From b4cdfc984115915be35775d1e3d9f5e79e3595c4 Mon Sep 17 00:00:00 2001 From: Luca Greco Date: Tue, 29 Jan 2019 15:50:42 +0000 Subject: [PATCH] Bug 1258897 - Fix test_ext_sendmessage_reply2.html intermittency and re-enable. r=mixedpuppy This patch should fix the test_ext_sendmessage_reply2.html intermittency which, based on the timeout failure that I've been able to intermittently reproduce when running this test locally using --verify, seems to be likely due to the following race: the tabs.create API (used to create the extension tabs used as part of the tests) was called right before subscribing the extension message listeners, and so from time to time the extension tabs were not able to successfully send their messages to the background page listeners (because the background page didn't subscribe the listeners yet) and as a result the test was getting stuck waiting for extension messages that were never going to be received. Differential Revision: https://phabricator.services.mozilla.com/D17849 --HG-- extra : moz-landing-system : lando --- .../components/extensions/test/mochitest/mochitest-common.ini | 1 - .../test/mochitest/test_ext_sendmessage_reply2.html | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/toolkit/components/extensions/test/mochitest/mochitest-common.ini b/toolkit/components/extensions/test/mochitest/mochitest-common.ini index 8f0a0f167206..7b3bd3dd12ca 100644 --- a/toolkit/components/extensions/test/mochitest/mochitest-common.ini +++ b/toolkit/components/extensions/test/mochitest/mochitest-common.ini @@ -109,7 +109,6 @@ skip-if = (toolkit == 'android') # bug 1342577 [test_ext_sendmessage_no_receiver.html] [test_ext_sendmessage_reply.html] [test_ext_sendmessage_reply2.html] -skip-if = true # Bug 1258897 [test_ext_storage_manager_capabilities.html] scheme=https [test_ext_subframes_privileges.html] diff --git a/toolkit/components/extensions/test/mochitest/test_ext_sendmessage_reply2.html b/toolkit/components/extensions/test/mochitest/test_ext_sendmessage_reply2.html index 348c4ca54d6e..c20a96fda258 100644 --- a/toolkit/components/extensions/test/mochitest/test_ext_sendmessage_reply2.html +++ b/toolkit/components/extensions/test/mochitest/test_ext_sendmessage_reply2.html @@ -14,8 +14,6 @@ "use strict"; function backgroundScript(token, id, otherId) { - browser.tabs.create({url: "tab.html"}); - browser.runtime.onMessage.addListener((msg, sender, sendReply) => { browser.test.assertEq(id, sender.id, `${id}: Got expected sender ID`); @@ -51,6 +49,8 @@ function backgroundScript(token, id, otherId) { browser.test.fail(`${id}: Unexpected runtime external message received: ${msg} ${uneval(sender)}`); } }); + + browser.tabs.create({url: "tab.html"}); } function contentScript(token, id, otherId) {