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