mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-15 06:15:43 +00:00
Bug 991668 - resolve promises on next tick to avoid "too much recursion" error when exporting bookmarks.html. r=Yoric
This commit is contained in:
parent
dca9b6269a
commit
34bc2b594f
@ -118,6 +118,13 @@ function notifyObservers(aTopic, aInitialImport) {
|
||||
: "html");
|
||||
}
|
||||
|
||||
function promiseSoon() {
|
||||
let deferred = Promise.defer();
|
||||
Services.tm.mainThread.dispatch(deferred.resolve,
|
||||
Ci.nsIThread.DISPATCH_NORMAL);
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
this.BookmarkHTMLUtils = Object.freeze({
|
||||
/**
|
||||
* Loads the current bookmarks hierarchy from a "bookmarks.html" file.
|
||||
@ -1089,6 +1096,10 @@ BookmarkExporter.prototype = {
|
||||
},
|
||||
|
||||
_writeItem: function (aItem, aIndent) {
|
||||
// This is a workaround for "too much recursion" error, due to the fact
|
||||
// Task.jsm still uses old on-same-tick promises. It may be removed as
|
||||
// soon as bug 887923 is fixed.
|
||||
yield promiseSoon();
|
||||
let uri = null;
|
||||
try {
|
||||
uri = NetUtil.newURI(aItem.uri);
|
||||
|
Loading…
Reference in New Issue
Block a user