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