Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 /*
7 * Date: 15 Feb 2001
8 *
9 * SUMMARY: calling obj.eval(str)
10 *
11 * See http://bugzilla.mozilla.org/show_bug.cgi?id=68498
12 * See http://bugzilla.mozilla.org/showattachment.cgi?attach_id=25251
13 *
14 * Brendan:
15 *
16 * "Backward compatibility: support calling obj.eval(str), which evaluates
17 * str using obj as the scope chain and variable object."
18 */
19 //-----------------------------------------------------------------------------
20 var BUGNUMBER = 68498;
21 var summary = 'Testing calling obj.eval(str)';
22 var statprefix = '; currently at expect[';
23 var statsuffix = '] within test -';
24 var actual = [ ];
25 var expect = [ ];
28 // Capture a reference to the global object -
29 var self = this;
31 // This function is the heart of the test -
32 function f(s) {self.eval(s); return y;}
35 // Set the actual-results array -
36 actual[0] = f('var y = 43');
37 actual[1] = 'y' in self && y;
38 actual[2] = delete y;
39 actual[3] = 'y' in self;
41 // Set the expected-results array -
42 expect[0] = 43;
43 expect[1] = 43;
44 expect[2] = true;
45 expect[3] = false;
48 //-------------------------------------------------------------------------------------------------
49 test();
50 //-------------------------------------------------------------------------------------------------
53 function test()
54 {
55 enterFunc ('test');
56 printBugNumber(BUGNUMBER);
57 printStatus (summary);
59 for (var i in expect)
60 {
61 reportCompare(expect[i], actual[i], getStatus(i));
62 }
64 exitFunc ('test');
65 }
68 function getStatus(i)
69 {
70 return (summary + statprefix + i + statsuffix);
71 }