зеркало из https://github.com/mozilla/ubiquity.git
Removed collection.js which is no longer in use.
This commit is contained in:
Родитель
ac7499c03e
Коммит
7edeb93f8d
|
@ -1,56 +0,0 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ubiquity.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2007
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Atul Varma <atul@mozilla.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
var EXPORTED_SYMBOLS = ["IterableCollection",
|
||||
"CompositeCollection"];
|
||||
|
||||
function IterableCollection(itemList) {
|
||||
this.__iterator__ = function iterator() {
|
||||
for (var i = 0; i < itemList.length; i++)
|
||||
yield itemList[i];
|
||||
};
|
||||
}
|
||||
|
||||
function CompositeCollection(collectionList) {
|
||||
this.__iterator__ = function iterator() {
|
||||
for (var i = 0; i < collectionList.length; i++) {
|
||||
let collection = collectionList[i];
|
||||
|
||||
for (var item in collection)
|
||||
yield item;
|
||||
}
|
||||
};
|
||||
}
|
|
@ -45,7 +45,6 @@ Cu.import("resource://ubiquity/modules/codesource.js");
|
|||
Cu.import("resource://ubiquity/modules/parser/parser.js");
|
||||
Cu.import("resource://ubiquity/modules/feedmanager.js");
|
||||
Cu.import("resource://ubiquity/modules/cmdmanager.js");
|
||||
Cu.import("resource://ubiquity/modules/collection.js");
|
||||
Cu.import("resource://ubiquity/modules/localization_utils.js");
|
||||
|
||||
Cu.import("resource://ubiquity/tests/framework.js");
|
||||
|
@ -103,22 +102,6 @@ function testUtilsUrlWorksWithKeywordArgs() {
|
|||
this.assert(Utils.url(kwargs).spec == expected);
|
||||
}
|
||||
|
||||
function testCompositeCollectionWorks() {
|
||||
let a = new StringCodeSource('a', 'a');
|
||||
let b = new StringCodeSource('b', 'b');
|
||||
let c = new StringCodeSource('c', 'c');
|
||||
let d = new StringCodeSource('d', 'd');
|
||||
|
||||
let coll_1 = new IterableCollection([a, b]);
|
||||
let coll_2 = new IterableCollection([c, d]);
|
||||
|
||||
let iter = Iterator(new CompositeCollection([coll_1, coll_2]));
|
||||
this.assert(iter.next().id == 'a');
|
||||
this.assert(iter.next().id == 'b');
|
||||
this.assert(iter.next().id == 'c');
|
||||
this.assert(iter.next().id == 'd');
|
||||
}
|
||||
|
||||
function testMixedCodeSourceWorks() {
|
||||
let a = new StringCodeSource("a", "a");
|
||||
let b = new StringCodeSource("b", "b");
|
||||
|
@ -296,27 +279,6 @@ function testCmdManagerCatchesExceptionsInCmds() {
|
|||
}
|
||||
}
|
||||
|
||||
function testIterableCollectionWorks() {
|
||||
var fakeCodeSource = {
|
||||
getCode: function() { return "a = 1"; },
|
||||
id: "http://www.foo.com/bar.js"
|
||||
};
|
||||
|
||||
var coll = new IterableCollection([fakeCodeSource]);
|
||||
var count = 0;
|
||||
for (var cs in coll) {
|
||||
this.assert(cs.getCode() == "a = 1");
|
||||
this.assert(cs.id == "http://www.foo.com/bar.js");
|
||||
count += 1;
|
||||
}
|
||||
this.assert(count == 1, "count must be 1.");
|
||||
}
|
||||
|
||||
function testUtilsTrim() {
|
||||
// Taken from http://www.somacon.com/p355.php.
|
||||
this.assert(Utils.trim("\n hello ") == "hello");
|
||||
}
|
||||
|
||||
function testUtilsSortBy() {
|
||||
var strArray = ["abc", "d", "ef", "ghij", "klm", "nop", "qrstuvw", "xyz"];
|
||||
this.assertEquals(strArray.slice().sort() + "",
|
||||
|
@ -452,13 +414,9 @@ function testLocalUriCodeSourceWorksWithBadFilenames() {
|
|||
"file:///truly-nonexistent",
|
||||
"resource://truly-nonexistent",
|
||||
"ubiquity:///truly-nonexistent"];
|
||||
var self = this;
|
||||
|
||||
urls.forEach(
|
||||
function(url) {
|
||||
var lucs = new LocalUriCodeSource(url);
|
||||
self.assertEquals(lucs.getCode(true), "");
|
||||
});
|
||||
urls.forEach(function(url) {
|
||||
this.assertEquals(new LocalUriCodeSource(url).getCode(true), "");
|
||||
}, this);
|
||||
}
|
||||
|
||||
function testUtilsGetLocalUrlWorks() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче