Summary: | Use std::function callbacks in CryptoAlgorithm instead of JS promises | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Alexey Proskuryakov <ap> | ||||
Component: | WebCore JavaScript | Assignee: | Alexey Proskuryakov <ap> | ||||
Status: | RESOLVED FIXED | ||||||
Severity: | Normal | CC: | andersca, commit-queue, sam | ||||
Priority: | P2 | ||||||
Version: | 528+ (Nightly build) | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Bug Depends on: | |||||||
Bug Blocks: | 122679 | ||||||
Attachments: |
|
Description
Alexey Proskuryakov
2013-11-20 12:02:46 PST
Created attachment 217463 [details]
proposed patch
Attachment 217463 [details] did not pass style-queue:
Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCore/bindings/js/JSDOMPromise.cpp', u'Source/WebCore/bindings/js/JSDOMPromise.h', u'Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp', u'Source/WebCore/crypto/CryptoAlgorithm.cpp', u'Source/WebCore/crypto/CryptoAlgorithm.h', u'Source/WebCore/crypto/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp', u'Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CBC.cpp', u'Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CBC.h', u'Source/WebCore/crypto/algorithms/CryptoAlgorithmHMAC.cpp', u'Source/WebCore/crypto/algorithms/CryptoAlgorithmHMAC.h', u'Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp', u'Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h', u'Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA1.cpp', u'Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA1.h', u'Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA224.cpp', u'Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA224.h', u'Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA256.cpp', u'Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA256.h', u'Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA384.cpp', u'Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA384.h', u'Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA512.cpp', u'Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA512.h', u'Source/WebCore/crypto/keys/CryptoKeyRSA.h', u'Source/WebCore/crypto/mac/CryptoAlgorithmAES_CBCMac.cpp', u'Source/WebCore/crypto/mac/CryptoAlgorithmHMACMac.cpp', u'Source/WebCore/crypto/mac/CryptoKeyRSAMac.cpp']" exit_code: 1
Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:45: The parameter name "data" adds no information, so it should be removed. [readability/parameter_name] [5]
Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:58: CryptoAlgorithmAES_CBC::generateKey is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4]
Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:71: CryptoAlgorithmAES_CBC::importKey is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4]
Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:58: CryptoAlgorithmRSASSA_PKCS1_v1_5::generateKey is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4]
Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:62: Place brace on its own line for function definitions. [whitespace/braces] [4]
Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:69: CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4]
Source/WebCore/crypto/algorithms/CryptoAlgorithmHMAC.h:45: The parameter name "data" adds no information, so it should be removed. [readability/parameter_name] [5]
Source/WebCore/crypto/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:91: CryptoAlgorithmRSASSA_PKCS1_v1_5::sign is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4]
Source/WebCore/crypto/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:130: CryptoAlgorithmRSASSA_PKCS1_v1_5::verify is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4]
Source/WebCore/crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:38: transformAES_CBC is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4]
Source/WebCore/crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:85: CryptoAlgorithmAES_CBC::encrypt is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4]
Source/WebCore/crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:98: CryptoAlgorithmAES_CBC::decrypt is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4]
Source/WebCore/crypto/CryptoAlgorithm.h:65: The parameter name "data" adds no information, so it should be removed. [readability/parameter_name] [5]
Total errors found: 13 in 27 files
If any of these errors are false positives, please file a bug against check-webkit-style.
Comment on attachment 217463 [details] proposed patch View in context: https://bugs.webkit.org/attachment.cgi?id=217463&action=review > Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:68 > + callback(result.get(), 0); nullptr? > Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:63 > + callback(0, &pair); nullptr? > Source/WebCore/crypto/mac/CryptoKeyRSAMac.cpp:222 > + KeyPairCallback* localCallback = new KeyPairCallback(callback); Can std::move callback here to avoid a copy. > Source/WebCore/crypto/mac/CryptoKeyRSAMac.cpp:223 > + VoidCallback* localFailureCallback = new VoidCallback(failureCallback); Ditto for failureCallback. Committed <http://trac.webkit.org/r159578>. Comment on attachment 217463 [details] proposed patch View in context: https://bugs.webkit.org/attachment.cgi?id=217463&action=review > Source/WebCore/bindings/js/JSDOMPromise.h:44 > + PromiseWrapper(const PromiseWrapper&); > + PromiseWrapper& operator=(const PromiseWrapper&); Why don’t we just let the compiler generate these? The hand-written functions look the same as what the compiler would generate if we didn’t say anything. |