|
[webcrypto] Match the error handling defined by the spec.
Previously the implementation was throwing exceptions for certain errors which the spec says to return a Promise and reject it with "null". [1]
The mechanism described by the spec does not provide for communicating any error details to the developer, since the Promise is rejected with "null".
In order to demystify these errors for developers, this change additionally logs error details to the dev tools console.
The specific errors which were previously throwing an exception and are now rejecting with null + logging to console are:
* Key is not extractable
* Key's algorithm doesn't match that of operation
* Key's usage does not permit the requested operation
* Any failure in parsing the AlgorithmIdentifier dictionary (with the exception of getting the "name" attribute).
One existing exception was changed:
* When the AlgorithmIdentifier is either missing a "name" attribute, or the "name" attribute is not a string throw a NotSupportedError - before a TypeError would be thrown.
Lastly, this change allows the embedder to provide error details when failing an operation.
[1] https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html
BUG= 245025
BUG= 331665
R=abarth@chromium.org
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=165513
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+459 lines, -285 lines) |
Patch |
|
M |
LayoutTests/crypto/digest.html
|
View
|
|
3 chunks |
+4 lines, -6 lines |
0 comments
|
Download
|
|
M |
LayoutTests/crypto/digest-expected.txt
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
LayoutTests/crypto/encrypt-decrypt.html
|
View
|
|
5 chunks |
+23 lines, -27 lines |
0 comments
|
Download
|
|
M |
LayoutTests/crypto/encrypt-decrypt-expected.txt
|
View
|
|
2 chunks |
+28 lines, -14 lines |
0 comments
|
Download
|
|
M |
LayoutTests/crypto/exportKey.html
|
View
|
|
2 chunks |
+5 lines, -3 lines |
0 comments
|
Download
|
|
M |
LayoutTests/crypto/exportKey-expected.txt
|
View
|
|
2 chunks |
+2 lines, -1 line |
0 comments
|
Download
|
|
M |
LayoutTests/crypto/generateKey.html
|
View
|
|
3 chunks |
+38 lines, -35 lines |
0 comments
|
Download
|
|
M |
LayoutTests/crypto/generateKey-expected.txt
|
View
|
|
2 chunks |
+67 lines, -35 lines |
0 comments
|
Download
|
|
M |
LayoutTests/crypto/importKey.html
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
LayoutTests/crypto/importKey-expected.txt
|
View
|
|
2 chunks |
+2 lines, -1 line |
0 comments
|
Download
|
|
M |
LayoutTests/crypto/resources/common.js
|
View
|
|
1 chunk |
+59 lines, -0 lines |
0 comments
|
Download
|
|
M |
LayoutTests/crypto/sign-verify.html
|
View
|
|
1 chunk |
+7 lines, -7 lines |
0 comments
|
Download
|
|
M |
LayoutTests/crypto/sign-verify-expected.txt
|
View
|
|
2 chunks |
+14 lines, -7 lines |
0 comments
|
Download
|
|
M |
LayoutTests/crypto/wrap-unwrap.html
|
View
|
|
4 chunks |
+5 lines, -5 lines |
0 comments
|
Download
|
|
M |
LayoutTests/crypto/wrap-unwrap-expected.txt
|
View
|
|
2 chunks |
+10 lines, -5 lines |
0 comments
|
Download
|
|
M |
Source/core/platform/CryptoResult.h
|
View
|
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
|
M |
Source/core/platform/chromium/support/WebCrypto.cpp
|
View
|
|
1 chunk |
+9 lines, -0 lines |
0 comments
|
Download
|
|
M |
Source/modules/crypto/CryptoResultImpl.h
|
View
|
1
|
2 chunks |
+2 lines, -0 lines |
0 comments
|
Download
|
|
M |
Source/modules/crypto/CryptoResultImpl.cpp
|
View
|
|
2 chunks |
+9 lines, -5 lines |
0 comments
|
Download
|
|
M |
Source/modules/crypto/Key.h
|
View
|
|
1 chunk |
+3 lines, -1 line |
0 comments
|
Download
|
|
M |
Source/modules/crypto/Key.cpp
|
View
|
|
1 chunk |
+6 lines, -5 lines |
0 comments
|
Download
|
|
M |
Source/modules/crypto/NormalizeAlgorithm.h
|
View
|
|
2 chunks |
+15 lines, -3 lines |
0 comments
|
Download
|
|
M |
Source/modules/crypto/NormalizeAlgorithm.cpp
|
View
|
|
9 chunks |
+71 lines, -83 lines |
0 comments
|
Download
|
|
M |
Source/modules/crypto/SubtleCrypto.cpp
|
View
|
|
7 chunks |
+65 lines, -39 lines |
0 comments
|
Download
|
|
M |
public/platform/WebCrypto.h
|
View
|
1
|
3 chunks |
+12 lines, -1 line |
0 comments
|
Download
|
Total messages: 7 (0 generated)
|