New issue
Advanced search Search tips

Issue 865952 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner:
Closed: Jul 23
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

Paint Worklets are registered twice

Reported by sebastia...@gmail.com, Jul 20

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0

Steps to reproduce the problem:
1. Open the attached test.html via a web server
2. Resize the browser window
3. Open the DevTools' console
4. Click the "JavaScript contexts" field
5. Switch to the Debugger panel
6. Open the worklet source
7. Set a breakpoint at the last line of it ("registerPaint('test', TestPainter);")

What is the expected behavior?
When resizing (step 2) the window the end point of the line should always have the same distance of the lower right corner of the viewport.

The "JavaScript contexts" field (step 4) should only list one Paint Worklet.

Breakpoints set in the global scope of the worklet should only be hit once (step 7).

What went wrong?
There are obviously two Paint Worklets registered instead of just one.

Did this work before? No 

Does this work in other browsers? N/A

Chrome version: 69.0.3497.0  Channel: n/a
OS Version: 10.0
Flash Version: Shockwave Flash 30.0 r0

I tested this in the current Canary version as well as in the current stable version (67.0.3396.99) and in both the issue occurred. Therefore, I think this is not a regression.

Another live sample is your example page at https://googlechromelabs.github.io/houdini-samples/paint-worklet/checkerboard/.

If you set a breakpoint at the line where the worklet is registered, you can see that it's hit twice.
 
testPaintWorklet.js
349 bytes View Download
test.html
297 bytes View Download
Just to be clear about the observed behavior:
The drawn line flickers between two positions, the "JavaScript contexts" field in the console lists two workers and the breakpoint set in the debugger is hit twice.
Labels: Needs-Triage-M69
Components: Blink>Paint
Owner: xidac...@chromium.org
Status: Assigned (was: Unconfirmed)
This looks like an intentional behavior. The Worklet spec requires to create at least two instances to avoid depending on global states as follows:

"These specifications must require user agents to always have at least two WorkletGlobalScopes per Worklet and randomly assign a method or set of methods on a class to a particular global scope."
https://drafts.css-houdini.org/worklets/#code-idempotency

Let me assign this to xidachen@ who is an owner of PaintWorklet implementation. xidachen@, can you double-check this from the perspective of the PaintWorklet?
Status: WontFix (was: Assigned)
Yes, this is expected behavior. The spec requires at least two global scopes, this is to balance the workload.
I see. So, then the question is whether it is possible for the user to share data between those instances?

The use case is to have some randomness on the initial paint but reuse that inition random value on subsequent paints.

Sebastian

Sign in to add a comment