[EME] Add basic implementation of HTMLMediaElement::setMediaKeys()
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-08-20  Zan Dobersek  <zdobersek@igalia.com>
2
3         [EME] Add basic implementation of HTMLMediaElement::setMediaKeys()
4         https://bugs.webkit.org/show_bug.cgi?id=175717
5
6         Reviewed by Xabier Rodriguez-Calvar.
7
8         Add an initial and incomplete implementation of HTMLMediaElement::setMediaKeys(),
9         interleaved with the specification wording of how this operation should behave.
10         The implementation still doesn't cover cases of CDM instances being already
11         associated with a different HTMLMediaElement, of CDM instances that can't be
12         disassociated from the current HTMLMediaElement, and of failures during both
13         association and disassociation of MediaKeys with the HTMLMediaElement.
14
15         The HTMLMediaElement (as a CDMClient inheritor) has to be attached or detached
16         from the MediaKeys object as appropriate. This attachment allows MediaKeys to
17         initiate an attempt to resume playback whenever the key statuses of the
18         associated MediaKeys object are updated.
19
20         Upon association and disassociation with MediaKeys, the CDMInstance object of
21         that specific MediaKeys instance is attached to or detached from the MediaPlayer
22         instance. This allows the platform layer to gather information about the
23         CDMInstance that will be used for decryption of media content for this specific
24         media element.
25
26         Additionally, the detachment from both MediaKeys and MediaPlayer is done upon
27         HTMLMediaElement destruction.
28
29         Upon setting the MediaKeys object, a task is queued that launches the 'Attempt to
30         Resume Playback If Necessary' algorithm. A placeholder method is added that will
31         implement the algorithm in the future.
32
33         The HTMLMediaElement::mediaKeys() getter is also implemented, returning pointer
34         held in m_mediaKeys.
35
36         Covered to a degree by existing imported W3C tests, with a setMediaKeys()-oriented
37         test having WPE-specific baseline update.
38
39         * Modules/encryptedmedia/MediaKeys.h:
40         (WebCore::MediaKeys::cdmInstance const):
41         * html/HTMLMediaElement.cpp:
42         (WebCore::HTMLMediaElement::~HTMLMediaElement):
43         (WebCore::HTMLMediaElement::mediaKeys const):
44         (WebCore::HTMLMediaElement::setMediaKeys):
45         (WebCore::HTMLMediaElement::attemptToResumePlaybackIfNecessary):
46         (WebCore::HTMLMediaElement::contextDestroyed):
47         * html/HTMLMediaElement.h:
48         * platform/graphics/MediaPlayer.cpp:
49         (WebCore::MediaPlayer::cdmInstanceAttached):
50         (WebCore::MediaPlayer::cdmInstanceDetached):
51         * platform/graphics/MediaPlayer.h:
52         * platform/graphics/MediaPlayerPrivate.h:
53         (WebCore::MediaPlayerPrivateInterface::cdmInstanceAttached):
54         (WebCore::MediaPlayerPrivateInterface::cdmInstanceDetached):
55
56 2017-08-20  Chris Dumez  <cdumez@apple.com>
57
58         Simplify calls to LoaderStrategy::startPingLoad()
59         https://bugs.webkit.org/show_bug.cgi?id=175756
60
61         Reviewed by Sam Weinig.
62
63         Simplify calls to LoaderStrategy::startPingLoad() by passing the Frame to it
64         and let its implementation gets what it needs from the frame. This reduces
65         the number of parameters to startPingLoad() and is more easily extensible.
66
67         * dom/Document.h:
68         * loader/LoaderStrategy.h:
69         * loader/PingLoader.cpp:
70         (WebCore::PingLoader::loadImage):
71         (WebCore::PingLoader::sendPing):
72         (WebCore::PingLoader::sendViolationReport):
73         (WebCore::PingLoader::startPingLoad):
74         * loader/PingLoader.h:
75         * loader/cache/CachedResource.cpp:
76         (WebCore::CachedResource::load):
77
78 2017-08-20  Antti Koivisto  <antti@apple.com>
79
80         Factor :before/:after render tree mutations into a RenderTreeUpdater helper class
81         https://bugs.webkit.org/show_bug.cgi?id=175752
82
83         Reviewed by Andreas Kling.
84
85         Move code that constructs generated content renderers out from PseudoElement.
86         Also refactor the related code from RenderTreeUpdater main class into
87         RenderTreeUpdater::GeneratedContent helper class.
88
89         * WebCore.xcodeproj/project.pbxproj:
90         * dom/PseudoElement.cpp:
91         (WebCore::PseudoElement::resolveCustomStyle): Deleted.
92
93             Not needed anymore.
94
95         (WebCore::PseudoElement::didAttachRenderers): Deleted.
96
97             Moves to createContentRenderers in GeneratedContent.
98
99         (WebCore::PseudoElement::didRecalcStyle): Deleted.
100
101             Moves to updateStyleForContentRenderers in GeneratedContent.
102
103         * dom/PseudoElement.h:
104         * style/RenderTreeUpdater.cpp:
105         (WebCore::RenderTreeUpdater::RenderTreeUpdater):
106         (WebCore::RenderTreeUpdater::~RenderTreeUpdater):
107         (WebCore::RenderTreeUpdater::commit):
108         (WebCore::RenderTreeUpdater::updateBeforeDescendants):
109         (WebCore::RenderTreeUpdater::updateAfterDescendants):
110         (WebCore::needsPseudoElement): Deleted.
111         (WebCore::RenderTreeUpdater::updateBeforeOrAfterPseudoElement): Deleted.
112         (WebCore::RenderTreeUpdater::updateQuotesUpTo): Deleted.
113
114             Quotes and other :before/:after support moves to GeneratedContent helpwe.
115
116         * style/RenderTreeUpdater.h:
117         (WebCore::RenderTreeUpdater::generatedContent):
118         * style/RenderTreeUpdaterGeneratedContent.cpp: Added.
119         (WebCore::RenderTreeUpdater::GeneratedContent::GeneratedContent):
120         (WebCore::RenderTreeUpdater::GeneratedContent::updateBeforePseudoElement):
121         (WebCore::RenderTreeUpdater::GeneratedContent::updateAfterPseudoElement):
122         (WebCore::RenderTreeUpdater::GeneratedContent::updateRemainingQuotes):
123         (WebCore::RenderTreeUpdater::GeneratedContent::updateQuotesUpTo):
124         (WebCore::createContentRenderers):
125         (WebCore::updateStyleForContentRenderers):
126         (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement):
127         (WebCore::RenderTreeUpdater::GeneratedContent::needsPseudoElement):
128         * style/RenderTreeUpdaterGeneratedContent.h: Added.
129
130 2017-08-19  Andy Estes  <aestes@apple.com>
131
132         [Payment Request] Add interface stubs
133         https://bugs.webkit.org/show_bug.cgi?id=175730
134
135         Reviewed by Youenn Fablet.
136
137         * DerivedSources.make:
138         * Modules/paymentrequest/PaymentAddress.h: Added.
139         * Modules/paymentrequest/PaymentAddress.idl: Added.
140         * Modules/paymentrequest/PaymentComplete.h: Added.
141         * Modules/paymentrequest/PaymentComplete.idl: Added.
142         * Modules/paymentrequest/PaymentCurrencyAmount.h: Added.
143         * Modules/paymentrequest/PaymentCurrencyAmount.idl: Added.
144         * Modules/paymentrequest/PaymentDetailsBase.h: Added.
145         * Modules/paymentrequest/PaymentDetailsBase.idl: Added.
146         * Modules/paymentrequest/PaymentDetailsInit.h: Added.
147         * Modules/paymentrequest/PaymentDetailsInit.idl: Added.
148         * Modules/paymentrequest/PaymentDetailsModifier.h: Added.
149         * Modules/paymentrequest/PaymentDetailsModifier.idl: Added.
150         * Modules/paymentrequest/PaymentDetailsUpdate.h: Added.
151         * Modules/paymentrequest/PaymentDetailsUpdate.idl: Added.
152         * Modules/paymentrequest/PaymentItem.h: Added.
153         * Modules/paymentrequest/PaymentItem.idl: Added.
154         * Modules/paymentrequest/PaymentMethodData.h: Added.
155         * Modules/paymentrequest/PaymentMethodData.idl: Added.
156         * Modules/paymentrequest/PaymentOptions.h: Added.
157         * Modules/paymentrequest/PaymentOptions.idl: Added.
158         * Modules/paymentrequest/PaymentRequest.cpp: Added.
159         (WebCore::PaymentRequest::create):
160         (WebCore::PaymentRequest::PaymentRequest):
161         (WebCore::PaymentRequest::~PaymentRequest):
162         (WebCore::PaymentRequest::show):
163         (WebCore::PaymentRequest::abort):
164         (WebCore::PaymentRequest::canMakePayment):
165         * Modules/paymentrequest/PaymentRequest.h: Added.
166         * Modules/paymentrequest/PaymentRequest.idl: Added.
167         * Modules/paymentrequest/PaymentRequestUpdateEvent.cpp: Added.
168         (WebCore::PaymentRequestUpdateEvent::~PaymentRequestUpdateEvent):
169         (WebCore::PaymentRequestUpdateEvent::updateWith):
170         * Modules/paymentrequest/PaymentRequestUpdateEvent.h: Added.
171         * Modules/paymentrequest/PaymentRequestUpdateEvent.idl: Added.
172         * Modules/paymentrequest/PaymentRequestUpdateEventInit.h: Added.
173         * Modules/paymentrequest/PaymentRequestUpdateEventInit.idl: Added.
174         * Modules/paymentrequest/PaymentResponse.cpp: Added.
175         (WebCore::PaymentResponse::complete):
176         * Modules/paymentrequest/PaymentResponse.h: Added.
177         * Modules/paymentrequest/PaymentResponse.idl: Added.
178         * Modules/paymentrequest/PaymentShippingOption.h: Added.
179         * Modules/paymentrequest/PaymentShippingOption.idl: Added.
180         * Modules/paymentrequest/PaymentShippingType.h: Added.
181         * Modules/paymentrequest/PaymentShippingType.idl: Added.
182         * WebCore.xcodeproj/project.pbxproj:
183         * dom/EventNames.h:
184         * dom/EventNames.in:
185         * dom/EventTargetFactory.in:
186
187 2017-08-19  Sam Weinig  <sam@webkit.org>
188
189         [WebCrypto] Remove the KeyAlgorithm type hierarchy
190         https://bugs.webkit.org/show_bug.cgi?id=175750
191
192         Reviewed by Chris Dumez.
193
194         Removes the unnecessary indirection that existed to generate a
195         KeyAlgorithm dictionary (or rather, one of its derived dictionaries)
196         for a CryptoKey. We were calling the virtual buildAlgorithm(), which
197         return a std::unique_ptr<KeyAlgorithm>, which we then casted to the 
198         correct derived class and called dictionary() on. This can now be
199         simplified by making each CryptoKey derived class override a function
200         that returns the KeyAlgorithm variant.
201
202         * crypto/CryptoKey.cpp:
203         (WebCore::CryptoKey::algorithm const): Deleted.
204         * crypto/CryptoKey.h:
205         (WebCore::CryptoKey::extractable const):
206         (WebCore::KeyAlgorithm::~KeyAlgorithm): Deleted.
207         (WebCore::KeyAlgorithm::name const): Deleted.
208         (WebCore::KeyAlgorithm::KeyAlgorithm): Deleted.
209         * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:
210         (WebCore::CryptoKeyRSA::algorithm const):
211         (WebCore::CryptoKeyRSA::buildAlgorithm const): Deleted.
212         * crypto/keys/CryptoKeyAES.cpp:
213         (WebCore::CryptoKeyAES::algorithm const):
214         (WebCore::AesKeyAlgorithm::dictionary const): Deleted.
215         (WebCore::CryptoKeyAES::buildAlgorithm const): Deleted.
216         * crypto/keys/CryptoKeyAES.h:
217         * crypto/keys/CryptoKeyEC.cpp:
218         (WebCore::CryptoKeyEC::algorithm const):
219         (WebCore::EcKeyAlgorithm::dictionary const): Deleted.
220         (WebCore::CryptoKeyEC::buildAlgorithm const): Deleted.
221         * crypto/keys/CryptoKeyEC.h:
222         (WebCore::EcKeyAlgorithm::EcKeyAlgorithm): Deleted.
223         (WebCore::EcKeyAlgorithm::namedCurve const): Deleted.
224         * crypto/keys/CryptoKeyHMAC.cpp:
225         (WebCore::CryptoKeyHMAC::algorithm const):
226         (WebCore::HmacKeyAlgorithm::dictionary const): Deleted.
227         (WebCore::CryptoKeyHMAC::buildAlgorithm const): Deleted.
228         * crypto/keys/CryptoKeyHMAC.h:
229         * crypto/keys/CryptoKeyRSA.cpp:
230         (WebCore::RsaKeyAlgorithm::dictionary const): Deleted.
231         (WebCore::RsaHashedKeyAlgorithm::dictionary const): Deleted.
232         * crypto/keys/CryptoKeyRSA.h:
233         (WebCore::RsaKeyAlgorithm::RsaKeyAlgorithm): Deleted.
234         (WebCore::RsaKeyAlgorithm::modulusLength const): Deleted.
235         (WebCore::RsaKeyAlgorithm::publicExponent const): Deleted.
236         * crypto/keys/CryptoKeyRaw.cpp:
237         (WebCore::CryptoKeyRaw::algorithm const):
238         (WebCore::RawKeyAlgorithm::dictionary const): Deleted.
239         (WebCore::CryptoKeyRaw::buildAlgorithm const): Deleted.
240         * crypto/keys/CryptoKeyRaw.h:
241         (WebCore::RawKeyAlgorithm::RawKeyAlgorithm): Deleted.
242         * crypto/mac/CryptoKeyRSAMac.cpp:
243         (WebCore::CryptoKeyRSA::algorithm const):
244         (WebCore::CryptoKeyRSA::buildAlgorithm const): Deleted.
245
246 2017-08-19  Sam Weinig  <sam@webkit.org>
247
248         [Mac] Change uint8_t* to Vector<uint8_t> type in all crypto algorithm implementation
249         https://bugs.webkit.org/show_bug.cgi?id=164939
250
251         Reviewed by Chris Dumez.
252
253         Address FIXMEs, replacing uint8_t*/size_t parameters with Vector<uint8_t>&.
254
255         * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
256         (WebCore::transformAES_CBC):
257         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
258         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
259         * crypto/mac/CryptoAlgorithmAES_KWMac.cpp:
260         (WebCore::wrapKeyAES_KW):
261         (WebCore::unwrapKeyAES_KW):
262         (WebCore::CryptoAlgorithmAES_KW::platformWrapKey):
263         (WebCore::CryptoAlgorithmAES_KW::platformUnwrapKey):
264         * crypto/mac/CryptoAlgorithmHMACMac.cpp:
265         (WebCore::calculateSignature):
266         (WebCore::CryptoAlgorithmHMAC::platformSign):
267         (WebCore::CryptoAlgorithmHMAC::platformVerify):
268         * crypto/mac/CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp:
269         (WebCore::encryptRSAES_PKCS1_v1_5):
270         (WebCore::decryptRSAES_PKCS1_v1_5):
271         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt):
272         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt):
273         * crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
274         (WebCore::signRSASSA_PKCS1_v1_5):
275         (WebCore::verifyRSASSA_PKCS1_v1_5):
276         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign):
277         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify):
278         * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp:
279         (WebCore::encryptRSA_OAEP):
280         (WebCore::decryptRSA_OAEP):
281         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
282         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
283
284 2017-08-18  Ryosuke Niwa  <rniwa@webkit.org>
285
286         Forbid setDragImage after dragstart
287         https://bugs.webkit.org/show_bug.cgi?id=175751
288
289         Reviewed by Wenson Hsieh.
290
291         Removed the code to allow setting the drag mage after dragstart had happened.
292
293         The feature was apparently used in Mac WebKit1 port but using it today causes the drag image
294         to disapepar while the user is moving the mouse cursor and being drawn once it's stopped
295         and results in the contionus flickering of the drag image.
296
297         The feaure was never supported in WebKit2 and doesn't match the HTML5 specification:
298         https://html.spec.whatwg.org/multipage/dnd.html#concept-dnd-rw
299         https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-setdragimage
300         or the behaviors of other browsers such as Chrome and Firefox.
301
302         No new tests. This patch simply removes code.
303
304         * dom/DataTransfer.cpp:
305         (WebCore::DataTransfer::setDragImage):
306         (WebCore::DataTransfer::canSetDragImage const): Deleted.
307         * dom/DataTransfer.h:
308         (WebCore::DataTransfer::makeDragImageWritable): Deleted.
309         * page/EventHandler.cpp:
310         (WebCore::EventHandler::handleDrag):
311
312 2017-08-18  Sam Weinig  <sam@webkit.org>
313
314         [WebCrypto] Get rid of CryptoKeyData class and all its subclasses
315         https://bugs.webkit.org/show_bug.cgi?id=169806
316
317         Reviewed by Chris Dumez.
318
319         - Replaces the CryptoKeyData type hierarchy 
320
321             CryptoKeyData
322               - CryptoKeyDataOctetSequence
323               - CryptoKeyDataRSAComponents
324
325           with the renamed CryptoKeyRSAComponents.
326
327         - Removes pure virtual exportData function on CryptoKey, and all
328           the implementations except the one on CryptoKeyRSA, which now is
329           non-virtual, and returns a CryptoKeyRSAComponents. Update the one
330           external caller, SerializedScriptValue, to handle this.
331
332         * CMakeLists.txt:
333         * WebCore.xcodeproj/project.pbxproj:
334         * bindings/js/SerializedScriptValue.cpp:
335         * crypto/CryptoAlgorithm.h:
336         * crypto/CryptoKey.h:
337         * crypto/CryptoKeyData.h: Removed.
338         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
339         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
340         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
341         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
342         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
343         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
344         * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:
345         (WebCore::CryptoKeyRSA::create):
346         (WebCore::CryptoKeyRSA::exportData const):
347         * crypto/keys/CryptoKeyAES.cpp:
348         (WebCore::CryptoKeyAES::exportData const): Deleted.
349         * crypto/keys/CryptoKeyAES.h:
350         * crypto/keys/CryptoKeyDataOctetSequence.cpp: Removed.
351         * crypto/keys/CryptoKeyDataOctetSequence.h: Removed.
352         * crypto/keys/CryptoKeyDataRSAComponents.cpp: Removed.
353         * crypto/keys/CryptoKeyDataRSAComponents.h: Removed.
354         * crypto/keys/CryptoKeyEC.cpp:
355         (WebCore::CryptoKeyEC::exportData const): Deleted.
356         * crypto/keys/CryptoKeyEC.h:
357         * crypto/keys/CryptoKeyHMAC.cpp:
358         (WebCore::CryptoKeyHMAC::exportData const): Deleted.
359         * crypto/keys/CryptoKeyHMAC.h:
360         * crypto/keys/CryptoKeyRSA.cpp:
361         (WebCore::CryptoKeyRSA::importJwk):
362         (WebCore::CryptoKeyRSA::exportJwk const):
363         * crypto/keys/CryptoKeyRSA.h:
364         * crypto/keys/CryptoKeyRSAComponents.cpp: Copied from crypto/keys/CryptoKeyDataRSAComponents.cpp.
365         (WebCore::CryptoKeyRSAComponents::CryptoKeyRSAComponents):
366         (WebCore::CryptoKeyRSAComponents::~CryptoKeyRSAComponents):
367         (WebCore::CryptoKeyDataRSAComponents::CryptoKeyDataRSAComponents): Deleted.
368         (WebCore::CryptoKeyDataRSAComponents::~CryptoKeyDataRSAComponents): Deleted.
369         * crypto/keys/CryptoKeyRSAComponents.h: Copied from crypto/keys/CryptoKeyDataRSAComponents.h.
370         (WebCore::CryptoKeyRSAComponents::createPublic):
371         (WebCore::CryptoKeyRSAComponents::createPrivate):
372         (WebCore::CryptoKeyRSAComponents::createPrivateWithAdditionalData):
373         * crypto/keys/CryptoKeyRaw.cpp:
374         (WebCore::CryptoKeyRaw::exportData const): Deleted.
375         * crypto/keys/CryptoKeyRaw.h:
376         * crypto/mac/CryptoKeyRSAMac.cpp:
377         (WebCore::getPrivateKeyComponents):
378         (WebCore::CryptoKeyRSA::create):
379         (WebCore::CryptoKeyRSA::exportData const):
380
381 2017-08-18  Youenn Fablet  <youenn@apple.com>
382
383         [Cache API] Add support for being loaded responses
384         https://bugs.webkit.org/show_bug.cgi?id=175732
385
386         Reviewed by Chris Dumez.
387
388         Covered by existing and rebased tests.
389
390         Introducing a callback-based method to consume the body when the load is finished.
391         Using that new method in Cache::put and calling batchPutOperation when the load is finished.
392
393         Fixing the case of a fetch response being cloned, in which case its body should be marked as ReadableStream.
394
395         * Modules/cache/Cache.cpp:
396         (WebCore::Cache::put): Changing order of checks to reduce test flakiness risks as there is not yet support for putting responses with ReadableStream.
397         (WebCore::toConnectionRecord):
398         (WebCore::Cache::batchPutOperation):
399         * Modules/cache/Cache.h:
400         * Modules/fetch/FetchBody.cpp:
401         (WebCore::FetchBody::readableStreamBody): Deleted.
402         * Modules/fetch/FetchBody.h:
403         (WebCore::FetchBody::loadingBody):
404         (WebCore::FetchBody::setAsReadableStream):
405         * Modules/fetch/FetchResponse.cpp:
406         (WebCore::FetchResponse::BodyLoader::didSucceed):
407         (WebCore::FetchResponse::BodyLoader::didFail):
408         (WebCore::FetchResponse::consumeBody):
409         (WebCore::FetchResponse::consumeBodyWhenLoaded):
410         * Modules/fetch/FetchResponse.h:
411
412 2017-08-18  Chris Dumez  <cdumez@apple.com>
413
414         [Beacon] Improve error reporting
415         https://bugs.webkit.org/show_bug.cgi?id=175723
416
417         Reviewed by Darin Adler.
418
419         Have Ping loads such as beacons report errors via their completion handler.
420         The Beacon API is using this error to log a console message when beacon loads
421         fail, provided that the page is still alive.
422
423         Test: http/wpt/beacon/beacon-async-error-logging.html
424
425         * Modules/beacon/NavigatorBeacon.cpp:
426         (WebCore::NavigatorBeacon::NavigatorBeacon):
427         (WebCore::NavigatorBeacon::~NavigatorBeacon):
428         (WebCore::NavigatorBeacon::from):
429         (WebCore::NavigatorBeacon::supplementName):
430         (WebCore::NavigatorBeacon::notifyFinished):
431         (WebCore::NavigatorBeacon::logError):
432         (WebCore::NavigatorBeacon::sendBeacon):
433         * Modules/beacon/NavigatorBeacon.h:
434         * loader/LoaderStrategy.h:
435         * loader/cache/CachedResource.cpp:
436         (WebCore::CachedResource::load):
437         * loader/cache/CachedResourceLoader.cpp:
438         (WebCore::CachedResourceLoader::requestBeaconResource):
439         * loader/cache/CachedResourceLoader.h:
440         * platform/network/PingHandle.h:
441
442 2017-08-18  Sam Weinig  <sam@webkit.org>
443
444         Remove the deprecated WebKitSubtleCrypto interface
445         https://bugs.webkit.org/show_bug.cgi?id=164938
446         <rdar://problem/29894563>
447
448         Reviewed by Chris Dumez.
449
450         Remove WebKitSubtleCrypto and all of its helper classes / functionality.
451
452         * CMakeLists.txt:
453         * DerivedSources.cpp:
454         * DerivedSources.make:
455         * WebCore.xcodeproj/project.pbxproj:
456         * bindings/js/JSCryptoAlgorithmDictionary.cpp: Removed.
457         * bindings/js/JSCryptoAlgorithmDictionary.h: Removed.
458         * bindings/js/JSCryptoKeySerializationJWK.cpp: Removed.
459         * bindings/js/JSCryptoKeySerializationJWK.h: Removed.
460         * bindings/js/JSCryptoOperationData.cpp: Removed.
461         * bindings/js/JSCryptoOperationData.h: Removed.
462         * bindings/js/JSWebKitSubtleCryptoCustom.cpp: Removed.
463         * crypto/CryptoAlgorithm.cpp:
464         (WebCore::CryptoAlgorithm::deriveKey): Deleted.
465         (WebCore::CryptoAlgorithm::encryptForWrapKey): Deleted.
466         (WebCore::CryptoAlgorithm::decryptForUnwrapKey): Deleted.
467         * crypto/CryptoAlgorithm.h:
468         * crypto/CryptoAlgorithmParametersDeprecated.h: Removed.
469         * crypto/CryptoKeySerialization.h: Removed.
470         * crypto/WebKitSubtleCrypto.cpp: Removed.
471         * crypto/WebKitSubtleCrypto.h: Removed.
472         * crypto/WebKitSubtleCrypto.idl: Removed.
473         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
474         (WebCore::CryptoAlgorithmAES_CBC::keyAlgorithmMatches const): Deleted.
475         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
476         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
477         (WebCore::CryptoAlgorithmAES_KW::encryptForWrapKey): Deleted.
478         (WebCore::CryptoAlgorithmAES_KW::decryptForUnwrapKey): Deleted.
479         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
480         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
481         (WebCore::CryptoAlgorithmHMAC::keyAlgorithmMatches const): Deleted.
482         * crypto/algorithms/CryptoAlgorithmHMAC.h:
483         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
484         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
485         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
486         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::keyAlgorithmMatches const): Deleted.
487         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
488         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
489         (WebCore::CryptoAlgorithmRSA_OAEP::keyAlgorithmMatches const): Deleted.
490         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
491         * crypto/algorithms/CryptoAlgorithmSHA1.cpp:
492         * crypto/algorithms/CryptoAlgorithmSHA1.h:
493         * crypto/algorithms/CryptoAlgorithmSHA224.cpp:
494         * crypto/algorithms/CryptoAlgorithmSHA224.h:
495         * crypto/algorithms/CryptoAlgorithmSHA256.cpp:
496         * crypto/algorithms/CryptoAlgorithmSHA256.h:
497         * crypto/algorithms/CryptoAlgorithmSHA384.cpp:
498         * crypto/algorithms/CryptoAlgorithmSHA384.h:
499         * crypto/algorithms/CryptoAlgorithmSHA512.cpp:
500         * crypto/algorithms/CryptoAlgorithmSHA512.h:
501         * crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp:
502         * crypto/gcrypt/CryptoAlgorithmAES_KWGCrypt.cpp:
503         (WebCore::CryptoAlgorithmAES_KW::platformEncrypt): Deleted.
504         (WebCore::CryptoAlgorithmAES_KW::platformDecrypt): Deleted.
505         * crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp:
506         * crypto/gcrypt/CryptoAlgorithmRSAES_PKCS1_v1_5GCrypt.cpp:
507         * crypto/gcrypt/CryptoAlgorithmRSASSA_PKCS1_v1_5GCrypt.cpp:
508         * crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp:
509         * crypto/keys/CryptoKeySerializationRaw.cpp: Removed.
510         * crypto/keys/CryptoKeySerializationRaw.h: Removed.
511         * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
512         * crypto/mac/CryptoAlgorithmAES_KWMac.cpp:
513         (WebCore::CryptoAlgorithmAES_KW::platformEncrypt): Deleted.
514         (WebCore::CryptoAlgorithmAES_KW::platformDecrypt): Deleted.
515         * crypto/mac/CryptoAlgorithmHMACMac.cpp:
516         * crypto/mac/CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp:
517         * crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
518         * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp:
519         * crypto/parameters/CryptoAlgorithmAesCbcParamsDeprecated.h: Removed.
520         * crypto/parameters/CryptoAlgorithmAesKeyGenParamsDeprecated.h: Removed.
521         * crypto/parameters/CryptoAlgorithmHmacKeyParamsDeprecated.h: Removed.
522         * crypto/parameters/CryptoAlgorithmHmacParamsDeprecated.h: Removed.
523         * crypto/parameters/CryptoAlgorithmRsaKeyGenParamsDeprecated.h: Removed.
524         * crypto/parameters/CryptoAlgorithmRsaKeyParamsWithHashDeprecated.h: Removed.
525         * crypto/parameters/CryptoAlgorithmRsaOaepParamsDeprecated.h: Removed.
526         * crypto/parameters/CryptoAlgorithmRsaSsaParamsDeprecated.h: Removed.
527         * features.json:
528         * page/Crypto.cpp:
529         * page/Crypto.h:
530         * page/Crypto.idl:
531
532 2017-08-18  Tim Horton  <timothy_horton@apple.com>
533
534         Remove classic mode screen scale clamping
535         https://bugs.webkit.org/show_bug.cgi?id=175739
536         <rdar://problem/33894531>
537
538         Reviewed by Andy Estes.
539
540         * platform/ios/PlatformScreenIOS.mm:
541         (WebCore::screenScaleFactor):
542         This code is no longer needed.
543
544 2017-08-18  Daewoong Jang  <daewoong.jang@navercorp.com>
545
546         [Curl] Improve multi-threaded networking
547         https://bugs.webkit.org/show_bug.cgi?id=175713
548
549         Reviewed by Alex Christensen.
550
551         * platform/Curl.cmake:
552         * platform/network/ResourceHandleInternal.h:
553         (WebCore::ResourceHandleInternal::ResourceHandleInternal):
554         (WebCore::ResourceHandleInternal::m_failureTimer): Deleted.
555         * platform/network/curl/CurlCacheManager.cpp:
556         (WebCore::CurlCacheManager::didReceiveResponse):
557         * platform/network/curl/CurlDownload.cpp:
558         (WebCore::CurlDownload::init):
559         (WebCore::CurlDownload::start):
560         (WebCore::CurlDownload::cancel):
561         (WebCore::CurlDownload::retain):
562         (WebCore::CurlDownload::release):
563         (WebCore::CurlDownload::setupRequest):
564         (WebCore::CurlDownload::notifyFinish):
565         (WebCore::CurlDownload::notifyFail):
566         * platform/network/curl/CurlDownload.h:
567         * platform/network/curl/CurlJobManager.cpp:
568         (WebCore::CurlJobList::isEmpty const):
569         (WebCore::CurlJobList::startJobs):
570         (WebCore::CurlJobList::finishJobs):
571         (WebCore::CurlJobList::notifyResult):
572         (WebCore::CurlJobManager::add):
573         (WebCore::CurlJobManager::cancel):
574         (WebCore::CurlJobManager::callOnJobThread):
575         (WebCore::CurlJobManager::startThreadIfNeeded):
576         (WebCore::CurlJobManager::updateJobList):
577         (WebCore::CurlJobManager::workerThread):
578         (WebCore::CurlJobList::append): Deleted.
579         (WebCore::CurlJobList::cancel): Deleted.
580         (WebCore::CurlJobList::complete): Deleted.
581         (WebCore::CurlJobList::withJob): Deleted.
582         (WebCore::CurlJobList::withCurlHandle): Deleted.
583         (WebCore::CurlJob::invoke): Deleted.
584         (WebCore::CurlJobManager::updateJobs): Deleted.
585         * platform/network/curl/CurlJobManager.h:
586         (WebCore::CurlJob::CurlJob): Deleted.
587         (WebCore::CurlJob::~CurlJob): Deleted.
588         (WebCore::CurlJob::operator=): Deleted.
589         (WebCore::CurlJob::curlHandle const): Deleted.
590         (WebCore::CurlJob::ticket const): Deleted.
591         (WebCore::CurlJob::finished): Deleted.
592         (WebCore::CurlJob::error): Deleted.
593         (WebCore::CurlJob::cancel): Deleted.
594         (WebCore::CurlJobManager::isActiveJob const): Deleted.
595         * platform/network/curl/MultipartHandle.cpp:
596         (WebCore::MultipartHandle::didReceiveData):
597         * platform/network/curl/ResourceHandleCurl.cpp:
598         (WebCore::ResourceHandleInternal::~ResourceHandleInternal):
599         (WebCore::ResourceHandle::start):
600         (WebCore::ResourceHandle::cancel):
601         (WebCore::ResourceHandle::platformSetDefersLoading):
602         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
603         (WebCore::ResourceHandle::receivedCredential):
604         (WebCore::ResourceHandle::receivedRequestToContinueWithoutCredential):
605         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
606         (WebCore::ResourceHandleInternal::initialize): Deleted.
607         (WebCore::ResourceHandleInternal::applyAuthentication): Deleted.
608         (WebCore::getFormElementsCount): Deleted.
609         (WebCore::ResourceHandleInternal::setupPUT): Deleted.
610         (WebCore::ResourceHandleInternal::setupPOST): Deleted.
611         (WebCore::ResourceHandleInternal::setupFormData): Deleted.
612         (WebCore::ResourceHandleInternal::didFinish): Deleted.
613         (WebCore::ResourceHandleInternal::didFail): Deleted.
614         (WebCore::ResourceHandleInternal::calculateWebTimingInformations): Deleted.
615         (WebCore::ResourceHandleInternal::handleLocalReceiveResponse): Deleted.
616         (WebCore::isHttpInfo): Deleted.
617         (WebCore::isHttpRedirect): Deleted.
618         (WebCore::isHttpAuthentication): Deleted.
619         (WebCore::isHttpNotModified): Deleted.
620         (WebCore::isAppendableHeader): Deleted.
621         (WebCore::removeLeadingAndTrailingQuotes): Deleted.
622         (WebCore::getProtectionSpace): Deleted.
623         (WebCore::ResourceHandleInternal::willPrepareSendData): Deleted.
624         (WebCore::ResourceHandleInternal::didReceiveHeaderLine): Deleted.
625         (WebCore::ResourceHandleInternal::didReceiveAllHeaders): Deleted.
626         (WebCore::ResourceHandleInternal::didReceiveContentData): Deleted.
627         (WebCore::ResourceHandleInternal::readCallback): Deleted.
628         (WebCore::ResourceHandleInternal::headerCallback): Deleted.
629         (WebCore::ResourceHandleInternal::writeCallback): Deleted.
630         (WebCore::ResourceHandleInternal::dispatchSynchronousJob): Deleted.
631         (WebCore::ResourceHandleInternal::handleDataURL): Deleted.
632         * platform/network/curl/ResourceHandleCurlDelegate.cpp: Added.
633         (WebCore::ResourceHandleCurlDelegate::ResourceHandleCurlDelegate):
634         (WebCore::ResourceHandleCurlDelegate::~ResourceHandleCurlDelegate):
635         (WebCore::ResourceHandleCurlDelegate::hasHandle const):
636         (WebCore::ResourceHandleCurlDelegate::releaseHandle):
637         (WebCore::ResourceHandleCurlDelegate::start):
638         (WebCore::ResourceHandleCurlDelegate::cancel):
639         (WebCore::ResourceHandleCurlDelegate::setDefersLoading):
640         (WebCore::ResourceHandleCurlDelegate::setAuthentication):
641         (WebCore::ResourceHandleCurlDelegate::dispatchSynchronousJob):
642         (WebCore::ResourceHandleCurlDelegate::retain):
643         (WebCore::ResourceHandleCurlDelegate::release):
644         (WebCore::ResourceHandleCurlDelegate::setupRequest):
645         (WebCore::ResourceHandleCurlDelegate::notifyFinish):
646         (WebCore::ResourceHandleCurlDelegate::notifyFail):
647         (WebCore::ResourceHandleCurlDelegate::response):
648         (WebCore::ResourceHandleCurlDelegate::setupAuthentication):
649         (WebCore::removeLeadingAndTrailingQuotes):
650         (WebCore::ResourceHandleCurlDelegate::getProtectionSpace):
651         (WebCore::isHttpInfo):
652         (WebCore::isHttpRedirect):
653         (WebCore::isHttpAuthentication):
654         (WebCore::isHttpNotModified):
655         (WebCore::isAppendableHeader):
656         (WebCore::ResourceHandleCurlDelegate::didReceiveHeaderLine):
657         (WebCore::ResourceHandleCurlDelegate::didReceiveAllHeaders):
658         (WebCore::ResourceHandleCurlDelegate::didReceiveContentData):
659         (WebCore::ResourceHandleCurlDelegate::handleLocalReceiveResponse):
660         (WebCore::ResourceHandleCurlDelegate::prepareSendData):
661         (WebCore::ResourceHandleCurlDelegate::didFinish):
662         (WebCore::ResourceHandleCurlDelegate::didFail):
663         (WebCore::ResourceHandleCurlDelegate::handleDataURL):
664         (WebCore::ResourceHandleCurlDelegate::setupPOST):
665         (WebCore::ResourceHandleCurlDelegate::setupPUT):
666         (WebCore::ResourceHandleCurlDelegate::getFormElementsCount):
667         (WebCore::ResourceHandleCurlDelegate::setupFormData):
668         (WebCore::ResourceHandleCurlDelegate::applyAuthentication):
669         (WebCore::ResourceHandleCurlDelegate::setWebTimings):
670         (WebCore::ResourceHandleCurlDelegate::didReceiveHeader):
671         (WebCore::ResourceHandleCurlDelegate::didReceiveData):
672         (WebCore::ResourceHandleCurlDelegate::willSendData):
673         (WebCore::ResourceHandleCurlDelegate::didReceiveHeaderCallback):
674         (WebCore::ResourceHandleCurlDelegate::didReceiveDataCallback):
675         (WebCore::ResourceHandleCurlDelegate::willSendDataCallback):
676         * platform/network/curl/ResourceHandleCurlDelegate.h: Added.
677
678 2017-08-18  Ryosuke Niwa  <rniwa@webkit.org>
679
680         iOS 10 debug build fix.
681
682         * dom/DataTransfer.cpp:
683         (WebCore::DataTransfer::DataTransfer):
684
685 2017-08-18  Ryosuke Niwa  <rniwa@webkit.org>
686
687         Rename DataTransferAccessPolicy to match spec and refactor related node
688         https://bugs.webkit.org/show_bug.cgi?id=175704
689
690         Reviewed by Wenson Hsieh.
691
692         Renamed DataTransferAccessPolicy to DataTransfer::StoreMode to match the drag data store mode concept
693         in the HTML5 specification:
694         https://html.spec.whatwg.org/multipage/dnd.html#drag-data-store-mode
695
696         DataTransfer in addition to those states can be disassociated from the drag data store when it becomes
697         no longer valid. We also support a special mode which allows only updating the drag image.
698         These two states, Invalid and DragImageWritable, are added in addition to the three states in the spec.
699
700         Also split DragAndDrop type of DataTransfer into DragAndDropData and DragAndDropFiles, and refactored
701         the related code.
702
703         No new tests since there should be no behavioral change.
704
705         * WebCore.xcodeproj/project.pbxproj:
706         * dom/DataTransfer.cpp:
707         (WebCore::DataTransfer::DataTransfer): No longer takes forFileDrag boolean since it's folded into type.
708         (WebCore::DataTransfer::createForCopyAndPaste):
709         (WebCore::DataTransfer::~DataTransfer):
710         (WebCore::DataTransfer::setAccessPolicy): Deleted.
711         (WebCore::DataTransfer::canReadTypes const):
712         (WebCore::DataTransfer::canReadData const):
713         (WebCore::DataTransfer::canWriteData const):
714         (WebCore::DataTransfer::createForInputEvent):
715         (WebCore::DataTransfer::createForDrag):
716         (WebCore::DataTransfer::createForDrop):
717         (WebCore::DataTransfer::canSetDragImage const):
718         * dom/DataTransfer.h:
719         (WebCore::DataTransfer::makeInvalidForSecurity): Added.
720         (WebCore::DataTransfer::makeDragImageWritable): Added.
721         * dom/DataTransferAccessPolicy.h: Removed.
722         * editing/Editor.cpp:
723         (WebCore::dispatchClipboardEvent): Moved and renamed from dispatchCPPEvent. Now computes the store mode
724         inside the function to match the spec: https://w3c.github.io/clipboard-apis/#fire-a-clipboard-event
725         (WebCore::Editor::canDHTMLCut):
726         (WebCore::Editor::canDHTMLCopy):
727         (WebCore::Editor::canDHTMLPaste):
728         (WebCore::Editor::tryDHTMLCopy):
729         (WebCore::Editor::tryDHTMLCut):
730         (WebCore::Editor::tryDHTMLPaste):
731         (WebCore::Editor::dispatchCPPEvent): Deleted.
732         * editing/Editor.h:
733         * page/DragController.cpp:
734         (WebCore::createDataTransferToUpdateDrag): Extracted to share code.
735         (WebCore::DragController::dragExited):
736         (WebCore::DragController::performDragOperation):
737         (WebCore::DragController::tryDHTMLDrag):
738         * page/EventHandler.cpp:
739         (WebCore::EventHandler::invalidateDataTransfer):
740         (WebCore::EventHandler::handleDrag):
741
742 2017-08-18  Said Abou-Hallawa  <sabouhallawa@apple.com>
743
744         Followup (r220289): RenderImageResourceStyleImage code clean up
745         https://bugs.webkit.org/show_bug.cgi?id=175444
746
747         Reviewed by Darin Adler.
748
749         RenderImageResourceStyleImage may be created with a StyleImage of type
750         StyleGeneratedImage. It may also be associated with a CachedImage which 
751         is loaded through a source URL. In this case, adding and removing m_renderer
752         as a client of the CachedImage will be done through 
753         RenderImageResource::setCachedImage().
754
755         RenderImageResource::setCachedImage() is already called from 
756         ImageLoader::updateRenderer() when the CachedImage finishes loading. This
757         call adds m_renderer to the clients of the CachedImage. 
758         RenderImageResource::setCachedImage() will also be called from 
759         RenderImageResourceStyleImage::shutdown() via RenderImageResource::shutdown()
760         to remove m_renderer from the clients of CachedImage by passing a null pointer.
761
762         * rendering/RenderImage.cpp:
763         (WebCore::RenderImage::styleWillChange):
764         * rendering/RenderImageResource.cpp:
765         (WebCore::RenderImageResource::initialize):
766         (WebCore::RenderImageResource::shutdown):
767         (WebCore::RenderImageResource::setCachedImage):
768         (WebCore::RenderImageResource::resetAnimation):
769         (WebCore::RenderImageResource::image const):
770         (WebCore::RenderImageResource::setContainerSizeForRenderer):
771         (WebCore::RenderImageResource::imageSize const):
772         (WebCore::RenderImageResource::~RenderImageResource): Deleted.
773         (WebCore::RenderImageResource::errorOccurred const): Deleted.
774         (WebCore::RenderImageResource::imageHasRelativeWidth const): Deleted.
775         (WebCore::RenderImageResource::imageHasRelativeHeight const): Deleted.
776         (WebCore::RenderImageResource::intrinsicSize const): Deleted.
777         (WebCore::RenderImageResource::getImageSize const): Deleted.
778         * rendering/RenderImageResource.h:
779         (WebCore::RenderImageResource::initialize):
780         (WebCore::RenderImageResource::renderer const):
781         (WebCore::RenderImageResource::errorOccurred const):
782         (WebCore::RenderImageResource::imageHasRelativeWidth const):
783         (WebCore::RenderImageResource::imageHasRelativeHeight const):
784         (WebCore::RenderImageResource::imageSize const):
785         (WebCore::RenderImageResource::intrinsicSize const):
786         (WebCore::RenderImageResource::imagePtr const):
787         * rendering/RenderImageResourceStyleImage.cpp:
788         (WebCore::RenderImageResourceStyleImage::initialize):
789         (WebCore::RenderImageResourceStyleImage::shutdown):
790         (WebCore::RenderImageResourceStyleImage::image const):
791         (WebCore::RenderImageResourceStyleImage::setContainerSizeForRenderer):
792         (WebCore::RenderImageResourceStyleImage::~RenderImageResourceStyleImage): Deleted.
793         * rendering/RenderImageResourceStyleImage.h:
794         * rendering/RenderSnapshottedPlugIn.cpp:
795         (WebCore::RenderSnapshottedPlugIn::RenderSnapshottedPlugIn):
796         * rendering/svg/RenderSVGImage.cpp:
797         (WebCore::RenderSVGImage::RenderSVGImage):
798
799 2017-08-18  Jiewen Tan  <jiewen_tan@apple.com>
800
801         [WebCrypto][Mac] Replace CCECCryptorGetKeyComponents with CCECCryptorExportKey for exporting ECC JWKs
802         https://bugs.webkit.org/show_bug.cgi?id=175657
803         <rdar://problem/33797150>
804
805         Reviewed by Brent Fulgham.
806
807         CCECCryptorGetKeyComponents returns components in unpadded formats. In some minor cases, the ECC components
808         do need padding. Therefore, we occasionally see some corrupted outputs in JWKs. To overcome that, this patch
809         replaces CCECCryptorGetKeyComponents with CCECCryptorExportKey which does padding all the time.
810
811         In the meantime, this patch also makes export* methods return OperationError if any error occur in the
812         underlying operations though very unlikely.
813
814         Test: crypto/subtle/ecdsa-generate-export-import-jwk-sign-verify.html
815
816         * crypto/algorithms/CryptoAlgorithmECDH.cpp:
817         (WebCore::CryptoAlgorithmECDH::exportKey):
818         * crypto/algorithms/CryptoAlgorithmECDSA.cpp:
819         (WebCore::CryptoAlgorithmECDSA::exportKey):
820         * crypto/gcrypt/CryptoKeyECGCrypt.cpp:
821         (WebCore::CryptoKeyEC::platformAddFieldElements const):
822         * crypto/keys/CryptoKeyEC.cpp:
823         (WebCore::CryptoKeyEC::exportRaw const):
824         (WebCore::CryptoKeyEC::exportJwk const):
825         (WebCore::CryptoKeyEC::exportSpki const):
826         (WebCore::CryptoKeyEC::exportPkcs8 const):
827         * crypto/keys/CryptoKeyEC.h:
828         * crypto/mac/CryptoKeyECMac.cpp:
829         (WebCore::CryptoKeyEC::platformExportRaw const):
830         (WebCore::CryptoKeyEC::platformAddFieldElements const):
831         (WebCore::CryptoKeyEC::platformExportSpki const):
832         (WebCore::CryptoKeyEC::platformExportPkcs8 const):
833
834 2017-08-18  Per Arne Vollan  <pvollan@apple.com>
835
836         [Win] accessibility/heading-crash-after-hidden.html is a flaky crash.
837         https://bugs.webkit.org/show_bug.cgi?id=173536
838
839         Reviewed by Brent Fulgham.
840
841         If the tree state is dirty, accessible objects are deleted while iterating over children
842         under AccessibilityNodeObject::textUnderElement when the style is updated. Make sure the
843         style is updated before this method is called.
844
845         No new tests, covered by existing tests.
846
847         * accessibility/win/AccessibilityObjectWrapperWin.cpp:
848         (WebCore::AccessibilityObjectWrapper::accessibilityAttributeValue):
849
850 2017-08-18  Youenn Fablet  <youenn@apple.com>
851
852         [Cache API] Add response body storage
853         https://bugs.webkit.org/show_bug.cgi?id=175658
854
855         Reviewed by Alex Christensen.
856
857         Covered by rebased tests.
858         Tests are still flaky until waiting for end of fetch load is implemented.
859
860         Adding a response body within CacheStorageConnection::Record.
861         Adding ability to pass this body from/to the main thread.
862
863         Adding response body consumption into a CacheStorageConnection::Record.
864         Adding response body setting from a CacheStorageConnection::Record.
865
866         * Modules/beacon/NavigatorBeacon.cpp:
867         (WebCore::NavigatorBeacon::sendBeacon):
868         * Modules/cache/Cache.cpp:
869         (WebCore::Cache::put):
870         (WebCore::toConnectionRecord):
871         (WebCore::Cache::updateRecords):
872         * Modules/cache/CacheStorageConnection.cpp:
873         (WebCore::CacheStorageConnection::copyResponseBody):
874         (WebCore::CacheStorageConnection::isolatedResponseBody):
875         (WebCore::CacheStorageConnection::Record::copy const):
876         * Modules/cache/CacheStorageConnection.h:
877         * Modules/cache/WorkerCacheStorageConnection.cpp:
878         (WebCore::toCrossThreadRecordData):
879         (WebCore::fromCrossThreadRecordData):
880         * Modules/fetch/FetchBody.cpp:
881         (WebCore::FetchBody::bodyAsFormData const):
882         (WebCore::FetchBody::take):
883         (WebCore::FetchBody::bodyForInternalRequest const): Deleted.
884         * Modules/fetch/FetchBody.h:
885         (WebCore::FetchBody::setAsFormData):
886         * Modules/fetch/FetchBodyConsumer.h:
887         (WebCore::FetchBodyConsumer::setData):
888         * Modules/fetch/FetchRequest.cpp:
889         (WebCore::FetchRequest::resourceRequest const):
890         * Modules/fetch/FetchResponse.cpp:
891         (WebCore::FetchResponse::consumeBody):
892         (WebCore::FetchResponse::setBodyData):
893         * Modules/fetch/FetchResponse.h:
894
895 2017-08-18  Youenn Fablet  <youenn@apple.com>
896
897         [Fetch API] Add support for a callback-based fetch
898         https://bugs.webkit.org/show_bug.cgi?id=175710
899
900         Reviewed by Alex Christensen.
901
902         No change of behavior.
903
904         Moving from a DOMPromise to a Callback taking an ExceptionOr<FetchResponse&>.
905         Updating window and worker call sites.
906
907         * Modules/fetch/DOMWindowFetch.cpp:
908         (WebCore::DOMWindowFetch::fetch):
909         * Modules/fetch/FetchResponse.cpp:
910         (WebCore::FetchResponse::fetch):
911         (WebCore::FetchResponse::BodyLoader::didFail):
912         (WebCore::FetchResponse::BodyLoader::BodyLoader):
913         (WebCore::FetchResponse::BodyLoader::didReceiveResponse):
914         (WebCore::FetchResponse::BodyLoader::stop):
915         * Modules/fetch/FetchResponse.h:
916         * Modules/fetch/WorkerGlobalScopeFetch.cpp:
917         (WebCore::WorkerGlobalScopeFetch::fetch):
918
919 2017-08-18  Brady Eidson  <beidson@apple.com>
920
921         Bounce ServiceWorker jobs to the Storage Process.
922         https://bugs.webkit.org/show_bug.cgi?id=175650
923
924         Reviewed by Andy Estes.
925
926         No new tests (Covered by both changes and consistencies in existing tests)
927
928         This lays the groundwork for the SW job queue being in the StorageProcess by actually
929         setting up some objects for IPC communication and actually sending things over the wire.
930
931         The main point of IPC is the WebCore abstract base class "SWServer::Connection"
932
933         A collection of them will soon be managed by the SWServer itself in the StorageProcess.
934
935         That object will be the stand-in for IPC on both the WebProcess and StorageProcess side.
936
937         Currently, any job that we try to schedule still immediately rejects (though now it does
938         so asynchronously instead of synchronously).
939
940         * CMakeLists.txt:
941         * WebCore.xcodeproj/project.pbxproj:
942
943         * dom/ExceptionData.h: Copied from Source/WebCore/workers/service/ServiceWorkerProvider.h.
944         (WebCore::ExceptionData::toException const):
945         (WebCore::ExceptionData::encode const):
946         (WebCore::ExceptionData::decode):
947
948         * workers/service/ServiceWorkerContainer.cpp:
949         (WebCore::ServiceWorkerContainer::addRegistration):
950         (WebCore::ServiceWorkerContainer::scheduleJob):
951         * workers/service/ServiceWorkerContainer.h:
952
953         * workers/service/ServiceWorkerJob.cpp:
954         (WebCore::ServiceWorkerJob::failedWithException):
955         (WebCore::ServiceWorkerJob::data const):
956         * workers/service/ServiceWorkerJob.h:
957
958         * workers/service/ServiceWorkerJobData.h: Copied from Source/WebCore/workers/service/ServiceWorkerProvider.h.
959         (WebCore::ServiceWorkerJobData::encode const):
960         (WebCore::ServiceWorkerJobData::decode):
961
962         * workers/service/ServiceWorkerJobType.h: Copied from Source/WebCore/workers/service/ServiceWorkerProvider.h.
963
964         * workers/service/ServiceWorkerProvider.h:
965
966         * workers/service/ServiceWorkerRegistrationParameters.h:
967
968         * workers/service/server/SWServer.cpp: Copied from Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.cpp.
969         (WebCore::SWServer::Connection::scheduleJob):
970         (WebCore::SWServer::Connection::jobRejected):
971         * workers/service/server/SWServer.h: Copied from Source/WebCore/workers/service/ServiceWorkerProvider.h.
972         (WebCore::SWServer::Connection::~Connection):
973
974 2017-08-18  Chris Dumez  <cdumez@apple.com>
975
976         [Beacon] Add support for quota limitation
977         https://bugs.webkit.org/show_bug.cgi?id=175443
978         <rdar://problem/33729002>
979
980         Reviewed by Youenn Fablet.
981
982         LoaderStrategy::startPingLoad() now takes a completion handler parameter, allowing CachedResource::load()
983         to know when a Beacon load is complete. This was needed in order for the fetch in-flight keepalive request
984         quota limit to work properly for beacon loads as well. We need to know when the beacon load completes in
985         order to know if the beacon is in-flight or not and only free up its allocated quota once it is no longer
986         in-flight.
987
988         No new tests, updated existing test.
989
990         * loader/LoaderStrategy.h:
991         * loader/PingLoader.cpp:
992         (WebCore::PingLoader::startPingLoad):
993         * loader/cache/CachedResource.cpp:
994         (WebCore::CachedResource::load):
995         * platform/network/PingHandle.h:
996
997 2017-08-18  Youenn Fablet  <youenn@apple.com>
998
999         [Cache API] Add a WK2 implementation of CacheStorageConnection
1000         https://bugs.webkit.org/show_bug.cgi?id=175640
1001
1002         Reviewed by Alex Christensen & Chris Dumez.
1003
1004         * Modules/cache/CacheStorageConnection.cpp: Adding Internal error.
1005         * Modules/cache/CacheStorageConnection.h: Ditto.
1006         * WebCore.xcodeproj/project.pbxproj: Exporting CacheQueryOptions.h header.
1007
1008 2017-08-18  Antti Koivisto  <antti@apple.com>
1009
1010         Factor render tree mutation code from RenderListItem to RenderTreeUpdater
1011         https://bugs.webkit.org/show_bug.cgi?id=175718
1012
1013         Reviewed by Andreas Kling.
1014
1015         We already stopped doing layout time mutations. We can now move the code out too.
1016
1017         * WebCore.xcodeproj/project.pbxproj:
1018         * rendering/RenderListItem.cpp:
1019         (WebCore::isHTMLListElement):
1020         (WebCore::getParentOfFirstLineBox): Deleted.
1021         (WebCore::firstNonMarkerChild): Deleted.
1022         (WebCore::RenderListItem::updateMarkerRenderer): Deleted.
1023
1024             Moved to RenderTreeUpdater::ListItem.
1025
1026         * rendering/RenderListItem.h:
1027         * rendering/RenderListMarker.cpp:
1028         (WebCore::RenderListMarker::willBeDestroyed):
1029         * rendering/TextAutoSizing.cpp:
1030         (WebCore::TextAutoSizingValue::adjustTextNodeSizes):
1031         * style/RenderTreeUpdater.cpp:
1032         (WebCore::RenderTreeUpdater::pushParent):
1033         (WebCore::RenderTreeUpdater::popParent):
1034         (WebCore::RenderTreeUpdater::updateBeforeDescendants):
1035         (WebCore::RenderTreeUpdater::updateAfterDescendants):
1036
1037             Factor pre/post update into functions.
1038
1039         (WebCore::RenderTreeUpdater::updateBeforeOrAfterPseudoElement):
1040         * style/RenderTreeUpdater.h:
1041         * style/RenderTreeUpdaterListItem.cpp: Added.
1042
1043             Mutation functions move here.
1044
1045         (WebCore::getParentOfFirstLineBox):
1046         (WebCore::firstNonMarkerChild):
1047         (WebCore::RenderTreeUpdater::ListItem::updateMarker):
1048         * style/RenderTreeUpdaterListItem.h: Added.
1049
1050 2017-08-18  Ms2ger  <Ms2ger@gmail.com>
1051
1052         [GTK] Show controls if a video element isn't allowed to play inline.
1053         https://bugs.webkit.org/show_bug.cgi?id=141705
1054
1055         Reviewed by Xabier Rodriguez-Calvar.
1056
1057         Test: covered by media/video-fullscreeen-only-controls.html [sic].
1058
1059         * Modules/mediacontrols/mediaControlsGtk.js:
1060         (ControllerGtk.prototype.shouldHaveControls):
1061
1062 2017-08-18  Zan Dobersek  <zdobersek@igalia.com>
1063
1064         [EME] MediaKeySession has to initiate playback resume on HTMLMediaElement
1065         https://bugs.webkit.org/show_bug.cgi?id=175671
1066
1067         Reviewed by Xabier Rodriguez-Calvar.
1068
1069         In MediaKeySession::updateKeyStatuses(), HTMLMediaElement objects that are
1070         associated with the MediaKeys instance that created this session have to
1071         be notified in order to run the 'Attempt to Resume Playback If Necessary'
1072         algorithm.
1073
1074         MediaKeys object now tracks the sessions that were created through it.
1075         MediaKeySession object is passed a MediaKeys reference, and has that
1076         reference invalidated if/when the MediaKeys object is destroyed.
1077
1078         In MediaKeySession::updateKeyStatuses(), a task is now queued, notifying
1079         the MediaKeys object, if any, that the associated HTMLMediaElement
1080         instances have to run the mentioned algorithm. The associated media
1081         elements are stored through CDMClient pointers, with HTMLMediaElement
1082         class inheriting from the newly-introduced CDMClient interface.
1083
1084         HTMLMediaElement::cdmClientAttemptToResumePlaybackIfNecessary() is left
1085         unimplemented for now. The object will attach itself to and detach from
1086         the associated MediaKeys object in setMediaKeys() and the destructor,
1087         enabling the MediaKeys object to properly dispatch the playback resume
1088         requests for the attached clients.
1089
1090         * Modules/encryptedmedia/CDMClient.h: Copied from Source/WebCore/Modules/encryptedmedia/MediaKeys.h.
1091         (WebCore::CDMClient::~CDMClient):
1092         * Modules/encryptedmedia/MediaKeySession.cpp:
1093         (WebCore::MediaKeySession::create):
1094         (WebCore::MediaKeySession::MediaKeySession):
1095         (WebCore::MediaKeySession::detachKeys):
1096         (WebCore::MediaKeySession::updateKeyStatuses):
1097         * Modules/encryptedmedia/MediaKeySession.h:
1098         * Modules/encryptedmedia/MediaKeys.cpp:
1099         (WebCore::MediaKeys::~MediaKeys):
1100         (WebCore::MediaKeys::createSession):
1101         (WebCore::MediaKeys::attachCDMClient):
1102         (WebCore::MediaKeys::detachCDMClient):
1103         (WebCore::MediaKeys::attemptToResumePlaybackOnClients):
1104         * Modules/encryptedmedia/MediaKeys.h:
1105         * html/HTMLMediaElement.cpp:
1106         (WebCore::HTMLMediaElement::cdmClientAttemptToResumePlaybackIfNecessary):
1107         * html/HTMLMediaElement.h:
1108
1109 2017-08-18  Commit Queue  <commit-queue@webkit.org>
1110
1111         Unreviewed, rolling out r220854.
1112         https://bugs.webkit.org/show_bug.cgi?id=175716
1113
1114         I'm not sure we really need this (Requested by KaL on
1115         #webkit).
1116
1117         Reverted changeset:
1118
1119         "[GTK][WPE] Add NTLM authentication enabled API"
1120         https://bugs.webkit.org/show_bug.cgi?id=122952
1121         http://trac.webkit.org/changeset/220854
1122
1123 2017-08-17  Wenson Hsieh  <wenson_hsieh@apple.com>
1124
1125         [Input Events] Rename inputType "formatForeColor" to "formatFontColor"
1126         https://bugs.webkit.org/show_bug.cgi?id=175703
1127
1128         Reviewed by Ryosuke Niwa.
1129
1130         Renames an inputType value to match the spec. There is no other change in behavior.
1131         Rebaselines fast/events/input-events-selection-forecolor-data.html and fast/events/input-events-forecolor-data.html.
1132
1133         * editing/EditCommand.cpp:
1134         (WebCore::inputTypeNameForEditingAction):
1135
1136 2017-08-17  Daewoong Jang  <daewoong.jang@navercorp.com>
1137
1138         [Curl] Improve multi-threaded networking
1139         https://bugs.webkit.org/show_bug.cgi?id=175253
1140
1141         Reviewed by Alex Christensen.
1142
1143         * platform/network/curl/CurlContext.cpp:
1144         (WebCore::CurlMultiHandle::CurlMultiHandle):
1145         (WebCore::CurlHandle::CurlHandle):
1146         (WebCore::CurlHandle::initialize):
1147         (WebCore::CurlHandle::setSslKeyPassword):
1148         (WebCore::CurlHandle::setSslErrors):
1149         (WebCore::CurlHandle::getSslErrors):
1150         * platform/network/curl/CurlContext.h:
1151         * platform/network/curl/CurlDownload.cpp:
1152         (WebCore::CurlDownload::init):
1153         (WebCore::CurlDownload::getResponse const):
1154         (WebCore::CurlDownload::setupRequest):
1155         (WebCore::CurlDownload::didReceiveHeader):
1156         (WebCore::CurlDownload::didReceiveData):
1157         (WebCore::CurlDownload::headerCallback):
1158         (WebCore::CurlDownload::getTempPath const): Deleted.
1159         (WebCore::CurlDownload::getUrl const): Deleted.
1160         (WebCore::CurlDownload::downloadFinishedCallback): Deleted.
1161         (WebCore::CurlDownload::downloadFailedCallback): Deleted.
1162         (WebCore::CurlDownload::receivedDataCallback): Deleted.
1163         (WebCore::CurlDownload::receivedResponseCallback): Deleted.
1164         * platform/network/curl/CurlDownload.h:
1165         * platform/network/curl/ResourceError.h:
1166         (WebCore::ResourceError::ResourceError):
1167         (WebCore::ResourceError::sslErrors const):
1168         (WebCore::ResourceError::setSSLErrors): Deleted.
1169         * platform/network/curl/ResourceHandleCurl.cpp:
1170         (WebCore::ResourceHandleInternal::initialize):
1171         (WebCore::ResourceHandleInternal::didFail):
1172         (WebCore::ResourceHandleInternal::dispatchSynchronousJob):
1173         * platform/network/curl/SSLHandle.cpp:
1174         (WebCore::allowedClientHosts):
1175         (WebCore::addAllowedClientCertificate):
1176         (WebCore::getSSLClientCertificate):
1177         (WebCore::certVerifyCallback):
1178         (WebCore::setSSLVerifyOptions):
1179         (WebCore::setSSLClientCertificate): Deleted.
1180         * platform/network/curl/SSLHandle.h:
1181
1182 2017-08-17  Chris Dumez  <cdumez@apple.com>
1183
1184         Regression(r220817): We should only copy the original request headers for Ping loads
1185         https://bugs.webkit.org/show_bug.cgi?id=175679
1186
1187         Reviewed by Youenn Fablet.
1188
1189         For performance reason, we should only copy the original request headers for Ping loads
1190         (Beacon at the moment), not for all CachedResourceRequests.
1191
1192         * loader/LoaderStrategy.h:
1193         * loader/cache/CachedResource.cpp:
1194         (WebCore::CachedResource::CachedResource):
1195         (WebCore::CachedResource::load):
1196         * loader/cache/CachedResource.h:
1197         (WebCore::CachedResource::shouldUsePingLoad):
1198         (WebCore::CachedResource::setOriginalRequestHeaders):
1199         * loader/cache/CachedResourceLoader.cpp:
1200         (WebCore::CachedResourceLoader::requestResource):
1201         * loader/cache/CachedResourceRequest.cpp:
1202         (WebCore::CachedResourceRequest::CachedResourceRequest):
1203         * loader/cache/CachedResourceRequest.h:
1204         (WebCore::CachedResourceRequest::releaseResourceRequest):
1205         (WebCore::CachedResourceRequest::releaseOriginalRequestHeaders): Deleted.
1206
1207 2017-08-17  Don Olmstead  <don.olmstead@sony.com>
1208
1209         [PAL] Relocate SessionID to root
1210         https://bugs.webkit.org/show_bug.cgi?id=175684
1211
1212         Reviewed by Alex Christensen.
1213
1214         No new tests. No change in functionality.
1215
1216         * dom/Document.h:
1217         * html/HTMLMediaElement.cpp:
1218         * loader/cache/CachedResource.h:
1219         * loader/cache/CachedResourceLoader.cpp:
1220         * loader/cache/MemoryCache.h:
1221         * loader/cocoa/DiskCacheMonitorCocoa.h:
1222         * page/CacheStorageProvider.h:
1223         * page/Page.h:
1224         * page/PlugInClient.h:
1225         * page/SocketProvider.h:
1226         * platform/CookiesStrategy.h:
1227         * platform/WebCoreCrossThreadCopier.cpp:
1228         * platform/network/CacheValidation.h:
1229         * platform/network/NetworkStorageSession.cpp:
1230         * platform/network/NetworkStorageSession.h:
1231         * platform/network/cf/SocketStreamHandleImpl.h:
1232         * platform/network/curl/SocketStreamHandleImpl.h:
1233         * platform/network/soup/SocketStreamHandleImpl.h:
1234         * workers/WorkerGlobalScope.h:
1235         * workers/service/ServiceWorkerContainer.h:
1236         * workers/service/ServiceWorkerRegistrationParameters.h:
1237
1238 2017-08-17  Wenson Hsieh  <wenson_hsieh@apple.com>
1239
1240         Fix the build on other platforms after r220865
1241         https://bugs.webkit.org/show_bug.cgi?id=175683
1242
1243         Reviewed by Tim Horton.
1244
1245         Instead of special casing iOS 10 behavior with __IPHONE_OS_VERSION_MAX_ALLOWED < 110000, revert to special
1246         casing iOS 11 behavior with __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000. This is because other targets that are
1247         neither iOS 10 nor 11 will fail the "before iOS 11" compile-time check, and subsequently assume that item
1248         providers exist. To fix this, flip the compiler-time checks and the order of codeblocks in the
1249         PlatformPasteboard::write methods.
1250
1251         There is no change in behavior.
1252
1253         * platform/ios/PlatformPasteboardIOS.mm:
1254         (WebCore::registerItemToPasteboard):
1255         (WebCore::PlatformPasteboard::write):
1256
1257 2017-08-17  Michael Catanzaro  <mcatanzaro@igalia.com>
1258
1259         -Wreturn-type warnings in CryptoKey.cpp and SubtleCrypto.cpp
1260         https://bugs.webkit.org/show_bug.cgi?id=175675
1261
1262         Reviewed by Jiewen Tan.
1263
1264         * crypto/CryptoKey.cpp:
1265         (WebCore::CryptoKey::algorithm const):
1266         * crypto/SubtleCrypto.cpp:
1267         (WebCore::toCryptoKeyUsageBitmap):
1268         (WebCore::toKeyData):
1269
1270 2017-08-17  Andreas Kling  <akling@apple.com>
1271
1272         Disable CSS regions at compile time
1273         https://bugs.webkit.org/show_bug.cgi?id=175630
1274
1275         Reviewed by Antti Koivisto.
1276
1277         * Configurations/FeatureDefines.xcconfig:
1278
1279 2017-08-17  Wenson Hsieh  <wenson_hsieh@apple.com>
1280
1281         [iOS] Respect type fidelities when copying image elements to the pasteboard
1282         https://bugs.webkit.org/show_bug.cgi?id=175638
1283         <rdar://problem/26556043>
1284
1285         Reviewed by Ryosuke Niwa.
1286
1287         Ensures that we respect type fidelities when copying on iOS, by unifying pasteboard writing codepaths across
1288         dragging and copying. When dragging and copying, we now generate and set UIItemProviders on the UIPasteboard.
1289
1290         Tests: ActionSheetTests.CopyImageElementWithHREF
1291                ActionSheetTests.CopyImageElementWithoutHREF
1292
1293         * platform/PlatformPasteboard.h:
1294
1295         Remove all variants of the writeObjectRepresentations helper method. Now that both paths for writing to the
1296         pasteboard are unified, it's no longer useful to separate out item-provider-based pasteboard logic.
1297
1298         * platform/ios/AbstractPasteboard.h:
1299         * platform/ios/PlatformPasteboardIOS.mm:
1300
1301         Replaces -setItemsUsingRegistrationInfoLists: with -setRegistrationInfoLists:. Rather than have a helper that
1302         both sets up item providers and item registration lists, split this functionality out into two setters. This is
1303         because UIPasteboard does not need to know about the registration info lists used to set up the item providers
1304         in the first place, but internal drag-and-drop clients require this information immediately when starting a drag
1305         in order to construct custom drag previews.
1306
1307         (WebCore::richTextRepresentationsForPasteboardWebContent):
1308         (WebCore::registerItemToPasteboard):
1309
1310         Add a new helper to register item providers to the pasteboard, given an WebItemProviderRegistrationInfoList.
1311
1312         (WebCore::PlatformPasteboard::write):
1313         (WebCore::PlatformPasteboard::writeObjectRepresentations): Deleted.
1314
1315         Refactors PlatformPasteboard::write to always generate and set item providers, unless we're building for an SDK
1316         prior to iOS 11. For images, strings and URLs, we can simply transition to using the new item-provider-based
1317         codepaths used for drag and drop. For web content, we add two additional UTIs that were present when copying,
1318         but not when dragging: flat RTFD and a string constant used to indicate to UIKit that the pasteboard contains
1319         rich text.
1320
1321         * platform/ios/WebItemProviderPasteboard.h:
1322         * platform/ios/WebItemProviderPasteboard.mm:
1323         (-[WebItemProviderRegistrationInfoList init]):
1324         (-[WebItemProviderRegistrationInfoList addData:forType:]):
1325         (-[WebItemProviderRegistrationInfoList addRepresentingObject:]):
1326         (-[WebItemProviderRegistrationInfoList numberOfItems]):
1327         (-[WebItemProviderRegistrationInfoList itemAtIndex:]):
1328         (-[WebItemProviderRegistrationInfoList itemProvider]):
1329         (-[WebItemProviderRegistrationInfoList description]):
1330
1331         Make some small tweaks in WebItemProviderPasteboard (and related classes):
1332         1. Transition to preferredPresentationSize from estimatedDisplayedSize, which is now deprecated.
1333         2. Remove calls to -initWithItemProviderData:typeIdentifier:error:, which is deprecated.
1334         3. Rename _items to _representations to better reflect the role of WebItemProviderRegistrationInfo.
1335         4. Implement -description for WebItemProviderRegistrationInfoList for debugging purposes.
1336
1337         (-[WebItemProviderPasteboard valuesForPasteboardType:inItemSet:]):
1338         (-[WebItemProviderPasteboard setRegistrationInfoLists:]):
1339         (-[WebItemProviderPasteboard setItemsUsingRegistrationInfoLists:]): Deleted.
1340
1341 2017-08-17  Youenn Fablet  <youenn@apple.com>
1342
1343         Add a DOMPromiseDeferred method to handle ExceptionOr<> results
1344         https://bugs.webkit.org/show_bug.cgi?id=175603
1345
1346         Reviewed by Darin Adler.
1347
1348         No change of behavior.
1349
1350         Introduce DOMPromiseDeferred::settle to reject/resolve a promise with an ExceptionOr<>.
1351         Making batchPutOperation/batchDeleteOperation take a Function with an ExceptionOr<>.
1352         Using DOMPromiseDeferred::settle in Cache put/remove.
1353         Updated CacheStorageConnection to create ExceptionOr<> from CacheStorageConnection::Error.
1354
1355         * Modules/cache/Cache.cpp:
1356         (WebCore::Cache::put):
1357         (WebCore::Cache::remove):
1358         (WebCore::Cache::batchDeleteOperation):
1359         (WebCore::Cache::batchPutOperation):
1360         * Modules/cache/Cache.h:
1361         * Modules/cache/CacheStorage.cpp:
1362         (WebCore::CacheStorage::open):
1363         (WebCore::CacheStorage::remove):
1364         * Modules/cache/CacheStorageConnection.cpp:
1365         (WebCore::CacheStorageConnection::errorToException):
1366         * Modules/cache/CacheStorageConnection.h:
1367         (WebCore::CacheStorageConnection::errorToException):
1368         (WebCore::CacheStorageConnection::exceptionOrResult):
1369         * bindings/js/JSDOMPromiseDeferred.h:
1370         (WebCore::DOMPromiseDeferred::settle):
1371         (WebCore::DOMPromiseDeferred<void>::settle):
1372
1373 2017-08-17  Zan Dobersek  <zdobersek@igalia.com>
1374
1375         [GStreamer] AppendPipeline: support dispatch of decryption-specific GstStructure into the pipeline
1376         https://bugs.webkit.org/show_bug.cgi?id=175668
1377
1378         Reviewed by Xabier Rodriguez-Calvar.
1379
1380         Add the AppendPipeline::dispatchDecryptionStructure() method. Callers can
1381         pass in a GstStructure object that contains all the information the
1382         decryption elements in the pipeline will require to properly decrypt the
1383         content. In case the decryptor element isn't available yet, the
1384         GstStructure is stored and dispatched when that element becomes available.
1385
1386         The dispatch itself simply creates a new custom GstEvent that adopts the
1387         given GstStructure object, sends that into the pipeline element, and
1388         shifts the state to 'ongoing'.
1389
1390         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
1391         (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsinkFromAnyThread):
1392         (WebCore::AppendPipeline::dispatchPendingDecryptionStructure):
1393         (WebCore::AppendPipeline::dispatchDecryptionStructure):
1394         * platform/graphics/gstreamer/mse/AppendPipeline.h: Remove a redundant private: label.
1395
1396 2017-08-17  Zan Dobersek  <zdobersek@igalia.com>
1397
1398         [GStreamer] GstStructure shouldn't be handled through GRefPtr
1399         https://bugs.webkit.org/show_bug.cgi?id=175673
1400
1401         Reviewed by Xabier Rodriguez-Calvar.
1402
1403         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
1404         (webkitMediaCommonEncryptionDecryptTransformCaps): GstStructure isn't
1405         ref-counted, so it should be handled through the GUniquePtr<GstStructure>
1406         smart pointer.
1407
1408 2017-08-17  Youenn Fablet  <youenn@apple.com>
1409
1410         [Mac/iOS] Increase the audio buffer size when audio capture is on but web audio is not used
1411         https://bugs.webkit.org/show_bug.cgi?id=175631
1412
1413         Reviewed by Eric Carlson.
1414
1415         * platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
1416         (PlatformMediaSessionManager::updateSessionState): Change value from 128 to the equivalent of 20ms when audio capture happens but not web audio.
1417
1418 2017-08-17  Antti Koivisto  <antti@apple.com>
1419
1420         RenderListItem - Avoid render tree mutation during layout
1421         https://bugs.webkit.org/show_bug.cgi?id=175666
1422
1423         Reviewed by Andreas Kling.
1424
1425         Mutations should be done by RenderTreeUpdater only.
1426
1427         * rendering/RenderListItem.cpp:
1428         (WebCore::RenderListItem::updateMarkerRenderer):
1429
1430             This is now called by RenderTreeUpdater only.
1431             Remove code dealing with this being called at layout time.
1432             Merged marker construction code from styleDidChange here and renamed for clarity.
1433
1434         (WebCore::RenderListItem::layout):
1435         (WebCore::RenderListItem::computePreferredLogicalWidths):
1436
1437             Remove mutating calls.
1438
1439         (WebCore::RenderListItem::styleDidChange): Deleted.
1440         (WebCore::RenderListItem::insertOrMoveMarkerRendererIfNeeded): Deleted.
1441         * rendering/RenderListItem.h:
1442         * rendering/TextAutoSizing.cpp:
1443         (WebCore::TextAutoSizingValue::adjustTextNodeSizes):
1444
1445             Call updateMarkerRenderer.
1446
1447         * style/RenderTreeUpdater.cpp:
1448         (WebCore::RenderTreeUpdater::popParent):
1449         (WebCore::RenderTreeUpdater::updateBeforeOrAfterPseudoElement):
1450
1451             Call updateMarkerRenderer.
1452
1453 2017-08-17  Don Olmstead  <don.olmstead@sony.com>
1454
1455         [PAL] Move SessionID into PAL
1456         https://bugs.webkit.org/show_bug.cgi?id=174192
1457
1458         Reviewed by Antti Koivisto.
1459
1460         No new tests. No change in behavior.
1461
1462         * CMakeLists.txt:
1463         * Modules/websockets/WebSocketChannel.cpp:
1464         (WebCore::WebSocketChannel::connect):
1465         * WebCore.xcodeproj/project.pbxproj:
1466         * dom/Document.cpp:
1467         (WebCore::Document::sessionID const):
1468         * dom/Document.h:
1469         * dom/ScriptExecutionContext.h:
1470         * html/HTMLMediaElement.cpp:
1471         (WebCore::HTMLMediaElement::elementWithID):
1472         (WebCore::HTMLMediaElement::finishParsingChildren):
1473         (WebCore::HTMLMediaElement::scheduleEvent):
1474         (WebCore::HTMLMediaElement::canPlayType const):
1475         (WebCore::HTMLMediaElement::load):
1476         (WebCore::HTMLMediaElement::loadResource):
1477         (WebCore::HTMLMediaElement::textTracksAreReady const):
1478         (WebCore::HTMLMediaElement::textTrackModeChanged):
1479         (WebCore::HTMLMediaElement::noneSupported):
1480         (WebCore::HTMLMediaElement::mediaLoadingFailedFatally):
1481         (WebCore::HTMLMediaElement::mediaLoadingFailed):
1482         (WebCore::HTMLMediaElement::setReadyState):
1483         (WebCore::HTMLMediaElement::addPlayedRange):
1484         (WebCore::HTMLMediaElement::seekTask):
1485         (WebCore::HTMLMediaElement::refreshCachedTime const):
1486         (WebCore::HTMLMediaElement::currentMediaTime const):
1487         (WebCore::HTMLMediaElement::setWebkitPreservesPitch):
1488         (WebCore::HTMLMediaElement::ended const):
1489         (WebCore::HTMLMediaElement::playInternal):
1490         (WebCore::HTMLMediaElement::pause):
1491         (WebCore::HTMLMediaElement::togglePlayState):
1492         (WebCore::HTMLMediaElement::beginScrubbing):
1493         (WebCore::HTMLMediaElement::playbackProgressTimerFired):
1494         (WebCore::HTMLMediaElement::mediaPlayerDidAddTextTrack):
1495         (WebCore::HTMLMediaElement::didAddTextTrack):
1496         (WebCore::HTMLMediaElement::didRemoveTextTrack):
1497         (WebCore::controllerJSValue):
1498         (WebCore::HTMLMediaElement::configureTextTracks):
1499         (WebCore::HTMLMediaElement::selectNextSourceChild):
1500         (WebCore::HTMLMediaElement::sourceWasAdded):
1501         (WebCore::HTMLMediaElement::sourceWasRemoved):
1502         (WebCore::HTMLMediaElement::mediaPlayerTimeChanged):
1503         (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged):
1504         (WebCore::HTMLMediaElement::potentiallyPlaying const):
1505         (WebCore::HTMLMediaElement::endedPlayback const):
1506         (WebCore::HTMLMediaElement::stoppedDueToErrors const):
1507         (WebCore::HTMLMediaElement::updatePlayState):
1508         (WebCore::HTMLMediaElement::userCancelledLoad):
1509         (WebCore::HTMLMediaElement::canSuspendForDocumentSuspension const):
1510         (WebCore::HTMLMediaElement::addEventListener):
1511         (WebCore::HTMLMediaElement::isFullscreen const):
1512         (WebCore::HTMLMediaElement::toggleStandardFullscreenState):
1513         (WebCore::HTMLMediaElement::waitForPreparedForInlineThen):
1514         (WebCore::HTMLMediaElement::setVideoFullscreenLayer):
1515         (WebCore::HTMLMediaElement::updateTextTrackDisplay):
1516         (WebCore::HTMLMediaElement::mediaControls const):
1517         (WebCore::HTMLMediaElement::configureTextTrackDisplay):
1518         (WebCore::HTMLMediaElement::setMediaGroup):
1519         (WebCore::HTMLMediaElement::setControllerForBindings):
1520         (WebCore::HTMLMediaElement::isBlockedOnMediaController const):
1521         (WebCore::HTMLMediaElement::prepareMediaFragmentURI):
1522         (WebCore::HTMLMediaElement::didAddUserAgentShadowRoot):
1523         (WebCore::HTMLMediaElement::fileSize const):
1524         (WebCore::HTMLMediaElement::mediaSessionTitle const):
1525         (WebCore::needsSeekingSupportQuirk):
1526         (WebCore::HTMLMediaElement::supportsSeeking const):
1527         (WebCore::HTMLMediaElement::doesHaveAttribute const):
1528         (WebCore::HTMLMediaElement::isVideoTooSmallForInlinePlayback):
1529         * loader/DocumentLoader.cpp:
1530         (WebCore::DocumentLoader::continueAfterContentPolicy):
1531         * loader/EmptyClients.cpp:
1532         * loader/FrameLoaderClient.h:
1533         * loader/cache/CachedCSSStyleSheet.cpp:
1534         (WebCore::CachedCSSStyleSheet::CachedCSSStyleSheet):
1535         * loader/cache/CachedCSSStyleSheet.h:
1536         * loader/cache/CachedFont.cpp:
1537         (WebCore::CachedFont::CachedFont):
1538         * loader/cache/CachedFont.h:
1539         * loader/cache/CachedImage.cpp:
1540         (WebCore::CachedImage::CachedImage):
1541         * loader/cache/CachedImage.h:
1542         * loader/cache/CachedRawResource.cpp:
1543         (WebCore::CachedRawResource::CachedRawResource):
1544         * loader/cache/CachedRawResource.h:
1545         * loader/cache/CachedResource.cpp:
1546         (WebCore::CachedResource::CachedResource):
1547         * loader/cache/CachedResource.h:
1548         (WebCore::CachedResource::sessionID const):
1549         * loader/cache/CachedResourceLoader.cpp:
1550         (WebCore::createResource):
1551         (WebCore::CachedResourceLoader::sessionID const):
1552         * loader/cache/CachedResourceLoader.h:
1553         * loader/cache/CachedSVGDocument.cpp:
1554         (WebCore::CachedSVGDocument::CachedSVGDocument):
1555         * loader/cache/CachedSVGDocument.h:
1556         * loader/cache/CachedSVGFont.cpp:
1557         (WebCore::CachedSVGFont::CachedSVGFont):
1558         * loader/cache/CachedSVGFont.h:
1559         * loader/cache/CachedScript.cpp:
1560         (WebCore::CachedScript::CachedScript):
1561         * loader/cache/CachedScript.h:
1562         * loader/cache/CachedTextTrack.cpp:
1563         (WebCore::CachedTextTrack::CachedTextTrack):
1564         * loader/cache/CachedTextTrack.h:
1565         * loader/cache/CachedXSLStyleSheet.cpp:
1566         (WebCore::CachedXSLStyleSheet::CachedXSLStyleSheet):
1567         * loader/cache/CachedXSLStyleSheet.h:
1568         * loader/cache/MemoryCache.cpp:
1569         (WebCore::MemoryCache::sessionResourceMap const):
1570         (WebCore::MemoryCache::ensureSessionResourceMap):
1571         (WebCore::MemoryCache::resourceForRequest):
1572         (WebCore::MemoryCache::addImageToCache):
1573         (WebCore::MemoryCache::removeImageFromCache):
1574         (WebCore::MemoryCache::forEachSessionResource):
1575         (WebCore::MemoryCache::removeResourcesWithOrigins):
1576         (WebCore::MemoryCache::originsWithCache const):
1577         (WebCore::MemoryCache::evictResources):
1578         * loader/cache/MemoryCache.h:
1579         * loader/cocoa/DiskCacheMonitorCocoa.h:
1580         (WebCore::DiskCacheMonitor::sessionID const):
1581         * loader/cocoa/DiskCacheMonitorCocoa.mm:
1582         (WebCore::DiskCacheMonitor::monitorFileBackingStoreCreation):
1583         (WebCore::DiskCacheMonitor::DiskCacheMonitor):
1584         * page/CacheStorageProvider.h:
1585         * page/DatabaseProvider.h:
1586         * page/Page.cpp:
1587         (WebCore::Page::Page):
1588         (WebCore::Page::enableLegacyPrivateBrowsing):
1589         (WebCore::Page::sessionID const):
1590         (WebCore::Page::setSessionID):
1591         * page/Page.h:
1592         * page/PlugInClient.h:
1593         * page/SocketProvider.cpp:
1594         (WebCore::SocketProvider::createSocketStreamHandle):
1595         * page/SocketProvider.h:
1596         * platform/CookiesStrategy.h:
1597         * platform/WebCoreCrossThreadCopier.cpp:
1598         (WTF::PAL::SessionID>::copy):
1599         (WTF::WebCore::SessionID>::copy): Deleted.
1600         * platform/WebCoreCrossThreadCopier.h:
1601         * platform/network/CacheValidation.cpp:
1602         (WebCore::headerValueForVary):
1603         (WebCore::collectVaryingRequestHeaders):
1604         (WebCore::verifyVaryingRequestHeaders):
1605         * platform/network/CacheValidation.h:
1606         * platform/network/NetworkStorageSession.cpp:
1607         (WebCore::NetworkStorageSession::globalSessionMap):
1608         (WebCore::NetworkStorageSession::storageSession):
1609         (WebCore::NetworkStorageSession::destroySession):
1610         * platform/network/NetworkStorageSession.h:
1611         (WebCore::NetworkStorageSession::sessionID const):
1612         * platform/network/NetworkStorageSessionStub.cpp:
1613         (WebCore::NetworkStorageSession::NetworkStorageSession):
1614         (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession):
1615         (WebCore::NetworkStorageSession::ensureSession):
1616         (WebCore::NetworkStorageSession::defaultStorageSession):
1617         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
1618         (WebCore::NetworkStorageSession::NetworkStorageSession):
1619         (WebCore::NetworkStorageSession::switchToNewTestingSession):
1620         (WebCore::NetworkStorageSession::defaultStorageSession):
1621         (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession):
1622         (WebCore::NetworkStorageSession::ensureSession):
1623         * platform/network/cf/SocketStreamHandleImpl.h:
1624         (WebCore::SocketStreamHandleImpl::create):
1625         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
1626         (WebCore::SocketStreamHandleImpl::SocketStreamHandleImpl):
1627         * platform/network/curl/SocketStreamHandleImpl.h:
1628         (WebCore::SocketStreamHandleImpl::create):
1629         * platform/network/soup/NetworkStorageSessionSoup.cpp:
1630         (WebCore::NetworkStorageSession::NetworkStorageSession):
1631         (WebCore::NetworkStorageSession::defaultStorageSession):
1632         (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession):
1633         (WebCore::NetworkStorageSession::ensureSession):
1634         (WebCore::NetworkStorageSession::switchToNewTestingSession):
1635         * platform/network/soup/SocketStreamHandleImpl.h:
1636         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
1637         (WebCore::SocketStreamHandleImpl::create):
1638         * workers/DedicatedWorkerGlobalScope.cpp:
1639         (WebCore::DedicatedWorkerGlobalScope::create):
1640         (WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope):
1641         * workers/DedicatedWorkerGlobalScope.h:
1642         * workers/DedicatedWorkerThread.cpp:
1643         (WebCore::DedicatedWorkerThread::DedicatedWorkerThread):
1644         (WebCore::DedicatedWorkerThread::createWorkerGlobalScope):
1645         * workers/DedicatedWorkerThread.h:
1646         * workers/Worker.cpp:
1647         (WebCore::Worker::notifyFinished):
1648         * workers/WorkerGlobalScope.cpp:
1649         (WebCore::WorkerGlobalScope::WorkerGlobalScope):
1650         * workers/WorkerGlobalScope.h:
1651         * workers/WorkerGlobalScopeProxy.h:
1652         * workers/WorkerMessagingProxy.cpp:
1653         (WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
1654         * workers/WorkerMessagingProxy.h:
1655         * workers/WorkerThread.cpp:
1656         (WebCore::WorkerThreadStartupData::WorkerThreadStartupData):
1657         (WebCore::WorkerThread::WorkerThread):
1658         * workers/WorkerThread.h:
1659         * workers/service/ServiceWorkerContainer.h:
1660         * workers/service/ServiceWorkerRegistrationParameters.h:
1661
1662 2017-08-17  Carlos Garcia Campos  <cgarcia@igalia.com>
1663
1664         [GTK][WPE] Add NTLM authentication enabled API
1665         https://bugs.webkit.org/show_bug.cgi?id=122952
1666
1667         Reviewed by Michael Catanzaro.
1668
1669         Add/remove NTLM feature to/from soup session depending on whether the feature is enabled or disabled.
1670
1671         * platform/network/soup/SoupNetworkSession.cpp:
1672         (WebCore::SoupNetworkSession::SoupNetworkSession):
1673         (WebCore::SoupNetworkSession::setInitialNTLMAuthenticationEnabled):
1674         (WebCore::SoupNetworkSession::setNTLMAuthenticationEnabled):
1675         * platform/network/soup/SoupNetworkSession.h:
1676
1677 2017-08-16  Ryosuke Niwa  <rniwa@webkit.org>
1678
1679         Add the support for mutating clipboard data via DataTransferItemList
1680         https://bugs.webkit.org/show_bug.cgi?id=175639
1681
1682         Reviewed by Wenson Hsieh.
1683
1684         Added the support for adding plaintext data via dataTransfer.items.add, clearing data via clear,
1685         and removing an entry via remove. When DataTransferItem is removed from DataTransferItemList,
1686         we must put into the disabled mode.
1687
1688         To support the removal of DataTransferItem, this patch replaces a reference to DataTransfer by
1689         a WeakPtr to DataTransferItemList, and stops forwarding ref from DataTransferItem to DataTransfer.
1690         This means that DataTransfer can now be GC'ed before DataTransferItem is GC'ed.
1691
1692         Because the identify and the order of DataTransferItems need to be preserved, we can't simply
1693         re-popluate m_itemList in DataTransferItemList. Instead, whenever the clipboard content is mutated,
1694         we make the parallel modifications to m_itemList. This includes changes made via DataTransfer
1695         methods such as setData and clearData.
1696
1697         Test: editing/pasteboard/datatransfer-items-copy-plaintext.html
1698
1699         * dom/DataTransfer.cpp:
1700         (WebCore::DataTransfer::clearData): Invoke didClearStringData when m_itemList exists.
1701         (WebCore::DataTransfer::setData): Ditto.
1702         (WebCore::DataTransfer::createForInputEvent):
1703         (WebCore::DataTransfer::createForDrag):
1704         (WebCore::DataTransfer::createForDrop):
1705         * dom/DataTransferItem.cpp:
1706         (WebCore::DataTransferItem::create):
1707         (WebCore::DataTransferItem::DataTransferItem):
1708         (WebCore::DataTransferItem::clearListAndPutIntoDisabledMode): Added.
1709         (WebCore::DataTransferItem::type const): Moved from the header.
1710         (WebCore::DataTransferItem::getAsString const):
1711         (WebCore::DataTransferItem::getAsFile const):
1712         * dom/DataTransferItem.h:
1713         (WebCore::DataTransferItem::ref): Deleted.
1714         (WebCore::DataTransferItem::deref): Deleted.
1715         (WebCore::DataTransferItem::isFile const): Added.
1716         (WebCore::DataTransferItem::type const): Move to the cpp file.
1717         * dom/DataTransferItemList.cpp:
1718         (WebCore::isSupportedType): Moved.
1719         (WebCore::DataTransferItemList::DataTransferItemList): Moved from the header.
1720         (WebCore::DataTransferItemList::~DataTransferItemList): Added.
1721         (WebCore::DataTransferItemList::item):
1722         (WebCore::DataTransferItemList::add): Implemented the variant to add string data.
1723         (WebCore::DataTransferItemList::remove): Implemented. For now, we don't have to deal with removing
1724         a file since a writable dataTransfer never contains a File object.
1725         (WebCore::DataTransferItemList::clear): Implemented.
1726         (WebCore::DataTransferItemList::ensureItems const):
1727         (WebCore::removeStringItemOfLowercasedType): Added.
1728         (WebCore::DataTransferItemList::didClearStringData): Called when dataTransfer.clear is called.
1729         (WebCore::DataTransferItemList::didSetStringData): Ditto for 
1730         * dom/DataTransferItemList.h:
1731         (WebCore::DataTransferItemList): Added a WeakPtrFactory. Also use a vector of Ref<DataTransferItem>
1732         instead of unique_ptr<DataTransferItem> since DataTransferItem can outlive DataTransferItemList.
1733         (WebCore::DataTransferItemList::dataTransfer): Added.
1734         * dom/DataTransferItemList.idl:
1735
1736 2017-08-16  Andy Estes  <aestes@apple.com>
1737
1738         [Apple Pay] Rename PaymentRequest to ApplePaySessionPaymentRequest
1739         https://bugs.webkit.org/show_bug.cgi?id=175648
1740
1741         Reviewed by Tim Horton.
1742
1743         The W3C Payment Request API defines an interface called PaymentRequest, which conflicts with
1744         an existing Apple Pay class. This patch renames PaymentRequest to
1745         ApplePaySessionPaymentRequest so that a follow-on patch can introduce PaymentRequest for the
1746         W3C API.
1747
1748         * Modules/applepay/ApplePayError.h:
1749         * Modules/applepay/ApplePayLineItem.h:
1750         * Modules/applepay/ApplePayPaymentRequest.h:
1751         * Modules/applepay/ApplePaySession.cpp:
1752         (WebCore::convertAndValidateTotal):
1753         (WebCore::convertAndValidate):
1754         (WebCore::ApplePaySession::ApplePaySession):
1755         (WebCore::ApplePaySession::didSelectShippingMethod):
1756         * Modules/applepay/ApplePaySession.h:
1757         * Modules/applepay/ApplePaySessionPaymentRequest.cpp: Renamed from Source/WebCore/Modules/applepay/PaymentRequest.cpp.
1758         (WebCore::ApplePaySessionPaymentRequest::ApplePaySessionPaymentRequest):
1759         (WebCore::ApplePaySessionPaymentRequest::~ApplePaySessionPaymentRequest):
1760         (WebCore::ApplePaySessionPaymentRequest::isValidSupportedNetwork):
1761         * Modules/applepay/ApplePaySessionPaymentRequest.h: Renamed from Source/WebCore/Modules/applepay/PaymentRequest.h.
1762         * Modules/applepay/ApplePayShippingMethodSelectedEvent.cpp:
1763         (WebCore::convert):
1764         (WebCore::ApplePayShippingMethodSelectedEvent::ApplePayShippingMethodSelectedEvent):
1765         * Modules/applepay/ApplePayShippingMethodSelectedEvent.h:
1766         * Modules/applepay/PaymentCoordinator.cpp:
1767         (WebCore::PaymentCoordinator::beginPaymentSession):
1768         (WebCore::PaymentCoordinator::didSelectShippingMethod):
1769         * Modules/applepay/PaymentCoordinator.h:
1770         * Modules/applepay/PaymentCoordinatorClient.h:
1771         * Modules/applepay/PaymentHeaders.h:
1772         * Modules/applepay/PaymentRequestValidator.cpp:
1773         (WebCore::PaymentRequestValidator::validate):
1774         (WebCore::PaymentRequestValidator::validateTotal):
1775         (WebCore::validateMerchantCapabilities):
1776         (WebCore::validateShippingMethod):
1777         (WebCore::validateShippingMethods):
1778         * Modules/applepay/PaymentRequestValidator.h:
1779         * WebCore.xcodeproj/project.pbxproj:
1780         * loader/EmptyClients.cpp:
1781
1782 2017-08-16  Chris Dumez  <cdumez@apple.com>
1783
1784         Cross origin Beacon requests with a ArrayBuffer / ArrayBufferView payload should not do a CORS preflight
1785         https://bugs.webkit.org/show_bug.cgi?id=175628
1786         <rdar://problem/33919278>
1787
1788         Reviewed by Geoffrey Garen.
1789
1790         Cross origin Beacon requests with a ArrayBuffer / ArrayBufferView payload should not do a CORS preflight.
1791         To achieve this, the following changes were made:
1792         1. Revert r220779 which caused us to use a non CORS-safelisted Content-Type header for such payload
1793         2. Teach PingLoad how to deal with "simple" cross origin requests (i.e. Don't assume we need a CORS
1794            preflight merely because the fetch mode is set to "cors").
1795
1796         Test: http/wpt/beacon/cors/crossorigin-arraybufferview-no-preflight.html
1797
1798         * Modules/fetch/FetchBody.cpp:
1799         (WebCore::FetchBody::extract):
1800         * loader/CrossOriginAccessControl.h:
1801         * loader/LoaderStrategy.h:
1802         * loader/PingLoader.cpp:
1803         (WebCore::PingLoader::loadImage):
1804         (WebCore::PingLoader::sendPing):
1805         (WebCore::PingLoader::sendViolationReport):
1806         (WebCore::PingLoader::startPingLoad):
1807         * loader/PingLoader.h:
1808         * loader/cache/CachedResource.cpp:
1809         (WebCore::CachedResource::CachedResource):
1810         (WebCore::CachedResource::load):
1811         * loader/cache/CachedResource.h:
1812         * loader/cache/CachedResourceRequest.cpp:
1813         (WebCore::CachedResourceRequest::CachedResourceRequest):
1814         * loader/cache/CachedResourceRequest.h:
1815         (WebCore::CachedResourceRequest::releaseOriginalRequestHeaders):
1816         * platform/network/HTTPHeaderValues.cpp:
1817         * platform/network/HTTPHeaderValues.h:
1818
1819 2017-08-16  Matt Baker  <mattbaker@apple.com>
1820
1821         Web Inspector: capture async stack trace when workers/main context posts a message
1822         https://bugs.webkit.org/show_bug.cgi?id=167084
1823         <rdar://problem/30033673>
1824
1825         Reviewed by Brian Burg.
1826
1827         Add instrumentation to DOMWindow to support showing asynchronous
1828         stack traces when the debugger pauses in a MessageEvent handler.
1829
1830         Test: inspector/debugger/async-stack-trace.html
1831
1832         * inspector/InspectorInstrumentation.cpp:
1833         (WebCore::InspectorInstrumentation::didPostMessageImpl):
1834         (WebCore::InspectorInstrumentation::didFailPostMessageImpl):
1835         (WebCore::InspectorInstrumentation::willDispatchPostMessageImpl):
1836         (WebCore::InspectorInstrumentation::didDispatchPostMessageImpl):
1837
1838         * inspector/InspectorInstrumentation.h:
1839         (WebCore::InspectorInstrumentation::didPostMessage):
1840         (WebCore::InspectorInstrumentation::didFailPostMessage):
1841         (WebCore::InspectorInstrumentation::willDispatchPostMessage):
1842         (WebCore::InspectorInstrumentation::didDispatchPostMessage):
1843
1844         * inspector/PageDebuggerAgent.cpp:
1845         (WebCore::PageDebuggerAgent::didClearAsyncStackTraceData):
1846         (WebCore::PageDebuggerAgent::didPostMessage):
1847         (WebCore::PageDebuggerAgent::didFailPostMessage):
1848         (WebCore::PageDebuggerAgent::willDispatchPostMessage):
1849         (WebCore::PageDebuggerAgent::didDispatchPostMessage):
1850         * inspector/PageDebuggerAgent.h:
1851
1852         * page/DOMWindow.cpp:
1853         (WebCore::DOMWindow::postMessage):
1854         (WebCore::DOMWindow::postMessageTimerFired):
1855
1856 2017-08-16  Timothy Horton  <timothy_horton@apple.com>
1857
1858         Try to fix the build
1859
1860         * platform/ios/PlatformPasteboardIOS.mm:
1861
1862 2017-08-16  Simon Fraser  <simon.fraser@apple.com>
1863
1864         Build fix after r220812
1865
1866         Fix builds where LOG_DISABLED is defined.
1867
1868         * css/MediaQueryEvaluator.cpp:
1869
1870 2017-08-16  Simon Fraser  <simon.fraser@apple.com>
1871
1872         Add a log channel for media queries
1873         https://bugs.webkit.org/show_bug.cgi?id=175591
1874
1875         Reviewed by Zalan Bujtas.
1876
1877         Add a "MediaQueries" log channel which logs data about media query evaluation.
1878
1879         * css/MediaList.cpp:
1880         (WebCore::MediaQuerySet::MediaQuerySet):
1881         (WebCore::operator<<):
1882         * css/MediaList.h:
1883         * css/MediaQuery.cpp:
1884         (WebCore::operator<<):
1885         * css/MediaQuery.h:
1886         * css/MediaQueryEvaluator.cpp:
1887         (WebCore::operator<<):
1888         (WebCore::MediaQueryEvaluator::evaluate const):
1889         (WebCore::aspectRatioValueAsString):
1890         (WebCore::orientationEvaluate):
1891         (WebCore::aspectRatioEvaluate):
1892         (WebCore::deviceAspectRatioEvaluate):
1893         (WebCore::evaluateResolution):
1894         (WebCore::deviceHeightEvaluate):
1895         (WebCore::deviceWidthEvaluate):
1896         (WebCore::heightEvaluate):
1897         (WebCore::widthEvaluate):
1898         * css/MediaQueryExpression.cpp:
1899         (WebCore::operator<<):
1900         * css/MediaQueryExpression.h:
1901         * css/MediaQueryMatcher.cpp:
1902         (WebCore::MediaQueryMatcher::styleResolverChanged):
1903         * css/StyleResolver.cpp:
1904         (WebCore::StyleResolver::hasMediaQueriesAffectedByViewportChange const):
1905         (WebCore::StyleResolver::hasMediaQueriesAffectedByAccessibilitySettingsChange const):
1906         * dom/InlineStyleSheetOwner.cpp:
1907         (WebCore::InlineStyleSheetOwner::createSheet):
1908         * html/HTMLImageElement.cpp:
1909         (WebCore::HTMLImageElement::bestFitSourceFromPictureElement):
1910         * html/HTMLLinkElement.cpp:
1911         (WebCore::HTMLLinkElement::process):
1912         * html/HTMLMediaElement.cpp:
1913         (WebCore::HTMLMediaElement::selectNextSourceChild):
1914         * html/HTMLPictureElement.cpp:
1915         (WebCore::HTMLPictureElement::viewportChangeAffectedPicture const):
1916         * html/parser/HTMLPreloadScanner.cpp:
1917         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
1918         * page/FrameView.cpp:
1919         (WebCore::FrameView::layout):
1920         * platform/Logging.cpp:
1921         (WebCore::initializeLogChannelsIfNecessary):
1922         * platform/Logging.h:
1923         * platform/URL.cpp:
1924         (WebCore::isSchemeFirstChar):
1925         (WebCore::operator<<):
1926         * platform/URL.h:
1927
1928 2017-08-16  Sam Weinig  <sam@webkit.org>
1929
1930         [WebIDL] Remove the need for JSSubtleCryptoCustom.cpp
1931         https://bugs.webkit.org/show_bug.cgi?id=175526
1932
1933         Reviewed by Chris Dumez.
1934
1935         - Generates bindings for all of SubtleCrypto except AlgorithmIdentifier normalization, 
1936           which is defined in the WebCrypto spec to happen after normal IDL operations.
1937         - Adds initial support for IDL object types in unions (some, unneeded at the moment,
1938           edge cases remain).
1939
1940         * CMakeLists.txt:
1941         * WebCore.xcodeproj/project.pbxproj:
1942         * bindings/js/JSSubtleCryptoCustom.cpp: Removed.
1943
1944             Remove JSSubtleCryptoCustom.cpp, added CryptoKeyFormat.h
1945
1946         * bindings/js/JSDOMConvertObject.h:
1947
1948             Add needed, when included in generated code, #include of StrongInlines.h
1949
1950         * bindings/js/JSDOMConvertUnion.h:
1951         
1952             Add initial support for object (needed for AlgorithmIdentifier which is 
1953             (object or DOMString)). Remaining support will be handled by https://webkit.org/b/175616
1954
1955             Also add remaining spec comments while in the area.
1956
1957         * bindings/js/JSDOMPromiseDeferred.cpp:
1958         (WebCore::DeferredPromise::reject):
1959
1960             Add support for the special ExistingExceptionError error code. Capturing
1961             the current exception and using it as the rejection value.
1962
1963         * crypto/SubtleCrypto.cpp:
1964         (WebCore::SubtleCrypto::~SubtleCrypto):
1965         (WebCore::toHashIdentifier):
1966         (WebCore::normalizeCryptoAlgorithmParameters):
1967         (WebCore::toCryptoKeyUsageBitmap):
1968         (WebCore::rejectWithException):
1969         (WebCore::normalizeJsonWebKey):
1970         (WebCore::toKeyData):
1971         (WebCore::copyToVector):
1972         (WebCore::isSupportedExportKey):
1973         (WebCore::SubtleCrypto::encrypt):
1974         (WebCore::SubtleCrypto::decrypt):
1975         (WebCore::SubtleCrypto::sign):
1976         (WebCore::SubtleCrypto::verify):
1977         (WebCore::SubtleCrypto::digest):
1978         (WebCore::SubtleCrypto::generateKey):
1979         (WebCore::SubtleCrypto::deriveKey):
1980         (WebCore::SubtleCrypto::deriveBits):
1981         (WebCore::SubtleCrypto::importKey):
1982         (WebCore::SubtleCrypto::exportKey):
1983         (WebCore::SubtleCrypto::wrapKey):
1984         (WebCore::SubtleCrypto::unwrapKey):
1985         * crypto/SubtleCrypto.h:
1986         * crypto/SubtleCrypto.idl:
1987
1988             Moves implementation from JSSubtleCryptoCustom.cpp -> here. Important changes that come
1989             with that are:
1990             - All parameters are now converted / type checked for us.
1991             - Rather than throwing exceptions and expecting the bindings layer to convert
1992               them to promise rejections, all rejections are now explicitly made.
1993             - Algorithms are no longer checked for being supported twice, once in normalizeCryptoAlgorithmParameters
1994               and then again in the operation. We instead rely on normalizeCryptoAlgorithmParameters to return
1995               an Exception if its not supported.
1996             - Shaves 251 lines off the file.
1997
1998         * crypto/CryptoKeyFormat.h: Added.
1999
2000             Add new header for unified key format enum. (For bindings purposes, SubtleCrypto
2001             re aliases it to SubtleCrypto::KeyFormat).
2002
2003         * bindings/js/JSWebKitSubtleCryptoCustom.cpp:
2004         * crypto/CryptoAlgorithm.cpp:
2005         * crypto/CryptoAlgorithm.h:
2006         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
2007         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
2008         * crypto/algorithms/CryptoAlgorithmAES_CFB.cpp:
2009         * crypto/algorithms/CryptoAlgorithmAES_CFB.h:
2010         * crypto/algorithms/CryptoAlgorithmAES_CTR.cpp:
2011         * crypto/algorithms/CryptoAlgorithmAES_CTR.h:
2012         * crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:
2013         * crypto/algorithms/CryptoAlgorithmAES_GCM.h:
2014         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
2015         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
2016         * crypto/algorithms/CryptoAlgorithmECDH.cpp:
2017         * crypto/algorithms/CryptoAlgorithmECDH.h:
2018         * crypto/algorithms/CryptoAlgorithmECDSA.cpp:
2019         * crypto/algorithms/CryptoAlgorithmECDSA.h:
2020         * crypto/algorithms/CryptoAlgorithmHKDF.cpp:
2021         * crypto/algorithms/CryptoAlgorithmHKDF.h:
2022         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
2023         * crypto/algorithms/CryptoAlgorithmHMAC.h:
2024         * crypto/algorithms/CryptoAlgorithmPBKDF2.cpp:
2025         * crypto/algorithms/CryptoAlgorithmPBKDF2.h:
2026         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
2027         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
2028         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
2029         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
2030         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
2031         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
2032         * crypto/algorithms/CryptoAlgorithmRSA_PSS.cpp:
2033         * crypto/algorithms/CryptoAlgorithmRSA_PSS.h:
2034
2035             Use CryptoKeyFormat enum directly, rather than SubtleCrypto::KeyFormat,
2036             to allow not including SubtleCrypto.h.
2037
2038         * crypto/parameters/CryptoAlgorithmEcdsaParams.h:
2039         * crypto/parameters/CryptoAlgorithmHkdfParams.h:
2040         * crypto/parameters/CryptoAlgorithmHmacKeyParams.h:
2041         * crypto/parameters/CryptoAlgorithmPbkdf2Params.h:
2042         * crypto/parameters/CryptoAlgorithmRsaHashedImportParams.h:
2043         * crypto/parameters/CryptoAlgorithmRsaHashedKeyGenParams.h:
2044         * crypto/parameters/EcdsaParams.idl:
2045         * crypto/parameters/HkdfParams.idl:
2046         * crypto/parameters/HmacKeyParams.idl:
2047         * crypto/parameters/Pbkdf2Params.idl:
2048         * crypto/parameters/RsaHashedImportParams.idl:
2049         * crypto/parameters/RsaHashedKeyGenParams.idl:
2050
2051             Update IDLs and implementations to use the correct definition of HashAlgorithmIdentifier,
2052             which is (object or DOMString), now that it is supported.
2053
2054 2017-08-16  Youenn Fablet  <youenn@apple.com>
2055
2056         [Cache API] Implement Worker connection to the Cache storage engine
2057         https://bugs.webkit.org/show_bug.cgi?id=175599
2058
2059         Reviewed by Chris Dumez.
2060
2061         Covered by existing tests.
2062
2063         Adding a WorkerCacheStorageConnection to connect workers Cache/CacheStorage
2064         to the cache storage engine.
2065         WorkerCacheStorageConnection does this by hopping to the main thread to call the document cache storage connection to do the actual job.
2066         Doing some CacheStorageConnection refactoring to share code with WK2 implementation of the cache storage connection. 
2067
2068         * Modules/cache/CacheQueryOptions.h:
2069         (WebCore::CacheQueryOptions::isolatedCopy const):
2070         * Modules/cache/CacheStorageConnection.cpp:
2071         (WebCore::CacheStorageConnection::open):
2072         (WebCore::CacheStorageConnection::remove):
2073         (WebCore::CacheStorageConnection::retrieveCaches):
2074         (WebCore::CacheStorageConnection::retrieveRecords):
2075         (WebCore::CacheStorageConnection::batchDeleteOperation):
2076         (WebCore::CacheStorageConnection::batchPutOperation):
2077         (WebCore::CacheStorageConnection::openOrRemoveCompleted):
2078         (WebCore::CacheStorageConnection::updateCaches):
2079         (WebCore::CacheStorageConnection::updateRecords):
2080         (WebCore::CacheStorageConnection::removeRecordsCompleted):
2081         (WebCore::CacheStorageConnection::putRecordsCompleted):
2082         * Modules/cache/CacheStorageConnection.h:
2083         (WebCore::CacheStorageConnection::openCompleted):
2084         (WebCore::CacheStorageConnection::removeCompleted):
2085         (WebCore::CacheStorageConnection::doOpen):
2086         (WebCore::CacheStorageConnection::doRemove):
2087         (WebCore::CacheStorageConnection::doRetrieveCaches):
2088         (WebCore::CacheStorageConnection::doRetrieveRecords):
2089         (WebCore::CacheStorageConnection::doBatchDeleteOperation):
2090         (WebCore::CacheStorageConnection::doBatchPutOperation):
2091         * Modules/cache/WorkerCacheStorageConnection.cpp: Added.
2092         (WebCore::toCrossThreadRecordData):
2093         (WebCore::fromCrossThreadRecordData):
2094         (WebCore::WorkerCacheStorageConnection::create):
2095         (WebCore::WorkerCacheStorageConnection::WorkerCacheStorageConnection):
2096         (WebCore::WorkerCacheStorageConnection::doOpen):
2097         (WebCore::WorkerCacheStorageConnection::doRemove):
2098         (WebCore::WorkerCacheStorageConnection::doRetrieveCaches):
2099         (WebCore::WorkerCacheStorageConnection::doRetrieveRecords):
2100         (WebCore::WorkerCacheStorageConnection::doBatchDeleteOperation):
2101         (WebCore::WorkerCacheStorageConnection::doBatchPutOperation):
2102         * Modules/cache/WorkerCacheStorageConnection.h: Added.
2103         * Modules/cache/WorkerGlobalScopeCaches.cpp:
2104         (WebCore::WorkerGlobalScopeCaches::caches const):
2105         * WebCore.xcodeproj/project.pbxproj:
2106         * loader/FetchOptions.h:
2107         (WebCore::FetchOptions::isolatedCopy const):
2108         * workers/WorkerGlobalScope.cpp:
2109         (WebCore::WorkerGlobalScope::cacheStorageConnection):
2110         * workers/WorkerGlobalScope.h:
2111
2112 2017-08-16  Yoshiaki Jitsukawa  <Yoshiaki.Jitsukawa@sony.com>
2113
2114         [PAL] Move spi/ios and spi/win directories into PAL
2115         https://bugs.webkit.org/show_bug.cgi?id=175171
2116
2117         Reviewed by Antti Koivisto.
2118
2119         * PlatformWin.cmake:
2120         * WebCore.xcodeproj/project.pbxproj:
2121         * editing/cocoa/DataDetection.mm:
2122         * loader/ios/PreviewLoader.mm:
2123         * page/CaptionUserPreferencesMediaAF.cpp:
2124         * page/cocoa/MemoryReleaseCocoa.mm:
2125         * page/cocoa/SettingsCocoa.mm:
2126         * page/ios/UserAgentIOS.mm:
2127         * platform/audio/ios/MediaSessionManagerIOS.mm:
2128         * platform/graphics/ca/PlatformCALayer.cpp:
2129         * platform/graphics/cocoa/FontCascadeCocoa.mm:
2130         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
2131         * platform/graphics/opentype/OpenTypeCG.h:
2132         * platform/graphics/win/SimpleFontDataCGWin.cpp:
2133         * platform/graphics/win/SimpleFontDataDirect2D.cpp:
2134         * platform/ios/Device.h:
2135         * platform/ios/PlatformPasteboardIOS.mm:
2136         * platform/ios/PlatformScreenIOS.mm:
2137         * platform/ios/QuickLookSoftLink.h:
2138         * platform/ios/QuickLookSoftLink.mm:
2139         * platform/ios/ValidationBubbleIOS.mm:
2140         * platform/ios/WebItemProviderPasteboard.mm:
2141         * platform/network/ios/PreviewConverter.mm:
2142         * platform/sql/SQLiteFileSystem.cpp:
2143         * rendering/RenderThemeIOS.mm:
2144
2145 2017-08-16  Tim Horton  <timothy_horton@apple.com>
2146
2147         2-3% of main thread time under UTTypeCreatePreferredIdentifierForTag on wunderground map
2148         https://bugs.webkit.org/show_bug.cgi?id=175618
2149
2150         Reviewed by Simon Fraser.
2151
2152         No new tests, just a perf win.
2153
2154         UTTypeCreatePreferredIdentifierForTag is fairly expensive, and is called
2155         under every toDataURL, which the Wunderground wundermap does a /lot/.
2156
2157         Keep a 16-item LRU cache of MIMEType->UTI mappings.
2158
2159         Also, make other callers of UTTypeCreatePreferredIdentifierForTag use
2160         the UTIUtilities version so they can share in the caching.
2161
2162         Also, as a drive-by, add and make other callers use mimeTypeFromUTI too,
2163         and make the UTIUtilities operate on Strings for a slightly more WebCore-y feel.
2164
2165         * editing/ios/EditorIOS.mm:
2166         (WebCore::Editor::WebContentReader::readImage):
2167         * platform/MIMETypeRegistry.cpp:
2168         (WebCore::initializeSupportedImageMIMETypes):
2169         (WebCore::initializeSupportedImageMIMETypesForEncoding):
2170         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
2171         (WebCore::createFileTypesSet):
2172         * platform/graphics/cg/ImageSourceCGMac.mm:
2173         (WebCore::MIMETypeForImageSourceType):
2174         Adopt newly-added MIMETypeFromUTI().
2175
2176         * platform/graphics/cg/ImageBufferCG.cpp:
2177         (WebCore::utiFromImageBufferMIMEType):
2178         (WebCore::ImageBuffer::toCFData const):
2179         (WebCore::cfData):
2180         (WebCore::utiFromMIMEType): Deleted.
2181         Adopt UTIFromMIMEType, and rename the local helper that does something
2182         different (a small static map) on iOS and Windows to not have an overlapping name.
2183
2184         * platform/ios/PasteboardIOS.mm:
2185         (WebCore::Pasteboard::resourceMIMEType):
2186         (WebCore::utiTypeFromCocoaType):
2187         Adopt UTIFromMIMEType().
2188
2189         * platform/ios/PlatformPasteboardIOS.mm:
2190         (WebCore::PlatformPasteboard::writeObjectRepresentations):
2191         * platform/mac/PasteboardMac.mm:
2192         (WebCore::cocoaTypeFromHTMLClipboardType):
2193         Adopt isDeclaredUTI and UTIFromMIMEType().
2194
2195         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
2196         (WebCore::WebCoreAVFResourceLoader::responseReceived):
2197         * platform/network/ios/WebCoreURLResponseIOS.mm:
2198         (WebCore::adjustMIMETypeIfNecessary):
2199         * platform/network/mac/WebCoreURLResponse.mm:
2200         (WebCore::adjustMIMETypeIfNecessary):
2201         * rendering/RenderThemeIOS.mm:
2202         (WebCore::iconForAttachment):
2203         * rendering/RenderThemeMac.mm:
2204         (WebCore::iconForAttachment):
2205         Deal with the fact that UTI utilities deal in Strings now.
2206
2207         * platform/network/mac/UTIUtilities.h:
2208         * platform/network/mac/UTIUtilities.mm:
2209         (WebCore::MIMETypeFromUTI):
2210         Added. This doesn't crawl up the UTI tree if the first conversion fails,
2211         which is what most of the existing code does. It's possible we want to
2212         use MIMETypeFromUTITree's logic everywhere, but I didn't want to change
2213         that in this patch.
2214
2215         (WebCore::MIMETypeFromUTITree):
2216         (WebCore::isDeclaredUTI):
2217         Take and return strings.
2218
2219         (WebCore::UTIFromMIMETypeCachePolicy::createValueForKey):
2220         (WebCore::UTIFromMIMEType):
2221         Add the aforementioned cache.
2222
2223 2017-08-16  Simon Fraser  <simon.fraser@apple.com>
2224
2225         Make RenderLayer and RenderLayerBacking TextStream-loggable, and clean up compositing logging
2226         https://bugs.webkit.org/show_bug.cgi?id=175634
2227
2228         Reviewed by Zalan Bujtas.
2229
2230         Add operator<<(TextStream&) for RenderLayer and RenderLayer backing, and use them for compositing logging.
2231
2232         Convert CompositingUpdateType to an enum class.
2233
2234         * page/FrameView.cpp:
2235         (WebCore::FrameView::updateCompositingLayersAfterLayout):
2236         (WebCore::FrameView::updateCompositingLayersAfterScrolling):
2237         * page/ios/FrameIOS.mm:
2238         (WebCore::Frame::viewportOffsetChanged):
2239         * rendering/RenderLayer.cpp:
2240         (WebCore::RenderLayer::updateLayerPositionsAfterLayout):
2241         (WebCore::RenderLayer::updateCompositingLayersAfterScroll):
2242         (WebCore::RenderLayer::calculateClipRects const):
2243         * rendering/RenderLayer.h:
2244         * rendering/RenderLayerBacking.cpp:
2245         (WebCore::RenderLayerBacking::updateAfterLayout):
2246         (WebCore::RenderLayerBacking::updateGeometry):
2247         (WebCore::operator<<):
2248         * rendering/RenderLayerBacking.h:
2249         * rendering/RenderLayerCompositor.cpp:
2250         (WebCore::RenderLayerCompositor::didRecalcStyleWithNoPendingLayout):
2251         (WebCore::RenderLayerCompositor::flushPendingLayerChanges):
2252         (WebCore::RenderLayerCompositor::updateCompositingLayersTimerFired):
2253         (WebCore::RenderLayerCompositor::updateCompositingLayers):
2254         (WebCore::RenderLayerCompositor::layerTreeAsText):
2255         (WebCore::operator<<):
2256         * rendering/RenderLayerCompositor.h:
2257
2258 2017-08-16  Eric Carlson  <eric.carlson@apple.com>
2259
2260         Consider allow gUM to be called from localhost without https
2261         https://bugs.webkit.org/show_bug.cgi?id=173457
2262         <rdar://problem/33900527>
2263
2264         Reviewed by Youenn Fablet.
2265
2266         Tests: http/tests/media/media-stream/get-user-media-localhost.html
2267                http/tests/media/media-stream/get-user-media-loopback-ip.html
2268
2269         * Modules/mediastream/UserMediaRequest.cpp:
2270         (WebCore::isSecure): Call SchemeRegistry::shouldTreatURLSchemeAsSecure instead of looking for
2271         the string 'https'.
2272         (WebCore::canCallGetUserMedia): Allow localhost or loopback address.
2273
2274         * page/SecurityOrigin.cpp:
2275         (WebCore::isLoopbackIPAddress): Add a comment.
2276         (WebCore::shouldTreatAsPotentionallyTrustworthy): Move tests for localhost and loopback address
2277         to isLocalHostOrLoopbackIPAddress, call it.
2278         (WebCore::SecurityOrigin::isLocalHostOrLoopbackIPAddress): 
2279         * page/SecurityOrigin.h:
2280
2281 2017-08-16  Chris Dumez  <cdumez@apple.com>
2282
2283         EventSource: ignore IDs with U+0000
2284         https://bugs.webkit.org/show_bug.cgi?id=175178
2285
2286         Reviewed by Darin Adler.
2287
2288         EventSource: ignore IDs with U+0000 as per:
2289         https://github.com/whatwg/html/pull/2849
2290
2291         Test: imported/w3c/web-platform-tests/eventsource/format-field-id-null.htm
2292
2293         * page/EventSource.cpp:
2294         (WebCore::EventSource::parseEventStreamLine):
2295
2296 2017-08-16  Fujii Hironori  <Hironori.Fujii@sony.com>
2297
2298         [HarfBuzz] Decomposed Vietnamese characters are rendered incorrectly
2299         https://bugs.webkit.org/show_bug.cgi?id=174418
2300
2301         Reviewed by Michael Catanzaro.
2302
2303         HarfBuzzShaper should normalize the input text before collecting
2304         HarfBuzzRuns. Actually, HarfBuzzShaper::setNormalizedBuffer does
2305         the task. But, this function hasn't been called from anywhere
2306         since Bug 90951.
2307
2308         Test: fast/text/international/vietnamese-nfd.html
2309               imported/blink/fast/text/international/text-shaping-arabic-diffs.html
2310
2311         * platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
2312         (WebCore::HarfBuzzShaper::HarfBuzzShaper):
2313         Call setNormalizedBuffer instead of normalizeCharacters.
2314         (WebCore::normalizeCharacters): Deleted.
2315         (WebCore::normalizeSpacesAndMirrorChars) Use
2316         FontCascade::treatAsZeroWidthSpaceInComplexScript instead of
2317         FontCascade::treatAsZeroWidthSpace to preserve ZWJ and ZWNJ.
2318
2319 2017-08-16  Antti Koivisto  <antti@apple.com>
2320
2321         Move first-letter renderer mutation code out of RenderBlock and into RenderTreeUpdater
2322         https://bugs.webkit.org/show_bug.cgi?id=175627
2323
2324         Reviewed by Andreas Kling.
2325
2326         Render tree should not mutate itself. We already fixed this for first-letter, supporting code
2327         can now move to RenderTreeUpdater too.
2328
2329         * CMakeLists.txt:
2330         * WebCore.xcodeproj/project.pbxproj:
2331         * rendering/RenderBlock.cpp:
2332         (WebCore::styleForFirstLetter): Deleted.
2333         (WebCore::isPunctuationForFirstLetter): Deleted.
2334         (WebCore::shouldSkipForFirstLetter): Deleted.
2335         (WebCore::RenderBlock::updateFirstLetterStyle): Deleted.
2336         (WebCore::RenderBlock::createFirstLetterRenderer): Deleted.
2337         (WebCore::RenderBlock::updateFirstLetter): Deleted.
2338         * rendering/RenderBlock.h:
2339         * rendering/RenderRubyRun.cpp:
2340         (WebCore::RenderRubyRun::updateFirstLetter): Deleted.
2341         * rendering/RenderRubyRun.h:
2342         * rendering/RenderTable.cpp:
2343         (WebCore::RenderTable::updateFirstLetter): Deleted.
2344         * rendering/RenderTable.h:
2345
2346             Virtual overrides just disabled first letter for some RenderBlock subclasses. This is now achieved via
2347             supportsFirstLetter test in the first letter updater.
2348
2349         * rendering/TextAutoSizing.cpp:
2350         (WebCore::TextAutoSizingValue::adjustTextNodeSizes):
2351         * rendering/svg/RenderSVGText.cpp:
2352         (WebCore::RenderSVGText::updateFirstLetter): Deleted.
2353         * rendering/svg/RenderSVGText.h:
2354         * style/RenderTreeUpdater.cpp:
2355         (WebCore::RenderTreeUpdater::popParent):
2356         * style/RenderTreeUpdater.h:
2357         * style/RenderTreeUpdaterFirstLetter.cpp: Added.
2358         (WebCore::styleForFirstLetter):
2359         (WebCore::isPunctuationForFirstLetter):
2360         (WebCore::shouldSkipForFirstLetter):
2361         (WebCore::updateFirstLetterStyle):
2362         (WebCore::createFirstLetterRenderer):
2363         (WebCore::supportsFirstLetter):
2364         (WebCore::RenderTreeUpdater::FirstLetter::update):
2365         * style/RenderTreeUpdaterFirstLetter.h: Added.
2366
2367 2017-08-16  Xabier Rodriguez Calvar  <calvaris@igalia.com>
2368
2369         [GStreamer][EME] Rework handling key systems and UUIDs
2370         https://bugs.webkit.org/show_bug.cgi?id=175567
2371
2372         Reviewed by Žan Doberšek.
2373
2374         The UUIDs and key system strings were moved to the
2375         GStreamerEMEUtilities class because so far they were managed by
2376         the decryptors and that was ugly.
2377
2378         * platform/GStreamer.cmake:
2379         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2380         (WebCore::MediaPlayerPrivateGStreamerBase::supportsKeySystem):
2381         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.cpp: Added.
2382         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h: Added.
2383         (WebCore::GStreamerEMEUtilities::isClearKeyKeySystem):
2384         (WebCore::GStreamerEMEUtilities::keySystemToUuid):
2385         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
2386         (webkit_media_clear_key_decrypt_class_init):
2387         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.h:
2388
2389 2017-08-16  Andy Estes  <aestes@apple.com>
2390
2391         [Payment Request] Add an ENABLE flag and an experimental feature preference
2392         https://bugs.webkit.org/show_bug.cgi?id=175622
2393
2394         Reviewed by Tim Horton.
2395
2396         * Configurations/FeatureDefines.xcconfig:
2397         * page/Settings.in:
2398
2399 2017-08-15  Ryosuke Niwa  <rniwa@webkit.org>
2400
2401         Make DataTransferItemList work with plain text entries
2402         https://bugs.webkit.org/show_bug.cgi?id=175596
2403
2404         Reviewed by Wenson Hsieh.
2405
2406         Added the basic machinery to get the list of plain text items to DataTransferItemList and DataTransferItem.
2407
2408         Each DataTransferItem now depends on DataTransfer so it does ref-forwarding like DataTransferItemList to make
2409         DataTransfer alive as long as any DataTransferItem is alive.
2410
2411         Specifications: https://html.spec.whatwg.org/multipage/dnd.html#the-datatransferitem-interface
2412                         https://html.spec.whatwg.org/multipage/dnd.html#the-datatransferitemlist-interface
2413
2414         Tests: editing/pasteboard/datatransfer-items-drop-plaintext-file.html
2415                editing/pasteboard/datatransfer-items-paste-plaintext.html
2416
2417         * dom/DataTransferItem.cpp:
2418         (WebCore::DataTransferItem::DataTransferItem): Added two variants one for plain text and another one for a file.
2419         (WebCore::DataTransferItem::kind const): Rewritten.
2420         (WebCore::DataTransferItem::getAsString const): Implemented.
2421         (WebCore::DataTransferItem::getAsFile const): Implemented.
2422         * dom/DataTransferItem.h:
2423         (WebCore::DataTransferItem::ref): Added.
2424         (WebCore::DataTransferItem::deref): Added.
2425         (WebCore::DataTransferItem::type const): Returns String instead of AtomicString.
2426         (WebCore::DataTransferItem::kind const): Moved to cpp.
2427         * dom/DataTransferItem.idl: Removed NoInterfaceObject since the interface object should exist on DOMWindow.
2428         * dom/DataTransferItemList.cpp:
2429         (WebCore::DataTransferItemList::length): Implemented.
2430         (WebCore::DataTransferItemList::item): Ditto.
2431         (WebCore::isSupportedType): Added. For now, we only support text/plain.
2432         (WebCore::DataTransferItemList::ensureItems): Added. Constructs the list of DataTransferItems.
2433         * dom/DataTransferItemList.h:
2434         (DataTransferItemList): Added m_items. The list is filled lazily by ensureItems.
2435         * dom/DataTransferItemList.idl: Removed NoInterfaceObject since the interface object should exist on DOMWindow.
2436
2437 2017-08-15  Simon Fraser  <simon.fraser@apple.com>
2438
2439         Remove ScrollView::clipsRepaints() which was only used by Chromium
2440         https://bugs.webkit.org/show_bug.cgi?id=175594
2441
2442         Reviewed by Tim Horton.
2443
2444         clipsRepaints() was added in r74568 but was only used by Chromium. It's always
2445         true for other platforms, so remove conditionals that test for it and assume true.
2446
2447         * page/FrameView.cpp:
2448         (WebCore::FrameView::scrollContentsFastPath):
2449         * platform/ScrollView.cpp:
2450         (WebCore::ScrollView::repaintContentRectangle):
2451         (WebCore::ScrollView::setClipsRepaints): Deleted.
2452         * platform/ScrollView.h:
2453         (WebCore::ScrollView::clipsRepaints const): Deleted.
2454
2455 2017-08-15  Simon Fraser  <simon.fraser@apple.com>
2456
2457         Allow WebCore logging channels to be set from the UI process
2458         https://bugs.webkit.org/show_bug.cgi?id=175608
2459
2460         Reviewed by Tim Horton.
2461
2462         Change initializeLogChannelsIfNecessary() to take an optional String, which can
2463         be a list of log channels passed from the UI process.
2464
2465         * platform/LogInitialization.h:
2466         * platform/Logging.cpp:
2467         (WebCore::initializeLogChannelsIfNecessary):
2468
2469 2017-08-15  Chris Dumez  <cdumez@apple.com>
2470
2471         Fetch / Beacon: Use "application/octet-stream" Content-Type for payloads of type ArrayBuffer / ArrayBufferView
2472         https://bugs.webkit.org/show_bug.cgi?id=175600
2473
2474         Reviewed by Youenn Fablet.
2475
2476         Use "application/octet-stream" Content-Type for payloads of type ArrayBuffer / ArrayBufferView in Fetch & Beacon.
2477         If we don't set a Content-Type header, our underlying network stack is going to add a "application/x-www-form-urlencoded"
2478         Content-Type header, which is worse.
2479
2480         Chrome is already using "application/octet-stream" Content-Type in Beacon, but use no Content-Type in Fetch.
2481         The Fetch/Beacon specification says we should have no Content-Type header in this case but this is unfortunately
2482         not something we can support at the moment. Using "application/octet-stream" Content-Type for now seems like the
2483         lesser evil.
2484
2485         Test: http/wpt/fetch/fetch-request-arraybuffer-content-type.html
2486
2487         * Modules/fetch/FetchBody.cpp:
2488         (WebCore::FetchBody::extract):
2489         * platform/network/HTTPHeaderValues.cpp:
2490         (WebCore::HTTPHeaderValues::octetStreamContentType):
2491         * platform/network/HTTPHeaderValues.h:
2492
2493 2017-08-15  Robin Morisset  <rmorisset@apple.com>
2494
2495         Change the order of arguments of JSWithScope::create() for consistency
2496         https://bugs.webkit.org/show_bug.cgi?id=175585
2497
2498         Reviewed by Saam Barati.
2499
2500         No change of behavior.
2501
2502         * bindings/js/JSHTMLElementCustom.cpp:
2503         (WebCore::JSHTMLElement::pushEventHandlerScope const):
2504
2505 2017-08-15  Youenn Fablet  <youenn@apple.com>
2506
2507         [Cache API] Ensure ResourceResponse is not null when redirected/tainting/type fields are set
2508         https://bugs.webkit.org/show_bug.cgi?id=175538
2509
2510         Reviewed by Chris Dumez.
2511
2512         No change of behavior.
2513         This change ensures that response type is preserved when encoding/decoding ResourceResponse, in particular the error type.
2514         This will allow Cache API to preserve responses when reading them from a different process.
2515
2516         * platform/network/ResourceResponseBase.cpp:
2517         (WebCore::ResourceResponseBase::setType):
2518         * platform/network/ResourceResponseBase.h:
2519         (WebCore::ResourceResponseBase::setType):
2520
2521 2017-08-15  Chris Dumez  <cdumez@apple.com>
2522
2523         Update CachedResourceLoader::requestResource() to return a WTF::Expected
2524         https://bugs.webkit.org/show_bug.cgi?id=175505
2525
2526         Reviewed by Youenn Fablet.
2527
2528         Update CachedResourceLoader::requestResource() to return a WTF::Expected
2529         type instead of using an out parameter for the ResourceError in case of
2530         synchronous failure.
2531
2532         * Modules/beacon/NavigatorBeacon.cpp:
2533         (WebCore::NavigatorBeacon::sendBeacon):
2534         * bindings/js/CachedScriptFetcher.cpp:
2535         (WebCore::CachedScriptFetcher::requestScriptWithCache const):
2536         * css/CSSFontFaceSrcValue.cpp:
2537         (WebCore::CSSFontFaceSrcValue::cachedFont):
2538         * css/CSSImageSetValue.cpp:
2539         (WebCore::CSSImageSetValue::loadBestFitImage):
2540         * css/CSSImageValue.cpp:
2541         (WebCore::CSSImageValue::loadImage):
2542         * css/StyleRuleImport.cpp:
2543         (WebCore::StyleRuleImport::requestStyleSheet):
2544         * dom/ProcessingInstruction.cpp:
2545         (WebCore::ProcessingInstruction::checkStyleSheet):
2546         * html/HTMLLinkElement.cpp:
2547         (WebCore::HTMLLinkElement::process):
2548         * loader/CrossOriginPreflightChecker.cpp:
2549         (WebCore::CrossOriginPreflightChecker::startPreflight):
2550         * loader/DocumentLoader.cpp:
2551         (WebCore::DocumentLoader::startLoadingMainResource):
2552         * loader/DocumentThreadableLoader.cpp:
2553         (WebCore::DocumentThreadableLoader::loadRequest):
2554         * loader/FrameLoader.cpp:
2555         (WebCore::FrameLoader::loadedResourceFromMemoryCache):
2556         * loader/FrameLoader.h:
2557         * loader/ImageLoader.cpp:
2558         (WebCore::ImageLoader::updateFromElement):
2559         * loader/LinkLoader.cpp:
2560         (WebCore::LinkLoader::preloadIfNeeded):
2561         * loader/MediaResourceLoader.cpp:
2562         (WebCore::MediaResourceLoader::requestResource):
2563         * loader/TextTrackLoader.cpp:
2564         (WebCore::TextTrackLoader::load):
2565         * loader/cache/CachedResourceLoader.cpp:
2566         (WebCore::castCachedResourceTo):
2567         (WebCore::CachedResourceLoader::requestImage):
2568         (WebCore::CachedResourceLoader::requestFont):
2569         (WebCore::CachedResourceLoader::requestTextTrack):
2570         (WebCore::CachedResourceLoader::requestCSSStyleSheet):
2571         (WebCore::CachedResourceLoader::requestUserCSSStyleSheet):
2572         (WebCore::CachedResourceLoader::requestScript):
2573         (WebCore::CachedResourceLoader::requestXSLStyleSheet):
2574         (WebCore::CachedResourceLoader::requestSVGDocument):
2575         (WebCore::CachedResourceLoader::requestLinkResource):
2576         (WebCore::CachedResourceLoader::requestMedia):
2577         (WebCore::CachedResourceLoader::requestIcon):
2578         (WebCore::CachedResourceLoader::requestRawResource):
2579         (WebCore::CachedResourceLoader::requestBeaconResource):
2580         (WebCore::CachedResourceLoader::requestMainResource):
2581         (WebCore::CachedResourceLoader::shouldContinueAfterNotifyingLoadedFromMemoryCache):
2582         (WebCore::CachedResourceLoader::requestResource):
2583         (WebCore::CachedResourceLoader::preload):
2584         * loader/cache/CachedResourceLoader.h:
2585         * loader/cache/CachedSVGDocumentReference.cpp:
2586         (WebCore::CachedSVGDocumentReference::load):
2587         * loader/icon/IconLoader.cpp:
2588         (WebCore::IconLoader::startLoading):
2589         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
2590         (WebCore::WebCoreAVFResourceLoader::startLoading):
2591         * svg/SVGFEImageElement.cpp:
2592         (WebCore::SVGFEImageElement::requestImageResource):
2593         * svg/SVGFontFaceUriElement.cpp:
2594         (WebCore::SVGFontFaceUriElement::loadFont):
2595         * svg/SVGUseElement.cpp:
2596         (WebCore::SVGUseElement::updateExternalDocument):
2597         * xml/XSLImportRule.cpp:
2598         (WebCore::XSLImportRule::loadSheet):
2599
2600 2017-08-15  Don Olmstead  <don.olmstead@sony.com>
2601
2602         [PAL] Move Sleep classes into PAL
2603         https://bugs.webkit.org/show_bug.cgi?id=175456
2604
2605         Reviewed by Ryosuke Niwa.
2606
2607         No new tests. No change in behavior.
2608
2609         * CMakeLists.txt:
2610         * PlatformMac.cmake:
2611         * WebCore.xcodeproj/project.pbxproj:
2612         * html/HTMLMediaElement.cpp:
2613         * html/HTMLMediaElement.h:
2614         * platform/audio/PlatformMediaSessionManager.cpp:
2615         * platform/audio/PlatformMediaSessionManager.h:
2616         * platform/mac/WebVideoFullscreenController.h:
2617         * platform/mac/WebVideoFullscreenController.mm:
2618
2619 2017-08-15  Youenn Fablet  <youenn@apple.com>
2620
2621         [Cache API] Adding generic support for CacheStorage and Cache methods
2622         https://bugs.webkit.org/show_bug.cgi?id=175455
2623
2624         Reviewed by Chris Dumez.
2625
2626         Covered by existing tests.
2627
2628         Adding a CacheStorageProvider abstraction that creates a CacheStorageConnection.
2629         The CacheStorageProvider is accessed from the page for Document calls.
2630         The CacheStorageConnection is responsible to implement the read/write operations on the cache database.
2631         At the moment, it does nothing but return not implemented errors.
2632
2633         Implementing CacheStorage APIs and Cache APIs based on the CacheStorageConnection except for Cache add and addAll which will be implemented later on.
2634         CacheStoragConnection is responsible to read/write CacheStorage list of caches and each individual cache.
2635         The CacheStorageConnection is a generic connection and not tied to any document/context.
2636         CacheStorage objects are manipulated by providing to the connection the origin of the context.
2637         CacheStorage are global to all contexts with the same origin.
2638         Cache objects are manipulated by an ID that is given initially by the CacheStorageEngine when opening the Cache object.
2639
2640         Adding various accessors and constructors for Fetch constructs as needed by the Cache API implementation.
2641
2642         * Modules/cache/Cache.cpp:
2643         (WebCore::Cache::Cache):
2644         (WebCore::Cache::~Cache):
2645         The CacheStorageConnection is a generic connection and not tied to any document/context.
2646         (WebCore::Cache::match): Implementation of https://www.w3.org/TR/service-workers-1/#cache-match.
2647         Redirect to matchAll as per spec.
2648         (WebCore::Cache::matchAll): Implementation of https://www.w3.org/TR/service-workers-1/#cache-matchAll.
2649         Checks for request as per spec. Then either refresh the request to response map and return all responses.
2650         Or call the query cache algorithm and return copies of the responses (using clone).
2651         (WebCore::Cache::put):
2652         Check the request and response as per spec.
2653         Add temporary rejection cases (being loaded responses, responses with ReadableStream) as there is no support for them right now.
2654         Call the batch put operation.
2655         (WebCore::Cache::remove):
2656         Check the request and response as per spec.
2657         Call the batch delete operation.
2658         (WebCore::Cache::keys):
2659         Refresh the request to response map and return corresponding requests.
2660         Making sure to reuse the same request objects as per spec.
2661         As per spec, the request to response map is ordered. We implement it as a Vector.
2662         (WebCore::Cache::refreshRequestToResponseMap):
2663         Use the cache storage connection to get an up-to-date list of cached records.
2664         (WebCore::Cache::queryCacheMatch):
2665         Implements the match algorithm defined in https://www.w3.org/TR/service-workers-1/#query-cache-algorithm.
2666         This is split for queryCache as cache storage engine will need to use it when implementing the delete operation.
2667         (WebCore::Cache::queryCache):
2668         Full implementation of https://www.w3.org/TR/service-workers-1/#query-cache-algorithm with no targetStorage argument.
2669         (WebCore::Cache::queryCacheWithTargetStorage):
2670         Full implementation of https://www.w3.org/TR/service-workers-1/#query-cache-algorithm with a provided targetStorage argument.
2671         (WebCore::Cache::batchDeleteOperation):
2672         Implementation of https://www.w3.org/TR/service-workers-1/#batch-cache-operations-algorithm but dedicated to a delete operation.
2673         Delete operation are always done one at a time.
2674         (WebCore::Cache::batchPutOperation):
2675         Implementation of https://www.w3.org/TR/service-workers-1/#batch-cache-operations-algorithm dedicated to a put operation.
2676         Put operation takes one record for put but can take several records in the case of addAll, hence the current design.
2677         (WebCore::Cache::updateRequestToResponseMap):
2678         Update the cache request to response map based on the records retrieved from the cache storage connection.
2679         * Modules/cache/Cache.h:
2680         (WebCore::Cache::create):
2681         (WebCore::Cache::name const):
2682         * Modules/cache/Cache.idl:
2683         * Modules/cache/CacheStorage.cpp:
2684         (WebCore::CacheStorage::origin const):
2685         Computing the cache origin that is passed to the CacheStorageConnection.
2686         (WebCore::CacheStorage::has):
2687         Implementation of https://www.w3.org/TR/service-workers-1/#cache-storage-has.
2688         Call the cache storage connection to refresh its cache map.
2689         Then use it to check whether a cache exists.
2690         (WebCore::CacheStorage::refreshCacheMap):
2691         Use the cache storage connection to get the list of existing caches.
2692         (WebCore::CacheStorage::open):
2693         Implementation of https://www.w3.org/TR/service-workers-1/#cache-storage-open.
2694         Refreshing the cache map so as to return a pre-existing cache if any.
2695         (WebCore::CacheStorage::remove):
2696         Implementation of https://www.w3.org/TR/service-workers-1/#cache-storage-delete-method.
2697         Refreshing the cache map so as to do nothing if there is no cache to remove.
2698         (WebCore::CacheStorage::keys):
2699         Implementation of https://www.w3.org/TR/service-workers-1/#cache-storage-keys-method.
2700         Refreshing the cache map and returnin its keys.
2701         As per spec, the cache map is ordered. We implement it as a Vector.
2702         (WebCore::CacheStorage::cacheMap):
2703         Get the list of cache objects, used as a private accessor for JS built-ins.
2704         * Modules/cache/CacheStorage.h:
2705         (WebCore::CacheStorage::create):
2706         (WebCore::CacheStorage::CacheStorage):
2707         * Modules/cache/CacheStorageConnection.cpp: Added.
2708         (WebCore::CacheStorageConnection::exceptionFromError):
2709         * Modules/cache/CacheStorageConnection.h: Added.
2710         Makes the link between Web facing Cache API and the cache storage engine.
2711         Envisioned implementation are:
2712         - One main thread connection used by all documents in the given process.
2713         - One connection per worker that forwards the calls to the main thread and use the main thread connection afterwards.
2714         (WebCore::CacheStorageConnection::create):
2715         (WebCore::CacheStorageConnection::open):
2716         (WebCore::CacheStorageConnection::remove):
2717         (WebCore::CacheStorageConnection::refreshCacheMap):
2718         (WebCore::CacheStorageConnection::refreshRequestToResponseMap):
2719         (WebCore::CacheStorageConnection::batchDeleteOperation):
2720         (WebCore::CacheStorageConnection::batchPutOperation):
2721         * Modules/cache/CacheStorageRecord.h: Added. A fetch record from the Web facing cache API perspective.
2722         * Modules/cache/DOMWindowCaches.cpp:
2723         (WebCore::DOMWindowCaches::caches const):
2724         * Modules/cache/WorkerGlobalScopeCaches.cpp:
2725         (WebCore::WorkerGlobalScopeCaches::from):
2726         (WebCore::WorkerGlobalScopeCaches::caches const):
2727         * Modules/cache/WorkerGlobalScopeCaches.h:
2728         (WebCore::WorkerGlobalScopeCaches::WorkerGlobalScopeCaches):
2729         * Modules/fetch/FetchBodyOwner.h:
2730         (WebCore::FetchBodyOwner::isReadableStreamBody const): Added getter as it is used by cache API.
2731         * Modules/fetch/FetchHeaders.h:
2732         (WebCore::FetchHeaders::create): Add another create as used by the cache API.
2733         (WebCore::FetchHeaders::guard const): Added getter and IPC serializer as this is something that will be stored by the cache engine.
2734         * Modules/fetch/FetchLoader.cpp:
2735         (WebCore::FetchLoader::start):
2736         * Modules/fetch/FetchRequest.cpp:
2737         (WebCore::buildOptions): In case FetchRequest::create is called from C++, there is no need to set init.window to a null value.
2738         Add a check so that no value at all is the same as a null/undefined value.
2739         (WebCore::FetchRequest::resourceRequest const):
2740         * Modules/fetch/FetchRequest.h:
2741         * Modules/fetch/FetchResponse.h:
2742         * WebCore.xcodeproj/project.pbxproj:
2743         * inspector/InspectorOverlay.cpp:
2744         (WebCore::InspectorOverlay::overlayPage):
2745         * page/CacheStorageProvider.h: Added.
2746         Interface to create main thread cache storage connection for the given page.
2747         There will be one provider for each process.
2748         Passing a sessionID so that we will create a connection per session.
2749         * page/Page.cpp:
2750         (WebCore::Page::Page):
2751         * page/Page.h:
2752         (WebCore::Page::cacheStorageProvider):
2753         * page/PageConfiguration.cpp:
2754         (WebCore::PageConfiguration::PageConfiguration):
2755         * page/PageConfiguration.h:
2756         * svg/graphics/SVGImage.cpp:
2757         (WebCore::SVGImage::dataChanged):
2758
2759 2017-08-15  Chris Dumez  <cdumez@apple.com>
2760
2761         Implement quota limitation for keepalive Fetch requests
2762         https://bugs.webkit.org/show_bug.cgi?id=175482
2763
2764         Reviewed by Sam Weinig and Youenn Fablet.
2765
2766         Implement quota limitation for keepalive Fetch requests as per:
2767         - https://fetch.spec.whatwg.org/#http-network-or-cache-fetch (Step 9)
2768
2769         This partly works for Beacon as well, meaning that no Beacon with a body
2770         over 64Kb can be sent. However, we don't keep track about wether or not
2771         beacon loads are inflight or not.
2772
2773         Also update CachedResourceLoader::requestResource() so that the caller
2774         can get a ResourceError when it returns null. This is useful for both
2775         Fetch and Beacon to return better error messages.
2776
2777         Test: http/wpt/beacon/beacon-quota.html
2778
2779         * CMakeLists.txt:
2780         * Modules/beacon/NavigatorBeacon.cpp:
2781         (WebCore::NavigatorBeacon::sendBeacon):
2782         * Modules/fetch/FetchBodyOwner.cpp:
2783         (WebCore::FetchBodyOwner::BlobLoader::didReceiveResponse):
2784         (WebCore::FetchBodyOwner::BlobLoader::didFail):
2785         * Modules/fetch/FetchBodyOwner.h:
2786         * Modules/fetch/FetchLoader.cpp:
2787         (WebCore::FetchLoader::start):
2788         (WebCore::FetchLoader::didFail):
2789         * Modules/fetch/FetchLoaderClient.h:
2790         * Modules/fetch/FetchResponse.cpp:
2791         (WebCore::FetchResponse::BodyLoader::didFail):
2792         * Modules/fetch/FetchResponse.h:
2793         * WebCore.xcodeproj/project.pbxproj:
2794         * loader/DocumentThreadableLoader.cpp:
2795         (WebCore::DocumentThreadableLoader::loadRequest):
2796         * loader/cache/CachedResource.cpp:
2797         (WebCore::CachedResource::load):
2798         * loader/cache/CachedResource.h:
2799         (WebCore::CachedResource::isMainOrMediaOrIconOrRawResource const):
2800         * loader/cache/CachedResourceLoader.cpp:
2801         (WebCore::createResource):
2802         (WebCore::CachedResourceLoader::requestImage):
2803         (WebCore::CachedResourceLoader::requestFont):
2804         (WebCore::CachedResourceLoader::requestTextTrack):
2805         (WebCore::CachedResourceLoader::requestCSSStyleSheet):
2806         (WebCore::CachedResourceLoader::requestUserCSSStyleSheet):
2807         (WebCore::CachedResourceLoader::requestScript):
2808         (WebCore::CachedResourceLoader::requestXSLStyleSheet):
2809         (WebCore::CachedResourceLoader::requestSVGDocument):
2810         (WebCore::CachedResourceLoader::requestLinkResource):
2811         (WebCore::CachedResourceLoader::requestMedia):
2812         (WebCore::CachedResourceLoader::requestIcon):
2813         (WebCore::CachedResourceLoader::requestRawResource):
2814         (WebCore::CachedResourceLoader::requestBeaconResource):
2815         (WebCore::CachedResourceLoader::requestMainResource):
2816         (WebCore::CachedResourceLoader::requestResource):
2817         (WebCore::CachedResourceLoader::preload):
2818         * loader/cache/CachedResourceLoader.h:
2819         * loader/cache/KeepaliveRequestTracker.cpp: Added.
2820         (WebCore::KeepaliveRequestTracker::~KeepaliveRequestTracker):
2821         (WebCore::KeepaliveRequestTracker::canLoadRequest):
2822         (WebCore::KeepaliveRequestTracker::registerRequest):
2823         (WebCore::KeepaliveRequestTracker::responseReceived):
2824         (WebCore::KeepaliveRequestTracker::notifyFinished):
2825         (WebCore::KeepaliveRequestTracker::unregisterRequest):
2826         * loader/cache/KeepaliveRequestTracker.h: Added.
2827         * platform/network/FormData.cpp:
2828         (WebCore::FormDataElement::lengthInBytes const):
2829         (WebCore::FormData::lengthInBytes const):
2830         * platform/network/FormData.h:
2831
2832 2017-08-15  Darin Adler  <darin@apple.com>
2833
2834         REGRESSION(r220052): http/tests/appcache/deferred-events-delete-while-raising-timer.html is crashing.
2835         https://bugs.webkit.org/show_bug.cgi?id=175107
2836
2837         Reviewed by Alexey Proskuryakov.
2838
2839         * loader/FrameLoader.cpp:
2840         (WebCore::FrameLoader::checkLoadComplete): Moved the assertion to after the null page check.
2841
2842 2017-08-15  Commit Queue  <commit-queue@webkit.org>
2843
2844         Unreviewed, rolling out r219504.
2845         https://bugs.webkit.org/show_bug.cgi?id=175580
2846
2847         Broke Arabic text shaping (Requested by mcatanzaro on
2848         #webkit).
2849
2850         Reverted changeset:
2851
2852         "[HarfBuzz] Decomposed Vietnamese characters are rendered
2853         incorrectly"
2854         https://bugs.webkit.org/show_bug.cgi?id=174418
2855         http://trac.webkit.org/changeset/219504
2856
2857 2017-08-14  Carlos Garcia Campos  <cgarcia@igalia.com>
2858
2859         WebDriver: handle click events on option elements
2860         https://bugs.webkit.org/show_bug.cgi?id=174710
2861         <rdar://problem/33459305>
2862
2863         Reviewed by Brian Burg.
2864
2865         Export WebCore symbols required by WebKit layer.
2866
2867         * html/HTMLOptGroupElement.h:
2868         * html/HTMLOptionElement.h:
2869
2870 2017-08-14  Simon Fraser  <simon.fraser@apple.com>
2871
2872         Remove Proximity Events and related code
2873         https://bugs.webkit.org/show_bug.cgi?id=175545
2874
2875         Reviewed by Daniel Bates.
2876
2877         No platform enables Proximity Events, so remove code inside ENABLE(PROXIMITY_EVENTS)
2878         and other related code.
2879
2880         * CMakeLists.txt:
2881         * Configurations/FeatureDefines.xcconfig:
2882         * DerivedSources.cpp:
2883         * Modules/proximity/DeviceProximityClient.h: Removed.
2884         * Modules/proximity/DeviceProximityController.cpp: Removed.
2885         * Modules/proximity/DeviceProximityController.h: Removed.
2886         * Modules/proximity/DeviceProximityEvent.cpp: Removed.
2887         * Modules/proximity/DeviceProximityEvent.h: Removed.
2888         * Modules/proximity/DeviceProximityEvent.idl: Removed.
2889         * dom/EventNames.h:
2890         * dom/EventNames.in:
2891         * history/PageCache.cpp:
2892         (WebCore::canCachePage):
2893         * page/DOMWindow.cpp:
2894         (WebCore::DOMWindow::addEventListener):
2895         (WebCore::DOMWindow::removeEventListener):
2896         (WebCore::DOMWindow::removeAllEventListeners):
2897         * page/DOMWindow.idl:
2898         * page/DiagnosticLoggingKeys.cpp:
2899         (WebCore::DiagnosticLoggingKeys::deviceProximityKey): Deleted.
2900         * page/DiagnosticLoggingKeys.h:
2901         * testing/Internals.cpp:
2902         (WebCore::Internals::setDeviceProximity): Deleted.
2903         * testing/Internals.h:
2904         * testing/Internals.idl:
2905
2906 2017-08-14  Simon Fraser  <simon.fraser@apple.com>
2907
2908         Remove ENABLE(REQUEST_AUTOCOMPLETE) code, which was disabled everywhere
2909         https://bugs.webkit.org/show_bug.cgi?id=175504
2910
2911         Reviewed by Sam Weinig.
2912         
2913         REQUEST_AUTOCOMPLETE was added in r133396 then removed in r148731, but brought back in r173596,
2914         however no further work was done, and it was left disabled. So remove the code.
2915
2916         * Configurations/FeatureDefines.xcconfig:
2917         * DerivedSources.make:
2918         * WebCore.xcodeproj/project.pbxproj:
2919         * dom/AutocompleteErrorEvent.h: Removed.
2920         * dom/AutocompleteErrorEvent.idl: Removed.
2921         * dom/EventNames.in:
2922         * dom/GlobalEventHandlers.idl:
2923         * html/HTMLFormElement.cpp:
2924         (WebCore::HTMLFormElement::HTMLFormElement):
2925         (WebCore::HTMLFormElement::requestAutocomplete): Deleted.
2926         (WebCore::HTMLFormElement::finishRequestAutocomplete): Deleted.
2927         (WebCore::HTMLFormElement::requestAutocompleteTimerFired): Deleted.
2928         * html/HTMLFormElement.h:
2929         * html/HTMLFormElement.idl:
2930         * loader/EmptyClients.cpp:
2931         * loader/FrameLoaderClient.h:
2932
2933 2017-08-14  Chris Dumez  <cdumez@apple.com>
2934
2935         XHR should only fire an abort event if the cancellation was requested by the client
2936         https://bugs.webkit.org/show_bug.cgi?id=175546
2937
2938         Reviewed by Youenn Fablet.
2939
2940         XHR should only fire an abort event if the cancellation was requested by the client, otherwise it should fire an error event.
2941         Blink and Gecko already match the specification.
2942
2943         Specification:
2944         - https://xhr.spec.whatwg.org/#handle-errors
2945         - https://xhr.spec.whatwg.org/#the-abort()-method
2946
2947         Test: http/tests/navigation/page-cache-xhr-in-pagehide.html
2948
2949         * xml/XMLHttpRequest.cpp:
2950         (WebCore::XMLHttpRequest::open):
2951         (WebCore::XMLHttpRequest::abort):
2952         (WebCore::XMLHttpRequest::abortError):
2953         (WebCore::XMLHttpRequest::didFail):
2954         * xml/XMLHttpRequest.h:
2955
2956 2017-08-14  Simon Fraser  <simon.fraser@apple.com>
2957
2958         Remove ENABLE_VIEW_MODE_CSS_MEDIA and related code
2959         https://bugs.webkit.org/show_bug.cgi?id=175557
2960
2961         Reviewed by Jon Lee.
2962
2963         No port cares about the ENABLE(VIEW_MODE_CSS_MEDIA) feature, so remove it.
2964
2965         * Configurations/FeatureDefines.xcconfig:
2966         * css/CSSValueKeywords.in:
2967         * css/MediaFeatureNames.h:
2968         * css/MediaQueryEvaluator.cpp:
2969         (WebCore::viewModeEvaluate): Deleted.
2970         * css/MediaQueryExpression.cpp:
2971         (WebCore::featureWithValidIdent):
2972         (WebCore::isFeatureValidWithoutValue):
2973         * page/Page.cpp:
2974         (WebCore::Page::stringToViewMode): Deleted.
2975         (WebCore::Page::setViewMode): Deleted.
2976         * page/Page.h:
2977         (WebCore::Page::viewMode const): Deleted.
2978
2979 2017-08-14  Myles C. Maxfield  <mmaxfield@apple.com>
2980
2981         Parse font-display
2982         https://bugs.webkit.org/show_bug.cgi?id=175382
2983
2984         Reviewed by Simon Fraser.
2985
2986         The syntax is very simple: font-display: auto | block | swap | fallback | optional.
2987         So, parsing support is quite straightfoward.
2988
2989         Test: fast/text/font-display/parse.html
2990
2991         * css/CSSComputedStyleDeclaration.cpp:
2992         (WebCore::ComputedStyleExtractor::propertyValue):
2993         * css/CSSFontFace.cpp:
2994         (WebCore::CSSFontFace::setLoadingBehavior):
2995         * css/CSSFontFace.h:
2996         * css/CSSFontSelector.cpp:
2997         (WebCore::CSSFontSelector::addFontFaceRule):
2998         * css/CSSPrimitiveValueMappings.h:
2999         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
3000         (WebCore::CSSPrimitiveValue::operator FontLoadingBehavior const):
3001         * css/CSSProperties.json:
3002         * css/CSSProperty.cpp:
3003         (WebCore::CSSProperty::isDescriptorOnly):
3004         * css/CSSValueKeywords.in:
3005         * css/parser/CSSPropertyParser.cpp:
3006         (WebCore::consumeFontFaceFontDisplay):
3007         (WebCore::CSSPropertyParser::parseFontFaceDescriptor):
3008         * rendering/style/RenderStyleConstants.h:
3009
3010 2017-08-14  Jer Noble  <jer.noble@apple.com>
3011
3012         Obj-C exception crash in AVStreamSession when using EME in Private Browsing mode
3013         https://bugs.webkit.org/show_bug.cgi?id=175547
3014
3015         Reviewed by Eric Carlson.
3016
3017         When the storagePath() is empty, do not use those AVStreamSession APIs which require a valid file path to stored
3018         proof-of-key-release data.
3019
3020         Drive-by fix: return emptyString() from HTMLMediaElement::mediaPlayerMediaKeysStorageDirectory() when in Private
3021         Browsing mode, to match the behavior of WebKitMediaKeySession.
3022
3023         * html/HTMLMediaElement.cpp:
3024         (WebCore::HTMLMediaElement::mediaPlayerMediaKeysStorageDirectory const):
3025         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
3026         (WebCore::CDMSessionAVStreamSession::releaseKeys):
3027         (WebCore::CDMSessionAVStreamSession::update):
3028         (WebCore::CDMSessionAVStreamSession::generateKeyReleaseMessage):
3029
3030 2017-08-14  Andy Estes  <aestes@apple.com>
3031
3032         REGRESSION (r220456): Crash in PreviewLoader::shouldCreateForMIMEType() when a ResourceResponse has a null MIME type
3033         https://bugs.webkit.org/show_bug.cgi?id=175548
3034         <rdar://problem/33866206>
3035
3036         Reviewed by Brady Eidson.
3037
3038         New API test: QuickLook.ShouldCreateForMIMEType
3039
3040         * WebCore.xcodeproj/project.pbxproj:
3041         * loader/ios/PreviewLoader.h:
3042         * loader/ios/PreviewLoader.mm:
3043         (WebCore::PreviewLoader::shouldCreateForMIMEType): Check if mimeType is a null String before
3044         calling HashSet::contains().
3045
3046 2017-08-14  Andy Estes  <aestes@apple.com>
3047
3048         [Apple Pay] Add support for phonetic contact names
3049         https://bugs.webkit.org/show_bug.cgi?id=175537
3050         <rdar://problem/32002644>
3051
3052         Reviewed by Tim Horton.
3053
3054         * Modules/applepay/ApplePayError.idl: Defined "phoneticName" in ApplePayErrorContactField.
3055         * Modules/applepay/ApplePayPaymentContact.h: Defined phoneticGivenName and phoneticFamilyName
3056         in ApplePayPaymentContact.
3057         * Modules/applepay/ApplePayPaymentContact.idl: Ditto.
3058         * Modules/applepay/ApplePayPaymentRequest.h: Defined PhoneticName in
3059         ApplePayPaymentRequest::ContactField.
3060         * Modules/applepay/ApplePayPaymentRequest.idl: Defined "phoneticName" in ApplePayContactField.
3061         * Modules/applepay/ApplePaySession.cpp:
3062         (WebCore::convertAndValidate): Added a version parameter. Added code to convert
3063         ContactField::PhoneticName, throwing an exception if version is less than 3.
3064         * Modules/applepay/PaymentContact.h: Added a version parameter to fromApplePayPaymentContact().
3065         * Modules/applepay/PaymentRequest.h: Defined phoneticName in PaymentRequest::ContactFields
3066         and defined PhoneticName in PaymentError::ContactField.
3067         * Modules/applepay/cocoa/PaymentContactCocoa.mm:
3068         (WebCore::convert): Added a version parameter. Set a phoneticRepresentation on the
3069         PKContact's name if there are non-empty phonetic names and version is 3 or greater.
3070         (WebCore::PaymentContact::fromApplePayPaymentContact): Passed version to convert().
3071
3072 2017-08-14  Said Abou-Hallawa  <sabouhallawa@apple.com>
3073
3074         The none smooth stroke applied to an SVG shape breaks its hit testing
3075         https://bugs.webkit.org/show_bug.cgi?id=175506
3076
3077         Reviewed by Simon Fraser.
3078
3079         Clear RenderSVGShape::m_path when calling RenderSVGRect::updateShapeFromElement().
3080         The m_path will be recalculated when RenderSVGShape::updateShapeFromElement()
3081         is called from RenderSVGRect::shapeDependentStrokeContains().
3082
3083         Test: svg/stroke/stroke-linejoin-click.html
3084
3085         * rendering/svg/RenderSVGRect.cpp:
3086         (WebCore::RenderSVGRect::updateShapeFromElement):
3087         * rendering/svg/RenderSVGShape.h:
3088         (WebCore::RenderSVGShape::clearPath):
3089
3090 2017-08-14  Adrian Perez de Castro  <aperez@igalia.com>
3091
3092         [WPE] Implement WebCore::standardUserAgent()
3093         https://bugs.webkit.org/show_bug.cgi?id=175507
3094
3095         Reviewed by Michael Catanzaro.
3096
3097         Remove "_GLIB" from user-agent version macros.
3098
3099         * platform/glib/UserAgentGLib.cpp:
3100         (WebCore::versionForUAString):
3101
3102 2017-08-14  Chris Dumez  <cdumez@apple.com>
3103
3104         Unreviewed, rollout r220622 & r220696
3105         https://bugs.webkit.org/show_bug.cgi?id=175482
3106         <rdar://problem/33860695>
3107
3108         Seems to have caused failures on iOS.
3109
3110         * CMakeLists.txt:
3111         * Modules/beacon/NavigatorBeacon.cpp:
3112         (WebCore::NavigatorBeacon::sendBeacon):
3113         * Modules/fetch/FetchBodyOwner.cpp:
3114         (WebCore::FetchBodyOwner::BlobLoader::didReceiveResponse):
3115         (WebCore::FetchBodyOwner::BlobLoader::didFail):
3116         * Modules/fetch/FetchBodyOwner.h:
3117         * Modules/fetch/FetchLoader.cpp:
3118         (WebCore::FetchLoader::start):
3119         (WebCore::FetchLoader::didFail):
3120         * Modules/fetch/FetchLoaderClient.h:
3121         * Modules/fetch/FetchResponse.cpp:
3122         (WebCore::FetchResponse::BodyLoader::didFail):
3123         * Modules/fetch/FetchResponse.h:
3124         * WebCore.xcodeproj/project.pbxproj:
3125         * loader/DocumentThreadableLoader.cpp:
3126         (WebCore::DocumentThreadableLoader::loadRequest):
3127         * loader/cache/CachedRawResource.cpp:
3128         (WebCore::CachedRawResource::finishLoading):
3129         * loader/cache/CachedResource.cpp:
3130         (WebCore::CachedResource::load):
3131         * loader/cache/CachedResource.h:
3132         (WebCore::CachedResource::isMainOrMediaOrIconOrRawResource const):
3133         * loader/cache/CachedResourceLoader.cpp:
3134         (WebCore::createResource):
3135         (WebCore::CachedResourceLoader::requestImage):
3136         (WebCore::CachedResourceLoader::requestFont):
3137         (WebCore::CachedResourceLoader::requestTextTrack):
3138         (WebCore::CachedResourceLoader::requestCSSStyleSheet):
3139         (WebCore::CachedResourceLoader::requestUserCSSStyleSheet):
3140         (WebCore::CachedResourceLoader::requestScript):
3141         (WebCore::CachedResourceLoader::requestXSLStyleSheet):
3142         (WebCore::CachedResourceLoader::requestSVGDocument):
3143         (WebCore::CachedResourceLoader::requestLinkResource):
3144         (WebCore::CachedResourceLoader::requestMedia):
3145         (WebCore::CachedResourceLoader::requestIcon):
3146         (WebCore::CachedResourceLoader::requestRawResource):
3147         (WebCore::CachedResourceLoader::requestBeaconResource):
3148         (WebCore::CachedResourceLoader::requestMainResource):
3149         (WebCore::CachedResourceLoader::requestResource):
3150         (WebCore::CachedResourceLoader::preload):
3151         * loader/cache/CachedResourceLoader.h:
3152         * loader/cache/KeepaliveRequestTracker.cpp: Removed.
3153         * loader/cache/KeepaliveRequestTracker.h: Removed.
3154         * platform/network/FormData.cpp:
3155         (WebCore::FormData::appendFile):
3156         (WebCore::FormData::appendFileRange):
3157         (WebCore::FormData::appendBlob):
3158         (WebCore::FormData::expandDataStore):
3159         * platform/network/FormData.h:
3160
3161 2017-08-14  Daniel Bates  <dabates@apple.com>
3162
3163         [css-ui] Implement caret-color support
3164         https://bugs.webkit.org/show_bug.cgi?id=166572
3165         <rdar://problem/33852589>
3166
3167         Reviewed by David Hyatt.
3168
3169         Add support for the CSS property caret-color as per <https://www.w3.org/TR/css-ui-3/#caret-color> (02 March 2017).
3170         The property caret-color specifies the color of the text insertion caret in an editable element,
3171         say an HTML textarea element.
3172
3173         Unlike other CSS color properties caret-color can have value "auto" and this is its initial
3174         value. Internally we treat value "auto" as an invalid caret color to simplify the code.
3175
3176         Tests: editing/pasteboard/preserve-caret-color.html
3177                fast/css/caret-color-auto.html
3178                fast/css/caret-color-fallback-to-color.html
3179                fast/css/caret-color-inherit.html
3180                fast/css/caret-color-span-inside-editable-parent.html
3181                fast/css/caret-color.html
3182                fast/history/visited-link-caret-color.html
3183
3184         * css/CSSComputedStyleDeclaration.cpp:
3185         (WebCore::ComputedStyleExtractor::propertyValue):
3186         * css/CSSProperties.json: Add property caret-color. We represent the initial  "auto" Also, fix up
3187         wording in a comment while I am here.
3188         * css/StyleResolver.cpp:
3189         (WebCore::isValidVisitedLinkProperty): Add caret-color to the list of properties that can be
3190         applied to visited hyperlinks.
3191         * css/parser/CSSParserFastPaths.cpp:
3192         (WebCore::parseCaretColor): Added.
3193         (WebCore::CSSParserFastPaths::maybeParseValue): Unlike other CSS color properties caret-color
3194         can be defined to be "auto". We explicitly check if the property is caret-color and use
3195         parseCaretColor() to parse its value.
3196         * css/parser/CSSPropertyParser.cpp:
3197         (WebCore::consumeCaretColor): Added.
3198         (WebCore::CSSPropertyParser::parseSingleValue): Similar to the change to CSSParserFastPaths::maybeParseValue()
3199         use a dedicated code path to parse caret-color.
3200         * editing/EditingStyle.cpp: Preserve caret-color during editing operations.
3201         * editing/FrameSelection.cpp:
3202         (WebCore::CaretBase::paintCaret const): Modified code to query property caret-color instead of
3203         color for the color of the text insertion caret. Always honor the caret-color of the editable
3204         element if it is valid color. Note that "caret-color: auto" is treated as an invalid color
3205         internally. A caret-color can have an invalid color if its inherits from the CSS color property
3206         with an invalid color. If caret-color is a valid color then we take it to be the color of the
3207         text insertion caret. Otherwise, we do what we do today and use a heuristic to determine the
3208         color of the text-insertion caret.
3209         (WebCore::disappearsIntoBackground): Deleted; moved logic into CaretBase::paintCaret().
3210         * page/animation/CSSPropertyAnimation.cpp:
3211         (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): Add property wrapper
3212         to support animating caret-color.
3213         * rendering/style/RenderStyle.cpp:
3214         (WebCore::RenderStyle::changeRequiresRepaintIfTextOrBorderOrOutline const): Modified to consider
3215         changes to caret color.
3216         (WebCore::RenderStyle::colorIncludingFallback const): Modified to compute the appropriate
3217         color for property caret-color with respect to an unvisited or visited link.
3218         * rendering/style/RenderStyle.h:
3219         (WebCore::RenderStyle::setCaretColor): Added.
3220         (WebCore::RenderStyle::setVisitedLinkCaretColor): Added.
3221         (WebCore::RenderStyle::caretColor const): Added.
3222         (WebCore::RenderStyle::visitedLinkCaretColor const): Added.
3223         * rendering/style/StyleRareInheritedData.cpp:
3224         (WebCore::StyleRareInheritedData::StyleRareInheritedData): Modified to consider caret color.
3225         (WebCore::StyleRareInheritedData::operator== const): Ditto.
3226         * rendering/style/StyleRareInheritedData.h:
3227
3228 2017-08-14  Zan Dobersek  <zdobersek@igalia.com>
3229
3230         REGRESSION(r220517-r220521) [GTK] Various compositing tests fail
3231         https://bugs.webkit.org/show_bug.cgi?id=175478
3232
3233         Reviewed by Sergio Villar Senin.
3234
3235         Fix a regression introduced in r220519. Move a framebuffer binding in TextureMapperGL
3236         away from GraphicsContext3D and onto the OpenGL API to work around the framebuffer
3237         binding state that's kept in the GraphicsContext3D class. This mismatch in how the
3238         framebuffer was bound was causing a couple of test failures in compositing tests.
3239
3240         No new tests -- regressed tests have their failure expectations removed.
3241
3242         * platform/graphics/texmap/TextureMapperGL.cpp:
3243         (WebCore::TextureMapperGL::bindDefaultSurface): Don't use GraphicsContext3D for the
3244         glBindFramebuffer() call. This would be done in subsequent patches that would move
3245         TextureMapperGL off the GraphicsContext3D usage, but this specific use case clashes
3246         with the framebuffer binding that's done in BitmapTextureGL and was causing test
3247         failures.
3248
3249 2017-08-14  Chris Dumez  <cdumez@apple.com>
3250
3251         Unreviewed fix after r220622 to address crashes on iOS.
3252
3253         * loader/cache/CachedRawResource.cpp:
3254         (WebCore::CachedRawResource::finishLoading):
3255
3256 2017-08-14  Antti Koivisto  <antti@apple.com>
3257
3258         Factor text autosizing into a class
3259         https://bugs.webkit.org/show_bug.cgi?id=175530
3260
3261         Reviewed by Andreas Kling.
3262
3263         Move the remaining parts out of Document.
3264
3265         * css/StyleBuilderCustom.h:
3266         (WebCore::computeLineHeightMultiplierDueToFontSize):
3267         * dom/Document.cpp:
3268         (WebCore::Document::destroyRenderTree):
3269         (WebCore::Document::textAutoSizing):
3270         (WebCore::TextAutoSizingTraits::constructDeletedValue): Deleted.
3271         (WebCore::TextAutoSizingTraits::isDeletedValue): Deleted.
3272         (WebCore::Document::addAutoSizedNode): Deleted.
3273         (WebCore::Document::updateAutoSizedNodes): Deleted.
3274         (WebCore::Document::clearAutoSizedNodes): Deleted.
3275         * dom/Document.h:
3276         * rendering/RenderBlockFlow.cpp:
3277         (WebCore::RenderBlockFlow::adjustComputedFontSizes):
3278         * rendering/RenderElement.cpp:
3279         (WebCore::RenderElement::adjustComputedFontSizesOnBlocks):
3280         (WebCore::RenderElement::resetTextAutosizing):
3281         * rendering/TextAutoSizing.cpp:
3282         (WebCore::TextAutoSizingTraits::constructDeletedValue):
3283         (WebCore::TextAutoSizingTraits::isDeletedValue):
3284         (WebCore::TextAutoSizing::addTextNode):
3285         (WebCore::TextAutoSizing::updateRenderTree):
3286         (WebCore::TextAutoSizing::reset):
3287         * rendering/TextAutoSizing.h:
3288
3289 2017-08-14  Antti Koivisto  <antti@apple.com>
3290
3291         [Render Tree Mutation] First letter should not mutate the render tree while in layout.
3292         https://bugs.webkit.org/show_bug.cgi?id=163848
3293
3294         Reviewed by Zalan Bujtas.
3295
3296         RenderBlock::updateFirstLetter shouldn't be called during layout. Instead it should
3297         be invoked by the RenderTreeUpdater.
3298
3299         With this future patches can move updateFirstLetter() and the related functions
3300         completely out of the render tree.
3301
3302         * rendering/RenderBlock.cpp:
3303         (WebCore::RenderBlock::layout):
3304
3305             No more updateFirstLetter calls during layout...
3306
3307         (WebCore::RenderBlock::computePreferredLogicalWidths):
3308
3309             ...or preferred width computation.
3310
3311         (WebCore::RenderBlock::updateFirstLetter):
3312         * rendering/RenderBlock.h:
3313         * rendering/RenderRubyRun.cpp:
3314         (WebCore::RenderRubyRun::updateFirstLetter):
3315         * rendering/RenderRubyRun.h:
3316         * rendering/RenderTable.cpp:
3317         (WebCore::RenderTable::updateFirstLetter):
3318         * rendering/RenderTable.h:
3319         * rendering/svg/RenderSVGText.cpp:
3320         (WebCore::RenderSVGText::updateFirstLetter):
3321         * rendering/svg/RenderSVGText.h:
3322         * style/RenderTreeUpdater.cpp:
3323         (WebCore::RenderTreeUpdater::popParent):
3324
3325             Call updateFirstLetter when closing the element. All of of descedant renderers are known here
3326             so this can be resolved correctly.
3327
3328 2017-08-13  Manuel Rego Casasnovas  <rego@igalia.com>
3329
3330         Composition underline color is always black
3331         https://bugs.webkit.org/show_bug.cgi?id=174675
3332
3333         Reviewed by Ryosuke Niwa.
3334
3335         This patch uses the current color of the text instead of black
3336         for the composition underline marker.
3337         This makes it visible in the case we have a black/dark background.
3338
3339         Test: editing/composition-underline-color.html
3340
3341         * editing/CompositionUnderline.h:
3342         (WebCore::CompositionUnderline::CompositionUnderline):
3343         Added new attribute compositionUnderlineColor.
3344         * rendering/InlineTextBox.cpp:
3345         (WebCore::InlineTextBox::paintCompositionUnderline):
3346         Use the text color if compositionUnderlineColor is TextColor.
3347
3348 2017-08-13  Carlos Garcia Campos  <cgarcia@igalia.com>
3349
3350         [GTK] stop kinetic scrolling when a zero movement is reached
3351         https://bugs.webkit.org/show_bug.cgi?id=175468
3352
3353         Reviewed by Michael Catanzaro.
3354
3355         This is GTK+ change by Christian Hergert.
3356         https://git.gnome.org/browse/gtk+/commit/?h=gtk-3-22&id=4f63d839550f7a9038b391e7d3e1e6fc8bdfafa6
3357
3358         When the kinetic scrolling reduces its speed, there can be multiple frames where the movement is zero pixels,
3359         followed by a 1 pixel movement later on. This causes a "jitter" right at the end of the scroll which makes it
3360         feel less quality than other platforms. Instead, we should just clamp it as soon as we get a zero movement.
3361
3362         * platform/ScrollAnimationKinetic.cpp:
3363         (WebCore::ScrollAnimationKinetic::PerAxisData::animateScroll):
3364
3365 2017-08-13  Chris Dumez  <cdumez@apple.com>
3366
3367         Drop non-const getter for CachedResource::resourceRequest()
3368         https://bugs.webkit.org/show_bug.cgi?id=175524
3369
3370         Reviewed by Youenn Fablet.
3371
3372         Drop non-const getter for CachedResource::resourceRequest(). It would be unsafe to modify the request of a CachedResource
3373         after it has been cached. Exposing such a getter is therefore a footgun.
3374
3375         * loader/LinkLoader.cpp:
3376         (WebCore::LinkLoader::preloadIfNeeded):
3377         * loader/cache/CachedImage.cpp:
3378         (WebCore::CachedImage::CachedImage):
3379         * loader/cache/CachedImage.h:
3380         * loader/cache/CachedResource.cpp:
3381         (WebCore::CachedResource::CachedResource):
3382         * loader/cache/CachedResource.h:
3383         (WebCore::CachedResource::resourceRequest const):
3384         (WebCore::CachedResource::ignoreForRequestCount const):
3385         (WebCore::CachedResource::setIgnoreForRequestCount):
3386         * loader/cache/CachedResourceLoader.cpp:
3387         (WebCore::CachedResourceLoader::requestResource):
3388         * loader/cache/CachedResourceRequest.h:
3389         (WebCore::CachedResourceRequest::ignoreForRequestCount const):
3390         (WebCore::CachedResourceRequest::setIgnoreForRequestCount):
3391         * loader/cache/MemoryCache.cpp:
3392         (WebCore::MemoryCache::addImageToCache):
3393         * platform/network/ResourceRequestBase.h:
3394
3395 2017-08-13  Adrian Perez de Castro  <aperez@igalia.com>
3396
3397         [WPE] Implement WebCore::standardUserAgent()
3398         https://bugs.webkit.org/show_bug.cgi?id=175507
3399
3400         Reviewed by Carlos Alberto Lopez Perez.
3401
3402         Implement missing User-Agent handling for the WPE port by sharing the code with the GTK+ port.
3403
3404         * PlatformGTK.cmake: Handlde renaming of UserAgentGtk.cpp to UserAgentGLib.cpp.
3405         * PlatformWPE.cmake: Add UserAgentGLib.cpp and UserAgentQuirks.cpp to the list of built WebCore sources.
3406         * platform/glib/UserAgentGLib.cpp: Renamed from Source/WebCore/platform/gtk/UserAgentGtk.cpp.
3407         (WebCore::versionForUAString): Change "GTK" in UA version macros to "GLIB".
3408
3409 2017-08-11  Ryosuke Niwa  <rniwa@webkit.org>
3410
3411         Replace DATA_TRANSFER_ITEMS by a runtime flag and add a stub implementation
3412         https://bugs.webkit.org/show_bug.cgi?id=175474
34