mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 21:05:36 +00:00
Backed out changeset 6fe388a0fb5e (Bug 581076) due to test failures. a=bustage
--HG-- extra : rebase_source : f726613cbce0938d25fd58a9547a5a25d15c1433
This commit is contained in:
parent
a6cf519b9f
commit
d7ea82d234
@ -56,12 +56,13 @@ pref("browser.hiddenWindowChromeURL", "chrome://browser/content/hiddenWindow.xul
|
|||||||
// Enables some extra Extension System Logging (can reduce performance)
|
// Enables some extra Extension System Logging (can reduce performance)
|
||||||
pref("extensions.logging.enabled", false);
|
pref("extensions.logging.enabled", false);
|
||||||
|
|
||||||
// Preferences for AMO integration
|
// Preferences for the Addon Repository
|
||||||
pref("extensions.getAddons.cache.enabled", true);
|
pref("extensions.getAddons.cache.enabled", true);
|
||||||
pref("extensions.getAddons.maxResults", 15);
|
pref("extensions.getAddons.maxResults", 15);
|
||||||
pref("extensions.getAddons.get.url", "https://services.addons.mozilla.org/%LOCALE%/%APP%/api/%API_VERSION%/search/guid:%IDS%");
|
pref("extensions.getAddons.get.url", "https://services.addons.mozilla.org/%LOCALE%/%APP%/api/%API_VERSION%/search/guid:%IDS%");
|
||||||
pref("extensions.getAddons.search.browseURL", "https://addons.mozilla.org/%LOCALE%/%APP%/search?q=%TERMS%");
|
|
||||||
pref("extensions.getAddons.search.url", "https://services.addons.mozilla.org/%LOCALE%/%APP%/api/%API_VERSION%/search/%TERMS%/all/%MAX_RESULTS%/%OS%/%VERSION%");
|
pref("extensions.getAddons.search.url", "https://services.addons.mozilla.org/%LOCALE%/%APP%/api/%API_VERSION%/search/%TERMS%/all/%MAX_RESULTS%/%OS%/%VERSION%");
|
||||||
|
|
||||||
|
// Preferences for AMO integration
|
||||||
pref("extensions.webservice.discoverURL", "https://services.addons.mozilla.org/%LOCALE%/%APP%/discovery/%VERSION%/%OS%");
|
pref("extensions.webservice.discoverURL", "https://services.addons.mozilla.org/%LOCALE%/%APP%/discovery/%VERSION%/%OS%");
|
||||||
|
|
||||||
// Blocklist preferences
|
// Blocklist preferences
|
||||||
|
@ -59,6 +59,3 @@ enableAddonTooltip=Enable this add-on
|
|||||||
enableAddonRestartRequiredTooltip=Enable this add-on (restart required)
|
enableAddonRestartRequiredTooltip=Enable this add-on (restart required)
|
||||||
disableAddonTooltip=Disable this add-on
|
disableAddonTooltip=Disable this add-on
|
||||||
disableAddonRestartRequiredTooltip=Disable this add-on (restart required)
|
disableAddonRestartRequiredTooltip=Disable this add-on (restart required)
|
||||||
|
|
||||||
#LOCALIZATION NOTE (showAllSearchResults) #1 is the total number of search results
|
|
||||||
showAllSearchResults=See all #1 result;See all #1 results
|
|
||||||
|
@ -100,8 +100,7 @@ xhtml|link {
|
|||||||
.addon[active="true"] .disabled-postfix,
|
.addon[active="true"] .disabled-postfix,
|
||||||
.addon[pending="install"] .update-postfix,
|
.addon[pending="install"] .update-postfix,
|
||||||
.addon[pending="install"] .disabled-postfix,
|
.addon[pending="install"] .disabled-postfix,
|
||||||
#detail-view[loading] > .detail-view-container,
|
#detail-view[loading] > .detail-view-container {
|
||||||
#search-list[remote="false"] #search-allresults-link {
|
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1150,9 +1150,7 @@ var gSearchView = {
|
|||||||
_sorters: null,
|
_sorters: null,
|
||||||
_listBox: null,
|
_listBox: null,
|
||||||
_emptyNotice: null,
|
_emptyNotice: null,
|
||||||
_allResultsLink: null,
|
|
||||||
_lastQuery: null,
|
_lastQuery: null,
|
||||||
_lastRemoteTotal: 0,
|
|
||||||
_pendingSearches: 0,
|
_pendingSearches: 0,
|
||||||
|
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
@ -1162,7 +1160,6 @@ var gSearchView = {
|
|||||||
this._sorters.handler = this;
|
this._sorters.handler = this;
|
||||||
this._listBox = document.getElementById("search-list");
|
this._listBox = document.getElementById("search-list");
|
||||||
this._emptyNotice = document.getElementById("search-list-empty");
|
this._emptyNotice = document.getElementById("search-list-empty");
|
||||||
this._allResultsLink = document.getElementById("search-allresults-link");
|
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
this._listBox.addEventListener("keydown", function(aEvent) {
|
this._listBox.addEventListener("keydown", function(aEvent) {
|
||||||
@ -1189,7 +1186,6 @@ var gSearchView = {
|
|||||||
show: function(aQuery, aRequest) {
|
show: function(aQuery, aRequest) {
|
||||||
gHeader.isSearching = true;
|
gHeader.isSearching = true;
|
||||||
this.showEmptyNotice(false);
|
this.showEmptyNotice(false);
|
||||||
this.showAllResultsLink(0);
|
|
||||||
|
|
||||||
gHeader.searchQuery = aQuery;
|
gHeader.searchQuery = aQuery;
|
||||||
aQuery = aQuery.trim().toLocaleLowerCase();
|
aQuery = aQuery.trim().toLocaleLowerCase();
|
||||||
@ -1203,8 +1199,8 @@ var gSearchView = {
|
|||||||
if (AddonRepository.isSearching)
|
if (AddonRepository.isSearching)
|
||||||
AddonRepository.cancelSearch();
|
AddonRepository.cancelSearch();
|
||||||
|
|
||||||
while (this._listBox.firstChild.localName == "richlistitem")
|
while (this._listBox.lastChild.localName == "richlistitem")
|
||||||
this._listBox.removeChild(this._listBox.firstChild);
|
this._listBox.removeChild(this._listBox.lastChild);
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
gCachedAddons = {};
|
gCachedAddons = {};
|
||||||
@ -1226,7 +1222,7 @@ var gSearchView = {
|
|||||||
if (aIsRemote)
|
if (aIsRemote)
|
||||||
gCachedAddons[aObj.id] = aObj;
|
gCachedAddons[aObj.id] = aObj;
|
||||||
|
|
||||||
self._listBox.insertBefore(item, self._listBox.lastChild);
|
self._listBox.appendChild(item);
|
||||||
createdCount++;
|
createdCount++;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1268,8 +1264,6 @@ var gSearchView = {
|
|||||||
if (gViewController && aRequest != gViewController.currentViewRequest)
|
if (gViewController && aRequest != gViewController.currentViewRequest)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
self._lastRemoteTotal = 0;
|
|
||||||
|
|
||||||
// XXXunf Better handling of AMO search failure. See bug 579502
|
// XXXunf Better handling of AMO search failure. See bug 579502
|
||||||
finishSearch(0); // Silently fail
|
finishSearch(0); // Silently fail
|
||||||
},
|
},
|
||||||
@ -1278,11 +1272,6 @@ var gSearchView = {
|
|||||||
if (gViewController && aRequest != gViewController.currentViewRequest)
|
if (gViewController && aRequest != gViewController.currentViewRequest)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (aTotalResults > maxRemoteResults)
|
|
||||||
self._lastRemoteTotal = aTotalResults;
|
|
||||||
else
|
|
||||||
self._lastRemoteTotal = 0;
|
|
||||||
|
|
||||||
var createdCount = createSearchResults(aAddonsList, false, true);
|
var createdCount = createSearchResults(aAddonsList, false, true);
|
||||||
finishSearch(createdCount);
|
finishSearch(createdCount);
|
||||||
}
|
}
|
||||||
@ -1307,7 +1296,6 @@ var gSearchView = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.showEmptyNotice(isEmpty);
|
this.showEmptyNotice(isEmpty);
|
||||||
this.showAllResultsLink(this._lastRemoteTotal);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gViewController.updateCommands();
|
gViewController.updateCommands();
|
||||||
@ -1368,24 +1356,9 @@ var gSearchView = {
|
|||||||
this._emptyNotice.hidden = !aShow;
|
this._emptyNotice.hidden = !aShow;
|
||||||
},
|
},
|
||||||
|
|
||||||
showAllResultsLink: function(aTotalResults) {
|
|
||||||
if (aTotalResults == 0) {
|
|
||||||
this._allResultsLink.hidden = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var linkStr = gStrings.ext.GetStringFromName("showAllSearchResults");
|
|
||||||
linkStr = PluralForm.get(aTotalResults, linkStr);
|
|
||||||
linkStr = linkStr.replace("#1", aTotalResults);
|
|
||||||
this._allResultsLink.value = linkStr;
|
|
||||||
|
|
||||||
this._allResultsLink.href = AddonRepository.getSearchURL(this._lastQuery);
|
|
||||||
this._allResultsLink.hidden = false;
|
|
||||||
},
|
|
||||||
|
|
||||||
onSortChanged: function(aSortBy, aAscending) {
|
onSortChanged: function(aSortBy, aAscending) {
|
||||||
var footer = this._listBox.lastChild;
|
var header = this._listBox.firstChild;
|
||||||
this._listBox.removeChild(footer);
|
this._listBox.removeChild(header);
|
||||||
|
|
||||||
var hints = aAscending ? "ascending" : "descending";
|
var hints = aAscending ? "ascending" : "descending";
|
||||||
if (INTEGER_FIELDS.indexOf(aSortBy) >= 0)
|
if (INTEGER_FIELDS.indexOf(aSortBy) >= 0)
|
||||||
@ -1395,7 +1368,7 @@ var gSearchView = {
|
|||||||
getService(Ci.nsIXULSortService);
|
getService(Ci.nsIXULSortService);
|
||||||
sortService.sort(this._listBox, aSortBy, hints);
|
sortService.sort(this._listBox, aSortBy, hints);
|
||||||
|
|
||||||
this._listBox.appendChild(footer);
|
this._listBox.insertBefore(header, this._listBox.firstChild);
|
||||||
},
|
},
|
||||||
|
|
||||||
getSelectedAddon: function() {
|
getSelectedAddon: function() {
|
||||||
|
@ -233,18 +233,15 @@
|
|||||||
<hbox id="search-sorters" class="sort-controls"
|
<hbox id="search-sorters" class="sort-controls"
|
||||||
showrelevance="true" sortby="relevancescore" ascending="false"/>
|
showrelevance="true" sortby="relevancescore" ascending="false"/>
|
||||||
</hbox>
|
</hbox>
|
||||||
<vbox id="search-list-empty" class="empty-list-notice"
|
|
||||||
flex="1" hidden="true">
|
|
||||||
<spacer flex="1"/>
|
|
||||||
<label value="&listEmpty.search.label;"/>
|
|
||||||
<button label="&listEmpty.button.label;" class="addon-control"
|
|
||||||
command="cmd_goToDiscoverPane"/>
|
|
||||||
<spacer flex="3"/>
|
|
||||||
</vbox>
|
|
||||||
<richlistbox id="search-list" class="list" flex="1">
|
<richlistbox id="search-list" class="list" flex="1">
|
||||||
<hbox pack="center">
|
<vbox id="search-list-empty" class="empty-list-notice"
|
||||||
<label id="search-allresults-link" class="text-link"/>
|
flex="1" hidden="true">
|
||||||
</hbox>
|
<spacer flex="1"/>
|
||||||
|
<label value="&listEmpty.search.label;"/>
|
||||||
|
<button label="&listEmpty.button.label;" class="addon-control"
|
||||||
|
command="cmd_goToDiscoverPane"/>
|
||||||
|
<spacer flex="3"/>
|
||||||
|
</vbox>
|
||||||
</richlistbox>
|
</richlistbox>
|
||||||
</vbox>
|
</vbox>
|
||||||
|
|
||||||
|
@ -60,7 +60,6 @@ _TEST_FILES = \
|
|||||||
browser_bug567137.js \
|
browser_bug567137.js \
|
||||||
browser_bug572561.js \
|
browser_bug572561.js \
|
||||||
browser_bug577990.js \
|
browser_bug577990.js \
|
||||||
browser_bug581076.js \
|
|
||||||
browser_dragdrop.js \
|
browser_dragdrop.js \
|
||||||
browser_list.js \
|
browser_list.js \
|
||||||
browser_searching.js \
|
browser_searching.js \
|
||||||
|
@ -1,121 +0,0 @@
|
|||||||
/* Any copyright is dedicated to the Public Domain.
|
|
||||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Bug 581076 - No "See all results" link present when searching for add-ons and not all are displayed (extensions.getAddons.maxResults)
|
|
||||||
|
|
||||||
const PREF_GETADDONS_BROWSESEARCHRESULTS = "extensions.getAddons.search.browseURL";
|
|
||||||
const PREF_GETADDONS_GETSEARCHRESULTS = "extensions.getAddons.search.url";
|
|
||||||
const PREF_GETADDONS_MAXRESULTS = "extensions.getAddons.maxResults";
|
|
||||||
const SEARCH_URL = TESTROOT + "browser_searching.xml";
|
|
||||||
const SEARCH_EXPECTED_TOTAL = 100;
|
|
||||||
const SEARCH_QUERY = "search";
|
|
||||||
|
|
||||||
var gManagerWindow;
|
|
||||||
|
|
||||||
|
|
||||||
function test() {
|
|
||||||
Services.prefs.setCharPref(PREF_GETADDONS_GETSEARCHRESULTS, SEARCH_URL);
|
|
||||||
Services.prefs.setIntPref(PREF_SEARCH_MAXRESULTS, 15);
|
|
||||||
|
|
||||||
waitForExplicitFinish();
|
|
||||||
|
|
||||||
open_manager(null, function(aWindow) {
|
|
||||||
gManagerWindow = aWindow;
|
|
||||||
run_next_test();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function end_test() {
|
|
||||||
Services.prefs.clearUserPref(PREF_GETADDONS_GETSEARCHRESULTS);
|
|
||||||
close_manager(gManagerWindow, finish);
|
|
||||||
}
|
|
||||||
|
|
||||||
function search(aRemoteSearch, aCallback) {
|
|
||||||
var searchBox = gManagerWindow.document.getElementById("header-search");
|
|
||||||
searchBox.value = SEARCH_QUERY;
|
|
||||||
|
|
||||||
EventUtils.synthesizeMouse(searchBox, 2, 2, { }, gManagerWindow);
|
|
||||||
EventUtils.synthesizeKey("VK_RETURN", { }, gManagerWindow);
|
|
||||||
|
|
||||||
wait_for_view_load(gManagerWindow, function() {
|
|
||||||
if (aRemoteSearch)
|
|
||||||
var filter = gManagerWindow.document.getElementById("search-filter-remote");
|
|
||||||
else
|
|
||||||
var filter = gManagerWindow.document.getElementById("search-filter-local");
|
|
||||||
EventUtils.synthesizeMouse(filter, 2, 2, { }, gManagerWindow);
|
|
||||||
|
|
||||||
executeSoon(aCallback);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function check_allresultslink(aShouldShow) {
|
|
||||||
var list = gManagerWindow.document.getElementById("search-list");
|
|
||||||
var link = gManagerWindow.document.getElementById("search-allresults-link");
|
|
||||||
is(link.parentNode, list.lastChild, "Footer should be at the end of the richlistbox");
|
|
||||||
if (aShouldShow) {
|
|
||||||
is_element_visible(link, "All Results link should be visible");
|
|
||||||
is(link.value, "See all " + SEARCH_EXPECTED_TOTAL + " results", "All Results link should show the correct message");
|
|
||||||
var scope = {};
|
|
||||||
Components.utils.import("resource://gre/modules/AddonRepository.jsm", scope);
|
|
||||||
is(link.href, scope.AddonRepository.getSearchURL(SEARCH_QUERY), "All Results link should have the correct href");
|
|
||||||
} else {
|
|
||||||
is_element_hidden(link, "All Results link should be hidden");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
add_test(function() {
|
|
||||||
info("Searching locally");
|
|
||||||
search(false, function() {
|
|
||||||
check_allresultslink(false);
|
|
||||||
restart_manager(gManagerWindow, null, function(aManager) {
|
|
||||||
gManagerWindow = aManager;
|
|
||||||
run_next_test();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
add_test(function() {
|
|
||||||
info("Searching remotely - more results than cap");
|
|
||||||
Services.prefs.setIntPref(PREF_GETADDONS_MAXRESULTS, 3);
|
|
||||||
search(true, function() {
|
|
||||||
check_allresultslink(true);
|
|
||||||
restart_manager(gManagerWindow, null, function(aManager) {
|
|
||||||
gManagerWindow = aManager;
|
|
||||||
run_next_test();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
add_test(function() {
|
|
||||||
info("Searching remotely - less results than cap");
|
|
||||||
Services.prefs.setIntPref(PREF_GETADDONS_MAXRESULTS, 200);
|
|
||||||
search(true, function() {
|
|
||||||
check_allresultslink(false);
|
|
||||||
restart_manager(gManagerWindow, null, function(aManager) {
|
|
||||||
gManagerWindow = aManager;
|
|
||||||
run_next_test();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
add_test(function() {
|
|
||||||
info("Searching remotely - more results than cap");
|
|
||||||
Services.prefs.setIntPref(PREF_GETADDONS_MAXRESULTS, 3);
|
|
||||||
search(true, function() {
|
|
||||||
check_allresultslink(true);
|
|
||||||
run_next_test();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
add_test(function() {
|
|
||||||
info("Switching views");
|
|
||||||
gManagerWindow.loadView("addons://list/extension");
|
|
||||||
wait_for_view_load(gManagerWindow, function() {
|
|
||||||
info("Re-loading previous search");
|
|
||||||
search(true, function() {
|
|
||||||
check_allresultslink(true);
|
|
||||||
run_next_test();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
@ -513,11 +513,6 @@
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
#search-allresults-link {
|
|
||||||
margin-top: 1em;
|
|
||||||
margin-bottom: 2em;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*** detail view ***/
|
/*** detail view ***/
|
||||||
|
|
||||||
#detail-view[active="false"] .fade {
|
#detail-view[active="false"] .fade {
|
||||||
|
@ -537,11 +537,6 @@
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
#search-allresults-link {
|
|
||||||
margin-top: 1em;
|
|
||||||
margin-bottom: 2em;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*** detail view ***/
|
/*** detail view ***/
|
||||||
|
|
||||||
#detail-view[active="false"] .fade {
|
#detail-view[active="false"] .fade {
|
||||||
|
@ -504,11 +504,6 @@
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
#search-allresults-link {
|
|
||||||
margin-top: 1em;
|
|
||||||
margin-bottom: 2em;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*** detail view ***/
|
/*** detail view ***/
|
||||||
|
|
||||||
#detail-view[active="false"] .fade {
|
#detail-view[active="false"] .fade {
|
||||||
|
Loading…
Reference in New Issue
Block a user