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

Unified Diff: chrome/renderer/extensions/dispatcher.cc

Issue 138563005: <webview>: Inject denyWebView into all extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated comments Created 6 years, 11 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: chrome/renderer/extensions/dispatcher.cc
diff --git a/chrome/renderer/extensions/dispatcher.cc b/chrome/renderer/extensions/dispatcher.cc
index 277b09464ed5542e9e6abd5052536d8680d8c637..c2b749956cda17687767c59e3becf6ae7c3f49cb 100644
--- a/chrome/renderer/extensions/dispatcher.cc
+++ b/chrome/renderer/extensions/dispatcher.cc
@@ -1186,39 +1186,32 @@ void Dispatcher::DidCreateScriptContext(
module_system->Require("windowControls");
}
- // Currently only platform apps and whitelisted component extensions support
- // the <webview> tag, because the "denyWebView" module will affect the
- // performance of DOM modifications (http://crbug.com/196453).
// We used to limit WebView to |BLESSED_EXTENSION_CONTEXT| within platform
// apps. An ext/app runs in a blessed extension context, if it is the active
// extension in the current process, in other words, if it is loaded in a top
// frame. To support webview in a non-frame extension, we have to allow
// unblessed extension context as well.
- if (context_type == Feature::BLESSED_EXTENSION_CONTEXT ||
- context_type == Feature::UNBLESSED_EXTENSION_CONTEXT) {
- // Note: setting up the WebView class here, not the chrome.webview API.
- // The API will be automatically set up when first used.
- if (extension->HasAPIPermission(APIPermission::kWebView)) {
- module_system->Require("webView");
- bool includeExperimental =
- GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV;
- if (!includeExperimental) {
- // TODO(asargent) We need a whitelist for webview experimental.
- // crbug.com/264852
- std::string id_hash = base::SHA1HashString(extension->id());
- std::string hexencoded_id_hash = base::HexEncode(id_hash.c_str(),
- id_hash.length());
- if (hexencoded_id_hash == "8C3741E3AF0B93B6E8E0DDD499BB0B74839EA578" ||
- hexencoded_id_hash == "E703483CEF33DEC18B4B6DD84B5C776FB9182BDB" ||
- hexencoded_id_hash == "1A26E32DE447A17CBE5E9750CDBA78F58539B39C" ||
- hexencoded_id_hash == "59048028102D7B4C681DBC7BC6CD980C3DC66DA3")
- includeExperimental = true;
- }
- if (includeExperimental)
- module_system->Require("webViewExperimental");
+ // Note: setting up the WebView class here, not the chrome.webview API.
+ // The API will be automatically set up when first used.
+ if (extension && extension->HasAPIPermission(APIPermission::kWebView)) {
+ module_system->Require("webView");
+ if (GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV) {
+ module_system->Require("webViewExperimental");
} else {
- module_system->Require("denyWebView");
+ // TODO(asargent) We need a whitelist for webview experimental.
+ // crbug.com/264852
+ std::string id_hash = base::SHA1HashString(extension->id());
+ std::string hexencoded_id_hash = base::HexEncode(id_hash.c_str(),
+ id_hash.length());
+ if (hexencoded_id_hash == "8C3741E3AF0B93B6E8E0DDD499BB0B74839EA578" ||
+ hexencoded_id_hash == "E703483CEF33DEC18B4B6DD84B5C776FB9182BDB" ||
+ hexencoded_id_hash == "1A26E32DE447A17CBE5E9750CDBA78F58539B39C" ||
+ hexencoded_id_hash == "59048028102D7B4C681DBC7BC6CD980C3DC66DA3") {
+ module_system->Require("webViewExperimental");
+ }
}
+ } else {
+ module_system->Require("denyWebView");
}
// Same comment as above for <adview> tag.
« 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