1// Copyright 2020 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Helper neuter function.
6function nop() { return false; }
7
8// Stubs for non-standard functions.
9try { gc; } catch(e) {
10  this.gc = function () {
11    for (let i = 0; i < 10000; i++) {
12      let s = new String("AAAA" + Math.random());
13    }
14  }
15}
16try { uneval; } catch(e) { this.uneval = this.nop; }
17
18try {
19  // For Chakra tests.
20  WScript;
21} catch(e) {
22  this.WScript = new Proxy({}, {
23    get(target, name) {
24      switch (name) {
25        case 'Echo':
26          return print;
27        default:
28          return {};
29      }
30
31    }
32  });
33}
34
35try { this.alert = console.log; } catch(e) { }
36try { this.print = console.log; } catch(e) { }
37