8148985: javadoc "FRAMES" and "NO FRAMES" links not working correctly
Reviewed-by: jjg, ksrini
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java Wed Mar 02 19:09:38 2016 +0530
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java Wed Mar 02 21:27:01 2016 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -96,6 +96,7 @@
protected void generateFrameFile() throws IOException {
Content frame = getFrameDetails();
HtmlTree body = new HtmlTree(HtmlTag.BODY);
+ body.addAttr(HtmlAttr.ONLOAD, "loadFrames()");
if (configuration.allowTag(HtmlTag.MAIN)) {
HtmlTree main = HtmlTree.MAIN(frame);
body.addContent(main);
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java Wed Mar 02 19:09:38 2016 +0530
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java Wed Mar 02 21:27:01 2016 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -423,6 +423,10 @@
" }" + DocletConstants.NL +
" }" + DocletConstants.NL +
" return true;" + DocletConstants.NL +
+ " }" + DocletConstants.NL +
+ " function loadFrames() {" + DocletConstants.NL +
+ " if (targetPage != \"\" && targetPage != \"undefined\")" + DocletConstants.NL +
+ " top.classFrame.location = top.targetPage;" + DocletConstants.NL +
" }" + DocletConstants.NL;
RawHtml scriptContent = new RawHtml(scriptCode);
script.addContent(scriptContent);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FrameOutputWriter.java Wed Mar 02 19:09:38 2016 +0530
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FrameOutputWriter.java Wed Mar 02 21:27:01 2016 +0000
@@ -27,6 +27,7 @@
import java.io.*;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlAttr;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
@@ -102,6 +103,7 @@
protected void generateFrameFile() throws IOException {
Content frame = getFrameDetails();
HtmlTree body = new HtmlTree(HtmlTag.BODY);
+ body.addAttr(HtmlAttr.ONLOAD, "loadFrames()");
if (configuration.allowTag(HtmlTag.MAIN)) {
HtmlTree main = HtmlTree.MAIN(frame);
body.addContent(main);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlWriter.java Wed Mar 02 19:09:38 2016 +0530
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlWriter.java Wed Mar 02 21:27:01 2016 +0000
@@ -401,6 +401,10 @@
" }" + DocletConstants.NL +
" }" + DocletConstants.NL +
" return true;" + DocletConstants.NL +
+ " }" + DocletConstants.NL +
+ " function loadFrames() {" + DocletConstants.NL +
+ " if (targetPage != \"\" && targetPage != \"undefined\")" + DocletConstants.NL +
+ " top.classFrame.location = top.targetPage;" + DocletConstants.NL +
" }" + DocletConstants.NL;
RawHtml scriptContent = new RawHtml(scriptCode);
script.addContent(scriptContent);
--- a/langtools/test/com/sun/javadoc/testHtmlVersion/TestHtmlVersion.java Wed Mar 02 19:09:38 2016 +0530
+++ b/langtools/test/com/sun/javadoc/testHtmlVersion/TestHtmlVersion.java Wed Mar 02 21:27:01 2016 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8072945 8081854 8141492
+ * @bug 8072945 8081854 8141492 8148985
* @summary Test the version of HTML generated by the javadoc tool.
* @author bpatel
* @library ../lib
@@ -688,7 +688,7 @@
checkOutput("index.html", true,
"<!DOCTYPE HTML>",
"<link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheet.css\" title=\"Style\">",
- "<body>\n"
+ "<body onload=\"loadFrames()\">\n"
+ "<main role=\"main\">\n"
+ "<div class=\"mainContainer\">\n"
+ "<div class=\"leftContainer\">\n"
@@ -1599,7 +1599,7 @@
checkOutput("index.html", true,
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
"<link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheet.css\" title=\"Style\">",
- "<body>\n"
+ "<body onload=\"loadFrames()\">\n"
+ "<div class=\"mainContainer\">\n"
+ "<div class=\"leftContainer\">\n"
+ "<div class=\"leftTop\">\n"
--- a/langtools/test/com/sun/javadoc/testJavascript/TestJavascript.java Wed Mar 02 19:09:38 2016 +0530
+++ b/langtools/test/com/sun/javadoc/testJavascript/TestJavascript.java Wed Mar 02 21:27:01 2016 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -100,8 +100,15 @@
+ " }\n"
+ " return true;\n"
+ " }\n"
+ + " function loadFrames() {\n"
+ + " if (targetPage != \"\" && targetPage != \"undefined\")\n"
+ + " top.classFrame.location = top.targetPage;\n"
+ + " }\n"
+ "</script>");
+ checkOutput("index.html", true,
+ "<body onload=\"loadFrames()\"");
+
//Make sure title javascript only runs if is-external is not true
checkOutput("pkg/C.html", true,
" try {\n"
--- a/langtools/test/jdk/javadoc/doclet/testHtmlVersion/TestHtmlVersion.java Wed Mar 02 19:09:38 2016 +0530
+++ b/langtools/test/jdk/javadoc/doclet/testHtmlVersion/TestHtmlVersion.java Wed Mar 02 21:27:01 2016 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8072945 8081854 8141492
+ * @bug 8072945 8081854 8141492 8148985
* @summary Test the version of HTML generated by the javadoc tool.
* @author bpatel
* @library ../lib
@@ -599,7 +599,7 @@
checkOutput("index.html", true,
"<!DOCTYPE HTML>",
"<link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheet.css\" title=\"Style\">",
- "<body>\n"
+ "<body onload=\"loadFrames()\">\n"
+ "<main role=\"main\">\n"
+ "<div class=\"mainContainer\">\n"
+ "<div class=\"leftContainer\">\n"
@@ -1391,7 +1391,7 @@
checkOutput("index.html", true,
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
"<link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheet.css\" title=\"Style\">",
- "<body>\n"
+ "<body onload=\"loadFrames()\">\n"
+ "<div class=\"mainContainer\">\n"
+ "<div class=\"leftContainer\">\n"
+ "<div class=\"leftTop\">\n"
--- a/langtools/test/jdk/javadoc/doclet/testJavascript/TestJavascript.java Wed Mar 02 19:09:38 2016 +0530
+++ b/langtools/test/jdk/javadoc/doclet/testJavascript/TestJavascript.java Wed Mar 02 21:27:01 2016 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4665566 4855876 7025314 8012375 8015997 8016328 8024756
+ * @bug 4665566 4855876 7025314 8012375 8015997 8016328 8024756 8148985
* @summary Verify that the output has the right javascript.
* @author jamieh
* @library ../lib
@@ -100,8 +100,15 @@
+ " }\n"
+ " return true;\n"
+ " }\n"
+ + " function loadFrames() {\n"
+ + " if (targetPage != \"\" && targetPage != \"undefined\")\n"
+ + " top.classFrame.location = top.targetPage;\n"
+ + " }\n"
+ "</script>");
+ checkOutput("index.html", true,
+ "<body onload=\"loadFrames()\"");
+
//Make sure title javascript only runs if is-external is not true
checkOutput("pkg/C.html", true,
" try {\n"