File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -272,6 +272,8 @@ namespace Js
272
272
{
273
273
JavascriptError::ThrowTypeError (requestContext, JSERR_InconsistentTrapResult, _u (" getOwnPropertyDescriptor" ));
274
274
}
275
+
276
+ // do not use "target" here, the trap may have caused it to change
275
277
if (!targetObj->IsExtensible ())
276
278
{
277
279
JavascriptError::ThrowTypeError (requestContext, JSERR_InconsistentTrapResult, _u (" getOwnPropertyDescriptor" ));
@@ -292,7 +294,8 @@ namespace Js
292
294
// i.Throw a TypeError exception.
293
295
// 22. Return resultDesc.
294
296
295
- BOOL isTargetExtensible = target->IsExtensible ();
297
+ // do not use "target" here, the trap may have caused it to change
298
+ BOOL isTargetExtensible = targetObj->IsExtensible ();
296
299
BOOL toProperty = JavascriptOperators::ToPropertyDescriptor (getResult, resultDescriptor, requestContext);
297
300
if (!toProperty && isTargetExtensible)
298
301
{
Original file line number Diff line number Diff line change @@ -253,6 +253,27 @@ var tests = [
253
253
assert . isTrue ( trapCalled ) ;
254
254
}
255
255
} ,
256
+ {
257
+ name : "Assertion validation : revoking the proxy in getOwnPropertyDescriptor trap, not undefined return" ,
258
+ body ( ) {
259
+ var trapCalled = false ;
260
+ var handler = {
261
+ getOwnPropertyDescriptor : function ( a , b , c ) {
262
+ trapCalled = true ;
263
+ let result = Object . getOwnPropertyDescriptor ( obj , 'proxy' ) ;
264
+
265
+ obj . revoke ( ) ;
266
+
267
+ // used to cause AV
268
+ return result ;
269
+ }
270
+ } ;
271
+
272
+ var obj = Proxy . revocable ( { } , handler ) ;
273
+ Object . getOwnPropertyDescriptor ( obj . proxy ) ;
274
+ assert . isTrue ( trapCalled ) ;
275
+ }
276
+ } ,
256
277
{
257
278
name : "Assertion validation : revoking the proxy by invoking getOwnPropertyDescriptor trap but no handler present" ,
258
279
body ( ) {
You can’t perform that action at this time.
0 commit comments