Commit f447e678 authored by Maya Lekova's avatar Maya Lekova Committed by Commit Bot

Implement corectness tests for Proxies constructor

Bug: 
Change-Id: Iea628676cd81f6917e6118657cfd60247a666b5a
Reviewed-on: https://chromium-review.googlesource.com/559329Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Commit-Queue: Maya Lekova <mslekova@google.com>
Cr-Commit-Position: refs/heads/master@{#46402}
parent e81af430
// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
(function testNonObjectTargetTypes() {
assertThrows(function(){ new Proxy(undefined, {}); }, TypeError);
assertThrows(function(){ new Proxy(null, {}); }, TypeError);
assertThrows(function(){ new Proxy('', {}); }, TypeError);
assertThrows(function(){ new Proxy(0, {}); }, TypeError);
assertThrows(function(){ new Proxy(0.5, {}); }, TypeError);
assertThrows(function(){ new Proxy(false, {}); }, TypeError);
})();
(function testRevokedTarget() {
var revocable = Proxy.revocable({}, {});
revocable.revoke();
assertThrows(function(){ new Proxy(revocable.proxy, {}); }, TypeError);
})();
(function testNonObjectHandlerTypes() {
assertThrows(function(){ new Proxy({}, undefined); }, TypeError);
assertThrows(function(){ new Proxy({}, null); }, TypeError);
assertThrows(function(){ new Proxy({}, ''); }, TypeError);
assertThrows(function(){ new Proxy({}, 0); }, TypeError);
assertThrows(function(){ new Proxy({}, 0.5); }, TypeError);
assertThrows(function(){ new Proxy({}, false); }, TypeError);
})();
(function testRevokedHandler() {
var revocable = Proxy.revocable({}, {});
revocable.revoke();
assertThrows(function(){ new Proxy({}, revocable.proxy); }, TypeError);
})();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment