New issue
Advanced search Search tips

Issue 782066 link

Starred by 4 users

Issue metadata

Status: Started
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Task



Sign in to add a comment

[Worklet] addModule() should reject a promise with a more specific exception

Project Member Reported by nhiroki@chromium.org, Nov 7 2017

Issue description

This is a bug for tracking a spec issue: https://github.com/w3c/css-houdini-drafts/issues/509

"The current spec defines that addModule() rejects a promise with "AbortError" DOMException in any case. This obfuscates the reason why addModule() failed and makes it hard to debug. It would be nice to reject it with a more specific exception like "NetworkError" and "SyntaxError"."
 
Status: ExternalDependency (was: Assigned)
Waiting for the consensus on the spec discussion.
Labels: WorkerBacklog
Looks like this is a real developer pain point (for example, [1]). Regardless of the spec change, we could print a console message.

[1] https://bugs.chromium.org/p/chromium/issues/detail?id=851123#c4
Just wanted to echo that I'd love to see more specific error messages. I'm working on developing a live-coding environment for worklets and the catch-all error is not helpful..
Cc: panicker@chromium.org japhet@chromium.org nhiroki@chromium.org
 Issue 872909  has been merged into this issue.
Cc: majidvp@chromium.org surma@chromium.org
Status: Started (was: ExternalDependency)
I'll start fixing this in parallel with the spec discussion.
Cc: haraken@chromium.org
I'm now trying to send V8's error object (JS_ERROR_TYPE) from a worklet thread to the main thread for resolving a promise returned by addModule() with it. This requires to serialize the error object as SerializedScriptValue. However, looks like v8's object serializer (v8::ValueSerializer::WriteObject() and v8::ValueSerializer::WriteJSReceiver()) called from SerializedScriptValue::Serialize() doesn't support it and returns a null object. We might need to change the V8 side... I'll take a closer look.
Cc: adamk@chromium.org
Components: Blink>JavaScript
+adamk@: Hi Adam. Do you know who is the best person to ask about V8's object serializer? Specifically, I'd like to know whether a JS_ERROR_TYPE object is serializable (see my previous comment#8).
Cc: jbroman@chromium.org
My memory is that, per spec, Error objects aren't cloneable. MDN agrees (https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#Things_that_don't_work_with_structured_clone) but I can't find the precise bit of the HTML spec that knows this.
 
Also CCing jbroman@, who wrote the value serializer.
Quoth the HTML spec[1]:

"Otherwise, if value has any internal slot other than [[Prototype]] or [[Extensible]], then throw a "DataCloneError" DOMException."

Quoth the ECMAScript spec[2]:

"NativeError instances...have an [[ErrorData]] internal slot whose value is undefined"

Thus NativeError objects (i.e., JS_ERROR_TYPE) are not structured serializable.

[1]: https://html.spec.whatwg.org/multipage/structured-data.html#structuredserializeinternal
[2]: http://www.ecma-international.org/ecma-262/6.0/index.html#sec-properties-of-nativeerror-instances
err, linked NativeError, but the same applies to error: http://www.ecma-international.org/ecma-262/6.0/index.html#sec-properties-of-error-instances
adamk@, jbroman@: Thank you for the clarification! Hmm, then we need to find other ways to notify errors on worklets. I'll back to the spec discussion...
I'm still not sure what is the best way to do this. As a stopgap, I'll make a CL to print console messages as c#3.

Sign in to add a comment