bug 501772 - Port Bug 500978 |Download Manager treats search terms as regular expressions| to SeaMonkey, r=Neil
This commit is contained in:
Родитель
928444d0ee
Коммит
1232ba134d
|
@ -104,7 +104,7 @@ function test()
|
|||
.getService(Components.interfaces.nsIObserverService);
|
||||
const DLMGR_UI_DONE = "download-manager-ui-done";
|
||||
|
||||
var testPhase = 0;
|
||||
var testPhase = -1;
|
||||
var testObs = {
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
if (aTopic != DLMGR_UI_DONE)
|
||||
|
@ -119,8 +119,13 @@ function test()
|
|||
searchbox.doCommand();
|
||||
};
|
||||
|
||||
let testResults = function(aExpected) {
|
||||
is(downloadView.rowCount, aExpected,
|
||||
"Phase " + testPhase + ": search matched " + aExpected + " download(s)");
|
||||
};
|
||||
|
||||
// The list must have built, so figure out what test to do
|
||||
switch (testPhase++) {
|
||||
switch (++testPhase) {
|
||||
case 0:
|
||||
// Search for multiple words in any order in all places
|
||||
search("download super pimped multiWord");
|
||||
|
@ -128,15 +133,23 @@ function test()
|
|||
break;
|
||||
case 1:
|
||||
// Done populating the two items
|
||||
ok(downloadView.rowCount == 2, "Search matched both downloads");
|
||||
testResults(2);
|
||||
|
||||
// Do partial word matches including the site
|
||||
search("agadak downl pimp multi");
|
||||
search("Agadak.net downl pimp multi");
|
||||
|
||||
break;
|
||||
case 2:
|
||||
// Done populating the one result
|
||||
ok(downloadView.rowCount == 1, "Found the single download");
|
||||
testResults(1);
|
||||
|
||||
// The search term shouldn't be treated like a regular expression,
|
||||
// e.g. "D.wnload" shouldn't match "Download".
|
||||
search("D.wnload");
|
||||
|
||||
break;
|
||||
case 3:
|
||||
testResults(0);
|
||||
|
||||
// We're done!
|
||||
win.close();
|
||||
|
|
|
@ -440,7 +440,7 @@ DownloadTreeView.prototype = {
|
|||
|
||||
if (!attrs.isActive)
|
||||
for each (let term in this._searchTerms)
|
||||
if (combinedSearch.search(term) == -1)
|
||||
if (combinedSearch.indexOf(term) == -1)
|
||||
matchSearch = false;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче