Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1017)

Unified Diff: Source/core/inspector/InspectorDOMAgent.cpp

Issue 138743008: Make sure the root node of selector queries is a ContainerNode (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/SelectorQuery.cpp ('k') | Source/web/WebNode.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/InspectorDOMAgent.cpp
diff --git a/Source/core/inspector/InspectorDOMAgent.cpp b/Source/core/inspector/InspectorDOMAgent.cpp
index 38120b1c3276dc8c946b546a7b58c4b37f0826f3..51e552c1fd43f22a040ddcc4d84823ad4df01fa1 100755
--- a/Source/core/inspector/InspectorDOMAgent.cpp
+++ b/Source/core/inspector/InspectorDOMAgent.cpp
@@ -558,11 +558,11 @@ void InspectorDOMAgent::querySelector(ErrorString* errorString, int nodeId, cons
{
*elementId = 0;
Node* node = assertNode(errorString, nodeId);
- if (!node)
+ if (!node || !node->isContainerNode())
return;
TrackExceptionState exceptionState;
- RefPtr<Element> element = node->querySelector(AtomicString(selectors), exceptionState);
+ RefPtr<Element> element = toContainerNode(node)->querySelector(AtomicString(selectors), exceptionState);
if (exceptionState.hadException()) {
*errorString = "DOM Error while querying";
return;
@@ -575,11 +575,11 @@ void InspectorDOMAgent::querySelector(ErrorString* errorString, int nodeId, cons
void InspectorDOMAgent::querySelectorAll(ErrorString* errorString, int nodeId, const String& selectors, RefPtr<TypeBuilder::Array<int> >& result)
{
Node* node = assertNode(errorString, nodeId);
- if (!node)
+ if (!node || !node->isContainerNode())
return;
TrackExceptionState exceptionState;
- RefPtr<NodeList> nodes = node->querySelectorAll(AtomicString(selectors), exceptionState);
+ RefPtr<NodeList> nodes = toContainerNode(node)->querySelectorAll(AtomicString(selectors), exceptionState);
if (exceptionState.hadException()) {
*errorString = "DOM Error while querying";
return;
« no previous file with comments | « Source/core/dom/SelectorQuery.cpp ('k') | Source/web/WebNode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698