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

Unified Diff: extensions/renderer/extension_helper.cc

Issue 2923053002: Move MainWorldScriptContext accessor/method from WebFrame to WebLocalFrame. (Closed)
Patch Set: . Created 3 years, 6 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
Index: extensions/renderer/extension_helper.cc
diff --git a/extensions/renderer/extension_helper.cc b/extensions/renderer/extension_helper.cc
index d90a34d7066fcc1186acd604aed54accda9a574f..c58c556ebd8eb60b9bc59e54314ceb5cc110afac 100644
--- a/extensions/renderer/extension_helper.cc
+++ b/extensions/renderer/extension_helper.cc
@@ -15,6 +15,7 @@
#include "extensions/renderer/dispatcher.h"
#include "third_party/WebKit/public/platform/WebURLRequest.h"
#include "third_party/WebKit/public/web/WebDocument.h"
+#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/WebKit/public/web/WebView.h"
namespace extensions {
@@ -67,8 +68,15 @@ void ExtensionHelper::OnSetFrameName(const std::string& name) {
void ExtensionHelper::OnAppWindowClosed() {
v8::HandleScope scope(v8::Isolate::GetCurrent());
- v8::Local<v8::Context> v8_context =
- render_view()->GetWebView()->MainFrame()->MainWorldScriptContext();
+ if (!render_view()->GetWebView()->MainFrame()->IsWebLocalFrame()) {
dcheng 2017/06/06 19:57:17 Is this actually something we need to handle? I do
Łukasz Anforowicz 2017/06/07 20:35:07 Good point - ExtensionMsg_AppWindowClosed is sent
+ NOTREACHED();
+ return;
+ }
+ v8::Local<v8::Context> v8_context = render_view()
+ ->GetWebView()
+ ->MainFrame()
+ ->ToWebLocalFrame()
+ ->MainWorldScriptContext();
ScriptContext* script_context =
dispatcher_->script_context_set().GetByV8Context(v8_context);
if (!script_context)

Powered by Google App Engine
This is Rietveld 408576698