equal
deleted
inserted
replaced
21 * questions. |
21 * questions. |
22 */ |
22 */ |
23 |
23 |
24 /* |
24 /* |
25 * @test |
25 * @test |
26 * @bug 4665566 4855876 7025314 8012375 8015997 |
26 * @bug 4665566 4855876 7025314 8012375 8015997 8016328 |
27 * @summary Verify that the output has the right javascript. |
27 * @summary Verify that the output has the right javascript. |
28 * @author jamieh |
28 * @author jamieh |
29 * @library ../lib/ |
29 * @library ../lib/ |
30 * @build JavadocTester |
30 * @build JavadocTester |
31 * @build TestJavascript |
31 * @build TestJavascript |
54 " if (targetPage != \"\" && targetPage != \"undefined\")" + NL + |
54 " if (targetPage != \"\" && targetPage != \"undefined\")" + NL + |
55 " targetPage = targetPage.substring(1);" + NL + |
55 " targetPage = targetPage.substring(1);" + NL + |
56 " if (targetPage.indexOf(\":\") != -1 || (targetPage != \"\" && !validURL(targetPage)))" + NL + |
56 " if (targetPage.indexOf(\":\") != -1 || (targetPage != \"\" && !validURL(targetPage)))" + NL + |
57 " targetPage = \"undefined\";" + NL + |
57 " targetPage = \"undefined\";" + NL + |
58 " function validURL(url) {" + NL + |
58 " function validURL(url) {" + NL + |
|
59 " try {" + NL + |
|
60 " url = decodeURIComponent(url);" + NL + |
|
61 " }" + NL + |
|
62 " catch (error) {" + NL + |
|
63 " return false;" + NL + |
|
64 " }" + NL + |
59 " var pos = url.indexOf(\".html\");" + NL + |
65 " var pos = url.indexOf(\".html\");" + NL + |
60 " if (pos == -1 || pos != url.length - 5)" + NL + |
66 " if (pos == -1 || pos != url.length - 5)" + NL + |
61 " return false;" + NL + |
67 " return false;" + NL + |
62 " var allowNumber = false;" + NL + |
68 " var allowNumber = false;" + NL + |
63 " var allowSep = false;" + NL + |
69 " var allowSep = false;" + NL + |
65 " for (var i = 0; i < url.length - 5; i++) {" + NL + |
71 " for (var i = 0; i < url.length - 5; i++) {" + NL + |
66 " var ch = url.charAt(i);" + NL + |
72 " var ch = url.charAt(i);" + NL + |
67 " if ('a' <= ch && ch <= 'z' ||" + NL + |
73 " if ('a' <= ch && ch <= 'z' ||" + NL + |
68 " 'A' <= ch && ch <= 'Z' ||" + NL + |
74 " 'A' <= ch && ch <= 'Z' ||" + NL + |
69 " ch == '$' ||" + NL + |
75 " ch == '$' ||" + NL + |
70 " ch == '_') {" + NL + |
76 " ch == '_' ||" + NL + |
|
77 " ch.charCodeAt(0) > 127) {" + NL + |
71 " allowNumber = true;" + NL + |
78 " allowNumber = true;" + NL + |
72 " allowSep = true;" + NL + |
79 " allowSep = true;" + NL + |
73 " } else if ('0' <= ch && ch <= '9'" + NL + |
80 " } else if ('0' <= ch && ch <= '9'" + NL + |
74 " || ch == '-') {" + NL + |
81 " || ch == '-') {" + NL + |
75 " if (!allowNumber)" + NL + |
82 " if (!allowNumber)" + NL + |