summaryrefslogtreecommitdiffstats
path: root/js/src/tests/js1_5/extensions/regress-406572.js
blob: 4911d05bc7b748d3698ea14eba52c03998c80ec5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

//-----------------------------------------------------------------------------
var BUGNUMBER = 406572;
var summary = 'JSOP_CLOSURE unconditionally replaces properties of the variable object - Browser only';
var actual = '';
var expect = '';

printBugNumber(BUGNUMBER);
printStatus (summary);

if (typeof window != 'undefined')
{
  try {
    actual = "FAIL: Unexpected exception thrown";

    var win = window;
    var windowString = String(window);
    window = 1;
    reportCompare(windowString, String(window), "window should be readonly");

    if (1)
      function window() { return 1; }

    // We should reach this line without throwing. Annex B means the
    // block-scoped function above gets an assignment to 'window' in the
    // nearest 'var' environment, but since 'window' is read-only, the
    // assignment silently fails.
    actual = "";

    // 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);