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

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

Issue 9965005: Deprecate chrome.extension.sendRequest in favor of sendMessage, with a safer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 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/event.js
diff --git a/chrome/renderer/resources/extensions/event.js b/chrome/renderer/resources/extensions/event.js
index c8a05cff7005e1ed2241a089adfaa86772231dd3..63b7d7f9127edfd59d816db7077d85979f211c97 100644
--- a/chrome/renderer/resources/extensions/event.js
+++ b/chrome/renderer/resources/extensions/event.js
@@ -115,8 +115,10 @@
if (eventArgumentMassagers[name])
eventArgumentMassagers[name](args);
}
- return attachedNamedEvents[name].dispatch.apply(
+ var result = attachedNamedEvents[name].dispatch.apply(
attachedNamedEvents[name], args);
+ if (result && result.validationErrors)
+ return result.validationErrors;
}
};
@@ -193,16 +195,21 @@
var args = Array.prototype.slice.call(arguments);
var validationErrors = this.validate_(args);
if (validationErrors) {
- return validationErrors;
+ return {validationErrors: validationErrors};
}
+ var results = [];
for (var i = 0; i < this.listeners_.length; i++) {
try {
- this.listeners_[i].apply(null, args);
+ var result = this.listeners_[i].apply(null, args);
+ if (result !== undefined)
+ results.push(result);
} catch (e) {
console.error("Error in event handler for '" + this.eventName_ +
"': " + e.stack);
}
}
+ if (results.length)
+ return {results: results};
};
// Attaches this event object to its name. Only one object can have a given
« no previous file with comments | « chrome/common/extensions/docs/tabs.html ('k') | chrome/renderer/resources/extensions/extension_custom_bindings.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698