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