document.all can be both 'function' and 'not function'
https://bugs.webkit.org/show_bug.cgi?id=139129
Summary document.all can be both 'function' and 'not function'
Rajaram Gaunker
Reported 2014-12-01 07:39:33 PST
typeof document.all === 'function' return true and var type = typeof document.all; type === 'function' will return false. So if you combine two statements or keep them separate they return different answer. This is happening because document.all is returned to be CallTypeHost. From spec https://html.spec.whatwg.org/#dom-document-all "The user agent must act such that the typeof operator in JavaScript returns the string undefined when applied to the object returned for all."
Attachments
Patch (1.57 KB, patch)
2014-12-01 07:55 PST, Rajaram Gaunker
no flags
Archive of layout-test-results from webkit-ews-12 for mac-mountainlion-wk2 (505.22 KB, application/zip)
2014-12-01 09:01 PST, Build Bot
no flags
Archive of layout-test-results from webkit-ews-06 for mac-mountainlion (516.91 KB, application/zip)
2014-12-01 09:24 PST, Build Bot
no flags
Patch (8.64 KB, patch)
2014-12-02 04:39 PST, Rajaram Gaunker
no flags
Patch (8.64 KB, patch)
2014-12-02 09:42 PST, Rajaram Gaunker
no flags
Rajaram Gaunker
Comment 1 2014-12-01 07:55:00 PST
WebKit Commit Bot
Comment 2 2014-12-01 07:59:03 PST
Comment on attachment 242310 [details] Patch Rejecting attachment 242310 [details] from commit-queue. zimbabao@gmail.com does not have committer permissions according to http://trac.webkit.org/browser/trunk/Tools/Scripts/webkitpy/common/config/contributors.json. - If you do not have committer rights please read http://webkit.org/coding/contributing.html for instructions on how to use bugzilla flags. - If you have committer rights please correct the error in Tools/Scripts/webkitpy/common/config/contributors.json by adding yourself to the file (no review needed). The commit-queue restarts itself every 2 hours. After restart the commit-queue will correctly respect your committer rights.
Build Bot
Comment 3 2014-12-01 09:00:57 PST
Comment on attachment 242310 [details] Patch Attachment 242310 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/6331413246771200 New failing tests: fast/dom/collection-null-like-arguments.html fast/dom/htmlallcollection-call-with-index-caching-bug.html
Build Bot
Comment 4 2014-12-01 09:01:00 PST
Created attachment 242314 [details] Archive of layout-test-results from webkit-ews-12 for mac-mountainlion-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: webkit-ews-12 Port: mac-mountainlion-wk2 Platform: Mac OS X 10.8.5
Build Bot
Comment 5 2014-12-01 09:24:41 PST
Comment on attachment 242310 [details] Patch Attachment 242310 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/5108600087248896 New failing tests: fast/dom/collection-null-like-arguments.html fast/dom/htmlallcollection-call-with-index-caching-bug.html
Build Bot
Comment 6 2014-12-01 09:24:44 PST
Created attachment 242315 [details] Archive of layout-test-results from webkit-ews-06 for mac-mountainlion The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-06 Port: mac-mountainlion Platform: Mac OS X 10.8.5
Sam Weinig
Comment 7 2014-12-01 16:29:13 PST
Comment on attachment 242310 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=242310&action=review > Source/WebCore/ChangeLog:8 > + No new tests This definitely needs tests.
Rajaram Gaunker
Comment 8 2014-12-02 04:39:25 PST
Darin Adler
Comment 9 2014-12-02 09:09:04 PST
Comment on attachment 242399 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=242399&action=review > Source/JavaScriptCore/runtime/CallData.h:45 > + CallTypeCallbleNonFunctionHost, "Callble" is not a word
Rajaram Gaunker
Comment 10 2014-12-02 09:42:19 PST
Geoffrey Garen
Comment 11 2014-12-02 13:16:08 PST
Comment on attachment 242419 [details] Patch It's almost certainly wrong to do this just for document.all. What about all the other callable APIs in the DOM? Also, why do we think that undefined is the right value for typeof? What's the source on that?
Rajaram Gaunker
Comment 12 2014-12-02 17:41:00 PST
@ggaren: Doing it for document.write because that what is mentioned in spec https://html.spec.whatwg.org/#dom-document-all "The user agent must act such that the typeof operator in JavaScript returns the string undefined when applied to the object returned for all." Are there more such APIs?. Also at present (type=typeof document.all, type === 'function')", "(typeof document.all === 'function') return false. Equivalent code pieces giving out different results, which is wrong. and currently typeof document.all returnrs 'undefined'.
Michael Catanzaro
Comment 13 2016-09-17 07:02:15 PDT
Comment on attachment 242419 [details] Patch Hi, Apologies that your patch was not reviewed in a timely manner. Since it's now quite old, I am removing it from the review request queue. Please consider rebasing it on trunk and resubmitting. To increase the chances of getting a review, consider using 'Tools/Scripts/webkit-patch upload --suggest-reviewers' to CC reviewers who might be interested in this bug.
Note You need to log in before you can comment on or make changes to this bug.