summaryrefslogtreecommitdiffstats
path: root/comm/suite/components/nsAbout.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /comm/suite/components/nsAbout.js
parentInitial commit. (diff)
downloadthunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz
thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'comm/suite/components/nsAbout.js')
-rw-r--r--comm/suite/components/nsAbout.js76
1 files changed, 76 insertions, 0 deletions
diff --git a/comm/suite/components/nsAbout.js b/comm/suite/components/nsAbout.js
new file mode 100644
index 0000000000..eb93ce0dda
--- /dev/null
+++ b/comm/suite/components/nsAbout.js
@@ -0,0 +1,76 @@
+/* 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 {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
+var {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
+
+const SCRIPT = Ci.nsIAboutModule.ALLOW_SCRIPT;
+const UNTRUSTED = Ci.nsIAboutModule.URI_SAFE_FOR_UNTRUSTED_CONTENT;
+const HIDE = Ci.nsIAboutModule.HIDE_FROM_ABOUTABOUT;
+const INDEXEDDB = Ci.nsIAboutModule.ENABLE_INDEXED_DB;
+
+function About() { }
+About.prototype = {
+ Flags: SCRIPT,
+ URI: "chrome://communicator/content/about.xhtml",
+ blockedFlags: SCRIPT | UNTRUSTED | HIDE,
+ blockedURI: "chrome://communicator/content/blockedSite.xhtml",
+ certerrorFlags: SCRIPT | UNTRUSTED | HIDE,
+ certerrorURI: "chrome://communicator/content/certError.xhtml",
+ dataFlags: SCRIPT,
+ dataURI: "chrome://communicator/content/dataman/dataman.xul",
+ feedsFlags: SCRIPT | UNTRUSTED | HIDE,
+ feedsURI: "chrome://communicator/content/feeds/subscribe.xhtml",
+ lifeFlags: SCRIPT | UNTRUSTED | HIDE,
+ lifeURI: "chrome://communicator/content/aboutLife.xhtml",
+ newserrorFlags: SCRIPT | HIDE,
+ newserrorURI: "chrome://messenger/content/newsError.xhtml",
+ privatebrowsingFlags: SCRIPT,
+ privatebrowsingURI: "chrome://communicator/content/aboutPrivateBrowsing.xul",
+ rightsFlags: SCRIPT | UNTRUSTED,
+ rightsURI: "chrome://branding/content/aboutRights.xhtml",
+ sessionrestoreFlags: SCRIPT | HIDE,
+ sessionrestoreURI: "chrome://communicator/content/aboutSessionRestore.xhtml",
+ // synctabsFlags: SCRIPT,
+ // synctabsURI: "chrome://communicator/content/aboutSyncTabs.xul",
+
+ classID: Components.ID("{d54f2c89-8fd6-4eeb-a7a4-51d4dcdf460f}"),
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule]),
+
+ getModule: function(aURI) {
+ return aURI.pathQueryRef.replace(/-|\W.*$/g, "").toLowerCase();
+ },
+
+ getURIFlags: function(aURI) {
+ return this[this.getModule(aURI) + "Flags"];
+ },
+
+ newChannel: function(aURI, aLoadInfo) {
+ let module = this.getModule(aURI);
+ let newURI = Services.io.newURI(this[module + "URI"]);
+
+ // We want a happy family which is always providing a loadInfo object.
+ if (!aLoadInfo) {
+ // Write out an error so that we have a stack and can fix the caller.
+ Cu.reportError('aLoadInfo was not provided in nsAbout.newChannel!');
+ }
+
+ let channel = aLoadInfo ?
+ Services.io.newChannelFromURIWithLoadInfo(newURI, aLoadInfo) :
+ Services.io.newChannelFromURI(newURI, null,
+ Services.scriptSecurityManager.getSystemPrincipal(),
+ null,
+ Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_SEC_CONTEXT_IS_NULL,
+ Ci.nsIContentPolicy.TYPE_OTHER);
+
+ channel.originalURI = aURI;
+ if (this[module + "Flags"] & UNTRUSTED) {
+ let principal = Services.scriptSecurityManager.createCodebasePrincipal(aURI, {});
+ channel.owner = principal;
+ }
+ return channel;
+ },
+};
+
+var NSGetFactory = XPCOMUtils.generateNSGetFactory([About]);