haikuwebkit/LayoutTests/js/array-from.html

11 lines
248 B
HTML
Raw Permalink Normal View History

ES6: Implement Array.from() https://bugs.webkit.org/show_bug.cgi?id=141054 <rdar://problem/19654521> Reviewed by Filip Pizlo. Source/JavaScriptCore: Implement the Array.from() ES6 method as defined in Section 22.1.2.1 of the specification. Given that we can't rely on the built-in global functions or objects to be untainted, I had to expose a few of them directly to the function via private names. In particular: - Math.floor -> @floor - Math.abs -> @abs - Number -> @Number - Array -> @Array - isFinite -> @isFinite * builtins/ArrayConstructor.js: Added. (from): Implementation of Array.from in JavaScript. * runtime/ArrayConstructor.cpp: Add "from" to the lookup table for the constructor object. * runtime/CommonIdentifiers.h: Add the private versions of the identifiers listed above. * runtime/JSGlobalObject.cpp: Add the implementations of those identifiers to the global object (using their private names). (JSC::JSGlobalObject::init): * runtime/JSGlobalObjectFunctions.cpp: (JSC::globalPrivateFuncAbs): Implementation of the abs function. (JSC::globalPrivateFuncFloor): Implementation of the floor function. * runtime/JSGlobalObjectFunctions.h: LayoutTests: Test for Array.from(). The test has one expected failure: using from() on a Set object, which will be addressed in a followup: https://bugs.webkit.org/show_bug.cgi?id=141055 * js/array-from-expected.txt: Added. * js/array-from.html: Added. * js/script-tests/array-from.js: Added. * js/Object-getOwnPropertyNames.html: Update results for the new value on the constructor. Canonical link: https://commits.webkit.org/159839@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@180370 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-02-20 00:20:54 +00:00
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../resources/js-test-pre.js"></script>
</head>
<body>
<script src="script-tests/array-from.js"></script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>