From 28124f15ce09b6656e799d60923fedad568fe35f Mon Sep 17 00:00:00 2001 From: Paolo Amadini Date: Thu, 20 Mar 2014 11:01:39 +0100 Subject: [PATCH] Bug 985523 - Convert to Promise.jsm in Places. r=mak --- toolkit/components/places/PlacesUtils.jsm | 2 +- toolkit/components/places/tests/browser/head.js | 2 +- toolkit/components/places/tests/head_common.js | 2 +- toolkit/components/places/tests/unit/test_result_sort.js | 8 +++++--- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/toolkit/components/places/PlacesUtils.jsm b/toolkit/components/places/PlacesUtils.jsm index 5124f9aa7414..1c2a9a85066b 100644 --- a/toolkit/components/places/PlacesUtils.jsm +++ b/toolkit/components/places/PlacesUtils.jsm @@ -42,7 +42,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "Task", "resource://gre/modules/Task.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "Promise", - "resource://gre/modules/commonjs/sdk/core/promise.js"); + "resource://gre/modules/Promise.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "Deprecated", "resource://gre/modules/Deprecated.jsm"); diff --git a/toolkit/components/places/tests/browser/head.js b/toolkit/components/places/tests/browser/head.js index c381f4f62962..39ae3f3c3b0e 100644 --- a/toolkit/components/places/tests/browser/head.js +++ b/toolkit/components/places/tests/browser/head.js @@ -6,7 +6,7 @@ const TRANSITION_TYPED = Ci.nsINavHistoryService.TRANSITION_TYPED; Components.utils.import("resource://gre/modules/NetUtil.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "Promise", - "resource://gre/modules/commonjs/sdk/core/promise.js"); + "resource://gre/modules/Promise.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "Task", "resource://gre/modules/Task.jsm"); diff --git a/toolkit/components/places/tests/head_common.js b/toolkit/components/places/tests/head_common.js index 366b926b1b58..780cd34436a0 100644 --- a/toolkit/components/places/tests/head_common.js +++ b/toolkit/components/places/tests/head_common.js @@ -27,7 +27,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "FileUtils", XPCOMUtils.defineLazyModuleGetter(this, "NetUtil", "resource://gre/modules/NetUtil.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "Promise", - "resource://gre/modules/commonjs/sdk/core/promise.js"); + "resource://gre/modules/Promise.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "Services", "resource://gre/modules/Services.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "Task", diff --git a/toolkit/components/places/tests/unit/test_result_sort.js b/toolkit/components/places/tests/unit/test_result_sort.js index 049b24313a62..3431287dec0c 100644 --- a/toolkit/components/places/tests/unit/test_result_sort.js +++ b/toolkit/components/places/tests/unit/test_result_sort.js @@ -112,12 +112,14 @@ add_task(function test() { checkOrder(id1, id3, id2); // Add a visit, then check frecency ordering. - yield promiseAddVisits({ uri: uri2, - transition: TRANSITION_TYPED}); + // When the bookmarks service gets onVisit, it asynchronously fetches all // items for that visit, and then notifies onItemVisited. Thus we must // explicitly wait for that. - yield promiseOnItemVisited(); + let waitForVisited = promiseOnItemVisited(); + yield promiseAddVisits({ uri: uri2, + transition: TRANSITION_TYPED}); + yield waitForVisited; do_print("Sort by frecency desc"); result.sortingMode = NHQO.SORT_BY_FRECENCY_DESCENDING;