[Webkit-unassigned] [Bug 149380] New: Promise constructor should throw when not called with "new"

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Sep 19 19:01:05 PDT 2015


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

            Bug ID: 149380
           Summary: Promise constructor should throw when not called with
                    "new"
    Classification: Unclassified
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
               URL: http://www.ecma-international.org/ecma-262/6.0/#sec-pr
                    omise-executor
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: ljharb at gmail.com
                CC: darin at apple.com, fpizlo at apple.com,
                    utatane.tea at gmail.com

Per http://www.ecma-international.org/ecma-262/6.0/#sec-promise-executor step 1 - if `newTarget` is undefined, a TypeError should be thrown.

Even if `new.target` isn't yet implemented, this can be 99% fixed with the equivalent of the line `if (!(this instanceof Promise)) { throw new TypeError(this + ' is not a Promise'); }`. If there's internal slots you can check, checking those would be cross-realm-safe as well.

This is the sole Promise violation the es6-shim is currently aware of in Safari 9/WebKit Nightly, and when this is fixed, es6-shim won't have to patch it at all.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20150920/b994e972/attachment.html>


More information about the webkit-unassigned mailing list