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

Unified Diff: chrome/browser/devtools/devtools_ui_bindings.cc

Issue 2364633004: Lock down the registration of blob:chrome-extension:// URLs (Closed)
Patch Set: Fix layout test. Created 4 years, 3 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
Index: chrome/browser/devtools/devtools_ui_bindings.cc
diff --git a/chrome/browser/devtools/devtools_ui_bindings.cc b/chrome/browser/devtools/devtools_ui_bindings.cc
index bcf29e1d78f7c26bc833f5f306bb2563324a4f78..fd0690afd29cde123e98efa4e6caaaeb814999cc 100644
--- a/chrome/browser/devtools/devtools_ui_bindings.cc
+++ b/chrome/browser/devtools/devtools_ui_bindings.cc
@@ -43,6 +43,7 @@
#include "components/prefs/scoped_user_pref_update.h"
#include "components/syncable_prefs/pref_service_syncable.h"
#include "components/zoom/page_zoom.h"
+#include "content/public/browser/child_process_security_policy.h"
#include "content/public/browser/devtools_external_agent_proxy.h"
#include "content/public/browser/devtools_external_agent_proxy_delegate.h"
#include "content/public/browser/navigation_controller.h"
@@ -58,6 +59,7 @@
#include "content/public/common/renderer_preferences.h"
#include "content/public/common/url_constants.h"
#include "extensions/browser/extension_registry.h"
+#include "extensions/common/constants.h"
#include "extensions/common/permissions/permissions_data.h"
#include "ipc/ipc_channel.h"
#include "net/base/io_buffer.h"
@@ -1070,6 +1072,15 @@ void DevToolsUIBindings::AddDevToolsExtensionsToClient() {
extensions::APIPermission::kExperimental)));
results.Append(std::move(extension_info));
}
+ if (!results.empty()) {
+ // At least one devtools extension exists; it will need to run in the
+ // devtools process. Grant it permission to load documents with
+ // chrome-extension:// origins.
+ content::ChildProcessSecurityPolicy::GetInstance()->GrantScheme(
+ web_contents_->GetMainFrame()->GetProcess()->GetID(),
+ extensions::kExtensionScheme);
+ }
+
CallClientFunction("DevToolsAPI.addExtensions",
&results, NULL, NULL);
}

Powered by Google App Engine
This is Rietveld 408576698