haikuwebkit/LayoutTests/fast/dom/document-all-undefined-expe...

16 lines
423 B
Plaintext
Raw Permalink Normal View History

JavaScript for-of does not work on a lot of collection types (e.g. HTMLCollection) https://bugs.webkit.org/show_bug.cgi?id=167091 Reviewed by Darin Adler. Source/JavaScriptCore: Update Array methods to throw a TypeError when (this === null || this === undefined) instead of when (this == null). This is because (this == null) returns true for types that masquerades as undefined (such as document.all) and this prevented use of the Array API on such types. The specification only stays to use ToObject(), which throws when the input is undefined or null. The corresponding specification is at: - https://www.ecma-international.org/ecma-262/7.0/index.html#sec-array.prototype.values - https://www.ecma-international.org/ecma-262/7.0/index.html#sec-toobject * builtins/ArrayPrototype.js: (values): (keys): (entries): (reduce): (reduceRight): (every): (forEach): (filter): (map): (some): (fill): (find): (findIndex): (includes): (sort): (concatSlowPath): (copyWithin): Source/WebCore: As per the Web IDL specification [1], https://heycam.github.io/webidl/#es-iterator an interface should get an iterator if it has: - an indexed property getter and an integer-typed attribute named "length". We now comply with this part of the Web IDL specification. This adds an iterator to the following interfaces: - AudioTrackList, ClientRectList, CSSRuleList, CSSStyleDeclaration, CSSValueList, MimeTypeArray, WebKitNamedFlowCollection, Plugin, PluginArray, DOMStringList, FileList, HTMLAllCollection, HTMLCollection, HTMLFormElement, HTMLOptionsCollection, HTMLSelectElement, MediaList, NamedNodeMap, SourceBufferList, StyleSheetList, TextTrackCueList, TextTrackList, TouchList, VideoTrackList, VTTRegionList. As a result, it is now possible to use `for ... of` for those types. Tests: fast/dom/FileList-iterator.html fast/dom/collection-iterators.html fast/dom/document-all-undefined.html fast/events/touch/ios/touchlist-iterator.html * bindings/scripts/CodeGeneratorJS.pm: (GetAttributeWithName): (InterfaceNeedsIterator): (GenerateImplementation): (addIterableProperties): LayoutTests: * fast/dom/FileList-iterator-expected.txt: Added. * fast/dom/FileList-iterator.html: Added. * fast/dom/collection-iterators-expected.txt: Added. * fast/dom/collection-iterators.html: Added. * fast/events/touch/ios/touchlist-iterator-expected.txt: Added. * fast/events/touch/ios/touchlist-iterator.html: Added. Add layout test coverage for all types that gained an iterator. * fast/dom/document-all-undefined-expected.txt: Added. * fast/dom/document-all-undefined.html: Added. Add layout test to cover the fact that HTMLAllCollection masquerades as undefined, as per: - https://html.spec.whatwg.org/multipage/obsolete.html#dom-document-all * inspector/model/remote-object-get-properties-expected.txt: Rebaseline now that there is an extra Symbol.iterator property. * platform/wk2/TestExpectations: Skip that requires beginDragWithFiles() as this is unimplemented in WebKitTestRunner. Canonical link: https://commits.webkit.org/184338@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211024 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-22 05:48:28 +00:00
Tests that document.all masquerades as undefined.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS ToBoolean() returned false for document.all
PASS document.all == undefined is true
PASS document.all === undefined is false
PASS document.all == null is true
PASS document.all === null is false
PASS typeof document.all is "undefined"
PASS successfullyParsed is true
TEST COMPLETE