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

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

Issue 12440030: Use utils.forEach everywhere rather than Array.prototype.forEach to guard (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: make foreach of an array give numbers Created 7 years, 9 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
Index: chrome/renderer/resources/extensions/binding.js
diff --git a/chrome/renderer/resources/extensions/binding.js b/chrome/renderer/resources/extensions/binding.js
index d6fb4dfed1e6c665aafe1746df6bf52b7c4e76fe..9fdb392e9aae13d9e6bee6836718a4ecaecd2efa 100644
--- a/chrome/renderer/resources/extensions/binding.js
+++ b/chrome/renderer/resources/extensions/binding.js
@@ -4,18 +4,19 @@
require('json_schema');
require('event_bindings');
-var schemaRegistry = requireNative('schema_registry');
-var sendRequest = require('sendRequest').sendRequest;
-var utils = require('utils');
-var chromeHidden = requireNative('chrome_hidden').GetChromeHidden();
var chrome = requireNative('chrome').GetChrome();
-var schemaUtils = require('schemaUtils');
-var process = requireNative('process');
-var manifestVersion = process.GetManifestVersion();
-var extensionId = process.GetExtensionId();
-var contextType = process.GetContextType();
+var chromeHidden = requireNative('chrome_hidden').GetChromeHidden();
+var forEach = require('utils').forEach;
var GetAvailability = requireNative('v8_context').GetAvailability;
var logging = requireNative('logging');
+var process = requireNative('process');
+var contextType = process.GetContextType();
+var extensionId = process.GetExtensionId();
+var manifestVersion = process.GetManifestVersion();
+var schemaRegistry = requireNative('schema_registry');
+var schemaUtils = require('schemaUtils');
+var sendRequest = require('sendRequest').sendRequest;
+var utils = require('utils');
// Stores the name and definition of each API function, with methods to
// modify their behaviour (such as a custom way to handle requests to the
@@ -164,7 +165,7 @@ Binding.prototype = {
// TODO(kalman/cduvall): Refactor this so |runHooks_| is not needed.
runHooks_: function(api) {
- this.customHooks_.forEach(function(hook) {
+ forEach(this.customHooks_, function(i, hook) {
if (!isSchemaNodeSupported(this.schema_, platform, manifestVersion))
return;
@@ -208,7 +209,7 @@ Binding.prototype = {
// Add types to global schemaValidator
if (schema.types) {
- schema.types.forEach(function(t) {
+ forEach(schema.types, function(i, t) {
if (!isSchemaNodeSupported(t, platform, manifestVersion))
return;
@@ -242,7 +243,7 @@ Binding.prototype = {
// Setup Functions.
if (schema.functions) {
- schema.functions.forEach(function(functionDef) {
+ forEach(schema.functions, function(i, functionDef) {
if (functionDef.name in mod) {
throw new Error('Function ' + functionDef.name +
' already defined in ' + schema.namespace);
@@ -309,7 +310,7 @@ Binding.prototype = {
// Setup Events
if (schema.events) {
- schema.events.forEach(function(eventDef) {
+ forEach(schema.events, function(i, eventDef) {
if (eventDef.name in mod) {
throw new Error('Event ' + eventDef.name +
' already defined in ' + schema.namespace);
@@ -345,7 +346,7 @@ Binding.prototype = {
if (!properties)
return;
- utils.forEach(properties, function(propertyName, propertyDef) {
+ forEach(properties, function(propertyName, propertyDef) {
if (propertyName in m)
return; // TODO(kalman): be strict like functions/events somehow.
if (!isSchemaNodeSupported(propertyDef, platform, manifestVersion))

Powered by Google App Engine
This is Rietveld 408576698