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