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