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; |