Focused crawls are collections of frequently-updated webcrawl data from narrow (as opposed to broad or wide) web crawls, often focused on a single domain or subdomain.
As shown by web-platform-tests/wpt#33663, however, this behavior is wrong, because exceptions thrown from an object's property getters should be surfaced without changes:
consttestObject={gettestProperty(){thrownewError();}};try{structuredClone(testObject);}catch(err){console.log(errinstanceofDOMException);// should be false; Deno prints true}
One way to fix this would be to have an optional third parameter to the internal API Deno.core.serialize that would be a (string) => any callback, returning the exception to throw. Or possibly (string) => never, having the callback itself throw the exception.
The text was updated successfully, but these errors were encountered:
Deno's implementation of structured cloning is built on top of the Rust functions serialize and deserialize in core/bindings.rs, which get exposed in JS as Deno.core.{,de}serialize. You'd have to get a third JS-side argument to serialize (with args.get(2)), turn it into a v8::Local<v8::Function>, and pass it as a field to the SerializeDeserialize struct so you can get it from the throw_data_clone_error method.
The code sample in the OP tests that non-serialization errors are rethrown unchanged, but this code sample tests that serialization errors are thrown correctly:
try{structuredClone(()=>{});// functions are not serializable}catch(err){console.log(errinstanceofDOMException);// should print trueconsole.log(err.name);// "DataCloneError"console.log(err.message);// "()=>{} could not be cloned"}
Or alternatively, you can test that your changes don't break any correct behavior by running the web platform tests for structured cloning: ./tools/wpt.ts run -- html/webappapis/structured-clone.
Be sure to check out the rusty_v8 rustdoc. And feel free to ask for help if you're stuck or don't understand something.
Deno's implementation of the structured clone algorithm is divided into a JS part, and a native part which doesn't have access to
DOMException. Since serialization errors must be represented by throwing aDataCloneErrorDOMException, the native part throws aTypeErrorwith the required message, and the JS part rethrows any exception thrown by the serialization as aDataCloneError.As shown by web-platform-tests/wpt#33663, however, this behavior is wrong, because exceptions thrown from an object's property getters should be surfaced without changes:
One way to fix this would be to have an optional third parameter to the internal API
Deno.core.serializethat would be a(string) => anycallback, returning the exception to throw. Or possibly(string) => never, having the callback itself throw the exception.The text was updated successfully, but these errors were encountered: