AboutCompat.sys.mjs (1195B)
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/. */ 4 5 const addonID = "webcompat@mozilla.org"; 6 const addonPageRelativeURL = "/about-compat/aboutCompat.html"; 7 8 export function AboutCompat() { 9 this.chromeURL = 10 WebExtensionPolicy.getByID(addonID).getURL(addonPageRelativeURL); 11 } 12 13 AboutCompat.prototype = { 14 QueryInterface: ChromeUtils.generateQI(["nsIAboutModule"]), 15 getURIFlags() { 16 return ( 17 Ci.nsIAboutModule.URI_MUST_LOAD_IN_EXTENSION_PROCESS | 18 Ci.nsIAboutModule.IS_SECURE_CHROME_UI 19 ); 20 }, 21 22 newChannel(aURI, aLoadInfo) { 23 const uri = Services.io.newURI(this.chromeURL); 24 const channel = Services.io.newChannelFromURIWithLoadInfo(uri, aLoadInfo); 25 channel.originalURI = aURI; 26 27 channel.owner = ( 28 Services.scriptSecurityManager.createContentPrincipal || 29 // Handles fallback to earlier versions. 30 // eslint-disable-next-line mozilla/valid-services-property 31 Services.scriptSecurityManager.createCodebasePrincipal 32 )(uri, aLoadInfo.originAttributes); 33 return channel; 34 }, 35 };