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

Unified Diff: extensions/renderer/resources/binding.js

Issue 1930213002: [Extensions] More bindings improvements (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 8 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 | « extensions/renderer/module_system_test.cc ('k') | extensions/renderer/script_context.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/resources/binding.js
diff --git a/extensions/renderer/resources/binding.js b/extensions/renderer/resources/binding.js
index 9c9aad92d1203a2f681dd4647df3771d9941eda1..0eef6cf9031ce0e3a5fdaa278a1b9f99a2009f94 100644
--- a/extensions/renderer/resources/binding.js
+++ b/extensions/renderer/resources/binding.js
@@ -4,6 +4,8 @@
var Event = require('event_bindings').Event;
var forEach = require('utils').forEach;
+// Note: Beware sneaky getters/setters when using GetAvailbility(). Use safe/raw
+// variables as arguments.
var GetAvailability = requireNative('v8_context').GetAvailability;
var exceptionHandler = require('uncaught_exception_handler');
var lastError = require('lastError');
@@ -249,7 +251,7 @@ Binding.prototype = {
// Binding.generate.
// Additionally, since the schema is an object returned from a native
// handler, its properties don't have the custom getters/setters that a page
- // may have put on Object.prototype.
+ // may have put on Object.prototype, and the object is frozen by v8.
var schema = schemaRegistry.GetSchema(this.apiName_);
function shouldCheckUnprivileged() {
@@ -379,9 +381,10 @@ Binding.prototype = {
var apiFunction = {};
apiFunction.definition = functionDef;
- apiFunction.name = schema.namespace + '.' + functionDef.name;
+ var apiFunctionName = schema.namespace + '.' + functionDef.name;
+ apiFunction.name = apiFunctionName;
- if (!GetAvailability(apiFunction.name).is_available ||
+ if (!GetAvailability(apiFunctionName).is_available ||
(checkUnprivileged && !isSchemaAccessAllowed(functionDef))) {
this.apiFunctions_.registerUnavailable(functionDef.name);
return;
« no previous file with comments | « extensions/renderer/module_system_test.cc ('k') | extensions/renderer/script_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698