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

Unified Diff: chrome/renderer/resources/event_bindings.js

Issue 152003: Fix some issues with extension messaging: (Closed)
Patch Set: Created 11 years, 6 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 | « chrome/renderer/renderer_resources.grd ('k') | chrome/renderer/resources/extension_process_bindings.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/resources/event_bindings.js
diff --git a/chrome/renderer/resources/event_bindings.js b/chrome/renderer/resources/event_bindings.js
index 78a1ceb66c233b26dc88131ee7e111da3b604e6c..a58cf37a36dfa9193436782c83e355c932ed9766 100644
--- a/chrome/renderer/resources/event_bindings.js
+++ b/chrome/renderer/resources/event_bindings.js
@@ -59,6 +59,12 @@ var chrome = chrome || {};
}
};
+ // Test if a named event has any listeners.
+ chromeHidden.Event.hasListener = function(name) {
+ return (attachedNamedEvents[name] &&
+ attachedNamedEvents[name].listeners_.length > 0);
+ }
+
// Registers a callback to be called when this event is dispatched.
chrome.Event.prototype.addListener = function(cb) {
this.listeners_.push(cb);
@@ -182,11 +188,16 @@ var chrome = chrome || {};
request(sargs, requestId, hasCallback);
}
- // Special unload event: we don't use the DOM unload because that slows
- // down tab shutdown. On the other hand, this might not always fire, since
- // Chrome will terminate renderers on shutdown (SuddenTermination).
+ // Special load events: we don't use the DOM unload because that slows
+ // down tab shutdown. On the other hand, onUnload might not always fire,
+ // since Chrome will terminate renderers on shutdown (SuddenTermination).
+ chromeHidden.onLoad = new chrome.Event();
chromeHidden.onUnload = new chrome.Event();
+ chromeHidden.dispatchOnLoad = function(extensionId) {
+ chromeHidden.onLoad.dispatch(extensionId);
+ }
+
chromeHidden.dispatchOnUnload = function() {
chromeHidden.onUnload.dispatch();
for (var i in allAttachedEvents)
« no previous file with comments | « chrome/renderer/renderer_resources.grd ('k') | chrome/renderer/resources/extension_process_bindings.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698