New issue
Advanced search Search tips

Issue 921060 link

Starred by 1 user

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug



Sign in to add a comment

Houdini - registering painter/animator/processor is allowed post module load

Project Member Reported by majidvp@chromium.org, Jan 11

Issue description

It seems we currently allow various houdini registration happen after worklet module is loaded.
The current specs allow this AFAICT, but our implementation does not really support this correctly and it is not clear if we should.


Consider this example that registers a new painter inside first paint of another painter.

registerPaint("one", class MyPaint {
    paint(ctx, size, styleMap) {
      ctx.fillStyle = 'green';
      ctx.fillRect(0, 0, size.width, size.height);

      registerPaint("two", class Two {
           paint(ctx){     
               ctx.fillStyle = 'blue';  
                ctx.fillRect(0, 0, size.width, size.height);
            }
      });
    }
});

Due to scope switching behavior of PaintWorklet, currently I believe the second painter only gets registered in the active global scope at the time of painting the first one. So second painter is flaky. See:  https://jsbin.com/xoziwodoce/1/edit?html,js,console,output


Another example is AudioWorklet where it only syncs its "registered processors" only once after modules load is complete thus making the assumption there is no registeration post load. See https://cs.chromium.org/chromium/src/third_party/blink/renderer/modules/webaudio/audio_worklet_object_proxy.cc?type=cs&sq=package:chromium&g=0&l=31



I like us to decide if post load registration is supported or not. Is there any usecase for it?
Absence of usecases, I suggest we ban this and have logic to throw if one tries to register post load.
 
Labels: Hotlist-Polish

Sign in to add a comment