aboutsummaryrefslogtreecommitdiff
path: root/test/js-unittest/b_147664838.js
blob: d1d8b7202b08dcbb99c88cf006784325c6c76f5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function FindProxyForURL(url, host){
  let re = /x/y;
  let cnt = 0;
  let str = re[Symbol.replace]("x", {
    toString: () => {
      cnt++;
      if (cnt == 2) {
        re.lastIndex = {valueOf: () => {
          re.x = 42;
          return 0;
        }};
      }
      return 'y$';
    }
  });
  if (str != "y$") {
    throw "regex mutated";
    return "FAIL";
  }
  return "DIRECT";
}