Bug 1321182 - Register click handler before starting click test in browser_ext_contextMenus.js r=mixedpuppy
authorRob Wu <rob@robwu.nl>
Fri, 20 Jul 2018 17:43:42 +0200
changeset 821135 69529e9693b081a458261f38c1c433d84970a2a5
parent 821134 8b31d456f8cb28f3aa7adefabcaa1d5cb340d59b
child 821136 9649aefe9a6b245c04206080d2338e7b92da6cdf
push id117018
push userbmo:sfoster@mozilla.com
push dateSat, 21 Jul 2018 04:05:10 +0000
reviewersmixedpuppy
bugs1321182
milestone63.0a1
Bug 1321182 - Register click handler before starting click test in browser_ext_contextMenus.js r=mixedpuppy MozReview-Commit-ID: FkOjNm7Tgd5
browser/components/extensions/test/browser/browser_ext_contextMenus.js
--- a/browser/components/extensions/test/browser/browser_ext_contextMenus.js
+++ b/browser/components/extensions/test/browser/browser_ext_contextMenus.js
@@ -529,27 +529,27 @@ add_task(async function test_bookmark_co
         url,
         title,
         parentId: "toolbar_____",
       });
       await browser.contextMenus.create({
         title: "Get bookmark",
         contexts: ["bookmark"],
       });
-      browser.test.sendMessage("bookmark-created");
       browser.contextMenus.onClicked.addListener(async (info) => {
         browser.test.assertEq(newBookmark.id, info.bookmarkId, "Bookmark ID matches");
 
         let [bookmark] = await browser.bookmarks.get(info.bookmarkId);
         browser.test.assertEq(title, bookmark.title, "Bookmark title matches");
         browser.test.assertEq(url, bookmark.url, "Bookmark url matches");
         browser.test.assertFalse(info.hasOwnProperty("pageUrl"), "Context menu does not expose pageUrl");
         await browser.bookmarks.remove(info.bookmarkId);
         browser.test.sendMessage("test-finish");
       });
+      browser.test.sendMessage("bookmark-created");
     },
   });
   await extension.startup();
   await extension.awaitMessage("bookmark-created");
   let menu = await openChromeContextMenu(
     "placesContext",
     "#PersonalToolbar .bookmark-item:last-child");