Diff
Modified: branches/safari-613-branch/LayoutTests/ChangeLog (294843 => 294844)
--- branches/safari-613-branch/LayoutTests/ChangeLog 2022-05-25 23:49:50 UTC (rev 294843)
+++ branches/safari-613-branch/LayoutTests/ChangeLog 2022-05-25 23:49:55 UTC (rev 294844)
@@ -1,5 +1,48 @@
2022-05-19 Alan Coon <[email protected]>
+ Cherry-pick r294234. rdar://problem/93602100
+
+ Web Inspector: Regression(r266885) Crash sometimes when rehydrating imported audit results
+ https://bugs.webkit.org/show_bug.cgi?id=240366
+
+ Reviewed by Devin Rousso.
+
+ Source/_javascript_Core:
+
+ * inspector/protocol/DOM.json:
+
+ Source/WebCore:
+
+ Added test cases to inspector/model/dom-node.html
+
+ After r266885, there is no path to handle the possibility that there may not be a resulting node for calls to
+ `DOM.querySelector`. To correct this, mark the return value as optional (Web Inspector frontend already treats
+ it as optional) and return early if there was no Element matching the selector.
+
+ * inspector/agents/InspectorDOMAgent.cpp:
+ (WebCore::InspectorDOMAgent::querySelector):
+ * inspector/agents/InspectorDOMAgent.h:
+
+ LayoutTests:
+
+ * inspector/model/dom-node.html:
+ * inspector/model/dom-node-expected.txt:
+
+ Canonical link: https://commits.webkit.org/250592@main
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294234 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2022-05-16 Patrick Angle <[email protected]>
+
+ Web Inspector: Regression(r266885) Crash sometimes when rehydrating imported audit results
+ https://bugs.webkit.org/show_bug.cgi?id=240366
+
+ Reviewed by Devin Rousso.
+
+ * inspector/model/dom-node.html:
+ * inspector/model/dom-node-expected.txt:
+
+2022-05-19 Alan Coon <[email protected]>
+
Cherry-pick r293819. rdar://problem/93602086
Crash in WindowProxy::setDOMWindow
Modified: branches/safari-613-branch/LayoutTests/inspector/model/dom-node-expected.txt (294843 => 294844)
--- branches/safari-613-branch/LayoutTests/inspector/model/dom-node-expected.txt 2022-05-25 23:49:50 UTC (rev 294843)
+++ branches/safari-613-branch/LayoutTests/inspector/model/dom-node-expected.txt 2022-05-25 23:49:55 UTC (rev 294844)
@@ -7,3 +7,11 @@
class="test-class"
data-item="test-data"
+-- Running test case: WI.DOMNode.querySelector
+Calling querySelector("#test-id") on document node.
+PASS: `querySelector("#test-id")` should return a WI.DOMNode
+Calling querySelector("#non-existent-id") on document node.
+PASS: `querySelector("#non-existent-id")` should return null.
+Calling querySelector("^\_(invalid selector)_/^") on document node.
+PASS: `querySelector` with an invalid selector should throw a SyntaxError.
+
Modified: branches/safari-613-branch/LayoutTests/inspector/model/dom-node.html (294843 => 294844)
--- branches/safari-613-branch/LayoutTests/inspector/model/dom-node.html 2022-05-25 23:49:50 UTC (rev 294843)
+++ branches/safari-613-branch/LayoutTests/inspector/model/dom-node.html 2022-05-25 23:49:55 UTC (rev 294844)
@@ -25,6 +25,34 @@
}
});
+ suite.addTestCase({
+ name: "WI.DOMNode.querySelector",
+ description: "Test getting a child node via querySelector.",
+ async test() {
+ let documentNode = await WI.domManager.requestDocument();
+
+ function querySelector(selector) {
+ InspectorTest.log(`Calling querySelector("${selector}") on document node.`);
+ return documentNode.querySelector(selector).then((nodeId) => {
+ if (!nodeId)
+ return null;
+ return WI.domManager.nodeForId(nodeId);
+ });
+ }
+
+ let nodeFromQueryingExistingId = await querySelector("#test-id");
+ InspectorTest.expectThat(nodeFromQueryingExistingId instanceof WI.DOMNode, "`querySelector(\"#test-id\")` should return a WI.DOMNode");
+
+ let nodeFromQueryingNonExistantId = await querySelector("#non-existent-id");
+ InspectorTest.expectNull(nodeFromQueryingNonExistantId, "`querySelector(\"#non-existent-id\")` should return null.");
+
+ await querySelector("^\\_(invalid selector)_/^").catch((error) => {
+ InspectorTest.expectEqual(error.message, "SyntaxError", "`querySelector` with an invalid selector should throw a SyntaxError.");
+ });
+
+ }
+ });
+
suite.runTestCasesAndFinish();
}
</script>
Modified: branches/safari-613-branch/Source/_javascript_Core/ChangeLog (294843 => 294844)
--- branches/safari-613-branch/Source/_javascript_Core/ChangeLog 2022-05-25 23:49:50 UTC (rev 294843)
+++ branches/safari-613-branch/Source/_javascript_Core/ChangeLog 2022-05-25 23:49:55 UTC (rev 294844)
@@ -1,3 +1,45 @@
+2022-05-19 Alan Coon <[email protected]>
+
+ Cherry-pick r294234. rdar://problem/93602100
+
+ Web Inspector: Regression(r266885) Crash sometimes when rehydrating imported audit results
+ https://bugs.webkit.org/show_bug.cgi?id=240366
+
+ Reviewed by Devin Rousso.
+
+ Source/_javascript_Core:
+
+ * inspector/protocol/DOM.json:
+
+ Source/WebCore:
+
+ Added test cases to inspector/model/dom-node.html
+
+ After r266885, there is no path to handle the possibility that there may not be a resulting node for calls to
+ `DOM.querySelector`. To correct this, mark the return value as optional (Web Inspector frontend already treats
+ it as optional) and return early if there was no Element matching the selector.
+
+ * inspector/agents/InspectorDOMAgent.cpp:
+ (WebCore::InspectorDOMAgent::querySelector):
+ * inspector/agents/InspectorDOMAgent.h:
+
+ LayoutTests:
+
+ * inspector/model/dom-node.html:
+ * inspector/model/dom-node-expected.txt:
+
+ Canonical link: https://commits.webkit.org/250592@main
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294234 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2022-05-16 Patrick Angle <[email protected]>
+
+ Web Inspector: Regression(r266885) Crash sometimes when rehydrating imported audit results
+ https://bugs.webkit.org/show_bug.cgi?id=240366
+
+ Reviewed by Devin Rousso.
+
+ * inspector/protocol/DOM.json:
+
2022-05-16 Alan Coon <[email protected]>
Cherry-pick r293220. rdar://problem/91924480
Modified: branches/safari-613-branch/Source/_javascript_Core/inspector/protocol/DOM.json (294843 => 294844)
--- branches/safari-613-branch/Source/_javascript_Core/inspector/protocol/DOM.json 2022-05-25 23:49:50 UTC (rev 294843)
+++ branches/safari-613-branch/Source/_javascript_Core/inspector/protocol/DOM.json 2022-05-25 23:49:55 UTC (rev 294844)
@@ -195,7 +195,7 @@
{ "name": "selector", "type": "string", "description": "Selector string." }
],
"returns": [
- { "name": "nodeId", "$ref": "NodeId", "description": "Query selector result." }
+ { "name": "nodeId", "$ref": "NodeId", "optional": true, "description": "Query selector result." }
]
},
{
Modified: branches/safari-613-branch/Source/WebCore/ChangeLog (294843 => 294844)
--- branches/safari-613-branch/Source/WebCore/ChangeLog 2022-05-25 23:49:50 UTC (rev 294843)
+++ branches/safari-613-branch/Source/WebCore/ChangeLog 2022-05-25 23:49:55 UTC (rev 294844)
@@ -1,5 +1,55 @@
2022-05-19 Alan Coon <[email protected]>
+ Cherry-pick r294234. rdar://problem/93602100
+
+ Web Inspector: Regression(r266885) Crash sometimes when rehydrating imported audit results
+ https://bugs.webkit.org/show_bug.cgi?id=240366
+
+ Reviewed by Devin Rousso.
+
+ Source/_javascript_Core:
+
+ * inspector/protocol/DOM.json:
+
+ Source/WebCore:
+
+ Added test cases to inspector/model/dom-node.html
+
+ After r266885, there is no path to handle the possibility that there may not be a resulting node for calls to
+ `DOM.querySelector`. To correct this, mark the return value as optional (Web Inspector frontend already treats
+ it as optional) and return early if there was no Element matching the selector.
+
+ * inspector/agents/InspectorDOMAgent.cpp:
+ (WebCore::InspectorDOMAgent::querySelector):
+ * inspector/agents/InspectorDOMAgent.h:
+
+ LayoutTests:
+
+ * inspector/model/dom-node.html:
+ * inspector/model/dom-node-expected.txt:
+
+ Canonical link: https://commits.webkit.org/250592@main
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294234 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2022-05-16 Patrick Angle <[email protected]>
+
+ Web Inspector: Regression(r266885) Crash sometimes when rehydrating imported audit results
+ https://bugs.webkit.org/show_bug.cgi?id=240366
+
+ Reviewed by Devin Rousso.
+
+ Added test cases to inspector/model/dom-node.html
+
+ After r266885, there is no path to handle the possibility that there may not be a resulting node for calls to
+ `DOM.querySelector`. To correct this, mark the return value as optional (Web Inspector frontend already treats
+ it as optional) and return early if there was no Element matching the selector.
+
+ * inspector/agents/InspectorDOMAgent.cpp:
+ (WebCore::InspectorDOMAgent::querySelector):
+ * inspector/agents/InspectorDOMAgent.h:
+
+2022-05-19 Alan Coon <[email protected]>
+
Cherry-pick r293922. rdar://problem/93602176
null ptr deref in WebCore::Frame::setPrinting
Modified: branches/safari-613-branch/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp (294843 => 294844)
--- branches/safari-613-branch/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp 2022-05-25 23:49:50 UTC (rev 294843)
+++ branches/safari-613-branch/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp 2022-05-25 23:49:55 UTC (rev 294844)
@@ -588,7 +588,7 @@
return { };
}
-Protocol::ErrorStringOr<Protocol::DOM::NodeId> InspectorDOMAgent::querySelector(Protocol::DOM::NodeId nodeId, const String& selector)
+Protocol::ErrorStringOr<std::optional<Protocol::DOM::NodeId>> InspectorDOMAgent::querySelector(Protocol::DOM::NodeId nodeId, const String& selector)
{
Protocol::ErrorString errorString;
@@ -602,11 +602,15 @@
if (queryResult.hasException())
return makeUnexpected(InspectorDOMAgent::toErrorString(queryResult.releaseException()));
- auto resultNodeId = pushNodePathToFrontend(errorString, queryResult.releaseReturnValue());
+ auto* queryResultNode = queryResult.releaseReturnValue();
+ if (!queryResultNode)
+ return { };
+
+ auto resultNodeId = pushNodePathToFrontend(errorString, queryResultNode);
if (!resultNodeId)
return makeUnexpected(errorString);
- return resultNodeId;
+ return { resultNodeId };
}
Protocol::ErrorStringOr<Ref<JSON::ArrayOf<Protocol::DOM::NodeId>>> InspectorDOMAgent::querySelectorAll(Protocol::DOM::NodeId nodeId, const String& selector)
Modified: branches/safari-613-branch/Source/WebCore/inspector/agents/InspectorDOMAgent.h (294843 => 294844)
--- branches/safari-613-branch/Source/WebCore/inspector/agents/InspectorDOMAgent.h 2022-05-25 23:49:50 UTC (rev 294843)
+++ branches/safari-613-branch/Source/WebCore/inspector/agents/InspectorDOMAgent.h 2022-05-25 23:49:55 UTC (rev 294844)
@@ -103,7 +103,7 @@
void willDestroyFrontendAndBackend(Inspector::DisconnectReason);
// DOMBackendDispatcherHandler
- Inspector::Protocol::ErrorStringOr<Inspector::Protocol::DOM::NodeId> querySelector(Inspector::Protocol::DOM::NodeId, const String& selector);
+ Inspector::Protocol::ErrorStringOr<std::optional<Inspector::Protocol::DOM::NodeId>> querySelector(Inspector::Protocol::DOM::NodeId, const String& selector);
Inspector::Protocol::ErrorStringOr<Ref<JSON::ArrayOf<Inspector::Protocol::DOM::NodeId>>> querySelectorAll(Inspector::Protocol::DOM::NodeId, const String& selector);
Inspector::Protocol::ErrorStringOr<Ref<Inspector::Protocol::DOM::Node>> getDocument();
Inspector::Protocol::ErrorStringOr<void> requestChildNodes(Inspector::Protocol::DOM::NodeId, std::optional<int>&& depth);