From a26646a811cd59a48366bee8dc7fd3d41a61afff Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Fri, 7 Jan 2022 12:17:46 -0800 Subject: [PATCH] browser(webkit): restore InspectorDOMAgent::resolveNode logic prior to #11105 (#11255) --- browser_patches/webkit/BUILD_NUMBER | 4 ++-- browser_patches/webkit/patches/bootstrap.diff | 20 +++++++++++++------ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/browser_patches/webkit/BUILD_NUMBER b/browser_patches/webkit/BUILD_NUMBER index b4358e74a5..f148617c59 100644 --- a/browser_patches/webkit/BUILD_NUMBER +++ b/browser_patches/webkit/BUILD_NUMBER @@ -1,2 +1,2 @@ -1591 -Changed: yurys@chromium.org Fri 07 Jan 2022 11:27:13 AM PST +1592 +Changed: yurys@chromium.org Fri 07 Jan 2022 12:11:24 PM PST diff --git a/browser_patches/webkit/patches/bootstrap.diff b/browser_patches/webkit/patches/bootstrap.diff index d9207084b1..49660212d9 100644 --- a/browser_patches/webkit/patches/bootstrap.diff +++ b/browser_patches/webkit/patches/bootstrap.diff @@ -3297,7 +3297,7 @@ index d2957810d8382c9351d5a93f144aed1493bcc651..8669933013d7972e355eacc358646d65 { return context ? instrumentingAgents(*context) : nullptr; diff --git a/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp b/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp -index 7a790bb23c8f37af57e4284b367cad9d679a434f..6690fcc604ae0036973845ac4347d15516e09571 100644 +index 7a790bb23c8f37af57e4284b367cad9d679a434f..a8b090780ff0811a0ac7614ee6ad3da1d01df665 100644 --- a/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp +++ b/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp @@ -62,12 +62,16 @@ @@ -3540,21 +3540,29 @@ index 7a790bb23c8f37af57e4284b367cad9d679a434f..6690fcc604ae0036973845ac4347d155 { Document* document = &node->document(); if (auto* templateHost = document->templateDocumentHost()) -@@ -2849,7 +2983,12 @@ RefPtr InspectorDOMAgent::resolveNode(Node* nod +@@ -2848,12 +2982,18 @@ RefPtr InspectorDOMAgent::resolveNode(Node* nod + if (!frame) return nullptr; - auto& globalObject = mainWorldGlobalObject(*frame); +- auto& globalObject = mainWorldGlobalObject(*frame); - auto injectedScript = m_injectedScriptManager.injectedScriptFor(&globalObject); + InjectedScript injectedScript; -+ if (contextId) ++ if (contextId) { + injectedScript = m_injectedScriptManager.injectedScriptForId(*contextId); -+ else ++ } else { ++ auto& globalObject = mainWorldGlobalObject(*frame); + injectedScript = m_injectedScriptManager.injectedScriptFor(&globalObject); ++ } + if (injectedScript.hasNoValue()) return nullptr; -@@ -2876,4 +3015,42 @@ Protocol::ErrorStringOr InspectorDOMAgent::setAllowEditingUserAgentShadowT +- return injectedScript.wrapObject(nodeAsScriptValue(globalObject, node), objectGroup); ++ return injectedScript.wrapObject(nodeAsScriptValue(*injectedScript.globalObject(), node), objectGroup); + } + + Node* InspectorDOMAgent::scriptValueAsNode(JSC::JSValue value) +@@ -2876,4 +3016,42 @@ Protocol::ErrorStringOr InspectorDOMAgent::setAllowEditingUserAgentShadowT return { }; }