Browse Source

port bug 1770994

Bill Gianopoulos 8 months ago
parent
commit
98b0c1916c

+ 287 - 0
comm-central/patches/WIP-9999999-port1770994-suite-bustage.patch

@@ -0,0 +1,287 @@
+# HG changeset patch
+# User Bill Gianopoulos <wgianopoulos@gmail.com>
+# Date 1708776876 0
+9999999 - Port bug 1770944 to fix suite bustage.
+Bug 1770944 - Remove dom/browser-element/BrowserElementParent.jsm.
+
+diff --git a/suite/components/AboutRedirector.jsm b/suite/components/AboutRedirector.jsm
+deleted file mode 100644
+--- a/suite/components/AboutRedirector.jsm
++++ /dev/null
+@@ -1,125 +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/. */
+-
+-var EXPORTED_SYMBOLS = ["AboutRedirector"];
+-
+-function AboutRedirector() {}
+-AboutRedirector.prototype = {
+-  QueryInterface: ChromeUtils.generateQI(["nsIAboutModule"]),
+-
+-  // Each entry in the map has the key as the part after the "about:" and the
+-  // value as a record with url and flags entries. Note that each addition here
+-  // should be coupled with a corresponding addition in mailComponents.manifest.
+-  _redirMap: {
+-    newserror: {
+-      url: "chrome://messenger/content/newsError.xhtml",
+-      flags: Ci.nsIAboutModule.ALLOW_SCRIPT,
+-    },
+-    rights: {
+-      url: "chrome://messenger/content/aboutRights.xhtml",
+-      flags:
+-        Ci.nsIAboutModule.ALLOW_SCRIPT |
+-        Ci.nsIAboutModule.URI_SAFE_FOR_UNTRUSTED_CONTENT,
+-    },
+-    support: {
+-      url: "chrome://messenger/content/about-support/aboutSupport.xhtml",
+-      flags: Ci.nsIAboutModule.ALLOW_SCRIPT,
+-    },
+-    preferences: {
+-      url: "chrome://messenger/content/preferences/preferences.xhtml",
+-      flags: Ci.nsIAboutModule.ALLOW_SCRIPT,
+-    },
+-    downloads: {
+-      url: "chrome://messenger/content/downloads/aboutDownloads.xhtml",
+-      flags: Ci.nsIAboutModule.ALLOW_SCRIPT,
+-    },
+-    policies: {
+-      url: "chrome://messenger/content/policies/aboutPolicies.xhtml",
+-      flags: Ci.nsIAboutModule.ALLOW_SCRIPT,
+-    },
+-    accountsettings: {
+-      url: "chrome://messenger/content/AccountManager.xhtml",
+-      flags: Ci.nsIAboutModule.ALLOW_SCRIPT,
+-    },
+-    accountsetup: {
+-      url: "chrome://messenger/content/accountcreation/accountSetup.xhtml",
+-      flags: Ci.nsIAboutModule.ALLOW_SCRIPT,
+-    },
+-    accountprovisioner: {
+-      url: "chrome://messenger/content/newmailaccount/accountProvisioner.xhtml",
+-      flags: Ci.nsIAboutModule.ALLOW_SCRIPT,
+-    },
+-    addressbook: {
+-      url: "chrome://messenger/content/addressbook/aboutAddressBook.xhtml",
+-      flags: Ci.nsIAboutModule.ALLOW_SCRIPT,
+-    },
+-    "3pane": {
+-      url: "chrome://messenger/content/about3Pane.xhtml",
+-      flags: Ci.nsIAboutModule.ALLOW_SCRIPT,
+-    },
+-    message: {
+-      url: "chrome://messenger/content/aboutMessage.xhtml",
+-      flags: Ci.nsIAboutModule.ALLOW_SCRIPT,
+-    },
+-    import: {
+-      url: "chrome://messenger/content/aboutImport.xhtml",
+-      flags: Ci.nsIAboutModule.ALLOW_SCRIPT,
+-    },
+-    profiling: {
+-      url:
+-        "chrome://devtools/content/performance-new/aboutprofiling/index.xhtml",
+-      flags:
+-        Ci.nsIAboutModule.ALLOW_SCRIPT | Ci.nsIAboutModule.IS_SECURE_CHROME_UI,
+-    },
+-  },
+-
+-  /**
+-   * Gets the module name from the given URI.
+-   */
+-  _getModuleName(aURI) {
+-    // Strip out the first ? or #, and anything following it
+-    let name = /[^?#]+/.exec(aURI.pathQueryRef)[0];
+-    return name.toLowerCase();
+-  },
+-
+-  getURIFlags(aURI) {
+-    let name = this._getModuleName(aURI);
+-    if (!(name in this._redirMap)) {
+-      throw Components.Exception(`no about:${name}`, Cr.NS_ERROR_ILLEGAL_VALUE);
+-    }
+-    return this._redirMap[name].flags;
+-  },
+-
+-  newChannel(aURI, aLoadInfo) {
+-    let name = this._getModuleName(aURI);
+-    if (!(name in this._redirMap)) {
+-      throw Components.Exception(`no about:${name}`, Cr.NS_ERROR_ILLEGAL_VALUE);
+-    }
+-
+-    let newURI = Services.io.newURI(this._redirMap[name].url);
+-    let channel = Services.io.newChannelFromURIWithLoadInfo(newURI, aLoadInfo);
+-    channel.originalURI = aURI;
+-
+-    if (
+-      this._redirMap[name].flags &
+-      Ci.nsIAboutModule.URI_SAFE_FOR_UNTRUSTED_CONTENT
+-    ) {
+-      let principal = Services.scriptSecurityManager.createContentPrincipal(
+-        aURI,
+-        {}
+-      );
+-      channel.owner = principal;
+-    }
+-
+-    return channel;
+-  },
+-
+-  getChromeURI(aURI) {
+-    let name = this._getModuleName(aURI);
+-    if (!(name in this._redirMap)) {
+-      throw Components.Exception(`no about:${name}`, Cr.NS_ERROR_ILLEGAL_VALUE);
+-    }
+-    return Services.io.newURI(this._redirMap[name].url);
+-  },
+-};
+diff --git a/suite/components/AboutRedirector.sys.mjs b/suite/components/AboutRedirector.sys.mjs
+new file mode 100644
+--- /dev/null
++++ b/suite/components/AboutRedirector.sys.mjs
+@@ -0,0 +1,127 @@
++/* 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/. */
++
++export function AboutRedirector() {}
++
++AboutRedirector.prototype = {
++  QueryInterface: ChromeUtils.generateQI(["nsIAboutModule"]),
++
++  // Each entry in the map has the key as the part after the "about:" and the
++  // value as a record with url and flags entries. Note that each addition here
++  // should be coupled with a corresponding addition in mailComponents.manifest.
++  _redirMap: {
++    newserror: {
++      url: "chrome://messenger/content/newsError.xhtml",
++      flags: Ci.nsIAboutModule.ALLOW_SCRIPT,
++    },
++    rights: {
++      url: "chrome://messenger/content/aboutRights.xhtml",
++      flags:
++        Ci.nsIAboutModule.ALLOW_SCRIPT |
++        Ci.nsIAboutModule.URI_SAFE_FOR_UNTRUSTED_CONTENT,
++    },
++    support: {
++      url: "chrome://messenger/content/about-support/aboutSupport.xhtml",
++      flags: Ci.nsIAboutModule.ALLOW_SCRIPT,
++    },
++    preferences: {
++      url: "chrome://messenger/content/preferences/preferences.xhtml",
++      flags: Ci.nsIAboutModule.ALLOW_SCRIPT,
++    },
++    downloads: {
++      url: "chrome://messenger/content/downloads/aboutDownloads.xhtml",
++      flags: Ci.nsIAboutModule.ALLOW_SCRIPT,
++    },
++    policies: {
++      url: "chrome://messenger/content/policies/aboutPolicies.xhtml",
++      flags: Ci.nsIAboutModule.ALLOW_SCRIPT,
++    },
++    accountsettings: {
++      url: "chrome://messenger/content/AccountManager.xhtml",
++      flags: Ci.nsIAboutModule.ALLOW_SCRIPT,
++    },
++    accountsetup: {
++      url: "chrome://messenger/content/accountcreation/accountSetup.xhtml",
++      flags: Ci.nsIAboutModule.ALLOW_SCRIPT,
++    },
++    accountprovisioner: {
++      url: "chrome://messenger/content/newmailaccount/accountProvisioner.xhtml",
++      flags: Ci.nsIAboutModule.ALLOW_SCRIPT,
++    },
++    addressbook: {
++      url: "chrome://messenger/content/addressbook/aboutAddressBook.xhtml",
++      flags: Ci.nsIAboutModule.ALLOW_SCRIPT,
++    },
++    "3pane": {
++      url: "chrome://messenger/content/about3Pane.xhtml",
++      flags: Ci.nsIAboutModule.ALLOW_SCRIPT,
++    },
++    message: {
++      url: "chrome://messenger/content/aboutMessage.xhtml",
++      flags: Ci.nsIAboutModule.ALLOW_SCRIPT,
++    },
++    import: {
++      url: "chrome://messenger/content/aboutImport.xhtml",
++      flags: Ci.nsIAboutModule.ALLOW_SCRIPT,
++    },
++    profiling: {
++      url: "chrome://devtools/content/performance-new/aboutprofiling/index.xhtml",
++      flags:
++        Ci.nsIAboutModule.ALLOW_SCRIPT | Ci.nsIAboutModule.IS_SECURE_CHROME_UI,
++    },
++  },
++
++  /**
++   * Gets the module name from the given URI.
++   */
++  _getModuleName(aURI) {
++    // Strip out the first ? or #, and anything following it
++    const name = /[^?#]+/.exec(aURI.pathQueryRef)[0];
++    return name.toLowerCase();
++  },
++
++  getURIFlags(aURI) {
++    const name = this._getModuleName(aURI);
++    if (!(name in this._redirMap)) {
++      throw Components.Exception(`no about:${name}`, Cr.NS_ERROR_ILLEGAL_VALUE);
++    }
++    return this._redirMap[name].flags;
++  },
++
++  newChannel(aURI, aLoadInfo) {
++    const name = this._getModuleName(aURI);
++    if (!(name in this._redirMap)) {
++      throw Components.Exception(`no about:${name}`, Cr.NS_ERROR_ILLEGAL_VALUE);
++    }
++
++    const newURI = Services.io.newURI(this._redirMap[name].url);
++    const channel = Services.io.newChannelFromURIWithLoadInfo(
++      newURI,
++      aLoadInfo
++    );
++    channel.originalURI = aURI;
++
++    if (
++      this._redirMap[name].flags &
++      Ci.nsIAboutModule.URI_SAFE_FOR_UNTRUSTED_CONTENT
++    ) {
++      const principal = Services.scriptSecurityManager.createContentPrincipal(
++        aURI,
++        {}
++      );
++      channel.owner = principal;
++    }
++
++    return channel;
++  },
++
++  getChromeURI(aURI) {
++    const name = this._getModuleName(aURI);
++    if (!(name in this._redirMap)) {
++      throw Components.Exception(`no about:${name}`, Cr.NS_ERROR_ILLEGAL_VALUE);
++    }
++    return Services.io.newURI(this._redirMap[name].url);
++  },
++
++};
+diff --git a/suite/components/moz.build b/suite/components/moz.build
+--- a/suite/components/moz.build
++++ b/suite/components/moz.build
+@@ -46,14 +46,14 @@ XPIDL_MODULE = "suite-components"
+ 
+ EXTRA_COMPONENTS += [
+     "nsGopherProtocolStubHandler.js",
+     "nsSuiteGlue.js",
+     "SuiteComponents.manifest",
+ ]
+ 
+ EXTRA_JS_MODULES += [
+-    "AboutRedirector.jsm",
++    "AboutRedirector.sys.mjs",
+ ]
+ 
+ XPCOM_MANIFESTS += [
+     "components.conf",
+ ]

+ 1 - 0
comm-central/patches/series

@@ -12,3 +12,4 @@ TOP-9999999-port1514936-suite-102a1.patch
 WIP-9999999-port1712633-suite-90a1.patch
 WIP-1650630-2-port-1603712-suite.patch
 WIP-1783623-port1524687-suite.patch
+WIP-9999999-port1770994-suite-bustage.patch