Title: [203443] trunk
Revision
203443
Author
[email protected]
Date
2016-07-19 22:09:51 -0700 (Tue, 19 Jul 2016)

Log Message

Fix null handling of several HTMLDocument attributes
https://bugs.webkit.org/show_bug.cgi?id=159923

Reviewed by Benjamin Poulain.

LayoutTests/imported/w3c:

Rebaseline now that more checks are passing.

* web-platform-tests/html/dom/reflection-sections-expected.txt:

Source/WebCore:

Fix null handling of several HTMLDocument attributes:
- https://html.spec.whatwg.org/multipage/dom.html#document
- https://html.spec.whatwg.org/multipage/obsolete.html#document-partial

In particular, null handling was incorrect in WebKit for 'dir',
'bgColor', 'fgColor', 'alinkColor', 'linkColor' and 'vlinkColor'.

Firefox and Chrome match the specification.

Test: fast/dom/HTMLDocument/null-handling.html

* html/HTMLDocument.idl:

LayoutTests:

Add layout test coverage. I have verified that this test is passing in
both Firefox and Chrome.

* fast/dom/HTMLDocument/null-handling-expected.txt: Added.
* fast/dom/HTMLDocument/null-handling.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (203442 => 203443)


--- trunk/LayoutTests/ChangeLog	2016-07-20 03:23:18 UTC (rev 203442)
+++ trunk/LayoutTests/ChangeLog	2016-07-20 05:09:51 UTC (rev 203443)
@@ -1,5 +1,18 @@
 2016-07-19  Chris Dumez  <[email protected]>
 
+        Fix null handling of several HTMLDocument attributes
+        https://bugs.webkit.org/show_bug.cgi?id=159923
+
+        Reviewed by Benjamin Poulain.
+
+        Add layout test coverage. I have verified that this test is passing in
+        both Firefox and Chrome.
+
+        * fast/dom/HTMLDocument/null-handling-expected.txt: Added.
+        * fast/dom/HTMLDocument/null-handling.html: Added.
+
+2016-07-19  Chris Dumez  <[email protected]>
+
         Document.createElementNS() / createAttributeNS() parameters should be mandatory
         https://bugs.webkit.org/show_bug.cgi?id=159938
 

Added: trunk/LayoutTests/fast/dom/HTMLDocument/null-handling-expected.txt (0 => 203443)


--- trunk/LayoutTests/fast/dom/HTMLDocument/null-handling-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLDocument/null-handling-expected.txt	2016-07-20 05:09:51 UTC (rev 203443)
@@ -0,0 +1,29 @@
+Tests null handling of several HTMLDocument attributes
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS htmlDocument.documentElement.getAttribute('dir') is null
+PASS htmlDocument.body.getAttribute('bgColor') is null
+PASS htmlDocument.body.getAttribute('text') is null
+PASS htmlDocument.body.getAttribute('alink') is null
+PASS htmlDocument.body.getAttribute('link') is null
+PASS htmlDocument.body.getAttribute('vlink') is null
+htmlDocument.dir = null
+PASS htmlDocument.documentElement.getAttribute('dir') is "null"
+htmlDocument.bgColor = null
+PASS htmlDocument.body.getAttribute('bgColor') is ""
+htmlDocument.bgColor = null
+PASS htmlDocument.body.getAttribute('bgColor') is ""
+htmlDocument.fgColor = null
+PASS htmlDocument.body.getAttribute('text') is ""
+htmlDocument.alinkColor = null
+PASS htmlDocument.body.getAttribute('alink') is ""
+htmlDocument.linkColor = null
+PASS htmlDocument.body.getAttribute('link') is ""
+htmlDocument.vlinkColor = null
+PASS htmlDocument.body.getAttribute('vlink') is ""
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/dom/HTMLDocument/null-handling.html (0 => 203443)


--- trunk/LayoutTests/fast/dom/HTMLDocument/null-handling.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLDocument/null-handling.html	2016-07-20 05:09:51 UTC (rev 203443)
@@ -0,0 +1,33 @@
+<DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script>
+description("Tests null handling of several HTMLDocument attributes");
+
+var htmlDocument = document.implementation.createHTMLDocument();
+shouldBeNull("htmlDocument.documentElement.getAttribute('dir')");
+shouldBeNull("htmlDocument.body.getAttribute('bgColor')");
+shouldBeNull("htmlDocument.body.getAttribute('text')");
+shouldBeNull("htmlDocument.body.getAttribute('alink')");
+shouldBeNull("htmlDocument.body.getAttribute('link')");
+shouldBeNull("htmlDocument.body.getAttribute('vlink')");
+
+evalAndLog("htmlDocument.dir = null");
+shouldBeEqualToString("htmlDocument.documentElement.getAttribute('dir')", "null");
+evalAndLog("htmlDocument.bgColor = null");
+shouldBeEqualToString("htmlDocument.body.getAttribute('bgColor')", "");
+evalAndLog("htmlDocument.bgColor = null");
+shouldBeEqualToString("htmlDocument.body.getAttribute('bgColor')", "");
+evalAndLog("htmlDocument.fgColor = null");
+shouldBeEqualToString("htmlDocument.body.getAttribute('text')", "");
+evalAndLog("htmlDocument.alinkColor = null");
+shouldBeEqualToString("htmlDocument.body.getAttribute('alink')", "");
+evalAndLog("htmlDocument.linkColor = null");
+shouldBeEqualToString("htmlDocument.body.getAttribute('link')", "");
+evalAndLog("htmlDocument.vlinkColor = null");
+shouldBeEqualToString("htmlDocument.body.getAttribute('vlink')", "");
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (203442 => 203443)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2016-07-20 03:23:18 UTC (rev 203442)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2016-07-20 05:09:51 UTC (rev 203443)
@@ -1,5 +1,16 @@
 2016-07-19  Chris Dumez  <[email protected]>
 
+        Fix null handling of several HTMLDocument attributes
+        https://bugs.webkit.org/show_bug.cgi?id=159923
+
+        Reviewed by Benjamin Poulain.
+
+        Rebaseline now that more checks are passing.
+
+        * web-platform-tests/html/dom/reflection-sections-expected.txt:
+
+2016-07-19  Chris Dumez  <[email protected]>
+
         Document.createElementNS() / createAttributeNS() parameters should be mandatory
         https://bugs.webkit.org/show_bug.cgi?id=159938
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-sections-expected.txt (203442 => 203443)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-sections-expected.txt	2016-07-20 03:23:18 UTC (rev 203442)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-sections-expected.txt	2016-07-20 05:09:51 UTC (rev 203443)
@@ -10012,7 +10012,7 @@
 PASS #document.fgColor (<body text>): IDL set to "\0" followed by getAttribute() 
 PASS #document.fgColor (<body text>): IDL set to "\0" followed by IDL get 
 PASS #document.fgColor (<body text>): IDL set to null should not throw 
-FAIL #document.fgColor (<body text>): IDL set to null followed by getAttribute() assert_equals: expected (string) "" but got (object) null
+PASS #document.fgColor (<body text>): IDL set to null followed by getAttribute() 
 PASS #document.fgColor (<body text>): IDL set to null followed by IDL get 
 PASS #document.fgColor (<body text>): IDL set to object "test-toString" should not throw 
 PASS #document.fgColor (<body text>): IDL set to object "test-toString" followed by getAttribute() 
@@ -10089,7 +10089,7 @@
 PASS #document.linkColor (<body link>): IDL set to "\0" followed by getAttribute() 
 PASS #document.linkColor (<body link>): IDL set to "\0" followed by IDL get 
 PASS #document.linkColor (<body link>): IDL set to null should not throw 
-FAIL #document.linkColor (<body link>): IDL set to null followed by getAttribute() assert_equals: expected (string) "" but got (object) null
+PASS #document.linkColor (<body link>): IDL set to null followed by getAttribute() 
 PASS #document.linkColor (<body link>): IDL set to null followed by IDL get 
 PASS #document.linkColor (<body link>): IDL set to object "test-toString" should not throw 
 PASS #document.linkColor (<body link>): IDL set to object "test-toString" followed by getAttribute() 
@@ -10166,7 +10166,7 @@
 PASS #document.vlinkColor (<body vlink>): IDL set to "\0" followed by getAttribute() 
 PASS #document.vlinkColor (<body vlink>): IDL set to "\0" followed by IDL get 
 PASS #document.vlinkColor (<body vlink>): IDL set to null should not throw 
-FAIL #document.vlinkColor (<body vlink>): IDL set to null followed by getAttribute() assert_equals: expected (string) "" but got (object) null
+PASS #document.vlinkColor (<body vlink>): IDL set to null followed by getAttribute() 
 PASS #document.vlinkColor (<body vlink>): IDL set to null followed by IDL get 
 PASS #document.vlinkColor (<body vlink>): IDL set to object "test-toString" should not throw 
 PASS #document.vlinkColor (<body vlink>): IDL set to object "test-toString" followed by getAttribute() 
@@ -10243,7 +10243,7 @@
 PASS #document.alinkColor (<body alink>): IDL set to "\0" followed by getAttribute() 
 PASS #document.alinkColor (<body alink>): IDL set to "\0" followed by IDL get 
 PASS #document.alinkColor (<body alink>): IDL set to null should not throw 
-FAIL #document.alinkColor (<body alink>): IDL set to null followed by getAttribute() assert_equals: expected (string) "" but got (object) null
+PASS #document.alinkColor (<body alink>): IDL set to null followed by getAttribute() 
 PASS #document.alinkColor (<body alink>): IDL set to null followed by IDL get 
 PASS #document.alinkColor (<body alink>): IDL set to object "test-toString" should not throw 
 PASS #document.alinkColor (<body alink>): IDL set to object "test-toString" followed by getAttribute() 
@@ -10320,7 +10320,7 @@
 PASS #document.bgColor (<body bgcolor>): IDL set to "\0" followed by getAttribute() 
 PASS #document.bgColor (<body bgcolor>): IDL set to "\0" followed by IDL get 
 PASS #document.bgColor (<body bgcolor>): IDL set to null should not throw 
-FAIL #document.bgColor (<body bgcolor>): IDL set to null followed by getAttribute() assert_equals: expected (string) "" but got (object) null
+PASS #document.bgColor (<body bgcolor>): IDL set to null followed by getAttribute() 
 PASS #document.bgColor (<body bgcolor>): IDL set to null followed by IDL get 
 PASS #document.bgColor (<body bgcolor>): IDL set to object "test-toString" should not throw 
 PASS #document.bgColor (<body bgcolor>): IDL set to object "test-toString" followed by getAttribute() 

Modified: trunk/Source/WebCore/ChangeLog (203442 => 203443)


--- trunk/Source/WebCore/ChangeLog	2016-07-20 03:23:18 UTC (rev 203442)
+++ trunk/Source/WebCore/ChangeLog	2016-07-20 05:09:51 UTC (rev 203443)
@@ -1,5 +1,25 @@
 2016-07-19  Chris Dumez  <[email protected]>
 
+        Fix null handling of several HTMLDocument attributes
+        https://bugs.webkit.org/show_bug.cgi?id=159923
+
+        Reviewed by Benjamin Poulain.
+
+        Fix null handling of several HTMLDocument attributes:
+        - https://html.spec.whatwg.org/multipage/dom.html#document
+        - https://html.spec.whatwg.org/multipage/obsolete.html#document-partial
+
+        In particular, null handling was incorrect in WebKit for 'dir',
+        'bgColor', 'fgColor', 'alinkColor', 'linkColor' and 'vlinkColor'.
+
+        Firefox and Chrome match the specification.
+
+        Test: fast/dom/HTMLDocument/null-handling.html
+
+        * html/HTMLDocument.idl:
+
+2016-07-19  Chris Dumez  <[email protected]>
+
         Document.createElementNS() / createAttributeNS() parameters should be mandatory
         https://bugs.webkit.org/show_bug.cgi?id=159938
 

Modified: trunk/Source/WebCore/html/HTMLDocument.idl (203442 => 203443)


--- trunk/Source/WebCore/html/HTMLDocument.idl	2016-07-20 03:23:18 UTC (rev 203442)
+++ trunk/Source/WebCore/html/HTMLDocument.idl	2016-07-20 05:09:51 UTC (rev 203443)
@@ -51,18 +51,16 @@
     readonly attribute long height;
 #endif
 
-    // FIXME: This should not have [TreatNullAs=LegacyNullString].
-    [TreatNullAs=LegacyNullString] attribute DOMString dir;
+    attribute DOMString dir;
 
     attribute DOMString designMode;
     readonly attribute DOMString compatMode;
 
     // Deprecated attributes.
-    // FIXME: These should not have [TreatNullAs=LegacyNullString].
-    [TreatNullAs=LegacyNullString] attribute DOMString bgColor;
-    [TreatNullAs=LegacyNullString] attribute DOMString fgColor;
-    [TreatNullAs=LegacyNullString] attribute DOMString alinkColor;
-    [TreatNullAs=LegacyNullString] attribute DOMString linkColor;
-    [TreatNullAs=LegacyNullString] attribute DOMString vlinkColor;
+    [TreatNullAs=EmptyString] attribute DOMString bgColor;
+    [TreatNullAs=EmptyString] attribute DOMString fgColor;
+    [TreatNullAs=EmptyString] attribute DOMString alinkColor;
+    [TreatNullAs=EmptyString] attribute DOMString linkColor;
+    [TreatNullAs=EmptyString] attribute DOMString vlinkColor;
 };
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to