Bug 1151694 - Part 4 - Able to use testcommon.js in the window which has no opener. r=bbirtles
authorHiroyuki Ikezoe <hiikezoe@mozilla-japan.org>
Thu, 10 Sep 2015 19:17:00 +0200
changeset 295618 80b4c268049fc680ad6934262155758175941039
parent 295617 81a35d84fb974c3932071b28bbe9c1c738a1a9f0
child 295619 328191c5dbbad33652ffc0865b23fc3c12a25094
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbirtles
bugs1151694
milestone43.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 1151694 - Part 4 - Able to use testcommon.js in the window which has no opener. r=bbirtles
dom/animation/test/testcommon.js
--- a/dom/animation/test/testcommon.js
+++ b/dom/animation/test/testcommon.js
@@ -84,25 +84,27 @@ function waitForAllAnimations(animations
  * to be computed so that when we synchronouslyet set it to a different value
  * we actually get a transition instead of that being the initial value.
  */
 function flushComputedStyle(elem) {
   var cs = window.getComputedStyle(elem);
   cs.marginLeft;
 }
 
-for (var funcName of ["async_test", "assert_not_equals", "assert_equals",
-                      "assert_approx_equals", "assert_less_than",
-                      "assert_less_than_equal", "assert_between_inclusive",
-                      "assert_true", "assert_false",
-                      "assert_class_string", "assert_throws",
-                      "assert_unreached", "test"]) {
-  window[funcName] = opener[funcName].bind(opener);
-}
+if (opener) {
+  for (var funcName of ["async_test", "assert_not_equals", "assert_equals",
+                        "assert_approx_equals", "assert_less_than",
+                        "assert_less_than_equal", "assert_between_inclusive",
+                        "assert_true", "assert_false",
+                        "assert_class_string", "assert_throws",
+                        "assert_unreached", "test"]) {
+    window[funcName] = opener[funcName].bind(opener);
+  }
 
-window.EventWatcher = opener.EventWatcher;
+  window.EventWatcher = opener.EventWatcher;
 
-function done() {
-  opener.add_completion_callback(function() {
-    self.close();
-  });
-  opener.done();
+  function done() {
+    opener.add_completion_callback(function() {
+      self.close();
+    });
+    opener.done();
+  }
 }