Make algorithm.name return registered name, not normalized one
https://bugs.webkit.org/show_bug.cgi?id=125641

Reviewed by Anders Carlsson.

Source/WebCore: 

Currently, WebCrypto editor's draft stipulates that algorithm name is lowercased
as part of normalization.

But it makes little sense to register algorithms as mixed (mostly upper) case, yet
return the name lowercased. Other implementations don't bother respecting this,
and signs are that the spec will change.

I'd like to match other implementations here, because sticking to the spec only
makes us fail 3rd party test suites for no good reason.

Updated many existing tests.

* crypto/CryptoAlgorithmRegistry.cpp:
(WebCore::CryptoAlgorithmRegistry::getIdentifierForName):
(WebCore::CryptoAlgorithmRegistry::registerAlgorithm):
* crypto/CryptoAlgorithmRegistry.h:
* crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
* crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
* crypto/algorithms/CryptoAlgorithmHMAC.cpp:
* crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
* crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
* crypto/algorithms/CryptoAlgorithmSHA1.cpp:
* crypto/algorithms/CryptoAlgorithmSHA224.cpp:
* crypto/algorithms/CryptoAlgorithmSHA256.cpp:
* crypto/algorithms/CryptoAlgorithmSHA384.cpp:
* crypto/algorithms/CryptoAlgorithmSHA512.cpp:

LayoutTests: 

* crypto/subtle/aes-cbc-192-encrypt-decrypt-expected.txt:
* crypto/subtle/aes-cbc-192-encrypt-decrypt.html:
* crypto/subtle/aes-cbc-256-encrypt-decrypt-expected.txt:
* crypto/subtle/aes-cbc-256-encrypt-decrypt.html:
* crypto/subtle/aes-cbc-encrypt-decrypt-expected.txt:
* crypto/subtle/aes-cbc-encrypt-decrypt-with-padding-expected.txt:
* crypto/subtle/aes-cbc-encrypt-decrypt-with-padding.html:
* crypto/subtle/aes-cbc-encrypt-decrypt.html:
* crypto/subtle/aes-cbc-generate-key-expected.txt:
* crypto/subtle/aes-cbc-generate-key.html:
* crypto/subtle/aes-cbc-import-jwk-expected.txt:
* crypto/subtle/aes-cbc-import-jwk.html:
* crypto/subtle/aes-cbc-invalid-length-expected.txt:
* crypto/subtle/aes-cbc-invalid-length.html:
* crypto/subtle/aes-cbc-unwrap-failure-expected.txt:
* crypto/subtle/aes-cbc-unwrap-failure.html:
* crypto/subtle/aes-cbc-unwrap-rsa-expected.txt:
* crypto/subtle/aes-cbc-unwrap-rsa.html:
* crypto/subtle/aes-cbc-wrap-rsa-expected.txt:
* crypto/subtle/aes-cbc-wrap-rsa-non-extractable-expected.txt:
* crypto/subtle/aes-cbc-wrap-rsa-non-extractable.html:
* crypto/subtle/aes-cbc-wrap-rsa.html:
* crypto/subtle/aes-kw-key-manipulation-expected.txt:
* crypto/subtle/aes-kw-key-manipulation.html:
* crypto/subtle/aes-kw-wrap-unwrap-aes-expected.txt:
* crypto/subtle/aes-kw-wrap-unwrap-aes.html:
* crypto/subtle/aes-postMessage-expected.txt:
* crypto/subtle/aes-postMessage.html:
* crypto/subtle/hmac-generate-key-expected.txt:
* crypto/subtle/hmac-generate-key.html:
* crypto/subtle/hmac-import-jwk-expected.txt:
* crypto/subtle/hmac-import-jwk.html:
* crypto/subtle/hmac-postMessage-expected.txt:
* crypto/subtle/hmac-postMessage.html:
* crypto/subtle/hmac-sign-verify-empty-key-expected.txt:
* crypto/subtle/hmac-sign-verify-empty-key.html:
* crypto/subtle/hmac-sign-verify-expected.txt:
* crypto/subtle/hmac-sign-verify.html:
* crypto/subtle/postMessage-worker-expected.txt:
* crypto/subtle/postMessage-worker.html:
* crypto/subtle/resources/postMessage-worker.js:
* crypto/subtle/rsa-oaep-key-manipulation-expected.txt:
* crypto/subtle/rsa-oaep-key-manipulation.html:
* crypto/subtle/rsa-oaep-wrap-unwrap-aes-expected.txt:
* crypto/subtle/rsa-oaep-wrap-unwrap-aes.html:
* crypto/subtle/rsa-postMessage-expected.txt:
* crypto/subtle/rsa-postMessage.html:
* crypto/subtle/rsassa-pkcs1-v1_5-generate-key-expected.txt:
* crypto/subtle/rsassa-pkcs1-v1_5-generate-key.html:
* crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-expected.txt:
* crypto/subtle/rsassa-pkcs1-v1_5-import-jwk.html:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160491 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Replace uses of WTF::BitArray with std::bitset
https://bugs.webkit.org/show_bug.cgi?id=125642

Reviewed by Anders Carlsson.

../WebCore: 

* css/CSSParser.cpp:
(WebCore::filterProperties):
(WebCore::CSSParser::createStyleProperties):
* css/StyleProperties.cpp:
(WebCore::StyleProperties::asText):

../WTF: 

* GNUmakefile.list.am:
* WTF.vcxproj/WTF.vcxproj:
* WTF.vcxproj/WTF.vcxproj.filters:
* WTF.xcodeproj/project.pbxproj:
* wtf/BitArray.h: Removed.
* wtf/CMakeLists.txt:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160492 268f45cc-cd09-0410-ab3c-d52691b4dbfc
ARM64: Hang running pdfjs test, suspect DFG generated code for "in"
https://bugs.webkit.org/show_bug.cgi?id=124727
<rdar://problem/15566923>

Reviewed by Michael Saboff.
        
Get rid of In's hackish use of StructureStubInfo. Previously it was using hotPathBegin,
and it was the only IC that used that field, which was wasteful. Moreover, it used it
to store two separate locations: the label for patching the jump and the label right
after the jump. The code was relying on those two being the same label, which is true
on X86 and some other platforms, but it isn't true on ARM64.
        
This gets rid of hotPathBegin and makes In express those two locations as offsets from
the callReturnLocation, which is analogous to what the other IC's do.
        
This fixes a bug where any successful In patching would result in a trivially infinite
loop - and hence a hang - on ARM64.

* bytecode/StructureStubInfo.h:
* dfg/DFGJITCompiler.cpp:
(JSC::DFG::JITCompiler::link):
* dfg/DFGJITCompiler.h:
(JSC::DFG::InRecord::InRecord):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileIn):
* jit/JITInlineCacheGenerator.cpp:
(JSC::JITByIdGenerator::finalize):
* jit/Repatch.cpp:
(JSC::replaceWithJump):
(JSC::patchJumpToGetByIdStub):
(JSC::tryCachePutByID):
(JSC::tryBuildPutByIdList):
(JSC::tryRepatchIn):
(JSC::resetGetByID):
(JSC::resetPutByID):
(JSC::resetIn):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160493 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Test new JSContext name APIs
https://bugs.webkit.org/show_bug.cgi?id=125607

Source/JavaScriptCore:

Reviewed by Darin Adler.

* API/JSContext.h:
* API/JSContextRef.h:
Fix whitespace issues.

* API/tests/testapi.c:
(globalContextNameTest):
(main):
* API/tests/testapi.mm:
Add tests for JSContext set/get name APIs.

Tools:

* Scripts/run-javascriptcore-tests:
Remove trailing whitespace.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160494 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Cocoa] Navigation action information for policy decisions is missing the original request
https://bugs.webkit.org/show_bug.cgi?id=125612

Reviewed by Anders Carlsson.

* Platform/CoreIPC/HandleMessage.h:
(CoreIPC::callMemberFunction): Added template with additional message parameter.
* UIProcess/API/C/WKPagePolicyClientInternal.h: Added. Defines a new version of the client
interface with a new version of the policy decision callback.
* UIProcess/API/Cocoa/WKBrowsingContextController.mm:
(setUpPagePolicyClient): Use the new internal version of the client. Pass the original
request in the action information dictionary under a new key.
* UIProcess/API/Cocoa/WKBrowsingContextPolicyDelegate.h: Declared new action information
key.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::decidePolicyForNavigationAction): Added originalRequest parameter,
which is passed to the policy client.
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in: Added originalRequest parameter in
DecidePolicyForNavigationAction.
* UIProcess/WebPolicyClient.cpp:
(WebKit::WebPolicyClient::decidePolicyForNavigationAction): Pass the original request to
the client.
* UIProcess/WebPolicyClient.h:
* WebKit2.xcodeproj/project.pbxproj: Added reference to new file.
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): Send the original
request from the navigation action to the UI process.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160495 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore: Replace uses of WTF::BitArray with std::bitset
https://bugs.webkit.org/show_bug.cgi?id=125642

Patch by Sam Weinig <sam@webkit.org> on 2013-12-12
Reviewed by Anders Carlsson.

* css/CSSParser.cpp:
(WebCore::filterProperties):
(WebCore::CSSParser::createStyleProperties):
* css/StyleProperties.cpp:
(WebCore::StyleProperties::asText):

LayoutTests: Public key in a generated KeyPair should always be extractable
https://bugs.webkit.org/show_bug.cgi?id=125643

Reviewed by Sam Weinig.

* crypto/subtle/rsa-oaep-generate-non-extractable-key-expected.txt: Added.
* crypto/subtle/rsa-oaep-generate-non-extractable-key.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160496 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Mac] Stop not caching HTTP resources with "Vary" header in response.
<https://webkit.org/b/125483>
<rdar://problem/11781097>

Remove the workaround preventing resources with the "Vary" header
from going into cache, as the CFNetwork cache has supported this
for quite a while now.

31.5 MB progression on Membuster3, because we can now mmap those
resources from disk once they are in the cache.

We keep the workaround on PLATFORM(WIN) for now.

Reviewed by Antti Koivisto.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160498 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: ES6: JavaScript syntax highlighting and recognition of for..of
https://bugs.webkit.org/show_bug.cgi?id=122868

Patch by Laszlo Vidacs <lac@inf.u-szeged.hu> on 2013-12-12
Reviewed by Timothy Hatcher.

Update to CodeMirror 3.20 including javascript ES6 updates.

* Tools/PrettyPrinting/codemirror.css:
* Tools/PrettyPrinting/codemirror.js: Minor local change due to error from jsmin.py
* Tools/PrettyPrinting/css.js:
* Tools/PrettyPrinting/javascript.js:
* UserInterface/External/CodeMirror/codemirror.css:
* UserInterface/External/CodeMirror/codemirror.js: Minor local change due to error from jsmin.py
* UserInterface/External/CodeMirror/coffeescript.js:
* UserInterface/External/CodeMirror/css.js:
* UserInterface/External/CodeMirror/htmlmixed.js:
* UserInterface/External/CodeMirror/javascript.js:
* UserInterface/External/CodeMirror/less.js:
* UserInterface/External/CodeMirror/matchbrackets.js:
* UserInterface/External/CodeMirror/placeholder.js:
* UserInterface/External/CodeMirror/runmode.js:
* UserInterface/External/CodeMirror/searchcursor.js:
* UserInterface/External/CodeMirror/sql.js:
* UserInterface/External/CodeMirror/xml.js:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160500 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add support for RSAES-PKCS1-v1_5
https://bugs.webkit.org/show_bug.cgi?id=125647

Reviewed by Anders Carlsson.

Source/WebCore: 

Tests: crypto/subtle/rsaes-pkcs1-v1_5-decrypt.html
       crypto/subtle/rsaes-pkcs1-v1_5-wrap-unwrap-aes.html

* crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
* crypto/algorithms/CryptoAlgorithmAES_KW.h:
Removed meaningless parameters arguments from private functions. The base arguments
class is always empty.

* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSCryptoAlgorithmDictionary.cpp:
(WebCore::JSCryptoAlgorithmDictionary::createParametersForEncrypt):
(WebCore::JSCryptoAlgorithmDictionary::createParametersForDecrypt):
* bindings/js/JSCryptoKeySerializationJWK.cpp:
(WebCore::JSCryptoKeySerializationJWK::reconcileAlgorithm):
(WebCore::JSCryptoKeySerializationJWK::keySizeIsValid):
(WebCore::JSCryptoKeySerializationJWK::addJWKAlgorithmToJSON):
* crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp: Added.
(WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::CryptoAlgorithmRSAES_PKCS1_v1_5):
(WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::~CryptoAlgorithmRSAES_PKCS1_v1_5):
(WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::create):
(WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::identifier):
(WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::keyAlgorithmMatches):
(WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::encrypt):
(WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::decrypt):
(WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::generateKey):
(WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey):
* crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h: Added.
* crypto/mac/CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp: Added.
(WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt):
(WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt):
* crypto/mac/CryptoAlgorithmRegistryMac.cpp:
(WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
Added support for this algorithm.

LayoutTests: 

* crypto/subtle/rsaes-pkcs1-v1_5-decrypt-expected.txt: Added.
* crypto/subtle/rsaes-pkcs1-v1_5-decrypt.html: Added.
* crypto/subtle/rsaes-pkcs1-v1_5-wrap-unwrap-aes-expected.txt: Added.
* crypto/subtle/rsaes-pkcs1-v1_5-wrap-unwrap-aes.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160502 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add support for RSAES-PKCS1-v1_5
https://bugs.webkit.org/show_bug.cgi?id=125647

Build fix.

* crypto/CommonCryptoUtilities.h: Declare a newly used private constant.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160503 268f45cc-cd09-0410-ab3c-d52691b4dbfc