3ac2d6bafe3cb5ff1c9155f933daefc201c6128a
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-12-07  Brady Eidson  <beidson@apple.com>
2
3         Read registrations in from disk.
4         https://bugs.webkit.org/show_bug.cgi?id=180543
5
6         Reviewed by Andy Estes.
7
8         No new tests (Not testable quite yet)
9
10         On launch, read through the database.
11
12         Set up enough objects in the SWServer necessary to cause fetches and postMessages to
13         go to a worker that has never run before.
14
15         * workers/service/ServiceWorkerContextData.cpp:
16         (WebCore::ServiceWorkerContextData::isolatedCopy const):
17         * workers/service/ServiceWorkerContextData.h:
18         (WebCore::ServiceWorkerContextData::encode const):
19         (WebCore::ServiceWorkerContextData::decode):
20
21         * workers/service/ServiceWorkerRegistrationKey.cpp:
22         (WebCore::ServiceWorkerRegistrationKey::toDatabaseKey const):
23         (WebCore::ServiceWorkerRegistrationKey::fromDatabaseKey):
24         * workers/service/ServiceWorkerRegistrationKey.h:
25
26         * workers/service/server/RegistrationDatabase.cpp:
27         (WebCore::stringToUpdateViaCache):
28         (WebCore::stringToWorkerType):
29         (WebCore::RegistrationDatabase::doPushChanges):
30         (WebCore::RegistrationDatabase::importRecords):
31         (WebCore::RegistrationDatabase::addRegistrationToStore):
32         * workers/service/server/RegistrationDatabase.h:
33
34         * workers/service/server/RegistrationStore.cpp:
35         (WebCore::RegistrationStore::RegistrationStore):
36         (WebCore::RegistrationStore::addRegistrationFromDatabase):
37         * workers/service/server/RegistrationStore.h:
38
39         * workers/service/server/SWServer.cpp:
40         (WebCore::SWServer::addRegistrationFromStore):
41         (WebCore::SWServer::SWServer):
42         (WebCore::SWServer::updateWorker):
43         (WebCore::SWServer::tryInstallContextData):
44         (WebCore::SWServer::installContextData):
45         (WebCore::generateServiceWorkerIdentifier): Deleted.
46         * workers/service/server/SWServer.h:
47
48         * workers/service/server/SWServerRegistration.h:
49
50         * workers/service/server/SWServerWorker.cpp:
51         (WebCore::SWServerWorker::contextData const):
52
53 2017-12-07  Yusuke Suzuki  <utatane.tea@gmail.com>
54
55         Use WTF Locking primitives in WebThread and drop pthread_xxx use
56         https://bugs.webkit.org/show_bug.cgi?id=180445
57
58         Reviewed by Saam Barati.
59
60         We remove use of pthread locking primitives from WebThread implementation,
61         and use WTF Lock and Condition instead.
62
63         No behavior change.
64
65         * platform/ios/wak/WebCoreThread.mm:
66         (HandleDelegateSource):
67         (SendDelegateMessage):
68         (WebThreadRunOnMainThread):
69         (WebThreadAdoptAndRelease):
70         (WebCoreObjCDeallocOnWebThreadImpl):
71         (WebCoreObjCDeallocWithWebThreadLockImpl):
72         (HandleWebThreadReleaseSource):
73         (_WebThreadAutoLock):
74         (WebRunLoopLockInternal):
75         (CurrentThreadContext):
76         Use WTF::ThreadSpecific.
77
78         (StartWebThread):
79         (_WebThreadLock):
80         Remove `shouldTry` parameter since it is always `false`. We clean up code based on `shouldTry = false`,
81         and rename it from _WebTryThreadLock to _WebThreadLock since it does not try now.
82
83         (_WebThreadLockFromAnyThread):
84         (WebThreadUnlockFromAnyThread):
85         (_WebThreadUnlock):
86         (lockWebCoreReleaseLock): Deleted.
87         (unlockWebCoreReleaseLock): Deleted.
88         (WebTimedConditionLock): Deleted.
89         (_WebTryThreadLock): Deleted.
90
91 2017-12-07  Alex Christensen  <achristensen@webkit.org>
92
93         Fix API test after r225645.
94         https://bugs.webkit.org/show_bug.cgi?id=180544
95
96         * loader/FrameLoader.cpp:
97         (WebCore::FrameLoader::loadURL):
98         (WebCore::FrameLoader::loadWithDocumentLoader):
99         The API test WebKitLegacy.FragmentNavigation started failing after r225645.
100         It does call the completion handler with ignore to cancel fragment navigation.
101         To make this work and increase compatibility, only synchronously continue with
102         fragment navigations if we haven't received a synchronous answer to the
103         decidePolicyForNavigationAction callback.
104
105 2017-12-07  Oleksandr Skachkov  <gskachkov@gmail.com>
106
107         WebAssembly: sending module to iframe fails
108         https://bugs.webkit.org/show_bug.cgi?id=179263
109
110         Reviewed by JF Bastien.
111
112         Allow use WebAssembly.Module as input parameters for postMessage 
113         in window and iframe object.
114
115         Tests: wasm/iframe-postmessage.html
116                wasm/window-postmessage.html
117
118         * bindings/js/SerializedScriptValue.cpp:
119         (WebCore::CloneSerializer::dumpIfTerminal):
120         * bindings/js/SerializedScriptValue.h:
121         * page/DOMWindow.cpp:
122         (WebCore::DOMWindow::postMessage):
123
124 2017-12-07  Joseph Pecoraro  <pecoraro@apple.com>
125
126         Web Inspector: Fix style in remote inspector classes
127         https://bugs.webkit.org/show_bug.cgi?id=180545
128
129         Reviewed by Youenn Fablet.
130
131         * page/PageDebuggable.h:
132         * workers/service/context/ServiceWorkerDebuggable.h:
133
134 2017-12-07  Antti Koivisto  <antti@apple.com>
135
136         Move security origin filtering for getMatchedCSSRules out of StyleResolver
137         https://bugs.webkit.org/show_bug.cgi?id=180468
138
139         Reviewed by Zalan Bujtas.
140
141         The non-standard getMatchedCSSRules API should not return rules from stylesheets in different security origins.
142         To implement this we currently have lots of invasive code in StyleResolver, RuleSets and ElementRuleCollector
143         basically passing around a bit. This also makes RuleSets document specific blocking optimizations.
144
145         This patches replaces the mechanism with a bit in StyleRule which is much simpler.
146
147         * css/DocumentRuleSets.cpp:
148         (WebCore::makeRuleSet):
149         * css/ElementRuleCollector.cpp:
150         (WebCore::ElementRuleCollector::collectMatchingRulesForList):
151         * css/ElementRuleCollector.h:
152         (WebCore::ElementRuleCollector::setPseudoStyleRequest):
153         (WebCore::ElementRuleCollector::setSameOriginOnly): Deleted.
154         * css/RuleFeature.cpp:
155         (WebCore::RuleFeatureSet::collectFeatures):
156         * css/RuleFeature.h:
157         (WebCore::RuleFeature::RuleFeature):
158         * css/RuleSet.cpp:
159         (WebCore::RuleData::RuleData):
160         (WebCore::RuleSet::addRule):
161         (WebCore::RuleSet::addChildRules):
162         (WebCore::RuleSet::addRulesFromSheet):
163         (WebCore::RuleSet::addStyleRule):
164         * css/RuleSet.h:
165         (WebCore::RuleData::linkMatchType const):
166         (WebCore::RuleData::hasDocumentSecurityOrigin const): Deleted.
167         * css/StyleResolver.cpp:
168         (WebCore::StyleResolver::pseudoStyleRulesForElement):
169         * css/StyleResolver.h:
170         * css/StyleRule.cpp:
171         (WebCore::StyleRule::StyleRule):
172         (WebCore::StyleRule::createForSplitting):
173         (WebCore::StyleRule::splitIntoMultipleRulesWithMaximumSelectorComponentCount const):
174         (WebCore::StyleRule::create): Deleted.
175         * css/StyleRule.h:
176         (WebCore::StyleRuleBase::StyleRuleBase):
177         (WebCore::StyleRuleBase::hasDocumentSecurityOrigin const):
178
179             Add a bit.
180
181         * css/parser/CSSParser.cpp:
182         (WebCore::CSSParserContext::CSSParserContext):
183
184             Include hasDocumentSecurityOrigin bit to parser context. This means that a stylesheet data structures
185             can't be shared between a contexts where this differs. This likely very rare in practice.
186
187         (WebCore::operator==):
188         * css/parser/CSSParserImpl.cpp:
189         (WebCore::CSSParserImpl::consumeStyleRule):
190         * css/parser/CSSParserMode.h:
191         (WebCore::CSSParserContextHash::hash):
192         * editing/EditingStyle.cpp:
193         (WebCore::EditingStyle::mergeStyleFromRules):
194         * page/DOMWindow.cpp:
195         (WebCore::DOMWindow::getMatchedCSSRules const):
196
197             Filter out rules from different security origin after getting them from style resolver.
198
199 2017-12-07  Zalan Bujtas  <zalan@apple.com>
200
201         AX: Document::existingAXObjectCache() should always return the existing AXObjectCache.
202         https://bugs.webkit.org/show_bug.cgi?id=180548
203         <rdar://problem/35917755>
204
205         Reviewed by Chris Fleizach.
206
207         Currently the AX cache becomes unreachable through Document::existingAXObjectCache soon after the render tree is destroyed.
208         From this point, the Node objects can't deregister themselves from the AX cache anymore. In some cases, it's
209         redundant/not advised to notify the cache about certain changes when the document is being destroyed, but the
210         callsites should make that decision.
211
212         Covered by existing tests.
213
214         * dom/Document.cpp:
215         (WebCore::Document::existingAXObjectCacheSlow const):
216         * rendering/RenderElement.cpp:
217         (WebCore::RenderElement::takeChildInternal):
218
219 2017-12-07  Youenn Fablet  <youenn@apple.com>
220
221         Fix erroneous ASSERT in DocumentThreadableLoader::didFail
222         https://bugs.webkit.org/show_bug.cgi?id=180549
223
224         Reviewed by Alex Christensen.
225
226         * loader/DocumentThreadableLoader.cpp:
227         (WebCore::DocumentThreadableLoader::didFail): ASSERT was checking whether the optional was null.
228         This could never be the case since we move the value of the optional, not the optional itself.
229         Ensure that the optional value is null so that we are sure request is being loaded and make the optional null just after that.
230
231 2017-12-07  Ryosuke Niwa  <rniwa@webkit.org>
232
233         iOS: Many AMP pages crash inside Document::updateStyleIfNeeded
234         https://bugs.webkit.org/show_bug.cgi?id=180550
235         <rdar://problem/35410390>
236
237         Reviewed by Zalan Bujtas.
238
239         The crash was caused when updatign the layout of an non-flattened frame inside a flattened frame.
240         In those cases, isInChildFrameWithFrameFlattening is false on the inner frame.
241
242         No new tests for now.
243
244         * dom/NoEventDispatchAssertion.h:
245         * rendering/RenderFrameBase.cpp:
246         (WebCore::RenderFrameBase::performLayoutWithFlattening): Disable the assertion temporarily here.
247         In theory, we should be able to remove the check for isInChildFrameWithFrameFlattening but we err
248         on the safer side for now.
249
250 2017-12-07  Alex Christensen  <achristensen@webkit.org>
251
252         Always synchronously continue with fragment navigations
253         https://bugs.webkit.org/show_bug.cgi?id=180544
254         <rdar://problem/34815986> and <rdar://problem/35126690>
255
256         Reviewed by Geoffrey Garen.
257
258         Test: http/tests/dom/document-fragment.html
259
260         When a decidePolicyForNavigationAction completionHandler is called asynchronously,
261         the document's URL has not changed yet when JavaScript execution continues.  This causes
262         significant web incompatibility because all browsers change the document's URL immediately
263         during fragment navigations.  In order to make WebKit applications more web compatible,
264         we now immediately continue to have the state consistent.  To keep compatibility with any
265         WebView, UIWebView, or WKWebView applications that use these delegate callbacks to update
266         state, we still call decidePolicyForNavigationAction.  This would break a theoretical app
267         that would cancel fragment navigations, but it fixes apps that continue fragment navigations
268         asynchronously.
269
270         * loader/FrameLoader.cpp:
271         (WebCore::FrameLoader::loadURL):
272         (WebCore::FrameLoader::loadWithDocumentLoader):
273
274 2017-12-07  Youenn Fablet  <youenn@apple.com>
275
276         Activate IDB and WebSockets in service workers
277         https://bugs.webkit.org/show_bug.cgi?id=180534
278
279         Reviewed by Brady Eidson.
280
281         Tests: http/tests/workers/service/serviceworker-idb.https.html
282                http/tests/workers/service/serviceworker-websocket.https.html
283
284         Using the dummy document used for loading to also fuel IDB and WebSocket.
285
286         * workers/service/context/ServiceWorkerThread.cpp:
287         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
288         * workers/service/context/ServiceWorkerThread.h:
289         * workers/service/context/ServiceWorkerThreadProxy.cpp:
290         (WebCore::idbConnectionProxy):
291         (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
292
293 2017-12-07  Matt Lewis  <jlewis3@apple.com>
294
295         Unreviewed, rolling out r225634.
296
297         This caused layout tests to time out.
298
299         Reverted changeset:
300
301         "Simplify log channel configuration UI"
302         https://bugs.webkit.org/show_bug.cgi?id=180527
303         https://trac.webkit.org/changeset/225634
304
305 2017-12-07  Jer Noble  <jer.noble@apple.com>
306
307         [EME] Support the 'encrypted' event for FPS encrypted streams
308         https://bugs.webkit.org/show_bug.cgi?id=180480
309
310         Reviewed by Eric Carlson.
311
312         Test: platform/mac/media/encrypted-media/fps-encrypted-event.html
313
314         Pass initData and initDataType up to HTMLMediaElement from SourceBufferPrivateAVFObjC.
315
316         Drive-by fix: initialize the initData and initDataType values of MediaEncryptedEvent from
317         values in its initializer struct.
318
319         * html/HTMLMediaElement.cpp:
320         (WebCore::HTMLMediaElement::mediaPlayerKeyNeeded):
321         (WebCore::HTMLMediaElement::mediaPlayerInitializationDataEncountered):
322         * html/MediaEncryptedEvent.cpp:
323         (WebCore::MediaEncryptedEvent::MediaEncryptedEvent):
324         (WebCore::MediaEncryptedEvent::initDataType): Deleted.
325         (WebCore::MediaEncryptedEvent::initData): Deleted.
326         * html/MediaEncryptedEvent.h:
327         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
328         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
329         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmInstanceAttached):
330         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
331         (WebCore::SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID):
332
333 2017-12-07  Myles C. Maxfield  <mmaxfield@apple.com>
334
335         [Cocoa] Add SPI to disallow user-installed fonts
336         https://bugs.webkit.org/show_bug.cgi?id=180062
337         <rdar://problem/35042408>
338
339         Reviewed by Simon Fraser.
340
341         This hooks up a WK2 preference, ShouldDisallowUserInstalledFonts, to our font selection
342         code. This preference works by specifying an attribute to our font selection code which
343         will prohibit user-installed fonts from ever being selected. This works both to disallow
344         newly installed fonts, as well as disallowing user-installed fonts which "shadow" (or
345         have the same name as) existing fonts, so that the existing font is selected instead.
346
347         The goal of this setting is to decrease the fingerprinting surface area which trackers
348         can use to identify users on the open Web.
349
350         Tests: fast/text/user-installed-font.html
351                fast/text/user-installed-fonts/disable.html
352                fast/text/user-installed-fonts/shadow-disable.html
353                fast/text/user-installed-fonts/shadow-family-disable.html
354                fast/text/user-installed-fonts/shadow-family.html
355                fast/text/user-installed-fonts/shadow-postscript-disable.html
356                fast/text/user-installed-fonts/shadow-postscript-family-disable.html
357                fast/text/user-installed-fonts/shadow-postscript-family.html
358                fast/text/user-installed-fonts/shadow-postscript.html
359                fast/text/user-installed-fonts/shadow.html
360
361         * css/CSSFontFaceSet.cpp:
362         (WebCore::CSSFontFaceSet::ensureLocalFontFacesForFamilyRegistered):
363         * css/StyleResolver.cpp:
364         (WebCore::StyleResolver::initializeFontStyle):
365         * page/Settings.yaml:
366         * platform/graphics/FontCache.h:
367         * platform/graphics/FontDescription.cpp:
368         (WebCore::FontDescription::FontDescription):
369         * platform/graphics/FontDescription.h:
370         (WebCore::FontDescription::mayRepresentUserInstalledFont const):
371         (WebCore::FontDescription::setMayRepresentUserInstalledFont):
372         (WebCore::FontDescription::operator== const):
373         * platform/graphics/cocoa/FontCacheCoreText.cpp:
374         (WebCore::FontDatabase::singleton):
375         (WebCore::FontDatabase::singletonAllowingUserInstalledFonts):
376         (WebCore::FontDatabase::singletonDisallowingUserInstalledFonts):
377         (WebCore::FontDatabase::collectionForFamily):
378         (WebCore::FontDatabase::fontForPostScriptName):
379         (WebCore::FontDatabase::FontDatabase):
380         (WebCore::FontCache::getFontSelectionCapabilitiesInFamily):
381         (WebCore::platformFontLookupWithFamily):
382         (WebCore::invalidateFontCache):
383         (WebCore::fontWithFamily):
384         * style/StyleResolveForDocument.cpp:
385         (WebCore::Style::resolveForDocument):
386         * testing/InternalSettings.cpp:
387         (WebCore::InternalSettings::setShouldDisallowUserInstalledFonts):
388         * testing/InternalSettings.h:
389         * testing/InternalSettings.idl:
390
391 2017-12-07  David Quesada  <david_quesada@apple.com>
392
393         [Web App Manifest] Support display-mode media feature
394         https://bugs.webkit.org/show_bug.cgi?id=180376
395         rdar://problem/35837993
396
397         Reviewed by Geoffrey Garen.
398
399         Tests: applicationmanifest/display-mode-subframe.html
400                applicationmanifest/display-mode.html
401
402         * Modules/applicationmanifest/ApplicationManifest.h:
403         (WebCore::ApplicationManifest::encode const):
404         (WebCore::ApplicationManifest::decode):
405         * Modules/applicationmanifest/ApplicationManifestParser.cpp:
406         (WebCore::ApplicationManifestParser::parseManifest):
407         (WebCore::ApplicationManifestParser::parseDisplay):
408         * Modules/applicationmanifest/ApplicationManifestParser.h:
409             Add a 'display' property to ApplicationManifest and have ApplicationManifestParser
410             populate it by parsing the 'display' property from the raw manifest.
411
412         * css/CSSValueKeywords.in:
413         * css/MediaFeatureNames.h:
414         * css/MediaQueryEvaluator.cpp:
415         (WebCore::displayModeEvaluate):
416             To evaluate whether a display-mode query matches, compare the parameter to the
417             display mode of the manifest applied to the main frame. If there is no manifest,
418             use the fallback display mode 'browser' - the spec mandates that display-mode
419             must be exposed even if there is no applied manifest.
420         * css/MediaQueryExpression.cpp:
421         (WebCore::featureWithValidIdent):
422         (WebCore::isFeatureValidWithoutValue):
423
424 2017-12-07  Jer Noble  <jer.noble@apple.com>
425
426         Creating a second AVPlayerItemVideoOutput causes flakey failures
427         https://bugs.webkit.org/show_bug.cgi?id=177119
428         <rdar://problem/34507977>
429
430         Reviewed by Dean Jackson.
431
432         Rather than having two concurrent AVPlayerItemVideoOutputs when painting to OpenGL,
433         use only one, but with the OpenGL compatibility flags enabled, for both 3D and 2D
434         canvas painting.
435
436         Of course, once this is fixed, the test breaks again because VideoTextureCopierCV is
437         stomping on top of some WebGL state set by the test. Rather than expand the
438         VideoTextureCopierCV's GraphicsStateSaver, use a totally separate (but shared) GL context to
439         implement the texture copy, so that its own state will not affect the state of the WebGL
440         context.
441
442         This necessitates adding a new createShared() factory for GraphicsContext3D. Since this is only
443         used on Cocoa platforms (for now), make it platform specific, and modify the other implementations
444         only so far as to throw assertions if somehow a shared context pointer is passed into their
445         constructors.
446
447         Drive-by fixes: 
448
449         - These changes exposed some test failures, which were off-by-1-or-2 errors in the color
450         output of videos painted into WebGL contexts. The Y' parameter needs to be scaled by 16/255
451         for video-range conversions and the CbCr vales by 128/255 (rather than just 0.5). Make the
452         color transforms a full 4x4 matrix and do the scaling in the matrix rather than tracked by a
453         separate uniform.
454
455         - There was a slight error in WebCoreDecompressionSession that could cause seeks to never
456         complete because incoming frames would be skipped if their startTime was in the past
457         (rather than their startTime + duration being in the past).
458
459         - The matrix name comparison should use CFEqual rather than pointer equality to test.
460
461         - iOS currently has a bug where the red and green color channels will be reversed when
462         uploading BGRA pixel formatted data to a texture; work around this bug for now.
463
464         * platform/graphics/GraphicsContext3D.h:
465         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
466         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
467         (WebCore::MediaPlayerPrivateAVFoundationObjC::destroyContextVideoRenderer):
468         (WebCore::MediaPlayerPrivateAVFoundationObjC::hasAvailableVideoFrame const):
469         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastPixelBuffer):
470         (WebCore::MediaPlayerPrivateAVFoundationObjC::videoOutputHasAvailableFrame):
471         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastImage):
472         (WebCore::MediaPlayerPrivateAVFoundationObjC::paintWithVideoOutput):
473         (WebCore::MediaPlayerPrivateAVFoundationObjC::copyVideoTextureToPlatformTexture):
474         (WebCore::MediaPlayerPrivateAVFoundationObjC::nativeImageForCurrentTime):
475         (WebCore::MediaPlayerPrivateAVFoundationObjC::waitForVideoOutputMediaDataWillChange):
476         * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
477         (WebCore::GraphicsContext3D::GraphicsContext3D):
478         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
479         (WebCore::GraphicsContext3D::createShared):
480         (WebCore::GraphicsContext3D::GraphicsContext3D):
481         * platform/graphics/cv/VideoTextureCopierCV.cpp:
482         (WebCore::VideoTextureCopierCV::VideoTextureCopierCV):
483         (WebCore::VideoTextureCopierCV::~VideoTextureCopierCV):
484         (WebCore::transferFunctionFromString):
485         (WebCore::YCbCrToRGBMatrixForRangeAndTransferFunction):
486         (WebCore::VideoTextureCopierCV::initializeUVContextObjects):
487         (WebCore::VideoTextureCopierCV::copyImageToPlatformTexture):
488         (WebCore::VideoTextureCopierCV::copyVideoTextureToPlatformTexture):
489         * platform/graphics/cv/VideoTextureCopierCV.h:
490         (WebCore::VideoTextureCopierCV::context):
491         * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
492         (WebCore::GraphicsContext3D::GraphicsContext3D):
493
494 2017-12-07  Jer Noble  <jer.noble@apple.com>
495
496         [EME] Support generateRequest() in CDMFairPlayStreaming
497         https://bugs.webkit.org/show_bug.cgi?id=179752
498
499         Reviewed by Eric Carlson.
500
501         Tests: platform/mac/media/encrypted-media/fps-createSession.html
502                platform/mac/media/encrypted-media/fps-generateRequest.html
503
504         Add support for generating license requests from initialization data in
505         CDMFairPlayStreaming. To do so, add explicit checks for FairPlay Steraming requirements:
506         reqests will fail if no server certificate exists, and will fail if no content key id exists
507         in the initialization data.
508
509         * platform/graphics/avfoundation/CDMFairPlayStreaming.cpp:
510         (WebCore::CDMPrivateFairPlayStreaming::extractKeyIDsSinf):
511         (WebCore::CDMPrivateFairPlayStreaming::sanitizeSinf):
512         (WebCore::CDMFactory::platformRegisterFactories):
513         * platform/graphics/avfoundation/CDMFairPlayStreaming.h:
514         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
515         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::requestLicense):
516         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didProvideRequest):
517
518 2017-12-07  Jer Noble  <jer.noble@apple.com>
519
520         [EME] Possible deadlock when aborting a SourceBufferPrivateAVFObjC append operation
521         https://bugs.webkit.org/show_bug.cgi?id=180486
522
523         Reviewed by Eric Carlson.
524
525         It's possible that an abort() operation which is blocked on the ongoing appendBuffer()
526         operation completing will deadlock forever, with either the willProvideContentKeyRequest
527         or didProvideContentKeyRequest callbacks blocking waiting to be run on the main thread
528         (which is itself blocked waiting for the append operation to complete).
529
530         To break this deadlock, add a new abortSemaphore which is signaled in the abort() method
531         and have the willProvide... and didProvide... methods block both on their own semaphores
532         as well as the abortSemaphore, allowing them to break out even if their main thread calls
533         never get a chance to execute.
534
535         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
536         (-[WebAVStreamDataParserListener streamDataParserWillProvideContentKeyRequestInitializationData:forTrackID:]):
537         (-[WebAVStreamDataParserListener streamDataParser:didProvideContentKeyRequestInitializationData:forTrackID:]):
538         (WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC):
539         (WebCore::SourceBufferPrivateAVFObjC::abort):
540
541 2017-12-07  Eric Carlson  <eric.carlson@apple.com>
542
543         Simplify log channel configuration UI
544         https://bugs.webkit.org/show_bug.cgi?id=180527
545         <rdar://problem/35908382>
546
547         Reviewed by Joseph Pecoraro.
548
549         No new tests -- no change in functionality.
550
551         * inspector/agents/WebConsoleAgent.cpp:
552         (WebCore::WebConsoleAgent::getLoggingChannels):
553         (WebCore::channelConfigurationForString):
554
555 2017-12-07  Joseph Pecoraro  <pecoraro@apple.com>
556
557         ServiceWorker Inspector: Use the SW's scope url for the remote inspection target metadata
558         https://bugs.webkit.org/show_bug.cgi?id=180519
559
560         Reviewed by Youenn Fablet.
561
562         * workers/service/context/ServiceWorkerDebuggable.cpp:
563         (WebCore::ServiceWorkerDebuggable::ServiceWorkerDebuggable):
564         * workers/service/context/ServiceWorkerDebuggable.h:
565         Switch to the scope URL for the remote inspector target info.
566
567 2017-12-07  Per Arne Vollan  <pvollan@apple.com>
568
569         Unreviewed Windows build fix.
570
571         * PlatformWin.cmake:
572
573 2017-12-07  Michael Catanzaro  <mcatanzaro@igalia.com>
574
575         [WPE][GTK] Freeze WebKit version in user agent
576         https://bugs.webkit.org/show_bug.cgi?id=180475
577
578         Reviewed by Carlos Garcia Campos.
579
580         Apple has frozen the WebKit version in its user agent, so we should too, at the same point.
581
582         * platform/glib/UserAgentGLib.cpp:
583         (WebCore::versionForUAString):
584
585 2017-12-07  Michael Catanzaro  <mcatanzaro@igalia.com>
586
587         [WPE][GTK] Update user agent quirk version strings
588         https://bugs.webkit.org/show_bug.cgi?id=180474
589
590         Reviewed by Carlos Garcia Campos.
591
592         * platform/UserAgentQuirks.cpp:
593         (WebCore::UserAgentQuirks::stringForQuirk):
594         * platform/glib/UserAgentGLib.cpp:
595         (WebCore::platformVersionForUAString):
596
597 2017-12-06  Chris Dumez  <cdumez@apple.com>
598
599         We should be able to recover after a Service Worker process crash
600         https://bugs.webkit.org/show_bug.cgi?id=180477
601
602         Reviewed by Brady Eidson and Youenn Fablet.
603
604         Test: http/tests/workers/service/postmessage-after-sw-process-crash.https.html
605
606         * workers/service/server/SWServer.cpp:
607         (WebCore::SWServer::serverToContextConnectionCreated):
608         Once the connection with the context process is established, process "run service worker"
609         requests that ocurred while establishing the connection.
610
611         (WebCore::SWServer::runServiceWorkerIfNecessary):
612         Take in a lambda function that gets called after the "run service worker" request
613         is processed. We used to assert that we had a connection to the context process.
614         We now wait for the connection to be established to process the request, thus
615         making the operation asynchronous.
616
617         (WebCore::SWServer::runServiceWorker):
618         Split some logic out of runServiceWorkerIfNecessary() to reuse in serverToContextConnectionCreated().
619
620         (WebCore::SWServer::markAllWorkersAsTerminated):
621         Add method to mark all service workers as terminated. This is called when the Service
622         Worker process crashes.
623
624         * workers/service/server/SWServer.h:
625
626 2017-12-06  Saam Barati  <sbarati@apple.com>
627
628         Unreviewed. Fix iOS (and maybe other platform) build
629
630         * workers/service/server/RegistrationDatabase.cpp:
631         (WebCore::RegistrationDatabase::openSQLiteDatabase):
632
633 2017-12-02  Darin Adler  <darin@apple.com>
634
635         Modernize some aspects of text codecs, eliminate WebKit use of strcasecmp
636         https://bugs.webkit.org/show_bug.cgi?id=180009
637
638         Reviewed by Alex Christensen.
639
640         * Modules/fetch/FetchBody.cpp:
641         (WebCore::FetchBody::consumeAsStream): Update to use size since the result of
642         encode is now Vector rather than CString. And for the new UnencodableHandling.
643         (WebCore::FetchBody::consumeText): Removed now-unneeded type cast. Ditto.
644         (WebCore::FetchBody::bodyAsFormData const): Ditto.
645         (WebCore::FetchBody::take): Pass result of encode directly to SharedBuffer::create.
646
647         * Modules/websockets/WebSocketDeflater.cpp: Removed include of StringExtras.h.
648         * bridge/IdentifierRep.h: Ditto.
649         * bridge/c/c_instance.cpp: Ditto.
650
651         * fileapi/BlobBuilder.cpp:
652         (WebCore::BlobBuilder::append): Updated for CString to Vector change and
653         for UnencodableHandling.
654
655         * html/parser/HTMLMetaCharsetParser.cpp:
656         (WebCore::HTMLMetaCharsetParser::checkForMetaCharset): Call the decode function
657         with all the arguments since there is only one decode function now.
658
659         * inspector/agents/InspectorDOMAgent.cpp:
660         (WebCore::computeContentSecurityPolicySHA256Hash): Updated for CString to Vector
661         change and for UnencodableHandling.
662
663         * loader/ResourceCryptographicDigest.cpp:
664         (WebCore::cryptographicDigestForBytes): Changed argument type to const void*.
665         * loader/ResourceCryptographicDigest.h: Ditto.
666
667         * loader/TextResourceDecoder.cpp:
668         (WebCore::TextResourceDecoder::TextResourceDecoder): Moved initialization of data
669         members to class definition.
670         (WebCore::TextResourceDecoder::create): Moved function body here from the header.
671         (WebCore::TextResourceDecoder::setEncoding): Use equalLettersIgnoringASCIICase.
672         (WebCore::TextResourceDecoder::shouldAutoDetect const): Updated for name change
673         to m_parentFrameAutoDetectedEncoding, which obviates a comment.
674         (WebCore::TextResourceDecoder::flush): Ditto.
675         * loader/TextResourceDecoder.h: Moved initialization here from constructor.
676         Moved function bodies out of the class. Renamed m_hintEncoding to
677         m_parentFrameAutoDetectedEncoding since that is a more accurate description.
678
679         * loader/appcache/ApplicationCacheStorage.cpp: Removed include of StringExtras.h.
680         * page/FrameTree.cpp: Ditto.
681         * page/PageSerializer.cpp: Ditto.
682         (WebCore::PageSerializer::serializeFrame): Pass result of encode directly to
683         StringBuffer::create and update for UnencodableHandling.
684         (WebCore::PageSerializer::serializeCSSStyleSheet): Ditto.
685         * page/csp/ContentSecurityPolicy.cpp:
686         (WebCore::ContentSecurityPolicy::findHashOfContentInPolicies const): Ditto.
687
688         * platform/FileHandle.cpp: Removed include of StringExtras.h.
689
690         * platform/SharedBuffer.cpp:
691         (WebCore::SharedBuffer::create): Added an overload that takes Vector<uint8_t>.
692         * platform/SharedBuffer.h: Ditto.
693
694         * platform/URLParser.cpp:
695         (WebCore::URLParser::encodeQuery): Updated since encode returns a Vector instead
696         of a CString now and for UnencodableHandling.
697         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
698         (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource): Ditto.
699
700         * platform/graphics/ca/PlatformCALayer.cpp: Removed include of StringExtras.h.
701
702         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
703         (WebCore::ResourceHandleCurlDelegate::handleDataURL): Updated for Vector instead
704         of CString.
705
706         * platform/network/FormData.cpp:
707         (WebCore::FormData::create): Added new overload, and simplified some existing ones.
708         (WebCore::normalizeStringData): Changed return type to Vector<uint8_t> and updated
709         for UnencodableHandling.
710         (WebCore::FormData::appendMultiPartStringValue): Updated for change in type of
711         result of normalizeStringData.
712         * platform/network/FormData.h: Updated for the above and updated comments.
713
714         * platform/network/FormDataBuilder.cpp: Made this a namespace instead of a class.
715         (WebCore::FormDataBuilder::append): Added an overload for Vector<uint8_t>.
716         (WebCore::FormDataBuilder::appendQuoted): Renamed from appendQuotedString and
717         changed the argument type.
718         (WebCore::FormDataBuilder::appendFormURLEncoded): Moved logic up from the
719         encodeStringAsFormData function into a new separate helper.
720         (WebCore::FormDataBuilder::addFilenameToMultiPartHeader): Updated for change to
721         UnencodableHandling.
722         (WebCore::FormDataBuilder::beginMultiPartHeader): Changed argument type.
723         (WebCore::FormDataBuilder::addKeyValuePairAsFormData): Ditto.
724         (WebCore::FormDataBuilder::encodeStringAsFormData): Updated to call helper.
725         * platform/network/FormDataBuilder.h: Updated for the above.
726
727         * platform/text/DecodeEscapeSequences.h: Use Vector<uint8_t> instead of
728         Vector<char>, also updated the code that calls encode for the new return type
729         and updated for change to UnencodableHandler.
730
731         * platform/text/TextCodec.cpp:
732         (WebCore::TextCodec::getUnencodableReplacement): Updated since we are using
733         std::array now, so the out argument is easier to understand, also updated for
734         change to UnencodablaHandler.
735         * platform/text/TextCodec.h: Use std::array for the UnencodableReplacementArray
736         type, removed the overload of decode so there is only one decode function.
737
738         * platform/text/TextCodecICU.cpp:
739         (WebCore::ICUConverterWrapper::~ICUConverterWrapper): Deleted.
740         Not needed any more since we use ICUConverterPtr instead now.
741         (WebCore::cachedConverterICU): Deleted.
742         (WebCore::TextCodecICU::create): Deleted. Callers just use make_unique
743         directly now.
744         (WebCore::TextCodecICU::registerCodecs): Rewrote to use lambdas instead
745         of functions with void* pointers.
746         (WebCore::TextCodecICU::TextCodecICU): Moved initializers into the header.
747         (WebCore::TextCodecICU::~TextCodecICU): Moved the body of releaseICUConverter
748         in here. Also greatly simplified it now that ICUConverterPtr handles closing
749         it as needed.
750         (WebCore::TextCodecICU::releaseICUConverter const): Deleted.
751         (WebCore::TextCodecICU::createICUConverter const): Rewrote to simplfy now that
752         we can use ICUConverterPtr.
753         (WebCore::ErrorCallbackSetter::ErrorCallbackSetter): Take a reference instead
754         of a pointer.
755         (WebCore::ErrorCallbackSetter::~ErrorCallbackSetter): Ditto.
756         (WebCore::TextCodecICU::decode): Use equalLettersIgnoringASCIICase instead of
757         strcasecmp.
758         (WebCore::TextCodecICU::encode): Return a Vector instead of a CString.
759         Take a StringView instead of a pointer and length. Simplified
760         the backslash-as-currency-symbol code by using String::replace.
761         * platform/text/TextCodecICU.h: Updated for above. Fixed indentation.
762         Added a new ICUConverterPtr typedef that uses std::unique_ptr to close the
763         converter; combined with move semantics it simplifies things so we don't have
764         to be so careful about calling ucnv_close.
765
766         * platform/text/TextCodecLatin1.cpp: Renamed the Latin-1 to Unicode table from
767         "table" to latin1ConversionTable.
768         (WebCore::TextCodecLatin1::registerCodecs): Use a lambda.
769         (WebCore::encodeComplexWindowsLatin1): Return a Vector instad of CString.
770         Also use StringView::codePoints instead of our own U16_NEXT.
771         (WebCore::TextCodecLatin1::encode): More of the same.
772         * platform/text/TextCodecLatin1.h: Updated for the above.
773
774         * platform/text/TextCodecReplacement.cpp:
775         (WebCore::TextCodecReplacement::create): Deleted.
776         (WebCore::TextCodecReplacement::TextCodecReplacement): Deleted.
777         (WebCore::TextCodecReplacement::registerCodecs): Use a lambda.
778         * platform/text/TextCodecReplacement.h: Updated for the above.
779
780         * platform/text/TextCodecUTF16.cpp:
781         (WebCore::newStreamingTextDecoderUTF16LE): Deleted.
782         (WebCore::newStreamingTextDecoderUTF16BE): Deleted.
783         (WebCore::TextCodecUTF16::registerCodecs): Use lambdas.
784         (WebCore::TextCodecUTF16::encode): Return a Vector.
785         * platform/text/TextCodecUTF16.h: Updated for the above.
786
787         * platform/text/TextCodecUTF8.cpp:
788         (WebCore::TextCodecUTF8::registerCodecs): Use a lambda.
789         (WebCore::TextCodecUTF8::encode): Return a Vector.
790         * platform/text/TextCodecUTF8.h: Updated for the above.
791
792         * platform/text/TextCodecUserDefined.cpp:
793         (WebCore::newStreamingTextDecoderUserDefined): Deleted.
794         (WebCore::TextCodecUserDefined::registerCodecs): Use a lambda.
795         (WebCore::encodeComplexUserDefined): Return a Vector.
796         (WebCore::TextCodecUserDefined::encode): Ditto.
797         * platform/text/TextCodecUserDefined.h: Updated for the above.
798
799         * platform/text/TextEncoding.cpp: Changed TextCodecMap to just hold a
800         WTF::Function instead of holding a function and an additional data pointer.
801         (WebCore::TextEncoding::TextEncoding): Use equalLettersIgnoringASCIICase
802         instead of a special isReplacementEncoding function.
803         (WebCore::TextEncoding::encode const): Return a Vector instead of a CString.
804         Pass StringView instead of a pointer and length.
805         * platform/text/TextEncoding.h: Updated for the above.
806
807         * platform/text/TextEncodingRegistry.cpp:
808         (WebCore::addToTextCodecMap): Removed the additionalData pointer and used
809         WTFMove since NewTextCodecFunction is now a WTF::Function rather than a C
810         function pointer.
811         (WebCore::isReplacementEncoding): Deleted.
812         (WebCore::newTextCodec): Use find instead of get now that the fucntions in
813         the map are WTF::Function and can't be copied.
814         (WebCore::dumpTextEncodingNameMap): Deleted.
815         * platform/text/TextEncodingRegistry.h: Updated for the above.
816
817         * platform/text/win/TextCodecWin.cpp:
818         (WebCore::TextCodecWin::encode): Updated comment.
819
820         * xml/XMLHttpRequest.cpp:
821         (WebCore::XMLHttpRequest::send): Updated for change to UnencodableHandling.
822
823         * xml/XSLTUnicodeSort.cpp: Removed include of StringExtras.h.
824         * xml/parser/XMLDocumentParser.cpp: Ditto.
825         * xml/parser/XMLDocumentParserLibxml2.cpp: Ditto.
826
827 2017-12-06  Said Abou-Hallawa  <sabouhallawa@apple.com>
828
829         Support the decoding="sync/async" syntax for image async attribute
830         https://bugs.webkit.org/show_bug.cgi?id=179432
831
832         Reviewed by Darin Adler.
833
834         Support the HTMLElementImage decoding attribute to allow controlling the
835         decoding of an image as per:
836                 https://github.com/whatwg/html/pull/3221
837                 https://whatpr.org/html/3221/images.html#decoding-images
838
839         Tests: fast/images/decode-decoding-attribute-async-large-image.html
840                fast/images/decoding-attribute-async-small-image.html
841                fast/images/decoding-attribute-dynamic-async-small-image.html
842                fast/images/decoding-attribute-sync-large-image.html
843
844         * html/HTMLAttributeNames.in:
845         * html/HTMLImageElement.cpp:
846         (WebCore::HTMLImageElement::decodingMode const):
847         * html/HTMLImageElement.h:
848         * html/HTMLImageElement.idl:
849         * platform/graphics/BitmapImage.cpp:
850         (WebCore::BitmapImage::draw):
851         (WebCore::BitmapImage::internalStartAnimation):
852         (WebCore::BitmapImage::advanceAnimation):
853         (WebCore::BitmapImage::internalAdvanceAnimation):
854         * platform/graphics/DecodingOptions.h:
855         (WebCore::DecodingOptions::DecodingOptions):
856         (WebCore::DecodingOptions::isAuto const):
857         (WebCore::DecodingOptions::isAsynchronousCompatibleWith const):
858         (WebCore::DecodingOptions::isNone const): Deleted.
859         * platform/graphics/ImageDecoder.h:
860         * platform/graphics/ImageFrame.cpp:
861         (WebCore::ImageFrame::clearImage):
862         * platform/graphics/ImageSource.cpp:
863         (WebCore::ImageSource::frameAtIndexCacheIfNeeded):
864         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.h:
865         * platform/graphics/cg/ImageDecoderCG.h:
866         * platform/graphics/win/ImageDecoderDirect2D.h:
867         * platform/image-decoders/ScalableImageDecoder.h:
868         * rendering/RenderBoxModelObject.cpp:
869         (WebCore::RenderBoxModelObject::decodingModeForImageDraw const):
870         The element attributes and the document settings should be checked before
871         checking our heuristics. And since the "decoding" attribute is per an image
872         and isLargeImageAsyncDecodingEnabledForTesting() is a global setting, the
873         decoding attribute should be checked first.
874
875 2017-12-06  David Quesada  <david_quesada@apple.com>
876
877         [Web App Manifest] Add SPI for applying a manifest to a top-level browsing context
878         https://bugs.webkit.org/show_bug.cgi?id=180368
879         rdar://problem/34748067
880
881         Reviewed by Geoffrey Garen.
882
883         Support applying a manifest to a top-level browsing context by adding a manifest
884         property on PageConfiguration to be stored on MainFrame instances created from the
885         configuration.
886
887         No new tests, no change in behavior.
888
889         * page/MainFrame.cpp:
890         (WebCore::MainFrame::MainFrame):
891         * page/MainFrame.h:
892         * page/PageConfiguration.h:
893
894 2017-12-06  Zalan Bujtas  <zalan@apple.com>
895
896         Remove nodes from AXObjectCache when the associated subframe document is getting destroyed.
897         https://bugs.webkit.org/show_bug.cgi?id=180503
898         <rdar://problem/35891328
899
900         Reviewed by Chris Fleizach.
901
902         While AXObjectCache lives on the mainframe's document, it caches nodes from every subframe document.
903         When a node is being destroyed, we deregister it from the AX cache through the Node's destructor.
904         Soon after the document is detached from the frame/frame is detached from the frame tree, this codepath
905         is no longer available (no access to the AXObjectCache object) and from this point we are unable to deregister
906         nodes associated with the current document.
907         In AXObjectCache::prepareForDocumentDestruction(), we preemptively remove all the cached nodes associated
908         with the about-to-be-destroyed document.
909
910         Covered by existing tests.
911
912         * accessibility/AXObjectCache.cpp:
913         (WebCore::AXObjectCache::remove):
914         (WebCore::filterForRemoval):
915         (WebCore::AXObjectCache::prepareForDocumentDestruction): Collecting the nodes and removing them later is
916         not the most performant way but in order to have a single code path for the de-registration (AXObjectCache::remove)
917         I think it's worth going down the slower path -which should not really be that slower anyway since those
918         lists tend to stay small.
919         (WebCore::AXObjectCache::clearTextMarkerNodesInUse): Deleted.
920         * accessibility/AXObjectCache.h:
921         (WebCore::AXObjectCache::removeNodeForUse):
922         (WebCore::AXObjectCache::remove):
923         * dom/Document.cpp:
924         (WebCore::Document::prepareForDestruction):
925         * dom/Node.cpp:
926         (WebCore::Node::willBeDeletedFrom):
927         (WebCore::Node::moveNodeToNewDocument):
928
929 2017-12-06  Brady Eidson  <beidson@apple.com>
930
931         Start writing ServiceWorker registrations to disk.
932         https://bugs.webkit.org/show_bug.cgi?id=180488
933
934         Reviewed by Chris Dumez.
935
936         No new tests (No observable behavior change).
937
938         As registrations changes occurs, we now write them to disk.
939         We don't re-read them in yet.
940
941         * Sources.txt:
942         * WebCore.xcodeproj/project.pbxproj:
943
944         * workers/service/ServiceWorkerRegistrationData.cpp:
945         (WebCore::ServiceWorkerRegistrationData::isolatedCopy const):
946         * workers/service/ServiceWorkerRegistrationData.h:
947         (WebCore::ServiceWorkerRegistrationData::encode const):
948         (WebCore::ServiceWorkerRegistrationData::decode):
949
950         * workers/service/ServiceWorkerRegistrationKey.cpp:
951         (WebCore::ServiceWorkerRegistrationKey::toDatabaseKey const):
952         * workers/service/ServiceWorkerRegistrationKey.h:
953
954         * workers/service/server/RegistrationDatabase.cpp: Added.
955         (WebCore::v1RecordsTableSchema):
956         (WebCore::v1RecordsTableSchemaAlternate):
957         (WebCore::databaseFilename):
958         (WebCore::RegistrationDatabase::RegistrationDatabase):
959         (WebCore::RegistrationDatabase::~RegistrationDatabase):
960         (WebCore::RegistrationDatabase::openSQLiteDatabase):
961         (WebCore::RegistrationDatabase::ensureValidRecordsTable):
962         (WebCore::updateViaCacheToString):
963         (WebCore::workerTypeToString):
964         (WebCore::RegistrationDatabase::pushChanges):
965         (WebCore::RegistrationDatabase::doPushChanges):
966         (WebCore::RegistrationDatabase::importRecords):
967         (WebCore::RegistrationDatabase::databaseFailedToOpen):
968         (WebCore::RegistrationDatabase::databaseOpenedAndRecordsImported):
969         * workers/service/server/RegistrationDatabase.h: Copied from Source/WebCore/workers/service/ServiceWorkerRegistrationData.cpp.
970         (WebCore::RegistrationDatabase::isClosed const):
971
972         * workers/service/server/RegistrationStore.cpp: Added.
973         (WebCore::RegistrationStore::RegistrationStore):
974         (WebCore::RegistrationStore::~RegistrationStore):
975         (WebCore::RegistrationStore::scheduleDatabasePushIfNecessary):
976         (WebCore::RegistrationStore::pushChangesToDatabase):
977         (WebCore::RegistrationStore::updateRegistration):
978         (WebCore::RegistrationStore::removeRegistration):
979         (WebCore::RegistrationStore::databaseFailedToOpen):
980         (WebCore::RegistrationStore::databaseOpenedAndRecordsImported):
981         * workers/service/server/RegistrationStore.h: Copied from Source/WebCore/workers/service/ServiceWorkerRegistrationData.cpp.
982
983         * workers/service/server/SWServer.cpp:
984         (WebCore::SWServer::removeRegistration):
985         (WebCore::SWServer::SWServer):
986         (WebCore::SWServer::updateWorker):
987         (WebCore::SWServer::installContextData):
988         * workers/service/server/SWServer.h:
989
990         * workers/service/server/SWServerRegistration.cpp:
991         (WebCore::SWServerRegistration::data const):
992         * workers/service/server/SWServerRegistration.h:
993         (WebCore::SWServerRegistration::setLastUpdateTime):
994
995 2017-12-06  Chris Dumez  <cdumez@apple.com>
996
997         Unreviewed, fix build after r225577.
998
999         * bindings/js/JSDOMGlobalObject.cpp:
1000
1001 2017-12-06  David Quesada  <david_quesada@apple.com>
1002
1003         [Web App Manifest] Add SPI for fetching the manifest
1004         https://bugs.webkit.org/show_bug.cgi?id=180294
1005         rdar://problem/34747968
1006
1007         Reviewed by Geoffrey Garen.
1008
1009         Test: applicationmanifest/developer-warnings.html
1010
1011         * Modules/applicationmanifest/ApplicationManifest.h:
1012         (WebCore::ApplicationManifest::encode const):
1013         (WebCore::ApplicationManifest::decode):
1014         * Modules/applicationmanifest/ApplicationManifestParser.cpp:
1015         (WebCore::ApplicationManifestParser::logManifestPropertyNotAString):
1016         (WebCore::ApplicationManifestParser::logManifestPropertyInvalidURL):
1017             Drive-by wording changes. Since the warning is prefixed with "parsing
1018             application manifest:", remove a redundant use of "application manifest".
1019
1020 2017-12-06  Per Arne Vollan  <pvollan@apple.com>
1021
1022         The WebProcess should use the NSRunLoop runloop type.
1023         https://bugs.webkit.org/show_bug.cgi?id=179804
1024         <rdar://problem/14012823>
1025
1026         Reviewed by Brent Fulgham.
1027
1028         No new tests.
1029
1030         * platform/mac/EventLoopMac.mm:
1031         (WebCore::EventLoop::cycle):
1032
1033 2017-12-06  Antti Koivisto  <antti@apple.com>
1034
1035         Prefer ids and classes over tag names in selector filter
1036         https://bugs.webkit.org/show_bug.cgi?id=180433
1037         <rdar://problem/35859103>
1038
1039         Reviewed by Zalan Bujtas.
1040
1041         There are only four slots in the filter and currently we just pick whatever identifiers we find traversing the selector
1042         from right to left. More specific selector types are on average more valuable (id > class > tag) so we should prefer them.
1043
1044         This appears to be 4-5% StyleBench progression.
1045
1046         * css/RuleSet.cpp:
1047         (WebCore::RuleData::RuleData):
1048         * css/SelectorFilter.cpp:
1049         (WebCore::collectSimpleSelectorHash):
1050         (WebCore::collectSelectorHashes):
1051
1052             This function collects all hashes from the selector.
1053
1054         (WebCore::chooseSelectorHashesForFilter):
1055
1056             This function chooses the most valuable hashes to use with the filter.
1057
1058         (WebCore::SelectorFilter::collectHashes):
1059
1060             Factor into two separate steps.
1061
1062         (WebCore::collectDescendantSelectorIdentifierHashes): Deleted.
1063         (WebCore::SelectorFilter::collectIdentifierHashes): Deleted.
1064         * css/SelectorFilter.h:
1065         (WebCore::SelectorFilter::fastRejectSelector const):
1066
1067 2017-12-06  Jer Noble  <jer.noble@apple.com>
1068
1069         [EME] Make CDMInstance& parameter passed through MediaPlayer non-const
1070         https://bugs.webkit.org/show_bug.cgi?id=180484
1071
1072         Reviewed by Jon Lee.
1073
1074         One can only call const methods on const references, and the obvious intent
1075         of these methods is for the callee to call non-const methods on the parameters.
1076
1077         * Modules/encryptedmedia/MediaKeys.h:
1078         (WebCore::MediaKeys::cdmInstance):
1079         * platform/graphics/MediaPlayer.cpp:
1080         (WebCore::MediaPlayer::cdmInstanceAttached):
1081         (WebCore::MediaPlayer::cdmInstanceDetached):
1082         (WebCore::MediaPlayer::attemptToDecryptWithInstance):
1083         * platform/graphics/MediaPlayer.h:
1084         * platform/graphics/MediaPlayerPrivate.h:
1085         (WebCore::MediaPlayerPrivateInterface::cdmInstanceAttached):
1086         (WebCore::MediaPlayerPrivateInterface::cdmInstanceDetached):
1087         (WebCore::MediaPlayerPrivateInterface::attemptToDecryptWithInstance):
1088         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1089         (WebCore::MediaPlayerPrivateGStreamerBase::cdmInstanceAttached):
1090         (WebCore::MediaPlayerPrivateGStreamerBase::cdmInstanceDetached):
1091         (WebCore::MediaPlayerPrivateGStreamerBase::attemptToDecryptWithInstance):
1092         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
1093         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
1094         (WebCore::MediaPlayerPrivateGStreamerMSE::attemptToDecryptWithInstance):
1095         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
1096
1097 2017-12-06  Youenn Fablet  <youenn@apple.com>
1098
1099         Preflight should bypass service worker
1100         https://bugs.webkit.org/show_bug.cgi?id=180463
1101
1102         Reviewed by Alex Christensen.
1103
1104         Covered by updated test.
1105
1106         * loader/CrossOriginPreflightChecker.cpp:
1107         (WebCore::CrossOriginPreflightChecker::startPreflight): Ensure service worker is not used.
1108         * loader/DocumentThreadableLoader.cpp:
1109         (WebCore::DocumentThreadableLoader::didFail): Tighten check and clear resource proactively to not hit loadRequest ASSERT.
1110
1111 2017-12-06  John Wilander  <wilander@apple.com>
1112
1113         Storage Access API: Make document.hasStorageAccess a function and always allow access for same-origin iframes
1114         https://bugs.webkit.org/show_bug.cgi?id=176944
1115         <rdar://problem/34440658>
1116
1117         Reviewed by Brent Fulgham.
1118
1119         Test: http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-without-user-gesture.html
1120
1121         This change introduces document.hasStorageAccess() as a function which
1122         returns a promise instead of being a property. Since cookie access can
1123         be due to both a granted request and recent user interaction as first
1124         party, the WebKit::WebResourceLoadStatisticsStore needs to be consulted.
1125
1126         * dom/Document.cpp:
1127         (WebCore::Document::hasStorageAccess):
1128         (WebCore::Document::requestStorageAccess):
1129             Removed check of the previous m_hasStorageAccess member.
1130             Same-origin check done earlier. This was a request/suggestion
1131             from Mozilla.
1132         * dom/Document.h:
1133         (WebCore::Document::hasStorageAccess const): Deleted.
1134             Now uses a promise.
1135         * dom/Document.idl:
1136         * page/ChromeClient.h:
1137
1138 2017-12-06  Youenn Fablet  <youenn@apple.com>
1139
1140         REGRESSION (r225537): Crash in WebCore::SWServerWorker::setHasPendingEvents(bool) + 68
1141         https://bugs.webkit.org/show_bug.cgi?id=180481
1142
1143         Reviewed by Chris Dumez.
1144
1145         Replacing ASSERT by if null check since there is no strong guarantee right now that there is a registration
1146         in SWServer registration map associated to a SWServerWorker.
1147
1148         * workers/service/server/SWServerWorker.cpp:
1149         (WebCore::SWServerWorker::setHasPendingEvents):
1150
1151 2017-12-06  Chris Dumez  <cdumez@apple.com>
1152
1153         ServiceWorkers API should reject promises when calling objects inside detached frames
1154         https://bugs.webkit.org/show_bug.cgi?id=180444
1155
1156         Reviewed by Youenn Fablet.
1157
1158         ServiceWorkers API should reject promises when calling objects inside detached frames.
1159
1160         No new tests, rebaselined existing test.
1161
1162         * bindings/js/JSDOMPromiseDeferred.h:
1163         (WebCore::callPromiseFunction):
1164         Use the caller's globalObject instead of the lexicalGlobalObject when constructing the
1165         deferred promise. The bug became visible when working on this service worker bug since
1166         rejecting the promise when the frame is detached did not actually work. The issue is
1167         that since the promise was created with the detached frame's globalObject, then it was
1168         suspended and would not run script.
1169
1170         * bindings/js/JSDOMWindowBase.cpp:
1171         (WebCore::callerGlobalObject):
1172         (WebCore::incumbentDOMWindow):
1173         * bindings/js/JSDOMWindowBase.h:
1174         Add convenience function to get the caller's globalObject. It was carved out of
1175         incumbentDOMWindow().
1176
1177         * workers/service/ServiceWorker.cpp:
1178         (WebCore::ServiceWorker::postMessage):
1179         * workers/service/ServiceWorkerContainer.cpp:
1180         (WebCore::ServiceWorkerContainer::addRegistration):
1181         (WebCore::ServiceWorkerContainer::getRegistration):
1182         (WebCore::ServiceWorkerContainer::getRegistrations):
1183         * workers/service/ServiceWorkerRegistration.cpp:
1184         (WebCore::ServiceWorkerRegistration::update):
1185         (WebCore::ServiceWorkerRegistration::unregister):
1186         Reject the promise when m_isStopped flag is set (i.e. ActiveDOMObject::stop()
1187         has been called).
1188
1189 2017-12-06  Said Abou-Hallawa  <sabouhallawa@apple.com>
1190
1191         [Mac] REGRESSION (r224527): Drawing a path with box-shadow takes double the blur-radius on Retina display
1192         https://bugs.webkit.org/show_bug.cgi?id=180460
1193         <rdar://problem/35869866>
1194
1195         Reviewed by Daniel Bates.
1196
1197         Disable using CGContextDrawPathDirect() for macOS High Sierra or earlier.
1198         This API has a bug when drawing a path with a shadow on Retina display.
1199         This bug is tracked internally by <rdar://problem/35620690>.
1200
1201
1202         * platform/graphics/cg/GraphicsContextCG.cpp:
1203
1204 2017-12-06  Youenn Fablet  <youenn@apple.com>
1205
1206         Service Worker fetch should filter HTTP headers that are added by CachedResourceLoader/CachedResource
1207         https://bugs.webkit.org/show_bug.cgi?id=180462
1208
1209         Reviewed by Geoffrey Garen.
1210
1211         Coved by rebased test.
1212
1213         * loader/CrossOriginAccessControl.cpp:
1214         (WebCore::cleanRedirectedRequestForAccessControl): Accept header is a safe header so it is fine to keep it.
1215         * workers/service/context/ServiceWorkerFetch.cpp:
1216         (WebCore::ServiceWorkerFetch::dispatchFetchEvent): Cleaning headers added by CachedResourceLoader/CachedResource.
1217
1218 2017-12-06  Zan Dobersek  <zdobersek@igalia.com>
1219
1220         [CoordGraphics] Introduce Nicosia::PaintingContext, add Cairo implementation
1221         https://bugs.webkit.org/show_bug.cgi?id=180239
1222
1223         Reviewed by Michael Catanzaro.
1224
1225         As the next step in the Nicosia abstraction formation, we introduce
1226         Nicosia::PaintingContext. Implementations of this class will leverage a
1227         chosen 2D graphics library to paint (through GraphicsContext) into the
1228         memory area that's specified by a given Nicosia::Buffer object.
1229
1230         Nicosia::Buffer is slimmed down to only control the memory that's
1231         required for rasterization of an RGBA32 painting output. It mimics the
1232         Cairo ImageBuffer implementation by using FastMalloc to allocate the
1233         necessary memory. In the future this class might become an interface of
1234         which different implementations will be providing memory that's
1235         allocated through different ways. For instance, when GLES3 is available,
1236         it would be possible to map GPU memory into the process memory space and
1237         rasterize into that, effectively eliminating need for GPU uploads.
1238
1239         Since the ImageBuffer use in Nicosia::Buffer is dropped, the context()
1240         and uploadImage() methods are also removed. The functionality of
1241         ImageBuffer that was leveraged for CoordinatedGraphics rasterization
1242         still remains used through the PaintingContextCairo implementation. In
1243         the constructor of that class, with the target Nicosia::Buffer provided,
1244         we construct the cairo_surface_t and cairo_t objects that are necessary
1245         to create a combination of PlatformContextCairo and GraphicsContext
1246         objects that we can then use for rasterization.
1247
1248         Reference of the passed-in Nicosia::Buffer object is increased for the
1249         lifetime of the cairo_surface_t object that will be drawing into that
1250         buffer's memory area. This ensures the memory area doesn't disappear
1251         from a live cairo_surface_t. Still, the expectation is that the
1252         cairo_surface_t object won't outlive the PaintingContextCairo object's
1253         lifetime, since the cairo_t object is also managed here and deleted in
1254         the destructor. To test that, we use a cairo_surface_t user data key
1255         that in its destroy callback dereferences the Nicosia::Buffer object and
1256         also marks the deletion process for the related PaintingContextCairo
1257         object as complete. This m_deletionComplete value is tested in the
1258         destructor of the class, once all the Cairo references are nulled out.
1259
1260         The PaintingContext objects should be limited to a single scope,
1261         enabling the implementation resources to assume that the lifetime of the
1262         implementation object won't extend outside of the scope where it was
1263         created. To ensure that, the PaintingContext::paint() static function is
1264         added that creates the PaintingContext object and then executes the
1265         passed-in functor, passing it the GraphicsContext that should be used
1266         for drawing. Drawing is thus limited to that functor only, and the
1267         PaintingContext's create() function and the virtual graphicsContext()
1268         are not made public in the class.
1269
1270         No new tests -- no change in functionality.
1271
1272         * platform/TextureMapper.cmake:
1273         * platform/graphics/nicosia/NicosiaBuffer.cpp:
1274         (Nicosia::Buffer::Buffer):
1275         (Nicosia::Buffer::context): Deleted.
1276         (Nicosia::Buffer::uploadImage): Deleted.
1277         * platform/graphics/nicosia/NicosiaBuffer.h:
1278         (Nicosia::Buffer::stride const):
1279         (Nicosia::Buffer::data const):
1280         * platform/graphics/nicosia/NicosiaPaintingContext.cpp: Copied from Source/WebCore/platform/graphics/nicosia/NicosiaBuffer.cpp.
1281         (Nicosia::PaintingContext::create):
1282         * platform/graphics/nicosia/NicosiaPaintingContext.h: Copied from Source/WebCore/platform/graphics/nicosia/NicosiaBuffer.cpp.
1283         (Nicosia::PaintingContext::paint):
1284         * platform/graphics/nicosia/NicosiaPaintingContextCairo.cpp: Added.
1285         (Nicosia::PaintingContextCairo::PaintingContextCairo):
1286         (Nicosia::PaintingContextCairo::~PaintingContextCairo):
1287         (Nicosia::PaintingContextCairo::graphicsContext):
1288         * platform/graphics/nicosia/NicosiaPaintingContextCairo.h: Copied from Source/WebCore/platform/graphics/nicosia/NicosiaBuffer.h.
1289         * platform/graphics/nicosia/NicosiaPaintingEngineBasic.cpp:
1290         (Nicosia::PaintingEngineBasic::paint):
1291         * platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp:
1292         (WebCore::CoordinatedImageBacking::update):
1293
1294 2017-12-05  Fujii Hironori  <Hironori.Fujii@sony.com>
1295
1296         [GTK] Layout test media/track/track-in-band-duplicate-tracks-when-source-changes.html crashes and times out
1297         https://bugs.webkit.org/show_bug.cgi?id=160131
1298
1299         Reviewed by Eric Carlson.
1300
1301         Null dereference can be happen if VideoTrack and AudioTrack are
1302         disconnected from its media element.
1303
1304         No new tests, no behavior change.
1305
1306         * html/track/AudioTrack.cpp:
1307         (WebCore::AudioTrack::willRemove): Null-check mediaElement.
1308         * html/track/VideoTrack.cpp:
1309         (WebCore::VideoTrack::setLanguage): Ditto.
1310
1311 2017-12-05  Chris Dumez  <cdumez@apple.com>
1312
1313         ServiceWorkerGlobalScope prototype chain should be immutable
1314         https://bugs.webkit.org/show_bug.cgi?id=180450
1315
1316         Reviewed by Youenn Fablet.
1317
1318         ServiceWorkerGlobalScope prototype chain should be immutable, similarly
1319         to what we do for DOMWindow. This is covered by a web-platform-test
1320         which was timing out because it was successfuly overwriting the
1321         ServiceWorkerGlobalScope prototype.
1322
1323         No new tests, rebaselined existing test.
1324
1325         * workers/DedicatedWorkerGlobalScope.idl:
1326         * workers/WorkerGlobalScope.idl:
1327         * workers/service/ServiceWorkerGlobalScope.idl:
1328
1329 2017-12-05  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1330
1331         Fast binding generation by batching several files at once
1332         https://bugs.webkit.org/show_bug.cgi?id=179958
1333
1334         Reviewed by Alex Christensen.
1335
1336         Passing several files to the sub process at once and reducing the total cost of
1337         process generation. Especially Windows port has great speed improvement because
1338         its implementation of fork/exec is terrible.
1339
1340         * bindings/scripts/generate-bindings-all.pl:
1341         (spawnGenerateBindingsIfNeeded):
1342         * bindings/scripts/generate-bindings.pl:
1343         (generateBindings):
1344
1345 2017-12-05  David Quesada  <david_quesada@apple.com>
1346
1347         [Web App Manifest] Support fetching the app manifest 
1348         https://bugs.webkit.org/show_bug.cgi?id=180292
1349
1350         Reviewed by Geoffrey Garen.
1351
1352         Add support in WebCore for loading and parsing application manifests. This functionality
1353         is currently exposed with two methods: DocumentLoader::loadApplicationManifest() to call
1354         to start loading the manifest, and FrameLoaderClient::finishedLoadingApplicationManifest()
1355         for clients to override in order to be notified of the loaded manifest.
1356
1357         No new tests, since no functionality is exposed to web content or embedders yet. The
1358         needed SPI will be added in an upcoming patch.
1359
1360         * Sources.txt:
1361         * WebCore.xcodeproj/project.pbxproj:
1362             Added CachedApplicationManifest and ApplicationManifestLoader.
1363         * html/HTMLLinkElement.h:
1364         * html/LinkRelAttribute.cpp:
1365         (WebCore::LinkRelAttribute::LinkRelAttribute):
1366         (WebCore::LinkRelAttribute::isSupported):
1367             Add "manifest" as a supported 'rel' type for links.
1368         * html/LinkRelAttribute.h:
1369         * inspector/agents/InspectorPageAgent.cpp:
1370         (WebCore::InspectorPageAgent::resourceTypeJSON):
1371         (WebCore::InspectorPageAgent::inspectorResourceType):
1372         * inspector/agents/InspectorPageAgent.h:
1373         * loader/ApplicationManifestLoader.cpp: Added.
1374             Added a class ApplicationManifestLoader which handles creating a ResourceRequest,
1375             loading the resource from the CachedResourceLoader, and parsing the resulting text.
1376             This class and its relation to DocumentLoader are roughly based on that of IconLoader,
1377             which serves a similar purpose - requesting a resource on the page and ultimately
1378             providing it to the embedder.
1379         (WebCore::ApplicationManifestLoader::ApplicationManifestLoader):
1380         (WebCore::ApplicationManifestLoader::~ApplicationManifestLoader):
1381         (WebCore::ApplicationManifestLoader::startLoading):
1382         (WebCore::ApplicationManifestLoader::stopLoading):
1383         (WebCore::ApplicationManifestLoader::processManifest):
1384         (WebCore::ApplicationManifestLoader::notifyFinished):
1385         * loader/ApplicationManifestLoader.h: Copied from Source/WebCore/page/csp/ContentSecurityPolicyDirectiveNames.h.
1386         * loader/DocumentLoader.cpp:
1387         (WebCore::DocumentLoader::stopLoading):
1388         (WebCore::DocumentLoader::loadApplicationManifest):
1389         (WebCore::DocumentLoader::finishedLoadingApplicationManifest):
1390         (WebCore::DocumentLoader::notifyFinishedLoadingApplicationManifest):
1391         * loader/DocumentLoader.h:
1392         * loader/FrameLoaderClient.h:
1393         * loader/LinkLoader.cpp:
1394         (WebCore::createLinkPreloadResourceClient):
1395         (WebCore::LinkLoader::isSupportedType):
1396         * loader/ResourceLoadInfo.cpp:
1397         (WebCore::toResourceType):
1398         * loader/SubresourceLoader.cpp:
1399         (WebCore::logResourceLoaded):
1400         * loader/cache/CachedApplicationManifest.cpp: Added.
1401         (WebCore::CachedApplicationManifest::CachedApplicationManifest):
1402         (WebCore::CachedApplicationManifest::finishLoading):
1403         (WebCore::CachedApplicationManifest::setEncoding):
1404         (WebCore::CachedApplicationManifest::encoding const):
1405         (WebCore::CachedApplicationManifest::process):
1406             Add a method to process the fetched text into an ApplicationManifest. CachedApplicationManifest
1407             does not store the resulting ApplicationManifest because the text of an application
1408             manifest can yield a different ApplicationManifest depending on the URL of the document
1409             processing it.
1410         * loader/cache/CachedApplicationManifest.h: Copied from Source/WebCore/page/csp/ContentSecurityPolicyDirectiveNames.h.
1411         * loader/cache/CachedResource.cpp:
1412         (WebCore::CachedResource::defaultPriorityForResourceType):
1413         * loader/cache/CachedResource.h:
1414         * loader/cache/CachedResourceLoader.cpp:
1415         (WebCore::createResource):
1416         (WebCore::CachedResourceLoader::requestApplicationManifest):
1417         (WebCore::contentTypeFromResourceType):
1418         (WebCore::CachedResourceLoader::checkInsecureContent const):
1419         (WebCore::CachedResourceLoader::allowedByContentSecurityPolicy const):
1420         * loader/cache/CachedResourceLoader.h:
1421         * page/DiagnosticLoggingKeys.cpp:
1422         (WebCore::DiagnosticLoggingKeys::applicationManifestKey):
1423         * page/DiagnosticLoggingKeys.h:
1424         * page/csp/ContentSecurityPolicy.cpp:
1425         (WebCore::ContentSecurityPolicy::allowManifestFromSource const):
1426         * page/csp/ContentSecurityPolicy.h:
1427         * page/csp/ContentSecurityPolicyDirectiveList.cpp:
1428         (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForManifest const):
1429         (WebCore::ContentSecurityPolicyDirectiveList::addDirective):
1430         * page/csp/ContentSecurityPolicyDirectiveList.h:
1431         * page/csp/ContentSecurityPolicyDirectiveNames.cpp:
1432         * page/csp/ContentSecurityPolicyDirectiveNames.h:
1433
1434 2017-12-05  Stephan Szabo  <stephan.szabo@sony.com>
1435
1436         Switch windows build to Visual Studio 2017
1437         https://bugs.webkit.org/show_bug.cgi?id=172412
1438
1439         Reviewed by Per Arne Vollan.
1440
1441         Only changes proj file to update generator
1442
1443         * WebCore.vcxproj/WebCore.proj:
1444
1445 2017-12-05  Brent Fulgham  <bfulgham@apple.com>
1446
1447         Limit user agent versioning to an upper bound
1448         https://bugs.webkit.org/show_bug.cgi?id=180365
1449         <rdar://problem/34550617>
1450
1451         Reviewed by Joseph Pecoraro.
1452
1453         Freeze the version reported as User Agent to OS 10.13.4 (OS 11.3 on iOS) and WebKit 605.1.15
1454         for User Agent purposes.
1455
1456         Test: fast/dom/navigator-userAgent-frozen.html
1457
1458         * page/cocoa/UserAgent.h:
1459         * page/cocoa/UserAgent.mm:
1460         (WebCore::versionPredatesFreeze): Helper function. Returns true for Version 10.13.3 or older.
1461         (WebCore::systemMarketingVersionForUserAgentString):
1462         (WebCore::userAgentBundleVersion):
1463         (WebCore::userVisibleWebKitBundleVersionFromFullVersion): Deleted.
1464         (WebCore::userAgentBundleVersionFromFullVersionString): Deleted.
1465         * page/ios/UserAgentIOS.mm:
1466         (WebCore::standardUserAgentWithApplicationName): Don't take the WebKit bundle version
1467         as an argument, or pass it to the user agent string generator.
1468         * page/mac/UserAgentMac.mm:
1469         (WebCore::standardUserAgentWithApplicationName): Ditto. 
1470
1471 2017-12-05  Matt Lewis  <jlewis3@apple.com>
1472
1473         Unreviewed, rolling out r225430.
1474
1475         This caused an API failure on release.
1476
1477         Reverted changeset:
1478
1479         "Move DateComponents into WTF"
1480         https://bugs.webkit.org/show_bug.cgi?id=180211
1481         https://trac.webkit.org/changeset/225430
1482
1483 2017-12-05  Simon Fraser  <simon.fraser@apple.com>
1484
1485         Composited frames incorrectly get requestAnimationFrame throttled
1486         https://bugs.webkit.org/show_bug.cgi?id=178396
1487
1488         Reviewed by Zalan Bujtas.
1489
1490         If a composited iframe was inside overflow:scroll, and the overflow was scrolled to the left
1491         further than the window width, then RenderLayer::childrenClipRect() would return an empty rectangle
1492         and we'd incorrectly consider the iframe out of view, and thus throttle its requestAnimationFrame.
1493
1494         childrenClipRect() was taking unscaledDocumentRect(), applying the clip, and then mapping the result
1495         from local to absolute coordinates (which mapped it through the overflow scroll offset). This is incorrect
1496         because it considers the unscaledDocumentRect() to be in local coordinates, which it is not.
1497
1498         Instead, start with the infinite rect, which essentially tells us if we have any clipping, and then
1499         intersect that with the document rect at the end. Something similar is done in other places that call.
1500         calculateRects().
1501
1502         Test: fast/animation/request-animation-frame-throttle-inside-overflow-scroll.html
1503
1504         * rendering/RenderLayer.cpp:
1505         (WebCore::RenderLayer::calculateClipRects const):
1506
1507 2017-12-05  Michael Saboff  <msaboff@apple.com>
1508
1509         Make WebKit build for ARM64_32
1510         https://bugs.webkit.org/show_bug.cgi?id=180447
1511
1512         Reviewed by Mark Lam.
1513
1514         No new test as this isn't a change to functionality.
1515
1516         * platform/graphics/transforms/TransformationMatrix.cpp:
1517         (WebCore::TransformationMatrix::multiply): Fallback to the C++ version for
1518         ARM64_32.
1519
1520 2017-12-05  Chris Dumez  <cdumez@apple.com>
1521
1522         XMLHttpRequest should not be exposed to service workers
1523         https://bugs.webkit.org/show_bug.cgi?id=180446
1524
1525         Reviewed by Youenn Fablet.
1526
1527         Stop exposing XMLHttpRequest to service workers, as per:
1528         - https://xhr.spec.whatwg.org/#interface-xmlhttprequest
1529
1530         * xml/XMLHttpRequest.idl:
1531
1532 2017-12-05  Joseph Pecoraro  <pecoraro@apple.com>
1533
1534         Web Inspector: content views for resources loaded through XHR do not reflect declared mime-type
1535         https://bugs.webkit.org/show_bug.cgi?id=141389
1536         <rdar://problem/19767070>
1537
1538         Reviewed by Brian Burg.
1539
1540         Updated: http/tests/inspector/network/xhr-response-body.html:
1541                  http/tests/inspector/network/fetch-response-body.html:
1542
1543         * xml/XMLHttpRequest.cpp:
1544         (WebCore::XMLHttpRequest::didFinishLoading):
1545         * inspector/InspectorInstrumentation.cpp:
1546         (WebCore::InspectorInstrumentation::didFinishXHRLoadingImpl): Deleted.
1547         * inspector/InspectorInstrumentation.h:
1548         (WebCore::InspectorInstrumentation::didFinishXHRLoading): Deleted.
1549         Remove special handling of XHR content that decoded output as text.
1550
1551         * inspector/NetworkResourcesData.h:
1552         (WebCore::NetworkResourcesData::ResourceData::requestId const):
1553         (WebCore::NetworkResourcesData::ResourceData::loaderId const):
1554         (WebCore::NetworkResourcesData::ResourceData::frameId const):
1555         (WebCore::NetworkResourcesData::ResourceData::url const):
1556         (WebCore::NetworkResourcesData::ResourceData::content const):
1557         (WebCore::NetworkResourcesData::ResourceData::isContentEvicted const):
1558         (WebCore::NetworkResourcesData::ResourceData::textEncodingName const):
1559         * inspector/NetworkResourcesData.cpp:
1560         (WebCore::NetworkResourcesData::ResourceData::ResourceData):
1561         (WebCore::NetworkResourcesData::ResourceData::decodeDataToContent):
1562         (WebCore::NetworkResourcesData::responseReceived):
1563         (WebCore::NetworkResourcesData::setResourceContent):
1564         (WebCore::shouldBufferResourceData):
1565         (WebCore::NetworkResourcesData::maybeAddResourceData):
1566         (WebCore::NetworkResourcesData::maybeDecodeDataToContent):
1567
1568         Make NetworkResourcesData only create a text decoder for resources we
1569         really think are text, and buffer resource data if it is text data
1570         or if it is a resource that would otherwise not be buffered by WebCore
1571         (such as XHRs with a DoNotBufferData policy). This ensures that the
1572         Inspector will have data to show for resources that won't be cached.
1573
1574         * inspector/agents/InspectorPageAgent.cpp:
1575         (WebCore::InspectorPageAgent::resourceContent):
1576         (WebCore::InspectorPageAgent::sourceMapURLForResource):
1577         (WebCore::InspectorPageAgent::searchInResource):
1578         (WebCore::InspectorPageAgent::searchInResources):
1579         (WebCore::hasTextContent): Deleted.
1580         (WebCore::InspectorPageAgent::cachedResourceContent): Deleted.
1581         (WebCore::InspectorPageAgent::createTextDecoder): Deleted.
1582         (WebCore::textContentForCachedResource): Deleted.
1583         * inspector/agents/InspectorPageAgent.h:
1584         * inspector/agents/InspectorNetworkAgent.cpp:
1585         (WebCore::InspectorNetworkAgent::didReceiveData):
1586         (WebCore::InspectorNetworkAgent::willDestroyCachedResource):
1587         (WebCore::InspectorNetworkAgent::getResponseBody):
1588         (WebCore::InspectorNetworkAgent::shouldTreatAsText):
1589         (WebCore::InspectorNetworkAgent::createTextDecoder):
1590         (WebCore::InspectorNetworkAgent::textContentForCachedResource):
1591         (WebCore::InspectorNetworkAgent::cachedResourceContent):
1592         (WebCore::textContentForResourceData):
1593         (WebCore::InspectorNetworkAgent::searchOtherRequests):
1594         (WebCore::isErrorStatusCode): Deleted.
1595         (WebCore::InspectorNetworkAgent::didFinishXHRLoading): Deleted.
1596         * inspector/agents/InspectorNetworkAgent.h:
1597         Move static PageAgent functions related to the generic data tuple
1598         (content, base64Encoded) to NetworkAgent. Also generalize it to
1599         not rely on the CachedResourceType, but instead rely on the MIME type.
1600         This has a few changes in behavior:
1601
1602             - Images, may now be text if they have a text mime type (image/svg+xml).
1603             - XHR / Fetch / Other may be sent as text if they have a text mime type.
1604             - XHR / Fetch / Other are not assumed to be text, and may be sent as base64 encoded.
1605         
1606         For this to be useful the frontend should also check the mime type and
1607         display an appropriate ContentView.
1608
1609 2017-12-05  Youenn Fablet  <youenn@apple.com>
1610
1611         Implement https://w3c.github.io/ServiceWorker/#clients-claim
1612         https://bugs.webkit.org/show_bug.cgi?id=180261
1613
1614         Reviewed by Chris Dumez.
1615
1616         Test: http/tests/workers/service/serviceworkerclients-claim.https.html
1617
1618         Implement claim by going to the storage process and then iterate over clients to see whether active worker can be set.
1619         Update SWServerWorker to call registration tryClear/tryActivate whenever a service worker has no pending event.
1620
1621         * workers/service/ServiceWorkerClients.cpp:
1622         (WebCore::ServiceWorkerClients::claim):
1623         * workers/service/context/SWContextManager.h:
1624         * workers/service/server/SWServer.cpp:
1625         (WebCore::SWServer::claim):
1626         (WebCore::SWServer::doRegistrationMatching):
1627         (WebCore::SWServer::doRegistrationMatching const): Deleted.
1628         * workers/service/server/SWServer.h:
1629         (WebCore::SWServer::Connection::doRegistrationMatching):
1630         * workers/service/server/SWServerRegistration.cpp:
1631         (WebCore::SWServerRegistration::controlClient):
1632         * workers/service/server/SWServerRegistration.h:
1633         * workers/service/server/SWServerToContextConnection.cpp:
1634         (WebCore::SWServerToContextConnection::claim):
1635         * workers/service/server/SWServerToContextConnection.h:
1636         * workers/service/server/SWServerWorker.cpp:
1637         (WebCore::SWServerWorker::claim):
1638         * workers/service/server/SWServerWorker.h:
1639
1640 2017-12-05  Per Arne Vollan  <pvollan@apple.com>
1641
1642         [Win] Scrollbars are sometimes not rendered in accelerated compositing mode.
1643         https://bugs.webkit.org/show_bug.cgi?id=180431
1644         <rdar://problem/34531264>
1645
1646         Reviewed by Simon Fraser.
1647
1648         No new tests, covered by existing tests.
1649
1650         When a scroll layer is required, we will create an overflow control hosts layer.
1651         In this case the method RenderLayerCompositor::shouldCompositeOverflowControls()
1652         should return true, otherwise the scrollbars will not be rendered.
1653  
1654         * rendering/RenderLayerCompositor.cpp:
1655         (WebCore::RenderLayerCompositor::shouldCompositeOverflowControls const):
1656
1657 2017-12-05  Youenn Fablet  <youenn@apple.com>
1658
1659         Call "Terminate Service Worker" on all workers when all their clients are gone
1660         https://bugs.webkit.org/show_bug.cgi?id=179552
1661         <rdar://problem/35836323>
1662
1663         Unreviewed.
1664
1665         * workers/service/server/SWServer.cpp: Reducing from 60_s to 10_s based on bugzilla comment.
1666
1667 2017-12-05  Chris Dumez  <cdumez@apple.com>
1668
1669         Add support for ServiceWorkerContainer.prototype.ready
1670         https://bugs.webkit.org/show_bug.cgi?id=180383
1671
1672         Reviewed by Youenn Fablet.
1673
1674         Add support for ServiceWorkerContainer.prototype.ready:
1675         - https://w3c.github.io/ServiceWorker/#navigator-service-worker-ready
1676
1677         No new tests, rebaselined existing test.
1678
1679         * workers/service/SWClientConnection.h:
1680         * workers/service/ServiceWorkerContainer.cpp:
1681         (WebCore::ServiceWorkerContainer::ServiceWorkerContainer):
1682         (WebCore::ServiceWorkerContainer::ready):
1683         * workers/service/ServiceWorkerContainer.h:
1684         * workers/service/ServiceWorkerRegistrationKey.h:
1685         * workers/service/server/SWServer.cpp:
1686         (WebCore::SWServer::resolveRegistrationReadyRequests):
1687         * workers/service/server/SWServer.h:
1688         * workers/service/server/SWServerRegistration.cpp:
1689         (WebCore::SWServerRegistration::activate):
1690         (WebCore::SWServerRegistration::setIsUninstalling):
1691         * workers/service/server/SWServerRegistration.h:
1692
1693 2017-12-05  Yusuke Suzuki  <utatane.tea@gmail.com>
1694
1695         Modernize WebThread code for further refactoring
1696         https://bugs.webkit.org/show_bug.cgi?id=180344
1697
1698         Reviewed by Alex Christensen.
1699
1700         When touching Thread and its initialization component, we need to touch
1701         web thread initialization code too. However, since web thread code is old,
1702         it's style is not following to WebKit coding style guidelines.
1703
1704         This patch first modernizes WebThread code for further refactoring.
1705
1706         1. `Type*` instead of `Type *`.
1707         2. Use std::call_once instead of pthread_once.
1708         3. Use static_cast instead of C-cast.
1709         4. Use nullptr instead of NULL.
1710         5. Use `ret` or `!ret` instead of `ret != 0` or `ret == 0`.
1711         6. Do not use #pragma unused.
1712         7. if-else with one statement should not have braces.
1713
1714         In this patch, we do not change pthread_condition_t to WTF::Condition and
1715         pthread_mutex_t to WTF::Lock since web thread code requires extra care about
1716         threading.
1717
1718         No behavior change.
1719
1720         * platform/ios/wak/WebCoreThread.mm:
1721         (-[NSObject releaseOnMainThread]):
1722         (SendMessage):
1723         (HandleDelegateSource):
1724         (SendDelegateMessage):
1725         (WebThreadAdoptAndRelease):
1726         (lockWebCoreReleaseLock):
1727         (unlockWebCoreReleaseLock):
1728         (WebCoreObjCDeallocOnWebThreadImpl):
1729         (WebCoreObjCDeallocWithWebThreadLockImpl):
1730         (HandleWebThreadReleaseSource):
1731         (WebThreadCallDelegate):
1732         (WebThreadPostNotification):
1733         (WebThreadCallDelegateAsync):
1734         (WebThreadMakeNSInvocation):
1735         (MainRunLoopAutoUnlock):
1736         (_WebThreadAutoLock):
1737         (WebRunLoopLock):
1738         (WebRunLoopUnlock):
1739         (MainRunLoopUnlockGuard):
1740         (CurrentThreadContext):
1741         (RunWebThread):
1742         (StartWebThread):
1743         (WebTimedConditionLock):
1744         (_WebTryThreadLock):
1745         (WebThreadUnlockFromAnyThread):
1746         (WebThreadUnlockGuardForMail):
1747         (_WebThreadUnlock):
1748         (WebThreadIsLocked):
1749         (WebThreadLockPopModal):
1750         (WebThreadCurrentContext):
1751         (WebThreadEnable):
1752         (FreeThreadContext): Deleted.
1753         (InitThreadContextKey): Deleted.
1754
1755 2017-12-05  Alex Christensen  <achristensen@webkit.org>
1756
1757         Fix non-unified build after r225381
1758         https://bugs.webkit.org/show_bug.cgi?id=180434
1759
1760         Reviewed by Keith Miller.
1761
1762         * loader/ResourceTimingInformation.cpp:
1763         FrameLoader.h is included in other files that are combined with this file in unified builds,
1764         but we need to merge r225381 to a branch that doesn't use unified builds.  This build failure
1765         would've come up randomly in the future when we add files, too.
1766
1767 2017-12-05  Simon Fraser  <simon.fraser@apple.com>
1768
1769         Remove webkitGetImageDataHD and webkitPutImageDataHD from canvas API
1770         https://bugs.webkit.org/show_bug.cgi?id=180387
1771
1772         Reviewed by Dean Jackson.
1773
1774         CanvasRenderingContext2D.webkitGetImageDataHD and webkitPutImageDataHD were never standardized,
1775         and Blink removed support in 2014 (https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/FOPH5dloGG8).
1776
1777         Since our canvas backing store is always 1x, they have no use anyway, so remove them.
1778
1779         * html/canvas/CanvasRenderingContext2D.cpp:
1780         (WebCore::CanvasRenderingContext2D::putImageData):
1781         (WebCore::CanvasRenderingContext2D::webkitGetImageDataHD const): Deleted.
1782         (WebCore::CanvasRenderingContext2D::webkitPutImageDataHD): Deleted.
1783         * html/canvas/CanvasRenderingContext2D.h:
1784         * html/canvas/CanvasRenderingContext2D.idl:
1785
1786 2017-12-05  Youenn Fablet  <youenn@apple.com>
1787
1788         Implement setting of service worker to client in SWServer without going to WebProcess
1789         https://bugs.webkit.org/show_bug.cgi?id=180382
1790
1791         Reviewed by Chris Dumez.
1792
1793         No change of behavior.
1794
1795         This patch removes the notification of active worker setting from ScriptExecution/WebProcess up to SWServer/StorageProcess.
1796         Instead, active worker setting is fully done/controlled in SWServer.
1797         Whenever there is a change, SWServer notifies WebProcess and ScriptExecutionContext gets updated accordingly.
1798
1799         * dom/Document.cpp:
1800         (WebCore::Document::setServiceWorkerConnection):
1801         * dom/ScriptExecutionContext.cpp:
1802         (WebCore::ScriptExecutionContext::setActiveServiceWorker):
1803         * loader/DocumentLoader.cpp:
1804         (WebCore::DocumentLoader::commitData):
1805         * workers/service/SWClientConnection.h:
1806         * workers/service/server/SWServer.cpp:
1807         (WebCore::SWServer::setClientActiveWorker):
1808         (WebCore::SWServer::registerServiceWorkerClient):
1809         (WebCore::SWServer::registrationFromServiceWorkerIdentifier):
1810         (WebCore::SWServer::unregisterServiceWorkerClient):
1811         (WebCore::SWServer::Connection::serviceWorkerStartedControllingClient): Deleted.
1812         (WebCore::SWServer::Connection::serviceWorkerStoppedControllingClient): Deleted.
1813         (WebCore::SWServer::serviceWorkerStartedControllingClient): Deleted.
1814         (WebCore::SWServer::serviceWorkerStoppedControllingClient): Deleted.
1815         * workers/service/server/SWServer.h:
1816         * workers/service/server/SWServerRegistration.cpp:
1817         (WebCore::SWServerRegistration::activate):
1818
1819 2017-12-01  Filip Pizlo  <fpizlo@apple.com>
1820
1821         GC constraint solving should be parallel
1822         https://bugs.webkit.org/show_bug.cgi?id=179934
1823
1824         Reviewed by JF Bastien.
1825
1826         No new tests because no change in behavior. This change is best tested using DOM-GC-intensive
1827         benchmarks like Speedometer and Dromaeo.
1828         
1829         This parallelizes the DOM's output constraint, and makes some small changes to make this more
1830         scalable.
1831
1832         * ForwardingHeaders/heap/SimpleMarkingConstraint.h: Added.
1833         * ForwardingHeaders/heap/VisitingTimeout.h: Removed.
1834         * Sources.txt:
1835         * WebCore.xcodeproj/project.pbxproj:
1836         * bindings/js/DOMGCOutputConstraint.cpp: Added.
1837         (WebCore::DOMGCOutputConstraint::DOMGCOutputConstraint):
1838         (WebCore::DOMGCOutputConstraint::~DOMGCOutputConstraint):
1839         (WebCore::DOMGCOutputConstraint::executeImpl):
1840         (WebCore::DOMGCOutputConstraint::doParallelWorkImpl):
1841         (WebCore::DOMGCOutputConstraint::finishParallelWorkImpl):
1842         * bindings/js/DOMGCOutputConstraint.h: Added.
1843         * bindings/js/WebCoreJSClientData.cpp:
1844         (WebCore::JSVMClientData::initNormalWorld):
1845         * dom/Node.cpp:
1846         (WebCore::Node::eventTargetDataConcurrently):
1847         (WebCore::Node::ensureEventTargetData):
1848         (WebCore::Node::clearEventTargetData):
1849
1850 2017-12-05  Antoine Quint  <graouts@apple.com>
1851
1852         <video> and scale() transforms yield shrunk small or clipped controls
1853         https://bugs.webkit.org/show_bug.cgi?id=180358
1854         <rdar://problem/34436124>
1855
1856         Unreviewed.
1857
1858         Use DOMMatrix vs. WebKitCSSMatrix per Simon's post-commit review feedback.
1859
1860         * Modules/modern-media-controls/media/media-controller.js:
1861         (MediaController.prototype._updateControlsSize):
1862
1863 2017-12-04  Chris Dumez  <cdumez@apple.com>
1864
1865         Support container.getRegistration() / getRegistrations() inside service workers
1866         https://bugs.webkit.org/show_bug.cgi?id=180360
1867
1868         Reviewed by Youenn Fablet.
1869
1870         Support container.getRegistration() / getRegistrations() inside service workers
1871         by making sure we hop to the right thread when needed.
1872
1873         Test: http/tests/workers/service/ServiceWorkerGlobalScope_getRegistration.html
1874
1875         * dom/ScriptExecutionContext.cpp:
1876         (WebCore::ScriptExecutionContext::postTaskTo):
1877         * dom/ScriptExecutionContext.h:
1878         * workers/service/SWClientConnection.cpp:
1879         (WebCore::SWClientConnection::jobRejectedInServer):
1880         (WebCore::SWClientConnection::registrationJobResolvedInServer):
1881         (WebCore::SWClientConnection::unregistrationJobResolvedInServer):
1882         (WebCore::SWClientConnection::startScriptFetchForServer):
1883         (WebCore::SWClientConnection::clearPendingJobs):
1884         * workers/service/SWClientConnection.h:
1885         * workers/service/ServiceWorkerContainer.cpp:
1886         (WebCore::ServiceWorkerContainer::getRegistration):
1887         (WebCore::ServiceWorkerContainer::didFinishGetRegistrationRequest):
1888         (WebCore::ServiceWorkerContainer::getRegistrations):
1889         (WebCore::ServiceWorkerContainer::didFinishGetRegistrationsRequest):
1890         (WebCore::ServiceWorkerContainer::stop):
1891         * workers/service/ServiceWorkerContainer.h:
1892
1893 2017-12-04  Simon Fraser  <simon.fraser@apple.com>
1894
1895         Cleanup code that computes iframe content offsets in FrameView
1896         https://bugs.webkit.org/show_bug.cgi?id=180385
1897
1898         Reviewed by Zalan Bujtas.
1899
1900         The coordinate conversion functions in FrameView explicitly added borderLeft/paddingLeft
1901         and borderTop/paddingTop to compute the offset from the contents of a frame to its parent renderer.
1902         
1903         This is equivalent to the call to contextBoxRect() that RenderWidget::updateWidgetGeometry() does,
1904         which also takes left-side scrollbars into account.
1905         
1906         Coordinate offsets don't need height and width, so add RenderBox::contentBoxLocation() that just
1907         computes the top left, and use it in FrameView.
1908
1909         * page/FrameView.cpp:
1910         (WebCore::FrameView::invalidateRect):
1911         (WebCore::FrameView::convertToContainingView const):
1912         (WebCore::FrameView::convertFromContainingView const):
1913         * platform/graphics/FloatPoint.h:
1914         (WebCore::FloatPoint::scaled const):
1915         (WebCore::FloatPoint::scaled): Deleted.
1916         * rendering/RenderBox.cpp:
1917         (WebCore::RenderBox::contentBoxLocation const):
1918         * rendering/RenderBox.h:
1919
1920 2017-12-04  Nan Wang  <n_wang@apple.com>
1921
1922         AX: AOM: Implement relation type properties
1923         https://bugs.webkit.org/show_bug.cgi?id=179500
1924
1925         Reviewed by Ryosuke Niwa.
1926
1927         Accessibility Object Model
1928         Explainer: https://wicg.github.io/aom/explainer.html
1929         Spec: https://wicg.github.io/aom/spec/
1930
1931         Implemented the AOM support for activeDescendant, details and errorMessage.
1932         The corresponding ARIA attributes all take IDREFs, and the AOM properties
1933         take references to AccessibleNodes instead.
1934
1935         Test: accessibility/mac/AOM-relation-property.html
1936
1937         * accessibility/AccessibilityObject.cpp:
1938         (WebCore::AccessibilityObject::getAttribute const):
1939         (WebCore::AccessibilityObject::hasProperty const):
1940         (WebCore::AccessibilityObject::stringValueForProperty const):
1941         (WebCore::AccessibilityObject::boolValueForProperty const):
1942         (WebCore::AccessibilityObject::intValueForProperty const):
1943         (WebCore::AccessibilityObject::unsignedValueForProperty const):
1944         (WebCore::AccessibilityObject::doubleValueForProperty const):
1945         (WebCore::AccessibilityObject::elementValueForProperty const):
1946         (WebCore::AccessibilityObject::supportsARIAAttributes const):
1947         (WebCore::AccessibilityObject::elementsFromProperty const):
1948         (WebCore::AccessibilityObject::elementsReferencedByProperty const):
1949         (WebCore::AccessibilityObject::ariaActiveDescendantReferencingElements const):
1950         (WebCore::AccessibilityObject::ariaDetailsElements const):
1951         (WebCore::AccessibilityObject::ariaDetailsReferencingElements const):
1952         (WebCore::AccessibilityObject::ariaErrorMessageElements const):
1953         (WebCore::AccessibilityObject::ariaErrorMessageReferencingElements const):
1954         * accessibility/AccessibilityObject.h:
1955         * accessibility/AccessibilityRenderObject.cpp:
1956         (WebCore::AccessibilityRenderObject::activeDescendant const):
1957         * accessibility/AccessibleNode.cpp:
1958         (WebCore::ariaAttributeMap):
1959         (WebCore::isPropertyValueRelation):
1960         (WebCore::AccessibleNode::attributeFromAXPropertyName):
1961         (WebCore::AccessibleNode::setRelationProperty):
1962         (WebCore::AccessibleNode::singleRelationValueForProperty):
1963         (WebCore::AccessibleNode::activeDescendant const):
1964         (WebCore::AccessibleNode::setActiveDescendant):
1965         (WebCore::AccessibleNode::details const):
1966         (WebCore::AccessibleNode::setDetails):
1967         (WebCore::AccessibleNode::errorMessage const):
1968         (WebCore::AccessibleNode::setErrorMessage):
1969         * accessibility/AccessibleNode.h:
1970         * accessibility/AccessibleNode.idl:
1971         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1972         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
1973
1974 2017-12-04  Simon Fraser  <simon.fraser@apple.com>
1975
1976         Minor DisplayRefreshMonitor-related cleanup
1977         https://bugs.webkit.org/show_bug.cgi?id=179802
1978
1979         Reviewed by Sam Weinig.
1980
1981         New trace point for when the CVDisplayLink fires on its own thread.
1982
1983         Some #pragma once, and put all the WellKnownRunLoopOrders in one place.
1984
1985         * inspector/agents/InspectorTimelineAgent.cpp:
1986         (WebCore::InspectorTimelineAgent::internalStart):
1987         * platform/cf/RunLoopObserver.h:
1988         * platform/graphics/DisplayRefreshMonitor.cpp:
1989         (WebCore::DisplayRefreshMonitor::displayDidRefresh):
1990         * platform/graphics/ca/LayerFlushScheduler.h:
1991         * platform/graphics/ca/cocoa/LayerFlushSchedulerMac.cpp:
1992         (WebCore::LayerFlushScheduler::LayerFlushScheduler):
1993
1994 2017-12-04  David Quesada  <david_quesada@apple.com>
1995
1996         Add a class for parsing application manifests
1997         https://bugs.webkit.org/show_bug.cgi?id=177973
1998         rdar://problem/34747949
1999
2000         Reviewed by Geoffrey Garen.
2001
2002         Add a new struct ApplicationManifest, along with ApplicationManifestParser to initialize
2003         ApplicationManifests from JSON data, according to the App Manifest spec. Just a basic subset
2004         of the manifests's properties are implemented to start with.
2005
2006         ApplicationManifestParser is tested by new unit tests in TestWebKitAPI.
2007
2008         * Configurations/FeatureDefines.xcconfig: Add ENABLE_APPLICATION_MANIFEST feature flag.
2009         * Modules/applicationmanifest/ApplicationManifest.h: Added.
2010         * Modules/applicationmanifest/ApplicationManifestParser.cpp: Added.
2011         (WebCore::ApplicationManifestParser::parse):
2012         The main entry point for eventual clients (and currently the unit tests) to invoke
2013         ApplicationManifestParser. There is a variant that accepts a ScriptExecutionContext that
2014         uses the context exclusively for logging console warnings while parsing the manifest, and
2015         not for actually executing any scripts.
2016         (WebCore::ApplicationManifestParser::ApplicationManifestParser):
2017         (WebCore::ApplicationManifestParser::parseManifest):
2018         (WebCore::ApplicationManifestParser::logManifestPropertyNotAString):
2019         (WebCore::ApplicationManifestParser::logManifestPropertyInvalidURL):
2020         (WebCore::ApplicationManifestParser::logDeveloperWarning):
2021         (WebCore::ApplicationManifestParser::parseStartURL):
2022         (WebCore::ApplicationManifestParser::parseName):
2023         (WebCore::ApplicationManifestParser::parseDescription):
2024         (WebCore::ApplicationManifestParser::parseShortName):
2025         (WebCore::isInScope):
2026         (WebCore::ApplicationManifestParser::parseScope):
2027         (WebCore::ApplicationManifestParser::parseGenericString):
2028         * Modules/applicationmanifest/ApplicationManifestParser.h: Added.
2029         * Sources.txt:
2030         * WebCore.xcodeproj/project.pbxproj:
2031         * features.json: Change the Web App Manifest feature status to "In Development"
2032
2033 2017-12-04  Zalan Bujtas  <zalan@apple.com>
2034
2035         RenderMultiColumnFlow::fragmentedFlowDescendantInserted should not destroy incoming newDescendant
2036         https://bugs.webkit.org/show_bug.cgi?id=180181
2037
2038         Reviewed by Antti Koivisto.
2039
2040         This is in preparation for having all multicolumn related tree mutation in RenderTreeUpdaterMultiColumn.
2041
2042         Covered by fast/multicol/column-span-range-crash.html
2043
2044         * rendering/RenderMultiColumnFlow.cpp:
2045         (WebCore::RenderMultiColumnFlow::fragmentedFlowDescendantInserted):
2046         * rendering/RenderMultiColumnFlow.h:
2047         * style/RenderTreeUpdaterMultiColumn.cpp:
2048         (WebCore::RenderTreeUpdater::MultiColumn::destroyFragmentedFlow):
2049
2050 2017-12-04  JF Bastien  <jfbastien@apple.com>
2051
2052         Update std::expected to match libc++ coding style
2053         https://bugs.webkit.org/show_bug.cgi?id=180264
2054
2055         Reviewed by Alex Christensen.
2056
2057         Update various uses of Expected, mostly renaming valueOr and
2058         hasValue to the STL naming convention.
2059
2060         * Modules/cache/DOMCache.cpp:
2061         (WebCore::DOMCache::retrieveRecords):
2062         (WebCore::DOMCache::batchDeleteOperation):
2063         (WebCore::DOMCache::batchPutOperation):
2064         * Modules/cache/DOMCacheStorage.cpp:
2065         (WebCore::DOMCacheStorage::retrieveCaches):
2066         (WebCore::DOMCacheStorage::open):
2067         (WebCore::DOMCacheStorage::remove):
2068         * Modules/cache/WorkerCacheStorageConnection.cpp:
2069         (WebCore::WorkerCacheStorageConnection::doRemove):
2070         (WebCore::WorkerCacheStorageConnection::doRetrieveCaches):
2071         (WebCore::recordsDataOrErrorFromRecords):
2072         (WebCore::recordsOrErrorFromRecordsData):
2073         * bindings/js/CachedScriptFetcher.cpp:
2074         (WebCore::CachedScriptFetcher::requestScriptWithCache const):
2075         * contentextensions/ContentExtensionCompiler.cpp:
2076         (WebCore::ContentExtensions::compileRuleList):
2077         * contentextensions/ContentExtensionParser.cpp:
2078         (WebCore::ContentExtensions::getDomainList):
2079         (WebCore::ContentExtensions::loadTrigger):
2080         (WebCore::ContentExtensions::loadRule):
2081         (WebCore::ContentExtensions::loadEncodedRules):
2082         (WebCore::ContentExtensions::parseRuleList):
2083         * css/CSSFontFaceSrcValue.cpp:
2084         (WebCore::CSSFontFaceSrcValue::cachedFont):
2085         * css/CSSImageSetValue.cpp:
2086         (WebCore::CSSImageSetValue::loadBestFitImage):
2087         * css/CSSImageValue.cpp:
2088         (WebCore::CSSImageValue::loadImage):
2089         * css/StyleRuleImport.cpp:
2090         (WebCore::StyleRuleImport::requestStyleSheet):
2091         * dom/CallbackResult.h:
2092         (WebCore::CallbackResult<ReturnType>::type const):
2093         (WebCore::CallbackResult<ReturnType>::releaseReturnValue):
2094         * dom/Element.cpp:
2095         (WebCore::Element::getIntegralAttribute const):
2096         (WebCore::Element::getUnsignedIntegralAttribute const):
2097         * dom/ExceptionOr.h:
2098         (WebCore::ExceptionOr<ReturnType>::hasException const):
2099         (WebCore::ExceptionOr<void>::hasException const):
2100         * dom/ProcessingInstruction.cpp:
2101         (WebCore::ProcessingInstruction::checkStyleSheet):
2102         * html/HTMLInputElement.cpp:
2103         (WebCore::HTMLInputElement::maxLengthAttributeChanged):
2104         (WebCore::HTMLInputElement::minLengthAttributeChanged):
2105         * html/HTMLLinkElement.cpp:
2106         (WebCore::HTMLLinkElement::process):
2107         * html/HTMLTextAreaElement.cpp:
2108         (WebCore::HTMLTextAreaElement::maxLengthAttributeChanged):
2109         (WebCore::HTMLTextAreaElement::minLengthAttributeChanged):
2110         * html/parser/HTMLParserIdioms.cpp:
2111         (WebCore::parseHTMLNonNegativeInteger):
2112         * html/parser/HTMLParserIdioms.h:
2113         (WebCore::limitToOnlyHTMLNonNegative):
2114         * loader/CrossOriginPreflightChecker.cpp:
2115         (WebCore::CrossOriginPreflightChecker::startPreflight):
2116         * loader/DocumentLoader.cpp:
2117         (WebCore::DocumentLoader::loadMainResource):
2118         * loader/DocumentThreadableLoader.cpp:
2119         (WebCore::DocumentThreadableLoader::loadRequest):
2120         * loader/ImageLoader.cpp:
2121         (WebCore::ImageLoader::updateFromElement):
2122         * loader/LinkLoader.cpp:
2123         (WebCore::LinkLoader::preloadIfNeeded):
2124         (WebCore::LinkLoader::loadLink):
2125         * loader/MediaResourceLoader.cpp:
2126         (WebCore::MediaResourceLoader::requestResource):
2127         * loader/TextTrackLoader.cpp:
2128         (WebCore::TextTrackLoader::load):
2129         * loader/cache/CachedSVGDocumentReference.cpp:
2130         (WebCore::CachedSVGDocumentReference::load):
2131         * loader/icon/IconLoader.cpp:
2132         (WebCore::IconLoader::startLoading):
2133         * platform/URLParser.cpp:
2134         (WebCore::URLParser::parseIPv4Host):
2135         * platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp:
2136         (WebCore::WebCoreAVCFResourceLoader::startLoading):
2137         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
2138         (WebCore::WebCoreAVFResourceLoader::startLoading):
2139         * svg/SVGFEImageElement.cpp:
2140         (WebCore::SVGFEImageElement::requestImageResource):
2141         * svg/SVGFontFaceUriElement.cpp:
2142         (WebCore::SVGFontFaceUriElement::loadFont):
2143         * svg/SVGUseElement.cpp:
2144         (WebCore::SVGUseElement::updateExternalDocument):
2145         * xml/XSLImportRule.cpp:
2146         (WebCore::XSLImportRule::loadSheet):
2147
2148 2017-12-04  Zalan Bujtas  <zalan@apple.com>
2149
2150         REGRESSION (r211531): Text flow changes and overlaps other text after double-click selecting paragraph
2151         https://bugs.webkit.org/show_bug.cgi?id=180377
2152         <rdar://problem/34337967>
2153
2154         Reviewed by Antti Koivisto.
2155
2156         Take floats into account when computing the available width for a certain vertical position.
2157
2158         Test: fast/block/float/simple-line-layout-float-shrink-line.html
2159
2160         * rendering/SimpleLineLayout.cpp:
2161         (WebCore::SimpleLineLayout::updateLineConstrains):
2162
2163 2017-12-04  Antoine Quint  <graouts@apple.com>
2164
2165         <video> and scale() transforms yield shrunk small or clipped controls
2166         https://bugs.webkit.org/show_bug.cgi?id=180358
2167         <rdar://problem/34436124>
2168
2169         Reviewed by Dean Jackson.
2170
2171         To compute the bounds of the media controls, we would call getBoundingClientRect()
2172         on the root-most element in the shadow root, which is styled to have width and height
2173         set to 100%, which allows to match the metrics of the host media element, without
2174         the borders.
2175
2176         However, if the host media element has CSS transforms applied, these would be factored
2177         into calls to getBoundingClientRect() and the controls would be too large and clipped,
2178         in case the scale was more than 1, or shrunk, in case the scale was less than 1.
2179
2180         To obtain correct metrics, we computed the complete transformation matrix applied to
2181         the host media element, and apply its inverted matrix to each corner point of the
2182         bounds returned for the root-most container element in the shadow root.
2183
2184         Then we compute the width and height of this transformed rectangle and set those to
2185         be our media controls' metrics.
2186
2187         Test: media/modern-media-controls/css/transformed-media.html
2188
2189         * Modules/modern-media-controls/media/media-controller.js:
2190         (MediaController.prototype._updateControlsSize):
2191         (MediaController.prototype._controlsWidth): Deleted.
2192
2193 2017-12-04  Antoine Quint  <graouts@apple.com>
2194
2195         Cursor is not visible after exiting full screen video
2196         https://bugs.webkit.org/show_bug.cgi?id=180247
2197         <rdar://problem/33885922>
2198
2199         Reviewed by Dean Jackson.
2200
2201         There is a dedicated NSCursor method to temporarily hide the mouse cursor while the mouse is idle,
2202         so we use this platform functionality, already exposed through the page chrome, instead which
2203         implements the expected behavior. Now, the mouse cursor is hidden while the mouse is stationary
2204         when a <video> is fullscreen, as before, but as soon as the user exits fullscreen, the mouse cursor
2205         reappears.
2206
2207         No test provided as I don't believe this platform behavior can be tested, there is no API to query
2208         whether the cursor is visible.
2209
2210         * page/EventHandler.cpp:
2211         (WebCore::EventHandler::cancelAutoHideCursorTimer):
2212         (WebCore::EventHandler::autoHideCursorTimerFired):
2213
2214 2017-12-04  Chris Dumez  <cdumez@apple.com>
2215
2216         ServiceWorkerGlobalScope::skipWaiting(Ref<DeferredPromise>&&) is unsafe
2217         https://bugs.webkit.org/show_bug.cgi?id=180372
2218
2219         Reviewed by Youenn Fablet.
2220
2221         Ref the WorkerThread and capture it in the lambda. Keep the pending promises in
2222         a HashMap on the ServiceWorkerGlobalScope so that they stay on the worker thread.
2223
2224         * workers/service/ServiceWorkerGlobalScope.cpp:
2225         (WebCore::ServiceWorkerGlobalScope::skipWaiting):
2226         * workers/service/ServiceWorkerGlobalScope.h:
2227
2228 2017-12-04  Brady Eidson  <beidson@apple.com>
2229
2230         Get a directory path to SWServers for storing ServiceWorker registrations.
2231         https://bugs.webkit.org/show_bug.cgi?id=180362
2232
2233         Reviewed by Chris Dumez.
2234
2235         No new tests (No observable behavior change yet).
2236
2237         * workers/service/server/SWServer.cpp:
2238         (WebCore::SWServer::SWServer):
2239         * workers/service/server/SWServer.h:
2240
2241 2017-12-04  Devin Rousso  <webkit@devinrousso.com>
2242
2243         Web Inspector: provide method for recording CanvasRenderingContext2D from JavaScript
2244         https://bugs.webkit.org/show_bug.cgi?id=175166
2245         <rdar://problem/34040740>
2246
2247         Reviewed by Joseph Pecoraro.
2248
2249         No new tests, updated existing tests.
2250
2251         * inspector/InspectorCanvas.h:
2252         * inspector/InspectorCanvas.cpp:
2253         (WebCore::InspectorCanvas::resetRecordingData):
2254
2255         * inspector/InspectorCanvasAgent.h:
2256         * inspector/InspectorCanvasAgent.cpp:
2257         (WebCore::InspectorCanvasAgent::didFinishRecordingCanvasFrame):
2258         (WebCore::InspectorCanvasAgent::consoleStartRecordingCanvas):
2259
2260         * inspector/InspectorInstrumentation.h:
2261         * inspector/InspectorInstrumentation.cpp:
2262         (WebCore::InspectorInstrumentation::consoleStartRecordingCanvas):
2263         (WebCore::InspectorInstrumentation::consoleStartRecordingCanvasImpl):
2264
2265         * page/PageConsoleClient.h:
2266         * page/PageConsoleClient.cpp:
2267         (WebCore::PageConsoleClient::record):
2268         (WebCore::PageConsoleClient::recordEnd):
2269
2270         * workers/WorkerConsoleClient.h:
2271         * workers/WorkerConsoleClient.cpp:
2272         (WebCore::WorkerConsoleClient::record):
2273         (WebCore::WorkerConsoleClient::recordEnd):
2274
2275 2017-12-04  Youenn Fablet  <youenn@apple.com>
2276
2277         Call "Terminate Service Worker" on all workers when all their clients are gone
2278         https://bugs.webkit.org/show_bug.cgi?id=179552
2279
2280         Reviewed by Chris Dumez.
2281
2282         Tested manually.
2283
2284         When SWServer detects that there is no longer any client for a given client origin,
2285         it iterates through the running workers to terminate them if they have the given client origin.
2286         A timer of 60 seconds is used in case a user closes a tab or a window, and reopens one with the same origin shortly after.
2287
2288         * workers/service/server/SWServer.cpp:
2289         (WebCore::SWServer::findClientByIdentifier):
2290         (WebCore::SWServer::matchAll):
2291         (WebCore::SWServer::registerServiceWorkerClient):
2292         (WebCore::SWServer::unregisterServiceWorkerClient):
2293         * workers/service/server/SWServer.h:
2294
2295 2017-12-04  Antti Koivisto  <antti@apple.com>
2296
2297         Enable selector filtering for ::before and ::after pseudo element resolution
2298         https://bugs.webkit.org/show_bug.cgi?id=180364
2299
2300         Reviewed by Ryosuke Niwa.
2301
2302         Since these pseudo elements are now resolved by TreeResolver we can use selector filter for them.
2303
2304         This is 10%+ progression in StyleBench pseudo element subtest.
2305
2306         * css/StyleResolver.cpp:
2307         (WebCore::StyleResolver::pseudoStyleForElement):
2308         * css/StyleResolver.h:
2309         * style/StyleTreeResolver.cpp:
2310         (WebCore::Style::TreeResolver::resolvePseudoStyle):
2311
2312 2017-12-04  Youenn Fablet  <youenn@apple.com>
2313
2314         Add support https://w3c.github.io/ServiceWorker/#on-client-unload-algorithm
2315         https://bugs.webkit.org/show_bug.cgi?id=180359
2316
2317         Reviewed by Chris Dumez.
2318
2319         This algorithm is needed for implementation of claim.
2320         As per specification, it is run for every client unload, hence why this is put in removeClientUsingRegistration.
2321
2322         * workers/service/server/SWServerRegistration.cpp:
2323         (WebCore::SWServerRegistration::removeClientUsingRegistration):
2324         (WebCore::SWServerRegistration::handleClientUnload):
2325         * workers/service/server/SWServerRegistration.h:
2326
2327 2017-12-04  Antti Koivisto  <antti@apple.com>
2328
2329         Remove duplicates from selector filter hashes
2330         https://bugs.webkit.org/show_bug.cgi?id=180354
2331
2332         Reviewed by Simon Fraser.
2333
2334         We have only four slots for hashes in RuleSet and adding more regresses performance. To use the limited slots
2335         better we should eliminate duplicates.
2336
2337         This patch also switches to using std::array instead of a C array for the hashes.
2338
2339         The patch reduces the number of selectors passing through the selector filter in StyleBench by ~0.4%.
2340
2341         * css/ElementRuleCollector.cpp:
2342         (WebCore::ElementRuleCollector::collectMatchingRulesForList):
2343         * css/RuleSet.cpp:
2344         (WebCore::RuleData::RuleData):
2345         * css/RuleSet.h:
2346         (WebCore::RuleData::descendantSelectorIdentifierHashes const):
2347         * css/SelectorFilter.cpp:
2348         (WebCore::collectDescendantSelectorIdentifierHashes):
2349         (WebCore::SelectorFilter::collectIdentifierHashes):
2350         * css/SelectorFilter.h:
2351         (WebCore::SelectorFilter::fastRejectSelector const):
2352
2353 2017-12-04  Youenn Fablet  <youenn@apple.com>
2354
2355         WorkerCacheStorageConnection should handle the case of terminated workers
2356         https://bugs.webkit.org/show_bug.cgi?id=180304
2357
2358         Reviewed by Chris Dumez.
2359
2360         No web page observable change of behavior.
2361
2362         Reworked WorkerCacheStorageConnection hopping.
2363         Instead of refing/unrefing itself, it refs the worker thread and the main thread connection.
2364         This worker thread is then used on the way back from the main thread.
2365
2366         * Modules/cache/WorkerCacheStorageConnection.cpp:
2367         (WebCore::WorkerCacheStorageConnection::create):
2368         (WebCore::WorkerCacheStorageConnection::WorkerCacheStorageConnection):
2369         (WebCore::WorkerCacheStorageConnection::doOpen):
2370         (WebCore::WorkerCacheStorageConnection::doRemove):
2371         (WebCore::WorkerCacheStorageConnection::doRetrieveCaches):
2372         (WebCore::WorkerCacheStorageConnection::reference):
2373         (WebCore::WorkerCacheStorageConnection::dereference):
2374         (WebCore::WorkerCacheStorageConnection::doRetrieveRecords):
2375         (WebCore::WorkerCacheStorageConnection::doBatchDeleteOperation):
2376         (WebCore::WorkerCacheStorageConnection::doBatchPutOperation):
2377         * Modules/cache/WorkerCacheStorageConnection.h:
2378         * workers/WorkerGlobalScope.cpp:
2379         (WebCore::WorkerGlobalScope::cacheStorageConnection):
2380         * workers/WorkerGlobalScope.h:
2381
2382 2017-12-04  Frederic Wang  <fwang@igalia.com>
2383
2384         Make ScrollingTreeNode::enclosingFrameNode return the node itself for frame nodes
2385         https://bugs.webkit.org/show_bug.cgi?id=180353
2386
2387         Reviewed by Antonio Gomes.
2388
2389         This function was introduced in bug 175135 to solve a rendering bug with fixed positioned
2390         nodes in overflow nodes. For a frame node, the reference frame to use for fixed nodes is
2391         actually the frame node itself or otherwise we will get the same rendering bug. This patch
2392         makes enclosingFrameNode return the node itself when it is a frame node and renames it to
2393         clarify this behavior. Currently, enclosingFrameNode is not used for frame nodes so the
2394         behavior is unchanged.
2395
2396         No new tests, behavior is unchanged.
2397
2398         * page/scrolling/ScrollingTreeNode.cpp:
2399         (WebCore::ScrollingTreeNode::enclosingFrameNodeIncludingSelf): Start the search from a frame
2400         scrolling node from the node itself. Renamed to make explicit that this function may include
2401         the node itself.
2402         * page/scrolling/ScrollingTreeNode.h: Renamed.
2403
2404 2017-12-04  Michael Catanzaro  <mcatanzaro@igalia.com>
2405
2406         [WPE][GTK] Implement PAL::SleepDisabler
2407         https://bugs.webkit.org/show_bug.cgi?id=178485
2408
2409         Reviewed by Carlos Garcia Campos.
2410
2411         Add a comment to warn about some odd use of SleepDisabler in HTMLMediaElement.
2412
2413         * html/HTMLMediaElement.cpp:
2414         (WebCore::HTMLMediaElement::shouldDisableSleep const):
2415
2416 2017-12-04  Frederic Wang  <fwang@igalia.com>
2417
2418         Bug 161300 - Move RenderMathMLRoot:RootType and RenderMathMLScripts:ScriptsType to element classes
2419         https://bugs.webkit.org/show_bug.cgi?id=161300
2420
2421         Reviewed by Darin Adler.
2422
2423         RenderMathMLRoot::m_kind and RenderMathMLScripts::m_scriptType are initialized in the
2424         constructors of the renderer classes from the tag name of the corresponding elements.
2425         This patch moves them into the corresponding element classes and makes them const members
2426         parsed in the constructors. It also introduces a MathMLRootElement class deriving from
2427         MathMLRowElement to store the new member. Finally, the types are redefined as enum classes.
2428
2429         No new tests, behavior unchanged and already covered by existing tests.
2430
2431         * Sources.txt: Add MathMLRootElement files.
2432         * WebCore.xcodeproj/project.pbxproj: Ditto.
2433         * mathml/MathMLAllInOne.cpp: Ditto.
2434         * mathml/MathMLRootElement.cpp:
2435         (WebCore::element): Override this function to downcast to MathMLRootElement.
2436         (WebCore::rootTypeOf): Helper function to parse the root type, moved from RenderMathMLRoot.
2437         (WebCore::MathMLRootElement::MathMLRootElement): Initialize the root type.
2438         (WebCore::MathMLRootElement::create):
2439         (WebCore::MathMLRootElement::createElementRenderer): Moved from MathMLRowElement.
2440         * mathml/MathMLRootElement.h: New class deriving from MathMLRowElement, with a RootType
2441         member exposed to the renderer class.
2442         * mathml/MathMLRowElement.cpp: Remove header for RenderMathMLRoot.h.
2443         (WebCore::MathMLRowElement::createElementRenderer): Moved to MathMLRootElement.
2444         * mathml/MathMLScriptsElement.cpp: Introduce a script type.
2445         (WebCore::scriptTypeOf): Helper function to parse the script type, moved from
2446         RenerMathMLScripts.
2447         (WebCore::MathMLScriptsElement::MathMLScriptsElement): Initialize the script type.
2448         * mathml/MathMLScriptsElement.h: Add new script type member.
2449         (WebCore::MathMLScriptsElement::scriptType const): Expose the script type to the renderer
2450         class.
2451         * mathml/mathtags.in: Map <msqrt> and <mroot> to MathMLRootElement.
2452         * rendering/mathml/RenderMathMLRoot.cpp:
2453         (WebCore::RenderMathMLRoot::RenderMathMLRoot): Use MathMLRootElement and remove parsing of
2454         the root type.
2455         (WebCore::RenderMathMLRoot::rootType const): Helper function to access the root type from
2456         the element class.
2457         (WebCore::RenderMathMLRoot::isValid const): Use rootType() and add prefix for enum class
2458         values.
2459         (WebCore::RenderMathMLRoot::getBase const): Ditto.
2460         (WebCore::RenderMathMLRoot::getIndex const): Ditto.
2461         (WebCore::RenderMathMLRoot::horizontalParameters): Ditto.
2462         (WebCore::RenderMathMLRoot::verticalParameters): Ditto.
2463         (WebCore::RenderMathMLRoot::computePreferredLogicalWidths): Ditto.
2464         (WebCore::RenderMathMLRoot::layoutBlock): Ditto.
2465         (WebCore::RenderMathMLRoot::paint): Ditto.
2466         * rendering/mathml/RenderMathMLRoot.h: Define root type as an enum class, replace
2467         MathMLRowElement with MathMLRootElement, declare and use new rootType() function and remove
2468         the m_kind member.
2469         * rendering/mathml/RenderMathMLScripts.cpp:
2470         (WebCore::RenderMathMLScripts::RenderMathMLScripts): Remove parsing of script type.
2471         (WebCore::RenderMathMLScripts::scriptType const): Helper function to access the script type
2472         from the element class.
2473         (WebCore::RenderMathMLScripts::validateAndGetReferenceChildren): Use scriptType() and add
2474         prefix for enum class values.
2475         (WebCore::RenderMathMLScripts::computePreferredLogicalWidths): Ditto.
2476         (WebCore::RenderMathMLScripts::verticalMetrics): Ditto.
2477         (WebCore::RenderMathMLScripts::layoutBlock): Ditto.
2478         * rendering/mathml/RenderMathMLScripts.h: Define root type as an enum class, declare the
2479         scriptType() function and remove the m_scriptType member.
2480         * rendering/mathml/RenderMathMLUnderOver.cpp:
2481         (WebCore::RenderMathMLUnderOver::isValid const): Use scriptType() and add prefix for enum
2482         class values.
2483         (WebCore::RenderMathMLUnderOver::under const): Ditto.
2484         (WebCore::RenderMathMLUnderOver::over const): Ditto.
2485         (WebCore::RenderMathMLUnderOver::computePreferredLogicalWidths): Ditto.
2486         (WebCore::RenderMathMLUnderOver::hasAccent const): Ditto.
2487         (WebCore::RenderMathMLUnderOver::layoutBlock): Ditto.
2488
2489 2017-12-04  Carlos Garcia Campos  <cgarcia@igalia.com>
2490
2491         [GStreamer] More leaks in TextCombinerGStreamer
2492         https://bugs.webkit.org/show_bug.cgi?id=180331
2493
2494         Reviewed by Michael Catanzaro.
2495
2496         I've noticed more leaks reading the code, but I couldn't check them with valgrind, because I don't know how to
2497         trigger that code path. This patch cleans up the file using smart pointer everywhere.
2498
2499         * platform/graphics/gstreamer/TextCombinerGStreamer.cpp:
2500         (webkit_text_combiner_pad_init):
2501         (webkitTextCombinerPadEvent):
2502         (webkitTextCombinerReleasePad):
2503
2504 2017-12-04  Jer Noble  <jer.noble@apple.com>
2505
2506         Include 'video/*' in image request Accept header if browser supports video media in image contexts.
2507         https://bugs.webkit.org/show_bug.cgi?id=179178
2508
2509         Reviewed by Alex Christensen.
2510
2511         Test: http/tests/images/image-supports-video.html
2512
2513         Ensure that 'video/*' is included in the Accept header by asking the ImageDecoder whether "Video"
2514         media is supported. The ImageDecoder will ask all it's constituent decoders, which aside from
2515         ImageDecoderAVFObjC will say only support the "Image" media type.
2516
2517         Drive-by fix: Make sure the MIMETypeRegistry includes all the types supported by AVFoundation when
2518         ImageDecoderAVFObjC is enabled. Also, now that Image reports it can support video mime types, check
2519         whether MediaDocument can support a given mime type before asking ImageDocument.
2520
2521         * html/HTMLImageElement.cpp:
2522         (WebCore::HTMLImageElement::bestFitSourceFromPictureElement):
2523         * loader/LinkLoader.cpp:
2524         (WebCore::LinkLoader::isSupportedType):
2525         * loader/cache/CachedResourceRequest.cpp:
2526         (WebCore::acceptHeaderValueFromType):
2527         * platform/MIMETypeRegistry.cpp:
2528         (WebCore::MIMETypeRegistry::isSupportedImageVideoOrSVGMIMEType):
2529         (WebCore::MIMETypeRegistry::isSupportedImageOrSVGMIMEType): Deleted.
2530         * platform/MIMETypeRegistry.h:
2531         * platform/graphics/ImageDecoder.cpp:
2532         (WebCore::ImageDecoder::supportsMediaType):
2533         * platform/graphics/ImageDecoder.h:
2534         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.h:
2535         (WebCore::ImageDecoderAVFObjC::supportsMediaType):
2536         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
2537         (WebCore::ImageDecoderAVFObjC::supportsContentType):
2538         * platform/graphics/cg/ImageDecoderCG.h:
2539         * platform/graphics/win/ImageDecoderDirect2D.h:
2540         * platform/image-decoders/ScalableImageDecoder.h:
2541         (WebCore::ScalableImageDecoder::supportsMediaType):
2542         * html/parser/HTMLPreloadScanner.cpp:
2543         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
2544
2545 2017-12-03  Yusuke Suzuki  <utatane.tea@gmail.com>
2546
2547         WTF shouldn't have both Thread and ThreadIdentifier
2548         https://bugs.webkit.org/show_bug.cgi?id=180308
2549
2550         Reviewed by Darin Adler.
2551
2552         No behavior change.
2553
2554         * Modules/indexeddb/IDBActiveDOMObject.h:
2555         (WebCore::IDBActiveDOMObject::originThread const):
2556         (WebCore::IDBActiveDOMObject::performCallbackOnOriginThread):
2557         (WebCore::IDBActiveDOMObject::callFunctionOnOriginThread):
2558         (WebCore::IDBActiveDOMObject::originThreadID const): Deleted.
2559         * Modules/indexeddb/IDBCursor.cpp:
2560         (WebCore::IDBCursor::IDBCursor):
2561         (WebCore::IDBCursor::~IDBCursor):
2562         (WebCore::IDBCursor::sourcesDeleted const):
2563         (WebCore::IDBCursor::transaction const):
2564         (WebCore::IDBCursor::update):
2565         (WebCore::IDBCursor::advance):
2566         (WebCore::IDBCursor::continueFunction):
2567         (WebCore::IDBCursor::uncheckedIterateCursor):
2568         (WebCore::IDBCursor::deleteFunction):
2569         (WebCore::IDBCursor::setGetResult):
2570         * Modules/indexeddb/IDBDatabase.cpp:
2571         (WebCore::IDBDatabase::~IDBDatabase):
2572         (WebCore::IDBDatabase::hasPendingActivity const):
2573         (WebCore::IDBDatabase::name const):
2574         (WebCore::IDBDatabase::version const):
2575         (WebCore::IDBDatabase::objectStoreNames const):
2576         (WebCore::IDBDatabase::renameObjectStore):
2577         (WebCore::IDBDatabase::renameIndex):
2578         (WebCore::IDBDatabase::createObjectStore):
2579         (WebCore::IDBDatabase::transaction):
2580         (WebCore::IDBDatabase::deleteObjectStore):
2581         (WebCore::IDBDatabase::close):
2582         (WebCore::IDBDatabase::connectionToServerLost):
2583         (WebCore::IDBDatabase::maybeCloseInServer):
2584         (WebCore::IDBDatabase::activeDOMObjectName const):
2585         (WebCore::IDBDatabase::canSuspendForDocumentSuspension const):
2586         (WebCore::IDBDatabase::stop):
2587         (WebCore::IDBDatabase::startVersionChangeTransaction):
2588         (WebCore::IDBDatabase::didStartTransaction):
2589         (WebCore::IDBDatabase::willCommitTransaction):
2590         (WebCore::IDBDatabase::didCommitTransaction):
2591         (WebCore::IDBDatabase::willAbortTransaction):
2592         (WebCore::IDBDatabase::didAbortTransaction):
2593         (WebCore::IDBDatabase::didCommitOrAbortTransaction):
2594         (WebCore::IDBDatabase::fireVersionChangeEvent):
2595         (WebCore::IDBDatabase::dispatchEvent):
2596         (WebCore::IDBDatabase::didCreateIndexInfo):
2597         (WebCore::IDBDatabase::didDeleteIndexInfo):
2598         * Modules/indexeddb/IDBIndex.cpp:
2599         (WebCore::IDBIndex::IDBIndex):
2600         (WebCore::IDBIndex::~IDBIndex):
2601         (WebCore::IDBIndex::name const):
2602         (WebCore::IDBIndex::setName):
2603         (WebCore::IDBIndex::objectStore):
2604         (WebCore::IDBIndex::keyPath const):
2605         (WebCore::IDBIndex::unique const):
2606         (WebCore::IDBIndex::multiEntry const):
2607         (WebCore::IDBIndex::rollbackInfoForVersionChangeAbort):
2608         (WebCore::IDBIndex::openCursor):
2609         (WebCore::IDBIndex::openKeyCursor):
2610         (WebCore::IDBIndex::doCount):
2611         (WebCore::IDBIndex::doGet):
2612         (WebCore::IDBIndex::doGetKey):
2613         (WebCore::IDBIndex::getAll):
2614         (WebCore::IDBIndex::getAllKeys):
2615         (WebCore::IDBIndex::markAsDeleted):
2616         * Modules/indexeddb/IDBObjectStore.cpp:
2617         (WebCore::IDBObjectStore::IDBObjectStore):
2618         (WebCore::IDBObjectStore::~IDBObjectStore):
2619         (WebCore::IDBObjectStore::name const):
2620         (WebCore::IDBObjectStore::setName):
2621         (WebCore::IDBObjectStore::keyPath const):
2622         (WebCore::IDBObjectStore::indexNames const):
2623         (WebCore::IDBObjectStore::transaction):
2624         (WebCore::IDBObjectStore::autoIncrement const):
2625         (WebCore::IDBObjectStore::openCursor):
2626         (WebCore::IDBObjectStore::openKeyCursor):
2627         (WebCore::IDBObjectStore::get):
2628         (WebCore::IDBObjectStore::getKey):
2629         (WebCore::IDBObjectStore::putOrAdd):
2630         (WebCore::IDBObjectStore::doDelete):
2631         (WebCore::IDBObjectStore::clear):
2632         (WebCore::IDBObjectStore::createIndex):
2633         (WebCore::IDBObjectStore::index):
2634         (WebCore::IDBObjectStore::deleteIndex):
2635         (WebCore::IDBObjectStore::doCount):
2636         (WebCore::IDBObjectStore::getAll):
2637         (WebCore::IDBObjectStore::getAllKeys):
2638         (WebCore::IDBObjectStore::markAsDeleted):
2639         (WebCore::IDBObjectStore::rollbackForVersionChangeAbort):
2640         * Modules/indexeddb/IDBOpenDBRequest.cpp:
2641         (WebCore::IDBOpenDBRequest::~IDBOpenDBRequest):
2642         (WebCore::IDBOpenDBRequest::onError):
2643         (WebCore::IDBOpenDBRequest::versionChangeTransactionDidFinish):
2644         (WebCore::IDBOpenDBRequest::fireSuccessAfterVersionChangeCommit):
2645         (WebCore::IDBOpenDBRequest::fireErrorAfterVersionChangeCompletion):
2646         (WebCore::IDBOpenDBRequest::dispatchEvent):
2647         (WebCore::IDBOpenDBRequest::onSuccess):
2648         (WebCore::IDBOpenDBRequest::onUpgradeNeeded):
2649         (WebCore::IDBOpenDBRequest::onDeleteDatabaseSuccess):
2650         (WebCore::IDBOpenDBRequest::requestCompleted):
2651         (WebCore::IDBOpenDBRequest::requestBlocked):
2652         * Modules/indexeddb/IDBRequest.cpp:
2653         (WebCore::IDBRequest::~IDBRequest):
2654         (WebCore:: const):
2655         (WebCore::IDBRequest::setSource):
2656         (WebCore::IDBRequest::setVersionChangeTransaction):
2657         (WebCore::IDBRequest::transaction const):
2658         (WebCore::IDBRequest::sourceObjectStoreIdentifier const):
2659         (WebCore::IDBRequest::sourceIndexIdentifier const):
2660         (WebCore::IDBRequest::requestedObjectStoreRecordType const):
2661         (WebCore::IDBRequest::requestedIndexRecordType const):
2662         (WebCore::IDBRequest::eventTargetInterface const):
2663         (WebCore::IDBRequest::activeDOMObjectName const):
2664         (WebCore::IDBRequest::canSuspendForDocumentSuspension const):
2665         (WebCore::IDBRequest::hasPendingActivity const):
2666         (WebCore::IDBRequest::stop):
2667         (WebCore::IDBRequest::enqueueEvent):
2668         (WebCore::IDBRequest::dispatchEvent):
2669         (WebCore::IDBRequest::uncaughtExceptionInEventHandler):
2670         (WebCore::IDBRequest::setResult):
2671         (WebCore::IDBRequest::setResultToStructuredClone):
2672         (WebCore::IDBRequest::setResultToUndefined):
2673         (WebCore::IDBRequest::resultCursor):
2674         (WebCore::IDBRequest::willIterateCursor):
2675         (WebCore::IDBRequest::didOpenOrIterateCursor):
2676         (WebCore::IDBRequest::completeRequestAndDispatchEvent):
2677         (WebCore::IDBRequest::onError):
2678         (WebCore::IDBRequest::onSuccess):
2679         * Modules/indexeddb/IDBTransaction.cpp:
2680         (WebCore::IDBTransaction::IDBTransaction):
2681         (WebCore::IDBTransaction::~IDBTransaction):
2682         (WebCore::IDBTransaction::objectStoreNames const):
2683         (WebCore::IDBTransaction::db):
2684         (WebCore::IDBTransaction::error const):
2685         (WebCore::IDBTransaction::objectStore):
2686         (WebCore::IDBTransaction::abortDueToFailedRequest):
2687         (WebCore::IDBTransaction::transitionedToFinishing):
2688         (WebCore::IDBTransaction::abort):
2689         (WebCore::IDBTransaction::internalAbort):
2690         (WebCore::IDBTransaction::abortOnServerAndCancelRequests):
2691         (WebCore::IDBTransaction::activeDOMObjectName const):
2692         (WebCore::IDBTransaction::canSuspendForDocumentSuspension const):
2693         (WebCore::IDBTransaction::hasPendingActivity const):
2694         (WebCore::IDBTransaction::stop):
2695         (WebCore::IDBTransaction::isActive const):
2696         (WebCore::IDBTransaction::isFinishedOrFinishing const):
2697         (WebCore::IDBTransaction::addRequest):
2698         (WebCore::IDBTransaction::removeRequest):
2699         (WebCore::IDBTransaction::scheduleOperation):
2700         (WebCore::IDBTransaction::schedulePendingOperationTimer):
2701         (WebCore::IDBTransaction::pendingOperationTimerFired):
2702         (WebCore::IDBTransaction::operationCompletedOnServer):
2703         (WebCore::IDBTransaction::scheduleCompletedOperationTimer):
2704         (WebCore::IDBTransaction::completedOperationTimerFired):
2705         (WebCore::IDBTransaction::commit):
2706         (WebCore::IDBTransaction::commitOnServer):
2707         (WebCore::IDBTransaction::finishAbortOrCommit):
2708         (WebCore::IDBTransaction::didStart):
2709         (WebCore::IDBTransaction::notifyDidAbort):
2710         (WebCore::IDBTransaction::didAbort):
2711         (WebCore::IDBTransaction::didCommit):
2712         (WebCore::IDBTransaction::fireOnComplete):
2713         (WebCore::IDBTransaction::fireOnAbort):
2714         (WebCore::IDBTransaction::enqueueEvent):
2715         (WebCore::IDBTransaction::dispatchEvent):
2716         (WebCore::IDBTransaction::createObjectStore):
2717         (WebCore::IDBTransaction::createObjectStoreOnServer):
2718         (WebCore::IDBTransaction::didCreateObjectStoreOnServer):
2719         (WebCore::IDBTransaction::renameObjectStore):
2720         (WebCore::IDBTransaction::renameObjectStoreOnServer):
2721         (WebCore::IDBTransaction::didRenameObjectStoreOnServer):
2722         (WebCore::IDBTransaction::createIndex):
2723         (WebCore::IDBTransaction::createIndexOnServer):
2724         (WebCore::IDBTransaction::didCreateIndexOnServer):
2725         (WebCore::IDBTransaction::renameIndex):
2726         (WebCore::IDBTransaction::renameIndexOnServer):
2727         (WebCore::IDBTransaction::didRenameIndexOnServer):
2728         (WebCore::IDBTransaction::requestOpenCursor):
2729         (WebCore::IDBTransaction::doRequestOpenCursor):
2730         (WebCore::IDBTransaction::openCursorOnServer):
2731         (WebCore::IDBTransaction::didOpenCursorOnServer):
2732         (WebCore::IDBTransaction::iterateCursor):
2733         (WebCore::IDBTransaction::iterateCursorOnServer):
2734         (WebCore::IDBTransaction::didIterateCursorOnServer):
2735         (WebCore::IDBTransaction::requestGetAllObjectStoreRecords):
2736         (WebCore::IDBTransaction::requestGetAllIndexRecords):
2737         (WebCore::IDBTransaction::getAllRecordsOnServer):
2738         (WebCore::IDBTransaction::didGetAllRecordsOnServer):
2739         (WebCore::IDBTransaction::requestGetRecord):
2740         (WebCore::IDBTransaction::requestGetValue):
2741         (WebCore::IDBTransaction::requestGetKey):
2742         (WebCore::IDBTransaction::requestIndexRecord):
2743         (WebCore::IDBTransaction::getRecordOnServer):
2744         (WebCore::IDBTransaction::didGetRecordOnServer):
2745         (WebCore::IDBTransaction::requestCount):
2746         (WebCore::IDBTransaction::getCountOnServer):
2747         (WebCore::IDBTransaction::didGetCountOnServer):
2748         (WebCore::IDBTransaction::requestDeleteRecord):
2749         (WebCore::IDBTransaction::deleteRecordOnServer):
2750         (WebCore::IDBTransaction::didDeleteRecordOnServer):
2751         (WebCore::IDBTransaction::requestClearObjectStore):
2752         (WebCore::IDBTransaction::clearObjectStoreOnServer):
2753         (WebCore::IDBTransaction::didClearObjectStoreOnServer):
2754         (WebCore::IDBTransaction::requestPutOrAdd):
2755         (WebCore::IDBTransaction::putOrAddOnServer):
2756         (WebCore::IDBTransaction::didPutOrAddOnServer):
2757         (WebCore::IDBTransaction::deleteObjectStore):
2758         (WebCore::IDBTransaction::deleteObjectStoreOnServer):
2759         (WebCore::IDBTransaction::didDeleteObjectStoreOnServer):
2760         (WebCore::IDBTransaction::deleteIndex):
2761         (WebCore::IDBTransaction::deleteIndexOnServer):
2762         (WebCore::IDBTransaction::didDeleteIndexOnServer):
2763         (WebCore::IDBTransaction::operationCompletedOnClient):
2764         (WebCore::IDBTransaction::establishOnServer):
2765         (WebCore::IDBTransaction::activate):
2766         (WebCore::IDBTransaction::deactivate):
2767         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
2768         (WebCore::IDBClient::removeItemsMatchingCurrentThread):
2769         * Modules/indexeddb/client/TransactionOperation.h:
2770         (WebCore::IDBClient::TransactionOperation::~TransactionOperation):
2771         (WebCore::IDBClient::TransactionOperation::perform):
2772         (WebCore::IDBClient::TransactionOperation::transitionToCompleteOnThisThread):
2773         (WebCore::IDBClient::TransactionOperation::transitionToComplete):
2774         (WebCore::IDBClient::TransactionOperation::doComplete):
2775         (WebCore::IDBClient::TransactionOperation::originThread const):
2776         (WebCore::IDBClient::TransactionOperation::originThreadID const): Deleted.
2777         * Modules/webaudio/AudioContext.cpp:
2778         (WebCore::AudioContext::AudioContext):
2779         (WebCore::AudioContext::lock):
2780         (WebCore::AudioContext::tryLock):
2781         (WebCore::AudioContext::unlock):
2782         (WebCore::AudioContext::isAudioThread const):
2783         (WebCore::AudioContext::isGraphOwner const):
2784         * Modules/webaudio/AudioContext.h:
2785         (WebCore::AudioContext::setAudioThread):
2786         (WebCore::AudioContext::audioThread const):
2787         * Modules/webaudio/AudioDestinationNode.cpp:
2788         (WebCore::AudioDestinationNode::render):
2789         * Modules/webdatabase/Database.cpp:
2790         (WebCore::Database::performClose):
2791         (WebCore::Database::securityOrigin):
2792         * Modules/webdatabase/DatabaseDetails.h:
2793         (WebCore::DatabaseDetails::DatabaseDetails):
2794         (WebCore::DatabaseDetails::operator=):
2795         (WebCore::DatabaseDetails::thread const):
2796         (WebCore::DatabaseDetails::threadID const): Deleted.
2797         * Modules/webdatabase/DatabaseManager.cpp:
2798         (WebCore::DatabaseManager::detailsForNameAndOrigin):
2799         * Modules/webdatabase/DatabaseThread.cpp:
2800         (WebCore::DatabaseThread::databaseThread):
2801         (WebCore::DatabaseThread::recordDatabaseOpen):
2802         (WebCore::DatabaseThread::recordDatabaseClosed):
2803         * Modules/webdatabase/DatabaseThread.h:
2804         (WebCore::DatabaseThread::getThread):
2805         (WebCore::DatabaseThread::getThreadID): Deleted.
2806         * Modules/webdatabase/SQLTransaction.cpp:
2807         (WebCore::SQLTransaction::checkAndHandleClosedDatabase):
2808         * Modules/webdatabase/SQLTransactionBackend.cpp:
2809         (WebCore::SQLTransactionBackend::doCleanup):
2810         (WebCore::SQLTransactionBackend::notifyDatabaseThreadIsShuttingDown):
2811         * bindings/js/JSCallbackData.h:
2812         (WebCore::JSCallbackData::JSCallbackData):
2813         (WebCore::JSCallbackData::~JSCallbackData):
2814         * bindings/js/ScheduledAction.cpp:
2815         (WebCore::ScheduledAction::execute):
2816         * dom/ScriptExecutionContext.cpp:
2817         (WebCore::ScriptExecutionContext::createdMessagePort):
2818         (WebCore::ScriptExecutionContext::destroyedMessagePort):
2819         * page/ResourceUsageOverlay.h:
2820         * page/scrolling/ScrollingThread.cpp:
2821         (WebCore::ScrollingThread::isCurrentThread):
2822         * platform/Supplementable.h:
2823         (WebCore::Supplementable::provideSupplement):
2824         (WebCore::Supplementable::removeSupplement):
2825         (WebCore::Supplementable::requireSupplement):
2826         (WebCore::Supplementable::Supplementable): Deleted.
2827         * platform/Timer.cpp:
2828         (WebCore::TimerBase::TimerBase):
2829         (WebCore::TimerBase::start):
2830         (WebCore::TimerBase::stop):
2831         (WebCore::TimerBase::setNextFireTime):
2832         * platform/Timer.h:
2833         (WebCore::TimerBase::isActive const):
2834         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2835         (WebCore::shouldAutoActivateFontIfNeeded):
2836         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
2837         (WebCore::TextureMapperPlatformLayerProxy::activateOnCompositingThread):
2838         (WebCore::TextureMapperPlatformLayerProxy::invalidate):
2839         (WebCore::TextureMapperPlatformLayerProxy::getAvailableBuffer):
2840         (WebCore::TextureMapperPlatformLayerProxy::appendToUnusedBuffers):
2841         (WebCore::TextureMapperPlatformLayerProxy::swapBuffer):
2842         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
2843         (): Deleted.
2844         * platform/ios/wak/WebCoreThread.mm:
2845         (RunWebThread):
2846         (StartWebThread):
2847         * platform/sql/SQLiteDatabase.cpp:
2848         (WebCore::SQLiteDatabase::open):
2849         (WebCore::SQLiteDatabase::close):
2850         * platform/sql/SQLiteDatabase.h:
2851         (WebCore::SQLiteDatabase::sqlite3Handle const):
2852         * workers/WorkerGlobalScope.cpp:
2853         (WebCore::WorkerGlobalScope::~WorkerGlobalScope):
2854         (WebCore::WorkerGlobalScope::isContextThread const):
2855         * workers/WorkerMessagingProxy.cpp:
2856         (WebCore::WorkerMessagingProxy::WorkerMessagingProxy):
2857         (WebCore::WorkerMessagingProxy::~WorkerMessagingProxy):
2858         * workers/WorkerRunLoop.cpp:
2859         (WebCore::WorkerRunLoop::runInMode):
2860         (WebCore::WorkerRunLoop::runCleanupTasks):
2861         * workers/WorkerThread.h:
2862         (WebCore::WorkerThread::thread const):
2863         (WebCore::WorkerThread::threadID const): Deleted.
2864         * workers/service/ServiceWorkerContainer.cpp:
2865         (WebCore::ServiceWorkerContainer::~ServiceWorkerContainer):
2866         (WebCore::ServiceWorkerContainer::scheduleJob):
2867         (WebCore::ServiceWorkerContainer::jobFailedWithException):
2868         (WebCore::ServiceWorkerContainer::scheduleTaskToFireUpdateFoundEvent):
2869         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
2870         (WebCore::ServiceWorkerContainer::jobResolvedWithUnregistrationResult):
2871         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
2872         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
2873         (WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
2874         (WebCore::ServiceWorkerContainer::jobDidFinish):
2875         (WebCore::ServiceWorkerContainer::addRegistration):
2876         (WebCore::ServiceWorkerContainer::removeRegistration):
2877         (WebCore::ServiceWorkerContainer::scheduleTaskToFireControllerChangeEvent):
2878         (WebCore::ServiceWorkerContainer::contextIdentifier):
2879         * workers/service/ServiceWorkerContainer.h:
2880         * workers/service/ServiceWorkerJob.cpp:
2881         (WebCore::ServiceWorkerJob::~ServiceWorkerJob):
2882         (WebCore::ServiceWorkerJob::failedWithException):
2883         (WebCore::ServiceWorkerJob::resolvedWithRegistration):
2884         (WebCore::ServiceWorkerJob::resolvedWithUnregistrationResult):
2885         (WebCore::ServiceWorkerJob::startScriptFetch):
2886         (WebCore::ServiceWorkerJob::fetchScriptWithContext):
2887         (WebCore::ServiceWorkerJob::didReceiveResponse):
2888         (WebCore::ServiceWorkerJob::notifyFinished):
2889         * workers/service/ServiceWorkerJob.h:
2890         * xml/parser/XMLDocumentParserLibxml2.cpp:
2891         (WebCore::matchFunc):
2892         (WebCore::openFunc):
2893         (WebCore::initializeXMLParser):
2894         (WebCore::XMLParserContext::createStringParser):
2895         (WebCore::XMLParserContext::createMemoryParser):
2896
2897 2017-12-03  Youenn Fablet  <youenn@apple.com>
2898
2899         WebSocketChannel should ensure its client is live when calling it in error case
2900         https://bugs.webkit.org/show_bug.cgi?id=180285
2901
2902         Reviewed by Darin Adler.
2903
2904         No observable change of behavior.
2905         This makes it consistent with other calls of didReceiveMessageError.
2906
2907         * Modules/websockets/WebSocketChannel.cpp:
2908         (WebCore::WebSocketChannel::fail):
2909
2910 2017-12-03  Alexey Proskuryakov  <ap@apple.com>
2911
2912         WebArchiveResourceWebResourceHandler leaks when pasting
2913         https://bugs.webkit.org/show_bug.cgi?id=180339
2914
2915         Reviewed by Joseph Pecoraro.
2916
2917         * editing/cocoa/WebContentReaderCocoa.mm:
2918         (WebCore::attributesForAttributedStringConversion):
2919
2920 2017-12-03  Chris Dumez  <cdumez@apple.com>
2921
2922         Support serviceWorker.postMessage() inside service workers
2923         https://bugs.webkit.org/show_bug.cgi?id=180328
2924
2925         Reviewed by Darin Adler.
2926
2927         Support serviceWorker.postMessage() inside service workers.
2928
2929         No new tests, unskipped and rebaselined existing test that is
2930         now passing.
2931
2932         * workers/service/SWClientConnection.h:
2933         * workers/service/ServiceWorker.cpp:
2934         (WebCore::ServiceWorker::postMessage):
2935         * workers/service/context/SWContextManager.cpp:
2936         (WebCore::SWContextManager::postMessageToServiceWorker):
2937         * workers/service/context/SWContextManager.h:
2938         * workers/service/context/ServiceWorkerThread.cpp:
2939         (WebCore::fireMessageEvent):
2940         (WebCore::ServiceWorkerThread::postMessageToServiceWorker):
2941         * workers/service/context/ServiceWorkerThread.h:
2942
2943 2017-12-03  Chris Dumez  <cdumez@apple.com>
2944
2945         Implement self.skipWaiting() inside service workers
2946         https://bugs.webkit.org/show_bug.cgi?id=180329
2947
2948         Reviewed by Darin Adler.
2949
2950         Implement self.skipWaiting() inside service workers:
2951         - https://w3c.github.io/ServiceWorker/#service-worker-global-scope-skipwaiting
2952
2953         Also fixes a bug where tryActivate() was calling activate() even though the
2954         registration's active worker was "in use":
2955         - https://w3c.github.io/ServiceWorker/#try-activate-algorithm
2956
2957         No new tests, rebaselined existing tests.
2958
2959         * workers/service/ServiceWorkerGlobalScope.cpp:
2960         (WebCore::ServiceWorkerGlobalScope::skipWaiting):
2961         * workers/service/context/SWContextManager.h:
2962         * workers/service/server/SWServerRegistration.cpp:
2963         (WebCore::SWServerRegistration::tryActivate):
2964         * workers/service/server/SWServerToContextConnection.cpp:
2965         (WebCore::SWServerToContextConnection::skipWaiting):
2966         * workers/service/server/SWServerToContextConnection.h:
2967         * workers/service/server/SWServerWorker.cpp:
2968         (WebCore::SWServerWorker::skipWaiting):
2969         * workers/service/server/SWServerWorker.h:
2970         (WebCore::SWServerWorker::isSkipWaitingFlagSet const):
2971
2972 2017-12-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2973
2974         [GStreamer] GstPad leaked in WebKitTextCombiner
2975         https://bugs.webkit.org/show_bug.cgi?id=180314
2976
2977         Reviewed by Michael Catanzaro.
2978
2979         gst_element_get_static_pad() returns a full reference that si never freed, because gst_ghost_pad_new doesn't
2980         take the ownership of the given pad.
2981
2982         * platform/graphics/gstreamer/TextCombinerGStreamer.cpp:
2983         (webkit_text_combiner_init):
2984
2985 2017-12-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2986
2987         [GStreamer] GstCaps leaked in MediaPlayerPrivateGStreamer::createGSTPlayBin
2988         https://bugs.webkit.org/show_bug.cgi?id=180311
2989
2990         Reviewed by Michael Catanzaro.
2991
2992         gst_caps_new_empty_simple() is passed directly to g_object_set(). The returned caps should be freed with
2993         gst_caps_unref().
2994
2995         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2996         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
2997
2998 2017-12-02  Youenn Fablet  <youenn@apple.com>
2999
3000         Move registration activation and clearing from SWServerJobQueue to SWServerRegistration
3001         https://bugs.webkit.org/show_bug.cgi?id=180325
3002
3003         Reviewed by Chris Dumez.
3004
3005         No change of behavior.
3006
3007         These algorithms fit naturally in SWServerRegistration and will be used as part of clients.claim.
3008
3009         * workers/service/server/SWServer.cpp:
3010         (WebCore::SWServer::clearAll):
3011         (WebCore::SWServer::didFinishActivation):
3012         * workers/service/server/SWServerJobQueue.cpp:
3013         (WebCore::SWServerJobQueue::scriptFetchFinished):
3014         (WebCore::SWServerJobQueue::scriptContextFailedToStart):
3015         (WebCore::SWServerJobQueue::didFinishInstall):
3016         (WebCore::SWServerJobQueue::runUnregisterJob):
3017         (WebCore::SWServerJobQueue::tryActivate): Deleted.
3018         (WebCore::SWServerJobQueue::activate): Deleted.
3019         (WebCore::SWServerJobQueue::didFinishActivation): Deleted.
3020         (WebCore::SWServerJobQueue::tryClearRegistration): Deleted.
3021         (WebCore::clearRegistrationWorker): Deleted.
3022         (WebCore::SWServerJobQueue::clearRegistration): Deleted.
3023         * workers/service/server/SWServerJobQueue.h:
3024         * workers/service/server/SWServerRegistration.cpp:
3025         (WebCore::SWServerRegistration::tryClear):
3026         (WebCore::clearRegistrationWorker):
3027         (WebCore::SWServerRegistration::clear):
3028         (WebCore::SWServerRegistration::tryActivate):
3029         (WebCore::SWServerRegistration::activate):
3030         (WebCore::SWServerRegistration::didFinishActivation):
3031         * workers/service/server/SWServerRegistration.h:
3032
3033 2017-12-02  Chris Dumez  <cdumez@apple.com>
3034
3035         Support container.register() / registration.unregister() /  inside service workers
3036         https://bugs.webkit.org/show_bug.cgi?id=180326
3037
3038         Reviewed by Youenn Fablet.
3039
3040         Support container.register() / registration.unregister() /  inside service workers.
3041         This is mostly about removing the is<Document>() checks and adding testing given
3042         that most of the work was done in r225455.
3043
3044         Test: http/tests/workers/service/ServiceWorkerGlobalScope_register.html
3045
3046         * workers/service/ServiceWorkerContainer.cpp:
3047         (WebCore::ServiceWorkerContainer::addRegistration):
3048         * workers/service/ServiceWorkerRegistration.cpp:
3049         (WebCore::ServiceWorkerRegistration::update):
3050         (WebCore::ServiceWorkerRegistration::unregister):
3051
3052 2017-12-02  Chris Dumez  <cdumez@apple.com>
3053
3054         Support serviceWorkerRegistration.update() inside service workers
3055         https://bugs.webkit.org/show_bug.cgi?id=180215
3056
3057         Reviewed by Darin Adler.
3058
3059         Support serviceWorkerRegistration.update() inside service workers. The code paths
3060         for job scheduling and resolution have been made thread safe by hopping to the right
3061         thread when necessary. In particular, ServiceWorkerContainer always makes sure to to
3062         a callOnMainThread() before calling methods on the SWClientConnection. Also, the
3063         SWClientConnection relies on a new postTaskTo() method before calling methods on the
3064         job.
3065
3066         Test: http/tests/workers/service/self_registration_update.html
3067
3068         * workers/service/SWClientConnection.cpp:
3069         (WebCore::SWClientConnection::scheduleJob):
3070         (WebCore::SWClientConnection::finishedFetchingScript):
3071         (WebCore::SWClientConnection::failedFetchingScript):
3072         (WebCore::SWClientConnection::jobRejectedInServer):
3073         (WebCore::SWClientConnection::registrationJobResolvedInServer):
3074         (WebCore::SWClientConnection::unregistrationJobResolvedInServer):
3075         (WebCore::SWClientConnection::startScriptFetchForServer):
3076         (WebCore::SWClientConnection::postMessageToServiceWorkerClient):
3077         (WebCore::SWClientConnection::updateRegistrationState):
3078         (WebCore::SWClientConnection::updateWorkerState):
3079         (WebCore::SWClientConnection::fireUpdateFoundEvent):
3080         (WebCore::SWClientConnection::notifyClientsOfControllerChange):
3081         (WebCore::SWClientConnection::clearPendingJobs):
3082         (WebCore::SWClientConnection::postTaskTo):
3083         * workers/service/SWClientConnection.h:
3084         * workers/service/ServiceWorkerContainer.cpp:
3085         (WebCore::ServiceWorkerContainer::scheduleJob):
3086         (WebCore::ServiceWorkerContainer::jobFailedWithException):
3087         (WebCore::ServiceWorkerContainer::scheduleTaskToFireUpdateFoundEvent):
3088         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
3089         (WebCore::ServiceWorkerContainer::jobResolvedWithUnregistrationResult):
3090         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
3091         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
3092         (WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
3093         (WebCore::ServiceWorkerContainer::jobDidFinish):
3094         (WebCore::ServiceWorkerContainer::addRegistration):
3095         (WebCore::ServiceWorkerContainer::removeRegistration):
3096         (WebCore::ServiceWorkerContainer::scheduleTaskToFireControllerChangeEvent):
3097         (WebCore::ServiceWorkerContainer::contextIdentifier):
3098         * workers/service/ServiceWorkerContainer.h:
3099         * workers/service/ServiceWorkerJob.cpp:
3100         (WebCore::ServiceWorkerJob::ServiceWorkerJob):
3101         * workers/service/ServiceWorkerJob.h:
3102         (WebCore::ServiceWorkerJob::contextIdentifier):
3103         * workers/service/ServiceWorkerJobClient.h:
3104         * workers/service/ServiceWorkerRegistration.cpp:
3105         (WebCore::ServiceWorkerRegistration::update):
3106         * workers/service/ServiceWorkerTypes.h:
3107
3108 2017-12-02  Simon Fraser  <simon.fraser@apple.com>
3109
3110         Make IOSurface::Locker and use it in ImageBufferDataCG
3111         https://bugs.webkit.org/show_bug.cgi?id=180317
3112
3113         Reviewed by Zalan Bujtas.
3114
3115         Add an RAII IOSurface::Locker which can lock readonly or readwrite. Access
3116         to the IOSurface base address is through the locker.
3117         
3118         Add IOSurface::bytesPerRow() to wrap IOSurfaceGetBytesPerRow().
3119         
3120         After this, there is only one location where we access the IOSurfaceRef
3121         directly, in WebGL code.
3122
3123         * platform/graphics/cg/ImageBufferDataCG.cpp:
3124         (WebCore::ImageBufferData::toBGRAData const):
3125         (WebCore::ImageBufferData::getData const):
3126         (WebCore::ImageBufferData::putData):
3127         * platform/graphics/cocoa/IOSurface.h:
3128         * platform/graphics/cocoa/IOSurface.mm:
3129         (WebCore::IOSurface::bytesPerRow const):
3130
3131 2017-12-02  Simon Fraser  <simon.fraser@apple.com>
3132
3133         Add an AlphaPremultiplication enum and use it consistently
3134         https://bugs.webkit.org/show_bug.cgi?id=180316
3135
3136         Reviewed by Zalan Bujtas.
3137
3138         ImageBuffer-related code sometimes used the 'Multiply' enum, and sometimes
3139         a bool to represent alpha premultiplication. Make an enum class and use it
3140         everywhere. Re-order and rename some parameters to clarify the meaning of this
3141         argument.
3142
3143         * html/canvas/CanvasRenderingContext2D.cpp:
3144         (WebCore::CanvasRenderingContext2D::putImageData):
3145         * platform/graphics/GraphicsTypes.cpp:
3146         (WebCore::operator<<):
3147         * platform/graphics/GraphicsTypes.h:
3148         * platform/graphics/ImageBuffer.cpp:
3149         (WebCore::ImageBuffer::genericConvertToLuminanceMask):
3150         * platform/graphics/ImageBuffer.h:
3151         * platform/graphics/ShadowBlur.cpp:
3152         (WebCore::ShadowBlur::blurShadowBuffer):
3153         * platform/graphics/cairo/ImageBufferCairo.cpp:
3154         (WebCore::getImageData):
3155         (WebCore::ImageBuffer::getUnmultipliedImageData const):
3156         (WebCore::ImageBuffer::getPremultipliedImageData const):
3157         (WebCore::ImageBuffer::putByteArray):
3158         * platform/graphics/cg/ImageBufferCG.cpp:
3159         (WebCore::ImageBuffer::getUnmultipliedImageData const):
3160         (WebCore::ImageBuffer::getPremultipliedImageData const):
3161         (WebCore::ImageBuffer::putByteArray):
3162         * platform/graphics/cg/ImageBufferDataCG.cpp:
3163         (WebCore::ImageBufferData::getData const):
3164         (WebCore::ImageBufferData::putData):
3165         * platform/graphics/cg/ImageBufferDataCG.h:
3166         * platform/graphics/filters/FEColorMatrix.cpp:
3167         (WebCore::FEColorMatrix::platformApplySoftware):
3168         * platform/graphics/filters/FEDropShadow.cpp:
3169         (WebCore::FEDropShadow::platformApplySoftware):
3170         * platform/graphics/filters/FilterEffect.cpp:
3171         (WebCore::FilterEffect::imageBufferResult):
3172         * platform/graphics/win/ImageBufferDataDirect2D.cpp:
3173         (WebCore::ImageBufferData::getData const):
3174         (WebCore::ImageBufferData::putData):
3175         * platform/graphics/win/ImageBufferDataDirect2D.h:
3176         * platform/graphics/win/ImageBufferDirect2D.cpp:
3177         (WebCore::ImageBuffer::getUnmultipliedImageData const):
3178         (WebCore::ImageBuffer::getPremultipliedImageData const):
3179         (WebCore::ImageBuffer::putByteArray):
3180
3181 2017-12-02  Youenn Fablet  <youenn@apple.com>
3182
3183         Implement https://w3c.github.io/ServiceWorker/#clients-getall
3184         https://bugs.webkit.org/show_bug.cgi?id=180276
3185
3186         Reviewed by Chris Dumez.
3187
3188         Test: http/tests/workers/service/serviceworkerclients-matchAll.https.html
3189
3190         Move Clients QueryOptions to its own class since it is used by various parties.
3191         Add encoder/decoder routines.
3192
3193         Add a ServieWorkerClientInformation which replaces SWServer::ClientInformation structure.
3194         This is what is sent back as a result to matchAll requests.
3195         Add encoder/decoder routines.
3196
3197         Implement matchAll by hopping to the main thread, making IPC to the storage process.
3198         SWServer in storage process then iterates through the relevant service workers and does some filtering.
3199         Additional filtering and information should be gathered in future patches to fully implement the algorithm.
3200
3201         Add to SWServer a HashMap to easily identify by which service worker a client is controlled, if any.
3202         This map is updated at the same time registrations are updated.
3203
3204         matchAll is given a callback as in the future, window client information will be retrieved asynchronously.
3205
3206         * WebCore.xcodeproj/project.pbxproj:
3207         * workers/service/ServiceWorkerClientInformation.h: Added.
3208         (WebCore::ServiceWorkerClientInformation::isolatedCopy const):
3209         (WebCore::ServiceWorkerClientInformation::encode const):
3210         (WebCore::ServiceWorkerClientInformation::decode):
3211         * workers/service/ServiceWorkerClientQueryOptions.h: Added.
3212         (WebCore::ServiceWorkerClientQueryOptions::encode const):
3213         (WebCore::ServiceWorkerClientQueryOptions::decode):
3214         * workers/service/ServiceWorkerClients.cpp:
3215         (WebCore::ServiceWorkerClients::matchAll):
3216         * workers/service/ServiceWorkerClients.h:
3217         * workers/service/context/SWContextManager.h:
3218         * workers/service/server/SWServer.cpp:
3219         (WebCore::SWServer::matchAll):
3220         (WebCore::SWServer::registerServiceWorkerClient):
3221         * workers/service/server/SWServer.h:
3222         * workers/service/server/SWServerToContextConnection.cpp:
3223         (WebCore::SWServerToContextConnection::matchAll):
3224         * workers/service/server/SWServerToContextConnection.h:
3225         * workers/service/server/SWServerWorker.cpp:
3226         (WebCore::SWServerWorker::matchAll):
3227         * workers/service/server/SWServerWorker.h:
3228
3229 2017-12-02  Brady Eidson  <beidson@apple.com>
3230
3231         Factor out the "databaseTaskQueue" parts of IDBServer into something reusable.
3232         https://bugs.webkit.org/show_bug.cgi?id=180298
3233
3234         Reviewed by Chris Dumez.
3235
3236         No new tests (Refactor only).
3237
3238         * Modules/indexeddb/server/IDBServer.cpp:
3239         (WebCore::IDBServer::IDBServer::IDBServer):
3240         (WebCore::IDBServer::IDBServer::postDatabaseTask):
3241         (WebCore::IDBServer::IDBServer::postDatabaseTaskReply):
3242         (WebCore::IDBServer::IDBServer::databaseRunLoop): Deleted.
3243         (WebCore::IDBServer::IDBServer::handleTaskRepliesOnMainThread): Deleted.
3244         * Modules/indexeddb/server/IDBServer.h:
3245         (): Deleted.
3246
3247 2017-12-02  Simon Fraser  <simon.fraser@apple.com>
3248
3249         Add a log channel for viewports
3250         https://bugs.webkit.org/show_bug.cgi?id=180295
3251
3252         Reviewed by Zalan Bujtas.
3253
3254         Add a "Viewports" log channel to log viewport scaling information, and enhance the
3255         WebKit "VisibleRects" channel to log additional data for the same reason.
3256
3257         * dom/Document.cpp:
3258         (WebCore::Document::processViewport):
3259         * loader/FrameLoader.cpp:
3260         (WebCore::FrameLoader::finishedParsing):
3261         (WebCore::FrameLoader::completed):
3262         * page/FrameView.cpp:
3263         (WebCore::FrameView::resetScrollbarsAndClearContentsSize):
3264         (WebCore::FrameView::scrollToAnchor):
3265         (WebCore::FrameView::maintainScrollPositionAtAnchor):
3266         (WebCore::FrameView::setScrollPosition):
3267         (WebCore::FrameView::autoSizeIfEnabled):
3268         (WebCore::FrameView::setWasScrolledByUser):
3269         * page/LayoutContext.cpp:
3270         (WebCore::LayoutContext::layout):
3271         * page/Page.cpp:
3272         (WebCore::Page::setPageScaleFactor):
3273         * page/ViewportConfiguration.cpp:
3274         (WebCore::ViewportConfiguration::setContentsSize):
3275         (WebCore::ViewportConfiguration::setViewportArguments):
3276         (WebCore::ViewportConfiguration::updateConfiguration):
3277         (WebCore::operator<<):
3278         (WebCore::ViewportConfiguration::description const):
3279         (WebCore::ViewportConfiguration::dump const):
3280         * page/ViewportConfiguration.h:
3281         * platform/Logging.h:
3282         * platform/ScrollView.cpp:
3283         (WebCore::ScrollView::setFixedLayoutSize):
3284
3285 2017-12-01  Alicia Boya García  <aboya@igalia.com>
3286
3287         [MSE] Use correct range end checks in sourceBufferPrivateDidReceiveSample()
3288         https://bugs.webkit.org/show_bug.cgi?id=179690
3289
3290         Reviewed by Jer Noble.
3291
3292         The Coded Frame Processing algorithm as defined in
3293         https://www.w3.org/TR/media-source/#sourcebuffer-coded-frame-processing states:
3294
3295         1.14. Remove existing coded frames in track buffer:
3296          -> If highest end timestamp for track buffer is not set:
3297                [...]
3298          -> If highest end timestamp for track buffer is set and less than or
3299             equal to presentation timestamp:
3300                Remove all coded frames from track buffer that have a
3301                presentation timestamp greater than or equal to highest end
3302                timestamp and less than frame end timestamp.
3303
3304         Note the removal range is closed-open [a, b). WebKit is actually removing
3305         frames using an open-closed range (a, b], which causes frames not to be removed
3306         in situations where they should and frames to be removed in situations when
3307         they should not.
3308
3309         Tests: media/media-source/media-source-range-end-frame-not-removed.html
3310                media/media-source/media-source-range-start-frame-replaced.html
3311
3312         * Modules/mediasource/SampleMap.cpp:
3313         (WebCore::PresentationOrderSampleMap::findSamplesBetweenPresentationTimesFromEnd):
3314         * Modules/mediasource/SampleMap.h:
3315         * Modules/mediasource/SourceBuffer.cpp:
3316         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
3317
3318 2017-12-01  Simon Fraser  <simon.fraser@apple.com>
3319
3320         Reduce the number of calls to ViewportConfiguration::updateConfiguration()
3321         https://bugs.webkit.org/show_bug.cgi?id=180299
3322
3323         Reviewed by Zalan Bujtas.
3324
3325         There are several calls to ViewportConfiguration::setDefaultConfiguration() during loading
3326         with the same arguments. We can avoid unnecessary calls to updateConfiguration() by returning
3327         early if the configuration hasn't changed.
3328
3329         * page/ViewportConfiguration.cpp:
3330         (WebCore::ViewportConfiguration::setDefaultConfiguration):
3331         * page/ViewportConfiguration.h:
3332         (WebCore::ViewportConfiguration::Parameters::operator== const):
3333
3334 2017-12-01  Aishwarya Nirmal  <anirmal@apple.com>
3335
3336         [Touch Bar Web API] Object representing Touch Bar Menu to send between Web and UI Processes
3337         https://bugs.webkit.org/show_bug.cgi?id=179714
3338
3339         Reviewed by Wenson Hsieh.
3340
3341         These changes allow the HTMLMenuElement and HTMLMenuItemElement to parse attributes relating
3342         to the touch bar and convey changes to the elements that will eventually be propogated to the
3343         UI process.
3344
3345         No new tests at this point because the changes to HTMLMenuElement and HTMLMenuItemElement are
3346         new properties, which might not be worth testing, and overriden methods for insertedIntoAncestor
3347         and removedFromAncestor, which are involved in sending a message to a UI process but might be
3348         difficult to test at this point since the UI process only receives (and does not yet process)
3349         the message.
3350
3351         * html/HTMLMenuElement.cpp:
3352         (WebCore::HTMLMenuElement::insertedIntoAncestor):
3353         (WebCore::HTMLMenuElement::removedFromAncestor):
3354         (WebCore::HTMLMenuElement::parseAttribute):
3355         * html/HTMLMenuElement.h:
3356         * html/HTMLMenuItemElement.cpp:
3357         (WebCore::HTMLMenuItemElement::insertedIntoAncestor):
3358         (WebCore::HTMLMenuItemElement::removedFromAncestor):
3359         * html/HTMLMenuItemElement.h:
3360         * page/ChromeClient.h:
3361
3362 2017-12-01  Daniel Bates  <dabates@apple.com>
3363
3364         AlternativePresentationButtonSubstitution::unapply() may not undo substitution
3365         https://bugs.webkit.org/show_bug.cgi?id=180279
3366         <rdar://problem/35800599>
3367
3368         Reviewed by Simon Fraser.
3369
3370         Fixes an issue where removing an alternative presentation button substituted for a non-HTML input
3371         element did not restore the original appearance of the element before the substitution.
3372
3373         To substitute the alternative presentation button for a non-HTML input element we attach a
3374         user-agent shadow root to it. Adding a shadow root, including a user-agent shadow root,
3375         tears down the existing renderers for the element. Currently when we unapply such a substitution
3376         we ultimately just remove the shadow root and do not create new renderers for the subtree
3377         that the shadow root was removed from. We need to create new renderers for this subtree
3378         to restore the original appearance of the element before the substitution.
3379
3380         * editing/cocoa/AlternativePresentationButtonSubstitution.cpp:
3381         (WebCore::AlternativePresentationButtonSubstitution::unapply):
3382
3383 2017-12-01  Christopher Reid  <chris.reid@sony.com>
3384
3385         Move DateComponents into WTF
3386         https://bugs.webkit.org/show_bug.cgi?id=180211
3387
3388         Reviewed by Myles C. Maxfield.
3389
3390         No new tests no change in behavior.
3391
3392         Moved DateComponents from platform into WTF.
3393
3394         * Sources.txt: Removed DateComponents
3395         * WebCore.xcodeproj/project.pbxproj: Removed DateComponents
3396         * dom/Document.cpp:
3397         * html/BaseDateAndTimeInputType.h:
3398         * html/DateTimeInputType.h: Fixed a call to the wrong parent constructor
3399         * html/HTMLInputElement.h:
3400         * html/InputType.cpp:
3401         * html/InputType.h:
3402         * platform/text/PlatformLocale.cpp:
3403         * platform/text/PlatformLocale.h:
3404         * platform/text/ios/LocalizedDateCache.h:
3405         * platform/text/mac/LocaleMac.h:
3406         * platform/text/win/LocaleWin.cpp:
3407         * platform/text/win/LocaleWin.h:
3408         * rendering/RenderThemeIOS.mm:
3409
3410 2017-12-01  Daniel Bates  <dabates@apple.com>
3411
3412         Alternative Presentation Button: Provide a way to query for the replaced elements
3413         https://bugs.webkit.org/show_bug.cgi?id=180114
3414         <rdar://problem/35710539>
3415
3416         Reviewed by Tim Horton.
3417
3418         Add SPI to query for the elements that were replaced by an Alternative Presentation Button.
3419
3420         Test: fast/forms/alternative-presentation-button/replaced-elements.html
3421
3422         * editing/Editor.cpp:
3423         (WebCore::Editor::elementsReplacedByAlternativePresentationButton): Added.
3424         * editing/Editor.h:
3425         * editing/cocoa/AlternativePresentationButtonSubstitution.cpp:
3426         (WebCore::AlternativePresentationButtonSubstitution::replacedElements): Added.
3427         * editing/cocoa/AlternativePresentationButtonSubstitution.h:
3428         * testing/Internals.cpp:
3429         (WebCore::Internals::elementsReplacedByAlternativePresentationButton): Added.
3430         * testing/Internals.h:
3431         * testing/Internals.idl: Expose internals function elementsReplacedByAlternativePresentationButton()
3432         so as to test Editor::elementsReplacedByAlternativePresentationButton().
3433
3434 2017-12-01  Said Abou-Hallawa  <sabouhallawa@apple.com>
3435
3436         Rename ImageFrameCache to ImageSource
3437         https://bugs.webkit.org/show_bug.cgi?id=180172
3438
3439         Reviewed by Per Arne Vollan.
3440
3441         This is a follow-up for r225300. ImageSource is the intended name after
3442         merging ImageFrameCache and ImageSource.
3443
3444         * Sources.txt:
3445         * WebCore.xcodeproj/project.pbxproj:
3446         * platform/graphics/BitmapImage.cpp:
3447         (WebCore::BitmapImage::BitmapImage):
3448         * platform/graphics/BitmapImage.h:
3449         * platform/graphics/ImageFrame.h:
3450         * platform/graphics/ImageFrameCache.cpp: Removed.
3451         * platform/graphics/ImageFrameCache.h: Removed.
3452         * platform/graphics/ImageSource.cpp: Added.
3453         (WebCore::ImageSource::ImageSource):
3454         (WebCore::ImageSource::~ImageSource):
3455         (WebCore::ImageSource::ensureDecoderAvailable):
3456         (WebCore::ImageSource::setData):
3457         (WebCore::ImageSource::resetData):
3458         (WebCore::ImageSource::dataChanged):
3459         (WebCore::ImageSource::isAllDataReceived):
3460         (WebCore::ImageSource::destroyDecodedData):
3461         (WebCore::ImageSource::destroyIncompleteDecodedData):
3462         (WebCore::ImageSource::clearFrameBufferCache):
3463         (WebCore::ImageSource::decodedSizeChanged):
3464         (WebCore::ImageSource::decodedSizeIncreased):
3465         (WebCore::ImageSource::decodedSizeDecreased):
3466         (WebCore::ImageSource::decodedSizeReset):
3467         (WebCore::ImageSource::didDecodeProperties):
3468         (WebCore::ImageSource::growFrames):
3469         (WebCore::ImageSource::setNativeImage):
3470         (WebCore::ImageSource::cacheMetadataAtIndex):
3471         (WebCore::ImageSource::cacheNativeImageAtIndex):
3472         (WebCore::ImageSource::cacheNativeImageAtIndexAsync):
3473         (WebCore::ImageSource::decodingQueue):
3474         (WebCore::ImageSource::frameRequestQueue):
3475         (WebCore::ImageSource::canUseAsyncDecoding):
3476         (WebCore::ImageSource::startAsyncDecodingQueue):
3477         (WebCore::ImageSource::requestFrameAsyncDecodingAtIndex):
3478         (WebCore::ImageSource::isAsyncDecodingQueueIdle const):
3479         (WebCore::ImageSource::stopAsyncDecodingQueue):
3480         (WebCore::ImageSource::frameAtIndexCacheIfNeeded):
3481         (WebCore::ImageSource::clearMetadata):
3482         (WebCore::ImageSource::sourceURL const):
3483         (WebCore::ImageSource::mimeType const):
3484         (WebCore::ImageSource::expectedContentLength const):
3485         (WebCore::ImageSource::metadata):
3486         (WebCore::ImageSource::frameMetadataAtIndex):
3487         (WebCore::ImageSource::frameMetadataAtIndexCacheIfNeeded):
3488         (WebCore::ImageSource::encodedDataStatus):
3489         (WebCore::ImageSource::frameCount):
3490         (WebCore::ImageSource::repetitionCount):
3491         (WebCore::ImageSource::uti):
3492         (WebCore::ImageSource::filenameExtension):
3493         (WebCore::ImageSource::hotSpot):
3494         (WebCore::ImageSource::size):
3495         (WebCore::ImageSource::sizeRespectingOrientation):
3496         (WebCore::ImageSource::singlePixelSolidColor):
3497         (WebCore::ImageSource::maximumSubsamplingLevel):
3498         (WebCore::ImageSource::frameIsBeingDecodedAndIsCompatibleWithOptionsAtIndex):
3499         (WebCore::ImageSource::frameDecodingStatusAtIndex):
3500         (WebCore::ImageSource::frameHasAlphaAtIndex):
3501         (WebCore::ImageSource::frameHasFullSizeNativeImageAtIndex):
3502         (WebCore::ImageSource::frameHasDecodedNativeImageCompatibleWithOptionsAtIndex):
3503         (WebCore::ImageSource::frameSubsamplingLevelAtIndex):
3504         (WebCore::ImageSource::frameSizeAtIndex):
3505         (WebCore::ImageSource::frameBytesAtIndex):
3506         (WebCore::ImageSource::frameDurationAtIndex):
3507         (WebCore::ImageSource::frameOrientationAtIndex):
3508         (WebCore::ImageSource::setTargetContext):
3509         (WebCore::ImageSource::createFrameImageAtIndex):
3510         (WebCore::ImageSource::frameImageAtIndex):
3511         (WebCore::ImageSource::frameImageAtIndexCacheIfNeeded):
3512         (WebCore::ImageSource::dump):
3513         * platform/graphics/ImageSource.h: Added.
3514         (WebCore::ImageSource::create):
3515         (WebCore::ImageSource::decodedSize const):
3516         (WebCore::ImageSource::destroyAllDecodedData):
3517         (WebCore::ImageSource::destroyAllDecodedDataExcludeFrame):
3518         (WebCore::ImageSource::destroyDecodedDataBeforeFrame):
3519         (WebCore::ImageSource::clearImage):
3520         (WebCore::ImageSource::requestFrameAsyncDecodingAtIndex):
3521         (WebCore::ImageSource::hasAsyncDecodingQueue const):
3522         (WebCore::ImageSource::isSizeAvailable):
3523         (WebCore::ImageSource::isDecoderAvailable const):
3524         (WebCore::ImageSource::frameAtIndexCacheIfNeeded):
3525         (WebCore::ImageSource::ImageFrameRequest::operator== const):
3526         * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
3527         (WebCore::GraphicsContext3D::ImageExtractor::extractImage):
3528         * platform/graphics/cg/GraphicsContext3DCG.cpp:
3529         (WebCore::GraphicsContext3D::ImageExtractor::extractImage):
3530
3531 2017-12-01  Youenn Fablet  <youenn@apple.com>
3532
3533         Implement https://w3c.github.io/ServiceWorker/#clients-get
3534         https://bugs.webkit.org/show_bug.cgi?id=180167
3535
3536         Reviewed by Chris Dumez.
3537
3538         Test: http/tests/workers/service/serviceworkerclients-get.https.html
3539
3540         Implement clients get by having service worker clients do the following:
3541         - Go to main thread to query the SWClientConnection for getting the client.
3542         - SWClientConnection requests it through IPC to StorageProcess SWServer.
3543         - SWServer looks at its client map and returns client data based on the given identifier.
3544         - SWClientConnection sends it back to the right clients for resolving the promise.
3545
3546         Identifier is parsed at service worker process level.
3547
3548         Made ServiceWorkerClients no longer an ActiveDOMObject since it is owned by ServiceWorkerGlobalScope
3549         and is only exposed in service workers.
3550
3551         * workers/service/ServiceWorkerClientIdentifier.h:
3552         (WebCore::ServiceWorkerClientIdentifier::fromString):
3553         * workers/service/ServiceWorkerClients.cpp:
3554         (WebCore::ServiceWorkerClients::ServiceWorkerClients):
3555         (WebCore::ServiceWorkerClients::get):
3556         * workers/service/ServiceWorkerClients.h:
3557         (WebCore::ServiceWorkerClients::create):
3558         * workers/service/context/SWContextManager.cpp:
3559         (WebCore::SWContextManager::postTaskToServiceWorker):
3560         * workers/service/context/SWContextManager.h:
3561         * workers/service/server/SWServer.cpp:
3562         (WebCore::SWServer::getClientFromId):
3563         * workers/service/server/SWServer.h:
3564         * workers/service/server/SWServerToContextConnection.cpp:
3565         (WebCore::SWServerToContextConnection::findClientByIdentifier):
3566         * workers/service/server/SWServerToContextConnection.h:
3567         * workers/service/server/SWServerWorker.cpp:
3568         (WebCore::SWServerWorker::origin const):
3569         (WebCore::SWServerWorker::findClientByIdentifier):
3570         * workers/service/server/SWServerWorker.h:
3571
3572 2017-12-01  Brian Burg  <bburg@apple.com>
3573
3574         Web Inspector: move Inspector::Protocol::Array<T> to JSON namespace
3575         https://bugs.webkit.org/show_bug.cgi?id=173662
3576
3577         Reviewed by Joseph Pecoraro.
3578
3579         Adopt new type names.
3580
3581         * inspector/InspectorCanvas.cpp:
3582         (WebCore::InspectorCanvas::recordAction):
3583         (WebCore::InspectorCanvas::releaseFrames):
3584         (WebCore::InspectorCanvas::releaseData):
3585         (WebCore::InspectorCanvas::indexForData):
3586         (WebCore::buildArrayForAffineTransform):
3587         (WebCore::buildArrayForVector):
3588         (WebCore::InspectorCanvas::buildInitialState):
3589         (WebCore::InspectorCanvas::buildAction):
3590         (WebCore::InspectorCanvas::buildArrayForCanvasGradient):
3591         (WebCore::InspectorCanvas::buildArrayForCanvasPattern):
3592         (WebCore::InspectorCanvas::buildArrayForImageData):
3593         (WebCore::InspectorCanvas::buildArrayForImageBitmap):
3594         * inspector/InspectorCanvas.h:
3595         * inspector/InspectorController.cpp:
3596         (WebCore::InspectorController::buildObjectForHighlightedNodes const):
3597         * inspector/InspectorController.h:
3598         * inspector/InspectorOverlay.cpp:
3599         (WebCore::buildObjectForHighlight):
3600         (WebCore::InspectorOverlay::drawPaintRects):
3601         (WebCore::buildArrayForRendererFragments):
3602         (WebCore::buildObjectForElementData):
3603         (WebCore::InspectorOverlay::buildHighlightObjectForNode const):
3604         (WebCore::InspectorOverlay::buildObjectForHighlightedNodes const):
3605         * inspector/InspectorOverlay.h:
3606         * inspector/InspectorStyleSheet.cpp:
3607         (WebCore::fillMediaListChain):
3608         (WebCore::InspectorStyle::buildArrayForComputedStyle const):
3609         (WebCore::InspectorStyle::styleWithProperties const):
3610         (WebCore::buildObjectForSelectorHelper):
3611         (WebCore::selectorsFromSource):
3612         (WebCore::InspectorStyleSheet::buildObjectForSelectorList):
3613         (WebCore::InspectorStyleSheet::buildObjectForRule):
3614         (WebCore::InspectorStyleSheet::buildObjectForStyle):
3615         (WebCore::InspectorStyleSheet::buildArrayForRuleList):
3616         * inspector/InspectorStyleSheet.h:
3617         * inspector/agents/InspectorApplicationCacheAgent.cpp:
3618         (WebCore::InspectorApplicationCacheAgent::getFramesWithManifests):
3619         (WebCore::InspectorApplicationCacheAgent::buildArrayForApplicationCacheResources):
3620         * inspector/agents/InspectorApplicationCacheAgent.h:
3621         * inspector/agents/InspectorCSSAgent.cpp:
3622         (WebCore::InspectorCSSAgent::getMatchedStylesForNode):
3623         (WebCore::InspectorCSSAgent::getComputedStyleForNode):
3624         (WebCore::InspectorCSSAgent::getAllStyleSheets):
3625         (WebCore::InspectorCSSAgent::getSupportedCSSProperties):
3626         (WebCore::InspectorCSSAgent::getSupportedSystemFontFamilyNames):
3627         (WebCore::InspectorCSSAgent::buildArrayForMatchedRuleList):
3628         * inspector/agents/InspectorCSSAgent.h:
3629         * inspector/agents/InspectorCanvasAgent.cpp:
3630         (WebCore::InspectorCanvasAgent::requestCSSCanvasClientNodes):
3631         * inspector/agents/InspectorCanvasAgent.h:
3632         * inspector/agents/InspectorDOMAgent.cpp:
3633         (WebCore::InspectorDOMAgent::querySelectorAll):
3634         (WebCore::InspectorDOMAgent::pushNodePathToFrontend):
3635         (WebCore::InspectorDOMAgent::getEventListenersForNode):
3636         (WebCore::InspectorDOMAgent::getSearchResults):
3637         (WebCore::InspectorDOMAgent::getAttributes):
3638         (WebCore::InspectorDOMAgent::buildObjectForNode):
3639         (WebCore::InspectorDOMAgent::buildArrayForElementAttributes):
3640         (WebCore::InspectorDOMAgent::buildArrayForContainerChildren):
3641         (WebCore::InspectorDOMAgent::buildArrayForPseudoElements):
3642         (WebCore::InspectorDOMAgent::processAccessibilityChildren):
3643         (WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):
3644         (WebCore::InspectorDOMAgent::styleAttributeInvalidated):
3645         * inspector/agents/InspectorDOMAgent.h:
3646         * inspector/agents/InspectorDOMStorageAgent.cpp:
3647         (WebCore::InspectorDOMStorageAgent::getDOMStorageItems):
3648         * inspector/agents/InspectorDOMStorageAgent.h:
3649         * inspector/agents/InspectorDatabaseAgent.cpp:
3650         (WebCore::InspectorDatabaseAgent::getDatabaseTableNames):
3651         * inspector/agents/InspectorDatabaseAgent.h:
3652         * inspector/agents/InspectorIndexedDBAgent.cpp:
3653         (WebCore::Inspector::keyPathFromIDBKeyPath):
3654         (WebCore::InspectorIndexedDBAgent::requestDatabaseNames):
3655         * inspector/agents/InspectorLayerTreeAgent.cpp:
3656         (WebCore::InspectorLayerTreeAgent::layersForNode):
3657         (WebCore::InspectorLayerTreeAgent::gatherLayersUsingRenderObjectHierarchy):
3658         (WebCore::InspectorLayerTreeAgent::gatherLayersUsingRenderLayerHierarchy):
3659         * inspector/agents/InspectorLayerTreeAgent.h:
3660         * inspector/agents/InspectorMemoryAgent.cpp:
3661         (WebCore::InspectorMemoryAgent::collectSample):
3662         * inspector/agents/InspectorNetworkAgent.cpp:
3663         (WebCore::InspectorNetworkAgent::searchOtherRequests):
3664         (WebCore::InspectorNetworkAgent::searchInRequest):
3665         * inspector/agents/InspectorNetworkAgent.h:
3666         * inspector/agents/InspectorPageAgent.cpp:
3667         (WebCore::buildArrayForCookies):
3668         (WebCore::InspectorPageAgent::getCookies):
3669         (WebCore::InspectorPageAgent::searchInResource):
3670         (WebCore::InspectorPageAgent::searchInResources):
3671         (WebCore::InspectorPageAgent::buildObjectForFrameTree):
3672         * inspector/agents/InspectorPageAgent.h:
3673         * inspector/agents/WebConsoleAgent.cpp:
3674         (WebCore::WebConsoleAgent::getLoggingChannels):
3675         * inspector/agents/WebConsoleAgent.h:
3676
3677 2017-12-01  Wenson Hsieh  <wenson_hsieh@apple.com>
3678
3679         [Attachment Support] Implement SPI for clients to update a given attachment's data
3680         https://bugs.webkit.org/show_bug.cgi?id=180184
3681         <rdar://problem/35355731>
3682
3683         Reviewed by Tim Horton.
3684
3685         Add native API support for Mail to update the data (and optionally, the name and type) of a given attachment
3686         element. See per-method comments below for more detail.
3687
3688         Test: WKAttachmentTests.ChangeAttachmentDataAndFileInformation
3689               WKAttachmentTests.ChangeAttachmentDataUpdatesWithInPlaceDisplay
3690
3691         * editing/Editor.cpp:
3692         (WebCore::Editor::insertAttachment):
3693         * html/HTMLAttachmentElement.cpp:
3694         (WebCore::HTMLAttachmentElement::setFile):
3695         (WebCore::HTMLAttachmentElement::invalidateShadowRootChildrenIfNecessary):
3696
3697         Pull out logic to hide and reset shadow DOM state into a separate helper, and additionally hide both the image
3698         and video child elements if they exist. This prevents us from getting into a state where both image and video
3699         elements may appear side-by-side when changing data from an image to a video or vice versa.
3700
3701         (WebCore::HTMLAttachmentElement::updateFileWithData):
3702
3703         Add a new helper to update the backing File of an attachment element from data, optionally updating the filename
3704         and content type as well.
3705
3706         (WebCore::HTMLAttachmentElement::populateShadowRootIfNecessary):
3707         * html/HTMLAttachmentElement.h:
3708
3709 2017-12-01  Chris Dumez  <cdumez@apple.com>
3710
3711         Get rid of microtask in ServiceWorkerContainer::jobResolvedWithRegistration()
3712         https://bugs.webkit.org/show_bug.cgi?id=180263
3713
3714         Reviewed by Youenn Fablet.
3715
3716         Get rid of microtask in ServiceWorkerContainer::jobResolvedWithRegistration(). It
3717         is no longer needed and MicrotaskQueue::mainThreadQueue() is only safe to use from
3718         the main thread, as its name suggest. ServiceWorkerContainer are also instantiated
3719         in Service worker threads nowadays.
3720
3721         * workers/service/SWClientConnection.cpp:
3722         (WebCore::SWClientConnection::registrationJobResolvedInServer):
3723         * workers/service/ServiceWorkerContainer.cpp:
3724         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
3725         * workers/service/ServiceWorkerContainer.h:
3726         * workers/service/ServiceWorkerJob.cpp:
3727         (WebCore::ServiceWorkerJob::resolvedWithRegistration):
3728         * workers/service/ServiceWorkerJob.h:
3729         * workers/service/ServiceWorkerJobClient.h:
3730
3731 2017-12-01  Myles C. Maxfield  <mmaxfield@apple.com>
3732
3733         Free FontFaceSets may include fonts that were never actually added to them
3734         https://bugs.webkit.org/show_bug.cgi?id=180164
3735
3736         Reviewed by Simon Fraser.
3737
3738         There are two circumstances where this can occur:
3739
3740         - If script makes a so-called "free" FontFaceSet, by using "new FontFaceSet". This object is not
3741         associated with the document, and should therefore only include fonts which have been manually
3742         added to it from script. However, today, this object includes preinstalled fonts which have the
3743         same names as any fonts manually added to it. (So, if you manually add "Helvetica", the object
3744         would have two objects - the one you just added and the preinstalled version too).
3745
3746         - For the document's FontFaceSet, the same thing would happen. This one is a little trickier
3747         because the spec is not clear whether or not the document's FontFaceSet should include these
3748         preinstalled fonts. However, running this test in Firefox and Chrome, they both agree that 
3749         preinstalled fonts should not be present, so this patch adheres to this behavior.
3750
3751         We can't actually remove the preinstalled fonts from the document's FontFaceSet (because that's
3752         how normal font lookups are performed), but we can filter them out at the point they meet the
3753         Javascript API. And, for "free" FontFaceSets, we can avoid adding them in the first place for
3754         performance.
3755
3756         Test: fast/text/font-face-api-preinstalled.html
3757
3758         * css/CSSFontFaceSet.cpp:
3759         (WebCore::CSSFontFaceSet::CSSFontFaceSet):
3760         (WebCore::CSSFontFaceSet::ensureLocalFontFacesForFamilyRegistered):
3761         (WebCore::CSSFontFaceSet::addToFacesLookupTable):
3762         (WebCore::CSSFontFaceSet::matchingFacesExcludingPreinstalledFonts):
3763         (WebCore::CSSFontFaceSet::check):
3764         (WebCore::CSSFontFaceSet::matchingFaces): Deleted.
3765         * css/CSSFontFaceSet.h:
3766         * css/CSSFontSelector.cpp:
3767         (WebCore::CSSFontSelector::CSSFontSelector):
3768         * css/FontFaceSet.cpp:
3769         (WebCore::FontFaceSet::load):
3770
3771 2017-12-01  Dean Jackson  <dino@apple.com>
3772
3773         Attempted build fix.
3774
3775         * platform/graphics/ANGLEWebKitBridge.cpp:
3776         (WebCore::ANGLEWebKitBridge::compileShaderSource):
3777         * platform/graphics/ANGLEWebKitBridge.h:
3778         * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
3779         (WebCore::Extensions3DOpenGLCommon::getTranslatedShaderSourceANGLE):
3780
3781 2017-12-01  Dean Jackson  <dino@apple.com>
3782
3783         Use SH_INITIALIZE_UNINITIALIZED_LOCALS now that ANGLE has been updated
3784         https://bugs.webkit.org/show_bug.cgi?id=177929
3785         <rdar://problem/34866210>
3786
3787         Reviewed by Sam Weinig.
3788
3789         Test: fast/canvas/webgl/uninitialized-locals.html
3790
3791         * platform/graphics/ANGLEWebKitBridge.cpp:
3792         (WebCore::ANGLEWebKitBridge::compileShaderSource):
3793         * platform/graphics/ANGLEWebKitBridge.h:
3794         * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
3795         (WebCore::Extensions3DOpenGLCommon::getTranslatedShaderSourceANGLE):
3796
3797 2017-12-01  Youenn Fablet  <youenn@apple.com>
3798
3799         Many imported/w3c/web-platform-tests/service-workers/ test are failing together intermittently
3800         https://bugs.webkit.org/show_bug.cgi?id=180227
3801
3802         Reviewed by Mark Lam.
3803
3804         No observable change.
3805
3806         * bindings/js/JSDOMPromise.cpp:
3807         (WebCore::callFunction):
3808
3809 2017-12-01  Brady Eidson  <beidson@apple.com>
3810
3811         Add Internals.terminateServiceWorker, and the ability to restart service workers for postMessage.
3812         https://bugs.webkit.org/show_bug.cgi?id=180170
3813
3814         Reviewed by Chris Dumez.
3815
3816         Test: http/tests/workers/service/postmessage-after-terminate.https.html
3817
3818         * dom/ActiveDOMObject.cpp:
3819         (WebCore::ActiveDOMObject::~ActiveDOMObject):
3820
3821         * testing/Internals.cpp:
3822         (WebCore::Internals::terminateServiceWorker):
3823         * testing/Internals.h:
3824         * testing/Internals.idl:
3825
3826         * workers/service/SWClientConnection.h:
3827
3828         * workers/service/ServiceWorker.idl:
3829
3830         * workers/service/context/SWContextManager.cpp:
3831         (WebCore::SWContextManager::postMessageToServiceWorkerGlobalScope):
3832         (WebCore::SWContextManager::terminateWorker):
3833         * workers/service/context/SWContextManager.h:
3834
3835         * workers/service/context/ServiceWorkerThreadProxy.h:
3836
3837         * workers/service/server/SWServer.cpp:
3838         (WebCore::SWServer::workerByID const):
3839         (WebCore::SWServer::Connection::syncTerminateWorker):
3840         (WebCore::SWServer::installContextData):
3841         (WebCore::SWServer::invokeRunServiceWorker):
3842         (WebCore::SWServer::terminateWorker):
3843         (WebCore::SWServer::syncTerminateWorker):
3844         (WebCore::SWServer::terminateWorkerInternal):
3845         (WebCore::SWServer::workerContextTerminated):
3846         * workers/service/server/SWServer.h:
3847         (WebCore::SWServer::workerByID const): Deleted.
3848
3849         * workers/service/server/SWServerToContextConnection.h:
3850
3851         * workers/service/server/SWServerWorker.cpp:
3852         (WebCore::SWServerWorker::contextData const):
3853         * workers/service/server/SWServerWorker.h:
3854         (WebCore::SWServerWorker::isRunning const):
3855         (WebCore::SWServerWorker::isTerminating const):
3856         (WebCore::SWServerWorker::setState):
3857         (WebCore::SWServerWorker::server):
3858
3859 2017-12-01  Zalan Bujtas  <zalan@apple.com>
3860
3861         Nullptr deref in WebCore::RenderTableCaption::containingBlockLogicalWidthForContent
3862         https://bugs.webkit.org/show_bug.cgi?id=180251
3863         <rdar://problem/34138562>
3864
3865         Reviewed by Simon Fraser.
3866
3867         containingBlockLogicalWidthForContent should check whether the renderer is actually
3868         attached to the tree.
3869
3870         Test: fast/table/caption-crash-when-layer-backed.html
3871
3872         * rendering/RenderBoxModelObject.cpp:
3873         (WebCore::RenderBoxModelObject::containingBlockLogicalWidthForContent const):
3874         * rendering/RenderTableCaption.h:
3875         (WebCore::RenderTableCaption::containingBlockLogicalWidthForContent const):
3876
3877 2017-12-01  Youenn Fablet  <youenn@apple.com>
3878
3879         Clear WebSWClientConnection in case storage process IPC connection is closing
3880         https://bugs.webkit.org/show_bug.cgi?id=180210
3881
3882         Reviewed by Chris Dumez.
3883
3884         No observable change of behavior.
3885
3886         * dom/Document.h: Keeping a ref since object may be deleted otherwise.
3887
3888 2017-12-01  Chris Dumez  <cdumez@apple.com>
3889
3890         Drop clientCreationURL from ServiceWorkerRegistrationKey
3891         https://bugs.webkit.org/show_bug.cgi?id=180255
3892
3893         Reviewed by Youenn Fablet.
3894
3895         Drop clientCreationURL from ServiceWorkerRegistrationKey. It is not needed and leads to
3896         wrong behavior when using the Service Worker API from inside service workers.
3897
3898         * workers/service/ServiceWorkerJobData.cpp:
3899         (WebCore::ServiceWorkerJobData::registrationKey const):
3900         * workers/service/ServiceWorkerRegistrationKey.cpp:
3901         (WebCore::ServiceWorkerRegistrationKey::ServiceWorkerRegistrationKey):
3902         (WebCore::ServiceWorkerRegistrationKey::hash const):
3903         (WebCore::ServiceWorkerRegistrationKey::operator== const):
3904         (WebCore::ServiceWorkerRegistrationKey::isolatedCopy const):
3905         (WebCore::ServiceWorkerRegistrationKey::loggingString const):
3906         * workers/service/ServiceWorkerRegistrationKey.h:
3907         (WebCore::ServiceWorkerRegistrationKey::scope const):
3908         (WebCore::ServiceWorkerRegistrationKey::setScope):
3909         (WebCore::ServiceWorkerRegistrationKey::encode const):
3910         (WebCore::ServiceWorkerRegistrationKey::decode):
3911         (WTF::HashTraits<WebCore::ServiceWorkerRegistrationKey>::constructDeletedValue):
3912         (WTF::HashTraits<WebCore::ServiceWorkerRegistrationKey>::isDeletedValue):
3913         (WebCore::ServiceWorkerRegistrationKey::clientCreationURL const): Deleted.
3914         (WebCore::ServiceWorkerRegistrationKey::setClientCreationURL): Deleted.
3915
3916 2017-12-01  Fujii Hironori  <Hironori.Fujii@sony.com>
3917
3918         [WinCairo] Wrongly placed scroll bars in HiDPI
3919         https://bugs.webkit.org/show_bug.cgi?id=180066
3920
3921         Reviewed by Žan Doberšek.
3922
3923         PlatformContextCairo wasn't properly initialized. It should have a
3924         pointer to GraphicsContextPrivate in WinCairo port to paint
3925         controls in right places.
3926
3927         No new tests, no behavior change.
3928
3929         * platform/graphics/win/GraphicsContextCairoWin.cpp:
3930         (WebCore::GraphicsContext::platformInit): Call PlatformContextCairo::setGraphicsContextPrivate.
3931
3932 2017-12-01  Eric Carlson  <eric.carlson@apple.com>
3933
3934         [MediaStream] Use CaptureDevice instead of device ID to identify devices
3935         https://bugs.webkit.org/show_bug.cgi?id=180206
3936         <rdar://problem/35775758>
3937
3938         Reviewed by Youenn Fablet.
3939
3940         No new tests, no change in behavior.
3941
3942         * Modules/mediastream/UserMediaRequest.cpp:
3943         (WebCore::UserMediaRequest::allow):
3944         * Modules/mediastream/UserMediaRequest.h:
3945         (WebCore::UserMediaRequest::allowedAudioDeviceUID const): Deleted.
3946         (WebCore::UserMediaRequest::allowedVideoDeviceUID const): Deleted.
3947         * platform/mediastream/RealtimeMediaSource.h:
3948         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
3949         (WebCore::RealtimeMediaSourceCenter::createMediaStream):
3950         (WebCore::RealtimeMediaSourceCenter::validateRequestConstraints):
3951         * platform/mediastream/RealtimeMediaSourceCenter.h:
3952         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
3953         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
3954         * platform/mock/MockRealtimeAudioSource.cpp:
3955         * platform/mock/MockRealtimeVideoSource.cpp:
3956
3957 2017-11-30  Alex Christensen  <achristensen@webkit.org>
3958
3959         Extra PerformanceEntryList entry after iframe navigation
3960         https://bugs.webkit.org/show_bug.cgi?id=178433
3961
3962         Reviewed by Joseph Pecoraro.
3963
3964         Test: http/tests/security/PerformanceEntryList-parent-only-first-navigation.html
3965
3966         When an iframe is loaded, its main resource load should be reported to the parent frame's PerformanceEntryList.
3967         Subsequent main resource loads should not.
3968
3969         * loader/FrameLoader.h:
3970         (WebCore::FrameLoader::shouldReportResourceTimingToParentFrame):
3971         * loader/ResourceTimingInformation.cpp:
3972         (WebCore::ResourceTimingInformation::addResourceTiming):
3973
3974 2017-11-30  Zalan Bujtas  <zalan@apple.com>
3975
3976         [Simple line layout] Incorrect repaint rect with vertically shrinking content and bottom-padding.
3977         https://bugs.webkit.org/show_bug.cgi?id=180223
3978         <rdar://problem/34122210>
3979
3980         Reviewed by Simon Fraser.
3981
3982         Repaint rect should be extended all the way to bottom border/padding.
3983
3984         Test: fast/repaint/simple-line-layout-shrinking-content.html
3985
3986         * rendering/RenderBlockFlow.cpp:
3987         (WebCore::RenderBlockFlow::layoutSimpleLines):
3988
3989 2017-11-30  Stephan Szabo  <stephan.szabo@sony.com>
3990
3991         Make LegacyCustomProtocolManager optional for network process
3992         https://bugs.webkit.org/show_bug.cgi?id=176230
3993
3994         Reviewed by Alex Christensen.
3995