Changeset 294844 in webkit
- Timestamp:
- May 25, 2022, 4:49:55 PM (4 years ago)
- Location:
- branches/safari-613-branch
- Files:
-
- 8 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/inspector/model/dom-node-expected.txt (modified) (1 diff)
-
LayoutTests/inspector/model/dom-node.html (modified) (1 diff)
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/inspector/protocol/DOM.json (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/inspector/agents/InspectorDOMAgent.cpp (modified) (2 diffs)
-
Source/WebCore/inspector/agents/InspectorDOMAgent.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-613-branch/LayoutTests/ChangeLog
r294840 r294844 1 2022-05-19 Alan Coon <alancoon@apple.com> 2 3 Cherry-pick r294234. rdar://problem/93602100 4 5 Web Inspector: Regression(r266885) Crash sometimes when rehydrating imported audit results 6 https://bugs.webkit.org/show_bug.cgi?id=240366 7 8 Reviewed by Devin Rousso. 9 10 Source/JavaScriptCore: 11 12 * inspector/protocol/DOM.json: 13 14 Source/WebCore: 15 16 Added test cases to inspector/model/dom-node.html 17 18 After r266885, there is no path to handle the possibility that there may not be a resulting node for calls to 19 `DOM.querySelector`. To correct this, mark the return value as optional (Web Inspector frontend already treats 20 it as optional) and return early if there was no Element matching the selector. 21 22 * inspector/agents/InspectorDOMAgent.cpp: 23 (WebCore::InspectorDOMAgent::querySelector): 24 * inspector/agents/InspectorDOMAgent.h: 25 26 LayoutTests: 27 28 * inspector/model/dom-node.html: 29 * inspector/model/dom-node-expected.txt: 30 31 Canonical link: https://commits.webkit.org/250592@main 32 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294234 268f45cc-cd09-0410-ab3c-d52691b4dbfc 33 34 2022-05-16 Patrick Angle <pangle@apple.com> 35 36 Web Inspector: Regression(r266885) Crash sometimes when rehydrating imported audit results 37 https://bugs.webkit.org/show_bug.cgi?id=240366 38 39 Reviewed by Devin Rousso. 40 41 * inspector/model/dom-node.html: 42 * inspector/model/dom-node-expected.txt: 43 1 44 2022-05-19 Alan Coon <alancoon@apple.com> 2 45 -
branches/safari-613-branch/LayoutTests/inspector/model/dom-node-expected.txt
r222483 r294844 8 8 data-item="test-data" 9 9 10 -- Running test case: WI.DOMNode.querySelector 11 Calling querySelector("#test-id") on document node. 12 PASS: `querySelector("#test-id")` should return a WI.DOMNode 13 Calling querySelector("#non-existent-id") on document node. 14 PASS: `querySelector("#non-existent-id")` should return null. 15 Calling querySelector("^\_(invalid selector)_/^") on document node. 16 PASS: `querySelector` with an invalid selector should throw a SyntaxError. 17 -
branches/safari-613-branch/LayoutTests/inspector/model/dom-node.html
r253242 r294844 26 26 }); 27 27 28 suite.addTestCase({ 29 name: "WI.DOMNode.querySelector", 30 description: "Test getting a child node via querySelector.", 31 async test() { 32 let documentNode = await WI.domManager.requestDocument(); 33 34 function querySelector(selector) { 35 InspectorTest.log(`Calling querySelector("${selector}") on document node.`); 36 return documentNode.querySelector(selector).then((nodeId) => { 37 if (!nodeId) 38 return null; 39 return WI.domManager.nodeForId(nodeId); 40 }); 41 } 42 43 let nodeFromQueryingExistingId = await querySelector("#test-id"); 44 InspectorTest.expectThat(nodeFromQueryingExistingId instanceof WI.DOMNode, "`querySelector(\"#test-id\")` should return a WI.DOMNode"); 45 46 let nodeFromQueryingNonExistantId = await querySelector("#non-existent-id"); 47 InspectorTest.expectNull(nodeFromQueryingNonExistantId, "`querySelector(\"#non-existent-id\")` should return null."); 48 49 await querySelector("^\\_(invalid selector)_/^").catch((error) => { 50 InspectorTest.expectEqual(error.message, "SyntaxError", "`querySelector` with an invalid selector should throw a SyntaxError."); 51 }); 52 53 } 54 }); 55 28 56 suite.runTestCasesAndFinish(); 29 57 } -
branches/safari-613-branch/Source/JavaScriptCore/ChangeLog
r294296 r294844 1 2022-05-19 Alan Coon <alancoon@apple.com> 2 3 Cherry-pick r294234. rdar://problem/93602100 4 5 Web Inspector: Regression(r266885) Crash sometimes when rehydrating imported audit results 6 https://bugs.webkit.org/show_bug.cgi?id=240366 7 8 Reviewed by Devin Rousso. 9 10 Source/JavaScriptCore: 11 12 * inspector/protocol/DOM.json: 13 14 Source/WebCore: 15 16 Added test cases to inspector/model/dom-node.html 17 18 After r266885, there is no path to handle the possibility that there may not be a resulting node for calls to 19 `DOM.querySelector`. To correct this, mark the return value as optional (Web Inspector frontend already treats 20 it as optional) and return early if there was no Element matching the selector. 21 22 * inspector/agents/InspectorDOMAgent.cpp: 23 (WebCore::InspectorDOMAgent::querySelector): 24 * inspector/agents/InspectorDOMAgent.h: 25 26 LayoutTests: 27 28 * inspector/model/dom-node.html: 29 * inspector/model/dom-node-expected.txt: 30 31 Canonical link: https://commits.webkit.org/250592@main 32 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294234 268f45cc-cd09-0410-ab3c-d52691b4dbfc 33 34 2022-05-16 Patrick Angle <pangle@apple.com> 35 36 Web Inspector: Regression(r266885) Crash sometimes when rehydrating imported audit results 37 https://bugs.webkit.org/show_bug.cgi?id=240366 38 39 Reviewed by Devin Rousso. 40 41 * inspector/protocol/DOM.json: 42 1 43 2022-05-16 Alan Coon <alancoon@apple.com> 2 44 -
branches/safari-613-branch/Source/JavaScriptCore/inspector/protocol/DOM.json
r278785 r294844 196 196 ], 197 197 "returns": [ 198 { "name": "nodeId", "$ref": "NodeId", " description": "Query selector result." }198 { "name": "nodeId", "$ref": "NodeId", "optional": true, "description": "Query selector result." } 199 199 ] 200 200 }, -
branches/safari-613-branch/Source/WebCore/ChangeLog
r294843 r294844 1 2022-05-19 Alan Coon <alancoon@apple.com> 2 3 Cherry-pick r294234. rdar://problem/93602100 4 5 Web Inspector: Regression(r266885) Crash sometimes when rehydrating imported audit results 6 https://bugs.webkit.org/show_bug.cgi?id=240366 7 8 Reviewed by Devin Rousso. 9 10 Source/JavaScriptCore: 11 12 * inspector/protocol/DOM.json: 13 14 Source/WebCore: 15 16 Added test cases to inspector/model/dom-node.html 17 18 After r266885, there is no path to handle the possibility that there may not be a resulting node for calls to 19 `DOM.querySelector`. To correct this, mark the return value as optional (Web Inspector frontend already treats 20 it as optional) and return early if there was no Element matching the selector. 21 22 * inspector/agents/InspectorDOMAgent.cpp: 23 (WebCore::InspectorDOMAgent::querySelector): 24 * inspector/agents/InspectorDOMAgent.h: 25 26 LayoutTests: 27 28 * inspector/model/dom-node.html: 29 * inspector/model/dom-node-expected.txt: 30 31 Canonical link: https://commits.webkit.org/250592@main 32 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294234 268f45cc-cd09-0410-ab3c-d52691b4dbfc 33 34 2022-05-16 Patrick Angle <pangle@apple.com> 35 36 Web Inspector: Regression(r266885) Crash sometimes when rehydrating imported audit results 37 https://bugs.webkit.org/show_bug.cgi?id=240366 38 39 Reviewed by Devin Rousso. 40 41 Added test cases to inspector/model/dom-node.html 42 43 After r266885, there is no path to handle the possibility that there may not be a resulting node for calls to 44 `DOM.querySelector`. To correct this, mark the return value as optional (Web Inspector frontend already treats 45 it as optional) and return early if there was no Element matching the selector. 46 47 * inspector/agents/InspectorDOMAgent.cpp: 48 (WebCore::InspectorDOMAgent::querySelector): 49 * inspector/agents/InspectorDOMAgent.h: 50 1 51 2022-05-19 Alan Coon <alancoon@apple.com> 2 52 -
branches/safari-613-branch/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp
r287327 r294844 589 589 } 590 590 591 Protocol::ErrorStringOr< Protocol::DOM::NodeId> InspectorDOMAgent::querySelector(Protocol::DOM::NodeId nodeId, const String& selector)591 Protocol::ErrorStringOr<std::optional<Protocol::DOM::NodeId>> InspectorDOMAgent::querySelector(Protocol::DOM::NodeId nodeId, const String& selector) 592 592 { 593 593 Protocol::ErrorString errorString; … … 603 603 return makeUnexpected(InspectorDOMAgent::toErrorString(queryResult.releaseException())); 604 604 605 auto resultNodeId = pushNodePathToFrontend(errorString, queryResult.releaseReturnValue()); 605 auto* queryResultNode = queryResult.releaseReturnValue(); 606 if (!queryResultNode) 607 return { }; 608 609 auto resultNodeId = pushNodePathToFrontend(errorString, queryResultNode); 606 610 if (!resultNodeId) 607 611 return makeUnexpected(errorString); 608 612 609 return resultNodeId;613 return { resultNodeId }; 610 614 } 611 615 -
branches/safari-613-branch/Source/WebCore/inspector/agents/InspectorDOMAgent.h
r279439 r294844 104 104 105 105 // DOMBackendDispatcherHandler 106 Inspector::Protocol::ErrorStringOr< Inspector::Protocol::DOM::NodeId> querySelector(Inspector::Protocol::DOM::NodeId, const String& selector);106 Inspector::Protocol::ErrorStringOr<std::optional<Inspector::Protocol::DOM::NodeId>> querySelector(Inspector::Protocol::DOM::NodeId, const String& selector); 107 107 Inspector::Protocol::ErrorStringOr<Ref<JSON::ArrayOf<Inspector::Protocol::DOM::NodeId>>> querySelectorAll(Inspector::Protocol::DOM::NodeId, const String& selector); 108 108 Inspector::Protocol::ErrorStringOr<Ref<Inspector::Protocol::DOM::Node>> getDocument();
Note:
See TracChangeset
for help on using the changeset viewer.