mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-16 15:17:14 +00:00
Bug 944375 - Add a new const array named TAB_OBSERVING to SessionStore.jsm and modify onTabAdd and onTabRemove to subscribe to events by iterating through this array. r=ttaubert
This commit is contained in:
parent
905b201116
commit
1dbc15f1b7
@ -78,6 +78,11 @@ const TAB_EVENTS = [
|
||||
"TabUnpinned"
|
||||
];
|
||||
|
||||
// Browser events observed.
|
||||
const BROWSER_EVENTS = [
|
||||
"load", "SwapDocShells", "UserTypedValueChanged"
|
||||
];
|
||||
|
||||
// The number of milliseconds in a day
|
||||
const MS_PER_DAY = 1000.0 * 60.0 * 60.0 * 24.0;
|
||||
|
||||
@ -1243,9 +1248,7 @@ let SessionStoreInternal = {
|
||||
*/
|
||||
onTabAdd: function ssi_onTabAdd(aWindow, aTab, aNoNotification) {
|
||||
let browser = aTab.linkedBrowser;
|
||||
browser.addEventListener("load", this, true);
|
||||
browser.addEventListener("SwapDocShells", this, true);
|
||||
browser.addEventListener("UserTypedValueChanged", this, true);
|
||||
BROWSER_EVENTS.forEach(msg => browser.addEventListener(msg, this, true));
|
||||
|
||||
let mm = browser.messageManager;
|
||||
MESSAGES.forEach(msg => mm.addMessageListener(msg, this));
|
||||
@ -1271,9 +1274,7 @@ let SessionStoreInternal = {
|
||||
*/
|
||||
onTabRemove: function ssi_onTabRemove(aWindow, aTab, aNoNotification) {
|
||||
let browser = aTab.linkedBrowser;
|
||||
browser.removeEventListener("load", this, true);
|
||||
browser.removeEventListener("SwapDocShells", this, true);
|
||||
browser.removeEventListener("UserTypedValueChanged", this, true);
|
||||
BROWSER_EVENTS.forEach(msg => browser.removeEventListener(msg, this, true));
|
||||
|
||||
let mm = browser.messageManager;
|
||||
MESSAGES.forEach(msg => mm.removeMessageListener(msg, this));
|
||||
|
Loading…
x
Reference in New Issue
Block a user