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

--HG--
extra : rebase_source : 7ff513eed5e9f4f353de59affb11cb04be3cbbaa
This commit is contained in:
Greg Mierzwinski 2017-06-05 12:35:53 -04:00
parent 68e7478636
commit d30da22f2d
2 changed files with 6 additions and 3 deletions

View File

@ -13,10 +13,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1323324
/** 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);
}

View File

@ -13,18 +13,20 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1323324
/** 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);
}