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