1
edit
Changes
Localized Search in Firefox Search Box: Release v.0 - Patch File: localsearchpatch_v01.txt
<b><font style="font-size:160%">Patch File: localsearchpatch_v01.txt</font></b>
<pre>
? localsearchpatch_v01.txt
? objdir-ff-debug
Index: browser/base/content/browser.js
===================================================================
RCS file: /cvsroot/mozilla/browser/base/content/browser.js,v
retrieving revision 1.953
diff -u -8 -p -r1.953 browser.js
--- browser/base/content/browser.js 30 Jan 2008 18:23:53 -0000 1.953
+++ browser/base/content/browser.js 1 Feb 2008 19:20:27 -0000
@@ -2794,16 +2794,17 @@ const BrowserSearch = {
engines.push({ uri: engine.href,
title: engine.title,
icon: iconURL });
if (hidden)
browser.hiddenEngines = engines;
else {
+ dump("DIAGNOSTIC MESSAGE: addEngine: function(engine, targetDoc) - Added a search engine plugin that was detected on web site.\n");
browser.engines = engines;
if (browser == gBrowser || browser == gBrowser.mCurrentBrowser)
this.updateSearchButton();
}
},
/**
* Update the browser UI to show whether or not additional engines are
Index: browser/components/search/nsSearchService.js
===================================================================
RCS file: /cvsroot/mozilla/browser/components/search/nsSearchService.js,v
retrieving revision 1.108
diff -u -8 -p -r1.108 nsSearchService.js
--- browser/components/search/nsSearchService.js 29 Jan 2008 19:39:20 -0000 1.108
+++ browser/components/search/nsSearchService.js 1 Feb 2008 19:20:30 -0000
@@ -2817,16 +2817,17 @@ SearchService.prototype = {
if (currentIndex == aNewIndex)
return; // nothing to do!
// Move the engine
var movedEngine = this._sortedEngines.splice(currentIndex, 1)[0];
this._sortedEngines.splice(aNewIndex, 0, movedEngine);
notifyAction(engine, SEARCH_ENGINE_CHANGED);
+ dump("DIAGNOSTIC MESSAGE: moveEngine: function SRCH_SVC_moveEngine(aEngine, aNewIndex) - MOVE search engine.\n");
// Since we moved an engine, we need to update the preferences.
this._needToSetOrderPrefs = true;
},
restoreDefaultEngines: function SRCH_SVC_resetDefaultEngines() {
for each (var e in this._engines) {
// Unhide all default engines
@@ -2837,16 +2838,17 @@ SearchService.prototype = {
get defaultEngine() {
const defPref = BROWSER_SEARCH_PREF + "defaultenginename";
// Get the default engine - this pref should always exist, but the engine
// might be hidden
this._defaultEngine = this.getEngineByName(getLocalizedPref(defPref, ""));
if (!this._defaultEngine || this._defaultEngine.hidden)
this._defaultEngine = this._getSortedEngines(false)[0] || null;
+ dump("DIAGNOSTIC MESSAGE: get defaultEngine() - GET Default search engine.\n");
return this._defaultEngine;
},
get currentEngine() {
if (!this._currentEngine || this._currentEngine.hidden)
this._currentEngine = this.defaultEngine;
return this._currentEngine;
},
@@ -2868,16 +2870,17 @@ SearchService.prototype = {
if (this._currentEngine == this.defaultEngine) {
if (prefB.prefHasUserValue(currentEnginePref))
prefB.clearUserPref(currentEnginePref);
}
else {
setLocalizedPref(currentEnginePref, this._currentEngine.name);
}
+ dump("DIAGNOSTIC MESSAGE: set currentEngine(val) - SET Current search engine.\n");
notifyAction(this._currentEngine, SEARCH_ENGINE_CURRENT);
},
// nsIObserver
observe: function SRCH_SVC_observe(aEngine, aTopic, aVerb) {
switch (aTopic) {
case SEARCH_ENGINE_TOPIC:
if (aVerb == SEARCH_ENGINE_LOADED) {
Index: browser/components/search/content/engineManager.js
===================================================================
RCS file: /cvsroot/mozilla/browser/components/search/content/engineManager.js,v
retrieving revision 1.18
diff -u -8 -p -r1.18 engineManager.js
--- browser/components/search/content/engineManager.js 26 Jul 2007 03:59:31 -0000 1.18
+++ browser/components/search/content/engineManager.js 1 Feb 2008 19:20:30 -0000
@@ -273,16 +273,18 @@ function EngineRemoveOp(aEngineClone) {
this._engine = aEngineClone.originalEngine;
}
EngineRemoveOp.prototype = {
_engine: null,
commit: function ERO_commit() {
var searchService = Cc["@mozilla.org/browser/search-service;1"].
getService(Ci.nsIBrowserSearchService);
searchService.removeEngine(this._engine);
+
+ dump("DIAGNOSTIC MESSAGE: commit: function ERO_commit() - User clicked OK to commit to search engine removal.\n");
}
}
function EngineUnhideOp(aEngineClone, aNewIndex) {
if (!aEngineClone)
throw new Error("bad args to new EngineUnhideOp!");
this._engine = aEngineClone.originalEngine;
this._newIndex = aNewIndex;
@@ -404,16 +406,18 @@ EngineStore.prototype = {
var index = this._getIndexForEngine(aEngine);
if (index == -1)
throw new Error("invalid engine?");
this._engines.splice(index, 1);
this._ops.push(new EngineRemoveOp(aEngine));
if (this._defaultEngines.some(this._isSameEngine, aEngine))
gEngineManagerDialog.showRestoreDefaults(true);
+
+ dump("DIAGNOSTIC MESSAGE: removeEngine: function ES_removeEngine(aEngine) - User selected an engine to \'Remove\' from Engine Manager list.\n");
},
restoreDefaultEngines: function ES_restoreDefaultEngines() {
var added = 0;
for (var i = 0; i < this._defaultEngines.length; ++i) {
var e = this._defaultEngines[i];
Index: browser/components/search/content/search.xml
===================================================================
RCS file: /cvsroot/mozilla/browser/components/search/content/search.xml,v
retrieving revision 1.119
diff -u -8 -p -r1.119 search.xml
--- browser/components/search/content/search.xml 29 Jan 2008 19:31:10 -0000 1.119
+++ browser/components/search/content/search.xml 1 Feb 2008 19:20:31 -0000
@@ -281,16 +281,18 @@
335102. -->
<!-- If the engine that was just removed from the searchbox list was
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[
+ dump("DIAGNOSTIC MESSAGE: offerNewEngine(aEngine) - Move auto-detected search engines to each browser's \'active\' list ");
+ dump("when they are removed from the search menu.\n");
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++) {
@@ -308,17 +310,19 @@
]]></body>
</method>
<!-- If the engine that was just added to the searchbox list was
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[
+ <body><![CDATA[
+ dump("DIAGNOSTIC MESSAGE: hideNewEngine(aEngine) - Move auto-detected search engines to each browser's \'hidden\' list.\n");
+
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++) {
@@ -404,16 +408,18 @@
menuitem = document.createElementNS(kXULNS, "menuitem");
menuitem.setAttribute("class", "menuitem-iconic addengine-item");
menuitem.setAttribute("label", labelStr);
menuitem.setAttribute("tooltiptext", engineInfo.uri);
menuitem.setAttribute("uri", engineInfo.uri);
if (engineInfo.icon)
menuitem.setAttribute("src", engineInfo.icon);
menuitem.setAttribute("title", engineInfo.title);
+
+ dump("DIAGNOSTIC MESSAGE: rebuildPopupDynamic() - Insert \'Add auto-detected engine\' to search engine menu.\n");
popup.insertBefore(menuitem, insertLocation);
}
}
]]></body>
</method>
<!-- Rebuilds the list of visible search engines in the menu. Does not remove
or update any dynamic entries (i.e., "Add this engine" items) nor the
</pre>
<pre>
? localsearchpatch_v01.txt
? objdir-ff-debug
Index: browser/base/content/browser.js
===================================================================
RCS file: /cvsroot/mozilla/browser/base/content/browser.js,v
retrieving revision 1.953
diff -u -8 -p -r1.953 browser.js
--- browser/base/content/browser.js 30 Jan 2008 18:23:53 -0000 1.953
+++ browser/base/content/browser.js 1 Feb 2008 19:20:27 -0000
@@ -2794,16 +2794,17 @@ const BrowserSearch = {
engines.push({ uri: engine.href,
title: engine.title,
icon: iconURL });
if (hidden)
browser.hiddenEngines = engines;
else {
+ dump("DIAGNOSTIC MESSAGE: addEngine: function(engine, targetDoc) - Added a search engine plugin that was detected on web site.\n");
browser.engines = engines;
if (browser == gBrowser || browser == gBrowser.mCurrentBrowser)
this.updateSearchButton();
}
},
/**
* Update the browser UI to show whether or not additional engines are
Index: browser/components/search/nsSearchService.js
===================================================================
RCS file: /cvsroot/mozilla/browser/components/search/nsSearchService.js,v
retrieving revision 1.108
diff -u -8 -p -r1.108 nsSearchService.js
--- browser/components/search/nsSearchService.js 29 Jan 2008 19:39:20 -0000 1.108
+++ browser/components/search/nsSearchService.js 1 Feb 2008 19:20:30 -0000
@@ -2817,16 +2817,17 @@ SearchService.prototype = {
if (currentIndex == aNewIndex)
return; // nothing to do!
// Move the engine
var movedEngine = this._sortedEngines.splice(currentIndex, 1)[0];
this._sortedEngines.splice(aNewIndex, 0, movedEngine);
notifyAction(engine, SEARCH_ENGINE_CHANGED);
+ dump("DIAGNOSTIC MESSAGE: moveEngine: function SRCH_SVC_moveEngine(aEngine, aNewIndex) - MOVE search engine.\n");
// Since we moved an engine, we need to update the preferences.
this._needToSetOrderPrefs = true;
},
restoreDefaultEngines: function SRCH_SVC_resetDefaultEngines() {
for each (var e in this._engines) {
// Unhide all default engines
@@ -2837,16 +2838,17 @@ SearchService.prototype = {
get defaultEngine() {
const defPref = BROWSER_SEARCH_PREF + "defaultenginename";
// Get the default engine - this pref should always exist, but the engine
// might be hidden
this._defaultEngine = this.getEngineByName(getLocalizedPref(defPref, ""));
if (!this._defaultEngine || this._defaultEngine.hidden)
this._defaultEngine = this._getSortedEngines(false)[0] || null;
+ dump("DIAGNOSTIC MESSAGE: get defaultEngine() - GET Default search engine.\n");
return this._defaultEngine;
},
get currentEngine() {
if (!this._currentEngine || this._currentEngine.hidden)
this._currentEngine = this.defaultEngine;
return this._currentEngine;
},
@@ -2868,16 +2870,17 @@ SearchService.prototype = {
if (this._currentEngine == this.defaultEngine) {
if (prefB.prefHasUserValue(currentEnginePref))
prefB.clearUserPref(currentEnginePref);
}
else {
setLocalizedPref(currentEnginePref, this._currentEngine.name);
}
+ dump("DIAGNOSTIC MESSAGE: set currentEngine(val) - SET Current search engine.\n");
notifyAction(this._currentEngine, SEARCH_ENGINE_CURRENT);
},
// nsIObserver
observe: function SRCH_SVC_observe(aEngine, aTopic, aVerb) {
switch (aTopic) {
case SEARCH_ENGINE_TOPIC:
if (aVerb == SEARCH_ENGINE_LOADED) {
Index: browser/components/search/content/engineManager.js
===================================================================
RCS file: /cvsroot/mozilla/browser/components/search/content/engineManager.js,v
retrieving revision 1.18
diff -u -8 -p -r1.18 engineManager.js
--- browser/components/search/content/engineManager.js 26 Jul 2007 03:59:31 -0000 1.18
+++ browser/components/search/content/engineManager.js 1 Feb 2008 19:20:30 -0000
@@ -273,16 +273,18 @@ function EngineRemoveOp(aEngineClone) {
this._engine = aEngineClone.originalEngine;
}
EngineRemoveOp.prototype = {
_engine: null,
commit: function ERO_commit() {
var searchService = Cc["@mozilla.org/browser/search-service;1"].
getService(Ci.nsIBrowserSearchService);
searchService.removeEngine(this._engine);
+
+ dump("DIAGNOSTIC MESSAGE: commit: function ERO_commit() - User clicked OK to commit to search engine removal.\n");
}
}
function EngineUnhideOp(aEngineClone, aNewIndex) {
if (!aEngineClone)
throw new Error("bad args to new EngineUnhideOp!");
this._engine = aEngineClone.originalEngine;
this._newIndex = aNewIndex;
@@ -404,16 +406,18 @@ EngineStore.prototype = {
var index = this._getIndexForEngine(aEngine);
if (index == -1)
throw new Error("invalid engine?");
this._engines.splice(index, 1);
this._ops.push(new EngineRemoveOp(aEngine));
if (this._defaultEngines.some(this._isSameEngine, aEngine))
gEngineManagerDialog.showRestoreDefaults(true);
+
+ dump("DIAGNOSTIC MESSAGE: removeEngine: function ES_removeEngine(aEngine) - User selected an engine to \'Remove\' from Engine Manager list.\n");
},
restoreDefaultEngines: function ES_restoreDefaultEngines() {
var added = 0;
for (var i = 0; i < this._defaultEngines.length; ++i) {
var e = this._defaultEngines[i];
Index: browser/components/search/content/search.xml
===================================================================
RCS file: /cvsroot/mozilla/browser/components/search/content/search.xml,v
retrieving revision 1.119
diff -u -8 -p -r1.119 search.xml
--- browser/components/search/content/search.xml 29 Jan 2008 19:31:10 -0000 1.119
+++ browser/components/search/content/search.xml 1 Feb 2008 19:20:31 -0000
@@ -281,16 +281,18 @@
335102. -->
<!-- If the engine that was just removed from the searchbox list was
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[
+ dump("DIAGNOSTIC MESSAGE: offerNewEngine(aEngine) - Move auto-detected search engines to each browser's \'active\' list ");
+ dump("when they are removed from the search menu.\n");
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++) {
@@ -308,17 +310,19 @@
]]></body>
</method>
<!-- If the engine that was just added to the searchbox list was
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[
+ <body><![CDATA[
+ dump("DIAGNOSTIC MESSAGE: hideNewEngine(aEngine) - Move auto-detected search engines to each browser's \'hidden\' list.\n");
+
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++) {
@@ -404,16 +408,18 @@
menuitem = document.createElementNS(kXULNS, "menuitem");
menuitem.setAttribute("class", "menuitem-iconic addengine-item");
menuitem.setAttribute("label", labelStr);
menuitem.setAttribute("tooltiptext", engineInfo.uri);
menuitem.setAttribute("uri", engineInfo.uri);
if (engineInfo.icon)
menuitem.setAttribute("src", engineInfo.icon);
menuitem.setAttribute("title", engineInfo.title);
+
+ dump("DIAGNOSTIC MESSAGE: rebuildPopupDynamic() - Insert \'Add auto-detected engine\' to search engine menu.\n");
popup.insertBefore(menuitem, insertLocation);
}
}
]]></body>
</method>
<!-- Rebuilds the list of visible search engines in the menu. Does not remove
or update any dynamic entries (i.e., "Add this engine" items) nor the
</pre>