Bug 1345284 - Move variable declarations in test_promise_argument.html, and test_promise_callback_retval.html. r?jmaher
This patch fixes an intermittent bug with the test "test_webassembly_compile.html". That test calls the garbage collector which destroys the variables declared within the function-level scopes in the tests "test_promise_argument.html", and "test_promise_callback_retval.html". Declaring them outside the function scope prevents the variables from being destroyed.
MozReview-Commit-ID: 7dMwavRqnFg
--- a/dom/promise/tests/test_promise_argument.html
+++ b/dom/promise/tests/test_promise_argument.html
@@ -8,20 +8,21 @@ https://bugzilla.mozilla.org/show_bug.cg
<title>Test for Bug 1323324</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script src="file_promise_argument_tests.js"></script>
<script type="application/javascript">
/** Test for Bug 1323324 **/
SimpleTest.waitForExplicitFinish();
+ var globalWrapper;
function verifyPromiseGlobal(p, global, msg) {
// SpecialPowers.Cu.getGlobalForObject returns a SpecialPowers wrapper for
// the actual global. We want to grab the underlying object.
- var globalWrapper = SpecialPowers.Cu.getGlobalForObject(p);
+ globalWrapper = SpecialPowers.Cu.getGlobalForObject(p);
is(SpecialPowers.unwrap(globalWrapper), global,
msg + " should come from " + global.label);
}
const isXrayArgumentTest = false;
function getPromise(global, arg) {
return global.TestFunctions.passThroughPromise(arg);
--- a/dom/promise/tests/test_promise_callback_retval.html
+++ b/dom/promise/tests/test_promise_callback_retval.html
@@ -8,28 +8,30 @@ https://bugzilla.mozilla.org/show_bug.cg
<title>Test for Bug 1323324</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script src="file_promise_argument_tests.js"></script>
<script type="application/javascript">
/** Test for Bug 1323324 **/
SimpleTest.waitForExplicitFinish();
+ var globalWrapper;
function verifyPromiseGlobal(p, global, msg) {
// SpecialPowers.Cu.getGlobalForObject returns a SpecialPowers wrapper for
// the actual global. We want to grab the underlying object.
- var globalWrapper = SpecialPowers.Cu.getGlobalForObject(p);
+ globalWrapper = SpecialPowers.Cu.getGlobalForObject(p);
is(SpecialPowers.unwrap(globalWrapper), global,
msg + " should come from " + global.label);
}
const isXrayArgumentTest = false;
+ var func;
function getPromise(global, arg) {
- var func = new global.Function("x", "return x").bind(undefined, arg);
+ func = new global.Function("x", "return x").bind(undefined, arg);
return TestFunctions.passThroughCallbackPromise(func);
}
addLoadEvent(function() {
frames[0].label = "child";
SpecialPowers.pushPrefEnv({set: [['dom.expose_test_interfaces', true]]},
runPromiseArgumentTests.bind(undefined,
SimpleTest.finish));