-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question about when to check if user's class implements AudioWorkletProcessor #1767
Comments
I think this is somewhat related to the lack of error report mechanism of AudioWorkletGlobalScope. However, we still have the step 6 in
This will just work when WGS has a proper error reporting channel. Also the reason why we have another check in the AudioWorkletProcessor instantiation because here we can properly deliver the error in the construction process with So I believe the current spec technically doesn't have an error - the problem here is that the context above is not really well explained anywhere. |
OK, thanks for the clarification.
Looking at registerProcessor spec I believe the following checks could be moved to AudioWorkletNode's constructor: 6, and maybe 3, 4, 5. But, as said, I prefer option 1) meaning we would move 1.32.5 check 6) to registerProcessor.
I know the spec is kinda frozen now, so I would understand if it's too late to change anything, but want to share my thoughts anyway :) |
A more serious issue is: can a AudioWorkletProcessor definition be modified after being successfully registered using registerProcessor? |
Re: #1767 (comment)
I think you meant 4) and 6) which are:
I, too, prefer coherency. But if you move these steps to
IMO this is actually a regression. Because the error that user will see at the AWP construction is "the 'x' node is undefined", unless you go extra miles and craft some clever error messages in there.
I would say it is not completely frozen - and I really appreciate you raising the issue. The more we talk about it, perhaps we can build a stronger case for WorkletGlobalScope's proper error handling. |
Re: #1767 (comment)
The step 2 of
I think this is possible. As long as |
So what about option 2? Moving some checks from registerProcessor to AWP construction.
Maybe something like "node is undefined. Are you sure the name is correct, and that the node was successfully registered?" or something like this? Similar to those hints your C++ compiler will give you when something goes wrong. Not very clever but would work. |
We don't necessarily need to check IsCallable everytime, nor to prevent this behavior. |
Re #1767 (comment):
Yes, perhaps this is something we can do here, but then our register function diverges from CSS Paint API. (See step 18, 19 in the algorithm) I don't think it's necessarily a bad thing, but just so we know. Also this actually goes against your argument, letting user know when something bad happens as soon as possible. I actually agree with it, but the option 2 is the opposite of it.
This is UA-dependent. The spec can't mandate what sort of error messages would be printed out. We may end up vague error messages across different browsers and that was my main concern. I don't think checks being scattered to two different places is really bad. If they serve legitimate reasons, it is better to have them there instead of merging them for an artificial reason. |
Yes, now I can see this can be actually an issue. If a But in order to do that, we still need to check the function every single render quantum. I peeked V8's |
I know :) I know Chrome already implemented AudioWorklet and shipped it, so I understand concerns about modifying this part of the spec (and possibly breaking existing applications). It's just that from my point of view, the spec would be nicer if we are more coherent regarding the checks performed.
Then they have a similar issue. It might interesting to raise the issue to them and see what they think.
Indeed it is, and UA are more likely to print a message like "node 'x' is undefined". But what the spec says is only to throw "NotSupportedError" and nothing else. So I would expect UA to pay attention to additional error messages to explain the issue. But you're right vendors might have not necessarily add a hint about why the node is undefined.
Again, I'm just asking question :) I'm not sure if the current spec implies that an exception will be thrown and notified through onprocessorerror or not. I just have concerns about different UA implementing different behaviors. |
Hey @ArnaudBienner! This is a great point and I really appreciate you raised this point. :) Here's what we ended up in this telecon today:
I'll come up with the more detailed spec text soon. :) |
After having a chat with @rtoy about the point 2 above, I believe there is an issue that needs a discussion.
I think we have at least 2 options:
For both cases, the error should be reported to the associated AWN's The problem of option 1 is that it is impossible to revive the marked AWP instance until the context is reconstructed. The option 2 can be also problematic because it will flood the |
I agree with you: 2 sounds better even though that means flooding the onprocessorerror event. |
As currently spec'd, after an If this were to change such that attempts to call One option may be to record the last error and only send another event on |
A good point. The proposed change (option 2) and the active source flag make the problem quite tricky. I guess this leaves us the option 1.
Considering we're keeping the old behavior, the only change needs to be made here is adding |
LGTM |
Describe the issue
Currently the spec states that a UA should check if a given processor implements the AudioWorkletProcessor interface at construction time [1.33.5]
I wonder why this is not done when calling registorProcessor in the AudioWorkletGlobalScope, since there we already check a bunch of things (existence of processor method, etc.) 1.33.2.2
I believe it would be better for the user to know right away if a processor is not valid, instead of failing at construction time later on.
Where Is It
See links above.
Additional Information
I'm not an expert on all those things, so forgive me if I missed the reason why it's like this :)
The text was updated successfully, but these errors were encountered: