Bug 1345284 - Move variable declarations in test_promise_argument.html, and test_promise_callback_retval.html. r=jmaher
authorGreg Mierzwinski <gmierz2@outlook.com>
Mon, 05 Jun 2017 12:35:53 -0400
changeset 410955 ab4f6b6cd8dd8897cd7bf7be4a05da4bca1ecc48
parent 410954 50a90931ab2e1f58a48a8eb7f064a5dda9f73116
child 410956 4aaf7ad4fef8d318688e9a4c3ceb74bc75b7153d
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs1345284
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
dom/promise/tests/test_promise_argument.html
dom/promise/tests/test_promise_callback_retval.html
--- 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));