Backed out changeset 1f1f058843cc (bug 860625) for xpcshell failures.

This commit is contained in:
Ryan VanderMeulen 2013-05-20 14:13:09 -04:00
parent 631226ee90
commit bbda6fe4ec

View File

@ -528,7 +528,7 @@ BookmarkExporter.prototype = {
false).root;
// Serialize to JSON and write to stream.
yield BookmarkNode.serializeAsJSONToOutputStream(root, streamProxy, false, false,
BookmarkNode.serializeAsJSONToOutputStream(root, streamProxy, false, false,
excludeItems);
root.containerOpen = false;
}
@ -552,27 +552,23 @@ let BookmarkNode = {
* Converts folder shortcuts into actual folders.
* @param aExcludeItems
* An array of item ids that should not be written to the backup.
* @returns Task promise
*/
serializeAsJSONToOutputStream: function BN_serializeAsJSONToOutputStream(
aNode, aStream, aIsUICommand, aResolveShortcuts, aExcludeItems) {
return Task.spawn(function() {
// Serialize to stream
let array = [];
if (yield this._appendConvertedNode(aNode, null, array, aIsUICommand,
if (this._appendConvertedNode(aNode, null, array, aIsUICommand,
aResolveShortcuts, aExcludeItems)) {
let json = JSON.stringify(array[0]);
aStream.write(json, json.length);
} else {
throw Cr.NS_ERROR_UNEXPECTED;
}
}.bind(this));
},
_appendConvertedNode: function BN__appendConvertedNode(
bNode, aIndex, aArray, aIsUICommand, aResolveShortcuts, aExcludeItems) {
return Task.spawn(function() {
let node = {};
// Set index in order received
@ -589,7 +585,7 @@ let BookmarkNode = {
if (PlacesUtils.nodeIsURI(bNode)) {
// Tag root accept only folder nodes
if (parent && parent.itemId == PlacesUtils.tagsFolderId)
throw new Task.Result(false);
return false;
// Check for url validity, since we can't halt while writing a backup.
// This will throw if we try to serialize an invalid url and it does
@ -597,14 +593,14 @@ let BookmarkNode = {
try {
NetUtil.newURI(bNode.uri);
} catch (ex) {
throw new Task.Result(false);
return false;
}
yield this._addURIProperties(bNode, node, aIsUICommand);
this._addURIProperties(bNode, node, aIsUICommand);
} else if (PlacesUtils.nodeIsContainer(bNode)) {
// Tag containers accept only uri nodes
if (grandParent && grandParent.itemId == PlacesUtils.tagsFolderId)
throw new Task.Result(false);
return false;
this._addContainerProperties(bNode, node, aIsUICommand,
aResolveShortcuts);
@ -613,19 +609,18 @@ let BookmarkNode = {
// Tag containers accept only uri nodes
if ((parent && parent.itemId == PlacesUtils.tagsFolderId) ||
(grandParent && grandParent.itemId == PlacesUtils.tagsFolderId))
throw new Task.Result(false);
return false;
this._addSeparatorProperties(bNode, node);
}
if (!node.feedURI && node.type == PlacesUtils.TYPE_X_MOZ_PLACE_CONTAINER) {
throw new Task.Result(yield this._appendConvertedComplexNode(node, bNode, aArray, aIsUICommand,
aResolveShortcuts, aExcludeItems));
return this._appendConvertedComplexNode(node, bNode, aArray, aIsUICommand,
aResolveShortcuts, aExcludeItems);
}
aArray.push(node);
throw new Task.Result(true);
}.bind(this));
return true;
},
_addGenericProperties: function BN__addGenericProperties(
@ -669,7 +664,6 @@ let BookmarkNode = {
_addURIProperties: function BN__addURIProperties(
aPlacesNode, aJSNode, aIsUICommand) {
return Task.spawn(function() {
aJSNode.type = PlacesUtils.TYPE_X_MOZ_PLACE;
aJSNode.uri = aPlacesNode.uri;
if (aJSNode.id && aJSNode.id != -1) {
@ -685,10 +679,9 @@ let BookmarkNode = {
// Last character-set
let uri = NetUtil.newURI(aPlacesNode.uri);
let lastCharset = yield PlacesUtils.getCharsetForURI(uri)
let lastCharset = PlacesUtils.history.getCharsetForURI(uri);
if (lastCharset)
aJSNode.charset = lastCharset;
});
},
_addSeparatorProperties: function BN__addSeparatorProperties(
@ -734,7 +727,6 @@ let BookmarkNode = {
_appendConvertedComplexNode: function BN__appendConvertedComplexNode(
aNode, aSourceNode, aArray, aIsUICommand, aResolveShortcuts,
aExcludeItems) {
return Task.spawn(function() {
let repr = {};
for (let [name, value] in Iterator(aNode))
@ -752,7 +744,7 @@ let BookmarkNode = {
let childNode = aSourceNode.getChild(i);
if (aExcludeItems && aExcludeItems.indexOf(childNode.itemId) != -1)
continue;
yield this._appendConvertedNode(aSourceNode.getChild(i), i, children,
this._appendConvertedNode(aSourceNode.getChild(i), i, children,
aIsUICommand, aResolveShortcuts,
aExcludeItems);
}
@ -761,7 +753,6 @@ let BookmarkNode = {
}
aArray.push(repr);
throw new Task.Result(true);
}.bind(this));
return true;
}
}