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