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