Debian Codegraph @

rhino/testsrc/tests/js1_5/extensions/regress-340199.js

raw symbols SCIP
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/. */
5
6 var gTestfile = 'regress-340199.js';
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 340199;
9 var summary = 'User-defined __iterator__ can be called through XPCNativeWrappers';
10 var actual = 'Not called';
11 var expect = 'Not called';
12
13 printBugNumber(BUGNUMBER);
14 printStatus (summary);
15
16 if (typeof window == 'undefined' ||
17 typeof XPCNativeWrapper == 'undefined')
18 {
19 reportCompare("window or XPCNativeWrapper not defined, Test skipped.",
20 "window or XPCNativeWrapper not defined, Test skipped.",
21 summary);
22 }
23 else
24 {
25 Object.prototype.__iterator__ =
26 function () { actual = "User code called"; print(actual); };
27
28 try
29 {
30 for (var i in XPCNativeWrapper(window))
31 {
32 try
33 {
34 print(i);
35 }
36 catch(ex)
37 {
38 print(ex);
39 }
40 }
41 }
42 catch(ex)
43 {
44 }
45
46 // prevent this from messing up enumerators when shutting down test.
47 delete Object.prototype.__iterator__;
48 }
49
50 reportCompare(expect, actual, summary);