Bug 347950: Adding or removing a search engine doesn't update other tabs' menus. r=gavin (on irc), ben

This commit is contained in:
pamg.bugs%gmail.com 2006-08-10 21:05:44 +00:00
Родитель a835545ae8
Коммит 8fd4afa0be
1 изменённых файлов: 35 добавлений и 29 удалений

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

@ -228,52 +228,58 @@
335102. -->
<!-- If the engine that was just removed from the searchbox list was
autodetected on this page, move it to the browser's active list so it will
be offered to be added again. -->
autodetected on this page, move it to each browser's active list so it
will be offered to be added again. -->
<method name="offerNewEngine">
<parameter name="aEngine"/>
<body><![CDATA[
var browser = getBrowser().mCurrentBrowser;
if (browser.hiddenEngines) {
// XXX This will need to be changed when engines are identified by
// URL rather than title; see bug 335102.
var removeTitle = aEngine.wrappedJSObject.name;
for (var i = 0; i < browser.hiddenEngines.length; i++) {
if (browser.hiddenEngines[i].title == removeTitle) {
if (!browser.engines)
browser.engines = [];
browser.engines.push(browser.hiddenEngines[i]);
browser.hiddenEngines.splice(i, 1);
BrowserSearch.updateSearchButton();
break;
var allbrowsers = getBrowser().mPanelContainer.childNodes;
for (var tab = 0; tab < allbrowsers.length; tab++) {
var browser = getBrowser().getBrowserAtIndex(tab);
if (browser.hiddenEngines) {
// XXX This will need to be changed when engines are identified by
// URL rather than title; see bug 335102.
var removeTitle = aEngine.wrappedJSObject.name;
for (var i = 0; i < browser.hiddenEngines.length; i++) {
if (browser.hiddenEngines[i].title == removeTitle) {
if (!browser.engines)
browser.engines = [];
browser.engines.push(browser.hiddenEngines[i]);
browser.hiddenEngines.splice(i, 1);
break;
}
}
}
}
BrowserSearch.updateSearchButton();
]]></body>
</method>
<!-- If the engine that was just added to the searchbox list was
autodetected on this page, move it to the browser's hidden list so it is
autodetected on this page, move it to each browser's hidden list so it is
no longer offered to be added. -->
<method name="hideNewEngine">
<parameter name="aEngine"/>
<body><![CDATA[
var browser = getBrowser().mCurrentBrowser;
if (browser.engines) {
// XXX This will need to be changed when engines are identified by
// URL rather than title; see bug 335102.
var removeTitle = aEngine.wrappedJSObject.name;
for (var i = 0; i < browser.engines.length; i++) {
if (browser.engines[i].title == removeTitle) {
if (!browser.hiddenEngines)
browser.hiddenEngines = [];
browser.hiddenEngines.push(browser.engines[i]);
browser.engines.splice(i, 1);
BrowserSearch.updateSearchButton();
break;
var allbrowsers = getBrowser().mPanelContainer.childNodes;
for (var tab = 0; tab < allbrowsers.length; tab++) {
var browser = getBrowser().getBrowserAtIndex(tab);
if (browser.engines) {
// XXX This will need to be changed when engines are identified by
// URL rather than title; see bug 335102.
var removeTitle = aEngine.wrappedJSObject.name;
for (var i = 0; i < browser.engines.length; i++) {
if (browser.engines[i].title == removeTitle) {
if (!browser.hiddenEngines)
browser.hiddenEngines = [];
browser.hiddenEngines.push(browser.engines[i]);
browser.engines.splice(i, 1);
break;
}
}
}
}
BrowserSearch.updateSearchButton();
]]></body>
</method>