- Revision
- 248034
- Author
- [email protected]
- Date
- 2019-07-31 01:53:39 -0700 (Wed, 31 Jul 2019)
Log Message
Web Inspector: Second call to setAttributeNS creates non-prefixed attribute
https://bugs.webkit.org/show_bug.cgi?id=200230
<rdar://problem/53712672>
Reviewed by Joseph Pecoraro.
Source/WebCore:
Original patch by Chris Dumez <[email protected]>.
Test: inspector/dom/attributeModified.html
* dom/Element.cpp:
(WebCore::Element::didAddAttribute):
(WebCore::Element::didModifyAttribute):
(WebCore::Element::didRemoveAttribute):
Use the fully qualified name, not just the local name, when notifying the inspector frontend
about changes to attributes.
LayoutTests:
* inspector/dom/attributeModified.html: Added.
* inspector/dom/attributeModified-expected.txt: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (248033 => 248034)
--- trunk/LayoutTests/ChangeLog 2019-07-31 08:02:09 UTC (rev 248033)
+++ trunk/LayoutTests/ChangeLog 2019-07-31 08:53:39 UTC (rev 248034)
@@ -1,3 +1,14 @@
+2019-07-31 Devin Rousso <[email protected]>
+
+ Web Inspector: Second call to setAttributeNS creates non-prefixed attribute
+ https://bugs.webkit.org/show_bug.cgi?id=200230
+ <rdar://problem/53712672>
+
+ Reviewed by Joseph Pecoraro.
+
+ * inspector/dom/attributeModified.html: Added.
+ * inspector/dom/attributeModified-expected.txt: Added.
+
2019-07-31 Carlos Garcia Campos <[email protected]>
[GTK] Datalist element support for TextFieldInputType
Added: trunk/LayoutTests/inspector/dom/attributeModified-expected.txt (0 => 248034)
--- trunk/LayoutTests/inspector/dom/attributeModified-expected.txt (rev 0)
+++ trunk/LayoutTests/inspector/dom/attributeModified-expected.txt 2019-07-31 08:53:39 UTC (rev 248034)
@@ -0,0 +1,33 @@
+Tests for the DOM.attributeModified event.
+
+
+== Running test suite: DOM.attributeModified
+-- Running test case: DOM.attributeModified.WithNamespace
+Creating test node...
+{
+ "id": "with-namespace",
+ "attribute:existing": "42"
+}
+
+Adding attribute with namespace...
+{
+ "id": "with-namespace",
+ "attribute:existing": "42",
+ "attribute:new": "1"
+}
+
+Replacing attribute with namespace...
+{
+ "id": "with-namespace",
+ "attribute:existing": "42",
+ "attribute:new": "2"
+}
+
+Replacing attribute without namespace...
+{
+ "id": "with-namespace",
+ "attribute:existing": "42",
+ "attribute:new": "3"
+}
+
+
Added: trunk/LayoutTests/inspector/dom/attributeModified.html (0 => 248034)
--- trunk/LayoutTests/inspector/dom/attributeModified.html (rev 0)
+++ trunk/LayoutTests/inspector/dom/attributeModified.html 2019-07-31 08:53:39 UTC (rev 248034)
@@ -0,0 +1,77 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script>
+
+function createTestNode(id) {
+ let node = document.body.appendChild(document.createElement("div"));
+ node.id = id;
+ node.setAttributeNS("http://example.com", "attribute:existing", 42);
+}
+
+function test() {
+ let documentNode = null;
+
+ let suite = InspectorTest.createAsyncSuite("DOM.attributeModified");
+
+ suite.addTestCase({
+ name: "DOM.attributeModified.WithNamespace",
+ description: "Check that the attributeModified event sends the full attribute name, including the namespace.",
+ async test() {
+ const id = "with-namespace";
+
+ InspectorTest.log("Creating test node...");
+ await InspectorTest.evaluateInPage(`createTestNode("${id}")`);
+ let testNodeId = await WI.domManager.querySelector(documentNode.id, "#" + id);
+ let testNode = WI.domManager.nodeForId(testNodeId);
+ InspectorTest.assert(testNode, "Missing test node for id " + testNodeId);
+
+ function logAttributes() {
+ let attributes = {};
+ for (let attribute of testNode.attributes())
+ attributes[attribute.name] = attribute.value;
+ InspectorTest.json(attributes);
+ InspectorTest.log("");
+ }
+
+ logAttributes();
+
+ InspectorTest.log("Adding attribute with namespace...");
+ await Promise.all([
+ testNode.awaitEvent(WI.DOMNode.Event.AttributeModified),
+ InspectorTest.evaluateInPage(`document.getElementById("${id}").setAttributeNS("http://example.com", "attribute:new", 1)`)
+ ]);
+
+ logAttributes();
+
+ InspectorTest.log("Replacing attribute with namespace...");
+ await Promise.all([
+ testNode.awaitEvent(WI.DOMNode.Event.AttributeModified),
+ InspectorTest.evaluateInPage(`document.getElementById("${id}").setAttributeNS("http://example.com", "attribute:new", 2)`)
+ ]);
+
+ logAttributes();
+
+ InspectorTest.log("Replacing attribute without namespace...");
+ await Promise.all([
+ testNode.awaitEvent(WI.DOMNode.Event.AttributeModified),
+ InspectorTest.evaluateInPage(`document.getElementById("${id}").setAttribute("attribute:new", "3")`)
+ ]);
+
+ logAttributes();
+ },
+ });
+
+ WI.domManager.requestDocument((root) => {
+ documentNode = root;
+
+ suite.runTestCasesAndFinish();
+ });
+}
+</script>
+</head>
+<body _onload_="runTest()">
+<p>Tests for the DOM.attributeModified event.</p>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (248033 => 248034)
--- trunk/Source/WebCore/ChangeLog 2019-07-31 08:02:09 UTC (rev 248033)
+++ trunk/Source/WebCore/ChangeLog 2019-07-31 08:53:39 UTC (rev 248034)
@@ -1,3 +1,22 @@
+2019-07-31 Devin Rousso <[email protected]>
+
+ Web Inspector: Second call to setAttributeNS creates non-prefixed attribute
+ https://bugs.webkit.org/show_bug.cgi?id=200230
+ <rdar://problem/53712672>
+
+ Reviewed by Joseph Pecoraro.
+
+ Original patch by Chris Dumez <[email protected]>.
+
+ Test: inspector/dom/attributeModified.html
+
+ * dom/Element.cpp:
+ (WebCore::Element::didAddAttribute):
+ (WebCore::Element::didModifyAttribute):
+ (WebCore::Element::didRemoveAttribute):
+ Use the fully qualified name, not just the local name, when notifying the inspector frontend
+ about changes to attributes.
+
2019-07-31 Carlos Garcia Campos <[email protected]>
[GTK] Datalist element support for TextFieldInputType
Modified: trunk/Source/WebCore/dom/Element.cpp (248033 => 248034)
--- trunk/Source/WebCore/dom/Element.cpp 2019-07-31 08:02:09 UTC (rev 248033)
+++ trunk/Source/WebCore/dom/Element.cpp 2019-07-31 08:53:39 UTC (rev 248034)
@@ -3852,7 +3852,7 @@
void Element::didAddAttribute(const QualifiedName& name, const AtomString& value)
{
attributeChanged(name, nullAtom(), value);
- InspectorInstrumentation::didModifyDOMAttr(document(), *this, name.localName(), value);
+ InspectorInstrumentation::didModifyDOMAttr(document(), *this, name.toString(), value);
dispatchSubtreeModifiedEvent();
}
@@ -3859,7 +3859,7 @@
void Element::didModifyAttribute(const QualifiedName& name, const AtomString& oldValue, const AtomString& newValue)
{
attributeChanged(name, oldValue, newValue);
- InspectorInstrumentation::didModifyDOMAttr(document(), *this, name.localName(), newValue);
+ InspectorInstrumentation::didModifyDOMAttr(document(), *this, name.toString(), newValue);
// Do not dispatch a DOMSubtreeModified event here; see bug 81141.
}
@@ -3866,7 +3866,7 @@
void Element::didRemoveAttribute(const QualifiedName& name, const AtomString& oldValue)
{
attributeChanged(name, oldValue, nullAtom());
- InspectorInstrumentation::didRemoveDOMAttr(document(), *this, name.localName());
+ InspectorInstrumentation::didRemoveDOMAttr(document(), *this, name.toString());
dispatchSubtreeModifiedEvent();
}