RESOLVED DUPLICATE of bug 215572 202485
typeof (function that masquerades as undefined) is "function", should be "undefined"
https://bugs.webkit.org/show_bug.cgi?id=202485
Summary typeof (function that masquerades as undefined) is "function", should be "und...
Geoffrey Garen
Reported 2019-10-02 11:17:40 PDT
See https://bugs.webkit.org/show_bug.cgi?id=198805. The openDatabase function is allocated by calling JSFunction::createFunctionThatMasqueradesAsUndefined.
Attachments
test case (313 bytes, text/html)
2019-10-02 11:19 PDT, Geoffrey Garen
no flags
Geoffrey Garen
Comment 1 2019-10-02 11:19:35 PDT
Created attachment 380040 [details] test case
Alexey Proskuryakov
Comment 2 2019-10-04 17:07:39 PDT
The test case produces PASS for me in Safari 13.0.1. PASS: typeof window.openDatabase is undefined
Oz
Comment 3 2019-10-11 01:47:31 PDT
I believe the issue is that (were these both tests) PASS: typeof window.openDatabase is undefined PASS: typeof window.openDatabase is function Both can't be true. Specifically window.openDatabase == "function" is true window.openDatabase == "undefined" is also true http://locutus.sorcerer.co.uk/demo/safari-openDatabase.html
Alexey Shvayka
Comment 4 2020-12-03 09:46:19 PST
(In reply to Oz from comment #3) > PASS: typeof window.openDatabase is undefined > PASS: typeof window.openDatabase is function > > Both can't be true. Nicely noted, thank you. That discrepancy was made possible due to peephole optimization in BytecodeGenerator::emitEqualityOpImpl(), which detects patterns like `typeof X === "Y"` and emits different bytecodes depending on Y. r265907 fixed the `typeof X === "function"` bytecode op to return `false` for masquerader (aka [[IsHTMLDDA]]) objects. test262 coverage was added in https://github.com/tc39/test262/pull/2706. *** This bug has been marked as a duplicate of bug 215572 ***
Note You need to log in before you can comment on or make changes to this bug.