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