Diff
Modified: branches/safari-613-branch/LayoutTests/TestExpectations (292346 => 292347)
--- branches/safari-613-branch/LayoutTests/TestExpectations 2022-04-04 21:56:32 UTC (rev 292346)
+++ branches/safari-613-branch/LayoutTests/TestExpectations 2022-04-04 21:56:37 UTC (rev 292347)
@@ -4932,6 +4932,11 @@
webkit.org/b/228176 fast/text/variable-system-font.html [ Pass ImageOnlyFailure ]
webkit.org/b/228176 fast/text/variable-system-font-2.html [ Pass ImageOnlyFailure ]
+# Console message from workers sometimes don't make their way to test output, so disable them to avoid flakiness.
+imported/w3c/web-platform-tests/workers/interfaces/WorkerUtils/importScripts/ [ DumpJSConsoleLogInStdErr ]
+imported/w3c/web-platform-tests/FileAPI/file/File-constructor.any.worker.html [ DumpJSConsoleLogInStdErr ]
+imported/w3c/web-platform-tests/html/webappapis/microtask-queuing/queue-microtask-exceptions.any.worker.html [ DumpJSConsoleLogInStdErr ]
+
webkit.org/b/229726 imported/w3c/web-platform-tests/css/css-font-loading/fontface-override-descriptors.html [ ImageOnlyFailure ]
webkit.org/b/229726 imported/w3c/web-platform-tests/css/css-font-loading/fontface-size-adjust-descriptor.html [ ImageOnlyFailure ]
webkit.org/b/229727 imported/w3c/web-platform-tests/css/css-font-loading/fontfaceset-load-var.html [ Skip ]
Modified: branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/File-constructor.any.worker-expected.txt (292346 => 292347)
--- branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/File-constructor.any.worker-expected.txt 2022-04-04 21:56:32 UTC (rev 292346)
+++ branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/File-constructor.any.worker-expected.txt 2022-04-04 21:56:37 UTC (rev 292347)
@@ -1,4 +1,3 @@
-CONSOLE MESSAGE: ReferenceError: Can't find variable: document
Harness Error (FAIL), message = ReferenceError: Can't find variable: document
Added: branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/timers/zero-settimeout.any-expected.txt (0 => 292347)
--- branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/timers/zero-settimeout.any-expected.txt (rev 0)
+++ branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/timers/zero-settimeout.any-expected.txt 2022-04-04 21:56:37 UTC (rev 292347)
@@ -0,0 +1,3 @@
+
+PASS A 0ms timeout should not be clamped to 1ms
+
Added: branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/timers/zero-settimeout.any.html (0 => 292347)
--- branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/timers/zero-settimeout.any.html (rev 0)
+++ branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/timers/zero-settimeout.any.html 2022-04-04 21:56:37 UTC (rev 292347)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
Added: branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/timers/zero-settimeout.any.js (0 => 292347)
--- branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/timers/zero-settimeout.any.js (rev 0)
+++ branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/timers/zero-settimeout.any.js 2022-04-04 21:56:37 UTC (rev 292347)
@@ -0,0 +1,15 @@
+async_test((t) => {
+ let order = [];
+
+ function append(n) {
+ order.push(`${n}ms`);
+ if (order.length == 3) {
+ assert_array_equals(order, ["0ms", "1ms", "2ms"]);
+ t.done();
+ }
+ }
+
+ setTimeout(t.step_func(() => append(2)), 2);
+ setTimeout(t.step_func(() => append(1)), 1);
+ setTimeout(t.step_func(() => append(0)), 0);
+}, "A 0ms timeout should not be clamped to 1ms");
Added: branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/timers/zero-settimeout.any.worker-expected.txt (0 => 292347)
--- branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/timers/zero-settimeout.any.worker-expected.txt (rev 0)
+++ branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/timers/zero-settimeout.any.worker-expected.txt 2022-04-04 21:56:37 UTC (rev 292347)
@@ -0,0 +1,3 @@
+
+PASS A 0ms timeout should not be clamped to 1ms
+
Added: branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/timers/zero-settimeout.any.worker.html (0 => 292347)
--- branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/timers/zero-settimeout.any.worker.html (rev 0)
+++ branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/timers/zero-settimeout.any.worker.html 2022-04-04 21:56:37 UTC (rev 292347)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
Modified: branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/workers/interfaces/WorkerUtils/importScripts/report-error-cross-origin.sub.any.worker-expected.txt (292346 => 292347)
--- branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/workers/interfaces/WorkerUtils/importScripts/report-error-cross-origin.sub.any.worker-expected.txt 2022-04-04 21:56:32 UTC (rev 292346)
+++ branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/workers/interfaces/WorkerUtils/importScripts/report-error-cross-origin.sub.any.worker-expected.txt 2022-04-04 21:56:37 UTC (rev 292347)
@@ -1,4 +1,3 @@
-CONSOLE MESSAGE: Error: Script error.
FAIL WorkerGlobalScope error event: error assert_equals: e.error should be a DOMException expected function "function DOMException() {
[native code]
Modified: branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/workers/interfaces/WorkerUtils/importScripts/report-error-redirect-to-cross-origin.sub.any.worker-expected.txt (292346 => 292347)
--- branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/workers/interfaces/WorkerUtils/importScripts/report-error-redirect-to-cross-origin.sub.any.worker-expected.txt 2022-04-04 21:56:32 UTC (rev 292346)
+++ branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/workers/interfaces/WorkerUtils/importScripts/report-error-redirect-to-cross-origin.sub.any.worker-expected.txt 2022-04-04 21:56:37 UTC (rev 292347)
@@ -1,4 +1,3 @@
-CONSOLE MESSAGE: Error: Script error.
FAIL WorkerGlobalScope error event: error assert_equals: e.error should be a DOMException expected function "function DOMException() {
[native code]
Modified: branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/workers/interfaces/WorkerUtils/importScripts/report-error-same-origin.sub.any.worker-expected.txt (292346 => 292347)
--- branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/workers/interfaces/WorkerUtils/importScripts/report-error-same-origin.sub.any.worker-expected.txt 2022-04-04 21:56:32 UTC (rev 292346)
+++ branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/workers/interfaces/WorkerUtils/importScripts/report-error-same-origin.sub.any.worker-expected.txt 2022-04-04 21:56:37 UTC (rev 292347)
@@ -1,4 +1,3 @@
-CONSOLE MESSAGE: SyntaxError: Unexpected token ';'
PASS WorkerGlobalScope error event: error
PASS WorkerGlobalScope error event: message
Modified: branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/workers/interfaces/WorkerUtils/importScripts/report-error-setTimeout-cross-origin.sub.any.worker-expected.txt (292346 => 292347)
--- branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/workers/interfaces/WorkerUtils/importScripts/report-error-setTimeout-cross-origin.sub.any.worker-expected.txt 2022-04-04 21:56:32 UTC (rev 292346)
+++ branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/workers/interfaces/WorkerUtils/importScripts/report-error-setTimeout-cross-origin.sub.any.worker-expected.txt 2022-04-04 21:56:37 UTC (rev 292347)
@@ -1,4 +1,3 @@
-CONSOLE MESSAGE: Error: Script error.
FAIL WorkerGlobalScope error event: error assert_equals: e.error should be a DOMException expected function "function DOMException() {
[native code]
Modified: branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/workers/interfaces/WorkerUtils/importScripts/report-error-setTimeout-redirect-to-cross-origin.sub.any.worker-expected.txt (292346 => 292347)
--- branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/workers/interfaces/WorkerUtils/importScripts/report-error-setTimeout-redirect-to-cross-origin.sub.any.worker-expected.txt 2022-04-04 21:56:32 UTC (rev 292346)
+++ branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/workers/interfaces/WorkerUtils/importScripts/report-error-setTimeout-redirect-to-cross-origin.sub.any.worker-expected.txt 2022-04-04 21:56:37 UTC (rev 292347)
@@ -1,4 +1,3 @@
-CONSOLE MESSAGE: Error: Script error.
FAIL WorkerGlobalScope error event: error assert_equals: e.error should be a DOMException expected function "function DOMException() {
[native code]
Modified: branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/workers/interfaces/WorkerUtils/importScripts/report-error-setTimeout-same-origin.sub.any.worker-expected.txt (292346 => 292347)
--- branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/workers/interfaces/WorkerUtils/importScripts/report-error-setTimeout-same-origin.sub.any.worker-expected.txt 2022-04-04 21:56:32 UTC (rev 292346)
+++ branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/workers/interfaces/WorkerUtils/importScripts/report-error-setTimeout-same-origin.sub.any.worker-expected.txt 2022-04-04 21:56:37 UTC (rev 292347)
@@ -1,4 +1,3 @@
-CONSOLE MESSAGE: SyntaxError: Unexpected token ';'
PASS WorkerGlobalScope error event: error
PASS WorkerGlobalScope error event: message
Modified: branches/safari-613-branch/LayoutTests/js/script-tests/weakref-finalizationregistry.js (292346 => 292347)
--- branches/safari-613-branch/LayoutTests/js/script-tests/weakref-finalizationregistry.js 2022-04-04 21:56:32 UTC (rev 292346)
+++ branches/safari-613-branch/LayoutTests/js/script-tests/weakref-finalizationregistry.js 2022-04-04 21:56:37 UTC (rev 292347)
@@ -18,7 +18,7 @@
setTimeout(() => {
gc();
resolve();
- }, 0);
+ }, 1);
});
}
Modified: branches/safari-613-branch/Source/WebCore/page/DOMTimer.cpp (292346 => 292347)
--- branches/safari-613-branch/Source/WebCore/page/DOMTimer.cpp 2022-04-04 21:56:32 UTC (rev 292346)
+++ branches/safari-613-branch/Source/WebCore/page/DOMTimer.cpp 2022-04-04 21:56:37 UTC (rev 292347)
@@ -49,6 +49,8 @@
namespace WebCore {
static const Seconds minIntervalForNonUserObservableChangeTimers { 1_s }; // Empirically determined to maximize battery life.
+static const Seconds minIntervalForOneShotTimers { 0_ms };
+static const Seconds minIntervalForRepeatingTimers { 1_ms };
static const int maxTimerNestingLevel = 5;
class DOMTimerFireState {
@@ -155,16 +157,17 @@
bool NestedTimersMap::isTrackingNestedTimers = false;
-DOMTimer::DOMTimer(ScriptExecutionContext& context, std::unique_ptr<ScheduledAction> action, Seconds interval, bool singleShot)
+DOMTimer::DOMTimer(ScriptExecutionContext& context, std::unique_ptr<ScheduledAction> action, Seconds interval, bool oneShot)
: SuspendableTimerBase(&context)
, m_nestingLevel(context.timerNestingLevel())
, m_action(WTFMove(action))
, m_originalInterval(interval)
, m_throttleState(Undetermined)
+ , m_oneShot(oneShot)
, m_currentTimerInterval(intervalClampedToMinimum())
, m_userGestureTokenToForward(UserGestureIndicator::currentUserGesture())
{
- if (singleShot)
+ if (oneShot)
startOneShot(m_currentTimerInterval);
else
startRepeating(m_currentTimerInterval);
@@ -172,9 +175,9 @@
DOMTimer::~DOMTimer() = default;
-int DOMTimer::install(ScriptExecutionContext& context, std::unique_ptr<ScheduledAction> action, Seconds timeout, bool singleShot)
+int DOMTimer::install(ScriptExecutionContext& context, std::unique_ptr<ScheduledAction> action, Seconds timeout, bool oneShot)
{
- Ref<DOMTimer> timer = adoptRef(*new DOMTimer(context, WTFMove(action), timeout, singleShot));
+ Ref<DOMTimer> timer = adoptRef(*new DOMTimer(context, WTFMove(action), timeout, oneShot));
timer->suspendIfNeeded();
// Keep asking for the next id until we're given one that we don't already have.
@@ -182,7 +185,7 @@
timer->m_timeoutId = context.circularSequentialID();
} while (!context.addTimeout(timer->m_timeoutId, timer.get()));
- InspectorInstrumentation::didInstallTimer(context, timer->m_timeoutId, timeout, singleShot);
+ InspectorInstrumentation::didInstallTimer(context, timer->m_timeoutId, timeout, oneShot);
// Keep track of nested timer installs.
if (NestedTimersMap* nestedTimers = NestedTimersMap::instanceForContext(context))
@@ -190,7 +193,7 @@
#if ENABLE(CONTENT_CHANGE_OBSERVER)
if (is<Document>(context)) {
auto& document = downcast<Document>(context);
- document.contentChangeObserver().didInstallDOMTimer(timer.get(), timeout, singleShot);
+ document.contentChangeObserver().didInstallDOMTimer(timer.get(), timeout, oneShot);
if (DeferDOMTimersForScope::isDeferring())
document.domTimerHoldingTank().add(timer.get());
}
@@ -280,8 +283,6 @@
// wait unit the end of this function to delete DOMTimer.
Ref<DOMTimer> protectedThis(*this);
- bool _oneShot_ = !repeatInterval();
-
ASSERT(scriptExecutionContext());
ScriptExecutionContext& context = *scriptExecutionContext();
@@ -289,7 +290,7 @@
if (is<Document>(context)) {
auto& document = downcast<Document>(context);
if (auto* holdingTank = document.domTimerHoldingTankIfExists(); holdingTank && holdingTank->contains(*this)) {
- if (oneShot)
+ if (m_oneShot)
startOneShot(0_s);
return;
}
@@ -307,7 +308,7 @@
// Only the first execution of a multi-shot timer should get an affirmative user gesture indicator.
m_userGestureTokenToForward = nullptr;
- InspectorInstrumentation::willFireTimer(context, m_timeoutId, oneShot);
+ InspectorInstrumentation::willFireTimer(context, m_timeoutId, m_oneShot);
// Simple case for non-one-shot timers.
if (isActive()) {
@@ -318,7 +319,7 @@
m_action->execute(context);
- InspectorInstrumentation::didFireTimer(context, m_timeoutId, oneShot);
+ InspectorInstrumentation::didFireTimer(context, m_timeoutId, m_oneShot);
updateThrottlingStateIfNecessary(fireState);
return;
@@ -336,13 +337,13 @@
#endif
m_action->execute(context);
- InspectorInstrumentation::didFireTimer(context, m_timeoutId, oneShot);
+ InspectorInstrumentation::didFireTimer(context, m_timeoutId, m_oneShot);
// Check if we should throttle nested single-shot timers.
if (nestedTimers) {
for (auto& idAndTimer : *nestedTimers) {
auto& timer = idAndTimer.value;
- if (timer->isActive() && !timer->repeatInterval())
+ if (timer->isActive() && timer->m_oneShot)
timer->updateThrottlingStateIfNecessary(fireState);
}
nestedTimers->stopTracking();
@@ -366,13 +367,13 @@
if (previousInterval == m_currentTimerInterval)
return;
- if (repeatInterval()) {
+ if (m_oneShot) {
+ LOG(DOMTimers, "%p - Updating DOMTimer's fire interval from %.2f ms to %.2f ms due to throttling.", this, previousInterval.milliseconds(), m_currentTimerInterval.milliseconds());
+ augmentFireInterval(m_currentTimerInterval - previousInterval);
+ } else {
ASSERT(repeatInterval() == previousInterval);
LOG(DOMTimers, "%p - Updating DOMTimer's repeat interval from %.2f ms to %.2f ms due to throttling.", this, previousInterval.milliseconds(), m_currentTimerInterval.milliseconds());
augmentRepeatInterval(m_currentTimerInterval - previousInterval);
- } else {
- LOG(DOMTimers, "%p - Updating DOMTimer's fire interval from %.2f ms to %.2f ms due to throttling.", this, previousInterval.milliseconds(), m_currentTimerInterval.milliseconds());
- augmentFireInterval(m_currentTimerInterval - previousInterval);
}
}
@@ -381,7 +382,7 @@
ASSERT(scriptExecutionContext());
ASSERT(m_nestingLevel <= maxTimerNestingLevel);
- Seconds interval = std::max(1_ms, m_originalInterval);
+ Seconds interval = std::max(m_oneShot ? minIntervalForOneShotTimers : minIntervalForRepeatingTimers, m_originalInterval);
// Only apply throttling to repeating timers.
if (m_nestingLevel < maxTimerNestingLevel)
Modified: branches/safari-613-branch/Source/WebCore/page/DOMTimer.h (292346 => 292347)
--- branches/safari-613-branch/Source/WebCore/page/DOMTimer.h 2022-04-04 21:56:32 UTC (rev 292346)
+++ branches/safari-613-branch/Source/WebCore/page/DOMTimer.h 2022-04-04 21:56:37 UTC (rev 292347)
@@ -91,6 +91,7 @@
std::unique_ptr<ScheduledAction> m_action;
Seconds m_originalInterval;
TimerThrottleState m_throttleState;
+ bool m_oneShot;
Seconds m_currentTimerInterval;
RefPtr<UserGestureToken> m_userGestureTokenToForward;
};