blob: e1ba1e070fc2c69461825851fcfb6e4ab7007201 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# HG changeset patch
# User andrew
# Date 1371731018 18000
# Node ID b4954380fa25058f1a6cfb9cb96f78d90cf0fc5c
# Parent 445134ee98c84b6d139fab0f9a9d8718c686c63b
8012375: Improve Javadoc framing
Reviewed-by: mduigou, jlaskey
diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java
--- langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java
+++ langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -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 +
|