View Javadoc
1   /*
2    * Copyright (c) 2002-2025 Gargoyle Software Inc.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * https://www.apache.org/licenses/LICENSE-2.0
8    *
9    * Unless required by applicable law or agreed to in writing, software
10   * distributed under the License is distributed on an "AS IS" BASIS,
11   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12   * See the License for the specific language governing permissions and
13   * limitations under the License.
14   */
15  package org.htmlunit.javascript;
16  
17  import org.htmlunit.WebDriverTestCase;
18  import org.htmlunit.junit.annotation.Alerts;
19  import org.htmlunit.junit.annotation.HtmlUnitNYI;
20  import org.junit.jupiter.api.Test;
21  
22  /**
23   * Array is a native JavaScript object and therefore provided by Rhino but behavior should be
24   * different depending on the simulated browser.
25   *
26   * @author Marc Guillemot
27   * @author Frank Danek
28   * @author Ahmed Ashour
29   * @author Ronald Brill
30   */
31  public class NativeArrayTest extends WebDriverTestCase {
32  
33      /**
34       * Test for sort algorithm used (when sort is called with callback).
35       * @throws Exception if the test fails
36       */
37      @Test
38      @Alerts(DEFAULT = {"1<>5", "5<>2", "1<>2", "5<>1", "2<>1", "1<>1", "5<>9"},
39              CHROME = {"5<>1", "2<>5", "2<>1", "1<>2", "1<>1", "9<>2", "9<>5"},
40              EDGE = {"5<>1", "2<>5", "2<>1", "1<>2", "1<>1", "9<>2", "9<>5"})
41      @HtmlUnitNYI(
42              CHROME = {"5<>1", "2<>5", "2<>5", "2<>1", "1<>2", "1<>1", "9<>2", "9<>5"},
43              EDGE = {"5<>1", "2<>5", "2<>5", "2<>1", "1<>2", "1<>1", "9<>2", "9<>5"},
44              FF = {"5<>1", "2<>5", "2<>5", "2<>1", "1<>2", "1<>1", "9<>2", "9<>5"},
45              FF_ESR = {"5<>1", "2<>5", "2<>5", "2<>1", "1<>2", "1<>1", "9<>2", "9<>5"})
46      public void sortSteps() throws Exception {
47          final String html = DOCTYPE_HTML
48              + "<html><head><script>\n"
49              + LOG_TITLE_FUNCTION
50              + "function compare(x, y) {\n"
51              + "  log('' + x + '<>' + y);\n"
52              + "  return x - y;\n"
53              + "}\n"
54              + "function doTest() {\n"
55              + "  var t = [1, 5, 2, 1, 9];\n"
56              + "  t.sort(compare);\n"
57              + "}\n"
58              + "</script></head>\n"
59              + "<body onload='doTest()'>\n"
60              + "</body></html>";
61  
62          loadPageVerifyTitle2(html);
63      }
64  
65      /**
66       * Test for sort callback returning bool instead of int.
67       * @throws Exception if the test fails
68       */
69      @Test
70      @Alerts("1,1,2,5,9")
71      public void sortIntComperator() throws Exception {
72          final String html = DOCTYPE_HTML
73              + "<html><head><script>\n"
74              + LOG_TITLE_FUNCTION
75              + "function compare(x, y) {\n"
76              + "  return x - y;\n"
77              + "}\n"
78              + "function doTest() {\n"
79              + "  var t = [1, 5, 2, 1, 9];\n"
80              + "  t.sort(compare);\n"
81              + "  log(t);\n"
82              + "}\n"
83              + "</script></head><body onload='doTest()'>\n"
84              + "</body></html>";
85  
86          loadPageVerifyTitle2(html);
87      }
88  
89      /**
90       * Test for sort callback returning bool instead of int.
91       * @throws Exception if the test fails
92       */
93      @Test
94      @Alerts("1,1,2,5,9")
95      public void sortSmallDoublesComperator() throws Exception {
96          final String html = DOCTYPE_HTML
97              + "<html><head><script>\n"
98              + LOG_TITLE_FUNCTION
99              + "function compare(x, y) {\n"
100             + "  return (x - y) / 1001;\n"
101             + "}\n"
102             + "function doTest() {\n"
103             + "  var t = [1, 5, 2, 1, 9];\n"
104             + "  t.sort(compare);\n"
105             + "  log(t);\n"
106             + "}\n"
107             + "</script></head><body onload='doTest()'>\n"
108             + "</body></html>";
109 
110         loadPageVerifyTitle2(html);
111     }
112 
113     /**
114      * Test for sort callback returning bool instead of int.
115      * @throws Exception if the test fails
116      */
117     @Test
118     @Alerts(DEFAULT = "1,5,2,1,9",
119             FF = "1,1,2,5,9",
120             FF_ESR = "1,1,2,5,9")
121     public void sortBoolComperator() throws Exception {
122         final String html = DOCTYPE_HTML
123             + "<html><head><script>\n"
124             + LOG_TITLE_FUNCTION
125             + "function compare(x, y) {\n"
126             + "  return x >= y;\n"
127             + "}\n"
128             + "function doTest() {\n"
129             + "  var t = ['1', '5', '2', '1', '9'];\n"
130             + "  t.sort(compare);\n"
131             + "  log(t);\n"
132             + "}\n"
133             + "</script></head><body onload='doTest()'>\n"
134             + "</body></html>";
135 
136         loadPageVerifyTitle2(html);
137     }
138 
139     /**
140      * Test for sort callback.
141      * @throws Exception if the test fails
142      */
143     @Test
144     @Alerts("1,1,2,5,9")
145     public void sortBool2IntComperator() throws Exception {
146         final String html = DOCTYPE_HTML
147             + "<html><head><script>\n"
148             + LOG_TITLE_FUNCTION
149             + "function compare(x, y) {\n"
150             + "  return (x >= y) === true ? 1 : -1;\n"
151             + "}\n"
152             + "function doTest() {\n"
153             + "  var t = ['1', '5', '2', '1', '9'];\n"
154             + "  t.sort(compare);\n"
155             + "  log(t);\n"
156             + "}\n"
157             + "</script></head><body onload='doTest()'>\n"
158             + "</body></html>";
159 
160         loadPageVerifyTitle2(html);
161     }
162 
163     /**
164      * Test for sort callback.
165      * @throws Exception if the test fails
166      */
167     @Test
168     @Alerts(DEFAULT = "1,5,2,1,9",
169             FF = "9,1,2,5,1",
170             FF_ESR = "9,1,2,5,1")
171     @HtmlUnitNYI(FF = "1,5,2,1,9",
172             FF_ESR = "1,5,2,1,9")
173     public void sortInvalidComperator() throws Exception {
174         final String html = DOCTYPE_HTML
175             + "<html><head><script>\n"
176             + LOG_TITLE_FUNCTION
177             + "function compare(x, y) {\n"
178             + "  return 1;\n"
179             + "}\n"
180             + "function doTest() {\n"
181             + "  var t = ['1', '5', '2', '1', '9'];\n"
182             + "  t.sort(compare);\n"
183             + "  log(t);\n"
184             + "}\n"
185             + "</script></head><body onload='doTest()'>\n"
186             + "</body></html>";
187 
188         loadPageVerifyTitle2(html);
189     }
190 
191     /**
192      * Test for the methods with the same expectations for all browsers.
193      * @throws Exception if the test fails
194      */
195     @Test
196     @Alerts({"concat: function", "constructor: function", "isArray: undefined", "join: function", "pop: function",
197         "push: function", "reverse: function", "shift: function", "slice: function", "sort: function",
198         "splice: function", "toLocaleString: function", "toString: function", "unshift: function"})
199     public void methods_common() throws Exception {
200         final String[] methods = {"concat", "constructor", "isArray", "join", "pop", "push", "reverse", "shift",
201             "slice", "sort", "splice", "toLocaleString", "toString", "unshift"};
202         final String html = NativeDateTest.createHTMLTestMethods("[]", methods);
203         loadPageVerifyTitle2(html);
204     }
205 
206     /**
207      * Test for the methods with the different expectations depending on the browsers.
208      * @throws Exception if the test fails
209      */
210     @Test
211     @Alerts({"every: function", "filter: function", "forEach: function", "indexOf: function",
212              "lastIndexOf: function", "map: function", "reduce: function", "reduceRight: function", "some: function"})
213     public void methods_different() throws Exception {
214         final String[] methods = {"every", "filter", "forEach", "indexOf", "lastIndexOf", "map", "reduce",
215             "reduceRight", "some"};
216         final String html = NativeDateTest.createHTMLTestMethods("[]", methods);
217         loadPageVerifyTitle2(html);
218     }
219 
220     /**
221      * @throws Exception if the test fails
222      */
223     @Test
224     @Alerts("toSource: undefined")
225     public void methods_toSource() throws Exception {
226         final String[] methods = {"toSource"};
227         final String html = NativeDateTest.createHTMLTestMethods("[]", methods);
228         loadPageVerifyTitle2(html);
229     }
230 
231     /**
232      * Rhino version used in HtmlUnit incorrectly walked the prototype chain while deleting property.
233      * @see <a href="http://sf.net/support/tracker.php?aid=2834335">Bug 2834335</a>
234      * @see <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=510504">corresponding Rhino bug</a>
235      * @throws Exception if the test fails
236      */
237     @Test
238     @Alerts({"hello", "foo", "hello"})
239     public void deleteShouldNotWalkPrototypeChain() throws Exception {
240         final String html = DOCTYPE_HTML
241             + "<html><body><script>\n"
242             + LOG_TITLE_FUNCTION
243             + "Array.prototype.foo = function() { log('hello')};\n"
244             + "[].foo();\n"
245             + "var x = [];\n"
246             + "for (var i in x) {\n"
247             + "  log(i);\n"
248             + "  delete x[i];\n"
249             + "}\n"
250             + "[].foo();\n"
251             + "</script></body>";
252 
253         loadPageVerifyTitle2(html);
254     }
255 
256     /**
257      * @throws Exception if the test fails
258      */
259     @Test
260     @Alerts("function Array() { [native code] }")
261     public void constructorToString() throws Exception {
262         final String html = DOCTYPE_HTML
263             + "<html><head><script>\n"
264             + LOG_TITLE_FUNCTION
265             + "log([].constructor.toString());\n"
266             + "</script></head><body>\n"
267             + "</body></html>";
268 
269         loadPageVerifyTitle2(html);
270     }
271 
272     /**
273      * @throws Exception if the test fails
274      */
275     @Test
276     @Alerts({"mandarin", "", "mandarin"})
277     public void shiftOneElement() throws Exception {
278         final String html = DOCTYPE_HTML
279             + "<html>\n"
280             + "<head>\n"
281             + "<script>\n"
282             + LOG_TITLE_FUNCTION
283             + "  var myFish = [ 'mandarin' ];\n"
284             + "  log(myFish);\n"
285 
286             + "  var shifted = myFish.shift();\n"
287             + "  log(myFish);\n"
288             + "  log(shifted);\n"
289             + "</script>\n"
290             + "</head>\n"
291             + "<body>\n"
292             + "</body></html>";
293 
294         loadPageVerifyTitle2(html);
295     }
296 
297     /**
298      * @throws Exception if the test fails
299      */
300     @Test
301     @Alerts({"", "", "undefined"})
302     public void shiftEmpty() throws Exception {
303         final String html = DOCTYPE_HTML
304             + "<html>\n"
305             + "<head>\n"
306             + "<script>\n"
307             + LOG_TITLE_FUNCTION
308             + "  var myFish = [ ];\n"
309             + "  log(myFish);\n"
310 
311             + "  var shifted = myFish.shift();\n"
312             + "  log(myFish);\n"
313             + "  log(shifted);\n"
314             + "</script>\n"
315             + "</head>\n"
316             + "<body>\n"
317             + "</body></html>";
318 
319         loadPageVerifyTitle2(html);
320     }
321 
322     /**
323      * @throws Exception if the test fails
324      */
325     @Test
326     @Alerts({"3", "a", "b", "c"})
327     public void fromString() throws Exception {
328         final String html = DOCTYPE_HTML
329             + "<html>\n"
330             + "<head>\n"
331             + "<script>\n"
332             + LOG_TITLE_FUNCTION
333             + "  if (Array.from) {\n"
334             + "    var arr = Array.from('abc');\n"
335             + "    log(arr.length);\n"
336             + "    for (var i = 0; i < arr.length; i++) {\n"
337             + "      log(arr[i]);\n"
338             + "    }\n"
339             + "  } else {\n"
340             + "    log('not supported');\n"
341             + "  }\n"
342             + "</script>\n"
343             + "</head>\n"
344             + "<body>\n"
345             + "</body></html>";
346 
347         loadPageVerifyTitle2(html);
348     }
349 
350     /**
351      * @throws Exception if the test fails
352      */
353     @Test
354     @Alerts({"3", "a", "b", "c"})
355     public void fromArray() throws Exception {
356         final String html = DOCTYPE_HTML
357             + "<html>\n"
358             + "<head>\n"
359             + "<script>\n"
360             + LOG_TITLE_FUNCTION
361             + "  if (Array.from) {\n"
362             + "    var arr = Array.from(['a', 'b', 'c']);\n"
363             + "    log(arr.length);\n"
364             + "    for (var i = 0; i < arr.length; i++) {\n"
365             + "      log(arr[i]);\n"
366             + "    }\n"
367             + "  } else {\n"
368             + "    log('not supported');\n"
369             + "  }\n"
370             + "</script>\n"
371             + "</head>\n"
372             + "<body>\n"
373             + "</body></html>";
374 
375         loadPageVerifyTitle2(html);
376     }
377 
378     /**
379      * @throws Exception if the test fails
380      */
381     @Test
382     @Alerts({"3", "a", "b", "c"})
383     public void fromArrayIterator() throws Exception {
384         final String html = DOCTYPE_HTML
385             + "<html>\n"
386             + "<head>\n"
387             + "<script>\n"
388             + LOG_TITLE_FUNCTION
389             + "  if (Array.from) {\n"
390             + "    var input = ['a', 'b', 'c'];\n"
391             + "    var arr = Array.from(input[Symbol.iterator]());\n"
392             + "    log(arr.length);\n"
393             + "    for (var i = 0; i < arr.length; i++) {\n"
394             + "      log(arr[i]);\n"
395             + "    }\n"
396             + "  } else {\n"
397             + "    log('not supported');\n"
398             + "  }\n"
399             + "</script>\n"
400             + "</head>\n"
401             + "<body>\n"
402             + "</body></html>";
403 
404         loadPageVerifyTitle2(html);
405     }
406 
407     /**
408      * @throws Exception if the test fails
409      */
410     @Test
411     @Alerts({"4", "T", "e", "s", "t"})
412     public void fromStringIterator() throws Exception {
413         final String html = DOCTYPE_HTML
414             + "<html>\n"
415             + "<head>\n"
416             + "<script>\n"
417             + LOG_TITLE_FUNCTION
418             + "  if (Array.from) {\n"
419             + "    var arr = Array.from('Test'[Symbol.iterator]());\n"
420             + "    log(arr.length);\n"
421             + "    for (var i = 0; i < arr.length; i++) {\n"
422             + "      log(arr[i]);\n"
423             + "    }\n"
424             + "  } else {\n"
425             + "    log('not supported');\n"
426             + "  }\n"
427             + "</script>\n"
428             + "</head>\n"
429             + "<body>\n"
430             + "</body></html>";
431 
432         loadPageVerifyTitle2(html);
433     }
434 
435     /**
436      * @throws Exception if the test fails
437      */
438     @Test
439     @Alerts({"2", "abc", "[object Window]"})
440     public void fromSet() throws Exception {
441         final String html = DOCTYPE_HTML
442             + "<html>\n"
443             + "<head>\n"
444             + "<script>\n"
445             + LOG_TITLE_FUNCTION
446             + "  if (Array.from) {\n"
447             + "    var s = new Set(['abc', window]);\n"
448             + "    var arr = Array.from(s);\n"
449             + "    log(arr.length);\n"
450             + "    for (var i = 0; i < arr.length; i++) {\n"
451             + "      log(arr[i]);\n"
452             + "    }\n"
453             + "  } else {\n"
454             + "    log('not supported');\n"
455             + "  }\n"
456             + "</script>\n"
457             + "</head>\n"
458             + "<body>\n"
459             + "</body></html>";
460 
461         loadPageVerifyTitle2(html);
462     }
463 
464     /**
465      * @throws Exception if the test fails
466      */
467     @Test
468     @Alerts({"3", "1,2", "3,4", "5,6"})
469     public void fromMap() throws Exception {
470         final String html = DOCTYPE_HTML
471             + "<html>\n"
472             + "<head>\n"
473             + "<script>\n"
474             + LOG_TITLE_FUNCTION
475             + "  if (Array.from) {\n"
476             + "    var m = new Map([[1, 2], [3, 4], [5, 6]]);\n"
477             + "    var arr = Array.from(m);\n"
478             + "    log(arr.length);\n"
479             + "    for (var i = 0; i < arr.length; i++) {\n"
480             + "      log(arr[i]);\n"
481             + "    }\n"
482             + "  } else {\n"
483             + "    log('not supported');\n"
484             + "  }\n"
485             + "</script>\n"
486             + "</head>\n"
487             + "<body>\n"
488             + "</body></html>";
489 
490         loadPageVerifyTitle2(html);
491     }
492 
493     /**
494      * @throws Exception if the test fails
495      */
496     @Test
497     @Alerts({"1", "by"})
498     public void fromUserDefinedIterable() throws Exception {
499         final String html = DOCTYPE_HTML
500             + "<html>\n"
501             + "<head>\n"
502             + "<script>\n"
503             + LOG_TITLE_FUNCTION
504             + "  if (Array.from) {\n"
505             + "    var myIterable = {};\n"
506             + "    myIterable[Symbol.iterator] = function() {\n"
507             + "      return {\n"
508             + "        next: function(){\n"
509             + "          if (this._first) {;\n"
510             + "            this._first = false;\n"
511             + "            return { value: 'by', done: false };\n"
512             + "          }\n"
513             + "          return { done: true };\n"
514             + "        },\n"
515             + "        _first: true\n"
516             + "      };\n"
517             + "    };\n"
518 
519             + "    var arr = Array.from(myIterable);\n"
520             + "    log(arr.length);\n"
521             + "    for (var i = 0; i < arr.length; i++) {\n"
522             + "      log(arr[i]);\n"
523             + "    }\n"
524             + "  } else {\n"
525             + "    log('not supported');\n"
526             + "  }\n"
527             + "</script>\n"
528             + "</head>\n"
529             + "<body>\n"
530             + "</body></html>";
531 
532         loadPageVerifyTitle2(html);
533     }
534 
535     /**
536      * @throws Exception if the test fails
537      */
538     @Test
539     @Alerts("TypeError")
540     public void fromObject() throws Exception {
541         final String html = DOCTYPE_HTML
542             + "<html>\n"
543             + "<head>\n"
544             + "<script>\n"
545             + LOG_TITLE_FUNCTION
546             + "  if (Array.from) {\n"
547             + "    var myIterable = {};\n"
548             + "    myIterable[Symbol.iterator] = function() {\n"
549             + "      return { done: true };\n"
550             + "    };\n"
551 
552             + "    try {\n"
553             + "      Array.from(myIterable);\n"
554             + "    } catch(e) { log('TypeError'); }\n"
555             + "  } else {\n"
556             + "    log('not supported');\n"
557             + "  }\n"
558             + "</script>\n"
559             + "</head>\n"
560             + "<body>\n"
561             + "</body></html>";
562 
563         loadPageVerifyTitle2(html);
564     }
565 
566     /**
567      * @throws Exception if the test fails
568      */
569     @Test
570     @Alerts("0")
571     public void fromNativeObject() throws Exception {
572         final String html = DOCTYPE_HTML
573             + "<html>\n"
574             + "<head>\n"
575             + "<script>\n"
576             + LOG_TITLE_FUNCTION
577             + "  if (Array.from) {\n"
578             + "    var arr = Array.from({firstName: 'Erika', age: 42});\n"
579             + "    log(arr.length);\n"
580             + "    for (var i = 0; i < arr.length; i++) {\n"
581             + "      log(arr[i]);\n"
582             + "    }\n"
583             + "  } else {\n"
584             + "    log('not supported');\n"
585             + "  }\n"
586             + "</script>\n"
587             + "</head>\n"
588             + "<body>\n"
589             + "</body></html>";
590 
591         loadPageVerifyTitle2(html);
592     }
593 
594     /**
595      * @throws Exception if the test fails
596      */
597     @Test
598     @Alerts({"1", "abc"})
599     public void fromArguments() throws Exception {
600         final String html = DOCTYPE_HTML
601             + "<html>\n"
602             + "<head>\n"
603             + "<script>\n"
604             + LOG_TITLE_FUNCTION
605             + "  function test(a) { return Array.from(arguments); }\n"
606 
607             + "  if (Array.from) {\n"
608             + "    var arr = test('abc') \n"
609             + "    log(arr.length);\n"
610             + "    for (var i = 0; i < arr.length; i++) {\n"
611             + "      log(arr[i]);\n"
612             + "    }\n"
613             + "  } else {\n"
614             + "    log('not supported');\n"
615             + "  }\n"
616             + "</script>\n"
617             + "</head>\n"
618             + "<body>\n"
619             + "</body></html>";
620 
621         loadPageVerifyTitle2(html);
622     }
623 
624     /**
625      * @throws Exception if the test fails
626      */
627     @Test
628     @Alerts({"true", "true", "true", "true", "false", "false", "false",
629                 "false", "false", "false", "false", "false", "false"})
630     public void isArray() throws Exception {
631         final String html = DOCTYPE_HTML
632             + "<html>\n"
633             + "<head>\n"
634             + "<script>\n"
635             + LOG_TITLE_FUNCTION
636             + "  log(Array.isArray([]));\n"
637             + "  log(Array.isArray([1]));\n"
638             + "  log(Array.isArray( new Array() ));\n"
639             + "  log(Array.isArray( Array.prototype ));\n"
640             + "  log(Array.isArray());\n"
641             + "  log(Array.isArray({}));\n"
642             + "  log(Array.isArray(null));\n"
643             + "  log(Array.isArray(undefined));\n"
644             + "  log(Array.isArray(17));\n"
645             + "  log(Array.isArray('Array'));\n"
646             + "  log(Array.isArray(true));\n"
647             + "  log(Array.isArray(false));\n"
648             + "  log(Array.isArray({ __proto__ : Array.prototype }));\n"
649             + "</script>\n"
650             + "</head>\n"
651             + "<body>\n"
652             + "</body></html>";
653 
654         loadPageVerifyTitle2(html);
655     }
656 
657     /**
658      * @throws Exception if the test fails
659      */
660     @Test
661     @Alerts({"function", "20"})
662     public void find() throws Exception {
663         final String html = DOCTYPE_HTML
664             + "<html>\n"
665             + "<head>\n"
666             + "<script>\n"
667             + LOG_TITLE_FUNCTION
668             + "  function isBig(n) { return n >= 10; }\n"
669             + "\n"
670             + "  var arr = [1, 20, 7, 17];\n"
671             + "  log(typeof arr.find);\n"
672             + "  if (typeof arr.find == 'function') {\n"
673             + "    log(arr.find(isBig));\n"
674             + "  }\n"
675             + "</script>\n"
676             + "</head>\n"
677             + "<body>\n"
678             + "</body></html>";
679 
680         loadPageVerifyTitle2(html);
681     }
682 
683     /**
684      * @throws Exception if the test fails
685      */
686     @Test
687     @Alerts({"function", "20"})
688     public void findPrototype() throws Exception {
689         final String html = DOCTYPE_HTML
690             + "<html>\n"
691             + "<head>\n"
692             + "<script>\n"
693             + LOG_TITLE_FUNCTION
694             + "  function isBig(n) { return n >= 10; }\n"
695             + "\n"
696             + "  var arr = [1, 20, 7, 17];\n"
697             + "  var find = Array.prototype.find;\n"
698             + "  log(typeof find);\n"
699             + "  if (typeof find == 'function') {\n"
700             + "    log(find.call(arr, isBig));\n"
701             + "  }\n"
702             + "</script>\n"
703             + "</head>\n"
704             + "<body>\n"
705             + "</body></html>";
706 
707         loadPageVerifyTitle2(html);
708     }
709 
710     /**
711      * @throws Exception if the test fails
712      */
713     @Test
714     @Alerts({"undefined", "TypeError"})
715     public void findStatic() throws Exception {
716         final String html = DOCTYPE_HTML
717             + "<html>\n"
718             + "<head>\n"
719             + "<script>\n"
720             + LOG_TITLE_FUNCTION
721             + "  function isBig(n) { return n >= 10; }\n"
722             + "\n"
723             + "  log(typeof Array.find);\n"
724             + "  var arr = [1, 20, 7, 17];\n"
725             + "  try {\n"
726             + "    log(Array.find(arr, isBig));\n"
727             + "  } catch(e) { log('TypeError'); }\n"
728             + "</script>\n"
729             + "</head>\n"
730             + "<body>\n"
731             + "</body></html>";
732 
733         loadPageVerifyTitle2(html);
734     }
735 
736     /**
737      * @throws Exception if the test fails
738      */
739     @Test
740     @Alerts({"function", "1"})
741     public void findIndex() throws Exception {
742         final String html = DOCTYPE_HTML
743             + "<html>\n"
744             + "<head>\n"
745             + "<script>\n"
746             + LOG_TITLE_FUNCTION
747             + "  function isBig(n) { return n >= 10; }\n"
748             + "\n"
749             + "  var arr = [1, 20, 7, 17];\n"
750             + "  log(typeof arr.findIndex);\n"
751             + "  if (typeof arr.findIndex == 'function') {\n"
752             + "    log(arr.findIndex(isBig));\n"
753             + "  }\n"
754             + "</script>\n"
755             + "</head>\n"
756             + "<body>\n"
757             + "</body></html>";
758 
759         loadPageVerifyTitle2(html);
760     }
761 
762     /**
763      * @throws Exception if the test fails
764      */
765     @Test
766     @Alerts({"function", "1"})
767     public void findIndexPrototype() throws Exception {
768         final String html = DOCTYPE_HTML
769             + "<html>\n"
770             + "<head>\n"
771             + "<script>\n"
772             + LOG_TITLE_FUNCTION
773             + "  function isBig(n) { return n >= 10; }\n"
774             + "\n"
775             + "  var arr = [1, 20, 7, 17];\n"
776             + "  var findIndex = Array.prototype.findIndex;\n"
777             + "  log(typeof findIndex);\n"
778             + "  if (typeof findIndex == 'function') {\n"
779             + "    log(findIndex.call(arr, isBig));\n"
780             + "  }\n"
781             + "</script>\n"
782             + "</head>\n"
783             + "<body>\n"
784             + "</body></html>";
785 
786         loadPageVerifyTitle2(html);
787     }
788 
789     /**
790      * @throws Exception if the test fails
791      */
792     @Test
793     @Alerts({"undefined", "TypeError"})
794     public void findIndexStatic() throws Exception {
795         final String html = DOCTYPE_HTML
796             + "<html>\n"
797             + "<head>\n"
798             + "<script>\n"
799             + LOG_TITLE_FUNCTION
800             + "  function isBig(n) { return n >= 10; }\n"
801             + "\n"
802             + "  log(typeof Array.findIndex);\n"
803             + "  var arr = [1, 20, 7, 17];\n"
804             + "  try {\n"
805             + "    log(Array.findIndex(arr, isBig));\n"
806             + "  } catch(e) { log('TypeError'); }\n"
807             + "</script>\n"
808             + "</head>\n"
809             + "<body>\n"
810             + "</body></html>";
811 
812         loadPageVerifyTitle2(html);
813     }
814 
815     /**
816      * @throws Exception if the test fails
817      */
818     @Test
819     @Alerts({"function", "20,17"})
820     public void filter() throws Exception {
821         final String html = DOCTYPE_HTML
822             + "<html>\n"
823             + "<head>\n"
824             + "<script>\n"
825             + LOG_TITLE_FUNCTION
826             + "  function isBig(n) { return n >= 10; }\n"
827             + "\n"
828             + "  var arr = [1, 20, 7, 17];\n"
829             + "  log(typeof arr.filter);\n"
830             + "  log(arr.filter(isBig));\n"
831             + "</script>\n"
832             + "</head>\n"
833             + "<body>\n"
834             + "</body></html>";
835 
836         loadPageVerifyTitle2(html);
837     }
838 
839     /**
840      * @throws Exception if the test fails
841      */
842     @Test
843     @Alerts({"function", "20,17"})
844     public void filterPrototype() throws Exception {
845         final String html = DOCTYPE_HTML
846             + "<html>\n"
847             + "<head>\n"
848             + "<script>\n"
849             + LOG_TITLE_FUNCTION
850             + "  function isBig(n) { return n >= 10; }\n"
851             + "\n"
852             + "  var arr = [1, 20, 7, 17];\n"
853             + "  var filter = Array.prototype.filter;\n"
854             + "  log(typeof filter);\n"
855             + "  log(filter.call(arr, isBig));\n"
856             + "</script>\n"
857             + "</head>\n"
858             + "<body>\n"
859             + "</body></html>";
860 
861         loadPageVerifyTitle2(html);
862     }
863 
864     /**
865      * @throws Exception if the test fails
866      */
867     @Test
868     @Alerts({"undefined", "TypeError"})
869     public void filterStatic() throws Exception {
870         final String html = DOCTYPE_HTML
871             + "<html>\n"
872             + "<head>\n"
873             + "<script>\n"
874             + LOG_TITLE_FUNCTION
875             + "  function isBig(n) { return n >= 10; }\n"
876             + "\n"
877             + "  log(typeof Array.filter);\n"
878             + "  var arr = [1, 20, 7, 17];\n"
879             + "  try {\n"
880             + "    log(Array.filter(arr, isBig));\n"
881             + "  } catch(e) { log('TypeError'); }\n"
882             + "</script>\n"
883             + "</head>\n"
884             + "<body>\n"
885             + "</body></html>";
886 
887         loadPageVerifyTitle2(html);
888     }
889 
890     /**
891      * @throws Exception if the test fails
892      */
893     @Test
894     @Alerts({"function", "1,2,3,4"})
895     public void map() throws Exception {
896         final String html = DOCTYPE_HTML
897             + "<html>\n"
898             + "<head>\n"
899             + "<script>\n"
900             + LOG_TITLE_FUNCTION
901             + "  var arr = [1, 4, 9, 16];\n"
902             + "  log(typeof arr.map);\n"
903             + "  log(arr.map(Math.sqrt));\n"
904             + "</script>\n"
905             + "</head>\n"
906             + "<body>\n"
907             + "</body></html>";
908 
909         loadPageVerifyTitle2(html);
910     }
911 
912     /**
913      * @throws Exception if the test fails
914      */
915     @Test
916     @Alerts({"function", "1,2,3,4"})
917     public void mapPrototype() throws Exception {
918         final String html = DOCTYPE_HTML
919             + "<html>\n"
920             + "<head>\n"
921             + "<script>\n"
922             + LOG_TITLE_FUNCTION
923             + "  var arr = [1, 4, 9, 16];\n"
924             + "  var map = Array.prototype.map;\n"
925             + "  log(typeof map);\n"
926             + "  log(map.call(arr, Math.sqrt));\n"
927             + "</script>\n"
928             + "</head>\n"
929             + "<body>\n"
930             + "</body></html>";
931 
932         loadPageVerifyTitle2(html);
933     }
934 
935     /**
936      * @throws Exception if the test fails
937      */
938     @Test
939     @Alerts({"undefined", "TypeError"})
940     public void mapStatic() throws Exception {
941         final String html = DOCTYPE_HTML
942             + "<html>\n"
943             + "<head>\n"
944             + "<script>\n"
945             + LOG_TITLE_FUNCTION
946             + "  log(typeof Array.map);\n"
947             + "  var arr = [1, 4, 9, 16];\n"
948             + "  try {\n"
949             + "    log(Array.map(arr, Math.sqrt));\n"
950             + "  } catch(e) { log('TypeError'); }\n"
951             + "</script>\n"
952             + "</head>\n"
953             + "<body>\n"
954             + "</body></html>";
955 
956         loadPageVerifyTitle2(html);
957     }
958 
959     /**
960      * @throws Exception if the test fails
961      */
962     @Test
963     @Alerts({"function", "false"})
964     public void every() throws Exception {
965         final String html = DOCTYPE_HTML
966             + "<html>\n"
967             + "<head>\n"
968             + "<script>\n"
969             + LOG_TITLE_FUNCTION
970             + "  function isSmall(n) { return n < 10; }\n"
971             + "\n"
972             + "  var arr = [1, 4, 9, 16];\n"
973             + "  log(typeof arr.every);\n"
974             + "  log(arr.every(isSmall));\n"
975             + "</script>\n"
976             + "</head>\n"
977             + "<body>\n"
978             + "</body></html>";
979 
980         loadPageVerifyTitle2(html);
981     }
982 
983     /**
984      * @throws Exception if the test fails
985      */
986     @Test
987     @Alerts({"function", "false"})
988     public void everyPrototype() throws Exception {
989         final String html = DOCTYPE_HTML
990             + "<html>\n"
991             + "<head>\n"
992             + "<script>\n"
993             + LOG_TITLE_FUNCTION
994             + "  function isSmall(n) { return n < 10; }\n"
995             + "\n"
996             + "  var arr = [1, 4, 9, 16];\n"
997             + "  var every = Array.prototype.every;\n"
998             + "  log(typeof every);\n"
999             + "  log(every.call(arr, isSmall));\n"
1000             + "</script>\n"
1001             + "</head>\n"
1002             + "<body>\n"
1003             + "</body></html>";
1004 
1005         loadPageVerifyTitle2(html);
1006     }
1007 
1008     /**
1009      * @throws Exception if the test fails
1010      */
1011     @Test
1012     @Alerts({"undefined", "TypeError"})
1013     public void everyStatic() throws Exception {
1014         final String html = DOCTYPE_HTML
1015             + "<html>\n"
1016             + "<head>\n"
1017             + "<script>\n"
1018             + LOG_TITLE_FUNCTION
1019             + "  function isSmall(n) { return n < 10; }\n"
1020             + "\n"
1021             + "  log(typeof Array.every);\n"
1022             + "  var arr = [1, 4, 9, 16];\n"
1023             + "  try {\n"
1024             + "    log(Array.every(arr, isSmall));\n"
1025             + "  } catch(e) { log('TypeError'); }\n"
1026             + "</script>\n"
1027             + "</head>\n"
1028             + "<body>\n"
1029             + "</body></html>";
1030 
1031         loadPageVerifyTitle2(html);
1032     }
1033 
1034     /**
1035      * @throws Exception if the test fails
1036      */
1037     @Test
1038     @Alerts({"function", "true"})
1039     public void some() throws Exception {
1040         final String html = DOCTYPE_HTML
1041             + "<html>\n"
1042             + "<head>\n"
1043             + "<script>\n"
1044             + LOG_TITLE_FUNCTION
1045             + "  function isSmall(n) { return n < 10; }\n"
1046             + "\n"
1047             + "  var arr = [1, 4, 9, 16];\n"
1048             + "  log(typeof arr.some);\n"
1049             + "  log(arr.some(isSmall));\n"
1050             + "</script>\n"
1051             + "</head>\n"
1052             + "<body>\n"
1053             + "</body></html>";
1054 
1055         loadPageVerifyTitle2(html);
1056     }
1057 
1058     /**
1059      * @throws Exception if the test fails
1060      */
1061     @Test
1062     @Alerts({"function", "true"})
1063     public void somePrototype() throws Exception {
1064         final String html = DOCTYPE_HTML
1065             + "<html>\n"
1066             + "<head>\n"
1067             + "<script>\n"
1068             + LOG_TITLE_FUNCTION
1069             + "  function isSmall(n) { return n < 10; }\n"
1070             + "\n"
1071             + "  var arr = [1, 4, 9, 16];\n"
1072             + "  var some = Array.prototype.some;\n"
1073             + "  log(typeof some);\n"
1074             + "  log(some.call(arr, isSmall));\n"
1075             + "</script>\n"
1076             + "</head>\n"
1077             + "<body>\n"
1078             + "</body></html>";
1079 
1080         loadPageVerifyTitle2(html);
1081     }
1082 
1083     /**
1084      * @throws Exception if the test fails
1085      */
1086     @Test
1087     @Alerts({"undefined", "TypeError"})
1088     public void someStatic() throws Exception {
1089         final String html = DOCTYPE_HTML
1090             + "<html>\n"
1091             + "<head>\n"
1092             + "<script>\n"
1093             + LOG_TITLE_FUNCTION
1094             + "  function isSmall(n) { return n < 10; }\n"
1095             + "\n"
1096             + "  log(typeof Array.some);\n"
1097             + "  var arr = [1, 4, 9, 16];\n"
1098             + "  try {\n"
1099             + "    log(Array.some(arr, isSmall));\n"
1100             + "  } catch(e) { log('TypeError'); }\n"
1101             + "</script>\n"
1102             + "</head>\n"
1103             + "<body>\n"
1104             + "</body></html>";
1105 
1106         loadPageVerifyTitle2(html);
1107     }
1108 
1109     /**
1110      * @throws Exception if the test fails
1111      */
1112     @Test
1113     @Alerts({"function", "4", "7"})
1114     public void forEach() throws Exception {
1115         final String html = DOCTYPE_HTML
1116             + "<html>\n"
1117             + "<head>\n"
1118             + "<script>\n"
1119             + LOG_TITLE_FUNCTION
1120             + "  var arr = [4, 7];\n"
1121             + "  log(typeof arr.forEach);\n"
1122             + "  arr.forEach(function(elem) { log(elem) });\n"
1123             + "</script>\n"
1124             + "</head>\n"
1125             + "<body>\n"
1126             + "</body></html>";
1127 
1128         loadPageVerifyTitle2(html);
1129     }
1130 
1131     /**
1132      * @throws Exception if the test fails
1133      */
1134     @Test
1135     @Alerts({"function", "4", "7"})
1136     public void forEachPrototype() throws Exception {
1137         final String html = DOCTYPE_HTML
1138             + "<html>\n"
1139             + "<head>\n"
1140             + "<script>\n"
1141             + LOG_TITLE_FUNCTION
1142             + "  var arr = [4, 7];\n"
1143             + "  var forEach = Array.prototype.forEach;\n"
1144             + "  log(typeof forEach);\n"
1145             + "  forEach.call(arr, function(elem) { log(elem) });\n"
1146             + "</script>\n"
1147             + "</head>\n"
1148             + "<body>\n"
1149             + "</body></html>";
1150 
1151         loadPageVerifyTitle2(html);
1152     }
1153 
1154     /**
1155      * @throws Exception if the test fails
1156      */
1157     @Test
1158     @Alerts({"undefined", "TypeError"})
1159     public void forEachStatic() throws Exception {
1160         final String html = DOCTYPE_HTML
1161             + "<html>\n"
1162             + "<head>\n"
1163             + "<script>\n"
1164             + LOG_TITLE_FUNCTION
1165             + "  log(typeof Array.forEach);\n"
1166             + "  var arr = [4, 7];\n"
1167             + "  try {\n"
1168             + "    Array.forEach(arr, function(elem) { log(elem) });\n"
1169             + "  } catch(e) { log('TypeError'); }\n"
1170             + "</script>\n"
1171             + "</head>\n"
1172             + "<body>\n"
1173             + "</body></html>";
1174 
1175         loadPageVerifyTitle2(html);
1176     }
1177 
1178     /**
1179      * @throws Exception if the test fails
1180      */
1181     @Test
1182     @Alerts({"function", "30"})
1183     public void reduce() throws Exception {
1184         final String html = DOCTYPE_HTML
1185             + "<html>\n"
1186             + "<head>\n"
1187             + "<script>\n"
1188             + LOG_TITLE_FUNCTION
1189             + "  function sum(acc, val) { return acc + val; }\n"
1190             + "\n"
1191             + "  var arr = [1, 4, 9, 16];\n"
1192             + "  log(typeof arr.reduce);\n"
1193             + "  log(arr.reduce(sum));\n"
1194             + "</script>\n"
1195             + "</head>\n"
1196             + "<body>\n"
1197             + "</body></html>";
1198 
1199         loadPageVerifyTitle2(html);
1200     }
1201 
1202     /**
1203      * @throws Exception if the test fails
1204      */
1205     @Test
1206     @Alerts({"function", "30"})
1207     public void reducePrototype() throws Exception {
1208         final String html = DOCTYPE_HTML
1209             + "<html>\n"
1210             + "<head>\n"
1211             + "<script>\n"
1212             + LOG_TITLE_FUNCTION
1213             + "  function sum(acc, val) { return acc + val; }\n"
1214             + "\n"
1215             + "  var arr = [1, 4, 9, 16];\n"
1216             + "  var reduce = Array.prototype.reduce;\n"
1217             + "  log(typeof reduce);\n"
1218             + "  log(reduce.call(arr, sum));\n"
1219             + "</script>\n"
1220             + "</head>\n"
1221             + "<body>\n"
1222             + "</body></html>";
1223 
1224         loadPageVerifyTitle2(html);
1225     }
1226 
1227     /**
1228      * @throws Exception if the test fails
1229      */
1230     @Test
1231     @Alerts({"undefined", "TypeError"})
1232     public void reduceStatic() throws Exception {
1233         final String html = DOCTYPE_HTML
1234             + "<html>\n"
1235             + "<head>\n"
1236             + "<script>\n"
1237             + LOG_TITLE_FUNCTION
1238             + "  function sum(acc, val) { return acc + val; }\n"
1239             + "\n"
1240             + "  log(typeof Array.reduce);\n"
1241             + "  var arr = [1, 4, 9, 16];\n"
1242             + "  try {\n"
1243             + "    log(Array.reduce(arr, sum));\n"
1244             + "  } catch(e) { log('TypeError'); }\n"
1245             + "</script>\n"
1246             + "</head>\n"
1247             + "<body>\n"
1248             + "</body></html>";
1249 
1250         loadPageVerifyTitle2(html);
1251     }
1252 
1253     /**
1254      * @throws Exception if the test fails
1255      */
1256     @Test
1257     @Alerts({"function", "2"})
1258     public void reduceRight() throws Exception {
1259         final String html = DOCTYPE_HTML
1260             + "<html>\n"
1261             + "<head>\n"
1262             + "<script>\n"
1263             + LOG_TITLE_FUNCTION
1264             + "  function diff(acc, val) { return acc - val; }\n"
1265             + "\n"
1266             + "  var arr = [1, 4, 9, 16];\n"
1267             + "  log(typeof arr.reduceRight);\n"
1268             + "  log(arr.reduceRight(diff));\n"
1269             + "</script>\n"
1270             + "</head>\n"
1271             + "<body>\n"
1272             + "</body></html>";
1273 
1274         loadPageVerifyTitle2(html);
1275     }
1276 
1277     /**
1278      * @throws Exception if the test fails
1279      */
1280     @Test
1281     @Alerts({"function", "2"})
1282     public void reduceRightPrototype() throws Exception {
1283         final String html = DOCTYPE_HTML
1284             + "<html>\n"
1285             + "<head>\n"
1286             + "<script>\n"
1287             + LOG_TITLE_FUNCTION
1288             + "  function diff(acc, val) { return acc - val; }\n"
1289             + "\n"
1290             + "  var arr = [1, 4, 9, 16];\n"
1291             + "  var reduceRight = Array.prototype.reduceRight;\n"
1292             + "  log(typeof reduceRight);\n"
1293             + "  log(reduceRight.call(arr, diff));\n"
1294             + "</script>\n"
1295             + "</head>\n"
1296             + "<body>\n"
1297             + "</body></html>";
1298 
1299         loadPageVerifyTitle2(html);
1300     }
1301 
1302     /**
1303      * @throws Exception if the test fails
1304      */
1305     @Test
1306     @Alerts({"undefined", "TypeError"})
1307     public void reduceRightStatic() throws Exception {
1308         final String html = DOCTYPE_HTML
1309             + "<html>\n"
1310             + "<head>\n"
1311             + "<script>\n"
1312             + LOG_TITLE_FUNCTION
1313             + "  function diff(acc, val) { return acc - val; }\n"
1314             + "\n"
1315             + "  log(typeof Array.reduceRight);\n"
1316             + "  var arr = [1, 4, 9, 16];\n"
1317             + "  try {\n"
1318             + "    log(Array.reduceRight(arr, diff));\n"
1319             + "  } catch(e) { log('TypeError'); }\n"
1320             + "</script>\n"
1321             + "</head>\n"
1322             + "<body>\n"
1323             + "</body></html>";
1324 
1325         loadPageVerifyTitle2(html);
1326     }
1327 
1328     /**
1329      * @throws Exception if the test fails
1330      */
1331     @Test
1332     @Alerts({"function", "1,4,9,16"})
1333     public void join() throws Exception {
1334         final String html = DOCTYPE_HTML
1335             + "<html>\n"
1336             + "<head>\n"
1337             + "<script>\n"
1338             + LOG_TITLE_FUNCTION
1339             + "  var arr = [1, 4, 9, 16];\n"
1340             + "  log(typeof arr.join);\n"
1341             + "  log(arr.join());\n"
1342             + "</script>\n"
1343             + "</head>\n"
1344             + "<body>\n"
1345             + "</body></html>";
1346 
1347         loadPageVerifyTitle2(html);
1348     }
1349 
1350     /**
1351      * @throws Exception if the test fails
1352      */
1353     @Test
1354     @Alerts({"function", "1,4,9,16"})
1355     public void joinPrototype() throws Exception {
1356         final String html = DOCTYPE_HTML
1357             + "<html>\n"
1358             + "<head>\n"
1359             + "<script>\n"
1360             + LOG_TITLE_FUNCTION
1361             + "  var arr = [1, 4, 9, 16];\n"
1362             + "  var join = Array.prototype.join;\n"
1363             + "  log(typeof join);\n"
1364             + "  log(join.call(arr));\n"
1365             + "</script>\n"
1366             + "</head>\n"
1367             + "<body>\n"
1368             + "</body></html>";
1369 
1370         loadPageVerifyTitle2(html);
1371     }
1372 
1373     /**
1374      * @throws Exception if the test fails
1375      */
1376     @Test
1377     @Alerts({"undefined", "TypeError"})
1378     public void joinStatic() throws Exception {
1379         final String html = DOCTYPE_HTML
1380             + "<html>\n"
1381             + "<head>\n"
1382             + "<script>\n"
1383             + LOG_TITLE_FUNCTION
1384             + "  log(typeof Array.join);\n"
1385             + "  var arr = [1, 4, 9, 16];\n"
1386             + "  try {\n"
1387             + "    log(Array.join(arr));\n"
1388             + "  } catch(e) { log('TypeError'); }\n"
1389             + "</script>\n"
1390             + "</head>\n"
1391             + "<body>\n"
1392             + "</body></html>";
1393 
1394         loadPageVerifyTitle2(html);
1395     }
1396 
1397     /**
1398      * @throws Exception if the test fails
1399      */
1400     @Test
1401     @Alerts({"function", "16,9,4,1"})
1402     public void reverse() throws Exception {
1403         final String html = DOCTYPE_HTML
1404             + "<html>\n"
1405             + "<head>\n"
1406             + "<script>\n"
1407             + LOG_TITLE_FUNCTION
1408             + "  var arr = [1, 4, 9, 16];\n"
1409             + "  log(typeof arr.reverse);\n"
1410             + "  log(arr.reverse());\n"
1411             + "</script>\n"
1412             + "</head>\n"
1413             + "<body>\n"
1414             + "</body></html>";
1415 
1416         loadPageVerifyTitle2(html);
1417     }
1418 
1419     /**
1420      * @throws Exception if the test fails
1421      */
1422     @Test
1423     @Alerts({"function", "16,9,4,1"})
1424     public void reversePrototype() throws Exception {
1425         final String html = DOCTYPE_HTML
1426             + "<html>\n"
1427             + "<head>\n"
1428             + "<script>\n"
1429             + LOG_TITLE_FUNCTION
1430             + "  var arr = [1, 4, 9, 16];\n"
1431             + "  var reverse = Array.prototype.reverse;\n"
1432             + "  log(typeof reverse);\n"
1433             + "  log(reverse.call(arr));\n"
1434             + "</script>\n"
1435             + "</head>\n"
1436             + "<body>\n"
1437             + "</body></html>";
1438 
1439         loadPageVerifyTitle2(html);
1440     }
1441 
1442     /**
1443      * @throws Exception if the test fails
1444      */
1445     @Test
1446     @Alerts({"undefined", "TypeError"})
1447     public void reverseStatic() throws Exception {
1448         final String html = DOCTYPE_HTML
1449             + "<html>\n"
1450             + "<head>\n"
1451             + "<script>\n"
1452             + LOG_TITLE_FUNCTION
1453             + "  log(typeof Array.reverse);\n"
1454             + "  var arr = [1, 4, 9, 16];\n"
1455             + "  try {\n"
1456             + "    log(Array.reverse(arr));\n"
1457             + "  } catch(e) { log('TypeError'); }\n"
1458             + "</script>\n"
1459             + "</head>\n"
1460             + "<body>\n"
1461             + "</body></html>";
1462 
1463         loadPageVerifyTitle2(html);
1464     }
1465 
1466     /**
1467      * @throws Exception if the test fails
1468      */
1469     @Test
1470     @Alerts({"function", "1,16,4,9"})
1471     public void sort() throws Exception {
1472         final String html = DOCTYPE_HTML
1473             + "<html>\n"
1474             + "<head>\n"
1475             + "<script>\n"
1476             + LOG_TITLE_FUNCTION
1477             + "  var arr = [1, 4, 9, 16];\n"
1478             + "  log(typeof arr.sort);\n"
1479             + "  log(arr.sort());\n"
1480             + "</script>\n"
1481             + "</head>\n"
1482             + "<body>\n"
1483             + "</body></html>";
1484 
1485         loadPageVerifyTitle2(html);
1486     }
1487 
1488     /**
1489      * @throws Exception if the test fails
1490      */
1491     @Test
1492     @Alerts({"function", "1,16,4,9"})
1493     public void sortPrototype() throws Exception {
1494         final String html = DOCTYPE_HTML
1495             + "<html>\n"
1496             + "<head>\n"
1497             + "<script>\n"
1498             + LOG_TITLE_FUNCTION
1499             + "  var arr = [1, 4, 9, 16];\n"
1500             + "  var sort = Array.prototype.sort;\n"
1501             + "  log(typeof sort);\n"
1502             + "  log(sort.call(arr));\n"
1503             + "</script>\n"
1504             + "</head>\n"
1505             + "<body>\n"
1506             + "</body></html>";
1507 
1508         loadPageVerifyTitle2(html);
1509     }
1510 
1511     /**
1512      * @throws Exception if the test fails
1513      */
1514     @Test
1515     @Alerts({"undefined", "TypeError"})
1516     public void sortStatic() throws Exception {
1517         final String html = DOCTYPE_HTML
1518             + "<html>\n"
1519             + "<head>\n"
1520             + "<script>\n"
1521             + LOG_TITLE_FUNCTION
1522             + "  log(typeof Array.sort);\n"
1523             + "  var arr = [1, 4, 9, 16];\n"
1524             + "  try {\n"
1525             + "    log(Array.sort(arr));\n"
1526             + "  } catch(e) { log('TypeError'); }\n"
1527             + "</script>\n"
1528             + "</head>\n"
1529             + "<body>\n"
1530             + "</body></html>";
1531 
1532         loadPageVerifyTitle2(html);
1533     }
1534 
1535     /**
1536      * @throws Exception if the test fails
1537      */
1538     @Test
1539     @Alerts({"function", "6", "1,4,9,16,3,7"})
1540     public void push() throws Exception {
1541         final String html = DOCTYPE_HTML
1542             + "<html>\n"
1543             + "<head>\n"
1544             + "<script>\n"
1545             + LOG_TITLE_FUNCTION
1546             + "  var arr = [1, 4, 9, 16];\n"
1547             + "  log(typeof arr.push);\n"
1548             + "  log(arr.push(3, 7));\n"
1549             + "  log(arr);\n"
1550             + "</script>\n"
1551             + "</head>\n"
1552             + "<body>\n"
1553             + "</body></html>";
1554 
1555         loadPageVerifyTitle2(html);
1556     }
1557 
1558     /**
1559      * @throws Exception if the test fails
1560      */
1561     @Test
1562     @Alerts({"function", "6", "1,4,9,16,3,7"})
1563     public void pushPrototype() throws Exception {
1564         final String html = DOCTYPE_HTML
1565             + "<html>\n"
1566             + "<head>\n"
1567             + "<script>\n"
1568             + LOG_TITLE_FUNCTION
1569             + "  var arr = [1, 4, 9, 16];\n"
1570             + "  var push = Array.prototype.push;\n"
1571             + "  log(typeof push);\n"
1572             + "  log(push.call(arr, 3, 7));\n"
1573             + "  log(arr);\n"
1574             + "</script>\n"
1575             + "</head>\n"
1576             + "<body>\n"
1577             + "</body></html>";
1578 
1579         loadPageVerifyTitle2(html);
1580     }
1581 
1582     /**
1583      * @throws Exception if the test fails
1584      */
1585     @Test
1586     @Alerts({"undefined", "TypeError"})
1587     public void pushStatic() throws Exception {
1588         final String html = DOCTYPE_HTML
1589             + "<html>\n"
1590             + "<head>\n"
1591             + "<script>\n"
1592             + LOG_TITLE_FUNCTION
1593             + "  log(typeof Array.push);\n"
1594             + "  var arr = [1, 4, 9, 16];\n"
1595             + "  try {\n"
1596             + "    log(Array.push(arr, 3, 7));\n"
1597             + "    log(arr);\n"
1598             + "  } catch(e) { log('TypeError'); }\n"
1599             + "</script>\n"
1600             + "</head>\n"
1601             + "<body>\n"
1602             + "</body></html>";
1603 
1604         loadPageVerifyTitle2(html);
1605     }
1606 
1607     /**
1608      * @throws Exception if the test fails
1609      */
1610     @Test
1611     @Alerts({"function", "16", "1,4,9"})
1612     public void pop() throws Exception {
1613         final String html = DOCTYPE_HTML
1614             + "<html>\n"
1615             + "<head>\n"
1616             + "<script>\n"
1617             + LOG_TITLE_FUNCTION
1618             + "  var arr = [1, 4, 9, 16];\n"
1619             + "  log(typeof arr.pop);\n"
1620             + "  log(arr.pop());\n"
1621             + "  log(arr);\n"
1622             + "</script>\n"
1623             + "</head>\n"
1624             + "<body>\n"
1625             + "</body></html>";
1626 
1627         loadPageVerifyTitle2(html);
1628     }
1629 
1630     /**
1631      * @throws Exception if the test fails
1632      */
1633     @Test
1634     @Alerts({"function", "16", "1,4,9"})
1635     public void popPrototype() throws Exception {
1636         final String html = DOCTYPE_HTML
1637             + "<html>\n"
1638             + "<head>\n"
1639             + "<script>\n"
1640             + LOG_TITLE_FUNCTION
1641             + "  var arr = [1, 4, 9, 16];\n"
1642             + "  var pop = Array.prototype.pop;\n"
1643             + "  log(typeof pop);\n"
1644             + "  log(pop.call(arr));\n"
1645             + "  log(arr);\n"
1646             + "</script>\n"
1647             + "</head>\n"
1648             + "<body>\n"
1649             + "</body></html>";
1650 
1651         loadPageVerifyTitle2(html);
1652     }
1653 
1654     /**
1655      * @throws Exception if the test fails
1656      */
1657     @Test
1658     @Alerts({"undefined", "TypeError"})
1659     public void popStatic() throws Exception {
1660         final String html = DOCTYPE_HTML
1661             + "<html>\n"
1662             + "<head>\n"
1663             + "<script>\n"
1664             + LOG_TITLE_FUNCTION
1665             + "  log(typeof Array.pop);\n"
1666             + "  var arr = [1, 4, 9, 16];\n"
1667             + "  try {\n"
1668             + "    log(Array.pop(arr));\n"
1669             + "    log(arr);\n"
1670             + "  } catch(e) { log('TypeError'); }\n"
1671             + "</script>\n"
1672             + "</head>\n"
1673             + "<body>\n"
1674             + "</body></html>";
1675 
1676         loadPageVerifyTitle2(html);
1677     }
1678 
1679     /**
1680      * @throws Exception if the test fails
1681      */
1682     @Test
1683     @Alerts({"function", "1", "4,9,16"})
1684     public void shift() throws Exception {
1685         final String html = DOCTYPE_HTML
1686             + "<html>\n"
1687             + "<head>\n"
1688             + "<script>\n"
1689             + LOG_TITLE_FUNCTION
1690             + "  var arr = [1, 4, 9, 16];\n"
1691             + "  log(typeof arr.shift);\n"
1692             + "  log(arr.shift());\n"
1693             + "  log(arr);\n"
1694             + "</script>\n"
1695             + "</head>\n"
1696             + "<body>\n"
1697             + "</body></html>";
1698 
1699         loadPageVerifyTitle2(html);
1700     }
1701 
1702     /**
1703      * @throws Exception if the test fails
1704      */
1705     @Test
1706     @Alerts({"function", "1", "4,9,16"})
1707     public void shiftPrototype() throws Exception {
1708         final String html = DOCTYPE_HTML
1709             + "<html>\n"
1710             + "<head>\n"
1711             + "<script>\n"
1712             + LOG_TITLE_FUNCTION
1713             + "  var arr = [1, 4, 9, 16];\n"
1714             + "  var shift = Array.prototype.shift;\n"
1715             + "  log(typeof shift);\n"
1716             + "  log(shift.call(arr));\n"
1717             + "  log(arr);\n"
1718             + "</script>\n"
1719             + "</head>\n"
1720             + "<body>\n"
1721             + "</body></html>";
1722 
1723         loadPageVerifyTitle2(html);
1724     }
1725 
1726     /**
1727      * @throws Exception if the test fails
1728      */
1729     @Test
1730     @Alerts({"undefined", "TypeError"})
1731     public void shiftStatic() throws Exception {
1732         final String html = DOCTYPE_HTML
1733             + "<html>\n"
1734             + "<head>\n"
1735             + "<script>\n"
1736             + LOG_TITLE_FUNCTION
1737             + "  log(typeof Array.shift);\n"
1738             + "  var arr = [1, 4, 9, 16];\n"
1739             + "  try {\n"
1740             + "    log(Array.shift(arr));\n"
1741             + "    log(arr);\n"
1742             + "  } catch(e) { log('TypeError'); }\n"
1743             + "</script>\n"
1744             + "</head>\n"
1745             + "<body>\n"
1746             + "</body></html>";
1747 
1748         loadPageVerifyTitle2(html);
1749     }
1750 
1751     /**
1752      * @throws Exception if the test fails
1753      */
1754     @Test
1755     @Alerts({"function", "6", "3,7,1,4,9,16"})
1756     public void unshift() throws Exception {
1757         final String html = DOCTYPE_HTML
1758             + "<html>\n"
1759             + "<head>\n"
1760             + "<script>\n"
1761             + LOG_TITLE_FUNCTION
1762             + "  var arr = [1, 4, 9, 16];\n"
1763             + "  log(typeof arr.unshift);\n"
1764             + "  log(arr.unshift(3, 7));\n"
1765             + "  log(arr);\n"
1766             + "</script>\n"
1767             + "</head>\n"
1768             + "<body>\n"
1769             + "</body></html>";
1770 
1771         loadPageVerifyTitle2(html);
1772     }
1773 
1774     /**
1775      * @throws Exception if the test fails
1776      */
1777     @Test
1778     @Alerts({"function", "6", "3,7,1,4,9,16"})
1779     public void unshiftPrototype() throws Exception {
1780         final String html = DOCTYPE_HTML
1781             + "<html>\n"
1782             + "<head>\n"
1783             + "<script>\n"
1784             + LOG_TITLE_FUNCTION
1785             + "  var arr = [1, 4, 9, 16];\n"
1786             + "  var unshift = Array.prototype.unshift;\n"
1787             + "  log(typeof unshift);\n"
1788             + "  log(unshift.call(arr, 3, 7));\n"
1789             + "  log(arr);\n"
1790             + "</script>\n"
1791             + "</head>\n"
1792             + "<body>\n"
1793             + "</body></html>";
1794 
1795         loadPageVerifyTitle2(html);
1796     }
1797 
1798     /**
1799      * @throws Exception if the test fails
1800      */
1801     @Test
1802     @Alerts({"undefined", "TypeError"})
1803     public void unshiftStatic() throws Exception {
1804         final String html = DOCTYPE_HTML
1805             + "<html>\n"
1806             + "<head>\n"
1807             + "<script>\n"
1808             + LOG_TITLE_FUNCTION
1809             + "  log(typeof Array.unshift);\n"
1810             + "  var arr = [1, 4, 9, 16];\n"
1811             + "  try {\n"
1812             + "    log(Array.unshift(arr, 3, 7));\n"
1813             + "    log(arr);\n"
1814             + "  } catch(e) { log('TypeError'); }\n"
1815             + "</script>\n"
1816             + "</head>\n"
1817             + "<body>\n"
1818             + "</body></html>";
1819 
1820         loadPageVerifyTitle2(html);
1821     }
1822 
1823     /**
1824      * @throws Exception if the test fails
1825      */
1826     @Test
1827     @Alerts({"function", "4,9", "1,16"})
1828     public void splice() throws Exception {
1829         final String html = DOCTYPE_HTML
1830             + "<html>\n"
1831             + "<head>\n"
1832             + "<script>\n"
1833             + LOG_TITLE_FUNCTION
1834             + "  var arr = [1, 4, 9, 16];\n"
1835             + "  log(typeof arr.splice);\n"
1836             + "  log(arr.splice(1, 2));\n"
1837             + "  log(arr);\n"
1838             + "</script>\n"
1839             + "</head>\n"
1840             + "<body>\n"
1841             + "</body></html>";
1842 
1843         loadPageVerifyTitle2(html);
1844     }
1845 
1846     /**
1847      * @throws Exception if the test fails
1848      */
1849     @Test
1850     @Alerts({"function", "4,9", "1,16"})
1851     public void splicePrototype() throws Exception {
1852         final String html = DOCTYPE_HTML
1853             + "<html>\n"
1854             + "<head>\n"
1855             + "<script>\n"
1856             + LOG_TITLE_FUNCTION
1857             + "  var arr = [1, 4, 9, 16];\n"
1858             + "  var splice = Array.prototype.splice;\n"
1859             + "  log(typeof splice);\n"
1860             + "  log(splice.call(arr, 1, 2));\n"
1861             + "  log(arr);\n"
1862             + "</script>\n"
1863             + "</head>\n"
1864             + "<body>\n"
1865             + "</body></html>";
1866 
1867         loadPageVerifyTitle2(html);
1868     }
1869 
1870     /**
1871      * @throws Exception if the test fails
1872      */
1873     @Test
1874     @Alerts({"undefined", "TypeError"})
1875     public void spliceStatic() throws Exception {
1876         final String html = DOCTYPE_HTML
1877             + "<html>\n"
1878             + "<head>\n"
1879             + "<script>\n"
1880             + LOG_TITLE_FUNCTION
1881             + "  log(typeof Array.splice);\n"
1882             + "  var arr = [1, 4, 9, 16];\n"
1883             + "  try {\n"
1884             + "    log(Array.splice(arr, 1, 2));\n"
1885             + "    log(arr);\n"
1886             + "  } catch(e) { log('TypeError'); }\n"
1887             + "</script>\n"
1888             + "</head>\n"
1889             + "<body>\n"
1890             + "</body></html>";
1891 
1892         loadPageVerifyTitle2(html);
1893     }
1894 
1895     /**
1896      * @throws Exception if the test fails
1897      */
1898     @Test
1899     @Alerts({"function", "1,4,9,16,1,2", "1,4,9,16"})
1900     public void concat() throws Exception {
1901         final String html = DOCTYPE_HTML
1902             + "<html>\n"
1903             + "<head>\n"
1904             + "<script>\n"
1905             + LOG_TITLE_FUNCTION
1906             + "  var arr = [1, 4, 9, 16];\n"
1907             + "  log(typeof arr.concat);\n"
1908             + "  log(arr.concat(1, 2));\n"
1909             + "  log(arr);\n"
1910             + "</script>\n"
1911             + "</head>\n"
1912             + "<body>\n"
1913             + "</body></html>";
1914 
1915         loadPageVerifyTitle2(html);
1916     }
1917 
1918     /**
1919      * @throws Exception if the test fails
1920      */
1921     @Test
1922     @Alerts({"function", "1,4,9,16,1,2", "1,4,9,16"})
1923     public void concatPrototype() throws Exception {
1924         final String html = DOCTYPE_HTML
1925             + "<html>\n"
1926             + "<head>\n"
1927             + "<script>\n"
1928             + LOG_TITLE_FUNCTION
1929             + "  var arr = [1, 4, 9, 16];\n"
1930             + "  var concat = Array.prototype.concat;\n"
1931             + "  log(typeof concat);\n"
1932             + "  log(concat.call(arr, 1, 2));\n"
1933             + "  log(arr);\n"
1934             + "</script>\n"
1935             + "</head>\n"
1936             + "<body>\n"
1937             + "</body></html>";
1938 
1939         loadPageVerifyTitle2(html);
1940     }
1941 
1942     /**
1943      * @throws Exception if the test fails
1944      */
1945     @Test
1946     @Alerts({"undefined", "TypeError"})
1947     public void concatStatic() throws Exception {
1948         final String html = DOCTYPE_HTML
1949             + "<html>\n"
1950             + "<head>\n"
1951             + "<script>\n"
1952             + LOG_TITLE_FUNCTION
1953             + "  log(typeof Array.concat);\n"
1954             + "  var arr = [1, 4, 9, 16];\n"
1955             + "  try {\n"
1956             + "    log(Array.concat(arr, 1, 2));\n"
1957             + "    log(arr);\n"
1958             + "  } catch(e) { log('TypeError'); }\n"
1959             + "</script>\n"
1960             + "</head>\n"
1961             + "<body>\n"
1962             + "</body></html>";
1963 
1964         loadPageVerifyTitle2(html);
1965     }
1966 
1967     /**
1968      * @throws Exception if the test fails
1969      */
1970     @Test
1971     @Alerts({"function", "4", "1,4,9,16"})
1972     public void slice() throws Exception {
1973         final String html = DOCTYPE_HTML
1974             + "<html>\n"
1975             + "<head>\n"
1976             + "<script>\n"
1977             + LOG_TITLE_FUNCTION
1978             + "  var arr = [1, 4, 9, 16];\n"
1979             + "  log(typeof arr.slice);\n"
1980             + "  log(arr.slice(1, 2));\n"
1981             + "  log(arr);\n"
1982             + "</script>\n"
1983             + "</head>\n"
1984             + "<body>\n"
1985             + "</body></html>";
1986 
1987         loadPageVerifyTitle2(html);
1988     }
1989 
1990     /**
1991      * @throws Exception if the test fails
1992      */
1993     @Test
1994     @Alerts({"function", "4", "1,4,9,16"})
1995     public void slicePrototype() throws Exception {
1996         final String html = DOCTYPE_HTML
1997             + "<html>\n"
1998             + "<head>\n"
1999             + "<script>\n"
2000             + LOG_TITLE_FUNCTION
2001             + "  var arr = [1, 4, 9, 16];\n"
2002             + "  var slice = Array.prototype.slice;\n"
2003             + "  log(typeof slice);\n"
2004             + "  log(slice.call(arr, 1, 2));\n"
2005             + "  log(arr);\n"
2006             + "</script>\n"
2007             + "</head>\n"
2008             + "<body>\n"
2009             + "</body></html>";
2010 
2011         loadPageVerifyTitle2(html);
2012     }
2013 
2014     /**
2015      * @throws Exception if the test fails
2016      */
2017     @Test
2018     @Alerts({"undefined", "TypeError"})
2019     public void sliceStatic() throws Exception {
2020         final String html = DOCTYPE_HTML
2021             + "<html>\n"
2022             + "<head>\n"
2023             + "<script>\n"
2024             + LOG_TITLE_FUNCTION
2025             + "  log(typeof Array.concat);\n"
2026             + "  var arr = [1, 4, 9, 16];\n"
2027             + "  try {\n"
2028             + "    log(Array.slice(arr, 1, 2));\n"
2029             + "    log(arr);\n"
2030             + "  } catch(e) { log('TypeError'); }\n"
2031             + "</script>\n"
2032             + "</head>\n"
2033             + "<body>\n"
2034             + "</body></html>";
2035 
2036         loadPageVerifyTitle2(html);
2037     }
2038 
2039     /**
2040      * @throws Exception if the test fails
2041      */
2042     @Test
2043     @Alerts({"function", "2", "1,4,9,16"})
2044     public void indexOf() throws Exception {
2045         final String html = DOCTYPE_HTML
2046             + "<html>\n"
2047             + "<head>\n"
2048             + "<script>\n"
2049             + LOG_TITLE_FUNCTION
2050             + "  var arr = [1, 4, 9, 16];\n"
2051             + "  log(typeof arr.indexOf);\n"
2052             + "  log(arr.indexOf(9));\n"
2053             + "  log(arr);\n"
2054             + "</script>\n"
2055             + "</head>\n"
2056             + "<body>\n"
2057             + "</body></html>";
2058 
2059         loadPageVerifyTitle2(html);
2060     }
2061 
2062     /**
2063      * @throws Exception if the test fails
2064      */
2065     @Test
2066     @Alerts({"function", "2", "1,4,9,16"})
2067     public void indexOfPrototype() throws Exception {
2068         final String html = DOCTYPE_HTML
2069             + "<html>\n"
2070             + "<head>\n"
2071             + "<script>\n"
2072             + LOG_TITLE_FUNCTION
2073             + "  var arr = [1, 4, 9, 16];\n"
2074             + "  var indexOf = Array.prototype.indexOf;\n"
2075             + "  log(typeof indexOf);\n"
2076             + "  log(indexOf.call(arr, 9));\n"
2077             + "  log(arr);\n"
2078             + "</script>\n"
2079             + "</head>\n"
2080             + "<body>\n"
2081             + "</body></html>";
2082 
2083         loadPageVerifyTitle2(html);
2084     }
2085 
2086     /**
2087      * @throws Exception if the test fails
2088      */
2089     @Test
2090     @Alerts({"undefined", "TypeError"})
2091     public void indexOfStatic() throws Exception {
2092         final String html = DOCTYPE_HTML
2093             + "<html>\n"
2094             + "<head>\n"
2095             + "<script>\n"
2096             + LOG_TITLE_FUNCTION
2097             + "  log(typeof Array.indexOf);\n"
2098             + "  var arr = [1, 4, 9, 16];\n"
2099             + "  try {\n"
2100             + "    log(Array.indexOf(arr, 9));\n"
2101             + "    log(arr);\n"
2102             + "  } catch(e) { log('TypeError'); }\n"
2103             + "</script>\n"
2104             + "</head>\n"
2105             + "<body>\n"
2106             + "</body></html>";
2107 
2108         loadPageVerifyTitle2(html);
2109     }
2110 
2111     /**
2112      * @throws Exception if the test fails
2113      */
2114     @Test
2115     @Alerts({"function", "2", "1,4,9,16"})
2116     public void lastIndexOf() throws Exception {
2117         final String html = DOCTYPE_HTML
2118             + "<html>\n"
2119             + "<head>\n"
2120             + "<script>\n"
2121             + LOG_TITLE_FUNCTION
2122             + "  var arr = [1, 4, 9, 16];\n"
2123             + "  log(typeof arr.lastIndexOf);\n"
2124             + "  log(arr.lastIndexOf(9));\n"
2125             + "  log(arr);\n"
2126             + "</script>\n"
2127             + "</head>\n"
2128             + "<body>\n"
2129             + "</body></html>";
2130 
2131         loadPageVerifyTitle2(html);
2132     }
2133 
2134     /**
2135      * @throws Exception if the test fails
2136      */
2137     @Test
2138     @Alerts({"function", "2", "1,4,9,16"})
2139     public void lastIndexOfPrototype() throws Exception {
2140         final String html = DOCTYPE_HTML
2141             + "<html>\n"
2142             + "<head>\n"
2143             + "<script>\n"
2144             + LOG_TITLE_FUNCTION
2145             + "  var arr = [1, 4, 9, 16];\n"
2146             + "  var lastIndexOf = Array.prototype.lastIndexOf;\n"
2147             + "  log(typeof lastIndexOf);\n"
2148             + "  log(lastIndexOf.call(arr, 9));\n"
2149             + "  log(arr);\n"
2150             + "</script>\n"
2151             + "</head>\n"
2152             + "<body>\n"
2153             + "</body></html>";
2154 
2155         loadPageVerifyTitle2(html);
2156     }
2157 
2158     /**
2159      * @throws Exception if the test fails
2160      */
2161     @Test
2162     @Alerts({"undefined", "TypeError"})
2163     public void lastIndexOfStatic() throws Exception {
2164         final String html = DOCTYPE_HTML
2165             + "<html>\n"
2166             + "<head>\n"
2167             + "<script>\n"
2168             + LOG_TITLE_FUNCTION
2169             + "  log(typeof Array.lastIndexOf);\n"
2170             + "  var arr = [1, 4, 9, 16];\n"
2171             + "  try {\n"
2172             + "    log(Array.lastIndexOf(arr, 9));\n"
2173             + "    log(arr);\n"
2174             + "  } catch(e) { log('TypeError'); }\n"
2175             + "</script>\n"
2176             + "</head>\n"
2177             + "<body>\n"
2178             + "</body></html>";
2179 
2180         loadPageVerifyTitle2(html);
2181     }
2182 
2183     /**
2184      * @throws Exception if the test fails
2185      */
2186     @Test
2187     @Alerts("3")
2188     public void of() throws Exception {
2189         final String html = DOCTYPE_HTML
2190             + "<html>\n"
2191             + "<head>\n"
2192             + "<script>\n"
2193             + LOG_TITLE_FUNCTION
2194             + "  if (Array.of) {\n"
2195             + "    var arr = Array.of(1, 2, 3);\n"
2196             + "    log(arr.length);\n"
2197             + "  } else {\n"
2198             + "    log('not supported');\n"
2199             + "  }\n"
2200             + "</script>\n"
2201             + "</head>\n"
2202             + "<body>\n"
2203             + "</body></html>";
2204 
2205         loadPageVerifyTitle2(html);
2206     }
2207 }