Merge jdk8u5-b04

Mon, 13 Jan 2014 15:42:19 -0800

author
asaha
date
Mon, 13 Jan 2014 15:42:19 -0800
changeset 2321
019dcdfffced
parent 2320
f6737cc3e7ee
parent 2319
bd5898d93742
child 2322
b9b9153a92d1

Merge

     1.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java	Fri Jan 10 11:43:01 2014 -0800
     1.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java	Mon Jan 13 15:42:19 2014 -0800
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 1998, 2014, 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 @@ -247,7 +247,7 @@
    1.11              } else if (opt.equals("-doctitle")) {
    1.12                  doctitle = os[1];
    1.13              } else if (opt.equals("-windowtitle")) {
    1.14 -                windowtitle = os[1];
    1.15 +                windowtitle = os[1].replaceAll("\\<.*?>", "");
    1.16              } else if (opt.equals("-top")) {
    1.17                  top = os[1];
    1.18              } else if (opt.equals("-bottom")) {
     2.1 --- a/test/com/sun/javadoc/testWindowTitle/TestWindowTitle.java	Fri Jan 10 11:43:01 2014 -0800
     2.2 +++ b/test/com/sun/javadoc/testWindowTitle/TestWindowTitle.java	Mon Jan 13 15:42:19 2014 -0800
     2.3 @@ -1,5 +1,5 @@
     2.4  /*
     2.5 - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
     2.6 + * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
     2.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.8   *
     2.9   * This code is free software; you can redistribute it and/or modify it
    2.10 @@ -23,7 +23,7 @@
    2.11  
    2.12  /*
    2.13   * @test
    2.14 - * @bug 8016675
    2.15 + * @bug 8016675 8026736
    2.16   * @summary Test for window title.
    2.17   * @author Bhavesh Patel
    2.18   * @library ../lib/
    2.19 @@ -34,26 +34,153 @@
    2.20  public class TestWindowTitle extends JavadocTester {
    2.21  
    2.22      private static final String BUG_ID = "8016675";
    2.23 -    private static final String WIN_TITLE =
    2.24 +    //Window title with JavaScript special characters.
    2.25 +    private static final String TITLE_JS_CHARS =
    2.26              "Testing \"Window 'Title'\" with a \\ backslash and a / " +
    2.27              "forward slash and a \u00e8 unicode char also a    tab and also a " +
    2.28              "\t special character another \u0002 unicode)";
    2.29 -    private static final String[][] TEST = {
    2.30 -        {BUG_ID + FS  + "overview-summary.html",
    2.31 +    private static final String[] ARGS_JS_CHARS = new String[]{
    2.32 +        "-d", BUG_ID + "-1", "-windowtitle", TITLE_JS_CHARS, "-sourcepath", SRC_DIR, "p1", "p2"
    2.33 +    };
    2.34 +    private static final String[][] TEST_JS_CHARS = {
    2.35 +        {BUG_ID + "-1" + FS + "overview-summary.html",
    2.36              "parent.document.title=\"Overview (Testing \\\"Window \\\'Title\\\'\\\" " +
    2.37              "with a \\\\ backslash and a / forward slash and a \\u00E8 unicode char " +
    2.38              "also a    tab and also a \\t special character another \\u0002 unicode))\";"
    2.39          },
    2.40      };
    2.41 -    private static final String[][] NEG_TEST = {
    2.42 -        {BUG_ID + FS + "overview-summary.html",
    2.43 +    private static final String[][] NEG_TEST_JS_CHARS = {
    2.44 +        {BUG_ID + "-1" + FS + "overview-summary.html",
    2.45              "parent.document.title=\"Overview (Testing \"Window \'Title\'\" " +
    2.46              "with a \\ backslash and a / forward slash and a \u00E8 unicode char " +
    2.47              "also a    tab and also a \t special character another \u0002 unicode))\";"
    2.48 +        }
    2.49 +    };
    2.50 +
    2.51 +    //Window title with a script tag.
    2.52 +    private static final String TITLE_SCRIPT_TAG =
    2.53 +            "Testing script tag in title </title><script>alert(\"Should not pop up\")</script>.";
    2.54 +    private static final String[] ARGS_SCRIPT_TAG = new String[]{
    2.55 +        "-d", BUG_ID + "-2", "-windowtitle", TITLE_SCRIPT_TAG, "-sourcepath", SRC_DIR, "p1", "p2"
    2.56 +    };
    2.57 +    private static final String[][] TEST_SCRIPT_TAG = {
    2.58 +        {BUG_ID + "-2" + FS + "overview-summary.html",
    2.59 +            "parent.document.title=\"Overview (Testing script tag in title alert" +
    2.60 +            "(\\\"Should not pop up\\\").)\";"
    2.61          },
    2.62 +        {BUG_ID + "-2" + FS + "p2" + FS + "C2.html",
    2.63 +            "parent.document.title=\"C2 (Testing script tag in title alert" +
    2.64 +            "(\\\"Should not pop up\\\").)\";"
    2.65 +        }
    2.66      };
    2.67 -    private static final String[] ARGS = new String[]{
    2.68 -        "-d", BUG_ID, "-windowtitle", WIN_TITLE, "-sourcepath", SRC_DIR, "p1", "p2"
    2.69 +    private static final String[][] NEG_TEST_SCRIPT_TAG = {
    2.70 +        {BUG_ID + "-2" + FS + "overview-summary.html",
    2.71 +            "parent.document.title=\"Overview (Testing script tag in title </title><script>" +
    2.72 +            "alert(\\\"Should not pop up\\\")</script>.)\";"
    2.73 +        },
    2.74 +        {BUG_ID + "-2" + FS + "p2" + FS + "C2.html",
    2.75 +            "parent.document.title=\"C2 (Testing script tag in title </title><script>" +
    2.76 +            "alert(\\\"Should not pop up\\\")</script>.)\";"
    2.77 +        }
    2.78 +    };
    2.79 +
    2.80 +    //Window title with other HTML tags.
    2.81 +    private static final String TITLE_HTML_TAGS =
    2.82 +            "Testing another <p>HTML</p> tag. Another <h1>tag</h1>. A " +
    2.83 +            "<span id=\"testTag\">tag with attributes</span>. <script and </p are not tags.";
    2.84 +    private static final String[] ARGS_HTML_TAGS = new String[]{
    2.85 +        "-d", BUG_ID + "-3", "-windowtitle", TITLE_HTML_TAGS, "-sourcepath", SRC_DIR, "p1", "p2"
    2.86 +    };
    2.87 +    private static final String[][] TEST_HTML_TAGS = {
    2.88 +        {BUG_ID + "-3" + FS + "overview-summary.html",
    2.89 +            "parent.document.title=\"Overview (Testing another HTML tag. Another tag. A " +
    2.90 +            "tag with attributes. <script and </p are not tags.)\";"
    2.91 +        }
    2.92 +    };
    2.93 +    private static final String[][] NEG_TEST_HTML_TAGS = {
    2.94 +        {BUG_ID + "-3" + FS + "overview-summary.html",
    2.95 +            "parent.document.title=\"Overview (Testing another <p>HTML</p> tag. Another " +
    2.96 +            "<h1>tag</h1>. A <span id=\"testTag\">tag with attributes</span>. <script and " +
    2.97 +            "</p are not tags.)\";"
    2.98 +        }
    2.99 +    };
   2.100 +
   2.101 +    //Window title using entities.
   2.102 +    private static final String TITLE_HTML_ENTITIES =
   2.103 +            "Testing entities &lt;script&gt;alert(\"Should not pop up\")&lt;/script&gt;.";
   2.104 +    private static final String[] ARGS_HTML_ENTITIES = new String[]{
   2.105 +        "-d", BUG_ID + "-4", "-windowtitle", TITLE_HTML_ENTITIES, "-sourcepath", SRC_DIR, "p1", "p2"
   2.106 +    };
   2.107 +    private static final String[][] TEST_HTML_ENTITIES = {
   2.108 +        {BUG_ID + "-4" + FS + "overview-summary.html",
   2.109 +            "parent.document.title=\"Overview (Testing entities &lt;script&gt;alert(\\\"Should " +
   2.110 +            "not pop up\\\")&lt;/script&gt;.)\";"
   2.111 +        }
   2.112 +    };
   2.113 +    private static final String[][] NEG_TEST_HTML_ENTITIES = {
   2.114 +        {BUG_ID + "-4" + FS  + "overview-summary.html",
   2.115 +            "parent.document.title=\"Overview (Testing entities alert(\\\"Should not pop up\\\").)\";"
   2.116 +        }
   2.117 +    };
   2.118 +
   2.119 +    //Window title with just empty HTML tags.
   2.120 +    private static final String TITLE_EMPTY_TAGS =
   2.121 +            "</title><script></script>";
   2.122 +    private static final String[] ARGS_EMPTY_TAGS = new String[]{
   2.123 +        "-d", BUG_ID + "-5", "-windowtitle", TITLE_EMPTY_TAGS, "-sourcepath", SRC_DIR, "p1", "p2"
   2.124 +    };
   2.125 +    private static final String[][] TEST_EMPTY_TAGS = {
   2.126 +        {BUG_ID + "-5" + FS + "overview-summary.html",
   2.127 +            "parent.document.title=\"Overview\";"
   2.128 +        }
   2.129 +    };
   2.130 +    private static final String[][] NEG_TEST_EMPTY_TAGS = {
   2.131 +        {BUG_ID + "-5" + FS + "overview-summary.html",
   2.132 +            "parent.document.title=\"Overview (</title><script></script>)\";"
   2.133 +        }
   2.134 +    };
   2.135 +
   2.136 +    //Window title with unicode characters.
   2.137 +    private static final String TITLE_UNICODE_CHARS =
   2.138 +            "Testing unicode \u003cscript\u003ealert(\"Should not pop up\")\u003c/script\u003e.";
   2.139 +    private static final String[] ARGS_UNICODE_CHARS = new String[]{
   2.140 +        "-d", BUG_ID + "-6", "-windowtitle", TITLE_UNICODE_CHARS, "-sourcepath", SRC_DIR, "p1", "p2"
   2.141 +    };
   2.142 +    private static final String[][] TEST_UNICODE_CHARS = {
   2.143 +        {BUG_ID + "-6" + FS + "overview-summary.html",
   2.144 +            "parent.document.title=\"Overview (Testing unicode alert(\\\"Should " +
   2.145 +            "not pop up\\\").)\";"
   2.146 +        }
   2.147 +    };
   2.148 +    private static final String[][] NEG_TEST_UNICODE_CHARS = {
   2.149 +        {BUG_ID + "-6" + FS + "overview-summary.html",
   2.150 +            "parent.document.title=\"Overview (Testing unicode <script>alert(\\\"Should not pop up\\\")" +
   2.151 +            "</script>.)\";"
   2.152 +        }
   2.153 +    };
   2.154 +
   2.155 +    //An empty window title.
   2.156 +    private static final String TITLE_EMPTY =
   2.157 +            "";
   2.158 +    private static final String[] ARGS_EMPTY_TITLE = new String[]{
   2.159 +        "-d", BUG_ID + "-7", "-windowtitle", TITLE_EMPTY, "-sourcepath", SRC_DIR, "p1", "p2"
   2.160 +    };
   2.161 +    private static final String[][] TEST_EMPTY = {
   2.162 +        {BUG_ID + "-7" + FS + "overview-summary.html",
   2.163 +            "parent.document.title=\"Overview\";"
   2.164 +        }
   2.165 +    };
   2.166 +
   2.167 +    //Test doctitle.
   2.168 +    private static final String[] ARGS_DOCTITLE = new String[]{
   2.169 +        "-d", BUG_ID + "-8", "-doctitle", TITLE_JS_CHARS, "-sourcepath", SRC_DIR, "p1", "p2"
   2.170 +    };
   2.171 +    private static final String[][] NEG_TEST_DOCTITLE = {
   2.172 +        {BUG_ID + "-8" + FS + "overview-summary.html",
   2.173 +            "parent.document.title=\"Overview (Testing \\\"Window \\\'Title\\\'\\\" " +
   2.174 +            "with a \\\\ backslash and a / forward slash and a \\u00E8 unicode char " +
   2.175 +            "also a    tab and also a \\t special character another \\u0002 unicode)\";"
   2.176 +        },
   2.177      };
   2.178  
   2.179      /**
   2.180 @@ -62,7 +189,14 @@
   2.181       */
   2.182      public static void main(String[] args) {
   2.183          TestWindowTitle tester = new TestWindowTitle();
   2.184 -        run(tester, ARGS, TEST, NEG_TEST);
   2.185 +        run(tester, ARGS_JS_CHARS, TEST_JS_CHARS, NEG_TEST_JS_CHARS);
   2.186 +        run(tester, ARGS_SCRIPT_TAG, TEST_SCRIPT_TAG, NEG_TEST_SCRIPT_TAG);
   2.187 +        run(tester, ARGS_HTML_TAGS, TEST_HTML_TAGS, NEG_TEST_HTML_TAGS);
   2.188 +        run(tester, ARGS_HTML_ENTITIES, TEST_HTML_ENTITIES, NEG_TEST_HTML_ENTITIES);
   2.189 +        run(tester, ARGS_EMPTY_TAGS, TEST_EMPTY_TAGS, NEG_TEST_EMPTY_TAGS);
   2.190 +        run(tester, ARGS_UNICODE_CHARS, TEST_UNICODE_CHARS, NEG_TEST_UNICODE_CHARS);
   2.191 +        run(tester, ARGS_EMPTY_TITLE, TEST_EMPTY, NO_TEST);
   2.192 +        run(tester, ARGS_DOCTITLE, NO_TEST, NEG_TEST_DOCTITLE);
   2.193          tester.printSummary();
   2.194      }
   2.195  

mercurial