[Webkit-unassigned] [Bug 204465] New: `unhandledrejection` event is fired later than specified

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Nov 21 12:04:31 PST 2019


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

            Bug ID: 204465
           Summary: `unhandledrejection` event is fired later than
                    specified
           Product: WebKit
           Version: Safari 13
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: DOM
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: mike at bocoup.com

## Steps to reproduce

(1) Create a document with the following markup

    <!DOCTYPE html>
    <meta charset="utf-8">
    <body>
    <script>
    addEventListener('unhandledrejection', () => {
      console.log('unhandledrejection')
    });
    document.body.addEventListener('readystatechange', () => {
      console.log('readystatechange');
    });
    </script>
    </body>

(2) Open the document
(3) Open the developer's console

A live demonstration is available at [1].

## Expected result

Three messages should be printed in the following sequence:

readystatechange
unhandledrejection
readystatechange

## Actual result

Three messages are printed in the following sequence:

unhandledrejection
readystatechange
readystatechange

Explanation of expected behavior: The script is executed immediately while
parsing is ongoing, and "cleaning up after running script" [2] involves
queueing a task on the DOM manipulation task source to fire the
`unhandledrejection` event. Parsing then completes, immediately transitioning
the document's readiness state to "interactive," and queuing another task on
the DOM manipulation task source to transition the state to "complete."

WebKit's bug does not appear to be a regression. It seems to have exhibited the
incorrect event sequence since the `unhandledrejection` event was introduced in
Safari version 11.1.

A test asserting the expected behavior is under review in the
web-platform-tests project at [3].

[1] https://output.jsbin.com/wozetohudo/quiet
[2] https://html.spec.whatwg.org/multipage/webappapis.html#clean-up-after-running-script
[3] https://github.com/web-platform-tests/wpt/pull/20329

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20191121/99ae064e/attachment.htm>


More information about the webkit-unassigned mailing list