| Index: extensions/renderer/dispatcher.cc
|
| diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc
|
| index 10b26c595f7f4aebfae5ee5c4f6e88605ab35dd3..b65dc2a0834be6e5cc96046c9a6b6decb1b8d3bd 100644
|
| --- a/extensions/renderer/dispatcher.cc
|
| +++ b/extensions/renderer/dispatcher.cc
|
| @@ -268,6 +268,16 @@ void Dispatcher::DidCreateScriptContext(
|
| const Extension* effective_extension =
|
| GetExtensionFromFrameAndWorld(frame, world_id, true);
|
|
|
| + bool extension_is_platform_app = extension && extension->is_platform_app();
|
| +
|
| + // If we are navigating to a platform app URL, the extension must first have
|
| + // been activated. If not, IsWithinPlatformApp will incorrectly return false,
|
| + // and we will be missing information about what features the app has.
|
| + // (Note: This DCHECK is invalid for non-app extensions, which do not get
|
| + // activated in "unblessed" contexts such as content scripts and iframes.)
|
| + if (extension_is_platform_app)
|
| + DCHECK(IsExtensionActive(extension_id));
|
| +
|
| GURL frame_url = ScriptContext::GetDataSourceURLForFrame(frame);
|
| Feature::Context context_type =
|
| ClassifyJavaScriptContext(extension,
|
| @@ -317,13 +327,12 @@ void Dispatcher::DidCreateScriptContext(
|
|
|
| UpdateBindingsForContext(context);
|
|
|
| - bool is_within_platform_app = IsWithinPlatformApp();
|
| // Inject custom JS into the platform app context.
|
| - if (is_within_platform_app) {
|
| + if (extension_is_platform_app) {
|
| module_system->Require("platformApp");
|
| }
|
|
|
| - delegate_->RequireAdditionalModules(context, is_within_platform_app);
|
| + delegate_->RequireAdditionalModules(context, extension_is_platform_app);
|
|
|
| VLOG(1) << "Num tracked contexts: " << script_context_set_.size();
|
| }
|
|
|