Title: [204648] trunk
Revision
204648
Author
[email protected]
Date
2016-08-19 12:44:01 -0700 (Fri, 19 Aug 2016)

Log Message

Attr.prefix / Element.prefix attribute should be readonly
https://bugs.webkit.org/show_bug.cgi?id=160998

Reviewed by Daniel Bates.

LayoutTests/imported/w3c:

Rebaseline W3C test now that more checks are passing.

* web-platform-tests/dom/interfaces-expected.txt:

Source/WebCore:

Attr.prefix / Element.prefix attribute should be readonly:
- https://dom.spec.whatwg.org/#element
- https://dom.spec.whatwg.org/#attr

Firefox and Chrome agree with the specification.

No new tests, rebaselined existing test.

* dom/Attr.idl:
* dom/Element.idl:

LayoutTests:

Update existing tests to reflect behavior change and drop a few
outdated tests.

* fast/dom/Element/prefix-setter-exception-expected.txt: Removed.
* fast/dom/Element/prefix-setter-exception.html: Removed.
* fast/dom/Element/setAttributeNode-case-insensitivity.html:
* fast/dom/bad-href-attribute-expected.txt: Removed.
* fast/dom/bad-href-attribute.html: Removed.
* fast/dom/node-prefix-setter-namespace-exception-expected.txt: Removed.
* fast/dom/node-prefix-setter-namespace-exception.html: Removed.
* fast/dom/script-tests/node-prefix-setter-namespace-exception.js: Removed.
* svg/custom/xlink-prefix-generation-in-attributes-expected.txt:
* svg/custom/xlink-prefix-generation-in-attributes.html:

Modified Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (204647 => 204648)


--- trunk/LayoutTests/ChangeLog	2016-08-19 19:33:58 UTC (rev 204647)
+++ trunk/LayoutTests/ChangeLog	2016-08-19 19:44:01 UTC (rev 204648)
@@ -1,3 +1,24 @@
+2016-08-19  Chris Dumez  <[email protected]>
+
+        Attr.prefix / Element.prefix attribute should be readonly
+        https://bugs.webkit.org/show_bug.cgi?id=160998
+
+        Reviewed by Daniel Bates.
+
+        Update existing tests to reflect behavior change and drop a few
+        outdated tests.
+
+        * fast/dom/Element/prefix-setter-exception-expected.txt: Removed.
+        * fast/dom/Element/prefix-setter-exception.html: Removed.
+        * fast/dom/Element/setAttributeNode-case-insensitivity.html:
+        * fast/dom/bad-href-attribute-expected.txt: Removed.
+        * fast/dom/bad-href-attribute.html: Removed.
+        * fast/dom/node-prefix-setter-namespace-exception-expected.txt: Removed.
+        * fast/dom/node-prefix-setter-namespace-exception.html: Removed.
+        * fast/dom/script-tests/node-prefix-setter-namespace-exception.js: Removed.
+        * svg/custom/xlink-prefix-generation-in-attributes-expected.txt:
+        * svg/custom/xlink-prefix-generation-in-attributes.html:
+
 2016-08-19  Nan Wang  <[email protected]>
 
         AX: iOS, Wrong axLabel on static text if heading has multiple children

Deleted: trunk/LayoutTests/fast/dom/Element/prefix-setter-exception-expected.txt (204647 => 204648)


--- trunk/LayoutTests/fast/dom/Element/prefix-setter-exception-expected.txt	2016-08-19 19:33:58 UTC (rev 204647)
+++ trunk/LayoutTests/fast/dom/Element/prefix-setter-exception-expected.txt	2016-08-19 19:44:01 UTC (rev 204648)
@@ -1,27 +0,0 @@
-Test for the implementation of DOM Level 3 Core API on Node Interface: prefix setter. INVALID_CHARACTER_ERR: Raised if the specified prefix contains an illegal character according to the XML version in use specified in the Document.xmlVersion attribute. http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-NodeNSPrefix
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS prefixedElem.prefix = "." threw exception InvalidCharacterError (DOM Exception 5): The string contains invalid characters..
-PASS prefixedElem.prefix is "before"
-PASS prefixedElem.prefix = "x." is "x."
-PASS prefixedElem.prefix is "x."
-PASS prefixedElem.prefix = "0a" threw exception InvalidCharacterError (DOM Exception 5): The string contains invalid characters..
-PASS prefixedElem.prefix is "before"
-PASS prefixedElem.prefix = "a0" is "a0"
-PASS prefixedElem.prefix is "a0"
-PASS prefixedElem.prefix = "_0" is "_0"
-PASS prefixedElem.prefix is "_0"
-PASS prefixedElem.prefix = "×" threw exception InvalidCharacterError (DOM Exception 5): The string contains invalid characters..
-PASS prefixedElem.prefix is "before"
-PASS prefixedElem.prefix = "·" threw exception InvalidCharacterError (DOM Exception 5): The string contains invalid characters..
-PASS prefixedElem.prefix is "before"
-PASS prefixedElem.prefix = "aa" is "aa"
-PASS prefixedElem.prefix is "aa"
-PASS prefixedElem.prefix = "\n" threw exception InvalidCharacterError (DOM Exception 5): The string contains invalid characters..
-PASS prefixedElem.prefix is "before"
-PASS successfullyParsed is true
-
-TEST COMPLETE
-

Deleted: trunk/LayoutTests/fast/dom/Element/prefix-setter-exception.html (204647 => 204648)


--- trunk/LayoutTests/fast/dom/Element/prefix-setter-exception.html	2016-08-19 19:33:58 UTC (rev 204647)
+++ trunk/LayoutTests/fast/dom/Element/prefix-setter-exception.html	2016-08-19 19:44:01 UTC (rev 204648)
@@ -1,38 +0,0 @@
-<!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<title>DOM L3 Core: Node Interface prefix property setter</title>
-</head>
-<body>
-<script src=""
-<script>
-description('Test for the implementation of DOM Level 3 Core API on Node Interface: prefix setter. INVALID_CHARACTER_ERR: Raised if the specified prefix contains an illegal character according to the XML version in use specified in the Document.xmlVersion attribute.  <a href=""
-
-var prefixedElem = document.createElementNS("ns1", "pre1:foo");
-document.body.appendChild(prefixedElem);
-
-function test(prefix, expectedToThrow) {
-    prefixedElem.prefix = "before";
-    if (expectedToThrow) {
-        shouldThrow('prefixedElem.prefix = ' + prefix);
-        shouldBe('prefixedElem.prefix', '"before"');
-    } else {
-        shouldBe('prefixedElem.prefix = ' + prefix, prefix);
-        shouldBe('prefixedElem.prefix', prefix);
-    }
-}
-
-test('"."', true);
-test('"x."', false);
-test('"0a"', true);
-test('"a0"', false);
-test('"_0"', false);
-test('"\xD7"', true);
-test('"\xB7"', true);
-test('"aa"', false);
-test('"\\n"', true);
-</script>
-<script src=""
-</body>
-</html>
-

Modified: trunk/LayoutTests/fast/dom/Element/setAttributeNode-case-insensitivity.html (204647 => 204648)


--- trunk/LayoutTests/fast/dom/Element/setAttributeNode-case-insensitivity.html	2016-08-19 19:33:58 UTC (rev 204647)
+++ trunk/LayoutTests/fast/dom/Element/setAttributeNode-case-insensitivity.html	2016-08-19 19:44:01 UTC (rev 204648)
@@ -20,12 +20,10 @@
 
 
         debug("Verifying that attributes with the same name but different namespaces are treated as unique entities. For the following test two different attribute values should be returned.");
-        var newAttr1 = document.createAttributeNS("ns1", "newattr");
-        newAttr1.prefix = "prefix1";
+        var newAttr1 = document.createAttributeNS("ns1", "prefix1:newattr");
         newAttr1.value = "newattr1";
         test.setAttributeNode(newAttr1);
-        var newAttr2 = document.createAttributeNS("ns2", "newattr");
-        newAttr2.prefix = "prefix2";
+        var newAttr2 = document.createAttributeNS("ns2", "prefix2:newattr");
         newAttr2.value = "newattr2";
         test.setAttributeNode(newAttr2);
         shouldBe("test.getAttributeNodeNS('ns1', 'newattr').value", "'newattr1'");
@@ -32,8 +30,7 @@
         shouldBe("test.getAttributeNodeNS('ns2', 'newattr').value", "'newattr2'");
 
         debug("Verifying that attributes with same name but different case and having same namespaces are treated as same. In the following test the new attribute should overwrite the value of the existing one.");
-        var newAttr3 = document.createAttributeNS("ns1", "NEWATTR");
-        newAttr3.prefix = "prefix2";
+        var newAttr3 = document.createAttributeNS("ns1", "prefix2:NEWATTR");
         newAttr3.value = "newattr3";
         test.setAttributeNode(newAttr3);
 

Deleted: trunk/LayoutTests/fast/dom/bad-href-attribute-expected.txt (204647 => 204648)


--- trunk/LayoutTests/fast/dom/bad-href-attribute-expected.txt	2016-08-19 19:33:58 UTC (rev 204647)
+++ trunk/LayoutTests/fast/dom/bad-href-attribute-expected.txt	2016-08-19 19:44:01 UTC (rev 204648)
@@ -1,6 +0,0 @@
-Test that you can't set a prefix for a node with null namespace.
-
-Should say PASS:
-
-PASS
-

Deleted: trunk/LayoutTests/fast/dom/bad-href-attribute.html (204647 => 204648)


--- trunk/LayoutTests/fast/dom/bad-href-attribute.html	2016-08-19 19:33:58 UTC (rev 204647)
+++ trunk/LayoutTests/fast/dom/bad-href-attribute.html	2016-08-19 19:44:01 UTC (rev 204648)
@@ -1,31 +0,0 @@
-<body>
-<p>Test that you can't set a prefix for a node with null namespace.</p>
-<p>Should say PASS:</p>
-<pre id = log></pre>
-<script>
-if (window.testRunner)
-    testRunner.dumpAsText();
-
-function log(msg)
-{
-    document.getElementById("log").innerHTML += msg + "\n";
-}
-
-var a = document.createElement("a");
-var attr = document.createAttribute("href");
-attr.value = "#";
-
-try {
-    attr.prefix = "foo";
-    log("FAIL: Was able to change the prefix.");
-} catch (ex) {
-    log("PASS");
-}
-    
-a.setAttributeNode(attr);
-
-// WebKit used to crash with an assertion here.
-a.href;
-
-</script>
-</body>

Deleted: trunk/LayoutTests/fast/dom/node-prefix-setter-namespace-exception-expected.txt (204647 => 204648)


--- trunk/LayoutTests/fast/dom/node-prefix-setter-namespace-exception-expected.txt	2016-08-19 19:33:58 UTC (rev 204647)
+++ trunk/LayoutTests/fast/dom/node-prefix-setter-namespace-exception-expected.txt	2016-08-19 19:44:01 UTC (rev 204648)
@@ -1,18 +0,0 @@
-Test how Node.prefix setter raises NAMESPACE_ERR.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS href.prefix is null
-PASS document.createAttribute('attr').prefix = 'abc' threw exception NamespaceError (DOM Exception 14): The operation is not allowed by Namespaces in XML..
-PASS document.createAttributeNS(null, 'attr').prefix = 'abc' threw exception NamespaceError (DOM Exception 14): The operation is not allowed by Namespaces in XML..
-PASS document.createElementNS(null, 'attr').prefix = 'abc' threw exception NamespaceError (DOM Exception 14): The operation is not allowed by Namespaces in XML..
-PASS document.createAttributeNS('foo', 'bar').prefix = 'xml' threw exception NamespaceError (DOM Exception 14): The operation is not allowed by Namespaces in XML..
-PASS document.createElementNS('foo', 'bar').prefix = 'xml' threw exception NamespaceError (DOM Exception 14): The operation is not allowed by Namespaces in XML..
-PASS document.createAttribute('attr').prefix = 'xmlns' threw exception NamespaceError (DOM Exception 14): The operation is not allowed by Namespaces in XML..
-PASS document.createAttributeNS('foo', 'attr').prefix = 'xmlns' threw exception NamespaceError (DOM Exception 14): The operation is not allowed by Namespaces in XML..
-PASS document.createAttribute('xmlns').prefix = 'foo' threw exception NamespaceError (DOM Exception 14): The operation is not allowed by Namespaces in XML..
-PASS successfullyParsed is true
-
-TEST COMPLETE
-

Deleted: trunk/LayoutTests/fast/dom/node-prefix-setter-namespace-exception.html (204647 => 204648)


--- trunk/LayoutTests/fast/dom/node-prefix-setter-namespace-exception.html	2016-08-19 19:33:58 UTC (rev 204647)
+++ trunk/LayoutTests/fast/dom/node-prefix-setter-namespace-exception.html	2016-08-19 19:44:01 UTC (rev 204648)
@@ -1,10 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<html>
-<head>
-<script src=""
-</head>
-<body>
-<script src=""
-<script src=""
-</body>
-</html>

Deleted: trunk/LayoutTests/fast/dom/script-tests/node-prefix-setter-namespace-exception.js (204647 => 204648)


--- trunk/LayoutTests/fast/dom/script-tests/node-prefix-setter-namespace-exception.js	2016-08-19 19:33:58 UTC (rev 204647)
+++ trunk/LayoutTests/fast/dom/script-tests/node-prefix-setter-namespace-exception.js	2016-08-19 19:44:01 UTC (rev 204648)
@@ -1,21 +0,0 @@
-description("Test how Node.prefix setter raises NAMESPACE_ERR.");
-
-var href = ""
-href.value = "#";
-
-// Should not throw.
-href.prefix = null;
-
-// Per DOM3 Core spec, setting to empty is implementation dependent.
-// Firefox treats empty like null.
-href.prefix = "";
-shouldBe("href.prefix", "null");
-
-shouldThrow("document.createAttribute('attr').prefix = 'abc'");
-shouldThrow("document.createAttributeNS(null, 'attr').prefix = 'abc'");
-shouldThrow("document.createElementNS(null, 'attr').prefix = 'abc'");
-shouldThrow("document.createAttributeNS('foo', 'bar').prefix = 'xml'");
-shouldThrow("document.createElementNS('foo', 'bar').prefix = 'xml'");
-shouldThrow("document.createAttribute('attr').prefix = 'xmlns'");
-shouldThrow("document.createAttributeNS('foo', 'attr').prefix = 'xmlns'");
-shouldThrow("document.createAttribute('xmlns').prefix = 'foo'");

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (204647 => 204648)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2016-08-19 19:33:58 UTC (rev 204647)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2016-08-19 19:44:01 UTC (rev 204648)
@@ -1,5 +1,16 @@
 2016-08-19  Chris Dumez  <[email protected]>
 
+        Attr.prefix / Element.prefix attribute should be readonly
+        https://bugs.webkit.org/show_bug.cgi?id=160998
+
+        Reviewed by Daniel Bates.
+
+        Rebaseline W3C test now that more checks are passing.
+
+        * web-platform-tests/dom/interfaces-expected.txt:
+
+2016-08-19  Chris Dumez  <[email protected]>
+
         <command> should be an HTMLUnknownElement and <basefont> should be an HTMLElement
         https://bugs.webkit.org/show_bug.cgi?id=161004
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/interfaces-expected.txt (204647 => 204648)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/interfaces-expected.txt	2016-08-19 19:33:58 UTC (rev 204647)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/interfaces-expected.txt	2016-08-19 19:44:01 UTC (rev 204648)
@@ -733,9 +733,7 @@
 PASS Element interface: existence and properties of interface prototype object 
 PASS Element interface: existence and properties of interface prototype object's "constructor" property 
 PASS Element interface: attribute namespaceURI 
-FAIL Element interface: attribute prefix assert_equals: setter must be undefined for readonly attributes expected (undefined) undefined but got (function) function "function prefix() {
-    [native code]
-}"
+PASS Element interface: attribute prefix 
 PASS Element interface: attribute localName 
 PASS Element interface: attribute tagName 
 PASS Element interface: attribute id 
@@ -950,9 +948,7 @@
 FAIL Attr interface: existence and properties of interface prototype object assert_equals: prototype of Attr.prototype is not Object.prototype expected object "[object Object]" but got object "[object NodePrototype]"
 PASS Attr interface: existence and properties of interface prototype object's "constructor" property 
 PASS Attr interface: attribute namespaceURI 
-FAIL Attr interface: attribute prefix assert_equals: setter must be undefined for readonly attributes expected (undefined) undefined but got (function) function "function prefix() {
-    [native code]
-}"
+PASS Attr interface: attribute prefix 
 PASS Attr interface: attribute localName 
 PASS Attr interface: attribute name 
 FAIL Attr interface: attribute nodeName assert_own_property: expected property "nodeName" missing

Modified: trunk/LayoutTests/svg/custom/xlink-prefix-generation-in-attributes-expected.txt (204647 => 204648)


--- trunk/LayoutTests/svg/custom/xlink-prefix-generation-in-attributes-expected.txt	2016-08-19 19:33:58 UTC (rev 204647)
+++ trunk/LayoutTests/svg/custom/xlink-prefix-generation-in-attributes-expected.txt	2016-08-19 19:44:01 UTC (rev 204648)
@@ -1,4 +1,3 @@
 <svg xmlns="http://www.w3.org/2000/svg" NS1:href="" xmlns:NS1="http://www.w3.org/1999/xlink"/>
 <svg xmlns="http://www.w3.org/2000/svg" NS1:href="" xmlns:NS1="http://www.w3.org/1999/xlink"/>
 <svg xmlns="http://www.w3.org/2000/svg" xlink:href="" xmlns:xlink="http://www.w3.org/1999/xlink"/>
-<svg xmlns="http://www.w3.org/2000/svg" xlink:href="" xmlns:xlink="http://www.w3.org/1999/xlink"/>

Modified: trunk/LayoutTests/svg/custom/xlink-prefix-generation-in-attributes.html (204647 => 204648)


--- trunk/LayoutTests/svg/custom/xlink-prefix-generation-in-attributes.html	2016-08-19 19:33:58 UTC (rev 204647)
+++ trunk/LayoutTests/svg/custom/xlink-prefix-generation-in-attributes.html	2016-08-19 19:44:01 UTC (rev 204648)
@@ -25,15 +25,8 @@
         xml = serializer.serializeToString(doc);
         document.getElementById("svgoutput2").textContent = xml + "\n";
    
-        // Example 3: Attempt to fix the document by setting Node.prefix.  The Node.prefix property should now contain "xlink".
+        // Example 3: Create the document with prefixes specified.  The Node.prefix property should now contain "xlink".
         doc = document.implementation.createDocument(svgns, "svg", null);
-        doc.documentElement.setAttributeNS(xlinkns, "href", "#foo");
-        doc.documentElement.attributes[0].prefix = "xlink";
-        xml = serializer.serializeToString(doc);
-        document.getElementById("svgoutput3").textContent = xml + "\n";
-   
-        // Example 4: Create the document with prefixes specified.  The Node.prefix property should now contain "xlink".
-        doc = document.implementation.createDocument(svgns, "svg", null);
         doc.documentElement.setAttributeNS(xlinkns, "xlink:href", "#foo");
         xml = serializer.serializeToString(doc);
         document.getElementById("svgoutput4").textContent = xml + "\n";

Modified: trunk/Source/WebCore/ChangeLog (204647 => 204648)


--- trunk/Source/WebCore/ChangeLog	2016-08-19 19:33:58 UTC (rev 204647)
+++ trunk/Source/WebCore/ChangeLog	2016-08-19 19:44:01 UTC (rev 204648)
@@ -1,5 +1,23 @@
 2016-08-19  Chris Dumez  <[email protected]>
 
+        Attr.prefix / Element.prefix attribute should be readonly
+        https://bugs.webkit.org/show_bug.cgi?id=160998
+
+        Reviewed by Daniel Bates.
+
+        Attr.prefix / Element.prefix attribute should be readonly:
+        - https://dom.spec.whatwg.org/#element
+        - https://dom.spec.whatwg.org/#attr
+
+        Firefox and Chrome agree with the specification.
+
+        No new tests, rebaselined existing test.
+
+        * dom/Attr.idl:
+        * dom/Element.idl:
+
+2016-08-19  Chris Dumez  <[email protected]>
+
         <command> should be an HTMLUnknownElement and <basefont> should be an HTMLElement
         https://bugs.webkit.org/show_bug.cgi?id=161004
 

Modified: trunk/Source/WebCore/dom/Attr.idl (204647 => 204648)


--- trunk/Source/WebCore/dom/Attr.idl	2016-08-19 19:33:58 UTC (rev 204647)
+++ trunk/Source/WebCore/dom/Attr.idl	2016-08-19 19:44:01 UTC (rev 204648)
@@ -41,7 +41,7 @@
     readonly attribute boolean isId;
 
     readonly attribute DOMString? namespaceURI;
-    [SetterRaisesException] attribute DOMString? prefix;
-    readonly attribute DOMString? localName;
+    readonly attribute DOMString? prefix;
+    readonly attribute DOMString localName;
 };
 

Modified: trunk/Source/WebCore/dom/Element.idl (204647 => 204648)


--- trunk/Source/WebCore/dom/Element.idl	2016-08-19 19:33:58 UTC (rev 204647)
+++ trunk/Source/WebCore/dom/Element.idl	2016-08-19 19:44:01 UTC (rev 204648)
@@ -66,8 +66,8 @@
     [Reflect] attribute DOMString id;
 
     readonly attribute DOMString? namespaceURI;
-    [SetterRaisesException] attribute DOMString? prefix;
-    readonly attribute DOMString? localName;
+    readonly attribute DOMString? prefix;
+    readonly attribute DOMString localName;
 
     // Common extensions
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to