1// Copyright JS Foundation and other contributors, http://js.foundation
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://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// TODO: Update these tests when the internal routine has been implemented
16
17var target = {}
18var handler = {};
19var proxy = new Proxy(target, handler);
20
21var revocable = Proxy.revocable(target, handler);
22revocable.revoke();
23var rev_proxy = revocable.proxy;
24
25try {
26  Proxy(target, handler);
27  assert(false);
28} catch (e) {
29  assert(e instanceof TypeError);
30}
31
32try {
33  new Proxy(undefined, undefined);
34  assert(false);
35} catch (e) {
36  assert(e instanceof TypeError);
37}
38
39try {
40  new Proxy(rev_proxy);
41  assert(false);
42} catch (e) {
43  assert(e instanceof TypeError);
44}
45
46try {
47  new Proxy({}, rev_proxy);
48  assert(false);
49} catch (e) {
50  assert(e instanceof TypeError);
51}
52
53try {
54  new Proxy(rev_proxy, {});
55  assert(false);
56} catch (e) {
57  assert(e instanceof TypeError);
58}
59