# HG changeset patch # User asaha # Date 1389656539 28800 # Node ID 019dcdfffced0ca2026a0ad8c0e5fcb49d46116f # Parent f6737cc3e7eecf3e4fce9ba1d6a9a8814ba00517# Parent bd5898d93742d8a99b9d41d05d9f429e243a4360 Merge diff -r f6737cc3e7ee -r 019dcdfffced src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java Fri Jan 10 11:43:01 2014 -0800 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java Mon Jan 13 15:42:19 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, 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 @@ -247,7 +247,7 @@ } else if (opt.equals("-doctitle")) { doctitle = os[1]; } else if (opt.equals("-windowtitle")) { - windowtitle = os[1]; + windowtitle = os[1].replaceAll("\\<.*?>", ""); } else if (opt.equals("-top")) { top = os[1]; } else if (opt.equals("-bottom")) { diff -r f6737cc3e7ee -r 019dcdfffced test/com/sun/javadoc/testWindowTitle/TestWindowTitle.java --- a/test/com/sun/javadoc/testWindowTitle/TestWindowTitle.java Fri Jan 10 11:43:01 2014 -0800 +++ b/test/com/sun/javadoc/testWindowTitle/TestWindowTitle.java Mon Jan 13 15:42:19 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2014, 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 8016675 + * @bug 8016675 8026736 * @summary Test for window title. * @author Bhavesh Patel * @library ../lib/ @@ -34,26 +34,153 @@ public class TestWindowTitle extends JavadocTester { private static final String BUG_ID = "8016675"; - private static final String WIN_TITLE = + //Window title with JavaScript special characters. + private static final String TITLE_JS_CHARS = "Testing \"Window 'Title'\" with a \\ backslash and a / " + "forward slash and a \u00e8 unicode char also a tab and also a " + "\t special character another \u0002 unicode)"; - private static final String[][] TEST = { - {BUG_ID + FS + "overview-summary.html", + private static final String[] ARGS_JS_CHARS = new String[]{ + "-d", BUG_ID + "-1", "-windowtitle", TITLE_JS_CHARS, "-sourcepath", SRC_DIR, "p1", "p2" + }; + private static final String[][] TEST_JS_CHARS = { + {BUG_ID + "-1" + FS + "overview-summary.html", "parent.document.title=\"Overview (Testing \\\"Window \\\'Title\\\'\\\" " + "with a \\\\ backslash and a / forward slash and a \\u00E8 unicode char " + "also a tab and also a \\t special character another \\u0002 unicode))\";" }, }; - private static final String[][] NEG_TEST = { - {BUG_ID + FS + "overview-summary.html", + private static final String[][] NEG_TEST_JS_CHARS = { + {BUG_ID + "-1" + FS + "overview-summary.html", "parent.document.title=\"Overview (Testing \"Window \'Title\'\" " + "with a \\ backslash and a / forward slash and a \u00E8 unicode char " + "also a tab and also a \t special character another \u0002 unicode))\";" + } + }; + + //Window title with a script tag. + private static final String TITLE_SCRIPT_TAG = + "Testing script tag in title ."; + private static final String[] ARGS_SCRIPT_TAG = new String[]{ + "-d", BUG_ID + "-2", "-windowtitle", TITLE_SCRIPT_TAG, "-sourcepath", SRC_DIR, "p1", "p2" + }; + private static final String[][] TEST_SCRIPT_TAG = { + {BUG_ID + "-2" + FS + "overview-summary.html", + "parent.document.title=\"Overview (Testing script tag in title alert" + + "(\\\"Should not pop up\\\").)\";" }, + {BUG_ID + "-2" + FS + "p2" + FS + "C2.html", + "parent.document.title=\"C2 (Testing script tag in title alert" + + "(\\\"Should not pop up\\\").)\";" + } }; - private static final String[] ARGS = new String[]{ - "-d", BUG_ID, "-windowtitle", WIN_TITLE, "-sourcepath", SRC_DIR, "p1", "p2" + private static final String[][] NEG_TEST_SCRIPT_TAG = { + {BUG_ID + "-2" + FS + "overview-summary.html", + "parent.document.title=\"Overview (Testing script tag in title .)\";" + }, + {BUG_ID + "-2" + FS + "p2" + FS + "C2.html", + "parent.document.title=\"C2 (Testing script tag in title .)\";" + } + }; + + //Window title with other HTML tags. + private static final String TITLE_HTML_TAGS = + "Testing another
HTML
tag. Another