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