| Index: chrome/renderer/extensions/event_bindings.cc
|
| diff --git a/chrome/renderer/extensions/event_bindings.cc b/chrome/renderer/extensions/event_bindings.cc
|
| index 52f5d0e1c6e0f22516fda0d7a911c5359bb8eb62..507dc00edea8c261b105f9c42c0376bcc55d8481 100644
|
| --- a/chrome/renderer/extensions/event_bindings.cc
|
| +++ b/chrome/renderer/extensions/event_bindings.cc
|
| @@ -11,6 +11,7 @@
|
| #include "chrome/renderer/extensions/bindings_utils.h"
|
| #include "chrome/renderer/extensions/event_bindings.h"
|
| #include "chrome/renderer/extensions/extension_process_bindings.h"
|
| +#include "chrome/renderer/extensions/extension_renderer_info.h"
|
| #include "chrome/renderer/extensions/js_only_v8_extensions.h"
|
| #include "chrome/renderer/render_thread.h"
|
| #include "chrome/renderer/render_view.h"
|
| @@ -167,6 +168,8 @@ static bool HasSufficientPermissions(ContextInfo* context,
|
| } // namespace
|
|
|
| const char* EventBindings::kName = "chrome/EventBindings";
|
| +const char* EventBindings::kTestingExtensionId =
|
| + "oooooooooooooooooooooooooooooooo";
|
|
|
| v8::Extension* EventBindings::Get() {
|
| static v8::Extension* extension = new ExtensionImpl();
|
| @@ -257,10 +260,10 @@ void EventBindings::HandleContextCreated(WebFrame* frame, bool content_script) {
|
| if (!ds)
|
| ds = frame->dataSource();
|
| GURL url = ds->request().url();
|
| - std::string extension_id;
|
| - if (url.SchemeIs(chrome::kExtensionScheme)) {
|
| - extension_id = url.host();
|
| - } else if (!content_script) {
|
| + std::string extension_id = ExtensionRendererInfo::GetIdByURL(url);
|
| +
|
| + if (!ExtensionRendererInfo::ExtensionBindingsAllowed(url) &&
|
| + !content_script) {
|
| // This context is a regular non-extension web page. Ignore it. We only
|
| // care about content scripts and extension frames.
|
| // (Unless we're in unit tests, in which case we don't care what the URL
|
| @@ -268,6 +271,10 @@ void EventBindings::HandleContextCreated(WebFrame* frame, bool content_script) {
|
| DCHECK(frame_context.IsEmpty() || frame_context == context);
|
| if (!in_unit_tests)
|
| return;
|
| +
|
| + // For tests, we want the dispatchOnLoad to actually setup our bindings,
|
| + // so we give a fake extension id;
|
| + extension_id = kTestingExtensionId;
|
| }
|
|
|
| v8::Persistent<v8::Context> persistent_context =
|
|
|