fetch redirect is incompatible with "no-cors" mode
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-01-20  Youenn Fablet  <youenn@apple.com>
2
3         fetch redirect is incompatible with "no-cors" mode
4         https://bugs.webkit.org/show_bug.cgi?id=181866
5         <rdar://problem/35827140>
6
7         Reviewed by Chris Dumez.
8
9         Covered by updated tests.
10
11         Return a network error when no-cors mode and redirect mode is manual or error.
12         Update preflight implementation to no longer use manual redirect mode to simulate https://fetch.spec.whatwg.org/#http-network-or-cache-fetch.
13         Instead implement redirectReceived callback to treat any redirect response as the preflight response.
14
15         * loader/cache/CachedResourceLoader.cpp:
16         (WebCore::CachedResourceLoader::canRequest):
17         * loader/CrossOriginPreflightChecker.cpp:
18         (WebCore::CrossOriginPreflightChecker::redirectReceived):
19         (WebCore::CrossOriginPreflightChecker::startPreflight):
20         * loader/CrossOriginPreflightChecker.h:
21
22 2018-01-19  Wenson Hsieh  <wenson_hsieh@apple.com>
23
24         [macOS] [WK2] Drag location is computed incorrectly when dragging content from subframes
25         https://bugs.webkit.org/show_bug.cgi?id=181896
26         <rdar://problem/35479043>
27
28         Reviewed by Tim Horton.
29
30         In r218837, I packaged most of the information needed to start a drag into DragItem, which is propagated to the client layer
31         via the startDrag codepath. However, this introduced a bug in computing the event position and drag location in window
32         coordinates. Consider the case where we're determining the drag image offset for a dragged element in a subframe:
33
34         Before the patch, the drag location (which starts out in the subframe's content coordinates) would be converted to root view
35         coordinates, which would then be converted to mainframe content coordinates, which would then be converted to window coordinates
36         using the mainframe's view. After the patch, we carry out the same math until the last step, where we erroneously use the
37         _subframe's_ view to convert to window coordinates from content coordinates. This results in the position of the iframe relative
38         to the mainframe being accounted for twice.
39
40         To fix this, we simply use the main frame's view to convert from mainframe content coordinates to window coordinates while
41         computing the drag location. As for the event position in window coordinates, this is currently unused by any codepath in WebKit,
42         so we can just remove it altogether.
43
44         Since this bug only affects drag and drop in the macOS WebKit2 port, there's currently no way to test this. I'll be using
45         <https://bugs.webkit.org/show_bug.cgi?id=181898> to track adding test support for drag and drop on macOS WebKit2. Manually tested
46         dragging in both WebKit1 and WebKit2 on macOS. dragLocationInWindowCoordinates isn't used at all for iOS drag and drop.
47
48         * page/DragController.cpp:
49         (WebCore::DragController::doSystemDrag):
50         * platform/DragItem.h:
51         (WebCore::DragItem::encode const):
52         (WebCore::DragItem::decode):
53
54 2018-01-19  Ryan Haddad  <ryanhaddad@apple.com>
55
56         Unreviewed, rolling out r227235.
57
58         The test for this change consistently times out on High
59         Sierra.
60
61         Reverted changeset:
62
63         "Support for preconnect Link headers"
64         https://bugs.webkit.org/show_bug.cgi?id=181657
65         https://trac.webkit.org/changeset/227235
66
67 2018-01-19  Youenn Fablet  <youenn@apple.com>
68
69         Cache storage errors like Quota should trigger console messages
70         https://bugs.webkit.org/show_bug.cgi?id=181879
71         <rdar://problem/36669048>
72
73         Reviewed by Chris Dumez.
74
75         Covered by rebased test.
76
77         * Modules/cache/DOMCache.cpp:
78         (WebCore::DOMCache::retrieveRecords):
79         (WebCore::DOMCache::batchDeleteOperation):
80         (WebCore::DOMCache::batchPutOperation):
81         * Modules/cache/DOMCacheEngine.cpp:
82         (WebCore::DOMCacheEngine::errorToException):
83         (WebCore::DOMCacheEngine::logErrorAndConvertToException):
84         * Modules/cache/DOMCacheEngine.h:
85         * Modules/cache/DOMCacheStorage.cpp:
86         (WebCore::DOMCacheStorage::retrieveCaches):
87         (WebCore::DOMCacheStorage::doOpen):
88         (WebCore::DOMCacheStorage::doRemove):
89
90 2018-01-19  Youenn Fablet  <youenn@apple.com>
91
92         Do not go to the storage process when registering a service worker client if there is no service worker registered
93         https://bugs.webkit.org/show_bug.cgi?id=181740
94         <rdar://problem/36650400>
95
96         Reviewed by Chris Dumez.
97
98         Register a document as service worker client only if there is an existing service worker connection.
99         This allows not creating any connection if no service worker is registered.
100
101         Add internals API to test whether a service worker connection was created or not.
102         This is used by API tests that cover the changes.
103
104         * dom/Document.cpp:
105         (WebCore::Document::privateBrowsingStateDidChange): No need to create a service worker connection if client is not registered yet.
106         (WebCore::Document::setServiceWorkerConnection): No need to unregister/register if service worker connection is the same.
107         Similarly, if Document is to be destroyed or suspended, we should not register it.
108         * loader/DocumentLoader.cpp:
109         (WebCore::DocumentLoader::commitData):
110         * testing/Internals.cpp:
111         (WebCore::Internals::hasServiceWorkerConnection):
112         * testing/Internals.h:
113         * testing/Internals.idl:
114         * workers/service/ServiceWorkerProvider.cpp:
115         (WebCore::ServiceWorkerProvider::registerServiceWorkerClients):
116         * workers/service/ServiceWorkerProvider.h:
117
118 2018-01-19  Dean Jackson  <dino@apple.com>
119
120         REGRESSION (r221092): Swipe actions are hard to perform in FastMail app
121         https://bugs.webkit.org/show_bug.cgi?id=181817
122         <rdar://problem/35274055>
123
124         Add a setting for controlling whether touch listeners are passive
125         by default on document/window/body.
126
127         Updated existing test.
128
129         * dom/EventTarget.cpp:
130         (WebCore::EventTarget::addEventListener):
131         * page/Settings.yaml:
132
133 2018-01-19  Daniel Bates  <dabates@apple.com>
134
135         Update frame-ancestor directive to match Content Security Policy Level 3
136         https://bugs.webkit.org/show_bug.cgi?id=178891
137         <rdar://problem/35209458>
138
139         Reviewed by Alex Christensen.
140
141         Derived from Blink e667cc2e501fabab3605b838e4ee0d642a9c4a59:
142         <https://chromium.googlesource.com/chromium/src.git/+/e667cc2e501fabab3605b838e4ee0d642a9c4a59>
143
144         Update frame-ancestor directive to match against the origin of the ancestor document per the
145         Content Security Policy Level 3 spec.: <https://w3c.github.io/webappsec-csp/> (15 January 2018).
146         Specifically this change in behavior was made to CSP 3 in <https://github.com/w3c/webappsec/issues/311>.
147         In earlier versions of the spec, the frame-ancestor directive matched against the URL of the
148         ancestor document.
149
150         Disregarding allow-same-origin sandboxed iframes, a document with policy "frame-ancestor 'self'"
151         will be blocked from loading in a sandboxed iframe as a result of this change.
152
153         Tests: http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-cross-in-allow-same-origin-sandboxed-cross-url-allow.html
154                http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-cross-in-sandboxed-cross-url-block.html
155
156         * page/csp/ContentSecurityPolicyDirectiveList.cpp:
157         (WebCore::checkFrameAncestors):
158
159 2018-01-19  Basuke Suzuki  <Basuke.Suzuki@sony.com>
160
161         [Curl] Add timeout support to XMLHttpRequest
162         https://bugs.webkit.org/show_bug.cgi?id=181876
163
164         Reviewed by Alex Christensen 
165
166         * platform/network/ResourceRequestBase.cpp:
167         * platform/network/curl/CurlContext.cpp:
168         (WebCore::CurlHandle::setTimeout):
169         * platform/network/curl/CurlContext.h:
170         * platform/network/curl/CurlRequest.cpp:
171         (WebCore::CurlRequest::setupTransfer):
172         (WebCore::CurlRequest::didCompleteTransfer):
173         * platform/network/curl/ResourceError.h:
174         * platform/network/curl/ResourceErrorCurl.cpp:
175         (WebCore::ResourceError::httpError):
176
177 2018-01-19  Yoav Weiss  <yoav@yoav.ws>
178
179         Support for preconnect Link headers
180         https://bugs.webkit.org/show_bug.cgi?id=181657
181
182         Reviewed by Darin Adler.
183
184         Move the preconnect functionality into its own function, and
185         also call this function when Link headers are processed.
186
187         Test: http/tests/preconnect/link-header-rel-preconnect-http.php
188
189         * loader/LinkLoader.cpp:
190         (WebCore::LinkLoader::loadLinksFromHeader): Call preconnectIfNeeded.
191         (WebCore::LinkLoader::preconnectIfNeeded): Preconnect to a host functionality moved here.
192         (WebCore::LinkLoader::loadLink): Call preconnectIfNeeded.
193         * loader/LinkLoader.h:
194
195 2018-01-19  Joseph Pecoraro  <pecoraro@apple.com>
196
197         AppCache: Log a Deprecation warning to the Console when AppCache is used
198         https://bugs.webkit.org/show_bug.cgi?id=181778
199
200         Reviewed by Alex Christensen.
201
202         * html/HTMLHtmlElement.cpp:
203         (WebCore::HTMLHtmlElement::insertedByParser):
204
205 2018-01-19  Chris Dumez  <cdumez@apple.com>
206
207         ASSERT(registration || isTerminating()) hit in SWServerWorker::skipWaiting()
208         https://bugs.webkit.org/show_bug.cgi?id=181761
209         <rdar://problem/36594564>
210
211         Reviewed by Youenn Fablet.
212
213         There is a short period of time, early in the registration process where a
214         SWServerWorker object exists for a registration but is not in the registration's
215         installing/waiting/active slots yet. As a result, if a registration is cleared
216         during this period (for e.g. due to the user clearing all website data), that
217         SWServerWorker will not be terminated. We then hit assertion later on when this
218         worker is trying to do things (like call skipWaiting).
219
220         To address the issue, we now keep a reference this SWServerWorker on the
221         registration, via a new SWServerRegistration::m_preInstallationWorker data member.
222         When the registration is cleared, we now take care of terminating this worker.
223
224         No new tests, covered by existing tests that crash flakily in debug builds.
225
226         * workers/WorkerThread.cpp:
227         (WebCore::WorkerThread::stop):
228         if the mutex is locked, then the worker thread is still starting. We spin the
229         runloop and try to stop again later. This avoids the deadlock shown in
230         Bug 181763 as the worker thread may need to interact with the main thread
231         during startup.
232
233         * workers/service/server/SWServer.cpp:
234         (WebCore::SWServer::installContextData):
235         * workers/service/server/SWServerJobQueue.cpp:
236         (WebCore::SWServerJobQueue::scriptContextFailedToStart):
237         (WebCore::SWServerJobQueue::install):
238         * workers/service/server/SWServerRegistration.cpp:
239         (WebCore::SWServerRegistration::~SWServerRegistration):
240         (WebCore::SWServerRegistration::setPreInstallationWorker):
241         (WebCore::SWServerRegistration::clear):
242         * workers/service/server/SWServerRegistration.h:
243         (WebCore::SWServerRegistration::preInstallationWorker const):
244
245 2018-01-19  Chris Dumez  <cdumez@apple.com>
246
247         Service worker registrations restored from disk may not be reused when the JS calls register() again
248         https://bugs.webkit.org/show_bug.cgi?id=181810
249         <rdar://problem/36591711>
250
251         Reviewed by Youenn Fablet.
252
253         The issue was that when restoring a registration from disk, we would not set its active worker right
254         away. We only set it later in installContextData(). installContextData() is only called after we’ve
255         launched the service worker process and established a connection to it.
256
257         However, we would start processing jobs (such as registrations) before we’ve established the connection
258         to the service worker process. SWServerJobQueue::runRegisterJob(), in order to reuse an existing
259         registration checks the registration’s active worker has the right script URL. The issue was that when
260         this code would execute, we may not have set the registration’s active service worker yet, in which case,
261         we would update the existing registration instead of reusing it as-is.
262
263         To address the issue, we now delay the processing of jobs until the connection to the service worker
264         process has been established and we've installed all pending contexts via installContextData().
265
266         Changed is covered by new API test.
267
268         * workers/service/server/SWServer.cpp:
269         (WebCore::SWServer::Connection::scheduleJobInServer):
270         (WebCore::SWServer::scheduleJob):
271         (WebCore::SWServer::serverToContextConnectionCreated):
272         * workers/service/server/SWServer.h:
273
274 2018-01-19  James Craig  <jcraig@apple.com>
275
276         AX: when invert colors is on, double-invert image and picture elements in UserAgentStyleSheet
277         https://bugs.webkit.org/show_bug.cgi?id=181281
278         <rdar://problem/36291776>
279
280         Reviewed by Simon Fraser.
281
282         Updated "Smart Invert" to include img and picture element inversion and tests.
283
284         Tests: accessibility/smart-invert-reference.html
285                accessibility/smart-invert.html
286
287         * css/html.css:
288         (@media (inverted-colors)):
289         (img:not(picture>img), picture, video):
290
291 2018-01-19  Chris Dumez  <cdumez@apple.com>
292
293         The WebContent process should not process incoming IPC while waiting for a sync IPC reply
294         https://bugs.webkit.org/show_bug.cgi?id=181560
295
296         Reviewed by Ryosuke Niwa.
297
298         Add internals API for testing purposes.
299
300         Test: fast/misc/testIncomingSyncIPCMessageWhileWaitingForSyncReply.html
301
302         * page/ChromeClient.h:
303         * testing/Internals.cpp:
304         (WebCore::Internals::testIncomingSyncIPCMessageWhileWaitingForSyncReply):
305         * testing/Internals.h:
306         * testing/Internals.idl:
307
308 2018-01-19  Keith Miller  <keith_miller@apple.com>
309
310         HaveInternalSDK includes should be "#include?"
311         https://bugs.webkit.org/show_bug.cgi?id=179670
312
313         Reviewed by Dan Bernstein.
314
315         * Configurations/Base.xcconfig:
316
317 2018-01-19  Daniel Bates  <dabates@apple.com>
318
319         Fix misspelling; substitute willDetachRenderer for willDetatchRenderer.
320
321         * html/HTMLPlugInImageElement.cpp:
322         (WebCore::HTMLPlugInImageElement::willDetachRenderers):
323         * plugins/PluginViewBase.h:
324         (WebCore::PluginViewBase::willDetachRenderer):
325         (WebCore::PluginViewBase::willDetatchRenderer): Deleted.
326
327 2018-01-19  Jonathan Bedard  <jbedard@apple.com>
328
329         Unreviewed build fix, remove unused lambda captures.
330
331         * dom/messageports/MessagePortChannel.cpp:
332         (WebCore::MessagePortChannel::takeAllMessagesForPort):
333         * dom/messageports/MessagePortChannelRegistry.cpp:
334         (WebCore::MessagePortChannelRegistry::messagePortChannelCreated):
335
336 2018-01-19  Antoine Quint  <graouts@apple.com>
337
338         [Web Animations] Expose timing properties (delay, endDelay, fill, iterationStart, iterations, direction) and getComputedTiming()
339         https://bugs.webkit.org/show_bug.cgi?id=181857
340         <rdar://problem/36660081>
341
342         Reviewed by Dean Jackson.
343
344         We start the work to implement the rest of the Web Animations timing and animation model by exposing more properties on
345         AnimationEffectTiming to control delay (delay, endDelay), looping (iterationStart, iterations), fill and direction.
346         Additionally, we expose the getComputedTiming() method on AnimationEffect, although it currently lacks some computed
347         properties that will come in later patch as we implement various processes defined by the spec. We also update the
348         existing duration() method on AnimationEffectTiming to be called iterationDuration() to match the terms used in the
349         specification.
350
351         Finally, we make all new properties, and update existing ones, that expose a time value go through the new utility
352         function secondsToWebAnimationsAPITime() to guarantee rounded values with microseconds precision, as advised by
353         the Web Animations specification.
354
355         * CMakeLists.txt:
356         * DerivedSources.make:
357         * Sources.txt:
358         * WebCore.xcodeproj/project.pbxproj:
359         * animation/AnimationEffect.cpp:
360         (WebCore::AnimationEffect::localTime const):
361         (WebCore::AnimationEffect::getComputedTiming):
362         * animation/AnimationEffect.h:
363         * animation/AnimationEffect.idl:
364         * animation/AnimationEffectTiming.cpp:
365         (WebCore::AnimationEffectTiming::AnimationEffectTiming):
366         (WebCore::AnimationEffectTiming::setIterationStart):
367         (WebCore::AnimationEffectTiming::setIterations):
368         (WebCore::AnimationEffectTiming::bindingsDuration const):
369         (WebCore::AnimationEffectTiming::setBindingsDuration):
370         (WebCore::AnimationEffectTiming::endTime const):
371         (WebCore::AnimationEffectTiming::activeDuration const):
372         * animation/AnimationEffectTiming.h:
373         * animation/AnimationEffectTiming.idl:
374         * animation/AnimationPlaybackEvent.cpp:
375         (WebCore::AnimationPlaybackEvent::bindingsCurrentTime const):
376         (WebCore::AnimationPlaybackEvent::bindingsTimelineTime const):
377         * animation/AnimationTimeline.cpp:
378         (WebCore::AnimationTimeline::bindingsCurrentTime):
379         * animation/ComputedTimingProperties.h: Added.
380         * animation/ComputedTimingProperties.idl: Added. We set nullable double values to a default value of "null" since
381         otherwise setting those properties to a null value would not set the properties in the converted JS dictionary.
382         * animation/KeyframeEffect.cpp:
383         (WebCore::KeyframeEffect::create): Handle new timing properties passed in the KeyframeEffectOptions dictionary.
384         (WebCore::KeyframeEffect::applyAtLocalTime):
385         (WebCore::KeyframeEffect::getAnimatedStyle):
386         (WebCore::KeyframeEffect::startOrStopAccelerated):
387         * animation/WebAnimation.cpp:
388         (WebCore::WebAnimation::bindingsStartTime const):
389         (WebCore::WebAnimation::bindingsCurrentTime const):
390         (WebCore::WebAnimation::effectEndTime const):
391         (WebCore::WebAnimation::timeToNextRequiredTick const):
392         * animation/WebAnimationUtilities.h: Added.
393         (WebCore::secondsToWebAnimationsAPITime):
394
395 2018-01-19  Alex Christensen  <achristensen@webkit.org>
396
397         Remove dead networking code
398         https://bugs.webkit.org/show_bug.cgi?id=181813
399
400         Reviewed by Tim Horton.
401
402         CFURLConnection is only used on Windows.
403
404         * platform/network/cf/ResourceError.h:
405         * platform/network/cf/ResourceRequest.h:
406         (WebCore::ResourceRequest::encodingRequiresPlatformData const):
407         * platform/network/cf/ResourceRequestCFNet.cpp:
408         (WebCore::findCFURLRequestCopyContentDispositionEncodingFallbackArrayFunction):
409         (WebCore::ResourceRequest::doUpdatePlatformRequest):
410         (WebCore::ResourceRequest::doUpdatePlatformHTTPBody):
411         (WebCore::ResourceRequest::doUpdateResourceRequest):
412         (WebCore::ResourceRequest::setStorageSession):
413         * platform/network/cf/ResourceResponse.h:
414         (WebCore::ResourceResponse::ResourceResponse):
415
416 2018-01-19  Alex Christensen  <achristensen@webkit.org>
417
418         Remove unused WebViewPrivate _allowCookies
419         https://bugs.webkit.org/show_bug.cgi?id=181812
420
421         Reviewed by Tim Horton.
422
423         This SPI was in the original iOS upstreaming and has not been used in many years.
424
425         * platform/network/ResourceRequestBase.cpp:
426         (WebCore::ResourceRequestBase::setDefaultAllowCookies): Deleted.
427         (WebCore::ResourceRequestBase::defaultAllowCookies): Deleted.
428         * platform/network/ResourceRequestBase.h:
429         (WebCore::ResourceRequestBase::ResourceRequestBase):
430
431 2018-01-18  Brady Eidson  <beidson@apple.com>
432
433         Make in-process MessagePorts be (mostly) asynchronous
434         https://bugs.webkit.org/show_bug.cgi?id=181454
435
436         Reviewed by Alex Christensen.
437
438         No new tests (Covered *brutally* by existing tests)
439
440         Part of making MessagePorts be a thing we can pass across processes is making them work async.
441         
442         The existing "MessagePortChannel" method of abstraction was not cut out for this.
443         This patch gets rid of MessagePortChannel and adds a new MessagePortChannelProvider abstraction.
444         It then gets the new machinery working in-process (with some pieces of out-of-process in place)
445
446         One synchronous behavior this patch maintains is the hasPendingActivity() check used to support GC.
447         That will (creatively) be made async in the next followup.
448         
449         More generally from MessagePorts, this patch also adds a "MessageWithMessagePorts" object to be used
450         with all forms of postMessage(). Much better.
451         
452         * CMakeLists.txt:
453         * Sources.txt:
454         * WebCore.xcodeproj/project.pbxproj:
455
456         * dom/InProcessMessagePortChannel.cpp: Removed.
457         * dom/InProcessMessagePortChannel.h: Removed.
458         * dom/MessagePortChannel.cpp: Removed.
459         * dom/MessagePortChannel.h: Removed.
460
461         * dom/MessageChannel.cpp:
462         (WebCore::MessageChannel::create):
463         (WebCore::MessageChannel::MessageChannel):
464         (WebCore::m_port2): Deleted.
465         * dom/MessageChannel.h:
466         (WebCore::MessageChannel::create): Deleted.
467
468         * dom/MessagePort.cpp:
469         (WebCore::MessagePort::create):
470         (WebCore::MessagePort::MessagePort):
471         (WebCore::MessagePort::~MessagePort):
472         (WebCore::MessagePort::entangle):
473         (WebCore::MessagePort::postMessage):
474         (WebCore::MessagePort::disentangle):
475         (WebCore::MessagePort::messageAvailable):
476         (WebCore::MessagePort::start):
477         (WebCore::MessagePort::close):
478         (WebCore::MessagePort::contextDestroyed):
479         (WebCore::MessagePort::dispatchMessages):
480         (WebCore::MessagePort::hasPendingActivity const):
481         (WebCore::MessagePort::locallyEntangledPort const):
482         (WebCore::MessagePort::disentanglePorts):
483         (WebCore::MessagePort::entanglePorts):
484         (WebCore::MessagePort::entangleWithRemote): Deleted.
485         * dom/MessagePort.h:
486
487         * dom/MessagePortIdentifier.h:
488         (WebCore::MessagePortIdentifier::logString const):
489
490         * dom/ScriptExecutionContext.cpp:
491         (WebCore::ScriptExecutionContext::processMessageWithMessagePortsSoon):
492         (WebCore::ScriptExecutionContext::dispatchMessagePortEvents):
493         (WebCore::ScriptExecutionContext::processMessagePortMessagesSoon): Deleted.
494         * dom/ScriptExecutionContext.h:
495
496         Add a single object that represents two intertwined ports, tracks their pending
497         messages, tracks which process they're in, etc etc:
498         * dom/messageports/MessagePortChannel.cpp: Added.
499         (WebCore::MessagePortChannel::create):
500         (WebCore::MessagePortChannel::MessagePortChannel):
501         (WebCore::MessagePortChannel::~MessagePortChannel):
502         (WebCore::MessagePortChannel::includesPort):
503         (WebCore::MessagePortChannel::entanglePortWithProcess):
504         (WebCore::MessagePortChannel::disentanglePort):
505         (WebCore::MessagePortChannel::closePort):
506         (WebCore::MessagePortChannel::postMessageToRemote):
507         (WebCore::MessagePortChannel::takeAllMessagesForPort):
508         (WebCore::MessagePortChannel::hasAnyMessagesPendingOrInFlight const):
509         * dom/messageports/MessagePortChannel.h: Added.
510         (WebCore::MessagePortChannel::port1 const):
511         (WebCore::MessagePortChannel::port2 const):
512         (WebCore::MessagePortChannel::logString const):
513
514         Abstraction for creating and operating on MessagePorts in a potentially cross-process way:
515         * dom/messageports/MessagePortChannelProvider.cpp: Added.
516         (WebCore::MessagePortChannelProvider::singleton):
517         (WebCore::MessagePortChannelProvider::setSharedProvider):
518         * dom/messageports/MessagePortChannelProvider.h: Added.
519         (WebCore::MessagePortChannelProvider::~MessagePortChannelProvider):
520
521         Adds a concrete implementation of that provider to be used in-process (e.g. WK1):
522         * dom/messageports/MessagePortChannelProviderImpl.cpp: Added.
523         (WebCore::MessagePortChannelProviderImpl::~MessagePortChannelProviderImpl):
524         (WebCore::MessagePortChannelProviderImpl::performActionOnAppropriateThread):
525         (WebCore::MessagePortChannelProviderImpl::createNewMessagePortChannel):
526         (WebCore::MessagePortChannelProviderImpl::entangleLocalPortInThisProcessToRemote):
527         (WebCore::MessagePortChannelProviderImpl::messagePortDisentangled):
528         (WebCore::MessagePortChannelProviderImpl::messagePortClosed):
529         (WebCore::MessagePortChannelProviderImpl::postMessageToRemote):
530         (WebCore::MessagePortChannelProviderImpl::takeAllMessagesForPort):
531         (WebCore::MessagePortChannelProviderImpl::hasMessagesForPorts_temporarySync):
532         * dom/messageports/MessagePortChannelProviderImpl.h: Added.
533
534         Adds a main thread object to handle the set of all MessagePortChannels that are open.
535         For now it lives in the WebProcess, but for out-of-process it will live in the UIProcess:
536         * dom/messageports/MessagePortChannelRegistry.cpp: Added.
537         (WebCore::MessagePortChannelRegistry::~MessagePortChannelRegistry):
538         (WebCore::MessagePortChannelRegistry::didCreateMessagePortChannel):
539         (WebCore::MessagePortChannelRegistry::messagePortChannelCreated):
540         (WebCore::MessagePortChannelRegistry::messagePortChannelDestroyed):
541         (WebCore::MessagePortChannelRegistry::didEntangleLocalToRemote):
542         (WebCore::MessagePortChannelRegistry::didDisentangleMessagePort):
543         (WebCore::MessagePortChannelRegistry::didCloseMessagePort):
544         (WebCore::MessagePortChannelRegistry::didPostMessageToRemote):
545         (WebCore::MessagePortChannelRegistry::takeAllMessagesForPort):
546         (WebCore::MessagePortChannelRegistry::hasMessagesForPorts_temporarySync): This is named against style
547           and weird on purpose - to call attention to how bad it is and how it's temporary.
548         (WebCore::MessagePortChannelRegistry::existingChannelContainingPort):
549         * dom/messageports/MessagePortChannelRegistry.h: Added.
550
551         Add an object that represents a "SerializedScriptValue for the message payload and the ports
552         that are being transferred along with that payload". This is used in all forms of postMessage():
553         * dom/messageports/MessageWithMessagePorts.cpp: Added.
554         * dom/messageports/MessageWithMessagePorts.h: Added.
555
556         * page/DOMWindow.cpp:
557         (WebCore::PostMessageTimer::PostMessageTimer):
558         (WebCore::PostMessageTimer::event):
559         (WebCore::DOMWindow::postMessage):
560
561         * platform/Logging.h:
562
563         * workers/DedicatedWorkerGlobalScope.cpp:
564         (WebCore::DedicatedWorkerGlobalScope::postMessage):
565
566         * workers/Worker.cpp:
567         (WebCore::Worker::postMessage):
568
569         * workers/WorkerGlobalScopeProxy.h:
570
571         * workers/WorkerMessagingProxy.cpp:
572         (WebCore::WorkerMessagingProxy::postMessageToWorkerObject):
573         (WebCore::WorkerMessagingProxy::postMessageToWorkerGlobalScope):
574         * workers/WorkerMessagingProxy.h:
575
576         * workers/WorkerObjectProxy.h:
577
578         * workers/service/ServiceWorker.cpp:
579         (WebCore::ServiceWorker::postMessage):
580
581         * workers/service/ServiceWorkerClient.cpp:
582         (WebCore::ServiceWorkerClient::postMessage):
583
584         * workers/service/context/SWContextManager.cpp:
585         (WebCore::SWContextManager::postMessageToServiceWorker):
586
587         * workers/service/context/ServiceWorkerThread.cpp:
588         (WebCore::fireMessageEvent):
589         (WebCore::ServiceWorkerThread::postMessageToServiceWorker):
590         * workers/service/context/ServiceWorkerThread.h:
591
592 2018-01-18  Ryan Haddad  <ryanhaddad@apple.com>
593
594         Unreviewed build fix, removed unused lambda capture.
595
596         * workers/service/context/SWContextManager.cpp:
597         (WebCore::SWContextManager::ServiceWorkerTerminationRequest::ServiceWorkerTerminationRequest):
598
599 2018-01-18  Chris Dumez  <cdumez@apple.com>
600
601         We should be able to terminate service workers that are unresponsive
602         https://bugs.webkit.org/show_bug.cgi?id=181563
603         <rdar://problem/35280031>
604
605         Reviewed by Alex Christensen.
606
607         Test: http/tests/workers/service/postmessage-after-terminating-hung-worker.html
608
609         * workers/service/context/SWContextManager.cpp:
610         (WebCore::SWContextManager::terminateWorker):
611         Before calling WorkerThread::stop(), set a timer with the given timeout parameter.
612         If the worker thread has not stopped when the timer fires, forcefully exit the
613         service worker process. The StorageProcess will take care of relaunching the
614         service worker process if it exits abruptly.
615
616         (WebCore::SWContextManager::serviceWorkerFailedToTerminate):
617         Log error message if we failed to terminate a service worker and call exit().
618
619         (WebCore::SWContextManager::ServiceWorkerTerminationRequest::ServiceWorkerTerminationRequest):
620
621         * workers/service/context/SWContextManager.h:
622
623 2018-01-18  Youenn Fablet  <youenn@apple.com>
624
625         Do not go to the storage process when loading a main resource if there is no service worker registered
626         https://bugs.webkit.org/show_bug.cgi?id=181395
627
628         Reviewed by Chris Dumez.
629
630         No observable behavior change.
631         Instead of creating a connection to know whether there is a potential service worker,
632         Ask the service worker provider that will use the connection if needed.
633         Otherwise, it will use a default value provided by the UIProcess.
634
635         Tested by cleaning all service workers and checking the computed value of the default value,
636         then observing whether pages registering service workers work well.
637
638         * loader/DocumentLoader.cpp:
639         (WebCore::DocumentLoader::startLoadingMainResource):
640         * workers/service/ServiceWorkerProvider.cpp:
641         (WebCore::ServiceWorkerProvider::mayHaveServiceWorkerRegisteredForOrigin):
642         * workers/service/ServiceWorkerProvider.h:
643
644 2018-01-18  Dan Bernstein  <mitz@apple.com>
645
646         [Xcode] Streamline and future-proof target-macOS-version-dependent build setting definitions
647         https://bugs.webkit.org/show_bug.cgi?id=181803
648
649         Reviewed by Tim Horton.
650
651         * Configurations/Base.xcconfig: Updated.
652         * Configurations/DebugRelease.xcconfig: Ditto.
653         * Configurations/FeatureDefines.xcconfig: Adopted macOSTargetConditionals helpers.
654         * Configurations/Version.xcconfig: Updated.
655         * Configurations/macOSTargetConditionals.xcconfig: Added. Defines helper build settings
656           useful for defining settings that depend on the target macOS version.
657
658 2018-01-18  Chris Dumez  <cdumez@apple.com>
659
660         Service Workers restored from persistent storage have 'redundant' state
661         https://bugs.webkit.org/show_bug.cgi?id=181749
662         <rdar://problem/36556486>
663
664         Reviewed by Youenn Fablet.
665
666         Tested by new API test.
667
668         * workers/service/server/SWServer.cpp:
669         (WebCore::SWServer::installContextData):
670         Make sure the SWServerWorker's state is set to "activated" after it is assigned to
671         the registrations' active slot. Otherwise, it stays in its default state (redundant).
672
673 2018-01-18  Antti Koivisto  <antti@apple.com>
674
675         REGRESSION(r225650): The scores of MotionMark tests Multiply and Leaves dropped by 8%
676         https://bugs.webkit.org/show_bug.cgi?id=181460
677         <rdar://problem/36379776>
678
679         Reviewed by Ryosuke Niwa.
680
681         * css/parser/CSSParser.cpp:
682         (WebCore::CSSParserContext::CSSParserContext):
683
684         Don't do the expensive security origin test if the supplied sheet base URL is null. This
685         is true for rules coming from the same document.
686
687 2018-01-18  Antti Koivisto  <antti@apple.com>
688
689         REGRESSION (r223604): Setting :before/after pseudo element on <noscript> asserts
690         https://bugs.webkit.org/show_bug.cgi?id=181795
691         <rdar://problem/36334524>
692
693         Reviewed by David Kilzer.
694
695         <noscript> disallows renderer generation outside CSS mechanisms, however we would still construct
696         PseudoElements for them during style resolution. These were never removed properly because the
697         pseudo element removal was tied to render tree teardown. Without proper removal the associated
698         animations were also not canceled.
699
700         Test: fast/css-generated-content/noscript-pseudo-anim-crash.html
701
702         * dom/Element.cpp:
703         (WebCore::Element::removedFromAncestor):
704
705         Take care to get rid of PseudoElements when the element is removed from the tree.
706         This also cancels any associated animations.
707
708 2018-01-18  Chris Fleizach  <cfleizach@apple.com>
709
710         AX: Aria-activedescendant not supported
711         https://bugs.webkit.org/show_bug.cgi?id=161734
712         <rdar://problem/28202679>
713
714         Reviewed by Joanmarie Diggs.
715
716         When a combo-box owns/controls a list/listbox/grid/tree, the owned element needs to check the active-descendant of the combobox when
717         checking if it has selected children. 
718         The target of the selection change notification should also be the owned element in these cases.
719
720         Test: accessibility/aria-combobox-controlling-list.html
721
722         * accessibility/AccessibilityObject.cpp:
723         (WebCore::AccessibilityObject::selectedListItem):
724         * accessibility/AccessibilityObject.h:
725         * accessibility/AccessibilityRenderObject.cpp:
726         (WebCore::AccessibilityRenderObject::targetElementForActiveDescendant const):
727         (WebCore::AccessibilityRenderObject::handleActiveDescendantChanged):
728         (WebCore::AccessibilityRenderObject::canHaveSelectedChildren const):
729         (WebCore::AccessibilityRenderObject::selectedChildren):
730         * accessibility/AccessibilityRenderObject.h:
731         * accessibility/mac/AXObjectCacheMac.mm:
732         (WebCore::AXObjectCache::postPlatformNotification):
733
734 2018-01-17  Per Arne Vollan  <pvollan@apple.com>
735
736         REGRESSION (r224780): Text stroke not applied to video captions.
737         https://bugs.webkit.org/show_bug.cgi?id=181743
738         <rdar://problem/35874338>
739
740         Reviewed by Simon Fraser.
741
742         Tests: media/track/track-css-visible-stroke-expected.html
743                media/track/track-css-visible-stroke.html
744
745         After r224780, it is no longer possible to mix text stroke styles with webkit
746         legacy text stroke styles.
747
748         * css/StyleResolver.cpp:
749         (WebCore::isValidCueStyleProperty):
750         * page/CaptionUserPreferencesMediaAF.cpp:
751         (WebCore::CaptionUserPreferencesMediaAF::captionsTextEdgeCSS const):
752
753 2018-01-18  Andy Estes  <aestes@apple.com>
754
755         [Payment Request] Support a default shipping address for Apple Pay
756         https://bugs.webkit.org/show_bug.cgi?id=181754
757         <rdar://problem/36009733>
758
759         Reviewed by Brady Eidson.
760
761         Move shippingContact from ApplePayPaymentRequest to ApplePayRequestBase. This allows
762         merchants to specify a default shipping address when using Apple Pay with Payment Request.
763
764         This also fixes a bug found during testing where
765         +[NSPersonNameComponentsFormatter localizedStringFromPersonNameComponents:style:options:]
766         would throw an exception when passed a nil NSPersonNameComponents.
767
768         Test: http/tests/ssl/applepay/ApplePayRequestShippingContact.https.html
769
770         * Modules/applepay/ApplePayPaymentRequest.h:
771         * Modules/applepay/ApplePayPaymentRequest.idl:
772         * Modules/applepay/ApplePayRequestBase.cpp:
773         (WebCore::convertAndValidate):
774         * Modules/applepay/ApplePayRequestBase.h:
775         * Modules/applepay/ApplePayRequestBase.idl:
776         * Modules/applepay/ApplePaySession.cpp:
777         (WebCore::convertAndValidate):
778         * Modules/applepay/ApplePaySessionPaymentRequest.h:
779         (WebCore::ApplePaySessionPaymentRequest::version const):
780         (WebCore::ApplePaySessionPaymentRequest::setVersion):
781         * Modules/applepay/cocoa/PaymentContactCocoa.mm:
782         (WebCore::convert):
783         * Modules/applepay/paymentrequest/ApplePayRequest.idl:
784         * testing/MockPaymentCoordinator.cpp:
785         (WebCore::MockPaymentCoordinator::showPaymentUI):
786         (WebCore::MockPaymentCoordinator::completeMerchantValidation):
787         * testing/MockPaymentCoordinator.h:
788
789 2018-01-18  Wenson Hsieh  <wenson_hsieh@apple.com>
790
791         [iOS] Specify -[NSURL _title] for the associated URL when copying an image element
792         https://bugs.webkit.org/show_bug.cgi?id=181783
793         <rdar://problem/35785445>
794
795         Reviewed by Ryosuke Niwa.
796
797         Always specify the -[NSURL _title] to be either the title specified in a PasteboardImage's inner PasteboardURL,
798         or if no title is specified, fall back to the user-visible URL string. This is because at least one internal
799         client always tries to use the -_title property to determine the title of a pasted URL, or if none is specified,
800         the -suggestedName. Since we need to set suggestedName to the preferred file name of the copied image and we
801         don't want the suggested name to become the title of the link, we need to explicitly set the link title.
802
803         In doing so, this patch also fixes a bug wherein we forget to set the _title of the NSURL we're registering to
804         an NSItemProvider.
805
806         Tests:  ActionSheetTests.CopyImageElementWithHREFAndTitle (new)
807                 ActionSheetTests.CopyImageElementWithHREF (modified)
808
809         * platform/ios/PlatformPasteboardIOS.mm:
810         (WebCore::PlatformPasteboard::write):
811
812 2018-01-17  Jer Noble  <jer.noble@apple.com>
813
814         WebVTT served via HLS never results in cues
815         https://bugs.webkit.org/show_bug.cgi?id=181773
816
817         Reviewed by Eric Carlson.
818
819         Test: http/tests/media/hls/hls-webvtt-tracks.html
820
821         Three independant errors conspired to keep in-band WebVTT samples from parsing:
822
823         - The definition of ISOWebVTTCue::boxTypeName() was incorrect.
824         - ISOWebVTTCue::parse() didn't call it's superclass's parse() method (leading to an incorrect size and offset).
825         - Use String::fromUTF8() rather than String.adopt(StringVector&&).
826
827         * platform/graphics/iso/ISOVTTCue.cpp:
828         (WebCore::ISOWebVTTCue::parse):
829         * platform/graphics/iso/ISOVTTCue.h:
830         (WebCore::ISOWebVTTCue::boxTypeName):
831
832 2018-01-17  John Wilander  <wilander@apple.com>
833
834         Resource Load Statistics: Block cookies for prevalent resources without user interaction
835         https://bugs.webkit.org/show_bug.cgi?id=177394
836         <rdar://problem/34613960>
837
838         Reviewed by Alex Christensen.
839
840         Tests: http/tests/resourceLoadStatistics/add-blocking-to-redirect.html
841                http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context.html
842                http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html
843                http/tests/resourceLoadStatistics/remove-partitioning-in-redirect.html
844
845         * platform/network/NetworkStorageSession.h:
846             Now exports NetworkStorageSession::nsCookieStorage().
847         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
848         (WebCore::NetworkStorageSession::setPrevalentDomainsToPartitionOrBlockCookies):
849             Fixes the FIXME.
850
851 2018-01-17  Dean Jackson  <dino@apple.com>
852
853         Remove linked-on test for Snow Leopard
854         https://bugs.webkit.org/show_bug.cgi?id=181770
855
856         Reviewed by Eric Carlson.
857
858         Remove a very old linked-on-or-after test.
859
860         * platform/graphics/ca/GraphicsLayerCA.cpp:
861
862 2018-01-17  Matt Lewis  <jlewis3@apple.com>
863
864         Unreviewed, rolling out r227098.
865
866         This broke the build.
867
868         Reverted changeset:
869
870         "Remove linked-on test for Snow Leopard"
871         https://bugs.webkit.org/show_bug.cgi?id=181770
872         https://trac.webkit.org/changeset/227098
873
874 2018-01-17  Dean Jackson  <dino@apple.com>
875
876         Remove linked-on test for Snow Leopard
877         https://bugs.webkit.org/show_bug.cgi?id=181770
878
879         Reviewed by Eric Carlson.
880
881         Remove a very old linked-on-or-after test.
882
883         * platform/graphics/ca/GraphicsLayerCA.cpp:
884
885 2018-01-17  Stephan Szabo  <stephan.szabo@sony.com>
886
887         [Curl] Use ResourceRequest::encodeWithPlatformData()
888         https://bugs.webkit.org/show_bug.cgi?id=181768
889
890         Reviewed by Alex Christensen.
891
892         No new tests, assertion hit in downstream port, should be covered by
893         existing tests.
894
895         * platform/network/curl/ResourceRequest.h:
896         (WebCore::ResourceRequest::encodeWithPlatformData const):
897         (WebCore::ResourceRequest::decodeWithPlatformData):
898
899 2018-01-17  Eric Carlson  <eric.carlson@apple.com>
900
901         Use existing RGB colorspace instead of creating a new one
902         https://bugs.webkit.org/show_bug.cgi?id=181765
903         <rdar://problem/36595753>
904
905         Reviewed by Dean Jackson.
906
907         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:
908         (WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream): Use sRGBColorSpaceRef instead
909         of creating a new static colorspace.
910
911 2018-01-17  Matt Lewis  <jlewis3@apple.com>
912
913         Unreviewed, rolling out r227076.
914
915         This breaks internal builds
916
917         Reverted changeset:
918
919         "Resource Load Statistics: Block cookies for prevalent
920         resources without user interaction"
921         https://bugs.webkit.org/show_bug.cgi?id=177394
922         https://trac.webkit.org/changeset/227076
923
924 2018-01-17  Ryosuke Niwa  <rniwa@webkit.org>
925
926         input and textarea elements should reveal selection in setSelection when focused
927         https://bugs.webkit.org/show_bug.cgi?id=181715
928         <rdar://problem/36570546>
929
930         Reviewed by Zalan Bujtas.
931
932         Made input and textarea elements reveal selection in FrameSelection::setSelection instead of by directly
933         invoking FrameSelection::revealSelection in their respective updateFocusAppearance to unify code paths.
934
935         Also added options to reveal selection up to the main frame to SetSelectionOption to be used in iOS.
936
937         * editing/FrameSelection.cpp:
938         (WebCore::FrameSelection::FrameSelection):
939         (WebCore::FrameSelection::moveWithoutValidationTo): Takes SelectionRevealMode as an argument and converts
940         sets appropriate selection options.
941         (WebCore::FrameSelection::setSelection): Reconstruct SelectionRevealMode out of selection option sets.
942         (WebCore::FrameSelection::updateAndRevealSelection):
943         * editing/FrameSelection.h:
944         (WebCore::FrameSelection): Added RevealSelectionUpToMainFrame as a SelectionRevealMode and replaced
945         m_shouldRevealSelection by m_selectionRevealMode.
946         * html/HTMLInputElement.cpp:
947         (WebCore::HTMLInputElement::updateFocusAppearance): Pass SelectionRevealMode to HTMLTextFormControlElement's
948         select and restoreCachedSelection instead of directly invoking FrameSelection::revealSelection.
949         * html/HTMLTextAreaElement.cpp:
950         (WebCore::HTMLTextAreaElement::updateFocusAppearance): Ditto.
951         * html/HTMLTextFormControlElement.cpp:
952         (WebCore::HTMLTextFormControlElement::select):
953         (WebCore::HTMLTextFormControlElement::setSelectionRange):
954         (WebCore::HTMLTextFormControlElement::restoreCachedSelection):
955         * html/HTMLTextFormControlElement.h:
956
957 2018-01-17  Michael Catanzaro  <mcatanzaro@igalia.com>
958
959         WEBKIT_FRAMEWORK should not modify file-global include directories
960         https://bugs.webkit.org/show_bug.cgi?id=181656
961
962         Reviewed by Konstantin Tokarev.
963
964         * CMakeLists.txt:
965         * PlatformWPE.cmake:
966
967 2018-01-17  Michael Catanzaro  <mcatanzaro@igalia.com>
968
969         [GTK] Try even harder not to static link WTF into libwebkit2gtk
970         https://bugs.webkit.org/show_bug.cgi?id=181751
971
972         Reviewed by Alex Christensen.
973
974         We don't want two copies of WTF. It should only be in libjavascriptcoregtk.
975
976         * PlatformGTK.cmake:
977
978 2018-01-17  Zalan Bujtas  <zalan@apple.com>
979
980         Multicol: RenderMultiColumnFlow should not inherit the flow state
981         https://bugs.webkit.org/show_bug.cgi?id=181762
982         <rdar://problem/35448565>
983
984         Reviewed by Simon Fraser.
985
986         Do not compute the inherited flow state flag for RenderMultiColumnFlow.
987         It is (by definition) always inside a fragmented flow.
988
989         Test: fast/multicol/crash-when-out-of-flow-positioned-becomes-in-flow.html
990
991         * rendering/RenderObject.cpp:
992         (WebCore::RenderObject::computedFragmentedFlowState):
993
994 2018-01-17  Alex Christensen  <achristensen@webkit.org>
995
996         Deprecate Application Cache
997         https://bugs.webkit.org/show_bug.cgi?id=181764
998
999         Reviewed by Geoffrey Garen.
1000
1001         * features.json:
1002
1003 2018-01-17  Wenson Hsieh  <wenson_hsieh@apple.com>
1004
1005         [iOS simulator] API test WKAttachmentTests.InjectedBundleReplaceURLWhenPastingImage is failing
1006         https://bugs.webkit.org/show_bug.cgi?id=181758
1007
1008         Reviewed by Tim Horton.
1009
1010         This test is failing because Editor::clientReplacementURLForResource expects a MIME type, but on iOS, the type
1011         paramter passed into WebContentReader::readImage is a UTI; subsequently, the bundle editing delegate receives
1012         a MIME type that's actually a UTI, which is incorrect. To address this, ensure that a MIME type is passed to
1013         bundle SPI by converting the type in WebContentReader::readImage to a MIME type.
1014
1015         * editing/cocoa/WebContentReaderCocoa.mm:
1016         (WebCore::WebContentReader::readImage):
1017
1018 2018-01-17  Antti Koivisto  <antti@apple.com>
1019
1020         REGRESSION (r226385?): Crash in com.apple.WebCore: WebCore::MediaQueryEvaluator::evaluate const + 32
1021         https://bugs.webkit.org/show_bug.cgi?id=181742
1022         <rdar://problem/36334726>
1023
1024         Reviewed by David Kilzer.
1025
1026         Test: fast/media/mediaqueryevaluator-crash.html
1027
1028         * css/MediaQueryEvaluator.cpp:
1029         (WebCore::MediaQueryEvaluator::MediaQueryEvaluator):
1030
1031         Use WeakPtr<Document> instead of a plain Frame pointer.
1032
1033         (WebCore::MediaQueryEvaluator::evaluate const):
1034
1035         Get the frame via document.
1036
1037         * css/MediaQueryEvaluator.h:
1038         * dom/Document.cpp:
1039         (WebCore::Document::prepareForDestruction):
1040
1041         Take care to clear style resolver.
1042
1043 2018-01-17  Youenn Fablet  <youenn@apple.com>
1044
1045         Put fetch request keepAlive behind a runtime flag
1046         https://bugs.webkit.org/show_bug.cgi?id=181592
1047
1048         Reviewed by Chris Dumez.
1049
1050         No change of behavior.
1051
1052         * Modules/fetch/FetchRequest.idl:
1053         * page/RuntimeEnabledFeatures.h:
1054         (WebCore::RuntimeEnabledFeatures::fetchAPIKeepAliveEnabled const):
1055         (WebCore::RuntimeEnabledFeatures::setFetchAPIKeepAliveEnabled):
1056
1057 2018-01-17  Per Arne Vollan  <pvollan@apple.com>
1058
1059         [Win] Use switch when converting from ResourceRequestCachePolicy to platform cache policy.
1060         https://bugs.webkit.org/show_bug.cgi?id=181686
1061
1062         Reviewed by Alex Christensen.
1063
1064         No new tests, covered by existing tests.
1065
1066         A switch will make the function easier on the eyes. Also, use the function in places where the ResourceRequestCachePolicy
1067         is just casted to a platform cache policy.
1068
1069         * platform/network/cf/ResourceRequestCFNet.cpp:
1070         (WebCore::toPlatformRequestCachePolicy):
1071
1072 2018-01-17  John Wilander  <wilander@apple.com>
1073
1074         Resource Load Statistics: Block cookies for prevalent resources without user interaction
1075         https://bugs.webkit.org/show_bug.cgi?id=177394
1076         <rdar://problem/34613960>
1077
1078         Reviewed by Alex Christensen.
1079
1080         Tests: http/tests/resourceLoadStatistics/add-blocking-to-redirect.html
1081                http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context.html
1082                http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html
1083                http/tests/resourceLoadStatistics/remove-partitioning-in-redirect.html
1084
1085         * platform/network/NetworkStorageSession.h:
1086             Now exports NetworkStorageSession::nsCookieStorage().
1087         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
1088         (WebCore::NetworkStorageSession::setPrevalentDomainsToPartitionOrBlockCookies):
1089             Fixes the FIXME.
1090
1091 2018-01-17  Daniel Bates  <dabates@apple.com>
1092
1093         REGRESSION (r222795): Cardiogram never signs in
1094         https://bugs.webkit.org/show_bug.cgi?id=181693
1095         <rdar://problem/36286293>
1096
1097         Reviewed by Ryosuke Niwa.
1098
1099         Exempt Cardiogram from the XHR header restrictions in r222795.
1100
1101         Following r222795 only Dashboard widgets are allowed to set arbitrary XHR headers.
1102         However Cardiogram also depends on such functionality.
1103
1104         Test: fast/xmlhttprequest/set-dangerous-headers-from-file-when-setting-enabled.html
1105
1106         * page/Settings.yaml:
1107         * platform/RuntimeApplicationChecks.h:
1108         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
1109         (WebCore::IOSApplication::isCardiogram):
1110         * xml/XMLHttpRequest.cpp:
1111         (WebCore::XMLHttpRequest::setRequestHeader):
1112
1113 2018-01-17  Daniel Bates  <dabates@apple.com>
1114
1115         ASSERTION FAILED: !m_completionHandler in PingHandle::~PingHandle()
1116         https://bugs.webkit.org/show_bug.cgi?id=181746
1117         <rdar://problem/36586248>
1118
1119         Reviewed by Chris Dumez.
1120
1121         Call PingHandle::pingLoadComplete() with an error when NSURLConnection queries
1122         whether the ping is able to respond to an authentication request. (Pings do not
1123         respond to authenticate requests.) It will call the completion handler, nullify
1124         the completion handler, and deallocate the PingHandle. Nullifying the completion
1125         handler is necessary to avoid the assertion failure in ~PingHandle().
1126
1127         Test: http/tests/misc/before-unload-load-image.html
1128
1129         * platform/network/PingHandle.h:
1130
1131 2018-01-17  Daniel Bates  <dabates@apple.com>
1132
1133         WebCoreResourceHandleAsOperationQueueDelegate/ResourceHandleCFURLConnectionDelegateWithOperationQueue may
1134         be deleted in main thread callback
1135         https://bugs.webkit.org/show_bug.cgi?id=181747
1136         <rdar://problem/36588120>
1137
1138         Reviewed by Alex Christensen.
1139
1140         Retain the delegate (e.g. WebCoreResourceHandleAsOperationQueueDelegate) before scheduling
1141         a main thread callback and blocking on a semaphore for its reply because the main thread
1142         callback can do anything, including deleting the delegate, before the non-main thread
1143         has a chance to execute. For instance, a PingHandle will delete itself (and hence delete
1144         its resource handle delegate) in most of the code paths invoked by the delegate.
1145
1146         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
1147         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willSendRequest):
1148         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse):
1149         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willCacheResponse):
1150         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace):
1151         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
1152         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]):
1153         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]):
1154         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
1155         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willCacheResponse:]):
1156
1157 2018-01-17  Chris Dumez  <cdumez@apple.com>
1158
1159         'fetch' event may be sent to a service worker before its state is set to 'activated'
1160         https://bugs.webkit.org/show_bug.cgi?id=181698
1161         <rdar://problem/36554856>
1162
1163         Reviewed by Youenn Fablet.
1164
1165         'fetch' event may be sent to a service worker before its state is set to 'activated'.
1166         When the registration's active worker needs to intercept a load, and its state is 'activating',
1167         we queue the request to send the fetch event in SWServerWorker::m_whenActivatedHandlers.
1168         Once the SWServerWorker::setState() is called with 'activated' state, we then call the
1169         handlers in m_whenActivatedHandlers to make send the fetch event now that the worker is
1170         activated. The issue is that even though the worker is activated and its state was set to
1171         'activated' on Storage process side, we had not yet notified the ServiceWorker process
1172         of the service worker's new state yet.
1173
1174         To address the issue, we now make sure that SWServerWorker::m_whenActivatedHandlers are
1175         called *after* we've sent the IPC to the ServiceWorker process to update the worker's
1176         state to 'activated'. Also, we now call ServiceWorkerFetch::dispatchFetchEvent()
1177         asynchronously in a postTask() as the service worker's state is also updated asynchronously
1178         in a postTask. This is as per specification [1], which says to "queue a task" to fire
1179         the fetch event.
1180
1181         [1] https://w3c.github.io/ServiceWorker/#on-fetch-request-algorithm (step 18)
1182
1183         No new tests, covered by imported/w3c/web-platform-tests/service-workers/service-worker/fetch-waits-for-activate.https.html
1184         which hits the new assertion without the fix.
1185
1186         * workers/service/context/ServiceWorkerFetch.cpp:
1187         (WebCore::ServiceWorkerFetch::dispatchFetchEvent):
1188         Add assertions to make sure that we dispatch the fetch event on the right worker and
1189         that the worker is in 'activated' state.
1190
1191         * workers/service/context/ServiceWorkerThread.cpp:
1192         (WebCore::ServiceWorkerThread::postFetchTask):
1193         Queue a task to fire the fetch event as per:
1194         - https://w3c.github.io/ServiceWorker/#on-fetch-request-algorithm (step 18)
1195         We need to match the specification exactly here or things will happen in the wrong
1196         order. In particular, things like "update registration state" and "update worker state"
1197         might happen *after* firing the fetch event, even though the IPC for "update registration/worker
1198         state" was sent before the "fire fetch event" one, because the code for updating a registration/
1199         worker state already queues a task, as per the specification.
1200
1201         * workers/service/server/SWServerRegistration.cpp:
1202         (WebCore::SWServerRegistration::updateWorkerState):
1203         * workers/service/server/SWServerRegistration.h:
1204         * workers/service/server/SWServerWorker.cpp:
1205         (WebCore::SWServerWorker::setState):
1206         Move code to send the IPC to the Service Worker process whenever the service worker's state
1207         needs to be updated from SWServerRegistration::updateWorkerState() to SWServerWorker::setState().
1208         This way, we can make sure the IPC is sent *before* we call the m_whenActivatedHandlers handlers,
1209         as they may also send IPC to the Service Worker process, and we need to make sure this IPC happens
1210         after so that the service worker is in the right state.
1211
1212 2018-01-17  Stephan Szabo  <stephan.szabo@sony.com>
1213
1214         Page.cpp only sees forward declaration of ApplicationStateChangeListener when ENABLE(VIDEO) is off
1215         https://bugs.webkit.org/show_bug.cgi?id=181713
1216
1217         Reviewed by Darin Adler.
1218
1219         No new tests (build fix).
1220
1221         * page/Page.cpp: Add include for ApplicationStateChangeListener
1222
1223 2018-01-17  Wenson Hsieh  <wenson_hsieh@apple.com>
1224
1225         Add injected bundle SPI to replace subresource URLs when dropping or pasting rich content
1226         https://bugs.webkit.org/show_bug.cgi?id=181637
1227         <rdar://problem/36508471>
1228
1229         Reviewed by Tim Horton.
1230
1231         Before carrying out blob URL conversion for pasted or dropped rich content, let the editor client replace
1232         subresource URLs in WebKit2 by calling out to new injected bundle SPI. See comments below for more detail.
1233
1234         Tests:  WKAttachmentTests.InjectedBundleReplaceURLsWhenPastingAttributedString
1235                 WKAttachmentTests.InjectedBundleReplaceURLWhenPastingImage
1236
1237         * editing/Editor.cpp:
1238         (WebCore::Editor::clientReplacementURLForResource):
1239         * editing/Editor.h:
1240
1241         Add a new helper to call out to the editor client for a URL string to replace a given ArchiveResource. In
1242         WebKit2, this calls out to the injected bundle's new `replacementURLForResource` SPI hook.
1243
1244         * editing/cocoa/WebContentReaderCocoa.mm:
1245         (WebCore::shouldReplaceSubresourceURL):
1246         (WebCore::replaceRichContentWithAttachments):
1247         (WebCore::replaceSubresourceURLsWithURLsFromClient):
1248
1249         Add a new static helper to replace subresource URLs in the given DocumentFragment with URLs supplied by the
1250         editor client. Additionally builds a list of ArchiveResources that have not been replaced, for use at call sites
1251         so that we don't unnecessarily create more Blobs for ArchiveResources that have already been replaced.
1252
1253         (WebCore::createFragmentAndAddResources):
1254         (WebCore::sanitizeMarkupWithArchive):
1255
1256         Tweak web content reading codepaths to first replace subresource URLs with editor-client-supplied URLs.
1257
1258         (WebCore::WebContentReader::readImage):
1259         (WebCore::shouldConvertToBlob): Deleted.
1260
1261         Rename this helper to shouldReplaceSubresourceURL, blob URL replacement is no longer the only scenario in which
1262         we replace resource URLs, but in both cases, we still want to ignore `http:`-family and `data:` URLs.
1263
1264         * loader/EmptyClients.cpp:
1265         * page/EditorClient.h:
1266
1267 2018-01-17  Yacine Bandou  <yacine.bandou_ext@softathome.com>
1268         [EME][GStreamer] Add the full-sample encryption support in the GStreamer ClearKey decryptor
1269         https://bugs.webkit.org/show_bug.cgi?id=180080
1270
1271         Reviewed by Xabier Rodriguez-Calvar.
1272
1273         Currently the GStreamer clearKey decryptor doesn't support the full-sample encryption,
1274         where the buffer is entirely encrypted, it supports only the sub-sample encryption.
1275
1276         Test: media/encrypted-media/clearKey/clearKey-cenc-audio-playback-mse.html
1277
1278         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
1279         (webKitMediaClearKeyDecryptorDecrypt):
1280
1281 2018-01-17  Zan Dobersek  <zdobersek@igalia.com>
1282
1283         Unreviewed follow-up to r227051.
1284
1285         * platform/graphics/cairo/CairoOperations.h: Fix declaration of the
1286         fillRoundedRect() function by removing the bool parameter that's not
1287         used at all in the definition. This went unspotted due to the unified
1288         source build including the implementation file before fillRoundedRect()
1289         usage in GrapihcsContextCairo.cpp, leaving the declaration undefined
1290         and instead using the definition directly.
1291
1292 2018-01-17  Zan Dobersek  <zdobersek@igalia.com>
1293
1294         [Cairo] Don't mirror global alpha and image interpolation quality state values in PlatformContextCairo
1295         https://bugs.webkit.org/show_bug.cgi?id=181725
1296
1297         Reviewed by Carlos Garcia Campos.
1298
1299         Don't duplicate global alpha and image interpolation quality state
1300         values on the PlatformContextCairo. Instead, retrieve them from
1301         the managing GraphicsContextState when necessary.
1302
1303         For Cairo operations, the FillSource and StrokeSource containers now
1304         store the global alpha value, using it during the operation executions.
1305         For drawNativeImage(), the global alpha and interpolation quality values
1306         are passed through arguments.
1307
1308         In PlatformContextCairo, the two values are no longer stored on the
1309         internally-managed stack, and the getter-setter pairs for the two values
1310         are removed. In drawSurfaceToContext(), the two values are now expected
1311         to be passed through the method arguments.
1312
1313         No new tests -- no change in behavior.
1314
1315         * platform/graphics/cairo/CairoOperations.cpp:
1316         (WebCore::Cairo::prepareForFilling):
1317         (WebCore::Cairo::prepareForStroking):
1318         (WebCore::Cairo::drawPathShadow):
1319         (WebCore::Cairo::fillCurrentCairoPath):
1320         (WebCore::Cairo::FillSource::FillSource):
1321         (WebCore::Cairo::StrokeSource::StrokeSource):
1322         (WebCore::Cairo::strokeRect):
1323         (WebCore::Cairo::strokePath):
1324         (WebCore::Cairo::drawGlyphs):
1325         (WebCore::Cairo::drawNativeImage):
1326         (WebCore::Cairo::State::setGlobalAlpha): Deleted.
1327         (WebCore::Cairo::State::setImageInterpolationQuality): Deleted.
1328         * platform/graphics/cairo/CairoOperations.h:
1329         * platform/graphics/cairo/GraphicsContextCairo.cpp:
1330         (WebCore::GraphicsContext::drawNativeImage):
1331         (WebCore::GraphicsContext::setPlatformAlpha):
1332         (WebCore::GraphicsContext::setPlatformImageInterpolationQuality):
1333         * platform/graphics/cairo/PlatformContextCairo.cpp:
1334         (WebCore::PlatformContextCairo::save):
1335         (WebCore::PlatformContextCairo::drawSurfaceToContext):
1336         (WebCore::PlatformContextCairo::State::State): Deleted.
1337         (WebCore::PlatformContextCairo::setImageInterpolationQuality): Deleted.
1338         (WebCore::PlatformContextCairo::imageInterpolationQuality const): Deleted.
1339         (WebCore::PlatformContextCairo::globalAlpha const): Deleted.
1340         (WebCore::PlatformContextCairo::setGlobalAlpha): Deleted.
1341         * platform/graphics/cairo/PlatformContextCairo.h:
1342         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
1343         (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::paintCurrentFrame):
1344
1345 2018-01-17  Philippe Normand  <pnormand@igalia.com>
1346
1347         REGRESSION(r226973/r226974): Four multimedia tests failing
1348         https://bugs.webkit.org/show_bug.cgi?id=181696
1349
1350         Reviewed by Carlos Garcia Campos.
1351
1352         This patch reverts some of the changes of the above revisions so as to fix layout test failures.
1353
1354         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1355         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Properly
1356         prepare stalled event when an error was detected.
1357         (WebCore::MediaPlayerPrivateGStreamer::processBufferingStats): Revert to previous version.
1358         (WebCore::MediaPlayerPrivateGStreamer::fillTimerFired): Ditto.
1359         (WebCore::MediaPlayerPrivateGStreamer::didLoadingProgress const):
1360         Emit progress event also when streaming but not when an error was
1361         detected.
1362         (WebCore::MediaPlayerPrivateGStreamer::totalBytes const): use isLiveStream like everywhere else.
1363         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
1364         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
1365         (webkit_web_src_init): Revert to keep-alive FALSE by default.
1366
1367 2018-01-17  Zan Dobersek  <zdobersek@igalia.com>
1368
1369         [Cairo] Move prepareForFilling(), prepareForStroking() code to CairoOperations
1370         https://bugs.webkit.org/show_bug.cgi?id=181721
1371
1372         Reviewed by Carlos Garcia Campos.
1373
1374         Move the prepareForFilling() and prepareForStroking() code off of the
1375         PlatformContextCairo class and into static functions inside the
1376         CairoOperations implementation files. The original methods weren't
1377         called from any place other than the Cairo operations, and they only
1378         operated with the cairo_t object that's stored in and retrievable from
1379         the PlatformContextCairo object.
1380
1381         No new tests -- no change in behavior.
1382
1383         * platform/graphics/cairo/CairoOperations.cpp:
1384         (WebCore::Cairo::reduceSourceByAlpha):
1385         (WebCore::Cairo::prepareCairoContextSource):
1386         (WebCore::Cairo::clipForPatternFilling):
1387         (WebCore::Cairo::prepareForFilling):
1388         (WebCore::Cairo::prepareForStroking):
1389         (WebCore::Cairo::drawPathShadow):
1390         (WebCore::Cairo::fillCurrentCairoPath):
1391         (WebCore::Cairo::strokeRect):
1392         (WebCore::Cairo::strokePath):
1393         (WebCore::Cairo::drawGlyphs):
1394         * platform/graphics/cairo/PlatformContextCairo.cpp:
1395         (WebCore::reduceSourceByAlpha): Deleted.
1396         (WebCore::prepareCairoContextSource): Deleted.
1397         (WebCore::PlatformContextCairo::prepareForFilling): Deleted.
1398         (WebCore::PlatformContextCairo::prepareForStroking): Deleted.
1399         (WebCore::PlatformContextCairo::clipForPatternFilling): Deleted.
1400         * platform/graphics/cairo/PlatformContextCairo.h:
1401
1402 2018-01-17  Zan Dobersek  <zdobersek@igalia.com>
1403
1404         [Cairo] Use one-time ShadowBlur objects when performing shadowing
1405         https://bugs.webkit.org/show_bug.cgi?id=181720
1406
1407         Reviewed by Carlos Garcia Campos.
1408
1409         Don't maintain a ShadowBlur object in the PlatformContextCairo class.
1410         Instead, use temporary ShadowBlur objects whenever shadowing is needed,
1411         providing all the shadow state information to it and drawing shadow into
1412         the given GraphicsContext object.
1413
1414         ShadowBlur constructors are cleaned up. The 'shadows ignored' argument
1415         can now also be provided to the variant that accepts explicit shadow
1416         attributes, but the argument is false by default.
1417
1418         In CairoOperations, the ShadowBlurUsage functionality is rolled into the
1419         new ShadowState class. ShadowState parameter is now used for operations
1420         that might need to perform shadow painting. Call sites are modified
1421         accordingly.
1422
1423         Cairo::State::setShadowValues() and Cairo::State::clearShadow() are
1424         removed, since the ShadowBlur object that was modified through those is
1425         being removed from the PlatformContextCairo class. We still have to flip
1426         the Y-axis of the shadow offset in GraphicsContext::setPlatformShadow()
1427         when shadows are ignoring transformations.
1428
1429         No new tests -- no change in behavior.
1430
1431         * platform/graphics/ShadowBlur.cpp:
1432         (WebCore::ShadowBlur::ShadowBlur):
1433         * platform/graphics/ShadowBlur.h:
1434         * platform/graphics/cairo/CairoOperations.cpp:
1435         (WebCore::Cairo::drawPathShadow):
1436         (WebCore::Cairo::drawGlyphsShadow):
1437         (WebCore::Cairo::ShadowState::ShadowState):
1438         (WebCore::Cairo::ShadowState::isVisible const):
1439         (WebCore::Cairo::ShadowState::isRequired const):
1440         (WebCore::Cairo::fillRect):
1441         (WebCore::Cairo::fillRoundedRect):
1442         (WebCore::Cairo::fillRectWithRoundedHole):
1443         (WebCore::Cairo::fillPath):
1444         (WebCore::Cairo::strokeRect):
1445         (WebCore::Cairo::strokePath):
1446         (WebCore::Cairo::drawGlyphs):
1447         (WebCore::Cairo::drawNativeImage):
1448         (WebCore::Cairo::State::setShadowValues): Deleted.
1449         (WebCore::Cairo::State::clearShadow): Deleted.
1450         (WebCore::Cairo::ShadowBlurUsage::ShadowBlurUsage): Deleted.
1451         (WebCore::Cairo::ShadowBlurUsage::required const): Deleted.
1452         * platform/graphics/cairo/CairoOperations.h:
1453         * platform/graphics/cairo/FontCairo.cpp:
1454         (WebCore::FontCascade::drawGlyphs):
1455         * platform/graphics/cairo/GraphicsContextCairo.cpp:
1456         (WebCore::GraphicsContext::restorePlatformState):
1457         (WebCore::GraphicsContext::drawNativeImage):
1458         (WebCore::GraphicsContext::fillPath):
1459         (WebCore::GraphicsContext::strokePath):
1460         (WebCore::GraphicsContext::fillRect):
1461         (WebCore::GraphicsContext::setPlatformShadow):
1462         (WebCore::GraphicsContext::clearPlatformShadow):
1463         (WebCore::GraphicsContext::strokeRect):
1464         (WebCore::GraphicsContext::platformFillRoundedRect):
1465         (WebCore::GraphicsContext::fillRectWithRoundedHole):
1466         * platform/graphics/cairo/PlatformContextCairo.cpp:
1467         (WebCore::PlatformContextCairo::drawSurfaceToContext):
1468         * platform/graphics/cairo/PlatformContextCairo.h:
1469         (WebCore::PlatformContextCairo::shadowBlur): Deleted.
1470         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
1471         (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::paintCurrentFrame):
1472
1473 2018-01-17  Zan Dobersek  <zdobersek@igalia.com>
1474
1475         CanvasImageData: createImageData() parameter should not be nullable
1476         https://bugs.webkit.org/show_bug.cgi?id=181670
1477
1478         Reviewed by Sam Weinig.
1479
1480         createImageData() method on the CanvasImageData interface should not
1481         treat the ImageData parameter as nullable, but should instead reject any
1482         null values with a TypeError, as demanded by the specification.
1483
1484         No new tests -- current tests covering createImageData(null) are updated
1485         to properly cover new behavior of throwing a TypeError exception.
1486
1487         * html/canvas/CanvasImageData.idl:
1488         * html/canvas/CanvasRenderingContext2DBase.cpp:
1489         (WebCore::CanvasRenderingContext2DBase::createImageData const):
1490         * html/canvas/CanvasRenderingContext2DBase.h:
1491
1492 2018-01-16  Fujii Hironori  <Hironori.Fujii@sony.com>
1493
1494         [CMake] Remove WebCoreDerivedSources library target
1495         https://bugs.webkit.org/show_bug.cgi?id=181664
1496
1497         Reviewed by Carlos Garcia Campos.
1498
1499         After unified source build has been introduced, CMake Visual
1500         Studio build suffers complicated unnecessary recompilation issues
1501         because Visual Studio invokes scripts twice in both WebCore and
1502         WebCoreDerivedSources projects (Bug 181117).
1503
1504         WebCoreDerivedSources library has been introduced in r198766 to
1505         avoid command line length limit of CMake Ninja build on macOS.
1506         Fortunately, unified source build has reduced the number of source
1507         files to compile, WebCore doesn't need to be split anymore.
1508
1509         No new tests (No behavior change)
1510
1511         * CMakeLists.txt: Replaced WebCore_DERIVED_SOURCES with WebCore_SOURCES. Removed WebCoreDerivedSources library target.
1512         Do not compile each JavaScript Builtins.cpp files because the unified source WebCoreJSBuiltins.cpp is already included.
1513         * PlatformGTK.cmake: Replaced WebCore_DERIVED_SOURCES with WebCore_SOURCES.
1514         * PlatformWin.cmake: Ditto.
1515
1516 2018-01-16  Simon Fraser  <simon.fraser@apple.com>
1517
1518         Can't scroll iframe after toggling it to display:none and back
1519         https://bugs.webkit.org/show_bug.cgi?id=181708
1520         rdar://problem/13234778
1521
1522         Reviewed by Tim Horton.
1523
1524         Nothing updated the FrameView's set of scrollable areas when a subframe came back from display:none.
1525         Mirror the existing virtual removeChild() by making addChild() virtual, and using it to mark
1526         the FrameView's scrollable area set as dirty.
1527
1528         Test: tiled-drawing/scrolling/non-fast-region/non-fast-scrollable-region-hide-show-iframe.html
1529
1530         * page/FrameView.cpp:
1531         (WebCore::FrameView::addChild):
1532         * page/FrameView.h:
1533         * platform/ScrollView.h:
1534
1535 2018-01-16  Chris Dumez  <cdumez@apple.com>
1536
1537         SWServerWorker::m_contextConnectionIdentifier may get out of date
1538         https://bugs.webkit.org/show_bug.cgi?id=181687
1539         <rdar://problem/36548111>
1540
1541         Reviewed by Brady Eidson.
1542
1543         SWServerWorker::m_contextConnectionIdentifier may get out of date. This happens when the
1544         context process crashes and is relaunched.
1545
1546         No new tests, added assertion in terminateWorkerInternal() that hits without this fix.
1547
1548         * workers/service/server/SWServer.cpp:
1549         (WebCore::SWServer::runServiceWorker):
1550         (WebCore::SWServer::terminateWorkerInternal):
1551         (WebCore::SWServer::unregisterServiceWorkerClient):
1552         * workers/service/server/SWServerWorker.h:
1553         (WebCore::SWServerWorker::setContextConnectionIdentifier):
1554
1555 2018-01-16  Jer Noble  <jer.noble@apple.com>
1556
1557         Reset MediaSourcePrivateAVFObjC's m_sourceBufferWithSelectedVideo when the underlying SourceBufferPrivate is removed.
1558         https://bugs.webkit.org/show_bug.cgi?id=181707
1559         <rdar://problem/34809474>
1560
1561         Reviewed by Eric Carlson.
1562
1563         Test: media/media-source/media-source-remove-unload-crash.html
1564
1565         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
1566         (WebCore::MediaSourcePrivateAVFObjC::removeSourceBuffer):
1567
1568 2018-01-12  Jiewen Tan  <jiewen_tan@apple.com>
1569
1570         [WebAuthN] Implement dummy WebAuthN IDLs
1571         https://bugs.webkit.org/show_bug.cgi?id=181627
1572         <rdar://problem/36459864>
1573
1574         Reviewed by Alex Christensen.
1575
1576         This patch implements dummy WebAuthN IDLs and connect them with Credential Management as well.
1577         All implementations in this patch are subject to change when real implementations land. The
1578         purpose here on the other hand is to have IDLs, bindings and implementations connected. This
1579         patch should handle all IDLs that we need.
1580
1581         No tests.
1582
1583         * CMakeLists.txt:
1584         * DerivedSources.make:
1585         * Modules/credentialmanagement/CredentialCreationOptions.h:
1586         * Modules/credentialmanagement/CredentialCreationOptions.idl:
1587         * Modules/credentialmanagement/CredentialRequestOptions.h:
1588         * Modules/credentialmanagement/CredentialRequestOptions.idl:
1589         * Modules/webauthn/AuthenticatorAssertionResponse.cpp: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.cpp.
1590         (WebCore::AuthenticatorAssertionResponse::AuthenticatorAssertionResponse):
1591         (WebCore::AuthenticatorAssertionResponse::~AuthenticatorAssertionResponse):
1592         (WebCore::AuthenticatorAssertionResponse::authenticatorData):
1593         (WebCore::AuthenticatorAssertionResponse::signature):
1594         (WebCore::AuthenticatorAssertionResponse::userHandle):
1595         * Modules/webauthn/AuthenticatorAssertionResponse.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialRequestOptions.h.
1596         * Modules/webauthn/AuthenticatorAssertionResponse.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl.
1597         * Modules/webauthn/AuthenticatorAttestationResponse.cpp: Copied from Source/WebCore/Modules/credentialmanagement/CredentialCreationOptions.h.
1598         (WebCore::AuthenticatorAttestationResponse::AuthenticatorAttestationResponse):
1599         (WebCore::AuthenticatorAttestationResponse::~AuthenticatorAttestationResponse):
1600         (WebCore::AuthenticatorAttestationResponse::attestationObject):
1601         * Modules/webauthn/AuthenticatorAttestationResponse.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialRequestOptions.h.
1602         * Modules/webauthn/AuthenticatorAttestationResponse.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl.
1603         * Modules/webauthn/AuthenticatorResponse.cpp: Copied from Source/WebCore/Modules/credentialmanagement/CredentialCreationOptions.h.
1604         (WebCore::AuthenticatorResponse::AuthenticatorResponse):
1605         (WebCore::AuthenticatorResponse::~AuthenticatorResponse):
1606         (WebCore::AuthenticatorResponse::clientDataJSON):
1607         * Modules/webauthn/AuthenticatorResponse.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialRequestOptions.h.
1608         * Modules/webauthn/AuthenticatorResponse.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl.
1609         * Modules/webauthn/PublicKeyCredential.cpp:
1610         (WebCore::PublicKeyCredential::rawId):
1611         (WebCore::PublicKeyCredential::response):
1612         (WebCore::PublicKeyCredential::getClientExtensionResults):
1613         (WebCore::PublicKeyCredential::isUserVerifyingPlatformAuthenticatorAvailable):
1614         * Modules/webauthn/PublicKeyCredential.h:
1615         * Modules/webauthn/PublicKeyCredential.idl:
1616         * Modules/webauthn/PublicKeyCredentialCreationOptions.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialRequestOptions.h.
1617         * Modules/webauthn/PublicKeyCredentialCreationOptions.idl: Added.
1618         * Modules/webauthn/PublicKeyCredentialDescriptor.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialCreationOptions.h.
1619         * Modules/webauthn/PublicKeyCredentialDescriptor.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl.
1620         * Modules/webauthn/PublicKeyCredentialRequestOptions.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialCreationOptions.h.
1621         * Modules/webauthn/PublicKeyCredentialRequestOptions.idl: Copied from Source/WebCore/Modules/credentialmanagement/CredentialRequestOptions.h.
1622         * Modules/webauthn/PublicKeyCredentialType.h: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl.
1623         * Modules/webauthn/PublicKeyCredentialType.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl.
1624         * Sources.txt:
1625         * WebCore.xcodeproj/project.pbxproj:
1626         * bindings/js/WebCoreBuiltinNames.h:
1627
1628 2018-01-16  Zalan Bujtas  <zalan@apple.com>
1629
1630         AX: Do not trigger layout in updateBackingStore() unless it is safe to do so
1631         https://bugs.webkit.org/show_bug.cgi?id=181703
1632         <rdar://problem/36365706>
1633
1634         Reviewed by Ryosuke Niwa.
1635
1636         Document::isSafeToUpdateStyleOrLayout() can tell whether it is safe to run layout.
1637
1638         Unable to create test with WebInspector involved. 
1639
1640         * accessibility/AccessibilityObject.cpp:
1641         (WebCore::AccessibilityObject::updateBackingStore):
1642         * dom/Document.cpp:
1643         (WebCore::Document::isSafeToUpdateStyleOrLayout const):
1644         (WebCore::Document::updateStyleIfNeeded):
1645         (WebCore::Document::updateLayout):
1646         (WebCore::isSafeToUpdateStyleOrLayout): Deleted.
1647         * dom/Document.h:
1648
1649 2018-01-16  Ryan Haddad  <ryanhaddad@apple.com>
1650
1651         Unreviewed, rolling out r226962.
1652
1653         The LayoutTest added with this change is a flaky timeout.
1654
1655         Reverted changeset:
1656
1657         "Support for preconnect Link headers"
1658         https://bugs.webkit.org/show_bug.cgi?id=181657
1659         https://trac.webkit.org/changeset/226962
1660
1661 2018-01-16  Simon Fraser  <simon.fraser@apple.com>
1662
1663         Text looks bad on some CSS spec pages
1664         https://bugs.webkit.org/show_bug.cgi?id=181700
1665         rdar://problem/36552107
1666
1667         Reviewed by Tim Horton.
1668
1669         When making new tiles in a TileController, we failed to set their "supports antialiased layer text"
1670         setting, so tile caches could end up with a mixture of layers that do and do not support
1671         antialiased layer text.
1672
1673         No tests because the tiled drawing tests don't dump out tiles inside of tile caches.
1674
1675         * platform/graphics/ca/TileController.cpp:
1676         (WebCore::TileController::createTileLayer):
1677
1678 2018-01-16  Said Abou-Hallawa  <sabouhallawa@apple.com>
1679
1680         REGRESSION(r221292): svg/animations/animateTransform-pattern-transform.html crashes with security assertion
1681         https://bugs.webkit.org/show_bug.cgi?id=179986
1682
1683         Reviewed by Simon Fraser.
1684
1685         This patch reverts all or parts of the following changes-sets
1686             <http://trac.webkit.org/changeset/221292>
1687             <http://trac.webkit.org/changeset/197967>
1688             <http://trac.webkit.org/changeset/196670>
1689
1690         A JS statement like this:
1691             var item = text.x.animVal.getItem(0);
1692
1693         Creates the following C++ objects:
1694             SVGAnimatedListPropertyTearOff<SVGLengthListValues> for 'text.x'
1695             SVGListPropertyTearOff<SVGLengthListValues> for 'text.x.animVal'
1696             SVGPropertyTearOff<SVGLengthValue> for 'text.x.animVal.getItem(0)'
1697
1698         If 'item' changes, the attribute 'x' of the element '<text>' will change
1699         as well. But this binding works only in one direction. If the attribute
1700         'x' of the element '<text>' changes, e.g.:
1701
1702             text.setAttribute('x', '10,20,30');
1703
1704         This will detach 'item' from the element <text> and any further changes 
1705         in 'item' won't affect the attribute 'x' of element <text>.
1706
1707         The one direction binding can only work if this chain of tear-off objects
1708         is kept connected. This is implemented by RefCounted back pointers from
1709         SVGPropertyTearOff and SVGListPropertyTearOff to SVGAnimatedListPropertyTearOff.
1710
1711         The security crashes and the memory leaks are happening because of the
1712         raw forward pointers:
1713             -- SVGAnimatedListPropertyTearOff maintains raw pointers of type
1714                SVGListPropertyTearOff for m_baseVal and m_animVal
1715             -- The m_wrappers and m_animatedWrappers of SVGAnimatedListPropertyTearOff
1716                are vectors of raw pointer Vector<SVGLength*>
1717
1718         To control the life cycle of the raw pointers, SVGListPropertyTearOff and
1719         SVGPropertyTearOff call SVGAnimatedListPropertyTearOff::propertyWillBeDeleted()
1720         to notify it they are going to be deleted. In propertyWillBeDeleted(), we
1721         clear the pointers so they are not used after being freed. This mechanism
1722         has been error-prone and we've never got it 100% right.
1723
1724         The solution we need to adopt with SVG tear-off objects is the following:
1725             -- All the forward pointers should be weak pointers.
1726             -- All the back pointers should be ref pointers.
1727
1728         This solution may not look intuitive but it solves the bugs and keeps the
1729         one direction binding. The forward weak pointers allows the tear-off
1730         objects to go aways if no reference from JS exists. The back ref pointers
1731         maintains the chain of objects and guarantees the correct binding.
1732
1733         * svg/SVGPathSegList.h:
1734         * svg/SVGTransformList.h:
1735         * svg/properties/SVGAnimatedListPropertyTearOff.h:
1736         (WebCore::SVGAnimatedListPropertyTearOff::baseVal):
1737         (WebCore::SVGAnimatedListPropertyTearOff::animVal):
1738         * svg/properties/SVGAnimatedPathSegListPropertyTearOff.h:
1739         * svg/properties/SVGAnimatedProperty.h:
1740         (WebCore::SVGAnimatedProperty::isAnimatedListTearOff const):
1741         (WebCore::SVGAnimatedProperty::propertyWillBeDeleted): Deleted.
1742         * svg/properties/SVGAnimatedPropertyTearOff.h:
1743         * svg/properties/SVGAnimatedTransformListPropertyTearOff.h:
1744         * svg/properties/SVGListProperty.h:
1745         (WebCore::SVGListProperty::initializeValuesAndWrappers):
1746         (WebCore::SVGListProperty::getItemValuesAndWrappers):
1747         (WebCore::SVGListProperty::insertItemBeforeValuesAndWrappers):
1748         (WebCore::SVGListProperty::replaceItemValuesAndWrappers):
1749         (WebCore::SVGListProperty::removeItemValuesAndWrappers):
1750         (WebCore::SVGListProperty::appendItemValuesAndWrappers):
1751         (WebCore::SVGListProperty::createWeakPtr const):
1752         * svg/properties/SVGListPropertyTearOff.h:
1753         (WebCore::SVGListPropertyTearOff::removeItemFromList):
1754         (WebCore::SVGListPropertyTearOff::~SVGListPropertyTearOff): Deleted.
1755         * svg/properties/SVGPropertyTearOff.h:
1756         (WebCore::SVGPropertyTearOff::createWeakPtr const):
1757         (WebCore::SVGPropertyTearOff::~SVGPropertyTearOff):
1758
1759 2018-01-16  Eric Carlson  <eric.carlson@apple.com>
1760
1761         AVSampleBufferDisplayLayer should be flushed when application activates
1762         https://bugs.webkit.org/show_bug.cgi?id=181623
1763         <rdar://problem/36487738>
1764
1765         Reviewed by Darin Adler.
1766
1767         No new tests, I wasn't able to reproduce it in a test.
1768
1769         * WebCore.xcodeproj/project.pbxproj:
1770         * dom/Document.cpp:
1771         (WebCore::Document::addApplicationStateChangeListener): New.
1772         (WebCore::Document::removeApplicationStateChangeListener): Ditto.
1773         (WebCore::Document::forEachApplicationStateChangeListener): Ditto.
1774         * dom/Document.h:
1775
1776         * html/HTMLMediaElement.cpp:
1777         (WebCore::HTMLMediaElement::registerWithDocument): Register for application state changes.
1778         (WebCore::HTMLMediaElement::unregisterWithDocument): Unregister.
1779         (WebCore::HTMLMediaElement::applicationWillResignActive): Pass through to the player.
1780         (WebCore::HTMLMediaElement::applicationDidBecomeActive): Ditto.
1781         * html/HTMLMediaElement.h:
1782
1783         * page/ApplicationStateChangeListener.h: Added.
1784         (WebCore::ApplicationStateChangeListener::applicationWillResignActive):
1785         (WebCore::ApplicationStateChangeListener::applicationDidBecomeActive):
1786         * page/Page.cpp:
1787         (WebCore::Page::forEachDocument):
1788         (WebCore::Page::applicationWillResignActive):
1789         (WebCore::Page::applicationDidEnterBackground):
1790         (WebCore::Page::applicationWillEnterForeground):
1791         (WebCore::Page::applicationDidBecomeActive):
1792         * page/Page.h:
1793         * platform/graphics/MediaPlayer.cpp:
1794         (WebCore::MediaPlayer::applicationWillResignActive):
1795         (WebCore::MediaPlayer::applicationDidBecomeActive):
1796         * platform/graphics/MediaPlayer.h:
1797         * platform/graphics/MediaPlayerPrivate.h:
1798         (WebCore::MediaPlayerPrivateInterface::applicationWillResignActive):
1799         (WebCore::MediaPlayerPrivateInterface::applicationDidBecomeActive):
1800
1801         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
1802         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1803         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC): Switch
1804         to release logging.
1805         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::~MediaPlayerPrivateMediaStreamAVFObjC): Ditto.
1806         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueCorrectedVideoSample): Split out of enqueueVideoSample.
1807         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample): Move code that updates
1808         the display later to enqueueCorrectedVideoSample. Rearrange logic to the image painter sample
1809         buffer has the correct timestamp.
1810         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::layerErrorDidChange): Switch to release logging.
1811         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::layerStatusDidChange): Ditto.
1812         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::applicationDidBecomeActive): f the display
1813         layer is in the "failed" state, flush the renderer and update the display mode.
1814         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayers): Switch to release logging.
1815         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::load): Ditto.
1816         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::cancelLoad): Ditto.
1817         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::prepareToPlay): Ditto.
1818         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateDisplayMode): Ditto.
1819         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::play): Ditto.
1820         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::pause): Ditto.
1821         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVolume): Ditto.
1822         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setMuted): Ditto.
1823         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateReadyState) Ditto.:
1824         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::logChannel const): Ditto.
1825         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateSampleTimes): Deleted.
1826
1827 2018-01-16  Michael Catanzaro  <mcatanzaro@igalia.com>
1828
1829         PAL should link to JavaScriptCore rather than WTF
1830         https://bugs.webkit.org/show_bug.cgi?id=181683
1831
1832         Reviewed by Konstantin Tokarev.
1833
1834         Do not link directly to JavaScriptCore. Get it via PAL.
1835
1836         * CMakeLists.txt:
1837
1838 2018-01-16  Zach Li  <zachli@apple.com>
1839
1840         Add pop-up policy support in website policies.
1841         https://bugs.webkit.org/show_bug.cgi?id=181544.
1842         rdar://problem/30521400.
1843
1844         Reviewed by Alex Christensen.
1845
1846         * loader/DocumentLoader.h:
1847         Introduce pop-up policy getter and setter. Initialize
1848         the policy as Default.
1849         (WebCore::DocumentLoader::popUpPolicy const):
1850         (WebCore::DocumentLoader::setPopUpPolicy):
1851         * page/DOMWindow.cpp:
1852         (WebCore::DOMWindow::allowPopUp):
1853         Pop-up policy specified on a per-page basis holds
1854         precedence over the global policy. If no pop-up policy
1855         is specified during navigation, global policy is used.
1856
1857 2018-01-16  Jer Noble  <jer.noble@apple.com>
1858
1859         Crash playing audio-only HLS stream via hls.js (MSE)
1860         https://bugs.webkit.org/show_bug.cgi?id=181691
1861         <rdar://problem/32967295>
1862
1863         Reviewed by Eric Carlson.
1864
1865         Add a weak-link check to the block called by -[AVSampleBufferDisplayLayer requestMediaDataWhenReadyOnQueue:usingBlock:].
1866
1867         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1868         (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled):
1869         (WebCore::SourceBufferPrivateAVFObjC::notifyClientWhenReadyForMoreSamples):
1870         (WebCore::SourceBufferPrivateAVFObjC::setVideoLayer):
1871
1872 2018-01-16  Simon Fraser  <simon.fraser@apple.com>
1873
1874         Rename applyHorizontalScale/applyVerticalScale in SVG filters, and related cleanup
1875         https://bugs.webkit.org/show_bug.cgi?id=181684
1876
1877         Reviewed by Alex Christensen.
1878
1879         Rename the confusing applyHorizontalScale/applyVerticalScale to scaledByFilterResolution(),
1880         and have it take and return a FloatSize. Change callers to do math in terms of FloatSizes.
1881
1882         Add inflate(size) to each of the rect classes.
1883
1884         * platform/graphics/FloatRect.h:
1885         (WebCore::FloatRect::inflate):
1886         * platform/graphics/IntRect.h:
1887         (WebCore::IntRect::inflate):
1888         * platform/graphics/LayoutRect.h:
1889         (WebCore::LayoutRect::inflate):
1890         * platform/graphics/filters/FEDisplacementMap.cpp:
1891         (WebCore::FEDisplacementMap::platformApplySoftware):
1892         * platform/graphics/filters/FEDropShadow.cpp:
1893         (WebCore::FEDropShadow::determineAbsolutePaintRect):
1894         (WebCore::FEDropShadow::platformApplySoftware):
1895         * platform/graphics/filters/FEGaussianBlur.cpp:
1896         (WebCore::FEGaussianBlur::calculateUnscaledKernelSize):
1897         (WebCore::FEGaussianBlur::calculateKernelSize):
1898         (WebCore::FEGaussianBlur::determineAbsolutePaintRect):
1899         (WebCore::FEGaussianBlur::platformApplySoftware):
1900         * platform/graphics/filters/FEGaussianBlur.h:
1901         * platform/graphics/filters/FEMorphology.cpp:
1902         (WebCore::FEMorphology::determineAbsolutePaintRect):
1903         (WebCore::FEMorphology::platformApplySoftware):
1904         * platform/graphics/filters/FEOffset.cpp:
1905         (WebCore::FEOffset::determineAbsolutePaintRect):
1906         (WebCore::FEOffset::platformApplySoftware):
1907         * platform/graphics/filters/Filter.h:
1908         (WebCore::Filter::setSourceImage):
1909         (WebCore::Filter::scaledByFilterResolution const):
1910         (WebCore::Filter::applyHorizontalScale const): Deleted.
1911         (WebCore::Filter::applyVerticalScale const): Deleted.
1912         * platform/graphics/filters/FilterOperations.cpp:
1913         (WebCore::outsetSizeForBlur):
1914         * rendering/FilterEffectRenderer.h:
1915         * svg/graphics/filters/SVGFilter.cpp:
1916         (WebCore::SVGFilter::scaledByFilterResolution const):
1917         (WebCore::SVGFilter::applyHorizontalScale const): Deleted.
1918         (WebCore::SVGFilter::applyVerticalScale const): Deleted.
1919         * svg/graphics/filters/SVGFilter.h:
1920
1921 2018-01-16  Fujii Hironori  <Hironori.Fujii@sony.com>
1922
1923         [CMake][Mac] Fix the build errors
1924         https://bugs.webkit.org/show_bug.cgi?id=181665
1925
1926         Reviewed by Alex Christensen.
1927
1928         No new tests (No behavior change)
1929
1930         * CMakeLists.txt: Added Modules/paymentrequest/MerchantValidationEvent.idl to compile.
1931         * PlatformMac.cmake: Added Modules/paymentrequest/MerchantValidationEvent.cpp to compile.
1932         Added workers/service/context and Modules/applicationmanifest as forwarding header paths.
1933
1934 2018-01-16  Wenson Hsieh  <wenson_hsieh@apple.com>
1935
1936         [Attachment Support] Provide the `src` of an attachment to the UI delegate when an attachment is inserted
1937         https://bugs.webkit.org/show_bug.cgi?id=181638
1938         <rdar://problem/36508702>
1939
1940         Reviewed by Dan Bernstein.
1941
1942         Adjust the `didInsertAttachment` codepath to additionally propagate the attachment element's `src`.
1943         Additionally, fix an issue with insertion and removal client notifications wherein the client can receive
1944         insertion calls without corresponding removal calls, or vice versa. This is an existing issue, but matters more
1945         now because we actually need to access the attachment element for its `src` when propagating changes to the
1946         client. See below for details.
1947
1948         Test: WKAttachmentTests.AttachmentUpdatesWhenInsertingRichMarkup
1949
1950         * dom/Document.h:
1951         (WebCore::Document::attachmentElementsByIdentifier const):
1952         * editing/Editor.cpp:
1953         (WebCore::Editor::notifyClientOfAttachmentUpdates):
1954         * page/EditorClient.h:
1955         (WebCore::EditorClient::didInsertAttachment):
1956         * page/Frame.cpp:
1957         (WebCore::Frame::setDocument):
1958
1959         When a Frame's document changes, inform the client that the attachments in the previous document are going away.
1960         For each attachment currently connected to the document, we have either (1) already informed the client that it
1961         was inserted, or (2) the attachment is pending an insertion call to the client. If (1) is the case, then we'll
1962         tell the client that the attachment is removed, which will balance out the earlier insertion call. If (2) is the
1963         case, then we'll remove the previously inserted attachment identifier from the set of attachment identifiers
1964         pending insertion, and the client won't be informed of insertions or removals.
1965
1966 2018-01-16  Antoine Quint  <graouts@apple.com>
1967
1968         Use traits for animation timing functions
1969         https://bugs.webkit.org/show_bug.cgi?id=181651
1970
1971         Reviewed by Dean Jackson.
1972
1973         Cleaning up Dean's previous patch as suggested by Darin's post-commit review comments. The
1974         downcast function can match const automatically and it's a better style to put the * inside
1975         the downcast call rather than outside.
1976
1977         * css/CSSComputedStyleDeclaration.cpp:
1978         (WebCore::createTimingFunctionValue):
1979         * platform/animation/TimingFunction.cpp:
1980         (WebCore::operator<<):
1981         (WebCore::TimingFunction::transformTime const):
1982         * platform/animation/TimingFunction.h:
1983         * platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm:
1984         (WebCore::toCAMediaTimingFunction):
1985
1986 2018-01-16  Philippe Normand  <pnormand@igalia.com>
1987
1988         [GStreamer] Live streaming cleanups
1989         https://bugs.webkit.org/show_bug.cgi?id=181672
1990
1991         Reviewed by Michael Catanzaro.
1992
1993         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1994         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Switch to
1995         streaming code path when no content-length was reported by the
1996         http source element.
1997         (WebCore::MediaPlayerPrivateGStreamer::totalBytes const): Return early when streaming.
1998         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
1999         (CachedResourceStreamingClient::responseReceived): Emit headers as
2000         an element message, like souphttpsrc.
2001
2002 2018-01-15  Philippe Normand  <pnormand@igalia.com>
2003
2004         [GStreamer] misc fixes and cleanups
2005         https://bugs.webkit.org/show_bug.cgi?id=181647
2006
2007         Reviewed by Michael Catanzaro.
2008
2009         * platform/graphics/MediaPlayer.cpp:
2010         (WebCore::convertEnumerationToString): New utility function to convert preload enum to string.
2011         * platform/graphics/MediaPlayerEnums.h: Ditto.
2012         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2013         (WebCore::MediaPlayerPrivateGStreamer::load): Debug tweak
2014         (WebCore::MediaPlayerPrivateGStreamer::prepareToPlay): Ditto
2015         (WebCore::MediaPlayerPrivateGStreamer::play): Ditto
2016         (WebCore::MediaPlayerPrivateGStreamer::paused const): Ditto
2017         (WebCore::MediaPlayerPrivateGStreamer::processBufferingStats): Prevent useless state update.
2018         (WebCore::MediaPlayerPrivateGStreamer::fillTimerFired): Ditto.
2019         (WebCore::MediaPlayerPrivateGStreamer::updateStates): Debug tweak.
2020         (WebCore::MediaPlayerPrivateGStreamer::setDownloadBuffering): Ditto.
2021         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
2022         Remove useless handlesSyncMessage method.
2023         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2024         (WebCore::MediaPlayerPrivateGStreamerBase::setMuted): Prevent useless state update.
2025         (WebCore::MediaPlayerPrivateGStreamerBase::muted const): Debug tweak.
2026         (WebCore::MediaPlayerPrivateGStreamerBase::setStreamVolumeElement): Ditto.
2027         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
2028         (webkit_web_src_init): Enable keepAlive by default like in souphttpsrc.
2029         (webKitWebSrcStart): Debug tweak.
2030         (webKitWebSrcQueryWithParent): Ditto.
2031         (webKitWebSrcNeedData): Ditto.
2032         (CachedResourceStreamingClient::responseReceived): Change appsrc
2033         stream-type when we wan't seek. Also update caps like souphttpsrc
2034         does.
2035         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.h: Add forward declaration of MediaPlayer.
2036         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
2037         (WebCore::MediaSourceClientGStreamerMSE::append): Fix compilation warning.
2038
2039 2018-01-16  Yacine Bandou  <yacine.bandou_ext@softathome.com>
2040
2041         [WPE] Two clearkey tests failing since r226621
2042         https://bugs.webkit.org/show_bug.cgi?id=181532
2043
2044         Reviewed by Xabier Rodriguez-Calvar.
2045
2046         Whith a fake initData, we can have a pssh size nul, thus we should check it.
2047         We saw this issue in the subtest "initData longer than 64Kb characters" in
2048         the clearkey-generate-request-disallowed-input layout test.
2049
2050         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
2051         (WebCore::extractKeyidsLocationFromCencInitData):
2052
2053 2018-01-15  Yoav Weiss  <yoav@yoav.ws>
2054
2055         Support for preconnect Link headers
2056         https://bugs.webkit.org/show_bug.cgi?id=181657
2057
2058         Reviewed by Darin Adler.
2059
2060         Move the preconnect functionality into its own function, and
2061         also call this function when Link headers are processed.
2062
2063         Test: http/tests/preconnect/link-header-rel-preconnect-http.php
2064
2065         * loader/LinkLoader.cpp:
2066         (WebCore::LinkLoader::loadLinksFromHeader): Call preconnect.
2067         (WebCore::LinkLoader::preconnect): Preconnect to a host functionality moved here.
2068         (WebCore::LinkLoader::preload): Renamed `preloadIfNeeded` to `preload`.
2069         (WebCore::LinkLoader::loadLink): Call preconnect.
2070         * loader/LinkLoader.h:
2071
2072 2018-01-15  Michael Catanzaro  <mcatanzaro@igalia.com>
2073
2074         Improve use of ExportMacros
2075         https://bugs.webkit.org/show_bug.cgi?id=181652
2076
2077         Reviewed by Konstantin Tokarev.
2078
2079         Remove a comment.
2080
2081         * platform/PlatformExportMacros.h:
2082
2083 2018-01-15  Konstantin Tokarev  <annulen@yandex.ru>
2084
2085         image-rendering should affect scaling of border-image
2086         https://bugs.webkit.org/show_bug.cgi?id=169440
2087
2088         Reviewed by Michael Catanzaro.
2089
2090         Test: fast/borders/border-image-pixelated.html
2091
2092         * rendering/style/NinePieceImage.cpp:
2093         (WebCore::NinePieceImage::paint):
2094
2095 2018-01-15  Tomas Popela  <tpopela@redhat.com>
2096
2097         2.19.3 ACCELERATED_2D_CANVAS support is broken
2098         https://bugs.webkit.org/show_bug.cgi?id=180799
2099
2100         Reviewed by Michael Catanzaro.
2101
2102         * html/canvas/CanvasRenderingContext2DBase.cpp:
2103         (WebCore::CanvasRenderingContext2DBase::didDraw):
2104
2105 2018-01-15  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2106
2107         [Curl] Enable HTTP/2
2108         https://bugs.webkit.org/show_bug.cgi?id=181551
2109
2110         Reviewed by Michael Catanzaro.
2111
2112         Start supporting HTTP/2 protocol. The first step is just enabling the HTTP/2 on Curl backend.
2113         Next step will be to enable multiplexing feature.
2114
2115         No new tests because we don't have HTTP/2 test backend yet.
2116
2117         * platform/network/curl/CurlContext.cpp:
2118         (WebCore::CurlContext::isHttp2Enabled const):
2119         (WebCore::CurlHandle::enableHttp):
2120         (WebCore::CurlHandle::enableHttpGetRequest):
2121         (WebCore::CurlHandle::enableHttpHeadRequest):
2122         (WebCore::CurlHandle::enableHttpPostRequest):
2123         (WebCore::CurlHandle::enableHttpPutRequest):
2124         (WebCore::CurlHandle::setHttpCustomRequest):
2125         * platform/network/curl/CurlContext.h:
2126
2127 2018-01-15  Dean Jackson  <dino@apple.com>
2128
2129         Use a helper function for checked arithmetic in WebGL validation
2130         https://bugs.webkit.org/show_bug.cgi?id=181620
2131         <rdar://problem/36485879>
2132
2133         Reviewed by Eric Carlson.
2134
2135         Eric recommended using a templated helper function to do
2136         a common arithmetic check in WebGL validation.
2137
2138         * html/canvas/WebGL2RenderingContext.cpp:
2139         (WebCore::WebGL2RenderingContext::validateIndexArrayConservative):
2140         * html/canvas/WebGLRenderingContext.cpp:
2141         (WebCore::WebGLRenderingContext::validateIndexArrayConservative):
2142         * html/canvas/WebGLRenderingContextBase.cpp:
2143         (WebCore::WebGLRenderingContextBase::validateIndexArrayPrecise):
2144         (WebCore::WebGLRenderingContextBase::validateDrawArrays):
2145         (WebCore::WebGLRenderingContextBase::validateSimulatedVertexAttrib0):
2146         (WebCore::WebGLRenderingContextBase::simulateVertexAttrib0):
2147         * html/canvas/WebGLRenderingContextBase.h:
2148         (WebCore::WebGLRenderingContextBase::checkedAddAndMultiply): New helper.
2149
2150 2018-01-15  Dean Jackson  <dino@apple.com>
2151
2152         Use traits for animation timing functions
2153         https://bugs.webkit.org/show_bug.cgi?id=181651
2154         <rdar://problem/36525328>
2155
2156         Reviewed by Antoine Quint.
2157
2158         Use the type traits for TimingFunction classes, so
2159         we can is<> and downcast<>.
2160
2161         * css/CSSComputedStyleDeclaration.cpp:
2162         (WebCore::createTimingFunctionValue):
2163         * platform/animation/TimingFunction.cpp:
2164         (WebCore::TimingFunction::transformTime const):
2165         * platform/animation/TimingFunction.h:
2166         * platform/graphics/ca/GraphicsLayerCA.cpp:
2167         (WebCore::animationHasStepsTimingFunction):
2168         (WebCore::animationHasFramesTimingFunction):
2169         * platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm:
2170         (WebCore::toCAMediaTimingFunction):
2171
2172 2018-01-15  Youenn Fablet  <youenn@apple.com>
2173
2174         RealtimeMediaSource should be ThreadSafeRefCounted
2175         https://bugs.webkit.org/show_bug.cgi?id=181649
2176
2177         Reviewed by Eric Carlson.
2178
2179         Difficult to write a test as this is really racy.
2180         RealtimeIncomingVideoSourceCocoa::OnFrame is taking a reference on a background thread
2181         to send a task to the main thread.
2182         This requires it to be thread safe ref counted.
2183
2184         * platform/mediastream/RealtimeMediaSource.h:
2185
2186 2018-01-15  Philippe Normand  <pnormand@igalia.com>
2187
2188         Prevent useless MediaPlayer mute state notifications
2189         https://bugs.webkit.org/show_bug.cgi?id=181646
2190
2191         Reviewed by Carlos Garcia Campos.
2192
2193         On GTK port the mute change notification was triggering the test
2194         runner to think the whole page mute state had changed and that
2195         media elements were muted. The simplest solution is to propagate
2196         the notification only if the state actually changed.
2197
2198         * platform/graphics/MediaPlayer.cpp:
2199         (WebCore::MediaPlayer::muteChanged): Propagate mute notification
2200         only if the mute state actually changed.
2201
2202 2018-01-15  Sebastian Dröge  <sebastian@centricular.com>
2203
2204         [GStreamer] Don't wait for draw condition variable when shutting down.
2205         https://bugs.webkit.org/show_bug.cgi?id=180978
2206
2207         Reviewed by Carlos Garcia Campos.
2208
2209         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2210         (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
2211         (WebCore::MediaPlayerPrivateGStreamerBase::cancelRepaint):
2212         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
2213         By also waiting for the draw condition variable while shutting down,
2214         it is possible that the GStreamer video sink is waiting for the main
2215         thread to actually render the current frame, while at the same time
2216         the main thread is waiting for the GStreamer video sink to shut down,
2217         resulting in a deadlock.
2218
2219 2018-01-13  Minsheng Liu  <lambda@liu.ms>
2220
2221         MathML Lengths should take zoom level into account
2222         https://bugs.webkit.org/show_bug.cgi?id=180029
2223
2224         Reviewed by Frédéric Wang.
2225
2226         The patch applies the effective zoom factor to physical units in toUserUnits().
2227
2228         Test: mathml/presentation/mspace-units-with-zoom.html
2229
2230         * rendering/mathml/RenderMathMLBlock.cpp:
2231         (WebCore::toUserUnits):
2232
2233 2018-01-12  Chris Dumez  <cdumez@apple.com>
2234
2235         ASSERTION FAILED: registration || isTerminating() in WebCore::SWServerWorker::skipWaiting()
2236         https://bugs.webkit.org/show_bug.cgi?id=181603
2237         <rdar://problem/36476050>
2238
2239         Reviewed by Youenn Fablet.
2240
2241         No new tests, covered by existing tests that crash flakily.
2242
2243         * workers/service/server/SWServer.cpp:
2244         (WebCore::SWServer::terminateWorkerInternal):
2245         If the connection to the context process is gone, make sure we make the worker as terminated
2246         so that it does not stay in Running state and in SWServer::m_runningOrTerminatingWorkers.
2247
2248         * workers/service/server/SWServerRegistration.cpp:
2249         (WebCore::SWServerRegistration::~SWServerRegistration):
2250         Add assertions to make sure none of the registration's workers are still running when
2251         the registration is destroyed.
2252
2253         (WebCore::SWServerRegistration::updateRegistrationState):
2254         Make sure registration workers that are overwritten are not still running.
2255
2256         * workers/service/server/SWServerWorker.cpp:
2257         (WebCore::SWServerWorker::setState):
2258         If a worker's state is set to redundant, make sure we also terminate it.
2259
2260 2018-01-12  Commit Queue  <commit-queue@webkit.org>
2261
2262         Unreviewed, rolling out r226927.
2263         https://bugs.webkit.org/show_bug.cgi?id=181621
2264
2265         Breaks 32-bit and iOS release for some reason that i don't
2266         understand yet (Requested by dino on #webkit).
2267
2268         Reverted changeset:
2269
2270         "Use a helper function for checked arithmetic in WebGL
2271         validation"
2272         https://bugs.webkit.org/show_bug.cgi?id=181620
2273         https://trac.webkit.org/changeset/226927
2274
2275 2018-01-12  Myles C. Maxfield  <mmaxfield@apple.com>
2276
2277         Data URL fonts split in the middle of an alphabet cause random letters to disappear
2278         https://bugs.webkit.org/show_bug.cgi?id=175845
2279         <rdar://problem/33996578>
2280
2281         Reviewed by Brent Fulgham.
2282
2283         It is fairly common practice for a font foundry to split a font up into two files such that a semi-random
2284         half of the alphabet is present in one of the files, and the other half is present in the other file. This
2285         practice involves representing the files as data URLs, so as to minimize the time it takes to load them.
2286
2287         Because resource loading is asynchronous (even for data URLs), it is possible today to get a paint after
2288         the first file is loaded but before the second file is loaded. Indeed, because of the way font fallback
2289         works, we will never start loading the second file until a layout has occurred with the first font.
2290
2291         Because a site usually only uses this pattern for a handful of fonts, and I've never seen this pattern
2292         being used for CJK fonts, it isn't very expensive to opportunistically decode these data URLs eagerly.
2293         Using this method doesn't actually guarantee that the two fonts will load in between successive paints,
2294         but it at least makes this much more likely. This patch implements this strategy, along with a size
2295         threshold to make sure that we won't decode any super large data URLs when it isn't necessary.
2296
2297         Test: fast/text/font-load-data-partitioned-alphabet.html
2298
2299         * css/CSSFontFace.cpp:
2300         (WebCore::CSSFontFace::opportunisticallyStartFontDataURLLoading):
2301         * css/CSSFontFace.h:
2302         * css/CSSFontFaceSource.cpp:
2303         (WebCore::CSSFontFaceSource::opportunisticallyStartFontDataURLLoading):
2304         * css/CSSFontFaceSource.h:
2305         * css/CSSFontSelector.cpp:
2306         (WebCore::CSSFontSelector::opportunisticallyStartFontDataURLLoading):
2307         * css/CSSFontSelector.h:
2308         * platform/graphics/FontCascadeFonts.cpp:
2309         (WebCore::opportunisticallyStartFontDataURLLoading):
2310         (WebCore::FontCascadeFonts::glyphDataForVariant):
2311         * platform/graphics/FontSelector.h:
2312
2313 2018-01-12  Alex Christensen  <achristensen@webkit.org>
2314
2315         History state should be updated during client redirects with asynchronous policy decisions
2316         https://bugs.webkit.org/show_bug.cgi?id=181358
2317         <rdar://problem/35547689>
2318
2319         Reviewed by Andy Estes.
2320
2321         When decidePolicyForNavigationAction is responded to asynchronously during a client redirect, 
2322         HistoryController::updateForRedirectWithLockedBackForwardList does not update the history because
2323         the document loader has not been marked as a client redirect because the FrameLoader only looks
2324         at its provisional document loader to mark it as a client redirect.  When decidePolicyForNavigationAction
2325         is responded to asynchronously, though, the FrameLoader's provisional document loader has moved to 
2326         its policy document loader.  To get both asynchronous and synchronous cases, let's just mark the document
2327         loader as a client redirect whether it's the provisional or policy document loader.
2328
2329         Covered by a new API test.
2330
2331         * loader/FrameLoader.cpp:
2332         (WebCore::FrameLoader::loadURL):
2333         (WebCore::FrameLoader::loadPostRequest):
2334
2335 2018-01-12  Dean Jackson  <dino@apple.com>
2336
2337         Use a helper function for checked arithmetic in WebGL validation
2338         https://bugs.webkit.org/show_bug.cgi?id=181620
2339         <rdar://problem/36485879>
2340
2341         Reviewed by Eric Carlson.
2342
2343         Eric recommended using a templated helper function to do
2344         a common arithmetic check in WebGL validation.
2345
2346         * html/canvas/WebGL2RenderingContext.cpp:
2347         (WebCore::WebGL2RenderingContext::validateIndexArrayConservative):
2348         * html/canvas/WebGLRenderingContext.cpp:
2349         (WebCore::WebGLRenderingContext::validateIndexArrayConservative):
2350         * html/canvas/WebGLRenderingContextBase.cpp:
2351         (WebCore::WebGLRenderingContextBase::checkedAddAndMultiply): New helper.
2352         (WebCore::WebGLRenderingContextBase::validateIndexArrayPrecise):
2353         (WebCore::WebGLRenderingContextBase::validateDrawArrays):
2354         (WebCore::WebGLRenderingContextBase::validateSimulatedVertexAttrib0):
2355         (WebCore::WebGLRenderingContextBase::simulateVertexAttrib0):
2356         * html/canvas/WebGLRenderingContextBase.h:
2357
2358 2018-01-12  Myles C. Maxfield  <mmaxfield@apple.com>
2359
2360         [Cocoa] CTFontCopyDefaultCascadeListForLanguages() can return nullptr
2361         https://bugs.webkit.org/show_bug.cgi?id=181615
2362         <rdar://problem/36334637>
2363
2364         Reviewed by Jon Lee.
2365
2366         Speculative fix. We are getting crash reports saying that this call can return nullptr, and we
2367         don't check for it.
2368
2369         No new tests because I couldn't find the specific input that causes it to return nullptr. (I
2370         tried running this code with every 0, 1, and 2 length locale string, every weight value, and
2371         every italic value, and couldn't get it to crash. I also inspected the code to figure out what
2372         values would cause it to return nullptr, and I couldn't find anything other than if the system
2373         has a totally busted font setup.)
2374
2375         * platform/graphics/cocoa/FontDescriptionCocoa.cpp:
2376         (WebCore::SystemFontDatabase::computeCascadeList):
2377
2378 2018-01-11  Dean Jackson  <dino@apple.com>
2379
2380         [WebGL] Simulated vertexAttrib0 can sometimes cause OUT_OF_MEMORY errors
2381         https://bugs.webkit.org/show_bug.cgi?id=181558
2382         <rdar://problem/36189833>
2383
2384         Reviewed by Eric Carlson.
2385
2386         Very large element indices in the ELEMENT_ARRAY_BUFFER meant that
2387         our simulated vertexAttrib0 buffer might be too large. We need
2388         to check for out-of-memory, but we can also detect some of the issues
2389         earlier in our validation code. Additionally, make sure that we don't
2390         accidentally cast an unsigned to a signed.
2391
2392         Test: fast/canvas/webgl/simulated-vertexAttrib0-invalid-indicies.html
2393
2394         * html/canvas/WebGL2RenderingContext.cpp:
2395         (WebCore::WebGL2RenderingContext::validateIndexArrayConservative): Update validation
2396         code to look for overflow, rather than relying on looking for sign changes.
2397         * html/canvas/WebGLRenderingContext.cpp:
2398         (WebCore::WebGLRenderingContext::validateIndexArrayConservative): Ditto.
2399         * html/canvas/WebGLRenderingContextBase.cpp:
2400         (WebCore::WebGLRenderingContextBase::validateIndexArrayPrecise):
2401         (WebCore::WebGLRenderingContextBase::drawArrays): Check that we were able to simulate.
2402         (WebCore::WebGLRenderingContextBase::drawElements):
2403         (WebCore::WebGLRenderingContextBase::validateSimulatedVertexAttrib0): Update validation code, and
2404         use GC3Duint, since that's what the indicies are.
2405         (WebCore::WebGLRenderingContextBase::simulateVertexAttrib0): Ditto.
2406         (WebCore::WebGLRenderingContextBase::drawArraysInstanced): Check that we were able to simulate.
2407         (WebCore::WebGLRenderingContextBase::drawElementsInstanced):
2408         * html/canvas/WebGLRenderingContextBase.h:
2409
2410 2018-01-12  Wenson Hsieh  <wenson_hsieh@apple.com>
2411
2412         Large in-place attachment elements cause the document width to expand when inserted
2413         https://bugs.webkit.org/show_bug.cgi?id=181614
2414
2415         Reviewed by Dan Bernstein.
2416
2417         Make in-place images and videos have a max-width of 100%, so that large attachments aren't inserted with full
2418         display size, causing the document and viewport width to expand.
2419
2420         * html/HTMLAttachmentElement.cpp:
2421         (WebCore::HTMLAttachmentElement::populateShadowRootIfNecessary):
2422
2423 2018-01-12  Keith Rollin  <krollin@apple.com>
2424
2425         Logged JSON should escape "'s and \'s in strings.
2426         https://bugs.webkit.org/show_bug.cgi?id=181608
2427
2428         Reviewed by Brent Fulgham.
2429
2430         No new tests -- no new functionality, just changed logging. The
2431         efficacy of the logging was verified by inspecting its output.
2432
2433         * loader/ResourceLoadObserver.cpp:
2434         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
2435
2436 2018-01-12  Dean Jackson  <dino@apple.com>
2437
2438         drawElements should be invalid if vertexAttrib0 doesn't have data
2439         https://bugs.webkit.org/show_bug.cgi?id=181609
2440         <rdar://problem/36392883>
2441
2442         Reviewed by Antoine Quint.
2443
2444         If a vertex attribute has been enabled, but no data provided, then
2445         draw validation should fail.
2446
2447         Test: fast/canvas/webgl/drawElements-empty-vertex-data.html
2448
2449         * html/canvas/WebGLRenderingContextBase.cpp:
2450         (WebCore::WebGLRenderingContextBase::validateVertexAttributes): If there were
2451         never any data in the vertex buffer, then we incorrectly compared with 0.
2452
2453 2018-01-12  Youenn Fablet  <youenn@apple.com>
2454
2455         FormDataElement::lengthInBytes should use ThreadableBlobRegistry
2456         https://bugs.webkit.org/show_bug.cgi?id=181554
2457
2458         Reviewed by Chris Dumez.
2459
2460         Covered by updated test.
2461
2462         Fix blobRegistry() use and add support for creating a response that may trigger the issue.
2463
2464
2465         * platform/network/FormData.cpp:
2466         (WebCore::FormDataElement::lengthInBytes const): Was using directly blobRegistry() while ThreadableBlobRegistry is more appropriate
2467         in case this is called from workers.
2468         * Modules/fetch/FetchBody.h:
2469         * Modules/fetch/FetchResponse.h:
2470         * fileapi/Blob.h:
2471         * testing/ServiceWorkerInternals.cpp:
2472         (WebCore::ServiceWorkerInternals::createOpaqueWithBlobBodyResponse):
2473         * testing/ServiceWorkerInternals.h:
2474         * testing/ServiceWorkerInternals.idl:
2475
2476 2018-01-12  Jer Noble  <jer.noble@apple.com>
2477
2478         Wrap CDMFairPlayStreaming and related classes in ENABLE(ENCRYPTED_MEDIA) checks
2479         https://bugs.webkit.org/show_bug.cgi?id=181602
2480
2481         Reviewed by Maciej Stachowiak.
2482
2483         * platform/graphics/avfoundation/CDMFairPlayStreaming.h:
2484         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
2485         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
2486
2487 2018-01-12  Youenn Fablet  <youenn@apple.com>
2488
2489         WebProcess should pass the registration identifier and not the worker identifier for fetch events
2490         https://bugs.webkit.org/show_bug.cgi?id=181591
2491
2492         Reviewed by Chris Dumez.
2493
2494         Test: http/wpt/service-workers/update-service-worker.https.html
2495
2496         Store service worker registration identifier in ResourceLoaderOptions instead of service worker identifier.
2497
2498         * loader/DocumentThreadableLoader.cpp:
2499         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
2500         (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest):
2501         * loader/ResourceLoaderOptions.h:
2502         * loader/WorkerThreadableLoader.cpp:
2503         (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
2504         * loader/cache/CachedResourceLoader.cpp:
2505         (WebCore::CachedResourceLoader::prepareFetch):
2506         (WebCore::CachedResourceLoader::determineRevalidationPolicy const):
2507         * loader/cache/CachedResourceRequest.cpp:
2508         (WebCore::CachedResourceRequest::setSelectedServiceWorkerRegistrationIdentifierIfNeeded):
2509         (WebCore::CachedResourceRequest::setNavigationServiceWorkerRegistrationData):
2510         (WebCore::CachedResourceRequest::setSelectedServiceWorkerIdentifierIfNeeded): Deleted.
2511         * loader/cache/CachedResourceRequest.h:
2512         * workers/WorkerScriptLoader.cpp:
2513         (WebCore::WorkerScriptLoader::loadSynchronously):
2514         (WebCore::WorkerScriptLoader::loadAsynchronously):
2515         * workers/service/server/SWServer.cpp:
2516         (WebCore::SWServer::activeWorkerFromRegistrationID):
2517         * workers/service/server/SWServer.h:
2518
2519 2018-01-12  Fujii Hironori  <Hironori.Fujii@sony.com>
2520
2521         [Win][CMake] Remove all-in-one file for WebCore DerivedSources
2522         https://bugs.webkit.org/show_bug.cgi?id=181582
2523
2524         Reviewed by Alex Christensen.
2525
2526         Those source files are compiled in unified source build nowadays.
2527
2528         No new tests (No behavior change)
2529
2530         * CMakeLists.txt: Removed calling PROCESS_ALLINONE_FILE.
2531         * DerivedSources.cpp: Removed.
2532         * WebCoreMacros.cmake: Removed a macro PROCESS_ALLINONE_FILE.
2533
2534 2018-01-12  Fujii Hironori  <Hironori.Fujii@sony.com>
2535
2536         [WinCairo][CMake] Use ${CURL_LIBRARY} instead of specifying the library name libcurl_imp explicitly
2537         https://bugs.webkit.org/show_bug.cgi?id=181578
2538
2539         Reviewed by Alex Christensen.
2540
2541         vcpkg has libcurl.lib, not libcurl_imp.lib.
2542
2543         No new tests because no behavior change.
2544
2545         * PlatformWinCairo.cmake: Link ${CURL_LIBRARY} instead of libcurl_imp.
2546
2547 2018-01-12  Jer Noble  <jer.noble@apple.com>
2548
2549         WebGL video texture black in Safari 11.0.2 and wrong colored in Safari Preview 11.1
2550         https://bugs.webkit.org/show_bug.cgi?id=181445
2551         <rdar://problem/36383183>
2552
2553         Reviewed by Dean Jackson.
2554
2555         Tests: added compile-time correctness tests for YCbCrMatrix values.
2556
2557         Perform the derivation from YCbCr coefficients into matrices in constexpr expressions
2558         at compile-time. This allows us to also perform compile-time correctness checks to catch
2559         regressions which may cause incorrect color conversions.
2560
2561         Since we now have general-purpose derivation of matrix values from coefficients,
2562         adding missing specificed matrices is trivial, so add support for SMPTE 240M and BT.2020
2563         matrices.
2564
2565         * platform/graphics/cv/VideoTextureCopierCV.cpp:
2566         (WebCore::GLfloatColor::GLfloatColor):
2567         (WebCore::GLfloatColor::abs):
2568         (WebCore::GLfloatColor::isApproximatelyEqualTo const):
2569         (WebCore::YCbCrMatrix::operator Vector<GLfloat> const):
2570         (WebCore::YCbCrMatrix::YCbCrMatrix):
2571         (WebCore::YCbCrMatrix::operator* const):
2572         (WebCore::YCbCrToRGBMatrixForRangeAndTransferFunction):
2573
2574 2018-01-12  Antoine Quint  <graouts@apple.com>
2575
2576         Add support for the frames() timing function
2577         https://bugs.webkit.org/show_bug.cgi?id=181585
2578         <rdar://problem/36463317>
2579
2580         Reviewed by Dean.
2581
2582         Implement the frames() timing function as specified in the CSS Timing Functions Level 1
2583         specification, specifically https://www.w3.org/TR/css-timing-1/#frames-timing-functions.
2584         A frames timing function is a type of timing function that divides the input time into a
2585         specified number of intervals of equal length.
2586
2587         Test: transitions/frames-timing-function.html
2588
2589         * css/CSSComputedStyleDeclaration.cpp:
2590         (WebCore::createTimingFunctionValue):
2591         * css/CSSTimingFunctionValue.cpp:
2592         (WebCore::CSSFramesTimingFunctionValue::customCSSText const):
2593         (WebCore::CSSFramesTimingFunctionValue::equals const):
2594         * css/CSSTimingFunctionValue.h:
2595         * css/CSSToStyleMap.cpp:
2596         (WebCore::CSSToStyleMap::mapAnimationTimingFunction):
2597         * css/CSSValue.cpp:
2598         (WebCore::CSSValue::equals const):
2599         (WebCore::CSSValue::cssText const):
2600         (WebCore::CSSValue::destroy):
2601         * css/CSSValue.h:
2602         (WebCore::CSSValue::isFramesTimingFunctionValue const):
2603         * css/CSSValueKeywords.in:
2604         * css/parser/CSSPropertyParser.cpp:
2605         (WebCore::consumeSteps):
2606         (WebCore::consumeFrames):
2607         (WebCore::consumeAnimationTimingFunction):
2608         * platform/animation/TimingFunction.cpp:
2609         (WebCore::operator<<):
2610         (WebCore::TimingFunction::transformTime const):
2611         * platform/animation/TimingFunction.h:
2612         (WebCore::TimingFunction::isFramesTimingFunction const):
2613         * platform/graphics/ca/GraphicsLayerCA.cpp:
2614         (WebCore::animationHasFramesTimingFunction):
2615         (WebCore::GraphicsLayerCA::animationCanBeAccelerated const):
2616
2617 2018-01-12  Commit Queue  <commit-queue@webkit.org>
2618
2619         Unreviewed, rolling out r226721.
2620         https://bugs.webkit.org/show_bug.cgi?id=181583
2621
2622         Lets do a slightly different fix (Requested by anttik on
2623         #webkit).
2624
2625         Reverted changeset:
2626
2627         "REGRESSION(r225650): The scores of MotionMark tests Multiply
2628         and Leaves dropped by 8%"
2629         https://bugs.webkit.org/show_bug.cgi?id=181460
2630         https://trac.webkit.org/changeset/226721
2631
2632 2018-01-11  Keith Miller  <keith_miller@apple.com>
2633
2634         Rename ENABLE_ASYNC_ITERATION to ENABLE_JS_ASYNC_ITERATION
2635         https://bugs.webkit.org/show_bug.cgi?id=181573
2636
2637         Reviewed by Simon Fraser.
2638
2639         * Configurations/FeatureDefines.xcconfig:
2640
2641 2018-01-11  Jiewen Tan  <jiewen_tan@apple.com>
2642
2643         [WebAuthN] Import a CBOR coder from Chromium
2644         https://bugs.webkit.org/show_bug.cgi?id=181522
2645         <rdar://problem/36055729>
2646
2647         Reviewed by Brent Fulgham.
2648
2649         This patch imports a CBOR coder including encoder and decoder from Chromium. CBOR encoder
2650         is needed for WebAuthN to encode attestation object into binaries. When supporting extensions
2651         in the future, CBOR encoder/decoder will be needed as well. Implementating and maintaining
2652         a fully-fledged CBOR coder doesn't seem to align with WebKit's best interests. Therefore,
2653         importing a most suitable third party implementation will be wise.
2654
2655         In this patch, it fully integrate the whole coder into our codebase. Those changes includes:
2656             1. Substitute data structures that enjoy a better WTF version.
2657             2. Replacing marcos.
2658             3. Implementating workarounds for some functionalities that we lack fundamental types' support.
2659             4. Changing the coding style to match ours.
2660
2661         This patch doesn't intend to improve the logic of the original codebase. Hence some of the
2662         coding logic might not match what WebKit ususally has.
2663
2664         Here is a full list of Chromium changes that constructed this CBOR coder in chronological order:
2665         6efcf495521d18d060027762f48bb292d6979136,
2666         9eb43fd347890b4c6cf54c4bd7ec1bbb88e381e1,
2667         31c85e74fd567772f18e0a41be468d04af721f21,
2668         68672fdcad280a8ff69b91927d38d0eabf2c87f2,
2669         0ca8667c0584fb21c0748ebd7468d32889759a07,
2670         df763d790d7e45d70116bdefacbfd4f9faa8995e,
2671         6d30c4a621c65314db63eb56e87c19ab75627b26,
2672         50fe92953f4739f17a62303fedbf8db9234317c8,
2673         47be22c3603424d1832d046a348ff3f982500288,
2674         98a59e46948b2c71608926004fac8192b0ff2208,
2675         07540c6d850ed6e0fa508d63c20a8ce96d751de6,
2676         06ae32d640c8e4b86ea8914a80ee419ea16e56d8.
2677
2678         Covered by API tests.
2679
2680         * Modules/webauthn/cbor/CBORBinary.h: Added.
2681         * Modules/webauthn/cbor/CBORReader.cpp: Added.
2682         (cbor::CBORReader::CBORReader):
2683         (cbor::CBORReader::~CBORReader):
2684         (cbor::CBORReader::read):
2685         (cbor::CBORReader::decodeCBOR):
2686         (cbor::CBORReader::readVariadicLengthInteger):
2687         (cbor::CBORReader::decodeValueToNegative):
2688         (cbor::CBORReader::decodeValueToUnsigned):
2689         (cbor::CBORReader::readSimpleValue):
2690         (cbor::CBORReader::readString):
2691         Workarounds applied.
2692         (cbor::CBORReader::readBytes):
2693         (cbor::CBORReader::readCBORArray):
2694         (cbor::CBORReader::readCBORMap):
2695         (cbor::CBORReader::canConsume):
2696         (cbor::CBORReader::checkMinimalEncoding):
2697         (cbor::CBORReader::checkExtraneousData):
2698         (cbor::CBORReader::checkDuplicateKey):
2699         (cbor::CBORReader::hasValidUTF8Format):
2700         Workarounds applied.
2701         (cbor::CBORReader::checkOutOfOrderKey):
2702         (cbor::CBORReader::getErrorCode):
2703         (cbor::CBORReader::errorCodeToString):
2704         * Modules/webauthn/cbor/CBORReader.h: Added.
2705         * Modules/webauthn/cbor/CBORValue.cpp: Added.
2706         (cbor::CBORValue::CBORValue):
2707         (cbor::CBORValue::operator=):
2708         (cbor::CBORValue::~CBORValue):
2709         (cbor::CBORValue::clone const):
2710         (cbor::CBORValue::getInteger const):
2711         (cbor::CBORValue::getUnsigned const):
2712         (cbor::CBORValue::getNegative const):
2713         (cbor::CBORValue::getString const):
2714         (cbor::CBORValue::getByteString const):
2715         (cbor::CBORValue::getArray const):
2716         (cbor::CBORValue::getMap const):
2717         (cbor::CBORValue::getSimpleValue const):
2718         (cbor::CBORValue::internalMoveConstructFrom):
2719         (cbor::CBORValue::internalCleanup):
2720         * Modules/webauthn/cbor/CBORValue.h: Added.
2721         * Modules/webauthn/cbor/CBORWriter.cpp: Added.
2722         (cbor::CBORWriter::~CBORWriter):
2723         (cbor::CBORWriter::write):
2724         (cbor::CBORWriter::CBORWriter):
2725         (cbor::CBORWriter::encodeCBOR):
2726         Workarounds applied.
2727         (cbor::CBORWriter::startItem):
2728         (cbor::CBORWriter::setAdditionalInformation):
2729         (cbor::CBORWriter::setUint):
2730         (cbor::CBORWriter::getNumUintBytes):
2731         * Modules/webauthn/cbor/CBORWriter.h: Added.
2732         * Sources.txt:
2733         * WebCore.xcodeproj/project.pbxproj:
2734
2735 2018-01-11  Chris Dumez  <cdumez@apple.com>
2736
2737         Setting Window.opener to null should disown its opener
2738         https://bugs.webkit.org/show_bug.cgi?id=181505
2739         <rdar://problem/36443151>
2740
2741         Reviewed by Ryosuke Niwa.
2742
2743         Setting Window.opener to null should disown its opener as per:
2744         - https://html.spec.whatwg.org/#dom-opener
2745
2746         With this change, tabs opened by clicking link inside Gmail no
2747         longer have the Gmail window as opener.
2748
2749         Tests: fast/dom/Window/window-opener-set-to-null.html
2750                fast/dom/Window/window-opener-shadowing.html
2751
2752         * bindings/js/JSDOMWindowCustom.cpp:
2753         (WebCore::JSDOMWindow::setOpener):
2754         * page/DOMWindow.cpp:
2755         (WebCore::DOMWindow::disownOpener):
2756         * page/DOMWindow.h:
2757         * page/DOMWindow.idl:
2758
2759 2018-01-11  Myles C. Maxfield  <mmaxfield@apple.com>
2760
2761         [Cocoa] Star character disappears when bolded
2762         https://bugs.webkit.org/show_bug.cgi?id=181568
2763         <rdar://problem/18755569>
2764
2765         Reviewed by Simon Fraser.
2766
2767         We had some code in ComplexTextController to ask the FontCache for a font, given the name
2768         of a particular font CoreText used inside a CTRun. This is wrong for two reasons: fonts
2769         are not identifiable by PostScript name (in the general case), and because the lookup
2770         procedure requires a FontDescription, the result may yield a font that is not the one
2771         looked up. The goal of this code was simply to preserve the rendering mode of the font,
2772         but we removed support for these rendering modes years ago. So the solution is to skip
2773         that lookup and use the CoreText font directly.
2774
2775         Test: fast/text/unknown-font.html
2776
2777         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
2778         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
2779
2780 2018-01-11  Keith Rollin  <krollin@apple.com>
2781
2782         Add optional logging of ITP-related user interaction information
2783         https://bugs.webkit.org/show_bug.cgi?id=181556
2784
2785         Reviewed by Brent Fulgham.
2786
2787         In order to support the tracking of the efficacy of Intelligent
2788         Tracking Protection, add some logging indicating when the user
2789         interacts with a page in a way that affects cookie partitioning. This
2790         logging is off by default, and is enabled with `defaults write -g
2791         WebKitLogCookieInformation -bool true`.
2792
2793         No new tests -- no changed functionality.
2794
2795         * loader/ResourceLoadObserver.cpp:
2796         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
2797         * loader/ResourceLoadObserver.h:
2798         (WebCore::ResourceLoadObserver::shouldLogUserInteraction const):
2799         (WebCore::ResourceLoadObserver::setShouldLogUserInteraction):
2800
2801 2018-01-11  James Craig  <jcraig@apple.com>
2802
2803         AX: when invert colors is on, double-invert video elements in UserAgentStyleSheet
2804         https://bugs.webkit.org/show_bug.cgi?id=168447
2805         <rdar://problem/30559874>
2806
2807         Reviewed by Simon Fraser.
2808
2809         Double-invert video when platform "invert colors" setting is enabled. Behavior matches 
2810         current "Smart Invert" feature of Safari Reader on macOS/iOS and other iOS native apps.
2811
2812         Tests: accessibility/smart-invert-reference.html
2813                accessibility/smart-invert.html
2814
2815         * Modules/modern-media-controls/controls/media-controls.css:
2816         (@media (inverted-colors)):
2817         (:host):
2818         (picture):
2819         * css/html.css:
2820         (@media (inverted-colors)):
2821         (video):
2822
2823 2018-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
2824
2825         Don't load inline data when requesting info for an attachment element backed by a file path
2826         https://bugs.webkit.org/show_bug.cgi?id=181550
2827
2828         Reviewed by Tim Horton.
2829
2830         When requesting data for an attachment element that is backed by a file path, we currently trigger a load in the
2831         web process to fetch contents of the attachment data as inline data in the AttachmentInfo. This is unnecessary,
2832         since the file path of the attachment element must have come from the UI process anyways, so it is sufficient to
2833         simply send the file path to the UI process and have the UI process read the contents of the path as a memory-
2834         mapped NSData.
2835
2836         This patch lets HTMLAttachmentElement skip over resource loading codepaths when creating an AttachmentInfo for
2837         the client, and also teaches _WKAttachment to read a AttachmentInfo's filepath as memory-mapped data if a file
2838         path is present, and no inline data was specified.
2839
2840         Covered by existing API tests.
2841
2842         * html/HTMLAttachmentElement.cpp:
2843         (WebCore::HTMLAttachmentElement::requestInfo):
2844
2845 2018-01-10  Ryosuke Niwa  <rniwa@webkit.org>
2846
2847         Make elements of zero width or height focusable
2848         https://bugs.webkit.org/show_bug.cgi?id=181516
2849
2850         Reviewed by Chris Dumez.
2851
2852         Don't check render box's size or bounding rect when deciding whether an element is focusable.
2853         New behavior matches that of Firefox and Chrome.
2854
2855         Test: fast/events/focus-zero-size-element.html
2856
2857         * dom/Element.cpp:
2858         (WebCore::Element::isFocusable): Only update the style.
2859         * html/HTMLFormControlElement.cpp:
2860         (WebCore::HTMLFormControlElement::isFocusable const): Deleted.
2861         * html/HTMLFormControlElement.h:
2862         * mathml/MathMLElement.cpp:
2863         (WebCore::MathMLElement::isFocusable const): Deleted. As far as I can tell, no math ml element is focusable.
2864         * mathml/MathMLElement.h:
2865         * svg/SVGAElement.cpp:
2866         (WebCore::SVGAElement::isFocusable const): Deleted.
2867         * svg/SVGAElement.h:
2868
2869 2018-01-11  Filip Pizlo  <fpizlo@apple.com>
2870
2871         Rename MarkedAllocator to BlockDirectory and AllocatorAttributes to CellAttributes
2872         https://bugs.webkit.org/show_bug.cgi?id=181543
2873
2874         Rubber stamped by Michael Saboff.
2875
2876         No new tests because I'm just renaming things.
2877
2878         * ForwardingHeaders/heap/BlockDirectoryInlines.h: Copied from Source/WebCore/ForwardingHeaders/heap/MarkedAllocatorInlines.h.
2879         * ForwardingHeaders/heap/MarkedAllocatorInlines.h: Removed.
2880         * bindings/js/DOMGCOutputConstraint.cpp:
2881
2882 2018-01-11  Alex Christensen  <achristensen@webkit.org>
2883
2884         REGRESSION(r225003): Loading hangs in environments where dispatch_async does not work
2885         https://bugs.webkit.org/show_bug.cgi?id=181553
2886         <rdar://problem/35733938>
2887
2888         Reviewed by Eric Carlson.
2889
2890         There is an environment where dispatch_async does not work, but performSelectorOnMainThread works.
2891         r225003 broke loading in this environment.  This fixes it and updates the test that r225003 fixed.
2892         It failed sometimes because loading was happening in a different order than html parsing, so I made
2893         the test not depend on html parsing timing by updating media/video-src-remove.html.
2894
2895         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
2896         (-[WebCoreResourceHandleAsOperationQueueDelegate callFunctionOnMainThread:]):
2897
2898 2018-01-11  Dean Jackson  <dino@apple.com>
2899
2900         Rolling out 226814. It crashes on some bots.
2901
2902 2018-01-11  Dean Jackson  <dino@apple.com>
2903
2904         [WebGL] Simulated vertexAttrib0 can sometimes cause OUT_OF_MEMORY errors
2905         https://bugs.webkit.org/show_bug.cgi?id=181558
2906         <rdar://problem/36189833>
2907
2908         Reviewed by Eric Carlson.
2909
2910         Very large element indices in the ELEMENT_ARRAY_BUFFER meant that
2911         our simulated vertexAttrib0 buffer might be too large. We need
2912         to check for out-of-memory, but we can also detect some of the issues
2913         earlier in our validation code. Additionally, make sure that we don't
2914         accidentally cast an unsigned to a signed.
2915
2916         Test: fast/canvas/webgl/simulated-vertexAttrib0-invalid-indicies.html
2917
2918         * html/canvas/WebGL2RenderingContext.cpp:
2919         (WebCore::WebGL2RenderingContext::validateIndexArrayConservative): Update validation
2920         code to look for overflow, rather than relying on looking for sign changes.
2921         * html/canvas/WebGLRenderingContext.cpp:
2922         (WebCore::WebGLRenderingContext::validateIndexArrayConservative): Ditto.
2923         * html/canvas/WebGLRenderingContextBase.cpp:
2924         (WebCore::WebGLRenderingContextBase::validateIndexArrayPrecise):
2925         (WebCore::WebGLRenderingContextBase::drawArrays): Check that we were able to simulate.
2926         (WebCore::WebGLRenderingContextBase::drawElements):
2927         (WebCore::WebGLRenderingContextBase::validateSimulatedVertexAttrib0): Update validation code, and
2928         use GC3Duint, since that's what the indicies are.
2929         (WebCore::WebGLRenderingContextBase::simulateVertexAttrib0): Ditto.
2930         (WebCore::WebGLRenderingContextBase::drawArraysInstanced): Check that we were able to simulate.
2931         (WebCore::WebGLRenderingContextBase::drawElementsInstanced):
2932         * html/canvas/WebGLRenderingContextBase.h:
2933
2934 2018-01-11  Chris Dumez  <cdumez@apple.com>
2935
2936         ASSERTION FAILED: registration in WebCore::SWServerWorker::skipWaiting()
2937         https://bugs.webkit.org/show_bug.cgi?id=181222
2938         <rdar://problem/36332686>
2939
2940         Reviewed by Youenn Fablet.
2941
2942         Replace assertion in SWServerWorker::skipWaiting() that assumes the worker
2943         has a registration. Nowadays, a SWServerWorker can stay alive for a short
2944         period without having a registration, while it is terminating.
2945
2946         No new tests, unskipped existing test.
2947
2948         * workers/service/server/SWServerWorker.cpp:
2949         (WebCore::SWServerWorker::skipWaiting):
2950
2951 2018-01-11  Antti Koivisto  <antti@apple.com>
2952
2953         Don't call RenderElement::setStyle when nothing changes
2954         https://bugs.webkit.org/show_bug.cgi?id=181530
2955
2956         Reviewed by Zalan Bujtas.
2957
2958         * style/StyleChange.h:
2959
2960         Remove 'Force' value. This essentially meant 'compute style for all descendants and call setStyle unconditionally'.
2961         Using this value lost information about whether anything actually changed in a particular style as it was automatically
2962         inherited by all descendants. The 'compute all descendants' part of the behavior is what is actually needed.
2963
2964         Instead add separate DescendantsToResolve enum for communicating what else to compute.
2965
2966         * style/StyleTreeResolver.cpp:
2967         (WebCore::Style::TreeResolver::Parent::Parent):
2968         (WebCore::Style::computeDescendantsToResolve):
2969
2970             Figure out which descendants will need resolving based on how the current elements style changed.
2971
2972         (WebCore::Style::TreeResolver::resolveElement):
2973         (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
2974         (WebCore::Style::TreeResolver::pushParent):
2975         (WebCore::Style::shouldResolveElement):
2976
2977             Use DescendantsToResolve as input.
2978
2979         (WebCore::Style::TreeResolver::resolveComposedTree):
2980         * style/StyleTreeResolver.h:
2981         * style/StyleUpdate.h:
2982         (WebCore::Style::ElementUpdates::ElementUpdates):
2983
2984             Add DescendantsToResolve.
2985
2986 2018-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
2987
2988         Send PromisedBlobInfo to the client through DragItem instead of DragClient::prepareToDragPromisedBlob
2989         https://bugs.webkit.org/show_bug.cgi?id=181497
2990
2991         Reviewed by Tim Horton.
2992
2993         Refactor drag initiation with DOMFile-backed attachment elements. See WebKit ChangeLog for more information. No
2994         change in behavior; promised blob dragging covered by WKAttachment API tests.
2995
2996         * loader/EmptyClients.cpp:
2997         * page/DragClient.h:
2998         (WebCore::DragClient::prepareToDragPromisedBlob): Deleted.
2999         * page/DragController.cpp:
3000         (WebCore::DragController::startDrag):
3001         (WebCore::DragController::doImageDrag):
3002         (WebCore::DragController::doSystemDrag):
3003         (WebCore::DragController::promisedBlobInfo):
3004         (WebCore::DragController::dragAttachmentElement): Deleted.
3005         * page/DragController.h:
3006         * platform/DragItem.h:
3007         (WebCore::DragItem::encode const):
3008         (WebCore::DragItem::decode):
3009
3010 2018-01-11  Youenn Fablet  <youenn@apple.com>
3011
3012         RTCController should disable ICE candidate filtering in case of getUserMedia based on the RTCPerrConnection origin
3013         https://bugs.webkit.org/show_bug.cgi?id=180851
3014
3015         Reviewed by Eric Carlson.
3016
3017         Test: http/wpt/webrtc/third-party-frame-ice-candidate-filtering.html
3018
3019         RTCController now stores all the client origins (top+frame origins) of frames that got access to camera/microphone access.
3020         For any such client origin, PeerConnection objects ICE candidate filtering is disabled.
3021         ICE candidate filtering is reset whenever navigating/reloading the page.
3022
3023         * Modules/mediastream/RTCController.cpp:
3024         (WebCore::RTCController::reset):
3025         (WebCore::matchDocumentOrigin):
3026         (WebCore::RTCController::shouldDisableICECandidateFiltering):
3027         (WebCore::RTCController::add):
3028         (WebCore::RTCController::disableICECandidateFilteringForAllOrigins):
3029         (WebCore::RTCController::disableICECandidateFiltering):
3030         (WebCore::RTCController::enableICECandidateFiltering):
3031         * Modules/mediastream/RTCController.h:
3032         * Modules/mediastream/RTCPeerConnection.cpp:
3033         (WebCore::RTCPeerConnection::create):
3034         * Modules/mediastream/UserMediaRequest.cpp:
3035         (WebCore::UserMediaRequest::allow):
3036         * page/Page.cpp:
3037         (WebCore::Page::disableICECandidateFiltering):
3038         * testing/Internals.cpp:
3039         (WebCore::Internals::setICECandidateFiltering):
3040
3041 2018-01-11  Ali Juma  <ajuma@chromium.org>
3042
3043         window.visualViewport should behave as [SameObject]
3044         https://bugs.webkit.org/show_bug.cgi?id=181548
3045
3046         Reviewed by Chris Dumez.
3047
3048         Add 'GenerateIsReachable' to VisualViewport so that window.visualViewport's
3049         JS wrapper object doesn't get garbage collected too soon.
3050
3051         Test: fast/visual-viewport/visual-viewport-same-object.html
3052
3053         * page/VisualViewport.idl:
3054
3055 2018-01-11  Basuke Suzuki  <Basuke.Suzuki@sony.com>
3056
3057         [Curl] Extract multipart handling from ResourceHandle to CurlRequest.
3058         https://bugs.webkit.org/show_bug.cgi?id=181506
3059
3060         Reviewed by Alex Christensen.
3061
3062         Rename old MultipartHandle class to CurlMultipartHandle and modernize it. Also move the responsibility 
3063         of handling multi part from ResourceHandle to CurlRequest. This is required for upcoming NetworkLoadTask.
3064
3065         No new tests because no new behavior.
3066
3067         * platform/Curl.cmake:
3068         * platform/network/curl/CurlMultipartHandle.cpp: Renamed from Source/WebCore/platform/network/curl/MultipartHandle.cpp.
3069         (WebCore::CurlMultipartHandle::createIfNeeded):
3070         (WebCore::CurlMultipartHandle::extractBoundary):
3071         (WebCore::CurlMultipartHandle::extractBoundaryFromContentType):
3072         (WebCore::CurlMultipartHandle::CurlMultipartHandle):
3073         (WebCore::CurlMultipartHandle::didReceiveData):
3074         (WebCore::CurlMultipartHandle::didComplete):
3075         (WebCore::CurlMultipartHandle::processContent):
3076         (WebCore::CurlMultipartHandle::checkForBoundary):
3077         (WebCore::CurlMultipartHandle::matchedLength):
3078         (WebCore::CurlMultipartHandle::parseHeadersIfPossible):
3079         * platform/network/curl/CurlMultipartHandle.h: Renamed from Source/WebCore/platform/network/curl/MultipartHandle.h.
3080         (WebCore::CurlMultipartHandle::~CurlMultipartHandle):
3081         * platform/network/curl/CurlMultipartHandleClient.h: Added.
3082         (WebCore::CurlMultipartHandleClient::~CurlMultipartHandleClient):
3083         * platform/network/curl/CurlRequest.cpp:
3084         (WebCore::CurlRequest::CurlRequest):
3085         (WebCore::CurlRequest::didReceiveHeader):
3086         (WebCore::CurlRequest::didReceiveData):
3087         (WebCore::CurlRequest::didReceiveHeaderFromMultipart):
3088         (WebCore::CurlRequest::didReceiveDataFromMultipart):
3089         (WebCore::CurlRequest::didCompleteTransfer):
3090         (WebCore::CurlRequest::finalizeTransfer):
3091         (WebCore::CurlRequest::invokeDidReceiveResponseForFile):
3092         (WebCore::CurlRequest::invokeDidReceiveResponse):
3093         (WebCore::CurlRequest::completeDidReceiveResponse):
3094         * platform/network/curl/CurlRequest.h:
3095         (WebCore::CurlRequest::create):
3096         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
3097         (WebCore::ResourceHandleCurlDelegate::createCurlRequest):
3098         (WebCore::ResourceHandleCurlDelegate::curlDidReceiveResponse):
3099         (WebCore::ResourceHandleCurlDelegate::curlDidReceiveBuffer):
3100         (WebCore::ResourceHandleCurlDelegate::curlDidComplete):
3101         * platform/network/curl/ResourceHandleCurlDelegate.h:
3102
3103 2018-01-11  Zalan Bujtas  <zalan@apple.com>
3104
3105         RenderTreeUpdater::current() returns null_ptr when mutation is done through Document::resolveStyle.
3106         https://bugs.webkit.org/show_bug.cgi?id=181513
3107         <rdar://problem/36367085>
3108
3109         Reviewed by Antti Koivisto.
3110
3111         This patch ensures that we use a valid RenderTreeBuilder even when
3112         Document::resolveStyle (incorrectly) triggers tree mutation.
3113         It can be reverted soon after the incorrect mutations are taken care of.
3114
3115         Test: fast/forms/button-set-text-crash.html
3116
3117         * rendering/RenderButton.cpp:
3118         (WebCore::RenderButton::setText):
3119         * rendering/RenderMenuList.cpp:
3120         (RenderMenuList::setText):
3121
3122 2018-01-11  Antoine Quint  <graouts@apple.com>
3123
3124         Only listen to webkitplaybacktargetavailabilitychanged when media controls are visible to the user
3125         https://bugs.webkit.org/show_bug.cgi?id=181547
3126         <rdar://problem/35947650>
3127
3128         Reviewed by Eric Carlson.
3129
3130         Because listening to "webkitplaybacktargetavailabilitychanged" events incurs some higher power usage on iOS,
3131         we only listen to such events when controls are visible to the user. In other words, the MediaControls need to
3132         have both "visible" set to "true" and "faded" set to "false". To support this, we add a delegate method on
3133         MediaControls such that it can tell the MediaController that the "visible" property changed. With this message,
3134         MediaController can inform its MediaControllerSupport objects that user visibility of the controls changed, which
3135         lets AirplaySupport disable itself when controls are no longer visible.
3136
3137         Test: media/modern-media-controls/airplay-support/airplay-support-disable-event-listeners-with-hidden-controls.html
3138
3139         * Modules/modern-media-controls/controls/media-controls.js:
3140         (MediaControls.prototype.set visible):
3141         * Modules/modern-media-controls/media/airplay-support.js:
3142         (AirplaySupport.prototype.controlsUserVisibilityDidChange):
3143         * Modules/modern-media-controls/media/media-controller-support.js:
3144         (MediaControllerSupport.prototype.controlsUserVisibilityDidChange):
3145         * Modules/modern-media-controls/media/media-controller.js:
3146         (MediaController.prototype.mediaControlsVisibilityDidChange):
3147         (MediaController.prototype.mediaControlsFadedStateDidChange):
3148         (MediaController.prototype._controlsUserVisibilityDidChange):
3149
3150 2018-01-11  Antoine Quint  <graouts@apple.com>
3151
3152         [iOS] There should be no controls markup generated in fullscreen
3153         https://bugs.webkit.org/show_bug.cgi?id=181540
3154         <rdar://problem/35060379>
3155
3156         Reviewed by Eric Carlson.
3157
3158         We completely forgo the display of any content when fullscreen on iOS by setting the
3159         "visible" flag to "false" on the MediaControls, which will prevent any DOM content from
3160         being added.
3161
3162         * Modules/modern-media-controls/media/media-controller.js:
3163         (MediaController.prototype.handleEvent):
3164         (MediaController.prototype._updateiOSFullscreenProperties):
3165         (MediaController):
3166         (MediaController.prototype._updateSupportingObjectsEnabledState): Deleted.
3167
3168 2018-01-11  Alex Christensen  <achristensen@webkit.org>
3169
3170         Revert changes accidentally committed with r226789.
3171         https://bugs.webkit.org/show_bug.cgi?id=181423
3172
3173         I had some local changes I did not mean to commit.
3174
3175         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
3176         (scheduledWithCustomRunLoopMode):
3177         (-[WebCoreResourceHandleAsOperationQueueDelegate callFunctionOnMainThread:]):
3178         (WebCore::if): Deleted.
3179         (WebCore::>::fromCallable): Deleted.
3180
3181 2018-01-10  Simon Fraser  <simon.fraser@apple.com>
3182
3183         On macOS, getBoundingClientRect gives incorrect values when pinch-zoomed
3184         https://bugs.webkit.org/show_bug.cgi?id=181511
3185         rdar://problem/33741427
3186
3187         Reviewed by Zalan Bujtas.
3188         
3189         When reverting "client coordinates are relative to layout viewport" in r219829
3190         I broke documentToClientOffset() on macOS by failing to take pinch zoom scale into
3191         account (frameScaleFactor() is always 1 on iOs, so this bug doesn't manifest there).
3192
3193         Covered by existing tests.
3194
3195         * page/FrameView.cpp:
3196         (WebCore::FrameView::documentToClientOffset const):
3197
3198 2018-01-11  Youenn Fablet  <youenn@apple.com>
3199
3200         Replace WebRTCLegacyAPIDisabled by WebRTCLegacyAPIEnabled and switch off WebRTC legacy flag by default
3201         https://bugs.webkit.org/show_bug.cgi?id=181480
3202
3203         Reviewed by Eric Carlson.
3204
3205         No change of behavior.
3206
3207         * page/RuntimeEnabledFeatures.h: Set default value to false.
3208
3209 2018-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
3210
3211         [Attachment Support] Support moving attachment elements in editable areas using drag and drop
3212         https://bugs.webkit.org/show_bug.cgi?id=181337
3213         <rdar://problem/36324813>
3214
3215         Reviewed by Tim Horton.
3216
3217         Makes slight adjustments to attachment-specific drag and drop logic to ensure that moving attachments via drag
3218         and drop behaves correctly. See per-change comments for more detail.
3219
3220         Tests:  WKAttachmentTests.DragInPlaceVideoAttachmentElement
3221                 WKAttachmentTests.MoveAttachmentElementAsIconByDragging
3222                 WKAttachmentTests.MoveInPlaceAttachmentElementByDragging
3223
3224         * editing/cocoa/EditorCocoa.mm:
3225         (WebCore::Editor::getPasteboardTypesAndDataForAttachment):
3226
3227         Stop vending the private web archive pasteboard type for attachments, for now. This works around issues where an
3228         attachment element that is dragged and dropped within the same page may lose its blob backing data if we try to
3229         remove and insert it as a fragment from the archive. Providing a web archive would allow us to avoid destroying
3230         and recreating an attachment element when dragging within the same page, but this is a nice-to-have optimization
3231         we can re-enable after investigation in a subsequent patch.
3232
3233         * html/HTMLAttachmentElement.cpp:
3234         (WebCore::HTMLAttachmentElement::populateShadowRootIfNecessary):
3235
3236         Add `draggable=false` to the image element of an in-place attachment element.
3237
3238         * page/DragController.cpp:
3239         (WebCore::enclosingAttachmentElement):
3240         (WebCore::DragController::draggableElement const):
3241
3242         Tweak single-selected-attachment handling to account for in-place attachments. Since the hit-tested node is
3243         inside the shadow subtree of the attachment element, the condition needs to check for the startElement as well
3244         as the startElement's shadow host.
3245
3246         (WebCore::DragController::startDrag):
3247
3248         Make two tweaks here. First, don't require a RenderAttachment to drag an attachment element (this is required
3249         for dragging in-place attachments). This was added in r217083 to address <rdar://problem/32282831>, but is no
3250         longer correct, since attachments may now be displayed in-place.
3251
3252         Secondly, only restore the previous selection if the attachment is in a richly contenteditable area. This was
3253         added to prevent the selection highlight from appearing in when dragging non-editable attachment elements in the
3254         Mail viewer. However, to allow drag moves to occur, we need the selection to persist after drag start.
3255
3256 2018-01-04  Filip Pizlo  <fpizlo@apple.com>
3257
3258         CodeBlocks should be in IsoSubspaces
3259         https://bugs.webkit.org/show_bug.cgi?id=180884
3260
3261         Reviewed by Saam Barati.
3262
3263         No new tests because no new behavior.
3264         
3265         Adopting new parallel constraint API, so that more of the logic of doing parallel
3266         constraint solving is shared between the DOM's output constraints and JSC's output
3267         constraints.
3268
3269         * bindings/js/DOMGCOutputConstraint.cpp:
3270         (WebCore::DOMGCOutputConstraint::executeImpl):
3271         (WebCore::DOMGCOutputConstraint::doParallelWorkImpl): Deleted.
3272         (WebCore::DOMGCOutputConstraint::finishParallelWorkImpl): Deleted.
3273         * bindings/js/DOMGCOutputConstraint.h:
3274
3275 2018-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
3276
3277         [Attachment Support] Support dragging attachment elements out as files on iOS
3278         https://bugs.webkit.org/show_bug.cgi?id=181199
3279         <rdar://problem/36299316>
3280
3281         Reviewed by Tim Horton, Andy Estes and Joseph Pecoraro.
3282
3283         Adds support for dragging "files" (i.e. creating item providers with preferred attachment presentation styles)
3284         from attachment elements on iOS for Mail. See below for more detail.
3285
3286         Tests:  WKAttachmentTestsIOS.DragAttachmentInsertedAsData
3287                 WKAttachmentTestsIOS.DragAttachmentInsertedAsFile
3288
3289         * page/DragController.cpp:
3290         (WebCore::DragController::platformContentTypeForBlobType const):
3291         (WebCore::DragController::dragAttachmentElement):
3292         * page/DragController.h:
3293         * page/mac/DragControllerMac.mm:
3294         (WebCore::DragController::platformContentTypeForBlobType const):
3295
3296         Add a private method to convert the type of a promised blob to a platform type. For Cocoa platforms, this
3297         converts the blob type (either a UTI or a MIME type) to a UTI for the platform to consume.
3298
3299         * platform/ios/WebItemProviderPasteboard.h:
3300         * platform/ios/WebItemProviderPasteboard.mm:
3301
3302         Refactor WebItemProviderRegistrationInfo. WebItemProviderRegistrationInfo currently encapsulates a single item
3303         provider registration call, and contains either a type identifier and data buffer, or an NSItemProviderWriting-
3304         conformant object. To register an item provider using a WebItemProviderRegistrationInfo, the item provider
3305         pasteboard currently checks to see whether the info contains an object or a type and data.
3306
3307         This patch removes WebItemProviderRegistrationInfo and replaces it with WebItemProviderDataRegistrar. Objects
3308         that implement this protocol know how to take an NSItemProvider and register data to it. So far, there are
3309         three implementations below.
3310
3311         (-[WebItemProviderDataRegistrar initWithData:type:]):
3312         (-[WebItemProviderDataRegistrar typeIdentifier]):
3313         (-[WebItemProviderDataRegistrar data]):
3314         (-[WebItemProviderDataRegistrar typeIdentifierForClient]):
3315         (-[WebItemProviderDataRegistrar dataForClient]):
3316         (-[WebItemProviderDataRegistrar registerItemProvider:]):
3317         (-[WebItemProviderDataRegistrar description]):
3318
3319         A data registrar takes a UTI and data buffer, and registers the UTI to the data. This replaces a
3320         WebItemProviderRegistrationInfo with both a type and data, but no representing object.
3321
3322         (-[WebItemProviderWritableObjectRegistrar initWithObject:]):
3323         (-[WebItemProviderWritableObjectRegistrar representingObjectForClient]):
3324         (-[WebItemProviderWritableObjectRegistrar registerItemProvider:]):
3325         (-[WebItemProviderWritableObjectRegistrar description]):
3326
3327         The writable object registrar writes an NSItemProviderWriting-conformant object to an item provider. This
3328         replaces a WebItemProviderRegistrationInfo with only a representing object.
3329
3330         (-[WebItemProviderPromisedFileRegistrar initWithType:callback:]):
3331         (-[WebItemProviderPromisedFileRegistrar registerItemProvider:]):
3332         (-[WebItemProviderPromisedFileRegistrar description]):
3333         (-[WebItemProviderRegistrationInfoList addData:forType:]):
3334         (-[WebItemProviderRegistrationInfoList addRepresentingObject:]):
3335         (-[WebItemProviderRegistrationInfoList addPromisedType:fileCallback:]):
3336
3337         Helper methods to add new registrars to a registration info list.
3338
3339         (-[WebItemProviderRegistrationInfoList itemAtIndex:]):
3340         (-[WebItemProviderRegistrationInfoList enumerateItems:]):
3341         (-[WebItemProviderRegistrationInfoList itemProvider]):
3342         (-[WebItemProviderRegistrationInfoList description]):
3343         (-[WebItemProviderRegistrationInfo initWithRepresentingObject:typeIdentifier:data:]): Deleted.
3344         (-[WebItemProviderRegistrationInfo representingObject]): Deleted.
3345         (-[WebItemProviderRegistrationInfo typeIdentifier]): Deleted.
3346
3347 2018-01-11  Michael Saboff  <msaboff@apple.com>
3348
3349         Add a DOM gadget for Spectre testing
3350         https://bugs.webkit.org/show_bug.cgi?id=181351
3351
3352         Reviewed by Ryosuke Niwa.
3353
3354         This change is used to test Spectre mitigations.
3355
3356         Added a new DOM class to test for Spectre issues in the DOM layer.
3357         This additional functionality is disabled by default and must be enabled
3358         through the JSC option "enableSpectreGadgets".
3359
3360         * CMakeLists.txt:
3361         * DerivedSources.make:
3362         * Sources.txt:
3363         * WebCore.xcodeproj/project.pbxproj:
3364         * bindings/js/WebCoreBuiltinNames.h:
3365         * dom/SpectreGadget.cpp: Added.
3366         (WebCore::SpectreGadget::SpectreGadget):
3367         (WebCore::SpectreGadget::create):
3368         (WebCore::SpectreGadget::setReadLength):
3369         (WebCore::SpectreGadget::charCodeAt):
3370         (WebCore::SpectreGadget::clflushReadLength):
3371         * dom/SpectreGadget.h: Added.
3372         * dom/SpectreGadget.idl: Added.
3373         * page/RuntimeEnabledFeatures.cpp:
3374         (WebCore::RuntimeEnabledFeatures::spectreGadgetsEnabled const):
3375         * page/RuntimeEnabledFeatures.h:
3376
3377 2018-01-11  Philippe Normand  <pnormand@igalia.com>
3378
3379         [GTK] media/muted-video-is-playing-audio.html is timing out
3380         https://bugs.webkit.org/show_bug.cgi?id=163781
3381
3382         Reviewed by Carlos Garcia Campos.
3383
3384         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3385         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideo): Sprinkle some debugging.
3386         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfAudio): Ditto.
3387         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3388         (WebCore::MediaPlayerPrivateGStreamerBase::setMuted): Ditto.
3389
3390 2018-01-10  Andy Estes  <aestes@apple.com>
3391
3392         [Payment Request] Rename ApplePayMerchantValidationEvent to MerchantValidationEvent
3393         https://bugs.webkit.org/show_bug.cgi?id=181437
3394         <rdar://problem/36376481>
3395
3396         Reviewed by Tim Horton.
3397         
3398         Renamed ApplePayMerchantValidationEvent to MerchantValidationEvent and changed complete() to accept a Promise.
3399
3400         Test: http/tests/paymentrequest/payment-request-merchant-validation.https.html
3401
3402         * DerivedSources.make:
3403         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
3404         (WebCore::ApplePayPaymentHandler::merchantValidationCompleted):
3405         (WebCore::ApplePayPaymentHandler::validateMerchant):
3406         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
3407         * Modules/paymentrequest/MerchantValidationEvent.cpp: Renamed from Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.cpp.
3408         (WebCore::MerchantValidationEvent::create):
3409         (WebCore::MerchantValidationEvent::MerchantValidationEvent):
3410         (WebCore::MerchantValidationEvent::eventInterface const):
3411         (WebCore::MerchantValidationEvent::complete):
3412         * Modules/paymentrequest/MerchantValidationEvent.h: Renamed from Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.h.
3413         * Modules/paymentrequest/MerchantValidationEvent.idl: Renamed from Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.idl.
3414         * Modules/paymentrequest/PaymentHandler.h:
3415         * Modules/paymentrequest/PaymentRequest.cpp:
3416         (WebCore::PaymentRequest::completeMerchantValidation):
3417         * Modules/paymentrequest/PaymentRequest.h:
3418         * Modules/paymentrequest/PaymentRequest.idl:
3419         *&nb