Correctly reject promise if failed to normalize algorithm
We used to leave the promise returned by crypto.subtle.importKey and some other crypto methods in an unsettled state in case the method failed with unsupported algorithm, which has been caught by a recently introduced DCHECK().
This fixes the invariant, along with bringing this and other crypto methods to spec compliance: an unsupported algorithm is generally
supposed to cause promise rejection rather than synchronous exception
according to https://w3c.github.io/webcrypto/:
If an error occurred, return a Promise rejected with normalizedAlgorithm.
Bug: 349877609
Change-Id: I72288a3fe084a2bf2ed2b30a4d01d41a4f0fa571
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5668545
Commit-Queue: Andrey Kosyakov caseq@chromium.org
Reviewed-by: Dmitry Gozman dgozman@chromium.org
Cr-Commit-Position: refs/heads/main@{#1321728}