1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 import { HomePage } from "resource:///modules/HomePage.sys.mjs";
6 import { PrivateBrowsingUtils } from "resource://gre/modules/PrivateBrowsingUtils.sys.mjs";
8 export class AboutHttpsOnlyErrorParent extends JSWindowActorParent {
10 return this.browsingContext.top.embedderElement;
13 receiveMessage(aMessage) {
14 switch (aMessage.name) {
16 this.goBackFromErrorPage(this.browser);
21 goBackFromErrorPage(aBrowser) {
22 if (!aBrowser.canGoBack) {
23 // If the unsafe page is the first or the only one in history, go to the
25 aBrowser.fixupAndLoadURIString(
26 this.getDefaultHomePage(aBrowser.ownerGlobal),
29 Services.scriptSecurityManager.getSystemPrincipal(),
37 getDefaultHomePage(win) {
38 if (PrivateBrowsingUtils.isWindowPrivate(win)) {
39 return win.BROWSER_NEW_TAB_URL || "about:blank";
41 let url = HomePage.getDefault();
42 // If url is a pipe-delimited set of pages, just take the first one.
43 if (url.includes("|")) {
44 url = url.split("|")[0];