Skip to content

Commit 764e978

Browse files
committed
need marshal in JavascriptProxy::GetValueFromDescriptor
my change chakra-core@6aa7967 revealed this bug
1 parent 7399001 commit 764e978

2 files changed

Lines changed: 35 additions & 4 deletions

File tree

lib/Runtime/Library/JavascriptProxy.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1855,7 +1855,7 @@ namespace Js
18551855
{
18561856
if (propertyDescriptor.ValueSpecified())
18571857
{
1858-
return propertyDescriptor.GetValue();
1858+
return CrossSite::MarshalVar(requestContext, propertyDescriptor.GetValue());
18591859
}
18601860
if (propertyDescriptor.GetterSpecified())
18611861
{

test/es6/proxybug.js

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
// Copyright (C) Microsoft. All rights reserved.
33
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
44
//-------------------------------------------------------------------------------------------------------
5+
6+
var passed;
7+
58
var func3 = function ()
69
{
710
var sc4 = WScript.LoadScript('function test(){ obj2.prop4 = {needMarshal:true}; }', 'samethread');
@@ -17,8 +20,36 @@ func3();
1720

1821
var bug = new Proxy(new Array(1), {has: () => true});
1922
var a = bug.concat();
20-
if (a[0] !== undefined || a.length !== 1) {
21-
print("failed");
23+
if(a[0] !== undefined || a.length !== 1) {
24+
passed = "failed";
2225
} else {
23-
print("passed");
26+
passed = "passed";
27+
}
28+
29+
function test0() {
30+
var obj1 = {};
31+
var arrObj0 = {};
32+
var x=1
33+
var proxyHandler = {};
34+
proxyHandler['get'] = function () {};
35+
proxyHandler['defineProperty'] = function (target, property, descriptor) {
36+
return Reflect.defineProperty(target, property, descriptor);
37+
};
38+
proxyHandler['isExtensible'] = function (target) {
39+
arrObj0.prop0;
40+
arrObj0 = new Proxy(arrObj0, proxyHandler);
41+
return Reflect.isExtensible(target);
42+
};
43+
arrObj0 = new Proxy(arrObj0, proxyHandler);
44+
arrObj0 = new Proxy(arrObj0, proxyHandler);
45+
do {
46+
var sc3 = WScript.LoadScript('function test(){arrObj0.length = arrObj0[obj1];}', 'samethread');
47+
sc3.obj1 = obj1;
48+
sc3.arrObj0 = arrObj0;
49+
sc3.test();
50+
} while (x--);
2451
}
52+
test0();
53+
54+
55+
print(passed);

0 commit comments

Comments
 (0)