haikuwebkit/LayoutTests/resources/testharnessreport.js

144 lines
6.1 KiB
JavaScript
Raw Permalink Normal View History

/*
* This file is intended for vendors to implement
* code needed to integrate testharness.js tests with their own test systems.
*
* Typically such integration will attach callbacks when each test is
* has run, using add_result_callback(callback(test)), or when the whole test file has
* completed, using add_completion_callback(callback(tests, harness_status)).
*
* For more documentation about the callback functions and the
* parameters they are called with see testharness.js
*/
// Setup for WebKit JavaScript tests
if (self.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
testRunner.setCanOpenWindows();
Import Notification tests from web-platform-tests https://bugs.webkit.org/show_bug.cgi?id=172196 Reviewed by Youenn Fablet. LayoutTests/imported/w3c: * resources/import-expectations.json: * web-platform-tests/notifications/OWNERS: Added. * web-platform-tests/notifications/common.js: Added. (createPassFail): (clearPassFail): (closeNotifications): (hasNotificationPermission): * web-platform-tests/notifications/constructor-basic-expected.txt: Added. * web-platform-tests/notifications/constructor-basic.html: Added. * web-platform-tests/notifications/constructor-invalid-expected.txt: Added. * web-platform-tests/notifications/constructor-invalid.html: Added. * web-platform-tests/notifications/event-onclose-expected.txt: Added. * web-platform-tests/notifications/event-onclose.html: Added. * web-platform-tests/notifications/event-onshow-expected.txt: Added. * web-platform-tests/notifications/event-onshow.html: Added. * web-platform-tests/notifications/instance-expected.txt: Added. * web-platform-tests/notifications/instance.html: Added. * web-platform-tests/notifications/interfaces-expected.txt: Added. * web-platform-tests/notifications/interfaces.html: Added. * web-platform-tests/notifications/lang-expected.txt: Added. * web-platform-tests/notifications/lang.html: Added. * web-platform-tests/notifications/permission-expected.txt: Added. * web-platform-tests/notifications/permission.html: Added. * web-platform-tests/notifications/resources/icon.png: Added. * web-platform-tests/notifications/resources/shownotification-sw.js: Added. (self.onmessage.event.then): * web-platform-tests/notifications/resources/w3c-import.log: Added. * web-platform-tests/notifications/shownotification-resolve-manual.https-expected.txt: Added. * web-platform-tests/notifications/shownotification-resolve-manual.https.html: Added. * web-platform-tests/notifications/w3c-import.log: Added. LayoutTests: * resources/testharnessreport.js: Allow notifications as this is a pre-requirement for web-platform-tests. Canonical link: https://commits.webkit.org/189144@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216979 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-17 17:23:20 +00:00
testRunner.grantWebNotificationPermission("http://localhost:8800");
// Let's restrict calling testharness timeout() to wptserve tests for the moment.
// That will limit the impact to a small number of tests.
// The risk is that testharness timeout() might be called to late on slow bots to finish properly.
if (testRunner.timeout && (location.port == 8800 || location.port == 9443))
setTimeout(timeout, testRunner.timeout * 0.9);
if (location.port == 8800 || location.port == 9443) {
Some WebAudio tests give different output on different machines https://bugs.webkit.org/show_bug.cgi?id=216371 <rdar://problem/68653909> Reviewed by Alex Christensen. LayoutTests/imported/w3c: Rebaseline existing tests. * web-platform-tests/webaudio/the-audio-api/the-audiocontext-interface/audiocontextoptions-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-getFrequencyResponse-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/realtime-conv-expected.txt: Source/WebCore: Hardcode default sample rate for AudioContext to 44100 for WPT tests instead of using the hardware sample rate. This allows some tests to output consistent results on different machines. No new tests, unskipped existing test. * Modules/webaudio/AudioContext.cpp: (WebCore::defaultSampleRateForTesting): (WebCore::AudioContext::setDefaultSampleRateForTesting): (WebCore::AudioContext::create): * Modules/webaudio/AudioContext.h: (WebCore::AudioContext::create): * testing/InternalSettings.cpp: (WebCore::InternalSettings::Backup::restoreTo): (WebCore::InternalSettings::setDefaultAudioContextSampleRate): * testing/InternalSettings.h: * testing/InternalSettings.idl: LayoutTests: * TestExpectations: Unskip test that should now have consistent results across machines. * resources/testharnessreport.js: Hardcode default sample rate for AudioContext to 44100 for WPT tests instead of using the hardware sample rate. Canonical link: https://commits.webkit.org/229308@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267018 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-14 17:00:56 +00:00
if (self.internals) {
// Use 44100 sample rate by default instead of the hardware sample rate so that we get consistent results across machines.
internals.settings.setDefaultAudioContextSampleRate(44100);
}
}
Resource Load Statistics: Downgrade all third-party referrer headers https://bugs.webkit.org/show_bug.cgi?id=201353 <rdar://problem/54895650> Source/WebKit: Majority of this patch was written by John Wilander <wilander@apple.com>. Patch by Kate Cheney <katherine_cheney@apple.com> on 2019-09-26 Reviewed by Brent Fulgham. When tracking protections are enabled, we should downgrade all third-party referrers to their origins. Note that this downgrade will be specific to Cocoa so other ports will have to adopt as they see fit. Cocoa already does this downgrade in ephemeral sessions (shipping). The majority of these changes are test infrastructure. The functional change is in WebKit::NetworkDataTaskCocoa and WebKit::NetworkSession. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::setShouldDowngradeReferrerForTesting): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::isResourceLoadStatisticsEnabled const): (WebKit::NetworkSession::setShouldDowngradeReferrerForTesting): (WebKit::NetworkSession::shouldDowngradeReferrer const): * NetworkProcess/NetworkSession.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::isThirdPartyRequest const): (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): (WebKit::NetworkDataTaskCocoa::restrictRequestReferrerToOriginIfNeeded): (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection): (WebKit::NetworkDataTaskCocoa::isThirdPartyRequest): Deleted. * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreSetResourceLoadStatisticsShouldDowngradeReferrerForTesting): (WKWebsiteDataStoreStatisticsResetToConsistentState): * UIProcess/API/C/WKWebsiteDataStoreRef.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::setShouldDowngradeReferrerForTesting): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::setResourceLoadStatisticsShouldDowngradeReferrerForTesting): * UIProcess/WebsiteData/WebsiteDataStore.h: Tools: Majority of this patch was written by John Wilander <wilander@apple.com>. Patch by Kate Cheney <katherine_cheney@apple.com> on 2019-09-26 Reviewed by Brent Fulgham. The changes to the TestRunner facilitates an opt-out for test cases that either test the referrer mechanism explicitly or tests that rely on the full referrer to be sent. The new boolean variable and early return in TestRunner::setStatisticsShouldDowngradeReferrer() prevent the same event from trying to set multiple TestRunner callbacks. * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp: (WTR::InjectedBundle::didReceiveMessageToPage): * WebKitTestRunner/InjectedBundle/TestRunner.cpp: (WTR::TestRunner::setStatisticsShouldDowngradeReferrer): (WTR::TestRunner::statisticsCallDidSetShouldDowngradeReferrerCallback): * WebKitTestRunner/InjectedBundle/TestRunner.h: * WebKitTestRunner/TestController.cpp: (WTR::TestController::setStatisticsShouldDowngradeReferrer): * WebKitTestRunner/TestController.h: * WebKitTestRunner/TestInvocation.cpp: (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle): (WTR::TestInvocation::didSetShouldDowngradeReferrer): * WebKitTestRunner/TestInvocation.h: LayoutTests: Majority of this patch was written by John Wilander <wilander@apple.com> Patch by Kate Cheney <katherine_cheney@apple.com> on 2019-09-26 Reviewed by Brent Fulgham. The changes in the two http/tests/resourceLoadStatistics/strip-referrer-to-origin* tests and the http/tests/navigation/ping-attribute/* tests are for the functional change. The other changes are to make use of the new testRunner.setStatisticsShouldDowngradeReferrer() to maintain earlier functionality. TestRunner::setStatisticsShouldDowngradeReferrer() function is not supported for mac-wk1, win or wincairo. * http/tests/blink/sendbeacon/beacon-cross-origin-expected.txt: * http/tests/navigation/ping-attribute/anchor-cross-origin.html: * http/tests/navigation/ping-attribute/area-cross-origin.html: * http/tests/referrer-policy-script/no-referrer-when-downgrade/cross-origin-http-http.html: * http/tests/referrer-policy-script/no-referrer-when-downgrade/cross-origin-http.https.html: * http/tests/referrer-policy-script/no-referrer-when-downgrade/same-origin.html: * http/tests/referrer-policy-script/no-referrer/cross-origin-http-http.html: * http/tests/referrer-policy-script/no-referrer/cross-origin-http.https.html: * http/tests/referrer-policy-script/no-referrer/same-origin.html: * http/tests/referrer-policy-script/origin-when-cross-origin/cross-origin-http-http.html: * http/tests/referrer-policy-script/origin-when-cross-origin/cross-origin-http.https.html: * http/tests/referrer-policy-script/origin-when-cross-origin/same-origin.html: * http/tests/referrer-policy-script/origin/cross-origin-http-http.html: * http/tests/referrer-policy-script/origin/cross-origin-http.https.html: * http/tests/referrer-policy-script/origin/same-origin.html: * http/tests/referrer-policy-script/same-origin/cross-origin-http-http.html: * http/tests/referrer-policy-script/same-origin/cross-origin-http.https.html: * http/tests/referrer-policy-script/same-origin/same-origin.html: * http/tests/referrer-policy-script/strict-origin-when-cross-origin/cross-origin-http-http.html: * http/tests/referrer-policy-script/strict-origin-when-cross-origin/cross-origin-http.https.html: * http/tests/referrer-policy-script/strict-origin-when-cross-origin/same-origin.html: * http/tests/referrer-policy-script/strict-origin/cross-origin-http-http.html: * http/tests/referrer-policy-script/strict-origin/cross-origin-http.https.html: * http/tests/referrer-policy-script/strict-origin/same-origin.html: * http/tests/referrer-policy-script/unsafe-url/cross-origin-http-http.html: * http/tests/referrer-policy-script/unsafe-url/cross-origin-http.https.html: * http/tests/referrer-policy-script/unsafe-url/same-origin.html: * http/tests/referrer-policy/no-referrer-when-downgrade/cross-origin-http-http.html: * http/tests/referrer-policy/no-referrer-when-downgrade/cross-origin-http.https.html: * http/tests/referrer-policy/no-referrer-when-downgrade/same-origin.html: * http/tests/referrer-policy/unsafe-url/cross-origin-http-http.html: * http/tests/referrer-policy/unsafe-url/cross-origin-http.https.html: * http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-requests.html: Removed. * http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-third-party-redirects-expected.txt: Renamed from LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-redirects-expected.txt. * http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-third-party-redirects.html: Copied from LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-redirects.html. * http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-third-party-requests-expected.txt: Renamed from LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-requests-expected.txt. * http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-third-party-requests.html: Renamed from LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-redirects.html. * http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies-when-private-browsing-enabled.php: * http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies.php: * http/tests/security/referrer-policy-header.html: * platform/ios-wk2/TestExpectations: * platform/ios/TestExpectations: * platform/mac-wk1/TestExpectations: * platform/mac-wk2/TestExpectations: * platform/win/TestExpectations: * platform/wincairo/TestExpectations: * platform/wk2/TestExpectations: * resources/testharnessreport.js: * resources/js-test.js: Canonical link: https://commits.webkit.org/215843@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250413 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-09-27 05:13:10 +00:00
if (testRunner.setStatisticsShouldDowngradeReferrer)
testRunner.setStatisticsShouldDowngradeReferrer(false, function() { });
}
if (self.internals && internals.setICECandidateFiltering)
We should do ICE candidate filtering at the Document level https://bugs.webkit.org/show_bug.cgi?id=173861 <rdar://problem/33122058> Patch by Youenn Fablet <youenn@apple.com> on 2017-07-11 Reviewed by Eric Carlson. Source/WebCore: Tests: http/tests/webrtc/filtering-ice-candidate-cross-origin-frame.html http/tests/webrtc/filtering-ice-candidate-same-origin-frame.html http/tests/webrtc/filtering-ice-candidate-same-origin-frame2.html webrtc/filtering-ice-candidate-after-reload.html Making UserMediaRequest disable the ICE candidate filtering for the page RTCController. All RTCPeerConnection of the page that are created on a document that are same-origin as the top document are now registered to the RTCController. This allows disabling filtering to only these RTCPeerConnection. The page keeps the default ICE candidate filtering policy. This policy allows disabling ICE candidate filtering for all RTCPeerConnection. When the top document is changing, the RTCController filtering policy is reset and its list of RTCPeerConnection is emptied. Internals no longer disables ICE candidate filtering by default. This allows finer grained testing. ICE candidate filtering is disabled for tests including testharnessreport.js to enable web-platform-tests to run without modifications. * Modules/mediastream/RTCController.cpp: (WebCore::RTCController::reset): * Modules/mediastream/RTCController.h: * Modules/mediastream/UserMediaRequest.cpp: (WebCore::UserMediaRequest::allow): * page/Frame.cpp: (WebCore::Frame::setDocument): * page/Page.cpp: (WebCore::Page::disableICECandidateFiltering): * page/Page.h: (WebCore::Page::shouldEnableICECandidateFilteringByDefault): (WebCore::Page::disableICECandidateFiltering): Deleted. (WebCore::Page::enableICECandidateFiltering): Deleted. (WebCore::Page::isICECandidateFilteringEnabled): Deleted. * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::setICECandidateFiltering): (WebCore::Internals::setEnumeratingAllNetworkInterfacesEnabled): (WebCore::Internals::isICECandidateFilteringEnabled): Deleted. * testing/Internals.h: * testing/Internals.idl: Source/WebKit2: Removing ICE candidate filtering handling at UIProcess level. ICE candidate filtering is now disabled at UserMediaRequest level. WebPage forwards the ICE candidate filtering option to the page so as to set the default option correctly for every document of the page. * UIProcess/UserMediaProcessManager.cpp: (WebKit::UserMediaProcessManager::willCreateMediaStream): (WebKit::UserMediaProcessManager::endedCaptureSession): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::disableICECandidateFiltering): (WebKit::WebPage::enableICECandidateFiltering): LayoutTests: * http/tests/webrtc/filtering-ice-candidate-cross-origin-frame-expected.txt: Added. * http/tests/webrtc/filtering-ice-candidate-cross-origin-frame.html: Added. * http/tests/webrtc/filtering-ice-candidate-same-origin-frame-expected.txt: Added. * http/tests/webrtc/filtering-ice-candidate-same-origin-frame.html: Added. * http/tests/webrtc/filtering-ice-candidate-same-origin-frame2-expected.txt: Added. * http/tests/webrtc/filtering-ice-candidate-same-origin-frame2.html: Added. * http/tests/webrtc/resources/check-ice-candidate-filtering.html: Added. * http/tests/webrtc/resources/do-get-user-media.html: Added. * platform/mac-wk1/TestExpectations: Disable http/tests/webrtc tests. * resources/testharnessreport.js: Disabled ICE candidate filtering by default. * webrtc/filtering-ice-candidate-after-reload-expected.txt: Added. * webrtc/filtering-ice-candidate-after-reload.html: Added. Canonical link: https://commits.webkit.org/191174@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219331 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-07-11 15:32:38 +00:00
internals.setICECandidateFiltering(false);
// Function used to convert the test status code into
// the corresponding string
function convertResult(resultStatus)
{
if(resultStatus == 0)
return("PASS");
else if(resultStatus == 1)
return("FAIL");
else if(resultStatus == 2)
return("TIMEOUT");
else
return("NOTRUN");
}
if (self.testRunner) {
/* Disable the default output of testharness.js. The default output formats
* test results into an HTML table. When that table is dumped as text, no
* spacing between cells is preserved, and it is therefore not readable. By
* setting output to false, the HTML table will not be created
*/
setup({"output": false, "explicit_timeout": true});
Support for promise rejection events (unhandledrejection) https://bugs.webkit.org/show_bug.cgi?id=150358 <rdar://problem/28441651> Reviewed by Saam Barati. Patch by Joseph Pecoraro and Yusuke Suzuki. LayoutTests/imported/w3c: * web-platform-tests/WebCryptoAPI/derive_bits_keys/test_ecdh_bits-expected.txt: * web-platform-tests/WebCryptoAPI/derive_bits_keys/test_ecdh_keys-expected.txt: * web-platform-tests/html/semantics/embedded-content/media-elements/event_pause_noautoplay-expected.txt: * web-platform-tests/html/semantics/embedded-content/media-elements/event_play_noautoplay-expected.txt: * web-platform-tests/html/semantics/embedded-content/media-elements/paused_true_during_pause-expected.txt: * web-platform-tests/html/syntax/parsing/html5lib_innerHTML_adoption01-expected.txt: * web-platform-tests/html/webappapis/scripting/events/body-exposed-window-event-handlers-expected.txt: * web-platform-tests/streams/piping/close-propagation-forward-expected.txt: * web-platform-tests/streams/piping/error-propagation-backward-expected.txt: * web-platform-tests/streams/piping/error-propagation-forward-expected.txt: * web-platform-tests/streams/piping/flow-control-expected.txt: * web-platform-tests/streams/piping/general-expected.txt: * web-platform-tests/user-timing/measure_exceptions_navigation_timing-expected.txt: Rebaseline expectations to include unhandled promise rejection messages. Also change how the test harness reports success or failure to use the values immediately on completion and then allow a run loop cycle before completing the test to gather the output. * web-platform-tests/resource-timing/rt-resource-errors.html: This is our own WPT test yet to be uploaded, so update the test to prevent an unexpected unhandled rejection. Source/JavaScriptCore: Implement support for promise.[[PromiseIsHandled]] and the HostPromiseRejectionTracker hook for HTML to track promise rejections: https://tc39.github.io/ecma262/#sec-host-promise-rejection-tracker https://html.spec.whatwg.org/multipage/webappapis.html#unhandled-promise-rejections * builtins/BuiltinNames.h: New private symbols. * builtins/PromiseOperations.js: (globalPrivate.newHandledRejectedPromise): Utility to create a rejected promise with [[PromiseIsHandled]] to true. (globalPrivate.rejectPromise): (globalPrivate.initializePromise): * builtins/PromisePrototype.js: (then): Implement standard behavior of [[PromiseIsHandled]] and the host hook. * runtime/JSPromise.cpp: (JSC::JSPromise::isHandled): * runtime/JSPromise.h: C++ accessors for the [[PromiseIsHandled]] state. * bytecode/BytecodeIntrinsicRegistry.cpp: (JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry): * bytecode/BytecodeIntrinsicRegistry.h: Expose private values for the Reject / Handle enum values in built-ins. * jsc.cpp: * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::promiseResolveFunction): Add a new GlobalObjectMethodTable hook matching the promise rejection hook. * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): (JSC::JSGlobalObject::visitChildren): * runtime/JSGlobalObjectFunctions.cpp: (JSC::globalFuncHostPromiseRejectionTracker): * runtime/JSGlobalObjectFunctions.h: Plumb the builtin hook through to the optional GlobalObjectMethodTable hook. * inspector/InjectedScriptSource.js: (InjectedScript.prototype.createFakeValueDescriptor): Silence possible rejected promises created internally via Web Inspector. Source/WebCore: Implement support for the `onunhandledrejection` and `rejectionhandled` events. They dispatch a new PromiseRejectionEvent using the ES6 HostPromiseRejectionTracker hook: https://tc39.github.io/ecma262/#sec-host-promise-rejection-tracker https://html.spec.whatwg.org/multipage/webappapis.html#unhandled-promise-rejections This is currently implemented only for Documents and not yet Web Workers. Tests: js/dom/unhandled-promise-rejection-basic.html js/dom/unhandled-promise-rejection-bindings-type-error.html js/dom/unhandled-promise-rejection-console-no-report.html js/dom/unhandled-promise-rejection-console-report.html js/dom/unhandled-promise-rejection-handle-during-event.html js/dom/unhandled-promise-rejection-handle-in-handler.html js/dom/unhandled-promise-rejection-handle.html js/dom/unhandled-promise-rejection-order.html * CMakeLists.txt: * DerivedSources.cpp: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * dom/DOMAllInOne.cpp: New files. * bindings/scripts/CodeGenerator.pm: (IsPromiseType): * bindings/scripts/CodeGeneratorJS.pm: (AddToIncludesForIDLType): (GetBaseIDLType): Binding support for Promise<T> attributes. * bindings/js/JSDOMConvert.h: * bindings/js/JSDOMConvertPromise.h: Copied from Source/JavaScriptCore/runtime/JSPromise.h. (WebCore::Converter<IDLPromise<T>>::convert): (WebCore::JSConverter<IDLPromise<T>>::convert): Promise<T> binding conversion is currently unimplemented, which only means web developers creating their own PromiseRejectionEvent will not get autowrapping of values assigned to `promise` in event initialization. Engine generated events will have expected behavior. * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::promiseRejectionTracker): * bindings/js/JSDOMWindowBase.h: * bindings/js/JSWorkerGlobalScopeBase.cpp: Implement HostPromiseRejectionTracker hook for Document but not Worker. Passes through to the ScriptExecutionContext's tracker. * bindings/js/JSMainThreadExecState.cpp: (WebCore::JSMainThreadExecState::didLeaveScriptContext): * bindings/js/JSMainThreadExecState.h: (WebCore::JSMainThreadExecState::~JSMainThreadExecState): When completing script execution and performing microtasks notify about rejected promises. Technically this should go inside of performing a microtask checkpoint, except lacking EventLoop concepts we use ScriptExecutionState. * dom/EventNames.h: * dom/EventNames.in: * dom/PromiseRejectionEvent.cpp: Added. (WebCore::PromiseRejectionEvent::PromiseRejectionEvent): (WebCore::PromiseRejectionEvent::~PromiseRejectionEvent): * dom/PromiseRejectionEvent.h: Added. * dom/PromiseRejectionEvent.idl: Added. New PromiseRejectionEvent event interface. * dom/GlobalEventHandlers.idl: New onunhandledrejection and onrejectionhandled. * dom/RejectedPromiseTracker.cpp: Added. (WebCore::RejectedPromise::RejectedPromise): (WebCore::RejectedPromise::globalObject): (WebCore::RejectedPromise::promise): (WebCore::UnhandledPromise::UnhandledPromise): (WebCore::UnhandledPromise::callStack): (WebCore::RejectedPromiseTracker::RejectedPromiseTracker): (WebCore::RejectedPromiseTracker::~RejectedPromiseTracker): (WebCore::createScriptCallStackFromReason): (WebCore::RejectedPromiseTracker::promiseRejected): (WebCore::RejectedPromiseTracker::promiseHandled): (WebCore::RejectedPromiseTracker::processQueueSoon): (WebCore::RejectedPromiseTracker::reportUnhandledRejections): (WebCore::RejectedPromiseTracker::reportRejectionHandled): * dom/RejectedPromiseTracker.h: Added. Track and report rejected promises. The promises are tracked weakly allowing them to be collected before they are reported. When reporting we dispatch PromiseRejectionEvent events, and if the default is not prevented we log a message to the console. * dom/ScriptExecutionContext.cpp: (WebCore::ScriptExecutionContext::reportUnhandledPromiseRejection): (WebCore::ScriptExecutionContext::ensureRejectedPromiseTrackerSlow): * dom/ScriptExecutionContext.h: (WebCore::ScriptExecutionContext::ensureRejectedPromiseTracker): Each ScriptExecutionContext can own a rejected promise tracker. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::pauseInternal): https://html.spec.whatwg.org/multipage/embedded-content.html#internal-pause-steps Internal pause steps say to timeupdate, pause, and rejecting pending play promises should all happen in a queued task. Here the first two actions are already scheduled on tasks, but rejecting play promises was not being done in a task, so this makes that change. * Modules/streams/ReadableStream.js: (pipeThrough): * Modules/streams/ReadableStreamInternals.js: (readableStreamReaderGenericInitialize): (readableStreamError): (readableStreamReaderGenericRelease): Satisfy parts of the Streams specification which state to set the [[PromiseIsHandled]] internal state of promises created internally by the Streams APIs. This prevents some internal promises from appearing as unhandled promise rejections. LayoutTests: * js/dom/unhandled-promise-rejection-basic-expected.txt: Added. * js/dom/unhandled-promise-rejection-basic.html: Added. * js/dom/unhandled-promise-rejection-bindings-type-error-expected.txt: Added. * js/dom/unhandled-promise-rejection-bindings-type-error.html: Added. * js/dom/unhandled-promise-rejection-console-no-report-expected.txt: Added. * js/dom/unhandled-promise-rejection-console-no-report.html: Added. * js/dom/unhandled-promise-rejection-console-report-expected.txt: Added. * js/dom/unhandled-promise-rejection-console-report.html: Added. * js/dom/unhandled-promise-rejection-handle-during-event-expected.txt: Added. * js/dom/unhandled-promise-rejection-handle-during-event.html: Added. * js/dom/unhandled-promise-rejection-handle-expected.txt: Added. * js/dom/unhandled-promise-rejection-handle-in-handler-expected.txt: Added. * js/dom/unhandled-promise-rejection-handle-in-handler.html: Added. * js/dom/unhandled-promise-rejection-handle.html: Added. * js/dom/unhandled-promise-rejection-order-expected.txt: Added. * js/dom/unhandled-promise-rejection-order.html: Added. New tests specific to the `onunhandledrejection` and `onrejectionhandled` events. * resources/testharnessreport.js: (self.testRunner.add_completion_callback.sanitize): (self.testRunner.add_completion_callback): Report results immediately and then finish the test after a turn. This way if the test ends with a pass, but may get unhandled rejections after completing which should not make the test appear as if it failed. Some tests have unhandled promise rejections but are expected to pass. Likewise some tests perform cleanup in their own completion callbacks, which happen after this initial completion callback, and we want to report results after all the work is done as it may eliminate non-deterministic debug test output. * TestExpectations: Mark some tests as flakey that have sometimes have unhandled promise rejections. These tests are all various imported tests that use the testharness. * fast/mediastream/MediaStream-MediaElement-setObject-null-expected.txt: * http/tests/security/video-cross-origin-caching-expected.txt: * inspector/debugger/break-on-exception-throw-in-promise-expected.txt: * inspector/debugger/break-on-uncaught-exception-throw-in-promise-expected.txt: * inspector/worker/resources-in-worker-expected.txt: * js/dom/dom-static-property-for-in-iteration-expected.txt: * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * js/promises-tests/promises-tests-2-2-6-expected.txt: * platform/mac/inspector/model/remote-object-expected.txt: * webrtc/libwebrtc/release-while-creating-offer-expected.txt: * webrtc/libwebrtc/release-while-setting-local-description-expected.txt: Update tests with unhandled promise rejection messages. * media/W3C/audio/events/event_pause_manual.html: * media/audio-playback-restriction-play-expected.txt: * media/audio-playback-restriction-play.html: * media/click-volume-bar-not-pausing.html: * media/remote-control-command-is-user-gesture-expected.txt: * media/remote-control-command-is-user-gesture.html: * media/track/track-mode.html: * media/video-autoplay-allowed-but-fullscreen-required.html: * media/video-display-none-crash.html: * media/video-main-content-deny-display-none.html: * media/video-main-content-deny-not-in-dom.html: * media/video-main-content-deny-not-visible.html: * media/video-main-content-deny-obscured.html: * media/video-main-content-deny-too-small.html: * media/video-multiple-concurrent-playback-expected.txt: * media/video-play-audio-require-user-gesture-expected.txt: * media/video-play-audio-require-user-gesture.html: * media/video-play-pause-events-expected.txt: * media/video-play-pause-events.html: * media/video-play-pause-exception-expected.txt: * media/video-play-pause-exception.html: * media/video-play-require-user-gesture-expected.txt: * media/video-play-require-user-gesture.html: * media/video-preload-expected.txt: * media/video-preload.html: * media/video-test.js: (handlePromise.handle): Snuff many possible unhandled promise rejections in media via media.play(). * streams/reference-implementation/pipe-to-expected.txt: * streams/reference-implementation/pipe-to-options-expected.txt: * streams/reference-implementation/readable-stream-templated-expected.txt: * streams/reference-implementation/writable-stream-abort-expected.txt: * streams/reference-implementation/writable-stream-expected.txt: These stream tests are out of date and produce unhandled rejections. * streams/shadowing-Promise.html: Update non-imported tests to prevent unhandled rejection messages. Canonical link: https://commits.webkit.org/188310@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215916 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-04-28 03:33:57 +00:00
/* Using a callback function, test results will be added to the page in a
* manner that allows dumpAsText to produce readable test results
*/
add_completion_callback(function (tests, harness_status) {
Support for promise rejection events (unhandledrejection) https://bugs.webkit.org/show_bug.cgi?id=150358 <rdar://problem/28441651> Reviewed by Saam Barati. Patch by Joseph Pecoraro and Yusuke Suzuki. LayoutTests/imported/w3c: * web-platform-tests/WebCryptoAPI/derive_bits_keys/test_ecdh_bits-expected.txt: * web-platform-tests/WebCryptoAPI/derive_bits_keys/test_ecdh_keys-expected.txt: * web-platform-tests/html/semantics/embedded-content/media-elements/event_pause_noautoplay-expected.txt: * web-platform-tests/html/semantics/embedded-content/media-elements/event_play_noautoplay-expected.txt: * web-platform-tests/html/semantics/embedded-content/media-elements/paused_true_during_pause-expected.txt: * web-platform-tests/html/syntax/parsing/html5lib_innerHTML_adoption01-expected.txt: * web-platform-tests/html/webappapis/scripting/events/body-exposed-window-event-handlers-expected.txt: * web-platform-tests/streams/piping/close-propagation-forward-expected.txt: * web-platform-tests/streams/piping/error-propagation-backward-expected.txt: * web-platform-tests/streams/piping/error-propagation-forward-expected.txt: * web-platform-tests/streams/piping/flow-control-expected.txt: * web-platform-tests/streams/piping/general-expected.txt: * web-platform-tests/user-timing/measure_exceptions_navigation_timing-expected.txt: Rebaseline expectations to include unhandled promise rejection messages. Also change how the test harness reports success or failure to use the values immediately on completion and then allow a run loop cycle before completing the test to gather the output. * web-platform-tests/resource-timing/rt-resource-errors.html: This is our own WPT test yet to be uploaded, so update the test to prevent an unexpected unhandled rejection. Source/JavaScriptCore: Implement support for promise.[[PromiseIsHandled]] and the HostPromiseRejectionTracker hook for HTML to track promise rejections: https://tc39.github.io/ecma262/#sec-host-promise-rejection-tracker https://html.spec.whatwg.org/multipage/webappapis.html#unhandled-promise-rejections * builtins/BuiltinNames.h: New private symbols. * builtins/PromiseOperations.js: (globalPrivate.newHandledRejectedPromise): Utility to create a rejected promise with [[PromiseIsHandled]] to true. (globalPrivate.rejectPromise): (globalPrivate.initializePromise): * builtins/PromisePrototype.js: (then): Implement standard behavior of [[PromiseIsHandled]] and the host hook. * runtime/JSPromise.cpp: (JSC::JSPromise::isHandled): * runtime/JSPromise.h: C++ accessors for the [[PromiseIsHandled]] state. * bytecode/BytecodeIntrinsicRegistry.cpp: (JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry): * bytecode/BytecodeIntrinsicRegistry.h: Expose private values for the Reject / Handle enum values in built-ins. * jsc.cpp: * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::promiseResolveFunction): Add a new GlobalObjectMethodTable hook matching the promise rejection hook. * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): (JSC::JSGlobalObject::visitChildren): * runtime/JSGlobalObjectFunctions.cpp: (JSC::globalFuncHostPromiseRejectionTracker): * runtime/JSGlobalObjectFunctions.h: Plumb the builtin hook through to the optional GlobalObjectMethodTable hook. * inspector/InjectedScriptSource.js: (InjectedScript.prototype.createFakeValueDescriptor): Silence possible rejected promises created internally via Web Inspector. Source/WebCore: Implement support for the `onunhandledrejection` and `rejectionhandled` events. They dispatch a new PromiseRejectionEvent using the ES6 HostPromiseRejectionTracker hook: https://tc39.github.io/ecma262/#sec-host-promise-rejection-tracker https://html.spec.whatwg.org/multipage/webappapis.html#unhandled-promise-rejections This is currently implemented only for Documents and not yet Web Workers. Tests: js/dom/unhandled-promise-rejection-basic.html js/dom/unhandled-promise-rejection-bindings-type-error.html js/dom/unhandled-promise-rejection-console-no-report.html js/dom/unhandled-promise-rejection-console-report.html js/dom/unhandled-promise-rejection-handle-during-event.html js/dom/unhandled-promise-rejection-handle-in-handler.html js/dom/unhandled-promise-rejection-handle.html js/dom/unhandled-promise-rejection-order.html * CMakeLists.txt: * DerivedSources.cpp: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * dom/DOMAllInOne.cpp: New files. * bindings/scripts/CodeGenerator.pm: (IsPromiseType): * bindings/scripts/CodeGeneratorJS.pm: (AddToIncludesForIDLType): (GetBaseIDLType): Binding support for Promise<T> attributes. * bindings/js/JSDOMConvert.h: * bindings/js/JSDOMConvertPromise.h: Copied from Source/JavaScriptCore/runtime/JSPromise.h. (WebCore::Converter<IDLPromise<T>>::convert): (WebCore::JSConverter<IDLPromise<T>>::convert): Promise<T> binding conversion is currently unimplemented, which only means web developers creating their own PromiseRejectionEvent will not get autowrapping of values assigned to `promise` in event initialization. Engine generated events will have expected behavior. * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::promiseRejectionTracker): * bindings/js/JSDOMWindowBase.h: * bindings/js/JSWorkerGlobalScopeBase.cpp: Implement HostPromiseRejectionTracker hook for Document but not Worker. Passes through to the ScriptExecutionContext's tracker. * bindings/js/JSMainThreadExecState.cpp: (WebCore::JSMainThreadExecState::didLeaveScriptContext): * bindings/js/JSMainThreadExecState.h: (WebCore::JSMainThreadExecState::~JSMainThreadExecState): When completing script execution and performing microtasks notify about rejected promises. Technically this should go inside of performing a microtask checkpoint, except lacking EventLoop concepts we use ScriptExecutionState. * dom/EventNames.h: * dom/EventNames.in: * dom/PromiseRejectionEvent.cpp: Added. (WebCore::PromiseRejectionEvent::PromiseRejectionEvent): (WebCore::PromiseRejectionEvent::~PromiseRejectionEvent): * dom/PromiseRejectionEvent.h: Added. * dom/PromiseRejectionEvent.idl: Added. New PromiseRejectionEvent event interface. * dom/GlobalEventHandlers.idl: New onunhandledrejection and onrejectionhandled. * dom/RejectedPromiseTracker.cpp: Added. (WebCore::RejectedPromise::RejectedPromise): (WebCore::RejectedPromise::globalObject): (WebCore::RejectedPromise::promise): (WebCore::UnhandledPromise::UnhandledPromise): (WebCore::UnhandledPromise::callStack): (WebCore::RejectedPromiseTracker::RejectedPromiseTracker): (WebCore::RejectedPromiseTracker::~RejectedPromiseTracker): (WebCore::createScriptCallStackFromReason): (WebCore::RejectedPromiseTracker::promiseRejected): (WebCore::RejectedPromiseTracker::promiseHandled): (WebCore::RejectedPromiseTracker::processQueueSoon): (WebCore::RejectedPromiseTracker::reportUnhandledRejections): (WebCore::RejectedPromiseTracker::reportRejectionHandled): * dom/RejectedPromiseTracker.h: Added. Track and report rejected promises. The promises are tracked weakly allowing them to be collected before they are reported. When reporting we dispatch PromiseRejectionEvent events, and if the default is not prevented we log a message to the console. * dom/ScriptExecutionContext.cpp: (WebCore::ScriptExecutionContext::reportUnhandledPromiseRejection): (WebCore::ScriptExecutionContext::ensureRejectedPromiseTrackerSlow): * dom/ScriptExecutionContext.h: (WebCore::ScriptExecutionContext::ensureRejectedPromiseTracker): Each ScriptExecutionContext can own a rejected promise tracker. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::pauseInternal): https://html.spec.whatwg.org/multipage/embedded-content.html#internal-pause-steps Internal pause steps say to timeupdate, pause, and rejecting pending play promises should all happen in a queued task. Here the first two actions are already scheduled on tasks, but rejecting play promises was not being done in a task, so this makes that change. * Modules/streams/ReadableStream.js: (pipeThrough): * Modules/streams/ReadableStreamInternals.js: (readableStreamReaderGenericInitialize): (readableStreamError): (readableStreamReaderGenericRelease): Satisfy parts of the Streams specification which state to set the [[PromiseIsHandled]] internal state of promises created internally by the Streams APIs. This prevents some internal promises from appearing as unhandled promise rejections. LayoutTests: * js/dom/unhandled-promise-rejection-basic-expected.txt: Added. * js/dom/unhandled-promise-rejection-basic.html: Added. * js/dom/unhandled-promise-rejection-bindings-type-error-expected.txt: Added. * js/dom/unhandled-promise-rejection-bindings-type-error.html: Added. * js/dom/unhandled-promise-rejection-console-no-report-expected.txt: Added. * js/dom/unhandled-promise-rejection-console-no-report.html: Added. * js/dom/unhandled-promise-rejection-console-report-expected.txt: Added. * js/dom/unhandled-promise-rejection-console-report.html: Added. * js/dom/unhandled-promise-rejection-handle-during-event-expected.txt: Added. * js/dom/unhandled-promise-rejection-handle-during-event.html: Added. * js/dom/unhandled-promise-rejection-handle-expected.txt: Added. * js/dom/unhandled-promise-rejection-handle-in-handler-expected.txt: Added. * js/dom/unhandled-promise-rejection-handle-in-handler.html: Added. * js/dom/unhandled-promise-rejection-handle.html: Added. * js/dom/unhandled-promise-rejection-order-expected.txt: Added. * js/dom/unhandled-promise-rejection-order.html: Added. New tests specific to the `onunhandledrejection` and `onrejectionhandled` events. * resources/testharnessreport.js: (self.testRunner.add_completion_callback.sanitize): (self.testRunner.add_completion_callback): Report results immediately and then finish the test after a turn. This way if the test ends with a pass, but may get unhandled rejections after completing which should not make the test appear as if it failed. Some tests have unhandled promise rejections but are expected to pass. Likewise some tests perform cleanup in their own completion callbacks, which happen after this initial completion callback, and we want to report results after all the work is done as it may eliminate non-deterministic debug test output. * TestExpectations: Mark some tests as flakey that have sometimes have unhandled promise rejections. These tests are all various imported tests that use the testharness. * fast/mediastream/MediaStream-MediaElement-setObject-null-expected.txt: * http/tests/security/video-cross-origin-caching-expected.txt: * inspector/debugger/break-on-exception-throw-in-promise-expected.txt: * inspector/debugger/break-on-uncaught-exception-throw-in-promise-expected.txt: * inspector/worker/resources-in-worker-expected.txt: * js/dom/dom-static-property-for-in-iteration-expected.txt: * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * js/promises-tests/promises-tests-2-2-6-expected.txt: * platform/mac/inspector/model/remote-object-expected.txt: * webrtc/libwebrtc/release-while-creating-offer-expected.txt: * webrtc/libwebrtc/release-while-setting-local-description-expected.txt: Update tests with unhandled promise rejection messages. * media/W3C/audio/events/event_pause_manual.html: * media/audio-playback-restriction-play-expected.txt: * media/audio-playback-restriction-play.html: * media/click-volume-bar-not-pausing.html: * media/remote-control-command-is-user-gesture-expected.txt: * media/remote-control-command-is-user-gesture.html: * media/track/track-mode.html: * media/video-autoplay-allowed-but-fullscreen-required.html: * media/video-display-none-crash.html: * media/video-main-content-deny-display-none.html: * media/video-main-content-deny-not-in-dom.html: * media/video-main-content-deny-not-visible.html: * media/video-main-content-deny-obscured.html: * media/video-main-content-deny-too-small.html: * media/video-multiple-concurrent-playback-expected.txt: * media/video-play-audio-require-user-gesture-expected.txt: * media/video-play-audio-require-user-gesture.html: * media/video-play-pause-events-expected.txt: * media/video-play-pause-events.html: * media/video-play-pause-exception-expected.txt: * media/video-play-pause-exception.html: * media/video-play-require-user-gesture-expected.txt: * media/video-play-require-user-gesture.html: * media/video-preload-expected.txt: * media/video-preload.html: * media/video-test.js: (handlePromise.handle): Snuff many possible unhandled promise rejections in media via media.play(). * streams/reference-implementation/pipe-to-expected.txt: * streams/reference-implementation/pipe-to-options-expected.txt: * streams/reference-implementation/readable-stream-templated-expected.txt: * streams/reference-implementation/writable-stream-abort-expected.txt: * streams/reference-implementation/writable-stream-expected.txt: These stream tests are out of date and produce unhandled rejections. * streams/shadowing-Promise.html: Update non-imported tests to prevent unhandled rejection messages. Canonical link: https://commits.webkit.org/188310@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215916 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-04-28 03:33:57 +00:00
var resultStr = "\n";
Support for promise rejection events (unhandledrejection) https://bugs.webkit.org/show_bug.cgi?id=150358 <rdar://problem/28441651> Reviewed by Saam Barati. Patch by Joseph Pecoraro and Yusuke Suzuki. LayoutTests/imported/w3c: * web-platform-tests/WebCryptoAPI/derive_bits_keys/test_ecdh_bits-expected.txt: * web-platform-tests/WebCryptoAPI/derive_bits_keys/test_ecdh_keys-expected.txt: * web-platform-tests/html/semantics/embedded-content/media-elements/event_pause_noautoplay-expected.txt: * web-platform-tests/html/semantics/embedded-content/media-elements/event_play_noautoplay-expected.txt: * web-platform-tests/html/semantics/embedded-content/media-elements/paused_true_during_pause-expected.txt: * web-platform-tests/html/syntax/parsing/html5lib_innerHTML_adoption01-expected.txt: * web-platform-tests/html/webappapis/scripting/events/body-exposed-window-event-handlers-expected.txt: * web-platform-tests/streams/piping/close-propagation-forward-expected.txt: * web-platform-tests/streams/piping/error-propagation-backward-expected.txt: * web-platform-tests/streams/piping/error-propagation-forward-expected.txt: * web-platform-tests/streams/piping/flow-control-expected.txt: * web-platform-tests/streams/piping/general-expected.txt: * web-platform-tests/user-timing/measure_exceptions_navigation_timing-expected.txt: Rebaseline expectations to include unhandled promise rejection messages. Also change how the test harness reports success or failure to use the values immediately on completion and then allow a run loop cycle before completing the test to gather the output. * web-platform-tests/resource-timing/rt-resource-errors.html: This is our own WPT test yet to be uploaded, so update the test to prevent an unexpected unhandled rejection. Source/JavaScriptCore: Implement support for promise.[[PromiseIsHandled]] and the HostPromiseRejectionTracker hook for HTML to track promise rejections: https://tc39.github.io/ecma262/#sec-host-promise-rejection-tracker https://html.spec.whatwg.org/multipage/webappapis.html#unhandled-promise-rejections * builtins/BuiltinNames.h: New private symbols. * builtins/PromiseOperations.js: (globalPrivate.newHandledRejectedPromise): Utility to create a rejected promise with [[PromiseIsHandled]] to true. (globalPrivate.rejectPromise): (globalPrivate.initializePromise): * builtins/PromisePrototype.js: (then): Implement standard behavior of [[PromiseIsHandled]] and the host hook. * runtime/JSPromise.cpp: (JSC::JSPromise::isHandled): * runtime/JSPromise.h: C++ accessors for the [[PromiseIsHandled]] state. * bytecode/BytecodeIntrinsicRegistry.cpp: (JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry): * bytecode/BytecodeIntrinsicRegistry.h: Expose private values for the Reject / Handle enum values in built-ins. * jsc.cpp: * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::promiseResolveFunction): Add a new GlobalObjectMethodTable hook matching the promise rejection hook. * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): (JSC::JSGlobalObject::visitChildren): * runtime/JSGlobalObjectFunctions.cpp: (JSC::globalFuncHostPromiseRejectionTracker): * runtime/JSGlobalObjectFunctions.h: Plumb the builtin hook through to the optional GlobalObjectMethodTable hook. * inspector/InjectedScriptSource.js: (InjectedScript.prototype.createFakeValueDescriptor): Silence possible rejected promises created internally via Web Inspector. Source/WebCore: Implement support for the `onunhandledrejection` and `rejectionhandled` events. They dispatch a new PromiseRejectionEvent using the ES6 HostPromiseRejectionTracker hook: https://tc39.github.io/ecma262/#sec-host-promise-rejection-tracker https://html.spec.whatwg.org/multipage/webappapis.html#unhandled-promise-rejections This is currently implemented only for Documents and not yet Web Workers. Tests: js/dom/unhandled-promise-rejection-basic.html js/dom/unhandled-promise-rejection-bindings-type-error.html js/dom/unhandled-promise-rejection-console-no-report.html js/dom/unhandled-promise-rejection-console-report.html js/dom/unhandled-promise-rejection-handle-during-event.html js/dom/unhandled-promise-rejection-handle-in-handler.html js/dom/unhandled-promise-rejection-handle.html js/dom/unhandled-promise-rejection-order.html * CMakeLists.txt: * DerivedSources.cpp: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * dom/DOMAllInOne.cpp: New files. * bindings/scripts/CodeGenerator.pm: (IsPromiseType): * bindings/scripts/CodeGeneratorJS.pm: (AddToIncludesForIDLType): (GetBaseIDLType): Binding support for Promise<T> attributes. * bindings/js/JSDOMConvert.h: * bindings/js/JSDOMConvertPromise.h: Copied from Source/JavaScriptCore/runtime/JSPromise.h. (WebCore::Converter<IDLPromise<T>>::convert): (WebCore::JSConverter<IDLPromise<T>>::convert): Promise<T> binding conversion is currently unimplemented, which only means web developers creating their own PromiseRejectionEvent will not get autowrapping of values assigned to `promise` in event initialization. Engine generated events will have expected behavior. * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::promiseRejectionTracker): * bindings/js/JSDOMWindowBase.h: * bindings/js/JSWorkerGlobalScopeBase.cpp: Implement HostPromiseRejectionTracker hook for Document but not Worker. Passes through to the ScriptExecutionContext's tracker. * bindings/js/JSMainThreadExecState.cpp: (WebCore::JSMainThreadExecState::didLeaveScriptContext): * bindings/js/JSMainThreadExecState.h: (WebCore::JSMainThreadExecState::~JSMainThreadExecState): When completing script execution and performing microtasks notify about rejected promises. Technically this should go inside of performing a microtask checkpoint, except lacking EventLoop concepts we use ScriptExecutionState. * dom/EventNames.h: * dom/EventNames.in: * dom/PromiseRejectionEvent.cpp: Added. (WebCore::PromiseRejectionEvent::PromiseRejectionEvent): (WebCore::PromiseRejectionEvent::~PromiseRejectionEvent): * dom/PromiseRejectionEvent.h: Added. * dom/PromiseRejectionEvent.idl: Added. New PromiseRejectionEvent event interface. * dom/GlobalEventHandlers.idl: New onunhandledrejection and onrejectionhandled. * dom/RejectedPromiseTracker.cpp: Added. (WebCore::RejectedPromise::RejectedPromise): (WebCore::RejectedPromise::globalObject): (WebCore::RejectedPromise::promise): (WebCore::UnhandledPromise::UnhandledPromise): (WebCore::UnhandledPromise::callStack): (WebCore::RejectedPromiseTracker::RejectedPromiseTracker): (WebCore::RejectedPromiseTracker::~RejectedPromiseTracker): (WebCore::createScriptCallStackFromReason): (WebCore::RejectedPromiseTracker::promiseRejected): (WebCore::RejectedPromiseTracker::promiseHandled): (WebCore::RejectedPromiseTracker::processQueueSoon): (WebCore::RejectedPromiseTracker::reportUnhandledRejections): (WebCore::RejectedPromiseTracker::reportRejectionHandled): * dom/RejectedPromiseTracker.h: Added. Track and report rejected promises. The promises are tracked weakly allowing them to be collected before they are reported. When reporting we dispatch PromiseRejectionEvent events, and if the default is not prevented we log a message to the console. * dom/ScriptExecutionContext.cpp: (WebCore::ScriptExecutionContext::reportUnhandledPromiseRejection): (WebCore::ScriptExecutionContext::ensureRejectedPromiseTrackerSlow): * dom/ScriptExecutionContext.h: (WebCore::ScriptExecutionContext::ensureRejectedPromiseTracker): Each ScriptExecutionContext can own a rejected promise tracker. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::pauseInternal): https://html.spec.whatwg.org/multipage/embedded-content.html#internal-pause-steps Internal pause steps say to timeupdate, pause, and rejecting pending play promises should all happen in a queued task. Here the first two actions are already scheduled on tasks, but rejecting play promises was not being done in a task, so this makes that change. * Modules/streams/ReadableStream.js: (pipeThrough): * Modules/streams/ReadableStreamInternals.js: (readableStreamReaderGenericInitialize): (readableStreamError): (readableStreamReaderGenericRelease): Satisfy parts of the Streams specification which state to set the [[PromiseIsHandled]] internal state of promises created internally by the Streams APIs. This prevents some internal promises from appearing as unhandled promise rejections. LayoutTests: * js/dom/unhandled-promise-rejection-basic-expected.txt: Added. * js/dom/unhandled-promise-rejection-basic.html: Added. * js/dom/unhandled-promise-rejection-bindings-type-error-expected.txt: Added. * js/dom/unhandled-promise-rejection-bindings-type-error.html: Added. * js/dom/unhandled-promise-rejection-console-no-report-expected.txt: Added. * js/dom/unhandled-promise-rejection-console-no-report.html: Added. * js/dom/unhandled-promise-rejection-console-report-expected.txt: Added. * js/dom/unhandled-promise-rejection-console-report.html: Added. * js/dom/unhandled-promise-rejection-handle-during-event-expected.txt: Added. * js/dom/unhandled-promise-rejection-handle-during-event.html: Added. * js/dom/unhandled-promise-rejection-handle-expected.txt: Added. * js/dom/unhandled-promise-rejection-handle-in-handler-expected.txt: Added. * js/dom/unhandled-promise-rejection-handle-in-handler.html: Added. * js/dom/unhandled-promise-rejection-handle.html: Added. * js/dom/unhandled-promise-rejection-order-expected.txt: Added. * js/dom/unhandled-promise-rejection-order.html: Added. New tests specific to the `onunhandledrejection` and `onrejectionhandled` events. * resources/testharnessreport.js: (self.testRunner.add_completion_callback.sanitize): (self.testRunner.add_completion_callback): Report results immediately and then finish the test after a turn. This way if the test ends with a pass, but may get unhandled rejections after completing which should not make the test appear as if it failed. Some tests have unhandled promise rejections but are expected to pass. Likewise some tests perform cleanup in their own completion callbacks, which happen after this initial completion callback, and we want to report results after all the work is done as it may eliminate non-deterministic debug test output. * TestExpectations: Mark some tests as flakey that have sometimes have unhandled promise rejections. These tests are all various imported tests that use the testharness. * fast/mediastream/MediaStream-MediaElement-setObject-null-expected.txt: * http/tests/security/video-cross-origin-caching-expected.txt: * inspector/debugger/break-on-exception-throw-in-promise-expected.txt: * inspector/debugger/break-on-uncaught-exception-throw-in-promise-expected.txt: * inspector/worker/resources-in-worker-expected.txt: * js/dom/dom-static-property-for-in-iteration-expected.txt: * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * js/promises-tests/promises-tests-2-2-6-expected.txt: * platform/mac/inspector/model/remote-object-expected.txt: * webrtc/libwebrtc/release-while-creating-offer-expected.txt: * webrtc/libwebrtc/release-while-setting-local-description-expected.txt: Update tests with unhandled promise rejection messages. * media/W3C/audio/events/event_pause_manual.html: * media/audio-playback-restriction-play-expected.txt: * media/audio-playback-restriction-play.html: * media/click-volume-bar-not-pausing.html: * media/remote-control-command-is-user-gesture-expected.txt: * media/remote-control-command-is-user-gesture.html: * media/track/track-mode.html: * media/video-autoplay-allowed-but-fullscreen-required.html: * media/video-display-none-crash.html: * media/video-main-content-deny-display-none.html: * media/video-main-content-deny-not-in-dom.html: * media/video-main-content-deny-not-visible.html: * media/video-main-content-deny-obscured.html: * media/video-main-content-deny-too-small.html: * media/video-multiple-concurrent-playback-expected.txt: * media/video-play-audio-require-user-gesture-expected.txt: * media/video-play-audio-require-user-gesture.html: * media/video-play-pause-events-expected.txt: * media/video-play-pause-events.html: * media/video-play-pause-exception-expected.txt: * media/video-play-pause-exception.html: * media/video-play-require-user-gesture-expected.txt: * media/video-play-require-user-gesture.html: * media/video-preload-expected.txt: * media/video-preload.html: * media/video-test.js: (handlePromise.handle): Snuff many possible unhandled promise rejections in media via media.play(). * streams/reference-implementation/pipe-to-expected.txt: * streams/reference-implementation/pipe-to-options-expected.txt: * streams/reference-implementation/readable-stream-templated-expected.txt: * streams/reference-implementation/writable-stream-abort-expected.txt: * streams/reference-implementation/writable-stream-expected.txt: These stream tests are out of date and produce unhandled rejections. * streams/shadowing-Promise.html: Update non-imported tests to prevent unhandled rejection messages. Canonical link: https://commits.webkit.org/188310@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215916 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-04-28 03:33:57 +00:00
// Sanitizes the given text for display in test results.
function sanitize(text) {
if (!text) {
return "";
}
Support for promise rejection events (unhandledrejection) https://bugs.webkit.org/show_bug.cgi?id=150358 <rdar://problem/28441651> Reviewed by Saam Barati. Patch by Joseph Pecoraro and Yusuke Suzuki. LayoutTests/imported/w3c: * web-platform-tests/WebCryptoAPI/derive_bits_keys/test_ecdh_bits-expected.txt: * web-platform-tests/WebCryptoAPI/derive_bits_keys/test_ecdh_keys-expected.txt: * web-platform-tests/html/semantics/embedded-content/media-elements/event_pause_noautoplay-expected.txt: * web-platform-tests/html/semantics/embedded-content/media-elements/event_play_noautoplay-expected.txt: * web-platform-tests/html/semantics/embedded-content/media-elements/paused_true_during_pause-expected.txt: * web-platform-tests/html/syntax/parsing/html5lib_innerHTML_adoption01-expected.txt: * web-platform-tests/html/webappapis/scripting/events/body-exposed-window-event-handlers-expected.txt: * web-platform-tests/streams/piping/close-propagation-forward-expected.txt: * web-platform-tests/streams/piping/error-propagation-backward-expected.txt: * web-platform-tests/streams/piping/error-propagation-forward-expected.txt: * web-platform-tests/streams/piping/flow-control-expected.txt: * web-platform-tests/streams/piping/general-expected.txt: * web-platform-tests/user-timing/measure_exceptions_navigation_timing-expected.txt: Rebaseline expectations to include unhandled promise rejection messages. Also change how the test harness reports success or failure to use the values immediately on completion and then allow a run loop cycle before completing the test to gather the output. * web-platform-tests/resource-timing/rt-resource-errors.html: This is our own WPT test yet to be uploaded, so update the test to prevent an unexpected unhandled rejection. Source/JavaScriptCore: Implement support for promise.[[PromiseIsHandled]] and the HostPromiseRejectionTracker hook for HTML to track promise rejections: https://tc39.github.io/ecma262/#sec-host-promise-rejection-tracker https://html.spec.whatwg.org/multipage/webappapis.html#unhandled-promise-rejections * builtins/BuiltinNames.h: New private symbols. * builtins/PromiseOperations.js: (globalPrivate.newHandledRejectedPromise): Utility to create a rejected promise with [[PromiseIsHandled]] to true. (globalPrivate.rejectPromise): (globalPrivate.initializePromise): * builtins/PromisePrototype.js: (then): Implement standard behavior of [[PromiseIsHandled]] and the host hook. * runtime/JSPromise.cpp: (JSC::JSPromise::isHandled): * runtime/JSPromise.h: C++ accessors for the [[PromiseIsHandled]] state. * bytecode/BytecodeIntrinsicRegistry.cpp: (JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry): * bytecode/BytecodeIntrinsicRegistry.h: Expose private values for the Reject / Handle enum values in built-ins. * jsc.cpp: * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::promiseResolveFunction): Add a new GlobalObjectMethodTable hook matching the promise rejection hook. * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): (JSC::JSGlobalObject::visitChildren): * runtime/JSGlobalObjectFunctions.cpp: (JSC::globalFuncHostPromiseRejectionTracker): * runtime/JSGlobalObjectFunctions.h: Plumb the builtin hook through to the optional GlobalObjectMethodTable hook. * inspector/InjectedScriptSource.js: (InjectedScript.prototype.createFakeValueDescriptor): Silence possible rejected promises created internally via Web Inspector. Source/WebCore: Implement support for the `onunhandledrejection` and `rejectionhandled` events. They dispatch a new PromiseRejectionEvent using the ES6 HostPromiseRejectionTracker hook: https://tc39.github.io/ecma262/#sec-host-promise-rejection-tracker https://html.spec.whatwg.org/multipage/webappapis.html#unhandled-promise-rejections This is currently implemented only for Documents and not yet Web Workers. Tests: js/dom/unhandled-promise-rejection-basic.html js/dom/unhandled-promise-rejection-bindings-type-error.html js/dom/unhandled-promise-rejection-console-no-report.html js/dom/unhandled-promise-rejection-console-report.html js/dom/unhandled-promise-rejection-handle-during-event.html js/dom/unhandled-promise-rejection-handle-in-handler.html js/dom/unhandled-promise-rejection-handle.html js/dom/unhandled-promise-rejection-order.html * CMakeLists.txt: * DerivedSources.cpp: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * dom/DOMAllInOne.cpp: New files. * bindings/scripts/CodeGenerator.pm: (IsPromiseType): * bindings/scripts/CodeGeneratorJS.pm: (AddToIncludesForIDLType): (GetBaseIDLType): Binding support for Promise<T> attributes. * bindings/js/JSDOMConvert.h: * bindings/js/JSDOMConvertPromise.h: Copied from Source/JavaScriptCore/runtime/JSPromise.h. (WebCore::Converter<IDLPromise<T>>::convert): (WebCore::JSConverter<IDLPromise<T>>::convert): Promise<T> binding conversion is currently unimplemented, which only means web developers creating their own PromiseRejectionEvent will not get autowrapping of values assigned to `promise` in event initialization. Engine generated events will have expected behavior. * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::promiseRejectionTracker): * bindings/js/JSDOMWindowBase.h: * bindings/js/JSWorkerGlobalScopeBase.cpp: Implement HostPromiseRejectionTracker hook for Document but not Worker. Passes through to the ScriptExecutionContext's tracker. * bindings/js/JSMainThreadExecState.cpp: (WebCore::JSMainThreadExecState::didLeaveScriptContext): * bindings/js/JSMainThreadExecState.h: (WebCore::JSMainThreadExecState::~JSMainThreadExecState): When completing script execution and performing microtasks notify about rejected promises. Technically this should go inside of performing a microtask checkpoint, except lacking EventLoop concepts we use ScriptExecutionState. * dom/EventNames.h: * dom/EventNames.in: * dom/PromiseRejectionEvent.cpp: Added. (WebCore::PromiseRejectionEvent::PromiseRejectionEvent): (WebCore::PromiseRejectionEvent::~PromiseRejectionEvent): * dom/PromiseRejectionEvent.h: Added. * dom/PromiseRejectionEvent.idl: Added. New PromiseRejectionEvent event interface. * dom/GlobalEventHandlers.idl: New onunhandledrejection and onrejectionhandled. * dom/RejectedPromiseTracker.cpp: Added. (WebCore::RejectedPromise::RejectedPromise): (WebCore::RejectedPromise::globalObject): (WebCore::RejectedPromise::promise): (WebCore::UnhandledPromise::UnhandledPromise): (WebCore::UnhandledPromise::callStack): (WebCore::RejectedPromiseTracker::RejectedPromiseTracker): (WebCore::RejectedPromiseTracker::~RejectedPromiseTracker): (WebCore::createScriptCallStackFromReason): (WebCore::RejectedPromiseTracker::promiseRejected): (WebCore::RejectedPromiseTracker::promiseHandled): (WebCore::RejectedPromiseTracker::processQueueSoon): (WebCore::RejectedPromiseTracker::reportUnhandledRejections): (WebCore::RejectedPromiseTracker::reportRejectionHandled): * dom/RejectedPromiseTracker.h: Added. Track and report rejected promises. The promises are tracked weakly allowing them to be collected before they are reported. When reporting we dispatch PromiseRejectionEvent events, and if the default is not prevented we log a message to the console. * dom/ScriptExecutionContext.cpp: (WebCore::ScriptExecutionContext::reportUnhandledPromiseRejection): (WebCore::ScriptExecutionContext::ensureRejectedPromiseTrackerSlow): * dom/ScriptExecutionContext.h: (WebCore::ScriptExecutionContext::ensureRejectedPromiseTracker): Each ScriptExecutionContext can own a rejected promise tracker. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::pauseInternal): https://html.spec.whatwg.org/multipage/embedded-content.html#internal-pause-steps Internal pause steps say to timeupdate, pause, and rejecting pending play promises should all happen in a queued task. Here the first two actions are already scheduled on tasks, but rejecting play promises was not being done in a task, so this makes that change. * Modules/streams/ReadableStream.js: (pipeThrough): * Modules/streams/ReadableStreamInternals.js: (readableStreamReaderGenericInitialize): (readableStreamError): (readableStreamReaderGenericRelease): Satisfy parts of the Streams specification which state to set the [[PromiseIsHandled]] internal state of promises created internally by the Streams APIs. This prevents some internal promises from appearing as unhandled promise rejections. LayoutTests: * js/dom/unhandled-promise-rejection-basic-expected.txt: Added. * js/dom/unhandled-promise-rejection-basic.html: Added. * js/dom/unhandled-promise-rejection-bindings-type-error-expected.txt: Added. * js/dom/unhandled-promise-rejection-bindings-type-error.html: Added. * js/dom/unhandled-promise-rejection-console-no-report-expected.txt: Added. * js/dom/unhandled-promise-rejection-console-no-report.html: Added. * js/dom/unhandled-promise-rejection-console-report-expected.txt: Added. * js/dom/unhandled-promise-rejection-console-report.html: Added. * js/dom/unhandled-promise-rejection-handle-during-event-expected.txt: Added. * js/dom/unhandled-promise-rejection-handle-during-event.html: Added. * js/dom/unhandled-promise-rejection-handle-expected.txt: Added. * js/dom/unhandled-promise-rejection-handle-in-handler-expected.txt: Added. * js/dom/unhandled-promise-rejection-handle-in-handler.html: Added. * js/dom/unhandled-promise-rejection-handle.html: Added. * js/dom/unhandled-promise-rejection-order-expected.txt: Added. * js/dom/unhandled-promise-rejection-order.html: Added. New tests specific to the `onunhandledrejection` and `onrejectionhandled` events. * resources/testharnessreport.js: (self.testRunner.add_completion_callback.sanitize): (self.testRunner.add_completion_callback): Report results immediately and then finish the test after a turn. This way if the test ends with a pass, but may get unhandled rejections after completing which should not make the test appear as if it failed. Some tests have unhandled promise rejections but are expected to pass. Likewise some tests perform cleanup in their own completion callbacks, which happen after this initial completion callback, and we want to report results after all the work is done as it may eliminate non-deterministic debug test output. * TestExpectations: Mark some tests as flakey that have sometimes have unhandled promise rejections. These tests are all various imported tests that use the testharness. * fast/mediastream/MediaStream-MediaElement-setObject-null-expected.txt: * http/tests/security/video-cross-origin-caching-expected.txt: * inspector/debugger/break-on-exception-throw-in-promise-expected.txt: * inspector/debugger/break-on-uncaught-exception-throw-in-promise-expected.txt: * inspector/worker/resources-in-worker-expected.txt: * js/dom/dom-static-property-for-in-iteration-expected.txt: * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * js/promises-tests/promises-tests-2-2-6-expected.txt: * platform/mac/inspector/model/remote-object-expected.txt: * webrtc/libwebrtc/release-while-creating-offer-expected.txt: * webrtc/libwebrtc/release-while-setting-local-description-expected.txt: Update tests with unhandled promise rejection messages. * media/W3C/audio/events/event_pause_manual.html: * media/audio-playback-restriction-play-expected.txt: * media/audio-playback-restriction-play.html: * media/click-volume-bar-not-pausing.html: * media/remote-control-command-is-user-gesture-expected.txt: * media/remote-control-command-is-user-gesture.html: * media/track/track-mode.html: * media/video-autoplay-allowed-but-fullscreen-required.html: * media/video-display-none-crash.html: * media/video-main-content-deny-display-none.html: * media/video-main-content-deny-not-in-dom.html: * media/video-main-content-deny-not-visible.html: * media/video-main-content-deny-obscured.html: * media/video-main-content-deny-too-small.html: * media/video-multiple-concurrent-playback-expected.txt: * media/video-play-audio-require-user-gesture-expected.txt: * media/video-play-audio-require-user-gesture.html: * media/video-play-pause-events-expected.txt: * media/video-play-pause-events.html: * media/video-play-pause-exception-expected.txt: * media/video-play-pause-exception.html: * media/video-play-require-user-gesture-expected.txt: * media/video-play-require-user-gesture.html: * media/video-preload-expected.txt: * media/video-preload.html: * media/video-test.js: (handlePromise.handle): Snuff many possible unhandled promise rejections in media via media.play(). * streams/reference-implementation/pipe-to-expected.txt: * streams/reference-implementation/pipe-to-options-expected.txt: * streams/reference-implementation/readable-stream-templated-expected.txt: * streams/reference-implementation/writable-stream-abort-expected.txt: * streams/reference-implementation/writable-stream-expected.txt: These stream tests are out of date and produce unhandled rejections. * streams/shadowing-Promise.html: Update non-imported tests to prevent unhandled rejection messages. Canonical link: https://commits.webkit.org/188310@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215916 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-04-28 03:33:57 +00:00
text = text.replace(/\0/g, "\\0");
return text.replace(/\r/g, "\\r");
}
Support for promise rejection events (unhandledrejection) https://bugs.webkit.org/show_bug.cgi?id=150358 <rdar://problem/28441651> Reviewed by Saam Barati. Patch by Joseph Pecoraro and Yusuke Suzuki. LayoutTests/imported/w3c: * web-platform-tests/WebCryptoAPI/derive_bits_keys/test_ecdh_bits-expected.txt: * web-platform-tests/WebCryptoAPI/derive_bits_keys/test_ecdh_keys-expected.txt: * web-platform-tests/html/semantics/embedded-content/media-elements/event_pause_noautoplay-expected.txt: * web-platform-tests/html/semantics/embedded-content/media-elements/event_play_noautoplay-expected.txt: * web-platform-tests/html/semantics/embedded-content/media-elements/paused_true_during_pause-expected.txt: * web-platform-tests/html/syntax/parsing/html5lib_innerHTML_adoption01-expected.txt: * web-platform-tests/html/webappapis/scripting/events/body-exposed-window-event-handlers-expected.txt: * web-platform-tests/streams/piping/close-propagation-forward-expected.txt: * web-platform-tests/streams/piping/error-propagation-backward-expected.txt: * web-platform-tests/streams/piping/error-propagation-forward-expected.txt: * web-platform-tests/streams/piping/flow-control-expected.txt: * web-platform-tests/streams/piping/general-expected.txt: * web-platform-tests/user-timing/measure_exceptions_navigation_timing-expected.txt: Rebaseline expectations to include unhandled promise rejection messages. Also change how the test harness reports success or failure to use the values immediately on completion and then allow a run loop cycle before completing the test to gather the output. * web-platform-tests/resource-timing/rt-resource-errors.html: This is our own WPT test yet to be uploaded, so update the test to prevent an unexpected unhandled rejection. Source/JavaScriptCore: Implement support for promise.[[PromiseIsHandled]] and the HostPromiseRejectionTracker hook for HTML to track promise rejections: https://tc39.github.io/ecma262/#sec-host-promise-rejection-tracker https://html.spec.whatwg.org/multipage/webappapis.html#unhandled-promise-rejections * builtins/BuiltinNames.h: New private symbols. * builtins/PromiseOperations.js: (globalPrivate.newHandledRejectedPromise): Utility to create a rejected promise with [[PromiseIsHandled]] to true. (globalPrivate.rejectPromise): (globalPrivate.initializePromise): * builtins/PromisePrototype.js: (then): Implement standard behavior of [[PromiseIsHandled]] and the host hook. * runtime/JSPromise.cpp: (JSC::JSPromise::isHandled): * runtime/JSPromise.h: C++ accessors for the [[PromiseIsHandled]] state. * bytecode/BytecodeIntrinsicRegistry.cpp: (JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry): * bytecode/BytecodeIntrinsicRegistry.h: Expose private values for the Reject / Handle enum values in built-ins. * jsc.cpp: * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::promiseResolveFunction): Add a new GlobalObjectMethodTable hook matching the promise rejection hook. * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): (JSC::JSGlobalObject::visitChildren): * runtime/JSGlobalObjectFunctions.cpp: (JSC::globalFuncHostPromiseRejectionTracker): * runtime/JSGlobalObjectFunctions.h: Plumb the builtin hook through to the optional GlobalObjectMethodTable hook. * inspector/InjectedScriptSource.js: (InjectedScript.prototype.createFakeValueDescriptor): Silence possible rejected promises created internally via Web Inspector. Source/WebCore: Implement support for the `onunhandledrejection` and `rejectionhandled` events. They dispatch a new PromiseRejectionEvent using the ES6 HostPromiseRejectionTracker hook: https://tc39.github.io/ecma262/#sec-host-promise-rejection-tracker https://html.spec.whatwg.org/multipage/webappapis.html#unhandled-promise-rejections This is currently implemented only for Documents and not yet Web Workers. Tests: js/dom/unhandled-promise-rejection-basic.html js/dom/unhandled-promise-rejection-bindings-type-error.html js/dom/unhandled-promise-rejection-console-no-report.html js/dom/unhandled-promise-rejection-console-report.html js/dom/unhandled-promise-rejection-handle-during-event.html js/dom/unhandled-promise-rejection-handle-in-handler.html js/dom/unhandled-promise-rejection-handle.html js/dom/unhandled-promise-rejection-order.html * CMakeLists.txt: * DerivedSources.cpp: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * dom/DOMAllInOne.cpp: New files. * bindings/scripts/CodeGenerator.pm: (IsPromiseType): * bindings/scripts/CodeGeneratorJS.pm: (AddToIncludesForIDLType): (GetBaseIDLType): Binding support for Promise<T> attributes. * bindings/js/JSDOMConvert.h: * bindings/js/JSDOMConvertPromise.h: Copied from Source/JavaScriptCore/runtime/JSPromise.h. (WebCore::Converter<IDLPromise<T>>::convert): (WebCore::JSConverter<IDLPromise<T>>::convert): Promise<T> binding conversion is currently unimplemented, which only means web developers creating their own PromiseRejectionEvent will not get autowrapping of values assigned to `promise` in event initialization. Engine generated events will have expected behavior. * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::promiseRejectionTracker): * bindings/js/JSDOMWindowBase.h: * bindings/js/JSWorkerGlobalScopeBase.cpp: Implement HostPromiseRejectionTracker hook for Document but not Worker. Passes through to the ScriptExecutionContext's tracker. * bindings/js/JSMainThreadExecState.cpp: (WebCore::JSMainThreadExecState::didLeaveScriptContext): * bindings/js/JSMainThreadExecState.h: (WebCore::JSMainThreadExecState::~JSMainThreadExecState): When completing script execution and performing microtasks notify about rejected promises. Technically this should go inside of performing a microtask checkpoint, except lacking EventLoop concepts we use ScriptExecutionState. * dom/EventNames.h: * dom/EventNames.in: * dom/PromiseRejectionEvent.cpp: Added. (WebCore::PromiseRejectionEvent::PromiseRejectionEvent): (WebCore::PromiseRejectionEvent::~PromiseRejectionEvent): * dom/PromiseRejectionEvent.h: Added. * dom/PromiseRejectionEvent.idl: Added. New PromiseRejectionEvent event interface. * dom/GlobalEventHandlers.idl: New onunhandledrejection and onrejectionhandled. * dom/RejectedPromiseTracker.cpp: Added. (WebCore::RejectedPromise::RejectedPromise): (WebCore::RejectedPromise::globalObject): (WebCore::RejectedPromise::promise): (WebCore::UnhandledPromise::UnhandledPromise): (WebCore::UnhandledPromise::callStack): (WebCore::RejectedPromiseTracker::RejectedPromiseTracker): (WebCore::RejectedPromiseTracker::~RejectedPromiseTracker): (WebCore::createScriptCallStackFromReason): (WebCore::RejectedPromiseTracker::promiseRejected): (WebCore::RejectedPromiseTracker::promiseHandled): (WebCore::RejectedPromiseTracker::processQueueSoon): (WebCore::RejectedPromiseTracker::reportUnhandledRejections): (WebCore::RejectedPromiseTracker::reportRejectionHandled): * dom/RejectedPromiseTracker.h: Added. Track and report rejected promises. The promises are tracked weakly allowing them to be collected before they are reported. When reporting we dispatch PromiseRejectionEvent events, and if the default is not prevented we log a message to the console. * dom/ScriptExecutionContext.cpp: (WebCore::ScriptExecutionContext::reportUnhandledPromiseRejection): (WebCore::ScriptExecutionContext::ensureRejectedPromiseTrackerSlow): * dom/ScriptExecutionContext.h: (WebCore::ScriptExecutionContext::ensureRejectedPromiseTracker): Each ScriptExecutionContext can own a rejected promise tracker. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::pauseInternal): https://html.spec.whatwg.org/multipage/embedded-content.html#internal-pause-steps Internal pause steps say to timeupdate, pause, and rejecting pending play promises should all happen in a queued task. Here the first two actions are already scheduled on tasks, but rejecting play promises was not being done in a task, so this makes that change. * Modules/streams/ReadableStream.js: (pipeThrough): * Modules/streams/ReadableStreamInternals.js: (readableStreamReaderGenericInitialize): (readableStreamError): (readableStreamReaderGenericRelease): Satisfy parts of the Streams specification which state to set the [[PromiseIsHandled]] internal state of promises created internally by the Streams APIs. This prevents some internal promises from appearing as unhandled promise rejections. LayoutTests: * js/dom/unhandled-promise-rejection-basic-expected.txt: Added. * js/dom/unhandled-promise-rejection-basic.html: Added. * js/dom/unhandled-promise-rejection-bindings-type-error-expected.txt: Added. * js/dom/unhandled-promise-rejection-bindings-type-error.html: Added. * js/dom/unhandled-promise-rejection-console-no-report-expected.txt: Added. * js/dom/unhandled-promise-rejection-console-no-report.html: Added. * js/dom/unhandled-promise-rejection-console-report-expected.txt: Added. * js/dom/unhandled-promise-rejection-console-report.html: Added. * js/dom/unhandled-promise-rejection-handle-during-event-expected.txt: Added. * js/dom/unhandled-promise-rejection-handle-during-event.html: Added. * js/dom/unhandled-promise-rejection-handle-expected.txt: Added. * js/dom/unhandled-promise-rejection-handle-in-handler-expected.txt: Added. * js/dom/unhandled-promise-rejection-handle-in-handler.html: Added. * js/dom/unhandled-promise-rejection-handle.html: Added. * js/dom/unhandled-promise-rejection-order-expected.txt: Added. * js/dom/unhandled-promise-rejection-order.html: Added. New tests specific to the `onunhandledrejection` and `onrejectionhandled` events. * resources/testharnessreport.js: (self.testRunner.add_completion_callback.sanitize): (self.testRunner.add_completion_callback): Report results immediately and then finish the test after a turn. This way if the test ends with a pass, but may get unhandled rejections after completing which should not make the test appear as if it failed. Some tests have unhandled promise rejections but are expected to pass. Likewise some tests perform cleanup in their own completion callbacks, which happen after this initial completion callback, and we want to report results after all the work is done as it may eliminate non-deterministic debug test output. * TestExpectations: Mark some tests as flakey that have sometimes have unhandled promise rejections. These tests are all various imported tests that use the testharness. * fast/mediastream/MediaStream-MediaElement-setObject-null-expected.txt: * http/tests/security/video-cross-origin-caching-expected.txt: * inspector/debugger/break-on-exception-throw-in-promise-expected.txt: * inspector/debugger/break-on-uncaught-exception-throw-in-promise-expected.txt: * inspector/worker/resources-in-worker-expected.txt: * js/dom/dom-static-property-for-in-iteration-expected.txt: * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * js/promises-tests/promises-tests-2-2-6-expected.txt: * platform/mac/inspector/model/remote-object-expected.txt: * webrtc/libwebrtc/release-while-creating-offer-expected.txt: * webrtc/libwebrtc/release-while-setting-local-description-expected.txt: Update tests with unhandled promise rejection messages. * media/W3C/audio/events/event_pause_manual.html: * media/audio-playback-restriction-play-expected.txt: * media/audio-playback-restriction-play.html: * media/click-volume-bar-not-pausing.html: * media/remote-control-command-is-user-gesture-expected.txt: * media/remote-control-command-is-user-gesture.html: * media/track/track-mode.html: * media/video-autoplay-allowed-but-fullscreen-required.html: * media/video-display-none-crash.html: * media/video-main-content-deny-display-none.html: * media/video-main-content-deny-not-in-dom.html: * media/video-main-content-deny-not-visible.html: * media/video-main-content-deny-obscured.html: * media/video-main-content-deny-too-small.html: * media/video-multiple-concurrent-playback-expected.txt: * media/video-play-audio-require-user-gesture-expected.txt: * media/video-play-audio-require-user-gesture.html: * media/video-play-pause-events-expected.txt: * media/video-play-pause-events.html: * media/video-play-pause-exception-expected.txt: * media/video-play-pause-exception.html: * media/video-play-require-user-gesture-expected.txt: * media/video-play-require-user-gesture.html: * media/video-preload-expected.txt: * media/video-preload.html: * media/video-test.js: (handlePromise.handle): Snuff many possible unhandled promise rejections in media via media.play(). * streams/reference-implementation/pipe-to-expected.txt: * streams/reference-implementation/pipe-to-options-expected.txt: * streams/reference-implementation/readable-stream-templated-expected.txt: * streams/reference-implementation/writable-stream-abort-expected.txt: * streams/reference-implementation/writable-stream-expected.txt: These stream tests are out of date and produce unhandled rejections. * streams/shadowing-Promise.html: Update non-imported tests to prevent unhandled rejection messages. Canonical link: https://commits.webkit.org/188310@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215916 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-04-28 03:33:57 +00:00
if(harness_status.status != 0)
resultStr += "Harness Error (" + convertResult(harness_status.status) + "), message = " + harness_status.message + "\n\n";
imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner-connections.html fails on some platforms https://bugs.webkit.org/show_bug.cgi?id=218527 <rdar://problem/68947198> Reviewed by Eric Carlson. LayoutTests/imported/w3c: Rebaseline WPT tests now that floating point values are truncated to 6 decimals in the tests' output. * web-platform-tests/webaudio/the-audio-api/the-analysernode-interface/realtimeanalyser-basic-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audiobuffer-interface/audiobuffer-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-multi-channels-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/ctor-audiobuffersource-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/sub-sample-buffer-stitching-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/sub-sample-scheduling-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audiocontext-interface/audiocontextoptions-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/adding-events-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/audioparam-close-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/audioparam-exponentialRampToValueAtTime-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/audioparam-linearRampToValueAtTime-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/audioparam-method-chaining-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/audioparam-setTargetAtTime-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/audioparam-setValueCurve-exceptions-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/audioparam-setValueCurveAtTime-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/event-insertion-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-biquad-connection-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-connections-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner-connections-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/set-target-conv-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-audioparam.https-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletglobalscope-timing-info.https-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-automation-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-getFrequencyResponse-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-biquadfilternode-interface/no-dezippering-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-constantsourcenode-interface/constant-source-basic-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-1-chan-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-2-chan-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-4-chan-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-delaynode-interface/no-dezippering-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-dynamicscompressornode-interface/ctor-dynamicscompressor-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-dynamicscompressornode-interface/dynamicscompressor-basic-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-iirfilternode-interface/iirfilter-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-iirfilternode-interface/iirfilter-getFrequencyResponse-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-oscillatornode-interface/detune-limiting-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-oscillatornode-interface/osc-basic-waveform-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/ctor-panner-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/distance-exponential-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/distance-inverse-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/distance-linear-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-automation-basic-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-automation-equalpower-stereo-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-automation-position-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-azimuth-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-equalpower-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-equalpower-stereo-expected.txt: LayoutTests: * platform/ios/TestExpectations: * platform/mac/TestExpectations: Unskip test that should no longer be flaky. * resources/testharnessreport.js: (self.testRunner.add_completion_callback): In addition to stripping arrays of floating point values from webaudio tests' output, we now also truncate all floating point values to 6 decimals in those tests too. This allows tests like k-rate-panner-connections.html to consistently pass on all platforms because the floating point values that were causing failures are not in an array. Canonical link: https://commits.webkit.org/231205@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269361 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-11-04 16:09:57 +00:00
// Truncate decimal values from output in webaudio tests to avoid test flakiness due to floating point precision issues.
WebAudio tests may give slightly different outputs on different platforms https://bugs.webkit.org/show_bug.cgi?id=218929 Reviewed by Geoffrey Garen. LayoutTests/imported/w3c: Rebaseline WPT tests now that their output has changed. * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-audiobuffersource-connections-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-audioworklet-connections.https-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-biquad-connection-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-biquad-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-constant-source-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-delay-connections-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-delay-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-gain-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-oscillator-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner-connections-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-stereo-panner-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-cascade-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-4-chan-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-delaynode-interface/maxdelay-rounding-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-oscillatornode-interface/detune-limiting-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/automation-changes-expected.txt: LayoutTests: WebAudio tests may give slightly different outputs on different platforms, causing what looks like flakiness. This is due to the "(contains X different values)" because X may differ from one platform to another (usually +/- 1). * resources/testharnessreport.js: (self.testRunner.add_completion_callback): Strip the "(contains X different values)" strings from output lines. * webaudio/AudioNode/tail-connections-expected.txt: * webaudio/AudioNode/tail-processing-expected.txt: * webaudio/BiquadFilter/biquad-829349-expected.txt: * webaudio/BiquadFilter/tail-time-allpass-expected.txt: * webaudio/BiquadFilter/tail-time-bandpass-expected.txt: * webaudio/BiquadFilter/tail-time-highpass-expected.txt: * webaudio/BiquadFilter/tail-time-highshelf-expected.txt: * webaudio/BiquadFilter/tail-time-lowpass-expected.txt: * webaudio/BiquadFilter/tail-time-lowshelf-expected.txt: * webaudio/BiquadFilter/tail-time-notch-expected.txt: * webaudio/BiquadFilter/tail-time-peaking-expected.txt: * webaudio/IIRFilter/iir-tail-time-expected.txt: Rebaseline tests accordingly. Canonical link: https://commits.webkit.org/231617@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269853 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-11-16 16:40:58 +00:00
const isWebAudioTest = document.URL.indexOf('/webaudio') >= 0;
Update WPT test harness so that webaudio tests output results that are consistent across different machines https://bugs.webkit.org/show_bug.cgi?id=216332 Reviewed by Geoffrey Garen. LayoutTests/imported/w3c: Rebaseline tests. * web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-multi-channels-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/sub-sample-buffer-stitching-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/sub-sample-scheduling-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-audiobuffersource-connections-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-biquad-connection-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-biquad-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-constant-source-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-delay-connections-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-delay-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-gain-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-oscillator-connections-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner-connections-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-stereo-panner-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/retrospective-exponentialRampToValueAtTime-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/retrospective-linearRampToValueAtTime-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/retrospective-setTargetAtTime-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/retrospective-setValueAtTime-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/retrospective-setValueCurveAtTime-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-automation-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-biquadfilternode-interface/no-dezippering-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-constantsourcenode-interface/constant-source-output-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-1-chan-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-2-chan-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-4-chan-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-delaynode-interface/no-dezippering-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-gainnode-interface/gain-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-gainnode-interface/no-dezippering-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-iirfilternode-interface/ctor-iirfilter-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-iirfilternode-interface/iirfilter-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-iirfilternode-interface/iirfilter-getFrequencyResponse-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-oscillatornode-interface/osc-basic-waveform-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/automation-changes-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-automation-position-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-distance-clamping-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-equalpower-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-rolloff-clamping-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-scriptprocessornode-interface/simple-input-output-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-stereopanner-interface/no-dezippering-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-waveshapernode-interface/waveshaper-copy-curve-expected.txt: LayoutTests: Unskip tests that should now pass on all platforms. * TestExpectations: * resources/testharnessreport.js: (self.testRunner.add_completion_callback): Our webaudio implementation uses single precision for floating point audio values. However, the tests were printing out those values with 16 digits, even when the checks were passing. We had to skip those tests because digits after the 6th one may differ across machines and we were getting TEXT diffs. To address the issue we now strip arrays from PASS lines in webaudio tests output and replace them with the string '[expected array]'. As long as the check is passing, the actual value in the array does not really matter. * webaudio/Oscillator/no-dezippering-expected.txt: * webaudio/Oscillator/osc-440hz-expected.txt: * webaudio/Oscillator/osc-negative-freq-expected.txt: * webaudio/Oscillator/start-sampling-expected.txt: * webaudio/audioparam-cancel-and-hold-expected.txt: * webaudio/convolvernode-unmodified-buffer-expected.txt: Rebaseline tests. Canonical link: https://commits.webkit.org/229442@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267167 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-16 22:31:44 +00:00
Support for promise rejection events (unhandledrejection) https://bugs.webkit.org/show_bug.cgi?id=150358 <rdar://problem/28441651> Reviewed by Saam Barati. Patch by Joseph Pecoraro and Yusuke Suzuki. LayoutTests/imported/w3c: * web-platform-tests/WebCryptoAPI/derive_bits_keys/test_ecdh_bits-expected.txt: * web-platform-tests/WebCryptoAPI/derive_bits_keys/test_ecdh_keys-expected.txt: * web-platform-tests/html/semantics/embedded-content/media-elements/event_pause_noautoplay-expected.txt: * web-platform-tests/html/semantics/embedded-content/media-elements/event_play_noautoplay-expected.txt: * web-platform-tests/html/semantics/embedded-content/media-elements/paused_true_during_pause-expected.txt: * web-platform-tests/html/syntax/parsing/html5lib_innerHTML_adoption01-expected.txt: * web-platform-tests/html/webappapis/scripting/events/body-exposed-window-event-handlers-expected.txt: * web-platform-tests/streams/piping/close-propagation-forward-expected.txt: * web-platform-tests/streams/piping/error-propagation-backward-expected.txt: * web-platform-tests/streams/piping/error-propagation-forward-expected.txt: * web-platform-tests/streams/piping/flow-control-expected.txt: * web-platform-tests/streams/piping/general-expected.txt: * web-platform-tests/user-timing/measure_exceptions_navigation_timing-expected.txt: Rebaseline expectations to include unhandled promise rejection messages. Also change how the test harness reports success or failure to use the values immediately on completion and then allow a run loop cycle before completing the test to gather the output. * web-platform-tests/resource-timing/rt-resource-errors.html: This is our own WPT test yet to be uploaded, so update the test to prevent an unexpected unhandled rejection. Source/JavaScriptCore: Implement support for promise.[[PromiseIsHandled]] and the HostPromiseRejectionTracker hook for HTML to track promise rejections: https://tc39.github.io/ecma262/#sec-host-promise-rejection-tracker https://html.spec.whatwg.org/multipage/webappapis.html#unhandled-promise-rejections * builtins/BuiltinNames.h: New private symbols. * builtins/PromiseOperations.js: (globalPrivate.newHandledRejectedPromise): Utility to create a rejected promise with [[PromiseIsHandled]] to true. (globalPrivate.rejectPromise): (globalPrivate.initializePromise): * builtins/PromisePrototype.js: (then): Implement standard behavior of [[PromiseIsHandled]] and the host hook. * runtime/JSPromise.cpp: (JSC::JSPromise::isHandled): * runtime/JSPromise.h: C++ accessors for the [[PromiseIsHandled]] state. * bytecode/BytecodeIntrinsicRegistry.cpp: (JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry): * bytecode/BytecodeIntrinsicRegistry.h: Expose private values for the Reject / Handle enum values in built-ins. * jsc.cpp: * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::promiseResolveFunction): Add a new GlobalObjectMethodTable hook matching the promise rejection hook. * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): (JSC::JSGlobalObject::visitChildren): * runtime/JSGlobalObjectFunctions.cpp: (JSC::globalFuncHostPromiseRejectionTracker): * runtime/JSGlobalObjectFunctions.h: Plumb the builtin hook through to the optional GlobalObjectMethodTable hook. * inspector/InjectedScriptSource.js: (InjectedScript.prototype.createFakeValueDescriptor): Silence possible rejected promises created internally via Web Inspector. Source/WebCore: Implement support for the `onunhandledrejection` and `rejectionhandled` events. They dispatch a new PromiseRejectionEvent using the ES6 HostPromiseRejectionTracker hook: https://tc39.github.io/ecma262/#sec-host-promise-rejection-tracker https://html.spec.whatwg.org/multipage/webappapis.html#unhandled-promise-rejections This is currently implemented only for Documents and not yet Web Workers. Tests: js/dom/unhandled-promise-rejection-basic.html js/dom/unhandled-promise-rejection-bindings-type-error.html js/dom/unhandled-promise-rejection-console-no-report.html js/dom/unhandled-promise-rejection-console-report.html js/dom/unhandled-promise-rejection-handle-during-event.html js/dom/unhandled-promise-rejection-handle-in-handler.html js/dom/unhandled-promise-rejection-handle.html js/dom/unhandled-promise-rejection-order.html * CMakeLists.txt: * DerivedSources.cpp: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * dom/DOMAllInOne.cpp: New files. * bindings/scripts/CodeGenerator.pm: (IsPromiseType): * bindings/scripts/CodeGeneratorJS.pm: (AddToIncludesForIDLType): (GetBaseIDLType): Binding support for Promise<T> attributes. * bindings/js/JSDOMConvert.h: * bindings/js/JSDOMConvertPromise.h: Copied from Source/JavaScriptCore/runtime/JSPromise.h. (WebCore::Converter<IDLPromise<T>>::convert): (WebCore::JSConverter<IDLPromise<T>>::convert): Promise<T> binding conversion is currently unimplemented, which only means web developers creating their own PromiseRejectionEvent will not get autowrapping of values assigned to `promise` in event initialization. Engine generated events will have expected behavior. * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::promiseRejectionTracker): * bindings/js/JSDOMWindowBase.h: * bindings/js/JSWorkerGlobalScopeBase.cpp: Implement HostPromiseRejectionTracker hook for Document but not Worker. Passes through to the ScriptExecutionContext's tracker. * bindings/js/JSMainThreadExecState.cpp: (WebCore::JSMainThreadExecState::didLeaveScriptContext): * bindings/js/JSMainThreadExecState.h: (WebCore::JSMainThreadExecState::~JSMainThreadExecState): When completing script execution and performing microtasks notify about rejected promises. Technically this should go inside of performing a microtask checkpoint, except lacking EventLoop concepts we use ScriptExecutionState. * dom/EventNames.h: * dom/EventNames.in: * dom/PromiseRejectionEvent.cpp: Added. (WebCore::PromiseRejectionEvent::PromiseRejectionEvent): (WebCore::PromiseRejectionEvent::~PromiseRejectionEvent): * dom/PromiseRejectionEvent.h: Added. * dom/PromiseRejectionEvent.idl: Added. New PromiseRejectionEvent event interface. * dom/GlobalEventHandlers.idl: New onunhandledrejection and onrejectionhandled. * dom/RejectedPromiseTracker.cpp: Added. (WebCore::RejectedPromise::RejectedPromise): (WebCore::RejectedPromise::globalObject): (WebCore::RejectedPromise::promise): (WebCore::UnhandledPromise::UnhandledPromise): (WebCore::UnhandledPromise::callStack): (WebCore::RejectedPromiseTracker::RejectedPromiseTracker): (WebCore::RejectedPromiseTracker::~RejectedPromiseTracker): (WebCore::createScriptCallStackFromReason): (WebCore::RejectedPromiseTracker::promiseRejected): (WebCore::RejectedPromiseTracker::promiseHandled): (WebCore::RejectedPromiseTracker::processQueueSoon): (WebCore::RejectedPromiseTracker::reportUnhandledRejections): (WebCore::RejectedPromiseTracker::reportRejectionHandled): * dom/RejectedPromiseTracker.h: Added. Track and report rejected promises. The promises are tracked weakly allowing them to be collected before they are reported. When reporting we dispatch PromiseRejectionEvent events, and if the default is not prevented we log a message to the console. * dom/ScriptExecutionContext.cpp: (WebCore::ScriptExecutionContext::reportUnhandledPromiseRejection): (WebCore::ScriptExecutionContext::ensureRejectedPromiseTrackerSlow): * dom/ScriptExecutionContext.h: (WebCore::ScriptExecutionContext::ensureRejectedPromiseTracker): Each ScriptExecutionContext can own a rejected promise tracker. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::pauseInternal): https://html.spec.whatwg.org/multipage/embedded-content.html#internal-pause-steps Internal pause steps say to timeupdate, pause, and rejecting pending play promises should all happen in a queued task. Here the first two actions are already scheduled on tasks, but rejecting play promises was not being done in a task, so this makes that change. * Modules/streams/ReadableStream.js: (pipeThrough): * Modules/streams/ReadableStreamInternals.js: (readableStreamReaderGenericInitialize): (readableStreamError): (readableStreamReaderGenericRelease): Satisfy parts of the Streams specification which state to set the [[PromiseIsHandled]] internal state of promises created internally by the Streams APIs. This prevents some internal promises from appearing as unhandled promise rejections. LayoutTests: * js/dom/unhandled-promise-rejection-basic-expected.txt: Added. * js/dom/unhandled-promise-rejection-basic.html: Added. * js/dom/unhandled-promise-rejection-bindings-type-error-expected.txt: Added. * js/dom/unhandled-promise-rejection-bindings-type-error.html: Added. * js/dom/unhandled-promise-rejection-console-no-report-expected.txt: Added. * js/dom/unhandled-promise-rejection-console-no-report.html: Added. * js/dom/unhandled-promise-rejection-console-report-expected.txt: Added. * js/dom/unhandled-promise-rejection-console-report.html: Added. * js/dom/unhandled-promise-rejection-handle-during-event-expected.txt: Added. * js/dom/unhandled-promise-rejection-handle-during-event.html: Added. * js/dom/unhandled-promise-rejection-handle-expected.txt: Added. * js/dom/unhandled-promise-rejection-handle-in-handler-expected.txt: Added. * js/dom/unhandled-promise-rejection-handle-in-handler.html: Added. * js/dom/unhandled-promise-rejection-handle.html: Added. * js/dom/unhandled-promise-rejection-order-expected.txt: Added. * js/dom/unhandled-promise-rejection-order.html: Added. New tests specific to the `onunhandledrejection` and `onrejectionhandled` events. * resources/testharnessreport.js: (self.testRunner.add_completion_callback.sanitize): (self.testRunner.add_completion_callback): Report results immediately and then finish the test after a turn. This way if the test ends with a pass, but may get unhandled rejections after completing which should not make the test appear as if it failed. Some tests have unhandled promise rejections but are expected to pass. Likewise some tests perform cleanup in their own completion callbacks, which happen after this initial completion callback, and we want to report results after all the work is done as it may eliminate non-deterministic debug test output. * TestExpectations: Mark some tests as flakey that have sometimes have unhandled promise rejections. These tests are all various imported tests that use the testharness. * fast/mediastream/MediaStream-MediaElement-setObject-null-expected.txt: * http/tests/security/video-cross-origin-caching-expected.txt: * inspector/debugger/break-on-exception-throw-in-promise-expected.txt: * inspector/debugger/break-on-uncaught-exception-throw-in-promise-expected.txt: * inspector/worker/resources-in-worker-expected.txt: * js/dom/dom-static-property-for-in-iteration-expected.txt: * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * js/promises-tests/promises-tests-2-2-6-expected.txt: * platform/mac/inspector/model/remote-object-expected.txt: * webrtc/libwebrtc/release-while-creating-offer-expected.txt: * webrtc/libwebrtc/release-while-setting-local-description-expected.txt: Update tests with unhandled promise rejection messages. * media/W3C/audio/events/event_pause_manual.html: * media/audio-playback-restriction-play-expected.txt: * media/audio-playback-restriction-play.html: * media/click-volume-bar-not-pausing.html: * media/remote-control-command-is-user-gesture-expected.txt: * media/remote-control-command-is-user-gesture.html: * media/track/track-mode.html: * media/video-autoplay-allowed-but-fullscreen-required.html: * media/video-display-none-crash.html: * media/video-main-content-deny-display-none.html: * media/video-main-content-deny-not-in-dom.html: * media/video-main-content-deny-not-visible.html: * media/video-main-content-deny-obscured.html: * media/video-main-content-deny-too-small.html: * media/video-multiple-concurrent-playback-expected.txt: * media/video-play-audio-require-user-gesture-expected.txt: * media/video-play-audio-require-user-gesture.html: * media/video-play-pause-events-expected.txt: * media/video-play-pause-events.html: * media/video-play-pause-exception-expected.txt: * media/video-play-pause-exception.html: * media/video-play-require-user-gesture-expected.txt: * media/video-play-require-user-gesture.html: * media/video-preload-expected.txt: * media/video-preload.html: * media/video-test.js: (handlePromise.handle): Snuff many possible unhandled promise rejections in media via media.play(). * streams/reference-implementation/pipe-to-expected.txt: * streams/reference-implementation/pipe-to-options-expected.txt: * streams/reference-implementation/readable-stream-templated-expected.txt: * streams/reference-implementation/writable-stream-abort-expected.txt: * streams/reference-implementation/writable-stream-expected.txt: These stream tests are out of date and produce unhandled rejections. * streams/shadowing-Promise.html: Update non-imported tests to prevent unhandled rejection messages. Canonical link: https://commits.webkit.org/188310@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215916 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-04-28 03:33:57 +00:00
for (var i = 0; i < tests.length; i++) {
var message = sanitize(tests[i].message);
if (tests[i].status == 1 && !tests[i].dumpStack) {
// Remove stack for failed tests for proper string comparison without file paths.
// For a test to dump the stack set its dumpStack attribute to true.
var stackIndex = message.indexOf("(stack:");
if (stackIndex > 0)
message = message.substr(0, stackIndex);
}
Update WPT test harness so that webaudio tests output results that are consistent across different machines https://bugs.webkit.org/show_bug.cgi?id=216332 Reviewed by Geoffrey Garen. LayoutTests/imported/w3c: Rebaseline tests. * web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-multi-channels-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/sub-sample-buffer-stitching-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/sub-sample-scheduling-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-audiobuffersource-connections-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-biquad-connection-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-biquad-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-constant-source-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-delay-connections-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-delay-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-gain-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-oscillator-connections-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner-connections-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-stereo-panner-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/retrospective-exponentialRampToValueAtTime-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/retrospective-linearRampToValueAtTime-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/retrospective-setTargetAtTime-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/retrospective-setValueAtTime-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/retrospective-setValueCurveAtTime-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-automation-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-biquadfilternode-interface/no-dezippering-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-constantsourcenode-interface/constant-source-output-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-1-chan-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-2-chan-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-4-chan-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-delaynode-interface/no-dezippering-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-gainnode-interface/gain-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-gainnode-interface/no-dezippering-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-iirfilternode-interface/ctor-iirfilter-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-iirfilternode-interface/iirfilter-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-iirfilternode-interface/iirfilter-getFrequencyResponse-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-oscillatornode-interface/osc-basic-waveform-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/automation-changes-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-automation-position-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-distance-clamping-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-equalpower-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-rolloff-clamping-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-scriptprocessornode-interface/simple-input-output-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-stereopanner-interface/no-dezippering-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-waveshapernode-interface/waveshaper-copy-curve-expected.txt: LayoutTests: Unskip tests that should now pass on all platforms. * TestExpectations: * resources/testharnessreport.js: (self.testRunner.add_completion_callback): Our webaudio implementation uses single precision for floating point audio values. However, the tests were printing out those values with 16 digits, even when the checks were passing. We had to skip those tests because digits after the 6th one may differ across machines and we were getting TEXT diffs. To address the issue we now strip arrays from PASS lines in webaudio tests output and replace them with the string '[expected array]'. As long as the check is passing, the actual value in the array does not really matter. * webaudio/Oscillator/no-dezippering-expected.txt: * webaudio/Oscillator/osc-440hz-expected.txt: * webaudio/Oscillator/osc-negative-freq-expected.txt: * webaudio/Oscillator/start-sampling-expected.txt: * webaudio/audioparam-cancel-and-hold-expected.txt: * webaudio/convolvernode-unmodified-buffer-expected.txt: Rebaseline tests. Canonical link: https://commits.webkit.org/229442@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267167 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-16 22:31:44 +00:00
let testName = tests[i].name;
WebAudio tests may give slightly different outputs on different platforms https://bugs.webkit.org/show_bug.cgi?id=218929 Reviewed by Geoffrey Garen. LayoutTests/imported/w3c: Rebaseline WPT tests now that their output has changed. * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-audiobuffersource-connections-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-audioworklet-connections.https-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-biquad-connection-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-biquad-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-constant-source-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-delay-connections-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-delay-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-gain-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-oscillator-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner-connections-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-stereo-panner-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-cascade-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-4-chan-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-delaynode-interface/maxdelay-rounding-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-oscillatornode-interface/detune-limiting-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/automation-changes-expected.txt: LayoutTests: WebAudio tests may give slightly different outputs on different platforms, causing what looks like flakiness. This is due to the "(contains X different values)" because X may differ from one platform to another (usually +/- 1). * resources/testharnessreport.js: (self.testRunner.add_completion_callback): Strip the "(contains X different values)" strings from output lines. * webaudio/AudioNode/tail-connections-expected.txt: * webaudio/AudioNode/tail-processing-expected.txt: * webaudio/BiquadFilter/biquad-829349-expected.txt: * webaudio/BiquadFilter/tail-time-allpass-expected.txt: * webaudio/BiquadFilter/tail-time-bandpass-expected.txt: * webaudio/BiquadFilter/tail-time-highpass-expected.txt: * webaudio/BiquadFilter/tail-time-highshelf-expected.txt: * webaudio/BiquadFilter/tail-time-lowpass-expected.txt: * webaudio/BiquadFilter/tail-time-lowshelf-expected.txt: * webaudio/BiquadFilter/tail-time-notch-expected.txt: * webaudio/BiquadFilter/tail-time-peaking-expected.txt: * webaudio/IIRFilter/iir-tail-time-expected.txt: Rebaseline tests accordingly. Canonical link: https://commits.webkit.org/231617@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269853 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-11-16 16:40:58 +00:00
if (isWebAudioTest) {
Update WPT test harness so that webaudio tests output results that are consistent across different machines https://bugs.webkit.org/show_bug.cgi?id=216332 Reviewed by Geoffrey Garen. LayoutTests/imported/w3c: Rebaseline tests. * web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-multi-channels-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/sub-sample-buffer-stitching-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/sub-sample-scheduling-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-audiobuffersource-connections-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-biquad-connection-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-biquad-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-constant-source-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-delay-connections-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-delay-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-gain-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-oscillator-connections-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner-connections-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-stereo-panner-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/retrospective-exponentialRampToValueAtTime-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/retrospective-linearRampToValueAtTime-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/retrospective-setTargetAtTime-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/retrospective-setValueAtTime-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/retrospective-setValueCurveAtTime-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-automation-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-biquadfilternode-interface/no-dezippering-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-constantsourcenode-interface/constant-source-output-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-1-chan-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-2-chan-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-4-chan-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-delaynode-interface/no-dezippering-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-gainnode-interface/gain-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-gainnode-interface/no-dezippering-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-iirfilternode-interface/ctor-iirfilter-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-iirfilternode-interface/iirfilter-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-iirfilternode-interface/iirfilter-getFrequencyResponse-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-oscillatornode-interface/osc-basic-waveform-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/automation-changes-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-automation-position-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-distance-clamping-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-equalpower-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-rolloff-clamping-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-scriptprocessornode-interface/simple-input-output-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-stereopanner-interface/no-dezippering-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-waveshapernode-interface/waveshaper-copy-curve-expected.txt: LayoutTests: Unskip tests that should now pass on all platforms. * TestExpectations: * resources/testharnessreport.js: (self.testRunner.add_completion_callback): Our webaudio implementation uses single precision for floating point audio values. However, the tests were printing out those values with 16 digits, even when the checks were passing. We had to skip those tests because digits after the 6th one may differ across machines and we were getting TEXT diffs. To address the issue we now strip arrays from PASS lines in webaudio tests output and replace them with the string '[expected array]'. As long as the check is passing, the actual value in the array does not really matter. * webaudio/Oscillator/no-dezippering-expected.txt: * webaudio/Oscillator/osc-440hz-expected.txt: * webaudio/Oscillator/osc-negative-freq-expected.txt: * webaudio/Oscillator/start-sampling-expected.txt: * webaudio/audioparam-cancel-and-hold-expected.txt: * webaudio/convolvernode-unmodified-buffer-expected.txt: Rebaseline tests. Canonical link: https://commits.webkit.org/229442@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267167 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-16 22:31:44 +00:00
testName = testName.replace(/\[[0-9.,\-e]*[0-9]\.[0-9]{7,}[0-9.,\-e]*\]/, "[expected array]");
imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner-connections.html fails on some platforms https://bugs.webkit.org/show_bug.cgi?id=218527 <rdar://problem/68947198> Reviewed by Eric Carlson. LayoutTests/imported/w3c: Rebaseline WPT tests now that floating point values are truncated to 6 decimals in the tests' output. * web-platform-tests/webaudio/the-audio-api/the-analysernode-interface/realtimeanalyser-basic-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audiobuffer-interface/audiobuffer-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-multi-channels-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/ctor-audiobuffersource-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/sub-sample-buffer-stitching-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/sub-sample-scheduling-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audiocontext-interface/audiocontextoptions-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/adding-events-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/audioparam-close-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/audioparam-exponentialRampToValueAtTime-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/audioparam-linearRampToValueAtTime-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/audioparam-method-chaining-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/audioparam-setTargetAtTime-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/audioparam-setValueCurve-exceptions-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/audioparam-setValueCurveAtTime-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/event-insertion-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-biquad-connection-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-connections-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner-connections-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/set-target-conv-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-audioparam.https-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletglobalscope-timing-info.https-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-automation-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-getFrequencyResponse-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-biquadfilternode-interface/no-dezippering-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-constantsourcenode-interface/constant-source-basic-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-1-chan-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-2-chan-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-4-chan-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-delaynode-interface/no-dezippering-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-dynamicscompressornode-interface/ctor-dynamicscompressor-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-dynamicscompressornode-interface/dynamicscompressor-basic-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-iirfilternode-interface/iirfilter-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-iirfilternode-interface/iirfilter-getFrequencyResponse-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-oscillatornode-interface/detune-limiting-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-oscillatornode-interface/osc-basic-waveform-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/ctor-panner-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/distance-exponential-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/distance-inverse-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/distance-linear-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-automation-basic-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-automation-equalpower-stereo-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-automation-position-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-azimuth-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-equalpower-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-equalpower-stereo-expected.txt: LayoutTests: * platform/ios/TestExpectations: * platform/mac/TestExpectations: Unskip test that should no longer be flaky. * resources/testharnessreport.js: (self.testRunner.add_completion_callback): In addition to stripping arrays of floating point values from webaudio tests' output, we now also truncate all floating point values to 6 decimals in those tests too. This allows tests like k-rate-panner-connections.html to consistently pass on all platforms because the floating point values that were causing failures are not in an array. Canonical link: https://commits.webkit.org/231205@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269361 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-11-04 16:09:57 +00:00
testName = testName.replace(/[0-9]\.[0-9]{7,}/g, (match, offset, string) => {
return parseFloat(match).toFixed(6);
});
WebAudio tests may give slightly different outputs on different platforms https://bugs.webkit.org/show_bug.cgi?id=218929 Reviewed by Geoffrey Garen. LayoutTests/imported/w3c: Rebaseline WPT tests now that their output has changed. * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-audiobuffersource-connections-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-audioworklet-connections.https-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-biquad-connection-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-biquad-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-constant-source-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-delay-connections-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-delay-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-gain-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-oscillator-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner-connections-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-stereo-panner-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-cascade-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-4-chan-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-delaynode-interface/maxdelay-rounding-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-oscillatornode-interface/detune-limiting-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/automation-changes-expected.txt: LayoutTests: WebAudio tests may give slightly different outputs on different platforms, causing what looks like flakiness. This is due to the "(contains X different values)" because X may differ from one platform to another (usually +/- 1). * resources/testharnessreport.js: (self.testRunner.add_completion_callback): Strip the "(contains X different values)" strings from output lines. * webaudio/AudioNode/tail-connections-expected.txt: * webaudio/AudioNode/tail-processing-expected.txt: * webaudio/BiquadFilter/biquad-829349-expected.txt: * webaudio/BiquadFilter/tail-time-allpass-expected.txt: * webaudio/BiquadFilter/tail-time-bandpass-expected.txt: * webaudio/BiquadFilter/tail-time-highpass-expected.txt: * webaudio/BiquadFilter/tail-time-highshelf-expected.txt: * webaudio/BiquadFilter/tail-time-lowpass-expected.txt: * webaudio/BiquadFilter/tail-time-lowshelf-expected.txt: * webaudio/BiquadFilter/tail-time-notch-expected.txt: * webaudio/BiquadFilter/tail-time-peaking-expected.txt: * webaudio/IIRFilter/iir-tail-time-expected.txt: Rebaseline tests accordingly. Canonical link: https://commits.webkit.org/231617@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269853 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-11-16 16:40:58 +00:00
testName = testName.replace(/ \(contains [0-9]+ different values\)./, ".");
testName = testName.replace(/ \(contains 1 different value\)./, ".");
testName = testName.replace(/: Actual Tail Frame [0-9]+ is greater than or equal to [0-9]+./, ".");
imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner-connections.html fails on some platforms https://bugs.webkit.org/show_bug.cgi?id=218527 <rdar://problem/68947198> Reviewed by Eric Carlson. LayoutTests/imported/w3c: Rebaseline WPT tests now that floating point values are truncated to 6 decimals in the tests' output. * web-platform-tests/webaudio/the-audio-api/the-analysernode-interface/realtimeanalyser-basic-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audiobuffer-interface/audiobuffer-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-multi-channels-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/ctor-audiobuffersource-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/sub-sample-buffer-stitching-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/sub-sample-scheduling-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audiocontext-interface/audiocontextoptions-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/adding-events-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/audioparam-close-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/audioparam-exponentialRampToValueAtTime-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/audioparam-linearRampToValueAtTime-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/audioparam-method-chaining-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/audioparam-setTargetAtTime-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/audioparam-setValueCurve-exceptions-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/audioparam-setValueCurveAtTime-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/event-insertion-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-biquad-connection-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-connections-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner-connections-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/set-target-conv-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-audioparam.https-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletglobalscope-timing-info.https-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-automation-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-getFrequencyResponse-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-biquadfilternode-interface/no-dezippering-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-constantsourcenode-interface/constant-source-basic-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-1-chan-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-2-chan-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-4-chan-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-delaynode-interface/no-dezippering-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-dynamicscompressornode-interface/ctor-dynamicscompressor-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-dynamicscompressornode-interface/dynamicscompressor-basic-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-iirfilternode-interface/iirfilter-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-iirfilternode-interface/iirfilter-getFrequencyResponse-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-oscillatornode-interface/detune-limiting-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-oscillatornode-interface/osc-basic-waveform-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/ctor-panner-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/distance-exponential-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/distance-inverse-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/distance-linear-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-automation-basic-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-automation-equalpower-stereo-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-automation-position-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-azimuth-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-equalpower-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-equalpower-stereo-expected.txt: LayoutTests: * platform/ios/TestExpectations: * platform/mac/TestExpectations: Unskip test that should no longer be flaky. * resources/testharnessreport.js: (self.testRunner.add_completion_callback): In addition to stripping arrays of floating point values from webaudio tests' output, we now also truncate all floating point values to 6 decimals in those tests too. This allows tests like k-rate-panner-connections.html to consistently pass on all platforms because the floating point values that were causing failures are not in an array. Canonical link: https://commits.webkit.org/231205@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269361 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-11-04 16:09:57 +00:00
}
Update WPT test harness so that webaudio tests output results that are consistent across different machines https://bugs.webkit.org/show_bug.cgi?id=216332 Reviewed by Geoffrey Garen. LayoutTests/imported/w3c: Rebaseline tests. * web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-multi-channels-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/sub-sample-buffer-stitching-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/sub-sample-scheduling-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-audiobuffersource-connections-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-biquad-connection-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-biquad-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-constant-source-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-delay-connections-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-delay-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-gain-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-oscillator-connections-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner-connections-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-stereo-panner-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/retrospective-exponentialRampToValueAtTime-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/retrospective-linearRampToValueAtTime-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/retrospective-setTargetAtTime-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/retrospective-setValueAtTime-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/retrospective-setValueCurveAtTime-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-biquadfilternode-interface/biquad-automation-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-biquadfilternode-interface/no-dezippering-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-constantsourcenode-interface/constant-source-output-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-1-chan-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-2-chan-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-4-chan-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-delaynode-interface/no-dezippering-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-gainnode-interface/gain-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-gainnode-interface/no-dezippering-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-iirfilternode-interface/ctor-iirfilter-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-iirfilternode-interface/iirfilter-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-iirfilternode-interface/iirfilter-getFrequencyResponse-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-oscillatornode-interface/osc-basic-waveform-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/automation-changes-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-automation-position-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-distance-clamping-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-equalpower-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-rolloff-clamping-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-scriptprocessornode-interface/simple-input-output-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-stereopanner-interface/no-dezippering-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-waveshapernode-interface/waveshaper-copy-curve-expected.txt: LayoutTests: Unskip tests that should now pass on all platforms. * TestExpectations: * resources/testharnessreport.js: (self.testRunner.add_completion_callback): Our webaudio implementation uses single precision for floating point audio values. However, the tests were printing out those values with 16 digits, even when the checks were passing. We had to skip those tests because digits after the 6th one may differ across machines and we were getting TEXT diffs. To address the issue we now strip arrays from PASS lines in webaudio tests output and replace them with the string '[expected array]'. As long as the check is passing, the actual value in the array does not really matter. * webaudio/Oscillator/no-dezippering-expected.txt: * webaudio/Oscillator/osc-440hz-expected.txt: * webaudio/Oscillator/osc-negative-freq-expected.txt: * webaudio/Oscillator/start-sampling-expected.txt: * webaudio/audioparam-cancel-and-hold-expected.txt: * webaudio/convolvernode-unmodified-buffer-expected.txt: Rebaseline tests. Canonical link: https://commits.webkit.org/229442@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267167 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-16 22:31:44 +00:00
resultStr += convertResult(tests[i].status) + " " + sanitize(testName) + " " + message + "\n";
Support for promise rejection events (unhandledrejection) https://bugs.webkit.org/show_bug.cgi?id=150358 <rdar://problem/28441651> Reviewed by Saam Barati. Patch by Joseph Pecoraro and Yusuke Suzuki. LayoutTests/imported/w3c: * web-platform-tests/WebCryptoAPI/derive_bits_keys/test_ecdh_bits-expected.txt: * web-platform-tests/WebCryptoAPI/derive_bits_keys/test_ecdh_keys-expected.txt: * web-platform-tests/html/semantics/embedded-content/media-elements/event_pause_noautoplay-expected.txt: * web-platform-tests/html/semantics/embedded-content/media-elements/event_play_noautoplay-expected.txt: * web-platform-tests/html/semantics/embedded-content/media-elements/paused_true_during_pause-expected.txt: * web-platform-tests/html/syntax/parsing/html5lib_innerHTML_adoption01-expected.txt: * web-platform-tests/html/webappapis/scripting/events/body-exposed-window-event-handlers-expected.txt: * web-platform-tests/streams/piping/close-propagation-forward-expected.txt: * web-platform-tests/streams/piping/error-propagation-backward-expected.txt: * web-platform-tests/streams/piping/error-propagation-forward-expected.txt: * web-platform-tests/streams/piping/flow-control-expected.txt: * web-platform-tests/streams/piping/general-expected.txt: * web-platform-tests/user-timing/measure_exceptions_navigation_timing-expected.txt: Rebaseline expectations to include unhandled promise rejection messages. Also change how the test harness reports success or failure to use the values immediately on completion and then allow a run loop cycle before completing the test to gather the output. * web-platform-tests/resource-timing/rt-resource-errors.html: This is our own WPT test yet to be uploaded, so update the test to prevent an unexpected unhandled rejection. Source/JavaScriptCore: Implement support for promise.[[PromiseIsHandled]] and the HostPromiseRejectionTracker hook for HTML to track promise rejections: https://tc39.github.io/ecma262/#sec-host-promise-rejection-tracker https://html.spec.whatwg.org/multipage/webappapis.html#unhandled-promise-rejections * builtins/BuiltinNames.h: New private symbols. * builtins/PromiseOperations.js: (globalPrivate.newHandledRejectedPromise): Utility to create a rejected promise with [[PromiseIsHandled]] to true. (globalPrivate.rejectPromise): (globalPrivate.initializePromise): * builtins/PromisePrototype.js: (then): Implement standard behavior of [[PromiseIsHandled]] and the host hook. * runtime/JSPromise.cpp: (JSC::JSPromise::isHandled): * runtime/JSPromise.h: C++ accessors for the [[PromiseIsHandled]] state. * bytecode/BytecodeIntrinsicRegistry.cpp: (JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry): * bytecode/BytecodeIntrinsicRegistry.h: Expose private values for the Reject / Handle enum values in built-ins. * jsc.cpp: * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::promiseResolveFunction): Add a new GlobalObjectMethodTable hook matching the promise rejection hook. * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): (JSC::JSGlobalObject::visitChildren): * runtime/JSGlobalObjectFunctions.cpp: (JSC::globalFuncHostPromiseRejectionTracker): * runtime/JSGlobalObjectFunctions.h: Plumb the builtin hook through to the optional GlobalObjectMethodTable hook. * inspector/InjectedScriptSource.js: (InjectedScript.prototype.createFakeValueDescriptor): Silence possible rejected promises created internally via Web Inspector. Source/WebCore: Implement support for the `onunhandledrejection` and `rejectionhandled` events. They dispatch a new PromiseRejectionEvent using the ES6 HostPromiseRejectionTracker hook: https://tc39.github.io/ecma262/#sec-host-promise-rejection-tracker https://html.spec.whatwg.org/multipage/webappapis.html#unhandled-promise-rejections This is currently implemented only for Documents and not yet Web Workers. Tests: js/dom/unhandled-promise-rejection-basic.html js/dom/unhandled-promise-rejection-bindings-type-error.html js/dom/unhandled-promise-rejection-console-no-report.html js/dom/unhandled-promise-rejection-console-report.html js/dom/unhandled-promise-rejection-handle-during-event.html js/dom/unhandled-promise-rejection-handle-in-handler.html js/dom/unhandled-promise-rejection-handle.html js/dom/unhandled-promise-rejection-order.html * CMakeLists.txt: * DerivedSources.cpp: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * dom/DOMAllInOne.cpp: New files. * bindings/scripts/CodeGenerator.pm: (IsPromiseType): * bindings/scripts/CodeGeneratorJS.pm: (AddToIncludesForIDLType): (GetBaseIDLType): Binding support for Promise<T> attributes. * bindings/js/JSDOMConvert.h: * bindings/js/JSDOMConvertPromise.h: Copied from Source/JavaScriptCore/runtime/JSPromise.h. (WebCore::Converter<IDLPromise<T>>::convert): (WebCore::JSConverter<IDLPromise<T>>::convert): Promise<T> binding conversion is currently unimplemented, which only means web developers creating their own PromiseRejectionEvent will not get autowrapping of values assigned to `promise` in event initialization. Engine generated events will have expected behavior. * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::promiseRejectionTracker): * bindings/js/JSDOMWindowBase.h: * bindings/js/JSWorkerGlobalScopeBase.cpp: Implement HostPromiseRejectionTracker hook for Document but not Worker. Passes through to the ScriptExecutionContext's tracker. * bindings/js/JSMainThreadExecState.cpp: (WebCore::JSMainThreadExecState::didLeaveScriptContext): * bindings/js/JSMainThreadExecState.h: (WebCore::JSMainThreadExecState::~JSMainThreadExecState): When completing script execution and performing microtasks notify about rejected promises. Technically this should go inside of performing a microtask checkpoint, except lacking EventLoop concepts we use ScriptExecutionState. * dom/EventNames.h: * dom/EventNames.in: * dom/PromiseRejectionEvent.cpp: Added. (WebCore::PromiseRejectionEvent::PromiseRejectionEvent): (WebCore::PromiseRejectionEvent::~PromiseRejectionEvent): * dom/PromiseRejectionEvent.h: Added. * dom/PromiseRejectionEvent.idl: Added. New PromiseRejectionEvent event interface. * dom/GlobalEventHandlers.idl: New onunhandledrejection and onrejectionhandled. * dom/RejectedPromiseTracker.cpp: Added. (WebCore::RejectedPromise::RejectedPromise): (WebCore::RejectedPromise::globalObject): (WebCore::RejectedPromise::promise): (WebCore::UnhandledPromise::UnhandledPromise): (WebCore::UnhandledPromise::callStack): (WebCore::RejectedPromiseTracker::RejectedPromiseTracker): (WebCore::RejectedPromiseTracker::~RejectedPromiseTracker): (WebCore::createScriptCallStackFromReason): (WebCore::RejectedPromiseTracker::promiseRejected): (WebCore::RejectedPromiseTracker::promiseHandled): (WebCore::RejectedPromiseTracker::processQueueSoon): (WebCore::RejectedPromiseTracker::reportUnhandledRejections): (WebCore::RejectedPromiseTracker::reportRejectionHandled): * dom/RejectedPromiseTracker.h: Added. Track and report rejected promises. The promises are tracked weakly allowing them to be collected before they are reported. When reporting we dispatch PromiseRejectionEvent events, and if the default is not prevented we log a message to the console. * dom/ScriptExecutionContext.cpp: (WebCore::ScriptExecutionContext::reportUnhandledPromiseRejection): (WebCore::ScriptExecutionContext::ensureRejectedPromiseTrackerSlow): * dom/ScriptExecutionContext.h: (WebCore::ScriptExecutionContext::ensureRejectedPromiseTracker): Each ScriptExecutionContext can own a rejected promise tracker. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::pauseInternal): https://html.spec.whatwg.org/multipage/embedded-content.html#internal-pause-steps Internal pause steps say to timeupdate, pause, and rejecting pending play promises should all happen in a queued task. Here the first two actions are already scheduled on tasks, but rejecting play promises was not being done in a task, so this makes that change. * Modules/streams/ReadableStream.js: (pipeThrough): * Modules/streams/ReadableStreamInternals.js: (readableStreamReaderGenericInitialize): (readableStreamError): (readableStreamReaderGenericRelease): Satisfy parts of the Streams specification which state to set the [[PromiseIsHandled]] internal state of promises created internally by the Streams APIs. This prevents some internal promises from appearing as unhandled promise rejections. LayoutTests: * js/dom/unhandled-promise-rejection-basic-expected.txt: Added. * js/dom/unhandled-promise-rejection-basic.html: Added. * js/dom/unhandled-promise-rejection-bindings-type-error-expected.txt: Added. * js/dom/unhandled-promise-rejection-bindings-type-error.html: Added. * js/dom/unhandled-promise-rejection-console-no-report-expected.txt: Added. * js/dom/unhandled-promise-rejection-console-no-report.html: Added. * js/dom/unhandled-promise-rejection-console-report-expected.txt: Added. * js/dom/unhandled-promise-rejection-console-report.html: Added. * js/dom/unhandled-promise-rejection-handle-during-event-expected.txt: Added. * js/dom/unhandled-promise-rejection-handle-during-event.html: Added. * js/dom/unhandled-promise-rejection-handle-expected.txt: Added. * js/dom/unhandled-promise-rejection-handle-in-handler-expected.txt: Added. * js/dom/unhandled-promise-rejection-handle-in-handler.html: Added. * js/dom/unhandled-promise-rejection-handle.html: Added. * js/dom/unhandled-promise-rejection-order-expected.txt: Added. * js/dom/unhandled-promise-rejection-order.html: Added. New tests specific to the `onunhandledrejection` and `onrejectionhandled` events. * resources/testharnessreport.js: (self.testRunner.add_completion_callback.sanitize): (self.testRunner.add_completion_callback): Report results immediately and then finish the test after a turn. This way if the test ends with a pass, but may get unhandled rejections after completing which should not make the test appear as if it failed. Some tests have unhandled promise rejections but are expected to pass. Likewise some tests perform cleanup in their own completion callbacks, which happen after this initial completion callback, and we want to report results after all the work is done as it may eliminate non-deterministic debug test output. * TestExpectations: Mark some tests as flakey that have sometimes have unhandled promise rejections. These tests are all various imported tests that use the testharness. * fast/mediastream/MediaStream-MediaElement-setObject-null-expected.txt: * http/tests/security/video-cross-origin-caching-expected.txt: * inspector/debugger/break-on-exception-throw-in-promise-expected.txt: * inspector/debugger/break-on-uncaught-exception-throw-in-promise-expected.txt: * inspector/worker/resources-in-worker-expected.txt: * js/dom/dom-static-property-for-in-iteration-expected.txt: * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * js/promises-tests/promises-tests-2-2-6-expected.txt: * platform/mac/inspector/model/remote-object-expected.txt: * webrtc/libwebrtc/release-while-creating-offer-expected.txt: * webrtc/libwebrtc/release-while-setting-local-description-expected.txt: Update tests with unhandled promise rejection messages. * media/W3C/audio/events/event_pause_manual.html: * media/audio-playback-restriction-play-expected.txt: * media/audio-playback-restriction-play.html: * media/click-volume-bar-not-pausing.html: * media/remote-control-command-is-user-gesture-expected.txt: * media/remote-control-command-is-user-gesture.html: * media/track/track-mode.html: * media/video-autoplay-allowed-but-fullscreen-required.html: * media/video-display-none-crash.html: * media/video-main-content-deny-display-none.html: * media/video-main-content-deny-not-in-dom.html: * media/video-main-content-deny-not-visible.html: * media/video-main-content-deny-obscured.html: * media/video-main-content-deny-too-small.html: * media/video-multiple-concurrent-playback-expected.txt: * media/video-play-audio-require-user-gesture-expected.txt: * media/video-play-audio-require-user-gesture.html: * media/video-play-pause-events-expected.txt: * media/video-play-pause-events.html: * media/video-play-pause-exception-expected.txt: * media/video-play-pause-exception.html: * media/video-play-require-user-gesture-expected.txt: * media/video-play-require-user-gesture.html: * media/video-preload-expected.txt: * media/video-preload.html: * media/video-test.js: (handlePromise.handle): Snuff many possible unhandled promise rejections in media via media.play(). * streams/reference-implementation/pipe-to-expected.txt: * streams/reference-implementation/pipe-to-options-expected.txt: * streams/reference-implementation/readable-stream-templated-expected.txt: * streams/reference-implementation/writable-stream-abort-expected.txt: * streams/reference-implementation/writable-stream-expected.txt: These stream tests are out of date and produce unhandled rejections. * streams/shadowing-Promise.html: Update non-imported tests to prevent unhandled rejection messages. Canonical link: https://commits.webkit.org/188310@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215916 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-04-28 03:33:57 +00:00
}
Make testharnessreport.js report the results correctly inside an SVG document https://bugs.webkit.org/show_bug.cgi?id=203503 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-10-30 Reviewed by Chris Dumez. LayoutTests/imported/w3c: * web-platform-tests/dom/nodes/Document-constructor-xml-expected.txt: * web-platform-tests/dom/nodes/Node-contains-xml-expected.txt: * web-platform-tests/dom/nodes/getElementsByClassName-10-expected.txt: * web-platform-tests/dom/nodes/getElementsByClassName-11-expected.txt: * web-platform-tests/svg/animations/scripted/end-element-on-inactive-element-expected.txt: Added. * web-platform-tests/svg/animations/scripted/onhover-syncbases-expected.txt: Added. * web-platform-tests/svg/extensibility/foreignObject/properties-expected.txt: Added. * web-platform-tests/svg/extensibility/interfaces/foreignObject-graphics-expected.txt: Added. * web-platform-tests/svg/geometry/inheritance-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/cx-computed-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/cx-invalid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/cx-valid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/cy-computed-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/cy-invalid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/cy-valid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/height-computed-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/r-computed-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/r-invalid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/r-valid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/rx-computed-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/rx-invalid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/rx-valid-expected.txt: * web-platform-tests/svg/geometry/parsing/ry-computed-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/ry-invalid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/ry-valid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/sizing-properties-computed-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/width-computed-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/x-computed-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/x-invalid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/x-valid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/y-computed-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/y-invalid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/y-valid-expected.txt: Added. * web-platform-tests/svg/interact/inheritance-expected.txt: Added. * web-platform-tests/svg/interact/parsing/pointer-events-computed-expected.txt: Added. * web-platform-tests/svg/interact/parsing/pointer-events-invalid-expected.txt: Added. * web-platform-tests/svg/interact/parsing/pointer-events-valid-expected.txt: Added. * web-platform-tests/svg/interact/script-content-expected.txt: Added. * web-platform-tests/svg/interact/scripted/composed.window-expected.txt: Added. * web-platform-tests/svg/interact/scripted/focus-events-expected.txt: Added. * web-platform-tests/svg/interact/scripted/focus-tabindex-default-value-expected.txt: Added. * web-platform-tests/svg/interact/scripted/tabindex-focus-flag-expected.txt: Added. * web-platform-tests/svg/linking/scripted/a-download-click-expected.txt: Added. * web-platform-tests/svg/linking/scripted/a.rel-getter-01-expected.txt: Added. * web-platform-tests/svg/linking/scripted/a.rel-setter-01-expected.txt: Added. * web-platform-tests/svg/linking/scripted/a.text-getter-01-expected.txt: Added. * web-platform-tests/svg/linking/scripted/a.text-setter-01-expected.txt: Added. * web-platform-tests/svg/linking/scripted/rellist-feature-detection-expected.txt: Added. * web-platform-tests/svg/painting/inheritance-expected.txt: Added. * web-platform-tests/svg/painting/parsing/color-interpolation-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/color-interpolation-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/fill-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/fill-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/fill-opacity-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/fill-opacity-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/fill-opacity-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/fill-rule-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/fill-rule-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/fill-rule-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/fill-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/image-rendering-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/image-rendering-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/image-rendering-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-end-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-end-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-end-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-mid-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-mid-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-mid-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-start-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-start-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-start-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/paint-order-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/paint-order-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/paint-order-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/shape-rendering-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/shape-rendering-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/shape-rendering-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-dasharray-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-dasharray-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-dasharray-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-dashoffset-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-dashoffset-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-dashoffset-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-linecap-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-linecap-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-linecap-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-linejoin-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-linejoin-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-linejoin-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-miterlimit-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-miterlimit-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-miterlimit-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-opacity-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-opacity-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-opacity-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-width-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-width-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-width-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/text-rendering-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/text-rendering-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/text-rendering-valid-expected.txt: Added. * web-platform-tests/svg/painting/scripted/paint-order-computed-value-01-expected.txt: Added. * web-platform-tests/svg/path/error-handling/bounding-expected.txt: Added. * web-platform-tests/svg/path/interfaces/SVGAnimatedPathData-removed-expected.txt: Added. * web-platform-tests/svg/path/property/d-interpolation-discrete-expected.txt: Added. * web-platform-tests/svg/path/property/d-interpolation-relative-absolute-expected.txt: Added. * web-platform-tests/svg/path/property/d-interpolation-single-expected.txt: Added. * web-platform-tests/svg/path/property/getComputedStyle-expected.txt: Added. * web-platform-tests/svg/path/property/serialization-expected.txt: Added. * web-platform-tests/svg/pservers/inheritance-expected.txt: Added. * web-platform-tests/svg/pservers/parsing/stop-color-computed-expected.txt: Added. * web-platform-tests/svg/pservers/parsing/stop-color-invalid-expected.txt: Added. * web-platform-tests/svg/pservers/parsing/stop-color-valid-expected.txt: Added. * web-platform-tests/svg/pservers/parsing/stop-opacity-computed-expected.txt: Added. * web-platform-tests/svg/pservers/parsing/stop-opacity-invalid-expected.txt: Added. * web-platform-tests/svg/pservers/parsing/stop-opacity-valid-expected.txt: Added. * web-platform-tests/svg/pservers/scripted/stop-color-inheritance-currentcolor-expected.txt: Added. * web-platform-tests/svg/scripted/text-attrs-dxdy-have-length-expected.txt: Added. * web-platform-tests/svg/scripted/text-attrs-xyrotate-have-length-expected.txt: Added. * web-platform-tests/svg/scripted/text-tspan-attrs-have-length-expected.txt: Added. * web-platform-tests/svg/scripted/text-tspan-attrs-indexed-access-expected.txt: Added. * web-platform-tests/svg/scripted/tspan-attrs-dxdy-have-length-expected.txt: Added. * web-platform-tests/svg/scripted/tspan-attrs-xyrotate-have-length-expected.txt: Added. * web-platform-tests/svg/shapes/line-getPointAtLength-expected.txt: Added. * web-platform-tests/svg/shapes/line-pathLength-expected.txt: Added. * web-platform-tests/svg/shapes/rx-ry-not-inherited-expected.txt: Added. * web-platform-tests/svg/shapes/scripted/disabled-shapes-not-hit-expected.txt: Added. * web-platform-tests/svg/struct/UnknownElement/interface-expected.txt: Added. * web-platform-tests/svg/struct/scripted/autofocus-attribute-expected.txt: Added. * web-platform-tests/svg/styling/required-properties-expected.txt: Added. * web-platform-tests/svg/text/inheritance-expected.txt: Added. * web-platform-tests/svg/text/parsing/inline-size-invalid-expected.txt: Added. * web-platform-tests/svg/text/parsing/inline-size-valid-expected.txt: Added. * web-platform-tests/svg/text/parsing/shape-inside-invalid-expected.txt: Added. * web-platform-tests/svg/text/parsing/shape-inside-valid-expected.txt: Added. * web-platform-tests/svg/text/parsing/shape-margin-invalid-expected.txt: Added. * web-platform-tests/svg/text/parsing/shape-margin-valid-expected.txt: Added. * web-platform-tests/svg/text/parsing/shape-subtract-invalid-expected.txt: Added. * web-platform-tests/svg/text/parsing/shape-subtract-valid-expected.txt: Added. * web-platform-tests/svg/text/parsing/text-anchor-computed-expected.txt: Added. * web-platform-tests/svg/text/parsing/text-anchor-invalid-expected.txt: Added. * web-platform-tests/svg/text/parsing/text-anchor-valid-expected.txt: Added. * web-platform-tests/svg/text/parsing/text-decoration-fill-invalid-expected.txt: Added. * web-platform-tests/svg/text/parsing/text-decoration-fill-valid-expected.txt: Added. * web-platform-tests/svg/text/parsing/text-decoration-stroke-invalid-expected.txt: Added. * web-platform-tests/svg/text/parsing/text-decoration-stroke-valid-expected.txt: Added. * web-platform-tests/svg/types/elements/SVGGeometryElement-rect-expected.txt: Added. * web-platform-tests/svg/types/scripted/SVGGeometryElement.getPointAtLength-01-expected.txt: Added. * web-platform-tests/svg/types/scripted/SVGGeometryElement.isPointInFill-01-expected.txt: Added. * web-platform-tests/svg/types/scripted/SVGGeometryElement.isPointInStroke-01-expected.txt: Added. * web-platform-tests/svg/types/scripted/SVGGraphicsElement-expected.txt: Added. * web-platform-tests/svg/types/scripted/event-handler-all-document-element-events-expected.txt: Added. LayoutTests: For SVG tests, the completion callback has to create a foreignObject and append it to the root element. Then the results element has to be appended to this foreignObject. * TestExpectations: * platform/mac/imported/w3c/web-platform-tests/svg/path/error-handling/bounding-expected.txt: Removed. * platform/mac/imported/w3c/web-platform-tests/svg/shapes/scripted/disabled-shapes-not-hit-expected.txt: Removed. * resources/testharnessreport.js: (self.testRunner.add_completion_callback): Canonical link: https://commits.webkit.org/216979@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@251777 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-30 17:20:17 +00:00
var results = document.createElementNS("http://www.w3.org/1999/xhtml", "pre");
Support for promise rejection events (unhandledrejection) https://bugs.webkit.org/show_bug.cgi?id=150358 <rdar://problem/28441651> Reviewed by Saam Barati. Patch by Joseph Pecoraro and Yusuke Suzuki. LayoutTests/imported/w3c: * web-platform-tests/WebCryptoAPI/derive_bits_keys/test_ecdh_bits-expected.txt: * web-platform-tests/WebCryptoAPI/derive_bits_keys/test_ecdh_keys-expected.txt: * web-platform-tests/html/semantics/embedded-content/media-elements/event_pause_noautoplay-expected.txt: * web-platform-tests/html/semantics/embedded-content/media-elements/event_play_noautoplay-expected.txt: * web-platform-tests/html/semantics/embedded-content/media-elements/paused_true_during_pause-expected.txt: * web-platform-tests/html/syntax/parsing/html5lib_innerHTML_adoption01-expected.txt: * web-platform-tests/html/webappapis/scripting/events/body-exposed-window-event-handlers-expected.txt: * web-platform-tests/streams/piping/close-propagation-forward-expected.txt: * web-platform-tests/streams/piping/error-propagation-backward-expected.txt: * web-platform-tests/streams/piping/error-propagation-forward-expected.txt: * web-platform-tests/streams/piping/flow-control-expected.txt: * web-platform-tests/streams/piping/general-expected.txt: * web-platform-tests/user-timing/measure_exceptions_navigation_timing-expected.txt: Rebaseline expectations to include unhandled promise rejection messages. Also change how the test harness reports success or failure to use the values immediately on completion and then allow a run loop cycle before completing the test to gather the output. * web-platform-tests/resource-timing/rt-resource-errors.html: This is our own WPT test yet to be uploaded, so update the test to prevent an unexpected unhandled rejection. Source/JavaScriptCore: Implement support for promise.[[PromiseIsHandled]] and the HostPromiseRejectionTracker hook for HTML to track promise rejections: https://tc39.github.io/ecma262/#sec-host-promise-rejection-tracker https://html.spec.whatwg.org/multipage/webappapis.html#unhandled-promise-rejections * builtins/BuiltinNames.h: New private symbols. * builtins/PromiseOperations.js: (globalPrivate.newHandledRejectedPromise): Utility to create a rejected promise with [[PromiseIsHandled]] to true. (globalPrivate.rejectPromise): (globalPrivate.initializePromise): * builtins/PromisePrototype.js: (then): Implement standard behavior of [[PromiseIsHandled]] and the host hook. * runtime/JSPromise.cpp: (JSC::JSPromise::isHandled): * runtime/JSPromise.h: C++ accessors for the [[PromiseIsHandled]] state. * bytecode/BytecodeIntrinsicRegistry.cpp: (JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry): * bytecode/BytecodeIntrinsicRegistry.h: Expose private values for the Reject / Handle enum values in built-ins. * jsc.cpp: * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::promiseResolveFunction): Add a new GlobalObjectMethodTable hook matching the promise rejection hook. * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): (JSC::JSGlobalObject::visitChildren): * runtime/JSGlobalObjectFunctions.cpp: (JSC::globalFuncHostPromiseRejectionTracker): * runtime/JSGlobalObjectFunctions.h: Plumb the builtin hook through to the optional GlobalObjectMethodTable hook. * inspector/InjectedScriptSource.js: (InjectedScript.prototype.createFakeValueDescriptor): Silence possible rejected promises created internally via Web Inspector. Source/WebCore: Implement support for the `onunhandledrejection` and `rejectionhandled` events. They dispatch a new PromiseRejectionEvent using the ES6 HostPromiseRejectionTracker hook: https://tc39.github.io/ecma262/#sec-host-promise-rejection-tracker https://html.spec.whatwg.org/multipage/webappapis.html#unhandled-promise-rejections This is currently implemented only for Documents and not yet Web Workers. Tests: js/dom/unhandled-promise-rejection-basic.html js/dom/unhandled-promise-rejection-bindings-type-error.html js/dom/unhandled-promise-rejection-console-no-report.html js/dom/unhandled-promise-rejection-console-report.html js/dom/unhandled-promise-rejection-handle-during-event.html js/dom/unhandled-promise-rejection-handle-in-handler.html js/dom/unhandled-promise-rejection-handle.html js/dom/unhandled-promise-rejection-order.html * CMakeLists.txt: * DerivedSources.cpp: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * dom/DOMAllInOne.cpp: New files. * bindings/scripts/CodeGenerator.pm: (IsPromiseType): * bindings/scripts/CodeGeneratorJS.pm: (AddToIncludesForIDLType): (GetBaseIDLType): Binding support for Promise<T> attributes. * bindings/js/JSDOMConvert.h: * bindings/js/JSDOMConvertPromise.h: Copied from Source/JavaScriptCore/runtime/JSPromise.h. (WebCore::Converter<IDLPromise<T>>::convert): (WebCore::JSConverter<IDLPromise<T>>::convert): Promise<T> binding conversion is currently unimplemented, which only means web developers creating their own PromiseRejectionEvent will not get autowrapping of values assigned to `promise` in event initialization. Engine generated events will have expected behavior. * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::promiseRejectionTracker): * bindings/js/JSDOMWindowBase.h: * bindings/js/JSWorkerGlobalScopeBase.cpp: Implement HostPromiseRejectionTracker hook for Document but not Worker. Passes through to the ScriptExecutionContext's tracker. * bindings/js/JSMainThreadExecState.cpp: (WebCore::JSMainThreadExecState::didLeaveScriptContext): * bindings/js/JSMainThreadExecState.h: (WebCore::JSMainThreadExecState::~JSMainThreadExecState): When completing script execution and performing microtasks notify about rejected promises. Technically this should go inside of performing a microtask checkpoint, except lacking EventLoop concepts we use ScriptExecutionState. * dom/EventNames.h: * dom/EventNames.in: * dom/PromiseRejectionEvent.cpp: Added. (WebCore::PromiseRejectionEvent::PromiseRejectionEvent): (WebCore::PromiseRejectionEvent::~PromiseRejectionEvent): * dom/PromiseRejectionEvent.h: Added. * dom/PromiseRejectionEvent.idl: Added. New PromiseRejectionEvent event interface. * dom/GlobalEventHandlers.idl: New onunhandledrejection and onrejectionhandled. * dom/RejectedPromiseTracker.cpp: Added. (WebCore::RejectedPromise::RejectedPromise): (WebCore::RejectedPromise::globalObject): (WebCore::RejectedPromise::promise): (WebCore::UnhandledPromise::UnhandledPromise): (WebCore::UnhandledPromise::callStack): (WebCore::RejectedPromiseTracker::RejectedPromiseTracker): (WebCore::RejectedPromiseTracker::~RejectedPromiseTracker): (WebCore::createScriptCallStackFromReason): (WebCore::RejectedPromiseTracker::promiseRejected): (WebCore::RejectedPromiseTracker::promiseHandled): (WebCore::RejectedPromiseTracker::processQueueSoon): (WebCore::RejectedPromiseTracker::reportUnhandledRejections): (WebCore::RejectedPromiseTracker::reportRejectionHandled): * dom/RejectedPromiseTracker.h: Added. Track and report rejected promises. The promises are tracked weakly allowing them to be collected before they are reported. When reporting we dispatch PromiseRejectionEvent events, and if the default is not prevented we log a message to the console. * dom/ScriptExecutionContext.cpp: (WebCore::ScriptExecutionContext::reportUnhandledPromiseRejection): (WebCore::ScriptExecutionContext::ensureRejectedPromiseTrackerSlow): * dom/ScriptExecutionContext.h: (WebCore::ScriptExecutionContext::ensureRejectedPromiseTracker): Each ScriptExecutionContext can own a rejected promise tracker. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::pauseInternal): https://html.spec.whatwg.org/multipage/embedded-content.html#internal-pause-steps Internal pause steps say to timeupdate, pause, and rejecting pending play promises should all happen in a queued task. Here the first two actions are already scheduled on tasks, but rejecting play promises was not being done in a task, so this makes that change. * Modules/streams/ReadableStream.js: (pipeThrough): * Modules/streams/ReadableStreamInternals.js: (readableStreamReaderGenericInitialize): (readableStreamError): (readableStreamReaderGenericRelease): Satisfy parts of the Streams specification which state to set the [[PromiseIsHandled]] internal state of promises created internally by the Streams APIs. This prevents some internal promises from appearing as unhandled promise rejections. LayoutTests: * js/dom/unhandled-promise-rejection-basic-expected.txt: Added. * js/dom/unhandled-promise-rejection-basic.html: Added. * js/dom/unhandled-promise-rejection-bindings-type-error-expected.txt: Added. * js/dom/unhandled-promise-rejection-bindings-type-error.html: Added. * js/dom/unhandled-promise-rejection-console-no-report-expected.txt: Added. * js/dom/unhandled-promise-rejection-console-no-report.html: Added. * js/dom/unhandled-promise-rejection-console-report-expected.txt: Added. * js/dom/unhandled-promise-rejection-console-report.html: Added. * js/dom/unhandled-promise-rejection-handle-during-event-expected.txt: Added. * js/dom/unhandled-promise-rejection-handle-during-event.html: Added. * js/dom/unhandled-promise-rejection-handle-expected.txt: Added. * js/dom/unhandled-promise-rejection-handle-in-handler-expected.txt: Added. * js/dom/unhandled-promise-rejection-handle-in-handler.html: Added. * js/dom/unhandled-promise-rejection-handle.html: Added. * js/dom/unhandled-promise-rejection-order-expected.txt: Added. * js/dom/unhandled-promise-rejection-order.html: Added. New tests specific to the `onunhandledrejection` and `onrejectionhandled` events. * resources/testharnessreport.js: (self.testRunner.add_completion_callback.sanitize): (self.testRunner.add_completion_callback): Report results immediately and then finish the test after a turn. This way if the test ends with a pass, but may get unhandled rejections after completing which should not make the test appear as if it failed. Some tests have unhandled promise rejections but are expected to pass. Likewise some tests perform cleanup in their own completion callbacks, which happen after this initial completion callback, and we want to report results after all the work is done as it may eliminate non-deterministic debug test output. * TestExpectations: Mark some tests as flakey that have sometimes have unhandled promise rejections. These tests are all various imported tests that use the testharness. * fast/mediastream/MediaStream-MediaElement-setObject-null-expected.txt: * http/tests/security/video-cross-origin-caching-expected.txt: * inspector/debugger/break-on-exception-throw-in-promise-expected.txt: * inspector/debugger/break-on-uncaught-exception-throw-in-promise-expected.txt: * inspector/worker/resources-in-worker-expected.txt: * js/dom/dom-static-property-for-in-iteration-expected.txt: * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * js/promises-tests/promises-tests-2-2-6-expected.txt: * platform/mac/inspector/model/remote-object-expected.txt: * webrtc/libwebrtc/release-while-creating-offer-expected.txt: * webrtc/libwebrtc/release-while-setting-local-description-expected.txt: Update tests with unhandled promise rejection messages. * media/W3C/audio/events/event_pause_manual.html: * media/audio-playback-restriction-play-expected.txt: * media/audio-playback-restriction-play.html: * media/click-volume-bar-not-pausing.html: * media/remote-control-command-is-user-gesture-expected.txt: * media/remote-control-command-is-user-gesture.html: * media/track/track-mode.html: * media/video-autoplay-allowed-but-fullscreen-required.html: * media/video-display-none-crash.html: * media/video-main-content-deny-display-none.html: * media/video-main-content-deny-not-in-dom.html: * media/video-main-content-deny-not-visible.html: * media/video-main-content-deny-obscured.html: * media/video-main-content-deny-too-small.html: * media/video-multiple-concurrent-playback-expected.txt: * media/video-play-audio-require-user-gesture-expected.txt: * media/video-play-audio-require-user-gesture.html: * media/video-play-pause-events-expected.txt: * media/video-play-pause-events.html: * media/video-play-pause-exception-expected.txt: * media/video-play-pause-exception.html: * media/video-play-require-user-gesture-expected.txt: * media/video-play-require-user-gesture.html: * media/video-preload-expected.txt: * media/video-preload.html: * media/video-test.js: (handlePromise.handle): Snuff many possible unhandled promise rejections in media via media.play(). * streams/reference-implementation/pipe-to-expected.txt: * streams/reference-implementation/pipe-to-options-expected.txt: * streams/reference-implementation/readable-stream-templated-expected.txt: * streams/reference-implementation/writable-stream-abort-expected.txt: * streams/reference-implementation/writable-stream-expected.txt: These stream tests are out of date and produce unhandled rejections. * streams/shadowing-Promise.html: Update non-imported tests to prevent unhandled rejection messages. Canonical link: https://commits.webkit.org/188310@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215916 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-04-28 03:33:57 +00:00
results.innerText = resultStr;
Make testharnessreport.js report the results correctly inside an SVG document https://bugs.webkit.org/show_bug.cgi?id=203503 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-10-30 Reviewed by Chris Dumez. LayoutTests/imported/w3c: * web-platform-tests/dom/nodes/Document-constructor-xml-expected.txt: * web-platform-tests/dom/nodes/Node-contains-xml-expected.txt: * web-platform-tests/dom/nodes/getElementsByClassName-10-expected.txt: * web-platform-tests/dom/nodes/getElementsByClassName-11-expected.txt: * web-platform-tests/svg/animations/scripted/end-element-on-inactive-element-expected.txt: Added. * web-platform-tests/svg/animations/scripted/onhover-syncbases-expected.txt: Added. * web-platform-tests/svg/extensibility/foreignObject/properties-expected.txt: Added. * web-platform-tests/svg/extensibility/interfaces/foreignObject-graphics-expected.txt: Added. * web-platform-tests/svg/geometry/inheritance-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/cx-computed-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/cx-invalid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/cx-valid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/cy-computed-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/cy-invalid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/cy-valid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/height-computed-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/r-computed-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/r-invalid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/r-valid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/rx-computed-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/rx-invalid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/rx-valid-expected.txt: * web-platform-tests/svg/geometry/parsing/ry-computed-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/ry-invalid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/ry-valid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/sizing-properties-computed-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/width-computed-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/x-computed-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/x-invalid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/x-valid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/y-computed-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/y-invalid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/y-valid-expected.txt: Added. * web-platform-tests/svg/interact/inheritance-expected.txt: Added. * web-platform-tests/svg/interact/parsing/pointer-events-computed-expected.txt: Added. * web-platform-tests/svg/interact/parsing/pointer-events-invalid-expected.txt: Added. * web-platform-tests/svg/interact/parsing/pointer-events-valid-expected.txt: Added. * web-platform-tests/svg/interact/script-content-expected.txt: Added. * web-platform-tests/svg/interact/scripted/composed.window-expected.txt: Added. * web-platform-tests/svg/interact/scripted/focus-events-expected.txt: Added. * web-platform-tests/svg/interact/scripted/focus-tabindex-default-value-expected.txt: Added. * web-platform-tests/svg/interact/scripted/tabindex-focus-flag-expected.txt: Added. * web-platform-tests/svg/linking/scripted/a-download-click-expected.txt: Added. * web-platform-tests/svg/linking/scripted/a.rel-getter-01-expected.txt: Added. * web-platform-tests/svg/linking/scripted/a.rel-setter-01-expected.txt: Added. * web-platform-tests/svg/linking/scripted/a.text-getter-01-expected.txt: Added. * web-platform-tests/svg/linking/scripted/a.text-setter-01-expected.txt: Added. * web-platform-tests/svg/linking/scripted/rellist-feature-detection-expected.txt: Added. * web-platform-tests/svg/painting/inheritance-expected.txt: Added. * web-platform-tests/svg/painting/parsing/color-interpolation-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/color-interpolation-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/fill-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/fill-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/fill-opacity-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/fill-opacity-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/fill-opacity-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/fill-rule-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/fill-rule-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/fill-rule-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/fill-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/image-rendering-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/image-rendering-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/image-rendering-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-end-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-end-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-end-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-mid-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-mid-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-mid-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-start-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-start-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-start-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/paint-order-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/paint-order-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/paint-order-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/shape-rendering-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/shape-rendering-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/shape-rendering-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-dasharray-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-dasharray-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-dasharray-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-dashoffset-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-dashoffset-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-dashoffset-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-linecap-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-linecap-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-linecap-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-linejoin-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-linejoin-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-linejoin-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-miterlimit-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-miterlimit-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-miterlimit-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-opacity-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-opacity-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-opacity-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-width-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-width-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-width-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/text-rendering-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/text-rendering-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/text-rendering-valid-expected.txt: Added. * web-platform-tests/svg/painting/scripted/paint-order-computed-value-01-expected.txt: Added. * web-platform-tests/svg/path/error-handling/bounding-expected.txt: Added. * web-platform-tests/svg/path/interfaces/SVGAnimatedPathData-removed-expected.txt: Added. * web-platform-tests/svg/path/property/d-interpolation-discrete-expected.txt: Added. * web-platform-tests/svg/path/property/d-interpolation-relative-absolute-expected.txt: Added. * web-platform-tests/svg/path/property/d-interpolation-single-expected.txt: Added. * web-platform-tests/svg/path/property/getComputedStyle-expected.txt: Added. * web-platform-tests/svg/path/property/serialization-expected.txt: Added. * web-platform-tests/svg/pservers/inheritance-expected.txt: Added. * web-platform-tests/svg/pservers/parsing/stop-color-computed-expected.txt: Added. * web-platform-tests/svg/pservers/parsing/stop-color-invalid-expected.txt: Added. * web-platform-tests/svg/pservers/parsing/stop-color-valid-expected.txt: Added. * web-platform-tests/svg/pservers/parsing/stop-opacity-computed-expected.txt: Added. * web-platform-tests/svg/pservers/parsing/stop-opacity-invalid-expected.txt: Added. * web-platform-tests/svg/pservers/parsing/stop-opacity-valid-expected.txt: Added. * web-platform-tests/svg/pservers/scripted/stop-color-inheritance-currentcolor-expected.txt: Added. * web-platform-tests/svg/scripted/text-attrs-dxdy-have-length-expected.txt: Added. * web-platform-tests/svg/scripted/text-attrs-xyrotate-have-length-expected.txt: Added. * web-platform-tests/svg/scripted/text-tspan-attrs-have-length-expected.txt: Added. * web-platform-tests/svg/scripted/text-tspan-attrs-indexed-access-expected.txt: Added. * web-platform-tests/svg/scripted/tspan-attrs-dxdy-have-length-expected.txt: Added. * web-platform-tests/svg/scripted/tspan-attrs-xyrotate-have-length-expected.txt: Added. * web-platform-tests/svg/shapes/line-getPointAtLength-expected.txt: Added. * web-platform-tests/svg/shapes/line-pathLength-expected.txt: Added. * web-platform-tests/svg/shapes/rx-ry-not-inherited-expected.txt: Added. * web-platform-tests/svg/shapes/scripted/disabled-shapes-not-hit-expected.txt: Added. * web-platform-tests/svg/struct/UnknownElement/interface-expected.txt: Added. * web-platform-tests/svg/struct/scripted/autofocus-attribute-expected.txt: Added. * web-platform-tests/svg/styling/required-properties-expected.txt: Added. * web-platform-tests/svg/text/inheritance-expected.txt: Added. * web-platform-tests/svg/text/parsing/inline-size-invalid-expected.txt: Added. * web-platform-tests/svg/text/parsing/inline-size-valid-expected.txt: Added. * web-platform-tests/svg/text/parsing/shape-inside-invalid-expected.txt: Added. * web-platform-tests/svg/text/parsing/shape-inside-valid-expected.txt: Added. * web-platform-tests/svg/text/parsing/shape-margin-invalid-expected.txt: Added. * web-platform-tests/svg/text/parsing/shape-margin-valid-expected.txt: Added. * web-platform-tests/svg/text/parsing/shape-subtract-invalid-expected.txt: Added. * web-platform-tests/svg/text/parsing/shape-subtract-valid-expected.txt: Added. * web-platform-tests/svg/text/parsing/text-anchor-computed-expected.txt: Added. * web-platform-tests/svg/text/parsing/text-anchor-invalid-expected.txt: Added. * web-platform-tests/svg/text/parsing/text-anchor-valid-expected.txt: Added. * web-platform-tests/svg/text/parsing/text-decoration-fill-invalid-expected.txt: Added. * web-platform-tests/svg/text/parsing/text-decoration-fill-valid-expected.txt: Added. * web-platform-tests/svg/text/parsing/text-decoration-stroke-invalid-expected.txt: Added. * web-platform-tests/svg/text/parsing/text-decoration-stroke-valid-expected.txt: Added. * web-platform-tests/svg/types/elements/SVGGeometryElement-rect-expected.txt: Added. * web-platform-tests/svg/types/scripted/SVGGeometryElement.getPointAtLength-01-expected.txt: Added. * web-platform-tests/svg/types/scripted/SVGGeometryElement.isPointInFill-01-expected.txt: Added. * web-platform-tests/svg/types/scripted/SVGGeometryElement.isPointInStroke-01-expected.txt: Added. * web-platform-tests/svg/types/scripted/SVGGraphicsElement-expected.txt: Added. * web-platform-tests/svg/types/scripted/event-handler-all-document-element-events-expected.txt: Added. LayoutTests: For SVG tests, the completion callback has to create a foreignObject and append it to the root element. Then the results element has to be appended to this foreignObject. * TestExpectations: * platform/mac/imported/w3c/web-platform-tests/svg/path/error-handling/bounding-expected.txt: Removed. * platform/mac/imported/w3c/web-platform-tests/svg/shapes/scripted/disabled-shapes-not-hit-expected.txt: Removed. * resources/testharnessreport.js: (self.testRunner.add_completion_callback): Canonical link: https://commits.webkit.org/216979@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@251777 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-30 17:20:17 +00:00
Support for promise rejection events (unhandledrejection) https://bugs.webkit.org/show_bug.cgi?id=150358 <rdar://problem/28441651> Reviewed by Saam Barati. Patch by Joseph Pecoraro and Yusuke Suzuki. LayoutTests/imported/w3c: * web-platform-tests/WebCryptoAPI/derive_bits_keys/test_ecdh_bits-expected.txt: * web-platform-tests/WebCryptoAPI/derive_bits_keys/test_ecdh_keys-expected.txt: * web-platform-tests/html/semantics/embedded-content/media-elements/event_pause_noautoplay-expected.txt: * web-platform-tests/html/semantics/embedded-content/media-elements/event_play_noautoplay-expected.txt: * web-platform-tests/html/semantics/embedded-content/media-elements/paused_true_during_pause-expected.txt: * web-platform-tests/html/syntax/parsing/html5lib_innerHTML_adoption01-expected.txt: * web-platform-tests/html/webappapis/scripting/events/body-exposed-window-event-handlers-expected.txt: * web-platform-tests/streams/piping/close-propagation-forward-expected.txt: * web-platform-tests/streams/piping/error-propagation-backward-expected.txt: * web-platform-tests/streams/piping/error-propagation-forward-expected.txt: * web-platform-tests/streams/piping/flow-control-expected.txt: * web-platform-tests/streams/piping/general-expected.txt: * web-platform-tests/user-timing/measure_exceptions_navigation_timing-expected.txt: Rebaseline expectations to include unhandled promise rejection messages. Also change how the test harness reports success or failure to use the values immediately on completion and then allow a run loop cycle before completing the test to gather the output. * web-platform-tests/resource-timing/rt-resource-errors.html: This is our own WPT test yet to be uploaded, so update the test to prevent an unexpected unhandled rejection. Source/JavaScriptCore: Implement support for promise.[[PromiseIsHandled]] and the HostPromiseRejectionTracker hook for HTML to track promise rejections: https://tc39.github.io/ecma262/#sec-host-promise-rejection-tracker https://html.spec.whatwg.org/multipage/webappapis.html#unhandled-promise-rejections * builtins/BuiltinNames.h: New private symbols. * builtins/PromiseOperations.js: (globalPrivate.newHandledRejectedPromise): Utility to create a rejected promise with [[PromiseIsHandled]] to true. (globalPrivate.rejectPromise): (globalPrivate.initializePromise): * builtins/PromisePrototype.js: (then): Implement standard behavior of [[PromiseIsHandled]] and the host hook. * runtime/JSPromise.cpp: (JSC::JSPromise::isHandled): * runtime/JSPromise.h: C++ accessors for the [[PromiseIsHandled]] state. * bytecode/BytecodeIntrinsicRegistry.cpp: (JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry): * bytecode/BytecodeIntrinsicRegistry.h: Expose private values for the Reject / Handle enum values in built-ins. * jsc.cpp: * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::promiseResolveFunction): Add a new GlobalObjectMethodTable hook matching the promise rejection hook. * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): (JSC::JSGlobalObject::visitChildren): * runtime/JSGlobalObjectFunctions.cpp: (JSC::globalFuncHostPromiseRejectionTracker): * runtime/JSGlobalObjectFunctions.h: Plumb the builtin hook through to the optional GlobalObjectMethodTable hook. * inspector/InjectedScriptSource.js: (InjectedScript.prototype.createFakeValueDescriptor): Silence possible rejected promises created internally via Web Inspector. Source/WebCore: Implement support for the `onunhandledrejection` and `rejectionhandled` events. They dispatch a new PromiseRejectionEvent using the ES6 HostPromiseRejectionTracker hook: https://tc39.github.io/ecma262/#sec-host-promise-rejection-tracker https://html.spec.whatwg.org/multipage/webappapis.html#unhandled-promise-rejections This is currently implemented only for Documents and not yet Web Workers. Tests: js/dom/unhandled-promise-rejection-basic.html js/dom/unhandled-promise-rejection-bindings-type-error.html js/dom/unhandled-promise-rejection-console-no-report.html js/dom/unhandled-promise-rejection-console-report.html js/dom/unhandled-promise-rejection-handle-during-event.html js/dom/unhandled-promise-rejection-handle-in-handler.html js/dom/unhandled-promise-rejection-handle.html js/dom/unhandled-promise-rejection-order.html * CMakeLists.txt: * DerivedSources.cpp: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * dom/DOMAllInOne.cpp: New files. * bindings/scripts/CodeGenerator.pm: (IsPromiseType): * bindings/scripts/CodeGeneratorJS.pm: (AddToIncludesForIDLType): (GetBaseIDLType): Binding support for Promise<T> attributes. * bindings/js/JSDOMConvert.h: * bindings/js/JSDOMConvertPromise.h: Copied from Source/JavaScriptCore/runtime/JSPromise.h. (WebCore::Converter<IDLPromise<T>>::convert): (WebCore::JSConverter<IDLPromise<T>>::convert): Promise<T> binding conversion is currently unimplemented, which only means web developers creating their own PromiseRejectionEvent will not get autowrapping of values assigned to `promise` in event initialization. Engine generated events will have expected behavior. * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::promiseRejectionTracker): * bindings/js/JSDOMWindowBase.h: * bindings/js/JSWorkerGlobalScopeBase.cpp: Implement HostPromiseRejectionTracker hook for Document but not Worker. Passes through to the ScriptExecutionContext's tracker. * bindings/js/JSMainThreadExecState.cpp: (WebCore::JSMainThreadExecState::didLeaveScriptContext): * bindings/js/JSMainThreadExecState.h: (WebCore::JSMainThreadExecState::~JSMainThreadExecState): When completing script execution and performing microtasks notify about rejected promises. Technically this should go inside of performing a microtask checkpoint, except lacking EventLoop concepts we use ScriptExecutionState. * dom/EventNames.h: * dom/EventNames.in: * dom/PromiseRejectionEvent.cpp: Added. (WebCore::PromiseRejectionEvent::PromiseRejectionEvent): (WebCore::PromiseRejectionEvent::~PromiseRejectionEvent): * dom/PromiseRejectionEvent.h: Added. * dom/PromiseRejectionEvent.idl: Added. New PromiseRejectionEvent event interface. * dom/GlobalEventHandlers.idl: New onunhandledrejection and onrejectionhandled. * dom/RejectedPromiseTracker.cpp: Added. (WebCore::RejectedPromise::RejectedPromise): (WebCore::RejectedPromise::globalObject): (WebCore::RejectedPromise::promise): (WebCore::UnhandledPromise::UnhandledPromise): (WebCore::UnhandledPromise::callStack): (WebCore::RejectedPromiseTracker::RejectedPromiseTracker): (WebCore::RejectedPromiseTracker::~RejectedPromiseTracker): (WebCore::createScriptCallStackFromReason): (WebCore::RejectedPromiseTracker::promiseRejected): (WebCore::RejectedPromiseTracker::promiseHandled): (WebCore::RejectedPromiseTracker::processQueueSoon): (WebCore::RejectedPromiseTracker::reportUnhandledRejections): (WebCore::RejectedPromiseTracker::reportRejectionHandled): * dom/RejectedPromiseTracker.h: Added. Track and report rejected promises. The promises are tracked weakly allowing them to be collected before they are reported. When reporting we dispatch PromiseRejectionEvent events, and if the default is not prevented we log a message to the console. * dom/ScriptExecutionContext.cpp: (WebCore::ScriptExecutionContext::reportUnhandledPromiseRejection): (WebCore::ScriptExecutionContext::ensureRejectedPromiseTrackerSlow): * dom/ScriptExecutionContext.h: (WebCore::ScriptExecutionContext::ensureRejectedPromiseTracker): Each ScriptExecutionContext can own a rejected promise tracker. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::pauseInternal): https://html.spec.whatwg.org/multipage/embedded-content.html#internal-pause-steps Internal pause steps say to timeupdate, pause, and rejecting pending play promises should all happen in a queued task. Here the first two actions are already scheduled on tasks, but rejecting play promises was not being done in a task, so this makes that change. * Modules/streams/ReadableStream.js: (pipeThrough): * Modules/streams/ReadableStreamInternals.js: (readableStreamReaderGenericInitialize): (readableStreamError): (readableStreamReaderGenericRelease): Satisfy parts of the Streams specification which state to set the [[PromiseIsHandled]] internal state of promises created internally by the Streams APIs. This prevents some internal promises from appearing as unhandled promise rejections. LayoutTests: * js/dom/unhandled-promise-rejection-basic-expected.txt: Added. * js/dom/unhandled-promise-rejection-basic.html: Added. * js/dom/unhandled-promise-rejection-bindings-type-error-expected.txt: Added. * js/dom/unhandled-promise-rejection-bindings-type-error.html: Added. * js/dom/unhandled-promise-rejection-console-no-report-expected.txt: Added. * js/dom/unhandled-promise-rejection-console-no-report.html: Added. * js/dom/unhandled-promise-rejection-console-report-expected.txt: Added. * js/dom/unhandled-promise-rejection-console-report.html: Added. * js/dom/unhandled-promise-rejection-handle-during-event-expected.txt: Added. * js/dom/unhandled-promise-rejection-handle-during-event.html: Added. * js/dom/unhandled-promise-rejection-handle-expected.txt: Added. * js/dom/unhandled-promise-rejection-handle-in-handler-expected.txt: Added. * js/dom/unhandled-promise-rejection-handle-in-handler.html: Added. * js/dom/unhandled-promise-rejection-handle.html: Added. * js/dom/unhandled-promise-rejection-order-expected.txt: Added. * js/dom/unhandled-promise-rejection-order.html: Added. New tests specific to the `onunhandledrejection` and `onrejectionhandled` events. * resources/testharnessreport.js: (self.testRunner.add_completion_callback.sanitize): (self.testRunner.add_completion_callback): Report results immediately and then finish the test after a turn. This way if the test ends with a pass, but may get unhandled rejections after completing which should not make the test appear as if it failed. Some tests have unhandled promise rejections but are expected to pass. Likewise some tests perform cleanup in their own completion callbacks, which happen after this initial completion callback, and we want to report results after all the work is done as it may eliminate non-deterministic debug test output. * TestExpectations: Mark some tests as flakey that have sometimes have unhandled promise rejections. These tests are all various imported tests that use the testharness. * fast/mediastream/MediaStream-MediaElement-setObject-null-expected.txt: * http/tests/security/video-cross-origin-caching-expected.txt: * inspector/debugger/break-on-exception-throw-in-promise-expected.txt: * inspector/debugger/break-on-uncaught-exception-throw-in-promise-expected.txt: * inspector/worker/resources-in-worker-expected.txt: * js/dom/dom-static-property-for-in-iteration-expected.txt: * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * js/promises-tests/promises-tests-2-2-6-expected.txt: * platform/mac/inspector/model/remote-object-expected.txt: * webrtc/libwebrtc/release-while-creating-offer-expected.txt: * webrtc/libwebrtc/release-while-setting-local-description-expected.txt: Update tests with unhandled promise rejection messages. * media/W3C/audio/events/event_pause_manual.html: * media/audio-playback-restriction-play-expected.txt: * media/audio-playback-restriction-play.html: * media/click-volume-bar-not-pausing.html: * media/remote-control-command-is-user-gesture-expected.txt: * media/remote-control-command-is-user-gesture.html: * media/track/track-mode.html: * media/video-autoplay-allowed-but-fullscreen-required.html: * media/video-display-none-crash.html: * media/video-main-content-deny-display-none.html: * media/video-main-content-deny-not-in-dom.html: * media/video-main-content-deny-not-visible.html: * media/video-main-content-deny-obscured.html: * media/video-main-content-deny-too-small.html: * media/video-multiple-concurrent-playback-expected.txt: * media/video-play-audio-require-user-gesture-expected.txt: * media/video-play-audio-require-user-gesture.html: * media/video-play-pause-events-expected.txt: * media/video-play-pause-events.html: * media/video-play-pause-exception-expected.txt: * media/video-play-pause-exception.html: * media/video-play-require-user-gesture-expected.txt: * media/video-play-require-user-gesture.html: * media/video-preload-expected.txt: * media/video-preload.html: * media/video-test.js: (handlePromise.handle): Snuff many possible unhandled promise rejections in media via media.play(). * streams/reference-implementation/pipe-to-expected.txt: * streams/reference-implementation/pipe-to-options-expected.txt: * streams/reference-implementation/readable-stream-templated-expected.txt: * streams/reference-implementation/writable-stream-abort-expected.txt: * streams/reference-implementation/writable-stream-expected.txt: These stream tests are out of date and produce unhandled rejections. * streams/shadowing-Promise.html: Update non-imported tests to prevent unhandled rejection messages. Canonical link: https://commits.webkit.org/188310@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215916 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-04-28 03:33:57 +00:00
var log = document.getElementById("log");
if (log)
log.appendChild(results);
Make testharnessreport.js report the results correctly inside an SVG document https://bugs.webkit.org/show_bug.cgi?id=203503 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-10-30 Reviewed by Chris Dumez. LayoutTests/imported/w3c: * web-platform-tests/dom/nodes/Document-constructor-xml-expected.txt: * web-platform-tests/dom/nodes/Node-contains-xml-expected.txt: * web-platform-tests/dom/nodes/getElementsByClassName-10-expected.txt: * web-platform-tests/dom/nodes/getElementsByClassName-11-expected.txt: * web-platform-tests/svg/animations/scripted/end-element-on-inactive-element-expected.txt: Added. * web-platform-tests/svg/animations/scripted/onhover-syncbases-expected.txt: Added. * web-platform-tests/svg/extensibility/foreignObject/properties-expected.txt: Added. * web-platform-tests/svg/extensibility/interfaces/foreignObject-graphics-expected.txt: Added. * web-platform-tests/svg/geometry/inheritance-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/cx-computed-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/cx-invalid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/cx-valid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/cy-computed-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/cy-invalid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/cy-valid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/height-computed-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/r-computed-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/r-invalid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/r-valid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/rx-computed-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/rx-invalid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/rx-valid-expected.txt: * web-platform-tests/svg/geometry/parsing/ry-computed-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/ry-invalid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/ry-valid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/sizing-properties-computed-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/width-computed-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/x-computed-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/x-invalid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/x-valid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/y-computed-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/y-invalid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/y-valid-expected.txt: Added. * web-platform-tests/svg/interact/inheritance-expected.txt: Added. * web-platform-tests/svg/interact/parsing/pointer-events-computed-expected.txt: Added. * web-platform-tests/svg/interact/parsing/pointer-events-invalid-expected.txt: Added. * web-platform-tests/svg/interact/parsing/pointer-events-valid-expected.txt: Added. * web-platform-tests/svg/interact/script-content-expected.txt: Added. * web-platform-tests/svg/interact/scripted/composed.window-expected.txt: Added. * web-platform-tests/svg/interact/scripted/focus-events-expected.txt: Added. * web-platform-tests/svg/interact/scripted/focus-tabindex-default-value-expected.txt: Added. * web-platform-tests/svg/interact/scripted/tabindex-focus-flag-expected.txt: Added. * web-platform-tests/svg/linking/scripted/a-download-click-expected.txt: Added. * web-platform-tests/svg/linking/scripted/a.rel-getter-01-expected.txt: Added. * web-platform-tests/svg/linking/scripted/a.rel-setter-01-expected.txt: Added. * web-platform-tests/svg/linking/scripted/a.text-getter-01-expected.txt: Added. * web-platform-tests/svg/linking/scripted/a.text-setter-01-expected.txt: Added. * web-platform-tests/svg/linking/scripted/rellist-feature-detection-expected.txt: Added. * web-platform-tests/svg/painting/inheritance-expected.txt: Added. * web-platform-tests/svg/painting/parsing/color-interpolation-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/color-interpolation-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/fill-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/fill-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/fill-opacity-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/fill-opacity-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/fill-opacity-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/fill-rule-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/fill-rule-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/fill-rule-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/fill-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/image-rendering-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/image-rendering-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/image-rendering-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-end-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-end-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-end-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-mid-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-mid-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-mid-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-start-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-start-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-start-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/paint-order-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/paint-order-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/paint-order-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/shape-rendering-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/shape-rendering-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/shape-rendering-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-dasharray-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-dasharray-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-dasharray-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-dashoffset-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-dashoffset-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-dashoffset-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-linecap-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-linecap-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-linecap-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-linejoin-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-linejoin-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-linejoin-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-miterlimit-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-miterlimit-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-miterlimit-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-opacity-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-opacity-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-opacity-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-width-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-width-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-width-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/text-rendering-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/text-rendering-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/text-rendering-valid-expected.txt: Added. * web-platform-tests/svg/painting/scripted/paint-order-computed-value-01-expected.txt: Added. * web-platform-tests/svg/path/error-handling/bounding-expected.txt: Added. * web-platform-tests/svg/path/interfaces/SVGAnimatedPathData-removed-expected.txt: Added. * web-platform-tests/svg/path/property/d-interpolation-discrete-expected.txt: Added. * web-platform-tests/svg/path/property/d-interpolation-relative-absolute-expected.txt: Added. * web-platform-tests/svg/path/property/d-interpolation-single-expected.txt: Added. * web-platform-tests/svg/path/property/getComputedStyle-expected.txt: Added. * web-platform-tests/svg/path/property/serialization-expected.txt: Added. * web-platform-tests/svg/pservers/inheritance-expected.txt: Added. * web-platform-tests/svg/pservers/parsing/stop-color-computed-expected.txt: Added. * web-platform-tests/svg/pservers/parsing/stop-color-invalid-expected.txt: Added. * web-platform-tests/svg/pservers/parsing/stop-color-valid-expected.txt: Added. * web-platform-tests/svg/pservers/parsing/stop-opacity-computed-expected.txt: Added. * web-platform-tests/svg/pservers/parsing/stop-opacity-invalid-expected.txt: Added. * web-platform-tests/svg/pservers/parsing/stop-opacity-valid-expected.txt: Added. * web-platform-tests/svg/pservers/scripted/stop-color-inheritance-currentcolor-expected.txt: Added. * web-platform-tests/svg/scripted/text-attrs-dxdy-have-length-expected.txt: Added. * web-platform-tests/svg/scripted/text-attrs-xyrotate-have-length-expected.txt: Added. * web-platform-tests/svg/scripted/text-tspan-attrs-have-length-expected.txt: Added. * web-platform-tests/svg/scripted/text-tspan-attrs-indexed-access-expected.txt: Added. * web-platform-tests/svg/scripted/tspan-attrs-dxdy-have-length-expected.txt: Added. * web-platform-tests/svg/scripted/tspan-attrs-xyrotate-have-length-expected.txt: Added. * web-platform-tests/svg/shapes/line-getPointAtLength-expected.txt: Added. * web-platform-tests/svg/shapes/line-pathLength-expected.txt: Added. * web-platform-tests/svg/shapes/rx-ry-not-inherited-expected.txt: Added. * web-platform-tests/svg/shapes/scripted/disabled-shapes-not-hit-expected.txt: Added. * web-platform-tests/svg/struct/UnknownElement/interface-expected.txt: Added. * web-platform-tests/svg/struct/scripted/autofocus-attribute-expected.txt: Added. * web-platform-tests/svg/styling/required-properties-expected.txt: Added. * web-platform-tests/svg/text/inheritance-expected.txt: Added. * web-platform-tests/svg/text/parsing/inline-size-invalid-expected.txt: Added. * web-platform-tests/svg/text/parsing/inline-size-valid-expected.txt: Added. * web-platform-tests/svg/text/parsing/shape-inside-invalid-expected.txt: Added. * web-platform-tests/svg/text/parsing/shape-inside-valid-expected.txt: Added. * web-platform-tests/svg/text/parsing/shape-margin-invalid-expected.txt: Added. * web-platform-tests/svg/text/parsing/shape-margin-valid-expected.txt: Added. * web-platform-tests/svg/text/parsing/shape-subtract-invalid-expected.txt: Added. * web-platform-tests/svg/text/parsing/shape-subtract-valid-expected.txt: Added. * web-platform-tests/svg/text/parsing/text-anchor-computed-expected.txt: Added. * web-platform-tests/svg/text/parsing/text-anchor-invalid-expected.txt: Added. * web-platform-tests/svg/text/parsing/text-anchor-valid-expected.txt: Added. * web-platform-tests/svg/text/parsing/text-decoration-fill-invalid-expected.txt: Added. * web-platform-tests/svg/text/parsing/text-decoration-fill-valid-expected.txt: Added. * web-platform-tests/svg/text/parsing/text-decoration-stroke-invalid-expected.txt: Added. * web-platform-tests/svg/text/parsing/text-decoration-stroke-valid-expected.txt: Added. * web-platform-tests/svg/types/elements/SVGGeometryElement-rect-expected.txt: Added. * web-platform-tests/svg/types/scripted/SVGGeometryElement.getPointAtLength-01-expected.txt: Added. * web-platform-tests/svg/types/scripted/SVGGeometryElement.isPointInFill-01-expected.txt: Added. * web-platform-tests/svg/types/scripted/SVGGeometryElement.isPointInStroke-01-expected.txt: Added. * web-platform-tests/svg/types/scripted/SVGGraphicsElement-expected.txt: Added. * web-platform-tests/svg/types/scripted/event-handler-all-document-element-events-expected.txt: Added. LayoutTests: For SVG tests, the completion callback has to create a foreignObject and append it to the root element. Then the results element has to be appended to this foreignObject. * TestExpectations: * platform/mac/imported/w3c/web-platform-tests/svg/path/error-handling/bounding-expected.txt: Removed. * platform/mac/imported/w3c/web-platform-tests/svg/shapes/scripted/disabled-shapes-not-hit-expected.txt: Removed. * resources/testharnessreport.js: (self.testRunner.add_completion_callback): Canonical link: https://commits.webkit.org/216979@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@251777 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-30 17:20:17 +00:00
else if (document.body)
Support for promise rejection events (unhandledrejection) https://bugs.webkit.org/show_bug.cgi?id=150358 <rdar://problem/28441651> Reviewed by Saam Barati. Patch by Joseph Pecoraro and Yusuke Suzuki. LayoutTests/imported/w3c: * web-platform-tests/WebCryptoAPI/derive_bits_keys/test_ecdh_bits-expected.txt: * web-platform-tests/WebCryptoAPI/derive_bits_keys/test_ecdh_keys-expected.txt: * web-platform-tests/html/semantics/embedded-content/media-elements/event_pause_noautoplay-expected.txt: * web-platform-tests/html/semantics/embedded-content/media-elements/event_play_noautoplay-expected.txt: * web-platform-tests/html/semantics/embedded-content/media-elements/paused_true_during_pause-expected.txt: * web-platform-tests/html/syntax/parsing/html5lib_innerHTML_adoption01-expected.txt: * web-platform-tests/html/webappapis/scripting/events/body-exposed-window-event-handlers-expected.txt: * web-platform-tests/streams/piping/close-propagation-forward-expected.txt: * web-platform-tests/streams/piping/error-propagation-backward-expected.txt: * web-platform-tests/streams/piping/error-propagation-forward-expected.txt: * web-platform-tests/streams/piping/flow-control-expected.txt: * web-platform-tests/streams/piping/general-expected.txt: * web-platform-tests/user-timing/measure_exceptions_navigation_timing-expected.txt: Rebaseline expectations to include unhandled promise rejection messages. Also change how the test harness reports success or failure to use the values immediately on completion and then allow a run loop cycle before completing the test to gather the output. * web-platform-tests/resource-timing/rt-resource-errors.html: This is our own WPT test yet to be uploaded, so update the test to prevent an unexpected unhandled rejection. Source/JavaScriptCore: Implement support for promise.[[PromiseIsHandled]] and the HostPromiseRejectionTracker hook for HTML to track promise rejections: https://tc39.github.io/ecma262/#sec-host-promise-rejection-tracker https://html.spec.whatwg.org/multipage/webappapis.html#unhandled-promise-rejections * builtins/BuiltinNames.h: New private symbols. * builtins/PromiseOperations.js: (globalPrivate.newHandledRejectedPromise): Utility to create a rejected promise with [[PromiseIsHandled]] to true. (globalPrivate.rejectPromise): (globalPrivate.initializePromise): * builtins/PromisePrototype.js: (then): Implement standard behavior of [[PromiseIsHandled]] and the host hook. * runtime/JSPromise.cpp: (JSC::JSPromise::isHandled): * runtime/JSPromise.h: C++ accessors for the [[PromiseIsHandled]] state. * bytecode/BytecodeIntrinsicRegistry.cpp: (JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry): * bytecode/BytecodeIntrinsicRegistry.h: Expose private values for the Reject / Handle enum values in built-ins. * jsc.cpp: * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::promiseResolveFunction): Add a new GlobalObjectMethodTable hook matching the promise rejection hook. * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): (JSC::JSGlobalObject::visitChildren): * runtime/JSGlobalObjectFunctions.cpp: (JSC::globalFuncHostPromiseRejectionTracker): * runtime/JSGlobalObjectFunctions.h: Plumb the builtin hook through to the optional GlobalObjectMethodTable hook. * inspector/InjectedScriptSource.js: (InjectedScript.prototype.createFakeValueDescriptor): Silence possible rejected promises created internally via Web Inspector. Source/WebCore: Implement support for the `onunhandledrejection` and `rejectionhandled` events. They dispatch a new PromiseRejectionEvent using the ES6 HostPromiseRejectionTracker hook: https://tc39.github.io/ecma262/#sec-host-promise-rejection-tracker https://html.spec.whatwg.org/multipage/webappapis.html#unhandled-promise-rejections This is currently implemented only for Documents and not yet Web Workers. Tests: js/dom/unhandled-promise-rejection-basic.html js/dom/unhandled-promise-rejection-bindings-type-error.html js/dom/unhandled-promise-rejection-console-no-report.html js/dom/unhandled-promise-rejection-console-report.html js/dom/unhandled-promise-rejection-handle-during-event.html js/dom/unhandled-promise-rejection-handle-in-handler.html js/dom/unhandled-promise-rejection-handle.html js/dom/unhandled-promise-rejection-order.html * CMakeLists.txt: * DerivedSources.cpp: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * dom/DOMAllInOne.cpp: New files. * bindings/scripts/CodeGenerator.pm: (IsPromiseType): * bindings/scripts/CodeGeneratorJS.pm: (AddToIncludesForIDLType): (GetBaseIDLType): Binding support for Promise<T> attributes. * bindings/js/JSDOMConvert.h: * bindings/js/JSDOMConvertPromise.h: Copied from Source/JavaScriptCore/runtime/JSPromise.h. (WebCore::Converter<IDLPromise<T>>::convert): (WebCore::JSConverter<IDLPromise<T>>::convert): Promise<T> binding conversion is currently unimplemented, which only means web developers creating their own PromiseRejectionEvent will not get autowrapping of values assigned to `promise` in event initialization. Engine generated events will have expected behavior. * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::promiseRejectionTracker): * bindings/js/JSDOMWindowBase.h: * bindings/js/JSWorkerGlobalScopeBase.cpp: Implement HostPromiseRejectionTracker hook for Document but not Worker. Passes through to the ScriptExecutionContext's tracker. * bindings/js/JSMainThreadExecState.cpp: (WebCore::JSMainThreadExecState::didLeaveScriptContext): * bindings/js/JSMainThreadExecState.h: (WebCore::JSMainThreadExecState::~JSMainThreadExecState): When completing script execution and performing microtasks notify about rejected promises. Technically this should go inside of performing a microtask checkpoint, except lacking EventLoop concepts we use ScriptExecutionState. * dom/EventNames.h: * dom/EventNames.in: * dom/PromiseRejectionEvent.cpp: Added. (WebCore::PromiseRejectionEvent::PromiseRejectionEvent): (WebCore::PromiseRejectionEvent::~PromiseRejectionEvent): * dom/PromiseRejectionEvent.h: Added. * dom/PromiseRejectionEvent.idl: Added. New PromiseRejectionEvent event interface. * dom/GlobalEventHandlers.idl: New onunhandledrejection and onrejectionhandled. * dom/RejectedPromiseTracker.cpp: Added. (WebCore::RejectedPromise::RejectedPromise): (WebCore::RejectedPromise::globalObject): (WebCore::RejectedPromise::promise): (WebCore::UnhandledPromise::UnhandledPromise): (WebCore::UnhandledPromise::callStack): (WebCore::RejectedPromiseTracker::RejectedPromiseTracker): (WebCore::RejectedPromiseTracker::~RejectedPromiseTracker): (WebCore::createScriptCallStackFromReason): (WebCore::RejectedPromiseTracker::promiseRejected): (WebCore::RejectedPromiseTracker::promiseHandled): (WebCore::RejectedPromiseTracker::processQueueSoon): (WebCore::RejectedPromiseTracker::reportUnhandledRejections): (WebCore::RejectedPromiseTracker::reportRejectionHandled): * dom/RejectedPromiseTracker.h: Added. Track and report rejected promises. The promises are tracked weakly allowing them to be collected before they are reported. When reporting we dispatch PromiseRejectionEvent events, and if the default is not prevented we log a message to the console. * dom/ScriptExecutionContext.cpp: (WebCore::ScriptExecutionContext::reportUnhandledPromiseRejection): (WebCore::ScriptExecutionContext::ensureRejectedPromiseTrackerSlow): * dom/ScriptExecutionContext.h: (WebCore::ScriptExecutionContext::ensureRejectedPromiseTracker): Each ScriptExecutionContext can own a rejected promise tracker. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::pauseInternal): https://html.spec.whatwg.org/multipage/embedded-content.html#internal-pause-steps Internal pause steps say to timeupdate, pause, and rejecting pending play promises should all happen in a queued task. Here the first two actions are already scheduled on tasks, but rejecting play promises was not being done in a task, so this makes that change. * Modules/streams/ReadableStream.js: (pipeThrough): * Modules/streams/ReadableStreamInternals.js: (readableStreamReaderGenericInitialize): (readableStreamError): (readableStreamReaderGenericRelease): Satisfy parts of the Streams specification which state to set the [[PromiseIsHandled]] internal state of promises created internally by the Streams APIs. This prevents some internal promises from appearing as unhandled promise rejections. LayoutTests: * js/dom/unhandled-promise-rejection-basic-expected.txt: Added. * js/dom/unhandled-promise-rejection-basic.html: Added. * js/dom/unhandled-promise-rejection-bindings-type-error-expected.txt: Added. * js/dom/unhandled-promise-rejection-bindings-type-error.html: Added. * js/dom/unhandled-promise-rejection-console-no-report-expected.txt: Added. * js/dom/unhandled-promise-rejection-console-no-report.html: Added. * js/dom/unhandled-promise-rejection-console-report-expected.txt: Added. * js/dom/unhandled-promise-rejection-console-report.html: Added. * js/dom/unhandled-promise-rejection-handle-during-event-expected.txt: Added. * js/dom/unhandled-promise-rejection-handle-during-event.html: Added. * js/dom/unhandled-promise-rejection-handle-expected.txt: Added. * js/dom/unhandled-promise-rejection-handle-in-handler-expected.txt: Added. * js/dom/unhandled-promise-rejection-handle-in-handler.html: Added. * js/dom/unhandled-promise-rejection-handle.html: Added. * js/dom/unhandled-promise-rejection-order-expected.txt: Added. * js/dom/unhandled-promise-rejection-order.html: Added. New tests specific to the `onunhandledrejection` and `onrejectionhandled` events. * resources/testharnessreport.js: (self.testRunner.add_completion_callback.sanitize): (self.testRunner.add_completion_callback): Report results immediately and then finish the test after a turn. This way if the test ends with a pass, but may get unhandled rejections after completing which should not make the test appear as if it failed. Some tests have unhandled promise rejections but are expected to pass. Likewise some tests perform cleanup in their own completion callbacks, which happen after this initial completion callback, and we want to report results after all the work is done as it may eliminate non-deterministic debug test output. * TestExpectations: Mark some tests as flakey that have sometimes have unhandled promise rejections. These tests are all various imported tests that use the testharness. * fast/mediastream/MediaStream-MediaElement-setObject-null-expected.txt: * http/tests/security/video-cross-origin-caching-expected.txt: * inspector/debugger/break-on-exception-throw-in-promise-expected.txt: * inspector/debugger/break-on-uncaught-exception-throw-in-promise-expected.txt: * inspector/worker/resources-in-worker-expected.txt: * js/dom/dom-static-property-for-in-iteration-expected.txt: * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * js/promises-tests/promises-tests-2-2-6-expected.txt: * platform/mac/inspector/model/remote-object-expected.txt: * webrtc/libwebrtc/release-while-creating-offer-expected.txt: * webrtc/libwebrtc/release-while-setting-local-description-expected.txt: Update tests with unhandled promise rejection messages. * media/W3C/audio/events/event_pause_manual.html: * media/audio-playback-restriction-play-expected.txt: * media/audio-playback-restriction-play.html: * media/click-volume-bar-not-pausing.html: * media/remote-control-command-is-user-gesture-expected.txt: * media/remote-control-command-is-user-gesture.html: * media/track/track-mode.html: * media/video-autoplay-allowed-but-fullscreen-required.html: * media/video-display-none-crash.html: * media/video-main-content-deny-display-none.html: * media/video-main-content-deny-not-in-dom.html: * media/video-main-content-deny-not-visible.html: * media/video-main-content-deny-obscured.html: * media/video-main-content-deny-too-small.html: * media/video-multiple-concurrent-playback-expected.txt: * media/video-play-audio-require-user-gesture-expected.txt: * media/video-play-audio-require-user-gesture.html: * media/video-play-pause-events-expected.txt: * media/video-play-pause-events.html: * media/video-play-pause-exception-expected.txt: * media/video-play-pause-exception.html: * media/video-play-require-user-gesture-expected.txt: * media/video-play-require-user-gesture.html: * media/video-preload-expected.txt: * media/video-preload.html: * media/video-test.js: (handlePromise.handle): Snuff many possible unhandled promise rejections in media via media.play(). * streams/reference-implementation/pipe-to-expected.txt: * streams/reference-implementation/pipe-to-options-expected.txt: * streams/reference-implementation/readable-stream-templated-expected.txt: * streams/reference-implementation/writable-stream-abort-expected.txt: * streams/reference-implementation/writable-stream-expected.txt: These stream tests are out of date and produce unhandled rejections. * streams/shadowing-Promise.html: Update non-imported tests to prevent unhandled rejection messages. Canonical link: https://commits.webkit.org/188310@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215916 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-04-28 03:33:57 +00:00
document.body.appendChild(results);
Make testharnessreport.js report the results correctly inside an SVG document https://bugs.webkit.org/show_bug.cgi?id=203503 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-10-30 Reviewed by Chris Dumez. LayoutTests/imported/w3c: * web-platform-tests/dom/nodes/Document-constructor-xml-expected.txt: * web-platform-tests/dom/nodes/Node-contains-xml-expected.txt: * web-platform-tests/dom/nodes/getElementsByClassName-10-expected.txt: * web-platform-tests/dom/nodes/getElementsByClassName-11-expected.txt: * web-platform-tests/svg/animations/scripted/end-element-on-inactive-element-expected.txt: Added. * web-platform-tests/svg/animations/scripted/onhover-syncbases-expected.txt: Added. * web-platform-tests/svg/extensibility/foreignObject/properties-expected.txt: Added. * web-platform-tests/svg/extensibility/interfaces/foreignObject-graphics-expected.txt: Added. * web-platform-tests/svg/geometry/inheritance-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/cx-computed-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/cx-invalid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/cx-valid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/cy-computed-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/cy-invalid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/cy-valid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/height-computed-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/r-computed-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/r-invalid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/r-valid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/rx-computed-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/rx-invalid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/rx-valid-expected.txt: * web-platform-tests/svg/geometry/parsing/ry-computed-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/ry-invalid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/ry-valid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/sizing-properties-computed-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/width-computed-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/x-computed-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/x-invalid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/x-valid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/y-computed-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/y-invalid-expected.txt: Added. * web-platform-tests/svg/geometry/parsing/y-valid-expected.txt: Added. * web-platform-tests/svg/interact/inheritance-expected.txt: Added. * web-platform-tests/svg/interact/parsing/pointer-events-computed-expected.txt: Added. * web-platform-tests/svg/interact/parsing/pointer-events-invalid-expected.txt: Added. * web-platform-tests/svg/interact/parsing/pointer-events-valid-expected.txt: Added. * web-platform-tests/svg/interact/script-content-expected.txt: Added. * web-platform-tests/svg/interact/scripted/composed.window-expected.txt: Added. * web-platform-tests/svg/interact/scripted/focus-events-expected.txt: Added. * web-platform-tests/svg/interact/scripted/focus-tabindex-default-value-expected.txt: Added. * web-platform-tests/svg/interact/scripted/tabindex-focus-flag-expected.txt: Added. * web-platform-tests/svg/linking/scripted/a-download-click-expected.txt: Added. * web-platform-tests/svg/linking/scripted/a.rel-getter-01-expected.txt: Added. * web-platform-tests/svg/linking/scripted/a.rel-setter-01-expected.txt: Added. * web-platform-tests/svg/linking/scripted/a.text-getter-01-expected.txt: Added. * web-platform-tests/svg/linking/scripted/a.text-setter-01-expected.txt: Added. * web-platform-tests/svg/linking/scripted/rellist-feature-detection-expected.txt: Added. * web-platform-tests/svg/painting/inheritance-expected.txt: Added. * web-platform-tests/svg/painting/parsing/color-interpolation-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/color-interpolation-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/fill-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/fill-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/fill-opacity-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/fill-opacity-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/fill-opacity-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/fill-rule-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/fill-rule-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/fill-rule-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/fill-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/image-rendering-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/image-rendering-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/image-rendering-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-end-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-end-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-end-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-mid-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-mid-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-mid-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-start-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-start-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-start-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/marker-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/paint-order-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/paint-order-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/paint-order-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/shape-rendering-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/shape-rendering-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/shape-rendering-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-dasharray-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-dasharray-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-dasharray-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-dashoffset-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-dashoffset-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-dashoffset-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-linecap-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-linecap-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-linecap-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-linejoin-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-linejoin-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-linejoin-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-miterlimit-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-miterlimit-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-miterlimit-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-opacity-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-opacity-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-opacity-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-width-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-width-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/stroke-width-valid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/text-rendering-computed-expected.txt: Added. * web-platform-tests/svg/painting/parsing/text-rendering-invalid-expected.txt: Added. * web-platform-tests/svg/painting/parsing/text-rendering-valid-expected.txt: Added. * web-platform-tests/svg/painting/scripted/paint-order-computed-value-01-expected.txt: Added. * web-platform-tests/svg/path/error-handling/bounding-expected.txt: Added. * web-platform-tests/svg/path/interfaces/SVGAnimatedPathData-removed-expected.txt: Added. * web-platform-tests/svg/path/property/d-interpolation-discrete-expected.txt: Added. * web-platform-tests/svg/path/property/d-interpolation-relative-absolute-expected.txt: Added. * web-platform-tests/svg/path/property/d-interpolation-single-expected.txt: Added. * web-platform-tests/svg/path/property/getComputedStyle-expected.txt: Added. * web-platform-tests/svg/path/property/serialization-expected.txt: Added. * web-platform-tests/svg/pservers/inheritance-expected.txt: Added. * web-platform-tests/svg/pservers/parsing/stop-color-computed-expected.txt: Added. * web-platform-tests/svg/pservers/parsing/stop-color-invalid-expected.txt: Added. * web-platform-tests/svg/pservers/parsing/stop-color-valid-expected.txt: Added. * web-platform-tests/svg/pservers/parsing/stop-opacity-computed-expected.txt: Added. * web-platform-tests/svg/pservers/parsing/stop-opacity-invalid-expected.txt: Added. * web-platform-tests/svg/pservers/parsing/stop-opacity-valid-expected.txt: Added. * web-platform-tests/svg/pservers/scripted/stop-color-inheritance-currentcolor-expected.txt: Added. * web-platform-tests/svg/scripted/text-attrs-dxdy-have-length-expected.txt: Added. * web-platform-tests/svg/scripted/text-attrs-xyrotate-have-length-expected.txt: Added. * web-platform-tests/svg/scripted/text-tspan-attrs-have-length-expected.txt: Added. * web-platform-tests/svg/scripted/text-tspan-attrs-indexed-access-expected.txt: Added. * web-platform-tests/svg/scripted/tspan-attrs-dxdy-have-length-expected.txt: Added. * web-platform-tests/svg/scripted/tspan-attrs-xyrotate-have-length-expected.txt: Added. * web-platform-tests/svg/shapes/line-getPointAtLength-expected.txt: Added. * web-platform-tests/svg/shapes/line-pathLength-expected.txt: Added. * web-platform-tests/svg/shapes/rx-ry-not-inherited-expected.txt: Added. * web-platform-tests/svg/shapes/scripted/disabled-shapes-not-hit-expected.txt: Added. * web-platform-tests/svg/struct/UnknownElement/interface-expected.txt: Added. * web-platform-tests/svg/struct/scripted/autofocus-attribute-expected.txt: Added. * web-platform-tests/svg/styling/required-properties-expected.txt: Added. * web-platform-tests/svg/text/inheritance-expected.txt: Added. * web-platform-tests/svg/text/parsing/inline-size-invalid-expected.txt: Added. * web-platform-tests/svg/text/parsing/inline-size-valid-expected.txt: Added. * web-platform-tests/svg/text/parsing/shape-inside-invalid-expected.txt: Added. * web-platform-tests/svg/text/parsing/shape-inside-valid-expected.txt: Added. * web-platform-tests/svg/text/parsing/shape-margin-invalid-expected.txt: Added. * web-platform-tests/svg/text/parsing/shape-margin-valid-expected.txt: Added. * web-platform-tests/svg/text/parsing/shape-subtract-invalid-expected.txt: Added. * web-platform-tests/svg/text/parsing/shape-subtract-valid-expected.txt: Added. * web-platform-tests/svg/text/parsing/text-anchor-computed-expected.txt: Added. * web-platform-tests/svg/text/parsing/text-anchor-invalid-expected.txt: Added. * web-platform-tests/svg/text/parsing/text-anchor-valid-expected.txt: Added. * web-platform-tests/svg/text/parsing/text-decoration-fill-invalid-expected.txt: Added. * web-platform-tests/svg/text/parsing/text-decoration-fill-valid-expected.txt: Added. * web-platform-tests/svg/text/parsing/text-decoration-stroke-invalid-expected.txt: Added. * web-platform-tests/svg/text/parsing/text-decoration-stroke-valid-expected.txt: Added. * web-platform-tests/svg/types/elements/SVGGeometryElement-rect-expected.txt: Added. * web-platform-tests/svg/types/scripted/SVGGeometryElement.getPointAtLength-01-expected.txt: Added. * web-platform-tests/svg/types/scripted/SVGGeometryElement.isPointInFill-01-expected.txt: Added. * web-platform-tests/svg/types/scripted/SVGGeometryElement.isPointInStroke-01-expected.txt: Added. * web-platform-tests/svg/types/scripted/SVGGraphicsElement-expected.txt: Added. * web-platform-tests/svg/types/scripted/event-handler-all-document-element-events-expected.txt: Added. LayoutTests: For SVG tests, the completion callback has to create a foreignObject and append it to the root element. Then the results element has to be appended to this foreignObject. * TestExpectations: * platform/mac/imported/w3c/web-platform-tests/svg/path/error-handling/bounding-expected.txt: Removed. * platform/mac/imported/w3c/web-platform-tests/svg/shapes/scripted/disabled-shapes-not-hit-expected.txt: Removed. * resources/testharnessreport.js: (self.testRunner.add_completion_callback): Canonical link: https://commits.webkit.org/216979@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@251777 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-30 17:20:17 +00:00
else {
var root = document.documentElement;
var is_html = root
&& root.namespaceURI == "http://www.w3.org/1999/xhtml"
&& root.localName == "html";
var is_svg = document.defaultView
&& "SVGSVGElement" in document.defaultView
&& root instanceof document.defaultView.SVGSVGElement;
if (is_svg) {
var foreignObject = document.createElementNS("http://www.w3.org/2000/svg", "foreignObject");
foreignObject.setAttribute("width", "100%");
foreignObject.setAttribute("height", "100%");
root.appendChild(foreignObject);
foreignObject.appendChild(results);
} else if (is_html) {
root.appendChild(document.createElementNS("http://www.w3.org/1999/xhtml", "body"))
.appendChild(results);
} else {
root.appendChild(results);
}
}
Support for promise rejection events (unhandledrejection) https://bugs.webkit.org/show_bug.cgi?id=150358 <rdar://problem/28441651> Reviewed by Saam Barati. Patch by Joseph Pecoraro and Yusuke Suzuki. LayoutTests/imported/w3c: * web-platform-tests/WebCryptoAPI/derive_bits_keys/test_ecdh_bits-expected.txt: * web-platform-tests/WebCryptoAPI/derive_bits_keys/test_ecdh_keys-expected.txt: * web-platform-tests/html/semantics/embedded-content/media-elements/event_pause_noautoplay-expected.txt: * web-platform-tests/html/semantics/embedded-content/media-elements/event_play_noautoplay-expected.txt: * web-platform-tests/html/semantics/embedded-content/media-elements/paused_true_during_pause-expected.txt: * web-platform-tests/html/syntax/parsing/html5lib_innerHTML_adoption01-expected.txt: * web-platform-tests/html/webappapis/scripting/events/body-exposed-window-event-handlers-expected.txt: * web-platform-tests/streams/piping/close-propagation-forward-expected.txt: * web-platform-tests/streams/piping/error-propagation-backward-expected.txt: * web-platform-tests/streams/piping/error-propagation-forward-expected.txt: * web-platform-tests/streams/piping/flow-control-expected.txt: * web-platform-tests/streams/piping/general-expected.txt: * web-platform-tests/user-timing/measure_exceptions_navigation_timing-expected.txt: Rebaseline expectations to include unhandled promise rejection messages. Also change how the test harness reports success or failure to use the values immediately on completion and then allow a run loop cycle before completing the test to gather the output. * web-platform-tests/resource-timing/rt-resource-errors.html: This is our own WPT test yet to be uploaded, so update the test to prevent an unexpected unhandled rejection. Source/JavaScriptCore: Implement support for promise.[[PromiseIsHandled]] and the HostPromiseRejectionTracker hook for HTML to track promise rejections: https://tc39.github.io/ecma262/#sec-host-promise-rejection-tracker https://html.spec.whatwg.org/multipage/webappapis.html#unhandled-promise-rejections * builtins/BuiltinNames.h: New private symbols. * builtins/PromiseOperations.js: (globalPrivate.newHandledRejectedPromise): Utility to create a rejected promise with [[PromiseIsHandled]] to true. (globalPrivate.rejectPromise): (globalPrivate.initializePromise): * builtins/PromisePrototype.js: (then): Implement standard behavior of [[PromiseIsHandled]] and the host hook. * runtime/JSPromise.cpp: (JSC::JSPromise::isHandled): * runtime/JSPromise.h: C++ accessors for the [[PromiseIsHandled]] state. * bytecode/BytecodeIntrinsicRegistry.cpp: (JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry): * bytecode/BytecodeIntrinsicRegistry.h: Expose private values for the Reject / Handle enum values in built-ins. * jsc.cpp: * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::promiseResolveFunction): Add a new GlobalObjectMethodTable hook matching the promise rejection hook. * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): (JSC::JSGlobalObject::visitChildren): * runtime/JSGlobalObjectFunctions.cpp: (JSC::globalFuncHostPromiseRejectionTracker): * runtime/JSGlobalObjectFunctions.h: Plumb the builtin hook through to the optional GlobalObjectMethodTable hook. * inspector/InjectedScriptSource.js: (InjectedScript.prototype.createFakeValueDescriptor): Silence possible rejected promises created internally via Web Inspector. Source/WebCore: Implement support for the `onunhandledrejection` and `rejectionhandled` events. They dispatch a new PromiseRejectionEvent using the ES6 HostPromiseRejectionTracker hook: https://tc39.github.io/ecma262/#sec-host-promise-rejection-tracker https://html.spec.whatwg.org/multipage/webappapis.html#unhandled-promise-rejections This is currently implemented only for Documents and not yet Web Workers. Tests: js/dom/unhandled-promise-rejection-basic.html js/dom/unhandled-promise-rejection-bindings-type-error.html js/dom/unhandled-promise-rejection-console-no-report.html js/dom/unhandled-promise-rejection-console-report.html js/dom/unhandled-promise-rejection-handle-during-event.html js/dom/unhandled-promise-rejection-handle-in-handler.html js/dom/unhandled-promise-rejection-handle.html js/dom/unhandled-promise-rejection-order.html * CMakeLists.txt: * DerivedSources.cpp: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * dom/DOMAllInOne.cpp: New files. * bindings/scripts/CodeGenerator.pm: (IsPromiseType): * bindings/scripts/CodeGeneratorJS.pm: (AddToIncludesForIDLType): (GetBaseIDLType): Binding support for Promise<T> attributes. * bindings/js/JSDOMConvert.h: * bindings/js/JSDOMConvertPromise.h: Copied from Source/JavaScriptCore/runtime/JSPromise.h. (WebCore::Converter<IDLPromise<T>>::convert): (WebCore::JSConverter<IDLPromise<T>>::convert): Promise<T> binding conversion is currently unimplemented, which only means web developers creating their own PromiseRejectionEvent will not get autowrapping of values assigned to `promise` in event initialization. Engine generated events will have expected behavior. * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::promiseRejectionTracker): * bindings/js/JSDOMWindowBase.h: * bindings/js/JSWorkerGlobalScopeBase.cpp: Implement HostPromiseRejectionTracker hook for Document but not Worker. Passes through to the ScriptExecutionContext's tracker. * bindings/js/JSMainThreadExecState.cpp: (WebCore::JSMainThreadExecState::didLeaveScriptContext): * bindings/js/JSMainThreadExecState.h: (WebCore::JSMainThreadExecState::~JSMainThreadExecState): When completing script execution and performing microtasks notify about rejected promises. Technically this should go inside of performing a microtask checkpoint, except lacking EventLoop concepts we use ScriptExecutionState. * dom/EventNames.h: * dom/EventNames.in: * dom/PromiseRejectionEvent.cpp: Added. (WebCore::PromiseRejectionEvent::PromiseRejectionEvent): (WebCore::PromiseRejectionEvent::~PromiseRejectionEvent): * dom/PromiseRejectionEvent.h: Added. * dom/PromiseRejectionEvent.idl: Added. New PromiseRejectionEvent event interface. * dom/GlobalEventHandlers.idl: New onunhandledrejection and onrejectionhandled. * dom/RejectedPromiseTracker.cpp: Added. (WebCore::RejectedPromise::RejectedPromise): (WebCore::RejectedPromise::globalObject): (WebCore::RejectedPromise::promise): (WebCore::UnhandledPromise::UnhandledPromise): (WebCore::UnhandledPromise::callStack): (WebCore::RejectedPromiseTracker::RejectedPromiseTracker): (WebCore::RejectedPromiseTracker::~RejectedPromiseTracker): (WebCore::createScriptCallStackFromReason): (WebCore::RejectedPromiseTracker::promiseRejected): (WebCore::RejectedPromiseTracker::promiseHandled): (WebCore::RejectedPromiseTracker::processQueueSoon): (WebCore::RejectedPromiseTracker::reportUnhandledRejections): (WebCore::RejectedPromiseTracker::reportRejectionHandled): * dom/RejectedPromiseTracker.h: Added. Track and report rejected promises. The promises are tracked weakly allowing them to be collected before they are reported. When reporting we dispatch PromiseRejectionEvent events, and if the default is not prevented we log a message to the console. * dom/ScriptExecutionContext.cpp: (WebCore::ScriptExecutionContext::reportUnhandledPromiseRejection): (WebCore::ScriptExecutionContext::ensureRejectedPromiseTrackerSlow): * dom/ScriptExecutionContext.h: (WebCore::ScriptExecutionContext::ensureRejectedPromiseTracker): Each ScriptExecutionContext can own a rejected promise tracker. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::pauseInternal): https://html.spec.whatwg.org/multipage/embedded-content.html#internal-pause-steps Internal pause steps say to timeupdate, pause, and rejecting pending play promises should all happen in a queued task. Here the first two actions are already scheduled on tasks, but rejecting play promises was not being done in a task, so this makes that change. * Modules/streams/ReadableStream.js: (pipeThrough): * Modules/streams/ReadableStreamInternals.js: (readableStreamReaderGenericInitialize): (readableStreamError): (readableStreamReaderGenericRelease): Satisfy parts of the Streams specification which state to set the [[PromiseIsHandled]] internal state of promises created internally by the Streams APIs. This prevents some internal promises from appearing as unhandled promise rejections. LayoutTests: * js/dom/unhandled-promise-rejection-basic-expected.txt: Added. * js/dom/unhandled-promise-rejection-basic.html: Added. * js/dom/unhandled-promise-rejection-bindings-type-error-expected.txt: Added. * js/dom/unhandled-promise-rejection-bindings-type-error.html: Added. * js/dom/unhandled-promise-rejection-console-no-report-expected.txt: Added. * js/dom/unhandled-promise-rejection-console-no-report.html: Added. * js/dom/unhandled-promise-rejection-console-report-expected.txt: Added. * js/dom/unhandled-promise-rejection-console-report.html: Added. * js/dom/unhandled-promise-rejection-handle-during-event-expected.txt: Added. * js/dom/unhandled-promise-rejection-handle-during-event.html: Added. * js/dom/unhandled-promise-rejection-handle-expected.txt: Added. * js/dom/unhandled-promise-rejection-handle-in-handler-expected.txt: Added. * js/dom/unhandled-promise-rejection-handle-in-handler.html: Added. * js/dom/unhandled-promise-rejection-handle.html: Added. * js/dom/unhandled-promise-rejection-order-expected.txt: Added. * js/dom/unhandled-promise-rejection-order.html: Added. New tests specific to the `onunhandledrejection` and `onrejectionhandled` events. * resources/testharnessreport.js: (self.testRunner.add_completion_callback.sanitize): (self.testRunner.add_completion_callback): Report results immediately and then finish the test after a turn. This way if the test ends with a pass, but may get unhandled rejections after completing which should not make the test appear as if it failed. Some tests have unhandled promise rejections but are expected to pass. Likewise some tests perform cleanup in their own completion callbacks, which happen after this initial completion callback, and we want to report results after all the work is done as it may eliminate non-deterministic debug test output. * TestExpectations: Mark some tests as flakey that have sometimes have unhandled promise rejections. These tests are all various imported tests that use the testharness. * fast/mediastream/MediaStream-MediaElement-setObject-null-expected.txt: * http/tests/security/video-cross-origin-caching-expected.txt: * inspector/debugger/break-on-exception-throw-in-promise-expected.txt: * inspector/debugger/break-on-uncaught-exception-throw-in-promise-expected.txt: * inspector/worker/resources-in-worker-expected.txt: * js/dom/dom-static-property-for-in-iteration-expected.txt: * js/dom/global-constructors-attributes-dedicated-worker-expected.txt: * js/promises-tests/promises-tests-2-2-6-expected.txt: * platform/mac/inspector/model/remote-object-expected.txt: * webrtc/libwebrtc/release-while-creating-offer-expected.txt: * webrtc/libwebrtc/release-while-setting-local-description-expected.txt: Update tests with unhandled promise rejection messages. * media/W3C/audio/events/event_pause_manual.html: * media/audio-playback-restriction-play-expected.txt: * media/audio-playback-restriction-play.html: * media/click-volume-bar-not-pausing.html: * media/remote-control-command-is-user-gesture-expected.txt: * media/remote-control-command-is-user-gesture.html: * media/track/track-mode.html: * media/video-autoplay-allowed-but-fullscreen-required.html: * media/video-display-none-crash.html: * media/video-main-content-deny-display-none.html: * media/video-main-content-deny-not-in-dom.html: * media/video-main-content-deny-not-visible.html: * media/video-main-content-deny-obscured.html: * media/video-main-content-deny-too-small.html: * media/video-multiple-concurrent-playback-expected.txt: * media/video-play-audio-require-user-gesture-expected.txt: * media/video-play-audio-require-user-gesture.html: * media/video-play-pause-events-expected.txt: * media/video-play-pause-events.html: * media/video-play-pause-exception-expected.txt: * media/video-play-pause-exception.html: * media/video-play-require-user-gesture-expected.txt: * media/video-play-require-user-gesture.html: * media/video-preload-expected.txt: * media/video-preload.html: * media/video-test.js: (handlePromise.handle): Snuff many possible unhandled promise rejections in media via media.play(). * streams/reference-implementation/pipe-to-expected.txt: * streams/reference-implementation/pipe-to-options-expected.txt: * streams/reference-implementation/readable-stream-templated-expected.txt: * streams/reference-implementation/writable-stream-abort-expected.txt: * streams/reference-implementation/writable-stream-expected.txt: These stream tests are out of date and produce unhandled rejections. * streams/shadowing-Promise.html: Update non-imported tests to prevent unhandled rejection messages. Canonical link: https://commits.webkit.org/188310@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215916 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-04-28 03:33:57 +00:00
// Wait for any other completion callbacks, which may eliminate test elements
// from the page and therefore reduce the output.
setTimeout(function () {
Add support for postMessage buffering between the service worker and window https://bugs.webkit.org/show_bug.cgi?id=201169 Reviewed by Youenn Fablet. LayoutTests/imported/w3c: Rebaseline WPT test that is now passing. * web-platform-tests/service-workers/service-worker/postmessage-to-client-message-queue.https-expected.txt: Source/WebCore: As per the Service Worker specification, a service worker client's message queue is initially disabled and only gets enabled after: - The DOMContentLoaded event has been fired or - The client sets the navigator.serviceWorker.onmessage event handler or - navigator.serviceWorker.startMessages() is called While the message queue is disabled, messages posted by the service worker to the client simply get queued and only get processed once the queue gets enabled. No new tests, rebaselined existing test. * dom/Document.cpp: (WebCore::Document::finishedParsing): Call startMessages() on the ServiceWorkerContainer once the DOMContentLoaded event has been fired. * dom/ScriptExecutionContext.cpp: (WebCore::ScriptExecutionContext::ensureServiceWorkerContainer): * dom/ScriptExecutionContext.h: * workers/service/SWClientConnection.cpp: (WebCore::SWClientConnection::postMessageToServiceWorkerClient): Fix a bug where a service worker would not be able to post a message to a client until that client has accessed navigator.serviceWorker (since the ServiceWorkerContainer is lazy initialized). To address the issue, we now initialize the ServiceWorkerContainer when a message is received from the service worker. Previously, messages were just getting dropped. * workers/service/ServiceWorkerContainer.cpp: (WebCore::ServiceWorkerContainer::ServiceWorkerContainer): When the ServiceWorkerContainer is constructed, suspend its message queue if its context document is still parsing. (WebCore::ServiceWorkerContainer::startMessages): Resume the message queue when startMessages() is called. (WebCore::ServiceWorkerContainer::postMessage): Enqueue the event instead of firing it right away. (WebCore::ServiceWorkerContainer::addEventListener): if navigator.serviceWorker.onmessage event handler gets set by the JavaScript, call startMessages(). * workers/service/ServiceWorkerContainer.h: LayoutTests: * TestExpectations: Unskip test that is no longer timing out. * resources/testharnessreport.js: (self.testRunner.add_completion_callback): Use testRunner.forceImmediateCompletion() instead of notifyDone() for WPT tests. testRunner.notifyDone() does not work in case of load error or when the load does not finish. The WPT test was timing out because the load does not finish for testing purposes. Canonical link: https://commits.webkit.org/215227@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249629 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-09-08 06:10:28 +00:00
testRunner.forceImmediateCompletion();
}, 0);
});
}