Backed out changeset 90abee1a4bc0 (bug 1142217) for bc1-e10s orange

This commit is contained in:
Wes Kocher 2015-03-12 17:19:39 -07:00
Родитель 2e3deba778
Коммит d8fe04f804
3 изменённых файлов: 5 добавлений и 59 удалений

Просмотреть файл

@ -194,8 +194,6 @@ ReadingListImpl.prototype = {
this._invalidateIterators();
let item = this._itemFromObject(obj);
this._callListeners("onItemAdded", item);
let mm = Cc["@mozilla.org/globalmessagemanager;1"].getService(Ci.nsIMessageListenerManager);
mm.broadcastAsyncMessage("Reader:Added", item);
return item;
}),
@ -236,23 +234,9 @@ ReadingListImpl.prototype = {
item.list = null;
this._itemsByURL.delete(item.url);
this._invalidateIterators();
let mm = Cc["@mozilla.org/globalmessagemanager;1"].getService(Ci.nsIMessageListenerManager);
mm.broadcastAsyncMessage("Reader:Removed", item);
this._callListeners("onItemDeleted", item);
}),
/**
* Find any item that matches a given URL - either the item's URL, or its
* resolved URL.
*
* @param {String/nsIURI} uri - URI to match against. This will be normalized.
*/
getItemForURL: Task.async(function* (uri) {
let url = this._normalizeURI(uri).spec;
let [item] = yield this.iterator({url: url}, {resolvedURL: url}).items(1);
return item;
}),
/**
* Adds a listener that will be notified when the list changes. Listeners
* are objects with the following optional methods:
@ -304,22 +288,6 @@ ReadingListImpl.prototype = {
// A Set containing listener objects.
_listeners: null,
/**
* Normalize a URI, stripping away extraneous parts we don't want to store
* or compare against.
*
* @param {nsIURI/String} uri - URI to normalize.
* @returns {nsIURI} Cloned and normalized version of the input URI.
*/
_normalizeURI(uri) {
if (typeof uri == "string") {
uri = Services.io.newURI(uri, "", null);
}
uri = uri.cloneIgnoringRef();
uri.userPass = "";
return uri;
},
/**
* Returns the ReadingListItem represented by the given simple object. If
* the item doesn't exist yet, it's created first.
@ -381,8 +349,6 @@ ReadingListImpl.prototype = {
},
};
let _unserializable = () => {}; // See comments in the ReadingListItem ctor.
/**
* An item in a reading list.
*
@ -393,18 +359,6 @@ let _unserializable = () => {}; // See comments in the ReadingListItem ctor.
*/
function ReadingListItem(props={}) {
this._properties = {};
// |this._unserializable| works around a problem when sending one of these
// items via a message manager. If |this.list| is set, the item can't be
// transferred directly, so .toJSON is implicitly called and the object
// returned via that is sent. However, once the item is deleted and |this.list|
// is null, the item *can* be directly serialized - so the message handler
// sees the "raw" object - ie, it sees "_properties" etc.
// We work around this problem by *always* having an unserializable property
// on the object - this way the implicit .toJSON call is always made, even
// when |this.list| is null.
this._unserializable = _unserializable;
this.setProperties(props, false);
}
@ -876,7 +830,7 @@ function hash(str) {
hasher.updateFromStream(stream, -1);
let binaryStr = hasher.finish(false);
let hexStr =
[("0" + binaryStr.charCodeAt(i).toString(16)).slice(-2) for (i in binaryStr)].
[("0" + binaryStr.charCodeAt(i).toString(16)).slice(-2) for (i in hash)].
join("");
return hexStr;
}

Просмотреть файл

@ -697,7 +697,7 @@ function hash(str) {
hasher.updateFromStream(stream, -1);
let binaryStr = hasher.finish(false);
let hexStr =
[("0" + binaryStr.charCodeAt(i).toString(16)).slice(-2) for (i in binaryStr)].
[("0" + binaryStr.charCodeAt(i).toString(16)).slice(-2) for (i in hash)].
join("");
return hexStr;
}

Просмотреть файл

@ -14,7 +14,6 @@ Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Task.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "ReaderMode", "resource://gre/modules/ReaderMode.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "ReadingList", "resource:///modules/readinglist/ReadingList.jsm");
const gStringBundle = Services.strings.createBundle("chrome://global/locale/aboutReader.properties");
@ -43,7 +42,7 @@ let ReaderParent = {
receiveMessage: function(message) {
switch (message.name) {
case "Reader:AddToList":
ReadingList.addItem(message.data.article);
// XXX: To implement.
break;
case "Reader:ArticleGet":
@ -60,18 +59,11 @@ let ReaderParent = {
break;
}
case "Reader:ListStatusRequest":
ReadingList.count(message.data).then(count => {
let mm = message.target.messageManager
mm.sendAsyncMessage("Reader:ListStatusData",
{ inReadingList: !!count, url: message.data.url });
});
// XXX: To implement.
break;
case "Reader:RemoveFromList":
// We need to get the "real" item to delete it.
ReadingList.getItemForURL(message.data.url).then(item => {
ReadingList.deleteItem(item)
});
// XXX: To implement.
break;
case "Reader:Share":