Bug 1503551 - Make window.external.AddSearchProvider a dummy function, r=smaug

This commit is contained in:
Andrea Marchesini 2018-10-31 18:30:18 +01:00
Родитель 223d7172bf
Коммит 71b39f6750
5 изменённых файлов: 18 добавлений и 4 удалений

Просмотреть файл

@ -159,6 +159,10 @@ add_task(async function test_opensearch_disabled() {
}); });
add_task(async function test_AddSearchProvider() { add_task(async function test_AddSearchProvider() {
if (!Services.prefs.getBoolPref("dom.sidebar.enabled", false)) {
return;
}
// Mock the modal error dialog // Mock the modal error dialog
let mockPrompter = { let mockPrompter = {
promptCount: 0, promptCount: 0,

Просмотреть файл

@ -1,4 +1,5 @@
[DEFAULT] [DEFAULT]
prefs = dom.sidebar.enabled=true
support-files = support-files =
426329.xml 426329.xml
483086-1.xml 483086-1.xml

Просмотреть файл

@ -8,5 +8,5 @@
interface External interface External
{ {
void AddSearchProvider(DOMString aDescriptionURL); void AddSearchProvider(DOMString aDescriptionURL);
unsigned long IsSearchProviderInstalled(DOMString aSearchURL); void IsSearchProviderInstalled();
}; };

Просмотреть файл

@ -5956,3 +5956,9 @@ pref("dom.datatransfer.mozAtAPIs", true);
#ifdef MOZ_LIBPRIO #ifdef MOZ_LIBPRIO
pref("prio.enabled", false); pref("prio.enabled", false);
#endif #endif
#ifdef NIGHTLY_BUILD
pref("dom.sidebar.enabled", false);
#else
pref("dom.sidebar.enabled", true);
#endif

Просмотреть файл

@ -4,6 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
function nsSidebar() { function nsSidebar() {
} }
@ -18,6 +19,10 @@ nsSidebar.prototype = {
// The capitalization, although nonstandard here, is to match other browsers' // The capitalization, although nonstandard here, is to match other browsers'
// APIs and is therefore important. // APIs and is therefore important.
AddSearchProvider(engineURL) { AddSearchProvider(engineURL) {
if (!Services.prefs.getBoolPref("dom.sidebar.enabled", false)) {
return;
}
if (!this.mm) { if (!this.mm) {
Cu.reportError(`Installing a search provider from this context is not currently supported: ${Error().stack}.`); Cu.reportError(`Installing a search provider from this context is not currently supported: ${Error().stack}.`);
return; return;
@ -32,9 +37,7 @@ nsSidebar.prototype = {
// This function exists to implement window.external.IsSearchProviderInstalled(), // This function exists to implement window.external.IsSearchProviderInstalled(),
// for compatibility with other browsers. The function has been deprecated // for compatibility with other browsers. The function has been deprecated
// and so will not be implemented. // and so will not be implemented.
IsSearchProviderInstalled(engineURL) { IsSearchProviderInstalled() {},
return 0;
},
classID: Components.ID("{22117140-9c6e-11d3-aaf1-00805f8a4905}"), classID: Components.ID("{22117140-9c6e-11d3-aaf1-00805f8a4905}"),
QueryInterface: ChromeUtils.generateQI([Ci.nsIDOMGlobalPropertyInitializer]), QueryInterface: ChromeUtils.generateQI([Ci.nsIDOMGlobalPropertyInitializer]),