Chromium Code Reviews| Index: extensions/renderer/programmatic_script_injector.cc |
| diff --git a/extensions/renderer/programmatic_script_injector.cc b/extensions/renderer/programmatic_script_injector.cc |
| index 0c40d72054e23e3694dd969eb5d3c2e897b43400..762fc0325b8c731231ae160d168e9e70c071b145 100644 |
| --- a/extensions/renderer/programmatic_script_injector.cc |
| +++ b/extensions/renderer/programmatic_script_injector.cc |
| @@ -26,16 +26,9 @@ |
| namespace extensions { |
| ProgrammaticScriptInjector::ProgrammaticScriptInjector( |
| - const ExtensionMsg_ExecuteCode_Params& params, |
| - content::RenderFrame* render_frame) |
| + const ExtensionMsg_ExecuteCode_Params& params) |
| : params_(new ExtensionMsg_ExecuteCode_Params(params)), |
| - url_( |
| - ScriptContext::GetDataSourceURLForFrame(render_frame->GetWebFrame())), |
| finished_(false) { |
| - if (url_.SchemeIs(url::kAboutScheme)) { |
| - origin_for_about_error_ = |
| - render_frame->GetWebFrame()->getSecurityOrigin().toString().utf8(); |
| - } |
| } |
| ProgrammaticScriptInjector::~ProgrammaticScriptInjector() { |
| @@ -74,6 +67,12 @@ PermissionsData::AccessType ProgrammaticScriptInjector::CanExecuteOnFrame( |
| const InjectionHost* injection_host, |
| blink::WebLocalFrame* frame, |
| int tab_id) const { |
| + // Note: we calculate url_ now and not in the constructor because with |
| + // PlzNavigate we won't have the URL at that point. |
| + url_ = ScriptContext::GetDataSourceURLForFrame(frame); |
|
Devlin
2016/11/01 23:39:32
Do we document anywhere at which point we *do* hav
jam
2016/11/01 23:47:03
Sure I'll add a comment here.
|
| + if (url_.SchemeIs(url::kAboutScheme)) { |
| + origin_for_about_error_ = frame->getSecurityOrigin().toString().utf8(); |
| + } |
| GURL effective_document_url = ScriptContext::GetEffectiveDocumentURL( |
| frame, frame->document().url(), params_->match_about_blank); |
| if (params_->is_web_view) { |