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