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