Index: extensions/renderer/dispatcher.cc |
diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc |
index 44b2fd0f96e818a1bf056574ab16224c2ad99ab8..6b00488110d42f420623df0e02d5b22ac58b125d 100644 |
--- a/extensions/renderer/dispatcher.cc |
+++ b/extensions/renderer/dispatcher.cc |
@@ -257,12 +257,19 @@ void Dispatcher::DidCreateScriptContext( |
extension_id = ""; |
} |
+ bool extension_is_platform_app = extension && extension->is_platform_app(); |
+ |
Feature::Context context_type = |
ClassifyJavaScriptContext(extension, |
extension_group, |
ScriptContext::GetDataSourceURLForFrame(frame), |
frame->document().securityOrigin()); |
+ // Sanity check that all platform app URLs are given a blessed extension |
+ // context. If not, the app page would be missing features such as APIs. |
+ if (extension_is_platform_app) |
+ DCHECK_EQ(Feature::BLESSED_EXTENSION_CONTEXT, context_type); |
lazyboy
2014/07/21 20:24:50
@kalman, so you're suggesting to add
if (!extensio
not at google - send to devlin
2014/07/21 20:34:09
That would work, or a check like isWebviewProcess(
lazyboy
2014/07/21 22:03:20
The process itself doesn't know much about he webv
|
+ |
ScriptContext* context = |
delegate_->CreateScriptContext(v8_context, frame, extension, context_type) |
.release(); |
@@ -296,14 +303,13 @@ 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( |
- module_system, extension, context_type, is_within_platform_app); |
+ module_system, extension, context_type, extension_is_platform_app); |
VLOG(1) << "Num tracked contexts: " << script_context_set_.size(); |
} |