Bug 823228 part 1. Make browser-test.js ignore indexed properties on the window when determining whether a test leaked properties onto the global. r=dao
authorBoris Zbarsky <bzbarsky@mit.edu>
Thu, 17 Jan 2013 12:30:36 -0500
changeset 119160 43511e31bf92e8613d0772fbfbab1b6e90ffccd6
parent 119159 697dc09bdc2a8de4473ac3e1e0a4f83eb1f909a3
child 119161 a46302d16d2006567836b20f5611d541652b3aa5
push id24195
push userMs2ger@gmail.com
push dateSat, 19 Jan 2013 16:10:11 +0000
treeherderautoland@02e12a80aef9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdao
bugs823228
milestone21.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 823228 part 1. Make browser-test.js ignore indexed properties on the window when determining whether a test leaked properties onto the global. r=dao
testing/mochitest/browser-test.js
--- a/testing/mochitest/browser-test.js
+++ b/testing/mochitest/browser-test.js
@@ -249,16 +249,23 @@ Tester.prototype = {
         }
       };
 
       if (this.SimpleTest.isExpectingUncaughtException()) {
         this.currentTest.addResult(new testResult(false, "expectUncaughtException was called but no uncaught exception was detected!", "", false));
       }
 
       Object.keys(window).forEach(function (prop) {
+        if (parseInt(prop) == prop) {
+          // This is a string which when parsed as an integer and then
+          // stringified gives the original string.  As in, this is in fact a
+          // string representation of an integer, so an index into
+          // window.frames.  Skip those.
+          return;
+        }
         if (this._globalProperties.indexOf(prop) == -1) {
           this._globalProperties.push(prop);
           if (this._globalPropertyWhitelist.indexOf(prop) == -1)
             this.currentTest.addResult(new testResult(false, "leaked window property: " + prop, "", false));
         }
       }, this);
 
       // Clear document.popupNode.  The test could have set it to a custom value