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