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

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

Issue 1903273003: [Extensions] Sprinkle in some more null protos and defineProperty's (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 | « no previous file | no next file » | 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 13ac7f960ccd89e28d61d7e52ca65baded2c8451..5887b1d038b6ff5d3eabce0fee4f296f9d57b5f8 100644
--- a/extensions/renderer/resources/binding.js
+++ b/extensions/renderer/resources/binding.js
@@ -26,11 +26,15 @@ var sendRequest = sendRequestHandler.sendRequest;
// modify their behaviour (such as a custom way to handle requests to the
// API, a custom callback, etc).
function APIFunctions(namespace) {
- this.apiFunctions_ = {};
- this.unavailableApiFunctions_ = {};
+ this.apiFunctions_ = { __proto__: null };
+ this.unavailableApiFunctions_ = { __proto: null };
robwu 2016/04/21 10:29:33 Typo: __proto -> __proto__.
Devlin 2016/04/21 18:28:30 D'oh, done.
this.namespace = namespace;
}
+APIFunctions.prototype = {
+ __proto__: null,
+};
+
APIFunctions.prototype.register = function(apiName, apiFunction) {
this.apiFunctions_[apiName] = apiFunction;
};
@@ -184,9 +188,12 @@ function Binding(apiName) {
this.customHooks_ = [];
};
-Binding.create = function(apiName) {
- return new Binding(apiName);
-};
+$Object.defineProperty(Binding, 'create', {
robwu 2016/04/21 10:29:33 Also use __proto__: null in the property descripto
Devlin 2016/04/21 18:28:30 I'm not as worried about avoiding throwing at the
+ configurable: false,
+ enumerable: false,
+ value: function(apiName) { return new Binding(apiName); },
+ writable: false,
+});
Binding.prototype = {
// Sneaky workaround for Object.prototype getters/setters - our prototype
@@ -376,7 +383,7 @@ Binding.prototype = {
return;
}
- var apiFunction = {};
+ var apiFunction = { __proto__: null };
robwu 2016/04/21 10:29:33 With this change, the separate apiFunctionName var
Devlin 2016/04/21 18:28:30 Done.
apiFunction.definition = functionDef;
var apiFunctionName = schema.namespace + '.' + functionDef.name;
apiFunction.name = apiFunctionName;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698