mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 14:04:59 +00:00

Includes all traps except the following: [[Call]], [[Construct]], [[OwnPropertyKeys]]. An important implication of this commit is that any call to any virtual Object method has the potential to throw an exception. These methods were not checked in this commit -- a future commit will have to protect these various method calls throughout the codebase.
30 lines
624 B
JavaScript
30 lines
624 B
JavaScript
load("test-common.js");
|
|
|
|
try {
|
|
new Proxy({}, {});
|
|
|
|
assertThrowsError(() => {
|
|
new Proxy();
|
|
}, {
|
|
error: TypeError,
|
|
message: "Proxy requires at least two arguments",
|
|
});
|
|
|
|
assertThrowsError(() => {
|
|
Proxy();
|
|
}, {
|
|
error: TypeError,
|
|
message: "Proxy must be called with the \"new\" operator",
|
|
});
|
|
|
|
assertThrowsError(() => {
|
|
new Proxy(1, {});
|
|
}, {
|
|
error: TypeError,
|
|
message: "Expected target argument of Proxy constructor to be object, got 1",
|
|
});
|
|
|
|
console.log("PASS");
|
|
} catch (e) {
|
|
console.log("FAIL: " + e);
|
|
}
|