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

Unified Diff: extensions/renderer/render_frame_observer_natives.cc

Issue 1642283002: Deal with frame removal by content scripts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Last nits Created 4 years, 9 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 | « extensions/renderer/extension_frame_helper.cc ('k') | extensions/renderer/script_injection_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/render_frame_observer_natives.cc
diff --git a/extensions/renderer/render_frame_observer_natives.cc b/extensions/renderer/render_frame_observer_natives.cc
index 1c1f06e87f3217890d3519e426f51be50ebc4542..7c507b379933d487dc0c5c9c3932c078f896da72 100644
--- a/extensions/renderer/render_frame_observer_natives.cc
+++ b/extensions/renderer/render_frame_observer_natives.cc
@@ -24,12 +24,11 @@ class LoadWatcher : public content::RenderFrameObserver {
: content::RenderFrameObserver(frame), callback_(callback) {}
void DidCreateDocumentElement() override {
- // The callback must be run as soon as the root element is available.
- // Running the callback may trigger DidCreateDocumentElement or
- // DidFailProvisionalLoad, so delete this before running the callback.
- base::Callback<void(bool)> callback = callback_;
+ // Defer the callback instead of running it now to avoid re-entrancy caused
+ // by the JavaScript callback.
+ ExtensionFrameHelper::Get(render_frame())
+ ->ScheduleAtDocumentStart(base::Bind(callback_, true));
delete this;
- callback.Run(true);
}
void DidFailProvisionalLoad(const blink::WebURLError& error) override {
« no previous file with comments | « extensions/renderer/extension_frame_helper.cc ('k') | extensions/renderer/script_injection_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698