changeset 3266:fd9b6417c521 jdk8u111-b04

8151921: Improved page resolution Reviewed-by: jjg, ksrini
author bpatel
date Wed, 06 Jul 2016 20:07:09 -0700
parents f74918365a72
children 5710d574a99a
files src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java test/com/sun/javadoc/testJavascript/TestJavascript.java
diffstat 2 files changed, 13 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java	Tue Jul 05 15:03:58 2016 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java	Wed Jul 06 20:07:09 2016 -0700
@@ -380,11 +380,12 @@
         HtmlTree script = new HtmlTree(HtmlTag.SCRIPT);
         script.addAttr(HtmlAttr.TYPE, "text/javascript");
         String scriptCode = DocletConstants.NL +
-                "    targetPage = \"\" + window.location.search;" + DocletConstants.NL +
-                "    if (targetPage != \"\" && targetPage != \"undefined\")" + DocletConstants.NL +
-                "        targetPage = targetPage.substring(1);" + DocletConstants.NL +
-                "    if (targetPage.indexOf(\":\") != -1 || (targetPage != \"\" && !validURL(targetPage)))" + DocletConstants.NL +
-                "        targetPage = \"undefined\";" + DocletConstants.NL +
+                "    tmpTargetPage = \"\" + window.location.search;" + DocletConstants.NL +
+                "    if (tmpTargetPage != \"\" && tmpTargetPage != \"undefined\")" + DocletConstants.NL +
+                "        tmpTargetPage = tmpTargetPage.substring(1);" + DocletConstants.NL +
+                "    if (tmpTargetPage.indexOf(\":\") != -1 || (tmpTargetPage != \"\" && !validURL(tmpTargetPage)))" + DocletConstants.NL +
+                "        tmpTargetPage = \"undefined\";" + DocletConstants.NL +
+                "    targetPage = tmpTargetPage;" + DocletConstants.NL +
                 "    function validURL(url) {" + DocletConstants.NL +
                 "        try {" + DocletConstants.NL +
                 "            url = decodeURIComponent(url);" + DocletConstants.NL +
--- a/test/com/sun/javadoc/testJavascript/TestJavascript.java	Tue Jul 05 15:03:58 2016 -0700
+++ b/test/com/sun/javadoc/testJavascript/TestJavascript.java	Wed Jul 06 20:07:09 2016 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      4665566 4855876 7025314 8012375 8015997 8016328 8024756
+ * @bug      4665566 4855876 7025314 8012375 8015997 8016328 8024756 8151921
  * @summary  Verify that the output has the right javascript.
  * @author   jamieh
  * @library  ../lib/
@@ -50,11 +50,12 @@
             "<a href=\"index.html?TestJavascript.html\" target=\"_top\">Frames</a>"},
         {BUG_ID + FS + "index.html",
             "<script type=\"text/javascript\">" + NL +
-                        "    targetPage = \"\" + window.location.search;" + NL +
-            "    if (targetPage != \"\" && targetPage != \"undefined\")" + NL +
-            "        targetPage = targetPage.substring(1);" + NL +
-            "    if (targetPage.indexOf(\":\") != -1 || (targetPage != \"\" && !validURL(targetPage)))" + NL +
-            "        targetPage = \"undefined\";" + NL +
+            "    tmpTargetPage = \"\" + window.location.search;" + NL +
+            "    if (tmpTargetPage != \"\" && tmpTargetPage != \"undefined\")" + NL +
+            "        tmpTargetPage = tmpTargetPage.substring(1);" + NL +
+            "    if (tmpTargetPage.indexOf(\":\") != -1 || (tmpTargetPage != \"\" && !validURL(tmpTargetPage)))" + NL +
+            "        tmpTargetPage = \"undefined\";" + NL +
+            "    targetPage = tmpTargetPage;" + NL +
             "    function validURL(url) {" + NL +
             "        try {" + NL +
             "            url = decodeURIComponent(url);" + NL +