feMorphology stops applying if either x or y radius is 0 but should not.
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-01-23  Simon Fraser  <simon.fraser@apple.com>
2
3         feMorphology stops applying if either x or y radius is 0 but should not.
4         https://bugs.webkit.org/show_bug.cgi?id=181903
5
6         Reviewed by Dean Jackson.
7         
8         feMorphology should allow the radius on one axis to be zero but still apply the effect
9         (it's akin to a blur on just one axis). Also, any negative radius, or zero on both axes
10         should act like a pass-through, rather than outputting transparent blank (this is a spec
11         change from SVG 1.1 to SVG 2).
12
13         Tests: svg/filters/feMorphology-zero-radius-one-axis-expected.svg
14                svg/filters/feMorphology-zero-radius-one-axis.svg
15
16         * platform/graphics/filters/FEMorphology.cpp:
17         (WebCore::FEMorphology::platformApplyDegenerate):
18         * platform/graphics/filters/FilterEffect.cpp:
19         (WebCore::FilterEffect::createImageBufferResult):
20
21 2018-01-23  Alex Christensen  <achristensen@webkit.org>
22
23         Remove unused MediaPlayerSupportsTypeClient
24         https://bugs.webkit.org/show_bug.cgi?id=182003
25
26         Reviewed by Sam Weinig.
27
28         This was used for a QTKit-specific hack I removed in r227372.
29
30         * Modules/encryptedmedia/CDM.cpp:
31         (WebCore::CDM::getSupportedCapabilitiesForAudioVideoType):
32         * Modules/mediasource/MediaSource.cpp:
33         (WebCore::MediaSource::isTypeSupported):
34         * dom/DOMImplementation.cpp:
35         (WebCore::DOMImplementation::createDocument):
36         (WebCore::DOMImplementationSupportsTypeClient::DOMImplementationSupportsTypeClient): Deleted.
37         (): Deleted.
38         * html/HTMLMediaElement.cpp:
39         (WebCore::HTMLMediaElement::canPlayType const):
40         (WebCore::HTMLMediaElement::selectNextSourceChild):
41         (WebCore::HTMLMediaElement::mediaPlayerNeedsSiteSpecificHacks const): Deleted.
42         (WebCore::HTMLMediaElement::mediaPlayerDocumentHost const): Deleted.
43         * html/HTMLMediaElement.h:
44         * platform/graphics/MediaPlayer.cpp:
45         (WebCore::MediaPlayer::supportsType):
46         * platform/graphics/MediaPlayer.h:
47         (WebCore::MediaPlayerSupportsTypeClient::mediaPlayerNeedsSiteSpecificHacks const): Deleted.
48         (WebCore::MediaPlayerSupportsTypeClient::mediaPlayerDocumentHost const): Deleted.
49
50 2018-01-23  Alex Christensen  <achristensen@webkit.org>
51
52         Remove unused QTKit preference
53         https://bugs.webkit.org/show_bug.cgi?id=181968
54
55         Reviewed by Alexey Proskuryakov.
56
57         They weren't used and didn't do anything.
58
59         * page/DeprecatedGlobalSettings.cpp:
60         (WebCore::DeprecatedGlobalSettings::setQTKitEnabled): Deleted.
61         * page/DeprecatedGlobalSettings.h:
62         (WebCore::DeprecatedGlobalSettings::isQTKitEnabled): Deleted.
63
64 2018-01-23  Javier Fernandez  <jfernandez@igalia.com>
65
66         [css-align] 'left' and 'right' should parse as invalid in block/cross-axis alignment
67         https://bugs.webkit.org/show_bug.cgi?id=181792
68
69         Reviewed by Antti Koivisto.
70
71         The CSS WG resolved to remove the 'left' and 'right' values from the
72         block/cross axis alignment properties.
73
74         https://github.com/w3c/csswg-drafts/issues/1403
75
76         This patch changes the CSS parsing logic of all the CSS Box Alignment
77         properties, both block-axis (align-{self, items, content} and
78         inline-axis (justify-{self, items, content}).
79
80         Additionally, the alignment shorthands (place-{self, items, content})
81         have been also changed to respect the new syntax.
82
83         Despite the number of layout tests changed, I don't think this
84         change will break any content in current sites. The CSS values
85         'left' and 'right' were introduced by the new CSS Box Alignment
86         spec and only implemented by the CSS Grid Layout feature, shipped
87         last year. Additionally, the removed values have no effect on the
88         layout result when they are applied to the block/cross-axis CSS
89         Alignment properties.
90
91         Tests: imported/w3c/web-platform-tests/css/css-align/content-distribution/parse-align-content-001.html
92                imported/w3c/web-platform-tests/css/css-align/content-distribution/parse-align-content-002.html
93                imported/w3c/web-platform-tests/css/css-align/content-distribution/parse-align-content-003.html
94                imported/w3c/web-platform-tests/css/css-align/content-distribution/parse-align-content-004.html
95                imported/w3c/web-platform-tests/css/css-align/content-distribution/parse-align-content-005.html
96                imported/w3c/web-platform-tests/css/css-align/content-distribution/parse-justify-content-001.html
97                imported/w3c/web-platform-tests/css/css-align/content-distribution/parse-justify-content-002.html
98                imported/w3c/web-platform-tests/css/css-align/content-distribution/parse-justify-content-003.html
99                imported/w3c/web-platform-tests/css/css-align/content-distribution/parse-justify-content-004.html
100                imported/w3c/web-platform-tests/css/css-align/content-distribution/parse-justify-content-005.html
101                imported/w3c/web-platform-tests/css/css-align/content-distribution/place-content-shorthand-001.html
102                imported/w3c/web-platform-tests/css/css-align/content-distribution/place-content-shorthand-002.html
103                imported/w3c/web-platform-tests/css/css-align/content-distribution/place-content-shorthand-003.html
104                imported/w3c/web-platform-tests/css/css-align/content-distribution/place-content-shorthand-004.html
105                imported/w3c/web-platform-tests/css/css-align/content-distribution/place-content-shorthand-005.html
106                imported/w3c/web-platform-tests/css/css-align/content-distribution/place-content-shorthand-006.html
107                imported/w3c/web-platform-tests/css/css-align/default-alignment/justify-items-legacy-001.html
108                imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-align-items-001.html
109                imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-align-items-002.html
110                imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-align-items-003.html
111                imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-align-items-004.html
112                imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-align-items-005.html
113                imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-justify-items-001.html
114                imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-justify-items-002.html
115                imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-justify-items-003.html
116                imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-justify-items-004.html
117                imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-justify-items-005.html
118                imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-justify-items-006.html
119                imported/w3c/web-platform-tests/css/css-align/default-alignment/place-items-shorthand-001.html
120                imported/w3c/web-platform-tests/css/css-align/default-alignment/place-items-shorthand-002.html
121                imported/w3c/web-platform-tests/css/css-align/default-alignment/place-items-shorthand-003.html
122                imported/w3c/web-platform-tests/css/css-align/default-alignment/place-items-shorthand-004.html
123                imported/w3c/web-platform-tests/css/css-align/default-alignment/place-items-shorthand-005.html
124                imported/w3c/web-platform-tests/css/css-align/default-alignment/place-items-shorthand-006.html
125                imported/w3c/web-platform-tests/css/css-align/distribution-values/space-evenly-001.html
126                imported/w3c/web-platform-tests/css/css-align/self-alignment/parse-align-self-001.html
127                imported/w3c/web-platform-tests/css/css-align/self-alignment/parse-align-self-002.html
128                imported/w3c/web-platform-tests/css/css-align/self-alignment/parse-align-self-003.html
129                imported/w3c/web-platform-tests/css/css-align/self-alignment/parse-align-self-004.html
130                imported/w3c/web-platform-tests/css/css-align/self-alignment/parse-align-self-005.html
131                imported/w3c/web-platform-tests/css/css-align/self-alignment/parse-justify-self-001.html
132                imported/w3c/web-platform-tests/css/css-align/self-alignment/parse-justify-self-002.html
133                imported/w3c/web-platform-tests/css/css-align/self-alignment/parse-justify-self-003.html
134                imported/w3c/web-platform-tests/css/css-align/self-alignment/parse-justify-self-004.html
135                imported/w3c/web-platform-tests/css/css-align/self-alignment/parse-justify-self-005.html
136                imported/w3c/web-platform-tests/css/css-align/self-alignment/place-self-shorthand-001.html
137                imported/w3c/web-platform-tests/css/css-align/self-alignment/place-self-shorthand-002.html
138                imported/w3c/web-platform-tests/css/css-align/self-alignment/place-self-shorthand-003.html
139                imported/w3c/web-platform-tests/css/css-align/self-alignment/place-self-shorthand-004.html
140                imported/w3c/web-platform-tests/css/css-align/self-alignment/place-self-shorthand-005.html
141                imported/w3c/web-platform-tests/css/css-align/self-alignment/place-self-shorthand-006.html
142
143         * css/parser/CSSPropertyParser.cpp:
144         (WebCore::isLeftOrRightKeyword):
145         (WebCore::isContentPositionKeyword):
146         (WebCore::isContentPositionOrLeftOrRightKeyword):
147         (WebCore::consumeContentDistributionOverflowPosition):
148         (WebCore::isSelfPositionKeyword):
149         (WebCore::isSelfPositionOrLeftOrRightKeyword):
150         (WebCore::consumeSelfPositionOverflowPosition):
151         (WebCore::consumeAlignItems):
152         (WebCore::consumeJustifyItems):
153         (WebCore::CSSPropertyParser::parseSingleValue):
154         (WebCore::consumeSimplifiedContentPosition):
155         (WebCore::CSSPropertyParser::consumePlaceContentShorthand):
156         (WebCore::consumeSimplifiedItemPosition):
157         (WebCore::CSSPropertyParser::consumePlaceItemsShorthand):
158         (WebCore::CSSPropertyParser::consumePlaceSelfShorthand):
159
160 2018-01-23  Simon Fraser  <simon.fraser@apple.com>
161
162         Element with position:fixed stops scrolling at the bottom of the page, but is painted in the right place on Chacos.com.
163         https://bugs.webkit.org/show_bug.cgi?id=181741
164         rdar://problem/36593581
165
166         Reviewed by Tim Horton.
167
168         The #ifdef for iOS was wrong; on iOS, visibleSize() is in content coordinates and matches
169         unscaledDocumentRect, so there's no need to scale it. Doing so computed the wrong unscaledMaximumScrollPosition
170         which broke hit-testing when the document minimum scale was > 1.
171
172         Test: fast/visual-viewport/ios/min-scale-greater-than-one.html
173
174         * page/FrameView.cpp:
175         (WebCore::FrameView::unscaledMaximumScrollPosition const):
176
177 2018-01-23  Antoine Quint  <graouts@apple.com>
178
179         [Web Animations] Expose getKeyframes() and parsing of remaining keyframe properties
180         https://bugs.webkit.org/show_bug.cgi?id=181978
181         <rdar://problem/36772586>
182
183         Reviewed by Dean Jackson.
184
185         We finish our implementation of multiple keyframes by exposing the getKeyframes() method on KeyframeEffect and
186         parsing the remaining properties that can be exposed on keyframes: "easing" and "composite". And since we parse
187         those properties on keyframes, we also parse "easing" on AnimationEffectTiming and "composite" and "iterationComposite"
188         on KeyframeEffect. 
189
190         To support this, we implement a new TimingFunction::createFromCSSText() method which takes in a string that is
191         a value provided directly via the JS API. As its converse, we expose a TimingFunction::cssText() method which
192         provides a string that can be sent back to JS to represent a timing function, using keywords when the timing
193         function matches one and ommitting default values.
194
195         We now also keep track of the original "offset" value provided through the JS API since that value is required
196         when calling getKeyframes() and distinct from the "computedOffset". These original offsets, composite operations
197         and timing functions are kept as separate Vectors from the KeyframeList since this type does not support exposing
198         those. We may consider improving that in a future patch.
199
200         Finally, we make some adjustments in the keyframe parsing to comply with the specification and correctly parse
201         all provided timing functions, regardless of the number of keyframes and timing functions provided.
202
203         Note that this patch is only about parsing, storing and returning provided easing and composite operations but
204         that such values will only be used for the resolution of animation effects in future patches.
205
206         * animation/AnimationEffect.cpp:
207         (WebCore::AnimationEffect::getComputedTiming): Set the "easing" property on the getComputedTiming() return value
208         now that we expose "easing" on AnimationEffectTiming.
209         * animation/AnimationEffectTiming.cpp:
210         (WebCore::AnimationEffectTiming::AnimationEffectTiming): Create a linear TimingFunction by default.
211         (WebCore::AnimationEffectTiming::setEasing): Parse the "easing" value and propagate an exception for invalid values.
212         * animation/AnimationEffectTiming.h: Expose the new "easing" property and backing TimingFunction.
213         * animation/AnimationEffectTiming.idl: Expose the new "easing" property.
214         * animation/KeyframeEffect.cpp:
215         (WebCore::CSSPropertyIDToIDLAttributeName): Provide a way to convert the name of a CSS property to a string that can
216         be used to generate a JS property name for use by getKeyframes().
217         (WebCore::computeMissingKeyframeOffsets): Implement the full steps of the spec.
218         (WebCore::processIterableKeyframes): Fix a problematic declaration for the easing variable.
219         (WebCore::processPropertyIndexedKeyframes): Now that ProcessedKeyframe has both an offset and a computedOffset, use
220         computed offsets. We also fix a couple of loops to fix compliance issues revealed by WPT tests.
221         (WebCore::KeyframeEffect::create): Parse the provided "easing" property on the KeyframeEffectOptions object.
222         (WebCore::KeyframeEffect::getKeyframes): Implement the getKeyframes() method as mandated by the spec.
223         (WebCore::KeyframeEffect::processKeyframes): Keep a list of unused easings so these might be parsed as well, and
224         potentially throw exceptions, as mandated by the spec. For valid easings, store their matching TimingFunction in
225         m_timingFunctions, original offset values in m_offsets and CompositeOperation values in m_compositeOperations.
226         * animation/KeyframeEffect.h: Switch the order in which we specify some of the Variant types so that default values
227         are correctly used.
228         * animation/KeyframeEffect.idl: Switch the order in which we specify some of the Variant types so that default values
229         are correctly used.
230         * platform/animation/TimingFunction.cpp:
231         (WebCore::TimingFunction::createFromCSSText):
232         (WebCore::TimingFunction::cssText const):
233         * platform/animation/TimingFunction.h:
234
235 2018-01-23  Brady Eidson  <beidson@apple.com>
236
237         Allow passing MessagePorts across processes (e.g. ServiceWorkers).
238         https://bugs.webkit.org/show_bug.cgi?id=181178
239
240         Reviewed by Andy Estes.
241
242         Test: http/tests/workers/service/basic-messageport.html
243
244         * dom/MessagePort.cpp:
245         (WebCore::MessagePort::MessagePort):
246         (WebCore::MessagePort::~MessagePort):
247
248         * dom/messageports/MessagePortChannel.cpp:
249         (WebCore::MessagePortChannel::entanglePortWithProcess):
250         * dom/messageports/MessagePortChannel.h:
251
252         * workers/service/SWClientConnection.cpp:
253         (WebCore::SWClientConnection::postMessageToServiceWorkerClient):
254         * workers/service/SWClientConnection.h:
255
256         * workers/service/ServiceWorker.cpp:
257         (WebCore::ServiceWorker::postMessage):
258
259         * workers/service/ServiceWorkerClient.cpp:
260         (WebCore::ServiceWorkerClient::postMessage):
261
262         * workers/service/context/SWContextManager.cpp:
263         (WebCore::SWContextManager::postMessageToServiceWorker):
264         * workers/service/context/SWContextManager.h:
265
266 2018-01-23  Commit Queue  <commit-queue@webkit.org>
267
268         Unreviewed, rolling out r227279 and r227373.
269         https://bugs.webkit.org/show_bug.cgi?id=181988
270
271         The LayoutTest crash fix introduced an API test failure.
272         (Requested by ryanhaddad on #webkit).
273
274         Reverted changesets:
275
276         "Resign NowPlaying status when no media element is eligible"
277         https://bugs.webkit.org/show_bug.cgi?id=181914
278         https://trac.webkit.org/changeset/227279
279
280         "Resign NowPlaying status when no media element is eligible"
281         https://bugs.webkit.org/show_bug.cgi?id=181914
282         https://trac.webkit.org/changeset/227373
283
284 2018-01-23  Michael Catanzaro  <mcatanzaro@igalia.com>
285
286         Unreviewed, fix some format specifiers added in r227190
287         https://bugs.webkit.org/show_bug.cgi?id=181454
288
289         * dom/messageports/MessagePortChannel.cpp:
290         (WebCore::MessagePortChannel::takeAllMessagesForPort):
291
292 2018-01-23  Ting-Wei Lan  <lantw44@gmail.com>
293
294         [GTK] Add user agent quirk for Microsoft Outlook Web App
295         https://bugs.webkit.org/show_bug.cgi?id=181982
296
297         Reviewed by Michael Catanzaro.
298
299         Microsoft Outlook Web App forces users to switch to the lite version on
300         the login page with our standard user agent on all non-macOS systems.
301         Since it is an application that can be installed by different companies,
302         schools and organizations, it is not possible to fix the issue unless
303         we keep a big list of host names that are known to run it. We check the
304         host name instead of the base domain name here because it is not
305         expected to run all sites under a base domain on this webmail and
306         calendar application.
307
308         https://mail.ntu.edu.tw is a site that is known to run Microsoft Outlook
309         Web App for several years, and it is not likely to change. When there
310         are other sites found to run it and having the same user agent problem,
311         we can expand the list to include them.
312
313         * platform/UserAgentQuirks.cpp:
314         (WebCore::urlRequiresMacintoshPlatform):
315
316 2018-01-23  Yacine Bandou  <yacine.bandou_ext@softathome.com>
317
318         [EME] Add support of multi keys from different sessions in CDMinstanceClearKey
319         https://bugs.webkit.org/show_bug.cgi?id=180083
320
321         Reviewed by Xabier Rodriguez-Calvar.
322
323         Add support of multi keys from different MediaKeySession in CDMInstanceClearKey.
324
325         Currently the CDMInstanceClearKey manages two "m_keys", one is a WTF::Vector
326         where it stores the list of last added keys, an other which is defined in the
327         ClearKeyState::singleton it is a WTF::HashMap, in this last one, it stores the
328         keys lists of each created session.
329
330         The method "keys()" of CDMInstanceClearKey returns the first "m_keys" which
331         contains just the list of last keys.
332
333         The goal of this commit is to return all keys lists of all sessions, thus
334         we remove the "m_keys" which is WTF::Vector and we modify the method
335         "keys()" to return all keys lists, which is stored in "m_keys" WTF::HashMap,
336         in one Vector instead of return just the list of last keys.
337
338         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
339         (WebCore::CDMInstanceClearKey::keys const):
340         (WebCore::CDMInstanceClearKey::updateLicense):
341         * platform/encryptedmedia/clearkey/CDMClearKey.h:
342
343 2018-01-22  Simon Fraser  <simon.fraser@apple.com>
344
345         Optimize building the non-fast scrollable region with multiple iframes
346         https://bugs.webkit.org/show_bug.cgi?id=181971
347
348         Reviewed by Zalan Bujtas.
349
350         AsyncScrollingCoordinator::frameViewLayoutUpdated() is called every time a subframe lays out.
351         We don't need to eagerly update the non-fast scrollable region at this time; we can just mark
352         it dirty, and rely on the existing scrolling tree commit code to recompute it.
353
354         On my machine this makes fast/frames/lots-of-objects.html no longer a timeout.
355
356         * page/scrolling/AsyncScrollingCoordinator.cpp:
357         (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
358
359 2018-01-22  Jiewen Tan  <jiewen_tan@apple.com>
360
361         [WebAuthN] Implement PublicKeyCredential's [[Create]] with a dummy authenticator
362         https://bugs.webkit.org/show_bug.cgi?id=181928
363         <rdar://problem/36459893>
364
365         Reviewed by Brent Fulgham.
366
367         This patch implements PublicKeyCredential's [[Create]] from https://www.w3.org/TR/webauthn/#createCredential
368         as of 5 December 2017. In order to do testing, a dummy authenticator is implemented to exercise a failure
369         and a pass path. A number of dependencies need to be resolved later in order to comply with the spec.
370         Also, the current architecture of handling async WebAuthN operations including dispatching, timeout, and aborting
371         might need a redesign once the underlying authenticator is clear. Since this is our first attempt to implement
372         a prototype, all those limitations, in my opinion, can be marked as non-blocking to accelerate the whole
373         process. Those limitations will then be addressed once the first prototype is finshed.
374
375         Tests: http/tests/webauthn/public-key-credential-create-with-invalid-parameters.https.html
376                http/tests/webauthn/public-key-credential-same-origin-with-ancestors-2.https.html
377                http/tests/webauthn/public-key-credential-same-origin-with-ancestors.https.html
378                http/wpt/webauthn/idl.https.html
379                http/wpt/webauthn/public-key-credential-create-failure.https.html
380                http/wpt/webauthn/public-key-credential-create-success.https.html
381
382         * Modules/credentialmanagement/BasicCredential.h:
383         * Modules/credentialmanagement/BasicCredential.idl:
384         * Modules/credentialmanagement/CredentialsContainer.cpp:
385         (WebCore::CredentialsContainer::PendingPromise::PendingPromise):
386         (WebCore::CredentialsContainer::dispatchTask):
387         (WebCore::CredentialsContainer::get):
388         (WebCore::CredentialsContainer::isCreate):
389         (WebCore::CredentialsContainer::preventSilentAccess const):
390         (WebCore::CredentialsContainer::preventSilentAccess): Deleted.
391         * Modules/credentialmanagement/CredentialsContainer.h:
392         (WebCore::CredentialsContainer::PendingPromise::create):
393         * Modules/webauthn/Authenticator.cpp: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.cpp.
394         (WebCore::Authenticator::singleton):
395         (WebCore::Authenticator::makeCredential const):
396         * Modules/webauthn/Authenticator.h: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredentialCreationOptions.h.
397         * Modules/webauthn/AuthenticatorAssertionResponse.cpp:
398         (WebCore::AuthenticatorAssertionResponse::authenticatorData const):
399         (WebCore::AuthenticatorAssertionResponse::signature const):
400         (WebCore::AuthenticatorAssertionResponse::userHandle const):
401         (WebCore::AuthenticatorAssertionResponse::~AuthenticatorAssertionResponse): Deleted.
402         (WebCore::AuthenticatorAssertionResponse::authenticatorData): Deleted.
403         (WebCore::AuthenticatorAssertionResponse::signature): Deleted.
404         (WebCore::AuthenticatorAssertionResponse::userHandle): Deleted.
405         * Modules/webauthn/AuthenticatorAssertionResponse.h:
406         (WebCore::AuthenticatorAssertionResponse::create):
407         * Modules/webauthn/AuthenticatorAttestationResponse.cpp:
408         (WebCore::AuthenticatorAttestationResponse::attestationObject const):
409         (WebCore::AuthenticatorAttestationResponse::~AuthenticatorAttestationResponse): Deleted.
410         (WebCore::AuthenticatorAttestationResponse::attestationObject): Deleted.
411         * Modules/webauthn/AuthenticatorAttestationResponse.h:
412         (WebCore::AuthenticatorAttestationResponse::create):
413         * Modules/webauthn/AuthenticatorResponse.cpp:
414         (WebCore::AuthenticatorResponse::clientDataJSON const):
415         (WebCore::AuthenticatorResponse::~AuthenticatorResponse): Deleted.
416         (WebCore::AuthenticatorResponse::clientDataJSON): Deleted.
417         * Modules/webauthn/AuthenticatorResponse.h:
418         * Modules/webauthn/AuthenticatorResponse.idl:
419         * Modules/webauthn/PublicKeyCredential.cpp:
420         (WebCore::PublicKeyCredentialInternal::produceClientDataJson):
421         (WebCore::PublicKeyCredentialInternal::produceClientDataJsonHash):
422         (WebCore::PublicKeyCredentialInternal::getIdFromAttestationObject):
423         (WebCore::PublicKeyCredential::PublicKeyCredential):
424         (WebCore::PublicKeyCredential::discoverFromExternalSource):
425         (WebCore::PublicKeyCredential::create):
426         (WebCore::PublicKeyCredential::rawId const):
427         (WebCore::PublicKeyCredential::response const):
428         (WebCore::PublicKeyCredential::getClientExtensionResults const):
429         (WebCore::PublicKeyCredential::rawId): Deleted.
430         (WebCore::PublicKeyCredential::response): Deleted.
431         (WebCore::PublicKeyCredential::getClientExtensionResults): Deleted.
432         * Modules/webauthn/PublicKeyCredential.h:
433         * Modules/webauthn/PublicKeyCredential.idl:
434         * Modules/webauthn/PublicKeyCredentialCreationOptions.h:
435         (): Deleted.
436         * Modules/webauthn/PublicKeyCredentialDescriptor.h:
437         * Modules/webauthn/PublicKeyCredentialDescriptor.idl:
438         * Sources.txt:
439         * WebCore.xcodeproj/project.pbxproj:
440         * bindings/js/JSAuthenticatorResponseCustom.cpp: Copied from Source/WebCore/Modules/webauthn/AuthenticatorAttestationResponse.cpp.
441         (WebCore::toJSNewlyCreated):
442         (WebCore::toJS):
443         * bindings/js/JSBasicCredentialCustom.cpp: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.cpp.
444         (WebCore::toJSNewlyCreated):
445         (WebCore::toJS):
446         * bindings/js/JSBindingsAllInOne.cpp:
447
448 2018-01-22  Myles C. Maxfield  <mmaxfield@apple.com>
449
450         [Cocoa] Support font collections
451         https://bugs.webkit.org/show_bug.cgi?id=181826
452         <rdar://problem/36455137>
453
454         Reviewed by Dean Jackson.
455
456         Use the CoreText call CTFontManagerCreateFontDescriptorsFromData() to get all the descriptors inside
457         the collection file. We select which one by using the fragment identifier at the end of the url linking
458         to the remote font. For example, to select the 4th font inside a TTC file, the @font-face block would
459         look like:
460
461         @font-face {
462             font-family: "MyFont";
463             src: url("path/to/font.ttc#4");
464         }
465
466         Note that these numbers are 1-indexed.
467
468         The CSS Fonts spec states:
469         > Fragment identifiers are used to indicate which font to load. If a container format lacks a defined
470         > fragment identifier scheme, implementations should use a simple 1-based indexing scheme (e.g.
471         > "font-collection#1" for the first font, "font-collection#2" for the second font).
472
473         Not only are TTC font collections supported, but WOFF2 font collections are also supported, which is
474         increasingly important web standard.
475
476         No new tests because I don't have a font collection file with the appropriate license for the
477         WebKit repository. I tested manually.
478
479         * css/CSSFontFaceSource.cpp:
480         (WebCore::CSSFontFaceSource::load):
481         * loader/cache/CachedFont.cpp:
482         (WebCore::CachedFont::calculateIndex const):
483         (WebCore::CachedFont::ensureCustomFontData):
484         (WebCore::CachedFont::createCustomFontData):
485         * loader/cache/CachedFont.h:
486         * platform/graphics/cairo/FontCustomPlatformData.h:
487         * platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp:
488         (WebCore::createFontCustomPlatformData):
489         * platform/graphics/mac/FontCustomPlatformData.cpp:
490         (WebCore::createFontCustomPlatformData):
491         * platform/graphics/mac/FontCustomPlatformData.h:
492         * platform/graphics/win/FontCustomPlatformData.cpp:
493         (WebCore::createFontCustomPlatformData):
494         * platform/graphics/win/FontCustomPlatformData.h:
495         * platform/graphics/win/FontCustomPlatformDataCairo.cpp:
496         (WebCore::createFontCustomPlatformData):
497
498 2018-01-22  Simon Fraser  <simon.fraser@apple.com>
499
500         REGRESSION (r227011): fast/frames/hidpi-position-iframe-on-device-pixel.html times out
501         https://bugs.webkit.org/show_bug.cgi?id=181959
502
503         Reviewed by Zalan Bujtas.
504
505         This test creates 300 iframes, which became slow after r227011 because they all became part
506         of the non-fast scrollable region, slowing down ScrollingCoordinator::absoluteEventTrackingRegionsForFrame().
507
508         Fix by not adding non-scrollable iframes, and making FrameView::isScrollable() more efficient for frames
509         that have not done layout yet.
510
511         * page/FrameView.cpp:
512         (WebCore::FrameView::isScrollable):
513         (WebCore::FrameView::addChild):
514
515 2018-01-22  Dan Bernstein  <mitz@apple.com>
516
517         Fixed building for macOS 10.12 with the macOS 10.13 SDK after r227156.
518
519         * Configurations/WebCore.xcconfig:
520
521 2018-01-22  Simon Fraser  <simon.fraser@apple.com>
522
523         REGRESSION (r226981): ASSERTION FAILED: startY >= 0 && endY <= height && startY < endY in WebCore::FEMorphology::platformApplyGeneric
524         https://bugs.webkit.org/show_bug.cgi?id=181836
525
526         Reviewed by Tim Horton.
527         
528         All the filters that use ParallelJobs<> has the same type of bug where very wide but not tall
529         filter regions could result in computing an optimalThreadNumber that was greater than the
530         number of rows to process, which resulted in jobs with zero rows to process.
531
532         Since we split the work by rows, cap the maximum number of threads to height/8 so that each job
533         has at least 8 rows of pixels to process. Add some assertions to detect jobs with zero rows.
534
535         FEMorphology was also using implicit float -> int conversion to detect integer overflow of radius,
536         so change that to use explicit clamping.
537         
538         Tests: svg/filters/feLighting-parallel-jobs.svg
539                svg/filters/feTurbulence-parallel-jobs-wide.svg
540
541         * platform/graphics/filters/FELighting.cpp:
542         (WebCore::FELighting::platformApplyGenericPaint):
543         (WebCore::FELighting::platformApplyGeneric):
544         * platform/graphics/filters/FEMorphology.cpp:
545         (WebCore::FEMorphology::platformApplyGeneric):
546         (WebCore::FEMorphology::platformApply):
547         (WebCore::FEMorphology::platformApplyDegenerate):
548         (WebCore::FEMorphology::platformApplySoftware):
549         * platform/graphics/filters/FETurbulence.cpp:
550         (WebCore::FETurbulence::fillRegion const):
551         (WebCore::FETurbulence::platformApplySoftware):
552
553 2018-01-22  Eric Carlson  <eric.carlson@apple.com>
554
555         Resign NowPlaying status when no media element is eligible
556         https://bugs.webkit.org/show_bug.cgi?id=181914
557         <rdar://problem/35294116>
558
559         Reviewed by Jer Noble.
560
561         No new tests, these changes prevent existing tests from crashing.
562
563         * html/HTMLMediaElement.h:
564         * html/MediaElementSession.cpp:
565         (WebCore::MediaElementSession::playbackPermitted const): Return early when the media 
566         element has been suspended.
567         (WebCore::MediaElementSession::canShowControlsManager const): Return false when the
568         media element has been suspended.
569         (WebCore::isMainContentForPurposesOfAutoplay): Return early if it isn't safe to update
570         style because HitTest can force a layout.
571         (WebCore::MediaElementSession::updateIsMainContent const): Ditto.
572
573 2018-01-22  Alex Christensen  <achristensen@webkit.org>
574
575         Begin removing QTKit code
576         https://bugs.webkit.org/show_bug.cgi?id=181951
577
578         Reviewed by Jer Noble.
579
580         QTKit was being used on El Capitan and before.
581
582         * Configurations/WebCore.xcconfig:
583         * SourcesMac.txt:
584         * WebCore.xcodeproj/project.pbxproj:
585         * platform/graphics/MediaPlayer.cpp:
586         (WebCore::buildMediaEnginesVector):
587         (WebCore::MediaPlayer::supportsType):
588         * platform/graphics/mac/MediaPlayerPrivateQTKit.h: Removed.
589         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm: Removed.
590         * platform/graphics/mac/MediaTimeQTKit.h: Removed.
591         * platform/graphics/mac/MediaTimeQTKit.mm: Removed.
592         * platform/mac/WebVideoFullscreenController.mm:
593         (-[WebVideoFullscreenController setVideoElement:]):
594         (-[WebVideoFullscreenController updatePowerAssertions]):
595
596 2018-01-22  Per Arne Vollan  <pvollan@apple.com>
597
598         [Win] Null pointer crash under WebCore::RenderStyle::colorIncludingFallback.
599         https://bugs.webkit.org/show_bug.cgi?id=181801
600         <rdar://problem/35614900>
601
602         Reviewed by Brent Fulgham.
603
604         Do not paint synchronously when popup items have been added or changed while the popup is visible.
605         If new popup items have been added after the popup was shown, a synchronous paint operation will
606         possibly access their style before it is ready, leading to a null pointer crash. The invalidated
607         area will be painted asynchronously.
608
609         No new tests. To reproduce this crash, it is necessary to open a popup with JavaScript, add new
610         popup items, and then end the test. Opening the popup can be done by sending a mousedown event
611         with the eventsender. However, on Windows the mousedown event is sent synchronously, and will
612         block as long as the popup is open and running the popup event loop. This means no JS can be
613         executed until the popup is closed, causing the test to always time out before new popup items
614         can be added. I have verified the fix with a manual test case.
615
616         * platform/win/PopupMenuWin.cpp:
617         (WebCore::PopupMenuWin::updateFromElement):
618
619 2018-01-22  Chris Dumez  <cdumez@apple.com>
620
621         RELEASE_ASSERT(registration) hit in SWServer::installContextData(const ServiceWorkerContextData&)
622         https://bugs.webkit.org/show_bug.cgi?id=181941
623         <rdar://problem/36744892>
624
625         Reviewed by Youenn Fablet.
626
627         Make sure we clear SWServer::m_pendingContextDatas & SWServer::m_pendingJobs as needed
628         when clearing Website data. Otherwise, we will hit assertion when those gets processed
629         after the connection to the SW process has been established (not to mentioned we failed
630         to clear some in-memory data even though the user asked us to).
631
632         * workers/service/server/SWServer.cpp:
633         (WebCore::SWServer::clearAll):
634         (WebCore::SWServer::clear):
635
636 2018-01-22  Ryosuke Niwa  <rniwa@webkit.org>
637
638         Blob conversion and sanitization doesn't work with Microsoft Word for Mac 2011
639         https://bugs.webkit.org/show_bug.cgi?id=181616
640         <rdar://problem/36484908>
641
642         Reviewed by Wenson Hsieh.
643
644         The bug was caused by WebContentReader::readHTML and WebContentMarkupReader::readHTML not sanitizing plain HTML string
645         as done for web archives even when custom pasteboard data is enabled. Fixed the bug by doing the sanitization.
646
647         Unfortunately, we can't make file URLs available in this case because WebContent process doesn't have sandbox extensions
648         to access local files referenced by the HTML source in the clipboard, and we can't make WebContent process request for
649         a sandbox extension¸on an arbitrary local file, as it would defeat the whole point of sandboxing.
650
651         Instead, we strip away all HTML attributes referencing a URL whose scheme is not HTTP, HTTPS, or data when sanitizing
652         text/html from the clipboard to avoid exposing local file paths, which can reveal privacy & security sensitive data
653         such as the user's full name, and the location of private containers of other applications in the system.
654
655         Tests: PasteHTML.DoesNotSanitizeHTMLWhenCustomPasteboardDataIsDisabled
656                PasteHTML.DoesNotStripFileURLsWhenCustomPasteboardDataIsDisabled
657                PasteHTML.ExposesHTMLTypeInDataTransfer
658                PasteHTML.KeepsHTTPURLs
659                PasteHTML.SanitizesHTML
660                PasteHTML.StripsFileURLs
661
662         * editing/cocoa/WebContentReaderCocoa.mm:
663         (WebCore::WebContentReader::readHTML): Fixed the bug by sanitizing the markup, and stripping away file URLs.
664         (WebCore::WebContentMarkupReader::readHTML): Ditto.
665         * editing/markup.cpp:
666         (WebCore::removeSubresourceURLAttributes): Added.
667         (WebCore::sanitizeMarkup): Added.
668         * editing/markup.h:
669
670 2018-01-22  Chris Dumez  <cdumez@apple.com>
671
672         Add release logging to help debug issues related to service workers
673         https://bugs.webkit.org/show_bug.cgi?id=181935
674         <rdar://problem/36735900>
675
676         Reviewed by Brady Eidson.
677
678         * workers/service/ServiceWorker.cpp:
679         (WebCore::ServiceWorker::ServiceWorker):
680         (WebCore::ServiceWorker::scheduleTaskToUpdateState):
681         (WebCore::ServiceWorker::postMessage):
682         (WebCore::ServiceWorker::isAlwaysOnLoggingAllowed const):
683         * workers/service/ServiceWorker.h:
684         * workers/service/ServiceWorkerContainer.cpp:
685         (WebCore::ServiceWorkerContainer::addRegistration):
686         (WebCore::ServiceWorkerContainer::removeRegistration):
687         (WebCore::ServiceWorkerContainer::updateRegistration):
688         (WebCore::ServiceWorkerContainer::jobFailedWithException):
689         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
690         (WebCore::ServiceWorkerContainer::jobResolvedWithUnregistrationResult):
691         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
692         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
693         (WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
694         (WebCore::ServiceWorkerContainer::isAlwaysOnLoggingAllowed const):
695         * workers/service/ServiceWorkerContainer.h:
696         * workers/service/ServiceWorkerRegistration.cpp:
697         (WebCore::ServiceWorkerRegistration::ServiceWorkerRegistration):
698         (WebCore::ServiceWorkerRegistration::updateStateFromServer):
699         (WebCore::ServiceWorkerRegistration::scheduleTaskToFireUpdateFoundEvent):
700         * workers/service/server/SWServer.cpp:
701         (WebCore::SWServer::scriptContextFailedToStart):
702         (WebCore::SWServer::didFinishInstall):
703         (WebCore::SWServer::didFinishActivation):
704         (WebCore::SWServer::terminateWorkerInternal):
705         * workers/service/server/SWServerJobQueue.cpp:
706         (WebCore::SWServerJobQueue::didResolveRegistrationPromise):
707         (WebCore::SWServerJobQueue::runRegisterJob):
708
709 2018-01-22  Youenn Fablet  <youenn@apple.com>
710
711         Safari Tech Preview can't use GitHub login at forums.swift.org
712         https://bugs.webkit.org/show_bug.cgi?id=181908
713         <rdar://problem/36715111>
714
715         Reviewed by Chris Dumez.
716
717         Test: http/wpt/service-workers/navigation-redirect.https.html
718
719         For subresource loads, redirections will not change who is in charge of continuing the load (service worker or network process).
720         For navigation loads, we need to match the registration for every redirection since this is using the Manual redirect mode.
721         This allows starting the load with a service worker and finishing the load with another service worker, which will become the controller.
722
723         Implement this by wrapping the registration matching of an URL within DocumentLoader::matchRegistration.
724         Use that method in DocumentLoader::redirectReceived.
725
726         * loader/DocumentLoader.cpp:
727         (WebCore::DocumentLoader::matchRegistration):
728         (WebCore::doRegistrationsMatch):
729         (WebCore::DocumentLoader::redirectReceived):
730         (WebCore::DocumentLoader::startLoadingMainResource):
731         * loader/DocumentLoader.h:
732
733 2018-01-22  Antti Koivisto  <antti@apple.com>
734
735         REGRESSION (Safari 11): Buttons inside a fieldset legend cannot be clicked on in Safari 11
736         https://bugs.webkit.org/show_bug.cgi?id=179666
737         <rdar://problem/35534292>
738
739         Reviewed by Zalan Bujtas.
740
741         The legend element of a fieldset is in the border area, outside the clip rect.
742         With overflow:hidden mouse events won't reach it.
743
744         Test case by Dhaya Benmessaoud.
745
746         Test: fast/forms/legend-overflow-hidden-hit-test.html
747
748         * rendering/RenderBlock.cpp:
749         (WebCore::RenderBlock::nodeAtPoint):
750         (WebCore::RenderBlock::hitTestExcludedChildrenInBorder):
751
752         Add a special case to hit testing to handle legend, similarly to what is done for painting.
753
754         * rendering/RenderBlock.h:
755
756 2018-01-22  Joanmarie Diggs  <jdiggs@igalia.com>
757
758         AX: Implement support for Graphics ARIA roles
759         https://bugs.webkit.org/show_bug.cgi?id=181796
760
761         Reviewed by Chris Fleizach.
762
763         Add mappings for the three new roles (graphics-document, graphics-object,
764         and graphics-symbol) as per the Graphics Accessibility API Mappings spec.
765
766         No new tests; instead, new test cases added to roles-computedRoleString.html
767         and roles-exposed.html.
768
769         * accessibility/AccessibilityObject.cpp:
770         (WebCore::initializeRoleMap):
771         (WebCore::AccessibilityObject::computedRoleString const):
772         * accessibility/AccessibilityObject.h:
773         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
774         (atkRole):
775         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
776         (-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):
777         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
778         (createAccessibilityRoleMap):
779         (-[WebAccessibilityObjectWrapper subrole]):
780         (-[WebAccessibilityObjectWrapper roleDescription]):
781
782 2018-01-22  Antti Koivisto  <antti@apple.com>
783
784         REGRESSION(r224535): Can't write reviews in the App Store
785         https://bugs.webkit.org/show_bug.cgi?id=181936
786         <rdar://problem/36670246>
787
788         Reviewed by Zalan Bujtas.
789
790         * page/LayoutContext.cpp:
791         (WebCore::LayoutContext::updateStyleForLayout):
792
793         r224535 was about media queries but it also removed a seemingly spurious call to SyleScope::didChangeStyleSheetEnvironment
794         from the path that does not involve media queries.
795         Turns out UITextContentView somehow depended on it, so revert this specific change.
796
797 2018-01-22  Brady Eidson  <beidson@apple.com>
798
799         In WebKit2, make the MessagePortChannelRegistry live in the UI process.
800         https://bugs.webkit.org/show_bug.cgi?id=181922
801
802         Reviewed by Andy Estes.
803
804         No new tests (Refactor, no behavior change)
805
806         Add encoder/decoders and EXPORT a whole bunch of stuff.
807         
808         * WebCore.xcodeproj/project.pbxproj:
809
810         * dom/MessagePort.h:
811
812         * dom/messageports/MessagePortChannel.cpp:
813         (WebCore::MessagePortChannel::processForPort):
814         * dom/messageports/MessagePortChannel.h:
815
816         * dom/messageports/MessagePortChannelProvider.h:
817         * dom/messageports/MessagePortChannelRegistry.h:
818
819         * dom/messageports/MessageWithMessagePorts.h:
820         (WebCore::MessageWithMessagePorts::encode const):
821         (WebCore::MessageWithMessagePorts::decode):
822
823 2018-01-22  Youenn Fablet  <youenn@apple.com>
824
825         Fetch Headers from an Opaque response should be filtered out
826         https://bugs.webkit.org/show_bug.cgi?id=181926
827
828         Reviewed by Chris Dumez.
829
830         Covered by updated test.
831
832         Refactor to use the same FetchResponse::create for Cache API and cloning.
833         In this method, ensure that response and headers are filtered correctly according response tainting.
834         Make also sure that synthetic responses do not get filtered (not needed since created by JavaScript).
835
836         Introduce helper routine to set the header map of a resource response.
837         Use this routine when cloning a synthetic response as in that case, m_internalResponse has no header at all.
838
839         * Modules/cache/DOMCache.cpp:
840         (WebCore::DOMCache::updateRecords):
841         * Modules/fetch/FetchResponse.cpp:
842         (WebCore::FetchResponse::create):
843         (WebCore::FetchResponse::clone):
844         * Modules/fetch/FetchResponse.h:
845         * platform/network/ResourceResponseBase.cpp:
846         (WebCore::ResourceResponseBase::setHTTPHeaderFields):
847         * platform/network/ResourceResponseBase.h:
848         * testing/ServiceWorkerInternals.cpp:
849         (WebCore::ServiceWorkerInternals::createOpaqueWithBlobBodyResponse):
850
851 2018-01-22  Javier Fernandez  <jfernandez@igalia.com>
852
853         [css-align] 'overflow' keyword must precede the self-position and content-position value
854         https://bugs.webkit.org/show_bug.cgi?id=181793
855
856         Reviewed by Antti Koivisto.
857
858         There were several discussions to avoid ambiguities with the complex
859         values, specially when it comes to define the place-xxx shorthands.
860
861         One of the sources of problems is the 'overflow-position' keyword. The
862         CSS WG has decided to change the syntax of all the CSS Box Alignment
863         properties so that the 'overflow-position' keyword always precede the
864         'self-position' or the 'content-position' keywords.
865
866         https://github.com/w3c/csswg-drafts/issues/1446#event-1125715434
867
868         In order to apply this change to the Content Distribution properties'
869         (align-content and justify-content) syntax I had to completely
870         re-implement their parsing function. Thanks to this I addressed also
871         the issue with the content-distribution fallback, which cannot be
872         specified explicitly now.
873
874         https://github.com/w3c/csswg-drafts/issues/1002#ref-commit-c38cac4
875
876         No new tests, just rebaselined the expected results of the test cases affected.
877
878         Despite the so many layout tests affected by this change, it's
879         unlikely that it might break any content in current web
880         sites. This patch changes the new CSS syntax, obviously backward
881         compatible, defined by the new CSS Box Alignment. The
882         'overflow-position' keyword is only used by the layout models
883         implementing the new spec, so far only CSS Grid Layout.
884         Considering that CSS Grid has been shipped last year, it's unlikely
885         that many sites are using the new CSS values.
886
887         * css/CSSComputedStyleDeclaration.cpp:
888         (WebCore::valueForItemPositionWithOverflowAlignment):
889         (WebCore::valueForContentPositionAndDistributionWithOverflowAlignment):
890         * css/CSSContentDistributionValue.cpp:
891         (WebCore::CSSContentDistributionValue::customCSSText const):
892         * css/StyleBuilderConverter.h:
893         (WebCore::StyleBuilderConverter::convertSelfOrDefaultAlignmentData):
894         * css/parser/CSSPropertyParser.cpp:
895         (WebCore::consumeOverflowPositionKeyword):
896         (WebCore::consumeContentPositionKeyword):
897         (WebCore::consumeContentDistributionOverflowPosition):
898         (WebCore::consumeSelfPositionOverflowPosition):
899
900 2018-01-22  Chris Nardi  <csnardi1@gmail.com>
901
902         Parse calc() in CSS media queries
903         https://bugs.webkit.org/show_bug.cgi?id=181716
904
905         calc() was previously unsupported inside of media queries. This change
906         adds in support for parsing calc inside of media queries.
907
908         Reviewed by Antti Koivisto.
909
910         Tests: Imported web-platform-tests/css/mediaqueries
911
912         * css/MediaQueryExpression.cpp:
913         (WebCore::featureWithValidIdent): Updated function to take a CSSPrimitiveValue.
914         (WebCore::featureWithValidDensity): Updated function to take a CSSPrimitiveValue instead of a CSSParserToken.
915         (WebCore::featureWithValidPositiveLength): Ditto.
916         (WebCore::featureExpectingPositiveInteger): Ditto.
917         (WebCore::featureWithPositiveInteger): Ditto.
918         (WebCore::featureWithPositiveNumber): Ditto.
919         (WebCore::featureWithZeroOrOne): Ditto.
920         (WebCore::MediaQueryExpression::MediaQueryExpression): Use CSSPropertyParserHelpers for consuming.
921         * css/MediaQueryExpression.h:
922         * css/parser/CSSPropertyParserHelpers.cpp:
923         (WebCore::CSSPropertyParserHelpers::consumeResolution): Added function for use in media query expression parsing.
924         * css/parser/CSSPropertyParserHelpers.h:
925         * css/parser/MediaQueryParser.cpp:
926         (WebCore::MediaQueryParser::readRestrictor): Updated functions to take a CSSParserTokenRange in order to use CSSPropertyParserHelpers.
927         (WebCore::MediaQueryParser::readMediaNot): Ditto.
928         (WebCore::MediaQueryParser::readMediaType): Ditto.
929         (WebCore::MediaQueryParser::readAnd): Ditto.
930         (WebCore::MediaQueryParser::readFeatureStart): Ditto.
931         (WebCore::MediaQueryParser::readFeature): Ditto.
932         (WebCore::MediaQueryParser::readFeatureColon): Ditto.
933         (WebCore::MediaQueryParser::readFeatureValue): Ditto.
934         (WebCore::MediaQueryParser::readFeatureEnd): Ditto.
935         (WebCore::MediaQueryParser::skipUntilComma): Ditto.
936         (WebCore::MediaQueryParser::skipUntilBlockEnd): Ditto.
937         (WebCore::MediaQueryParser::processToken): Ditto.
938         (WebCore::MediaQueryParser::parseInternal): Ditto.
939         (WebCore::MediaQueryData::clear): Removed reference to m_valueList
940         (WebCore::MediaQueryData::addExpression): Use CSSParserTokenRange.
941         (WebCore::MediaQueryData::lastExpressionValid): New helper function.
942         (WebCore::MediaQueryData::removeLastExpression): New helper function.
943         * css/parser/MediaQueryParser.h:
944
945 2018-01-22  Zan Dobersek  <zdobersek@igalia.com>
946
947         [Cairo] Refactor PlatformContextCairo::drawSurfaceToContext() into a Cairo operation
948         https://bugs.webkit.org/show_bug.cgi?id=181930
949
950         Reviewed by Carlos Garcia Campos.
951
952         Move the PlatformContextCairo::drawSurfaceToContext() code into the
953         Cairo namespace as an operation, renaming it to drawSurface(). Mirroring
954         other operations, the PlatformContextCairo object is now passed through
955         a reference as the first argument to the function, and cairo_t context
956         object is retrieved from that.
957
958         Call sites of the PlatformContextCairo::drawSurfaceToContext() method
959         are adjusted to now call Cairo::drawSurface() and properly pass the
960         PlatformContextCairo object to the function.
961
962         No new tests -- no change in functionality.
963
964         * platform/graphics/cairo/CairoOperations.cpp:
965         (WebCore::Cairo::prepareForStroking): Make this static.
966         (WebCore::Cairo::drawPatternToCairoContext):
967         (WebCore::Cairo::drawNativeImage):
968         (WebCore::Cairo::drawSurface):
969         * platform/graphics/cairo/CairoOperations.h:
970         * platform/graphics/cairo/PlatformContextCairo.cpp:
971         (WebCore::drawPatternToCairoContext): Deleted.
972         (WebCore::PlatformContextCairo::drawSurfaceToContext): Deleted.
973         * platform/graphics/cairo/PlatformContextCairo.h:
974         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
975         (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::paintCurrentFrame):
976
977 2018-01-22  Manuel Rego Casasnovas  <rego@igalia.com>
978
979         [css-grid] Spanning Grid item has too much space at the bottom / is too high
980         https://bugs.webkit.org/show_bug.cgi?id=181677
981
982         Reviewed by Javier Fernandez.
983
984         In IndefiniteSizeStrategy::findUsedFlexFraction() we were not
985         subtracting the size of the gutters when we call findFrUnitSize().
986         If an item spans several tracks, we cannot pass the maxContentForChild()
987         directly, we need to subtract the gutters as they are treated
988         as fixed size tracks in the algorithm.
989
990         The spec text is pretty clear regarding this
991         (https://drafts.csswg.org/css-grid/#algo-find-fr-size):
992         "Let leftover space be the space to fill minus the base sizes
993          of the non-flexible grid tracks."
994
995         Gutters are treated as fixed-size tracks for the purpose
996         of the track sizing algorithm, so we need to subtract them from the
997         leftover space while finding the size of an "fr".
998
999         Tests: imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-find-fr-size-gutters-001.html
1000                imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-find-fr-size-gutters-002.html
1001
1002         * rendering/GridTrackSizingAlgorithm.cpp:
1003         (WebCore::GridTrackSizingAlgorithm::findFrUnitSize const):
1004         (WebCore::IndefiniteSizeStrategy::findUsedFlexFraction const):
1005
1006 2018-01-21  Ryosuke Niwa  <rniwa@webkit.org>
1007
1008         Turning off custom pasteboard data doesn't actually turn it off in WK2
1009         https://bugs.webkit.org/show_bug.cgi?id=181920
1010         <rdar://problem/36686429>
1011
1012         Reviewed by Wenson Hsieh.
1013
1014         Replaced the global settings for custom pasteboard data by regular runtime enabled flags.
1015
1016         * dom/DataTransfer.cpp:
1017         (WebCore::DataTransfer::getDataForItem const):
1018         (WebCore::DataTransfer::shouldSuppressGetAndSetDataToAvoidExposingFilePaths const):
1019         (WebCore::DataTransfer::setDataFromItemList):
1020         (WebCore::DataTransfer::types const):
1021         (WebCore::DataTransfer::commitToPasteboard):
1022         * dom/DataTransferItemList.cpp:
1023         (WebCore::shouldExposeTypeInItemList):
1024         * editing/Editor.cpp:
1025         (WebCore::createDataTransferForClipboardEvent):
1026         * editing/cocoa/WebContentReaderCocoa.mm:
1027         (WebCore::createFragmentAndAddResources):
1028         (WebCore::WebContentReader::readWebArchive):
1029         * page/DeprecatedGlobalSettings.cpp:
1030         (WebCore::DeprecatedGlobalSettings::defaultCustomPasteboardDataEnabled): Deleted.
1031         * page/DeprecatedGlobalSettings.h:
1032         (WebCore::DeprecatedGlobalSettings::setCustomPasteboardDataEnabled): Deleted.
1033         (WebCore::DeprecatedGlobalSettings::customPasteboardDataEnabled): Deleted.
1034         * page/RuntimeEnabledFeatures.h:
1035         (WebCore::RuntimeEnabledFeatures::setCustomPasteboardDataEnabled):
1036         (WebCore::RuntimeEnabledFeatures::customPasteboardDataEnabled const):
1037         * testing/InternalSettings.cpp:
1038         (WebCore::InternalSettings::Backup::Backup):
1039         (WebCore::InternalSettings::Backup::restoreTo):
1040         (WebCore::InternalSettings::setCustomPasteboardDataEnabled):
1041
1042 2018-01-21  Wenson Hsieh  <wenson_hsieh@apple.com>
1043
1044         Add a new feature flag for EXTRA_ZOOM_MODE and reintroduce AdditionalFeatureDefines.h
1045         https://bugs.webkit.org/show_bug.cgi?id=181918
1046
1047         Reviewed by Tim Horton.
1048
1049         Add EXTRA_ZOOM_MODE to FeatureDefines.xconfig (off by default). No change in behavior.
1050
1051         * Configurations/FeatureDefines.xcconfig:
1052
1053 2018-01-19  Ryosuke Niwa  <rniwa@webkit.org>
1054
1055         Release assertion in canExecuteScript when executing scripts during page cache restore
1056         https://bugs.webkit.org/show_bug.cgi?id=181902
1057
1058         Reviewed by Antti Koivisto.
1059
1060         The crash was caused by an erroneous instantiation of ScriptDisallowedScope::InMainThread in CachedPage::restore.
1061         It can execute arbitrary scripts since CachedFrame::open can update style, layout, and evaluate media queries.
1062
1063         This is fine because there is no way to put this page back into a page cache until the load is commited via
1064         FrameLoader::commitProvisionalLoad is invoked later which only happens after CachedPage::restore had exited.
1065
1066         Also added a release assert to make sure this condition holds.
1067
1068         Tests: fast/history/page-cache-execute-script-during-restore.html
1069                fast/history/page-cache-navigate-during-restore.html
1070
1071         * history/CachedPage.cpp:
1072         (WebCore::CachedPageRestorationScope::CachedPageRestorationScope): Added.
1073         (WebCore::CachedPageRestorationScope::~CachedPageRestorationScope): Added.
1074         (WebCore::CachedPage::restore): Don't instantiate ScriptDisallowedScope::InMainThread. Set isRestoringCachedPage
1075         on the cached pate to release-assert that there won't be any attempt to put this very page back into the cache.
1076         * history/PageCache.cpp:
1077         (WebCore::canCachePage): Added a release assert to make sure the page which is in the process of being restored
1078         from the page cache is not put into the page cache.
1079         * page/Page.h:
1080         (WebCore::Page::setIsRestoringCachedPage): Added.
1081         (WebCore::Page::isRestoringCachedPage const): Added.
1082
1083 2018-01-21  Eric Carlson  <eric.carlson@apple.com>
1084
1085         Resign NowPlaying status when no media element is eligible
1086         https://bugs.webkit.org/show_bug.cgi?id=181914
1087         <rdar://problem/35294116>
1088
1089         Reviewed by Jer Noble.
1090
1091         Updated API test.
1092
1093         * html/HTMLMediaElement.cpp:
1094         (WebCore::HTMLMediaElement::removedFromAncestor): Call mediaSession->clientCharacteristicsChanged
1095         so NowPlaying status will be updated.
1096
1097         * html/MediaElementSession.cpp:
1098         (WebCore::MediaElementSession::canShowControlsManager const): Return false when being queried
1099         for NowPlaying status in an inactive document.
1100
1101         * platform/audio/PlatformMediaSessionManager.cpp:
1102         (WebCore::PlatformMediaSessionManager::updateNowPlayingInfoIfNecessary): Implement in for all
1103         ports.
1104         * platform/audio/PlatformMediaSessionManager.h:
1105         (WebCore::PlatformMediaSessionManager::registeredAsNowPlayingApplication const):
1106         * platform/audio/ios/MediaSessionManagerIOS.h:
1107         * platform/audio/mac/MediaSessionManagerMac.h:
1108         * platform/audio/mac/MediaSessionManagerMac.mm:
1109         (WebCore::MediaSessionManagerMac::updateNowPlayingInfo): Call MRMediaRemoteSetCanBeNowPlayingApplication
1110         whenever status changes.
1111         (WebCore::PlatformMediaSessionManager::updateNowPlayingInfoIfNecessary): Deleted, implemented
1112         in the base class.
1113
1114 2018-01-21  Jer Noble  <jer.noble@apple.com>
1115
1116         REGRESSION (macOS 10.13.2): imported/w3c/web-platform-tests/media-source/mediasource-* LayoutTests failing
1117         https://bugs.webkit.org/show_bug.cgi?id=181891
1118
1119         Reviewed by Eric Carlson.
1120
1121         In macOS 10.13.2, CoreMedia changed the definition of CMSampleBufferGetDuration() to return
1122         the presentation duration rather than the decode duration. For media streams where those two
1123         durations are identical (or at least, closely similar), this isn't a problem. But the media
1124         file used in the WPT tests have an unusual frame cadence: decode durations go {3000, 1, 5999,
1125         1, 5999,...} and presentation durations go {3000, 2999, 3000, 2999}. This caused one check in
1126         the "Coded Frame Processing" algorithm to begin failing, where it checks that the delta
1127         between the last sample's decode time and the new decode time is no more than 2x as far as
1128         the last sample's duration. That's not a problem as long as the "duration" is the "decode
1129         duration" and the samples are all adjacent. Once the "duration" is "presentation duration",
1130         all the assumptions in the algorithm are invalidated. In the WPT test case, the delta between
1131         decode times is 5999, and 2 * the presentation duration is 5998, causing all samples up to
1132         the next sync sample to be dropped.
1133
1134         To work around this change in behavior, we'll adopt the same technique used by Mozilla's MSE
1135         implementation, which was done for similar reasons. Rather than track the "last frame duration",
1136         we'll record the "greatest frame duration", and use actual decode timestamps to derive this
1137         duration. The "greatest frame duration" field will be reset at the same times as "last frame
1138         duration", and will be used only in the part of the algorithm that checks for large decode
1139         timestamp gaps.
1140
1141         * Modules/mediasource/SourceBuffer.cpp:
1142         (WebCore::SourceBuffer::TrackBuffer::TrackBuffer):
1143         (WebCore::SourceBuffer::resetParserState):
1144         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
1145
1146 2018-01-21  Andy Estes  <aestes@apple.com>
1147
1148         [ios] LayoutTest imported/w3c/web-platform-tests/payment-request/rejects_if_not_active.https.html is crashing in JSC::JSONParse
1149         https://bugs.webkit.org/show_bug.cgi?id=177832
1150         <rdar://problem/34805315>
1151
1152         Reviewed by Tim Horton.
1153
1154         Test: http/tests/paymentrequest/rejects_if_not_active.https.html
1155
1156         * Modules/paymentrequest/PaymentRequest.cpp:
1157         (WebCore::PaymentRequest::show): Rejected promise if the document is not active.
1158
1159 2018-01-20  Brady Eidson  <beidson@apple.com>
1160
1161         Make garbage collection of MessagePort objects be asynchronous.
1162         https://bugs.webkit.org/show_bug.cgi?id=181910
1163
1164         Reviewed by Andy Estes.
1165
1166         No new tests (Covered by existing tests, including GC-specific ones).
1167
1168         The basic premise here is as follows:
1169         - You can *always* GC a MessagePort that is closed
1170         - You can *always* GC a MessagePort that has no onmessage handler, as incoming messages cannot 
1171           possibly revive it.
1172         - You can GC a MessagePort, even if it has a message handler, as long as there are no messages 
1173           in flight between it and the remote port, and as long as the remote port is "maybe eligible for GC."
1174           
1175         A MessagePort is considered "maybe eligible for GC" once hasPendingActivity is asked once.
1176         
1177         A MessagePort loses "maybe eligible for GC" status once it is used for sending or receiving a message.
1178         
1179         The changes to MessagePort.cpp implement the above with a tiny little bool-driven state machine.
1180         * dom/MessagePort.cpp:
1181         (WebCore::MessagePort::postMessage):
1182         (WebCore::MessagePort::disentangle):
1183         (WebCore::MessagePort::registerLocalActivity):
1184         (WebCore::MessagePort::start):
1185         (WebCore::MessagePort::close):
1186         (WebCore::MessagePort::contextDestroyed):
1187         (WebCore::MessagePort::dispatchMessages):
1188         (WebCore::MessagePort::hasPendingActivity const):
1189         (WebCore::MessagePort::isLocallyReachable const):
1190         (WebCore::MessagePort::addEventListener):
1191         (WebCore::MessagePort::removeEventListener):
1192         * dom/MessagePort.h:
1193
1194         - Remove the lock and any background-thread code paths
1195         - Add ASSERT(isMainThread())s throughout
1196         * dom/messageports/MessagePortChannel.cpp:
1197         (WebCore::MessagePortChannel::MessagePortChannel):
1198         (WebCore::MessagePortChannel::includesPort):
1199         (WebCore::MessagePortChannel::entanglePortWithProcess):
1200         (WebCore::MessagePortChannel::disentanglePort):
1201         (WebCore::MessagePortChannel::closePort):
1202         (WebCore::MessagePortChannel::postMessageToRemote):
1203         (WebCore::MessagePortChannel::takeAllMessagesForPort):
1204         (WebCore::MessagePortChannel::checkRemotePortForActivity):
1205         (WebCore::MessagePortChannel::hasAnyMessagesPendingOrInFlight const):
1206         * dom/messageports/MessagePortChannel.h:
1207         
1208         Add a callback for a MessagePortChannel to go ask the remote MessagePort object about local activity:
1209         * dom/messageports/MessagePortChannelProvider.h:
1210         * dom/messageports/MessagePortChannelProviderImpl.cpp:
1211         (WebCore::MessagePortChannelProviderImpl::checkRemotePortForActivity):
1212         (WebCore::MessagePortChannelProviderImpl::checkProcessLocalPortForActivity):
1213         (WebCore::MessagePortChannelProviderImpl::hasMessagesForPorts_temporarySync): Deleted.
1214         * dom/messageports/MessagePortChannelProviderImpl.h:
1215         
1216         - Remove the lock and any background-thread code paths
1217         - Add ASSERT(isMainThread())s throughout
1218         * dom/messageports/MessagePortChannelRegistry.cpp:
1219         (WebCore::MessagePortChannelRegistry::messagePortChannelCreated):
1220         (WebCore::MessagePortChannelRegistry::messagePortChannelDestroyed):
1221         (WebCore::MessagePortChannelRegistry::didEntangleLocalToRemote):
1222         (WebCore::MessagePortChannelRegistry::didDisentangleMessagePort):
1223         (WebCore::MessagePortChannelRegistry::didCloseMessagePort):
1224         (WebCore::MessagePortChannelRegistry::didPostMessageToRemote):
1225         (WebCore::MessagePortChannelRegistry::takeAllMessagesForPort):
1226         (WebCore::MessagePortChannelRegistry::checkRemotePortForActivity):
1227         (WebCore::MessagePortChannelRegistry::existingChannelContainingPort):
1228         (WebCore::MessagePortChannelRegistry::hasMessagesForPorts_temporarySync): Deleted.
1229         * dom/messageports/MessagePortChannelRegistry.h:
1230
1231 2018-01-20  Andy Estes  <aestes@apple.com>
1232
1233         [Apple Pay] Stop eagerly loading PassKit.framework
1234         https://bugs.webkit.org/show_bug.cgi?id=181911
1235         <rdar://problem/36555369>
1236
1237         Reviewed by Tim Horton.
1238
1239         r226458 and r226123 added code that caused PassKit.framework to be eagerly loaded when
1240         initializing a WKWebView. This is costly and should only be done when Apple Pay is first used.
1241
1242         To avoid eagerly loading PassKit, this patch does two things:
1243
1244         1. Instead of sending the available payment networks as part of WebPageCreationParameters,
1245         PaymentCoordinator asks for them using a syncrhonous message the first time they are needed.
1246         2. Instead of setting the Apple Pay preference to false when PassKit can't be loaded,
1247         the following API entry points check for a missing PassKit and return false, or throw
1248         exceptions, or reject promises:
1249             - ApplePaySession.canMakePayments()
1250             - ApplePaySession.canMakePaymentsWithActiveCard()
1251             - ApplePaySession.openPaymentSetup()
1252             - ApplePaySession.begin()
1253
1254         No new tests for (1), which causes no change in behavior. (2) was manually verified by
1255         locally moving aside PassKit.framework, but that's not possible to do in an automated test.
1256
1257         * Modules/applepay/PaymentCoordinator.cpp:
1258         (WebCore::PaymentCoordinator::PaymentCoordinator):
1259         (WebCore::PaymentCoordinator::validatedPaymentNetwork const):
1260         (WebCore::toHashSet): Deleted.
1261         * Modules/applepay/PaymentCoordinator.h:
1262         * Modules/applepay/PaymentCoordinatorClient.h:
1263         * loader/EmptyClients.cpp:
1264         * page/MainFrame.cpp:
1265         (WebCore::MainFrame::MainFrame):
1266
1267         Removed PaymentCoordinator::m_availablePaymentNetworks and made
1268         PaymentCoordinator::validatedPaymentNetwork() call
1269         PaymentCoordinatorClient::validatedPaymentNetwork() instead.
1270
1271         * page/PageConfiguration.h:
1272
1273         Removed availablePaymentNetworks from PageConfiguration.
1274
1275         * testing/Internals.cpp:
1276         (WebCore::Internals::Internals):
1277         * testing/MockPaymentCoordinator.cpp:
1278         (WebCore::MockPaymentCoordinator::validatedPaymentNetwork):
1279         * testing/MockPaymentCoordinator.h:
1280
1281         Implemented PaymentCoordinatorClient::validatedPaymentNetwork().
1282
1283 2018-01-20  Jer Noble  <jer.noble@apple.com>
1284
1285         Release ASSERT when reloading Vimeo page @ WebCore: WebCore::Document::updateLayout
1286         https://bugs.webkit.org/show_bug.cgi?id=181840
1287         <rdar://problem/36186214>
1288
1289         Reviewed by Simon Fraser.
1290
1291         Test: media/video-fullscreen-reload-crash.html
1292
1293         Short circuit play() or pause() operations if the document is suspended or stopped.
1294
1295         * html/HTMLMediaElement.cpp:
1296         (WebCore::HTMLMediaElement::playInternal):
1297         (WebCore::HTMLMediaElement::pauseInternal):
1298
1299 2018-01-20  Youenn Fablet  <youenn@apple.com>
1300
1301         fetch redirect is incompatible with "no-cors" mode
1302         https://bugs.webkit.org/show_bug.cgi?id=181866
1303         <rdar://problem/35827140>
1304
1305         Reviewed by Chris Dumez.
1306
1307         Covered by updated tests.
1308
1309         Return a network error when no-cors mode and redirect mode is manual or error.
1310         Update preflight implementation to no longer use manual redirect mode to simulate https://fetch.spec.whatwg.org/#http-network-or-cache-fetch.
1311         Instead implement redirectReceived callback to treat any redirect response as the preflight response.
1312
1313         * loader/cache/CachedResourceLoader.cpp:
1314         (WebCore::CachedResourceLoader::canRequest):
1315         * loader/CrossOriginPreflightChecker.cpp:
1316         (WebCore::CrossOriginPreflightChecker::redirectReceived):
1317         (WebCore::CrossOriginPreflightChecker::startPreflight):
1318         * loader/CrossOriginPreflightChecker.h:
1319
1320 2018-01-19  Wenson Hsieh  <wenson_hsieh@apple.com>
1321
1322         [macOS] [WK2] Drag location is computed incorrectly when dragging content from subframes
1323         https://bugs.webkit.org/show_bug.cgi?id=181896
1324         <rdar://problem/35479043>
1325
1326         Reviewed by Tim Horton.
1327
1328         In r218837, I packaged most of the information needed to start a drag into DragItem, which is propagated to the client layer
1329         via the startDrag codepath. However, this introduced a bug in computing the event position and drag location in window
1330         coordinates. Consider the case where we're determining the drag image offset for a dragged element in a subframe:
1331
1332         Before the patch, the drag location (which starts out in the subframe's content coordinates) would be converted to root view
1333         coordinates, which would then be converted to mainframe content coordinates, which would then be converted to window coordinates
1334         using the mainframe's view. After the patch, we carry out the same math until the last step, where we erroneously use the
1335         _subframe's_ view to convert to window coordinates from content coordinates. This results in the position of the iframe relative
1336         to the mainframe being accounted for twice.
1337
1338         To fix this, we simply use the main frame's view to convert from mainframe content coordinates to window coordinates while
1339         computing the drag location. As for the event position in window coordinates, this is currently unused by any codepath in WebKit,
1340         so we can just remove it altogether.
1341
1342         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
1343         <https://bugs.webkit.org/show_bug.cgi?id=181898> to track adding test support for drag and drop on macOS WebKit2. Manually tested
1344         dragging in both WebKit1 and WebKit2 on macOS. dragLocationInWindowCoordinates isn't used at all for iOS drag and drop.
1345
1346         * page/DragController.cpp:
1347         (WebCore::DragController::doSystemDrag):
1348         * platform/DragItem.h:
1349         (WebCore::DragItem::encode const):
1350         (WebCore::DragItem::decode):
1351
1352 2018-01-19  Ryan Haddad  <ryanhaddad@apple.com>
1353
1354         Unreviewed, rolling out r227235.
1355
1356         The test for this change consistently times out on High
1357         Sierra.
1358
1359         Reverted changeset:
1360
1361         "Support for preconnect Link headers"
1362         https://bugs.webkit.org/show_bug.cgi?id=181657
1363         https://trac.webkit.org/changeset/227235
1364
1365 2018-01-19  Youenn Fablet  <youenn@apple.com>
1366
1367         Cache storage errors like Quota should trigger console messages
1368         https://bugs.webkit.org/show_bug.cgi?id=181879
1369         <rdar://problem/36669048>
1370
1371         Reviewed by Chris Dumez.
1372
1373         Covered by rebased test.
1374
1375         * Modules/cache/DOMCache.cpp:
1376         (WebCore::DOMCache::retrieveRecords):
1377         (WebCore::DOMCache::batchDeleteOperation):
1378         (WebCore::DOMCache::batchPutOperation):
1379         * Modules/cache/DOMCacheEngine.cpp:
1380         (WebCore::DOMCacheEngine::errorToException):
1381         (WebCore::DOMCacheEngine::logErrorAndConvertToException):
1382         * Modules/cache/DOMCacheEngine.h:
1383         * Modules/cache/DOMCacheStorage.cpp:
1384         (WebCore::DOMCacheStorage::retrieveCaches):
1385         (WebCore::DOMCacheStorage::doOpen):
1386         (WebCore::DOMCacheStorage::doRemove):
1387
1388 2018-01-19  Youenn Fablet  <youenn@apple.com>
1389
1390         Do not go to the storage process when registering a service worker client if there is no service worker registered
1391         https://bugs.webkit.org/show_bug.cgi?id=181740
1392         <rdar://problem/36650400>
1393
1394         Reviewed by Chris Dumez.
1395
1396         Register a document as service worker client only if there is an existing service worker connection.
1397         This allows not creating any connection if no service worker is registered.
1398
1399         Add internals API to test whether a service worker connection was created or not.
1400         This is used by API tests that cover the changes.
1401
1402         * dom/Document.cpp:
1403         (WebCore::Document::privateBrowsingStateDidChange): No need to create a service worker connection if client is not registered yet.
1404         (WebCore::Document::setServiceWorkerConnection): No need to unregister/register if service worker connection is the same.
1405         Similarly, if Document is to be destroyed or suspended, we should not register it.
1406         * loader/DocumentLoader.cpp:
1407         (WebCore::DocumentLoader::commitData):
1408         * testing/Internals.cpp:
1409         (WebCore::Internals::hasServiceWorkerConnection):
1410         * testing/Internals.h:
1411         * testing/Internals.idl:
1412         * workers/service/ServiceWorkerProvider.cpp:
1413         (WebCore::ServiceWorkerProvider::registerServiceWorkerClients):
1414         * workers/service/ServiceWorkerProvider.h:
1415
1416 2018-01-19  Dean Jackson  <dino@apple.com>
1417
1418         REGRESSION (r221092): Swipe actions are hard to perform in FastMail app
1419         https://bugs.webkit.org/show_bug.cgi?id=181817
1420         <rdar://problem/35274055>
1421
1422         Add a setting for controlling whether touch listeners are passive
1423         by default on document/window/body.
1424
1425         Updated existing test.
1426
1427         * dom/EventTarget.cpp:
1428         (WebCore::EventTarget::addEventListener):
1429         * page/Settings.yaml:
1430
1431 2018-01-19  Daniel Bates  <dabates@apple.com>
1432
1433         Update frame-ancestor directive to match Content Security Policy Level 3
1434         https://bugs.webkit.org/show_bug.cgi?id=178891
1435         <rdar://problem/35209458>
1436
1437         Reviewed by Alex Christensen.
1438
1439         Derived from Blink e667cc2e501fabab3605b838e4ee0d642a9c4a59:
1440         <https://chromium.googlesource.com/chromium/src.git/+/e667cc2e501fabab3605b838e4ee0d642a9c4a59>
1441
1442         Update frame-ancestor directive to match against the origin of the ancestor document per the
1443         Content Security Policy Level 3 spec.: <https://w3c.github.io/webappsec-csp/> (15 January 2018).
1444         Specifically this change in behavior was made to CSP 3 in <https://github.com/w3c/webappsec/issues/311>.
1445         In earlier versions of the spec, the frame-ancestor directive matched against the URL of the
1446         ancestor document.
1447
1448         Disregarding allow-same-origin sandboxed iframes, a document with policy "frame-ancestor 'self'"
1449         will be blocked from loading in a sandboxed iframe as a result of this change.
1450
1451         Tests: http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-cross-in-allow-same-origin-sandboxed-cross-url-allow.html
1452                http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-cross-in-sandboxed-cross-url-block.html
1453
1454         * page/csp/ContentSecurityPolicyDirectiveList.cpp:
1455         (WebCore::checkFrameAncestors):
1456
1457 2018-01-19  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1458
1459         [Curl] Add timeout support to XMLHttpRequest
1460         https://bugs.webkit.org/show_bug.cgi?id=181876
1461
1462         Reviewed by Alex Christensen 
1463
1464         * platform/network/ResourceRequestBase.cpp:
1465         * platform/network/curl/CurlContext.cpp:
1466         (WebCore::CurlHandle::setTimeout):
1467         * platform/network/curl/CurlContext.h:
1468         * platform/network/curl/CurlRequest.cpp:
1469         (WebCore::CurlRequest::setupTransfer):
1470         (WebCore::CurlRequest::didCompleteTransfer):
1471         * platform/network/curl/ResourceError.h:
1472         * platform/network/curl/ResourceErrorCurl.cpp:
1473         (WebCore::ResourceError::httpError):
1474
1475 2018-01-19  Yoav Weiss  <yoav@yoav.ws>
1476
1477         Support for preconnect Link headers
1478         https://bugs.webkit.org/show_bug.cgi?id=181657
1479
1480         Reviewed by Darin Adler.
1481
1482         Move the preconnect functionality into its own function, and
1483         also call this function when Link headers are processed.
1484
1485         Test: http/tests/preconnect/link-header-rel-preconnect-http.php
1486
1487         * loader/LinkLoader.cpp:
1488         (WebCore::LinkLoader::loadLinksFromHeader): Call preconnectIfNeeded.
1489         (WebCore::LinkLoader::preconnectIfNeeded): Preconnect to a host functionality moved here.
1490         (WebCore::LinkLoader::loadLink): Call preconnectIfNeeded.
1491         * loader/LinkLoader.h:
1492
1493 2018-01-19  Joseph Pecoraro  <pecoraro@apple.com>
1494
1495         AppCache: Log a Deprecation warning to the Console when AppCache is used
1496         https://bugs.webkit.org/show_bug.cgi?id=181778
1497
1498         Reviewed by Alex Christensen.
1499
1500         * html/HTMLHtmlElement.cpp:
1501         (WebCore::HTMLHtmlElement::insertedByParser):
1502
1503 2018-01-19  Chris Dumez  <cdumez@apple.com>
1504
1505         ASSERT(registration || isTerminating()) hit in SWServerWorker::skipWaiting()
1506         https://bugs.webkit.org/show_bug.cgi?id=181761
1507         <rdar://problem/36594564>
1508
1509         Reviewed by Youenn Fablet.
1510
1511         There is a short period of time, early in the registration process where a
1512         SWServerWorker object exists for a registration but is not in the registration's
1513         installing/waiting/active slots yet. As a result, if a registration is cleared
1514         during this period (for e.g. due to the user clearing all website data), that
1515         SWServerWorker will not be terminated. We then hit assertion later on when this
1516         worker is trying to do things (like call skipWaiting).
1517
1518         To address the issue, we now keep a reference this SWServerWorker on the
1519         registration, via a new SWServerRegistration::m_preInstallationWorker data member.
1520         When the registration is cleared, we now take care of terminating this worker.
1521
1522         No new tests, covered by existing tests that crash flakily in debug builds.
1523
1524         * workers/WorkerThread.cpp:
1525         (WebCore::WorkerThread::stop):
1526         if the mutex is locked, then the worker thread is still starting. We spin the
1527         runloop and try to stop again later. This avoids the deadlock shown in
1528         Bug 181763 as the worker thread may need to interact with the main thread
1529         during startup.
1530
1531         * workers/service/server/SWServer.cpp:
1532         (WebCore::SWServer::installContextData):
1533         * workers/service/server/SWServerJobQueue.cpp:
1534         (WebCore::SWServerJobQueue::scriptContextFailedToStart):
1535         (WebCore::SWServerJobQueue::install):
1536         * workers/service/server/SWServerRegistration.cpp:
1537         (WebCore::SWServerRegistration::~SWServerRegistration):
1538         (WebCore::SWServerRegistration::setPreInstallationWorker):
1539         (WebCore::SWServerRegistration::clear):
1540         * workers/service/server/SWServerRegistration.h:
1541         (WebCore::SWServerRegistration::preInstallationWorker const):
1542
1543 2018-01-19  Chris Dumez  <cdumez@apple.com>
1544
1545         Service worker registrations restored from disk may not be reused when the JS calls register() again
1546         https://bugs.webkit.org/show_bug.cgi?id=181810
1547         <rdar://problem/36591711>
1548
1549         Reviewed by Youenn Fablet.
1550
1551         The issue was that when restoring a registration from disk, we would not set its active worker right
1552         away. We only set it later in installContextData(). installContextData() is only called after we’ve
1553         launched the service worker process and established a connection to it.
1554
1555         However, we would start processing jobs (such as registrations) before we’ve established the connection
1556         to the service worker process. SWServerJobQueue::runRegisterJob(), in order to reuse an existing
1557         registration checks the registration’s active worker has the right script URL. The issue was that when
1558         this code would execute, we may not have set the registration’s active service worker yet, in which case,
1559         we would update the existing registration instead of reusing it as-is.
1560
1561         To address the issue, we now delay the processing of jobs until the connection to the service worker
1562         process has been established and we've installed all pending contexts via installContextData().
1563
1564         Changed is covered by new API test.
1565
1566         * workers/service/server/SWServer.cpp:
1567         (WebCore::SWServer::Connection::scheduleJobInServer):
1568         (WebCore::SWServer::scheduleJob):
1569         (WebCore::SWServer::serverToContextConnectionCreated):
1570         * workers/service/server/SWServer.h:
1571
1572 2018-01-19  James Craig  <jcraig@apple.com>
1573
1574         AX: when invert colors is on, double-invert image and picture elements in UserAgentStyleSheet
1575         https://bugs.webkit.org/show_bug.cgi?id=181281
1576         <rdar://problem/36291776>
1577
1578         Reviewed by Simon Fraser.
1579
1580         Updated "Smart Invert" to include img and picture element inversion and tests.
1581
1582         Tests: accessibility/smart-invert-reference.html
1583                accessibility/smart-invert.html
1584
1585         * css/html.css:
1586         (@media (inverted-colors)):
1587         (img:not(picture>img), picture, video):
1588
1589 2018-01-19  Chris Dumez  <cdumez@apple.com>
1590
1591         The WebContent process should not process incoming IPC while waiting for a sync IPC reply
1592         https://bugs.webkit.org/show_bug.cgi?id=181560
1593
1594         Reviewed by Ryosuke Niwa.
1595
1596         Add internals API for testing purposes.
1597
1598         Test: fast/misc/testIncomingSyncIPCMessageWhileWaitingForSyncReply.html
1599
1600         * page/ChromeClient.h:
1601         * testing/Internals.cpp:
1602         (WebCore::Internals::testIncomingSyncIPCMessageWhileWaitingForSyncReply):
1603         * testing/Internals.h:
1604         * testing/Internals.idl:
1605
1606 2018-01-19  Keith Miller  <keith_miller@apple.com>
1607
1608         HaveInternalSDK includes should be "#include?"
1609         https://bugs.webkit.org/show_bug.cgi?id=179670
1610
1611         Reviewed by Dan Bernstein.
1612
1613         * Configurations/Base.xcconfig:
1614
1615 2018-01-19  Daniel Bates  <dabates@apple.com>
1616
1617         Fix misspelling; substitute willDetachRenderer for willDetatchRenderer.
1618
1619         * html/HTMLPlugInImageElement.cpp:
1620         (WebCore::HTMLPlugInImageElement::willDetachRenderers):
1621         * plugins/PluginViewBase.h:
1622         (WebCore::PluginViewBase::willDetachRenderer):
1623         (WebCore::PluginViewBase::willDetatchRenderer): Deleted.
1624
1625 2018-01-19  Jonathan Bedard  <jbedard@apple.com>
1626
1627         Unreviewed build fix, remove unused lambda captures.
1628
1629         * dom/messageports/MessagePortChannel.cpp:
1630         (WebCore::MessagePortChannel::takeAllMessagesForPort):
1631         * dom/messageports/MessagePortChannelRegistry.cpp:
1632         (WebCore::MessagePortChannelRegistry::messagePortChannelCreated):
1633
1634 2018-01-19  Antoine Quint  <graouts@apple.com>
1635
1636         [Web Animations] Expose timing properties (delay, endDelay, fill, iterationStart, iterations, direction) and getComputedTiming()
1637         https://bugs.webkit.org/show_bug.cgi?id=181857
1638         <rdar://problem/36660081>
1639
1640         Reviewed by Dean Jackson.
1641
1642         We start the work to implement the rest of the Web Animations timing and animation model by exposing more properties on
1643         AnimationEffectTiming to control delay (delay, endDelay), looping (iterationStart, iterations), fill and direction.
1644         Additionally, we expose the getComputedTiming() method on AnimationEffect, although it currently lacks some computed
1645         properties that will come in later patch as we implement various processes defined by the spec. We also update the
1646         existing duration() method on AnimationEffectTiming to be called iterationDuration() to match the terms used in the
1647         specification.
1648
1649         Finally, we make all new properties, and update existing ones, that expose a time value go through the new utility
1650         function secondsToWebAnimationsAPITime() to guarantee rounded values with microseconds precision, as advised by
1651         the Web Animations specification.
1652
1653         * CMakeLists.txt:
1654         * DerivedSources.make:
1655         * Sources.txt:
1656         * WebCore.xcodeproj/project.pbxproj:
1657         * animation/AnimationEffect.cpp:
1658         (WebCore::AnimationEffect::localTime const):
1659         (WebCore::AnimationEffect::getComputedTiming):
1660         * animation/AnimationEffect.h:
1661         * animation/AnimationEffect.idl:
1662         * animation/AnimationEffectTiming.cpp:
1663         (WebCore::AnimationEffectTiming::AnimationEffectTiming):
1664         (WebCore::AnimationEffectTiming::setIterationStart):
1665         (WebCore::AnimationEffectTiming::setIterations):
1666         (WebCore::AnimationEffectTiming::bindingsDuration const):
1667         (WebCore::AnimationEffectTiming::setBindingsDuration):
1668         (WebCore::AnimationEffectTiming::endTime const):
1669         (WebCore::AnimationEffectTiming::activeDuration const):
1670         * animation/AnimationEffectTiming.h:
1671         * animation/AnimationEffectTiming.idl:
1672         * animation/AnimationPlaybackEvent.cpp:
1673         (WebCore::AnimationPlaybackEvent::bindingsCurrentTime const):
1674         (WebCore::AnimationPlaybackEvent::bindingsTimelineTime const):
1675         * animation/AnimationTimeline.cpp:
1676         (WebCore::AnimationTimeline::bindingsCurrentTime):
1677         * animation/ComputedTimingProperties.h: Added.
1678         * animation/ComputedTimingProperties.idl: Added. We set nullable double values to a default value of "null" since
1679         otherwise setting those properties to a null value would not set the properties in the converted JS dictionary.
1680         * animation/KeyframeEffect.cpp:
1681         (WebCore::KeyframeEffect::create): Handle new timing properties passed in the KeyframeEffectOptions dictionary.
1682         (WebCore::KeyframeEffect::applyAtLocalTime):
1683         (WebCore::KeyframeEffect::getAnimatedStyle):
1684         (WebCore::KeyframeEffect::startOrStopAccelerated):
1685         * animation/WebAnimation.cpp:
1686         (WebCore::WebAnimation::bindingsStartTime const):
1687         (WebCore::WebAnimation::bindingsCurrentTime const):
1688         (WebCore::WebAnimation::effectEndTime const):
1689         (WebCore::WebAnimation::timeToNextRequiredTick const):
1690         * animation/WebAnimationUtilities.h: Added.
1691         (WebCore::secondsToWebAnimationsAPITime):
1692
1693 2018-01-19  Alex Christensen  <achristensen@webkit.org>
1694
1695         Remove dead networking code
1696         https://bugs.webkit.org/show_bug.cgi?id=181813
1697
1698         Reviewed by Tim Horton.
1699
1700         CFURLConnection is only used on Windows.
1701
1702         * platform/network/cf/ResourceError.h:
1703         * platform/network/cf/ResourceRequest.h:
1704         (WebCore::ResourceRequest::encodingRequiresPlatformData const):
1705         * platform/network/cf/ResourceRequestCFNet.cpp:
1706         (WebCore::findCFURLRequestCopyContentDispositionEncodingFallbackArrayFunction):
1707         (WebCore::ResourceRequest::doUpdatePlatformRequest):
1708         (WebCore::ResourceRequest::doUpdatePlatformHTTPBody):
1709         (WebCore::ResourceRequest::doUpdateResourceRequest):
1710         (WebCore::ResourceRequest::setStorageSession):
1711         * platform/network/cf/ResourceResponse.h:
1712         (WebCore::ResourceResponse::ResourceResponse):
1713
1714 2018-01-19  Alex Christensen  <achristensen@webkit.org>
1715
1716         Remove unused WebViewPrivate _allowCookies
1717         https://bugs.webkit.org/show_bug.cgi?id=181812
1718
1719         Reviewed by Tim Horton.
1720
1721         This SPI was in the original iOS upstreaming and has not been used in many years.
1722
1723         * platform/network/ResourceRequestBase.cpp:
1724         (WebCore::ResourceRequestBase::setDefaultAllowCookies): Deleted.
1725         (WebCore::ResourceRequestBase::defaultAllowCookies): Deleted.
1726         * platform/network/ResourceRequestBase.h:
1727         (WebCore::ResourceRequestBase::ResourceRequestBase):
1728
1729 2018-01-18  Brady Eidson  <beidson@apple.com>
1730
1731         Make in-process MessagePorts be (mostly) asynchronous
1732         https://bugs.webkit.org/show_bug.cgi?id=181454
1733
1734         Reviewed by Alex Christensen.
1735
1736         No new tests (Covered *brutally* by existing tests)
1737
1738         Part of making MessagePorts be a thing we can pass across processes is making them work async.
1739         
1740         The existing "MessagePortChannel" method of abstraction was not cut out for this.
1741         This patch gets rid of MessagePortChannel and adds a new MessagePortChannelProvider abstraction.
1742         It then gets the new machinery working in-process (with some pieces of out-of-process in place)
1743
1744         One synchronous behavior this patch maintains is the hasPendingActivity() check used to support GC.
1745         That will (creatively) be made async in the next followup.
1746         
1747         More generally from MessagePorts, this patch also adds a "MessageWithMessagePorts" object to be used
1748         with all forms of postMessage(). Much better.
1749         
1750         * CMakeLists.txt:
1751         * Sources.txt:
1752         * WebCore.xcodeproj/project.pbxproj:
1753
1754         * dom/InProcessMessagePortChannel.cpp: Removed.
1755         * dom/InProcessMessagePortChannel.h: Removed.
1756         * dom/MessagePortChannel.cpp: Removed.
1757         * dom/MessagePortChannel.h: Removed.
1758
1759         * dom/MessageChannel.cpp:
1760         (WebCore::MessageChannel::create):
1761         (WebCore::MessageChannel::MessageChannel):
1762         (WebCore::m_port2): Deleted.
1763         * dom/MessageChannel.h:
1764         (WebCore::MessageChannel::create): Deleted.
1765
1766         * dom/MessagePort.cpp:
1767         (WebCore::MessagePort::create):
1768         (WebCore::MessagePort::MessagePort):
1769         (WebCore::MessagePort::~MessagePort):
1770         (WebCore::MessagePort::entangle):
1771         (WebCore::MessagePort::postMessage):
1772         (WebCore::MessagePort::disentangle):
1773         (WebCore::MessagePort::messageAvailable):
1774         (WebCore::MessagePort::start):
1775         (WebCore::MessagePort::close):
1776         (WebCore::MessagePort::contextDestroyed):
1777         (WebCore::MessagePort::dispatchMessages):
1778         (WebCore::MessagePort::hasPendingActivity const):
1779         (WebCore::MessagePort::locallyEntangledPort const):
1780         (WebCore::MessagePort::disentanglePorts):
1781         (WebCore::MessagePort::entanglePorts):
1782         (WebCore::MessagePort::entangleWithRemote): Deleted.
1783         * dom/MessagePort.h:
1784
1785         * dom/MessagePortIdentifier.h:
1786         (WebCore::MessagePortIdentifier::logString const):
1787
1788         * dom/ScriptExecutionContext.cpp:
1789         (WebCore::ScriptExecutionContext::processMessageWithMessagePortsSoon):
1790         (WebCore::ScriptExecutionContext::dispatchMessagePortEvents):
1791         (WebCore::ScriptExecutionContext::processMessagePortMessagesSoon): Deleted.
1792         * dom/ScriptExecutionContext.h:
1793
1794         Add a single object that represents two intertwined ports, tracks their pending
1795         messages, tracks which process they're in, etc etc:
1796         * dom/messageports/MessagePortChannel.cpp: Added.
1797         (WebCore::MessagePortChannel::create):
1798         (WebCore::MessagePortChannel::MessagePortChannel):
1799         (WebCore::MessagePortChannel::~MessagePortChannel):
1800         (WebCore::MessagePortChannel::includesPort):
1801         (WebCore::MessagePortChannel::entanglePortWithProcess):
1802         (WebCore::MessagePortChannel::disentanglePort):
1803         (WebCore::MessagePortChannel::closePort):
1804         (WebCore::MessagePortChannel::postMessageToRemote):
1805         (WebCore::MessagePortChannel::takeAllMessagesForPort):
1806         (WebCore::MessagePortChannel::hasAnyMessagesPendingOrInFlight const):
1807         * dom/messageports/MessagePortChannel.h: Added.
1808         (WebCore::MessagePortChannel::port1 const):
1809         (WebCore::MessagePortChannel::port2 const):
1810         (WebCore::MessagePortChannel::logString const):
1811
1812         Abstraction for creating and operating on MessagePorts in a potentially cross-process way:
1813         * dom/messageports/MessagePortChannelProvider.cpp: Added.
1814         (WebCore::MessagePortChannelProvider::singleton):
1815         (WebCore::MessagePortChannelProvider::setSharedProvider):
1816         * dom/messageports/MessagePortChannelProvider.h: Added.
1817         (WebCore::MessagePortChannelProvider::~MessagePortChannelProvider):
1818
1819         Adds a concrete implementation of that provider to be used in-process (e.g. WK1):
1820         * dom/messageports/MessagePortChannelProviderImpl.cpp: Added.
1821         (WebCore::MessagePortChannelProviderImpl::~MessagePortChannelProviderImpl):
1822         (WebCore::MessagePortChannelProviderImpl::performActionOnAppropriateThread):
1823         (WebCore::MessagePortChannelProviderImpl::createNewMessagePortChannel):
1824         (WebCore::MessagePortChannelProviderImpl::entangleLocalPortInThisProcessToRemote):
1825         (WebCore::MessagePortChannelProviderImpl::messagePortDisentangled):
1826         (WebCore::MessagePortChannelProviderImpl::messagePortClosed):
1827         (WebCore::MessagePortChannelProviderImpl::postMessageToRemote):
1828         (WebCore::MessagePortChannelProviderImpl::takeAllMessagesForPort):
1829         (WebCore::MessagePortChannelProviderImpl::hasMessagesForPorts_temporarySync):
1830         * dom/messageports/MessagePortChannelProviderImpl.h: Added.
1831
1832         Adds a main thread object to handle the set of all MessagePortChannels that are open.
1833         For now it lives in the WebProcess, but for out-of-process it will live in the UIProcess:
1834         * dom/messageports/MessagePortChannelRegistry.cpp: Added.
1835         (WebCore::MessagePortChannelRegistry::~MessagePortChannelRegistry):
1836         (WebCore::MessagePortChannelRegistry::didCreateMessagePortChannel):
1837         (WebCore::MessagePortChannelRegistry::messagePortChannelCreated):
1838         (WebCore::MessagePortChannelRegistry::messagePortChannelDestroyed):
1839         (WebCore::MessagePortChannelRegistry::didEntangleLocalToRemote):
1840         (WebCore::MessagePortChannelRegistry::didDisentangleMessagePort):
1841         (WebCore::MessagePortChannelRegistry::didCloseMessagePort):
1842         (WebCore::MessagePortChannelRegistry::didPostMessageToRemote):
1843         (WebCore::MessagePortChannelRegistry::takeAllMessagesForPort):
1844         (WebCore::MessagePortChannelRegistry::hasMessagesForPorts_temporarySync): This is named against style
1845           and weird on purpose - to call attention to how bad it is and how it's temporary.
1846         (WebCore::MessagePortChannelRegistry::existingChannelContainingPort):
1847         * dom/messageports/MessagePortChannelRegistry.h: Added.
1848
1849         Add an object that represents a "SerializedScriptValue for the message payload and the ports
1850         that are being transferred along with that payload". This is used in all forms of postMessage():
1851         * dom/messageports/MessageWithMessagePorts.cpp: Added.
1852         * dom/messageports/MessageWithMessagePorts.h: Added.
1853
1854         * page/DOMWindow.cpp:
1855         (WebCore::PostMessageTimer::PostMessageTimer):
1856         (WebCore::PostMessageTimer::event):
1857         (WebCore::DOMWindow::postMessage):
1858
1859         * platform/Logging.h:
1860
1861         * workers/DedicatedWorkerGlobalScope.cpp:
1862         (WebCore::DedicatedWorkerGlobalScope::postMessage):
1863
1864         * workers/Worker.cpp:
1865         (WebCore::Worker::postMessage):
1866
1867         * workers/WorkerGlobalScopeProxy.h:
1868
1869         * workers/WorkerMessagingProxy.cpp:
1870         (WebCore::WorkerMessagingProxy::postMessageToWorkerObject):
1871         (WebCore::WorkerMessagingProxy::postMessageToWorkerGlobalScope):
1872         * workers/WorkerMessagingProxy.h:
1873
1874         * workers/WorkerObjectProxy.h:
1875
1876         * workers/service/ServiceWorker.cpp:
1877         (WebCore::ServiceWorker::postMessage):
1878
1879         * workers/service/ServiceWorkerClient.cpp:
1880         (WebCore::ServiceWorkerClient::postMessage):
1881
1882         * workers/service/context/SWContextManager.cpp:
1883         (WebCore::SWContextManager::postMessageToServiceWorker):
1884
1885         * workers/service/context/ServiceWorkerThread.cpp:
1886         (WebCore::fireMessageEvent):
1887         (WebCore::ServiceWorkerThread::postMessageToServiceWorker):
1888         * workers/service/context/ServiceWorkerThread.h:
1889
1890 2018-01-18  Ryan Haddad  <ryanhaddad@apple.com>
1891
1892         Unreviewed build fix, removed unused lambda capture.
1893
1894         * workers/service/context/SWContextManager.cpp:
1895         (WebCore::SWContextManager::ServiceWorkerTerminationRequest::ServiceWorkerTerminationRequest):
1896
1897 2018-01-18  Chris Dumez  <cdumez@apple.com>
1898
1899         We should be able to terminate service workers that are unresponsive
1900         https://bugs.webkit.org/show_bug.cgi?id=181563
1901         <rdar://problem/35280031>
1902
1903         Reviewed by Alex Christensen.
1904
1905         Test: http/tests/workers/service/postmessage-after-terminating-hung-worker.html
1906
1907         * workers/service/context/SWContextManager.cpp:
1908         (WebCore::SWContextManager::terminateWorker):
1909         Before calling WorkerThread::stop(), set a timer with the given timeout parameter.
1910         If the worker thread has not stopped when the timer fires, forcefully exit the
1911         service worker process. The StorageProcess will take care of relaunching the
1912         service worker process if it exits abruptly.
1913
1914         (WebCore::SWContextManager::serviceWorkerFailedToTerminate):
1915         Log error message if we failed to terminate a service worker and call exit().
1916
1917         (WebCore::SWContextManager::ServiceWorkerTerminationRequest::ServiceWorkerTerminationRequest):
1918
1919         * workers/service/context/SWContextManager.h:
1920
1921 2018-01-18  Youenn Fablet  <youenn@apple.com>
1922
1923         Do not go to the storage process when loading a main resource if there is no service worker registered
1924         https://bugs.webkit.org/show_bug.cgi?id=181395
1925
1926         Reviewed by Chris Dumez.
1927
1928         No observable behavior change.
1929         Instead of creating a connection to know whether there is a potential service worker,
1930         Ask the service worker provider that will use the connection if needed.
1931         Otherwise, it will use a default value provided by the UIProcess.
1932
1933         Tested by cleaning all service workers and checking the computed value of the default value,
1934         then observing whether pages registering service workers work well.
1935
1936         * loader/DocumentLoader.cpp:
1937         (WebCore::DocumentLoader::startLoadingMainResource):
1938         * workers/service/ServiceWorkerProvider.cpp:
1939         (WebCore::ServiceWorkerProvider::mayHaveServiceWorkerRegisteredForOrigin):
1940         * workers/service/ServiceWorkerProvider.h:
1941
1942 2018-01-18  Dan Bernstein  <mitz@apple.com>
1943
1944         [Xcode] Streamline and future-proof target-macOS-version-dependent build setting definitions
1945         https://bugs.webkit.org/show_bug.cgi?id=181803
1946
1947         Reviewed by Tim Horton.
1948
1949         * Configurations/Base.xcconfig: Updated.
1950         * Configurations/DebugRelease.xcconfig: Ditto.
1951         * Configurations/FeatureDefines.xcconfig: Adopted macOSTargetConditionals helpers.
1952         * Configurations/Version.xcconfig: Updated.
1953         * Configurations/macOSTargetConditionals.xcconfig: Added. Defines helper build settings
1954           useful for defining settings that depend on the target macOS version.
1955
1956 2018-01-18  Chris Dumez  <cdumez@apple.com>
1957
1958         Service Workers restored from persistent storage have 'redundant' state
1959         https://bugs.webkit.org/show_bug.cgi?id=181749
1960         <rdar://problem/36556486>
1961
1962         Reviewed by Youenn Fablet.
1963
1964         Tested by new API test.
1965
1966         * workers/service/server/SWServer.cpp:
1967         (WebCore::SWServer::installContextData):
1968         Make sure the SWServerWorker's state is set to "activated" after it is assigned to
1969         the registrations' active slot. Otherwise, it stays in its default state (redundant).
1970
1971 2018-01-18  Antti Koivisto  <antti@apple.com>
1972
1973         REGRESSION(r225650): The scores of MotionMark tests Multiply and Leaves dropped by 8%
1974         https://bugs.webkit.org/show_bug.cgi?id=181460
1975         <rdar://problem/36379776>
1976
1977         Reviewed by Ryosuke Niwa.
1978
1979         * css/parser/CSSParser.cpp:
1980         (WebCore::CSSParserContext::CSSParserContext):
1981
1982         Don't do the expensive security origin test if the supplied sheet base URL is null. This
1983         is true for rules coming from the same document.
1984
1985 2018-01-18  Antti Koivisto  <antti@apple.com>
1986
1987         REGRESSION (r223604): Setting :before/after pseudo element on <noscript> asserts
1988         https://bugs.webkit.org/show_bug.cgi?id=181795
1989         <rdar://problem/36334524>
1990
1991         Reviewed by David Kilzer.
1992
1993         <noscript> disallows renderer generation outside CSS mechanisms, however we would still construct
1994         PseudoElements for them during style resolution. These were never removed properly because the
1995         pseudo element removal was tied to render tree teardown. Without proper removal the associated
1996         animations were also not canceled.
1997
1998         Test: fast/css-generated-content/noscript-pseudo-anim-crash.html
1999
2000         * dom/Element.cpp:
2001         (WebCore::Element::removedFromAncestor):
2002
2003         Take care to get rid of PseudoElements when the element is removed from the tree.
2004         This also cancels any associated animations.
2005
2006 2018-01-18  Chris Fleizach  <cfleizach@apple.com>
2007
2008         AX: Aria-activedescendant not supported
2009         https://bugs.webkit.org/show_bug.cgi?id=161734
2010         <rdar://problem/28202679>
2011
2012         Reviewed by Joanmarie Diggs.
2013
2014         When a combo-box owns/controls a list/listbox/grid/tree, the owned element needs to check the active-descendant of the combobox when
2015         checking if it has selected children. 
2016         The target of the selection change notification should also be the owned element in these cases.
2017
2018         Test: accessibility/aria-combobox-controlling-list.html
2019
2020         * accessibility/AccessibilityObject.cpp:
2021         (WebCore::AccessibilityObject::selectedListItem):
2022         * accessibility/AccessibilityObject.h:
2023         * accessibility/AccessibilityRenderObject.cpp:
2024         (WebCore::AccessibilityRenderObject::targetElementForActiveDescendant const):
2025         (WebCore::AccessibilityRenderObject::handleActiveDescendantChanged):
2026         (WebCore::AccessibilityRenderObject::canHaveSelectedChildren const):
2027         (WebCore::AccessibilityRenderObject::selectedChildren):
2028         * accessibility/AccessibilityRenderObject.h:
2029         * accessibility/mac/AXObjectCacheMac.mm:
2030         (WebCore::AXObjectCache::postPlatformNotification):
2031
2032 2018-01-17  Per Arne Vollan  <pvollan@apple.com>
2033
2034         REGRESSION (r224780): Text stroke not applied to video captions.
2035         https://bugs.webkit.org/show_bug.cgi?id=181743
2036         <rdar://problem/35874338>
2037
2038         Reviewed by Simon Fraser.
2039
2040         Tests: media/track/track-css-visible-stroke-expected.html
2041                media/track/track-css-visible-stroke.html
2042
2043         After r224780, it is no longer possible to mix text stroke styles with webkit
2044         legacy text stroke styles.
2045
2046         * css/StyleResolver.cpp:
2047         (WebCore::isValidCueStyleProperty):
2048         * page/CaptionUserPreferencesMediaAF.cpp:
2049         (WebCore::CaptionUserPreferencesMediaAF::captionsTextEdgeCSS const):
2050
2051 2018-01-18  Andy Estes  <aestes@apple.com>
2052
2053         [Payment Request] Support a default shipping address for Apple Pay
2054         https://bugs.webkit.org/show_bug.cgi?id=181754
2055         <rdar://problem/36009733>
2056
2057         Reviewed by Brady Eidson.
2058
2059         Move shippingContact from ApplePayPaymentRequest to ApplePayRequestBase. This allows
2060         merchants to specify a default shipping address when using Apple Pay with Payment Request.
2061
2062         This also fixes a bug found during testing where
2063         +[NSPersonNameComponentsFormatter localizedStringFromPersonNameComponents:style:options:]
2064         would throw an exception when passed a nil NSPersonNameComponents.
2065
2066         Test: http/tests/ssl/applepay/ApplePayRequestShippingContact.https.html
2067
2068         * Modules/applepay/ApplePayPaymentRequest.h:
2069         * Modules/applepay/ApplePayPaymentRequest.idl:
2070         * Modules/applepay/ApplePayRequestBase.cpp:
2071         (WebCore::convertAndValidate):
2072         * Modules/applepay/ApplePayRequestBase.h:
2073         * Modules/applepay/ApplePayRequestBase.idl:
2074         * Modules/applepay/ApplePaySession.cpp:
2075         (WebCore::convertAndValidate):
2076         * Modules/applepay/ApplePaySessionPaymentRequest.h:
2077         (WebCore::ApplePaySessionPaymentRequest::version const):
2078         (WebCore::ApplePaySessionPaymentRequest::setVersion):
2079         * Modules/applepay/cocoa/PaymentContactCocoa.mm:
2080         (WebCore::convert):
2081         * Modules/applepay/paymentrequest/ApplePayRequest.idl:
2082         * testing/MockPaymentCoordinator.cpp:
2083         (WebCore::MockPaymentCoordinator::showPaymentUI):
2084         (WebCore::MockPaymentCoordinator::completeMerchantValidation):
2085         * testing/MockPaymentCoordinator.h:
2086
2087 2018-01-18  Wenson Hsieh  <wenson_hsieh@apple.com>
2088
2089         [iOS] Specify -[NSURL _title] for the associated URL when copying an image element
2090         https://bugs.webkit.org/show_bug.cgi?id=181783
2091         <rdar://problem/35785445>
2092
2093         Reviewed by Ryosuke Niwa.
2094
2095         Always specify the -[NSURL _title] to be either the title specified in a PasteboardImage's inner PasteboardURL,
2096         or if no title is specified, fall back to the user-visible URL string. This is because at least one internal
2097         client always tries to use the -_title property to determine the title of a pasted URL, or if none is specified,
2098         the -suggestedName. Since we need to set suggestedName to the preferred file name of the copied image and we
2099         don't want the suggested name to become the title of the link, we need to explicitly set the link title.
2100
2101         In doing so, this patch also fixes a bug wherein we forget to set the _title of the NSURL we're registering to
2102         an NSItemProvider.
2103
2104         Tests:  ActionSheetTests.CopyImageElementWithHREFAndTitle (new)
2105                 ActionSheetTests.CopyImageElementWithHREF (modified)
2106
2107         * platform/ios/PlatformPasteboardIOS.mm:
2108         (WebCore::PlatformPasteboard::write):
2109
2110 2018-01-17  Jer Noble  <jer.noble@apple.com>
2111
2112         WebVTT served via HLS never results in cues
2113         https://bugs.webkit.org/show_bug.cgi?id=181773
2114
2115         Reviewed by Eric Carlson.
2116
2117         Test: http/tests/media/hls/hls-webvtt-tracks.html
2118
2119         Three independant errors conspired to keep in-band WebVTT samples from parsing:
2120
2121         - The definition of ISOWebVTTCue::boxTypeName() was incorrect.
2122         - ISOWebVTTCue::parse() didn't call it's superclass's parse() method (leading to an incorrect size and offset).
2123         - Use String::fromUTF8() rather than String.adopt(StringVector&&).
2124
2125         * platform/graphics/iso/ISOVTTCue.cpp:
2126         (WebCore::ISOWebVTTCue::parse):
2127         * platform/graphics/iso/ISOVTTCue.h:
2128         (WebCore::ISOWebVTTCue::boxTypeName):
2129
2130 2018-01-17  John Wilander  <wilander@apple.com>
2131
2132         Resource Load Statistics: Block cookies for prevalent resources without user interaction
2133         https://bugs.webkit.org/show_bug.cgi?id=177394
2134         <rdar://problem/34613960>
2135
2136         Reviewed by Alex Christensen.
2137
2138         Tests: http/tests/resourceLoadStatistics/add-blocking-to-redirect.html
2139                http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context.html
2140                http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html
2141                http/tests/resourceLoadStatistics/remove-partitioning-in-redirect.html
2142
2143         * platform/network/NetworkStorageSession.h:
2144             Now exports NetworkStorageSession::nsCookieStorage().
2145         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
2146         (WebCore::NetworkStorageSession::setPrevalentDomainsToPartitionOrBlockCookies):
2147             Fixes the FIXME.
2148
2149 2018-01-17  Dean Jackson  <dino@apple.com>
2150
2151         Remove linked-on test for Snow Leopard
2152         https://bugs.webkit.org/show_bug.cgi?id=181770
2153
2154         Reviewed by Eric Carlson.
2155
2156         Remove a very old linked-on-or-after test.
2157
2158         * platform/graphics/ca/GraphicsLayerCA.cpp:
2159
2160 2018-01-17  Matt Lewis  <jlewis3@apple.com>
2161
2162         Unreviewed, rolling out r227098.
2163
2164         This broke the build.
2165
2166         Reverted changeset:
2167
2168         "Remove linked-on test for Snow Leopard"
2169         https://bugs.webkit.org/show_bug.cgi?id=181770
2170         https://trac.webkit.org/changeset/227098
2171
2172 2018-01-17  Dean Jackson  <dino@apple.com>
2173
2174         Remove linked-on test for Snow Leopard
2175         https://bugs.webkit.org/show_bug.cgi?id=181770
2176
2177         Reviewed by Eric Carlson.
2178
2179         Remove a very old linked-on-or-after test.
2180
2181         * platform/graphics/ca/GraphicsLayerCA.cpp:
2182
2183 2018-01-17  Stephan Szabo  <stephan.szabo@sony.com>
2184
2185         [Curl] Use ResourceRequest::encodeWithPlatformData()
2186         https://bugs.webkit.org/show_bug.cgi?id=181768
2187
2188         Reviewed by Alex Christensen.
2189
2190         No new tests, assertion hit in downstream port, should be covered by
2191         existing tests.
2192
2193         * platform/network/curl/ResourceRequest.h:
2194         (WebCore::ResourceRequest::encodeWithPlatformData const):
2195         (WebCore::ResourceRequest::decodeWithPlatformData):
2196
2197 2018-01-17  Eric Carlson  <eric.carlson@apple.com>
2198
2199         Use existing RGB colorspace instead of creating a new one
2200         https://bugs.webkit.org/show_bug.cgi?id=181765
2201         <rdar://problem/36595753>
2202
2203         Reviewed by Dean Jackson.
2204
2205         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:
2206         (WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream): Use sRGBColorSpaceRef instead
2207         of creating a new static colorspace.
2208
2209 2018-01-17  Matt Lewis  <jlewis3@apple.com>
2210
2211         Unreviewed, rolling out r227076.
2212
2213         This breaks internal builds
2214
2215         Reverted changeset:
2216
2217         "Resource Load Statistics: Block cookies for prevalent
2218         resources without user interaction"
2219         https://bugs.webkit.org/show_bug.cgi?id=177394
2220         https://trac.webkit.org/changeset/227076
2221
2222 2018-01-17  Ryosuke Niwa  <rniwa@webkit.org>
2223
2224         input and textarea elements should reveal selection in setSelection when focused
2225         https://bugs.webkit.org/show_bug.cgi?id=181715
2226         <rdar://problem/36570546>
2227
2228         Reviewed by Zalan Bujtas.
2229
2230         Made input and textarea elements reveal selection in FrameSelection::setSelection instead of by directly
2231         invoking FrameSelection::revealSelection in their respective updateFocusAppearance to unify code paths.
2232
2233         Also added options to reveal selection up to the main frame to SetSelectionOption to be used in iOS.
2234
2235         * editing/FrameSelection.cpp:
2236         (WebCore::FrameSelection::FrameSelection):
2237         (WebCore::FrameSelection::moveWithoutValidationTo): Takes SelectionRevealMode as an argument and converts
2238         sets appropriate selection options.
2239         (WebCore::FrameSelection::setSelection): Reconstruct SelectionRevealMode out of selection option sets.
2240         (WebCore::FrameSelection::updateAndRevealSelection):
2241         * editing/FrameSelection.h:
2242         (WebCore::FrameSelection): Added RevealSelectionUpToMainFrame as a SelectionRevealMode and replaced
2243         m_shouldRevealSelection by m_selectionRevealMode.
2244         * html/HTMLInputElement.cpp:
2245         (WebCore::HTMLInputElement::updateFocusAppearance): Pass SelectionRevealMode to HTMLTextFormControlElement's
2246         select and restoreCachedSelection instead of directly invoking FrameSelection::revealSelection.
2247         * html/HTMLTextAreaElement.cpp:
2248         (WebCore::HTMLTextAreaElement::updateFocusAppearance): Ditto.
2249         * html/HTMLTextFormControlElement.cpp:
2250         (WebCore::HTMLTextFormControlElement::select):
2251         (WebCore::HTMLTextFormControlElement::setSelectionRange):
2252         (WebCore::HTMLTextFormControlElement::restoreCachedSelection):
2253         * html/HTMLTextFormControlElement.h:
2254
2255 2018-01-17  Michael Catanzaro  <mcatanzaro@igalia.com>
2256
2257         WEBKIT_FRAMEWORK should not modify file-global include directories
2258         https://bugs.webkit.org/show_bug.cgi?id=181656
2259
2260         Reviewed by Konstantin Tokarev.
2261
2262         * CMakeLists.txt:
2263         * PlatformWPE.cmake:
2264
2265 2018-01-17  Michael Catanzaro  <mcatanzaro@igalia.com>
2266
2267         [GTK] Try even harder not to static link WTF into libwebkit2gtk
2268         https://bugs.webkit.org/show_bug.cgi?id=181751
2269
2270         Reviewed by Alex Christensen.
2271
2272         We don't want two copies of WTF. It should only be in libjavascriptcoregtk.
2273
2274         * PlatformGTK.cmake:
2275
2276 2018-01-17  Zalan Bujtas  <zalan@apple.com>
2277
2278         Multicol: RenderMultiColumnFlow should not inherit the flow state
2279         https://bugs.webkit.org/show_bug.cgi?id=181762
2280         <rdar://problem/35448565>
2281
2282         Reviewed by Simon Fraser.
2283
2284         Do not compute the inherited flow state flag for RenderMultiColumnFlow.
2285         It is (by definition) always inside a fragmented flow.
2286
2287         Test: fast/multicol/crash-when-out-of-flow-positioned-becomes-in-flow.html
2288
2289         * rendering/RenderObject.cpp:
2290         (WebCore::RenderObject::computedFragmentedFlowState):
2291
2292 2018-01-17  Alex Christensen  <achristensen@webkit.org>
2293
2294         Deprecate Application Cache
2295         https://bugs.webkit.org/show_bug.cgi?id=181764
2296
2297         Reviewed by Geoffrey Garen.
2298
2299         * features.json:
2300
2301 2018-01-17  Wenson Hsieh  <wenson_hsieh@apple.com>
2302
2303         [iOS simulator] API test WKAttachmentTests.InjectedBundleReplaceURLWhenPastingImage is failing
2304         https://bugs.webkit.org/show_bug.cgi?id=181758
2305
2306         Reviewed by Tim Horton.
2307
2308         This test is failing because Editor::clientReplacementURLForResource expects a MIME type, but on iOS, the type
2309         paramter passed into WebContentReader::readImage is a UTI; subsequently, the bundle editing delegate receives
2310         a MIME type that's actually a UTI, which is incorrect. To address this, ensure that a MIME type is passed to
2311         bundle SPI by converting the type in WebContentReader::readImage to a MIME type.
2312
2313         * editing/cocoa/WebContentReaderCocoa.mm:
2314         (WebCore::WebContentReader::readImage):
2315
2316 2018-01-17  Antti Koivisto  <antti@apple.com>
2317
2318         REGRESSION (r226385?): Crash in com.apple.WebCore: WebCore::MediaQueryEvaluator::evaluate const + 32
2319         https://bugs.webkit.org/show_bug.cgi?id=181742
2320         <rdar://problem/36334726>
2321
2322         Reviewed by David Kilzer.
2323
2324         Test: fast/media/mediaqueryevaluator-crash.html
2325
2326         * css/MediaQueryEvaluator.cpp:
2327         (WebCore::MediaQueryEvaluator::MediaQueryEvaluator):
2328
2329         Use WeakPtr<Document> instead of a plain Frame pointer.
2330
2331         (WebCore::MediaQueryEvaluator::evaluate const):
2332
2333         Get the frame via document.
2334
2335         * css/MediaQueryEvaluator.h:
2336         * dom/Document.cpp:
2337         (WebCore::Document::prepareForDestruction):
2338
2339         Take care to clear style resolver.
2340
2341 2018-01-17  Youenn Fablet  <youenn@apple.com>
2342
2343         Put fetch request keepAlive behind a runtime flag
2344         https://bugs.webkit.org/show_bug.cgi?id=181592
2345
2346         Reviewed by Chris Dumez.
2347
2348         No change of behavior.
2349
2350         * Modules/fetch/FetchRequest.idl:
2351         * page/RuntimeEnabledFeatures.h:
2352         (WebCore::RuntimeEnabledFeatures::fetchAPIKeepAliveEnabled const):
2353         (WebCore::RuntimeEnabledFeatures::setFetchAPIKeepAliveEnabled):
2354
2355 2018-01-17  Per Arne Vollan  <pvollan@apple.com>
2356
2357         [Win] Use switch when converting from ResourceRequestCachePolicy to platform cache policy.
2358         https://bugs.webkit.org/show_bug.cgi?id=181686
2359
2360         Reviewed by Alex Christensen.
2361
2362         No new tests, covered by existing tests.
2363
2364         A switch will make the function easier on the eyes. Also, use the function in places where the ResourceRequestCachePolicy
2365         is just casted to a platform cache policy.
2366
2367         * platform/network/cf/ResourceRequestCFNet.cpp:
2368         (WebCore::toPlatformRequestCachePolicy):
2369
2370 2018-01-17  John Wilander  <wilander@apple.com>
2371
2372         Resource Load Statistics: Block cookies for prevalent resources without user interaction
2373         https://bugs.webkit.org/show_bug.cgi?id=177394
2374         <rdar://problem/34613960>
2375
2376         Reviewed by Alex Christensen.
2377
2378         Tests: http/tests/resourceLoadStatistics/add-blocking-to-redirect.html
2379                http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context.html
2380                http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html
2381                http/tests/resourceLoadStatistics/remove-partitioning-in-redirect.html
2382
2383         * platform/network/NetworkStorageSession.h:
2384             Now exports NetworkStorageSession::nsCookieStorage().
2385         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
2386         (WebCore::NetworkStorageSession::setPrevalentDomainsToPartitionOrBlockCookies):
2387             Fixes the FIXME.
2388
2389 2018-01-17  Daniel Bates  <dabates@apple.com>
2390
2391         REGRESSION (r222795): Cardiogram never signs in
2392         https://bugs.webkit.org/show_bug.cgi?id=181693
2393         <rdar://problem/36286293>
2394
2395         Reviewed by Ryosuke Niwa.
2396
2397         Exempt Cardiogram from the XHR header restrictions in r222795.
2398
2399         Following r222795 only Dashboard widgets are allowed to set arbitrary XHR headers.
2400         However Cardiogram also depends on such functionality.
2401
2402         Test: fast/xmlhttprequest/set-dangerous-headers-from-file-when-setting-enabled.html
2403
2404         * page/Settings.yaml:
2405         * platform/RuntimeApplicationChecks.h:
2406         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
2407         (WebCore::IOSApplication::isCardiogram):
2408         * xml/XMLHttpRequest.cpp:
2409         (WebCore::XMLHttpRequest::setRequestHeader):
2410
2411 2018-01-17  Daniel Bates  <dabates@apple.com>
2412
2413         ASSERTION FAILED: !m_completionHandler in PingHandle::~PingHandle()
2414         https://bugs.webkit.org/show_bug.cgi?id=181746
2415         <rdar://problem/36586248>
2416
2417         Reviewed by Chris Dumez.
2418
2419         Call PingHandle::pingLoadComplete() with an error when NSURLConnection queries
2420         whether the ping is able to respond to an authentication request. (Pings do not
2421         respond to authenticate requests.) It will call the completion handler, nullify
2422         the completion handler, and deallocate the PingHandle. Nullifying the completion
2423         handler is necessary to avoid the assertion failure in ~PingHandle().
2424
2425         Test: http/tests/misc/before-unload-load-image.html
2426
2427         * platform/network/PingHandle.h:
2428
2429 2018-01-17  Daniel Bates  <dabates@apple.com>
2430
2431         WebCoreResourceHandleAsOperationQueueDelegate/ResourceHandleCFURLConnectionDelegateWithOperationQueue may
2432         be deleted in main thread callback
2433         https://bugs.webkit.org/show_bug.cgi?id=181747
2434         <rdar://problem/36588120>
2435
2436         Reviewed by Alex Christensen.
2437
2438         Retain the delegate (e.g. WebCoreResourceHandleAsOperationQueueDelegate) before scheduling
2439         a main thread callback and blocking on a semaphore for its reply because the main thread
2440         callback can do anything, including deleting the delegate, before the non-main thread
2441         has a chance to execute. For instance, a PingHandle will delete itself (and hence delete
2442         its resource handle delegate) in most of the code paths invoked by the delegate.
2443
2444         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
2445         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willSendRequest):
2446         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse):
2447         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willCacheResponse):
2448         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace):
2449         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
2450         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]):
2451         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]):
2452         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
2453         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willCacheResponse:]):
2454
2455 2018-01-17  Chris Dumez  <cdumez@apple.com>
2456
2457         'fetch' event may be sent to a service worker before its state is set to 'activated'
2458         https://bugs.webkit.org/show_bug.cgi?id=181698
2459         <rdar://problem/36554856>
2460
2461         Reviewed by Youenn Fablet.
2462
2463         'fetch' event may be sent to a service worker before its state is set to 'activated'.
2464         When the registration's active worker needs to intercept a load, and its state is 'activating',
2465         we queue the request to send the fetch event in SWServerWorker::m_whenActivatedHandlers.
2466         Once the SWServerWorker::setState() is called with 'activated' state, we then call the
2467         handlers in m_whenActivatedHandlers to make send the fetch event now that the worker is
2468         activated. The issue is that even though the worker is activated and its state was set to
2469         'activated' on Storage process side, we had not yet notified the ServiceWorker process
2470         of the service worker's new state yet.
2471
2472         To address the issue, we now make sure that SWServerWorker::m_whenActivatedHandlers are
2473         called *after* we've sent the IPC to the ServiceWorker process to update the worker's
2474         state to 'activated'. Also, we now call ServiceWorkerFetch::dispatchFetchEvent()
2475         asynchronously in a postTask() as the service worker's state is also updated asynchronously
2476         in a postTask. This is as per specification [1], which says to "queue a task" to fire
2477         the fetch event.
2478
2479         [1] https://w3c.github.io/ServiceWorker/#on-fetch-request-algorithm (step 18)
2480
2481         No new tests, covered by imported/w3c/web-platform-tests/service-workers/service-worker/fetch-waits-for-activate.https.html
2482         which hits the new assertion without the fix.
2483
2484         * workers/service/context/ServiceWorkerFetch.cpp:
2485         (WebCore::ServiceWorkerFetch::dispatchFetchEvent):
2486         Add assertions to make sure that we dispatch the fetch event on the right worker and
2487         that the worker is in 'activated' state.
2488
2489         * workers/service/context/ServiceWorkerThread.cpp:
2490         (WebCore::ServiceWorkerThread::postFetchTask):
2491         Queue a task to fire the fetch event as per:
2492         - https://w3c.github.io/ServiceWorker/#on-fetch-request-algorithm (step 18)
2493         We need to match the specification exactly here or things will happen in the wrong
2494         order. In particular, things like "update registration state" and "update worker state"
2495         might happen *after* firing the fetch event, even though the IPC for "update registration/worker
2496         state" was sent before the "fire fetch event" one, because the code for updating a registration/
2497         worker state already queues a task, as per the specification.
2498
2499         * workers/service/server/SWServerRegistration.cpp:
2500         (WebCore::SWServerRegistration::updateWorkerState):
2501         * workers/service/server/SWServerRegistration.h:
2502         * workers/service/server/SWServerWorker.cpp:
2503         (WebCore::SWServerWorker::setState):
2504         Move code to send the IPC to the Service Worker process whenever the service worker's state
2505         needs to be updated from SWServerRegistration::updateWorkerState() to SWServerWorker::setState().
2506         This way, we can make sure the IPC is sent *before* we call the m_whenActivatedHandlers handlers,
2507         as they may also send IPC to the Service Worker process, and we need to make sure this IPC happens
2508         after so that the service worker is in the right state.
2509
2510 2018-01-17  Stephan Szabo  <stephan.szabo@sony.com>
2511
2512         Page.cpp only sees forward declaration of ApplicationStateChangeListener when ENABLE(VIDEO) is off
2513         https://bugs.webkit.org/show_bug.cgi?id=181713
2514
2515         Reviewed by Darin Adler.
2516
2517         No new tests (build fix).
2518
2519         * page/Page.cpp: Add include for ApplicationStateChangeListener
2520
2521 2018-01-17  Wenson Hsieh  <wenson_hsieh@apple.com>
2522
2523         Add injected bundle SPI to replace subresource URLs when dropping or pasting rich content
2524         https://bugs.webkit.org/show_bug.cgi?id=181637
2525         <rdar://problem/36508471>
2526
2527         Reviewed by Tim Horton.
2528
2529         Before carrying out blob URL conversion for pasted or dropped rich content, let the editor client replace
2530         subresource URLs in WebKit2 by calling out to new injected bundle SPI. See comments below for more detail.
2531
2532         Tests:  WKAttachmentTests.InjectedBundleReplaceURLsWhenPastingAttributedString
2533                 WKAttachmentTests.InjectedBundleReplaceURLWhenPastingImage
2534
2535         * editing/Editor.cpp:
2536         (WebCore::Editor::clientReplacementURLForResource):
2537         * editing/Editor.h:
2538
2539         Add a new helper to call out to the editor client for a URL string to replace a given ArchiveResource. In
2540         WebKit2, this calls out to the injected bundle's new `replacementURLForResource` SPI hook.
2541
2542         * editing/cocoa/WebContentReaderCocoa.mm:
2543         (WebCore::shouldReplaceSubresourceURL):
2544         (WebCore::replaceRichContentWithAttachments):
2545         (WebCore::replaceSubresourceURLsWithURLsFromClient):
2546
2547         Add a new static helper to replace subresource URLs in the given DocumentFragment with URLs supplied by the
2548         editor client. Additionally builds a list of ArchiveResources that have not been replaced, for use at call sites
2549         so that we don't unnecessarily create more Blobs for ArchiveResources that have already been replaced.
2550
2551         (WebCore::createFragmentAndAddResources):
2552         (WebCore::sanitizeMarkupWithArchive):
2553
2554         Tweak web content reading codepaths to first replace subresource URLs with editor-client-supplied URLs.
2555
2556         (WebCore::WebContentReader::readImage):
2557         (WebCore::shouldConvertToBlob): Deleted.
2558
2559         Rename this helper to shouldReplaceSubresourceURL, blob URL replacement is no longer the only scenario in which
2560         we replace resource URLs, but in both cases, we still want to ignore `http:`-family and `data:` URLs.
2561
2562         * loader/EmptyClients.cpp:
2563         * page/EditorClient.h:
2564
2565 2018-01-17  Yacine Bandou  <yacine.bandou_ext@softathome.com>
2566         [EME][GStreamer] Add the full-sample encryption support in the GStreamer ClearKey decryptor
2567         https://bugs.webkit.org/show_bug.cgi?id=180080
2568
2569         Reviewed by Xabier Rodriguez-Calvar.
2570
2571         Currently the GStreamer clearKey decryptor doesn't support the full-sample encryption,
2572         where the buffer is entirely encrypted, it supports only the sub-sample encryption.
2573
2574         Test: media/encrypted-media/clearKey/clearKey-cenc-audio-playback-mse.html
2575
2576         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
2577         (webKitMediaClearKeyDecryptorDecrypt):
2578
2579 2018-01-17  Zan Dobersek  <zdobersek@igalia.com>
2580
2581         Unreviewed follow-up to r227051.
2582
2583         * platform/graphics/cairo/CairoOperations.h: Fix declaration of the
2584         fillRoundedRect() function by removing the bool parameter that's not
2585         used at all in the definition. This went unspotted due to the unified
2586         source build including the implementation file before fillRoundedRect()
2587         usage in GrapihcsContextCairo.cpp, leaving the declaration undefined
2588         and instead using the definition directly.
2589
2590 2018-01-17  Zan Dobersek  <zdobersek@igalia.com>
2591
2592         [Cairo] Don't mirror global alpha and image interpolation quality state values in PlatformContextCairo
2593         https://bugs.webkit.org/show_bug.cgi?id=181725
2594
2595         Reviewed by Carlos Garcia Campos.
2596
2597         Don't duplicate global alpha and image interpolation quality state
2598         values on the PlatformContextCairo. Instead, retrieve them from
2599         the managing GraphicsContextState when necessary.
2600
2601         For Cairo operations, the FillSource and StrokeSource containers now
2602         store the global alpha value, using it during the operation executions.
2603         For drawNativeImage(), the global alpha and interpolation quality values
2604         are passed through arguments.
2605
2606         In PlatformContextCairo, the two values are no longer stored on the
2607         internally-managed stack, and the getter-setter pairs for the two values
2608         are removed. In drawSurfaceToContext(), the two values are now expected
2609         to be passed through the method arguments.
2610
2611         No new tests -- no change in behavior.
2612
2613         * platform/graphics/cairo/CairoOperations.cpp:
2614         (WebCore::Cairo::prepareForFilling):
2615         (WebCore::Cairo::prepareForStroking):
2616         (WebCore::Cairo::drawPathShadow):
2617         (WebCore::Cairo::fillCurrentCairoPath):
2618         (WebCore::Cairo::FillSource::FillSource):
2619         (WebCore::Cairo::StrokeSource::StrokeSource):
2620         (WebCore::Cairo::strokeRect):
2621         (WebCore::Cairo::strokePath):
2622         (WebCore::Cairo::drawGlyphs):
2623         (WebCore::Cairo::drawNativeImage):
2624         (WebCore::Cairo::State::setGlobalAlpha): Deleted.
2625         (WebCore::Cairo::State::setImageInterpolationQuality): Deleted.
2626         * platform/graphics/cairo/CairoOperations.h:
2627         * platform/graphics/cairo/GraphicsContextCairo.cpp:
2628         (WebCore::GraphicsContext::drawNativeImage):
2629         (WebCore::GraphicsContext::setPlatformAlpha):
2630         (WebCore::GraphicsContext::setPlatformImageInterpolationQuality):
2631         * platform/graphics/cairo/PlatformContextCairo.cpp:
2632         (WebCore::PlatformContextCairo::save):
2633         (WebCore::PlatformContextCairo::drawSurfaceToContext):
2634         (WebCore::PlatformContextCairo::State::State): Deleted.
2635         (WebCore::PlatformContextCairo::setImageInterpolationQuality): Deleted.
2636         (WebCore::PlatformContextCairo::imageInterpolationQuality const): Deleted.
2637         (WebCore::PlatformContextCairo::globalAlpha const): Deleted.
2638         (WebCore::PlatformContextCairo::setGlobalAlpha): Deleted.
2639         * platform/graphics/cairo/PlatformContextCairo.h:
2640         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
2641         (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::paintCurrentFrame):
2642
2643 2018-01-17  Philippe Normand  <pnormand@igalia.com>
2644
2645         REGRESSION(r226973/r226974): Four multimedia tests failing
2646         https://bugs.webkit.org/show_bug.cgi?id=181696
2647
2648         Reviewed by Carlos Garcia Campos.
2649
2650         This patch reverts some of the changes of the above revisions so as to fix layout test failures.
2651
2652         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2653         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Properly
2654         prepare stalled event when an error was detected.
2655         (WebCore::MediaPlayerPrivateGStreamer::processBufferingStats): Revert to previous version.
2656         (WebCore::MediaPlayerPrivateGStreamer::fillTimerFired): Ditto.
2657         (WebCore::MediaPlayerPrivateGStreamer::didLoadingProgress const):
2658         Emit progress event also when streaming but not when an error was
2659         detected.
2660         (WebCore::MediaPlayerPrivateGStreamer::totalBytes const): use isLiveStream like everywhere else.
2661         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
2662         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
2663         (webkit_web_src_init): Revert to keep-alive FALSE by default.
2664
2665 2018-01-17  Zan Dobersek  <zdobersek@igalia.com>
2666
2667         [Cairo] Move prepareForFilling(), prepareForStroking() code to CairoOperations
2668         https://bugs.webkit.org/show_bug.cgi?id=181721
2669
2670         Reviewed by Carlos Garcia Campos.
2671
2672         Move the prepareForFilling() and prepareForStroking() code off of the
2673         PlatformContextCairo class and into static functions inside the
2674         CairoOperations implementation files. The original methods weren't
2675         called from any place other than the Cairo operations, and they only
2676         operated with the cairo_t object that's stored in and retrievable from
2677         the PlatformContextCairo object.
2678
2679         No new tests -- no change in behavior.
2680
2681         * platform/graphics/cairo/CairoOperations.cpp:
2682         (WebCore::Cairo::reduceSourceByAlpha):
2683         (WebCore::Cairo::prepareCairoContextSource):
2684         (WebCore::Cairo::clipForPatternFilling):
2685         (WebCore::Cairo::prepareForFilling):
2686         (WebCore::Cairo::prepareForStroking):
2687         (WebCore::Cairo::drawPathShadow):
2688         (WebCore::Cairo::fillCurrentCairoPath):
2689         (WebCore::Cairo::strokeRect):
2690         (WebCore::Cairo::strokePath):
2691         (WebCore::Cairo::drawGlyphs):
2692         * platform/graphics/cairo/PlatformContextCairo.cpp:
2693         (WebCore::reduceSourceByAlpha): Deleted.
2694         (WebCore::prepareCairoContextSource): Deleted.
2695         (WebCore::PlatformContextCairo::prepareForFilling): Deleted.
2696         (WebCore::PlatformContextCairo::prepareForStroking): Deleted.
2697         (WebCore::PlatformContextCairo::clipForPatternFilling): Deleted.
2698         * platform/graphics/cairo/PlatformContextCairo.h:
2699
2700 2018-01-17  Zan Dobersek  <zdobersek@igalia.com>
2701
2702         [Cairo] Use one-time ShadowBlur objects when performing shadowing
2703         https://bugs.webkit.org/show_bug.cgi?id=181720
2704
2705         Reviewed by Carlos Garcia Campos.
2706
2707         Don't maintain a ShadowBlur object in the PlatformContextCairo class.
2708         Instead, use temporary ShadowBlur objects whenever shadowing is needed,
2709         providing all the shadow state information to it and drawing shadow into
2710         the given GraphicsContext object.
2711
2712         ShadowBlur constructors are cleaned up. The 'shadows ignored' argument
2713         can now also be provided to the variant that accepts explicit shadow
2714         attributes, but the argument is false by default.
2715
2716         In CairoOperations, the ShadowBlurUsage functionality is rolled into the
2717         new ShadowState class. ShadowState parameter is now used for operations
2718         that might need to perform shadow painting. Call sites are modified
2719         accordingly.
2720
2721         Cairo::State::setShadowValues() and Cairo::State::clearShadow() are
2722         removed, since the ShadowBlur object that was modified through those is
2723         being removed from the PlatformContextCairo class. We still have to flip
2724         the Y-axis of the shadow offset in GraphicsContext::setPlatformShadow()
2725         when shadows are ignoring transformations.
2726
2727         No new tests -- no change in behavior.
2728
2729         * platform/graphics/ShadowBlur.cpp:
2730         (WebCore::ShadowBlur::ShadowBlur):
2731         * platform/graphics/ShadowBlur.h:
2732         * platform/graphics/cairo/CairoOperations.cpp:
2733         (WebCore::Cairo::drawPathShadow):
2734         (WebCore::Cairo::drawGlyphsShadow):
2735         (WebCore::Cairo::ShadowState::ShadowState):
2736         (WebCore::Cairo::ShadowState::isVisible const):
2737         (WebCore::Cairo::ShadowState::isRequired const):
2738         (WebCore::Cairo::fillRect):
2739         (WebCore::Cairo::fillRoundedRect):
2740         (WebCore::Cairo::fillRectWithRoundedHole):
2741         (WebCore::Cairo::fillPath):
2742         (WebCore::Cairo::strokeRect):
2743         (WebCore::Cairo::strokePath):
2744         (WebCore::Cairo::drawGlyphs):
2745         (WebCore::Cairo::drawNativeImage):
2746         (WebCore::Cairo::State::setShadowValues): Deleted.
2747         (WebCore::Cairo::State::clearShadow): Deleted.
2748         (WebCore::Cairo::ShadowBlurUsage::ShadowBlurUsage): Deleted.
2749         (WebCore::Cairo::ShadowBlurUsage::required const): Deleted.
2750         * platform/graphics/cairo/CairoOperations.h:
2751         * platform/graphics/cairo/FontCairo.cpp:
2752         (WebCore::FontCascade::drawGlyphs):
2753         * platform/graphics/cairo/GraphicsContextCairo.cpp:
2754         (WebCore::GraphicsContext::restorePlatformState):
2755         (WebCore::GraphicsContext::drawNativeImage):
2756         (WebCore::GraphicsContext::fillPath):
2757         (WebCore::GraphicsContext::strokePath):
2758         (WebCore::GraphicsContext::fillRect):
2759         (WebCore::GraphicsContext::setPlatformShadow):
2760         (WebCore::GraphicsContext::clearPlatformShadow):
2761         (WebCore::GraphicsContext::strokeRect):
2762         (WebCore::GraphicsContext::platformFillRoundedRect):
2763         (WebCore::GraphicsContext::fillRectWithRoundedHole):
2764         * platform/graphics/cairo/PlatformContextCairo.cpp:
2765         (WebCore::PlatformContextCairo::drawSurfaceToContext):
2766         * platform/graphics/cairo/PlatformContextCairo.h:
2767         (WebCore::PlatformContextCairo::shadowBlur): Deleted.
2768         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
2769         (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::paintCurrentFrame):
2770
2771 2018-01-17  Zan Dobersek  <zdobersek@igalia.com>
2772
2773         CanvasImageData: createImageData() parameter should not be nullable
2774         https://bugs.webkit.org/show_bug.cgi?id=181670
2775
2776         Reviewed by Sam Weinig.
2777
2778         createImageData() method on the CanvasImageData interface should not
2779         treat the ImageData parameter as nullable, but should instead reject any
2780         null values with a TypeError, as demanded by the specification.
2781
2782         No new tests -- current tests covering createImageData(null) are updated
2783         to properly cover new behavior of throwing a TypeError exception.
2784
2785         * html/canvas/CanvasImageData.idl:
2786         * html/canvas/CanvasRenderingContext2DBase.cpp:
2787         (WebCore::CanvasRenderingContext2DBase::createImageData const):
2788         * html/canvas/CanvasRenderingContext2DBase.h:
2789
2790 2018-01-16  Fujii Hironori  <Hironori.Fujii@sony.com>
2791
2792         [CMake] Remove WebCoreDerivedSources library target
2793         https://bugs.webkit.org/show_bug.cgi?id=181664
2794
2795         Reviewed by Carlos Garcia Campos.
2796
2797         After unified source build has been introduced, CMake Visual
2798         Studio build suffers complicated unnecessary recompilation issues
2799         because Visual Studio invokes scripts twice in both WebCore and
2800         WebCoreDerivedSources projects (Bug 181117).
2801
2802         WebCoreDerivedSources library has been introduced in r198766 to
2803         avoid command line length limit of CMake Ninja build on macOS.
2804         Fortunately, unified source build has reduced the number of source
2805         files to compile, WebCore doesn't need to be split anymore.
2806
2807         No new tests (No behavior change)
2808
2809         * CMakeLists.txt: Replaced WebCore_DERIVED_SOURCES with WebCore_SOURCES. Removed WebCoreDerivedSources library target.
2810         Do not compile each JavaScript Builtins.cpp files because the unified source WebCoreJSBuiltins.cpp is already included.
2811         * PlatformGTK.cmake: Replaced WebCore_DERIVED_SOURCES with WebCore_SOURCES.
2812         * PlatformWin.cmake: Ditto.
2813
2814 2018-01-16  Simon Fraser  <simon.fraser@apple.com>
2815
2816         Can't scroll iframe after toggling it to display:none and back
2817         https://bugs.webkit.org/show_bug.cgi?id=181708
2818         rdar://problem/13234778
2819
2820         Reviewed by Tim Horton.
2821
2822         Nothing updated the FrameView's set of scrollable areas when a subframe came back from display:none.
2823         Mirror the existing virtual removeChild() by making addChild() virtual, and using it to mark
2824         the FrameView's scrollable area set as dirty.
2825
2826         Test: tiled-drawing/scrolling/non-fast-region/non-fast-scrollable-region-hide-show-iframe.html
2827
2828         * page/FrameView.cpp:
2829         (WebCore::FrameView::addChild):
2830         * page/FrameView.h:
2831         * platform/ScrollView.h:
2832
2833 2018-01-16  Chris Dumez  <cdumez@apple.com>
2834
2835         SWServerWorker::m_contextConnectionIdentifier may get out of date
2836         https://bugs.webkit.org/show_bug.cgi?id=181687
2837         <rdar://problem/36548111>
2838
2839         Reviewed by Brady Eidson.
2840
2841         SWServerWorker::m_contextConnectionIdentifier may get out of date. This happens when the
2842         context process crashes and is relaunched.
2843
2844         No new tests, added assertion in terminateWorkerInternal() that hits without this fix.
2845
2846         * workers/service/server/SWServer.cpp:
2847         (WebCore::SWServer::runServiceWorker):
2848         (WebCore::SWServer::terminateWorkerInternal):
2849         (WebCore::SWServer::unregisterServiceWorkerClient):
2850         * workers/service/server/SWServerWorker.h:
2851         (WebCore::SWServerWorker::setContextConnectionIdentifier):
2852
2853 2018-01-16  Jer Noble  <jer.noble@apple.com>
2854
2855         Reset MediaSourcePrivateAVFObjC's m_sourceBufferWithSelectedVideo when the underlying SourceBufferPrivate is removed.
2856         https://bugs.webkit.org/show_bug.cgi?id=181707
2857         <rdar://problem/34809474>
2858
2859         Reviewed by Eric Carlson.
2860
2861         Test: media/media-source/media-source-remove-unload-crash.html
2862
2863         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
2864         (WebCore::MediaSourcePrivateAVFObjC::removeSourceBuffer):
2865
2866 2018-01-12  Jiewen Tan  <jiewen_tan@apple.com>
2867
2868         [WebAuthN] Implement dummy WebAuthN IDLs
2869         https://bugs.webkit.org/show_bug.cgi?id=181627
2870         <rdar://problem/36459864>
2871
2872         Reviewed by Alex Christensen.
2873
2874         This patch implements dummy WebAuthN IDLs and connect them with Credential Management as well.
2875         All implementations in this patch are subject to change when real implementations land. The
2876         purpose here on the other hand is to have IDLs, bindings and implementations connected. This
2877         patch should handle all IDLs that we need.
2878
2879         No tests.
2880
2881         * CMakeLists.txt:
2882         * DerivedSources.make:
2883         * Modules/credentialmanagement/CredentialCreationOptions.h:
2884         * Modules/credentialmanagement/CredentialCreationOptions.idl:
2885         * Modules/credentialmanagement/CredentialRequestOptions.h:
2886         * Modules/credentialmanagement/CredentialRequestOptions.idl:
2887         * Modules/webauthn/AuthenticatorAssertionResponse.cpp: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.cpp.
2888         (WebCore::AuthenticatorAssertionResponse::AuthenticatorAssertionResponse):
2889         (WebCore::AuthenticatorAssertionResponse::~AuthenticatorAssertionResponse):
2890         (WebCore::AuthenticatorAssertionResponse::authenticatorData):
2891         (WebCore::AuthenticatorAssertionResponse::signature):
2892         (WebCore::AuthenticatorAssertionResponse::userHandle):
2893         * Modules/webauthn/AuthenticatorAssertionResponse.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialRequestOptions.h.
2894         * Modules/webauthn/AuthenticatorAssertionResponse.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl.
2895         * Modules/webauthn/AuthenticatorAttestationResponse.cpp: Copied from Source/WebCore/Modules/credentialmanagement/CredentialCreationOptions.h.
2896         (WebCore::AuthenticatorAttestationResponse::AuthenticatorAttestationResponse):
2897         (WebCore::AuthenticatorAttestationResponse::~AuthenticatorAttestationResponse):
2898         (WebCore::AuthenticatorAttestationResponse::attestationObject):
2899         * Modules/webauthn/AuthenticatorAttestationResponse.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialRequestOptions.h.
2900         * Modules/webauthn/AuthenticatorAttestationResponse.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl.
2901         * Modules/webauthn/AuthenticatorResponse.cpp: Copied from Source/WebCore/Modules/credentialmanagement/CredentialCreationOptions.h.
2902         (WebCore::AuthenticatorResponse::AuthenticatorResponse):
2903         (WebCore::AuthenticatorResponse::~AuthenticatorResponse):
2904         (WebCore::AuthenticatorResponse::clientDataJSON):
2905         * Modules/webauthn/AuthenticatorResponse.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialRequestOptions.h.
2906         * Modules/webauthn/AuthenticatorResponse.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl.
2907         * Modules/webauthn/PublicKeyCredential.cpp:
2908         (WebCore::PublicKeyCredential::rawId):
2909         (WebCore::PublicKeyCredential::response):
2910         (WebCore::PublicKeyCredential::getClientExtensionResults):
2911         (WebCore::PublicKeyCredential::isUserVerifyingPlatformAuthenticatorAvailable):
2912         * Modules/webauthn/PublicKeyCredential.h:
2913         * Modules/webauthn/PublicKeyCredential.idl:
2914         * Modules/webauthn/PublicKeyCredentialCreationOptions.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialRequestOptions.h.
2915         * Modules/webauthn/PublicKeyCredentialCreationOptions.idl: Added.
2916         * Modules/webauthn/PublicKeyCredentialDescriptor.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialCreationOptions.h.
2917         * Modules/webauthn/PublicKeyCredentialDescriptor.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl.
2918         * Modules/webauthn/PublicKeyCredentialRequestOptions.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialCreationOptions.h.
2919         * Modules/webauthn/PublicKeyCredentialRequestOptions.idl: Copied from Source/WebCore/Modules/credentialmanagement/CredentialRequestOptions.h.
2920         * Modules/webauthn/PublicKeyCredentialType.h: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl.
2921         * Modules/webauthn/PublicKeyCredentialType.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl.
2922         * Sources.txt:
2923         * WebCore.xcodeproj/project.pbxproj:
2924         * bindings/js/WebCoreBuiltinNames.h:
2925
2926 2018-01-16  Zalan Bujtas  <zalan@apple.com>
2927
2928         AX: Do not trigger layout in updateBackingStore() unless it is safe to do so
2929         https://bugs.webkit.org/show_bug.cgi?id=181703
2930         <rdar://problem/36365706>
2931
2932         Reviewed by Ryosuke Niwa.
2933
2934         Document::isSafeToUpdateStyleOrLayout() can tell whether it is safe to run layout.
2935
2936         Unable to create test with WebInspector involved. 
2937
2938         * accessibility/AccessibilityObject.cpp:
2939         (WebCore::AccessibilityObject::updateBackingStore):
2940         * dom/Document.cpp:
2941         (WebCore::Document::isSafeToUpdateStyleOrLayout const):
2942         (WebCore::Document::updateStyleIfNeeded):
2943         (WebCore::Document::updateLayout):
2944         (WebCore::isSafeToUpdateStyleOrLayout): Deleted.
2945         * dom/Document.h:
2946
2947 2018-01-16  Ryan Haddad  <ryanhaddad@apple.com>
2948
2949         Unreviewed, rolling out r226962.
2950
2951         The LayoutTest added with this change is a flaky timeout.
2952
2953         Reverted changeset:
2954
2955         "Support for preconnect Link headers"
2956         https://bugs.webkit.org/show_bug.cgi?id=181657
2957         https://trac.webkit.org/changeset/226962
2958
2959 2018-01-16  Simon Fraser  <simon.fraser@apple.com>
2960
2961         Text looks bad on some CSS spec pages
2962         https://bugs.webkit.org/show_bug.cgi?id=181700
2963         rdar://problem/36552107
2964
2965         Reviewed by Tim Horton.
2966
2967         When making new tiles in a TileController, we failed to set their "supports antialiased layer text"
2968         setting, so tile caches could end up with a mixture of layers that do and do not support
2969         antialiased layer text.
2970
2971         No tests because the tiled drawing tests don't dump out tiles inside of tile caches.
2972
2973         * platform/graphics/ca/TileController.cpp:
2974         (WebCore::TileController::createTileLayer):
2975
2976 2018-01-16  Said Abou-Hallawa  <sabouhallawa@apple.com>
2977
2978         REGRESSION(r221292): svg/animations/animateTransform-pattern-transform.html crashes with security assertion
2979         https://bugs.webkit.org/show_bug.cgi?id=179986
2980
2981         Reviewed by Simon Fraser.
2982
2983         This patch reverts all or parts of the following changes-sets
2984             <http://trac.webkit.org/changeset/221292>
2985             <http://trac.webkit.org/changeset/197967>
2986             <http://trac.webkit.org/changeset/196670>
2987
2988         A JS statement like this:
2989             var item = text.x.animVal.getItem(0);
2990
2991         Creates the following C++ objects:
2992             SVGAnimatedListPropertyTearOff<SVGLengthListValues> for 'text.x'
2993             SVGListPropertyTearOff<SVGLengthListValues> for 'text.x.animVal'
2994             SVGPropertyTearOff<SVGLengthValue> for 'text.x.animVal.getItem(0)'
2995
2996         If 'item' changes, the attribute 'x' of the element '<text>' will change
2997         as well. But this binding works only in one direction. If the attribute
2998         'x' of the element '<text>' changes, e.g.:
2999
3000             text.setAttribute('x', '10,20,30');
3001
3002         This will detach 'item' from the element <text> and any further changes 
3003         in 'item' won't affect the attribute 'x' of element <text>.
3004
3005         The one direction binding can only work if this chain of tear-off objects
3006         is kept connected. This is implemented by RefCounted back pointers from
3007         SVGPropertyTearOff and SVGListPropertyTearOff to SVGAnimatedListPropertyTearOff.
3008
3009         The security crashes and the memory leaks are happening because of the
3010         raw forward pointers:
3011             -- SVGAnimatedListPropertyTearOff maintains raw pointers of type
3012                SVGListPropertyTearOff for m_baseVal and m_animVal
3013             -- The m_wrappers and m_animatedWrappers of SVGAnimatedListPropertyTearOff
3014                are vectors of raw pointer Vector<SVGLength*>
3015
3016         To control the life cycle of the raw pointers, SVGListPropertyTearOff and
3017         SVGPropertyTearOff call SVGAnimatedListPropertyTearOff::propertyWillBeDeleted()
3018         to notify it they are going to be deleted. In propertyWillBeDeleted(), we
3019         clear the pointers so they are not used after being freed. This mechanism
3020         has been error-prone and we've never got it 100% right.
3021
3022         The solution we need to adopt with SVG tear-off objects is the following:
3023             -- All the forward pointers should be weak pointers.
3024             -- All the back pointers should be ref pointers.
3025
3026         This solution may not look intuitive but it solves the bugs and keeps the
3027         one direction binding. The forward weak pointers allows the tear-off
3028         objects to go aways if no reference from JS exists. The back ref pointers
3029         maintains the chain of objects and guarantees the correct binding.
3030
3031         * svg/SVGPathSegList.h:
3032         * svg/SVGTransformList.h:
3033         * svg/properties/SVGAnimatedListPropertyTearOff.h:
3034         (WebCore::SVGAnimatedListPropertyTearOff::baseVal):
3035         (WebCore::SVGAnimatedListPropertyTearOff::animVal):
3036         * svg/properties/SVGAnimatedPathSegListPropertyTearOff.h:
3037         * svg/properties/SVGAnimatedProperty.h:
3038         (WebCore::SVGAnimatedProperty::isAnimatedListTearOff const):
3039         (WebCore::SVGAnimatedProperty::propertyWillBeDeleted): Deleted.
3040         * svg/properties/SVGAnimatedPropertyTearOff.h:
3041         * svg/properties/SVGAnimatedTransformListPropertyTearOff.h:
3042         * svg/properties/SVGListProperty.h:
3043         (WebCore::SVGListProperty::initializeValuesAndWrappers):
3044         (WebCore::SVGListProperty::getItemValuesAndWrappers):
3045         (WebCore::SVGListProperty::insertItemBeforeValuesAndWrappers):
3046         (WebCore::SVGListProperty::replaceItemValuesAndWrappers):
3047         (WebCore::SVGListProperty::removeItemValuesAndWrappers):
3048         (WebCore::SVGListProperty::appendItemValuesAndWrappers):
3049         (WebCore::SVGListProperty::createWeakPtr const):
3050         * svg/properties/SVGListPropertyTearOff.h:
3051         (WebCore::SVGListPropertyTearOff::removeItemFromList):
3052         (WebCore::SVGListPropertyTearOff::~SVGListPropertyTearOff): Deleted.
3053         * svg/properties/SVGPropertyTearOff.h:
3054         (WebCore::SVGPropertyTearOff::createWeakPtr const):
3055         (WebCore::SVGPropertyTearOff::~SVGPropertyTearOff):
3056
3057 2018-01-16  Eric Carlson  <eric.carlson@apple.com>
3058
3059         AVSampleBufferDisplayLayer should be flushed when application activates
3060         https://bugs.webkit.org/show_bug.cgi?id=181623
3061         <rdar://problem/36487738>
3062
3063         Reviewed by Darin Adler.
3064
3065         No new tests, I wasn't able to reproduce it in a test.
3066
3067         * WebCore.xcodeproj/project.pbxproj:
3068         * dom/Document.cpp:
3069         (WebCore::Document::addApplicationStateChangeListener): New.
3070         (WebCore::Document::removeApplicationStateChangeListener): Ditto.
3071         (WebCore::Document::forEachApplicationStateChangeListener): Ditto.
3072         * dom/Document.h:
3073
3074         * html/HTMLMediaElement.cpp:
3075         (WebCore::HTMLMediaElement::registerWithDocument): Register for application state changes.
3076         (WebCore::HTMLMediaElement::unregisterWithDocument): Unregister.
3077         (WebCore::HTMLMediaElement::applicationWillResignActive): Pass through to the player.
3078         (WebCore::HTMLMediaElement::applicationDidBecomeActive): Ditto.
3079         * html/HTMLMediaElement.h:
3080
3081         * page/ApplicationStateChangeListener.h: Added.
3082         (WebCore::ApplicationStateChangeListener::applicationWillResignActive):
3083         (WebCore::ApplicationStateChangeListener::applicationDidBecomeActive):
3084         * page/Page.cpp:
3085         (WebCore::Page::forEachDocument):
3086         (WebCore::Page::applicationWillResignActive):
3087         (WebCore::Page::applicationDidEnterBackground):
3088         (WebCore::Page::applicationWillEnterForeground):
3089         (WebCore::Page::applicationDidBecomeActive):
3090         * page/Page.h:
3091         * platform/graphics/MediaPlayer.cpp:
3092         (WebCore::MediaPlayer::applicationWillResignActive):
3093         (WebCore::MediaPlayer::applicationDidBecomeActive):
3094         * platform/graphics/MediaPlayer.h:
3095         * platform/graphics/MediaPlayerPrivate.h:
3096         (WebCore::MediaPlayerPrivateInterface::applicationWillResignActive):
3097         (WebCore::MediaPlayerPrivateInterface::applicationDidBecomeActive):
3098
3099         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
3100         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3101         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC): Switch
3102         to release logging.
3103         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::~MediaPlayerPrivateMediaStreamAVFObjC): Ditto.
3104         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueCorrectedVideoSample): Split out of enqueueVideoSample.
3105         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample): Move code that updates
3106         the display later to enqueueCorrectedVideoSample. Rearrange logic to the image painter sample
3107         buffer has the correct timestamp.
3108         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::layerErrorDidChange): Switch to release logging.
3109         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::layerStatusDidChange): Ditto.
3110         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::applicationDidBecomeActive): f the display
3111         layer is in the "failed" state, flush the renderer and update the display mode.
3112         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayers): Switch to release logging.
3113         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::load): Ditto.
3114         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::cancelLoad): Ditto.
3115         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::prepareToPlay): Ditto.
3116         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateDisplayMode): Ditto.
3117         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::play): Ditto.
3118         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::pause): Ditto.
3119         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVolume): Ditto.
3120         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setMuted): Ditto.
3121         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateReadyState) Ditto.:
3122         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::logChannel const): Ditto.
3123         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateSampleTimes): Deleted.
3124
3125 2018-01-16  Michael Catanzaro  <mcatanzaro@igalia.com>
3126
3127         PAL should link to JavaScriptCore rather than WTF
3128         https://bugs.webkit.org/show_bug.cgi?id=181683
3129
3130         Reviewed by Konstantin Tokarev.
3131
3132         Do not link directly to JavaScriptCore. Get it via PAL.
3133
3134         * CMakeLists.txt:
3135
3136 2018-01-16  Zach Li  <zachli@apple.com>
3137
3138         Add pop-up policy support in website policies.
3139         https://bugs.webkit.org/show_bug.cgi?id=181544.
3140         rdar://problem/30521400.
3141
3142         Reviewed by Alex Christensen.
3143
3144         * loader/DocumentLoader.h:
3145         Introduce pop-up policy getter and setter. Initialize
3146         the policy as Default.
3147         (WebCore::DocumentLoader::popUpPolicy const):
3148         (WebCore::DocumentLoader::setPopUpPolicy):
3149         * page/DOMWindow.cpp:
3150         (WebCore::DOMWindow::allowPopUp):
3151         Pop-up policy specified on a per-page basis holds
3152         precedence over the global policy. If no pop-up policy
3153         is specified during navigation, global policy is used.
3154
3155 2018-01-16  Jer Noble  <jer.noble@apple.com>
3156
3157         Crash playing audio-only HLS stream via hls.js (MSE)
3158         https://bugs.webkit.org/show_bug.cgi?id=181691
3159         <rdar://problem/32967295>
3160
3161         Reviewed by Eric Carlson.
3162
3163         Add a weak-link check to the block called by -[AVSampleBufferDisplayLayer requestMediaDataWhenReadyOnQueue:usingBlock:].
3164
3165         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
3166         (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled):
3167         (WebCore::SourceBufferPrivateAVFObjC::notifyClientWhenReadyForMoreSamples):
3168         (WebCore::SourceBufferPrivateAVFObjC::setVideoLayer):
3169
3170 2018-01-16  Simon Fraser  <simon.fraser@apple.com>
3171
3172         Rename applyHorizontalScale/applyVerticalScale in SVG filters, and related cleanup
3173         https://bugs.webkit.org/show_bug.cgi?id=181684
3174
3175         Reviewed by Alex Christensen.
3176
3177         Rename the confusing applyHorizontalScale/applyVerticalScale to scaledByFilterResolution(),
3178         and have it take and return a FloatSize. Change callers to do math in terms of FloatSizes.
3179
3180         Add inflate(size) to each of the rect classes.
3181
3182         * platform/graphics/FloatRect.h:
3183         (WebCore::FloatRect::inflate):
3184         * platform/graphics/IntRect.h:
3185         (WebCore::IntRect::inflate):
3186         * platform/graphics/LayoutRect.h:
3187         (WebCore::LayoutRect::inflate):
3188         * platform/graphics/filters/FEDisplacementMap.cpp:
3189         (WebCore::FEDisplacementMap::platformApplySoftware):
3190         * platform/graphics/filters/FEDropShadow.cpp:
3191         (WebCore::FEDropShadow::determineAbsolutePaintRect):
3192         (WebCore::FEDropShadow::platformApplySoftware):
3193         * platform/graphics/filters/FEGaussianBlur.cpp:
3194         (WebCore::FEGaussianBlur::calculateUnscaledKernelSize):
3195         (WebCore::FEGaussianBlur::calculateKernelSize):
3196         (WebCore::FEGaussianBlur::determineAbsolutePaintRect):
3197         (WebCore::FEGaussianBlur::platformApplySoftware):
3198         * platform/graphics/filters/FEGaussianBlur.h:
3199         * platform/graphics/filters/FEMorphology.cpp:
3200         (WebCore::FEMorphology::determineAbsolutePaintRect):
3201         (WebCore::FEMorphology::platformApplySoftware):
3202         * platform/graphics/filters/FEOffset.cpp:
3203         (WebCore::FEOffset::determineAbsolutePaintRect):
3204         (WebCore::FEOffset::platformApplySoftware):
3205         * platform/graphics/filters/Filter.h:
3206         (WebCore::Filter::setSourceImage):
3207         (WebCore::Filter::scaledByFilterResolution const):
3208         (WebCore::Filter::applyHorizontalScale const): Deleted.
3209         (WebCore::Filter::applyVerticalScale const): Deleted.
3210         * platform/graphics/filters/FilterOperations.cpp:
3211         (WebCore::outsetSizeForBlur):
3212         * rendering/FilterEffectRenderer.h:
3213         * svg/graphics/filters/SVGFilter.cpp:
3214         (WebCore::SVGFilter::scaledByFilterResolution const):
3215         (WebCore::SVGFilter::applyHorizontalScale const): Deleted.
3216         (WebCore::SVGFilter::applyVerticalScale const): Deleted.
3217         * svg/graphics/filters/SVGFilter.h:
3218
3219 2018-01-16  Fujii Hironori  <Hironori.Fujii@sony.com>
3220
3221         [CMake][Mac] Fix the build errors
3222         https://bugs.webkit.org/show_bug.cgi?id=181665
3223
3224         Reviewed by Alex Christensen.
3225
3226         No new tests (No behavior change)
3227
3228         * CMakeLists.txt: Added Modules/paymentrequest/MerchantValidationEvent.idl to compile.
3229         * PlatformMac.cmake: Added Modules/paymentrequest/MerchantValidationEvent.cpp to compile.
3230         Added workers/service/context and Modules/applicationmanifest as forwarding header paths.
3231
3232 2018-01-16  Wenson Hsieh  <wenson_hsieh@apple.com>
3233
3234         [Attachment Support] Provide the `src` of an attachment to the UI delegate when an attachment is inserted
3235         https://bugs.webkit.org/show_bug.cgi?id=181638
3236         <rdar://problem/36508702>
3237
3238         Reviewed by Dan Bernstein.
3239
3240         Adjust the `didInsertAttachment` codepath to additionally propagate the attachment element's `src`.
3241         Additionally, fix an issue with insertion and removal client notifications wherein the client can receive
3242         insertion calls without corresponding removal calls, or vice versa. This is an existing issue, but matters more
3243         now because we actually need to access the attachment element for its `src` when propagating changes to the
3244         client. See below for details.
3245
3246         Test: WKAttachmentTests.AttachmentUpdatesWhenInsertingRichMarkup
3247
3248         * dom/Document.h:
3249         (WebCore::Document::attachmentElementsByIdentifier const):
3250         * editing/Editor.cpp:
3251         (WebCore::Editor::notifyClientOfAttachmentUpdates):
3252         * page/EditorClient.h:
3253         (WebCore::EditorClient::didInsertAttachment):
3254         * page/Frame.cpp:
3255         (WebCore::Frame::setDocument):
3256
3257         When a Frame's document changes, inform the client that the attachments in the previous document are going away.
3258         For each attachment currently connected to the document, we have either (1) already informed the client that it
3259         was inserted, or (2) the attachment is pending an insertion call to the client. If (1) is the case, then we'll
3260         tell the client that the attachment is removed, which will balance out the earlier insertion call. If (2) is the
3261         case, then we'll remove the previously inserted attachment identifier from the set of attachment identifiers
3262         pending insertion, and the client won't be informed of insertions or removals.
3263
3264 2018-01-16  Antoine Quint  <graouts@apple.com>
3265
3266         Use traits for animation timing functions
3267         https://bugs.webkit.org/show_bug.cgi?id=181651
3268
3269         Reviewed by Dean Jackson.
3270
3271         Cleaning up Dean's previous patch as suggested by Darin's post-commit review comments. The
3272         downcast function can match const automatically and it's a better style to put the * inside
3273         the downcast call rather than outside.
3274
3275         * css/CSSComputedStyleDeclaration.cpp:
3276         (WebCore::createTimingFunctionValue):
3277         * platform/animation/TimingFunction.cpp:
3278         (WebCore::operator<<):
3279         (WebCore::TimingFunction::transformTime const):
3280         * platform/animation/TimingFunction.h:
3281         * platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm:
3282         (WebCore::toCAMediaTimingFunction):
3283
3284 2018-01-16  Philippe Normand  <pnormand@igalia.com>
3285
3286         [GStreamer] Live streaming cleanups
3287         https://bugs.webkit.org/show_bug.cgi?id=181672
3288
3289         Reviewed by Michael Catanzaro.
3290
3291         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3292         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Switch to
3293         streaming code path when no content-length was reported by the
3294         http source element.
3295         (WebCore::MediaPlayerPrivateGStreamer::totalBytes const): Return early when streaming.
3296         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
3297         (CachedResourceStreamingClient::responseReceived): Emit headers as
3298         an element message, like souphttpsrc.
3299
3300 2018-01-15  Philippe Normand  <pnormand@igalia.com>
3301
3302         [GStreamer] misc fixes and cleanups
3303         https://bugs.webkit.org/show_bug.cgi?id=181647
3304
3305         Reviewed by Michael Catanzaro.
3306
3307         * platform/graphics/MediaPlayer.cpp:
3308         (WebCore::convertEnumerationToString): New utility function to convert preload enum to string.
3309         * platform/graphics/MediaPlayerEnums.h: Ditto.
3310         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3311         (WebCore::MediaPlayerPrivateGStreamer::load): Debug tweak
3312         (WebCore::MediaPlayerPrivateGStreamer::prepareToPlay): Ditto
3313         (WebCore::MediaPlayerPrivateGStreamer::play): Ditto
3314         (WebCore::MediaPlayerPrivateGStreamer::paused const): Ditto
3315         (WebCore::MediaPlayerPrivateGStreamer::processBufferingStats): Prevent useless state update.
3316         (WebCore::MediaPlayerPrivateGStreamer::fillTimerFired): Ditto.
3317         (WebCore::MediaPlayerPrivateGStreamer::updateStates): Debug tweak.
3318         (WebCore::MediaPlayerPrivateGStreamer::setDownloadBuffering): Ditto.
3319         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
3320         Remove useless handlesSyncMessage method.
3321         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3322         (WebCore::MediaPlayerPrivateGStreamerBase::setMuted): Prevent useless state update.
3323         (WebCore::MediaPlayerPrivateGStreamerBase::muted const): Debug tweak.
3324         (WebCore::MediaPlayerPrivateGStreamerBase::setStreamVolumeElement): Ditto.
3325         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
3326         (webkit_web_src_init): Enable keepAlive by default like in souphttpsrc.
3327         (webKitWebSrcStart): Debug tweak.
3328         (webKitWebSrcQueryWithParent): Ditto.
3329         (webKitWebSrcNeedData): Ditto.
3330         (CachedResourceStreamingClient::responseReceived): Change appsrc
3331         stream-type when we wan't seek. Also update caps like souphttpsrc
3332         does.
3333         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.h: Add forward declaration of MediaPlayer.
3334         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
3335         (WebCore::MediaSourceClientGStreamerMSE::append): Fix compilation warning.
3336
3337 2018-01-16  Yacine Bandou  <yacine.bandou_ext@softathome.com>
3338
3339         [WPE] Two clearkey tests failing since r226621
3340         https://bugs.webkit.org/show_bug.cgi?id=181532
3341
3342         Reviewed by Xabier Rodriguez-Calvar.
3343
3344         Whith a fake initData, we can have a pssh size nul, thus we should check it.
3345         We saw this issue in the subtest "initData longer than 64Kb characters" in
3346         the clearkey-generate-request-disallowed-input layout test.
3347
3348         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
3349         (WebCore::extractKeyidsLocationFromCencInitData):
3350
3351 2018-01-15  Yoav Weiss  <yoav@yoav.ws>
3352
3353         Support for preconnect Link headers
3354         https://bugs.webkit.org/show_bug.cgi?id=181657
3355
3356         Reviewed by Darin Adler.
3357
3358         Move the preconnect functionality into its own function, and
3359         also call this function when Link headers are processed.
3360
3361         Test: http/tests/preconnect/link-header-rel-preconnect-http.php
3362
3363         * loader/LinkLoader.cpp:
3364         (WebCore::LinkLoader::loadLinksFromHeader): Call preconnect.
3365         (WebCore::LinkLoader::preconnect): Preconnect to a host functionality moved here.
3366         (WebCore::LinkLoader::preload): Renamed `preloadIfNeeded` to `preload`.