diff options
Diffstat (limited to 'chrome/renderer/extensions/event_bindings.cc')
-rw-r--r-- | chrome/renderer/extensions/event_bindings.cc | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/chrome/renderer/extensions/event_bindings.cc b/chrome/renderer/extensions/event_bindings.cc index a751785..f1dfa19 100644 --- a/chrome/renderer/extensions/event_bindings.cc +++ b/chrome/renderer/extensions/event_bindings.cc @@ -128,6 +128,14 @@ class ExtensionImpl : public ExtensionBase { } }; +// Returns true if the extension running in the given |context| has sufficient +// permissions to access the data. +static bool HasSufficientPermissions(ContextInfo* context, + bool requires_incognito_access) { + return (!requires_incognito_access || + ExtensionProcessBindings::HasIncognitoEnabled(context->extension_id)); +} + } // namespace const char* EventBindings::kName = "chrome/EventBindings"; @@ -290,7 +298,8 @@ void EventBindings::HandleContextDestroyed(WebFrame* frame) { // static void EventBindings::CallFunction(const std::string& function_name, int argc, v8::Handle<v8::Value>* argv, - RenderView* render_view) { + RenderView* render_view, + bool requires_incognito_access) { // We copy the context list, because calling into javascript may modify it // out from under us. We also guard against deleted contexts by checking if // they have been cleared first. @@ -300,8 +309,13 @@ void EventBindings::CallFunction(const std::string& function_name, it != contexts.end(); ++it) { if (render_view && render_view != (*it)->render_view) continue; + if ((*it)->context.IsEmpty()) continue; + + if (!HasSufficientPermissions(it->get(), requires_incognito_access)) + continue; + v8::Handle<v8::Value> retval = CallFunctionInContext((*it)->context, function_name, argc, argv); // In debug, the js will validate the event parameters and return a |