No way for policy client to determine if a the response’s MIME type can be shown
https://bugs.webkit.org/show_bug.cgi?id=124445

Reviewed by Sam Weinig.

Source/WebKit2: 

* Platform/CoreIPC/HandleMessage.h:
(CoreIPC::callMemberFunction): Added a fifth message parameter to this template.

* UIProcess/API/C/WKPage.h: Added a canShowMIMEType parameter to
WKPageDecidePolicyForResponseCallback and deprecated the old version.

* UIProcess/API/mac/WKBrowsingContextController.mm:
(setUpPagePolicyClient): Include whether the response MIME type can be shown under a new key
in the action information dictionary.
* UIProcess/API/mac/WKBrowsingContextPolicyDelegate.h: Declared
WKActionCanShowMIMETypeKey.

* UIProcess/WebInspectorProxy.cpp:
(WebKit::WebInspectorProxy::createInspectorPage): Updated for changes in the policy client.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::decidePolicyForResponse): Added canShowMIMEType parameter, which is
passed to the policy client.
(WebKit::WebPageProxy::decidePolicyForResponseSync): Added canShowMIMEType parameter, which
is passed to the above function.
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in: Added canShowMIMEType paramter to
DecidePolicyForResponseSync.

* UIProcess/WebPolicyClient.cpp:
(WebKit::WebPolicyClient::decidePolicyForResponse): Added canShowMIMEType parameter, which
is passed to the client callback.
* UIProcess/WebPolicyClient.h:

* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse): Determine if the response
MIME type can be shown and pass this information along in the message to the UI process.

Tools: 

* MiniBrowser/mac/WK2BrowserWindowController.m:
(decidePolicyForResponse): Added canShowMIMEType parameter.
(-[WK2BrowserWindowController awakeFromNib]): Updated for changes in the policy client.

* TestWebKitAPI/Tests/WebKit2/PageLoadBasic.cpp:
(TestWebKitAPI::decidePolicyForResponse): Added canShowMIMEType parameter.

* WebKitTestRunner/TestController.cpp:
(WTR::TestController::createWebViewWithOptions): Updated for changes in the policy client.
(WTR::TestController::decidePolicyForResponse): Added canShowMIMEType parameter.
* WebKitTestRunner/TestController.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159387 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Try to fix the EFL build.

* UIProcess/efl/PagePolicyClientEfl.cpp:
(WebKit::PagePolicyClientEfl::decidePolicyForResponseCallback): No need to call
WKFrameCanShowMIMEType now that this information is passed in as a parameter.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159388 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION (r158774): Iteration over element children is broken
https://bugs.webkit.org/show_bug.cgi?id=124145

Source/WebCore: 

Reviewed by Anders Carlsson.
        
Mutation during traversal invalidates the position cache. After the mid-point we start
traversing backwards as it the shortest path. However backward traversal of children-only
HTMLCollection was wrong and would end up going to descendants.
        
Reduction by yannick.poirier@inverto.tv.

Test: fast/dom/htmlcollection-children-mutation.html

* html/HTMLCollection.cpp:
(WebCore::HTMLCollection::collectionTraverseBackward):
        
    Traverse direct children only when m_shouldOnlyIncludeDirectChildren bit is set.

LayoutTests: 

Reviewed by Anders Carlsson.

* fast/dom/htmlcollection-children-mutation-expected.txt: Added.
* fast/dom/htmlcollection-children-mutation.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159389 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Use uint8_t vectors for WebCrypto data
https://bugs.webkit.org/show_bug.cgi?id=124466

Reviewed by Sam Weinig.

Source/WebCore: 

Using Vector<char> for crypto key data is somewhat non-idiomatic, and it gets simply
dangerous for bignums, because signed arithmetic is not appropriate for bignum digits.

* Modules/websockets/WebSocketHandshake.cpp:
(WebCore::generateSecWebSocketKey):
(WebCore::WebSocketHandshake::getExpectedWebSocketAccept):
No longer need to cast data to char* here.

* bindings/js/JSCryptoKeySerializationJWK.cpp:
* bindings/js/JSCryptoKeySerializationJWK.h:
* crypto/CryptoDigest.h:
* crypto/CryptoKey.h:
* crypto/keys/CryptoKeyAES.cpp:
* crypto/keys/CryptoKeyAES.h:
* crypto/keys/CryptoKeyDataOctetSequence.h:
* crypto/keys/CryptoKeyDataRSAComponents.cpp:
* crypto/keys/CryptoKeyDataRSAComponents.h:
* crypto/keys/CryptoKeyHMAC.cpp:
* crypto/keys/CryptoKeyHMAC.h:
* crypto/keys/CryptoKeyRSA.h:
* crypto/keys/CryptoKeySerializationRaw.cpp:
* crypto/keys/CryptoKeySerializationRaw.h:
* crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
* crypto/mac/CryptoAlgorithmHMACMac.cpp:
* crypto/mac/CryptoDigestMac.cpp:
* crypto/mac/CryptoKeyMac.cpp:
* crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h:
Switched to Vector<uint8_t>.

* crypto/mac/CryptoKeyRSAMac.cpp:
(WebCore::getPublicKeyComponents): Extracted from buildAlgorithmDescription() and simplified.
(WebCore::CryptoKeyRSA::create): Switched to Vector<uint8_t>.
(WebCore::CryptoKeyRSA::buildAlgorithmDescription): No longer need to copy data just
to change type from Vector<char> to Vector<unsigned char>.
(WebCore::bigIntegerToUInt32): Ditto. No longer need to cast types when dealing with the bignum.
(WebCore::CryptoKeyRSA::generatePair): Improved an error message a little.

* fileapi/FileReaderLoader.cpp: (WebCore::FileReaderLoader::convertToDataURL):
* inspector/DOMPatchSupport.cpp: (WebCore::DOMPatchSupport::createDigest):
* inspector/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::archive):
* platform/graphics/cg/ImageBufferCG.cpp: (WebCore::CGImageToDataURL):
No longer need to cast data to char* here.

Source/WTF: 

Binary data can be UTF-8, in which case "char*" is idiomatic, or it can be arbitrary
binary data, in which case "uint8_t*" is more common.

Changed encode functions that took "const char *" to "const void*", and decode
functions that took "Vector<char>&" now take an adapter class.

The adapter relies on Vector<char> and Vector<uint8_t> classes having an identical layout.

* wtf/text/Base64.cpp:
(WTF::base64Encode):
(WTF::base64URLEncode):
(WTF::base64DecodeInternal):
(WTF::base64Decode):
(WTF::base64URLDecode):
* wtf/text/Base64.h:
(WTF::SignedOrUnsignedCharVectorAdapter):
(WTF::ConstSignedOrUnsignedCharVectorAdapter):
(WTF::base64Encode):
(WTF::base64URLEncode):



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