Bug 630838 - Clear document.popupNode between browser chrome tests.
authorMarco Bonardo <mbonardo@mozilla.com>
Wed, 02 Feb 2011 17:00:47 +0100
changeset 61778 dc93a523cdbd0330a81e49c290da7a2099386015
parent 61777 837cbbef3695a32342bd65f72d638c8d16969de9
child 61779 17b4a1ed16af5fa748ff9557b7cd05333516c623
push id18486
push usermak77@bonardo.net
push dateWed, 02 Feb 2011 16:02:40 +0000
treeherdermozilla-central@7abdd2abd9cb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs630838
milestone2.0b11pre
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 630838 - Clear document.popupNode between browser chrome tests. r=mano, gavin a=tests-only
testing/mochitest/browser-test.js
testing/mochitest/tests/browser/Makefile.in
testing/mochitest/tests/browser/browser_popupNode.js
testing/mochitest/tests/browser/browser_popupNode_check.js
--- a/testing/mochitest/browser-test.js
+++ b/testing/mochitest/browser-test.js
@@ -164,16 +164,21 @@ Tester.prototype = {
         try {
           func.apply(testScope);
         }
         catch (ex) {
           this.currentTest.addResult(new testResult(false, "Cleanup function threw an exception", ex, false));
         }
       };
 
+      // Clear document.popupNode.  The test could have set it to a custom value
+      // for its own purposes, nulling it out it will go back to the default
+      // behavior of returning the last opened popup.
+      document.popupNode = null;
+
       // Note the test run time
       let time = Date.now() - this.lastStartTime;
       this.dumper.dump("INFO TEST-END | " + this.currentTest.path + " | finished in " + time + "ms\n");
       this.currentTest.setDuration(time);
     }
 
     // Check the window state for the current test before moving to the next one.
     // This also causes us to check before starting any tests, since nextTest()
--- a/testing/mochitest/tests/browser/Makefile.in
+++ b/testing/mochitest/tests/browser/Makefile.in
@@ -45,16 +45,18 @@ include $(DEPTH)/config/autoconf.mk
 include $(topsrcdir)/config/rules.mk
 
 _BROWSER_TEST_FILES = \
 	                  head.js \
 	                  browser_head.js \
 	                  browser_pass.js \
 	                  browser_async.js \
 	                  browser_privileges.js \
+	                  browser_popupNode.js \
+	                  browser_popupNode_check.js \
 # Disabled, these are only good for testing the harness' failure reporting
 #	                  browser_zz_fail_openwindow.js \
 #	                  browser_fail.js \
 #	                  browser_fail_async_throw.js \
 #	                  browser_fail_fp.js \
 #	                  browser_fail_pf.js \
 #	                  browser_fail_throw.js \
 #	                  browser_fail_timeout.js \
new file mode 100644
--- /dev/null
+++ b/testing/mochitest/tests/browser/browser_popupNode.js
@@ -0,0 +1,4 @@
+function test() {
+  document.popupNode = document;
+  isnot(document.popupNode, null, "document.popupNode has been correctly set");
+}
new file mode 100644
--- /dev/null
+++ b/testing/mochitest/tests/browser/browser_popupNode_check.js
@@ -0,0 +1,3 @@
+function test() {
+  is(document.popupNode, null, "document.popupNode has been correctly cleared");
+}