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

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: Robs 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..888dd0642f4c2520ef70ec73f6eaf02aff9b9d74 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 };
this.namespace = namespace;
}
+APIFunctions.prototype = {
+ __proto__: null,
+};
+
APIFunctions.prototype.register = function(apiName, apiFunction) {
this.apiFunctions_[apiName] = apiFunction;
};
@@ -184,9 +188,13 @@ function Binding(apiName) {
this.customHooks_ = [];
};
-Binding.create = function(apiName) {
- return new Binding(apiName);
-};
+$Object.defineProperty(Binding, 'create', {
+ __proto__: null,
+ 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,12 +384,11 @@ Binding.prototype = {
return;
}
- var apiFunction = {};
+ var apiFunction = { __proto__: null };
apiFunction.definition = functionDef;
- var apiFunctionName = schema.namespace + '.' + functionDef.name;
- apiFunction.name = apiFunctionName;
+ apiFunction.name = schema.namespace + '.' + functionDef.name;
- if (!GetAvailability(apiFunctionName).is_available ||
+ if (!GetAvailability(apiFunction.name).is_available ||
(checkUnprivileged && !isSchemaAccessAllowed(functionDef))) {
this.apiFunctions_.registerUnavailable(functionDef.name);
return;
« 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