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

Unified Diff: extensions/renderer/dispatcher.cc

Issue 371563005: Extensions: DCHECK that all app pages are blessed before use. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address kalman's comments. Created 6 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698