summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/js/script-tests/global-function-resolve.js
blob: 138768b2a8cf9c1fac98c4c86feb6afe73c68273 (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
description("Test to make sure cached lookups on the global object are performed correctly.");

var functionNames = [
    'addEventListener',
    'alert',
    'clearInterval',
    'clearTimeout',
    'clientInformation',
    'close',
    'closed',
    'confirm',
    'console',
    'crypto',
    'defaultStatus',
    'defaultstatus',
    'description',
    'devicePixelRatio',
    'dispatchEvent',
    'document',
    'getComputedStyle',
    'getMatchedCSSRules',
    'getSelection',
    'history',
    'innerHeight',
    'innerWidth',
    'location',
    'locationbar',
    'menubar',
    'moveBy',
    'moveTo',
    'name',
    'navigator',
    'open',
    'openDatabase',
    'opener',
    'outerHeight',
    'outerWidth',
    'pageXOffset',
    'pageYOffset',
    'parent',
    'prompt',
    'releaseEvents',
    'removeEventListener',
    'resizeBy',
    'resizeTo',
    'screen',
    'screenLeft',
    'screenTop',
    'screenX',
    'screenY',
    'scroll',
    'scrollBy',
    'scrollTo',
    'scrollX',
    'scrollY',
    'setInterval',
    'setTimeout',
    'showModalDialog',
    'status',
    'stop',
    'window',
];

var cachedFunctions = [];
for (var i = 0; i < functionNames.length; i++)
    cachedFunctions[i] = new Function("return " + functionNames[i]);

for (var i = 0; i < functionNames.length; i++) {
    shouldBe("cachedFunctions["+i+"]()", functionNames[i]);
    shouldBe("cachedFunctions["+i+"]()", functionNames[i]);
}