Files
palemoon27/toolkit/components/processsingleton/MainProcessSingleton.js
roytam1 20c74da2f3 import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1155923 - Removing moz prefix from RTC interfaces, r=jesup,smaug (db1bd2fe68)
- Bug 1155923 - Temporarily restoring moz-prefixed interface, r=jesup,smaug (e1e9ecd7eb)
- Bug 1203167 - stop serializing user-installed engines to XML files, r=adw. (e1f85fcf16)
- Bug 1178453 - Change logging in storage-json.js to avoid string concatenation. r=MattN (06f78f0f57)
- No bug - Password manager: Modernize the style of storage-json.js. (42fb046b66)
- Bug 1166961 - Show click to play button on Fennec when autoplay is blocked. r=mfinkle (322b8670f1)
- Bug 1217082 - Remove for-each from toolkit/. r=Gijs (b98cb95f9b)
- Bug 1203167 - Keep user-installed engines when refreshing an outdated cache, r=adw. (c2c74e49cb)
- Bug 1124605 - Execute dragStateChanged(false) before the element is hidden. r=jaws (056b585257)
- bit of  Bug 1141661 - No need to manually convert this URI anymore. r=mossop (a22910d350)
- Bug 862148 - stop parsing Sherlock plugins, r=adw. (4e75933ad5)
- Bug 862148 - remove the _parseAsOpenSearch method, r=adw. (bf6266c9de)
- Bug 1197763 - Remove preprocessing from browser/components/search/. r=Gijs (e730e73cbb)
- Bug 1113561 - display more than two of previous search in the suggestions pane of about:home, r=florian. (6f1a2d4ba3)
- Bug 1066645 - [e10s] Fix isWindowPrivate call in about:home search (r=ttaubert) (7c61a86bdb)
- Bug 1083167 - Fix FormHistory error in ContentSearch by not passing an empty string to FormHistory.update. r=MattN (83e04f31d7)
- Bug 1032243 - about:newtab should use native Promise implementation r=adw (c2146c25ba)
- Bug 1042214 - Send detailed view ping of shown tiles [r=adw f=gavin] (8f88628f71)
- Bug 1137234 - Make middle clicks on search suggestions on about:home, about:newtab open search results in a background tab. r=adw (8a225392d5)
- Bug 1166465 - about:home and about:newtab search suggestions should use openUILink. r=adw (5e1ba41d3e)
- Bug 1182026 - Fix in-tree documentation for TLS Error Reports (r=?) (d2d43683b4)
- Bug 1221716 - Part 1: Make the simpler parts of BytecodeEmitter::emitTree() use the `ok` boolean consistently. r=Waldo. (8b2eae4dcf)
- Bug 1221716 - Part 2: Factor out all remaining complex cases from the switch statement in emitTree(). r=Waldo. (805c9a96da)
- Bug 1221737 - Drop some BytecodeEmitter checks for cases that the Parser rules out. r=jonco. (9726a6527b)
- Bug 1224460 - Use pwd -W to fill _topsrcdir in configure. r=gps (cc7bf71652)
- Bug 1221737 followup - Bump XDR_BYTECODE_VERSION_SUBTRAHEND to fix build errors on a CLOSED TREE. r=bustage (d2d2f41a14)
- Bug 1170913, full-update target in tools/update-packaging/ always runs automation-partial-patch, r=glandium DONTBUILD (12e5e212d8)
- Bug 1137756 - Use absolute paths in complete-patch.patch. r=gps (62fc37688b)
- Bug 1173998 - use localized package for previous mar; r=nthomas (fb6c95955c)
- Bug 1173459 - Stop generating partial MAR files and publishing complete MARs to balrog as a part of nightly automation. r=mshal (4c427b9f7f)
- Bug 1164580 - Preprocess ua-update.json via slashslash filter. r=fabrice (d934f84f15)
- Bug 1200021 - Part 2: more diagnostics. r=bas (e1cfecbbd4)
- Bug 1200021 - crash in mozilla::layers::ContentClientDoubleBuffered::FinalizeFrame(nsIntRegion const&): Diagnostics to get more data. r=bas (d782b24501)
- Bug 1222569 - fix initialization order in DataTextureSourceD3D9; r=Bas (028939600b)
- Bug 1209801 - Part 1: Add TextureFlags parameter to TextureClientPool. r=mattwoodrow (c5b73613f9)
- Bug 1209801 - Part 2: Do not allow big image textures to be used with TiledLayerBuffers. r=mattwoodrow (cb553ccdea)
- Bug 1211615: Upload the full texture on the first upload for component alpha textures. r=nical (3bd6688679)
- minor (928a95b259)
- Bug 1222569 - remove unused variable in TextureD3D9.cpp; r=Bas (ac5a86be1c)
- Bug 1223928 - Make the horizontal scrollbar on the root scrollable shift correctly with the dynamic toolbar. r=botond (6c6c0b8c24)
- Bug 1216349: Upload the old valid region as well if our texture host changed. r=nical (7d4d041bd2)
- Bug 1236227, don't OOM in TextDecoder, r=baku (9bef90eada)
- Bug 1218594 - r=smaug (de39570c72)
- remove include (62e582fe3d)
- Bug 1226176 - Compute retained sizes in dominator trees and expose them to JavaScript; r=bz,sfink (92bb08a674)
2023-01-27 10:34:48 +08:00

91 lines
3.5 KiB
JavaScript

/* 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/. */
"use strict";
const { utils: Cu, interfaces: Ci, classes: Cc, results: Cr } = Components;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
"resource://gre/modules/NetUtil.jsm");
function MainProcessSingleton() {}
MainProcessSingleton.prototype = {
classID: Components.ID("{0636a680-45cb-11e4-916c-0800200c9a66}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
Ci.nsISupportsWeakReference]),
logConsoleMessage: function(message) {
let logMsg = message.data;
logMsg.wrappedJSObject = logMsg;
Services.obs.notifyObservers(logMsg, "console-api-log-event", null);
},
// Called when a webpage calls window.external.AddSearchProvider
addSearchEngine: function({ target: browser, data: { pageURL, engineURL } }) {
pageURL = NetUtil.newURI(pageURL);
engineURL = NetUtil.newURI(engineURL, null, pageURL);
let iconURL;
let tabbrowser = browser.getTabBrowser();
if (browser.mIconURL && (!tabbrowser || tabbrowser.shouldLoadFavIcon(pageURL)))
iconURL = NetUtil.newURI(browser.mIconURL);
try {
// Make sure the URLs are HTTP, HTTPS, or FTP.
let isWeb = ["https", "http", "ftp"];
if (isWeb.indexOf(engineURL.scheme) < 0)
throw "Unsupported search engine URL: " + engineURL;
if (iconURL && isWeb.indexOf(iconURL.scheme) < 0)
throw "Unsupported search icon URL: " + iconURL;
}
catch(ex) {
Cu.reportError("Invalid argument passed to window.external.AddSearchProvider: " + ex);
var searchBundle = Services.strings.createBundle("chrome://global/locale/search/search.properties");
var brandBundle = Services.strings.createBundle("chrome://branding/locale/brand.properties");
var brandName = brandBundle.GetStringFromName("brandShortName");
var title = searchBundle.GetStringFromName("error_invalid_engine_title");
var msg = searchBundle.formatStringFromName("error_invalid_engine_msg",
[brandName], 1);
Services.ww.getNewPrompter(browser.ownerDocument.defaultView).alert(title, msg);
return;
}
Services.search.init(function(status) {
if (status != Cr.NS_OK)
return;
Services.search.addEngine(engineURL.spec, null, iconURL ? iconURL.spec : null, true);
})
},
observe: function(subject, topic, data) {
switch (topic) {
case "app-startup": {
Services.obs.addObserver(this, "xpcom-shutdown", false);
// Load this script early so that console.* is initialized
// before other frame scripts.
Services.mm.loadFrameScript("chrome://global/content/browser-content.js", true);
Services.ppmm.loadProcessScript("chrome://global/content/process-content.js", true);
Services.ppmm.addMessageListener("Console:Log", this.logConsoleMessage);
Services.mm.addMessageListener("Search:AddEngine", this.addSearchEngine);
break;
}
case "xpcom-shutdown":
Services.ppmm.removeMessageListener("Console:Log", this.logConsoleMessage);
Services.mm.removeMessageListener("Search:AddEngine", this.addSearchEngine);
break;
}
},
};
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([MainProcessSingleton]);