Changeset 215916 in webkit
- Timestamp:
- Apr 27, 2017 8:33:57 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 21 added
- 106 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r215914 r215916 1 2017-04-27 Joseph Pecoraro <pecoraro@apple.com> 2 3 Support for promise rejection events (unhandledrejection) 4 https://bugs.webkit.org/show_bug.cgi?id=150358 5 <rdar://problem/28441651> 6 7 Reviewed by Saam Barati. 8 9 Patch by Joseph Pecoraro and Yusuke Suzuki. 10 11 * js/dom/unhandled-promise-rejection-basic-expected.txt: Added. 12 * js/dom/unhandled-promise-rejection-basic.html: Added. 13 * js/dom/unhandled-promise-rejection-bindings-type-error-expected.txt: Added. 14 * js/dom/unhandled-promise-rejection-bindings-type-error.html: Added. 15 * js/dom/unhandled-promise-rejection-console-no-report-expected.txt: Added. 16 * js/dom/unhandled-promise-rejection-console-no-report.html: Added. 17 * js/dom/unhandled-promise-rejection-console-report-expected.txt: Added. 18 * js/dom/unhandled-promise-rejection-console-report.html: Added. 19 * js/dom/unhandled-promise-rejection-handle-during-event-expected.txt: Added. 20 * js/dom/unhandled-promise-rejection-handle-during-event.html: Added. 21 * js/dom/unhandled-promise-rejection-handle-expected.txt: Added. 22 * js/dom/unhandled-promise-rejection-handle-in-handler-expected.txt: Added. 23 * js/dom/unhandled-promise-rejection-handle-in-handler.html: Added. 24 * js/dom/unhandled-promise-rejection-handle.html: Added. 25 * js/dom/unhandled-promise-rejection-order-expected.txt: Added. 26 * js/dom/unhandled-promise-rejection-order.html: Added. 27 New tests specific to the `onunhandledrejection` and `onrejectionhandled` events. 28 29 * resources/testharnessreport.js: 30 (self.testRunner.add_completion_callback.sanitize): 31 (self.testRunner.add_completion_callback): 32 Report results immediately and then finish the test after a turn. This way 33 if the test ends with a pass, but may get unhandled rejections after 34 completing which should not make the test appear as if it failed. Some tests 35 have unhandled promise rejections but are expected to pass. Likewise some 36 tests perform cleanup in their own completion callbacks, which happen after 37 this initial completion callback, and we want to report results after all 38 the work is done as it may eliminate non-deterministic debug test output. 39 40 * TestExpectations: 41 Mark some tests as flakey that have sometimes have unhandled promise rejections. 42 These tests are all various imported tests that use the testharness. 43 44 * fast/mediastream/MediaStream-MediaElement-setObject-null-expected.txt: 45 * http/tests/security/video-cross-origin-caching-expected.txt: 46 * inspector/debugger/break-on-exception-throw-in-promise-expected.txt: 47 * inspector/debugger/break-on-uncaught-exception-throw-in-promise-expected.txt: 48 * inspector/worker/resources-in-worker-expected.txt: 49 * js/dom/dom-static-property-for-in-iteration-expected.txt: 50 * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: 51 * js/promises-tests/promises-tests-2-2-6-expected.txt: 52 * platform/mac/inspector/model/remote-object-expected.txt: 53 * webrtc/libwebrtc/release-while-creating-offer-expected.txt: 54 * webrtc/libwebrtc/release-while-setting-local-description-expected.txt: 55 Update tests with unhandled promise rejection messages. 56 57 * media/W3C/audio/events/event_pause_manual.html: 58 * media/audio-playback-restriction-play-expected.txt: 59 * media/audio-playback-restriction-play.html: 60 * media/click-volume-bar-not-pausing.html: 61 * media/remote-control-command-is-user-gesture-expected.txt: 62 * media/remote-control-command-is-user-gesture.html: 63 * media/track/track-mode.html: 64 * media/video-autoplay-allowed-but-fullscreen-required.html: 65 * media/video-display-none-crash.html: 66 * media/video-main-content-deny-display-none.html: 67 * media/video-main-content-deny-not-in-dom.html: 68 * media/video-main-content-deny-not-visible.html: 69 * media/video-main-content-deny-obscured.html: 70 * media/video-main-content-deny-too-small.html: 71 * media/video-multiple-concurrent-playback-expected.txt: 72 * media/video-play-audio-require-user-gesture-expected.txt: 73 * media/video-play-audio-require-user-gesture.html: 74 * media/video-play-pause-events-expected.txt: 75 * media/video-play-pause-events.html: 76 * media/video-play-pause-exception-expected.txt: 77 * media/video-play-pause-exception.html: 78 * media/video-play-require-user-gesture-expected.txt: 79 * media/video-play-require-user-gesture.html: 80 * media/video-preload-expected.txt: 81 * media/video-preload.html: 82 * media/video-test.js: 83 (handlePromise.handle): 84 Snuff many possible unhandled promise rejections in media via media.play(). 85 86 * streams/reference-implementation/pipe-to-expected.txt: 87 * streams/reference-implementation/pipe-to-options-expected.txt: 88 * streams/reference-implementation/readable-stream-templated-expected.txt: 89 * streams/reference-implementation/writable-stream-abort-expected.txt: 90 * streams/reference-implementation/writable-stream-expected.txt: 91 These stream tests are out of date and produce unhandled rejections. 92 93 * streams/shadowing-Promise.html: 94 Update non-imported tests to prevent unhandled rejection messages. 95 1 96 2017-04-27 Chris Dumez <cdumez@apple.com> 2 97 -
trunk/LayoutTests/TestExpectations
r215913 r215916 330 330 webkit.org/b/169565 imported/w3c/web-platform-tests/cors/status-async.htm [ Failure ] 331 331 webkit.org/b/169565 imported/w3c/web-platform-tests/cors/304.htm [ Failure ] 332 333 # Tests that are flakey due to unhandled promise rejection error messages 334 webkit.org/b/171094 imported/w3c/web-platform-tests/streams/readable-streams/tee.html [ Pass Failure ] 335 webkit.org/b/171094 streams/brand-checks.html [ Pass Failure ] 336 webkit.org/b/171094 streams/reference-implementation/abstract-ops.html [ Pass Failure ] 332 337 333 338 # WPT tests that fail after doing full test repository reimport and need further investigation -
trunk/LayoutTests/fast/mediastream/MediaStream-MediaElement-setObject-null-expected.txt
r212311 r215916 1 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: [object DOMError] 1 2 PASS video.srcObject = stream did not throw exception. 2 3 PASS video.duration is Number.POSITIVE_INFINITY -
trunk/LayoutTests/http/tests/security/video-cross-origin-caching-expected.txt
r200493 r215916 1 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: [object DOMError] 1 2 2 3 This test passes if you do not see a CORS error. -
trunk/LayoutTests/imported/w3c/ChangeLog
r215914 r215916 1 2017-04-27 Joseph Pecoraro <pecoraro@apple.com> 2 3 Support for promise rejection events (unhandledrejection) 4 https://bugs.webkit.org/show_bug.cgi?id=150358 5 <rdar://problem/28441651> 6 7 Reviewed by Saam Barati. 8 9 Patch by Joseph Pecoraro and Yusuke Suzuki. 10 11 * web-platform-tests/WebCryptoAPI/derive_bits_keys/test_ecdh_bits-expected.txt: 12 * web-platform-tests/WebCryptoAPI/derive_bits_keys/test_ecdh_keys-expected.txt: 13 * web-platform-tests/html/semantics/embedded-content/media-elements/event_pause_noautoplay-expected.txt: 14 * web-platform-tests/html/semantics/embedded-content/media-elements/event_play_noautoplay-expected.txt: 15 * web-platform-tests/html/semantics/embedded-content/media-elements/paused_true_during_pause-expected.txt: 16 * web-platform-tests/html/syntax/parsing/html5lib_innerHTML_adoption01-expected.txt: 17 * web-platform-tests/html/webappapis/scripting/events/body-exposed-window-event-handlers-expected.txt: 18 * web-platform-tests/streams/piping/close-propagation-forward-expected.txt: 19 * web-platform-tests/streams/piping/error-propagation-backward-expected.txt: 20 * web-platform-tests/streams/piping/error-propagation-forward-expected.txt: 21 * web-platform-tests/streams/piping/flow-control-expected.txt: 22 * web-platform-tests/streams/piping/general-expected.txt: 23 * web-platform-tests/user-timing/measure_exceptions_navigation_timing-expected.txt: 24 Rebaseline expectations to include unhandled promise rejection messages. 25 Also change how the test harness reports success or failure to use the values 26 immediately on completion and then allow a run loop cycle before completing 27 the test to gather the output. 28 29 * web-platform-tests/resource-timing/rt-resource-errors.html: 30 This is our own WPT test yet to be uploaded, so update the test to prevent 31 an unexpected unhandled rejection. 32 1 33 2017-04-27 Chris Dumez <cdumez@apple.com> 2 34 -
trunk/LayoutTests/imported/w3c/web-platform-tests/WebCryptoAPI/derive_bits_keys/test_ecdh_bits-expected.txt
r212124 r215916 1 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: DataError (DOM Exception 30): Data provided to an operation does not meet requirements 1 2 deriveBits Tests for ECDH 2 3 3 4 4 Harness Error ( TIMEOUT), message = null5 Harness Error (FAIL), message = Data provided to an operation does not meet requirements 5 6 6 7 -
trunk/LayoutTests/imported/w3c/web-platform-tests/WebCryptoAPI/derive_bits_keys/test_ecdh_keys-expected.txt
r212124 r215916 1 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: DataError (DOM Exception 30): Data provided to an operation does not meet requirements 1 2 deriveKey Tests for ECDH 2 3 3 4 4 Harness Error ( TIMEOUT), message = null5 Harness Error (FAIL), message = Data provided to an operation does not meet requirements 5 6 6 7 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/event_pause_noautoplay-expected.txt
r189476 r215916 1 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: [object DOMError] 2 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: [object DOMError] 1 3 spec reference 2 4 3 5 6 7 Harness Error (FAIL), message = The operation was aborted. 4 8 5 9 PASS audio events - pause -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/event_play_noautoplay-expected.txt
r189476 r215916 1 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: [object DOMError] 2 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: [object DOMError] 1 3 spec reference 2 4 3 5 6 7 Harness Error (FAIL), message = The operation was aborted. 4 8 5 9 PASS audio events - play -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/paused_true_during_pause-expected.txt
r189476 r215916 1 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: [object DOMError] 2 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: [object DOMError] 1 3 spec reference 2 4 3 5 6 7 Harness Error (FAIL), message = The operation was aborted. 4 8 5 9 PASS audio events - paused property -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/html5lib_innerHTML_adoption01-expected.txt
r210823 r215916 3 3 4 4 5 Harness Error (FAIL), message = ReferenceError: Can't find variable: template6 7 5 FAIL html5lib_innerHTML_adoption01.html 0bf80e1546d4c221354aa9734f61713b7d64ee6d assert_equals: expected "#document\n| <b>\n| <em>\n| <foo>\n| <foob>\n| <fooc>\n| <aside>\n| <b>" but got "#document\n| <b>\n| <em>\n| <foo>\n| <foob>\n| <fooc>\n| <aside>\n| <em>\n| <b>" 8 6 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/events/body-exposed-window-event-handlers-expected.txt
r213882 r215916 32 32 PASS Return null when getting the popstate event handler of a windowless body 33 33 PASS Ignore setting of popstate window event handlers on windowless body 34 FAIL Return null when getting the rejectionhandled event handler of a windowless body assert_equals: expected (object) null but got (undefined) undefined 34 PASS Return null when getting the rejectionhandled event handler of a windowless body 35 35 FAIL Ignore setting of rejectionhandled window event handlers on windowless body assert_equals: expected (object) null but got (function) function "function () { return "Handler attached to windowless element"; }" 36 36 PASS Return null when getting the storage event handler of a windowless body 37 37 PASS Ignore setting of storage window event handlers on windowless body 38 FAIL Return null when getting the unhandledrejection event handler of a windowless body assert_equals: expected (object) null but got (undefined) undefined 38 PASS Return null when getting the unhandledrejection event handler of a windowless body 39 39 FAIL Ignore setting of unhandledrejection window event handlers on windowless body assert_equals: expected (object) null but got (function) function "function () { return "Handler attached to windowless element"; }" 40 40 PASS Return null when getting the unload event handler of a windowless body … … 72 72 PASS Return null when getting the popstate event handler of a windowless frameset 73 73 PASS Ignore setting of popstate window event handlers on windowless frameset 74 FAIL Return null when getting the rejectionhandled event handler of a windowless frameset assert_equals: expected (object) null but got (undefined) undefined 74 PASS Return null when getting the rejectionhandled event handler of a windowless frameset 75 75 FAIL Ignore setting of rejectionhandled window event handlers on windowless frameset assert_equals: expected (object) null but got (function) function "function () { return "Handler attached to windowless element"; }" 76 76 PASS Return null when getting the storage event handler of a windowless frameset 77 77 PASS Ignore setting of storage window event handlers on windowless frameset 78 FAIL Return null when getting the unhandledrejection event handler of a windowless frameset assert_equals: expected (object) null but got (undefined) undefined 78 PASS Return null when getting the unhandledrejection event handler of a windowless frameset 79 79 FAIL Ignore setting of unhandledrejection window event handlers on windowless frameset assert_equals: expected (object) null but got (function) function "function () { return "Handler attached to windowless element"; }" 80 80 PASS Return null when getting the unload event handler of a windowless frameset -
trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/rt-resource-errors.html
r212449 r215916 34 34 let allowedDataURL = crossOriginURL("cors-allowed", "resource-timing/resources/data.json") + "&pipe=header(Access-Control-Allow-Origin,*)"; 35 35 36 fetch(rejectedDataURL) ;36 fetch(rejectedDataURL).catch(function(){}); 37 37 fetch(allowedDataURL); 38 38 -
trunk/LayoutTests/imported/w3c/web-platform-tests/streams/piping/close-propagation-forward-expected.txt
r215164 r215916 1 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 2 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 3 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 4 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 5 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 6 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 7 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 8 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 9 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 10 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 11 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 12 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 13 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 14 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 15 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 16 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 17 18 Harness Error (FAIL), message = cancel() called on a reader owned by no readable stream 1 19 2 20 FAIL Closing must be propagated forward: starts closed; preventClose omitted; fulfilled close promise assert_array_equals: close must always be called with the controller lengths differ, expected 1 got 0 -
trunk/LayoutTests/imported/w3c/web-platform-tests/streams/piping/error-propagation-backward-expected.txt
r212202 r215916 1 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: error2: error2! 2 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: error1: error1! 1 3 2 Harness Error ( TIMEOUT), message = null4 Harness Error (FAIL), message = error1! 3 5 4 6 PASS Errors must be propagated backward: starts errored; preventCancel omitted; fulfilled cancel promise -
trunk/LayoutTests/imported/w3c/web-platform-tests/streams/piping/error-propagation-forward-expected.txt
r212202 r215916 1 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: error1: error1! 2 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 3 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: error1: error1! 4 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 5 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: error2: error2! 6 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: error1: error1! 7 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 8 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: error1: error1! 9 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 10 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: error1: error1! 11 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 12 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: error1: error1! 13 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 14 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: error1: error1! 15 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 16 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: error1: error1! 17 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 18 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: error1: error1! 19 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 20 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: error1: error1! 21 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: error1: error1! 22 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: error1: error1! 23 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: error1: error1! 24 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: error1: error1! 25 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: error1: error1! 26 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: error1: error1! 27 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: error1: error1! 28 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 29 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: error1: error1! 30 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 31 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: error2: error2! 32 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: error1: error1! 33 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: error1: error1! 34 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 35 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: error1: error1! 36 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 37 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: error2: error2! 38 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: error1: error1! 39 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: error1: error1! 40 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 41 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: error1: error1! 42 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 43 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: error2: error2! 44 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: error1: error1! 45 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: error1: error1! 46 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 47 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: error1: error1! 48 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 49 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: error2: error2! 50 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: error1: error1! 51 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: error1: error1! 52 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: error1: error1! 53 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 54 55 Harness Error (FAIL), message = cancel() called on a reader owned by no readable stream 1 56 2 57 PASS Errors must be propagated forward: starts errored; preventAbort = false; fulfilled abort promise -
trunk/LayoutTests/imported/w3c/web-platform-tests/streams/piping/flow-control-expected.txt
r215164 r215916 1 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: Error: assert_array_equals: close must always be called with the controller lengths differ, expected 1 got 0 2 3 Harness Error (FAIL), message = assert_array_equals: close must always be called with the controller lengths differ, expected 1 got 0 1 4 2 5 FAIL Piping from a non-empty ReadableStream into a WritableStream that does not desire chunks promise_test: Unhandled rejection with value: object "TypeError: ws.controller.error is not a function. (In 'ws.controller.error(error1)', 'ws.controller.error' is undefined)" -
trunk/LayoutTests/imported/w3c/web-platform-tests/streams/piping/general-expected.txt
r212202 r215916 1 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: The WritableStream.ready getter can only be used on instances of WritableStream 2 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 3 CONSOLE MESSAGE: line 2684: TypeError: undefined is not an object (evaluating 'e.message') 4 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: undefined 5 CONSOLE MESSAGE: line 2684: TypeError: undefined is not an object (evaluating 'e.message') 6 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: undefined 7 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 8 CONSOLE MESSAGE: line 2684: TypeError: undefined is not an object (evaluating 'e.message') 9 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: undefined 10 CONSOLE MESSAGE: line 2684: TypeError: undefined is not an object (evaluating 'e.message') 11 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: undefined 12 CONSOLE MESSAGE: line 2684: TypeError: undefined is not an object (evaluating 'e.message') 13 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: undefined 14 15 Harness Error (FAIL), message = The WritableStream.ready getter can only be used on instances of WritableStream 1 16 2 17 FAIL Piping must lock both the ReadableStream and WritableStream assert_false: sanity check: the WritableStream must not start locked expected false got undefined -
trunk/LayoutTests/imported/w3c/web-platform-tests/user-timing/measure_exceptions_navigation_timing-expected.txt
r215164 r215916 5 5 6 6 7 Harness Error (FAIL), message = ReferenceError: Can't find variable: onload_test8 9 7 PASS window.performance.measure("measure", "loadEventEnd"), where "loadEventEnd" is a navigation timing attribute with a value of 0, throws a InvalidAccessError exception. 10 8 PASS window.performance.measure("measure", "loadEventEnd", "responseEnd"), where "loadEventEnd" is a navigation timing attribute with a value of 0, throws a InvalidAccessError exception. -
trunk/LayoutTests/inspector/debugger/break-on-exception-throw-in-promise-expected.txt
r202825 r215916 2 2 CONSOLE MESSAGE: line 38: in promise 3 3 CONSOLE MESSAGE: line 7: throwing TestError 4 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TestError 4 5 CONSOLE MESSAGE: line 55: testThrowingInPromiseThen 5 6 CONSOLE MESSAGE: line 57: in promise 6 7 CONSOLE MESSAGE: line 60: in promise.then 7 8 CONSOLE MESSAGE: line 7: throwing TestError 9 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TestError 8 10 CONSOLE MESSAGE: line 66: testThrowingInPromiseThenWithCatch 9 11 CONSOLE MESSAGE: line 68: in promise … … 21 23 CONSOLE MESSAGE: line 7: throwing TestError 22 24 CONSOLE MESSAGE: line 85: in promise.catch 25 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TestError 23 26 Checking pause locations within Promises when pausing on all exceptions. 24 27 -
trunk/LayoutTests/inspector/debugger/break-on-uncaught-exception-throw-in-promise-expected.txt
r202825 r215916 2 2 CONSOLE MESSAGE: line 38: in promise 3 3 CONSOLE MESSAGE: line 7: throwing TestError 4 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TestError 4 5 CONSOLE MESSAGE: line 55: testThrowingInPromiseThen 5 6 CONSOLE MESSAGE: line 57: in promise 6 7 CONSOLE MESSAGE: line 60: in promise.then 7 8 CONSOLE MESSAGE: line 7: throwing TestError 9 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TestError 8 10 CONSOLE MESSAGE: line 66: testThrowingInPromiseThenWithCatch 9 11 CONSOLE MESSAGE: line 68: in promise … … 21 23 CONSOLE MESSAGE: line 7: throwing TestError 22 24 CONSOLE MESSAGE: line 85: in promise.catch 25 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TestError 23 26 Checking no pauses within Promises when pausing on uncaught exceptions. 24 27 -
trunk/LayoutTests/inspector/worker/resources-in-worker-expected.txt
r208520 r215916 1 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: Type error 1 2 Test for Resources in a Worker. 2 3 -
trunk/LayoutTests/js/dom/dom-static-property-for-in-iteration-expected.txt
r210029 r215916 90 90 PASS a["onprogress"] is null 91 91 PASS a["onratechange"] is null 92 PASS a["onrejectionhandled"] is null 92 93 PASS a["onreset"] is null 93 94 PASS a["onresize"] is null … … 101 102 PASS a["ontimeupdate"] is null 102 103 PASS a["ontoggle"] is null 104 PASS a["onunhandledrejection"] is null 103 105 PASS a["onvolumechange"] is null 104 106 PASS a["onwaiting"] is null … … 111 113 PASS a["localName"] is a 112 114 PASS a["offsetLeft"] is 8 113 PASS a["offsetTop"] is 1 689115 PASS a["offsetTop"] is 1719 114 116 PASS a["offsetWidth"] is 40 115 117 PASS a["offsetHeight"] is 18 -
trunk/LayoutTests/js/dom/global-constructors-attributes-dedicated-worker-expected.txt
r212449 r215916 240 240 PASS [Worker] Object.getOwnPropertyDescriptor(global, 'Promise').enumerable is false 241 241 PASS [Worker] Object.getOwnPropertyDescriptor(global, 'Promise').configurable is true 242 PASS [Worker] Object.getOwnPropertyDescriptor(global, 'PromiseRejectionEvent').value is PromiseRejectionEvent 243 PASS [Worker] Object.getOwnPropertyDescriptor(global, 'PromiseRejectionEvent').hasOwnProperty('get') is false 244 PASS [Worker] Object.getOwnPropertyDescriptor(global, 'PromiseRejectionEvent').hasOwnProperty('set') is false 245 PASS [Worker] Object.getOwnPropertyDescriptor(global, 'PromiseRejectionEvent').enumerable is false 246 PASS [Worker] Object.getOwnPropertyDescriptor(global, 'PromiseRejectionEvent').configurable is true 242 247 PASS [Worker] Object.getOwnPropertyDescriptor(global, 'RangeError').value is RangeError 243 248 PASS [Worker] Object.getOwnPropertyDescriptor(global, 'RangeError').hasOwnProperty('get') is false -
trunk/LayoutTests/js/promises-tests/promises-tests-2-2-6-expected.txt
r174307 r215916 1 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: [object Object] 2 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: [object Object] 3 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: [object Object] 4 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: [object Object] 5 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: [object Object] 6 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: [object Object] 1 7 Test Promise with Promise A+ tests 2.2.6. 2 8 -
trunk/LayoutTests/media/W3C/w3cwrapper.js
r155282 r215916 60 60 assert_false = function(a) { shouldBeFalse("" + a); } 61 61 62 // Don't report unhandled promise rejections in these tests. 63 window.onunhandledrejection = function() { return false; } 64 62 65 var successfullyParsed = true; -
trunk/LayoutTests/media/audio-playback-restriction-play-expected.txt
r197953 r215916 5 5 RUN(video.src = findMediaFile('audio', 'content/test')) 6 6 EVENT(canplaythrough) 7 RUN( video.play())7 RUN(handlePromise(video.play())) 8 8 EXPECTED (video.paused == 'true') OK 9 9 Running with keyDown. -
trunk/LayoutTests/media/audio-playback-restriction-play.html
r197953 r215916 21 21 function canplaythrough() 22 22 { 23 run(" video.play()");23 run("handlePromise(video.play())"); 24 24 testExpected('video.paused', true); 25 25 runWithKeyDown(playWithKeyDown); -
trunk/LayoutTests/media/click-volume-bar-not-pausing.html
r210959 r215916 79 79 80 80 mediaElement.pause(); 81 mediaElement.play();81 handlePromise(mediaElement.play()); 82 82 } 83 83 -
trunk/LayoutTests/media/media-file.js
r83210 r215916 73 73 return filename; 74 74 } 75 76 function handlePromise(promise) { 77 function handle() { } 78 return promise.then(handle, handle); 79 } -
trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-auto-hide-mouse-leave-after-play.html
r211374 r215916 39 39 debug("Resuming media playback."); 40 40 media.addEventListener("play", mediaResumedPlaying); 41 media.play() ;41 media.play().catch(function(){}); 42 42 } 43 43 -
trunk/LayoutTests/media/modern-media-controls/playback-support/playback-support-media-api.html
r208226 r215916 34 34 }); 35 35 36 media.play() ;36 media.play().catch(function(){}); 37 37 38 38 </script> -
trunk/LayoutTests/media/modern-media-controls/start-support/start-support-manual-play.html
r208226 r215916 32 32 }); 33 33 34 media.play() ;34 media.play().catch(function(){}); 35 35 36 36 </script> -
trunk/LayoutTests/media/remote-control-command-is-user-gesture-expected.txt
r199515 r215916 7 7 8 8 * video.play() should fail 9 RUN( video.play())9 RUN(handlePromise(video.play())) 10 10 EXPECTED (video.paused == 'true') OK 11 11 -
trunk/LayoutTests/media/remote-control-command-is-user-gesture.html
r199515 r215916 26 26 { 27 27 consoleWrite('<br>* video.play() should fail '); 28 run(' video.play()');28 run('handlePromise(video.play())'); 29 29 testExpected('video.paused', true); 30 30 -
trunk/LayoutTests/media/track/track-cues-pause-on-exit.html
r154815 r215916 6 6 <script src=../media-file.js></script> 7 7 <script src=../video-test.js></script> 8 </head> 9 <body onload="bodyLoaded()"> 10 <p>Tests that the video is paused after cues that have pause-on-exit flag are processed</p> 11 <video controls> 12 <track id="testTrack" src="captions-webvtt/simple-captions.vtt" onload="loaded()" default> 13 </video> 8 14 <script> 9 15 var videoCanPlayThrough = false; … … 76 82 setCaptionDisplayMode('Automatic'); 77 83 </script> 78 </head>79 <body onload="bodyLoaded()">80 <p>Tests that the video is paused after cues that have pause-on-exit flag are processed</p>81 <video controls>82 <track id="testTrack" src="captions-webvtt/simple-captions.vtt" onload="loaded()" default>83 </video>84 84 </body> 85 85 </html> -
trunk/LayoutTests/media/track/track-mode.html
r154527 r215916 77 77 78 78 consoleWrite("<b>++ at least " + textTrack.cues.length + " events expected while mode = showing</b>"); 79 video.play();79 handlePromise(video.play()); 80 80 } 81 81 -
trunk/LayoutTests/media/video-autoplay-allowed-but-fullscreen-required.html
r198609 r215916 16 16 17 17 function canPlayThrough() { 18 v ideo.play();18 var promise = video.play(); 19 19 waitForEventAndFail('playing'); 20 20 setTimeout(didNotPlay, 100); 21 promise.catch(didNotPlay); 21 22 } 22 23 -
trunk/LayoutTests/media/video-display-none-crash.html
r79630 r215916 5 5 <script> 6 6 video.src = findMediaFile("video", "content/test"); 7 video.play();7 handlePromise(video.play()); 8 8 video.style.display = "none"; 9 9 video.pause(); -
trunk/LayoutTests/media/video-main-content-deny-display-none.html
r197953 r215916 16 16 17 17 function canPlayThrough() { 18 v ideo.play();18 var promise = video.play(); 19 19 waitForEventAndFail('playing'); 20 20 setTimeout(didNotBeginPlaying, 100); 21 promise.catch(didNotBeginPlaying); 21 22 } 22 23 -
trunk/LayoutTests/media/video-main-content-deny-not-in-dom.html
r197953 r215916 16 16 17 17 function canPlayThrough() { 18 v ideo.play();18 var promise = video.play(); 19 19 waitForEventAndFail('playing'); 20 20 setTimeout(didNotBeginPlaying, 100); 21 promise.catch(didNotBeginPlaying); 21 22 } 22 23 -
trunk/LayoutTests/media/video-main-content-deny-not-visible.html
r197953 r215916 16 16 17 17 function canPlayThrough() { 18 v ideo.play();18 var promise = video.play(); 19 19 waitForEventAndFail('playing'); 20 20 setTimeout(didNotBeginPlaying, 100); 21 promise.catch(didNotBeginPlaying); 21 22 } 22 23 -
trunk/LayoutTests/media/video-main-content-deny-obscured.html
r197953 r215916 16 16 17 17 function canPlayThrough() { 18 v ideo.play();18 var promise = video.play(); 19 19 waitForEventAndFail('playing'); 20 20 setTimeout(didNotBeginPlaying, 100); 21 promise.catch(didNotBeginPlaying); 21 22 } 22 23 -
trunk/LayoutTests/media/video-main-content-deny-too-small.html
r200778 r215916 17 17 18 18 function canPlayThrough() { 19 v ideo.play();19 var promise = video.play(); 20 20 waitForEventAndFail('playing'); 21 21 setTimeout(didNotBeginPlaying, 100); 22 promise.catch(didNotBeginPlaying); 22 23 } 23 24 -
trunk/LayoutTests/media/video-paint-test.js
r120416 r215916 14 14 waitForMultipleEvents("canplaythrough", videos.length, function() { 15 15 for (var i = 0; i < videos.length; ++i) { 16 videos[i].play();16 handlePromise(videos[i].play()); 17 17 videos[i].addEventListener("playing", function(event) { 18 18 event.target.pause(); … … 43 43 waitForMultipleEvents("canplaythrough", videos.length, function() { 44 44 for (var i = 0; i < videos.length; ++i) { 45 videos[i].play();45 handlePromise(videos[i].play()); 46 46 videos[i].addEventListener("playing", function(event) { 47 47 event.target.pause(); … … 66 66 }); 67 67 } 68 69 function handlePromise(promise) 70 { 71 function handle() { } 72 return promise.then(handle, handle); 73 } -
trunk/LayoutTests/media/video-play-audio-require-user-gesture-expected.txt
r201109 r215916 5 5 6 6 * No user gesture initiated 7 RUN( video.play())7 RUN(handlePromise(video.play())) 8 8 TEST(video.webkitEnterFullScreen()) THROWS(DOMException.INVALID_STATE_ERR) OK 9 9 EXPECTED (video.paused == 'true') OK -
trunk/LayoutTests/media/video-play-audio-require-user-gesture.html
r210959 r215916 38 38 consoleWrite(""); 39 39 consoleWrite("* No user gesture initiated"); 40 run(" video.play()");40 run("handlePromise(video.play())"); 41 41 testDOMException("video.webkitEnterFullScreen()", "DOMException.INVALID_STATE_ERR"); 42 42 testExpected("video.paused", true); -
trunk/LayoutTests/media/video-play-pause-events-expected.txt
r158743 r215916 2 2 Test that calling play() and pause() triggers async play, timeupdate and pause events. 3 3 4 RUN( video.play())4 RUN(handlePromise(video.play())) 5 5 RUN(video.pause()) 6 6 SCRIPT DONE -
trunk/LayoutTests/media/video-play-pause-events.html
r79630 r215916 4 4 <script src=video-test.js></script> 5 5 <script> 6 video.src = findMediaFile("video", "content/test .mp4");6 video.src = findMediaFile("video", "content/test"); 7 7 8 8 waitForEvent("loadstart"); … … 20 20 21 21 22 run(" video.play()");22 run("handlePromise(video.play())"); 23 23 run("video.pause()"); 24 24 -
trunk/LayoutTests/media/video-play-pause-exception-expected.txt
r158743 r215916 2 2 Video has no src. Test that the playing event is not dispatched. 3 3 4 RUN( video.play())4 RUN(handlePromise(video.play())) 5 5 RUN(video.pause()) 6 6 EVENT(waiting) -
trunk/LayoutTests/media/video-play-pause-exception.html
r176043 r215916 27 27 waitForEvent("pause", onpause); 28 28 29 run(" video.play()");29 run("handlePromise(video.play())"); 30 30 run("video.pause()"); 31 31 </script> -
trunk/LayoutTests/media/video-play-require-user-gesture-expected.txt
r158743 r215916 5 5 6 6 * No user gesture initiated 7 RUN( video.play())7 RUN(handlePromise(video.play())) 8 8 TEST(video.webkitEnterFullScreen()) THROWS(DOMException.INVALID_STATE_ERR) OK 9 9 EXPECTED (video.paused == 'true') OK -
trunk/LayoutTests/media/video-play-require-user-gesture.html
r210959 r215916 38 38 consoleWrite(""); 39 39 consoleWrite("* No user gesture initiated"); 40 run(" video.play()");40 run("handlePromise(video.play())"); 41 41 testDOMException("video.webkitEnterFullScreen()", "DOMException.INVALID_STATE_ERR"); 42 42 testExpected("video.paused", true); -
trunk/LayoutTests/media/video-played-collapse-expected.txt
r158743 r215916 9 9 Test playing when there are no ranges 10 10 EVENT(seeked) 11 RUN( video.play())11 RUN(handlePromise(video.play())) 12 12 RUN(video.pause()) 13 13 EVENT(pause) … … 18 18 Create a new range 19 19 EVENT(seeked) 20 RUN( video.play())20 RUN(handlePromise(video.play())) 21 21 RUN(video.pause()) 22 22 EVENT(pause) … … 29 29 Test playing from one range into another, should collapse the two ranges 30 30 EVENT(seeked) 31 RUN( video.play())31 RUN(handlePromise(video.play())) 32 32 RUN(video.pause()) 33 33 EVENT(pause) … … 39 39 RUN(video.loop = true) 40 40 EVENT(seeked) 41 RUN( video.play())41 RUN(handlePromise(video.play())) 42 42 RUN(video.pause()) 43 43 EVENT(pause) -
trunk/LayoutTests/media/video-played-ranges-1-expected.txt
r158743 r215916 8 8 9 9 Test playing when there are no ranges 10 RUN( video.play())10 RUN(handlePromise(video.play())) 11 11 RUN(video.pause()) 12 12 EVENT(pause) … … 16 16 17 17 Test jumping forward into a new range and play 18 RUN( video.play())18 RUN(handlePromise(video.play())) 19 19 RUN(video.pause()) 20 20 EVENT(pause) … … 26 26 27 27 Test jumping backwards into a new range and play, should insert new range 28 RUN( video.play())28 RUN(handlePromise(video.play())) 29 29 RUN(video.pause()) 30 30 EVENT(pause) … … 38 38 39 39 Test playing into an existing range, should extend range start 40 RUN( video.play())40 RUN(handlePromise(video.play())) 41 41 RUN(video.pause()) 42 42 EVENT(pause) … … 50 50 51 51 Test jumping into an existing range and play beyond end, should extend range end 52 RUN( video.play())52 RUN(handlePromise(video.play())) 53 53 RUN(video.pause()) 54 54 EVENT(pause) -
trunk/LayoutTests/media/video-played-reset-expected.txt
r158743 r215916 8 8 9 9 Test playing when there are no ranges 10 RUN( video.play())10 RUN(handlePromise(video.play())) 11 11 RUN(video.pause()) 12 12 EVENT(pause) … … 23 23 24 24 Test jumping forward into a new range and play 25 RUN( video.play())25 RUN(handlePromise(video.play())) 26 26 RUN(video.pause()) 27 27 EVENT(pause) -
trunk/LayoutTests/media/video-played.js
r151942 r215916 109 109 } 110 110 111 run(" video.play()");111 run("handlePromise(video.play())"); 112 112 113 113 var startTime = nowInSecs(); -
trunk/LayoutTests/media/video-preload-expected.txt
r158743 r215916 8 8 EVENT(loadstart) 9 9 did not buffer automatically OK 10 RUN( video.play())10 RUN(handlePromise(video.play())) 11 11 EVENT(play) 12 12 EVENT(loadedmetadata) -
trunk/LayoutTests/media/video-preload.html
r79630 r215916 51 51 // start playback, which should force data to load 52 52 movie.shouldBuffer = true; 53 run(" video.play()");53 run("handlePromise(video.play())"); 54 54 } 55 55 -
trunk/LayoutTests/media/video-test.js
r210555 r215916 442 442 443 443 } 444 445 function handlePromise(promise) { 446 function handle() { } 447 return promise.then(handle, handle); 448 } -
trunk/LayoutTests/platform/mac/inspector/model/remote-object-expected.txt
r215855 r215916 1 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: undefined 2 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: result 1 3 2 4 ----------------------------------------------------- -
trunk/LayoutTests/resources/testharnessreport.js
r212150 r215916 45 45 setup({"output": false, "explicit_timeout": true}); 46 46 47 /* Using a callback function, test results will be added to the page in a 47 /* Using a callback function, test results will be added to the page in a 48 48 * manner that allows dumpAsText to produce readable test results 49 49 */ 50 50 add_completion_callback(function (tests, harness_status) { 51 // Wait for any other completion callbacks 52 setTimeout(function() { 53 var results = document.createElement("pre"); 54 var resultStr = "\n"; 51 var results = document.createElement("pre"); 52 var resultStr = "\n"; 55 53 56 // Sanitizes the given text for display in test results. 57 function sanitize(text) { 58 if (!text) { 59 return ""; 60 } 61 text = text.replace(/\0/g, "\\0"); 62 return text.replace(/\r/g, "\\r"); 54 // Sanitizes the given text for display in test results. 55 function sanitize(text) { 56 if (!text) { 57 return ""; 63 58 } 59 text = text.replace(/\0/g, "\\0"); 60 return text.replace(/\r/g, "\\r"); 61 } 64 62 65 66 63 if(harness_status.status != 0) 64 resultStr += "Harness Error (" + convertResult(harness_status.status) + "), message = " + harness_status.message + "\n\n"; 67 65 68 for (var i = 0; i < tests.length; i++) { 69 var message = sanitize(tests[i].message); 70 if (tests[i].status == 1 && !tests[i].dumpStack) { 71 // Remove stack for failed tests for proper string comparison without file paths. 72 // For a test to dump the stack set its dumpStack attribute to true. 73 var stackIndex = message.indexOf("(stack:"); 74 if (stackIndex > 0) 75 message = message.substr(0, stackIndex); 76 } 77 resultStr += convertResult(tests[i].status) + " " + sanitize(tests[i].name) + " " + message + "\n"; 66 for (var i = 0; i < tests.length; i++) { 67 var message = sanitize(tests[i].message); 68 if (tests[i].status == 1 && !tests[i].dumpStack) { 69 // Remove stack for failed tests for proper string comparison without file paths. 70 // For a test to dump the stack set its dumpStack attribute to true. 71 var stackIndex = message.indexOf("(stack:"); 72 if (stackIndex > 0) 73 message = message.substr(0, stackIndex); 78 74 } 75 resultStr += convertResult(tests[i].status) + " " + sanitize(tests[i].name) + " " + message + "\n"; 76 } 79 77 80 81 82 83 84 85 78 results.innerText = resultStr; 79 var log = document.getElementById("log"); 80 if (log) 81 log.appendChild(results); 82 else 83 document.body.appendChild(results); 86 84 85 // Wait for any other completion callbacks, which may eliminate test elements 86 // from the page and therefore reduce the output. 87 setTimeout(function () { 87 88 testRunner.notifyDone(); 88 89 }, 0); -
trunk/LayoutTests/streams/reference-implementation/pipe-to-expected.txt
r192765 r215916 1 CONSOLE MESSAGE: line 2687: TypeError: undefined is not an object (evaluating 'e.message') 2 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: undefined 3 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: Error: horrible things 4 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: Error: horrible things 5 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 6 CONSOLE MESSAGE: line 2687: TypeError: undefined is not an object (evaluating 'e.message') 7 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: undefined 8 CONSOLE MESSAGE: line 2687: TypeError: undefined is not an object (evaluating 'e.message') 9 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: undefined 10 CONSOLE MESSAGE: line 2687: TypeError: undefined is not an object (evaluating 'e.message') 11 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: undefined 12 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: Error: horrible things 13 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: Error: horrible things 14 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 15 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 16 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: Error: horrible things 17 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 18 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: Error: I don't like you. 19 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: Error: I don't like you. 20 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: Error: I don't like you. 21 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: Error: I don't like you. 22 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: Error: I don't like you. 23 24 Harness Error (FAIL), message = I don't like you. 1 25 2 26 PASS Piping from a ReadableStream from which lots of data are readable synchronously -
trunk/LayoutTests/streams/reference-implementation/pipe-to-options-expected.txt
r192765 r215916 1 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: Error: destination error 2 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: Error: destination error 3 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: Error: destination error 4 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: Error: destination error 5 6 Harness Error (FAIL), message = destination error 1 7 2 8 PASS Piping with no options and a destination error -
trunk/LayoutTests/streams/reference-implementation/readable-stream-templated-expected.txt
r193824 r215916 1 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 2 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: Error: boo! 3 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 4 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: Error: boo! 5 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: Error: boo! 6 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 7 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: Error: boo! 8 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 9 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: Error: boo! 10 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: Error: !!! 11 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: Error: !!! 12 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: Error: !!! 13 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: Error: !!! 14 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 15 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 16 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: cancel() called on a reader owned by no readable stream 17 18 Harness Error (FAIL), message = cancel() called on a reader owned by no readable stream 1 19 2 20 PASS Running templatedRSClosed with ReadableStream (closed via call in start) -
trunk/LayoutTests/streams/reference-implementation/writable-stream-abort-expected.txt
r191669 r215916 1 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: a 2 CONSOLE MESSAGE: line 2687: TypeError: undefined is not an object (evaluating 'e.message') 3 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: undefined 4 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: Error: Sorry, it just wasn't meant to be. 5 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: Error: Sorry, it just wasn't meant to be. 6 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: Error: Sorry, it just wasn't meant to be. 7 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: Error: Sorry, it just wasn't meant to be. 8 CONSOLE MESSAGE: line 2687: TypeError: undefined is not an object (evaluating 'e.message') 9 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: undefined 10 CONSOLE MESSAGE: line 2687: TypeError: undefined is not an object (evaluating 'e.message') 11 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: undefined 12 CONSOLE MESSAGE: line 2687: TypeError: undefined is not an object (evaluating 'e.message') 13 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: undefined 14 CONSOLE MESSAGE: line 2687: TypeError: undefined is not an object (evaluating 'e.message') 15 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: undefined 16 CONSOLE MESSAGE: line 2687: TypeError: undefined is not an object (evaluating 'e.message') 17 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: undefined 18 CONSOLE MESSAGE: line 2687: TypeError: undefined is not an object (evaluating 'e.message') 19 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: undefined 20 CONSOLE MESSAGE: line 2687: TypeError: undefined is not an object (evaluating 'e.message') 21 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: undefined 22 CONSOLE MESSAGE: line 2687: TypeError: undefined is not an object (evaluating 'e.message') 23 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: undefined 24 CONSOLE MESSAGE: line 2687: TypeError: undefined is not an object (evaluating 'e.message') 25 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: undefined 26 CONSOLE MESSAGE: line 2687: TypeError: undefined is not an object (evaluating 'e.message') 27 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: undefined 28 29 Harness Error (FAIL), message = TypeError: undefined is not an object (evaluating 'e.message') 1 30 2 31 PASS Aborting a WritableStream immediately prevents future writes -
trunk/LayoutTests/streams/reference-implementation/writable-stream-expected.txt
r194366 r215916 1 CONSOLE MESSAGE: line 2687: TypeError: undefined is not an object (evaluating 'e.message') 2 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: undefined 3 4 Harness Error (FAIL), message = TypeError: undefined is not an object (evaluating 'e.message') 1 5 2 6 PASS error argument is given to start method -
trunk/LayoutTests/streams/shadowing-Promise.html
r212147 r215916 32 32 const PromiseRejectBackup = Promise.reject; 33 33 34 function handle() { } 35 34 36 try { 35 37 Promise.reject = function() { assert_unreached("streams should not use this Promise.reject method"); }; 36 38 37 ReadableStream.prototype.cancel.call({}, "reason") ;38 WritableStream.prototype.abort.call({}, "reason") ;39 ReadableStream.prototype.cancel.call({}, "reason").then(handle, handle); 40 WritableStream.prototype.abort.call({}, "reason").then(handle, handle); 39 41 } finally { 40 42 Promise.reject = PromiseRejectBackup; -
trunk/LayoutTests/webrtc/libwebrtc/release-while-creating-offer-expected.txt
r213282 r215916 1 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: Argument 1 ('candidate') to RTCPeerConnection.addIceCandidate must be an instance of RTCIceCandidate 1 2 PASS successfullyParsed is true 2 3 -
trunk/LayoutTests/webrtc/libwebrtc/release-while-setting-local-description-expected.txt
r213282 r215916 1 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: TypeError: Argument 1 ('candidate') to RTCPeerConnection.addIceCandidate must be an instance of RTCIceCandidate 2 CONSOLE MESSAGE: line 1: Unhandled Promise Rejection: InvalidStateError (DOM Exception 11): The object is in an invalid state. 1 3 PASS successfullyParsed is true 2 4 -
trunk/Source/JavaScriptCore/ChangeLog
r215908 r215916 1 2017-04-27 Joseph Pecoraro <pecoraro@apple.com> 2 3 Support for promise rejection events (unhandledrejection) 4 https://bugs.webkit.org/show_bug.cgi?id=150358 5 <rdar://problem/28441651> 6 7 Reviewed by Saam Barati. 8 9 Patch by Joseph Pecoraro and Yusuke Suzuki. 10 11 Implement support for promise.[[PromiseIsHandled]] and the 12 HostPromiseRejectionTracker hook for HTML to track promise rejections: 13 https://tc39.github.io/ecma262/#sec-host-promise-rejection-tracker 14 https://html.spec.whatwg.org/multipage/webappapis.html#unhandled-promise-rejections 15 16 * builtins/BuiltinNames.h: 17 New private symbols. 18 19 * builtins/PromiseOperations.js: 20 (globalPrivate.newHandledRejectedPromise): 21 Utility to create a rejected promise with [[PromiseIsHandled]] to true. 22 23 (globalPrivate.rejectPromise): 24 (globalPrivate.initializePromise): 25 * builtins/PromisePrototype.js: 26 (then): 27 Implement standard behavior of [[PromiseIsHandled]] and the host hook. 28 29 * runtime/JSPromise.cpp: 30 (JSC::JSPromise::isHandled): 31 * runtime/JSPromise.h: 32 C++ accessors for the [[PromiseIsHandled]] state. 33 34 * bytecode/BytecodeIntrinsicRegistry.cpp: 35 (JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry): 36 * bytecode/BytecodeIntrinsicRegistry.h: 37 Expose private values for the Reject / Handle enum values in built-ins. 38 39 * jsc.cpp: 40 * runtime/JSGlobalObject.h: 41 (JSC::JSGlobalObject::promiseResolveFunction): 42 Add a new GlobalObjectMethodTable hook matching the promise rejection hook. 43 44 * runtime/JSGlobalObject.cpp: 45 (JSC::JSGlobalObject::init): 46 (JSC::JSGlobalObject::visitChildren): 47 * runtime/JSGlobalObjectFunctions.cpp: 48 (JSC::globalFuncHostPromiseRejectionTracker): 49 * runtime/JSGlobalObjectFunctions.h: 50 Plumb the builtin hook through to the optional GlobalObjectMethodTable hook. 51 52 * inspector/InjectedScriptSource.js: 53 (InjectedScript.prototype.createFakeValueDescriptor): 54 Silence possible rejected promises created internally via Web Inspector. 55 1 56 2017-04-27 Saam Barati <sbarati@apple.com> 2 57 -
trunk/Source/JavaScriptCore/builtins/BuiltinNames.h
r214931 r215916 83 83 macro(templateRegistryKey) \ 84 84 macro(enqueueJob) \ 85 macro(hostPromiseRejectionTracker) \ 86 macro(promiseIsHandled) \ 85 87 macro(promiseState) \ 86 88 macro(promiseReactions) \ -
trunk/Source/JavaScriptCore/builtins/PromiseOperations.js
r209455 r215916 86 86 87 87 @globalPrivate 88 function newHandledRejectedPromise(error) 89 { 90 let promise = @Promise.@reject(error); 91 promise.@promiseIsHandled = true; 92 return promise; 93 } 94 95 @globalPrivate 88 96 function triggerPromiseReactions(state, reactions, argument) 89 97 { … … 105 113 106 114 @InspectorInstrumentation.promiseRejected(promise, reason, reactions); 115 116 if (!promise.@promiseIsHandled) 117 @hostPromiseRejectionTracker(promise, @promiseRejectionReject); 107 118 108 119 @triggerPromiseReactions(@promiseStateRejected, reactions, reason); … … 213 224 this.@promiseState = @promiseStatePending; 214 225 this.@promiseReactions = []; 226 this.@promiseIsHandled = false; 215 227 216 228 var resolvingFunctions = @createResolvingFunctions(this); -
trunk/Source/JavaScriptCore/builtins/PromisePrototype.js
r209455 r215916 53 53 if (state === @promiseStatePending) 54 54 @putByValDirect(this.@promiseReactions, this.@promiseReactions.length, reaction); 55 else 55 else { 56 if (state === @promiseStateRejected && !this.@promiseIsHandled) 57 @hostPromiseRejectionTracker(this, @promiseRejectionHandle); 56 58 @enqueueJob(@promiseReactionJob, [state, reaction, this.@promiseResult]); 59 } 60 61 this.@promiseIsHandled = true; 57 62 58 63 return resultCapability.@promise; -
trunk/Source/JavaScriptCore/bytecode/BytecodeIntrinsicRegistry.cpp
r212019 r215916 33 33 #include "JSCJSValueInlines.h" 34 34 #include "JSGeneratorFunction.h" 35 #include "JSGlobalObject.h" 35 36 #include "JSModuleLoader.h" 36 37 #include "JSPromise.h" … … 62 63 m_ModuleLink.set(m_vm, jsNumber(static_cast<unsigned>(JSModuleLoader::Status::Link))); 63 64 m_ModuleReady.set(m_vm, jsNumber(static_cast<unsigned>(JSModuleLoader::Status::Ready))); 65 m_promiseRejectionReject.set(m_vm, jsNumber(static_cast<unsigned>(JSPromiseRejectionOperation::Reject))); 66 m_promiseRejectionHandle.set(m_vm, jsNumber(static_cast<unsigned>(JSPromiseRejectionOperation::Handle))); 64 67 m_promiseStatePending.set(m_vm, jsNumber(static_cast<unsigned>(JSPromise::Status::Pending))); 65 68 m_promiseStateFulfilled.set(m_vm, jsNumber(static_cast<unsigned>(JSPromise::Status::Fulfilled))); -
trunk/Source/JavaScriptCore/bytecode/BytecodeIntrinsicRegistry.h
r212019 r215916 74 74 macro(ModuleLink) \ 75 75 macro(ModuleReady) \ 76 macro(promiseRejectionReject) \ 77 macro(promiseRejectionHandle) \ 76 78 macro(promiseStatePending) \ 77 79 macro(promiseStateFulfilled) \ -
trunk/Source/JavaScriptCore/inspector/InjectedScriptSource.js
r210910 r215916 590 590 if (symbol) 591 591 descriptor.symbol = symbol; 592 // Silence any possible unhandledrejection exceptions created from accessing a native accessor with a wrong this object. 593 if (descriptor.value instanceof Promise) 594 descriptor.value.catch(function(){}); 592 595 return descriptor; 593 596 } catch (e) { -
trunk/Source/JavaScriptCore/jsc.cpp
r215896 r215916 1432 1432 &shouldInterruptScript, 1433 1433 &javaScriptRuntimeFlags, 1434 nullptr, 1434 nullptr, // queueTaskToEventLoop 1435 1435 &shouldInterruptScriptBeforeTimeout, 1436 1436 &moduleLoaderImportModule, 1437 1437 &moduleLoaderResolve, 1438 1438 &moduleLoaderFetch, 1439 nullptr, 1440 nullptr, 1441 nullptr 1439 nullptr, // moduleLoaderInstantiate 1440 nullptr, // moduleLoaderEvaluate 1441 nullptr, // promiseRejectionTracker 1442 nullptr, // defaultLanguage 1442 1443 }; 1443 1444 -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
r215673 r215916 249 249 &shouldInterruptScript, 250 250 &javaScriptRuntimeFlags, 251 nullptr, 251 nullptr, // queueTaskToEventLoop 252 252 &shouldInterruptScriptBeforeTimeout, 253 nullptr, 254 nullptr, 255 nullptr, 256 nullptr, 257 nullptr, 258 nullptr 253 nullptr, // moduleLoaderImportModule 254 nullptr, // moduleLoaderResolve 255 nullptr, // moduleLoaderFetch 256 nullptr, // moduleLoaderInstantiate 257 nullptr, // moduleLoaderEvaluate 258 nullptr, // promiseRejectionTracker 259 nullptr, // defaultLanguage 259 260 }; 260 261 … … 814 815 GlobalPropertyInfo(vm.propertyNames->builtinNames().mapIteratorNextPrivateName(), JSFunction::create(vm, this, 0, String(), privateFuncMapIteratorNext), DontEnum | DontDelete | ReadOnly), 815 816 817 GlobalPropertyInfo(vm.propertyNames->builtinNames().hostPromiseRejectionTrackerPrivateName(), JSFunction::create(vm, this, 2, String(), globalFuncHostPromiseRejectionTracker), DontEnum | DontDelete | ReadOnly), 816 818 GlobalPropertyInfo(vm.propertyNames->builtinNames().InspectorInstrumentationPrivateName(), InspectorInstrumentationObject::create(vm, this, InspectorInstrumentationObject::createStructure(vm, this, m_objectPrototype.get())), DontEnum | DontDelete | ReadOnly), 817 819 GlobalPropertyInfo(vm.propertyNames->builtinNames().MapPrivateName(), mapConstructor, DontEnum | DontDelete | ReadOnly), -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h
r215777 r215916 162 162 #undef DECLARE_SIMPLE_BUILTIN_TYPE 163 163 164 class JSInternalPromise; 165 class InternalPromisePrototype; 166 class InternalPromiseConstructor; 167 168 typedef Vector<ExecState*, 16> ExecStateStack; 164 enum class JSPromiseRejectionOperation : unsigned { 165 Reject, // When a promise is rejected without any handlers. 166 Handle, // When a handler is added to a rejected promise for the first time. 167 }; 169 168 170 169 struct GlobalObjectMethodTable { … … 198 197 typedef JSValue (*ModuleLoaderEvaluatePtr)(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSValue, JSValue); 199 198 ModuleLoaderEvaluatePtr moduleLoaderEvaluate; 199 200 typedef void (*PromiseRejectionTrackerPtr)(JSGlobalObject*, ExecState*, JSPromise*, JSPromiseRejectionOperation); 201 PromiseRejectionTrackerPtr promiseRejectionTracker; 200 202 201 203 typedef String (*DefaultLanguageFunctionPtr)(); -
trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
r214143 r215916 31 31 #include "IndirectEvalExecutable.h" 32 32 #include "Interpreter.h" 33 #include "JSCInlines.h" 33 34 #include "JSFunction.h" 34 35 #include "JSGlobalObject.h" 35 36 #include "JSInternalPromise.h" 36 37 #include "JSModuleLoader.h" 38 #include "JSPromise.h" 37 39 #include "JSPromiseDeferred.h" 38 40 #include "JSString.h" … … 45 47 #include "Parser.h" 46 48 #include "StackVisitor.h" 47 #include <wtf/dtoa.h>48 49 #include <stdio.h> 49 50 #include <stdlib.h> … … 53 54 #include <wtf/MathExtras.h> 54 55 #include <wtf/StringExtras.h> 56 #include <wtf/dtoa.h> 55 57 #include <wtf/text/StringBuilder.h> 56 58 #include <wtf/unicode/UTF8.h> … … 296 298 if (number >= mantissaOverflowLowerBound) 297 299 number = parseIntOverflow(firstDigitPosition, data - firstDigitPosition, 8); 298 300 299 301 return number; 300 302 } … … 373 375 break; 374 376 } 375 377 376 378 // Empty string. 377 379 if (characters == endCharacters) 378 380 return 0.0; 379 381 380 382 double number; 381 383 if (characters[0] == '0' && characters + 2 < endCharacters) { … … 390 392 } else 391 393 number = jsStrDecimalLiteral(characters, endCharacters); 392 394 393 395 // Allow trailing white space. 394 396 for (; characters < endCharacters; ++characters) { … … 398 400 if (characters != endCharacters) 399 401 return PNaN; 400 402 401 403 return number; 402 404 } … … 490 492 LiteralParser<UChar> preparser(exec, s.characters16(), s.length(), NonStrictJSON); 491 493 if (JSValue parsedObject = preparser.tryLiteralParse()) 492 return JSValue::encode(parsedObject); 494 return JSValue::encode(parsedObject); 493 495 } 494 496 … … 683 685 return throwVMTypeError(exec, scope); 684 686 } 685 687 686 688 EncodedJSValue JSC_HOST_CALL globalFuncThrowTypeErrorArgumentsCalleeAndCaller(ExecState* exec) 687 689 { … … 734 736 bool shouldThrowIfCantSet = true; 735 737 thisObject->setPrototype(vm, exec, value, shouldThrowIfCantSet); 738 return JSValue::encode(jsUndefined()); 739 } 740 741 EncodedJSValue JSC_HOST_CALL globalFuncHostPromiseRejectionTracker(ExecState* exec) 742 { 743 JSGlobalObject* globalObject = exec->lexicalGlobalObject(); 744 VM& vm = globalObject->vm(); 745 auto scope = DECLARE_THROW_SCOPE(vm); 746 747 if (!globalObject->globalObjectMethodTable()->promiseRejectionTracker) 748 return JSValue::encode(jsUndefined()); 749 750 JSPromise* promise = jsCast<JSPromise*>(exec->argument(0)); 751 JSValue operationValue = exec->argument(1); 752 753 ASSERT(operationValue.isNumber()); 754 auto operation = static_cast<JSPromiseRejectionOperation>(operationValue.toUInt32(exec)); 755 ASSERT(operation == JSPromiseRejectionOperation::Reject || operation == JSPromiseRejectionOperation::Handle); 756 ASSERT(!scope.exception()); 757 758 globalObject->globalObjectMethodTable()->promiseRejectionTracker(globalObject, exec, promise, operation); 759 RETURN_IF_EXCEPTION(scope, { }); 760 736 761 return JSValue::encode(jsUndefined()); 737 762 } -
trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.h
r214038 r215916 50 50 EncodedJSValue JSC_HOST_CALL globalFuncProtoGetter(ExecState*); 51 51 EncodedJSValue JSC_HOST_CALL globalFuncProtoSetter(ExecState*); 52 EncodedJSValue JSC_HOST_CALL globalFuncHostPromiseRejectionTracker(ExecState*); 52 53 EncodedJSValue JSC_HOST_CALL globalFuncBuiltinLog(ExecState*); 53 54 EncodedJSValue JSC_HOST_CALL globalFuncImportModule(ExecState*); -
trunk/Source/JavaScriptCore/runtime/JSPromise.cpp
r209455 r215916 86 86 } 87 87 88 bool JSPromise::isHandled(VM& vm) const 89 { 90 JSValue value = getDirect(vm, vm.propertyNames->builtinNames().promiseIsHandledPrivateName()); 91 ASSERT(value.isBoolean()); 92 return value.asBoolean(); 93 } 94 88 95 } // namespace JSC -
trunk/Source/JavaScriptCore/runtime/JSPromise.h
r206525 r215916 46 46 47 47 Status status(VM&) const; 48 JSValue result(VM&) const; 48 JS_EXPORT_PRIVATE JSValue result(VM&) const; 49 JS_EXPORT_PRIVATE bool isHandled(VM&) const; 49 50 50 51 // Initialize the promise with the executor. -
trunk/Source/WebCore/CMakeLists.txt
r215907 r215916 467 467 dom/ProcessingInstruction.idl 468 468 dom/ProgressEvent.idl 469 dom/PromiseRejectionEvent.idl 469 470 dom/Range.idl 470 471 dom/RequestAnimationFrameCallback.idl … … 1537 1538 dom/ProcessingInstruction.cpp 1538 1539 dom/ProgressEvent.cpp 1540 dom/PromiseRejectionEvent.cpp 1539 1541 dom/PseudoElement.cpp 1540 1542 dom/QualifiedName.cpp 1541 1543 dom/RadioButtonGroups.cpp 1542 1544 dom/Range.cpp 1545 dom/RejectedPromiseTracker.cpp 1543 1546 dom/ScopedEventQueue.cpp 1544 1547 dom/ScriptElement.cpp -
trunk/Source/WebCore/ChangeLog
r215914 r215916 1 2017-04-27 Joseph Pecoraro <pecoraro@apple.com> 2 3 Support for promise rejection events (unhandledrejection) 4 https://bugs.webkit.org/show_bug.cgi?id=150358 5 <rdar://problem/28441651> 6 7 Reviewed by Saam Barati. 8 9 Patch by Joseph Pecoraro and Yusuke Suzuki. 10 11 Implement support for the `onunhandledrejection` and `rejectionhandled` events. 12 They dispatch a new PromiseRejectionEvent using the ES6 HostPromiseRejectionTracker hook: 13 https://tc39.github.io/ecma262/#sec-host-promise-rejection-tracker 14 https://html.spec.whatwg.org/multipage/webappapis.html#unhandled-promise-rejections 15 16 This is currently implemented only for Documents and not yet Web Workers. 17 18 Tests: js/dom/unhandled-promise-rejection-basic.html 19 js/dom/unhandled-promise-rejection-bindings-type-error.html 20 js/dom/unhandled-promise-rejection-console-no-report.html 21 js/dom/unhandled-promise-rejection-console-report.html 22 js/dom/unhandled-promise-rejection-handle-during-event.html 23 js/dom/unhandled-promise-rejection-handle-in-handler.html 24 js/dom/unhandled-promise-rejection-handle.html 25 js/dom/unhandled-promise-rejection-order.html 26 27 * CMakeLists.txt: 28 * DerivedSources.cpp: 29 * DerivedSources.make: 30 * WebCore.xcodeproj/project.pbxproj: 31 * dom/DOMAllInOne.cpp: 32 New files. 33 34 * bindings/scripts/CodeGenerator.pm: 35 (IsPromiseType): 36 * bindings/scripts/CodeGeneratorJS.pm: 37 (AddToIncludesForIDLType): 38 (GetBaseIDLType): 39 Binding support for Promise<T> attributes. 40 41 * bindings/js/JSDOMConvert.h: 42 * bindings/js/JSDOMConvertPromise.h: Copied from Source/JavaScriptCore/runtime/JSPromise.h. 43 (WebCore::Converter<IDLPromise<T>>::convert): 44 (WebCore::JSConverter<IDLPromise<T>>::convert): 45 Promise<T> binding conversion is currently unimplemented, which only means 46 web developers creating their own PromiseRejectionEvent will not get 47 autowrapping of values assigned to `promise` in event initialization. 48 Engine generated events will have expected behavior. 49 50 * bindings/js/JSDOMWindowBase.cpp: 51 (WebCore::JSDOMWindowBase::promiseRejectionTracker): 52 * bindings/js/JSDOMWindowBase.h: 53 * bindings/js/JSWorkerGlobalScopeBase.cpp: 54 Implement HostPromiseRejectionTracker hook for Document but not Worker. 55 Passes through to the ScriptExecutionContext's tracker. 56 57 * bindings/js/JSMainThreadExecState.cpp: 58 (WebCore::JSMainThreadExecState::didLeaveScriptContext): 59 * bindings/js/JSMainThreadExecState.h: 60 (WebCore::JSMainThreadExecState::~JSMainThreadExecState): 61 When completing script execution and performing microtasks notify 62 about rejected promises. Technically this should go inside of 63 performing a microtask checkpoint, except lacking EventLoop 64 concepts we use ScriptExecutionState. 65 66 * dom/EventNames.h: 67 * dom/EventNames.in: 68 * dom/PromiseRejectionEvent.cpp: Added. 69 (WebCore::PromiseRejectionEvent::PromiseRejectionEvent): 70 (WebCore::PromiseRejectionEvent::~PromiseRejectionEvent): 71 * dom/PromiseRejectionEvent.h: Added. 72 * dom/PromiseRejectionEvent.idl: Added. 73 New PromiseRejectionEvent event interface. 74 75 * dom/GlobalEventHandlers.idl: 76 New onunhandledrejection and onrejectionhandled. 77 78 * dom/RejectedPromiseTracker.cpp: Added. 79 (WebCore::RejectedPromise::RejectedPromise): 80 (WebCore::RejectedPromise::globalObject): 81 (WebCore::RejectedPromise::promise): 82 (WebCore::UnhandledPromise::UnhandledPromise): 83 (WebCore::UnhandledPromise::callStack): 84 (WebCore::RejectedPromiseTracker::RejectedPromiseTracker): 85 (WebCore::RejectedPromiseTracker::~RejectedPromiseTracker): 86 (WebCore::createScriptCallStackFromReason): 87 (WebCore::RejectedPromiseTracker::promiseRejected): 88 (WebCore::RejectedPromiseTracker::promiseHandled): 89 (WebCore::RejectedPromiseTracker::processQueueSoon): 90 (WebCore::RejectedPromiseTracker::reportUnhandledRejections): 91 (WebCore::RejectedPromiseTracker::reportRejectionHandled): 92 * dom/RejectedPromiseTracker.h: Added. 93 Track and report rejected promises. The promises are tracked weakly 94 allowing them to be collected before they are reported. When reporting 95 we dispatch PromiseRejectionEvent events, and if the default is not 96 prevented we log a message to the console. 97 98 * dom/ScriptExecutionContext.cpp: 99 (WebCore::ScriptExecutionContext::reportUnhandledPromiseRejection): 100 (WebCore::ScriptExecutionContext::ensureRejectedPromiseTrackerSlow): 101 * dom/ScriptExecutionContext.h: 102 (WebCore::ScriptExecutionContext::ensureRejectedPromiseTracker): 103 Each ScriptExecutionContext can own a rejected promise tracker. 104 105 * html/HTMLMediaElement.cpp: 106 (WebCore::HTMLMediaElement::pauseInternal): 107 https://html.spec.whatwg.org/multipage/embedded-content.html#internal-pause-steps 108 Internal pause steps say to timeupdate, pause, and rejecting pending play promises 109 should all happen in a queued task. Here the first two actions are already scheduled 110 on tasks, but rejecting play promises was not being done in a task, so this makes 111 that change. 112 113 * Modules/streams/ReadableStream.js: 114 (pipeThrough): 115 * Modules/streams/ReadableStreamInternals.js: 116 (readableStreamReaderGenericInitialize): 117 (readableStreamError): 118 (readableStreamReaderGenericRelease): 119 Satisfy parts of the Streams specification which state to set the 120 [[PromiseIsHandled]] internal state of promises created internally 121 by the Streams APIs. This prevents some internal promises from 122 appearing as unhandled promise rejections. 123 1 124 2017-04-27 Chris Dumez <cdumez@apple.com> 2 125 -
trunk/Source/WebCore/DerivedSources.cpp
r215429 r215916 380 380 #include "JSProcessingInstruction.cpp" 381 381 #include "JSProgressEvent.cpp" 382 #include "JSPromiseRejectionEvent.cpp" 382 383 #include "JSRadioNodeList.cpp" 383 384 #include "JSRange.cpp" -
trunk/Source/WebCore/DerivedSources.make
r215629 r215916 404 404 $(WebCore)/dom/ProcessingInstruction.idl \ 405 405 $(WebCore)/dom/ProgressEvent.idl \ 406 $(WebCore)/dom/Pro gressEvent.idl \406 $(WebCore)/dom/PromiseRejectionEvent.idl \ 407 407 $(WebCore)/dom/Range.idl \ 408 408 $(WebCore)/dom/RequestAnimationFrameCallback.idl \ -
trunk/Source/WebCore/Modules/streams/ReadableStream.js
r215429 r215916 111 111 const writable = streams.writable; 112 112 const readable = streams.readable; 113 this.pipeTo(writable, options); 113 const promise = this.pipeTo(writable, options); 114 if (@isPromise(promise)) 115 promise.@promiseIsHandled = true; 114 116 return readable; 115 117 } -
trunk/Source/WebCore/Modules/streams/ReadableStreamInternals.js
r215429 r215916 55 55 else { 56 56 @assert(stream.@state === @streamErrored); 57 reader.@closedPromiseCapability = { @promise: @ Promise.@reject(stream.@storedError) };57 reader.@closedPromiseCapability = { @promise: @newHandledRejectedPromise(stream.@storedError) }; 58 58 } 59 59 } … … 280 280 281 281 reader.@closedPromiseCapability.@reject.@call(@undefined, error); 282 reader.@closedPromiseCapability.@promise.@promiseIsHandled = true; 282 283 } 283 284 … … 494 495 @assert(reader.@ownerReadableStream.@reader === reader); 495 496 496 if (reader.@ownerReadableStream.@state === @streamReadable) 497 if (reader.@ownerReadableStream.@state === @streamReadable) { 497 498 reader.@closedPromiseCapability.@reject.@call(@undefined, new @TypeError("releasing lock of reader whose stream is still in readable state")); 498 else 499 reader.@closedPromiseCapability = { @promise: @Promise.@reject(new @TypeError("reader released lock")) }; 499 reader.@closedPromiseCapability.@promise.@promiseIsHandled = true; 500 } else 501 reader.@closedPromiseCapability = { @promise: @newHandledRejectedPromise(new @TypeError("reader released lock")) }; 500 502 501 503 reader.@ownerReadableStream.@reader = @undefined; -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r215907 r215916 4357 4357 A5732B0A136A161D005C8D7C /* DateComponents.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5732B08136A161D005C8D7C /* DateComponents.cpp */; }; 4358 4358 A5732B0B136A161D005C8D7C /* DateComponents.h in Headers */ = {isa = PBXBuildFile; fileRef = A5732B09136A161D005C8D7C /* DateComponents.h */; settings = {ATTRIBUTES = (Private, ); }; }; 4359 A578F4351DE00EEB003DFC6A /* PromiseRejectionEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = A578F4331DE00ED6003DFC6A /* PromiseRejectionEvent.h */; }; 4360 A578F4361DE00EED003DFC6A /* PromiseRejectionEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A578F4321DE00ED6003DFC6A /* PromiseRejectionEvent.cpp */; }; 4361 A578F43B1DE01421003DFC6A /* JSPromiseRejectionEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A578F4391DE013FB003DFC6A /* JSPromiseRejectionEvent.cpp */; }; 4362 A578F43C1DE01423003DFC6A /* JSPromiseRejectionEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = A578F43A1DE013FB003DFC6A /* JSPromiseRejectionEvent.h */; }; 4363 A578F43F1DE0B630003DFC6A /* RejectedPromiseTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = A578F43E1DE0B62B003DFC6A /* RejectedPromiseTracker.h */; settings = {ATTRIBUTES = (Private, ); }; }; 4364 A578F4401DE0B634003DFC6A /* RejectedPromiseTracker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A578F43D1DE0B62B003DFC6A /* RejectedPromiseTracker.cpp */; }; 4359 4365 A57FD71B1DB9423E006AE24B /* WorkerRuntimeAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A57FD7191DB94236006AE24B /* WorkerRuntimeAgent.cpp */; }; 4360 4366 A57FD71C1DB9423E006AE24B /* WorkerRuntimeAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = A57FD71A1DB94236006AE24B /* WorkerRuntimeAgent.h */; }; … … 6657 6663 E3150EA71DA7219300194012 /* DOMJITHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = E3150EA51DA7218D00194012 /* DOMJITHelpers.h */; }; 6658 6664 E318039D1DC40099009932C2 /* JSDynamicDowncast.h in Headers */ = {isa = PBXBuildFile; fileRef = E3A5872E1DC3F52600F607A6 /* JSDynamicDowncast.h */; settings = {ATTRIBUTES = (Private, ); }; }; 6665 E323CFFA1E5AF6AF00F0B4A0 /* JSDOMConvertPromise.h in Headers */ = {isa = PBXBuildFile; fileRef = E323CFF91E5AF6A500F0B4A0 /* JSDOMConvertPromise.h */; settings = {ATTRIBUTES = (Private, ); }; }; 6659 6666 E3565B7B1DC2D6C900217DBD /* JSEventCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = E34EE49F1DC2D57500EAA9D3 /* JSEventCustom.h */; settings = {ATTRIBUTES = (Private, ); }; }; 6660 6667 E35802B61DC8435D00A9773C /* DOMJITIDLTypeFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = E35802B51DC8435800A9773C /* DOMJITIDLTypeFilter.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 12560 12567 A5732B08136A161D005C8D7C /* DateComponents.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DateComponents.cpp; sourceTree = "<group>"; }; 12561 12568 A5732B09136A161D005C8D7C /* DateComponents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DateComponents.h; sourceTree = "<group>"; }; 12569 A578F4321DE00ED6003DFC6A /* PromiseRejectionEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PromiseRejectionEvent.cpp; sourceTree = "<group>"; }; 12570 A578F4331DE00ED6003DFC6A /* PromiseRejectionEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PromiseRejectionEvent.h; sourceTree = "<group>"; }; 12571 A578F4341DE00ED6003DFC6A /* PromiseRejectionEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = PromiseRejectionEvent.idl; sourceTree = "<group>"; }; 12572 A578F4391DE013FB003DFC6A /* JSPromiseRejectionEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSPromiseRejectionEvent.cpp; sourceTree = "<group>"; }; 12573 A578F43A1DE013FB003DFC6A /* JSPromiseRejectionEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPromiseRejectionEvent.h; sourceTree = "<group>"; }; 12574 A578F43D1DE0B62B003DFC6A /* RejectedPromiseTracker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RejectedPromiseTracker.cpp; sourceTree = "<group>"; }; 12575 A578F43E1DE0B62B003DFC6A /* RejectedPromiseTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RejectedPromiseTracker.h; sourceTree = "<group>"; }; 12562 12576 A57FD7191DB94236006AE24B /* WorkerRuntimeAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WorkerRuntimeAgent.cpp; sourceTree = "<group>"; }; 12563 12577 A57FD71A1DB94236006AE24B /* WorkerRuntimeAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkerRuntimeAgent.h; sourceTree = "<group>"; }; … … 15200 15214 E307DED31D81E4ED00141CAF /* LoadableModuleScript.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoadableModuleScript.h; sourceTree = "<group>"; }; 15201 15215 E3150EA51DA7218D00194012 /* DOMJITHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMJITHelpers.h; sourceTree = "<group>"; }; 15216 E323CFF91E5AF6A500F0B4A0 /* JSDOMConvertPromise.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMConvertPromise.h; sourceTree = "<group>"; }; 15202 15217 E334825E1DC93AA0009C9544 /* DOMJITAbstractHeapRepository.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMJITAbstractHeapRepository.h; sourceTree = "<group>"; }; 15203 15218 E34EE49F1DC2D57500EAA9D3 /* JSEventCustom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSEventCustom.h; sourceTree = "<group>"; }; … … 19659 19674 7C8E34A21E4A338E0054CE23 /* JSDOMConvertNumbers.h */, 19660 19675 7C8E34A31E4A338E0054CE23 /* JSDOMConvertObject.h */, 19676 E323CFF91E5AF6A500F0B4A0 /* JSDOMConvertPromise.h */, 19661 19677 7C8E34A41E4A338E0054CE23 /* JSDOMConvertRecord.h */, 19662 19678 7C8E34A51E4A338E0054CE23 /* JSDOMConvertSequences.h */, … … 22031 22047 5189F01B10B37BD900F3C739 /* JSPopStateEvent.cpp */, 22032 22048 5189F01C10B37BD900F3C739 /* JSPopStateEvent.h */, 22049 A578F4391DE013FB003DFC6A /* JSPromiseRejectionEvent.cpp */, 22050 A578F43A1DE013FB003DFC6A /* JSPromiseRejectionEvent.h */, 22033 22051 CED06ACE1C77754800FDFAF1 /* JSSecurityPolicyViolationEvent.cpp */, 22034 22052 CED06ACF1C77754800FDFAF1 /* JSSecurityPolicyViolationEvent.h */, … … 25726 25744 E4B41E020CBF8EAA00AF2ECE /* ProgressEvent.h */, 25727 25745 E4B41E030CBF8EAA00AF2ECE /* ProgressEvent.idl */, 25746 A578F4321DE00ED6003DFC6A /* PromiseRejectionEvent.cpp */, 25747 A578F4331DE00ED6003DFC6A /* PromiseRejectionEvent.h */, 25748 A578F4341DE00ED6003DFC6A /* PromiseRejectionEvent.idl */, 25728 25749 FF945EC9161F7F3600971BC8 /* PseudoElement.cpp */, 25729 25750 FF945ECA161F7F3600971BC8 /* PseudoElement.h */, … … 25738 25759 A84D827B11D333ED00972990 /* RawDataDocumentParser.h */, 25739 25760 85031B360A44EFC700F992E0 /* RegisteredEventListener.h */, 25761 A578F43D1DE0B62B003DFC6A /* RejectedPromiseTracker.cpp */, 25762 A578F43E1DE0B62B003DFC6A /* RejectedPromiseTracker.h */, 25740 25763 A76E5F7E135E0DCF00A69837 /* RenderedDocumentMarker.h */, 25741 25764 4998AEC413F9D0EA0090B1AA /* RequestAnimationFrameCallback.h */, … … 26774 26797 BC23EE920DAED2BC009FDC91 /* CSSImageGeneratorValue.h in Headers */, 26775 26798 9393E600151A99F200066F06 /* CSSImageSetValue.h in Headers */, 26799 A578F4351DE00EEB003DFC6A /* PromiseRejectionEvent.h in Headers */, 26776 26800 A80E6CFA0A1989CA007FB8C5 /* CSSImageValue.h in Headers */, 26777 26801 A80E6CF60A1989CA007FB8C5 /* CSSImportRule.h in Headers */, … … 26955 26979 A8185F3909765766005826D9 /* DocumentType.h in Headers */, 26956 26980 973889A1116EA9DC00ADF313 /* DocumentWriter.h in Headers */, 26981 A578F43C1DE01423003DFC6A /* JSPromiseRejectionEvent.h in Headers */, 26957 26982 1A8F6BC30DB55CDC001DB794 /* DOMApplicationCache.h in Headers */, 26958 26983 BC60D6E90D28D83400B9918F /* DOMCoreException.h in Headers */, … … 28753 28778 493E5E0912D6420500020081 /* PlatformCALayerClient.h in Headers */, 28754 28779 2D70BA1318074DDF0001908A /* PlatformCALayerCocoa.h in Headers */, 28780 A578F43F1DE0B630003DFC6A /* RejectedPromiseTracker.h in Headers */, 28755 28781 A14978711ABAF3A500CEF7E4 /* PlatformContentFilter.h in Headers */, 28756 28782 E1424C8A164B3B4E00F32D40 /* PlatformCookieJar.h in Headers */, … … 29525 29551 83C1D428178D5AB400141E68 /* SVGPathSegCurvetoCubicRel.h in Headers */, 29526 29552 B2227A690D00BF220071B782 /* SVGPathSegCurvetoCubicSmooth.h in Headers */, 29553 E323CFFA1E5AF6AF00F0B4A0 /* JSDOMConvertPromise.h in Headers */, 29527 29554 83C1D429178D5AB400141E68 /* SVGPathSegCurvetoCubicSmoothAbs.h in Headers */, 29528 29555 83C1D42A178D5AB400141E68 /* SVGPathSegCurvetoCubicSmoothRel.h in Headers */, … … 31577 31604 70F546E8B8B5D7DC54EE144E /* JSBeforeUnloadEvent.cpp in Sources */, 31578 31605 FDF09DC81399B62200688E5B /* JSBiquadFilterNode.cpp in Sources */, 31606 A578F43B1DE01421003DFC6A /* JSPromiseRejectionEvent.cpp in Sources */, 31579 31607 2E2D99CD10E2BBDA00496337 /* JSBlob.cpp in Sources */, 31580 31608 A15D751A1E68F89E00A35FBC /* JSBlobCallback.cpp in Sources */, … … 32462 32490 2D9BF7461DBFDC47007A7D99 /* MediaKeys.cpp in Sources */, 32463 32491 2D9BF7451DBFDC44007A7D99 /* MediaKeySession.cpp in Sources */, 32492 A578F4401DE0B634003DFC6A /* RejectedPromiseTracker.cpp in Sources */, 32464 32493 2D9BF7441DBFDC41007A7D99 /* MediaKeyStatusMap.cpp in Sources */, 32465 32494 2D9BF7431DBFDC3E007A7D99 /* MediaKeySystemAccess.cpp in Sources */, … … 33720 33749 A833C7CC0A2CF07400D57664 /* XLinkNames.cpp in Sources */, 33721 33750 00B9318713BA8DB30035A948 /* XMLDocumentParser.cpp in Sources */, 33751 A578F4361DE00EED003DFC6A /* PromiseRejectionEvent.cpp in Sources */, 33722 33752 00B9318913BA8DBC0035A948 /* XMLDocumentParserLibxml2.cpp in Sources */, 33723 33753 00B9318B13BA8DC90035A948 /* XMLDocumentParserScope.cpp in Sources */, -
trunk/Source/WebCore/bindings/js/JSDOMConvert.h
r211821 r215916 41 41 #include "JSDOMConvertNumbers.h" 42 42 #include "JSDOMConvertObject.h" 43 #include "JSDOMConvertPromise.h" 43 44 #include "JSDOMConvertRecord.h" 44 45 #include "JSDOMConvertSequences.h" -
trunk/Source/WebCore/bindings/js/JSDOMConvertPromise.h
r215915 r215916 1 1 /* 2 * Copyright (C) 201 3 Apple Inc. All rights reserved.2 * Copyright (C) 2017 Yusuke Suzuki <utatane.tea@gmail.com> 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 26 26 #pragma once 27 27 28 #include "JSObject.h" 28 #include "IDLTypes.h" 29 #include "JSDOMConvertBase.h" 29 30 30 namespace JSC{31 namespace WebCore { 31 32 32 class JSPromise : public JSNonFinalObject { 33 public: 34 typedef JSNonFinalObject Base; 33 // FIXME: Implement IDLPromise<> conversions. 34 // https://bugs.webkit.org/show_bug.cgi?id=166752 35 template<typename T> 36 struct Converter<IDLPromise<T>> : DefaultConverter<IDLPromise<T>> { 37 using ReturnType = JSC::JSValue; 35 38 36 static JSPromise* create(VM&, Structure*); 37 static Structure* createStructure(VM&, JSGlobalObject*, JSValue); 38 39 DECLARE_EXPORT_INFO; 40 41 enum class Status : unsigned { 42 Pending = 1, 43 Fulfilled, 44 Rejected 45 }; 46 47 Status status(VM&) const; 48 JSValue result(VM&) const; 49 50 // Initialize the promise with the executor. 51 // This may raise a JS exception. 52 void initialize(ExecState*, JSGlobalObject*, JSValue executor); 53 54 protected: 55 JSPromise(VM&, Structure*); 56 void finishCreation(VM&); 39 static JSC::JSValue convert(JSC::ExecState&, JSC::JSValue value) 40 { 41 return value; 42 } 57 43 }; 58 44 59 } // namespace JSC 45 template<typename T> 46 struct JSConverter<IDLPromise<T>> { 47 using Type = JSC::JSValue; 48 static constexpr bool needsState = false; 49 static constexpr bool needsGlobalObject = false; 50 51 static JSC::JSValue convert(JSC::JSValue value) 52 { 53 return value; 54 } 55 }; 56 57 } // namespace WebCore -
trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp
r215904 r215916 39 39 #include "Logging.h" 40 40 #include "Page.h" 41 #include "RejectedPromiseTracker.h" 41 42 #include "RuntimeApplicationChecks.h" 42 43 #include "ScriptController.h" … … 47 48 #include <bytecode/CodeBlock.h> 48 49 #include <heap/StrongInlines.h> 50 #include <runtime/JSInternalPromise.h> 49 51 #include <runtime/JSInternalPromiseDeferred.h> 50 52 #include <runtime/Microtask.h> … … 70 72 &moduleLoaderResolve, 71 73 &moduleLoaderFetch, 72 nullptr, 74 nullptr, // moduleLoaderInstantiate 73 75 &moduleLoaderEvaluate, 76 &promiseRejectionTracker, 74 77 &defaultLanguage 75 78 }; … … 356 359 } 357 360 358 359 361 JSC::JSInternalPromise* JSDOMWindowBase::moduleLoaderResolve(JSC::JSGlobalObject* globalObject, JSC::ExecState* exec, JSC::JSModuleLoader* moduleLoader, JSC::JSValue moduleName, JSC::JSValue importerModuleKey, JSC::JSValue scriptFetcher) 360 362 { … … 392 394 } 393 395 396 void JSDOMWindowBase::promiseRejectionTracker(JSGlobalObject* jsGlobalObject, ExecState* exec, JSPromise* promise, JSPromiseRejectionOperation operation) 397 { 398 // https://html.spec.whatwg.org/multipage/webappapis.html#the-hostpromiserejectiontracker-implementation 399 400 VM& vm = exec->vm(); 401 auto& globalObject = *JSC::jsCast<JSDOMWindowBase*>(jsGlobalObject); 402 auto* context = globalObject.scriptExecutionContext(); 403 if (!context) 404 return; 405 406 // InternalPromises should not be exposed to user scripts. 407 if (JSC::jsDynamicCast<JSC::JSInternalPromise*>(vm, promise)) 408 return; 409 410 // FIXME: If script has muted errors (cross origin), terminate these steps. 411 // <https://webkit.org/b/171415> Implement the `muted-errors` property of Scripts to avoid onerror/onunhandledrejection for cross-origin scripts 412 413 switch (operation) { 414 case JSPromiseRejectionOperation::Reject: 415 context->ensureRejectedPromiseTracker().promiseRejected(*exec, globalObject, *promise); 416 break; 417 case JSPromiseRejectionOperation::Handle: 418 context->ensureRejectedPromiseTracker().promiseHandled(*exec, globalObject, *promise); 419 break; 420 } 421 } 422 394 423 } // namespace WebCore -
trunk/Source/WebCore/bindings/js/JSDOMWindowBase.h
r215904 r215916 81 81 static JSC::JSValue moduleLoaderEvaluate(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSModuleLoader*, JSC::JSValue, JSC::JSValue, JSC::JSValue); 82 82 static JSC::JSInternalPromise* moduleLoaderImportModule(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSModuleLoader*, JSC::JSString*, const JSC::SourceOrigin&); 83 static void promiseRejectionTracker(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSPromise*, JSC::JSPromiseRejectionOperation); 83 84 84 85 RefPtr<DOMWindow> m_wrapped; -
trunk/Source/WebCore/bindings/js/JSMainThreadExecState.cpp
r197131 r215916 28 28 29 29 #include "Microtasks.h" 30 #include "MutationObserver.h" 30 #include "RejectedPromiseTracker.h" 31 #include "ScriptExecutionContext.h" 32 #include "ScriptState.h" 31 33 32 34 namespace WebCore { … … 34 36 JSC::ExecState* JSMainThreadExecState::s_mainThreadState = 0; 35 37 36 void JSMainThreadExecState::didLeaveScriptContext( )38 void JSMainThreadExecState::didLeaveScriptContext(JSC::ExecState* exec) 37 39 { 38 40 MicrotaskQueue::mainThreadQueue().performMicrotaskCheckpoint(); 41 scriptExecutionContextFromExecState(exec)->ensureRejectedPromiseTracker().processQueueSoon(); 39 42 } 40 43 -
trunk/Source/WebCore/bindings/js/JSMainThreadExecState.h
r210585 r215916 32 32 #include <runtime/Microtask.h> 33 33 #include <wtf/MainThread.h> 34 35 #if PLATFORM(IOS)36 #include "WebCoreThread.h"37 #endif38 34 39 35 namespace WebCore { … … 140 136 ASSERT_UNUSED(scope, !scope.exception()); 141 137 138 JSC::ExecState* state = s_mainThreadState; 142 139 bool didExitJavaScript = s_mainThreadState && !m_previousState; 143 140 … … 145 142 146 143 if (didExitJavaScript) 147 didLeaveScriptContext( );144 didLeaveScriptContext(state); 148 145 } 149 146 … … 154 151 JSC::JSLockHolder m_lock; 155 152 156 static void didLeaveScriptContext( );153 static void didLeaveScriptContext(JSC::ExecState*); 157 154 }; 158 155 -
trunk/Source/WebCore/bindings/js/JSWorkerGlobalScopeBase.cpp
r211247 r215916 53 53 &queueTaskToEventLoop, 54 54 &shouldInterruptScriptBeforeTimeout, 55 nullptr, 56 nullptr, 57 nullptr, 58 nullptr, 59 nullptr, 55 nullptr, // moduleLoaderImportModule 56 nullptr, // moduleLoaderResolve 57 nullptr, // moduleLoaderFetch 58 nullptr, // moduleLoaderInstantiate 59 nullptr, // moduleLoaderEvaluate 60 nullptr, // promiseRejectionTracker 60 61 &defaultLanguage 61 62 }; -
trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm
r215403 r215916 689 689 } 690 690 691 sub IsPromiseType 692 { 693 my ($object, $type) = @_; 694 695 assert("Not a type") if ref($type) ne "IDLType"; 696 697 return $type->name eq "Promise"; 698 } 699 691 700 # These match WK_lcfirst and WK_ucfirst defined in builtins_generator.py. 692 701 # Uppercase the first letter while respecting WebKit style guidelines. -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r215904 r215916 301 301 AddToIncludesForIDLType(@{$type->subtypes}[0], $includesRef, $conditional); 302 302 AddToIncludesForIDLType(@{$type->subtypes}[1], $includesRef, $conditional); 303 return; 304 } 305 306 if ($codeGenerator->IsPromiseType($type)) { 307 AddToIncludes("JSDOMPromise.h", $includesRef, $conditional); 308 AddToIncludesForIDLType(@{$type->subtypes}[0], $includesRef, $conditional); 303 309 return; 304 310 } … … 5433 5439 return "IDLFrozenArray<" . GetIDLType($interface, @{$type->subtypes}[0]) . ">" if $codeGenerator->IsFrozenArrayType($type); 5434 5440 return "IDLRecord<" . GetIDLType($interface, @{$type->subtypes}[0]) . ", " . GetIDLType($interface, @{$type->subtypes}[1]) . ">" if $codeGenerator->IsRecordType($type); 5441 return "IDLPromise<" . GetIDLType($interface, @{$type->subtypes}[0]) . ">" if $codeGenerator->IsPromiseType($type); 5435 5442 return "IDLUnion<" . join(", ", GetIDLUnionMemberTypes($interface, $type)) . ">" if $type->isUnion; 5436 5443 return "IDLCallbackFunction<" . GetCallbackClassName($type->name) . ">" if $codeGenerator->IsCallbackFunction($type); -
trunk/Source/WebCore/dom/DOMAllInOne.cpp
r210216 r215916 127 127 #include "RadioButtonGroups.cpp" 128 128 #include "Range.cpp" 129 #include "RejectedPromiseTracker.cpp" 129 130 #include "ScopedEventQueue.cpp" 130 131 #include "ScriptElement.cpp" -
trunk/Source/WebCore/dom/EventNames.h
r214819 r215916 183 183 macro(ratechange) \ 184 184 macro(readystatechange) \ 185 macro(rejectionhandled) \ 185 186 macro(removesourcebuffer) \ 186 187 macro(removestream) \ … … 231 232 macro(track) \ 232 233 macro(transitionend) \ 234 macro(unhandledrejection) \ 233 235 macro(unload) \ 234 236 macro(unmute) \ -
trunk/Source/WebCore/dom/EventNames.in
r214536 r215916 27 27 PopStateEvent 28 28 ProgressEvent 29 PromiseRejectionEvent 29 30 TextEvent 30 31 TransitionEvent -
trunk/Source/WebCore/dom/GlobalEventHandlers.idl
r207514 r215916 80 80 attribute EventHandler onprogress; 81 81 attribute EventHandler onratechange; 82 attribute EventHandler onrejectionhandled; 82 83 attribute EventHandler onreset; 83 84 attribute EventHandler onresize; … … 93 94 attribute EventHandler ontimeupdate; 94 95 attribute EventHandler ontoggle; 96 attribute EventHandler onunhandledrejection; 95 97 attribute EventHandler onvolumechange; 96 98 attribute EventHandler onwaiting; -
trunk/Source/WebCore/dom/ScriptExecutionContext.cpp
r213519 r215916 35 35 #include "Document.h" 36 36 #include "ErrorEvent.h" 37 #include "JSDOMExceptionHandling.h" 37 38 #include "JSDOMWindow.h" 38 39 #include "MessagePort.h" 39 40 #include "NoEventDispatchAssertion.h" 40 41 #include "PublicURLManager.h" 42 #include "RejectedPromiseTracker.h" 41 43 #include "ResourceRequest.h" 42 44 #include "ScriptState.h" … … 47 49 #include <inspector/ScriptCallStack.h> 48 50 #include <runtime/Exception.h> 51 #include <runtime/JSPromise.h> 49 52 #include <wtf/MainThread.h> 50 53 #include <wtf/Ref.h> … … 380 383 } 381 384 385 void ScriptExecutionContext::reportUnhandledPromiseRejection(JSC::ExecState& state, JSC::JSPromise& promise, Inspector::ScriptCallStack& callStack) 386 { 387 JSC::VM& vm = state.vm(); 388 auto scope = DECLARE_CATCH_SCOPE(vm); 389 390 int lineNumber = 0; 391 int columnNumber = 0; 392 String sourceURL; 393 394 JSC::JSValue result = promise.result(vm); 395 String resultMessage = retrieveErrorMessage(state, vm, result, scope); 396 String errorMessage = makeString("Unhandled Promise Rejection: ", resultMessage); 397 if (const ScriptCallFrame* callFrame = callStack.firstNonNativeCallFrame()) { 398 lineNumber = callFrame->lineNumber(); 399 columnNumber = callFrame->columnNumber(); 400 sourceURL = callFrame->sourceURL(); 401 } 402 403 logExceptionToConsole(errorMessage, sourceURL, lineNumber, columnNumber, &callStack); 404 } 405 382 406 void ScriptExecutionContext::addConsoleMessage(MessageSource source, MessageLevel level, const String& message, const String& sourceURL, unsigned lineNumber, unsigned columnNumber, JSC::ExecState* state, unsigned long requestIdentifier) 383 407 { … … 465 489 } 466 490 491 RejectedPromiseTracker& ScriptExecutionContext::ensureRejectedPromiseTrackerSlow() 492 { 493 // ScriptExecutionContext::vm() in Worker is only available after WorkerGlobalScope initialization is done. 494 // When initializing ScriptExecutionContext, vm() is not ready. 495 496 ASSERT(!m_rejectedPromiseTracker); 497 m_rejectedPromiseTracker = std::make_unique<RejectedPromiseTracker>(*this, vm()); 498 return *m_rejectedPromiseTracker.get(); 499 } 500 467 501 void ScriptExecutionContext::setDatabaseContext(DatabaseContext* databaseContext) 468 502 { -
trunk/Source/WebCore/dom/ScriptExecutionContext.h
r214203 r215916 41 41 class Exception; 42 42 class ExecState; 43 class JSPromise; 43 44 class VM; 44 45 template<typename> class Strong; … … 57 58 class MessagePort; 58 59 class PublicURLManager; 60 class RejectedPromiseTracker; 59 61 class ResourceRequest; 60 62 class SecurityOrigin; … … 95 97 bool sanitizeScriptError(String& errorMessage, int& lineNumber, int& columnNumber, String& sourceURL, JSC::Strong<JSC::Unknown>& error, CachedScript* = nullptr); 96 98 void reportException(const String& errorMessage, int lineNumber, int columnNumber, const String& sourceURL, JSC::Exception*, RefPtr<Inspector::ScriptCallStack>&&, CachedScript* = nullptr); 99 void reportUnhandledPromiseRejection(JSC::ExecState&, JSC::JSPromise&, Inspector::ScriptCallStack&); 97 100 98 101 void addConsoleMessage(MessageSource, MessageLevel, const String& message, const String& sourceURL, unsigned lineNumber, unsigned columnNumber, JSC::ExecState* = nullptr, unsigned long requestIdentifier = 0); … … 197 200 198 201 virtual EventQueue& eventQueue() const = 0; 202 virtual EventTarget* errorEventTarget() = 0; 199 203 200 204 DatabaseContext* databaseContext() { return m_databaseContext.get(); } … … 208 212 int timerNestingLevel() const { return m_timerNestingLevel; } 209 213 void setTimerNestingLevel(int timerNestingLevel) { m_timerNestingLevel = timerNestingLevel; } 214 215 RejectedPromiseTracker& ensureRejectedPromiseTracker() 216 { 217 if (m_rejectedPromiseTracker) 218 return *m_rejectedPromiseTracker.get(); 219 return ensureRejectedPromiseTrackerSlow(); 220 } 210 221 211 222 JSC::ExecState* execState(); … … 228 239 private: 229 240 virtual void addMessage(MessageSource, MessageLevel, const String& message, const String& sourceURL, unsigned lineNumber, unsigned columnNumber, RefPtr<Inspector::ScriptCallStack>&&, JSC::ExecState* = nullptr, unsigned long requestIdentifier = 0) = 0; 230 virtual EventTarget* errorEventTarget() = 0;231 241 virtual void logExceptionToConsole(const String& errorMessage, const String& sourceURL, int lineNumber, int columnNumber, RefPtr<Inspector::ScriptCallStack>&&) = 0; 232 242 bool dispatchErrorEvent(const String& errorMessage, int lineNumber, int columnNumber, const String& sourceURL, JSC::Exception*, CachedScript*); … … 234 244 virtual void refScriptExecutionContext() = 0; 235 245 virtual void derefScriptExecutionContext() = 0; 246 247 RejectedPromiseTracker& ensureRejectedPromiseTrackerSlow(); 236 248 237 249 void checkConsistency() const; … … 245 257 struct PendingException; 246 258 std::unique_ptr<Vector<std::unique_ptr<PendingException>>> m_pendingExceptions; 259 std::unique_ptr<RejectedPromiseTracker> m_rejectedPromiseTracker; 247 260 248 261 ActiveDOMObject::ReasonForSuspension m_reasonForSuspendingActiveDOMObjects { static_cast<ActiveDOMObject::ReasonForSuspension>(-1) }; -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r215771 r215916 3298 3298 scheduleTimeupdateEvent(false); 3299 3299 scheduleEvent(eventNames().pauseEvent); 3300 rejectPendingPlayPromises(DOMError::create("AbortError", "The operation was aborted.")); 3301 3300 m_promiseTaskQueue.enqueueTask([this]() { 3301 rejectPendingPlayPromises(DOMError::create("AbortError", "The operation was aborted.")); 3302 }); 3302 3303 if (MemoryPressureHandler::singleton().isUnderMemoryPressure()) 3303 3304 purgeBufferedDataIfPossible();
Note: See TracChangeset
for help on using the changeset viewer.