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