From 5a53cfd93c713ed7241f388d37a4fbd269633fbe Mon Sep 17 00:00:00 2001 From: Yati Sagade Date: Fri, 22 Dec 2017 21:50:01 +0100 Subject: [PATCH] Paint worklets: Add pref for blocking sleep to be enabled for wpt tests In aa48a2c2e3c7699a167d9ffe791f4bb17e9b9f1c I added a timeout for paint worklet threads. However, the test was broken. The blocking sleep function that was implemented as part of that commit was guarded behind the `dom.worklet.blockingsleep.enabled` pref, and while I ran the wpt-tests with that pref enabled, the test runner for sure did not. I tried running the test _without_ the pref enabled, and the tests still pass. This is because even the reference in that reftest is that of a broken image background, and *both* the paintworklet thread timing out and `sleep()` not being in scope would render the same thing: a broken image, which compares equal to the reference. This patch makes sure that now the pref is enabled for wpt worklet tests, and that such we can distinguish an actual timeout (test pass) from an unexpected situation (when we should fail the test). --- tests/wpt/mozilla/meta/MANIFEST.json | 2 +- tests/wpt/mozilla/meta/mozilla/worklets/__dir__.ini | 2 +- .../tests/mozilla/worklets/test_paint_worklet_timeout.js | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index c7192ca228c..eea4208db2f 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -72459,7 +72459,7 @@ "reftest" ], "mozilla/worklets/test_paint_worklet_timeout.js": [ - "83cdbd59c905de898b72ba47d3ae10bb95d76301", + "3e4ff24fc85ad2956b741ff1785cecfb9641d792", "support" ], "mozilla/worklets/test_paint_worklet_timeout_ref.html": [ diff --git a/tests/wpt/mozilla/meta/mozilla/worklets/__dir__.ini b/tests/wpt/mozilla/meta/mozilla/worklets/__dir__.ini index 3bd8f8ce1a5..43043a1b6c3 100644 --- a/tests/wpt/mozilla/meta/mozilla/worklets/__dir__.ini +++ b/tests/wpt/mozilla/meta/mozilla/worklets/__dir__.ini @@ -1 +1 @@ -prefs: [dom.worklet.enabled:true] +prefs: [dom.worklet.enabled:true,dom.worklet.blockingsleep.enabled:true] diff --git a/tests/wpt/mozilla/tests/mozilla/worklets/test_paint_worklet_timeout.js b/tests/wpt/mozilla/tests/mozilla/worklets/test_paint_worklet_timeout.js index 46e9756cf66..16f38b1636b 100644 --- a/tests/wpt/mozilla/tests/mozilla/worklets/test_paint_worklet_timeout.js +++ b/tests/wpt/mozilla/tests/mozilla/worklets/test_paint_worklet_timeout.js @@ -1,7 +1,12 @@ registerPaint("testgreen", class { paint(ctx, size) { + try { + sleep(30); // too long for a paintworklet to init + } catch (e) { + console.log("Problem sleeping: " + e); + } + // should fail if control reaches here before timeout ctx.fillStyle = 'green'; ctx.fillRect(0, 0, size.width, size.height); - sleep(30); // too long for a paintworklet to init } });