forked from mirrors/gecko-dev
Bug 1034036 - Part 1: Merge RecentWindow.jsm and UpdateTopLevelContentWindowIDHelper.jsm into one module called 'BrowserWindowTracker.jsm'. r=dao
MozReview-Commit-ID: 9qzq1aGvjDu --HG-- rename : browser/modules/UpdateTopLevelContentWindowIDHelper.jsm => browser/modules/BrowserWindowTracker.jsm extra : rebase_source : 9c4a728e13fd691d377e7f221c5632646115daca
This commit is contained in:
parent
c44a678ffa
commit
d16ee58ded
33 changed files with 210 additions and 254 deletions
|
|
@ -112,7 +112,7 @@ var CaptivePortalWatcher = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let win = RecentWindow.getMostRecentBrowserWindow();
|
let win = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||||
// If no browser window has focus, open and show the tab when we regain focus.
|
// If no browser window has focus, open and show the tab when we regain focus.
|
||||||
// This is so that if a different application was focused, when the user
|
// This is so that if a different application was focused, when the user
|
||||||
// (re-)focuses a browser window, we open the tab immediately in that window
|
// (re-)focuses a browser window, we open the tab immediately in that window
|
||||||
|
|
@ -135,7 +135,7 @@ var CaptivePortalWatcher = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let win = RecentWindow.getMostRecentBrowserWindow();
|
let win = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||||
if (win != Services.ww.activeWindow) {
|
if (win != Services.ww.activeWindow) {
|
||||||
// The window that got focused was not a browser window.
|
// The window that got focused was not a browser window.
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
||||||
BrowserUITelemetry: "resource:///modules/BrowserUITelemetry.jsm",
|
BrowserUITelemetry: "resource:///modules/BrowserUITelemetry.jsm",
|
||||||
BrowserUsageTelemetry: "resource:///modules/BrowserUsageTelemetry.jsm",
|
BrowserUsageTelemetry: "resource:///modules/BrowserUsageTelemetry.jsm",
|
||||||
BrowserUtils: "resource://gre/modules/BrowserUtils.jsm",
|
BrowserUtils: "resource://gre/modules/BrowserUtils.jsm",
|
||||||
|
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
|
||||||
CharsetMenu: "resource://gre/modules/CharsetMenu.jsm",
|
CharsetMenu: "resource://gre/modules/CharsetMenu.jsm",
|
||||||
Color: "resource://gre/modules/Color.jsm",
|
Color: "resource://gre/modules/Color.jsm",
|
||||||
ContentSearch: "resource:///modules/ContentSearch.jsm",
|
ContentSearch: "resource:///modules/ContentSearch.jsm",
|
||||||
|
|
@ -48,7 +49,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
||||||
PromiseUtils: "resource://gre/modules/PromiseUtils.jsm",
|
PromiseUtils: "resource://gre/modules/PromiseUtils.jsm",
|
||||||
ReaderMode: "resource://gre/modules/ReaderMode.jsm",
|
ReaderMode: "resource://gre/modules/ReaderMode.jsm",
|
||||||
ReaderParent: "resource:///modules/ReaderParent.jsm",
|
ReaderParent: "resource:///modules/ReaderParent.jsm",
|
||||||
RecentWindow: "resource:///modules/RecentWindow.jsm",
|
|
||||||
SafeBrowsing: "resource://gre/modules/SafeBrowsing.jsm",
|
SafeBrowsing: "resource://gre/modules/SafeBrowsing.jsm",
|
||||||
Sanitizer: "resource:///modules/Sanitizer.jsm",
|
Sanitizer: "resource:///modules/Sanitizer.jsm",
|
||||||
SessionStore: "resource:///modules/sessionstore/SessionStore.jsm",
|
SessionStore: "resource:///modules/sessionstore/SessionStore.jsm",
|
||||||
|
|
@ -1489,8 +1489,7 @@ var gBrowserInit = {
|
||||||
if (!getBoolPref("ui.click_hold_context_menus", false))
|
if (!getBoolPref("ui.click_hold_context_menus", false))
|
||||||
SetClickAndHoldHandlers();
|
SetClickAndHoldHandlers();
|
||||||
|
|
||||||
ChromeUtils.import("resource:///modules/UpdateTopLevelContentWindowIDHelper.jsm", {})
|
BrowserWindowTracker.track(window);
|
||||||
.trackBrowserWindow(window);
|
|
||||||
|
|
||||||
PlacesToolbarHelper.init();
|
PlacesToolbarHelper.init();
|
||||||
|
|
||||||
|
|
@ -2675,7 +2674,7 @@ async function BrowserViewSourceOfDocument(aArgsOrDocument) {
|
||||||
// In the case of popups, we need to find a non-popup browser window.
|
// In the case of popups, we need to find a non-popup browser window.
|
||||||
if (!tabBrowser || !window.toolbar.visible) {
|
if (!tabBrowser || !window.toolbar.visible) {
|
||||||
// This returns only non-popup browser windows by default.
|
// This returns only non-popup browser windows by default.
|
||||||
let browserWindow = RecentWindow.getMostRecentBrowserWindow();
|
let browserWindow = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||||
tabBrowser = browserWindow.gBrowser;
|
tabBrowser = browserWindow.gBrowser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5301,7 +5300,7 @@ nsBrowserAccess.prototype = {
|
||||||
if (window.toolbar.visible)
|
if (window.toolbar.visible)
|
||||||
win = window;
|
win = window;
|
||||||
else {
|
else {
|
||||||
win = RecentWindow.getMostRecentBrowserWindow({private: aIsPrivate});
|
win = BrowserWindowTracker.getMostRecentBrowserWindow({private: aIsPrivate});
|
||||||
needToFocusWin = true;
|
needToFocusWin = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -886,7 +886,7 @@ nsContextMenu.prototype = {
|
||||||
// (in the sidebar). Deal with those cases:
|
// (in the sidebar). Deal with those cases:
|
||||||
if (!tabBrowser || !tabBrowser.loadOneTab || !window.toolbar.visible) {
|
if (!tabBrowser || !tabBrowser.loadOneTab || !window.toolbar.visible) {
|
||||||
// This returns only non-popup browser windows by default.
|
// This returns only non-popup browser windows by default.
|
||||||
let browserWindow = RecentWindow.getMostRecentBrowserWindow();
|
let browserWindow = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||||
tabBrowser = browserWindow.gBrowser;
|
tabBrowser = browserWindow.gBrowser;
|
||||||
}
|
}
|
||||||
let relatedToCurrent = gBrowser && gBrowser.selectedBrowser == browser;
|
let relatedToCurrent = gBrowser && gBrowser.selectedBrowser == browser;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
ChromeUtils.import("resource:///modules/RecentWindow.jsm");
|
ChromeUtils.import("resource:///modules/BrowserWindowTracker.jsm");
|
||||||
|
|
||||||
ChromeUtils.defineModuleGetter(this, "CaptivePortalWatcher",
|
ChromeUtils.defineModuleGetter(this, "CaptivePortalWatcher",
|
||||||
"resource:///modules/CaptivePortalWatcher.jsm");
|
"resource:///modules/CaptivePortalWatcher.jsm");
|
||||||
|
|
@ -20,12 +20,12 @@ async function setupPrefsAndRecentWindowBehavior() {
|
||||||
// We need to test behavior when a portal is detected when there is no browser
|
// We need to test behavior when a portal is detected when there is no browser
|
||||||
// window, but we can't close the default window opened by the test harness.
|
// window, but we can't close the default window opened by the test harness.
|
||||||
// Instead, we deactivate CaptivePortalWatcher in the default window and
|
// Instead, we deactivate CaptivePortalWatcher in the default window and
|
||||||
// exclude it from RecentWindow.getMostRecentBrowserWindow in an attempt to
|
// exclude it from BrowserWindowTracker.getMostRecentBrowserWindow in an attempt to
|
||||||
// mask its presence.
|
// mask its presence.
|
||||||
window.CaptivePortalWatcher.uninit();
|
window.CaptivePortalWatcher.uninit();
|
||||||
let getMostRecentBrowserWindowCopy = RecentWindow.getMostRecentBrowserWindow;
|
let getMostRecentBrowserWindowCopy = BrowserWindowTracker.getMostRecentBrowserWindow;
|
||||||
let defaultWindow = window;
|
let defaultWindow = window;
|
||||||
RecentWindow.getMostRecentBrowserWindow = () => {
|
BrowserWindowTracker.getMostRecentBrowserWindow = () => {
|
||||||
let win = getMostRecentBrowserWindowCopy();
|
let win = getMostRecentBrowserWindowCopy();
|
||||||
if (win == defaultWindow) {
|
if (win == defaultWindow) {
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -34,7 +34,7 @@ async function setupPrefsAndRecentWindowBehavior() {
|
||||||
};
|
};
|
||||||
|
|
||||||
registerCleanupFunction(function cleanUp() {
|
registerCleanupFunction(function cleanUp() {
|
||||||
RecentWindow.getMostRecentBrowserWindow = getMostRecentBrowserWindowCopy;
|
BrowserWindowTracker.getMostRecentBrowserWindow = getMostRecentBrowserWindowCopy;
|
||||||
window.CaptivePortalWatcher.init();
|
window.CaptivePortalWatcher.init();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -90,8 +90,8 @@ const startupPhases = {
|
||||||
"nsPlacesExpiration.js",
|
"nsPlacesExpiration.js",
|
||||||
]),
|
]),
|
||||||
modules: new Set([
|
modules: new Set([
|
||||||
// Bug 1391495 - RecentWindow.jsm is intermittently used.
|
// Bug 1391495 - BrowserWindowTracker.jsm is intermittently used.
|
||||||
// "resource:///modules/RecentWindow.jsm",
|
// "resource:///modules/BrowserWindowTracker.jsm",
|
||||||
"resource://gre/modules/BookmarkHTMLUtils.jsm",
|
"resource://gre/modules/BookmarkHTMLUtils.jsm",
|
||||||
"resource://gre/modules/Bookmarks.jsm",
|
"resource://gre/modules/Bookmarks.jsm",
|
||||||
"resource://gre/modules/ContextualIdentityService.jsm",
|
"resource://gre/modules/ContextualIdentityService.jsm",
|
||||||
|
|
@ -128,7 +128,7 @@ if (Services.prefs.getBoolPref("browser.startup.blankWindow")) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gBrowser.selectedBrowser.isRemoteBrowser) {
|
if (!gBrowser.selectedBrowser.isRemoteBrowser) {
|
||||||
// With e10s disabled, Places and RecentWindow.jsm (from a
|
// With e10s disabled, Places and BrowserWindowTracker.jsm (from a
|
||||||
// SessionSaver.jsm timer) intermittently get loaded earlier. Likely
|
// SessionSaver.jsm timer) intermittently get loaded earlier. Likely
|
||||||
// due to messages from the 'content' process arriving synchronously
|
// due to messages from the 'content' process arriving synchronously
|
||||||
// instead of crossing a process boundary.
|
// instead of crossing a process boundary.
|
||||||
|
|
|
||||||
|
|
@ -11,14 +11,11 @@ ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
ChromeUtils.defineModuleGetter(this, "PrivateBrowsingUtils",
|
ChromeUtils.defineModuleGetter(this, "PrivateBrowsingUtils",
|
||||||
"resource://gre/modules/PrivateBrowsingUtils.jsm");
|
"resource://gre/modules/PrivateBrowsingUtils.jsm");
|
||||||
|
|
||||||
ChromeUtils.defineModuleGetter(this, "RecentWindow",
|
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||||
"resource:///modules/RecentWindow.jsm");
|
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
|
||||||
|
ContextualIdentityService: "resource://gre/modules/ContextualIdentityService.jsm",
|
||||||
ChromeUtils.defineModuleGetter(this, "ShellService",
|
ShellService: "resource:///modules/ShellService.jsm"
|
||||||
"resource:///modules/ShellService.jsm");
|
});
|
||||||
|
|
||||||
ChromeUtils.defineModuleGetter(this, "ContextualIdentityService",
|
|
||||||
"resource://gre/modules/ContextualIdentityService.jsm");
|
|
||||||
|
|
||||||
XPCOMUtils.defineLazyServiceGetter(this, "aboutNewTabService",
|
XPCOMUtils.defineLazyServiceGetter(this, "aboutNewTabService",
|
||||||
"@mozilla.org/browser/aboutnewtab-service;1",
|
"@mozilla.org/browser/aboutnewtab-service;1",
|
||||||
|
|
@ -63,7 +60,7 @@ function getTopWin(skipPopups) {
|
||||||
return top;
|
return top;
|
||||||
|
|
||||||
let isPrivate = PrivateBrowsingUtils.isWindowPrivate(window);
|
let isPrivate = PrivateBrowsingUtils.isWindowPrivate(window);
|
||||||
return RecentWindow.getMostRecentBrowserWindow({private: isPrivate,
|
return BrowserWindowTracker.getMostRecentBrowserWindow({private: isPrivate,
|
||||||
allowPopups: !skipPopups});
|
allowPopups: !skipPopups});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
||||||
NetUtil: "resource://gre/modules/NetUtil.jsm",
|
NetUtil: "resource://gre/modules/NetUtil.jsm",
|
||||||
PluralForm: "resource://gre/modules/PluralForm.jsm",
|
PluralForm: "resource://gre/modules/PluralForm.jsm",
|
||||||
AppConstants: "resource://gre/modules/AppConstants.jsm",
|
AppConstants: "resource://gre/modules/AppConstants.jsm",
|
||||||
|
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
|
||||||
DownloadHistory: "resource://gre/modules/DownloadHistory.jsm",
|
DownloadHistory: "resource://gre/modules/DownloadHistory.jsm",
|
||||||
Downloads: "resource://gre/modules/Downloads.jsm",
|
Downloads: "resource://gre/modules/Downloads.jsm",
|
||||||
DownloadUIHelper: "resource://gre/modules/DownloadUIHelper.jsm",
|
DownloadUIHelper: "resource://gre/modules/DownloadUIHelper.jsm",
|
||||||
|
|
@ -46,7 +47,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
||||||
FileUtils: "resource://gre/modules/FileUtils.jsm",
|
FileUtils: "resource://gre/modules/FileUtils.jsm",
|
||||||
OS: "resource://gre/modules/osfile.jsm",
|
OS: "resource://gre/modules/osfile.jsm",
|
||||||
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
|
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
|
||||||
RecentWindow: "resource:///modules/RecentWindow.jsm",
|
|
||||||
});
|
});
|
||||||
|
|
||||||
XPCOMUtils.defineLazyGetter(this, "DownloadsLogger", () => {
|
XPCOMUtils.defineLazyGetter(this, "DownloadsLogger", () => {
|
||||||
|
|
@ -826,7 +826,7 @@ DownloadsDataCtor.prototype = {
|
||||||
DownloadsCommon.log("Attempting to notify that a new download has started or finished.");
|
DownloadsCommon.log("Attempting to notify that a new download has started or finished.");
|
||||||
|
|
||||||
// Show the panel in the most recent browser window, if present.
|
// Show the panel in the most recent browser window, if present.
|
||||||
let browserWin = RecentWindow.getMostRecentBrowserWindow({ private: this._isPrivate });
|
let browserWin = BrowserWindowTracker.getMostRecentBrowserWindow({ private: this._isPrivate });
|
||||||
if (!browserWin) {
|
if (!browserWin) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,13 +17,11 @@ var EXPORTED_SYMBOLS = [
|
||||||
// Globals
|
// Globals
|
||||||
|
|
||||||
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
|
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||||
ChromeUtils.defineModuleGetter(this, "Downloads",
|
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
|
||||||
"resource://gre/modules/Downloads.jsm");
|
Downloads: "resource://gre/modules/Downloads.jsm",
|
||||||
ChromeUtils.defineModuleGetter(this, "RecentWindow",
|
Services: "resource://gre/modules/Services.jsm",
|
||||||
"resource:///modules/RecentWindow.jsm");
|
});
|
||||||
ChromeUtils.defineModuleGetter(this, "Services",
|
|
||||||
"resource://gre/modules/Services.jsm");
|
|
||||||
|
|
||||||
XPCOMUtils.defineLazyGetter(this, "gWinTaskbar", function() {
|
XPCOMUtils.defineLazyGetter(this, "gWinTaskbar", function() {
|
||||||
if (!("@mozilla.org/windows-taskbar;1" in Cc)) {
|
if (!("@mozilla.org/windows-taskbar;1" in Cc)) {
|
||||||
|
|
@ -140,7 +138,7 @@ var DownloadsTaskbar = {
|
||||||
|
|
||||||
aWindow.addEventListener("unload", () => {
|
aWindow.addEventListener("unload", () => {
|
||||||
// Locate another browser window, excluding the one being closed.
|
// Locate another browser window, excluding the one being closed.
|
||||||
let browserWindow = RecentWindow.getMostRecentBrowserWindow();
|
let browserWindow = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||||
if (browserWindow) {
|
if (browserWindow) {
|
||||||
// Move the progress indicator to the other browser window.
|
// Move the progress indicator to the other browser window.
|
||||||
this._attachIndicator(browserWindow);
|
this._attachIndicator(browserWindow);
|
||||||
|
|
@ -169,7 +167,7 @@ var DownloadsTaskbar = {
|
||||||
|
|
||||||
aWindow.addEventListener("unload", () => {
|
aWindow.addEventListener("unload", () => {
|
||||||
// Locate another browser window, excluding the one being closed.
|
// Locate another browser window, excluding the one being closed.
|
||||||
let browserWindow = RecentWindow.getMostRecentBrowserWindow();
|
let browserWindow = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||||
if (browserWindow) {
|
if (browserWindow) {
|
||||||
// Move the progress indicator to the other browser window.
|
// Move the progress indicator to the other browser window.
|
||||||
this._attachGtkTaskbarProgress(browserWindow);
|
this._attachGtkTaskbarProgress(browserWindow);
|
||||||
|
|
|
||||||
|
|
@ -15,20 +15,15 @@ var EXPORTED_SYMBOLS = [
|
||||||
|
|
||||||
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
|
|
||||||
ChromeUtils.defineModuleGetter(this, "Downloads",
|
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||||
"resource://gre/modules/Downloads.jsm");
|
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
|
||||||
ChromeUtils.defineModuleGetter(this, "DownloadUtils",
|
Downloads: "resource://gre/modules/Downloads.jsm",
|
||||||
"resource://gre/modules/DownloadUtils.jsm");
|
DownloadUtils: "resource://gre/modules/DownloadUtils.jsm",
|
||||||
ChromeUtils.defineModuleGetter(this, "DownloadsCommon",
|
DownloadsCommon: "resource:///modules/DownloadsCommon.jsm",
|
||||||
"resource:///modules/DownloadsCommon.jsm");
|
FileUtils: "resource://gre/modules/FileUtils.jsm",
|
||||||
ChromeUtils.defineModuleGetter(this, "FileUtils",
|
OS: "resource://gre/modules/osfile.jsm",
|
||||||
"resource://gre/modules/FileUtils.jsm");
|
PlacesUtils: "resource://gre/modules/PlacesUtils.jsm"
|
||||||
ChromeUtils.defineModuleGetter(this, "OS",
|
});
|
||||||
"resource://gre/modules/osfile.jsm");
|
|
||||||
ChromeUtils.defineModuleGetter(this, "PlacesUtils",
|
|
||||||
"resource://gre/modules/PlacesUtils.jsm");
|
|
||||||
ChromeUtils.defineModuleGetter(this, "RecentWindow",
|
|
||||||
"resource:///modules/RecentWindow.jsm");
|
|
||||||
|
|
||||||
var DownloadsViewUI = {
|
var DownloadsViewUI = {
|
||||||
/**
|
/**
|
||||||
|
|
@ -132,7 +127,7 @@ this.DownloadsViewUI.DownloadElementShell.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
get browserWindow() {
|
get browserWindow() {
|
||||||
return RecentWindow.getMostRecentBrowserWindow();
|
return BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -5,22 +5,16 @@
|
||||||
|
|
||||||
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
|
|
||||||
ChromeUtils.defineModuleGetter(this, "Downloads",
|
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||||
"resource://gre/modules/Downloads.jsm");
|
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
|
||||||
ChromeUtils.defineModuleGetter(this, "DownloadsCommon",
|
Downloads: "resource://gre/modules/Downloads.jsm",
|
||||||
"resource:///modules/DownloadsCommon.jsm");
|
DownloadsCommon: "resource:///modules/DownloadsCommon.jsm",
|
||||||
ChromeUtils.defineModuleGetter(this, "DownloadsViewUI",
|
DownloadsViewUI: "resource:///modules/DownloadsViewUI.jsm",
|
||||||
"resource:///modules/DownloadsViewUI.jsm");
|
FileUtils: "resource://gre/modules/FileUtils.jsm",
|
||||||
ChromeUtils.defineModuleGetter(this, "FileUtils",
|
NetUtil: "resource://gre/modules/NetUtil.jsm",
|
||||||
"resource://gre/modules/FileUtils.jsm");
|
OS: "resource://gre/modules/osfile.jsm",
|
||||||
ChromeUtils.defineModuleGetter(this, "NetUtil",
|
Services: "resource://gre/modules/Services.jsm"
|
||||||
"resource://gre/modules/NetUtil.jsm");
|
});
|
||||||
ChromeUtils.defineModuleGetter(this, "OS",
|
|
||||||
"resource://gre/modules/osfile.jsm");
|
|
||||||
ChromeUtils.defineModuleGetter(this, "RecentWindow",
|
|
||||||
"resource:///modules/RecentWindow.jsm");
|
|
||||||
ChromeUtils.defineModuleGetter(this, "Services",
|
|
||||||
"resource://gre/modules/Services.jsm");
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A download element shell is responsible for handling the commands and the
|
* A download element shell is responsible for handling the commands and the
|
||||||
|
|
@ -572,7 +566,7 @@ DownloadsPlacesView.prototype = {
|
||||||
|
|
||||||
_downloadURLFromClipboard() {
|
_downloadURLFromClipboard() {
|
||||||
let [url, name] = this._getURLFromClipboardData();
|
let [url, name] = this._getURLFromClipboardData();
|
||||||
let browserWin = RecentWindow.getMostRecentBrowserWindow();
|
let browserWin = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||||
let initiatingDoc = browserWin ? browserWin.document : document;
|
let initiatingDoc = browserWin ? browserWin.document : document;
|
||||||
DownloadURL(url, name, initiatingDoc);
|
DownloadURL(url, name, initiatingDoc);
|
||||||
},
|
},
|
||||||
|
|
@ -752,7 +746,7 @@ DownloadsPlacesView.prototype = {
|
||||||
let links = Services.droppedLinkHandler.dropLinks(aEvent);
|
let links = Services.droppedLinkHandler.dropLinks(aEvent);
|
||||||
if (!links.length)
|
if (!links.length)
|
||||||
return;
|
return;
|
||||||
let browserWin = RecentWindow.getMostRecentBrowserWindow();
|
let browserWin = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||||
let initiatingDoc = browserWin ? browserWin.document : document;
|
let initiatingDoc = browserWin ? browserWin.document : document;
|
||||||
for (let link of links) {
|
for (let link of links) {
|
||||||
if (link.url.startsWith("about:"))
|
if (link.url.startsWith("about:"))
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@
|
||||||
|
|
||||||
ChromeUtils.defineModuleGetter(this, "PrivateBrowsingUtils",
|
ChromeUtils.defineModuleGetter(this, "PrivateBrowsingUtils",
|
||||||
"resource://gre/modules/PrivateBrowsingUtils.jsm");
|
"resource://gre/modules/PrivateBrowsingUtils.jsm");
|
||||||
ChromeUtils.defineModuleGetter(this, "RecentWindow",
|
ChromeUtils.defineModuleGetter(this, "BrowserWindowTracker",
|
||||||
"resource:///modules/RecentWindow.jsm");
|
"resource:///modules/BrowserWindowTracker.jsm");
|
||||||
|
|
||||||
var {
|
var {
|
||||||
ExtensionError,
|
ExtensionError,
|
||||||
|
|
@ -188,7 +188,7 @@ class WindowTracker extends WindowTrackerBase {
|
||||||
* @readonly
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get topNormalWindow() {
|
get topNormalWindow() {
|
||||||
return RecentWindow.getMostRecentBrowserWindow({allowPopups: false});
|
return BrowserWindowTracker.getMostRecentBrowserWindow({allowPopups: false});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,20 +6,16 @@ ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
|
ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
|
||||||
|
|
||||||
ChromeUtils.defineModuleGetter(this, "HeadlessShell",
|
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||||
"resource:///modules/HeadlessShell.jsm");
|
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
|
||||||
ChromeUtils.defineModuleGetter(this, "LaterRun",
|
HeadlessShell: "resource:///modules/HeadlessShell.jsm",
|
||||||
"resource:///modules/LaterRun.jsm");
|
LaterRun: "resource:///modules/LaterRun.jsm",
|
||||||
ChromeUtils.defineModuleGetter(this, "PrivateBrowsingUtils",
|
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
|
||||||
"resource://gre/modules/PrivateBrowsingUtils.jsm");
|
ShellService: "resource:///modules/ShellService.jsm",
|
||||||
ChromeUtils.defineModuleGetter(this, "RecentWindow",
|
UpdatePing: "resource://gre/modules/UpdatePing.jsm"
|
||||||
"resource:///modules/RecentWindow.jsm");
|
});
|
||||||
ChromeUtils.defineModuleGetter(this, "ShellService",
|
|
||||||
"resource:///modules/ShellService.jsm");
|
|
||||||
XPCOMUtils.defineLazyServiceGetter(this, "WindowsUIUtils",
|
XPCOMUtils.defineLazyServiceGetter(this, "WindowsUIUtils",
|
||||||
"@mozilla.org/windows-ui-utils;1", "nsIWindowsUIUtils");
|
"@mozilla.org/windows-ui-utils;1", "nsIWindowsUIUtils");
|
||||||
ChromeUtils.defineModuleGetter(this, "UpdatePing",
|
|
||||||
"resource://gre/modules/UpdatePing.jsm");
|
|
||||||
|
|
||||||
function shouldLoadURI(aURI) {
|
function shouldLoadURI(aURI) {
|
||||||
if (aURI && !aURI.schemeIs("chrome"))
|
if (aURI && !aURI.schemeIs("chrome"))
|
||||||
|
|
@ -677,7 +673,7 @@ function handURIToExistingBrowser(uri, location, cmdLine, forcePrivate, triggeri
|
||||||
// Unless using a private window is forced, open external links in private
|
// Unless using a private window is forced, open external links in private
|
||||||
// windows only if we're in perma-private mode.
|
// windows only if we're in perma-private mode.
|
||||||
var allowPrivate = forcePrivate || PrivateBrowsingUtils.permanentPrivateBrowsing;
|
var allowPrivate = forcePrivate || PrivateBrowsingUtils.permanentPrivateBrowsing;
|
||||||
var navWin = RecentWindow.getMostRecentBrowserWindow({private: allowPrivate});
|
var navWin = BrowserWindowTracker.getMostRecentBrowserWindow({private: allowPrivate});
|
||||||
if (!navWin) {
|
if (!navWin) {
|
||||||
// if we couldn't load it in an existing window, open a new one
|
// if we couldn't load it in an existing window, open a new one
|
||||||
openBrowserWindow(cmdLine, uri.spec, null, forcePrivate);
|
openBrowserWindow(cmdLine, uri.spec, null, forcePrivate);
|
||||||
|
|
@ -789,7 +785,7 @@ nsDefaultCommandLineHandler.prototype = {
|
||||||
cmdLine.state != Ci.nsICommandLine.STATE_INITIAL_LAUNCH &&
|
cmdLine.state != Ci.nsICommandLine.STATE_INITIAL_LAUNCH &&
|
||||||
WindowsUIUtils.inTabletMode) {
|
WindowsUIUtils.inTabletMode) {
|
||||||
// In windows 10 tablet mode, do not create a new window, but reuse the existing one.
|
// In windows 10 tablet mode, do not create a new window, but reuse the existing one.
|
||||||
let win = RecentWindow.getMostRecentBrowserWindow();
|
let win = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||||
if (win) {
|
if (win) {
|
||||||
win.focus();
|
win.focus();
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
||||||
BrowserErrorReporter: "resource:///modules/BrowserErrorReporter.jsm",
|
BrowserErrorReporter: "resource:///modules/BrowserErrorReporter.jsm",
|
||||||
BrowserUITelemetry: "resource:///modules/BrowserUITelemetry.jsm",
|
BrowserUITelemetry: "resource:///modules/BrowserUITelemetry.jsm",
|
||||||
BrowserUsageTelemetry: "resource:///modules/BrowserUsageTelemetry.jsm",
|
BrowserUsageTelemetry: "resource:///modules/BrowserUsageTelemetry.jsm",
|
||||||
|
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
|
||||||
ContentClick: "resource:///modules/ContentClick.jsm",
|
ContentClick: "resource:///modules/ContentClick.jsm",
|
||||||
ContextualIdentityService: "resource://gre/modules/ContextualIdentityService.jsm",
|
ContextualIdentityService: "resource://gre/modules/ContextualIdentityService.jsm",
|
||||||
CustomizableUI: "resource:///modules/CustomizableUI.jsm",
|
CustomizableUI: "resource:///modules/CustomizableUI.jsm",
|
||||||
|
|
@ -127,7 +128,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
||||||
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
|
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
|
||||||
ProcessHangMonitor: "resource:///modules/ProcessHangMonitor.jsm",
|
ProcessHangMonitor: "resource:///modules/ProcessHangMonitor.jsm",
|
||||||
ReaderParent: "resource:///modules/ReaderParent.jsm",
|
ReaderParent: "resource:///modules/ReaderParent.jsm",
|
||||||
RecentWindow: "resource:///modules/RecentWindow.jsm",
|
|
||||||
RemotePrompt: "resource:///modules/RemotePrompt.jsm",
|
RemotePrompt: "resource:///modules/RemotePrompt.jsm",
|
||||||
SafeBrowsing: "resource://gre/modules/SafeBrowsing.jsm",
|
SafeBrowsing: "resource://gre/modules/SafeBrowsing.jsm",
|
||||||
Sanitizer: "resource:///modules/Sanitizer.jsm",
|
Sanitizer: "resource:///modules/Sanitizer.jsm",
|
||||||
|
|
@ -505,7 +505,7 @@ BrowserGlue.prototype = {
|
||||||
case "handle-xul-text-link":
|
case "handle-xul-text-link":
|
||||||
let linkHandled = subject.QueryInterface(Ci.nsISupportsPRBool);
|
let linkHandled = subject.QueryInterface(Ci.nsISupportsPRBool);
|
||||||
if (!linkHandled.data) {
|
if (!linkHandled.data) {
|
||||||
let win = RecentWindow.getMostRecentBrowserWindow();
|
let win = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||||
if (win) {
|
if (win) {
|
||||||
data = JSON.parse(data);
|
data = JSON.parse(data);
|
||||||
let where = win.whereToOpenLink(data);
|
let where = win.whereToOpenLink(data);
|
||||||
|
|
@ -534,7 +534,7 @@ BrowserGlue.prototype = {
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
Cu.reportError(ex);
|
Cu.reportError(ex);
|
||||||
}
|
}
|
||||||
let win = RecentWindow.getMostRecentBrowserWindow();
|
let win = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||||
win.BrowserSearch.recordSearchInTelemetry(engine, "urlbar");
|
win.BrowserSearch.recordSearchInTelemetry(engine, "urlbar");
|
||||||
break;
|
break;
|
||||||
case "browser-search-engine-modified":
|
case "browser-search-engine-modified":
|
||||||
|
|
@ -832,7 +832,7 @@ BrowserGlue.prototype = {
|
||||||
if (profileAge < 90) // 3 months
|
if (profileAge < 90) // 3 months
|
||||||
return;
|
return;
|
||||||
|
|
||||||
let win = RecentWindow.getMostRecentBrowserWindow();
|
let win = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||||
if (!win)
|
if (!win)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -870,7 +870,7 @@ BrowserGlue.prototype = {
|
||||||
* why a profile reset is offered.
|
* why a profile reset is offered.
|
||||||
*/
|
*/
|
||||||
_resetProfileNotification(reason) {
|
_resetProfileNotification(reason) {
|
||||||
let win = RecentWindow.getMostRecentBrowserWindow();
|
let win = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||||
if (!win)
|
if (!win)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -907,7 +907,7 @@ BrowserGlue.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
_notifyUnsignedAddonsDisabled() {
|
_notifyUnsignedAddonsDisabled() {
|
||||||
let win = RecentWindow.getMostRecentBrowserWindow();
|
let win = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||||
if (!win)
|
if (!win)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -1481,7 +1481,7 @@ BrowserGlue.prototype = {
|
||||||
let key = getNotifyString({propName: "notificationButtonAccessKey",
|
let key = getNotifyString({propName: "notificationButtonAccessKey",
|
||||||
stringName: "pu.notifyButton.accesskey"});
|
stringName: "pu.notifyButton.accesskey"});
|
||||||
|
|
||||||
let win = RecentWindow.getMostRecentBrowserWindow();
|
let win = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||||
let notifyBox = win.document.getElementById("high-priority-global-notificationbox");
|
let notifyBox = win.document.getElementById("high-priority-global-notificationbox");
|
||||||
|
|
||||||
let buttons = [
|
let buttons = [
|
||||||
|
|
@ -1516,7 +1516,7 @@ BrowserGlue.prototype = {
|
||||||
// This callback will be called twice but only once with this topic
|
// This callback will be called twice but only once with this topic
|
||||||
if (topic != "alertclickcallback")
|
if (topic != "alertclickcallback")
|
||||||
return;
|
return;
|
||||||
let win = RecentWindow.getMostRecentBrowserWindow();
|
let win = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||||
win.openTrustedLinkIn(data, "tab");
|
win.openTrustedLinkIn(data, "tab");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1777,7 +1777,7 @@ BrowserGlue.prototype = {
|
||||||
var url = Services.urlFormatter.formatURLPref("app.support.baseURL");
|
var url = Services.urlFormatter.formatURLPref("app.support.baseURL");
|
||||||
url += helpTopic;
|
url += helpTopic;
|
||||||
|
|
||||||
var win = RecentWindow.getMostRecentBrowserWindow();
|
var win = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||||
|
|
||||||
var buttons = [
|
var buttons = [
|
||||||
{
|
{
|
||||||
|
|
@ -2284,7 +2284,7 @@ BrowserGlue.prototype = {
|
||||||
} catch (ex) { /* Don't break the default prompt if telemetry is broken. */ }
|
} catch (ex) { /* Don't break the default prompt if telemetry is broken. */ }
|
||||||
|
|
||||||
if (willPrompt) {
|
if (willPrompt) {
|
||||||
DefaultBrowserCheck.prompt(RecentWindow.getMostRecentBrowserWindow());
|
DefaultBrowserCheck.prompt(BrowserWindowTracker.getMostRecentBrowserWindow());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -2506,7 +2506,7 @@ BrowserGlue.prototype = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let chromeWindow = RecentWindow.getMostRecentBrowserWindow();
|
let chromeWindow = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||||
chromeWindow.openPreferences(...args);
|
chromeWindow.openPreferences(...args);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -2531,7 +2531,7 @@ BrowserGlue.prototype = {
|
||||||
const URIs = data.wrappedJSObject.object;
|
const URIs = data.wrappedJSObject.object;
|
||||||
|
|
||||||
// win can be null, but it's ok, we'll assign it later in openTab()
|
// win can be null, but it's ok, we'll assign it later in openTab()
|
||||||
let win = RecentWindow.getMostRecentBrowserWindow({private: false});
|
let win = BrowserWindowTracker.getMostRecentBrowserWindow({private: false});
|
||||||
|
|
||||||
const openTab = async (URI) => {
|
const openTab = async (URI) => {
|
||||||
let tab;
|
let tab;
|
||||||
|
|
@ -2614,7 +2614,7 @@ BrowserGlue.prototype = {
|
||||||
if (AppConstants.platform == "win") {
|
if (AppConstants.platform == "win") {
|
||||||
imageURL = "chrome://branding/content/icon64.png";
|
imageURL = "chrome://branding/content/icon64.png";
|
||||||
}
|
}
|
||||||
let win = RecentWindow.getMostRecentBrowserWindow({private: false});
|
let win = BrowserWindowTracker.getMostRecentBrowserWindow({private: false});
|
||||||
if (!win) {
|
if (!win) {
|
||||||
win = await this._openURLInNewWindow(url);
|
win = await this._openURLInNewWindow(url);
|
||||||
let tabs = win.gBrowser.tabs;
|
let tabs = win.gBrowser.tabs;
|
||||||
|
|
@ -2649,7 +2649,7 @@ BrowserGlue.prototype = {
|
||||||
if (topic != "alertclickcallback")
|
if (topic != "alertclickcallback")
|
||||||
return;
|
return;
|
||||||
let url = await FxAccounts.config.promiseManageDevicesURI("device-connected-notification");
|
let url = await FxAccounts.config.promiseManageDevicesURI("device-connected-notification");
|
||||||
let win = RecentWindow.getMostRecentBrowserWindow({private: false});
|
let win = BrowserWindowTracker.getMostRecentBrowserWindow({private: false});
|
||||||
if (!win) {
|
if (!win) {
|
||||||
this._openURLInNewWindow(url);
|
this._openURLInNewWindow(url);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -2699,7 +2699,7 @@ BrowserGlue.prototype = {
|
||||||
Services.prefs.setBoolPref("dom.ipc.plugins.flash.disable-protected-mode", true);
|
Services.prefs.setBoolPref("dom.ipc.plugins.flash.disable-protected-mode", true);
|
||||||
Services.prefs.setBoolPref("browser.flash-protected-mode-flip.done", true);
|
Services.prefs.setBoolPref("browser.flash-protected-mode-flip.done", true);
|
||||||
|
|
||||||
let win = RecentWindow.getMostRecentBrowserWindow();
|
let win = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||||
if (!win) {
|
if (!win) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -3066,7 +3066,7 @@ var JawsScreenReaderVersionCheck = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let win = RecentWindow.getMostRecentBrowserWindow();
|
let win = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||||
if (!win || !win.gBrowser || !win.gBrowser.selectedBrowser) {
|
if (!win || !win.gBrowser || !win.gBrowser.selectedBrowser) {
|
||||||
Services.console.logStringMessage(
|
Services.console.logStringMessage(
|
||||||
"Content access support for older versions of JAWS is disabled " +
|
"Content access support for older versions of JAWS is disabled " +
|
||||||
|
|
|
||||||
|
|
@ -11,13 +11,13 @@ ChromeUtils.import("resource://gre/modules/Timer.jsm");
|
||||||
|
|
||||||
XPCOMUtils.defineLazyModuleGetters(this, {
|
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||||
AppConstants: "resource://gre/modules/AppConstants.jsm",
|
AppConstants: "resource://gre/modules/AppConstants.jsm",
|
||||||
|
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
|
||||||
OpenInTabsUtils: "resource:///modules/OpenInTabsUtils.jsm",
|
OpenInTabsUtils: "resource:///modules/OpenInTabsUtils.jsm",
|
||||||
PlacesTransactions: "resource://gre/modules/PlacesTransactions.jsm",
|
PlacesTransactions: "resource://gre/modules/PlacesTransactions.jsm",
|
||||||
PlacesUtils: "resource://gre/modules/PlacesUtils.jsm",
|
PlacesUtils: "resource://gre/modules/PlacesUtils.jsm",
|
||||||
PluralForm: "resource://gre/modules/PluralForm.jsm",
|
PluralForm: "resource://gre/modules/PluralForm.jsm",
|
||||||
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
|
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
|
||||||
PromiseUtils: "resource://gre/modules/PromiseUtils.jsm",
|
PromiseUtils: "resource://gre/modules/PromiseUtils.jsm",
|
||||||
RecentWindow: "resource:///modules/RecentWindow.jsm",
|
|
||||||
Weave: "resource://services-sync/main.js",
|
Weave: "resource://services-sync/main.js",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -607,7 +607,7 @@ var PlacesUIUtils = {
|
||||||
var browserWindow = null;
|
var browserWindow = null;
|
||||||
browserWindow =
|
browserWindow =
|
||||||
aWindow && aWindow.document.documentElement.getAttribute("windowtype") == "navigator:browser" ?
|
aWindow && aWindow.document.documentElement.getAttribute("windowtype") == "navigator:browser" ?
|
||||||
aWindow : RecentWindow.getMostRecentBrowserWindow();
|
aWindow : BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||||
|
|
||||||
var urls = [];
|
var urls = [];
|
||||||
let skipMarking = browserWindow && PrivateBrowsingUtils.isWindowPrivate(browserWindow);
|
let skipMarking = browserWindow && PrivateBrowsingUtils.isWindowPrivate(browserWindow);
|
||||||
|
|
@ -745,7 +745,7 @@ var PlacesUIUtils = {
|
||||||
if (aWhere == "current" && isBookmark) {
|
if (aWhere == "current" && isBookmark) {
|
||||||
if (PlacesUtils.annotations
|
if (PlacesUtils.annotations
|
||||||
.itemHasAnnotation(aNode.itemId, this.LOAD_IN_SIDEBAR_ANNO)) {
|
.itemHasAnnotation(aNode.itemId, this.LOAD_IN_SIDEBAR_ANNO)) {
|
||||||
let browserWin = RecentWindow.getMostRecentBrowserWindow();
|
let browserWin = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||||
if (browserWin) {
|
if (browserWin) {
|
||||||
browserWin.openWebPanel(aNode.title, aNode.uri);
|
browserWin.openWebPanel(aNode.title, aNode.uri);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,8 @@ const TEST_URL = "http://www.example.com/";
|
||||||
const DIALOG_URL = "chrome://browser/content/places/bookmarkProperties.xul";
|
const DIALOG_URL = "chrome://browser/content/places/bookmarkProperties.xul";
|
||||||
const DIALOG_URL_MINIMAL_UI = "chrome://browser/content/places/bookmarkProperties2.xul";
|
const DIALOG_URL_MINIMAL_UI = "chrome://browser/content/places/bookmarkProperties2.xul";
|
||||||
|
|
||||||
ChromeUtils.import("resource:///modules/RecentWindow.jsm");
|
ChromeUtils.import("resource:///modules/BrowserWindowTracker.jsm");
|
||||||
var win = RecentWindow.getMostRecentBrowserWindow();
|
var win = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||||
|
|
||||||
function add_bookmark(url) {
|
function add_bookmark(url) {
|
||||||
return PlacesUtils.bookmarks.insert({
|
return PlacesUtils.bookmarks.insert({
|
||||||
|
|
|
||||||
|
|
@ -165,11 +165,11 @@ XPCOMUtils.defineLazyServiceGetters(this, {
|
||||||
XPCOMUtils.defineLazyModuleGetters(this, {
|
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||||
AppConstants: "resource://gre/modules/AppConstants.jsm",
|
AppConstants: "resource://gre/modules/AppConstants.jsm",
|
||||||
AsyncShutdown: "resource://gre/modules/AsyncShutdown.jsm",
|
AsyncShutdown: "resource://gre/modules/AsyncShutdown.jsm",
|
||||||
|
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
|
||||||
DevToolsShim: "chrome://devtools-startup/content/DevToolsShim.jsm",
|
DevToolsShim: "chrome://devtools-startup/content/DevToolsShim.jsm",
|
||||||
GlobalState: "resource:///modules/sessionstore/GlobalState.jsm",
|
GlobalState: "resource:///modules/sessionstore/GlobalState.jsm",
|
||||||
PrivacyFilter: "resource:///modules/sessionstore/PrivacyFilter.jsm",
|
PrivacyFilter: "resource:///modules/sessionstore/PrivacyFilter.jsm",
|
||||||
PromiseUtils: "resource://gre/modules/PromiseUtils.jsm",
|
PromiseUtils: "resource://gre/modules/PromiseUtils.jsm",
|
||||||
RecentWindow: "resource:///modules/RecentWindow.jsm",
|
|
||||||
RunState: "resource:///modules/sessionstore/RunState.jsm",
|
RunState: "resource:///modules/sessionstore/RunState.jsm",
|
||||||
SessionCookies: "resource:///modules/sessionstore/SessionCookies.jsm",
|
SessionCookies: "resource:///modules/sessionstore/SessionCookies.jsm",
|
||||||
SessionFile: "resource:///modules/sessionstore/SessionFile.jsm",
|
SessionFile: "resource:///modules/sessionstore/SessionFile.jsm",
|
||||||
|
|
@ -4230,7 +4230,7 @@ var SessionStoreInternal = {
|
||||||
* @returns Window reference
|
* @returns Window reference
|
||||||
*/
|
*/
|
||||||
_getMostRecentBrowserWindow: function ssi_getMostRecentBrowserWindow() {
|
_getMostRecentBrowserWindow: function ssi_getMostRecentBrowserWindow() {
|
||||||
return RecentWindow.getMostRecentBrowserWindow({ allowPopups: true });
|
return BrowserWindowTracker.getMostRecentBrowserWindow({ allowPopups: true });
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
* notifications. The latter won't.
|
* notifications. The latter won't.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// The rejection "RecentWindow.getMostRecentBrowserWindow(...) is null" is left
|
// The rejection "BrowserWindowTracker.getMostRecentBrowserWindow(...) is null" is left
|
||||||
// unhandled in some cases. This bug should be fixed, but for the moment this
|
// unhandled in some cases. This bug should be fixed, but for the moment this
|
||||||
// file is whitelisted.
|
// file is whitelisted.
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -74,8 +74,8 @@ var Translation = {
|
||||||
|
|
||||||
openProviderAttribution() {
|
openProviderAttribution() {
|
||||||
let attribution = this.supportedEngines[this.translationEngine];
|
let attribution = this.supportedEngines[this.translationEngine];
|
||||||
ChromeUtils.import("resource:///modules/RecentWindow.jsm");
|
ChromeUtils.import("resource:///modules/BrowserWindowTracker.jsm");
|
||||||
RecentWindow.getMostRecentBrowserWindow().openTrustedLinkIn(attribution, "tab");
|
BrowserWindowTracker.getMostRecentBrowserWindow().openUILinkIn(attribution, "tab");
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -36,14 +36,12 @@ ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
|
|
||||||
ChromeUtils.import("resource://formautofill/FormAutofillUtils.jsm");
|
ChromeUtils.import("resource://formautofill/FormAutofillUtils.jsm");
|
||||||
|
|
||||||
ChromeUtils.defineModuleGetter(this, "FormAutofillPreferences",
|
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||||
"resource://formautofill/FormAutofillPreferences.jsm");
|
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
|
||||||
ChromeUtils.defineModuleGetter(this, "FormAutofillDoorhanger",
|
FormAutofillPreferences: "resource://formautofill/FormAutofillPreferences.jsm",
|
||||||
"resource://formautofill/FormAutofillDoorhanger.jsm");
|
FormAutofillDoorhanger: "resource://formautofill/FormAutofillDoorhanger.jsm",
|
||||||
ChromeUtils.defineModuleGetter(this, "MasterPassword",
|
MasterPassword: "resource://formautofill/MasterPassword.jsm",
|
||||||
"resource://formautofill/MasterPassword.jsm");
|
});
|
||||||
ChromeUtils.defineModuleGetter(this, "RecentWindow",
|
|
||||||
"resource:///modules/RecentWindow.jsm");
|
|
||||||
|
|
||||||
this.log = null;
|
this.log = null;
|
||||||
FormAutofillUtils.defineLazyLogGetter(this, EXPORTED_SYMBOLS[0]);
|
FormAutofillUtils.defineLazyLogGetter(this, EXPORTED_SYMBOLS[0]);
|
||||||
|
|
@ -243,7 +241,7 @@ FormAutofillParent.prototype = {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "FormAutofill:OpenPreferences": {
|
case "FormAutofill:OpenPreferences": {
|
||||||
const win = RecentWindow.getMostRecentBrowserWindow();
|
const win = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||||
win.openPreferences("panePrivacy", {origin: "autofillFooter"});
|
win.openPreferences("panePrivacy", {origin: "autofillFooter"});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
2
browser/extensions/pocket/bootstrap.js
vendored
2
browser/extensions/pocket/bootstrap.js
vendored
|
|
@ -22,8 +22,6 @@ ChromeUtils.defineModuleGetter(this, "Pocket",
|
||||||
"chrome://pocket/content/Pocket.jsm");
|
"chrome://pocket/content/Pocket.jsm");
|
||||||
ChromeUtils.defineModuleGetter(this, "ReaderMode",
|
ChromeUtils.defineModuleGetter(this, "ReaderMode",
|
||||||
"resource://gre/modules/ReaderMode.jsm");
|
"resource://gre/modules/ReaderMode.jsm");
|
||||||
ChromeUtils.defineModuleGetter(this, "RecentWindow",
|
|
||||||
"resource:///modules/RecentWindow.jsm");
|
|
||||||
ChromeUtils.defineModuleGetter(this, "Services",
|
ChromeUtils.defineModuleGetter(this, "Services",
|
||||||
"resource://gre/modules/Services.jsm");
|
"resource://gre/modules/Services.jsm");
|
||||||
XPCOMUtils.defineLazyGetter(this, "gPocketBundle", function() {
|
XPCOMUtils.defineLazyGetter(this, "gPocketBundle", function() {
|
||||||
|
|
|
||||||
|
|
@ -9,14 +9,12 @@ var EXPORTED_SYMBOLS = ["BrowserUITelemetry"];
|
||||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
|
|
||||||
ChromeUtils.defineModuleGetter(this, "AppConstants",
|
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||||
"resource://gre/modules/AppConstants.jsm");
|
AppConstants: "resource://gre/modules/AppConstants.jsm",
|
||||||
ChromeUtils.defineModuleGetter(this, "RecentWindow",
|
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
|
||||||
"resource:///modules/RecentWindow.jsm");
|
CustomizableUI: "resource:///modules/CustomizableUI.jsm",
|
||||||
ChromeUtils.defineModuleGetter(this, "CustomizableUI",
|
UITour: "resource:///modules/UITour.jsm",
|
||||||
"resource:///modules/CustomizableUI.jsm");
|
});
|
||||||
ChromeUtils.defineModuleGetter(this, "UITour",
|
|
||||||
"resource:///modules/UITour.jsm");
|
|
||||||
XPCOMUtils.defineLazyGetter(this, "Timer", function() {
|
XPCOMUtils.defineLazyGetter(this, "Timer", function() {
|
||||||
let timer = {};
|
let timer = {};
|
||||||
ChromeUtils.import("resource://gre/modules/Timer.jsm", timer);
|
ChromeUtils.import("resource://gre/modules/Timer.jsm", timer);
|
||||||
|
|
@ -266,7 +264,7 @@ var BrowserUITelemetry = {
|
||||||
// probably been closed, since the vast majority of saved-session
|
// probably been closed, since the vast majority of saved-session
|
||||||
// pings are gathered during shutdown.
|
// pings are gathered during shutdown.
|
||||||
Services.search.init(rv => {
|
Services.search.init(rv => {
|
||||||
let win = RecentWindow.getMostRecentBrowserWindow({
|
let win = BrowserWindowTracker.getMostRecentBrowserWindow({
|
||||||
private: false,
|
private: false,
|
||||||
allowPopups: false,
|
allowPopups: false,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
* the current selected tab's content outer window ID.
|
* the current selected tab's content outer window ID.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var EXPORTED_SYMBOLS = ["trackBrowserWindow"];
|
var EXPORTED_SYMBOLS = ["BrowserWindowTracker"];
|
||||||
|
|
||||||
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
@ -16,6 +16,10 @@ ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
XPCOMUtils.defineLazyServiceGetter(this, "_focusManager",
|
XPCOMUtils.defineLazyServiceGetter(this, "_focusManager",
|
||||||
"@mozilla.org/focus-manager;1",
|
"@mozilla.org/focus-manager;1",
|
||||||
"nsIFocusManager");
|
"nsIFocusManager");
|
||||||
|
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||||
|
AppConstants: "resource://gre/modules/AppConstants.jsm",
|
||||||
|
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm"
|
||||||
|
});
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
const TAB_EVENTS = ["TabBrowserInserted", "TabSelect"];
|
const TAB_EVENTS = ["TabBrowserInserted", "TabSelect"];
|
||||||
|
|
@ -26,11 +30,6 @@ const DEBUG = false;
|
||||||
var _lastFocusedWindow = null;
|
var _lastFocusedWindow = null;
|
||||||
var _lastTopLevelWindowID = 0;
|
var _lastTopLevelWindowID = 0;
|
||||||
|
|
||||||
// Exported symbol
|
|
||||||
function trackBrowserWindow(aWindow) {
|
|
||||||
WindowHelper.addWindow(aWindow);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Global methods
|
// Global methods
|
||||||
function debug(s) {
|
function debug(s) {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
|
|
@ -135,4 +134,65 @@ var WindowHelper = {
|
||||||
// aWindow is now focused
|
// aWindow is now focused
|
||||||
_lastFocusedWindow = aWindow;
|
_lastFocusedWindow = aWindow;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getMostRecentBrowserWindow: function RW_getMostRecentBrowserWindow(aOptions) {
|
||||||
|
let checkPrivacy = typeof aOptions == "object" &&
|
||||||
|
"private" in aOptions;
|
||||||
|
|
||||||
|
let allowPopups = typeof aOptions == "object" && !!aOptions.allowPopups;
|
||||||
|
|
||||||
|
function isSuitableBrowserWindow(win) {
|
||||||
|
return (!win.closed &&
|
||||||
|
(allowPopups || win.toolbar.visible) &&
|
||||||
|
(!checkPrivacy ||
|
||||||
|
PrivateBrowsingUtils.permanentPrivateBrowsing ||
|
||||||
|
PrivateBrowsingUtils.isWindowPrivate(win) == aOptions.private));
|
||||||
|
}
|
||||||
|
|
||||||
|
let broken_wm_z_order =
|
||||||
|
AppConstants.platform != "macosx" && AppConstants.platform != "win";
|
||||||
|
|
||||||
|
if (broken_wm_z_order) {
|
||||||
|
let win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||||
|
|
||||||
|
// if we're lucky, this isn't a popup, and we can just return this
|
||||||
|
if (win && !isSuitableBrowserWindow(win)) {
|
||||||
|
win = null;
|
||||||
|
let windowList = Services.wm.getEnumerator("navigator:browser");
|
||||||
|
// this is oldest to newest, so this gets a bit ugly
|
||||||
|
while (windowList.hasMoreElements()) {
|
||||||
|
let nextWin = windowList.getNext();
|
||||||
|
if (isSuitableBrowserWindow(nextWin))
|
||||||
|
win = nextWin;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return win;
|
||||||
|
}
|
||||||
|
let windowList = Services.wm.getZOrderDOMWindowEnumerator("navigator:browser", true);
|
||||||
|
while (windowList.hasMoreElements()) {
|
||||||
|
let win = windowList.getNext();
|
||||||
|
if (isSuitableBrowserWindow(win))
|
||||||
|
return win;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.BrowserWindowTracker = {
|
||||||
|
/**
|
||||||
|
* Get the most recent browser window.
|
||||||
|
*
|
||||||
|
* @param aOptions an object accepting the arguments for the search.
|
||||||
|
* * private: true to restrict the search to private windows
|
||||||
|
* only, false to restrict the search to non-private only.
|
||||||
|
* Omit the property to search in both groups.
|
||||||
|
* * allowPopups: true if popup windows are permissable.
|
||||||
|
*/
|
||||||
|
getMostRecentBrowserWindow(options) {
|
||||||
|
return WindowHelper.getMostRecentBrowserWindow(options);
|
||||||
|
},
|
||||||
|
|
||||||
|
track(window) {
|
||||||
|
return WindowHelper.addWindow(window);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -11,22 +11,16 @@ var EXPORTED_SYMBOLS = [ "TabCrashHandler",
|
||||||
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
ChromeUtils.defineModuleGetter(this, "CrashSubmit",
|
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||||
"resource://gre/modules/CrashSubmit.jsm");
|
AppConstants: "resource://gre/modules/AppConstants.jsm",
|
||||||
ChromeUtils.defineModuleGetter(this, "AppConstants",
|
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
|
||||||
"resource://gre/modules/AppConstants.jsm");
|
clearTimeout: "resource://gre/modules/Timer.jsm",
|
||||||
ChromeUtils.defineModuleGetter(this, "RemotePages",
|
CrashSubmit: "resource://gre/modules/CrashSubmit.jsm",
|
||||||
"resource://gre/modules/RemotePageManager.jsm");
|
PluralForm: "resource://gre/modules/PluralForm.jsm",
|
||||||
ChromeUtils.defineModuleGetter(this, "SessionStore",
|
RemotePages: "resource://gre/modules/RemotePageManager.jsm",
|
||||||
"resource:///modules/sessionstore/SessionStore.jsm");
|
SessionStore: "resource:///modules/sessionstore/SessionStore.jsm",
|
||||||
ChromeUtils.defineModuleGetter(this, "RecentWindow",
|
setTimeout: "resource://gre/modules/Timer.jsm"
|
||||||
"resource:///modules/RecentWindow.jsm");
|
});
|
||||||
ChromeUtils.defineModuleGetter(this, "PluralForm",
|
|
||||||
"resource://gre/modules/PluralForm.jsm");
|
|
||||||
ChromeUtils.defineModuleGetter(this, "setTimeout",
|
|
||||||
"resource://gre/modules/Timer.jsm");
|
|
||||||
ChromeUtils.defineModuleGetter(this, "clearTimeout",
|
|
||||||
"resource://gre/modules/Timer.jsm");
|
|
||||||
|
|
||||||
XPCOMUtils.defineLazyGetter(this, "gNavigatorBundle", function() {
|
XPCOMUtils.defineLazyGetter(this, "gNavigatorBundle", function() {
|
||||||
const url = "chrome://browser/locale/browser.properties";
|
const url = "chrome://browser/locale/browser.properties";
|
||||||
|
|
@ -838,7 +832,7 @@ var UnsubmittedCrashHandler = {
|
||||||
* @returns The <xul:notification> if one is shown. null otherwise.
|
* @returns The <xul:notification> if one is shown. null otherwise.
|
||||||
*/
|
*/
|
||||||
show({ notificationID, message, reportIDs, onAction }) {
|
show({ notificationID, message, reportIDs, onAction }) {
|
||||||
let chromeWin = RecentWindow.getMostRecentBrowserWindow();
|
let chromeWin = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||||
if (!chromeWin) {
|
if (!chromeWin) {
|
||||||
// Can't show a notification in this case. We'll hopefully
|
// Can't show a notification in this case. We'll hopefully
|
||||||
// get another opportunity to have the user submit their
|
// get another opportunity to have the user submit their
|
||||||
|
|
|
||||||
|
|
@ -8,18 +8,14 @@ var EXPORTED_SYMBOLS = ["ExtensionsUI"];
|
||||||
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
ChromeUtils.import("resource://gre/modules/EventEmitter.jsm");
|
ChromeUtils.import("resource://gre/modules/EventEmitter.jsm");
|
||||||
|
|
||||||
ChromeUtils.defineModuleGetter(this, "AddonManager",
|
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||||
"resource://gre/modules/AddonManager.jsm");
|
AddonManager: "resource://gre/modules/AddonManager.jsm",
|
||||||
ChromeUtils.defineModuleGetter(this, "AddonManagerPrivate",
|
AddonManagerPrivate: "resource://gre/modules/AddonManager.jsm",
|
||||||
"resource://gre/modules/AddonManager.jsm");
|
AppMenuNotifications: "resource://gre/modules/AppMenuNotifications.jsm",
|
||||||
ChromeUtils.defineModuleGetter(this, "AppMenuNotifications",
|
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
|
||||||
"resource://gre/modules/AppMenuNotifications.jsm");
|
ExtensionData: "resource://gre/modules/Extension.jsm",
|
||||||
ChromeUtils.defineModuleGetter(this, "ExtensionData",
|
Services: "resource://gre/modules/Services.jsm"
|
||||||
"resource://gre/modules/Extension.jsm");
|
});
|
||||||
ChromeUtils.defineModuleGetter(this, "RecentWindow",
|
|
||||||
"resource:///modules/RecentWindow.jsm");
|
|
||||||
ChromeUtils.defineModuleGetter(this, "Services",
|
|
||||||
"resource://gre/modules/Services.jsm");
|
|
||||||
|
|
||||||
XPCOMUtils.defineLazyPreferenceGetter(this, "WEBEXT_PERMISSION_PROMPTS",
|
XPCOMUtils.defineLazyPreferenceGetter(this, "WEBEXT_PERMISSION_PROMPTS",
|
||||||
"extensions.webextPermissionPrompts", false);
|
"extensions.webextPermissionPrompts", false);
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,8 @@ ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
ChromeUtils.defineModuleGetter(this, "BrowserUtils",
|
ChromeUtils.defineModuleGetter(this, "BrowserUtils",
|
||||||
"resource://gre/modules/BrowserUtils.jsm");
|
"resource://gre/modules/BrowserUtils.jsm");
|
||||||
ChromeUtils.defineModuleGetter(this, "RecentWindow",
|
ChromeUtils.defineModuleGetter(this, "BrowserWindowTracker",
|
||||||
"resource:///modules/RecentWindow.jsm");
|
"resource:///modules/BrowserWindowTracker.jsm");
|
||||||
|
|
||||||
var Feeds = {
|
var Feeds = {
|
||||||
// Listeners are added in nsBrowserGlue.js
|
// Listeners are added in nsBrowserGlue.js
|
||||||
|
|
@ -43,7 +43,7 @@ var Feeds = {
|
||||||
}
|
}
|
||||||
|
|
||||||
case "FeedConverter:addLiveBookmark": {
|
case "FeedConverter:addLiveBookmark": {
|
||||||
let topWindow = RecentWindow.getMostRecentBrowserWindow();
|
let topWindow = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||||
topWindow.PlacesCommandHook.addLiveBookmark(data.spec, data.title, data.subtitle)
|
topWindow.PlacesCommandHook.addLiveBookmark(data.spec, data.title, data.subtitle)
|
||||||
.catch(Cu.reportError);
|
.catch(Cu.reportError);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -1,65 +0,0 @@
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
||||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var EXPORTED_SYMBOLS = ["RecentWindow"];
|
|
||||||
|
|
||||||
ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
|
|
||||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
|
||||||
ChromeUtils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
|
|
||||||
|
|
||||||
var RecentWindow = {
|
|
||||||
/*
|
|
||||||
* Get the most recent browser window.
|
|
||||||
*
|
|
||||||
* @param aOptions an object accepting the arguments for the search.
|
|
||||||
* * private: true to restrict the search to private windows
|
|
||||||
* only, false to restrict the search to non-private only.
|
|
||||||
* Omit the property to search in both groups.
|
|
||||||
* * allowPopups: true if popup windows are permissable.
|
|
||||||
*/
|
|
||||||
getMostRecentBrowserWindow: function RW_getMostRecentBrowserWindow(aOptions) {
|
|
||||||
let checkPrivacy = typeof aOptions == "object" &&
|
|
||||||
"private" in aOptions;
|
|
||||||
|
|
||||||
let allowPopups = typeof aOptions == "object" && !!aOptions.allowPopups;
|
|
||||||
|
|
||||||
function isSuitableBrowserWindow(win) {
|
|
||||||
return (!win.closed &&
|
|
||||||
(allowPopups || win.toolbar.visible) &&
|
|
||||||
(!checkPrivacy ||
|
|
||||||
PrivateBrowsingUtils.permanentPrivateBrowsing ||
|
|
||||||
PrivateBrowsingUtils.isWindowPrivate(win) == aOptions.private));
|
|
||||||
}
|
|
||||||
|
|
||||||
let broken_wm_z_order =
|
|
||||||
AppConstants.platform != "macosx" && AppConstants.platform != "win";
|
|
||||||
|
|
||||||
if (broken_wm_z_order) {
|
|
||||||
let win = Services.wm.getMostRecentWindow("navigator:browser");
|
|
||||||
|
|
||||||
// if we're lucky, this isn't a popup, and we can just return this
|
|
||||||
if (win && !isSuitableBrowserWindow(win)) {
|
|
||||||
win = null;
|
|
||||||
let windowList = Services.wm.getEnumerator("navigator:browser");
|
|
||||||
// this is oldest to newest, so this gets a bit ugly
|
|
||||||
while (windowList.hasMoreElements()) {
|
|
||||||
let nextWin = windowList.getNext();
|
|
||||||
if (isSuitableBrowserWindow(nextWin))
|
|
||||||
win = nextWin;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return win;
|
|
||||||
}
|
|
||||||
let windowList = Services.wm.getZOrderDOMWindowEnumerator("navigator:browser", true);
|
|
||||||
while (windowList.hasMoreElements()) {
|
|
||||||
let win = windowList.getNext();
|
|
||||||
if (isSuitableBrowserWindow(win))
|
|
||||||
return win;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
@ -49,6 +49,9 @@ with Files('AsyncTabSwitcher.jsm'):
|
||||||
with Files("AttributionCode.jsm"):
|
with Files("AttributionCode.jsm"):
|
||||||
BUG_COMPONENT = ("Toolkit", "Telemetry")
|
BUG_COMPONENT = ("Toolkit", "Telemetry")
|
||||||
|
|
||||||
|
with Files("BrowserWindowTracker.jsm"):
|
||||||
|
BUG_COMPONENT = ("Core", "Networking")
|
||||||
|
|
||||||
with Files("*Telemetry.jsm"):
|
with Files("*Telemetry.jsm"):
|
||||||
BUG_COMPONENT = ("Toolkit", "Telemetry")
|
BUG_COMPONENT = ("Toolkit", "Telemetry")
|
||||||
|
|
||||||
|
|
@ -109,9 +112,6 @@ with Files("WindowsPreviewPerTab.jsm"):
|
||||||
with Files("offlineAppCache.jsm"):
|
with Files("offlineAppCache.jsm"):
|
||||||
BUG_COMPONENT = ("Firefox", "Preferences")
|
BUG_COMPONENT = ("Firefox", "Preferences")
|
||||||
|
|
||||||
with Files("UpdateTopLevelContentWindowIDHelper.jsm"):
|
|
||||||
BUG_COMPONENT = ("Core", "Networking")
|
|
||||||
|
|
||||||
with Files("webrtcUI.jsm"):
|
with Files("webrtcUI.jsm"):
|
||||||
BUG_COMPONENT = ("Firefox", "Device Permissions")
|
BUG_COMPONENT = ("Firefox", "Device Permissions")
|
||||||
|
|
||||||
|
|
@ -133,6 +133,7 @@ EXTRA_JS_MODULES += [
|
||||||
'BrowserErrorReporter.jsm',
|
'BrowserErrorReporter.jsm',
|
||||||
'BrowserUITelemetry.jsm',
|
'BrowserUITelemetry.jsm',
|
||||||
'BrowserUsageTelemetry.jsm',
|
'BrowserUsageTelemetry.jsm',
|
||||||
|
'BrowserWindowTracker.jsm',
|
||||||
'ContentClick.jsm',
|
'ContentClick.jsm',
|
||||||
'ContentCrashHandlers.jsm',
|
'ContentCrashHandlers.jsm',
|
||||||
'ContentLinkHandler.jsm',
|
'ContentLinkHandler.jsm',
|
||||||
|
|
@ -154,7 +155,6 @@ EXTRA_JS_MODULES += [
|
||||||
'PluginContent.jsm',
|
'PluginContent.jsm',
|
||||||
'ProcessHangMonitor.jsm',
|
'ProcessHangMonitor.jsm',
|
||||||
'ReaderParent.jsm',
|
'ReaderParent.jsm',
|
||||||
'RecentWindow.jsm',
|
|
||||||
'RemotePrompt.jsm',
|
'RemotePrompt.jsm',
|
||||||
'Sanitizer.jsm',
|
'Sanitizer.jsm',
|
||||||
'SchedulePressure.jsm',
|
'SchedulePressure.jsm',
|
||||||
|
|
@ -162,7 +162,6 @@ EXTRA_JS_MODULES += [
|
||||||
'SitePermissions.jsm',
|
'SitePermissions.jsm',
|
||||||
'ThemeVariableMap.jsm',
|
'ThemeVariableMap.jsm',
|
||||||
'TransientPrefs.jsm',
|
'TransientPrefs.jsm',
|
||||||
'UpdateTopLevelContentWindowIDHelper.jsm',
|
|
||||||
'webrtcUI.jsm',
|
'webrtcUI.jsm',
|
||||||
'ZoomUI.jsm',
|
'ZoomUI.jsm',
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -89,8 +89,8 @@ class BaseNavigationTestCase(WindowManagerMixin, MarionetteTestCase):
|
||||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||||
win = Services.wm.getMostRecentWindow("navigator:browser");
|
win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||||
} else {
|
} else {
|
||||||
Components.utils.import("resource:///modules/RecentWindow.jsm");
|
Components.utils.import("resource:///modules/BrowserWindowTracker.jsm");
|
||||||
win = RecentWindow.getMostRecentBrowserWindow();
|
win = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
let tabBrowser = null;
|
let tabBrowser = null;
|
||||||
|
|
|
||||||
|
|
@ -44,8 +44,8 @@ class TestSwitchToWindowContent(WindowManagerMixin, MarionetteTestCase):
|
||||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||||
win = Services.wm.getMostRecentWindow("navigator:browser");
|
win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||||
} else {
|
} else {
|
||||||
Components.utils.import("resource:///modules/RecentWindow.jsm");
|
Components.utils.import("resource:///modules/BrowserWindowTracker.jsm");
|
||||||
win = RecentWindow.getMostRecentBrowserWindow();
|
win = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
let tabBrowser = null;
|
let tabBrowser = null;
|
||||||
|
|
|
||||||
|
|
@ -95,9 +95,9 @@ class TestCloseWindow(WindowManagerMixin, MarionetteTestCase):
|
||||||
|
|
||||||
with self.marionette.using_context("chrome"):
|
with self.marionette.using_context("chrome"):
|
||||||
self.marionette.execute_async_script("""
|
self.marionette.execute_async_script("""
|
||||||
Components.utils.import("resource:///modules/RecentWindow.jsm");
|
Components.utils.import("resource:///modules/BrowserWindowTracker.jsm");
|
||||||
|
|
||||||
let win = RecentWindow.getMostRecentBrowserWindow();
|
let win = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||||
win.addEventListener("TabBrowserDiscarded", ev => {
|
win.addEventListener("TabBrowserDiscarded", ev => {
|
||||||
marionetteScriptFinished(true);
|
marionetteScriptFinished(true);
|
||||||
}, { once: true});
|
}, { once: true});
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@
|
||||||
|
|
||||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
ChromeUtils.import("resource://gre/modules/Task.jsm");
|
ChromeUtils.import("resource://gre/modules/Task.jsm");
|
||||||
ChromeUtils.import("resource:///modules/RecentWindow.jsm");
|
|
||||||
|
|
||||||
const ANIMATION_PREF = "toolkit.cosmeticAnimations.enabled";
|
const ANIMATION_PREF = "toolkit.cosmeticAnimations.enabled";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -436,8 +436,8 @@ var TelemetryReportingPolicyImpl = {
|
||||||
|
|
||||||
let win;
|
let win;
|
||||||
try {
|
try {
|
||||||
const { RecentWindow } = ChromeUtils.import("resource:///modules/RecentWindow.jsm", {});
|
const { BrowserWindowTracker } = ChromeUtils.import("resource:///modules/BrowserWindowTracker.jsm", {});
|
||||||
win = RecentWindow.getMostRecentBrowserWindow();
|
win = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
|
||||||
if (!win) {
|
if (!win) {
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@ const EXPORTED_SYMBOLS = ["WebNavigation"];
|
||||||
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
ChromeUtils.defineModuleGetter(this, "RecentWindow",
|
ChromeUtils.defineModuleGetter(this, "BrowserWindowTracker",
|
||||||
"resource:///modules/RecentWindow.jsm");
|
"resource:///modules/BrowserWindowTracker.jsm");
|
||||||
|
|
||||||
// Maximum amount of time that can be passed and still consider
|
// Maximum amount of time that can be passed and still consider
|
||||||
// the data recent (similar to how is done in nsNavHistory,
|
// the data recent (similar to how is done in nsNavHistory,
|
||||||
|
|
@ -216,7 +216,7 @@ var Manager = {
|
||||||
* @param {boolean} [tabTransitionData.typed]
|
* @param {boolean} [tabTransitionData.typed]
|
||||||
*/
|
*/
|
||||||
setRecentTabTransitionData(tabTransitionData) {
|
setRecentTabTransitionData(tabTransitionData) {
|
||||||
let window = RecentWindow.getMostRecentBrowserWindow();
|
let window = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||||
if (window && window.gBrowser && window.gBrowser.selectedTab &&
|
if (window && window.gBrowser && window.gBrowser.selectedTab &&
|
||||||
window.gBrowser.selectedTab.linkedBrowser) {
|
window.gBrowser.selectedTab.linkedBrowser) {
|
||||||
let browser = window.gBrowser.selectedTab.linkedBrowser;
|
let browser = window.gBrowser.selectedTab.linkedBrowser;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue