mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backing out bug 591024, bug 610764 and bug 614416 due to test failures. a=bustage
This commit is contained in:
parent
44e5a105d6
commit
26445d7b8f
@ -72,7 +72,9 @@ const UPDATES_RELEASENOTES_TRANSFORMFILE = "chrome://mozapps/content/extensions/
|
||||
|
||||
const XMLURI_PARSE_ERROR = "http://www.mozilla.org/newlayout/xml/parsererror.xml"
|
||||
|
||||
const VIEW_DEFAULT = "addons://discover/";
|
||||
const VIEW_DEFAULT = "addons://list/extension";
|
||||
|
||||
const INTEGER_FIELDS = ["dateUpdated", "size", "relevancescore"];
|
||||
|
||||
var gStrings = {};
|
||||
XPCOMUtils.defineLazyServiceGetter(gStrings, "bundleSvc",
|
||||
@ -1161,81 +1163,16 @@ function createItem(aObj, aIsInstall, aIsRemote) {
|
||||
// the binding handles the rest
|
||||
item.setAttribute("value", aObj.id);
|
||||
|
||||
// The XUL sort service only supports 32 bit integers so we strip the
|
||||
// milliseconds to make this small enough
|
||||
if (aObj.updateDate)
|
||||
item.setAttribute("dateUpdated", aObj.updateDate.getTime() / 1000);
|
||||
|
||||
if (aObj.size)
|
||||
item.setAttribute("size", aObj.size);
|
||||
return item;
|
||||
}
|
||||
|
||||
function sortElements(aElements, aSortBy, aAscending) {
|
||||
const DATE_FIELDS = ["updateDate"];
|
||||
const INTEGER_FIELDS = ["size", "relevancescore"];
|
||||
|
||||
function dateCompare(a, b) {
|
||||
var aTime = a.getTime();
|
||||
var bTime = b.getTime();
|
||||
if (aTime < bTime)
|
||||
return -1;
|
||||
if (aTime > bTime)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
function intCompare(a, b) {
|
||||
return a - b;
|
||||
}
|
||||
|
||||
function stringCompare(a, b) {
|
||||
return a.localeCompare(b);
|
||||
}
|
||||
|
||||
function getValue(aObj) {
|
||||
if (!aObj)
|
||||
return null;
|
||||
|
||||
if (aObj.hasAttribute(aSortBy))
|
||||
return aObj.getAttribute(aSortBy);
|
||||
|
||||
addon = aObj.mAddon || aObj.mInstall;
|
||||
if (!addon)
|
||||
return null;
|
||||
|
||||
return addon[aSortBy];
|
||||
}
|
||||
|
||||
var sortFunc = stringCompare;
|
||||
if (DATE_FIELDS.indexOf(aSortBy) != -1)
|
||||
sortFunc = dateCompare;
|
||||
else if (INTEGER_FIELDS.indexOf(aSortBy) != -1)
|
||||
sortFunc = intCompare;
|
||||
|
||||
aElements.sort(function(a, b) {
|
||||
if (!aAscending)
|
||||
[a, b] = [b, a];
|
||||
|
||||
var aValue = getValue(a);
|
||||
var bValue = getValue(b);
|
||||
|
||||
if (!aValue && !bValue)
|
||||
return 0;
|
||||
if (!aValue)
|
||||
return -1;
|
||||
if (!bValue)
|
||||
return 1;
|
||||
|
||||
return sortFunc(aValue, bValue);
|
||||
});
|
||||
}
|
||||
|
||||
function sortList(aList, aSortBy, aAscending) {
|
||||
var elements = Array.slice(aList.childNodes, 0);
|
||||
sortElements(elements, aSortBy, aAscending);
|
||||
|
||||
while (aList.listChild)
|
||||
aList.removeChild(aList.lastChild);
|
||||
|
||||
elements.forEach(function(aElement) {
|
||||
aList.appendChild(aElement);
|
||||
});
|
||||
}
|
||||
|
||||
function getAddonsAndInstalls(aType, aCallback) {
|
||||
var addonTypes = null, installTypes = null;
|
||||
if (aType != null) {
|
||||
@ -1625,9 +1562,8 @@ var gSearchView = {
|
||||
this._pendingSearches = 2;
|
||||
this._sorters.setSort("relevancescore", false);
|
||||
|
||||
var elements = [];
|
||||
|
||||
function createSearchResults(aObjsList, aIsInstall, aIsRemote) {
|
||||
var createdCount = 0;
|
||||
aObjsList.forEach(function(aObj) {
|
||||
let score = 0;
|
||||
if (aQuery.length > 0) {
|
||||
@ -1641,18 +1577,16 @@ var gSearchView = {
|
||||
if (aIsRemote)
|
||||
gCachedAddons[aObj.id] = aObj;
|
||||
|
||||
elements.push(item);
|
||||
self._listBox.insertBefore(item, self._listBox.lastChild);
|
||||
createdCount++;
|
||||
});
|
||||
|
||||
return createdCount;
|
||||
}
|
||||
|
||||
function finishSearch(createdCount) {
|
||||
if (elements.length > 0) {
|
||||
sortElements(elements, self._sorters.sortBy, self._sorters.ascending);
|
||||
elements.forEach(function(aElement) {
|
||||
self._listBox.insertBefore(aElement, self._listBox.lastChild);
|
||||
});
|
||||
self.updateListAttributes();
|
||||
}
|
||||
if (createdCount > 0)
|
||||
self.onSortChanged(self._sorters.sortBy, self._sorters.ascending);
|
||||
|
||||
self._pendingSearches--;
|
||||
self.updateView();
|
||||
@ -1665,9 +1599,9 @@ var gSearchView = {
|
||||
if (gViewController && aRequest != gViewController.currentViewRequest)
|
||||
return;
|
||||
|
||||
createSearchResults(aAddons, false, false);
|
||||
createSearchResults(aInstalls, true, false);
|
||||
finishSearch();
|
||||
var createdCount = createSearchResults(aAddons, false, false);
|
||||
createdCount += createSearchResults(aInstalls, true, false);
|
||||
finishSearch(createdCount);
|
||||
});
|
||||
|
||||
var maxRemoteResults = 0;
|
||||
@ -1814,7 +1748,18 @@ var gSearchView = {
|
||||
this._allResultsLink.hidden = false;
|
||||
},
|
||||
|
||||
updateListAttributes: function() {
|
||||
onSortChanged: function(aSortBy, aAscending) {
|
||||
var footer = this._listBox.lastChild;
|
||||
this._listBox.removeChild(footer);
|
||||
|
||||
var hints = aAscending ? "ascending" : "descending";
|
||||
if (INTEGER_FIELDS.indexOf(aSortBy) >= 0)
|
||||
hints += " integer";
|
||||
|
||||
var sortService = Cc["@mozilla.org/xul/xul-sort-service;1"].
|
||||
getService(Ci.nsIXULSortService);
|
||||
sortService.sort(this._listBox, aSortBy, hints);
|
||||
|
||||
var item = this._listBox.querySelector("richlistitem[remote='true'][first]");
|
||||
if (item)
|
||||
item.removeAttribute("first");
|
||||
@ -1839,15 +1784,6 @@ var gSearchView = {
|
||||
items[items.length - 1].setAttribute("last", true);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
onSortChanged: function(aSortBy, aAscending) {
|
||||
var footer = this._listBox.lastChild;
|
||||
this._listBox.removeChild(footer);
|
||||
|
||||
sortList(this._listBox, aSortBy, aAscending);
|
||||
this.updateListAttributes();
|
||||
|
||||
this._listBox.appendChild(footer);
|
||||
},
|
||||
|
||||
@ -1924,23 +1860,21 @@ var gListView = {
|
||||
if (gViewController && aRequest != gViewController.currentViewRequest)
|
||||
return;
|
||||
|
||||
var elements = [];
|
||||
|
||||
for (let i = 0; i < aAddonsList.length; i++)
|
||||
elements.push(createItem(aAddonsList[i]));
|
||||
|
||||
for (let i = 0; i < aInstallsList.length; i++)
|
||||
elements.push(createItem(aInstallsList[i], true));
|
||||
|
||||
if (elements.length > 0) {
|
||||
sortElements(elements, self._sorters.sortBy, self._sorters.ascending);
|
||||
elements.forEach(function(aElement) {
|
||||
self._listBox.appendChild(aElement);
|
||||
});
|
||||
} else {
|
||||
self.showEmptyNotice(true);
|
||||
for (let i = 0; i < aAddonsList.length; i++) {
|
||||
let item = createItem(aAddonsList[i]);
|
||||
self._listBox.appendChild(item);
|
||||
}
|
||||
|
||||
for (let i = 0; i < aInstallsList.length; i++) {
|
||||
let item = createItem(aInstallsList[i], true);
|
||||
self._listBox.appendChild(item);
|
||||
}
|
||||
|
||||
if (self._listBox.childElementCount > 0)
|
||||
self.onSortChanged(self._sorters.sortBy, self._sorters.ascending);
|
||||
else
|
||||
self.showEmptyNotice(true);
|
||||
|
||||
gEventManager.registerInstallListener(self);
|
||||
gViewController.updateCommands();
|
||||
gViewController.notifyViewChanged();
|
||||
@ -1972,7 +1906,13 @@ var gListView = {
|
||||
},
|
||||
|
||||
onSortChanged: function(aSortBy, aAscending) {
|
||||
sortList(this._listBox, aSortBy, aAscending);
|
||||
var hints = aAscending ? "ascending" : "descending";
|
||||
if (INTEGER_FIELDS.indexOf(aSortBy) >= 0)
|
||||
hints += " integer";
|
||||
|
||||
var sortService = Cc["@mozilla.org/xul/xul-sort-service;1"].
|
||||
getService(Ci.nsIXULSortService);
|
||||
sortService.sort(this._listBox, aSortBy, hints);
|
||||
},
|
||||
|
||||
onNewInstall: function(aInstall) {
|
||||
@ -2404,6 +2344,7 @@ var gUpdatesView = {
|
||||
_updateSelected: null,
|
||||
_updatePrefs: null,
|
||||
_categoryItem: null,
|
||||
_numManualUpdaters: 0,
|
||||
|
||||
initialize: function() {
|
||||
this.node = document.getElementById("updates-view");
|
||||
@ -2422,6 +2363,7 @@ var gUpdatesView = {
|
||||
this._updatePrefs = Services.prefs.getBranch("extensions.update.");
|
||||
this._updatePrefs.QueryInterface(Ci.nsIPrefBranch2);
|
||||
this._updatePrefs.addObserver("", this, false);
|
||||
this.updateManualUpdatersCount(true);
|
||||
this.updateAvailableCount(true);
|
||||
|
||||
AddonManager.addAddonListener(this);
|
||||
@ -2452,8 +2394,6 @@ var gUpdatesView = {
|
||||
|
||||
hide: function() {
|
||||
this._updateSelected.hidden = true;
|
||||
|
||||
this._categoryItem.disabled = this._categoryItem.badgeCount == 0;
|
||||
},
|
||||
|
||||
_showRecentUpdates: function(aRequest) {
|
||||
@ -2462,23 +2402,19 @@ var gUpdatesView = {
|
||||
if (gViewController && aRequest != gViewController.currentViewRequest)
|
||||
return;
|
||||
|
||||
var elements = [];
|
||||
let threshold = Date.now() - UPDATES_RECENT_TIMESPAN;
|
||||
aAddonsList.forEach(function(aAddon) {
|
||||
if (!aAddon.updateDate || aAddon.updateDate.getTime() < threshold)
|
||||
return;
|
||||
|
||||
elements.push(createItem(aAddon));
|
||||
let item = createItem(aAddon);
|
||||
self._listBox.appendChild(item);
|
||||
});
|
||||
|
||||
if (elements.length > 0) {
|
||||
sortElements(elements, self._sorters.sortBy, self._sorters.ascending);
|
||||
elements.forEach(function(aElement) {
|
||||
self._listBox.appendChild(aElement);
|
||||
});
|
||||
} else {
|
||||
if (self._listBox.itemCount > 0)
|
||||
self.onSortChanged(self._sorters.sortBy, self._sorters.ascending);
|
||||
else
|
||||
self.showEmptyNotice(true);
|
||||
}
|
||||
|
||||
gViewController.notifyViewChanged();
|
||||
});
|
||||
@ -2504,8 +2440,6 @@ var gUpdatesView = {
|
||||
self._listBox.removeItemAt(0);
|
||||
}
|
||||
|
||||
var elements = [];
|
||||
|
||||
aInstallsList.forEach(function(aInstall) {
|
||||
if (!self.isManualUpdate(aInstall))
|
||||
return;
|
||||
@ -2515,15 +2449,12 @@ var gUpdatesView = {
|
||||
item.addEventListener("IncludeUpdateChanged", function() {
|
||||
self.maybeDisableUpdateSelected();
|
||||
}, false);
|
||||
elements.push(item);
|
||||
self._listBox.appendChild(item);
|
||||
});
|
||||
|
||||
if (elements.length > 0) {
|
||||
if (self._listBox.itemCount > 0) {
|
||||
self._updateSelected.hidden = false;
|
||||
sortElements(elements, self._sorters.sortBy, self._sorters.ascending);
|
||||
elements.forEach(function(aElement) {
|
||||
self._listBox.appendChild(aElement);
|
||||
});
|
||||
self.onSortChanged(self._sorters.sortBy, self._sorters.ascending);
|
||||
} else {
|
||||
self.showEmptyNotice(true);
|
||||
}
|
||||
@ -2550,12 +2481,45 @@ var gUpdatesView = {
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
if (aTopic != "nsPref:changed")
|
||||
return;
|
||||
if (aData == "autoUpdateDefault")
|
||||
this.updateManualUpdatersCount();
|
||||
},
|
||||
|
||||
maybeRefresh: function() {
|
||||
if (gViewController.currentViewId == "addons://updates/available")
|
||||
if (gViewController.currentViewId == "addons://updates/available") {
|
||||
this._showAvailableUpdates(true);
|
||||
this.updateAvailableCount();
|
||||
} else {
|
||||
this.updateManualUpdatersCount();
|
||||
this.updateAvailableCount();
|
||||
}
|
||||
},
|
||||
|
||||
maybeShowCategory: function() {
|
||||
var hide = this._numManualUpdaters == 0;
|
||||
if (this._categoryItem.disabled != hide) {
|
||||
this._categoryItem.disabled = hide;
|
||||
var event = document.createEvent("Events");
|
||||
event.initEvent("CategoryVisible", true, true);
|
||||
this._categoryItem.dispatchEvent(event);
|
||||
}
|
||||
},
|
||||
|
||||
updateManualUpdatersCount: function(aInitializing) {
|
||||
if (aInitializing)
|
||||
gPendingInitializations++;
|
||||
var self = this;
|
||||
var autoUpdateDefault = AddonManager.autoUpdateDefault;
|
||||
AddonManager.getAllAddons(function(aAddonList) {
|
||||
var manualUpdaters = aAddonList.filter(function(aAddon) {
|
||||
if (!("applyBackgroundUpdates" in aAddon))
|
||||
return false;
|
||||
return !shouldAutoUpdate(aAddon, autoUpdateDefault);
|
||||
});
|
||||
self._numManualUpdaters = manualUpdaters.length;
|
||||
self.maybeShowCategory();
|
||||
if (aInitializing)
|
||||
notifyInitialized();
|
||||
});
|
||||
},
|
||||
|
||||
updateAvailableCount: function(aInitializing) {
|
||||
@ -2566,8 +2530,6 @@ var gUpdatesView = {
|
||||
var count = aInstallsList.filter(function(aInstall) {
|
||||
return self.isManualUpdate(aInstall, true);
|
||||
}).length;
|
||||
self._categoryItem.disabled = gViewController.currentViewObj != self &&
|
||||
count == 0;
|
||||
self._categoryItem.badgeCount = count;
|
||||
if (aInitializing)
|
||||
notifyInitialized();
|
||||
@ -2613,7 +2575,13 @@ var gUpdatesView = {
|
||||
},
|
||||
|
||||
onSortChanged: function(aSortBy, aAscending) {
|
||||
sortList(this._listBox, aSortBy, aAscending);
|
||||
var hints = aAscending ? "ascending" : "descending";
|
||||
if (INTEGER_FIELDS.indexOf(aSortBy) >= 0)
|
||||
hints += " integer";
|
||||
|
||||
var sortService = Cc["@mozilla.org/xul/xul-sort-service;1"].
|
||||
getService(Ci.nsIXULSortService);
|
||||
sortService.sort(this._listBox, aSortBy, hints);
|
||||
},
|
||||
|
||||
onNewInstall: function(aInstall) {
|
||||
@ -2622,8 +2590,18 @@ var gUpdatesView = {
|
||||
this.maybeRefresh();
|
||||
},
|
||||
|
||||
onInstallStarted: function(aInstall) {
|
||||
this.updateAvailableCount();
|
||||
onExternalInstall: function(aAddon) {
|
||||
if (!shouldAutoUpdate(aAddon)) {
|
||||
this._numManualUpdaters++;
|
||||
this.maybeShowCategory();
|
||||
}
|
||||
},
|
||||
|
||||
onInstallEnded: function(aAddon) {
|
||||
if (!shouldAutoUpdate(aAddon)) {
|
||||
this._numManualUpdaters++;
|
||||
this.maybeShowCategory();
|
||||
}
|
||||
},
|
||||
|
||||
onInstallCancelled: function(aInstall) {
|
||||
@ -2634,7 +2612,7 @@ var gUpdatesView = {
|
||||
|
||||
onPropertyChanged: function(aAddon, aProperties) {
|
||||
if (aProperties.indexOf("applyBackgroundUpdates") != -1)
|
||||
this.updateAvailableCount();
|
||||
this.updateManualUpdatersCount();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -246,7 +246,7 @@
|
||||
<xul:button anonid="date-btn" class="sorter"
|
||||
label="&sort.dateUpdated.label;"
|
||||
tooltiptext="&sort.dateUpdated.tooltip;"
|
||||
oncommand="this.parentNode._handleChange('updateDate');"/>
|
||||
oncommand="this.parentNode._handleChange('dateUpdated');"/>
|
||||
<xul:button anonid="relevance-btn" class="sorter" hidden="true"
|
||||
label="&sort.relevance.label;"
|
||||
tooltiptext="&sort.relevance.tooltip;"
|
||||
@ -348,7 +348,7 @@
|
||||
this._btnName.checked = false;
|
||||
}
|
||||
|
||||
if (sortBy == "updateDate") {
|
||||
if (sortBy == "dateUpdated") {
|
||||
this._btnDate.checkState = checkState;
|
||||
this._btnDate.checked = true;
|
||||
} else {
|
||||
@ -1034,6 +1034,11 @@
|
||||
|
||||
this.setAttribute("name", aAddon.name);
|
||||
|
||||
if (aAddon.size)
|
||||
this.setAttribute("size", aAddon.size);
|
||||
else
|
||||
this.removeAttribute("size");
|
||||
|
||||
var iconURL = this.mAddon.iconURL;
|
||||
if (iconURL)
|
||||
this._icon.src = iconURL;
|
||||
@ -1106,10 +1111,13 @@
|
||||
);
|
||||
}
|
||||
|
||||
if (this.mAddon.updateDate)
|
||||
if (this.mAddon.updateDate) {
|
||||
this._dateUpdated.value = formatDate(this.mAddon.updateDate);
|
||||
else
|
||||
this.setAttribute("dateUpdated", this.mAddon.updateDate.getTime() / 1000);
|
||||
} else {
|
||||
this._dateUpdated.value = this._dateUpdated.getAttribute("unknown");
|
||||
this.removeAttribute("dateUpdated");
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
|
@ -416,7 +416,7 @@
|
||||
<spacer flex="5000"/> <!-- Necessary to allow the message to wrap -->
|
||||
</hbox>
|
||||
<spacer flex="1"/>
|
||||
<hbox id="updates-sorters" class="sort-controls" sortby="updateDate"
|
||||
<hbox id="updates-sorters" class="sort-controls" sortby="dateUpdated"
|
||||
ascending="false"/>
|
||||
</hbox>
|
||||
<vbox id="updates-list-empty" class="alert-container"
|
||||
|
@ -61,7 +61,6 @@ _MAIN_TEST_FILES = \
|
||||
browser_bug591465.js \
|
||||
browser_bug596336.js \
|
||||
browser_bug608316.js \
|
||||
browser_bug610764.js \
|
||||
browser_details.js \
|
||||
browser_discovery.js \
|
||||
browser_dragdrop.js \
|
||||
|
@ -41,18 +41,16 @@ function end_test() {
|
||||
|
||||
|
||||
function perform_search(aQuery, aCallback) {
|
||||
waitForFocus(function() {
|
||||
var searchBox = gManagerWindow.document.getElementById("header-search");
|
||||
searchBox.value = aQuery;
|
||||
var searchBox = gManagerWindow.document.getElementById("header-search");
|
||||
searchBox.value = aQuery;
|
||||
|
||||
EventUtils.synthesizeMouse(searchBox, 2, 2, { }, gManagerWindow);
|
||||
EventUtils.synthesizeKey("VK_RETURN", { }, gManagerWindow);
|
||||
wait_for_view_load(gManagerWindow, function() {
|
||||
var list = gManagerWindow.document.getElementById("search-list");
|
||||
var rows = list.getElementsByTagName("richlistitem");
|
||||
aCallback(rows);
|
||||
});
|
||||
}, gManagerWindow);
|
||||
EventUtils.synthesizeMouse(searchBox, 2, 2, { }, gManagerWindow);
|
||||
EventUtils.synthesizeKey("VK_RETURN", { }, gManagerWindow);
|
||||
wait_for_view_load(gManagerWindow, function() {
|
||||
var list = gManagerWindow.document.getElementById("search-list");
|
||||
var rows = list.getElementsByTagName("richlistitem");
|
||||
aCallback(rows);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
@ -387,7 +387,7 @@ add_test(function() {
|
||||
return;
|
||||
}
|
||||
|
||||
open_manager("addons://list/extension", function(aManager) {
|
||||
open_manager(null, function(aManager) {
|
||||
info("Part 1");
|
||||
is_in_list(aManager, "addons://list/extension", false, false);
|
||||
|
||||
@ -453,7 +453,7 @@ add_test(function() {
|
||||
return;
|
||||
}
|
||||
|
||||
open_manager("addons://list/extension", function(aManager) {
|
||||
open_manager(null, function(aManager) {
|
||||
info("Part 1");
|
||||
is_in_list(aManager, "addons://list/extension", false, false);
|
||||
|
||||
@ -530,7 +530,7 @@ add_test(function() {
|
||||
// Tests that removing an extension from the detail view goes back and doesn't
|
||||
// allow you to go forward again.
|
||||
add_test(function() {
|
||||
open_manager("addons://list/extension", function(aManager) {
|
||||
open_manager(null, function(aManager) {
|
||||
info("Part 1");
|
||||
is_in_list(aManager, "addons://list/extension", false, false);
|
||||
|
||||
@ -574,20 +574,3 @@ add_test(function() {
|
||||
close_manager(aManager, run_next_test);
|
||||
});
|
||||
});
|
||||
|
||||
// Tests that opening the manager opens the last view
|
||||
add_test(function() {
|
||||
open_manager("addons://list/plugin", function(aManager) {
|
||||
info("Part 1");
|
||||
is_in_list(aManager, "addons://list/plugin", false, false);
|
||||
|
||||
close_manager(aManager, function() {
|
||||
open_manager(null, function(aManager) {
|
||||
info("Part 1");
|
||||
is_in_list(aManager, "addons://list/plugin", false, false);
|
||||
|
||||
close_manager(aManager, run_next_test);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -40,23 +40,21 @@ function end_test() {
|
||||
}
|
||||
|
||||
function search(aRemoteSearch, aCallback) {
|
||||
waitForFocus(function() {
|
||||
var searchBox = gManagerWindow.document.getElementById("header-search");
|
||||
searchBox.value = SEARCH_QUERY;
|
||||
var searchBox = gManagerWindow.document.getElementById("header-search");
|
||||
searchBox.value = SEARCH_QUERY;
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(searchBox, { }, gManagerWindow);
|
||||
EventUtils.synthesizeKey("VK_RETURN", { }, gManagerWindow);
|
||||
EventUtils.synthesizeMouseAtCenter(searchBox, { }, 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.synthesizeMouseAtCenter(filter, { }, 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.synthesizeMouseAtCenter(filter, { }, gManagerWindow);
|
||||
|
||||
executeSoon(aCallback);
|
||||
});
|
||||
}, gManagerWindow);
|
||||
executeSoon(aCallback);
|
||||
});
|
||||
}
|
||||
|
||||
function check_allresultslink(aShouldShow) {
|
||||
|
@ -1,34 +0,0 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
// Tests that the discovery view is the default
|
||||
|
||||
var gCategoryUtilities;
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
open_manager(null, function(aWindow) {
|
||||
waitForFocus(function() {
|
||||
// The last view is cached except when it is the search view so switch to
|
||||
// that and reopen to ensure we see the default view
|
||||
var searchBox = aWindow.document.getElementById("header-search");
|
||||
searchBox.value = "bar";
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(searchBox, { }, aWindow);
|
||||
EventUtils.synthesizeKey("VK_RETURN", { }, aWindow);
|
||||
|
||||
wait_for_view_load(aWindow, function() {
|
||||
close_manager(aWindow, function() {
|
||||
open_manager(null, function(aWindow) {
|
||||
gCategoryUtilities = new CategoryUtilities(aWindow);
|
||||
is(gCategoryUtilities.selectedCategory, "discover", "Should show the discovery pane by default");
|
||||
|
||||
close_manager(aWindow, finish);
|
||||
});
|
||||
});
|
||||
});
|
||||
}, aWindow);
|
||||
});
|
||||
}
|
@ -4,6 +4,7 @@
|
||||
|
||||
// Tests that the discovery view loads properly
|
||||
|
||||
const PREF_DISCOVERURL = "extensions.webservice.discoverURL";
|
||||
const PREF_BACKGROUND_UPDATE = "extensions.update.enabled";
|
||||
|
||||
var gManagerWindow;
|
||||
|
@ -204,7 +204,7 @@ add_test(function() {
|
||||
add_test(function() {
|
||||
installSearchResult(function() {
|
||||
close_manager(gManagerWindow, function() {
|
||||
open_manager("addons://list/extension", function(aWindow) {
|
||||
open_manager(null, function(aWindow) {
|
||||
gManagerWindow = aWindow;
|
||||
gCategoryUtilities = new CategoryUtilities(gManagerWindow);
|
||||
check_undo_install();
|
||||
|
@ -48,16 +48,25 @@ add_test(function() {
|
||||
applyBackgroundUpdates: AddonManager.AUTOUPDATE_DISABLE
|
||||
}]);
|
||||
|
||||
is(gCategoryUtilities.isVisible(gAvailableCategory), false, "Available Updates category should still be hidden");
|
||||
|
||||
run_next_test();
|
||||
is(gCategoryUtilities.isVisible(gAvailableCategory), true, "Available Updates category should now be visible");
|
||||
|
||||
gAvailableCategory.addEventListener("CategoryVisible", function() {
|
||||
gAvailableCategory.removeEventListener("CategoryVisible", arguments.callee, false);
|
||||
is(gCategoryUtilities.isVisible(gAvailableCategory), false, "Available Updates category should not be visible");
|
||||
gAvailableCategory.addEventListener("CategoryVisible", function() {
|
||||
gAvailableCategory.removeEventListener("CategoryVisible", arguments.callee, false);
|
||||
is(gCategoryUtilities.isVisible(gAvailableCategory), true, "Available Updates category should be visible");
|
||||
run_next_test();
|
||||
}, false);
|
||||
gProvider.addons[1].applyBackgroundUpdates = AddonManager.AUTOUPDATE_DISABLE;
|
||||
}, false);
|
||||
gProvider.addons[1].applyBackgroundUpdates = AddonManager.AUTOUPDATE_ENABLE;
|
||||
});
|
||||
|
||||
|
||||
add_test(function() {
|
||||
gAvailableCategory.addEventListener("CategoryBadgeUpdated", function() {
|
||||
gAvailableCategory.removeEventListener("CategoryBadgeUpdated", arguments.callee, false);
|
||||
is(gCategoryUtilities.isVisible(gAvailableCategory), true, "Available Updates category should now be visible");
|
||||
is(gAvailableCategory.badgeCount, 1, "Badge for Available Updates should now be 1");
|
||||
run_next_test();
|
||||
}, false);
|
||||
@ -156,17 +165,6 @@ add_test(function() {
|
||||
|
||||
|
||||
add_test(function() {
|
||||
var badgeUpdated = false;
|
||||
var installCompleted = false;
|
||||
|
||||
gAvailableCategory.addEventListener("CategoryBadgeUpdated", function() {
|
||||
gAvailableCategory.removeEventListener("CategoryBadgeUpdated", arguments.callee, false);
|
||||
if (installCompleted)
|
||||
run_next_test();
|
||||
else
|
||||
badgeUpdated = true;
|
||||
}, false);
|
||||
|
||||
var list = gManagerWindow.document.getElementById("updates-list");
|
||||
var item = list.firstChild;
|
||||
var updateBtn = item._updateBtn;
|
||||
@ -180,63 +178,11 @@ add_test(function() {
|
||||
},
|
||||
onInstallEnded: function() {
|
||||
install.removeTestListener(this);
|
||||
info("Install ended");
|
||||
info("install ended");
|
||||
is_element_hidden(item._installStatus, "Install progress widget should be hidden");
|
||||
|
||||
if (badgeUpdated)
|
||||
run_next_test();
|
||||
else
|
||||
installCompleted = true;
|
||||
run_next_test();
|
||||
}
|
||||
};
|
||||
install.addTestListener(listener);
|
||||
EventUtils.synthesizeMouseAtCenter(updateBtn, { }, gManagerWindow);
|
||||
});
|
||||
|
||||
|
||||
add_test(function() {
|
||||
is(gCategoryUtilities.isVisible(gAvailableCategory), true, "Available Updates category should still be visible");
|
||||
is(gAvailableCategory.badgeCount, 0, "Badge for Available Updates should now be 0");
|
||||
|
||||
gCategoryUtilities.openType("extension", function() {
|
||||
is(gCategoryUtilities.isVisible(gAvailableCategory), false, "Available Updates category should be hidden");
|
||||
|
||||
close_manager(gManagerWindow, function() {
|
||||
open_manager(null, function(aWindow) {
|
||||
gManagerWindow = aWindow;
|
||||
gCategoryUtilities = new CategoryUtilities(gManagerWindow);
|
||||
gAvailableCategory = gManagerWindow.gCategories.get("addons://updates/available");
|
||||
|
||||
is(gCategoryUtilities.isVisible(gAvailableCategory), false, "Available Updates category should be hidden");
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
add_test(function() {
|
||||
gAvailableCategory.addEventListener("CategoryBadgeUpdated", function() {
|
||||
gAvailableCategory.removeEventListener("CategoryBadgeUpdated", arguments.callee, false);
|
||||
is(gCategoryUtilities.isVisible(gAvailableCategory), true, "Available Updates category should now be visible");
|
||||
is(gAvailableCategory.badgeCount, 1, "Badge for Available Updates should now be 1");
|
||||
|
||||
gAvailableCategory.addEventListener("CategoryBadgeUpdated", function() {
|
||||
gAvailableCategory.removeEventListener("CategoryBadgeUpdated", arguments.callee, false);
|
||||
is(gCategoryUtilities.isVisible(gAvailableCategory), false, "Available Updates category should now be hidden");
|
||||
|
||||
run_next_test();
|
||||
}, false);
|
||||
|
||||
AddonManager.getAddonByID("addon2@tests.mozilla.org", function(aAddon) {
|
||||
aAddon.applyBackgroundUpdates = AddonManager.AUTOUPDATE_ENABLE;
|
||||
});
|
||||
}, false);
|
||||
|
||||
gProvider.createInstalls([{
|
||||
name: "manually updating addon (new and even more improved!)",
|
||||
existingAddon: gProvider.addons[1],
|
||||
version: "1.2",
|
||||
releaseNotesURI: Services.io.newURI(TESTROOT + "thereIsNoFileHere.xhtml", null, null)
|
||||
}]);
|
||||
});
|
||||
|
@ -68,7 +68,7 @@ add_test(function() {
|
||||
add_test(function() {
|
||||
var updatesList = gManagerWindow.document.getElementById("updates-list");
|
||||
var items = updatesList.getElementsByTagName("richlistitem");
|
||||
var possible = ["addon1@tests.mozilla.org", "addon2@tests.mozilla.org", "addon3@tests.mozilla.org"];
|
||||
var possible = ["addon1@tests.mozilla.org", "addon2@tests.mozilla.org", "addon2@tests.mozilla.org"];
|
||||
var expected = ["addon2@tests.mozilla.org", "addon1@tests.mozilla.org"];
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
let item = items[i];
|
||||
@ -76,7 +76,7 @@ add_test(function() {
|
||||
if (possible.indexOf(itemId) == -1)
|
||||
continue; // skip over any other addons, such as shipped addons that would update on every build
|
||||
isnot(expected.length, 0, "Should be expecting more items");
|
||||
is(itemId, expected.shift(), "Should get expected item based on recentness of update");
|
||||
is(itemId, expected.shift(), "Should get expected item based on recenty of update");
|
||||
if (itemId == "addon1@tests.mozilla.org")
|
||||
is_element_visible(item._relNotesToggle, "Release notes toggle should be visible for addon with release notes");
|
||||
else
|
||||
|
@ -60,8 +60,9 @@ function check_order(aExpectedOrder) {
|
||||
var node = list.firstChild;
|
||||
while (node) {
|
||||
var id = node.getAttribute("value");
|
||||
if (id && id.substring(id.length - 18) == "@tests.mozilla.org")
|
||||
order.push(node.getAttribute("value"));
|
||||
if (id && id.substring(id.length - 18) != "@tests.mozilla.org")
|
||||
return;
|
||||
order.push(node.getAttribute("value"));
|
||||
node = node.nextSibling;
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,6 @@ const MANAGER_URI = "about:addons";
|
||||
const INSTALL_URI = "chrome://mozapps/content/xpinstall/xpinstallConfirm.xul";
|
||||
const PREF_LOGGING_ENABLED = "extensions.logging.enabled";
|
||||
const PREF_SEARCH_MAXRESULTS = "extensions.getAddons.maxResults";
|
||||
const PREF_DISCOVERURL = "extensions.webservice.discoverURL";
|
||||
|
||||
var gPendingTests = [];
|
||||
var gTestsRun = 0;
|
||||
@ -38,8 +37,6 @@ var gUseInContentUI = !gTestInWindow && ("switchToTabHavingURI" in window);
|
||||
Services.prefs.setBoolPref(PREF_LOGGING_ENABLED, true);
|
||||
// Turn off remote results in searches
|
||||
Services.prefs.setIntPref(PREF_SEARCH_MAXRESULTS, 0);
|
||||
// Default to a local discovery pane
|
||||
Services.prefs.setCharPref(PREF_DISCOVERURL, "http://127.0.0.1/extensions-dummy/discoveryURL");
|
||||
registerCleanupFunction(function() {
|
||||
Services.prefs.clearUserPref(PREF_LOGGING_ENABLED);
|
||||
try {
|
||||
@ -540,7 +537,6 @@ MockProvider.prototype = {
|
||||
*/
|
||||
addInstall: function MP_addInstall(aInstall) {
|
||||
this.installs.push(aInstall);
|
||||
aInstall._provider = this;
|
||||
|
||||
if (!this.started)
|
||||
return;
|
||||
@ -548,16 +544,6 @@ MockProvider.prototype = {
|
||||
aInstall.callListeners("onNewInstall");
|
||||
},
|
||||
|
||||
removeInstall: function MP_removeInstall(aInstall) {
|
||||
var pos = this.installs.indexOf(aInstall);
|
||||
if (pos == -1) {
|
||||
ok(false, "Tried to remove an install that wasn't registered with the mock provider");
|
||||
return;
|
||||
}
|
||||
|
||||
this.installs.splice(pos, 1);
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates a set of mock add-on objects and adds them to the list of add-ons
|
||||
* managed by this provider.
|
||||
@ -1034,7 +1020,6 @@ MockInstall.prototype = {
|
||||
AddonManagerPrivate.callAddonListeners("onInstalling", this.addon);
|
||||
|
||||
this.state = AddonManager.STATE_INSTALLED;
|
||||
this._provider.removeInstall(this);
|
||||
this.callListeners("onInstallEnded");
|
||||
break;
|
||||
case AddonManager.STATE_DOWNLOADING:
|
||||
|
Loading…
Reference in New Issue
Block a user