Bug 164746

Summary: Update SubtleCrypto::wrapKey to match the latest spec
Product: WebKit Reporter: Jiewen Tan <jiewen_tan>
Component: WebCore Misc.Assignee: Jiewen Tan <jiewen_tan>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, cdumez, commit-queue, esprehn+autocc, jiewen_tan, kondapallykalyan, rob, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 160883    
Attachments:
Description Flags
Patch none

Description Jiewen Tan 2016-11-14 15:59:26 PST
Update SubtleCrypto::wrapKey to match the latest spec.
Comment 1 Radar WebKit Bug Importer 2016-11-14 16:52:50 PST
<rdar://problem/29258160>
Comment 2 Jiewen Tan 2016-11-29 13:13:51 PST
Created attachment 295626 [details]
Patch
Comment 3 WebKit Commit Bot 2016-11-29 13:15:36 PST
Attachment 295626 [details] did not pass style-queue:


ERROR: Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_KW.cpp:161:  CryptoAlgorithmAES_KW::wrapKey is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/gnutls/CryptoAlgorithmAES_KWGnuTLS.cpp:36:  CryptoAlgorithmAES_KW::platformWrapKey is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/mac/CryptoAlgorithmAES_KWMac.cpp:39:  wrapKeyAES_KW is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/mac/CryptoAlgorithmAES_KWMac.cpp:50:  CryptoAlgorithmAES_KW::platformWrapKey is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
Total errors found: 4 in 33 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Brent Fulgham 2016-11-29 13:28:23 PST
Comment on attachment 295626 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=295626&action=review

r=me

> Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp:651
> +    supportExportKeyThrow(state, key->algorithmIdentifier());

Is it okay that we are changing from this promise rejection to a DOM exception? Is that per the new specification?

> LayoutTests/imported/w3c/WebCryptoAPI/idlharness-expected.txt:67
> +PASS SubtleCrypto interface: calling wrapKey(KeyFormat,CryptoKey,CryptoKey,AlgorithmIdentifier) on crypto.subtle with too few arguments must throw TypeError 

Ever closer! I hope to see 'unwrapKey' soon! :-)
Comment 5 Jiewen Tan 2016-11-29 13:58:53 PST
Comment on attachment 295626 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=295626&action=review

Thanks Brent for r+ my patch.

>> Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp:651
>> +    supportExportKeyThrow(state, key->algorithmIdentifier());
> 
> Is it okay that we are changing from this promise rejection to a DOM exception? Is that per the new specification?

Don't worry. There is a catcher in callPromiseFunction to convert any thrown exceptions to rejected promises.
Comment 6 WebKit Commit Bot 2016-11-30 14:26:31 PST
Comment on attachment 295626 [details]
Patch

Clearing flags on attachment: 295626

Committed r209155: <http://trac.webkit.org/changeset/209155>
Comment 7 WebKit Commit Bot 2016-11-30 14:26:35 PST
All reviewed patches have been landed.  Closing bug.