[Webkit-unassigned] [Bug 186991] New: Different output compared with v8 and spidermonkey

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Jun 24 23:44:42 PDT 2018


https://bugs.webkit.org/show_bug.cgi?id=186991

            Bug ID: 186991
           Summary: Different output compared with v8 and spidermonkey
           Product: WebKit
           Version: WebKit Local Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: sunlili at ict.ac.cn

Hello,
The following code behaves incorrectly (inconsistent with the standard and other engines).

arr0 = [ 1, 2, 3 ];                                                                                                                 
arr1 = [ 4, 5, 6 ];  
handler1 = { 
    get: function (oTarget, sKey) { 
        print('arg ' + '1' + ':get ' + sKey.toString()); 
        if (sKey.toString() == 'Symbol(Symbol.isConcatSpreadable)') { 
            arr1['length'] = 4294967294;
        }   
        if (sKey.toString() == 'length') { 
            arr1['length'] = 10; 
        }   
        if (Number(sKey.toString()) != NaN) { ; } 
        return Reflect.get(oTarget, sKey); 
    },  
    has: function (oTarget, sKey) { 
        print('arg ' + '1' + ':has ' + sKey.toString()); 
        if (Number(sKey.toString()) != NaN) { 
            return Symbol.search;
        }   
        return Reflect.has(oTarget, sKey);
     }   
}; 
var proxy1 = new Proxy(arr1, handler1); 
func = Array.prototype.concat.bind(arr0, proxy1); 
arr2 = func(); 
print(arr2);

The output is:
arg 1:get Symbol(Symbol.isConcatSpreadable)
arg 1:get Symbol(Symbol.toPrimitive)
arg 1:get toString
arg 1:get join
arg 1:get length
arg 1:get 0
arg 1:get 1
arg 1:get 2
arg 1:get 3
arg 1:get 4
arg 1:get 5
arg 1:get 6
arg 1:get 7
arg 1:get 8
arg 1:get 9
1,2,3,4,5,6,,,,,,,

However, it should be:
arg 1:get Symbol(Symbol.isConcatSpreadable)
arg 1:get length
arg 1:has 0
arg 1:get 0
arg 1:has 1
arg 1:get 1
arg 1:has 2
arg 1:get 2
arg 1:has 3
arg 1:get 3
arg 1:has 4
arg 1:get 4
arg 1:has 5
arg 1:get 5
arg 1:has 6
arg 1:get 6
arg 1:has 7
arg 1:get 7
arg 1:has 8
arg 1:get 8
arg 1:has 9
arg 1:get 9
1,2,3,4,5,6,,,,,,,

BT group
2018.6.25

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20180625/0b032610/attachment-0001.html>


More information about the webkit-unassigned mailing list