зеркало из https://github.com/mozilla/pjs.git
147068 patch by kd-moz@tprac.de r=shliang sr=jag Remove duplicate results appearing in sidebar search
This commit is contained in:
Родитель
ab99b2472a
Коммит
806825c68d
|
@ -33,32 +33,44 @@ function searchResultsOpenURL(event)
|
|||
}
|
||||
|
||||
|
||||
// Workaround for bug 196057 (double onload event): accept only the first onload event
|
||||
// ( This workaround will fix bug 147068 (duplicate search results).
|
||||
// Without this fix, xpfe\components\search\src\nsInternetSearchService.cpp will
|
||||
// crash when removing the same tree node twice. )
|
||||
// If bug 196057 should be fixed eventually, this workaround does no harm -
|
||||
// nevertheless it should be removed then
|
||||
var gbProcessOnloadEvent = true;
|
||||
|
||||
function onLoadInternetResults()
|
||||
{
|
||||
// clear any previous results on load
|
||||
var iSearch = Components.classes["@mozilla.org/rdf/datasource;1?name=internetsearch"]
|
||||
.getService(Components.interfaces.nsIInternetSearchService);
|
||||
iSearch.ClearResultSearchSites();
|
||||
if (gbProcessOnloadEvent)
|
||||
{ // forbid other onload events
|
||||
gbProcessOnloadEvent = false;
|
||||
|
||||
// the search URI is passed in as a parameter, so get it and them root the results list
|
||||
var searchURI = top._content.location.href;
|
||||
if (searchURI) {
|
||||
const lastSearchURIPref = "browser.search.lastMultipleSearchURI";
|
||||
var offset = searchURI.indexOf("?");
|
||||
if (offset > 0) {
|
||||
nsPreferences.setUnicharPref(lastSearchURIPref, searchURI); // evil
|
||||
searchURI = searchURI.substr(offset+1);
|
||||
loadResultsList(searchURI);
|
||||
}
|
||||
else {
|
||||
searchURI = nsPreferences.copyUnicharPref(lastSearchURIPref, "");
|
||||
offset = searchURI.indexOf("?");
|
||||
// clear any previous results on load
|
||||
var iSearch = Components.classes["@mozilla.org/rdf/datasource;1?name=internetsearch"]
|
||||
.getService(Components.interfaces.nsIInternetSearchService);
|
||||
iSearch.ClearResultSearchSites();
|
||||
|
||||
// the search URI is passed in as a parameter, so get it and them root the results list
|
||||
var searchURI = top._content.location.href;
|
||||
if (searchURI) {
|
||||
const lastSearchURIPref = "browser.search.lastMultipleSearchURI";
|
||||
var offset = searchURI.indexOf("?");
|
||||
if (offset > 0) {
|
||||
nsPreferences.setUnicharPref(lastSearchURIPref, searchURI); // evil
|
||||
searchURI = searchURI.substr(offset+1);
|
||||
loadResultsList(searchURI);
|
||||
}
|
||||
else {
|
||||
searchURI = nsPreferences.copyUnicharPref(lastSearchURIPref, "");
|
||||
offset = searchURI.indexOf("?");
|
||||
if (offset > 0) {
|
||||
nsPreferences.setUnicharPref(lastSearchURIPref, searchURI); // evil
|
||||
searchURI = searchURI.substr(offset+1);
|
||||
loadResultsList(searchURI);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
Загрузка…
Ссылка в новой задаче