# HG changeset patch # User chegar # Date 1368005315 -3600 # Node ID 66264fd9d5ddfb2b0140ecef7500bb2963e2d759 # Parent 1bfb28b29bc6f2cf3a5d354b04a0b13dfcc816c6# Parent 1935600c6f3439bffa1407acfef95ce403fd2fe3 Merge diff -r 1bfb28b29bc6 -r 66264fd9d5dd langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java Wed May 08 10:27:52 2013 +0100 +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java Wed May 08 10:28:35 2013 +0100 @@ -309,8 +309,41 @@ 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)" + DocletConstants.NL + + " if (targetPage.indexOf(\":\") != -1 || (targetPage != \"\" && !validURL(targetPage)))" + DocletConstants.NL + " targetPage = \"undefined\";" + DocletConstants.NL + + " function validURL(url) {" + DocletConstants.NL + + " if (!(url.indexOf(\".html\") == url.length - 5))" + DocletConstants.NL + + " return false;" + DocletConstants.NL + + " var allowNumber = false;" + DocletConstants.NL + + " var allowSep = false;" + DocletConstants.NL + + " var seenDot = false;" + DocletConstants.NL + + " for (var i = 0; i < url.length - 5; i++) {" + DocletConstants.NL + + " var ch = url.charAt(i);" + DocletConstants.NL + + " if ('a' <= ch && ch <= 'z' ||" + DocletConstants.NL + + " 'A' <= ch && ch <= 'Z' ||" + DocletConstants.NL + + " ch == '$' ||" + DocletConstants.NL + + " ch == '_') {" + DocletConstants.NL + + " allowNumber = true;" + DocletConstants.NL + + " allowSep = true;" + DocletConstants.NL + + " } else if ('0' <= ch && ch <= '9'" + DocletConstants.NL + + " || ch == '-') {" + DocletConstants.NL + + " if (!allowNumber)" + DocletConstants.NL + + " return false;" + DocletConstants.NL + + " } else if (ch == '/' || ch == '.') {" + DocletConstants.NL + + " if (!allowSep)" + DocletConstants.NL + + " return false;" + DocletConstants.NL + + " allowNumber = false;" + DocletConstants.NL + + " allowSep = false;" + DocletConstants.NL + + " if (ch == '.')" + DocletConstants.NL + + " seenDot = true;" + DocletConstants.NL + + " if (ch == '/' && seenDot)" + DocletConstants.NL + + " return false;" + DocletConstants.NL + + " } else {" + DocletConstants.NL + + " return false;"+ DocletConstants.NL + + " }" + 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 + diff -r 1bfb28b29bc6 -r 66264fd9d5dd langtools/test/com/sun/javadoc/testJavascript/TestJavascript.java --- a/langtools/test/com/sun/javadoc/testJavascript/TestJavascript.java Wed May 08 10:27:52 2013 +0100 +++ b/langtools/test/com/sun/javadoc/testJavascript/TestJavascript.java Wed May 08 10:28:35 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2013, 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 + * @bug 4665566 4855876 7025314 8012375 * @summary Verify that the output has the right javascript. * @author jamieh * @library ../lib/ @@ -35,7 +35,7 @@ public class TestJavascript extends JavadocTester { //Test information. - private static final String BUG_ID = "4665566-4855876"; + private static final String BUG_ID = "4665566-4855876-8012375"; //Javadoc arguments. private static final String[] ARGS = new String[] { @@ -53,8 +53,41 @@ " targetPage = \"\" + window.location.search;" + NL + " if (targetPage != \"\" && targetPage != \"undefined\")" + NL + " targetPage = targetPage.substring(1);" + NL + - " if (targetPage.indexOf(\":\") != -1)" + NL + + " if (targetPage.indexOf(\":\") != -1 || (targetPage != \"\" && !validURL(targetPage)))" + NL + " targetPage = \"undefined\";" + NL + + " function validURL(url) {" + NL + + " if (!(url.indexOf(\".html\") == url.length - 5))" + NL + + " return false;" + NL + + " var allowNumber = false;" + NL + + " var allowSep = false;" + NL + + " var seenDot = false;" + NL + + " for (var i = 0; i < url.length - 5; i++) {" + NL + + " var ch = url.charAt(i);" + NL + + " if ('a' <= ch && ch <= 'z' ||" + NL + + " 'A' <= ch && ch <= 'Z' ||" + NL + + " ch == '$' ||" + NL + + " ch == '_') {" + NL + + " allowNumber = true;" + NL + + " allowSep = true;" + NL + + " } else if ('0' <= ch && ch <= '9'" + NL + + " || ch == '-') {" + NL + + " if (!allowNumber)" + NL + + " return false;" + NL + + " } else if (ch == '/' || ch == '.') {" + NL + + " if (!allowSep)" + NL + + " return false;" + NL + + " allowNumber = false;" + NL + + " allowSep = false;" + NL + + " if (ch == '.')" + NL + + " seenDot = true;" + NL + + " if (ch == '/' && seenDot)" + NL + + " return false;" + NL + + " } else {" + NL + + " return false;" + NL + + " }" + NL + + " }" + NL + + " return true;" + NL + + " }" + NL + " function loadFrames() {" + NL + " if (targetPage != \"\" && targetPage != \"undefined\")" + NL + " top.classFrame.location = top.targetPage;" + NL +