ServiceWorkers API should reject promises when calling objects inside detached frames
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-12-06  Chris Dumez  <cdumez@apple.com>
2
3         ServiceWorkers API should reject promises when calling objects inside detached frames
4         https://bugs.webkit.org/show_bug.cgi?id=180444
5
6         Reviewed by Youenn Fablet.
7
8         ServiceWorkers API should reject promises when calling objects inside detached frames.
9
10         No new tests, rebaselined existing test.
11
12         * bindings/js/JSDOMPromiseDeferred.h:
13         (WebCore::callPromiseFunction):
14         Use the caller's globalObject instead of the lexicalGlobalObject when constructing the
15         deferred promise. The bug became visible when working on this service worker bug since
16         rejecting the promise when the frame is detached did not actually work. The issue is
17         that since the promise was created with the detached frame's globalObject, then it was
18         suspended and would not run script.
19
20         * bindings/js/JSDOMWindowBase.cpp:
21         (WebCore::callerGlobalObject):
22         (WebCore::incumbentDOMWindow):
23         * bindings/js/JSDOMWindowBase.h:
24         Add convenience function to get the caller's globalObject. It was carved out of
25         incumbentDOMWindow().
26
27         * workers/service/ServiceWorker.cpp:
28         (WebCore::ServiceWorker::postMessage):
29         * workers/service/ServiceWorkerContainer.cpp:
30         (WebCore::ServiceWorkerContainer::addRegistration):
31         (WebCore::ServiceWorkerContainer::getRegistration):
32         (WebCore::ServiceWorkerContainer::getRegistrations):
33         * workers/service/ServiceWorkerRegistration.cpp:
34         (WebCore::ServiceWorkerRegistration::update):
35         (WebCore::ServiceWorkerRegistration::unregister):
36         Reject the promise when m_isStopped flag is set (i.e. ActiveDOMObject::stop()
37         has been called).
38
39 2017-12-06  Said Abou-Hallawa  <sabouhallawa@apple.com>
40
41         [Mac] REGRESSION (r224527): Drawing a path with box-shadow takes double the blur-radius on Retina display
42         https://bugs.webkit.org/show_bug.cgi?id=180460
43         <rdar://problem/35869866>
44
45         Reviewed by Daniel Bates.
46
47         Disable using CGContextDrawPathDirect() for macOS High Sierra or earlier.
48         This API has a bug when drawing a path with a shadow on Retina display.
49
50         * platform/graphics/cg/GraphicsContextCG.cpp:
51
52 2017-12-06  Youenn Fablet  <youenn@apple.com>
53
54         Service Worker fetch should filter HTTP headers that are added by CachedResourceLoader/CachedResource
55         https://bugs.webkit.org/show_bug.cgi?id=180462
56
57         Reviewed by Geoffrey Garen.
58
59         Coved by rebased test.
60
61         * loader/CrossOriginAccessControl.cpp:
62         (WebCore::cleanRedirectedRequestForAccessControl): Accept header is a safe header so it is fine to keep it.
63         * workers/service/context/ServiceWorkerFetch.cpp:
64         (WebCore::ServiceWorkerFetch::dispatchFetchEvent): Cleaning headers added by CachedResourceLoader/CachedResource.
65
66 2017-12-06  Zan Dobersek  <zdobersek@igalia.com>
67
68         [CoordGraphics] Introduce Nicosia::PaintingContext, add Cairo implementation
69         https://bugs.webkit.org/show_bug.cgi?id=180239
70
71         Reviewed by Michael Catanzaro.
72
73         As the next step in the Nicosia abstraction formation, we introduce
74         Nicosia::PaintingContext. Implementations of this class will leverage a
75         chosen 2D graphics library to paint (through GraphicsContext) into the
76         memory area that's specified by a given Nicosia::Buffer object.
77
78         Nicosia::Buffer is slimmed down to only control the memory that's
79         required for rasterization of an RGBA32 painting output. It mimics the
80         Cairo ImageBuffer implementation by using FastMalloc to allocate the
81         necessary memory. In the future this class might become an interface of
82         which different implementations will be providing memory that's
83         allocated through different ways. For instance, when GLES3 is available,
84         it would be possible to map GPU memory into the process memory space and
85         rasterize into that, effectively eliminating need for GPU uploads.
86
87         Since the ImageBuffer use in Nicosia::Buffer is dropped, the context()
88         and uploadImage() methods are also removed. The functionality of
89         ImageBuffer that was leveraged for CoordinatedGraphics rasterization
90         still remains used through the PaintingContextCairo implementation. In
91         the constructor of that class, with the target Nicosia::Buffer provided,
92         we construct the cairo_surface_t and cairo_t objects that are necessary
93         to create a combination of PlatformContextCairo and GraphicsContext
94         objects that we can then use for rasterization.
95
96         Reference of the passed-in Nicosia::Buffer object is increased for the
97         lifetime of the cairo_surface_t object that will be drawing into that
98         buffer's memory area. This ensures the memory area doesn't disappear
99         from a live cairo_surface_t. Still, the expectation is that the
100         cairo_surface_t object won't outlive the PaintingContextCairo object's
101         lifetime, since the cairo_t object is also managed here and deleted in
102         the destructor. To test that, we use a cairo_surface_t user data key
103         that in its destroy callback dereferences the Nicosia::Buffer object and
104         also marks the deletion process for the related PaintingContextCairo
105         object as complete. This m_deletionComplete value is tested in the
106         destructor of the class, once all the Cairo references are nulled out.
107
108         The PaintingContext objects should be limited to a single scope,
109         enabling the implementation resources to assume that the lifetime of the
110         implementation object won't extend outside of the scope where it was
111         created. To ensure that, the PaintingContext::paint() static function is
112         added that creates the PaintingContext object and then executes the
113         passed-in functor, passing it the GraphicsContext that should be used
114         for drawing. Drawing is thus limited to that functor only, and the
115         PaintingContext's create() function and the virtual graphicsContext()
116         are not made public in the class.
117
118         No new tests -- no change in functionality.
119
120         * platform/TextureMapper.cmake:
121         * platform/graphics/nicosia/NicosiaBuffer.cpp:
122         (Nicosia::Buffer::Buffer):
123         (Nicosia::Buffer::context): Deleted.
124         (Nicosia::Buffer::uploadImage): Deleted.
125         * platform/graphics/nicosia/NicosiaBuffer.h:
126         (Nicosia::Buffer::stride const):
127         (Nicosia::Buffer::data const):
128         * platform/graphics/nicosia/NicosiaPaintingContext.cpp: Copied from Source/WebCore/platform/graphics/nicosia/NicosiaBuffer.cpp.
129         (Nicosia::PaintingContext::create):
130         * platform/graphics/nicosia/NicosiaPaintingContext.h: Copied from Source/WebCore/platform/graphics/nicosia/NicosiaBuffer.cpp.
131         (Nicosia::PaintingContext::paint):
132         * platform/graphics/nicosia/NicosiaPaintingContextCairo.cpp: Added.
133         (Nicosia::PaintingContextCairo::PaintingContextCairo):
134         (Nicosia::PaintingContextCairo::~PaintingContextCairo):
135         (Nicosia::PaintingContextCairo::graphicsContext):
136         * platform/graphics/nicosia/NicosiaPaintingContextCairo.h: Copied from Source/WebCore/platform/graphics/nicosia/NicosiaBuffer.h.
137         * platform/graphics/nicosia/NicosiaPaintingEngineBasic.cpp:
138         (Nicosia::PaintingEngineBasic::paint):
139         * platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp:
140         (WebCore::CoordinatedImageBacking::update):
141
142 2017-12-05  Fujii Hironori  <Hironori.Fujii@sony.com>
143
144         [GTK] Layout test media/track/track-in-band-duplicate-tracks-when-source-changes.html crashes and times out
145         https://bugs.webkit.org/show_bug.cgi?id=160131
146
147         Reviewed by Eric Carlson.
148
149         Null dereference can be happen if VideoTrack and AudioTrack are
150         disconnected from its media element.
151
152         No new tests, no behavior change.
153
154         * html/track/AudioTrack.cpp:
155         (WebCore::AudioTrack::willRemove): Null-check mediaElement.
156         * html/track/VideoTrack.cpp:
157         (WebCore::VideoTrack::setLanguage): Ditto.
158
159 2017-12-05  Chris Dumez  <cdumez@apple.com>
160
161         ServiceWorkerGlobalScope prototype chain should be immutable
162         https://bugs.webkit.org/show_bug.cgi?id=180450
163
164         Reviewed by Youenn Fablet.
165
166         ServiceWorkerGlobalScope prototype chain should be immutable, similarly
167         to what we do for DOMWindow. This is covered by a web-platform-test
168         which was timing out because it was successfuly overwriting the
169         ServiceWorkerGlobalScope prototype.
170
171         No new tests, rebaselined existing test.
172
173         * workers/DedicatedWorkerGlobalScope.idl:
174         * workers/WorkerGlobalScope.idl:
175         * workers/service/ServiceWorkerGlobalScope.idl:
176
177 2017-12-05  Basuke Suzuki  <Basuke.Suzuki@sony.com>
178
179         Fast binding generation by batching several files at once
180         https://bugs.webkit.org/show_bug.cgi?id=179958
181
182         Reviewed by Alex Christensen.
183
184         Passing several files to the sub process at once and reducing the total cost of
185         process generation. Especially Windows port has great speed improvement because
186         its implementation of fork/exec is terrible.
187
188         * bindings/scripts/generate-bindings-all.pl:
189         (spawnGenerateBindingsIfNeeded):
190         * bindings/scripts/generate-bindings.pl:
191         (generateBindings):
192
193 2017-12-05  David Quesada  <david_quesada@apple.com>
194
195         [Web App Manifest] Support fetching the app manifest 
196         https://bugs.webkit.org/show_bug.cgi?id=180292
197
198         Reviewed by Geoffrey Garen.
199
200         Add support in WebCore for loading and parsing application manifests. This functionality
201         is currently exposed with two methods: DocumentLoader::loadApplicationManifest() to call
202         to start loading the manifest, and FrameLoaderClient::finishedLoadingApplicationManifest()
203         for clients to override in order to be notified of the loaded manifest.
204
205         No new tests, since no functionality is exposed to web content or embedders yet. The
206         needed SPI will be added in an upcoming patch.
207
208         * Sources.txt:
209         * WebCore.xcodeproj/project.pbxproj:
210             Added CachedApplicationManifest and ApplicationManifestLoader.
211         * html/HTMLLinkElement.h:
212         * html/LinkRelAttribute.cpp:
213         (WebCore::LinkRelAttribute::LinkRelAttribute):
214         (WebCore::LinkRelAttribute::isSupported):
215             Add "manifest" as a supported 'rel' type for links.
216         * html/LinkRelAttribute.h:
217         * inspector/agents/InspectorPageAgent.cpp:
218         (WebCore::InspectorPageAgent::resourceTypeJSON):
219         (WebCore::InspectorPageAgent::inspectorResourceType):
220         * inspector/agents/InspectorPageAgent.h:
221         * loader/ApplicationManifestLoader.cpp: Added.
222             Added a class ApplicationManifestLoader which handles creating a ResourceRequest,
223             loading the resource from the CachedResourceLoader, and parsing the resulting text.
224             This class and its relation to DocumentLoader are roughly based on that of IconLoader,
225             which serves a similar purpose - requesting a resource on the page and ultimately
226             providing it to the embedder.
227         (WebCore::ApplicationManifestLoader::ApplicationManifestLoader):
228         (WebCore::ApplicationManifestLoader::~ApplicationManifestLoader):
229         (WebCore::ApplicationManifestLoader::startLoading):
230         (WebCore::ApplicationManifestLoader::stopLoading):
231         (WebCore::ApplicationManifestLoader::processManifest):
232         (WebCore::ApplicationManifestLoader::notifyFinished):
233         * loader/ApplicationManifestLoader.h: Copied from Source/WebCore/page/csp/ContentSecurityPolicyDirectiveNames.h.
234         * loader/DocumentLoader.cpp:
235         (WebCore::DocumentLoader::stopLoading):
236         (WebCore::DocumentLoader::loadApplicationManifest):
237         (WebCore::DocumentLoader::finishedLoadingApplicationManifest):
238         (WebCore::DocumentLoader::notifyFinishedLoadingApplicationManifest):
239         * loader/DocumentLoader.h:
240         * loader/FrameLoaderClient.h:
241         * loader/LinkLoader.cpp:
242         (WebCore::createLinkPreloadResourceClient):
243         (WebCore::LinkLoader::isSupportedType):
244         * loader/ResourceLoadInfo.cpp:
245         (WebCore::toResourceType):
246         * loader/SubresourceLoader.cpp:
247         (WebCore::logResourceLoaded):
248         * loader/cache/CachedApplicationManifest.cpp: Added.
249         (WebCore::CachedApplicationManifest::CachedApplicationManifest):
250         (WebCore::CachedApplicationManifest::finishLoading):
251         (WebCore::CachedApplicationManifest::setEncoding):
252         (WebCore::CachedApplicationManifest::encoding const):
253         (WebCore::CachedApplicationManifest::process):
254             Add a method to process the fetched text into an ApplicationManifest. CachedApplicationManifest
255             does not store the resulting ApplicationManifest because the text of an application
256             manifest can yield a different ApplicationManifest depending on the URL of the document
257             processing it.
258         * loader/cache/CachedApplicationManifest.h: Copied from Source/WebCore/page/csp/ContentSecurityPolicyDirectiveNames.h.
259         * loader/cache/CachedResource.cpp:
260         (WebCore::CachedResource::defaultPriorityForResourceType):
261         * loader/cache/CachedResource.h:
262         * loader/cache/CachedResourceLoader.cpp:
263         (WebCore::createResource):
264         (WebCore::CachedResourceLoader::requestApplicationManifest):
265         (WebCore::contentTypeFromResourceType):
266         (WebCore::CachedResourceLoader::checkInsecureContent const):
267         (WebCore::CachedResourceLoader::allowedByContentSecurityPolicy const):
268         * loader/cache/CachedResourceLoader.h:
269         * page/DiagnosticLoggingKeys.cpp:
270         (WebCore::DiagnosticLoggingKeys::applicationManifestKey):
271         * page/DiagnosticLoggingKeys.h:
272         * page/csp/ContentSecurityPolicy.cpp:
273         (WebCore::ContentSecurityPolicy::allowManifestFromSource const):
274         * page/csp/ContentSecurityPolicy.h:
275         * page/csp/ContentSecurityPolicyDirectiveList.cpp:
276         (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForManifest const):
277         (WebCore::ContentSecurityPolicyDirectiveList::addDirective):
278         * page/csp/ContentSecurityPolicyDirectiveList.h:
279         * page/csp/ContentSecurityPolicyDirectiveNames.cpp:
280         * page/csp/ContentSecurityPolicyDirectiveNames.h:
281
282 2017-12-05  Stephan Szabo  <stephan.szabo@sony.com>
283
284         Switch windows build to Visual Studio 2017
285         https://bugs.webkit.org/show_bug.cgi?id=172412
286
287         Reviewed by Per Arne Vollan.
288
289         Only changes proj file to update generator
290
291         * WebCore.vcxproj/WebCore.proj:
292
293 2017-12-05  Brent Fulgham  <bfulgham@apple.com>
294
295         Limit user agent versioning to an upper bound
296         https://bugs.webkit.org/show_bug.cgi?id=180365
297         <rdar://problem/34550617>
298
299         Reviewed by Joseph Pecoraro.
300
301         Freeze the version reported as User Agent to OS 10.13.4 (OS 11.3 on iOS) and WebKit 605.1.15
302         for User Agent purposes.
303
304         Test: fast/dom/navigator-userAgent-frozen.html
305
306         * page/cocoa/UserAgent.h:
307         * page/cocoa/UserAgent.mm:
308         (WebCore::versionPredatesFreeze): Helper function. Returns true for Version 10.13.3 or older.
309         (WebCore::systemMarketingVersionForUserAgentString):
310         (WebCore::userAgentBundleVersion):
311         (WebCore::userVisibleWebKitBundleVersionFromFullVersion): Deleted.
312         (WebCore::userAgentBundleVersionFromFullVersionString): Deleted.
313         * page/ios/UserAgentIOS.mm:
314         (WebCore::standardUserAgentWithApplicationName): Don't take the WebKit bundle version
315         as an argument, or pass it to the user agent string generator.
316         * page/mac/UserAgentMac.mm:
317         (WebCore::standardUserAgentWithApplicationName): Ditto. 
318
319 2017-12-05  Matt Lewis  <jlewis3@apple.com>
320
321         Unreviewed, rolling out r225430.
322
323         This caused an API failure on release.
324
325         Reverted changeset:
326
327         "Move DateComponents into WTF"
328         https://bugs.webkit.org/show_bug.cgi?id=180211
329         https://trac.webkit.org/changeset/225430
330
331 2017-12-05  Simon Fraser  <simon.fraser@apple.com>
332
333         Composited frames incorrectly get requestAnimationFrame throttled
334         https://bugs.webkit.org/show_bug.cgi?id=178396
335
336         Reviewed by Zalan Bujtas.
337
338         If a composited iframe was inside overflow:scroll, and the overflow was scrolled to the left
339         further than the window width, then RenderLayer::childrenClipRect() would return an empty rectangle
340         and we'd incorrectly consider the iframe out of view, and thus throttle its requestAnimationFrame.
341
342         childrenClipRect() was taking unscaledDocumentRect(), applying the clip, and then mapping the result
343         from local to absolute coordinates (which mapped it through the overflow scroll offset). This is incorrect
344         because it considers the unscaledDocumentRect() to be in local coordinates, which it is not.
345
346         Instead, start with the infinite rect, which essentially tells us if we have any clipping, and then
347         intersect that with the document rect at the end. Something similar is done in other places that call.
348         calculateRects().
349
350         Test: fast/animation/request-animation-frame-throttle-inside-overflow-scroll.html
351
352         * rendering/RenderLayer.cpp:
353         (WebCore::RenderLayer::calculateClipRects const):
354
355 2017-12-05  Michael Saboff  <msaboff@apple.com>
356
357         Make WebKit build for ARM64_32
358         https://bugs.webkit.org/show_bug.cgi?id=180447
359
360         Reviewed by Mark Lam.
361
362         No new test as this isn't a change to functionality.
363
364         * platform/graphics/transforms/TransformationMatrix.cpp:
365         (WebCore::TransformationMatrix::multiply): Fallback to the C++ version for
366         ARM64_32.
367
368 2017-12-05  Chris Dumez  <cdumez@apple.com>
369
370         XMLHttpRequest should not be exposed to service workers
371         https://bugs.webkit.org/show_bug.cgi?id=180446
372
373         Reviewed by Youenn Fablet.
374
375         Stop exposing XMLHttpRequest to service workers, as per:
376         - https://xhr.spec.whatwg.org/#interface-xmlhttprequest
377
378         * xml/XMLHttpRequest.idl:
379
380 2017-12-05  Joseph Pecoraro  <pecoraro@apple.com>
381
382         Web Inspector: content views for resources loaded through XHR do not reflect declared mime-type
383         https://bugs.webkit.org/show_bug.cgi?id=141389
384         <rdar://problem/19767070>
385
386         Reviewed by Brian Burg.
387
388         Updated: http/tests/inspector/network/xhr-response-body.html:
389                  http/tests/inspector/network/fetch-response-body.html:
390
391         * xml/XMLHttpRequest.cpp:
392         (WebCore::XMLHttpRequest::didFinishLoading):
393         * inspector/InspectorInstrumentation.cpp:
394         (WebCore::InspectorInstrumentation::didFinishXHRLoadingImpl): Deleted.
395         * inspector/InspectorInstrumentation.h:
396         (WebCore::InspectorInstrumentation::didFinishXHRLoading): Deleted.
397         Remove special handling of XHR content that decoded output as text.
398
399         * inspector/NetworkResourcesData.h:
400         (WebCore::NetworkResourcesData::ResourceData::requestId const):
401         (WebCore::NetworkResourcesData::ResourceData::loaderId const):
402         (WebCore::NetworkResourcesData::ResourceData::frameId const):
403         (WebCore::NetworkResourcesData::ResourceData::url const):
404         (WebCore::NetworkResourcesData::ResourceData::content const):
405         (WebCore::NetworkResourcesData::ResourceData::isContentEvicted const):
406         (WebCore::NetworkResourcesData::ResourceData::textEncodingName const):
407         * inspector/NetworkResourcesData.cpp:
408         (WebCore::NetworkResourcesData::ResourceData::ResourceData):
409         (WebCore::NetworkResourcesData::ResourceData::decodeDataToContent):
410         (WebCore::NetworkResourcesData::responseReceived):
411         (WebCore::NetworkResourcesData::setResourceContent):
412         (WebCore::shouldBufferResourceData):
413         (WebCore::NetworkResourcesData::maybeAddResourceData):
414         (WebCore::NetworkResourcesData::maybeDecodeDataToContent):
415
416         Make NetworkResourcesData only create a text decoder for resources we
417         really think are text, and buffer resource data if it is text data
418         or if it is a resource that would otherwise not be buffered by WebCore
419         (such as XHRs with a DoNotBufferData policy). This ensures that the
420         Inspector will have data to show for resources that won't be cached.
421
422         * inspector/agents/InspectorPageAgent.cpp:
423         (WebCore::InspectorPageAgent::resourceContent):
424         (WebCore::InspectorPageAgent::sourceMapURLForResource):
425         (WebCore::InspectorPageAgent::searchInResource):
426         (WebCore::InspectorPageAgent::searchInResources):
427         (WebCore::hasTextContent): Deleted.
428         (WebCore::InspectorPageAgent::cachedResourceContent): Deleted.
429         (WebCore::InspectorPageAgent::createTextDecoder): Deleted.
430         (WebCore::textContentForCachedResource): Deleted.
431         * inspector/agents/InspectorPageAgent.h:
432         * inspector/agents/InspectorNetworkAgent.cpp:
433         (WebCore::InspectorNetworkAgent::didReceiveData):
434         (WebCore::InspectorNetworkAgent::willDestroyCachedResource):
435         (WebCore::InspectorNetworkAgent::getResponseBody):
436         (WebCore::InspectorNetworkAgent::shouldTreatAsText):
437         (WebCore::InspectorNetworkAgent::createTextDecoder):
438         (WebCore::InspectorNetworkAgent::textContentForCachedResource):
439         (WebCore::InspectorNetworkAgent::cachedResourceContent):
440         (WebCore::textContentForResourceData):
441         (WebCore::InspectorNetworkAgent::searchOtherRequests):
442         (WebCore::isErrorStatusCode): Deleted.
443         (WebCore::InspectorNetworkAgent::didFinishXHRLoading): Deleted.
444         * inspector/agents/InspectorNetworkAgent.h:
445         Move static PageAgent functions related to the generic data tuple
446         (content, base64Encoded) to NetworkAgent. Also generalize it to
447         not rely on the CachedResourceType, but instead rely on the MIME type.
448         This has a few changes in behavior:
449
450             - Images, may now be text if they have a text mime type (image/svg+xml).
451             - XHR / Fetch / Other may be sent as text if they have a text mime type.
452             - XHR / Fetch / Other are not assumed to be text, and may be sent as base64 encoded.
453         
454         For this to be useful the frontend should also check the mime type and
455         display an appropriate ContentView.
456
457 2017-12-05  Youenn Fablet  <youenn@apple.com>
458
459         Implement https://w3c.github.io/ServiceWorker/#clients-claim
460         https://bugs.webkit.org/show_bug.cgi?id=180261
461
462         Reviewed by Chris Dumez.
463
464         Test: http/tests/workers/service/serviceworkerclients-claim.https.html
465
466         Implement claim by going to the storage process and then iterate over clients to see whether active worker can be set.
467         Update SWServerWorker to call registration tryClear/tryActivate whenever a service worker has no pending event.
468
469         * workers/service/ServiceWorkerClients.cpp:
470         (WebCore::ServiceWorkerClients::claim):
471         * workers/service/context/SWContextManager.h:
472         * workers/service/server/SWServer.cpp:
473         (WebCore::SWServer::claim):
474         (WebCore::SWServer::doRegistrationMatching):
475         (WebCore::SWServer::doRegistrationMatching const): Deleted.
476         * workers/service/server/SWServer.h:
477         (WebCore::SWServer::Connection::doRegistrationMatching):
478         * workers/service/server/SWServerRegistration.cpp:
479         (WebCore::SWServerRegistration::controlClient):
480         * workers/service/server/SWServerRegistration.h:
481         * workers/service/server/SWServerToContextConnection.cpp:
482         (WebCore::SWServerToContextConnection::claim):
483         * workers/service/server/SWServerToContextConnection.h:
484         * workers/service/server/SWServerWorker.cpp:
485         (WebCore::SWServerWorker::claim):
486         * workers/service/server/SWServerWorker.h:
487
488 2017-12-05  Per Arne Vollan  <pvollan@apple.com>
489
490         [Win] Scrollbars are sometimes not rendered in accelerated compositing mode.
491         https://bugs.webkit.org/show_bug.cgi?id=180431
492         <rdar://problem/34531264>
493
494         Reviewed by Simon Fraser.
495
496         No new tests, covered by existing tests.
497
498         When a scroll layer is required, we will create an overflow control hosts layer.
499         In this case the method RenderLayerCompositor::shouldCompositeOverflowControls()
500         should return true, otherwise the scrollbars will not be rendered.
501  
502         * rendering/RenderLayerCompositor.cpp:
503         (WebCore::RenderLayerCompositor::shouldCompositeOverflowControls const):
504
505 2017-12-05  Youenn Fablet  <youenn@apple.com>
506
507         Call "Terminate Service Worker" on all workers when all their clients are gone
508         https://bugs.webkit.org/show_bug.cgi?id=179552
509         <rdar://problem/35836323>
510
511         Unreviewed.
512
513         * workers/service/server/SWServer.cpp: Reducing from 60_s to 10_s based on bugzilla comment.
514
515 2017-12-05  Chris Dumez  <cdumez@apple.com>
516
517         Add support for ServiceWorkerContainer.prototype.ready
518         https://bugs.webkit.org/show_bug.cgi?id=180383
519
520         Reviewed by Youenn Fablet.
521
522         Add support for ServiceWorkerContainer.prototype.ready:
523         - https://w3c.github.io/ServiceWorker/#navigator-service-worker-ready
524
525         No new tests, rebaselined existing test.
526
527         * workers/service/SWClientConnection.h:
528         * workers/service/ServiceWorkerContainer.cpp:
529         (WebCore::ServiceWorkerContainer::ServiceWorkerContainer):
530         (WebCore::ServiceWorkerContainer::ready):
531         * workers/service/ServiceWorkerContainer.h:
532         * workers/service/ServiceWorkerRegistrationKey.h:
533         * workers/service/server/SWServer.cpp:
534         (WebCore::SWServer::resolveRegistrationReadyRequests):
535         * workers/service/server/SWServer.h:
536         * workers/service/server/SWServerRegistration.cpp:
537         (WebCore::SWServerRegistration::activate):
538         (WebCore::SWServerRegistration::setIsUninstalling):
539         * workers/service/server/SWServerRegistration.h:
540
541 2017-12-05  Yusuke Suzuki  <utatane.tea@gmail.com>
542
543         Modernize WebThread code for further refactoring
544         https://bugs.webkit.org/show_bug.cgi?id=180344
545
546         Reviewed by Alex Christensen.
547
548         When touching Thread and its initialization component, we need to touch
549         web thread initialization code too. However, since web thread code is old,
550         it's style is not following to WebKit coding style guidelines.
551
552         This patch first modernizes WebThread code for further refactoring.
553
554         1. `Type*` instead of `Type *`.
555         2. Use std::call_once instead of pthread_once.
556         3. Use static_cast instead of C-cast.
557         4. Use nullptr instead of NULL.
558         5. Use `ret` or `!ret` instead of `ret != 0` or `ret == 0`.
559         6. Do not use #pragma unused.
560         7. if-else with one statement should not have braces.
561
562         In this patch, we do not change pthread_condition_t to WTF::Condition and
563         pthread_mutex_t to WTF::Lock since web thread code requires extra care about
564         threading.
565
566         No behavior change.
567
568         * platform/ios/wak/WebCoreThread.mm:
569         (-[NSObject releaseOnMainThread]):
570         (SendMessage):
571         (HandleDelegateSource):
572         (SendDelegateMessage):
573         (WebThreadAdoptAndRelease):
574         (lockWebCoreReleaseLock):
575         (unlockWebCoreReleaseLock):
576         (WebCoreObjCDeallocOnWebThreadImpl):
577         (WebCoreObjCDeallocWithWebThreadLockImpl):
578         (HandleWebThreadReleaseSource):
579         (WebThreadCallDelegate):
580         (WebThreadPostNotification):
581         (WebThreadCallDelegateAsync):
582         (WebThreadMakeNSInvocation):
583         (MainRunLoopAutoUnlock):
584         (_WebThreadAutoLock):
585         (WebRunLoopLock):
586         (WebRunLoopUnlock):
587         (MainRunLoopUnlockGuard):
588         (CurrentThreadContext):
589         (RunWebThread):
590         (StartWebThread):
591         (WebTimedConditionLock):
592         (_WebTryThreadLock):
593         (WebThreadUnlockFromAnyThread):
594         (WebThreadUnlockGuardForMail):
595         (_WebThreadUnlock):
596         (WebThreadIsLocked):
597         (WebThreadLockPopModal):
598         (WebThreadCurrentContext):
599         (WebThreadEnable):
600         (FreeThreadContext): Deleted.
601         (InitThreadContextKey): Deleted.
602
603 2017-12-05  Alex Christensen  <achristensen@webkit.org>
604
605         Fix non-unified build after r225381
606         https://bugs.webkit.org/show_bug.cgi?id=180434
607
608         Reviewed by Keith Miller.
609
610         * loader/ResourceTimingInformation.cpp:
611         FrameLoader.h is included in other files that are combined with this file in unified builds,
612         but we need to merge r225381 to a branch that doesn't use unified builds.  This build failure
613         would've come up randomly in the future when we add files, too.
614
615 2017-12-05  Simon Fraser  <simon.fraser@apple.com>
616
617         Remove webkitGetImageDataHD and webkitPutImageDataHD from canvas API
618         https://bugs.webkit.org/show_bug.cgi?id=180387
619
620         Reviewed by Dean Jackson.
621
622         CanvasRenderingContext2D.webkitGetImageDataHD and webkitPutImageDataHD were never standardized,
623         and Blink removed support in 2014 (https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/FOPH5dloGG8).
624
625         Since our canvas backing store is always 1x, they have no use anyway, so remove them.
626
627         * html/canvas/CanvasRenderingContext2D.cpp:
628         (WebCore::CanvasRenderingContext2D::putImageData):
629         (WebCore::CanvasRenderingContext2D::webkitGetImageDataHD const): Deleted.
630         (WebCore::CanvasRenderingContext2D::webkitPutImageDataHD): Deleted.
631         * html/canvas/CanvasRenderingContext2D.h:
632         * html/canvas/CanvasRenderingContext2D.idl:
633
634 2017-12-05  Youenn Fablet  <youenn@apple.com>
635
636         Implement setting of service worker to client in SWServer without going to WebProcess
637         https://bugs.webkit.org/show_bug.cgi?id=180382
638
639         Reviewed by Chris Dumez.
640
641         No change of behavior.
642
643         This patch removes the notification of active worker setting from ScriptExecution/WebProcess up to SWServer/StorageProcess.
644         Instead, active worker setting is fully done/controlled in SWServer.
645         Whenever there is a change, SWServer notifies WebProcess and ScriptExecutionContext gets updated accordingly.
646
647         * dom/Document.cpp:
648         (WebCore::Document::setServiceWorkerConnection):
649         * dom/ScriptExecutionContext.cpp:
650         (WebCore::ScriptExecutionContext::setActiveServiceWorker):
651         * loader/DocumentLoader.cpp:
652         (WebCore::DocumentLoader::commitData):
653         * workers/service/SWClientConnection.h:
654         * workers/service/server/SWServer.cpp:
655         (WebCore::SWServer::setClientActiveWorker):
656         (WebCore::SWServer::registerServiceWorkerClient):
657         (WebCore::SWServer::registrationFromServiceWorkerIdentifier):
658         (WebCore::SWServer::unregisterServiceWorkerClient):
659         (WebCore::SWServer::Connection::serviceWorkerStartedControllingClient): Deleted.
660         (WebCore::SWServer::Connection::serviceWorkerStoppedControllingClient): Deleted.
661         (WebCore::SWServer::serviceWorkerStartedControllingClient): Deleted.
662         (WebCore::SWServer::serviceWorkerStoppedControllingClient): Deleted.
663         * workers/service/server/SWServer.h:
664         * workers/service/server/SWServerRegistration.cpp:
665         (WebCore::SWServerRegistration::activate):
666
667 2017-12-01  Filip Pizlo  <fpizlo@apple.com>
668
669         GC constraint solving should be parallel
670         https://bugs.webkit.org/show_bug.cgi?id=179934
671
672         Reviewed by JF Bastien.
673
674         No new tests because no change in behavior. This change is best tested using DOM-GC-intensive
675         benchmarks like Speedometer and Dromaeo.
676         
677         This parallelizes the DOM's output constraint, and makes some small changes to make this more
678         scalable.
679
680         * ForwardingHeaders/heap/SimpleMarkingConstraint.h: Added.
681         * ForwardingHeaders/heap/VisitingTimeout.h: Removed.
682         * Sources.txt:
683         * WebCore.xcodeproj/project.pbxproj:
684         * bindings/js/DOMGCOutputConstraint.cpp: Added.
685         (WebCore::DOMGCOutputConstraint::DOMGCOutputConstraint):
686         (WebCore::DOMGCOutputConstraint::~DOMGCOutputConstraint):
687         (WebCore::DOMGCOutputConstraint::executeImpl):
688         (WebCore::DOMGCOutputConstraint::doParallelWorkImpl):
689         (WebCore::DOMGCOutputConstraint::finishParallelWorkImpl):
690         * bindings/js/DOMGCOutputConstraint.h: Added.
691         * bindings/js/WebCoreJSClientData.cpp:
692         (WebCore::JSVMClientData::initNormalWorld):
693         * dom/Node.cpp:
694         (WebCore::Node::eventTargetDataConcurrently):
695         (WebCore::Node::ensureEventTargetData):
696         (WebCore::Node::clearEventTargetData):
697
698 2017-12-05  Antoine Quint  <graouts@apple.com>
699
700         <video> and scale() transforms yield shrunk small or clipped controls
701         https://bugs.webkit.org/show_bug.cgi?id=180358
702         <rdar://problem/34436124>
703
704         Unreviewed.
705
706         Use DOMMatrix vs. WebKitCSSMatrix per Simon's post-commit review feedback.
707
708         * Modules/modern-media-controls/media/media-controller.js:
709         (MediaController.prototype._updateControlsSize):
710
711 2017-12-04  Chris Dumez  <cdumez@apple.com>
712
713         Support container.getRegistration() / getRegistrations() inside service workers
714         https://bugs.webkit.org/show_bug.cgi?id=180360
715
716         Reviewed by Youenn Fablet.
717
718         Support container.getRegistration() / getRegistrations() inside service workers
719         by making sure we hop to the right thread when needed.
720
721         Test: http/tests/workers/service/ServiceWorkerGlobalScope_getRegistration.html
722
723         * dom/ScriptExecutionContext.cpp:
724         (WebCore::ScriptExecutionContext::postTaskTo):
725         * dom/ScriptExecutionContext.h:
726         * workers/service/SWClientConnection.cpp:
727         (WebCore::SWClientConnection::jobRejectedInServer):
728         (WebCore::SWClientConnection::registrationJobResolvedInServer):
729         (WebCore::SWClientConnection::unregistrationJobResolvedInServer):
730         (WebCore::SWClientConnection::startScriptFetchForServer):
731         (WebCore::SWClientConnection::clearPendingJobs):
732         * workers/service/SWClientConnection.h:
733         * workers/service/ServiceWorkerContainer.cpp:
734         (WebCore::ServiceWorkerContainer::getRegistration):
735         (WebCore::ServiceWorkerContainer::didFinishGetRegistrationRequest):
736         (WebCore::ServiceWorkerContainer::getRegistrations):
737         (WebCore::ServiceWorkerContainer::didFinishGetRegistrationsRequest):
738         (WebCore::ServiceWorkerContainer::stop):
739         * workers/service/ServiceWorkerContainer.h:
740
741 2017-12-04  Simon Fraser  <simon.fraser@apple.com>
742
743         Cleanup code that computes iframe content offsets in FrameView
744         https://bugs.webkit.org/show_bug.cgi?id=180385
745
746         Reviewed by Zalan Bujtas.
747
748         The coordinate conversion functions in FrameView explicitly added borderLeft/paddingLeft
749         and borderTop/paddingTop to compute the offset from the contents of a frame to its parent renderer.
750         
751         This is equivalent to the call to contextBoxRect() that RenderWidget::updateWidgetGeometry() does,
752         which also takes left-side scrollbars into account.
753         
754         Coordinate offsets don't need height and width, so add RenderBox::contentBoxLocation() that just
755         computes the top left, and use it in FrameView.
756
757         * page/FrameView.cpp:
758         (WebCore::FrameView::invalidateRect):
759         (WebCore::FrameView::convertToContainingView const):
760         (WebCore::FrameView::convertFromContainingView const):
761         * platform/graphics/FloatPoint.h:
762         (WebCore::FloatPoint::scaled const):
763         (WebCore::FloatPoint::scaled): Deleted.
764         * rendering/RenderBox.cpp:
765         (WebCore::RenderBox::contentBoxLocation const):
766         * rendering/RenderBox.h:
767
768 2017-12-04  Nan Wang  <n_wang@apple.com>
769
770         AX: AOM: Implement relation type properties
771         https://bugs.webkit.org/show_bug.cgi?id=179500
772
773         Reviewed by Ryosuke Niwa.
774
775         Accessibility Object Model
776         Explainer: https://wicg.github.io/aom/explainer.html
777         Spec: https://wicg.github.io/aom/spec/
778
779         Implemented the AOM support for activeDescendant, details and errorMessage.
780         The corresponding ARIA attributes all take IDREFs, and the AOM properties
781         take references to AccessibleNodes instead.
782
783         Test: accessibility/mac/AOM-relation-property.html
784
785         * accessibility/AccessibilityObject.cpp:
786         (WebCore::AccessibilityObject::getAttribute const):
787         (WebCore::AccessibilityObject::hasProperty const):
788         (WebCore::AccessibilityObject::stringValueForProperty const):
789         (WebCore::AccessibilityObject::boolValueForProperty const):
790         (WebCore::AccessibilityObject::intValueForProperty const):
791         (WebCore::AccessibilityObject::unsignedValueForProperty const):
792         (WebCore::AccessibilityObject::doubleValueForProperty const):
793         (WebCore::AccessibilityObject::elementValueForProperty const):
794         (WebCore::AccessibilityObject::supportsARIAAttributes const):
795         (WebCore::AccessibilityObject::elementsFromProperty const):
796         (WebCore::AccessibilityObject::elementsReferencedByProperty const):
797         (WebCore::AccessibilityObject::ariaActiveDescendantReferencingElements const):
798         (WebCore::AccessibilityObject::ariaDetailsElements const):
799         (WebCore::AccessibilityObject::ariaDetailsReferencingElements const):
800         (WebCore::AccessibilityObject::ariaErrorMessageElements const):
801         (WebCore::AccessibilityObject::ariaErrorMessageReferencingElements const):
802         * accessibility/AccessibilityObject.h:
803         * accessibility/AccessibilityRenderObject.cpp:
804         (WebCore::AccessibilityRenderObject::activeDescendant const):
805         * accessibility/AccessibleNode.cpp:
806         (WebCore::ariaAttributeMap):
807         (WebCore::isPropertyValueRelation):
808         (WebCore::AccessibleNode::attributeFromAXPropertyName):
809         (WebCore::AccessibleNode::setRelationProperty):
810         (WebCore::AccessibleNode::singleRelationValueForProperty):
811         (WebCore::AccessibleNode::activeDescendant const):
812         (WebCore::AccessibleNode::setActiveDescendant):
813         (WebCore::AccessibleNode::details const):
814         (WebCore::AccessibleNode::setDetails):
815         (WebCore::AccessibleNode::errorMessage const):
816         (WebCore::AccessibleNode::setErrorMessage):
817         * accessibility/AccessibleNode.h:
818         * accessibility/AccessibleNode.idl:
819         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
820         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
821
822 2017-12-04  Simon Fraser  <simon.fraser@apple.com>
823
824         Minor DisplayRefreshMonitor-related cleanup
825         https://bugs.webkit.org/show_bug.cgi?id=179802
826
827         Reviewed by Sam Weinig.
828
829         New trace point for when the CVDisplayLink fires on its own thread.
830
831         Some #pragma once, and put all the WellKnownRunLoopOrders in one place.
832
833         * inspector/agents/InspectorTimelineAgent.cpp:
834         (WebCore::InspectorTimelineAgent::internalStart):
835         * platform/cf/RunLoopObserver.h:
836         * platform/graphics/DisplayRefreshMonitor.cpp:
837         (WebCore::DisplayRefreshMonitor::displayDidRefresh):
838         * platform/graphics/ca/LayerFlushScheduler.h:
839         * platform/graphics/ca/cocoa/LayerFlushSchedulerMac.cpp:
840         (WebCore::LayerFlushScheduler::LayerFlushScheduler):
841
842 2017-12-04  David Quesada  <david_quesada@apple.com>
843
844         Add a class for parsing application manifests
845         https://bugs.webkit.org/show_bug.cgi?id=177973
846         rdar://problem/34747949
847
848         Reviewed by Geoffrey Garen.
849
850         Add a new struct ApplicationManifest, along with ApplicationManifestParser to initialize
851         ApplicationManifests from JSON data, according to the App Manifest spec. Just a basic subset
852         of the manifests's properties are implemented to start with.
853
854         ApplicationManifestParser is tested by new unit tests in TestWebKitAPI.
855
856         * Configurations/FeatureDefines.xcconfig: Add ENABLE_APPLICATION_MANIFEST feature flag.
857         * Modules/applicationmanifest/ApplicationManifest.h: Added.
858         * Modules/applicationmanifest/ApplicationManifestParser.cpp: Added.
859         (WebCore::ApplicationManifestParser::parse):
860         The main entry point for eventual clients (and currently the unit tests) to invoke
861         ApplicationManifestParser. There is a variant that accepts a ScriptExecutionContext that
862         uses the context exclusively for logging console warnings while parsing the manifest, and
863         not for actually executing any scripts.
864         (WebCore::ApplicationManifestParser::ApplicationManifestParser):
865         (WebCore::ApplicationManifestParser::parseManifest):
866         (WebCore::ApplicationManifestParser::logManifestPropertyNotAString):
867         (WebCore::ApplicationManifestParser::logManifestPropertyInvalidURL):
868         (WebCore::ApplicationManifestParser::logDeveloperWarning):
869         (WebCore::ApplicationManifestParser::parseStartURL):
870         (WebCore::ApplicationManifestParser::parseName):
871         (WebCore::ApplicationManifestParser::parseDescription):
872         (WebCore::ApplicationManifestParser::parseShortName):
873         (WebCore::isInScope):
874         (WebCore::ApplicationManifestParser::parseScope):
875         (WebCore::ApplicationManifestParser::parseGenericString):
876         * Modules/applicationmanifest/ApplicationManifestParser.h: Added.
877         * Sources.txt:
878         * WebCore.xcodeproj/project.pbxproj:
879         * features.json: Change the Web App Manifest feature status to "In Development"
880
881 2017-12-04  Zalan Bujtas  <zalan@apple.com>
882
883         RenderMultiColumnFlow::fragmentedFlowDescendantInserted should not destroy incoming newDescendant
884         https://bugs.webkit.org/show_bug.cgi?id=180181
885
886         Reviewed by Antti Koivisto.
887
888         This is in preparation for having all multicolumn related tree mutation in RenderTreeUpdaterMultiColumn.
889
890         Covered by fast/multicol/column-span-range-crash.html
891
892         * rendering/RenderMultiColumnFlow.cpp:
893         (WebCore::RenderMultiColumnFlow::fragmentedFlowDescendantInserted):
894         * rendering/RenderMultiColumnFlow.h:
895         * style/RenderTreeUpdaterMultiColumn.cpp:
896         (WebCore::RenderTreeUpdater::MultiColumn::destroyFragmentedFlow):
897
898 2017-12-04  JF Bastien  <jfbastien@apple.com>
899
900         Update std::expected to match libc++ coding style
901         https://bugs.webkit.org/show_bug.cgi?id=180264
902
903         Reviewed by Alex Christensen.
904
905         Update various uses of Expected, mostly renaming valueOr and
906         hasValue to the STL naming convention.
907
908         * Modules/cache/DOMCache.cpp:
909         (WebCore::DOMCache::retrieveRecords):
910         (WebCore::DOMCache::batchDeleteOperation):
911         (WebCore::DOMCache::batchPutOperation):
912         * Modules/cache/DOMCacheStorage.cpp:
913         (WebCore::DOMCacheStorage::retrieveCaches):
914         (WebCore::DOMCacheStorage::open):
915         (WebCore::DOMCacheStorage::remove):
916         * Modules/cache/WorkerCacheStorageConnection.cpp:
917         (WebCore::WorkerCacheStorageConnection::doRemove):
918         (WebCore::WorkerCacheStorageConnection::doRetrieveCaches):
919         (WebCore::recordsDataOrErrorFromRecords):
920         (WebCore::recordsOrErrorFromRecordsData):
921         * bindings/js/CachedScriptFetcher.cpp:
922         (WebCore::CachedScriptFetcher::requestScriptWithCache const):
923         * contentextensions/ContentExtensionCompiler.cpp:
924         (WebCore::ContentExtensions::compileRuleList):
925         * contentextensions/ContentExtensionParser.cpp:
926         (WebCore::ContentExtensions::getDomainList):
927         (WebCore::ContentExtensions::loadTrigger):
928         (WebCore::ContentExtensions::loadRule):
929         (WebCore::ContentExtensions::loadEncodedRules):
930         (WebCore::ContentExtensions::parseRuleList):
931         * css/CSSFontFaceSrcValue.cpp:
932         (WebCore::CSSFontFaceSrcValue::cachedFont):
933         * css/CSSImageSetValue.cpp:
934         (WebCore::CSSImageSetValue::loadBestFitImage):
935         * css/CSSImageValue.cpp:
936         (WebCore::CSSImageValue::loadImage):
937         * css/StyleRuleImport.cpp:
938         (WebCore::StyleRuleImport::requestStyleSheet):
939         * dom/CallbackResult.h:
940         (WebCore::CallbackResult<ReturnType>::type const):
941         (WebCore::CallbackResult<ReturnType>::releaseReturnValue):
942         * dom/Element.cpp:
943         (WebCore::Element::getIntegralAttribute const):
944         (WebCore::Element::getUnsignedIntegralAttribute const):
945         * dom/ExceptionOr.h:
946         (WebCore::ExceptionOr<ReturnType>::hasException const):
947         (WebCore::ExceptionOr<void>::hasException const):
948         * dom/ProcessingInstruction.cpp:
949         (WebCore::ProcessingInstruction::checkStyleSheet):
950         * html/HTMLInputElement.cpp:
951         (WebCore::HTMLInputElement::maxLengthAttributeChanged):
952         (WebCore::HTMLInputElement::minLengthAttributeChanged):
953         * html/HTMLLinkElement.cpp:
954         (WebCore::HTMLLinkElement::process):
955         * html/HTMLTextAreaElement.cpp:
956         (WebCore::HTMLTextAreaElement::maxLengthAttributeChanged):
957         (WebCore::HTMLTextAreaElement::minLengthAttributeChanged):
958         * html/parser/HTMLParserIdioms.cpp:
959         (WebCore::parseHTMLNonNegativeInteger):
960         * html/parser/HTMLParserIdioms.h:
961         (WebCore::limitToOnlyHTMLNonNegative):
962         * loader/CrossOriginPreflightChecker.cpp:
963         (WebCore::CrossOriginPreflightChecker::startPreflight):
964         * loader/DocumentLoader.cpp:
965         (WebCore::DocumentLoader::loadMainResource):
966         * loader/DocumentThreadableLoader.cpp:
967         (WebCore::DocumentThreadableLoader::loadRequest):
968         * loader/ImageLoader.cpp:
969         (WebCore::ImageLoader::updateFromElement):
970         * loader/LinkLoader.cpp:
971         (WebCore::LinkLoader::preloadIfNeeded):
972         (WebCore::LinkLoader::loadLink):
973         * loader/MediaResourceLoader.cpp:
974         (WebCore::MediaResourceLoader::requestResource):
975         * loader/TextTrackLoader.cpp:
976         (WebCore::TextTrackLoader::load):
977         * loader/cache/CachedSVGDocumentReference.cpp:
978         (WebCore::CachedSVGDocumentReference::load):
979         * loader/icon/IconLoader.cpp:
980         (WebCore::IconLoader::startLoading):
981         * platform/URLParser.cpp:
982         (WebCore::URLParser::parseIPv4Host):
983         * platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp:
984         (WebCore::WebCoreAVCFResourceLoader::startLoading):
985         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
986         (WebCore::WebCoreAVFResourceLoader::startLoading):
987         * svg/SVGFEImageElement.cpp:
988         (WebCore::SVGFEImageElement::requestImageResource):
989         * svg/SVGFontFaceUriElement.cpp:
990         (WebCore::SVGFontFaceUriElement::loadFont):
991         * svg/SVGUseElement.cpp:
992         (WebCore::SVGUseElement::updateExternalDocument):
993         * xml/XSLImportRule.cpp:
994         (WebCore::XSLImportRule::loadSheet):
995
996 2017-12-04  Zalan Bujtas  <zalan@apple.com>
997
998         REGRESSION (r211531): Text flow changes and overlaps other text after double-click selecting paragraph
999         https://bugs.webkit.org/show_bug.cgi?id=180377
1000         <rdar://problem/34337967>
1001
1002         Reviewed by Antti Koivisto.
1003
1004         Take floats into account when computing the available width for a certain vertical position.
1005
1006         Test: fast/block/float/simple-line-layout-float-shrink-line.html
1007
1008         * rendering/SimpleLineLayout.cpp:
1009         (WebCore::SimpleLineLayout::updateLineConstrains):
1010
1011 2017-12-04  Antoine Quint  <graouts@apple.com>
1012
1013         <video> and scale() transforms yield shrunk small or clipped controls
1014         https://bugs.webkit.org/show_bug.cgi?id=180358
1015         <rdar://problem/34436124>
1016
1017         Reviewed by Dean Jackson.
1018
1019         To compute the bounds of the media controls, we would call getBoundingClientRect()
1020         on the root-most element in the shadow root, which is styled to have width and height
1021         set to 100%, which allows to match the metrics of the host media element, without
1022         the borders.
1023
1024         However, if the host media element has CSS transforms applied, these would be factored
1025         into calls to getBoundingClientRect() and the controls would be too large and clipped,
1026         in case the scale was more than 1, or shrunk, in case the scale was less than 1.
1027
1028         To obtain correct metrics, we computed the complete transformation matrix applied to
1029         the host media element, and apply its inverted matrix to each corner point of the
1030         bounds returned for the root-most container element in the shadow root.
1031
1032         Then we compute the width and height of this transformed rectangle and set those to
1033         be our media controls' metrics.
1034
1035         Test: media/modern-media-controls/css/transformed-media.html
1036
1037         * Modules/modern-media-controls/media/media-controller.js:
1038         (MediaController.prototype._updateControlsSize):
1039         (MediaController.prototype._controlsWidth): Deleted.
1040
1041 2017-12-04  Antoine Quint  <graouts@apple.com>
1042
1043         Cursor is not visible after exiting full screen video
1044         https://bugs.webkit.org/show_bug.cgi?id=180247
1045         <rdar://problem/33885922>
1046
1047         Reviewed by Dean Jackson.
1048
1049         There is a dedicated NSCursor method to temporarily hide the mouse cursor while the mouse is idle,
1050         so we use this platform functionality, already exposed through the page chrome, instead which
1051         implements the expected behavior. Now, the mouse cursor is hidden while the mouse is stationary
1052         when a <video> is fullscreen, as before, but as soon as the user exits fullscreen, the mouse cursor
1053         reappears.
1054
1055         No test provided as I don't believe this platform behavior can be tested, there is no API to query
1056         whether the cursor is visible.
1057
1058         * page/EventHandler.cpp:
1059         (WebCore::EventHandler::cancelAutoHideCursorTimer):
1060         (WebCore::EventHandler::autoHideCursorTimerFired):
1061
1062 2017-12-04  Chris Dumez  <cdumez@apple.com>
1063
1064         ServiceWorkerGlobalScope::skipWaiting(Ref<DeferredPromise>&&) is unsafe
1065         https://bugs.webkit.org/show_bug.cgi?id=180372
1066
1067         Reviewed by Youenn Fablet.
1068
1069         Ref the WorkerThread and capture it in the lambda. Keep the pending promises in
1070         a HashMap on the ServiceWorkerGlobalScope so that they stay on the worker thread.
1071
1072         * workers/service/ServiceWorkerGlobalScope.cpp:
1073         (WebCore::ServiceWorkerGlobalScope::skipWaiting):
1074         * workers/service/ServiceWorkerGlobalScope.h:
1075
1076 2017-12-04  Brady Eidson  <beidson@apple.com>
1077
1078         Get a directory path to SWServers for storing ServiceWorker registrations.
1079         https://bugs.webkit.org/show_bug.cgi?id=180362
1080
1081         Reviewed by Chris Dumez.
1082
1083         No new tests (No observable behavior change yet).
1084
1085         * workers/service/server/SWServer.cpp:
1086         (WebCore::SWServer::SWServer):
1087         * workers/service/server/SWServer.h:
1088
1089 2017-12-04  Devin Rousso  <webkit@devinrousso.com>
1090
1091         Web Inspector: provide method for recording CanvasRenderingContext2D from JavaScript
1092         https://bugs.webkit.org/show_bug.cgi?id=175166
1093         <rdar://problem/34040740>
1094
1095         Reviewed by Joseph Pecoraro.
1096
1097         No new tests, updated existing tests.
1098
1099         * inspector/InspectorCanvas.h:
1100         * inspector/InspectorCanvas.cpp:
1101         (WebCore::InspectorCanvas::resetRecordingData):
1102
1103         * inspector/InspectorCanvasAgent.h:
1104         * inspector/InspectorCanvasAgent.cpp:
1105         (WebCore::InspectorCanvasAgent::didFinishRecordingCanvasFrame):
1106         (WebCore::InspectorCanvasAgent::consoleStartRecordingCanvas):
1107
1108         * inspector/InspectorInstrumentation.h:
1109         * inspector/InspectorInstrumentation.cpp:
1110         (WebCore::InspectorInstrumentation::consoleStartRecordingCanvas):
1111         (WebCore::InspectorInstrumentation::consoleStartRecordingCanvasImpl):
1112
1113         * page/PageConsoleClient.h:
1114         * page/PageConsoleClient.cpp:
1115         (WebCore::PageConsoleClient::record):
1116         (WebCore::PageConsoleClient::recordEnd):
1117
1118         * workers/WorkerConsoleClient.h:
1119         * workers/WorkerConsoleClient.cpp:
1120         (WebCore::WorkerConsoleClient::record):
1121         (WebCore::WorkerConsoleClient::recordEnd):
1122
1123 2017-12-04  Youenn Fablet  <youenn@apple.com>
1124
1125         Call "Terminate Service Worker" on all workers when all their clients are gone
1126         https://bugs.webkit.org/show_bug.cgi?id=179552
1127
1128         Reviewed by Chris Dumez.
1129
1130         Tested manually.
1131
1132         When SWServer detects that there is no longer any client for a given client origin,
1133         it iterates through the running workers to terminate them if they have the given client origin.
1134         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.
1135
1136         * workers/service/server/SWServer.cpp:
1137         (WebCore::SWServer::findClientByIdentifier):
1138         (WebCore::SWServer::matchAll):
1139         (WebCore::SWServer::registerServiceWorkerClient):
1140         (WebCore::SWServer::unregisterServiceWorkerClient):
1141         * workers/service/server/SWServer.h:
1142
1143 2017-12-04  Antti Koivisto  <antti@apple.com>
1144
1145         Enable selector filtering for ::before and ::after pseudo element resolution
1146         https://bugs.webkit.org/show_bug.cgi?id=180364
1147
1148         Reviewed by Ryosuke Niwa.
1149
1150         Since these pseudo elements are now resolved by TreeResolver we can use selector filter for them.
1151
1152         This is 10%+ progression in StyleBench pseudo element subtest.
1153
1154         * css/StyleResolver.cpp:
1155         (WebCore::StyleResolver::pseudoStyleForElement):
1156         * css/StyleResolver.h:
1157         * style/StyleTreeResolver.cpp:
1158         (WebCore::Style::TreeResolver::resolvePseudoStyle):
1159
1160 2017-12-04  Youenn Fablet  <youenn@apple.com>
1161
1162         Add support https://w3c.github.io/ServiceWorker/#on-client-unload-algorithm
1163         https://bugs.webkit.org/show_bug.cgi?id=180359
1164
1165         Reviewed by Chris Dumez.
1166
1167         This algorithm is needed for implementation of claim.
1168         As per specification, it is run for every client unload, hence why this is put in removeClientUsingRegistration.
1169
1170         * workers/service/server/SWServerRegistration.cpp:
1171         (WebCore::SWServerRegistration::removeClientUsingRegistration):
1172         (WebCore::SWServerRegistration::handleClientUnload):
1173         * workers/service/server/SWServerRegistration.h:
1174
1175 2017-12-04  Antti Koivisto  <antti@apple.com>
1176
1177         Remove duplicates from selector filter hashes
1178         https://bugs.webkit.org/show_bug.cgi?id=180354
1179
1180         Reviewed by Simon Fraser.
1181
1182         We have only four slots for hashes in RuleSet and adding more regresses performance. To use the limited slots
1183         better we should eliminate duplicates.
1184
1185         This patch also switches to using std::array instead of a C array for the hashes.
1186
1187         The patch reduces the number of selectors passing through the selector filter in StyleBench by ~0.4%.
1188
1189         * css/ElementRuleCollector.cpp:
1190         (WebCore::ElementRuleCollector::collectMatchingRulesForList):
1191         * css/RuleSet.cpp:
1192         (WebCore::RuleData::RuleData):
1193         * css/RuleSet.h:
1194         (WebCore::RuleData::descendantSelectorIdentifierHashes const):
1195         * css/SelectorFilter.cpp:
1196         (WebCore::collectDescendantSelectorIdentifierHashes):
1197         (WebCore::SelectorFilter::collectIdentifierHashes):
1198         * css/SelectorFilter.h:
1199         (WebCore::SelectorFilter::fastRejectSelector const):
1200
1201 2017-12-04  Youenn Fablet  <youenn@apple.com>
1202
1203         WorkerCacheStorageConnection should handle the case of terminated workers
1204         https://bugs.webkit.org/show_bug.cgi?id=180304
1205
1206         Reviewed by Chris Dumez.
1207
1208         No web page observable change of behavior.
1209
1210         Reworked WorkerCacheStorageConnection hopping.
1211         Instead of refing/unrefing itself, it refs the worker thread and the main thread connection.
1212         This worker thread is then used on the way back from the main thread.
1213
1214         * Modules/cache/WorkerCacheStorageConnection.cpp:
1215         (WebCore::WorkerCacheStorageConnection::create):
1216         (WebCore::WorkerCacheStorageConnection::WorkerCacheStorageConnection):
1217         (WebCore::WorkerCacheStorageConnection::doOpen):
1218         (WebCore::WorkerCacheStorageConnection::doRemove):
1219         (WebCore::WorkerCacheStorageConnection::doRetrieveCaches):
1220         (WebCore::WorkerCacheStorageConnection::reference):
1221         (WebCore::WorkerCacheStorageConnection::dereference):
1222         (WebCore::WorkerCacheStorageConnection::doRetrieveRecords):
1223         (WebCore::WorkerCacheStorageConnection::doBatchDeleteOperation):
1224         (WebCore::WorkerCacheStorageConnection::doBatchPutOperation):
1225         * Modules/cache/WorkerCacheStorageConnection.h:
1226         * workers/WorkerGlobalScope.cpp:
1227         (WebCore::WorkerGlobalScope::cacheStorageConnection):
1228         * workers/WorkerGlobalScope.h:
1229
1230 2017-12-04  Frederic Wang  <fwang@igalia.com>
1231
1232         Make ScrollingTreeNode::enclosingFrameNode return the node itself for frame nodes
1233         https://bugs.webkit.org/show_bug.cgi?id=180353
1234
1235         Reviewed by Antonio Gomes.
1236
1237         This function was introduced in bug 175135 to solve a rendering bug with fixed positioned
1238         nodes in overflow nodes. For a frame node, the reference frame to use for fixed nodes is
1239         actually the frame node itself or otherwise we will get the same rendering bug. This patch
1240         makes enclosingFrameNode return the node itself when it is a frame node and renames it to
1241         clarify this behavior. Currently, enclosingFrameNode is not used for frame nodes so the
1242         behavior is unchanged.
1243
1244         No new tests, behavior is unchanged.
1245
1246         * page/scrolling/ScrollingTreeNode.cpp:
1247         (WebCore::ScrollingTreeNode::enclosingFrameNodeIncludingSelf): Start the search from a frame
1248         scrolling node from the node itself. Renamed to make explicit that this function may include
1249         the node itself.
1250         * page/scrolling/ScrollingTreeNode.h: Renamed.
1251
1252 2017-12-04  Michael Catanzaro  <mcatanzaro@igalia.com>
1253
1254         [WPE][GTK] Implement PAL::SleepDisabler
1255         https://bugs.webkit.org/show_bug.cgi?id=178485
1256
1257         Reviewed by Carlos Garcia Campos.
1258
1259         Add a comment to warn about some odd use of SleepDisabler in HTMLMediaElement.
1260
1261         * html/HTMLMediaElement.cpp:
1262         (WebCore::HTMLMediaElement::shouldDisableSleep const):
1263
1264 2017-12-04  Frederic Wang  <fwang@igalia.com>
1265
1266         Bug 161300 - Move RenderMathMLRoot:RootType and RenderMathMLScripts:ScriptsType to element classes
1267         https://bugs.webkit.org/show_bug.cgi?id=161300
1268
1269         Reviewed by Darin Adler.
1270
1271         RenderMathMLRoot::m_kind and RenderMathMLScripts::m_scriptType are initialized in the
1272         constructors of the renderer classes from the tag name of the corresponding elements.
1273         This patch moves them into the corresponding element classes and makes them const members
1274         parsed in the constructors. It also introduces a MathMLRootElement class deriving from
1275         MathMLRowElement to store the new member. Finally, the types are redefined as enum classes.
1276
1277         No new tests, behavior unchanged and already covered by existing tests.
1278
1279         * Sources.txt: Add MathMLRootElement files.
1280         * WebCore.xcodeproj/project.pbxproj: Ditto.
1281         * mathml/MathMLAllInOne.cpp: Ditto.
1282         * mathml/MathMLRootElement.cpp:
1283         (WebCore::element): Override this function to downcast to MathMLRootElement.
1284         (WebCore::rootTypeOf): Helper function to parse the root type, moved from RenderMathMLRoot.
1285         (WebCore::MathMLRootElement::MathMLRootElement): Initialize the root type.
1286         (WebCore::MathMLRootElement::create):
1287         (WebCore::MathMLRootElement::createElementRenderer): Moved from MathMLRowElement.
1288         * mathml/MathMLRootElement.h: New class deriving from MathMLRowElement, with a RootType
1289         member exposed to the renderer class.
1290         * mathml/MathMLRowElement.cpp: Remove header for RenderMathMLRoot.h.
1291         (WebCore::MathMLRowElement::createElementRenderer): Moved to MathMLRootElement.
1292         * mathml/MathMLScriptsElement.cpp: Introduce a script type.
1293         (WebCore::scriptTypeOf): Helper function to parse the script type, moved from
1294         RenerMathMLScripts.
1295         (WebCore::MathMLScriptsElement::MathMLScriptsElement): Initialize the script type.
1296         * mathml/MathMLScriptsElement.h: Add new script type member.
1297         (WebCore::MathMLScriptsElement::scriptType const): Expose the script type to the renderer
1298         class.
1299         * mathml/mathtags.in: Map <msqrt> and <mroot> to MathMLRootElement.
1300         * rendering/mathml/RenderMathMLRoot.cpp:
1301         (WebCore::RenderMathMLRoot::RenderMathMLRoot): Use MathMLRootElement and remove parsing of
1302         the root type.
1303         (WebCore::RenderMathMLRoot::rootType const): Helper function to access the root type from
1304         the element class.
1305         (WebCore::RenderMathMLRoot::isValid const): Use rootType() and add prefix for enum class
1306         values.
1307         (WebCore::RenderMathMLRoot::getBase const): Ditto.
1308         (WebCore::RenderMathMLRoot::getIndex const): Ditto.
1309         (WebCore::RenderMathMLRoot::horizontalParameters): Ditto.
1310         (WebCore::RenderMathMLRoot::verticalParameters): Ditto.
1311         (WebCore::RenderMathMLRoot::computePreferredLogicalWidths): Ditto.
1312         (WebCore::RenderMathMLRoot::layoutBlock): Ditto.
1313         (WebCore::RenderMathMLRoot::paint): Ditto.
1314         * rendering/mathml/RenderMathMLRoot.h: Define root type as an enum class, replace
1315         MathMLRowElement with MathMLRootElement, declare and use new rootType() function and remove
1316         the m_kind member.
1317         * rendering/mathml/RenderMathMLScripts.cpp:
1318         (WebCore::RenderMathMLScripts::RenderMathMLScripts): Remove parsing of script type.
1319         (WebCore::RenderMathMLScripts::scriptType const): Helper function to access the script type
1320         from the element class.
1321         (WebCore::RenderMathMLScripts::validateAndGetReferenceChildren): Use scriptType() and add
1322         prefix for enum class values.
1323         (WebCore::RenderMathMLScripts::computePreferredLogicalWidths): Ditto.
1324         (WebCore::RenderMathMLScripts::verticalMetrics): Ditto.
1325         (WebCore::RenderMathMLScripts::layoutBlock): Ditto.
1326         * rendering/mathml/RenderMathMLScripts.h: Define root type as an enum class, declare the
1327         scriptType() function and remove the m_scriptType member.
1328         * rendering/mathml/RenderMathMLUnderOver.cpp:
1329         (WebCore::RenderMathMLUnderOver::isValid const): Use scriptType() and add prefix for enum
1330         class values.
1331         (WebCore::RenderMathMLUnderOver::under const): Ditto.
1332         (WebCore::RenderMathMLUnderOver::over const): Ditto.
1333         (WebCore::RenderMathMLUnderOver::computePreferredLogicalWidths): Ditto.
1334         (WebCore::RenderMathMLUnderOver::hasAccent const): Ditto.
1335         (WebCore::RenderMathMLUnderOver::layoutBlock): Ditto.
1336
1337 2017-12-04  Carlos Garcia Campos  <cgarcia@igalia.com>
1338
1339         [GStreamer] More leaks in TextCombinerGStreamer
1340         https://bugs.webkit.org/show_bug.cgi?id=180331
1341
1342         Reviewed by Michael Catanzaro.
1343
1344         I've noticed more leaks reading the code, but I couldn't check them with valgrind, because I don't know how to
1345         trigger that code path. This patch cleans up the file using smart pointer everywhere.
1346
1347         * platform/graphics/gstreamer/TextCombinerGStreamer.cpp:
1348         (webkit_text_combiner_pad_init):
1349         (webkitTextCombinerPadEvent):
1350         (webkitTextCombinerReleasePad):
1351
1352 2017-12-04  Jer Noble  <jer.noble@apple.com>
1353
1354         Include 'video/*' in image request Accept header if browser supports video media in image contexts.
1355         https://bugs.webkit.org/show_bug.cgi?id=179178
1356
1357         Reviewed by Alex Christensen.
1358
1359         Test: http/tests/images/image-supports-video.html
1360
1361         Ensure that 'video/*' is included in the Accept header by asking the ImageDecoder whether "Video"
1362         media is supported. The ImageDecoder will ask all it's constituent decoders, which aside from
1363         ImageDecoderAVFObjC will say only support the "Image" media type.
1364
1365         Drive-by fix: Make sure the MIMETypeRegistry includes all the types supported by AVFoundation when
1366         ImageDecoderAVFObjC is enabled. Also, now that Image reports it can support video mime types, check
1367         whether MediaDocument can support a given mime type before asking ImageDocument.
1368
1369         * html/HTMLImageElement.cpp:
1370         (WebCore::HTMLImageElement::bestFitSourceFromPictureElement):
1371         * loader/LinkLoader.cpp:
1372         (WebCore::LinkLoader::isSupportedType):
1373         * loader/cache/CachedResourceRequest.cpp:
1374         (WebCore::acceptHeaderValueFromType):
1375         * platform/MIMETypeRegistry.cpp:
1376         (WebCore::MIMETypeRegistry::isSupportedImageVideoOrSVGMIMEType):
1377         (WebCore::MIMETypeRegistry::isSupportedImageOrSVGMIMEType): Deleted.
1378         * platform/MIMETypeRegistry.h:
1379         * platform/graphics/ImageDecoder.cpp:
1380         (WebCore::ImageDecoder::supportsMediaType):
1381         * platform/graphics/ImageDecoder.h:
1382         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.h:
1383         (WebCore::ImageDecoderAVFObjC::supportsMediaType):
1384         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
1385         (WebCore::ImageDecoderAVFObjC::supportsContentType):
1386         * platform/graphics/cg/ImageDecoderCG.h:
1387         * platform/graphics/win/ImageDecoderDirect2D.h:
1388         * platform/image-decoders/ScalableImageDecoder.h:
1389         (WebCore::ScalableImageDecoder::supportsMediaType):
1390         * html/parser/HTMLPreloadScanner.cpp:
1391         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
1392
1393 2017-12-03  Yusuke Suzuki  <utatane.tea@gmail.com>
1394
1395         WTF shouldn't have both Thread and ThreadIdentifier
1396         https://bugs.webkit.org/show_bug.cgi?id=180308
1397
1398         Reviewed by Darin Adler.
1399
1400         No behavior change.
1401
1402         * Modules/indexeddb/IDBActiveDOMObject.h:
1403         (WebCore::IDBActiveDOMObject::originThread const):
1404         (WebCore::IDBActiveDOMObject::performCallbackOnOriginThread):
1405         (WebCore::IDBActiveDOMObject::callFunctionOnOriginThread):
1406         (WebCore::IDBActiveDOMObject::originThreadID const): Deleted.
1407         * Modules/indexeddb/IDBCursor.cpp:
1408         (WebCore::IDBCursor::IDBCursor):
1409         (WebCore::IDBCursor::~IDBCursor):
1410         (WebCore::IDBCursor::sourcesDeleted const):
1411         (WebCore::IDBCursor::transaction const):
1412         (WebCore::IDBCursor::update):
1413         (WebCore::IDBCursor::advance):
1414         (WebCore::IDBCursor::continueFunction):
1415         (WebCore::IDBCursor::uncheckedIterateCursor):
1416         (WebCore::IDBCursor::deleteFunction):
1417         (WebCore::IDBCursor::setGetResult):
1418         * Modules/indexeddb/IDBDatabase.cpp:
1419         (WebCore::IDBDatabase::~IDBDatabase):
1420         (WebCore::IDBDatabase::hasPendingActivity const):
1421         (WebCore::IDBDatabase::name const):
1422         (WebCore::IDBDatabase::version const):
1423         (WebCore::IDBDatabase::objectStoreNames const):
1424         (WebCore::IDBDatabase::renameObjectStore):
1425         (WebCore::IDBDatabase::renameIndex):
1426         (WebCore::IDBDatabase::createObjectStore):
1427         (WebCore::IDBDatabase::transaction):
1428         (WebCore::IDBDatabase::deleteObjectStore):
1429         (WebCore::IDBDatabase::close):
1430         (WebCore::IDBDatabase::connectionToServerLost):
1431         (WebCore::IDBDatabase::maybeCloseInServer):
1432         (WebCore::IDBDatabase::activeDOMObjectName const):
1433         (WebCore::IDBDatabase::canSuspendForDocumentSuspension const):
1434         (WebCore::IDBDatabase::stop):
1435         (WebCore::IDBDatabase::startVersionChangeTransaction):
1436         (WebCore::IDBDatabase::didStartTransaction):
1437         (WebCore::IDBDatabase::willCommitTransaction):
1438         (WebCore::IDBDatabase::didCommitTransaction):
1439         (WebCore::IDBDatabase::willAbortTransaction):
1440         (WebCore::IDBDatabase::didAbortTransaction):
1441         (WebCore::IDBDatabase::didCommitOrAbortTransaction):
1442         (WebCore::IDBDatabase::fireVersionChangeEvent):
1443         (WebCore::IDBDatabase::dispatchEvent):
1444         (WebCore::IDBDatabase::didCreateIndexInfo):
1445         (WebCore::IDBDatabase::didDeleteIndexInfo):
1446         * Modules/indexeddb/IDBIndex.cpp:
1447         (WebCore::IDBIndex::IDBIndex):
1448         (WebCore::IDBIndex::~IDBIndex):
1449         (WebCore::IDBIndex::name const):
1450         (WebCore::IDBIndex::setName):
1451         (WebCore::IDBIndex::objectStore):
1452         (WebCore::IDBIndex::keyPath const):
1453         (WebCore::IDBIndex::unique const):
1454         (WebCore::IDBIndex::multiEntry const):
1455         (WebCore::IDBIndex::rollbackInfoForVersionChangeAbort):
1456         (WebCore::IDBIndex::openCursor):
1457         (WebCore::IDBIndex::openKeyCursor):
1458         (WebCore::IDBIndex::doCount):
1459         (WebCore::IDBIndex::doGet):
1460         (WebCore::IDBIndex::doGetKey):
1461         (WebCore::IDBIndex::getAll):
1462         (WebCore::IDBIndex::getAllKeys):
1463         (WebCore::IDBIndex::markAsDeleted):
1464         * Modules/indexeddb/IDBObjectStore.cpp:
1465         (WebCore::IDBObjectStore::IDBObjectStore):
1466         (WebCore::IDBObjectStore::~IDBObjectStore):
1467         (WebCore::IDBObjectStore::name const):
1468         (WebCore::IDBObjectStore::setName):
1469         (WebCore::IDBObjectStore::keyPath const):
1470         (WebCore::IDBObjectStore::indexNames const):
1471         (WebCore::IDBObjectStore::transaction):
1472         (WebCore::IDBObjectStore::autoIncrement const):
1473         (WebCore::IDBObjectStore::openCursor):
1474         (WebCore::IDBObjectStore::openKeyCursor):
1475         (WebCore::IDBObjectStore::get):
1476         (WebCore::IDBObjectStore::getKey):
1477         (WebCore::IDBObjectStore::putOrAdd):
1478         (WebCore::IDBObjectStore::doDelete):
1479         (WebCore::IDBObjectStore::clear):
1480         (WebCore::IDBObjectStore::createIndex):
1481         (WebCore::IDBObjectStore::index):
1482         (WebCore::IDBObjectStore::deleteIndex):
1483         (WebCore::IDBObjectStore::doCount):
1484         (WebCore::IDBObjectStore::getAll):
1485         (WebCore::IDBObjectStore::getAllKeys):
1486         (WebCore::IDBObjectStore::markAsDeleted):
1487         (WebCore::IDBObjectStore::rollbackForVersionChangeAbort):
1488         * Modules/indexeddb/IDBOpenDBRequest.cpp:
1489         (WebCore::IDBOpenDBRequest::~IDBOpenDBRequest):
1490         (WebCore::IDBOpenDBRequest::onError):
1491         (WebCore::IDBOpenDBRequest::versionChangeTransactionDidFinish):
1492         (WebCore::IDBOpenDBRequest::fireSuccessAfterVersionChangeCommit):
1493         (WebCore::IDBOpenDBRequest::fireErrorAfterVersionChangeCompletion):
1494         (WebCore::IDBOpenDBRequest::dispatchEvent):
1495         (WebCore::IDBOpenDBRequest::onSuccess):
1496         (WebCore::IDBOpenDBRequest::onUpgradeNeeded):
1497         (WebCore::IDBOpenDBRequest::onDeleteDatabaseSuccess):
1498         (WebCore::IDBOpenDBRequest::requestCompleted):
1499         (WebCore::IDBOpenDBRequest::requestBlocked):
1500         * Modules/indexeddb/IDBRequest.cpp:
1501         (WebCore::IDBRequest::~IDBRequest):
1502         (WebCore:: const):
1503         (WebCore::IDBRequest::setSource):
1504         (WebCore::IDBRequest::setVersionChangeTransaction):
1505         (WebCore::IDBRequest::transaction const):
1506         (WebCore::IDBRequest::sourceObjectStoreIdentifier const):
1507         (WebCore::IDBRequest::sourceIndexIdentifier const):
1508         (WebCore::IDBRequest::requestedObjectStoreRecordType const):
1509         (WebCore::IDBRequest::requestedIndexRecordType const):
1510         (WebCore::IDBRequest::eventTargetInterface const):
1511         (WebCore::IDBRequest::activeDOMObjectName const):
1512         (WebCore::IDBRequest::canSuspendForDocumentSuspension const):
1513         (WebCore::IDBRequest::hasPendingActivity const):
1514         (WebCore::IDBRequest::stop):
1515         (WebCore::IDBRequest::enqueueEvent):
1516         (WebCore::IDBRequest::dispatchEvent):
1517         (WebCore::IDBRequest::uncaughtExceptionInEventHandler):
1518         (WebCore::IDBRequest::setResult):
1519         (WebCore::IDBRequest::setResultToStructuredClone):
1520         (WebCore::IDBRequest::setResultToUndefined):
1521         (WebCore::IDBRequest::resultCursor):
1522         (WebCore::IDBRequest::willIterateCursor):
1523         (WebCore::IDBRequest::didOpenOrIterateCursor):
1524         (WebCore::IDBRequest::completeRequestAndDispatchEvent):
1525         (WebCore::IDBRequest::onError):
1526         (WebCore::IDBRequest::onSuccess):
1527         * Modules/indexeddb/IDBTransaction.cpp:
1528         (WebCore::IDBTransaction::IDBTransaction):
1529         (WebCore::IDBTransaction::~IDBTransaction):
1530         (WebCore::IDBTransaction::objectStoreNames const):
1531         (WebCore::IDBTransaction::db):
1532         (WebCore::IDBTransaction::error const):
1533         (WebCore::IDBTransaction::objectStore):
1534         (WebCore::IDBTransaction::abortDueToFailedRequest):
1535         (WebCore::IDBTransaction::transitionedToFinishing):
1536         (WebCore::IDBTransaction::abort):
1537         (WebCore::IDBTransaction::internalAbort):
1538         (WebCore::IDBTransaction::abortOnServerAndCancelRequests):
1539         (WebCore::IDBTransaction::activeDOMObjectName const):
1540         (WebCore::IDBTransaction::canSuspendForDocumentSuspension const):
1541         (WebCore::IDBTransaction::hasPendingActivity const):
1542         (WebCore::IDBTransaction::stop):
1543         (WebCore::IDBTransaction::isActive const):
1544         (WebCore::IDBTransaction::isFinishedOrFinishing const):
1545         (WebCore::IDBTransaction::addRequest):
1546         (WebCore::IDBTransaction::removeRequest):
1547         (WebCore::IDBTransaction::scheduleOperation):
1548         (WebCore::IDBTransaction::schedulePendingOperationTimer):
1549         (WebCore::IDBTransaction::pendingOperationTimerFired):
1550         (WebCore::IDBTransaction::operationCompletedOnServer):
1551         (WebCore::IDBTransaction::scheduleCompletedOperationTimer):
1552         (WebCore::IDBTransaction::completedOperationTimerFired):
1553         (WebCore::IDBTransaction::commit):
1554         (WebCore::IDBTransaction::commitOnServer):
1555         (WebCore::IDBTransaction::finishAbortOrCommit):
1556         (WebCore::IDBTransaction::didStart):
1557         (WebCore::IDBTransaction::notifyDidAbort):
1558         (WebCore::IDBTransaction::didAbort):
1559         (WebCore::IDBTransaction::didCommit):
1560         (WebCore::IDBTransaction::fireOnComplete):
1561         (WebCore::IDBTransaction::fireOnAbort):
1562         (WebCore::IDBTransaction::enqueueEvent):
1563         (WebCore::IDBTransaction::dispatchEvent):
1564         (WebCore::IDBTransaction::createObjectStore):
1565         (WebCore::IDBTransaction::createObjectStoreOnServer):
1566         (WebCore::IDBTransaction::didCreateObjectStoreOnServer):
1567         (WebCore::IDBTransaction::renameObjectStore):
1568         (WebCore::IDBTransaction::renameObjectStoreOnServer):
1569         (WebCore::IDBTransaction::didRenameObjectStoreOnServer):
1570         (WebCore::IDBTransaction::createIndex):
1571         (WebCore::IDBTransaction::createIndexOnServer):
1572         (WebCore::IDBTransaction::didCreateIndexOnServer):
1573         (WebCore::IDBTransaction::renameIndex):
1574         (WebCore::IDBTransaction::renameIndexOnServer):
1575         (WebCore::IDBTransaction::didRenameIndexOnServer):
1576         (WebCore::IDBTransaction::requestOpenCursor):
1577         (WebCore::IDBTransaction::doRequestOpenCursor):
1578         (WebCore::IDBTransaction::openCursorOnServer):
1579         (WebCore::IDBTransaction::didOpenCursorOnServer):
1580         (WebCore::IDBTransaction::iterateCursor):
1581         (WebCore::IDBTransaction::iterateCursorOnServer):
1582         (WebCore::IDBTransaction::didIterateCursorOnServer):
1583         (WebCore::IDBTransaction::requestGetAllObjectStoreRecords):
1584         (WebCore::IDBTransaction::requestGetAllIndexRecords):
1585         (WebCore::IDBTransaction::getAllRecordsOnServer):
1586         (WebCore::IDBTransaction::didGetAllRecordsOnServer):
1587         (WebCore::IDBTransaction::requestGetRecord):
1588         (WebCore::IDBTransaction::requestGetValue):
1589         (WebCore::IDBTransaction::requestGetKey):
1590         (WebCore::IDBTransaction::requestIndexRecord):
1591         (WebCore::IDBTransaction::getRecordOnServer):
1592         (WebCore::IDBTransaction::didGetRecordOnServer):
1593         (WebCore::IDBTransaction::requestCount):
1594         (WebCore::IDBTransaction::getCountOnServer):
1595         (WebCore::IDBTransaction::didGetCountOnServer):
1596         (WebCore::IDBTransaction::requestDeleteRecord):
1597         (WebCore::IDBTransaction::deleteRecordOnServer):
1598         (WebCore::IDBTransaction::didDeleteRecordOnServer):
1599         (WebCore::IDBTransaction::requestClearObjectStore):
1600         (WebCore::IDBTransaction::clearObjectStoreOnServer):
1601         (WebCore::IDBTransaction::didClearObjectStoreOnServer):
1602         (WebCore::IDBTransaction::requestPutOrAdd):
1603         (WebCore::IDBTransaction::putOrAddOnServer):
1604         (WebCore::IDBTransaction::didPutOrAddOnServer):
1605         (WebCore::IDBTransaction::deleteObjectStore):
1606         (WebCore::IDBTransaction::deleteObjectStoreOnServer):
1607         (WebCore::IDBTransaction::didDeleteObjectStoreOnServer):
1608         (WebCore::IDBTransaction::deleteIndex):
1609         (WebCore::IDBTransaction::deleteIndexOnServer):
1610         (WebCore::IDBTransaction::didDeleteIndexOnServer):
1611         (WebCore::IDBTransaction::operationCompletedOnClient):
1612         (WebCore::IDBTransaction::establishOnServer):
1613         (WebCore::IDBTransaction::activate):
1614         (WebCore::IDBTransaction::deactivate):
1615         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
1616         (WebCore::IDBClient::removeItemsMatchingCurrentThread):
1617         * Modules/indexeddb/client/TransactionOperation.h:
1618         (WebCore::IDBClient::TransactionOperation::~TransactionOperation):
1619         (WebCore::IDBClient::TransactionOperation::perform):
1620         (WebCore::IDBClient::TransactionOperation::transitionToCompleteOnThisThread):
1621         (WebCore::IDBClient::TransactionOperation::transitionToComplete):
1622         (WebCore::IDBClient::TransactionOperation::doComplete):
1623         (WebCore::IDBClient::TransactionOperation::originThread const):
1624         (WebCore::IDBClient::TransactionOperation::originThreadID const): Deleted.
1625         * Modules/webaudio/AudioContext.cpp:
1626         (WebCore::AudioContext::AudioContext):
1627         (WebCore::AudioContext::lock):
1628         (WebCore::AudioContext::tryLock):
1629         (WebCore::AudioContext::unlock):
1630         (WebCore::AudioContext::isAudioThread const):
1631         (WebCore::AudioContext::isGraphOwner const):
1632         * Modules/webaudio/AudioContext.h:
1633         (WebCore::AudioContext::setAudioThread):
1634         (WebCore::AudioContext::audioThread const):
1635         * Modules/webaudio/AudioDestinationNode.cpp:
1636         (WebCore::AudioDestinationNode::render):
1637         * Modules/webdatabase/Database.cpp:
1638         (WebCore::Database::performClose):
1639         (WebCore::Database::securityOrigin):
1640         * Modules/webdatabase/DatabaseDetails.h:
1641         (WebCore::DatabaseDetails::DatabaseDetails):
1642         (WebCore::DatabaseDetails::operator=):
1643         (WebCore::DatabaseDetails::thread const):
1644         (WebCore::DatabaseDetails::threadID const): Deleted.
1645         * Modules/webdatabase/DatabaseManager.cpp:
1646         (WebCore::DatabaseManager::detailsForNameAndOrigin):
1647         * Modules/webdatabase/DatabaseThread.cpp:
1648         (WebCore::DatabaseThread::databaseThread):
1649         (WebCore::DatabaseThread::recordDatabaseOpen):
1650         (WebCore::DatabaseThread::recordDatabaseClosed):
1651         * Modules/webdatabase/DatabaseThread.h:
1652         (WebCore::DatabaseThread::getThread):
1653         (WebCore::DatabaseThread::getThreadID): Deleted.
1654         * Modules/webdatabase/SQLTransaction.cpp:
1655         (WebCore::SQLTransaction::checkAndHandleClosedDatabase):
1656         * Modules/webdatabase/SQLTransactionBackend.cpp:
1657         (WebCore::SQLTransactionBackend::doCleanup):
1658         (WebCore::SQLTransactionBackend::notifyDatabaseThreadIsShuttingDown):
1659         * bindings/js/JSCallbackData.h:
1660         (WebCore::JSCallbackData::JSCallbackData):
1661         (WebCore::JSCallbackData::~JSCallbackData):
1662         * bindings/js/ScheduledAction.cpp:
1663         (WebCore::ScheduledAction::execute):
1664         * dom/ScriptExecutionContext.cpp:
1665         (WebCore::ScriptExecutionContext::createdMessagePort):
1666         (WebCore::ScriptExecutionContext::destroyedMessagePort):
1667         * page/ResourceUsageOverlay.h:
1668         * page/scrolling/ScrollingThread.cpp:
1669         (WebCore::ScrollingThread::isCurrentThread):
1670         * platform/Supplementable.h:
1671         (WebCore::Supplementable::provideSupplement):
1672         (WebCore::Supplementable::removeSupplement):
1673         (WebCore::Supplementable::requireSupplement):
1674         (WebCore::Supplementable::Supplementable): Deleted.
1675         * platform/Timer.cpp:
1676         (WebCore::TimerBase::TimerBase):
1677         (WebCore::TimerBase::start):
1678         (WebCore::TimerBase::stop):
1679         (WebCore::TimerBase::setNextFireTime):
1680         * platform/Timer.h:
1681         (WebCore::TimerBase::isActive const):
1682         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1683         (WebCore::shouldAutoActivateFontIfNeeded):
1684         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
1685         (WebCore::TextureMapperPlatformLayerProxy::activateOnCompositingThread):
1686         (WebCore::TextureMapperPlatformLayerProxy::invalidate):
1687         (WebCore::TextureMapperPlatformLayerProxy::getAvailableBuffer):
1688         (WebCore::TextureMapperPlatformLayerProxy::appendToUnusedBuffers):
1689         (WebCore::TextureMapperPlatformLayerProxy::swapBuffer):
1690         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
1691         (): Deleted.
1692         * platform/ios/wak/WebCoreThread.mm:
1693         (RunWebThread):
1694         (StartWebThread):
1695         * platform/sql/SQLiteDatabase.cpp:
1696         (WebCore::SQLiteDatabase::open):
1697         (WebCore::SQLiteDatabase::close):
1698         * platform/sql/SQLiteDatabase.h:
1699         (WebCore::SQLiteDatabase::sqlite3Handle const):
1700         * workers/WorkerGlobalScope.cpp:
1701         (WebCore::WorkerGlobalScope::~WorkerGlobalScope):
1702         (WebCore::WorkerGlobalScope::isContextThread const):
1703         * workers/WorkerMessagingProxy.cpp:
1704         (WebCore::WorkerMessagingProxy::WorkerMessagingProxy):
1705         (WebCore::WorkerMessagingProxy::~WorkerMessagingProxy):
1706         * workers/WorkerRunLoop.cpp:
1707         (WebCore::WorkerRunLoop::runInMode):
1708         (WebCore::WorkerRunLoop::runCleanupTasks):
1709         * workers/WorkerThread.h:
1710         (WebCore::WorkerThread::thread const):
1711         (WebCore::WorkerThread::threadID const): Deleted.
1712         * workers/service/ServiceWorkerContainer.cpp:
1713         (WebCore::ServiceWorkerContainer::~ServiceWorkerContainer):
1714         (WebCore::ServiceWorkerContainer::scheduleJob):
1715         (WebCore::ServiceWorkerContainer::jobFailedWithException):
1716         (WebCore::ServiceWorkerContainer::scheduleTaskToFireUpdateFoundEvent):
1717         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
1718         (WebCore::ServiceWorkerContainer::jobResolvedWithUnregistrationResult):
1719         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
1720         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
1721         (WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
1722         (WebCore::ServiceWorkerContainer::jobDidFinish):
1723         (WebCore::ServiceWorkerContainer::addRegistration):
1724         (WebCore::ServiceWorkerContainer::removeRegistration):
1725         (WebCore::ServiceWorkerContainer::scheduleTaskToFireControllerChangeEvent):
1726         (WebCore::ServiceWorkerContainer::contextIdentifier):
1727         * workers/service/ServiceWorkerContainer.h:
1728         * workers/service/ServiceWorkerJob.cpp:
1729         (WebCore::ServiceWorkerJob::~ServiceWorkerJob):
1730         (WebCore::ServiceWorkerJob::failedWithException):
1731         (WebCore::ServiceWorkerJob::resolvedWithRegistration):
1732         (WebCore::ServiceWorkerJob::resolvedWithUnregistrationResult):
1733         (WebCore::ServiceWorkerJob::startScriptFetch):
1734         (WebCore::ServiceWorkerJob::fetchScriptWithContext):
1735         (WebCore::ServiceWorkerJob::didReceiveResponse):
1736         (WebCore::ServiceWorkerJob::notifyFinished):
1737         * workers/service/ServiceWorkerJob.h:
1738         * xml/parser/XMLDocumentParserLibxml2.cpp:
1739         (WebCore::matchFunc):
1740         (WebCore::openFunc):
1741         (WebCore::initializeXMLParser):
1742         (WebCore::XMLParserContext::createStringParser):
1743         (WebCore::XMLParserContext::createMemoryParser):
1744
1745 2017-12-03  Youenn Fablet  <youenn@apple.com>
1746
1747         WebSocketChannel should ensure its client is live when calling it in error case
1748         https://bugs.webkit.org/show_bug.cgi?id=180285
1749
1750         Reviewed by Darin Adler.
1751
1752         No observable change of behavior.
1753         This makes it consistent with other calls of didReceiveMessageError.
1754
1755         * Modules/websockets/WebSocketChannel.cpp:
1756         (WebCore::WebSocketChannel::fail):
1757
1758 2017-12-03  Alexey Proskuryakov  <ap@apple.com>
1759
1760         WebArchiveResourceWebResourceHandler leaks when pasting
1761         https://bugs.webkit.org/show_bug.cgi?id=180339
1762
1763         Reviewed by Joseph Pecoraro.
1764
1765         * editing/cocoa/WebContentReaderCocoa.mm:
1766         (WebCore::attributesForAttributedStringConversion):
1767
1768 2017-12-03  Chris Dumez  <cdumez@apple.com>
1769
1770         Support serviceWorker.postMessage() inside service workers
1771         https://bugs.webkit.org/show_bug.cgi?id=180328
1772
1773         Reviewed by Darin Adler.
1774
1775         Support serviceWorker.postMessage() inside service workers.
1776
1777         No new tests, unskipped and rebaselined existing test that is
1778         now passing.
1779
1780         * workers/service/SWClientConnection.h:
1781         * workers/service/ServiceWorker.cpp:
1782         (WebCore::ServiceWorker::postMessage):
1783         * workers/service/context/SWContextManager.cpp:
1784         (WebCore::SWContextManager::postMessageToServiceWorker):
1785         * workers/service/context/SWContextManager.h:
1786         * workers/service/context/ServiceWorkerThread.cpp:
1787         (WebCore::fireMessageEvent):
1788         (WebCore::ServiceWorkerThread::postMessageToServiceWorker):
1789         * workers/service/context/ServiceWorkerThread.h:
1790
1791 2017-12-03  Chris Dumez  <cdumez@apple.com>
1792
1793         Implement self.skipWaiting() inside service workers
1794         https://bugs.webkit.org/show_bug.cgi?id=180329
1795
1796         Reviewed by Darin Adler.
1797
1798         Implement self.skipWaiting() inside service workers:
1799         - https://w3c.github.io/ServiceWorker/#service-worker-global-scope-skipwaiting
1800
1801         Also fixes a bug where tryActivate() was calling activate() even though the
1802         registration's active worker was "in use":
1803         - https://w3c.github.io/ServiceWorker/#try-activate-algorithm
1804
1805         No new tests, rebaselined existing tests.
1806
1807         * workers/service/ServiceWorkerGlobalScope.cpp:
1808         (WebCore::ServiceWorkerGlobalScope::skipWaiting):
1809         * workers/service/context/SWContextManager.h:
1810         * workers/service/server/SWServerRegistration.cpp:
1811         (WebCore::SWServerRegistration::tryActivate):
1812         * workers/service/server/SWServerToContextConnection.cpp:
1813         (WebCore::SWServerToContextConnection::skipWaiting):
1814         * workers/service/server/SWServerToContextConnection.h:
1815         * workers/service/server/SWServerWorker.cpp:
1816         (WebCore::SWServerWorker::skipWaiting):
1817         * workers/service/server/SWServerWorker.h:
1818         (WebCore::SWServerWorker::isSkipWaitingFlagSet const):
1819
1820 2017-12-03  Carlos Garcia Campos  <cgarcia@igalia.com>
1821
1822         [GStreamer] GstPad leaked in WebKitTextCombiner
1823         https://bugs.webkit.org/show_bug.cgi?id=180314
1824
1825         Reviewed by Michael Catanzaro.
1826
1827         gst_element_get_static_pad() returns a full reference that si never freed, because gst_ghost_pad_new doesn't
1828         take the ownership of the given pad.
1829
1830         * platform/graphics/gstreamer/TextCombinerGStreamer.cpp:
1831         (webkit_text_combiner_init):
1832
1833 2017-12-03  Carlos Garcia Campos  <cgarcia@igalia.com>
1834
1835         [GStreamer] GstCaps leaked in MediaPlayerPrivateGStreamer::createGSTPlayBin
1836         https://bugs.webkit.org/show_bug.cgi?id=180311
1837
1838         Reviewed by Michael Catanzaro.
1839
1840         gst_caps_new_empty_simple() is passed directly to g_object_set(). The returned caps should be freed with
1841         gst_caps_unref().
1842
1843         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1844         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
1845
1846 2017-12-02  Youenn Fablet  <youenn@apple.com>
1847
1848         Move registration activation and clearing from SWServerJobQueue to SWServerRegistration
1849         https://bugs.webkit.org/show_bug.cgi?id=180325
1850
1851         Reviewed by Chris Dumez.
1852
1853         No change of behavior.
1854
1855         These algorithms fit naturally in SWServerRegistration and will be used as part of clients.claim.
1856
1857         * workers/service/server/SWServer.cpp:
1858         (WebCore::SWServer::clearAll):
1859         (WebCore::SWServer::didFinishActivation):
1860         * workers/service/server/SWServerJobQueue.cpp:
1861         (WebCore::SWServerJobQueue::scriptFetchFinished):
1862         (WebCore::SWServerJobQueue::scriptContextFailedToStart):
1863         (WebCore::SWServerJobQueue::didFinishInstall):
1864         (WebCore::SWServerJobQueue::runUnregisterJob):
1865         (WebCore::SWServerJobQueue::tryActivate): Deleted.
1866         (WebCore::SWServerJobQueue::activate): Deleted.
1867         (WebCore::SWServerJobQueue::didFinishActivation): Deleted.
1868         (WebCore::SWServerJobQueue::tryClearRegistration): Deleted.
1869         (WebCore::clearRegistrationWorker): Deleted.
1870         (WebCore::SWServerJobQueue::clearRegistration): Deleted.
1871         * workers/service/server/SWServerJobQueue.h:
1872         * workers/service/server/SWServerRegistration.cpp:
1873         (WebCore::SWServerRegistration::tryClear):
1874         (WebCore::clearRegistrationWorker):
1875         (WebCore::SWServerRegistration::clear):
1876         (WebCore::SWServerRegistration::tryActivate):
1877         (WebCore::SWServerRegistration::activate):
1878         (WebCore::SWServerRegistration::didFinishActivation):
1879         * workers/service/server/SWServerRegistration.h:
1880
1881 2017-12-02  Chris Dumez  <cdumez@apple.com>
1882
1883         Support container.register() / registration.unregister() /  inside service workers
1884         https://bugs.webkit.org/show_bug.cgi?id=180326
1885
1886         Reviewed by Youenn Fablet.
1887
1888         Support container.register() / registration.unregister() /  inside service workers.
1889         This is mostly about removing the is<Document>() checks and adding testing given
1890         that most of the work was done in r225455.
1891
1892         Test: http/tests/workers/service/ServiceWorkerGlobalScope_register.html
1893
1894         * workers/service/ServiceWorkerContainer.cpp:
1895         (WebCore::ServiceWorkerContainer::addRegistration):
1896         * workers/service/ServiceWorkerRegistration.cpp:
1897         (WebCore::ServiceWorkerRegistration::update):
1898         (WebCore::ServiceWorkerRegistration::unregister):
1899
1900 2017-12-02  Chris Dumez  <cdumez@apple.com>
1901
1902         Support serviceWorkerRegistration.update() inside service workers
1903         https://bugs.webkit.org/show_bug.cgi?id=180215
1904
1905         Reviewed by Darin Adler.
1906
1907         Support serviceWorkerRegistration.update() inside service workers. The code paths
1908         for job scheduling and resolution have been made thread safe by hopping to the right
1909         thread when necessary. In particular, ServiceWorkerContainer always makes sure to to
1910         a callOnMainThread() before calling methods on the SWClientConnection. Also, the
1911         SWClientConnection relies on a new postTaskTo() method before calling methods on the
1912         job.
1913
1914         Test: http/tests/workers/service/self_registration_update.html
1915
1916         * workers/service/SWClientConnection.cpp:
1917         (WebCore::SWClientConnection::scheduleJob):
1918         (WebCore::SWClientConnection::finishedFetchingScript):
1919         (WebCore::SWClientConnection::failedFetchingScript):
1920         (WebCore::SWClientConnection::jobRejectedInServer):
1921         (WebCore::SWClientConnection::registrationJobResolvedInServer):
1922         (WebCore::SWClientConnection::unregistrationJobResolvedInServer):
1923         (WebCore::SWClientConnection::startScriptFetchForServer):
1924         (WebCore::SWClientConnection::postMessageToServiceWorkerClient):
1925         (WebCore::SWClientConnection::updateRegistrationState):
1926         (WebCore::SWClientConnection::updateWorkerState):
1927         (WebCore::SWClientConnection::fireUpdateFoundEvent):
1928         (WebCore::SWClientConnection::notifyClientsOfControllerChange):
1929         (WebCore::SWClientConnection::clearPendingJobs):
1930         (WebCore::SWClientConnection::postTaskTo):
1931         * workers/service/SWClientConnection.h:
1932         * workers/service/ServiceWorkerContainer.cpp:
1933         (WebCore::ServiceWorkerContainer::scheduleJob):
1934         (WebCore::ServiceWorkerContainer::jobFailedWithException):
1935         (WebCore::ServiceWorkerContainer::scheduleTaskToFireUpdateFoundEvent):
1936         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
1937         (WebCore::ServiceWorkerContainer::jobResolvedWithUnregistrationResult):
1938         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
1939         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
1940         (WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
1941         (WebCore::ServiceWorkerContainer::jobDidFinish):
1942         (WebCore::ServiceWorkerContainer::addRegistration):
1943         (WebCore::ServiceWorkerContainer::removeRegistration):
1944         (WebCore::ServiceWorkerContainer::scheduleTaskToFireControllerChangeEvent):
1945         (WebCore::ServiceWorkerContainer::contextIdentifier):
1946         * workers/service/ServiceWorkerContainer.h:
1947         * workers/service/ServiceWorkerJob.cpp:
1948         (WebCore::ServiceWorkerJob::ServiceWorkerJob):
1949         * workers/service/ServiceWorkerJob.h:
1950         (WebCore::ServiceWorkerJob::contextIdentifier):
1951         * workers/service/ServiceWorkerJobClient.h:
1952         * workers/service/ServiceWorkerRegistration.cpp:
1953         (WebCore::ServiceWorkerRegistration::update):
1954         * workers/service/ServiceWorkerTypes.h:
1955
1956 2017-12-02  Simon Fraser  <simon.fraser@apple.com>
1957
1958         Make IOSurface::Locker and use it in ImageBufferDataCG
1959         https://bugs.webkit.org/show_bug.cgi?id=180317
1960
1961         Reviewed by Zalan Bujtas.
1962
1963         Add an RAII IOSurface::Locker which can lock readonly or readwrite. Access
1964         to the IOSurface base address is through the locker.
1965         
1966         Add IOSurface::bytesPerRow() to wrap IOSurfaceGetBytesPerRow().
1967         
1968         After this, there is only one location where we access the IOSurfaceRef
1969         directly, in WebGL code.
1970
1971         * platform/graphics/cg/ImageBufferDataCG.cpp:
1972         (WebCore::ImageBufferData::toBGRAData const):
1973         (WebCore::ImageBufferData::getData const):
1974         (WebCore::ImageBufferData::putData):
1975         * platform/graphics/cocoa/IOSurface.h:
1976         * platform/graphics/cocoa/IOSurface.mm:
1977         (WebCore::IOSurface::bytesPerRow const):
1978
1979 2017-12-02  Simon Fraser  <simon.fraser@apple.com>
1980
1981         Add an AlphaPremultiplication enum and use it consistently
1982         https://bugs.webkit.org/show_bug.cgi?id=180316
1983
1984         Reviewed by Zalan Bujtas.
1985
1986         ImageBuffer-related code sometimes used the 'Multiply' enum, and sometimes
1987         a bool to represent alpha premultiplication. Make an enum class and use it
1988         everywhere. Re-order and rename some parameters to clarify the meaning of this
1989         argument.
1990
1991         * html/canvas/CanvasRenderingContext2D.cpp:
1992         (WebCore::CanvasRenderingContext2D::putImageData):
1993         * platform/graphics/GraphicsTypes.cpp:
1994         (WebCore::operator<<):
1995         * platform/graphics/GraphicsTypes.h:
1996         * platform/graphics/ImageBuffer.cpp:
1997         (WebCore::ImageBuffer::genericConvertToLuminanceMask):
1998         * platform/graphics/ImageBuffer.h:
1999         * platform/graphics/ShadowBlur.cpp:
2000         (WebCore::ShadowBlur::blurShadowBuffer):
2001         * platform/graphics/cairo/ImageBufferCairo.cpp:
2002         (WebCore::getImageData):
2003         (WebCore::ImageBuffer::getUnmultipliedImageData const):
2004         (WebCore::ImageBuffer::getPremultipliedImageData const):
2005         (WebCore::ImageBuffer::putByteArray):
2006         * platform/graphics/cg/ImageBufferCG.cpp:
2007         (WebCore::ImageBuffer::getUnmultipliedImageData const):
2008         (WebCore::ImageBuffer::getPremultipliedImageData const):
2009         (WebCore::ImageBuffer::putByteArray):
2010         * platform/graphics/cg/ImageBufferDataCG.cpp:
2011         (WebCore::ImageBufferData::getData const):
2012         (WebCore::ImageBufferData::putData):
2013         * platform/graphics/cg/ImageBufferDataCG.h:
2014         * platform/graphics/filters/FEColorMatrix.cpp:
2015         (WebCore::FEColorMatrix::platformApplySoftware):
2016         * platform/graphics/filters/FEDropShadow.cpp:
2017         (WebCore::FEDropShadow::platformApplySoftware):
2018         * platform/graphics/filters/FilterEffect.cpp:
2019         (WebCore::FilterEffect::imageBufferResult):
2020         * platform/graphics/win/ImageBufferDataDirect2D.cpp:
2021         (WebCore::ImageBufferData::getData const):
2022         (WebCore::ImageBufferData::putData):
2023         * platform/graphics/win/ImageBufferDataDirect2D.h:
2024         * platform/graphics/win/ImageBufferDirect2D.cpp:
2025         (WebCore::ImageBuffer::getUnmultipliedImageData const):
2026         (WebCore::ImageBuffer::getPremultipliedImageData const):
2027         (WebCore::ImageBuffer::putByteArray):
2028
2029 2017-12-02  Youenn Fablet  <youenn@apple.com>
2030
2031         Implement https://w3c.github.io/ServiceWorker/#clients-getall
2032         https://bugs.webkit.org/show_bug.cgi?id=180276
2033
2034         Reviewed by Chris Dumez.
2035
2036         Test: http/tests/workers/service/serviceworkerclients-matchAll.https.html
2037
2038         Move Clients QueryOptions to its own class since it is used by various parties.
2039         Add encoder/decoder routines.
2040
2041         Add a ServieWorkerClientInformation which replaces SWServer::ClientInformation structure.
2042         This is what is sent back as a result to matchAll requests.
2043         Add encoder/decoder routines.
2044
2045         Implement matchAll by hopping to the main thread, making IPC to the storage process.
2046         SWServer in storage process then iterates through the relevant service workers and does some filtering.
2047         Additional filtering and information should be gathered in future patches to fully implement the algorithm.
2048
2049         Add to SWServer a HashMap to easily identify by which service worker a client is controlled, if any.
2050         This map is updated at the same time registrations are updated.
2051
2052         matchAll is given a callback as in the future, window client information will be retrieved asynchronously.
2053
2054         * WebCore.xcodeproj/project.pbxproj:
2055         * workers/service/ServiceWorkerClientInformation.h: Added.
2056         (WebCore::ServiceWorkerClientInformation::isolatedCopy const):
2057         (WebCore::ServiceWorkerClientInformation::encode const):
2058         (WebCore::ServiceWorkerClientInformation::decode):
2059         * workers/service/ServiceWorkerClientQueryOptions.h: Added.
2060         (WebCore::ServiceWorkerClientQueryOptions::encode const):
2061         (WebCore::ServiceWorkerClientQueryOptions::decode):
2062         * workers/service/ServiceWorkerClients.cpp:
2063         (WebCore::ServiceWorkerClients::matchAll):
2064         * workers/service/ServiceWorkerClients.h:
2065         * workers/service/context/SWContextManager.h:
2066         * workers/service/server/SWServer.cpp:
2067         (WebCore::SWServer::matchAll):
2068         (WebCore::SWServer::registerServiceWorkerClient):
2069         * workers/service/server/SWServer.h:
2070         * workers/service/server/SWServerToContextConnection.cpp:
2071         (WebCore::SWServerToContextConnection::matchAll):
2072         * workers/service/server/SWServerToContextConnection.h:
2073         * workers/service/server/SWServerWorker.cpp:
2074         (WebCore::SWServerWorker::matchAll):
2075         * workers/service/server/SWServerWorker.h:
2076
2077 2017-12-02  Brady Eidson  <beidson@apple.com>
2078
2079         Factor out the "databaseTaskQueue" parts of IDBServer into something reusable.
2080         https://bugs.webkit.org/show_bug.cgi?id=180298
2081
2082         Reviewed by Chris Dumez.
2083
2084         No new tests (Refactor only).
2085
2086         * Modules/indexeddb/server/IDBServer.cpp:
2087         (WebCore::IDBServer::IDBServer::IDBServer):
2088         (WebCore::IDBServer::IDBServer::postDatabaseTask):
2089         (WebCore::IDBServer::IDBServer::postDatabaseTaskReply):
2090         (WebCore::IDBServer::IDBServer::databaseRunLoop): Deleted.
2091         (WebCore::IDBServer::IDBServer::handleTaskRepliesOnMainThread): Deleted.
2092         * Modules/indexeddb/server/IDBServer.h:
2093         (): Deleted.
2094
2095 2017-12-02  Simon Fraser  <simon.fraser@apple.com>
2096
2097         Add a log channel for viewports
2098         https://bugs.webkit.org/show_bug.cgi?id=180295
2099
2100         Reviewed by Zalan Bujtas.
2101
2102         Add a "Viewports" log channel to log viewport scaling information, and enhance the
2103         WebKit "VisibleRects" channel to log additional data for the same reason.
2104
2105         * dom/Document.cpp:
2106         (WebCore::Document::processViewport):
2107         * loader/FrameLoader.cpp:
2108         (WebCore::FrameLoader::finishedParsing):
2109         (WebCore::FrameLoader::completed):
2110         * page/FrameView.cpp:
2111         (WebCore::FrameView::resetScrollbarsAndClearContentsSize):
2112         (WebCore::FrameView::scrollToAnchor):
2113         (WebCore::FrameView::maintainScrollPositionAtAnchor):
2114         (WebCore::FrameView::setScrollPosition):
2115         (WebCore::FrameView::autoSizeIfEnabled):
2116         (WebCore::FrameView::setWasScrolledByUser):
2117         * page/LayoutContext.cpp:
2118         (WebCore::LayoutContext::layout):
2119         * page/Page.cpp:
2120         (WebCore::Page::setPageScaleFactor):
2121         * page/ViewportConfiguration.cpp:
2122         (WebCore::ViewportConfiguration::setContentsSize):
2123         (WebCore::ViewportConfiguration::setViewportArguments):
2124         (WebCore::ViewportConfiguration::updateConfiguration):
2125         (WebCore::operator<<):
2126         (WebCore::ViewportConfiguration::description const):
2127         (WebCore::ViewportConfiguration::dump const):
2128         * page/ViewportConfiguration.h:
2129         * platform/Logging.h:
2130         * platform/ScrollView.cpp:
2131         (WebCore::ScrollView::setFixedLayoutSize):
2132
2133 2017-12-01  Alicia Boya García  <aboya@igalia.com>
2134
2135         [MSE] Use correct range end checks in sourceBufferPrivateDidReceiveSample()
2136         https://bugs.webkit.org/show_bug.cgi?id=179690
2137
2138         Reviewed by Jer Noble.
2139
2140         The Coded Frame Processing algorithm as defined in
2141         https://www.w3.org/TR/media-source/#sourcebuffer-coded-frame-processing states:
2142
2143         1.14. Remove existing coded frames in track buffer:
2144          -> If highest end timestamp for track buffer is not set:
2145                [...]
2146          -> If highest end timestamp for track buffer is set and less than or
2147             equal to presentation timestamp:
2148                Remove all coded frames from track buffer that have a
2149                presentation timestamp greater than or equal to highest end
2150                timestamp and less than frame end timestamp.
2151
2152         Note the removal range is closed-open [a, b). WebKit is actually removing
2153         frames using an open-closed range (a, b], which causes frames not to be removed
2154         in situations where they should and frames to be removed in situations when
2155         they should not.
2156
2157         Tests: media/media-source/media-source-range-end-frame-not-removed.html
2158                media/media-source/media-source-range-start-frame-replaced.html
2159
2160         * Modules/mediasource/SampleMap.cpp:
2161         (WebCore::PresentationOrderSampleMap::findSamplesBetweenPresentationTimesFromEnd):
2162         * Modules/mediasource/SampleMap.h:
2163         * Modules/mediasource/SourceBuffer.cpp:
2164         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
2165
2166 2017-12-01  Simon Fraser  <simon.fraser@apple.com>
2167
2168         Reduce the number of calls to ViewportConfiguration::updateConfiguration()
2169         https://bugs.webkit.org/show_bug.cgi?id=180299
2170
2171         Reviewed by Zalan Bujtas.
2172
2173         There are several calls to ViewportConfiguration::setDefaultConfiguration() during loading
2174         with the same arguments. We can avoid unnecessary calls to updateConfiguration() by returning
2175         early if the configuration hasn't changed.
2176
2177         * page/ViewportConfiguration.cpp:
2178         (WebCore::ViewportConfiguration::setDefaultConfiguration):
2179         * page/ViewportConfiguration.h:
2180         (WebCore::ViewportConfiguration::Parameters::operator== const):
2181
2182 2017-12-01  Aishwarya Nirmal  <anirmal@apple.com>
2183
2184         [Touch Bar Web API] Object representing Touch Bar Menu to send between Web and UI Processes
2185         https://bugs.webkit.org/show_bug.cgi?id=179714
2186
2187         Reviewed by Wenson Hsieh.
2188
2189         These changes allow the HTMLMenuElement and HTMLMenuItemElement to parse attributes relating
2190         to the touch bar and convey changes to the elements that will eventually be propogated to the
2191         UI process.
2192
2193         No new tests at this point because the changes to HTMLMenuElement and HTMLMenuItemElement are
2194         new properties, which might not be worth testing, and overriden methods for insertedIntoAncestor
2195         and removedFromAncestor, which are involved in sending a message to a UI process but might be
2196         difficult to test at this point since the UI process only receives (and does not yet process)
2197         the message.
2198
2199         * html/HTMLMenuElement.cpp:
2200         (WebCore::HTMLMenuElement::insertedIntoAncestor):
2201         (WebCore::HTMLMenuElement::removedFromAncestor):
2202         (WebCore::HTMLMenuElement::parseAttribute):
2203         * html/HTMLMenuElement.h:
2204         * html/HTMLMenuItemElement.cpp:
2205         (WebCore::HTMLMenuItemElement::insertedIntoAncestor):
2206         (WebCore::HTMLMenuItemElement::removedFromAncestor):
2207         * html/HTMLMenuItemElement.h:
2208         * page/ChromeClient.h:
2209
2210 2017-12-01  Daniel Bates  <dabates@apple.com>
2211
2212         AlternativePresentationButtonSubstitution::unapply() may not undo substitution
2213         https://bugs.webkit.org/show_bug.cgi?id=180279
2214         <rdar://problem/35800599>
2215
2216         Reviewed by Simon Fraser.
2217
2218         Fixes an issue where removing an alternative presentation button substituted for a non-HTML input
2219         element did not restore the original appearance of the element before the substitution.
2220
2221         To substitute the alternative presentation button for a non-HTML input element we attach a
2222         user-agent shadow root to it. Adding a shadow root, including a user-agent shadow root,
2223         tears down the existing renderers for the element. Currently when we unapply such a substitution
2224         we ultimately just remove the shadow root and do not create new renderers for the subtree
2225         that the shadow root was removed from. We need to create new renderers for this subtree
2226         to restore the original appearance of the element before the substitution.
2227
2228         * editing/cocoa/AlternativePresentationButtonSubstitution.cpp:
2229         (WebCore::AlternativePresentationButtonSubstitution::unapply):
2230
2231 2017-12-01  Christopher Reid  <chris.reid@sony.com>
2232
2233         Move DateComponents into WTF
2234         https://bugs.webkit.org/show_bug.cgi?id=180211
2235
2236         Reviewed by Myles C. Maxfield.
2237
2238         No new tests no change in behavior.
2239
2240         Moved DateComponents from platform into WTF.
2241
2242         * Sources.txt: Removed DateComponents
2243         * WebCore.xcodeproj/project.pbxproj: Removed DateComponents
2244         * dom/Document.cpp:
2245         * html/BaseDateAndTimeInputType.h:
2246         * html/DateTimeInputType.h: Fixed a call to the wrong parent constructor
2247         * html/HTMLInputElement.h:
2248         * html/InputType.cpp:
2249         * html/InputType.h:
2250         * platform/text/PlatformLocale.cpp:
2251         * platform/text/PlatformLocale.h:
2252         * platform/text/ios/LocalizedDateCache.h:
2253         * platform/text/mac/LocaleMac.h:
2254         * platform/text/win/LocaleWin.cpp:
2255         * platform/text/win/LocaleWin.h:
2256         * rendering/RenderThemeIOS.mm:
2257
2258 2017-12-01  Daniel Bates  <dabates@apple.com>
2259
2260         Alternative Presentation Button: Provide a way to query for the replaced elements
2261         https://bugs.webkit.org/show_bug.cgi?id=180114
2262         <rdar://problem/35710539>
2263
2264         Reviewed by Tim Horton.
2265
2266         Add SPI to query for the elements that were replaced by an Alternative Presentation Button.
2267
2268         Test: fast/forms/alternative-presentation-button/replaced-elements.html
2269
2270         * editing/Editor.cpp:
2271         (WebCore::Editor::elementsReplacedByAlternativePresentationButton): Added.
2272         * editing/Editor.h:
2273         * editing/cocoa/AlternativePresentationButtonSubstitution.cpp:
2274         (WebCore::AlternativePresentationButtonSubstitution::replacedElements): Added.
2275         * editing/cocoa/AlternativePresentationButtonSubstitution.h:
2276         * testing/Internals.cpp:
2277         (WebCore::Internals::elementsReplacedByAlternativePresentationButton): Added.
2278         * testing/Internals.h:
2279         * testing/Internals.idl: Expose internals function elementsReplacedByAlternativePresentationButton()
2280         so as to test Editor::elementsReplacedByAlternativePresentationButton().
2281
2282 2017-12-01  Said Abou-Hallawa  <sabouhallawa@apple.com>
2283
2284         Rename ImageFrameCache to ImageSource
2285         https://bugs.webkit.org/show_bug.cgi?id=180172
2286
2287         Reviewed by Per Arne Vollan.
2288
2289         This is a follow-up for r225300. ImageSource is the intended name after
2290         merging ImageFrameCache and ImageSource.
2291
2292         * Sources.txt:
2293         * WebCore.xcodeproj/project.pbxproj:
2294         * platform/graphics/BitmapImage.cpp:
2295         (WebCore::BitmapImage::BitmapImage):
2296         * platform/graphics/BitmapImage.h:
2297         * platform/graphics/ImageFrame.h:
2298         * platform/graphics/ImageFrameCache.cpp: Removed.
2299         * platform/graphics/ImageFrameCache.h: Removed.
2300         * platform/graphics/ImageSource.cpp: Added.
2301         (WebCore::ImageSource::ImageSource):
2302         (WebCore::ImageSource::~ImageSource):
2303         (WebCore::ImageSource::ensureDecoderAvailable):
2304         (WebCore::ImageSource::setData):
2305         (WebCore::ImageSource::resetData):
2306         (WebCore::ImageSource::dataChanged):
2307         (WebCore::ImageSource::isAllDataReceived):
2308         (WebCore::ImageSource::destroyDecodedData):
2309         (WebCore::ImageSource::destroyIncompleteDecodedData):
2310         (WebCore::ImageSource::clearFrameBufferCache):
2311         (WebCore::ImageSource::decodedSizeChanged):
2312         (WebCore::ImageSource::decodedSizeIncreased):
2313         (WebCore::ImageSource::decodedSizeDecreased):
2314         (WebCore::ImageSource::decodedSizeReset):
2315         (WebCore::ImageSource::didDecodeProperties):
2316         (WebCore::ImageSource::growFrames):
2317         (WebCore::ImageSource::setNativeImage):
2318         (WebCore::ImageSource::cacheMetadataAtIndex):
2319         (WebCore::ImageSource::cacheNativeImageAtIndex):
2320         (WebCore::ImageSource::cacheNativeImageAtIndexAsync):
2321         (WebCore::ImageSource::decodingQueue):
2322         (WebCore::ImageSource::frameRequestQueue):
2323         (WebCore::ImageSource::canUseAsyncDecoding):
2324         (WebCore::ImageSource::startAsyncDecodingQueue):
2325         (WebCore::ImageSource::requestFrameAsyncDecodingAtIndex):
2326         (WebCore::ImageSource::isAsyncDecodingQueueIdle const):
2327         (WebCore::ImageSource::stopAsyncDecodingQueue):
2328         (WebCore::ImageSource::frameAtIndexCacheIfNeeded):
2329         (WebCore::ImageSource::clearMetadata):
2330         (WebCore::ImageSource::sourceURL const):
2331         (WebCore::ImageSource::mimeType const):
2332         (WebCore::ImageSource::expectedContentLength const):
2333         (WebCore::ImageSource::metadata):
2334         (WebCore::ImageSource::frameMetadataAtIndex):
2335         (WebCore::ImageSource::frameMetadataAtIndexCacheIfNeeded):
2336         (WebCore::ImageSource::encodedDataStatus):
2337         (WebCore::ImageSource::frameCount):
2338         (WebCore::ImageSource::repetitionCount):
2339         (WebCore::ImageSource::uti):
2340         (WebCore::ImageSource::filenameExtension):
2341         (WebCore::ImageSource::hotSpot):
2342         (WebCore::ImageSource::size):
2343         (WebCore::ImageSource::sizeRespectingOrientation):
2344         (WebCore::ImageSource::singlePixelSolidColor):
2345         (WebCore::ImageSource::maximumSubsamplingLevel):
2346         (WebCore::ImageSource::frameIsBeingDecodedAndIsCompatibleWithOptionsAtIndex):
2347         (WebCore::ImageSource::frameDecodingStatusAtIndex):
2348         (WebCore::ImageSource::frameHasAlphaAtIndex):
2349         (WebCore::ImageSource::frameHasFullSizeNativeImageAtIndex):
2350         (WebCore::ImageSource::frameHasDecodedNativeImageCompatibleWithOptionsAtIndex):
2351         (WebCore::ImageSource::frameSubsamplingLevelAtIndex):
2352         (WebCore::ImageSource::frameSizeAtIndex):
2353         (WebCore::ImageSource::frameBytesAtIndex):
2354         (WebCore::ImageSource::frameDurationAtIndex):
2355         (WebCore::ImageSource::frameOrientationAtIndex):
2356         (WebCore::ImageSource::setTargetContext):
2357         (WebCore::ImageSource::createFrameImageAtIndex):
2358         (WebCore::ImageSource::frameImageAtIndex):
2359         (WebCore::ImageSource::frameImageAtIndexCacheIfNeeded):
2360         (WebCore::ImageSource::dump):
2361         * platform/graphics/ImageSource.h: Added.
2362         (WebCore::ImageSource::create):
2363         (WebCore::ImageSource::decodedSize const):
2364         (WebCore::ImageSource::destroyAllDecodedData):
2365         (WebCore::ImageSource::destroyAllDecodedDataExcludeFrame):
2366         (WebCore::ImageSource::destroyDecodedDataBeforeFrame):
2367         (WebCore::ImageSource::clearImage):
2368         (WebCore::ImageSource::requestFrameAsyncDecodingAtIndex):
2369         (WebCore::ImageSource::hasAsyncDecodingQueue const):
2370         (WebCore::ImageSource::isSizeAvailable):
2371         (WebCore::ImageSource::isDecoderAvailable const):
2372         (WebCore::ImageSource::frameAtIndexCacheIfNeeded):
2373         (WebCore::ImageSource::ImageFrameRequest::operator== const):
2374         * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
2375         (WebCore::GraphicsContext3D::ImageExtractor::extractImage):
2376         * platform/graphics/cg/GraphicsContext3DCG.cpp:
2377         (WebCore::GraphicsContext3D::ImageExtractor::extractImage):
2378
2379 2017-12-01  Youenn Fablet  <youenn@apple.com>
2380
2381         Implement https://w3c.github.io/ServiceWorker/#clients-get
2382         https://bugs.webkit.org/show_bug.cgi?id=180167
2383
2384         Reviewed by Chris Dumez.
2385
2386         Test: http/tests/workers/service/serviceworkerclients-get.https.html
2387
2388         Implement clients get by having service worker clients do the following:
2389         - Go to main thread to query the SWClientConnection for getting the client.
2390         - SWClientConnection requests it through IPC to StorageProcess SWServer.
2391         - SWServer looks at its client map and returns client data based on the given identifier.
2392         - SWClientConnection sends it back to the right clients for resolving the promise.
2393
2394         Identifier is parsed at service worker process level.
2395
2396         Made ServiceWorkerClients no longer an ActiveDOMObject since it is owned by ServiceWorkerGlobalScope
2397         and is only exposed in service workers.
2398
2399         * workers/service/ServiceWorkerClientIdentifier.h:
2400         (WebCore::ServiceWorkerClientIdentifier::fromString):
2401         * workers/service/ServiceWorkerClients.cpp:
2402         (WebCore::ServiceWorkerClients::ServiceWorkerClients):
2403         (WebCore::ServiceWorkerClients::get):
2404         * workers/service/ServiceWorkerClients.h:
2405         (WebCore::ServiceWorkerClients::create):
2406         * workers/service/context/SWContextManager.cpp:
2407         (WebCore::SWContextManager::postTaskToServiceWorker):
2408         * workers/service/context/SWContextManager.h:
2409         * workers/service/server/SWServer.cpp:
2410         (WebCore::SWServer::getClientFromId):
2411         * workers/service/server/SWServer.h:
2412         * workers/service/server/SWServerToContextConnection.cpp:
2413         (WebCore::SWServerToContextConnection::findClientByIdentifier):
2414         * workers/service/server/SWServerToContextConnection.h:
2415         * workers/service/server/SWServerWorker.cpp:
2416         (WebCore::SWServerWorker::origin const):
2417         (WebCore::SWServerWorker::findClientByIdentifier):
2418         * workers/service/server/SWServerWorker.h:
2419
2420 2017-12-01  Brian Burg  <bburg@apple.com>
2421
2422         Web Inspector: move Inspector::Protocol::Array<T> to JSON namespace
2423         https://bugs.webkit.org/show_bug.cgi?id=173662
2424
2425         Reviewed by Joseph Pecoraro.
2426
2427         Adopt new type names.
2428
2429         * inspector/InspectorCanvas.cpp:
2430         (WebCore::InspectorCanvas::recordAction):
2431         (WebCore::InspectorCanvas::releaseFrames):
2432         (WebCore::InspectorCanvas::releaseData):
2433         (WebCore::InspectorCanvas::indexForData):
2434         (WebCore::buildArrayForAffineTransform):
2435         (WebCore::buildArrayForVector):
2436         (WebCore::InspectorCanvas::buildInitialState):
2437         (WebCore::InspectorCanvas::buildAction):
2438         (WebCore::InspectorCanvas::buildArrayForCanvasGradient):
2439         (WebCore::InspectorCanvas::buildArrayForCanvasPattern):
2440         (WebCore::InspectorCanvas::buildArrayForImageData):
2441         (WebCore::InspectorCanvas::buildArrayForImageBitmap):
2442         * inspector/InspectorCanvas.h:
2443         * inspector/InspectorController.cpp:
2444         (WebCore::InspectorController::buildObjectForHighlightedNodes const):
2445         * inspector/InspectorController.h:
2446         * inspector/InspectorOverlay.cpp:
2447         (WebCore::buildObjectForHighlight):
2448         (WebCore::InspectorOverlay::drawPaintRects):
2449         (WebCore::buildArrayForRendererFragments):
2450         (WebCore::buildObjectForElementData):
2451         (WebCore::InspectorOverlay::buildHighlightObjectForNode const):
2452         (WebCore::InspectorOverlay::buildObjectForHighlightedNodes const):
2453         * inspector/InspectorOverlay.h:
2454         * inspector/InspectorStyleSheet.cpp:
2455         (WebCore::fillMediaListChain):
2456         (WebCore::InspectorStyle::buildArrayForComputedStyle const):
2457         (WebCore::InspectorStyle::styleWithProperties const):
2458         (WebCore::buildObjectForSelectorHelper):
2459         (WebCore::selectorsFromSource):
2460         (WebCore::InspectorStyleSheet::buildObjectForSelectorList):
2461         (WebCore::InspectorStyleSheet::buildObjectForRule):
2462         (WebCore::InspectorStyleSheet::buildObjectForStyle):
2463         (WebCore::InspectorStyleSheet::buildArrayForRuleList):
2464         * inspector/InspectorStyleSheet.h:
2465         * inspector/agents/InspectorApplicationCacheAgent.cpp:
2466         (WebCore::InspectorApplicationCacheAgent::getFramesWithManifests):
2467         (WebCore::InspectorApplicationCacheAgent::buildArrayForApplicationCacheResources):
2468         * inspector/agents/InspectorApplicationCacheAgent.h:
2469         * inspector/agents/InspectorCSSAgent.cpp:
2470         (WebCore::InspectorCSSAgent::getMatchedStylesForNode):
2471         (WebCore::InspectorCSSAgent::getComputedStyleForNode):
2472         (WebCore::InspectorCSSAgent::getAllStyleSheets):
2473         (WebCore::InspectorCSSAgent::getSupportedCSSProperties):
2474         (WebCore::InspectorCSSAgent::getSupportedSystemFontFamilyNames):
2475         (WebCore::InspectorCSSAgent::buildArrayForMatchedRuleList):
2476         * inspector/agents/InspectorCSSAgent.h:
2477         * inspector/agents/InspectorCanvasAgent.cpp:
2478         (WebCore::InspectorCanvasAgent::requestCSSCanvasClientNodes):
2479         * inspector/agents/InspectorCanvasAgent.h:
2480         * inspector/agents/InspectorDOMAgent.cpp:
2481         (WebCore::InspectorDOMAgent::querySelectorAll):
2482         (WebCore::InspectorDOMAgent::pushNodePathToFrontend):
2483         (WebCore::InspectorDOMAgent::getEventListenersForNode):
2484         (WebCore::InspectorDOMAgent::getSearchResults):
2485         (WebCore::InspectorDOMAgent::getAttributes):
2486         (WebCore::InspectorDOMAgent::buildObjectForNode):
2487         (WebCore::InspectorDOMAgent::buildArrayForElementAttributes):
2488         (WebCore::InspectorDOMAgent::buildArrayForContainerChildren):
2489         (WebCore::InspectorDOMAgent::buildArrayForPseudoElements):
2490         (WebCore::InspectorDOMAgent::processAccessibilityChildren):
2491         (WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):
2492         (WebCore::InspectorDOMAgent::styleAttributeInvalidated):
2493         * inspector/agents/InspectorDOMAgent.h:
2494         * inspector/agents/InspectorDOMStorageAgent.cpp:
2495         (WebCore::InspectorDOMStorageAgent::getDOMStorageItems):
2496         * inspector/agents/InspectorDOMStorageAgent.h:
2497         * inspector/agents/InspectorDatabaseAgent.cpp:
2498         (WebCore::InspectorDatabaseAgent::getDatabaseTableNames):
2499         * inspector/agents/InspectorDatabaseAgent.h:
2500         * inspector/agents/InspectorIndexedDBAgent.cpp:
2501         (WebCore::Inspector::keyPathFromIDBKeyPath):
2502         (WebCore::InspectorIndexedDBAgent::requestDatabaseNames):
2503         * inspector/agents/InspectorLayerTreeAgent.cpp:
2504         (WebCore::InspectorLayerTreeAgent::layersForNode):
2505         (WebCore::InspectorLayerTreeAgent::gatherLayersUsingRenderObjectHierarchy):
2506         (WebCore::InspectorLayerTreeAgent::gatherLayersUsingRenderLayerHierarchy):
2507         * inspector/agents/InspectorLayerTreeAgent.h:
2508         * inspector/agents/InspectorMemoryAgent.cpp:
2509         (WebCore::InspectorMemoryAgent::collectSample):
2510         * inspector/agents/InspectorNetworkAgent.cpp:
2511         (WebCore::InspectorNetworkAgent::searchOtherRequests):
2512         (WebCore::InspectorNetworkAgent::searchInRequest):
2513         * inspector/agents/InspectorNetworkAgent.h:
2514         * inspector/agents/InspectorPageAgent.cpp:
2515         (WebCore::buildArrayForCookies):
2516         (WebCore::InspectorPageAgent::getCookies):
2517         (WebCore::InspectorPageAgent::searchInResource):
2518         (WebCore::InspectorPageAgent::searchInResources):
2519         (WebCore::InspectorPageAgent::buildObjectForFrameTree):
2520         * inspector/agents/InspectorPageAgent.h:
2521         * inspector/agents/WebConsoleAgent.cpp:
2522         (WebCore::WebConsoleAgent::getLoggingChannels):
2523         * inspector/agents/WebConsoleAgent.h:
2524
2525 2017-12-01  Wenson Hsieh  <wenson_hsieh@apple.com>
2526
2527         [Attachment Support] Implement SPI for clients to update a given attachment's data
2528         https://bugs.webkit.org/show_bug.cgi?id=180184
2529         <rdar://problem/35355731>
2530
2531         Reviewed by Tim Horton.
2532
2533         Add native API support for Mail to update the data (and optionally, the name and type) of a given attachment
2534         element. See per-method comments below for more detail.
2535
2536         Test: WKAttachmentTests.ChangeAttachmentDataAndFileInformation
2537               WKAttachmentTests.ChangeAttachmentDataUpdatesWithInPlaceDisplay
2538
2539         * editing/Editor.cpp:
2540         (WebCore::Editor::insertAttachment):
2541         * html/HTMLAttachmentElement.cpp:
2542         (WebCore::HTMLAttachmentElement::setFile):
2543         (WebCore::HTMLAttachmentElement::invalidateShadowRootChildrenIfNecessary):
2544
2545         Pull out logic to hide and reset shadow DOM state into a separate helper, and additionally hide both the image
2546         and video child elements if they exist. This prevents us from getting into a state where both image and video
2547         elements may appear side-by-side when changing data from an image to a video or vice versa.
2548
2549         (WebCore::HTMLAttachmentElement::updateFileWithData):
2550
2551         Add a new helper to update the backing File of an attachment element from data, optionally updating the filename
2552         and content type as well.
2553
2554         (WebCore::HTMLAttachmentElement::populateShadowRootIfNecessary):
2555         * html/HTMLAttachmentElement.h:
2556
2557 2017-12-01  Chris Dumez  <cdumez@apple.com>
2558
2559         Get rid of microtask in ServiceWorkerContainer::jobResolvedWithRegistration()
2560         https://bugs.webkit.org/show_bug.cgi?id=180263
2561
2562         Reviewed by Youenn Fablet.
2563
2564         Get rid of microtask in ServiceWorkerContainer::jobResolvedWithRegistration(). It
2565         is no longer needed and MicrotaskQueue::mainThreadQueue() is only safe to use from
2566         the main thread, as its name suggest. ServiceWorkerContainer are also instantiated
2567         in Service worker threads nowadays.
2568
2569         * workers/service/SWClientConnection.cpp:
2570         (WebCore::SWClientConnection::registrationJobResolvedInServer):
2571         * workers/service/ServiceWorkerContainer.cpp:
2572         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
2573         * workers/service/ServiceWorkerContainer.h:
2574         * workers/service/ServiceWorkerJob.cpp:
2575         (WebCore::ServiceWorkerJob::resolvedWithRegistration):
2576         * workers/service/ServiceWorkerJob.h:
2577         * workers/service/ServiceWorkerJobClient.h:
2578
2579 2017-12-01  Myles C. Maxfield  <mmaxfield@apple.com>
2580
2581         Free FontFaceSets may include fonts that were never actually added to them
2582         https://bugs.webkit.org/show_bug.cgi?id=180164
2583
2584         Reviewed by Simon Fraser.
2585
2586         There are two circumstances where this can occur:
2587
2588         - If script makes a so-called "free" FontFaceSet, by using "new FontFaceSet". This object is not
2589         associated with the document, and should therefore only include fonts which have been manually
2590         added to it from script. However, today, this object includes preinstalled fonts which have the
2591         same names as any fonts manually added to it. (So, if you manually add "Helvetica", the object
2592         would have two objects - the one you just added and the preinstalled version too).
2593
2594         - For the document's FontFaceSet, the same thing would happen. This one is a little trickier
2595         because the spec is not clear whether or not the document's FontFaceSet should include these
2596         preinstalled fonts. However, running this test in Firefox and Chrome, they both agree that 
2597         preinstalled fonts should not be present, so this patch adheres to this behavior.
2598
2599         We can't actually remove the preinstalled fonts from the document's FontFaceSet (because that's
2600         how normal font lookups are performed), but we can filter them out at the point they meet the
2601         Javascript API. And, for "free" FontFaceSets, we can avoid adding them in the first place for
2602         performance.
2603
2604         Test: fast/text/font-face-api-preinstalled.html
2605
2606         * css/CSSFontFaceSet.cpp:
2607         (WebCore::CSSFontFaceSet::CSSFontFaceSet):
2608         (WebCore::CSSFontFaceSet::ensureLocalFontFacesForFamilyRegistered):
2609         (WebCore::CSSFontFaceSet::addToFacesLookupTable):
2610         (WebCore::CSSFontFaceSet::matchingFacesExcludingPreinstalledFonts):
2611         (WebCore::CSSFontFaceSet::check):
2612         (WebCore::CSSFontFaceSet::matchingFaces): Deleted.
2613         * css/CSSFontFaceSet.h:
2614         * css/CSSFontSelector.cpp:
2615         (WebCore::CSSFontSelector::CSSFontSelector):
2616         * css/FontFaceSet.cpp:
2617         (WebCore::FontFaceSet::load):
2618
2619 2017-12-01  Dean Jackson  <dino@apple.com>
2620
2621         Attempted build fix.
2622
2623         * platform/graphics/ANGLEWebKitBridge.cpp:
2624         (WebCore::ANGLEWebKitBridge::compileShaderSource):
2625         * platform/graphics/ANGLEWebKitBridge.h:
2626         * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
2627         (WebCore::Extensions3DOpenGLCommon::getTranslatedShaderSourceANGLE):
2628
2629 2017-12-01  Dean Jackson  <dino@apple.com>
2630
2631         Use SH_INITIALIZE_UNINITIALIZED_LOCALS now that ANGLE has been updated
2632         https://bugs.webkit.org/show_bug.cgi?id=177929
2633         <rdar://problem/34866210>
2634
2635         Reviewed by Sam Weinig.
2636
2637         Test: fast/canvas/webgl/uninitialized-locals.html
2638
2639         * platform/graphics/ANGLEWebKitBridge.cpp:
2640         (WebCore::ANGLEWebKitBridge::compileShaderSource):
2641         * platform/graphics/ANGLEWebKitBridge.h:
2642         * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
2643         (WebCore::Extensions3DOpenGLCommon::getTranslatedShaderSourceANGLE):
2644
2645 2017-12-01  Youenn Fablet  <youenn@apple.com>
2646
2647         Many imported/w3c/web-platform-tests/service-workers/ test are failing together intermittently
2648         https://bugs.webkit.org/show_bug.cgi?id=180227
2649
2650         Reviewed by Mark Lam.
2651
2652         No observable change.
2653
2654         * bindings/js/JSDOMPromise.cpp:
2655         (WebCore::callFunction):
2656
2657 2017-12-01  Brady Eidson  <beidson@apple.com>
2658
2659         Add Internals.terminateServiceWorker, and the ability to restart service workers for postMessage.
2660         https://bugs.webkit.org/show_bug.cgi?id=180170
2661
2662         Reviewed by Chris Dumez.
2663
2664         Test: http/tests/workers/service/postmessage-after-terminate.https.html
2665
2666         * dom/ActiveDOMObject.cpp:
2667         (WebCore::ActiveDOMObject::~ActiveDOMObject):
2668
2669         * testing/Internals.cpp:
2670         (WebCore::Internals::terminateServiceWorker):
2671         * testing/Internals.h:
2672         * testing/Internals.idl:
2673
2674         * workers/service/SWClientConnection.h:
2675
2676         * workers/service/ServiceWorker.idl:
2677
2678         * workers/service/context/SWContextManager.cpp:
2679         (WebCore::SWContextManager::postMessageToServiceWorkerGlobalScope):
2680         (WebCore::SWContextManager::terminateWorker):
2681         * workers/service/context/SWContextManager.h:
2682
2683         * workers/service/context/ServiceWorkerThreadProxy.h:
2684
2685         * workers/service/server/SWServer.cpp:
2686         (WebCore::SWServer::workerByID const):
2687         (WebCore::SWServer::Connection::syncTerminateWorker):
2688         (WebCore::SWServer::installContextData):
2689         (WebCore::SWServer::invokeRunServiceWorker):
2690         (WebCore::SWServer::terminateWorker):
2691         (WebCore::SWServer::syncTerminateWorker):
2692         (WebCore::SWServer::terminateWorkerInternal):
2693         (WebCore::SWServer::workerContextTerminated):
2694         * workers/service/server/SWServer.h:
2695         (WebCore::SWServer::workerByID const): Deleted.
2696
2697         * workers/service/server/SWServerToContextConnection.h:
2698
2699         * workers/service/server/SWServerWorker.cpp:
2700         (WebCore::SWServerWorker::contextData const):
2701         * workers/service/server/SWServerWorker.h:
2702         (WebCore::SWServerWorker::isRunning const):
2703         (WebCore::SWServerWorker::isTerminating const):
2704         (WebCore::SWServerWorker::setState):
2705         (WebCore::SWServerWorker::server):
2706
2707 2017-12-01  Zalan Bujtas  <zalan@apple.com>
2708
2709         Nullptr deref in WebCore::RenderTableCaption::containingBlockLogicalWidthForContent
2710         https://bugs.webkit.org/show_bug.cgi?id=180251
2711         <rdar://problem/34138562>
2712
2713         Reviewed by Simon Fraser.
2714
2715         containingBlockLogicalWidthForContent should check whether the renderer is actually
2716         attached to the tree.
2717
2718         Test: fast/table/caption-crash-when-layer-backed.html
2719
2720         * rendering/RenderBoxModelObject.cpp:
2721         (WebCore::RenderBoxModelObject::containingBlockLogicalWidthForContent const):
2722         * rendering/RenderTableCaption.h:
2723         (WebCore::RenderTableCaption::containingBlockLogicalWidthForContent const):
2724
2725 2017-12-01  Youenn Fablet  <youenn@apple.com>
2726
2727         Clear WebSWClientConnection in case storage process IPC connection is closing
2728         https://bugs.webkit.org/show_bug.cgi?id=180210
2729
2730         Reviewed by Chris Dumez.
2731
2732         No observable change of behavior.
2733
2734         * dom/Document.h: Keeping a ref since object may be deleted otherwise.
2735
2736 2017-12-01  Chris Dumez  <cdumez@apple.com>
2737
2738         Drop clientCreationURL from ServiceWorkerRegistrationKey
2739         https://bugs.webkit.org/show_bug.cgi?id=180255
2740
2741         Reviewed by Youenn Fablet.
2742
2743         Drop clientCreationURL from ServiceWorkerRegistrationKey. It is not needed and leads to
2744         wrong behavior when using the Service Worker API from inside service workers.
2745
2746         * workers/service/ServiceWorkerJobData.cpp:
2747         (WebCore::ServiceWorkerJobData::registrationKey const):
2748         * workers/service/ServiceWorkerRegistrationKey.cpp:
2749         (WebCore::ServiceWorkerRegistrationKey::ServiceWorkerRegistrationKey):
2750         (WebCore::ServiceWorkerRegistrationKey::hash const):
2751         (WebCore::ServiceWorkerRegistrationKey::operator== const):
2752         (WebCore::ServiceWorkerRegistrationKey::isolatedCopy const):
2753         (WebCore::ServiceWorkerRegistrationKey::loggingString const):
2754         * workers/service/ServiceWorkerRegistrationKey.h:
2755         (WebCore::ServiceWorkerRegistrationKey::scope const):
2756         (WebCore::ServiceWorkerRegistrationKey::setScope):
2757         (WebCore::ServiceWorkerRegistrationKey::encode const):
2758         (WebCore::ServiceWorkerRegistrationKey::decode):
2759         (WTF::HashTraits<WebCore::ServiceWorkerRegistrationKey>::constructDeletedValue):
2760         (WTF::HashTraits<WebCore::ServiceWorkerRegistrationKey>::isDeletedValue):
2761         (WebCore::ServiceWorkerRegistrationKey::clientCreationURL const): Deleted.
2762         (WebCore::ServiceWorkerRegistrationKey::setClientCreationURL): Deleted.
2763
2764 2017-12-01  Fujii Hironori  <Hironori.Fujii@sony.com>
2765
2766         [WinCairo] Wrongly placed scroll bars in HiDPI
2767         https://bugs.webkit.org/show_bug.cgi?id=180066
2768
2769         Reviewed by Žan Doberšek.
2770
2771         PlatformContextCairo wasn't properly initialized. It should have a
2772         pointer to GraphicsContextPrivate in WinCairo port to paint
2773         controls in right places.
2774
2775         No new tests, no behavior change.
2776
2777         * platform/graphics/win/GraphicsContextCairoWin.cpp:
2778         (WebCore::GraphicsContext::platformInit): Call PlatformContextCairo::setGraphicsContextPrivate.
2779
2780 2017-12-01  Eric Carlson  <eric.carlson@apple.com>
2781
2782         [MediaStream] Use CaptureDevice instead of device ID to identify devices
2783         https://bugs.webkit.org/show_bug.cgi?id=180206
2784         <rdar://problem/35775758>
2785
2786         Reviewed by Youenn Fablet.
2787
2788         No new tests, no change in behavior.
2789
2790         * Modules/mediastream/UserMediaRequest.cpp:
2791         (WebCore::UserMediaRequest::allow):
2792         * Modules/mediastream/UserMediaRequest.h:
2793         (WebCore::UserMediaRequest::allowedAudioDeviceUID const): Deleted.
2794         (WebCore::UserMediaRequest::allowedVideoDeviceUID const): Deleted.
2795         * platform/mediastream/RealtimeMediaSource.h:
2796         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
2797         (WebCore::RealtimeMediaSourceCenter::createMediaStream):
2798         (WebCore::RealtimeMediaSourceCenter::validateRequestConstraints):
2799         * platform/mediastream/RealtimeMediaSourceCenter.h:
2800         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
2801         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
2802         * platform/mock/MockRealtimeAudioSource.cpp:
2803         * platform/mock/MockRealtimeVideoSource.cpp:
2804
2805 2017-11-30  Alex Christensen  <achristensen@webkit.org>
2806
2807         Extra PerformanceEntryList entry after iframe navigation
2808         https://bugs.webkit.org/show_bug.cgi?id=178433
2809
2810         Reviewed by Joseph Pecoraro.
2811
2812         Test: http/tests/security/PerformanceEntryList-parent-only-first-navigation.html
2813
2814         When an iframe is loaded, its main resource load should be reported to the parent frame's PerformanceEntryList.
2815         Subsequent main resource loads should not.
2816
2817         * loader/FrameLoader.h:
2818         (WebCore::FrameLoader::shouldReportResourceTimingToParentFrame):
2819         * loader/ResourceTimingInformation.cpp:
2820         (WebCore::ResourceTimingInformation::addResourceTiming):
2821
2822 2017-11-30  Zalan Bujtas  <zalan@apple.com>
2823
2824         [Simple line layout] Incorrect repaint rect with vertically shrinking content and bottom-padding.
2825         https://bugs.webkit.org/show_bug.cgi?id=180223
2826         <rdar://problem/34122210>
2827
2828         Reviewed by Simon Fraser.
2829
2830         Repaint rect should be extended all the way to bottom border/padding.
2831
2832         Test: fast/repaint/simple-line-layout-shrinking-content.html
2833
2834         * rendering/RenderBlockFlow.cpp:
2835         (WebCore::RenderBlockFlow::layoutSimpleLines):
2836
2837 2017-11-30  Stephan Szabo  <stephan.szabo@sony.com>
2838
2839         Make LegacyCustomProtocolManager optional for network process
2840         https://bugs.webkit.org/show_bug.cgi?id=176230
2841
2842         Reviewed by Alex Christensen.
2843
2844         No new tests, only sets up feature define
2845
2846         * Configurations/FeatureDefines.xcconfig:
2847
2848 2017-11-30  Joseph Pecoraro  <pecoraro@apple.com>
2849
2850         [Cocoa] Fix CVPixelBuffer leak
2851         https://bugs.webkit.org/show_bug.cgi?id=180224
2852
2853         Reviewed by Youenn Fablet.
2854
2855         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.cpp:
2856         (WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferFromVideoFrame):
2857         Adopt the newly created pixel buffer.
2858
2859         (WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):
2860         Release the format description as soon as we are done with it. Otherwise
2861         we could have bailed before releasing it.
2862
2863 2017-11-30  Simon Fraser  <simon.fraser@apple.com>
2864
2865         Improve filter logging
2866         https://bugs.webkit.org/show_bug.cgi?id=180182
2867
2868         Reviewed by Sam Weinig.
2869
2870         Add a parameter to FilterEffect::externalRepresentation() so that we can log extra
2871         data without breaking layout tests.
2872
2873         Add TextStream output for ColorSpace.
2874         
2875         Improve logging of FEComponentTransfer ComponentTransferFunctions by logging the data
2876         that's appropriate for the function type, and rebaseline affected tests.
2877
2878         * platform/graphics/Color.cpp:
2879         (WebCore::operator<<):
2880         * platform/graphics/Color.h:
2881         * platform/graphics/filters/FEBlend.cpp:
2882         (WebCore::FEBlend::externalRepresentation const):
2883         * platform/graphics/filters/FEBlend.h:
2884         * platform/graphics/filters/FEColorMatrix.cpp:
2885         (WebCore::FEColorMatrix::externalRepresentation const):
2886         * platform/graphics/filters/FEColorMatrix.h:
2887         * platform/graphics/filters/FEComponentTransfer.cpp:
2888         (WebCore::operator<<):
2889         (WebCore::FEComponentTransfer::externalRepresentation const):
2890         * platform/graphics/filters/FEComponentTransfer.h:
2891         * platform/graphics/filters/FEComposite.cpp:
2892         (WebCore::FEComposite::externalRepresentation const):
2893         * platform/graphics/filters/FEComposite.h:
2894         * platform/graphics/filters/FEConvolveMatrix.cpp:
2895         (WebCore::FEConvolveMatrix::externalRepresentation const):
2896         * platform/graphics/filters/FEConvolveMatrix.h:
2897         * platform/graphics/filters/FEDiffuseLighting.cpp:
2898         (WebCore::FEDiffuseLighting::externalRepresentation const):
2899         * platform/graphics/filters/FEDiffuseLighting.h:
2900         * platform/graphics/filters/FEDisplacementMap.cpp:
2901         (WebCore::FEDisplacementMap::externalRepresentation const):
2902         * platform/graphics/filters/FEDisplacementMap.h:
2903         * platform/graphics/filters/FEDropShadow.cpp:
2904         (WebCore::FEDropShadow::externalRepresentation const):
2905         * platform/graphics/filters/FEDropShadow.h:
2906         * platform/graphics/filters/FEFlood.cpp:
2907         (WebCore::FEFlood::externalRepresentation const):
2908         * platform/graphics/filters/FEFlood.h:
2909         * platform/graphics/filters/FEGaussianBlur.cpp:
2910         (WebCore::FEGaussianBlur::externalRepresentation const):
2911         * platform/graphics/filters/FEGaussianBlur.h:
2912         * platform/graphics/filters/FEMerge.cpp:
2913         (WebCore::FEMerge::externalRepresentation const):
2914         * platform/graphics/filters/FEMerge.h:
2915         * platform/graphics/filters/FEMorphology.cpp:
2916         (WebCore::FEMorphology::externalRepresentation const):
2917         * platform/graphics/filters/FEMorphology.h:
2918         * platform/graphics/filters/FEOffset.cpp:
2919         (WebCore::FEOffset::externalRepresentation const):
2920         * platform/graphics/filters/FEOffset.h:
2921         * platform/graphics/filters/FESpecularLighting.cpp:
2922         (WebCore::FESpecularLighting::externalRepresentation const):
2923         * platform/graphics/filters/FESpecularLighting.h:
2924         * platform/graphics/filters/FETile.cpp:
2925         (WebCore::FETile::externalRepresentation const):
2926         * platform/graphics/filters/FETile.h:
2927         * platform/graphics/filters/FETurbulence.cpp:
2928         (WebCore::FETurbulence::externalRepresentation const):
2929         * platform/graphics/filters/FETurbulence.h:
2930         * platform/graphics/filters/FilterEffect.cpp:
2931         (WebCore::FilterEffect::externalRepresentation const):
2932         (WebCore::operator<<):
2933         * platform/graphics/filters/FilterEffect.h:
2934         * platform/graphics/filters/SourceAlpha.cpp:
2935         (WebCore::SourceAlpha::externalRepresentation const):
2936         * platform/graphics/filters/SourceAlpha.h:
2937         * platform/graphics/filters/SourceGraphic.cpp:
2938         (WebCore::SourceGraphic::externalRepresentation const):
2939         * platform/graphics/filters/SourceGraphic.h:
2940         * rendering/svg/RenderSVGResourceFilter.cpp:
2941         (WebCore::RenderSVGResourceFilter::applyResource):
2942         * svg/graphics/filters/SVGFEImage.cpp:
2943         (WebCore::FEImage::externalRepresentation const):
2944         * svg/graphics/filters/SVGFEImage.h:
2945
2946 2017-11-30  Ryan Haddad  <ryanhaddad@apple.com>
2947
2948         Unreviewed build fix, removed unused lambda captures.
2949
2950         * workers/service/context/ServiceWorkerThread.cpp:
2951         (WebCore::ServiceWorkerThread::postFetchTask):
2952         (WebCore::ServiceWorkerThread::postMessageToServiceWorkerGlobalScope):
2953
2954 2017-11-30  Chris Dumez  <cdumez@apple.com>
2955
2956         Move SWClientConnection class out of server/ folder
2957         https://bugs.webkit.org/show_bug.cgi?id=180217
2958
2959         Reviewed by Brady Eidson.
2960
2961         Move SWClientConnection class out of server/ folder since the client connection
2962         lives in the WebProcess, not the Storage process.
2963
2964         * Sources.txt:
2965         * WebCore.xcodeproj/project.pbxproj:
2966         * workers/service/SWClientConnection.cpp: Renamed from Source/WebCore/workers/service/server/SWClientConnection.cpp.
2967         (WebCore::SWClientConnection::scheduleJob):
2968         (WebCore::SWClientConnection::finishedFetchingScript):
2969         (WebCore::SWClientConnection::failedFetchingScript):
2970         (WebCore::SWClientConnection::jobRejectedInServer):
2971         (WebCore::SWClientConnection::registrationJobResolvedInServer):
2972         (WebCore::SWClientConnection::unregistrationJobResolvedInServer):
2973         (WebCore::SWClientConnection::startScriptFetchForServer):
2974         (WebCore::SWClientConnection::postMessageToServiceWorkerClient):
2975         (WebCore::SWClientConnection::forEachContainer):
2976         (WebCore::SWClientConnection::updateRegistrationState):
2977         (WebCore::SWClientConnection::updateWorkerState):
2978         (WebCore::SWClientConnection::fireUpdateFoundEvent):
2979         (WebCore::SWClientConnection::notifyClientsOfControllerChange):
2980         * workers/service/SWClientConnection.h: Renamed from Source/WebCore/workers/service/server/SWClientConnection.h.
2981         * workers/service/ServiceWorkerContainer.cpp:
2982
2983 2017-11-30  Chris Dumez  <cdumez@apple.com>
2984
2985         ServiceWorkerThread's m_extendedEvents gets destroyed on the wrong thread
2986         https://bugs.webkit.org/show_bug.cgi?id=180216
2987
2988         Reviewed by Brady Eidson.
2989
2990         ServiceWorkerThread's m_extendedEvents gets destroyed on the wrong thread. Those events live on the worker
2991         thread so we should destroy them on the worker thread, not the main thread. To address the issue, m_extendedEvents
2992         was moved to ServiceWorkerGlobalScope, which actually lives on the right thread.
2993
2994         * workers/service/ServiceWorkerGlobalScope.cpp:
2995         (WebCore::ServiceWorkerGlobalScope::updateExtendedEventsSet):
2996         * workers/service/ServiceWorkerGlobalScope.h:
2997         * workers/service/context/ServiceWorkerThread.cpp:
2998         (WebCore::ServiceWorkerThread::postFetchTask):
2999         (WebCore::ServiceWorkerThread::postMessageToServiceWorkerGlobalScope):
3000         (WebCore::ServiceWorkerThread::updateExtendedEventsSet): Deleted.
3001         * workers/service/context/ServiceWorkerThread.h:
3002         (WebCore::ServiceWorkerThread::hasPendingEvents const): Deleted.
3003
3004 2017-11-30  Chris Dumez  <cdumez@apple.com>
3005
3006         SWServerToContextConnection / SWServerWorker do not need to be ThreadSafeRefCounted
3007         https://bugs.webkit.org/show_bug.cgi?id=180214
3008
3009         Reviewed by Brady Eidson.
3010
3011         SWServerToContextConnection / SWServerWorker do not need to be ThreadSafeRefCounted.
3012         RefCounted is sufficient as there is no longer any multithreading on server side.
3013
3014         * workers/service/server/SWServerToContextConnection.h:
3015         * workers/service/server/SWServerWorker.h:
3016
3017 2017-11-30  Chris Dumez  <cdumez@apple.com>
3018
3019         ServiceWorkerGlobalScope::skipWaiting() should resolve its promise
3020         https://bugs.webkit.org/show_bug.cgi?id=180204
3021
3022         Reviewed by Brady Eidson.
3023
3024         ServiceWorkerGlobalScope::skipWaiting() should resolve its promise, even if it is not
3025         implemented yet. For now, always reject the promise.
3026
3027         * workers/service/ServiceWorkerGlobalScope.cpp:
3028         (WebCore::ServiceWorkerGlobalScope::skipWaiting):
3029
3030 2017-11-30  Chris Dumez  <cdumez@apple.com>
3031
3032         Mark a few heap-allocated service worker types as WTF_MAKE_FAST_ALLOCATED
3033         https://bugs.webkit.org/show_bug.cgi?id=180212
3034
3035         Reviewed by Geoffrey Garen.
3036
3037         Mark a few heap-allocated service worker types as WTF_MAKE_FAST_ALLOCATED for performance.
3038
3039         * workers/service/server/SWOriginStore.h:
3040         * workers/service/server/SWServer.h:
3041         * workers/service/server/SWServerJobQueue.h:
3042         * workers/service/server/SWServerRegistration.h:
3043
3044 2017-11-30  Brady Eidson  <beidson@apple.com>
3045
3046         Make WorkerThread lifetime much more predictable.
3047         https://bugs.webkit.org/show_bug.cgi?id=180203
3048
3049         Reviewed by Chris Dumez.
3050
3051         No new tests (Fixes flakiness in existing and future tests).
3052
3053         The family of classes related to Workers has a complicated ownership model.
3054
3055         For Dedicated Workers, the WorkerThread object is owned by the WorkerMessagingProxy,
3056         which manages its own lifetime. Additionally, other object(s) have raw C++ references
3057         to it, and the expected lifetimes are described in comments scattered through a few files.
3058
3059         What it boils down to is that the "Worker" DOM object - which lives on the main thread - 
3060         is the key to the proper destruction of all of these objects.
3061
3062         For ServiceWorkers running in their own context process, there is no "Worker" on the main thread.
3063
3064         As a result, ServiceWorkers can get into a situation where their WorkerThread can be destroyed before
3065         their ServiceWorkerGlobalScope is destroyed on the running background thread.
3066
3067         There's no reason to not have WorkerThread guarantee its own lifetime until its background thread
3068         has actually completed.
3069
3070         * workers/WorkerThread.cpp:
3071         (WebCore::WorkerThread::workerThread): Protect the WorkerThread object during the entire runtime
3072           of the background thread itself, and release that protection on the main thread.
3073         * workers/WorkerThread.h:
3074
3075 2017-11-30  Chris Dumez  <cdumez@apple.com>
3076
3077         Populate self.registration.installing/waiting/active inside service workers
3078         https://bugs.webkit.org/show_bug.cgi?id=180168
3079
3080         Reviewed by Brady Eidson.
3081
3082         Populate self.registration.installing/waiting/active inside service workers.
3083         Also make sure the ServiceWorker's state properly gets updated inside
3084         service workers.
3085
3086         No new tests, extended existing test for self.registration.
3087
3088         * workers/service/ServiceWorker.cpp:
3089         (WebCore::ServiceWorker::scheduleTaskToUpdateState):
3090         * workers/service/context/SWContextManager.cpp:
3091         (WebCore::SWContextManager::forEachServiceWorkerThread):
3092         * workers/service/context/SWContextManager.h:
3093         * workers/service/context/ServiceWorkerThread.cpp:
3094         (WebCore::ServiceWorkerThread::fireInstallEvent):
3095         (WebCore::ServiceWorkerThread::fireActivateEvent):
3096         * workers/service/server/SWClientConnection.cpp:
3097         (WebCore::SWClientConnection::updateRegistrationState):
3098         (WebCore::SWClientConnection::updateWorkerState):
3099         (WebCore::SWClientConnection::fireUpdateFoundEvent):
3100         * workers/service/server/SWClientConnection.h:
3101
3102 2017-11-30  Chris Dumez  <cdumez@apple.com>
3103
3104         Rename RegistrationOptions to ServiceWorkerRegistrationOptions
3105         https://bugs.webkit.org/show_bug.cgi?id=180207
3106
3107         Reviewed by Geoffrey Garen.
3108
3109         Rename RegistrationOptions to ServiceWorkerRegistrationOptions as the name
3110         RegistrationOptions is too generic and likely to conflict. Also modernize
3111         ServiceWorkerRegistrationOptions' IPC decoder.
3112
3113         * workers/service/ServiceWorkerContainer.h:
3114         * workers/service/ServiceWorkerJobData.h:
3115         (WebCore::ServiceWorkerJobData::decode):
3116         * workers/service/ServiceWorkerRegistrationOptions.cpp:
3117         (WebCore::ServiceWorkerRegistrationOptions::isolatedCopy const):
3118         * workers/service/ServiceWorkerRegistrationOptions.h:
3119         (WebCore::ServiceWorkerRegistrationOptions::encode const):
3120         (WebCore::ServiceWorkerRegistrationOptions::decode):
3121
3122 2017-11-30  Darin Adler  <darin@apple.com>
3123
3124         [Mac] remove unneeded RetainPtr use introduced in r225142
3125         https://bugs.webkit.org/show_bug.cgi?id=180202
3126
3127         Reviewed by Tim Horton.
3128
3129         * editing/mac/DictionaryLookup.h: Changed out arguments back to NSDictionary ** instead
3130         of RetainPtr because these use autorelease.
3131
3132         * editing/mac/DictionaryLookup.mm:
3133         (WebCore::tokenRange): Use NSDictionary **.
3134         (WebCore::DictionaryLookup::rangeForSelection): Ditto.
3135         (WebCore::DictionaryLookup::rangeAtHitTestResult): Ditto.
3136         (WebCore::DictionaryLookup::stringForPDFSelection): Ditto.
3137
3138 2017-11-30  Chris Dumez  <cdumez@apple.com>
3139
3140         Mark ServiceWorkerGlobalScope as final
3141         https://bugs.webkit.org/show_bug.cgi?id=180201
3142
3143         Reviewed by Alex Christensen.
3144
3145         * workers/service/ServiceWorkerGlobalScope.h:
3146
3147 2017-11-30  Zan Dobersek  <zdobersek@igalia.com>
3148
3149         [CoordGraphics] Move CoordinatedGraphicsLayer painting behind Nicosia::PaintingEngine
3150         https://bugs.webkit.org/show_bug.cgi?id=180141
3151
3152         Reviewed by Carlos Garcia Campos.
3153
3154         Introduce a painting engine concept that's used to perform painting
3155         for a given GraphicsLayer object.
3156
3157         The Nicosia::PaintingEngine object is leveraged in the
3158         CoordinatedGraphicsLayer::updateContentBuffers() method. It's retrieved
3159         through the CoordinatedGraphicsLayerClient interface, with a new method
3160         introduced there for this purpose.
3161
3162         The Nicosia::PaintingEngine interface is kept simple for now, with only
3163         a single paint() method. The only current implementation is the
3164         PaintingEngineBasic class, which simply reuses the code that was
3165         previously in CoordinatedGraphicsLayer::updateContentBuffers(),
3166         maintaining the current functionality.
3167
3168         The Nicosia::PaintingEngine::create() function returns a new
3169         PaintingEngine object. For now it defaults to PaintingEngineBasic, but
3170         it could be configured at configure-time or even runtime in the future
3171         to return a more advanced engine implementation.
3172
3173         No new tests -- no change in behavior.
3174
3175         * platform/TextureMapper.cmake:
3176         * platform/graphics/nicosia/NicosiaPaintingEngine.cpp: Added.
3177         (Nicosia::PaintingEngine::create):
3178         * platform/graphics/nicosia/NicosiaPaintingEngine.h: Added.
3179         * platform/graphics/nicosia/NicosiaPaintingEngineBasic.cpp: Added.
3180         (Nicosia::PaintingEngineBasic::paint):
3181         * platform/graphics/nicosia/NicosiaPaintingEngineBasic.h: Added.
3182         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
3183         (WebCore::CoordinatedGraphicsLayer::updateContentBuffers):
3184         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
3185
3186 2017-11-30  Adrian Perez de Castro  <aperez@igalia.com>
3187
3188         [GStreamer] Builds fails with ENABLE_VIDEO=OFF due to GStreamer usage
3189         https://bugs.webkit.org/show_bug.cgi?id=179373
3190
3191         Reviewed by Xabier Rodriguez-Calvar.
3192
3193         This allows to build with WebAudio enabled even if video support is
3194         disabled by guarding usage of HTMLMediaElement with ENABLE(VIDEO).
3195
3196         No new tests needed.
3197
3198         * page/DeprecatedGlobalSettings.cpp:
3199         (WebCore::DeprecatedGlobalSettings::setGStreamerEnabled): Guard usage of HTMLMediaElement.
3200
3201 2017-11-29  Chris Dumez  <cdumez@apple.com>
3202
3203         ServiceWorker WebProcess sometimes crashes in JSVMClientData::~JSVMClientData()
3204         https://bugs.webkit.org/show_bug.cgi?id=180173
3205
3206         Reviewed by Alex Christensen.
3207
3208         The leak was caused by EventListeners remaining when destroying the VM, because
3209         JSEventListener refs the DOMWrapperWorld. To address the issue, we now call
3210         removeAllEventListeners() in the stop() method of ServiceWorkerContainer,
3211         ServiceWorkerRegistration and ServiceWorker. Those event listeners are no
3212         longer needed after ActiveDOMObject::stop() is called since the script
3213         execution context is about to be destroyed.
3214
3215         This is the same pattern used in IDBDatabase::stop(), IDBRequest::stop().
3216
3217         No new tests, already covered by existing test.
3218
3219         * workers/service/ServiceWorker.cpp:
3220         (WebCore::ServiceWorker::stop):
3221         * workers/service/ServiceWorkerContainer.cpp:
3222         (WebCore::ServiceWorkerContainer::stop):
3223         * workers/service/ServiceWorkerContainer.h:
3224         * workers/service/ServiceWorkerRegistration.cpp:
3225         (WebCore::ServiceWorkerRegistration::stop):
3226
3227 2017-11-29  Filip Pizlo  <fpizlo@apple.com>
3228
3229         GC should support isoheaps
3230         https://bugs.webkit.org/show_bug.cgi?id=179288
3231
3232         Reviewed by Saam Barati.
3233
3234         No new tests because no new behavior.
3235         
3236         Adopting changes in JSC Subspace API.
3237
3238         * ForwardingHeaders/runtime/JSDestructibleObjectHeapCellType.h: Added.
3239         * ForwardingHeaders/runtime/JSSegmentedVariableObjectHeapCellType.h: Added.
3240         * bindings/js/JSDOMWrapper.cpp:
3241         (WebCore::outputConstraintSubspaceFor):
3242         (WebCore::globalObjectOutputConstraintSubspaceFor):
3243         * bindings/js/JSDOMWrapper.h:
3244         * bindings/js/WebCoreJSClientData.cpp:
3245         (WebCore::JSVMClientData::JSVMClientData):
3246         * bindings/js/WebCoreJSClientData.h:
3247         (WebCore::JSVMClientData::outputConstraintSpace):
3248         (WebCore::JSVMClientData::globalObjectOutputConstraintSpace):
3249         * bindings/scripts/CodeGeneratorJS.pm:
3250         (GenerateHeader):
3251
3252 2017-11-29  Eric Carlson  <eric.carlson@apple.com>
3253
3254         [MediaStream] Clean up audio and video capture factories
3255         https://bugs.webkit.org/show_bug.cgi?id=180156
3256         <rdar://problem/35753435>
3257
3258         Reviewed by Youenn Fablet.
3259
3260         No new tests, no behavior change.
3261
3262         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
3263         (WebCore::RealtimeMediaSourceCenter::setAudioFactory): Deleted.
3264         (WebCore::RealtimeMediaSourceCenter::unsetAudioFactory): Deleted.
3265         (WebCore::RealtimeMediaSourceCenter::audioFactory): Deleted.
3266         (WebCore::RealtimeMediaSourceCenter::setVideoFactory): Deleted.
3267         (WebCore::RealtimeMediaSourceCenter::unsetVideoFactory): Deleted.
3268         (WebCore::RealtimeMediaSourceCenter::videoFactory): Deleted.
3269         (WebCore::RealtimeMediaSourceCenter::setAudioCaptureDeviceManager): Deleted.
3270         (WebCore::RealtimeMediaSourceCenter::unsetAudioCaptureDeviceManager): Deleted.
3271         (WebCore::RealtimeMediaSourceCenter::audioCaptureDeviceManager): Deleted.
3272         (WebCore::RealtimeMediaSourceCenter::setVideoCaptureDeviceManager): Deleted.
3273         (WebCore::RealtimeMediaSourceCenter::unsetVideoCaptureDeviceManager): Deleted.
3274         (WebCore::RealtimeMediaSourceCenter::videoCaptureDeviceManager): Deleted.
3275         * platform/mediastream/RealtimeMediaSourceCenter.h:
3276         (WebCore::RealtimeMediaSourceCenter::setAudioFactory):
3277         (WebCore::RealtimeMediaSourceCenter::unsetAudioFactory):
3278         * platform/mediastream/RealtimeMediaSourceSettings.cpp:
3279         (WebCore::RealtimeMediaSourceSettings::facingMode):
3280         (WebCore::RealtimeMediaSourceSettings::videoFacingModeEnum):
3281         (WebCore::userFacing): Deleted.
3282         (WebCore::environmentFacing): Deleted.
3283         (WebCore::leftFacing): Deleted.
3284         (WebCore::rightFacing): Deleted.
3285         * platform/mediastream/RealtimeMediaSourceSettings.h:
3286         (WebCore::RealtimeMediaSourceSettings::RealtimeMediaSourceSettings): Deleted.
3287         * platform/mediastream/mac/AVVideoCaptureSource.h:
3288         * platform/mediastream/mac/AVVideoCaptureSource.mm:
3289         (WebCore::AVVideoCaptureSource::create):
3290         (WebCore::AVVideoCaptureSource::~AVVideoCaptureSource):
3291         (WebCore::AVVideoCaptureSource::setupCaptureSession):
3292         (): Deleted.
3293         (WebCore::AVVideoCaptureSourceFactory::setVideoCapturePageState): Deleted.
3294         (WebCore::avVideoCaptureSourceFactory): Deleted.
3295         (WebCore::AVVideoCaptureSource::factory): Deleted.
3296         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
3297         (WebCore::videoCaptureSourceFactory):
3298         (WebCore::RealtimeMediaSourceCenterMac::audioFactory):
3299         (WebCore::RealtimeMediaSourceCenterMac::videoFactory):
3300         (WebCore::RealtimeMediaSourceCenterMac::audioCaptureDeviceManager):
3301         (WebCore::RealtimeMediaSourceCenterMac::videoCaptureDeviceManager):
3302         (WebCore::RealtimeMediaSourceCenterMac::RealtimeMediaSourceCenterMac): Deleted.
3303         (WebCore::RealtimeMediaSourceCenterMac::defaultAudioFactory): Deleted.
3304         (WebCore::RealtimeMediaSourceCenterMac::defaultVideoFactory): Deleted.
3305         (WebCore::RealtimeMediaSourceCenterMac::defaultAudioCaptureDeviceManager): Deleted.
3306         (WebCore::RealtimeMediaSourceCenterMac::defaultVideoCaptureDeviceManager): Deleted.
3307         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
3308         * platform/mock/MockRealtimeAudioSource.cpp:
3309         (WebCore::MockRealtimeAudioSource::~MockRealtimeAudioSource):
3310         (WebCore::MockRealtimeAudioSource::startProducingData):
3311         * platform/mock/MockRealtimeMediaSourceCenter.h:
3312         * platform/mock/MockRealtimeVideoSource.cpp:
3313         (WebCore::MockRealtimeVideoSource::~MockRealtimeVideoSource):
3314         (WebCore::MockRealtimeVideoSource::startProducingData):
3315         * platform/mock/MockRealtimeVideoSource.h:
3316
3317 2017-11-29  Wenson Hsieh  <wenson_hsieh@apple.com>
3318
3319         [Attachment Support] Implement SPI for clients to make an attachment element display in-place
3320         https://bugs.webkit.org/show_bug.cgi?id=180153
3321         <rdar://problem/35735252>
3322
3323         Reviewed by Tim Horton.
3324
3325         Adds SPI support for inserting attachments using in-place display style, and updating display options for
3326         existing attachments. See comments below for more detail.
3327
3328         Tests: WKAttachmentTests.InPlaceImageAttachmentToggleDisplayMode
3329                WKAttachmentTests.InPlaceImageAttachmentParagraphInsertion
3330                WKAttachmentTests.InPlaceVideoAttachmentInsertionWithinList
3331                WKAttachmentTests.InPlacePDFAttachmentCutAndPaste
3332
3333         * WebCore.xcodeproj/project.pbxproj:
3334         * editing/Editor.cpp:
3335         (WebCore::Editor::insertAttachment):
3336         (WebCore::Editor::insertAttachmentFromFile):
3337
3338         Update display options for the attachment before inserting into the document.
3339
3340         * editing/Editor.h:
3341         * html/AttachmentTypes.h: Added.
3342
3343         Add a new header to define the new attachment display types. This lets us avoid importing HTMLAttachmentElement.h
3344         and instead just import AttachmentTypes.h in some places in WebKit that only deal with plumbing
3345         AttachmentDisplayOptions to the web process.
3346
3347         (WebCore::AttachmentDisplayOptions::encode const):
3348         (WebCore::AttachmentDisplayOptions::decode):
3349
3350         Support serializing and deserializing attachment display options.
3351
3352         * html/HTMLAttachmentElement.cpp:
3353         (WebCore::HTMLAttachmentElement::setFile):
3354
3355         Regenerate the shadow root if needed when setting the file.
3356
3357         (WebCore::HTMLAttachmentElement::updateDisplayMode):
3358
3359         Introduce a new method to update the display mode of an attachment element. This builds up the shadow root of
3360         the attachment if it is displayed in-place.
3361
3362         (WebCore::HTMLAttachmentElement::ensureInnerImage):
3363         (WebCore::HTMLAttachmentElement::ensureInnerVideo):
3364
3365         Helpers to insert image and video elements into the shadow root if needed, and return the image or video element.
3366
3367         (WebCore::HTMLAttachmentElement::innerImage const):
3368         (WebCore::HTMLAttachmentElement::innerVideo const):
3369
3370         Helpers to retrieve existing image and video elements in the shadow root.
3371
3372         (WebCore::HTMLAttachmentElement::populateShadowRootIfNecessary):
3373
3374         Appends and configures the attachment element's shadow root for inline display, initializing an image or video
3375         element or neither, depending on the attachment type.
3376
3377         * html/HTMLAttachmentElement.h:
3378
3379         Introduce an AttachmentDisplayOptions struct which mirrors _WKAttachmentDisplayOptions in the WebKit layer. For
3380         now, this only contains a display mode enum.
3381
3382         * platform/audio/ios/AudioSessionIOS.mm:
3383
3384         Avoid this AVAudioSession assertion when targeting iOS simulator. AVAudioSession always throws this error when
3385         setting an audio session category in the simulator, even in a basic test app, since AVFoundation doesn't support
3386         audio sessions in the simulator.
3387
3388         (WebCore::AudioSession::setCategory):
3389
3390 2017-11-29  Simon Fraser  <simon.fraser@apple.com>
3391
3392         Missing layer content when animating elements on-screen
3393         https://bugs.webkit.org/show_bug.cgi?id=180178
3394         rdar://problem/34923438
3395
3396         Reviewed by Dean Jackson.
3397
3398         If a delayed animation starts, that animates layers from offscreen, then we would fail
3399         to run the logic that ensures that those layers have backing store.
3400
3401         Fix by ensuring that if any layer starts or ends a transform animation, we re-evaluate
3402         backing store attachment on all its descendants.
3403
3404         I tried to make a test, but layer flushing is timing-sensitive and the test would have taken
3405         5s, and not been reliable. There's a manual test in the bug.
3406
3407         * platform/graphics/ca/GraphicsLayerCA.cpp:
3408         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
3409         * platform/graphics/ca/GraphicsLayerCA.h:
3410
3411 2017-11-29  Youenn Fablet  <youenn@apple.com>
3412
3413         ServiceWorkerClient objects should be reused if there is already one existing with the same identifier
3414         https://bugs.webkit.org/show_bug.cgi?id=180143
3415
3416         Reviewed by Chris Dumez.
3417
3418         Covered by updated tests.
3419
3420         ServiceWorkerGlobalScope keeps a map of all live ServiceWorkerClient objects.
3421         Before creating a new client, it checks whether the map has one such object with the same identifier.
3422         If so, it reuses this object. Otherwise it creates either a ServiceWorkerWindowClient or ServiceWorkerClient.
3423