Bug 1619992 - Split AboutNewTabService into AboutNewTabParentService and AboutNewTabChildService. r=perftest-reviewers,Mardak,sparky
This patch does the following: * Moves most logic for initiating about:home / about:newtab into AboutNewTab.jsm * Makes AboutNewTab the API surface for overriding the default about:newtab URLs. * Reduces the surface of nsIAboutNewTabService, and makes the properties read-only * Splits the remaining code in the nsIAboutNewTabService into an implementation for the parent process, and one for content processes. This split will hopefully help reduce confusion about which code in AboutNewTabService is running in which process. Differential Revision: https://phabricator.services.mozilla.com/D65569
This commit is contained in:
@@ -13,6 +13,7 @@ var { XPCOMUtils } = ChromeUtils.import(
|
||||
);
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
AboutNewTab: "resource:///modules/AboutNewTab.jsm",
|
||||
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
|
||||
ContextualIdentityService:
|
||||
"resource://gre/modules/ContextualIdentityService.jsm",
|
||||
@@ -21,13 +22,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
ShellService: "resource:///modules/ShellService.jsm",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(
|
||||
this,
|
||||
"aboutNewTabService",
|
||||
"@mozilla.org/browser/aboutnewtab-service;1",
|
||||
"nsIAboutNewTabService"
|
||||
);
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "ReferrerInfo", () =>
|
||||
Components.Constructor(
|
||||
"@mozilla.org/referrer-info;1",
|
||||
@@ -42,7 +36,7 @@ Object.defineProperty(this, "BROWSER_NEW_TAB_URL", {
|
||||
if (PrivateBrowsingUtils.isWindowPrivate(window)) {
|
||||
if (
|
||||
!PrivateBrowsingUtils.permanentPrivateBrowsing &&
|
||||
!aboutNewTabService.overridden
|
||||
!AboutNewTab.newTabURLOverridden
|
||||
) {
|
||||
return "about:privatebrowsing";
|
||||
}
|
||||
@@ -61,12 +55,12 @@ Object.defineProperty(this, "BROWSER_NEW_TAB_URL", {
|
||||
if (
|
||||
!privateAllowed &&
|
||||
(extensionControlled ||
|
||||
aboutNewTabService.newTabURL.startsWith("moz-extension://"))
|
||||
AboutNewTab.newTabURL.startsWith("moz-extension://"))
|
||||
) {
|
||||
return "about:privatebrowsing";
|
||||
}
|
||||
}
|
||||
return aboutNewTabService.newTabURL;
|
||||
return AboutNewTab.newTabURL;
|
||||
},
|
||||
});
|
||||
|
||||
@@ -655,7 +649,7 @@ function openLinkIn(url, where, params) {
|
||||
focusUrlBar =
|
||||
!loadInBackground &&
|
||||
w.isBlankPageURL(url) &&
|
||||
!aboutNewTabService.willNotifyUser;
|
||||
!AboutNewTab.willNotifyUser;
|
||||
|
||||
let tabUsedForLoad = w.gBrowser.loadOneTab(url, {
|
||||
referrerInfo: aReferrerInfo,
|
||||
|
||||
Reference in New Issue
Block a user