Bug 982680. Fix regress-406572.js to actually test something useful. r=peterv,waldo
authorBoris Zbarsky <bzbarsky@mit.edu>
Sat, 29 Mar 2014 01:45:09 -0400
changeset 194529 265e35a94cc5f72005988d41ed4f4abe8365125d
parent 194528 3dc94091255a09dd473db24617dc1c7a5ad151b8
child 194530 e45db0a68b4f805d3beefbd3d1c1a0b1f501f4a3
push id3624
push userasasaki@mozilla.com
push dateMon, 09 Jun 2014 21:49:01 +0000
treeherdermozilla-beta@b1a5da15899a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspeterv, waldo
bugs982680, 406572
milestone31.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 982680. Fix regress-406572.js to actually test something useful. r=peterv,waldo
js/src/tests/js1_5/extensions/regress-406572.js
--- a/js/src/tests/js1_5/extensions/regress-406572.js
+++ b/js/src/tests/js1_5/extensions/regress-406572.js
@@ -9,29 +9,36 @@ var summary = 'JSOP_CLOSURE unconditiona
 var actual = '';
 var expect = '';
 
 printBugNumber(BUGNUMBER);
 printStatus (summary);
 
 if (typeof window != 'undefined')
 {
-  var s = self;
+  try {
+    actual = "FAIL: Unexpected exception thrown";
 
-  document.writeln(uneval(self));
-  self = 1;
-  document.writeln(uneval(self));
+    var win = window;
+    var windowString = String(window);
+    window = 1;
+    reportCompare(windowString, String(window), "window should be readonly");
+
+    actual = ""; // We should reach this line, and throw an exception after it
 
-  if (1)
-    function self() { return 1; }
+    if (1)
+      function window() { return 1; }
+
+    actual = "FAIL: this line should never be reached";
 
-  document.writeln(uneval(self));
-
-  // The test harness might rely on self having its original value: restore it.
-  self = s;
+    // The test harness might rely on window having its original value:
+    // restore it.
+    window = win;
+  } catch (e) {
+  }
 }
 else
 {
   expect = actual = 'Test can only run in a Gecko 1.9 browser or later.';
   print(actual);
 }
 reportCompare(expect, actual, summary);