1.1 --- a/src/share/classes/com/sun/tools/doclint/Checker.java Tue Jul 12 14:52:08 2016 -0700 1.2 +++ b/src/share/classes/com/sun/tools/doclint/Checker.java Mon Jul 18 23:53:12 2016 +0300 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -126,7 +126,7 @@ 1.11 } 1.12 } 1.13 1.14 - private Deque<TagStackItem> tagStack; // TODO: maybe want to record starting tree as well 1.15 + private final Deque<TagStackItem> tagStack; // TODO: maybe want to record starting tree as well 1.16 private HtmlTag currHeaderTag; 1.17 1.18 private final int implicitHeaderLevel; 1.19 @@ -401,7 +401,16 @@ 1.20 break; 1.21 1.22 case OTHER: 1.23 - env.messages.error(HTML, tree, "dc.tag.not.allowed", treeName); 1.24 + switch (t) { 1.25 + case SCRIPT: 1.26 + // <script> may or may not be allowed, depending on --allow-script-in-comments 1.27 + // but we allow it here, and rely on a separate scanner to detect all uses 1.28 + // of JavaScript, including <script> tags, and use in attributes, etc. 1.29 + break; 1.30 + 1.31 + default: 1.32 + env.messages.error(HTML, tree, "dc.tag.not.allowed", treeName); 1.33 + } 1.34 return; 1.35 } 1.36 1.37 @@ -519,22 +528,27 @@ 1.38 if (!first) 1.39 env.messages.error(HTML, tree, "dc.attr.repeated", name); 1.40 } 1.41 - AttrKind k = currTag.getAttrKind(name); 1.42 - switch (k) { 1.43 - case OK: 1.44 - break; 1.45 1.46 - case INVALID: 1.47 - env.messages.error(HTML, tree, "dc.attr.unknown", name); 1.48 - break; 1.49 + // for now, doclint allows all attribute names beginning with "on" as event handler names, 1.50 + // without checking the validity or applicability of the name 1.51 + if (!name.toString().startsWith("on")) { 1.52 + AttrKind k = currTag.getAttrKind(name); 1.53 + switch (k) { 1.54 + case OK: 1.55 + break; 1.56 1.57 - case OBSOLETE: 1.58 - env.messages.warning(ACCESSIBILITY, tree, "dc.attr.obsolete", name); 1.59 - break; 1.60 + case INVALID: 1.61 + env.messages.error(HTML, tree, "dc.attr.unknown", name); 1.62 + break; 1.63 1.64 - case USE_CSS: 1.65 - env.messages.warning(ACCESSIBILITY, tree, "dc.attr.obsolete.use.css", name); 1.66 - break; 1.67 + case OBSOLETE: 1.68 + env.messages.warning(ACCESSIBILITY, tree, "dc.attr.obsolete", name); 1.69 + break; 1.70 + 1.71 + case USE_CSS: 1.72 + env.messages.warning(ACCESSIBILITY, tree, "dc.attr.obsolete.use.css", name); 1.73 + break; 1.74 + } 1.75 } 1.76 1.77 if (attr != null) { 1.78 @@ -643,6 +657,9 @@ 1.79 } 1.80 1.81 private void checkURI(AttributeTree tree, String uri) { 1.82 + // allow URIs beginning with javascript:, which would otherwise be rejected by the URI API. 1.83 + if (uri.startsWith("javascript:")) 1.84 + return; 1.85 try { 1.86 URI u = new URI(uri); 1.87 } catch (URISyntaxException e) {