Title: [130203] trunk
Revision
130203
Author
a...@chromium.org
Date
2012-10-02 13:35:47 -0700 (Tue, 02 Oct 2012)

Log Message

createHTMLDocument() should not create a title element if the title argument is left out
https://bugs.webkit.org/show_bug.cgi?id=96694

Reviewed by Darin Adler.

In case the argument is not passed to createHTMLDocument we use a null string and check
for that before creating a title element.

Source/WebCore:

Test: fast/dom/DOMImplementation/createHTMLDocument-optional-title.html

* dom/DOMImplementation.cpp:
(WebCore::DOMImplementation::createHTMLDocument):
* dom/DOMImplementation.idl:

LayoutTests:

* fast/dom/DOMImplementation/createHTMLDocument-optional-title-expected.txt: Added.
* fast/dom/DOMImplementation/createHTMLDocument-optional-title.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (130202 => 130203)


--- trunk/LayoutTests/ChangeLog	2012-10-02 20:28:05 UTC (rev 130202)
+++ trunk/LayoutTests/ChangeLog	2012-10-02 20:35:47 UTC (rev 130203)
@@ -1,3 +1,16 @@
+2012-10-02  Erik Arvidsson  <a...@chromium.org>
+
+        createHTMLDocument() should not create a title element if the title argument is left out
+        https://bugs.webkit.org/show_bug.cgi?id=96694
+
+        Reviewed by Darin Adler.
+
+        In case the argument is not passed to createHTMLDocument we use a null string and check
+        for that before creating a title element.
+
+        * fast/dom/DOMImplementation/createHTMLDocument-optional-title-expected.txt: Added.
+        * fast/dom/DOMImplementation/createHTMLDocument-optional-title.html: Added.
+
 2012-10-02  Raphael Kubo da Costa  <raphael.kubo.da.co...@intel.com>
 
         Remove MSYS-related changes to the http testing infrastructure.

Added: trunk/LayoutTests/fast/dom/DOMImplementation/createHTMLDocument-optional-title-expected.txt (0 => 130203)


--- trunk/LayoutTests/fast/dom/DOMImplementation/createHTMLDocument-optional-title-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/DOMImplementation/createHTMLDocument-optional-title-expected.txt	2012-10-02 20:35:47 UTC (rev 130203)
@@ -0,0 +1,14 @@
+This tests optional title for createHTMLDocument
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.implementation.createHTMLDocument().querySelector("title") is null
+PASS document.implementation.createHTMLDocument(null).querySelector("title").textContent is "null"
+PASS document.implementation.createHTMLDocument(undefined).querySelector("title").textContent is "undefined"
+PASS document.implementation.createHTMLDocument("").querySelector("title").textContent is ""
+PASS document.implementation.createHTMLDocument("x").querySelector("title").textContent is "x"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/dom/DOMImplementation/createHTMLDocument-optional-title.html (0 => 130203)


--- trunk/LayoutTests/fast/dom/DOMImplementation/createHTMLDocument-optional-title.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/DOMImplementation/createHTMLDocument-optional-title.html	2012-10-02 20:35:47 UTC (rev 130203)
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<script src=""
+<script>
+description('This tests optional title for createHTMLDocument');
+
+shouldBeNull('document.implementation.createHTMLDocument().querySelector("title")');
+
+shouldBeEqualToString('document.implementation.createHTMLDocument(null).querySelector("title").textContent', 'null');
+shouldBeEqualToString('document.implementation.createHTMLDocument(undefined).querySelector("title").textContent', 'undefined');
+shouldBeEqualToString('document.implementation.createHTMLDocument("").querySelector("title").textContent', '');
+shouldBeEqualToString('document.implementation.createHTMLDocument("x").querySelector("title").textContent', 'x');
+
+</script>
+<script src=""
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (130202 => 130203)


--- trunk/Source/WebCore/ChangeLog	2012-10-02 20:28:05 UTC (rev 130202)
+++ trunk/Source/WebCore/ChangeLog	2012-10-02 20:35:47 UTC (rev 130203)
@@ -1,3 +1,19 @@
+2012-10-02  Erik Arvidsson  <a...@chromium.org>
+
+        createHTMLDocument() should not create a title element if the title argument is left out
+        https://bugs.webkit.org/show_bug.cgi?id=96694
+
+        Reviewed by Darin Adler.
+
+        In case the argument is not passed to createHTMLDocument we use a null string and check
+        for that before creating a title element.
+
+        Test: fast/dom/DOMImplementation/createHTMLDocument-optional-title.html
+
+        * dom/DOMImplementation.cpp:
+        (WebCore::DOMImplementation::createHTMLDocument):
+        * dom/DOMImplementation.idl:
+
 2012-10-02  David Grogan  <dgro...@chromium.org>
 
         IndexedDB: Don't wedge if page reloads with pending upgradeneeded

Modified: trunk/Source/WebCore/dom/DOMImplementation.cpp (130202 => 130203)


--- trunk/Source/WebCore/dom/DOMImplementation.cpp	2012-10-02 20:28:05 UTC (rev 130202)
+++ trunk/Source/WebCore/dom/DOMImplementation.cpp	2012-10-02 20:35:47 UTC (rev 130203)
@@ -372,7 +372,8 @@
     RefPtr<HTMLDocument> d = HTMLDocument::create(0, KURL());
     d->open();
     d->write("<!doctype html><html><body></body></html>");
-    d->setTitle(title);
+    if (!title.isNull())
+        d->setTitle(title);
     d->setSecurityOrigin(m_document->securityOrigin());
     d->setContextFeatures(m_document->contextFeatures());
     return d.release();

Modified: trunk/Source/WebCore/dom/DOMImplementation.idl (130202 => 130203)


--- trunk/Source/WebCore/dom/DOMImplementation.idl	2012-10-02 20:28:05 UTC (rev 130202)
+++ trunk/Source/WebCore/dom/DOMImplementation.idl	2012-10-02 20:35:47 UTC (rev 130203)
@@ -49,7 +49,7 @@
 
         // HTMLDOMImplementation interface from DOM Level 2 HTML
 
-        HTMLDocument createHTMLDocument(in [Optional=DefaultIsUndefined] DOMString title);
+        HTMLDocument createHTMLDocument(in [Optional=DefaultIsNullString] DOMString title);
     };
 
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to