Issue #2690 - Convert error from non-existing convenience function.

Didn't check that the convenience function existed for this. Throw the
error manually, instead.
TO-DO: Add these convenience functions for one-shot errors.
This commit is contained in:
Moonchild 2025-02-05 22:51:26 +01:00 committed by roytam1
commit 3d7a95ab44
2 changed files with 4 additions and 2 deletions

View file

@ -43,6 +43,7 @@ MSG_DEF(MSG_GLOBAL_NOT_NATIVE, 0, JSEXN_TYPEERR, "Global is not a native object.
MSG_DEF(MSG_ENCODING_NOT_SUPPORTED, 1, JSEXN_RANGEERR, "The given encoding '{0}' is not supported.")
MSG_DEF(MSG_DOM_ENCODING_NOT_UTF, 0, JSEXN_RANGEERR, "The encoding must be utf-8, utf-16, or utf-16be.")
MSG_DEF(MSG_DOM_DECODING_FAILED, 0, JSEXN_TYPEERR, "Decoding failed.")
MSG_DEF(MSG_DOM_OPERATION_FAILED, 0, JSEXN_TYPEERR, "The operation could not be performed.")
MSG_DEF(MSG_NOT_FINITE, 1, JSEXN_TYPEERR, "{0} is not a finite floating-point value.")
MSG_DEF(MSG_INVALID_VERSION, 0, JSEXN_TYPEERR, "0 (Zero) is not a valid database version.")
MSG_DEF(MSG_INVALID_BYTESTRING, 2, JSEXN_TYPEERR, "Cannot convert string to ByteString because the character"

View file

@ -402,8 +402,9 @@ WebCryptoTask::FailWithError(nsresult aRv)
MOZ_ASSERT(IsOnOriginalThread());
if (aRv == NS_ERROR_DOM_TYPE_MISMATCH_ERR) {
mResultPromise->MaybeRejectWithTypeError(
"The operation could not be performed.");
ErrorResult rv;
rv.ThrowTypeError<MSG_DOM_OPERATION_FAILED>();
mResultPromise->MaybeReject(rv);
} else {
// Blindly convert nsresult to DOMException
// Individual tasks must ensure they pass the right values