Bug 1272381 - Use chromeScript.sendSyncMessage to initialize array and avoid race in test a=testonly
MozReview-Commit-ID: DxdsE6zwHqK
--- a/netwerk/test/mochitests/test_user_agent_updates.html
+++ b/netwerk/test/mochitests/test_user_agent_updates.html
@@ -189,25 +189,28 @@ function testBadUpdate(callback) {
callback();
}, false);
document.getElementById('content').appendChild(ifr);
}, 5000); });
}
SimpleTest.waitForExplicitFinish();
SimpleTest.requestFlakyTimeout("Test sets timeouts to wait for updates to happen.");
-SimpleTest.requestCompleteLog();
SpecialPowers.pushPrefEnv({
set: [
[PREF_APP_UPDATE_TIMERMINIMUMDELAY, 0]
]
}, function () {
chromeScript.sendSyncMessage("UAO-uninit");
+ // Sets the OVERRIDES var in the chrome script.
+ // We do this to avoid code duplication.
+ chromeScript.sendSyncMessage("set-overrides", OVERRIDES);
+
// testProfileLoad, testDownload, and testProfileSave must run in this order
// because testDownload depends on testProfileLoad to call UAO.init()
// and testProfileSave depends on testDownload to save overrides to the profile
chromeScript.sendAsyncMessage("testProfileLoad", location.hostname);
});
const chromeScript = SpecialPowers.loadChromeScript(_ => {
@@ -354,14 +357,13 @@ chromeScript.addMessageListener("testPro
chromeScript.addMessageListener("is-message", function(params) {
let {value, expected, message} = params;
is(value, expected, message);
});
chromeScript.addMessageListener("info-message", function(message) {
info(message);
});
-chromeScript.sendAsyncMessage("set-overrides", OVERRIDES);
</script>
</pre>
</body>
</html>