зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
c44a678ffa
Коммит
d16ee58ded
|
@ -112,7 +112,7 @@ var CaptivePortalWatcher = {
|
|||
return;
|
||||
}
|
||||
|
||||
let win = RecentWindow.getMostRecentBrowserWindow();
|
||||
let win = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||
// 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
|
||||
// (re-)focuses a browser window, we open the tab immediately in that window
|
||||
|
@ -135,7 +135,7 @@ var CaptivePortalWatcher = {
|
|||
return;
|
||||
}
|
||||
|
||||
let win = RecentWindow.getMostRecentBrowserWindow();
|
||||
let win = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||
if (win != Services.ww.activeWindow) {
|
||||
// The window that got focused was not a browser window.
|
||||
return;
|
||||
|
|
|
@ -20,6 +20,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
|||
BrowserUITelemetry: "resource:///modules/BrowserUITelemetry.jsm",
|
||||
BrowserUsageTelemetry: "resource:///modules/BrowserUsageTelemetry.jsm",
|
||||
BrowserUtils: "resource://gre/modules/BrowserUtils.jsm",
|
||||
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
|
||||
CharsetMenu: "resource://gre/modules/CharsetMenu.jsm",
|
||||
Color: "resource://gre/modules/Color.jsm",
|
||||
ContentSearch: "resource:///modules/ContentSearch.jsm",
|
||||
|
@ -48,7 +49,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
|||
PromiseUtils: "resource://gre/modules/PromiseUtils.jsm",
|
||||
ReaderMode: "resource://gre/modules/ReaderMode.jsm",
|
||||
ReaderParent: "resource:///modules/ReaderParent.jsm",
|
||||
RecentWindow: "resource:///modules/RecentWindow.jsm",
|
||||
SafeBrowsing: "resource://gre/modules/SafeBrowsing.jsm",
|
||||
Sanitizer: "resource:///modules/Sanitizer.jsm",
|
||||
SessionStore: "resource:///modules/sessionstore/SessionStore.jsm",
|
||||
|
@ -1489,8 +1489,7 @@ var gBrowserInit = {
|
|||
if (!getBoolPref("ui.click_hold_context_menus", false))
|
||||
SetClickAndHoldHandlers();
|
||||
|
||||
ChromeUtils.import("resource:///modules/UpdateTopLevelContentWindowIDHelper.jsm", {})
|
||||
.trackBrowserWindow(window);
|
||||
BrowserWindowTracker.track(window);
|
||||
|
||||
PlacesToolbarHelper.init();
|
||||
|
||||
|
@ -2675,7 +2674,7 @@ async function BrowserViewSourceOfDocument(aArgsOrDocument) {
|
|||
// In the case of popups, we need to find a non-popup browser window.
|
||||
if (!tabBrowser || !window.toolbar.visible) {
|
||||
// This returns only non-popup browser windows by default.
|
||||
let browserWindow = RecentWindow.getMostRecentBrowserWindow();
|
||||
let browserWindow = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||
tabBrowser = browserWindow.gBrowser;
|
||||
}
|
||||
|
||||
|
@ -5301,7 +5300,7 @@ nsBrowserAccess.prototype = {
|
|||
if (window.toolbar.visible)
|
||||
win = window;
|
||||
else {
|
||||
win = RecentWindow.getMostRecentBrowserWindow({private: aIsPrivate});
|
||||
win = BrowserWindowTracker.getMostRecentBrowserWindow({private: aIsPrivate});
|
||||
needToFocusWin = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -886,7 +886,7 @@ nsContextMenu.prototype = {
|
|||
// (in the sidebar). Deal with those cases:
|
||||
if (!tabBrowser || !tabBrowser.loadOneTab || !window.toolbar.visible) {
|
||||
// This returns only non-popup browser windows by default.
|
||||
let browserWindow = RecentWindow.getMostRecentBrowserWindow();
|
||||
let browserWindow = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||
tabBrowser = browserWindow.gBrowser;
|
||||
}
|
||||
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",
|
||||
"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
|
||||
// window, but we can't close the default window opened by the test harness.
|
||||
// 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.
|
||||
window.CaptivePortalWatcher.uninit();
|
||||
let getMostRecentBrowserWindowCopy = RecentWindow.getMostRecentBrowserWindow;
|
||||
let getMostRecentBrowserWindowCopy = BrowserWindowTracker.getMostRecentBrowserWindow;
|
||||
let defaultWindow = window;
|
||||
RecentWindow.getMostRecentBrowserWindow = () => {
|
||||
BrowserWindowTracker.getMostRecentBrowserWindow = () => {
|
||||
let win = getMostRecentBrowserWindowCopy();
|
||||
if (win == defaultWindow) {
|
||||
return null;
|
||||
|
@ -34,7 +34,7 @@ async function setupPrefsAndRecentWindowBehavior() {
|
|||
};
|
||||
|
||||
registerCleanupFunction(function cleanUp() {
|
||||
RecentWindow.getMostRecentBrowserWindow = getMostRecentBrowserWindowCopy;
|
||||
BrowserWindowTracker.getMostRecentBrowserWindow = getMostRecentBrowserWindowCopy;
|
||||
window.CaptivePortalWatcher.init();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -90,8 +90,8 @@ const startupPhases = {
|
|||
"nsPlacesExpiration.js",
|
||||
]),
|
||||
modules: new Set([
|
||||
// Bug 1391495 - RecentWindow.jsm is intermittently used.
|
||||
// "resource:///modules/RecentWindow.jsm",
|
||||
// Bug 1391495 - BrowserWindowTracker.jsm is intermittently used.
|
||||
// "resource:///modules/BrowserWindowTracker.jsm",
|
||||
"resource://gre/modules/BookmarkHTMLUtils.jsm",
|
||||
"resource://gre/modules/Bookmarks.jsm",
|
||||
"resource://gre/modules/ContextualIdentityService.jsm",
|
||||
|
@ -128,7 +128,7 @@ if (Services.prefs.getBoolPref("browser.startup.blankWindow")) {
|
|||
}
|
||||
|
||||
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
|
||||
// due to messages from the 'content' process arriving synchronously
|
||||
// instead of crossing a process boundary.
|
||||
|
|
|
@ -11,14 +11,11 @@ ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
|||
ChromeUtils.defineModuleGetter(this, "PrivateBrowsingUtils",
|
||||
"resource://gre/modules/PrivateBrowsingUtils.jsm");
|
||||
|
||||
ChromeUtils.defineModuleGetter(this, "RecentWindow",
|
||||
"resource:///modules/RecentWindow.jsm");
|
||||
|
||||
ChromeUtils.defineModuleGetter(this, "ShellService",
|
||||
"resource:///modules/ShellService.jsm");
|
||||
|
||||
ChromeUtils.defineModuleGetter(this, "ContextualIdentityService",
|
||||
"resource://gre/modules/ContextualIdentityService.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
|
||||
ContextualIdentityService: "resource://gre/modules/ContextualIdentityService.jsm",
|
||||
ShellService: "resource:///modules/ShellService.jsm"
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "aboutNewTabService",
|
||||
"@mozilla.org/browser/aboutnewtab-service;1",
|
||||
|
@ -63,8 +60,8 @@ function getTopWin(skipPopups) {
|
|||
return top;
|
||||
|
||||
let isPrivate = PrivateBrowsingUtils.isWindowPrivate(window);
|
||||
return RecentWindow.getMostRecentBrowserWindow({private: isPrivate,
|
||||
allowPopups: !skipPopups});
|
||||
return BrowserWindowTracker.getMostRecentBrowserWindow({private: isPrivate,
|
||||
allowPopups: !skipPopups});
|
||||
}
|
||||
|
||||
function getBoolPref(prefname, def) {
|
||||
|
|
|
@ -39,6 +39,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
|||
NetUtil: "resource://gre/modules/NetUtil.jsm",
|
||||
PluralForm: "resource://gre/modules/PluralForm.jsm",
|
||||
AppConstants: "resource://gre/modules/AppConstants.jsm",
|
||||
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
|
||||
DownloadHistory: "resource://gre/modules/DownloadHistory.jsm",
|
||||
Downloads: "resource://gre/modules/Downloads.jsm",
|
||||
DownloadUIHelper: "resource://gre/modules/DownloadUIHelper.jsm",
|
||||
|
@ -46,7 +47,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
|||
FileUtils: "resource://gre/modules/FileUtils.jsm",
|
||||
OS: "resource://gre/modules/osfile.jsm",
|
||||
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
|
||||
RecentWindow: "resource:///modules/RecentWindow.jsm",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "DownloadsLogger", () => {
|
||||
|
@ -826,7 +826,7 @@ DownloadsDataCtor.prototype = {
|
|||
DownloadsCommon.log("Attempting to notify that a new download has started or finished.");
|
||||
|
||||
// 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) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -17,13 +17,11 @@ var EXPORTED_SYMBOLS = [
|
|||
// Globals
|
||||
|
||||
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
ChromeUtils.defineModuleGetter(this, "Downloads",
|
||||
"resource://gre/modules/Downloads.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "RecentWindow",
|
||||
"resource:///modules/RecentWindow.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "Services",
|
||||
"resource://gre/modules/Services.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
|
||||
Downloads: "resource://gre/modules/Downloads.jsm",
|
||||
Services: "resource://gre/modules/Services.jsm",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "gWinTaskbar", function() {
|
||||
if (!("@mozilla.org/windows-taskbar;1" in Cc)) {
|
||||
|
@ -140,7 +138,7 @@ var DownloadsTaskbar = {
|
|||
|
||||
aWindow.addEventListener("unload", () => {
|
||||
// Locate another browser window, excluding the one being closed.
|
||||
let browserWindow = RecentWindow.getMostRecentBrowserWindow();
|
||||
let browserWindow = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||
if (browserWindow) {
|
||||
// Move the progress indicator to the other browser window.
|
||||
this._attachIndicator(browserWindow);
|
||||
|
@ -169,7 +167,7 @@ var DownloadsTaskbar = {
|
|||
|
||||
aWindow.addEventListener("unload", () => {
|
||||
// Locate another browser window, excluding the one being closed.
|
||||
let browserWindow = RecentWindow.getMostRecentBrowserWindow();
|
||||
let browserWindow = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||
if (browserWindow) {
|
||||
// Move the progress indicator to the other browser window.
|
||||
this._attachGtkTaskbarProgress(browserWindow);
|
||||
|
|
|
@ -15,20 +15,15 @@ var EXPORTED_SYMBOLS = [
|
|||
|
||||
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
ChromeUtils.defineModuleGetter(this, "Downloads",
|
||||
"resource://gre/modules/Downloads.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "DownloadUtils",
|
||||
"resource://gre/modules/DownloadUtils.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "DownloadsCommon",
|
||||
"resource:///modules/DownloadsCommon.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "FileUtils",
|
||||
"resource://gre/modules/FileUtils.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");
|
||||
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
|
||||
Downloads: "resource://gre/modules/Downloads.jsm",
|
||||
DownloadUtils: "resource://gre/modules/DownloadUtils.jsm",
|
||||
DownloadsCommon: "resource:///modules/DownloadsCommon.jsm",
|
||||
FileUtils: "resource://gre/modules/FileUtils.jsm",
|
||||
OS: "resource://gre/modules/osfile.jsm",
|
||||
PlacesUtils: "resource://gre/modules/PlacesUtils.jsm"
|
||||
});
|
||||
|
||||
var DownloadsViewUI = {
|
||||
/**
|
||||
|
@ -132,7 +127,7 @@ this.DownloadsViewUI.DownloadElementShell.prototype = {
|
|||
},
|
||||
|
||||
get browserWindow() {
|
||||
return RecentWindow.getMostRecentBrowserWindow();
|
||||
return BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -5,22 +5,16 @@
|
|||
|
||||
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
ChromeUtils.defineModuleGetter(this, "Downloads",
|
||||
"resource://gre/modules/Downloads.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "DownloadsCommon",
|
||||
"resource:///modules/DownloadsCommon.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "DownloadsViewUI",
|
||||
"resource:///modules/DownloadsViewUI.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "FileUtils",
|
||||
"resource://gre/modules/FileUtils.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "NetUtil",
|
||||
"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");
|
||||
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
|
||||
Downloads: "resource://gre/modules/Downloads.jsm",
|
||||
DownloadsCommon: "resource:///modules/DownloadsCommon.jsm",
|
||||
DownloadsViewUI: "resource:///modules/DownloadsViewUI.jsm",
|
||||
FileUtils: "resource://gre/modules/FileUtils.jsm",
|
||||
NetUtil: "resource://gre/modules/NetUtil.jsm",
|
||||
OS: "resource://gre/modules/osfile.jsm",
|
||||
Services: "resource://gre/modules/Services.jsm"
|
||||
});
|
||||
|
||||
/**
|
||||
* A download element shell is responsible for handling the commands and the
|
||||
|
@ -572,7 +566,7 @@ DownloadsPlacesView.prototype = {
|
|||
|
||||
_downloadURLFromClipboard() {
|
||||
let [url, name] = this._getURLFromClipboardData();
|
||||
let browserWin = RecentWindow.getMostRecentBrowserWindow();
|
||||
let browserWin = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||
let initiatingDoc = browserWin ? browserWin.document : document;
|
||||
DownloadURL(url, name, initiatingDoc);
|
||||
},
|
||||
|
@ -752,7 +746,7 @@ DownloadsPlacesView.prototype = {
|
|||
let links = Services.droppedLinkHandler.dropLinks(aEvent);
|
||||
if (!links.length)
|
||||
return;
|
||||
let browserWin = RecentWindow.getMostRecentBrowserWindow();
|
||||
let browserWin = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||
let initiatingDoc = browserWin ? browserWin.document : document;
|
||||
for (let link of links) {
|
||||
if (link.url.startsWith("about:"))
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
ChromeUtils.defineModuleGetter(this, "PrivateBrowsingUtils",
|
||||
"resource://gre/modules/PrivateBrowsingUtils.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "RecentWindow",
|
||||
"resource:///modules/RecentWindow.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "BrowserWindowTracker",
|
||||
"resource:///modules/BrowserWindowTracker.jsm");
|
||||
|
||||
var {
|
||||
ExtensionError,
|
||||
|
@ -188,7 +188,7 @@ class WindowTracker extends WindowTrackerBase {
|
|||
* @readonly
|
||||
*/
|
||||
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/AppConstants.jsm");
|
||||
|
||||
ChromeUtils.defineModuleGetter(this, "HeadlessShell",
|
||||
"resource:///modules/HeadlessShell.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "LaterRun",
|
||||
"resource:///modules/LaterRun.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "PrivateBrowsingUtils",
|
||||
"resource://gre/modules/PrivateBrowsingUtils.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "RecentWindow",
|
||||
"resource:///modules/RecentWindow.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "ShellService",
|
||||
"resource:///modules/ShellService.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
|
||||
HeadlessShell: "resource:///modules/HeadlessShell.jsm",
|
||||
LaterRun: "resource:///modules/LaterRun.jsm",
|
||||
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
|
||||
ShellService: "resource:///modules/ShellService.jsm",
|
||||
UpdatePing: "resource://gre/modules/UpdatePing.jsm"
|
||||
});
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "WindowsUIUtils",
|
||||
"@mozilla.org/windows-ui-utils;1", "nsIWindowsUIUtils");
|
||||
ChromeUtils.defineModuleGetter(this, "UpdatePing",
|
||||
"resource://gre/modules/UpdatePing.jsm");
|
||||
"@mozilla.org/windows-ui-utils;1", "nsIWindowsUIUtils");
|
||||
|
||||
function shouldLoadURI(aURI) {
|
||||
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
|
||||
// windows only if we're in perma-private mode.
|
||||
var allowPrivate = forcePrivate || PrivateBrowsingUtils.permanentPrivateBrowsing;
|
||||
var navWin = RecentWindow.getMostRecentBrowserWindow({private: allowPrivate});
|
||||
var navWin = BrowserWindowTracker.getMostRecentBrowserWindow({private: allowPrivate});
|
||||
if (!navWin) {
|
||||
// if we couldn't load it in an existing window, open a new one
|
||||
openBrowserWindow(cmdLine, uri.spec, null, forcePrivate);
|
||||
|
@ -789,7 +785,7 @@ nsDefaultCommandLineHandler.prototype = {
|
|||
cmdLine.state != Ci.nsICommandLine.STATE_INITIAL_LAUNCH &&
|
||||
WindowsUIUtils.inTabletMode) {
|
||||
// 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) {
|
||||
win.focus();
|
||||
return;
|
||||
|
|
|
@ -96,6 +96,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
|||
BrowserErrorReporter: "resource:///modules/BrowserErrorReporter.jsm",
|
||||
BrowserUITelemetry: "resource:///modules/BrowserUITelemetry.jsm",
|
||||
BrowserUsageTelemetry: "resource:///modules/BrowserUsageTelemetry.jsm",
|
||||
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
|
||||
ContentClick: "resource:///modules/ContentClick.jsm",
|
||||
ContextualIdentityService: "resource://gre/modules/ContextualIdentityService.jsm",
|
||||
CustomizableUI: "resource:///modules/CustomizableUI.jsm",
|
||||
|
@ -127,7 +128,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
|||
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
|
||||
ProcessHangMonitor: "resource:///modules/ProcessHangMonitor.jsm",
|
||||
ReaderParent: "resource:///modules/ReaderParent.jsm",
|
||||
RecentWindow: "resource:///modules/RecentWindow.jsm",
|
||||
RemotePrompt: "resource:///modules/RemotePrompt.jsm",
|
||||
SafeBrowsing: "resource://gre/modules/SafeBrowsing.jsm",
|
||||
Sanitizer: "resource:///modules/Sanitizer.jsm",
|
||||
|
@ -505,7 +505,7 @@ BrowserGlue.prototype = {
|
|||
case "handle-xul-text-link":
|
||||
let linkHandled = subject.QueryInterface(Ci.nsISupportsPRBool);
|
||||
if (!linkHandled.data) {
|
||||
let win = RecentWindow.getMostRecentBrowserWindow();
|
||||
let win = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||
if (win) {
|
||||
data = JSON.parse(data);
|
||||
let where = win.whereToOpenLink(data);
|
||||
|
@ -534,7 +534,7 @@ BrowserGlue.prototype = {
|
|||
} catch (ex) {
|
||||
Cu.reportError(ex);
|
||||
}
|
||||
let win = RecentWindow.getMostRecentBrowserWindow();
|
||||
let win = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||
win.BrowserSearch.recordSearchInTelemetry(engine, "urlbar");
|
||||
break;
|
||||
case "browser-search-engine-modified":
|
||||
|
@ -832,7 +832,7 @@ BrowserGlue.prototype = {
|
|||
if (profileAge < 90) // 3 months
|
||||
return;
|
||||
|
||||
let win = RecentWindow.getMostRecentBrowserWindow();
|
||||
let win = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||
if (!win)
|
||||
return;
|
||||
|
||||
|
@ -870,7 +870,7 @@ BrowserGlue.prototype = {
|
|||
* why a profile reset is offered.
|
||||
*/
|
||||
_resetProfileNotification(reason) {
|
||||
let win = RecentWindow.getMostRecentBrowserWindow();
|
||||
let win = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||
if (!win)
|
||||
return;
|
||||
|
||||
|
@ -907,7 +907,7 @@ BrowserGlue.prototype = {
|
|||
},
|
||||
|
||||
_notifyUnsignedAddonsDisabled() {
|
||||
let win = RecentWindow.getMostRecentBrowserWindow();
|
||||
let win = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||
if (!win)
|
||||
return;
|
||||
|
||||
|
@ -1481,7 +1481,7 @@ BrowserGlue.prototype = {
|
|||
let key = getNotifyString({propName: "notificationButtonAccessKey",
|
||||
stringName: "pu.notifyButton.accesskey"});
|
||||
|
||||
let win = RecentWindow.getMostRecentBrowserWindow();
|
||||
let win = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||
let notifyBox = win.document.getElementById("high-priority-global-notificationbox");
|
||||
|
||||
let buttons = [
|
||||
|
@ -1516,7 +1516,7 @@ BrowserGlue.prototype = {
|
|||
// This callback will be called twice but only once with this topic
|
||||
if (topic != "alertclickcallback")
|
||||
return;
|
||||
let win = RecentWindow.getMostRecentBrowserWindow();
|
||||
let win = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||
win.openTrustedLinkIn(data, "tab");
|
||||
}
|
||||
|
||||
|
@ -1777,7 +1777,7 @@ BrowserGlue.prototype = {
|
|||
var url = Services.urlFormatter.formatURLPref("app.support.baseURL");
|
||||
url += helpTopic;
|
||||
|
||||
var win = RecentWindow.getMostRecentBrowserWindow();
|
||||
var win = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||
|
||||
var buttons = [
|
||||
{
|
||||
|
@ -2284,7 +2284,7 @@ BrowserGlue.prototype = {
|
|||
} catch (ex) { /* Don't break the default prompt if telemetry is broken. */ }
|
||||
|
||||
if (willPrompt) {
|
||||
DefaultBrowserCheck.prompt(RecentWindow.getMostRecentBrowserWindow());
|
||||
DefaultBrowserCheck.prompt(BrowserWindowTracker.getMostRecentBrowserWindow());
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -2506,7 +2506,7 @@ BrowserGlue.prototype = {
|
|||
return;
|
||||
}
|
||||
|
||||
let chromeWindow = RecentWindow.getMostRecentBrowserWindow();
|
||||
let chromeWindow = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||
chromeWindow.openPreferences(...args);
|
||||
},
|
||||
|
||||
|
@ -2531,7 +2531,7 @@ BrowserGlue.prototype = {
|
|||
const URIs = data.wrappedJSObject.object;
|
||||
|
||||
// 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) => {
|
||||
let tab;
|
||||
|
@ -2614,7 +2614,7 @@ BrowserGlue.prototype = {
|
|||
if (AppConstants.platform == "win") {
|
||||
imageURL = "chrome://branding/content/icon64.png";
|
||||
}
|
||||
let win = RecentWindow.getMostRecentBrowserWindow({private: false});
|
||||
let win = BrowserWindowTracker.getMostRecentBrowserWindow({private: false});
|
||||
if (!win) {
|
||||
win = await this._openURLInNewWindow(url);
|
||||
let tabs = win.gBrowser.tabs;
|
||||
|
@ -2649,7 +2649,7 @@ BrowserGlue.prototype = {
|
|||
if (topic != "alertclickcallback")
|
||||
return;
|
||||
let url = await FxAccounts.config.promiseManageDevicesURI("device-connected-notification");
|
||||
let win = RecentWindow.getMostRecentBrowserWindow({private: false});
|
||||
let win = BrowserWindowTracker.getMostRecentBrowserWindow({private: false});
|
||||
if (!win) {
|
||||
this._openURLInNewWindow(url);
|
||||
} else {
|
||||
|
@ -2699,7 +2699,7 @@ BrowserGlue.prototype = {
|
|||
Services.prefs.setBoolPref("dom.ipc.plugins.flash.disable-protected-mode", true);
|
||||
Services.prefs.setBoolPref("browser.flash-protected-mode-flip.done", true);
|
||||
|
||||
let win = RecentWindow.getMostRecentBrowserWindow();
|
||||
let win = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||
if (!win) {
|
||||
return;
|
||||
}
|
||||
|
@ -3066,7 +3066,7 @@ var JawsScreenReaderVersionCheck = {
|
|||
return;
|
||||
}
|
||||
|
||||
let win = RecentWindow.getMostRecentBrowserWindow();
|
||||
let win = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||
if (!win || !win.gBrowser || !win.gBrowser.selectedBrowser) {
|
||||
Services.console.logStringMessage(
|
||||
"Content access support for older versions of JAWS is disabled " +
|
||||
|
|
|
@ -11,13 +11,13 @@ ChromeUtils.import("resource://gre/modules/Timer.jsm");
|
|||
|
||||
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
AppConstants: "resource://gre/modules/AppConstants.jsm",
|
||||
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
|
||||
OpenInTabsUtils: "resource:///modules/OpenInTabsUtils.jsm",
|
||||
PlacesTransactions: "resource://gre/modules/PlacesTransactions.jsm",
|
||||
PlacesUtils: "resource://gre/modules/PlacesUtils.jsm",
|
||||
PluralForm: "resource://gre/modules/PluralForm.jsm",
|
||||
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
|
||||
PromiseUtils: "resource://gre/modules/PromiseUtils.jsm",
|
||||
RecentWindow: "resource:///modules/RecentWindow.jsm",
|
||||
Weave: "resource://services-sync/main.js",
|
||||
});
|
||||
|
||||
|
@ -607,7 +607,7 @@ var PlacesUIUtils = {
|
|||
var browserWindow = null;
|
||||
browserWindow =
|
||||
aWindow && aWindow.document.documentElement.getAttribute("windowtype") == "navigator:browser" ?
|
||||
aWindow : RecentWindow.getMostRecentBrowserWindow();
|
||||
aWindow : BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||
|
||||
var urls = [];
|
||||
let skipMarking = browserWindow && PrivateBrowsingUtils.isWindowPrivate(browserWindow);
|
||||
|
@ -745,7 +745,7 @@ var PlacesUIUtils = {
|
|||
if (aWhere == "current" && isBookmark) {
|
||||
if (PlacesUtils.annotations
|
||||
.itemHasAnnotation(aNode.itemId, this.LOAD_IN_SIDEBAR_ANNO)) {
|
||||
let browserWin = RecentWindow.getMostRecentBrowserWindow();
|
||||
let browserWin = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||
if (browserWin) {
|
||||
browserWin.openWebPanel(aNode.title, aNode.uri);
|
||||
return;
|
||||
|
|
|
@ -34,8 +34,8 @@ const TEST_URL = "http://www.example.com/";
|
|||
const DIALOG_URL = "chrome://browser/content/places/bookmarkProperties.xul";
|
||||
const DIALOG_URL_MINIMAL_UI = "chrome://browser/content/places/bookmarkProperties2.xul";
|
||||
|
||||
ChromeUtils.import("resource:///modules/RecentWindow.jsm");
|
||||
var win = RecentWindow.getMostRecentBrowserWindow();
|
||||
ChromeUtils.import("resource:///modules/BrowserWindowTracker.jsm");
|
||||
var win = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||
|
||||
function add_bookmark(url) {
|
||||
return PlacesUtils.bookmarks.insert({
|
||||
|
|
|
@ -165,11 +165,11 @@ XPCOMUtils.defineLazyServiceGetters(this, {
|
|||
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
AppConstants: "resource://gre/modules/AppConstants.jsm",
|
||||
AsyncShutdown: "resource://gre/modules/AsyncShutdown.jsm",
|
||||
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
|
||||
DevToolsShim: "chrome://devtools-startup/content/DevToolsShim.jsm",
|
||||
GlobalState: "resource:///modules/sessionstore/GlobalState.jsm",
|
||||
PrivacyFilter: "resource:///modules/sessionstore/PrivacyFilter.jsm",
|
||||
PromiseUtils: "resource://gre/modules/PromiseUtils.jsm",
|
||||
RecentWindow: "resource:///modules/RecentWindow.jsm",
|
||||
RunState: "resource:///modules/sessionstore/RunState.jsm",
|
||||
SessionCookies: "resource:///modules/sessionstore/SessionCookies.jsm",
|
||||
SessionFile: "resource:///modules/sessionstore/SessionFile.jsm",
|
||||
|
@ -4230,7 +4230,7 @@ var SessionStoreInternal = {
|
|||
* @returns Window reference
|
||||
*/
|
||||
_getMostRecentBrowserWindow: function ssi_getMostRecentBrowserWindow() {
|
||||
return RecentWindow.getMostRecentBrowserWindow({ allowPopups: true });
|
||||
return BrowserWindowTracker.getMostRecentBrowserWindow({ allowPopups: true });
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
* 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
|
||||
// file is whitelisted.
|
||||
//
|
||||
|
|
|
@ -74,8 +74,8 @@ var Translation = {
|
|||
|
||||
openProviderAttribution() {
|
||||
let attribution = this.supportedEngines[this.translationEngine];
|
||||
ChromeUtils.import("resource:///modules/RecentWindow.jsm");
|
||||
RecentWindow.getMostRecentBrowserWindow().openTrustedLinkIn(attribution, "tab");
|
||||
ChromeUtils.import("resource:///modules/BrowserWindowTracker.jsm");
|
||||
BrowserWindowTracker.getMostRecentBrowserWindow().openUILinkIn(attribution, "tab");
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -36,14 +36,12 @@ ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
|||
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillUtils.jsm");
|
||||
|
||||
ChromeUtils.defineModuleGetter(this, "FormAutofillPreferences",
|
||||
"resource://formautofill/FormAutofillPreferences.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "FormAutofillDoorhanger",
|
||||
"resource://formautofill/FormAutofillDoorhanger.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "MasterPassword",
|
||||
"resource://formautofill/MasterPassword.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "RecentWindow",
|
||||
"resource:///modules/RecentWindow.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
|
||||
FormAutofillPreferences: "resource://formautofill/FormAutofillPreferences.jsm",
|
||||
FormAutofillDoorhanger: "resource://formautofill/FormAutofillDoorhanger.jsm",
|
||||
MasterPassword: "resource://formautofill/MasterPassword.jsm",
|
||||
});
|
||||
|
||||
this.log = null;
|
||||
FormAutofillUtils.defineLazyLogGetter(this, EXPORTED_SYMBOLS[0]);
|
||||
|
@ -243,7 +241,7 @@ FormAutofillParent.prototype = {
|
|||
break;
|
||||
}
|
||||
case "FormAutofill:OpenPreferences": {
|
||||
const win = RecentWindow.getMostRecentBrowserWindow();
|
||||
const win = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||
win.openPreferences("panePrivacy", {origin: "autofillFooter"});
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -22,8 +22,6 @@ ChromeUtils.defineModuleGetter(this, "Pocket",
|
|||
"chrome://pocket/content/Pocket.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "ReaderMode",
|
||||
"resource://gre/modules/ReaderMode.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "RecentWindow",
|
||||
"resource:///modules/RecentWindow.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "Services",
|
||||
"resource://gre/modules/Services.jsm");
|
||||
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/XPCOMUtils.jsm");
|
||||
|
||||
ChromeUtils.defineModuleGetter(this, "AppConstants",
|
||||
"resource://gre/modules/AppConstants.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "RecentWindow",
|
||||
"resource:///modules/RecentWindow.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "CustomizableUI",
|
||||
"resource:///modules/CustomizableUI.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "UITour",
|
||||
"resource:///modules/UITour.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
AppConstants: "resource://gre/modules/AppConstants.jsm",
|
||||
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
|
||||
CustomizableUI: "resource:///modules/CustomizableUI.jsm",
|
||||
UITour: "resource:///modules/UITour.jsm",
|
||||
});
|
||||
XPCOMUtils.defineLazyGetter(this, "Timer", function() {
|
||||
let 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
|
||||
// pings are gathered during shutdown.
|
||||
Services.search.init(rv => {
|
||||
let win = RecentWindow.getMostRecentBrowserWindow({
|
||||
let win = BrowserWindowTracker.getMostRecentBrowserWindow({
|
||||
private: false,
|
||||
allowPopups: false,
|
||||
});
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* 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/Services.jsm");
|
||||
|
@ -16,6 +16,10 @@ ChromeUtils.import("resource://gre/modules/Services.jsm");
|
|||
XPCOMUtils.defineLazyServiceGetter(this, "_focusManager",
|
||||
"@mozilla.org/focus-manager;1",
|
||||
"nsIFocusManager");
|
||||
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
AppConstants: "resource://gre/modules/AppConstants.jsm",
|
||||
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm"
|
||||
});
|
||||
|
||||
// Constants
|
||||
const TAB_EVENTS = ["TabBrowserInserted", "TabSelect"];
|
||||
|
@ -26,11 +30,6 @@ const DEBUG = false;
|
|||
var _lastFocusedWindow = null;
|
||||
var _lastTopLevelWindowID = 0;
|
||||
|
||||
// Exported symbol
|
||||
function trackBrowserWindow(aWindow) {
|
||||
WindowHelper.addWindow(aWindow);
|
||||
}
|
||||
|
||||
// Global methods
|
||||
function debug(s) {
|
||||
if (DEBUG) {
|
||||
|
@ -135,4 +134,65 @@ var WindowHelper = {
|
|||
// aWindow is now focused
|
||||
_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/Services.jsm");
|
||||
|
||||
ChromeUtils.defineModuleGetter(this, "CrashSubmit",
|
||||
"resource://gre/modules/CrashSubmit.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "AppConstants",
|
||||
"resource://gre/modules/AppConstants.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "RemotePages",
|
||||
"resource://gre/modules/RemotePageManager.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "SessionStore",
|
||||
"resource:///modules/sessionstore/SessionStore.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "RecentWindow",
|
||||
"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.defineLazyModuleGetters(this, {
|
||||
AppConstants: "resource://gre/modules/AppConstants.jsm",
|
||||
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
|
||||
clearTimeout: "resource://gre/modules/Timer.jsm",
|
||||
CrashSubmit: "resource://gre/modules/CrashSubmit.jsm",
|
||||
PluralForm: "resource://gre/modules/PluralForm.jsm",
|
||||
RemotePages: "resource://gre/modules/RemotePageManager.jsm",
|
||||
SessionStore: "resource:///modules/sessionstore/SessionStore.jsm",
|
||||
setTimeout: "resource://gre/modules/Timer.jsm"
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "gNavigatorBundle", function() {
|
||||
const url = "chrome://browser/locale/browser.properties";
|
||||
|
@ -838,7 +832,7 @@ var UnsubmittedCrashHandler = {
|
|||
* @returns The <xul:notification> if one is shown. null otherwise.
|
||||
*/
|
||||
show({ notificationID, message, reportIDs, onAction }) {
|
||||
let chromeWin = RecentWindow.getMostRecentBrowserWindow();
|
||||
let chromeWin = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||
if (!chromeWin) {
|
||||
// Can't show a notification in this case. We'll hopefully
|
||||
// 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/EventEmitter.jsm");
|
||||
|
||||
ChromeUtils.defineModuleGetter(this, "AddonManager",
|
||||
"resource://gre/modules/AddonManager.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "AddonManagerPrivate",
|
||||
"resource://gre/modules/AddonManager.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "AppMenuNotifications",
|
||||
"resource://gre/modules/AppMenuNotifications.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "ExtensionData",
|
||||
"resource://gre/modules/Extension.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "RecentWindow",
|
||||
"resource:///modules/RecentWindow.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "Services",
|
||||
"resource://gre/modules/Services.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
AddonManager: "resource://gre/modules/AddonManager.jsm",
|
||||
AddonManagerPrivate: "resource://gre/modules/AddonManager.jsm",
|
||||
AppMenuNotifications: "resource://gre/modules/AppMenuNotifications.jsm",
|
||||
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
|
||||
ExtensionData: "resource://gre/modules/Extension.jsm",
|
||||
Services: "resource://gre/modules/Services.jsm"
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyPreferenceGetter(this, "WEBEXT_PERMISSION_PROMPTS",
|
||||
"extensions.webextPermissionPrompts", false);
|
||||
|
|
|
@ -11,8 +11,8 @@ ChromeUtils.import("resource://gre/modules/Services.jsm");
|
|||
|
||||
ChromeUtils.defineModuleGetter(this, "BrowserUtils",
|
||||
"resource://gre/modules/BrowserUtils.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "RecentWindow",
|
||||
"resource:///modules/RecentWindow.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "BrowserWindowTracker",
|
||||
"resource:///modules/BrowserWindowTracker.jsm");
|
||||
|
||||
var Feeds = {
|
||||
// Listeners are added in nsBrowserGlue.js
|
||||
|
@ -43,7 +43,7 @@ var Feeds = {
|
|||
}
|
||||
|
||||
case "FeedConverter:addLiveBookmark": {
|
||||
let topWindow = RecentWindow.getMostRecentBrowserWindow();
|
||||
let topWindow = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||
topWindow.PlacesCommandHook.addLiveBookmark(data.spec, data.title, data.subtitle)
|
||||
.catch(Cu.reportError);
|
||||
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"):
|
||||
BUG_COMPONENT = ("Toolkit", "Telemetry")
|
||||
|
||||
with Files("BrowserWindowTracker.jsm"):
|
||||
BUG_COMPONENT = ("Core", "Networking")
|
||||
|
||||
with Files("*Telemetry.jsm"):
|
||||
BUG_COMPONENT = ("Toolkit", "Telemetry")
|
||||
|
||||
|
@ -109,9 +112,6 @@ with Files("WindowsPreviewPerTab.jsm"):
|
|||
with Files("offlineAppCache.jsm"):
|
||||
BUG_COMPONENT = ("Firefox", "Preferences")
|
||||
|
||||
with Files("UpdateTopLevelContentWindowIDHelper.jsm"):
|
||||
BUG_COMPONENT = ("Core", "Networking")
|
||||
|
||||
with Files("webrtcUI.jsm"):
|
||||
BUG_COMPONENT = ("Firefox", "Device Permissions")
|
||||
|
||||
|
@ -133,6 +133,7 @@ EXTRA_JS_MODULES += [
|
|||
'BrowserErrorReporter.jsm',
|
||||
'BrowserUITelemetry.jsm',
|
||||
'BrowserUsageTelemetry.jsm',
|
||||
'BrowserWindowTracker.jsm',
|
||||
'ContentClick.jsm',
|
||||
'ContentCrashHandlers.jsm',
|
||||
'ContentLinkHandler.jsm',
|
||||
|
@ -154,7 +155,6 @@ EXTRA_JS_MODULES += [
|
|||
'PluginContent.jsm',
|
||||
'ProcessHangMonitor.jsm',
|
||||
'ReaderParent.jsm',
|
||||
'RecentWindow.jsm',
|
||||
'RemotePrompt.jsm',
|
||||
'Sanitizer.jsm',
|
||||
'SchedulePressure.jsm',
|
||||
|
@ -162,7 +162,6 @@ EXTRA_JS_MODULES += [
|
|||
'SitePermissions.jsm',
|
||||
'ThemeVariableMap.jsm',
|
||||
'TransientPrefs.jsm',
|
||||
'UpdateTopLevelContentWindowIDHelper.jsm',
|
||||
'webrtcUI.jsm',
|
||||
'ZoomUI.jsm',
|
||||
]
|
||||
|
|
|
@ -89,8 +89,8 @@ class BaseNavigationTestCase(WindowManagerMixin, MarionetteTestCase):
|
|||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
} else {
|
||||
Components.utils.import("resource:///modules/RecentWindow.jsm");
|
||||
win = RecentWindow.getMostRecentBrowserWindow();
|
||||
Components.utils.import("resource:///modules/BrowserWindowTracker.jsm");
|
||||
win = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||
}
|
||||
|
||||
let tabBrowser = null;
|
||||
|
|
|
@ -44,8 +44,8 @@ class TestSwitchToWindowContent(WindowManagerMixin, MarionetteTestCase):
|
|||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
} else {
|
||||
Components.utils.import("resource:///modules/RecentWindow.jsm");
|
||||
win = RecentWindow.getMostRecentBrowserWindow();
|
||||
Components.utils.import("resource:///modules/BrowserWindowTracker.jsm");
|
||||
win = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||
}
|
||||
|
||||
let tabBrowser = null;
|
||||
|
|
|
@ -95,9 +95,9 @@ class TestCloseWindow(WindowManagerMixin, MarionetteTestCase):
|
|||
|
||||
with self.marionette.using_context("chrome"):
|
||||
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 => {
|
||||
marionetteScriptFinished(true);
|
||||
}, { once: true});
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/Task.jsm");
|
||||
ChromeUtils.import("resource:///modules/RecentWindow.jsm");
|
||||
|
||||
const ANIMATION_PREF = "toolkit.cosmeticAnimations.enabled";
|
||||
|
||||
|
|
|
@ -436,8 +436,8 @@ var TelemetryReportingPolicyImpl = {
|
|||
|
||||
let win;
|
||||
try {
|
||||
const { RecentWindow } = ChromeUtils.import("resource:///modules/RecentWindow.jsm", {});
|
||||
win = RecentWindow.getMostRecentBrowserWindow();
|
||||
const { BrowserWindowTracker } = ChromeUtils.import("resource:///modules/BrowserWindowTracker.jsm", {});
|
||||
win = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||
} catch (e) {}
|
||||
|
||||
if (!win) {
|
||||
|
|
|
@ -9,8 +9,8 @@ const EXPORTED_SYMBOLS = ["WebNavigation"];
|
|||
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
ChromeUtils.defineModuleGetter(this, "RecentWindow",
|
||||
"resource:///modules/RecentWindow.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "BrowserWindowTracker",
|
||||
"resource:///modules/BrowserWindowTracker.jsm");
|
||||
|
||||
// Maximum amount of time that can be passed and still consider
|
||||
// the data recent (similar to how is done in nsNavHistory,
|
||||
|
@ -216,7 +216,7 @@ var Manager = {
|
|||
* @param {boolean} [tabTransitionData.typed]
|
||||
*/
|
||||
setRecentTabTransitionData(tabTransitionData) {
|
||||
let window = RecentWindow.getMostRecentBrowserWindow();
|
||||
let window = BrowserWindowTracker.getMostRecentBrowserWindow();
|
||||
if (window && window.gBrowser && window.gBrowser.selectedTab &&
|
||||
window.gBrowser.selectedTab.linkedBrowser) {
|
||||
let browser = window.gBrowser.selectedTab.linkedBrowser;
|
||||
|
|
Загрузка…
Ссылка в новой задаче