Skip to content

subtlecrypto: Don't throw exceptions twice when converting to Algorithm object #49141

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

Merged
merged 1 commit into from
Nov 16, 2024

Conversation

servo-wpt-sync
Copy link
Collaborator

Removes match statements like

let Ok(ConversionResult::Success(algorithm)) = Algorithm::new(cx, value.handle())
else {
    return Err(Error::Syntax);
};

These don't cause issues if Algorithm::new returns Ok(ConversionResult::Failure, but in the case of Err(()) the implementation already called throw_type_error and we must not throw an additional Syntax error, otherwise we'll crash.

Luckily, this case is already handled elsewhere by the value_from_js_object macro.

Reviewed in servo/servo#34239

Copy link
Collaborator

@wpt-pr-bot wpt-pr-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The review process for this patch is being conducted in the Servo project.

…hrows a TypeError

The WebCryptoAPI spec does not tell us which error to throw exactly, but
according to https://webidl.spec.whatwg.org/ it should be a TypeError.

This previously crashed servo.

Signed-off-by: Simon Wülker <[email protected]>
@servo-wpt-sync servo-wpt-sync merged commit 0cb14c1 into web-platform-tests:master Nov 16, 2024
19 checks passed
@servo-wpt-sync servo-wpt-sync deleted the servo_export_34239 branch November 16, 2024 00:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants