8012375: Improve Javadoc framing
Reviewed-by: mduigou, jlaskey
This commit is contained in:
parent
09a04066fd
commit
64831179a9
langtools
src/share/classes/com/sun/tools/doclets/formats/html/markup
test/com/sun/javadoc/testJavascript
@ -309,8 +309,41 @@ public class HtmlWriter {
|
||||
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 +
|
||||
|
@ -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 @@ public class TestJavascript extends JavadocTester {
|
||||
" 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 +
|
||||
|
Loading…
x
Reference in New Issue
Block a user