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