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