Title: [195152] trunk
Revision
195152
Author
[email protected]
Date
2016-01-15 15:06:32 -0800 (Fri, 15 Jan 2016)

Log Message

createElementNS and createAttributeNS should treat undefined namespaceURI as null string
https://bugs.webkit.org/show_bug.cgi?id=153119

Reviewed by Chris Dumez.

LayoutTests/imported/w3c:

Rebaseline a test now that more test cases are passing.

* web-platform-tests/dom/nodes/Document-createElementNS-expected.txt:

Source/WebCore:

Treat undefined as null in document.createElementNS and document.createAttributeNS as defined in:
https://dom.spec.whatwg.org/#document

Test: fast/dom/Document/createAttributeNS-undefined-namespace.html

* dom/Document.idl:

LayoutTests:

Add a regression test for calling createAttributeNS with undefined namespaceURI.

* fast/dom/Document/createAttributeNS-undefined-namespace-expected.txt: Added.
* fast/dom/Document/createAttributeNS-undefined-namespace.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (195151 => 195152)


--- trunk/LayoutTests/ChangeLog	2016-01-15 23:03:02 UTC (rev 195151)
+++ trunk/LayoutTests/ChangeLog	2016-01-15 23:06:32 UTC (rev 195152)
@@ -1,3 +1,15 @@
+2016-01-15  Ryosuke Niwa  <[email protected]>
+
+        createElementNS and createAttributeNS should treat undefined namespaceURI as null string
+        https://bugs.webkit.org/show_bug.cgi?id=153119
+
+        Reviewed by Chris Dumez.
+
+        Add a regression test for calling createAttributeNS with undefined namespaceURI.
+
+        * fast/dom/Document/createAttributeNS-undefined-namespace-expected.txt: Added.
+        * fast/dom/Document/createAttributeNS-undefined-namespace.html: Added.
+
 2016-01-15  Jiewen Tan  <[email protected]>
 
         Refine http/tests/contentdispositionattachmentsandbox/referer-header-stripped-with-meta-referer*

Added: trunk/LayoutTests/fast/dom/Document/createAttributeNS-undefined-namespace-expected.txt (0 => 195152)


--- trunk/LayoutTests/fast/dom/Document/createAttributeNS-undefined-namespace-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/Document/createAttributeNS-undefined-namespace-expected.txt	2016-01-15 23:06:32 UTC (rev 195152)
@@ -0,0 +1,15 @@
+Test calling createAttributeNS with undefined as the namespace URI. It should treat it as null.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+element = document.createElement("div"); attr = document.createAttributeNS(undefined, "foo")
+PASS attr.prefix is null
+PASS attr.localName is "foo"
+PASS attr.namespaceURI is null
+PASS element.getAttributeNodeNS(null, "foo") is null
+PASS element.setAttributeNode(attr); element.getAttributeNodeNS(null, "foo") is attr
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/dom/Document/createAttributeNS-undefined-namespace.html (0 => 195152)


--- trunk/LayoutTests/fast/dom/Document/createAttributeNS-undefined-namespace.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/Document/createAttributeNS-undefined-namespace.html	2016-01-15 23:06:32 UTC (rev 195152)
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script>
+
+description('Test calling createAttributeNS with undefined as the namespace URI. It should treat it as null.');
+
+evalAndLog('element = document.createElement("div"); attr = document.createAttributeNS(undefined, "foo")');
+shouldBeNull('attr.prefix');
+shouldBeEqualToString('attr.localName', 'foo');
+shouldBeNull('attr.namespaceURI');
+shouldBeNull('element.getAttributeNodeNS(null, "foo")');
+shouldBe('element.setAttributeNode(attr); element.getAttributeNodeNS(null, "foo")', 'attr');
+
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (195151 => 195152)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2016-01-15 23:03:02 UTC (rev 195151)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2016-01-15 23:06:32 UTC (rev 195152)
@@ -1,3 +1,14 @@
+2016-01-15  Ryosuke Niwa  <[email protected]>
+
+        createElementNS and createAttributeNS should treat undefined namespaceURI as null string
+        https://bugs.webkit.org/show_bug.cgi?id=153119
+
+        Reviewed by Chris Dumez.
+
+        Rebaseline a test now that more test cases are passing.
+
+        * web-platform-tests/dom/nodes/Document-createElementNS-expected.txt:
+
 2016-01-15  Youenn Fablet  <[email protected]>
 
         [Streams API] Expose ReadableStream and relatives to Worker

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Document-createElementNS-expected.txt (195151 => 195152)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Document-createElementNS-expected.txt	2016-01-15 23:03:02 UTC (rev 195151)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Document-createElementNS-expected.txt	2016-01-15 23:06:32 UTC (rev 195152)
@@ -32,20 +32,20 @@
 PASS createElementNS test 29: "",":foo","NAMESPACE_ERR" 
 PASS createElementNS test 30: "","f:oo","NAMESPACE_ERR" 
 PASS createElementNS test 31: "","foo:","NAMESPACE_ERR" 
-FAIL createElementNS test 32: undefined,undefined,null assert_equals: expected (object) null but got (string) "undefined"
-FAIL createElementNS test 33: undefined,"foo",null assert_equals: expected (object) null but got (string) "undefined"
+PASS createElementNS test 32: undefined,undefined,null 
+PASS createElementNS test 33: undefined,"foo",null 
 PASS createElementNS test 34: undefined,"1foo","INVALID_CHARACTER_ERR" 
-FAIL createElementNS test 35: undefined,"f1oo",null assert_equals: expected (object) null but got (string) "undefined"
-FAIL createElementNS test 36: undefined,"foo1",null assert_equals: expected (object) null but got (string) "undefined"
+PASS createElementNS test 35: undefined,"f1oo",null 
+PASS createElementNS test 36: undefined,"foo1",null 
 PASS createElementNS test 37: undefined,":foo","NAMESPACE_ERR" 
-FAIL createElementNS test 38: undefined,"f:oo","NAMESPACE_ERR" assert_throws: function "function () { document.createElementNS(namespace, qualifi..." did not throw
+PASS createElementNS test 38: undefined,"f:oo","NAMESPACE_ERR" 
 PASS createElementNS test 39: undefined,"foo:","NAMESPACE_ERR" 
-FAIL createElementNS test 40: undefined,"xml",null assert_equals: expected (object) null but got (string) "undefined"
+PASS createElementNS test 40: undefined,"xml",null 
 PASS createElementNS test 41: undefined,"xmlns","NAMESPACE_ERR" 
-FAIL createElementNS test 42: undefined,"xmlfoo",null assert_equals: expected (object) null but got (string) "undefined"
+PASS createElementNS test 42: undefined,"xmlfoo",null 
 PASS createElementNS test 43: undefined,"xml:foo","NAMESPACE_ERR" 
 PASS createElementNS test 44: undefined,"xmlns:foo","NAMESPACE_ERR" 
-FAIL createElementNS test 45: undefined,"xmlfoo:bar","NAMESPACE_ERR" assert_throws: function "function () { document.createElementNS(namespace, qualifi..." did not throw
+PASS createElementNS test 45: undefined,"xmlfoo:bar","NAMESPACE_ERR" 
 PASS createElementNS test 46: "http://example.com/","foo",null 
 PASS createElementNS test 47: "http://example.com/","1foo","INVALID_CHARACTER_ERR" 
 PASS createElementNS test 48: "http://example.com/","f1oo",null 
@@ -159,7 +159,7 @@
 FAIL createElementNS test 156: null,null,null InvalidCharacterError: DOM Exception 5
 PASS createElementNS test 157: null,"","INVALID_CHARACTER_ERR" 
 FAIL createElementNS test 158: undefined,null,null InvalidCharacterError: DOM Exception 5
-FAIL createElementNS test 159: undefined,undefined,null assert_equals: expected (object) null but got (string) "undefined"
+PASS createElementNS test 159: undefined,undefined,null 
 PASS createElementNS test 160: undefined,"","INVALID_CHARACTER_ERR" 
 FAIL createElementNS test 161: "http://example.com/",null,null InvalidCharacterError: DOM Exception 5
 PASS createElementNS test 162: "http://example.com/","","INVALID_CHARACTER_ERR" 
@@ -180,6 +180,6 @@
 PASS Upper-case non-HTML element without a prefix 
 PASS Upper-case non-HTML element with a prefix 
 PASS null namespace 
-FAIL undefined namespace assert_equals: expected (object) null but got (string) "undefined"
+PASS undefined namespace 
 PASS empty string namespace 
 

Modified: trunk/Source/WebCore/ChangeLog (195151 => 195152)


--- trunk/Source/WebCore/ChangeLog	2016-01-15 23:03:02 UTC (rev 195151)
+++ trunk/Source/WebCore/ChangeLog	2016-01-15 23:06:32 UTC (rev 195152)
@@ -1,3 +1,17 @@
+2016-01-15  Ryosuke Niwa  <[email protected]>
+
+        createElementNS and createAttributeNS should treat undefined namespaceURI as null string
+        https://bugs.webkit.org/show_bug.cgi?id=153119
+
+        Reviewed by Chris Dumez.
+
+        Treat undefined as null in document.createElementNS and document.createAttributeNS as defined in:
+        https://dom.spec.whatwg.org/#document
+
+        Test: fast/dom/Document/createAttributeNS-undefined-namespace.html
+
+        * dom/Document.idl:
+
 2016-01-15  Myles C. Maxfield  <[email protected]>
 
         [Cocoa] Font features are not applied to the system font

Modified: trunk/Source/WebCore/dom/Document.idl (195151 => 195152)


--- trunk/Source/WebCore/dom/Document.idl	2016-01-15 23:03:02 UTC (rev 195151)
+++ trunk/Source/WebCore/dom/Document.idl	2016-01-15 23:06:32 UTC (rev 195152)
@@ -54,9 +54,9 @@
 
     [ObjCLegacyUnnamedParameters, NewObject, RaisesException] Node importNode([Default=Undefined] optional Node importedNode,
                     optional boolean deep);
-    [ObjCLegacyUnnamedParameters, NewObject, RaisesException] Element createElementNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
+    [ObjCLegacyUnnamedParameters, NewObject, RaisesException] Element createElementNS([TreatNullAs=NullString,TreatUndefinedAs=NullString,Default=Undefined] optional DOMString namespaceURI,
                             [TreatNullAs=NullString,Default=Undefined] optional DOMString qualifiedName);
-    [ObjCLegacyUnnamedParameters, NewObject, RaisesException] Attr createAttributeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
+    [ObjCLegacyUnnamedParameters, NewObject, RaisesException] Attr createAttributeNS([TreatNullAs=NullString,TreatUndefinedAs=NullString,Default=Undefined] optional DOMString namespaceURI,
                                                                           [TreatNullAs=NullString,Default=Undefined] optional DOMString qualifiedName);
 
 #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to