Index: chrome/renderer/resources/extensions/app_custom_bindings.js |
diff --git a/chrome/renderer/resources/extensions/app_custom_bindings.js b/chrome/renderer/resources/extensions/app_custom_bindings.js |
index 4d58054b989b2a6b18d6ff555db9153abf1fe7c9..3fe84cbd70c236f33650c8236c0cac8da7b5855e 100644 |
--- a/chrome/renderer/resources/extensions/app_custom_bindings.js |
+++ b/chrome/renderer/resources/extensions/app_custom_bindings.js |
@@ -35,13 +35,21 @@ var app = { |
// |
// So, define it manually, and let the getIsInstalled function act as its |
// documentation. |
-app.__defineGetter__('isInstalled', wrapForLogging(appNatives.GetIsInstalled)); |
+$Object.defineProperty( |
Devlin
2017/05/04 18:58:50
all these changes are just to guard against untrus
|
+ app, 'isInstalled', |
+ { |
+ __proto__: null, |
+ configurable: true, |
+ enumerable: true, |
+ writable: true, |
+ get: wrapForLogging(appNatives.GetIsInstalled), |
+ }); |
// Called by app_bindings.cc. |
function onInstallStateResponse(state, callbackId) { |
var callback = callbacks[callbackId]; |
delete callbacks[callbackId]; |
- if (typeof(callback) == 'function') { |
+ if (typeof callback == 'function') { |
try { |
callback(state); |
} catch (e) { |
@@ -52,16 +60,24 @@ function onInstallStateResponse(state, callbackId) { |
} |
// TODO(kalman): move this stuff to its own custom bindings. |
-var callbacks = {}; |
+var callbacks = { __proto__: null }; |
var nextCallbackId = 1; |
-app.installState = function getInstallState(callback) { |
+function getInstallState(callback) { |
var callbackId = nextCallbackId++; |
callbacks[callbackId] = callback; |
appNatives.GetInstallState(callbackId); |
-}; |
-if (extensionId) |
- app.installState = wrapForLogging(app.installState); |
+} |
+ |
+$Object.defineProperty( |
+ app, 'installState', |
+ { |
+ __proto__: null, |
+ configurable: true, |
+ enumerable: true, |
+ writable: true, |
+ get: wrapForLogging(getInstallState), |
+ }); |
exports.$set('binding', app); |
exports.$set('onInstallStateResponse', onInstallStateResponse); |