Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: chrome/ext/background.js

Issue 5735785512828928: Remove tabs from TabMap onLoading instead of onBeforeNavigate on Safari (Closed)
Patch Set: Created Jan. 23, 2014, 11:33 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | safari/ext/background.js » ('j') | safari/ext/background.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/ext/background.js
===================================================================
--- a/chrome/ext/background.js
+++ b/chrome/ext/background.js
@@ -244,11 +244,15 @@
this.browserAction = new BrowserAction(tab.id);
- this.onBeforeNavigate = ext.tabs.onBeforeNavigate._bindToTab(this);
this.onLoading = ext.tabs.onLoading._bindToTab(this);
this.onCompleted = ext.tabs.onCompleted._bindToTab(this);
this.onActivated = ext.tabs.onActivated._bindToTab(this);
this.onRemoved = ext.tabs.onRemoved._bindToTab(this);
+
+ // the "beforeNavigate" event in Safari isn't dispatched when a new URL
+ // was entered into the address bar. So we can only use it only on Chrome,
+ // but we have to hide it from the browser-independent high level code.
+ this._onBeforeNavigate = ext.tabs._onBeforeNavigate._bindToTab(this);
};
Tab.prototype = {
get url()
@@ -301,7 +305,7 @@
{
tab.onRemoved.addListener(this._delete);
if (this._deleteTabOnBeforeNavigate)
- tab.onBeforeNavigate.addListener(this._delete);
+ tab._onBeforeNavigate.addListener(this._delete);
}
this._map[tab._id] = {tab: tab, value: value};
@@ -326,7 +330,7 @@
delete this._map[tab._id];
tab.onRemoved.removeListener(this._delete);
- tab.onBeforeNavigate.removeListener(this._delete);
+ tab._onBeforeNavigate.removeListener(this._delete);
};
@@ -513,11 +517,15 @@
};
ext.tabs = {
- onBeforeNavigate: new BeforeNavigateTabEventTarget(),
onLoading: new LoadingTabEventTarget(),
onCompleted: new CompletedTabEventTarget(),
onActivated: new ActivatedTabEventTarget(),
- onRemoved: new RemovedTabEventTarget()
+ onRemoved: new RemovedTabEventTarget(),
+
+ // the "beforeNavigate" event in Safari isn't dispatched when a new URL
+ // was entered into the address bar. So we can only use it only on Chrome,
+ // but we have to hide it from the browser-independent high level code.
+ _onBeforeNavigate: new BeforeNavigateTabEventTarget()
};
ext.webRequest = {
« no previous file with comments | « no previous file | safari/ext/background.js » ('j') | safari/ext/background.js » ('J')

Powered by Google App Engine
This is Rietveld