зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset c35bab726b03 (bug 1493483) for multiple browser-chrome failures e.g browser_extension_controlled.js. CLOSED TREE
This commit is contained in:
Родитель
0b687a9b65
Коммит
523d3ae4fe
|
@ -3828,7 +3828,7 @@ const BrowserSearch = {
|
|||
if (Components.isSuccessCode(rv)) {
|
||||
// Delay the update for this until so that we don't change it while
|
||||
// the user is looking at it / isn't expecting it.
|
||||
this._updateURLBarPlaceholder(Services.search.defaultEngine, true);
|
||||
this._updateURLBarPlaceholder(Services.search.currentEngine, true);
|
||||
this._searchInitComplete = true;
|
||||
}
|
||||
});
|
||||
|
@ -4120,11 +4120,17 @@ const BrowserSearch = {
|
|||
* search was performed.
|
||||
*/
|
||||
_loadSearch(searchText, useNewTab, purpose, triggeringPrincipal) {
|
||||
let engine;
|
||||
if (!triggeringPrincipal) {
|
||||
throw new Error("Required argument triggeringPrincipal missing within _loadSearch");
|
||||
}
|
||||
|
||||
let engine = Services.search.defaultEngine;
|
||||
// If the search bar is visible, use the current engine, otherwise, fall
|
||||
// back to the default engine.
|
||||
if (isElementVisible(this.searchBar))
|
||||
engine = Services.search.currentEngine;
|
||||
else
|
||||
engine = Services.search.defaultEngine;
|
||||
|
||||
let submission = engine.getSubmission(searchText, null, purpose); // HTML response
|
||||
|
||||
|
|
|
@ -1506,7 +1506,7 @@ nsContextMenu.prototype = {
|
|||
}
|
||||
|
||||
// format "Search <engine> for <selection>" string to show in menu
|
||||
let engineName = Services.search.defaultEngine.name;
|
||||
let engineName = Services.search.currentEngine.name;
|
||||
var menuLabel = gNavigatorBundle.getFormattedString("contextMenuSearch",
|
||||
[engineName,
|
||||
selectedText]);
|
||||
|
|
|
@ -2475,7 +2475,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|||
this.input.urlbarSearchSuggestEnabled) {
|
||||
// Preconnect to the current search engine only if the search
|
||||
// suggestions are enabled.
|
||||
let engine = Services.search.defaultEngine;
|
||||
let engine = Services.search.currentEngine;
|
||||
engine.speculativeConnect({window,
|
||||
originAttributes: gBrowser.contentPrincipal.originAttributes});
|
||||
}
|
||||
|
|
|
@ -763,7 +763,7 @@ var Policies = {
|
|||
}
|
||||
if (defaultEngine) {
|
||||
try {
|
||||
Services.search.defaultEngine = defaultEngine;
|
||||
Services.search.currentEngine = defaultEngine;
|
||||
} catch (ex) {
|
||||
log.error("Unable to set the default search engine", ex);
|
||||
}
|
||||
|
|
|
@ -86,8 +86,8 @@ this.chrome_settings_overrides = class extends ExtensionAPI {
|
|||
if (!item) {
|
||||
return;
|
||||
}
|
||||
if (Services.search.defaultEngine.name != item.value &&
|
||||
Services.search.deafultEngine.name != item.initialValue) {
|
||||
if (Services.search.currentEngine.name != item.value &&
|
||||
Services.search.currentEngine.name != item.initialValue) {
|
||||
// The current engine is not the same as the value that the ExtensionSettingsStore has.
|
||||
// This means that the user changed the engine, so we shouldn't control it anymore.
|
||||
// Do nothing and remove our entry from the ExtensionSettingsStore.
|
||||
|
@ -99,7 +99,7 @@ this.chrome_settings_overrides = class extends ExtensionAPI {
|
|||
try {
|
||||
let engine = Services.search.getEngineByName(item.value || item.initialValue);
|
||||
if (engine) {
|
||||
Services.search.defaultEngine = engine;
|
||||
Services.search.currentEngine = engine;
|
||||
}
|
||||
} catch (e) {
|
||||
Cu.reportError(e);
|
||||
|
@ -217,7 +217,7 @@ this.chrome_settings_overrides = class extends ExtensionAPI {
|
|||
if (extension.startupReason === "ADDON_INSTALL") {
|
||||
// Don't ask if it already the current engine
|
||||
let engine = Services.search.getEngineByName(engineName);
|
||||
if (Services.search.defaultEngine != engine) {
|
||||
if (Services.search.currentEngine != engine) {
|
||||
let allow = await new Promise(resolve => {
|
||||
let subject = {
|
||||
wrappedJSObject: {
|
||||
|
@ -227,7 +227,7 @@ this.chrome_settings_overrides = class extends ExtensionAPI {
|
|||
browser: windowTracker.topWindow.gBrowser.selectedBrowser,
|
||||
name: this.extension.name,
|
||||
icon: this.extension.iconURL,
|
||||
currentEngine: Services.search.defaultEngine.name,
|
||||
currentEngine: Services.search.currentEngine.name,
|
||||
newEngine: engineName,
|
||||
resolve,
|
||||
},
|
||||
|
@ -256,9 +256,9 @@ this.chrome_settings_overrides = class extends ExtensionAPI {
|
|||
if (extension.startupReason === "ADDON_INSTALL") {
|
||||
let item = await ExtensionSettingsStore.addSetting(
|
||||
extension.id, DEFAULT_SEARCH_STORE_TYPE, DEFAULT_SEARCH_SETTING_NAME, engineName, () => {
|
||||
return Services.search.defaultEngine.name;
|
||||
return Services.search.currentEngine.name;
|
||||
});
|
||||
Services.search.defaultEngine = Services.search.getEngineByName(item.value);
|
||||
Services.search.currentEngine = Services.search.getEngineByName(item.value);
|
||||
} else if (extension.startupReason === "ADDON_ENABLE") {
|
||||
chrome_settings_overrides.processDefaultSearchSetting("enable", extension.id);
|
||||
}
|
||||
|
@ -272,7 +272,7 @@ this.chrome_settings_overrides = class extends ExtensionAPI {
|
|||
let engines = Services.search.getEnginesByExtensionID(extension.id);
|
||||
if (engines.length > 0) {
|
||||
// There can be only one engine right now
|
||||
isCurrent = Services.search.defaultEngine == engines[0];
|
||||
isCurrent = Services.search.currentEngine == engines[0];
|
||||
// Get position of engine and store it
|
||||
index = Services.search.getEngines().indexOf(engines[0]);
|
||||
Services.search.removeEngine(engines[0]);
|
||||
|
@ -289,7 +289,7 @@ this.chrome_settings_overrides = class extends ExtensionAPI {
|
|||
if (extension.startupReason === "ADDON_UPGRADE") {
|
||||
let engine = Services.search.getEngineByName(engines[0].name);
|
||||
if (isCurrent) {
|
||||
Services.search.defaultEngine = engine;
|
||||
Services.search.currentEngine = engine;
|
||||
}
|
||||
if (index != -1) {
|
||||
Services.search.moveEngine(engine, index);
|
||||
|
|
|
@ -53,7 +53,7 @@ this.search = class extends ExtensionAPI {
|
|||
|
||||
return {
|
||||
name: engine.name,
|
||||
isDefault: engine === Services.search.defaultEngine,
|
||||
isDefault: engine === Services.search.currentEngine,
|
||||
alias: engine.alias || undefined,
|
||||
favIconUrl,
|
||||
};
|
||||
|
@ -69,7 +69,7 @@ this.search = class extends ExtensionAPI {
|
|||
throw new ExtensionError(`${searchProperties.engine} was not found`);
|
||||
}
|
||||
} else {
|
||||
engine = Services.search.defaultEngine;
|
||||
engine = Services.search.currentEngine;
|
||||
}
|
||||
let submission = engine.getSubmission(searchProperties.query, null, "webextension");
|
||||
let options = {
|
||||
|
|
|
@ -53,7 +53,7 @@ const SEARCH_FILTERS = [
|
|||
];
|
||||
|
||||
function getShortURLForCurrentSearch() {
|
||||
const url = shortURL({url: Services.search.defaultEngine.searchForm});
|
||||
const url = shortURL({url: Services.search.currentEngine.searchForm});
|
||||
return url;
|
||||
}
|
||||
|
||||
|
|
|
@ -2317,7 +2317,7 @@ BrowserGlue.prototype = {
|
|||
}, SEARCH_SERVICE_TOPIC);
|
||||
});
|
||||
searchInitializedPromise.then(() => {
|
||||
let currentEngine = Services.search.defaultEngine.wrappedJSObject;
|
||||
let currentEngine = Services.search.currentEngine.wrappedJSObject;
|
||||
// Only reset the current engine if it wasn't set by a WebExtension
|
||||
// and it is not one of the default engines.
|
||||
// If the original default is not a default, the user has a weird
|
||||
|
|
|
@ -149,7 +149,7 @@ var gSearchPane = {
|
|||
// This is called each time something affects the list of engines.
|
||||
let list = document.getElementById("defaultEngine");
|
||||
// Set selection to the current default engine.
|
||||
let currentEngine = Services.search.defaultEngine.name;
|
||||
let currentEngine = Services.search.currentEngine.name;
|
||||
|
||||
// If the current engine isn't in the list any more, select the first item.
|
||||
let engines = gEngineView._engineStore._engines;
|
||||
|
@ -391,7 +391,7 @@ var gSearchPane = {
|
|||
},
|
||||
|
||||
setDefaultEngine() {
|
||||
Services.search.defaultEngine =
|
||||
Services.search.currentEngine =
|
||||
document.getElementById("defaultEngine").selectedItem.engine;
|
||||
ExtensionSettingsStore.setByUser(SEARCH_TYPE, SEARCH_KEY);
|
||||
},
|
||||
|
|
|
@ -479,7 +479,7 @@
|
|||
|
||||
<method name="updateHeader">
|
||||
<body><![CDATA[
|
||||
let currentEngine = Services.search.defaultEngine;
|
||||
let currentEngine = Services.search.currentEngine;
|
||||
let uri = currentEngine.iconURI;
|
||||
if (uri) {
|
||||
this.setAttribute("src", uri.spec);
|
||||
|
@ -935,7 +935,7 @@
|
|||
return this._engines;
|
||||
let currentEngineNameToIgnore;
|
||||
if (!this.getAttribute("includecurrentengine"))
|
||||
currentEngineNameToIgnore = Services.search.defaultEngine.name;
|
||||
currentEngineNameToIgnore = Services.search.currentEngine.name;
|
||||
|
||||
let pref = Services.prefs.getStringPref("browser.search.hiddenOneOffs");
|
||||
let hiddenList = pref ? pref.split(",") : [];
|
||||
|
@ -990,7 +990,7 @@
|
|||
let engines = this.engines;
|
||||
let oneOffCount = engines.length;
|
||||
let collapsed = !oneOffCount ||
|
||||
(oneOffCount == 1 && engines[0].name == Services.search.defaultEngine.name);
|
||||
(oneOffCount == 1 && engines[0].name == Services.search.currentEngine.name);
|
||||
|
||||
// header is a xul:deck so collapsed doesn't work on it, see bug 589569.
|
||||
this.header.hidden = this.buttons.collapsed = collapsed;
|
||||
|
@ -1801,7 +1801,7 @@
|
|||
this.handleSearchCommand(event, this._contextEngine, true);
|
||||
}
|
||||
if (anonid == "search-one-offs-context-set-default") {
|
||||
let currentEngine = Services.search.defaultEngine;
|
||||
let currentEngine = Services.search.currentEngine;
|
||||
|
||||
if (!this.getAttribute("includecurrentengine")) {
|
||||
// Make the target button of the context menu reflect the current
|
||||
|
@ -1817,7 +1817,7 @@
|
|||
button.engine = currentEngine;
|
||||
}
|
||||
|
||||
Services.search.defaultEngine = this._contextEngine;
|
||||
Services.search.currentEngine = this._contextEngine;
|
||||
}
|
||||
]]></handler>
|
||||
|
||||
|
@ -1830,7 +1830,7 @@
|
|||
return;
|
||||
}
|
||||
document.getAnonymousElementByAttribute(this, "anonid", "search-one-offs-context-set-default")
|
||||
.setAttribute("disabled", target.engine == Services.search.defaultEngine);
|
||||
.setAttribute("disabled", target.engine == Services.search.currentEngine);
|
||||
|
||||
this._contextEngine = target.engine;
|
||||
]]></handler>
|
||||
|
|
|
@ -41,7 +41,7 @@ function doSearch() {
|
|||
}
|
||||
}
|
||||
|
||||
let engine = Services.search.defaultEngine;
|
||||
let engine = Services.search.currentEngine;
|
||||
let submission = engine.getSubmission(queryString, null, purpose);
|
||||
|
||||
window.removeEventListener("unload", recordPageClosed);
|
||||
|
@ -70,10 +70,10 @@ function record(result) {
|
|||
}
|
||||
|
||||
function keepCurrentEngine() {
|
||||
// Calling the defaultEngine setter will force a correct loadPathHash to be
|
||||
// Calling the currentEngine setter will force a correct loadPathHash to be
|
||||
// written for this engine, so that we don't prompt the user again.
|
||||
// eslint-disable-next-line no-self-assign
|
||||
Services.search.defaultEngine = Services.search.defaultEngine;
|
||||
Services.search.currentEngine = Services.search.currentEngine;
|
||||
record(TELEMETRY_RESULT_ENUM.KEPT_CURRENT);
|
||||
savePref("declined");
|
||||
doSearch();
|
||||
|
@ -83,7 +83,7 @@ function changeSearchEngine() {
|
|||
let engine = Services.search.originalDefaultEngine;
|
||||
if (engine.hidden)
|
||||
engine.hidden = false;
|
||||
Services.search.defaultEngine = engine;
|
||||
Services.search.currentEngine = engine;
|
||||
|
||||
record(TELEMETRY_RESULT_ENUM.RESTORED_DEFAULT);
|
||||
savePref("accepted");
|
||||
|
|
|
@ -158,12 +158,12 @@ class MozSearchbar extends MozXULElement {
|
|||
}
|
||||
|
||||
set currentEngine(val) {
|
||||
Services.search.defaultEngine = val;
|
||||
Services.search.currentEngine = val;
|
||||
return val;
|
||||
}
|
||||
|
||||
get currentEngine() {
|
||||
var currentEngine = Services.search.defaultEngine;
|
||||
var currentEngine = Services.search.currentEngine;
|
||||
// Return a dummy engine if there is no currentEngine
|
||||
return currentEngine || { name: "", uri: null };
|
||||
}
|
||||
|
|
|
@ -334,7 +334,7 @@ var ContentSearch = {
|
|||
currentEngine: await this._currentEngineObj(),
|
||||
};
|
||||
if (uriFlag) {
|
||||
state.currentEngine.iconBuffer = Services.search.defaultEngine.getIconURLBySize(16, 16);
|
||||
state.currentEngine.iconBuffer = Services.search.currentEngine.getIconURLBySize(16, 16);
|
||||
}
|
||||
let pref = Services.prefs.getCharPref("browser.search.hiddenOneOffs");
|
||||
let hiddenList = pref ? pref.split(",") : [];
|
||||
|
@ -420,7 +420,7 @@ var ContentSearch = {
|
|||
},
|
||||
|
||||
_onMessageSetCurrentEngine(msg, data) {
|
||||
Services.search.defaultEngine = Services.search.getEngineByName(data);
|
||||
Services.search.currentEngine = Services.search.getEngineByName(data);
|
||||
},
|
||||
|
||||
_onMessageManageEngines(msg) {
|
||||
|
@ -510,7 +510,7 @@ var ContentSearch = {
|
|||
},
|
||||
|
||||
async _currentEngineObj() {
|
||||
let engine = Services.search.defaultEngine;
|
||||
let engine = Services.search.currentEngine;
|
||||
let favicon = engine.getIconURLBySize(16, 16);
|
||||
let placeholder = this._stringBundle.formatStringFromName(
|
||||
"searchWithEngine", [engine.name], 1);
|
||||
|
|
|
@ -72,7 +72,7 @@ const SearchAutocompleteProviderInternal = {
|
|||
this.aliasMatches = [];
|
||||
this.defaultMatch = null;
|
||||
|
||||
let currentEngine = Services.search.defaultEngine;
|
||||
let currentEngine = Services.search.currentEngine;
|
||||
// This can be null in XCPShell.
|
||||
if (currentEngine) {
|
||||
this.defaultMatch = {
|
||||
|
@ -119,7 +119,7 @@ const SearchAutocompleteProviderInternal = {
|
|||
|
||||
getSuggestionController(searchToken, inPrivateContext, maxLocalResults,
|
||||
maxRemoteResults, userContextId) {
|
||||
let engine = Services.search.defaultEngine;
|
||||
let engine = Services.search.currentEngine;
|
||||
if (!engine) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -2416,7 +2416,7 @@ Engine.prototype = {
|
|||
if (aResponseType == URLTYPE_SEARCH_HTML &&
|
||||
((resetPending = resetStatus == "pending") ||
|
||||
resetEnabled) &&
|
||||
this.name == Services.search.defaultEngine.name &&
|
||||
this.name == Services.search.currentEngine.name &&
|
||||
!this._isDefault &&
|
||||
this.name != Services.search.originalDefaultEngine.name &&
|
||||
(resetPending || !this.getAttr("loadPathHash") ||
|
||||
|
|
|
@ -151,7 +151,7 @@ SuggestAutoComplete.prototype = {
|
|||
this._listener = listener;
|
||||
this._suggestionController.fetch(searchString,
|
||||
privacyMode,
|
||||
Services.search.defaultEngine);
|
||||
Services.search.currentEngine);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче