private-proxy-oom.js (914B)
1 // Check for proxy expando OOM issues. 2 3 function assertThrowsTypeError(f) { 4 assertThrowsInstanceOf(f, TypeError); 5 } 6 7 8 function testing() { 9 var target = {}; 10 var p1 = new Proxy(target, {}); 11 var p2 = new Proxy(target, {}); 12 13 class A extends class { 14 constructor(o) { 15 return o; 16 } 17 } 18 { 19 #field = 10; 20 static gf(o) { 21 return o.#field; 22 } 23 static sf(o) { 24 o.#field = 15; 25 } 26 } 27 28 // Verify field handling on the proxy we install it on. 29 new A(p1); 30 assertEq(A.gf(p1), 10); 31 A.sf(p1) 32 assertEq(A.gf(p1), 15); 33 34 // Should't be on the target 35 assertThrowsTypeError(() => A.gf(target)); 36 37 // Can't set the field, doesn't exist 38 assertThrowsTypeError(() => A.sf(p2)); 39 40 // Definitely can't get the field, doesn't exist. 41 assertThrowsTypeError(() => A.gf(p2)); 42 43 // Still should't be on the target. 44 assertThrowsTypeError(() => A.gf(target)); 45 } 46 47 oomTest(testing);