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