Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Issue 141413003: [webcrypto] Match the error handling defined by the spec. (Closed)

Created:
6 years, 11 months ago by eroman
Modified:
6 years, 11 months ago
Reviewers:
abarth-chromium
CC:
blink-reviews, jamesr, tommyw+watchlist_chromium.org, dglazkov+blink, abarth-chromium, Ryan Sleevi
Visibility:
Public.

Description

[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

Patch Set 1 : #

Patch Set 2 : Rebase #

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

Messages

Total messages: 7 (0 generated)
eroman
This builds off of https://codereview.chromium.org/133253002/ abarth: Please review rsleevi: Please confirm my interpretation of the ...
6 years, 11 months ago (2014-01-17 23:05:01 UTC) #1
abarth-chromium
LGTM assuming rsleevi is happy.
6 years, 11 months ago (2014-01-18 09:05:56 UTC) #2
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/eroman@chromium.org/141413003/60026
6 years, 11 months ago (2014-01-21 19:44:24 UTC) #3
commit-bot: I haz the power
Failed to apply patch for Source/modules/crypto/CryptoResultImpl.cpp: While running patch -p1 --forward --force --no-backup-if-mismatch; patching file ...
6 years, 11 months ago (2014-01-21 19:44:33 UTC) #4
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/eroman@chromium.org/141413003/150001
6 years, 11 months ago (2014-01-22 03:27:05 UTC) #5
commit-bot: I haz the power
Retried try job too often on linux_blink_rel for step(s) webkit_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=linux_blink_rel&number=18528
6 years, 11 months ago (2014-01-22 05:58:56 UTC) #6
eroman
6 years, 11 months ago (2014-01-22 06:11:17 UTC) #7
Message was sent while issue was closed.
Committed patchset #2 manually as r165513 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698