Wed, 08 May 2013 10:28:35 +0100
Merge
1.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java Wed May 08 10:27:52 2013 +0100 1.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java Wed May 08 10:28:35 2013 +0100 1.3 @@ -309,8 +309,41 @@ 1.4 String scriptCode = DocletConstants.NL + " targetPage = \"\" + window.location.search;" + DocletConstants.NL + 1.5 " if (targetPage != \"\" && targetPage != \"undefined\")" + DocletConstants.NL + 1.6 " targetPage = targetPage.substring(1);" + DocletConstants.NL + 1.7 - " if (targetPage.indexOf(\":\") != -1)" + DocletConstants.NL + 1.8 + " if (targetPage.indexOf(\":\") != -1 || (targetPage != \"\" && !validURL(targetPage)))" + DocletConstants.NL + 1.9 " targetPage = \"undefined\";" + DocletConstants.NL + 1.10 + " function validURL(url) {" + DocletConstants.NL + 1.11 + " if (!(url.indexOf(\".html\") == url.length - 5))" + DocletConstants.NL + 1.12 + " return false;" + DocletConstants.NL + 1.13 + " var allowNumber = false;" + DocletConstants.NL + 1.14 + " var allowSep = false;" + DocletConstants.NL + 1.15 + " var seenDot = false;" + DocletConstants.NL + 1.16 + " for (var i = 0; i < url.length - 5; i++) {" + DocletConstants.NL + 1.17 + " var ch = url.charAt(i);" + DocletConstants.NL + 1.18 + " if ('a' <= ch && ch <= 'z' ||" + DocletConstants.NL + 1.19 + " 'A' <= ch && ch <= 'Z' ||" + DocletConstants.NL + 1.20 + " ch == '$' ||" + DocletConstants.NL + 1.21 + " ch == '_') {" + DocletConstants.NL + 1.22 + " allowNumber = true;" + DocletConstants.NL + 1.23 + " allowSep = true;" + DocletConstants.NL + 1.24 + " } else if ('0' <= ch && ch <= '9'" + DocletConstants.NL + 1.25 + " || ch == '-') {" + DocletConstants.NL + 1.26 + " if (!allowNumber)" + DocletConstants.NL + 1.27 + " return false;" + DocletConstants.NL + 1.28 + " } else if (ch == '/' || ch == '.') {" + DocletConstants.NL + 1.29 + " if (!allowSep)" + DocletConstants.NL + 1.30 + " return false;" + DocletConstants.NL + 1.31 + " allowNumber = false;" + DocletConstants.NL + 1.32 + " allowSep = false;" + DocletConstants.NL + 1.33 + " if (ch == '.')" + DocletConstants.NL + 1.34 + " seenDot = true;" + DocletConstants.NL + 1.35 + " if (ch == '/' && seenDot)" + DocletConstants.NL + 1.36 + " return false;" + DocletConstants.NL + 1.37 + " } else {" + DocletConstants.NL + 1.38 + " return false;"+ DocletConstants.NL + 1.39 + " }" + DocletConstants.NL + 1.40 + " }" + DocletConstants.NL + 1.41 + " return true;" + DocletConstants.NL + 1.42 + " }" + DocletConstants.NL + 1.43 " function loadFrames() {" + DocletConstants.NL + 1.44 " if (targetPage != \"\" && targetPage != \"undefined\")" + DocletConstants.NL + 1.45 " top.classFrame.location = top.targetPage;" + DocletConstants.NL +
2.1 --- a/test/com/sun/javadoc/testJavascript/TestJavascript.java Wed May 08 10:27:52 2013 +0100 2.2 +++ b/test/com/sun/javadoc/testJavascript/TestJavascript.java Wed May 08 10:28:35 2013 +0100 2.3 @@ -1,5 +1,5 @@ 2.4 /* 2.5 - * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. 2.6 + * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. 2.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.8 * 2.9 * This code is free software; you can redistribute it and/or modify it 2.10 @@ -23,7 +23,7 @@ 2.11 2.12 /* 2.13 * @test 2.14 - * @bug 4665566 4855876 7025314 2.15 + * @bug 4665566 4855876 7025314 8012375 2.16 * @summary Verify that the output has the right javascript. 2.17 * @author jamieh 2.18 * @library ../lib/ 2.19 @@ -35,7 +35,7 @@ 2.20 public class TestJavascript extends JavadocTester { 2.21 2.22 //Test information. 2.23 - private static final String BUG_ID = "4665566-4855876"; 2.24 + private static final String BUG_ID = "4665566-4855876-8012375"; 2.25 2.26 //Javadoc arguments. 2.27 private static final String[] ARGS = new String[] { 2.28 @@ -53,8 +53,41 @@ 2.29 " targetPage = \"\" + window.location.search;" + NL + 2.30 " if (targetPage != \"\" && targetPage != \"undefined\")" + NL + 2.31 " targetPage = targetPage.substring(1);" + NL + 2.32 - " if (targetPage.indexOf(\":\") != -1)" + NL + 2.33 + " if (targetPage.indexOf(\":\") != -1 || (targetPage != \"\" && !validURL(targetPage)))" + NL + 2.34 " targetPage = \"undefined\";" + NL + 2.35 + " function validURL(url) {" + NL + 2.36 + " if (!(url.indexOf(\".html\") == url.length - 5))" + NL + 2.37 + " return false;" + NL + 2.38 + " var allowNumber = false;" + NL + 2.39 + " var allowSep = false;" + NL + 2.40 + " var seenDot = false;" + NL + 2.41 + " for (var i = 0; i < url.length - 5; i++) {" + NL + 2.42 + " var ch = url.charAt(i);" + NL + 2.43 + " if ('a' <= ch && ch <= 'z' ||" + NL + 2.44 + " 'A' <= ch && ch <= 'Z' ||" + NL + 2.45 + " ch == '$' ||" + NL + 2.46 + " ch == '_') {" + NL + 2.47 + " allowNumber = true;" + NL + 2.48 + " allowSep = true;" + NL + 2.49 + " } else if ('0' <= ch && ch <= '9'" + NL + 2.50 + " || ch == '-') {" + NL + 2.51 + " if (!allowNumber)" + NL + 2.52 + " return false;" + NL + 2.53 + " } else if (ch == '/' || ch == '.') {" + NL + 2.54 + " if (!allowSep)" + NL + 2.55 + " return false;" + NL + 2.56 + " allowNumber = false;" + NL + 2.57 + " allowSep = false;" + NL + 2.58 + " if (ch == '.')" + NL + 2.59 + " seenDot = true;" + NL + 2.60 + " if (ch == '/' && seenDot)" + NL + 2.61 + " return false;" + NL + 2.62 + " } else {" + NL + 2.63 + " return false;" + NL + 2.64 + " }" + NL + 2.65 + " }" + NL + 2.66 + " return true;" + NL + 2.67 + " }" + NL + 2.68 " function loadFrames() {" + NL + 2.69 " if (targetPage != \"\" && targetPage != \"undefined\")" + NL + 2.70 " top.classFrame.location = top.targetPage;" + NL +