Skip to content

Commit

Permalink
Closes mozilla#41: Switch to built in jetpack window watcher to remov…
Browse files Browse the repository at this point in the history
…e unload+/watchWindows

Convert code to use WindowWatcher and remove now unused watchWindows/unload.
  • Loading branch information
Maxim Zhilyaev authored and Mardak committed Nov 2, 2012
1 parent d14ba73 commit 3e5c4cd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 148 deletions.
26 changes: 16 additions & 10 deletions siteSuggest/lib/main.js
Expand Up @@ -7,7 +7,7 @@ const {Ci,Cu,Cc} = require("chrome");
const {AppViewer} = require("appViewer");
const {Demographer} = require("Demographer");
const tabs = require("tabs");
const {watchWindows} = require("watchWindows");
const {WindowTracker} = require("window-utils");

Cu.import("resource://gre/modules/Services.jsm", this);

Expand Down Expand Up @@ -92,14 +92,20 @@ exports.main = function(options) {
});

// per-window initialization
watchWindows(function(window) {
let {gBrowser} = window;
let tracker = new WindowTracker({
onTrack: function(window) {
let {gBrowser} = window;
// Listen for tab content loads.
tabs.on("ready", function(tab) {
if (tabs.activeTab.url == "about:newtab") {
addApplicationFrame(window, gBrowser);
}
}); // end of tabs.on.ready
}, // end of onTrack

// Listen for tab content loads.
tabs.on("ready", function(tab) {
if (tabs.activeTab.url == "about:newtab") {
addAppsButton(window, gBrowser);
}
}); // end of tabs.on.ready
}); // end of watchWindows
// we explicitly do nothing for onUntrack
// there no browser XUL ui that we changed
// while changes to new tab are conceivably
// not critical: new tab gets replaced right away
}); // end of wondow tracker
}
73 changes: 0 additions & 73 deletions siteSuggest/lib/unload+.js

This file was deleted.

65 changes: 0 additions & 65 deletions siteSuggest/lib/watchWindows.js

This file was deleted.

0 comments on commit 3e5c4cd

Please sign in to comment.