From 0ade9bae36ea0e55df258e3a2db2febbbb7acc1d Mon Sep 17 00:00:00 2001 From: "arv@chromium.org" Date: Fri, 4 Jun 2010 16:54:42 +0000 Subject: Bookmarks: Fix a script error when deleting multiple folders. When deleting multiple folders we get callback after each remove and this can trigger a selection change which in turn triggers a call to getSubtree for a folder that was just removed. When this happens we finish the Promise with the value undefined. BUG=None TEST=Create two folders and select both. Hit Delete and check that we do not get a script error. (We still get an error from the extension API that the id no longer exists but at least we do not keel over. Review URL: http://codereview.chromium.org/2647001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48938 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/resources/bookmark_manager/js/bmm.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'chrome') diff --git a/chrome/browser/resources/bookmark_manager/js/bmm.js b/chrome/browser/resources/bookmark_manager/js/bmm.js index b02d850..f3d824aa 100644 --- a/chrome/browser/resources/bookmark_manager/js/bmm.js +++ b/chrome/browser/resources/bookmark_manager/js/bmm.js @@ -3,7 +3,6 @@ // found in the LICENSE file. cr.define('bmm', function() { - const TreeIterator = bmm.TreeIterator; const Promise = cr.Promise; /** @@ -44,7 +43,7 @@ cr.define('bmm', function() { loadingPromises[id] = new Promise; chrome.experimental.bookmarkManager.getSubtree(id, false, function(nodes) { - loadingPromises[id].value = nodes[0]; + loadingPromises[id].value = nodes && nodes[0]; delete loadingPromises[id]; }); } -- cgit v1.1