summaryrefslogtreecommitdiffstats
path: root/net/data/proxy_resolver_v8_unittest/exception_findproxyforurl_during_resolve.js
blob: d5b89328e37078b3e40ea3090a271dca005dfe1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Copyright (c) 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// This PAC script will throw an exception when accessing the "FindProxyForURL"
// the *second* time it is accessed.

function actualFindProxyForURL(url, host) {
  return "DIRECT";
}

var counter = 2;

function FindProxyForURLGetter() {
  counter--;
  if (counter <= 0)
    throw "crash!";
  return actualFindProxyForURL;
}

Object.defineProperty(this, "FindProxyForURL", {get: FindProxyForURLGetter});