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