Bug 1589900 - ensure we initialize about:privatebrowsing remote page handler before loading it from the commandline, r=mossop

Differential Revision: https://phabricator.services.mozilla.com/D51583

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Gijs Kruitbosch 2019-11-04 18:27:05 +00:00
Родитель 91cac2c161
Коммит 34cb7fdd7d
2 изменённых файлов: 11 добавлений и 0 удалений

Просмотреть файл

@ -16,6 +16,8 @@ const { AppConstants } = ChromeUtils.import(
);
XPCOMUtils.defineLazyModuleGetters(this, {
AboutPrivateBrowsingHandler:
"resource:///modules/aboutpages/AboutPrivateBrowsingHandler.jsm",
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
HeadlessShell: "resource:///modules/HeadlessShell.jsm",
HomePage: "resource:///modules/HomePage.jsm",
@ -513,6 +515,9 @@ nsBrowserContentHandler.prototype = {
false
);
if (privateWindowParam) {
// Ensure we initialize the handler before trying to load
// about:privatebrowsing.
AboutPrivateBrowsingHandler.init();
let forcePrivate = true;
let resolvedURI;
if (!PrivateBrowsingUtils.enabled) {
@ -538,6 +543,9 @@ nsBrowserContentHandler.prototype = {
}
// NS_ERROR_INVALID_ARG is thrown when flag exists, but has no param.
if (cmdLine.handleFlag("private-window", false)) {
// Ensure we initialize the handler before trying to load
// about:privatebrowsing.
AboutPrivateBrowsingHandler.init();
openBrowserWindow(
cmdLine,
gSystemPrincipal,

Просмотреть файл

@ -42,6 +42,9 @@ var AboutPrivateBrowsingHandler = {
],
init() {
if (this._inited) {
return;
}
this.receiveMessage = this.receiveMessage.bind(this);
this.pageListener = new RemotePages("about:privatebrowsing");
for (let topic of this._topics) {