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