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