HTMLMediaElement: WebKitMediaKeys member name should be prefixed
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-02-14  Zan Dobersek  <zdobersek@igalia.com>
2
3         HTMLMediaElement: WebKitMediaKeys member name should be prefixed
4         https://bugs.webkit.org/show_bug.cgi?id=168297
5
6         Reviewed by Xabier Rodriguez-Calvar.
7
8         Rename the LEGACY_ENCRYPTED_MEDIA m_mediaKeys variable to m_webkitMediaKeys
9         so that it contains the legacy prefix, just like the API. This will make
10         room for the MediaKeys member variable that will be implemented under
11         the ENCRYPTED_MEDIA guards.
12
13         * html/HTMLMediaElement.cpp:
14         (WebCore::HTMLMediaElement::mediaPlayerCachedKeyForKeyId):
15         (WebCore::HTMLMediaElement::webkitSetMediaKeys):
16         * html/HTMLMediaElement.h:
17         (WebCore::HTMLMediaElement::webkitKeys):
18
19 2017-02-14  Carlos Garcia Campos  <cgarcia@igalia.com>
20
21         [GTK] Make DragImageRef a RefPtr instead of a plain pointer
22         https://bugs.webkit.org/show_bug.cgi?id=168296
23
24         Reviewed by Sergio Villar Senin.
25
26         Use RefPtr<cairo_surface_t> as DragImageRef for GTK+ port to avoid memory leaks.
27
28         * platform/DragImage.h:
29         * platform/gtk/DragImageGtk.cpp:
30         (WebCore::dragImageSize):
31         (WebCore::deleteDragImage):
32         (WebCore::scaleDragImage):
33         (WebCore::dissolveDragImageToFraction):
34         (WebCore::createDragImageFromImage):
35         (WebCore::createDragImageIconForCachedImageFilename):
36
37 2017-02-14  Vanessa Chipirrás Navalón  <vchipirras@igalia.com>
38
39         [GStreamer][MSE] Some GStreamer log messages are generated with the 'default' category
40         https://bugs.webkit.org/show_bug.cgi?id=168015
41
42         Reviewed by Xabier Rodriguez-Calvar.
43
44         The elements AppendPipeline, PlaybackPipeline, MediaSourceClientGstreamerMSE do not have
45         a defined Gstreamer log category, then the webkitmse category has been added to them.
46         WebKitMediaSourceGstreamer has its own category but was not declared at the beginning of
47         the .cpp file.
48
49         * platform/graphics/gstreamer/mse/AppendPipeline.cpp: Added webkitmse category.
50         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
51         Added webkitmse category and gst header.
52         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp: Added webkitmse category.
53         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
54         Added webkitmediasrc category.
55
56 2017-02-14  Carlos Garcia Campos  <cgarcia@igalia.com>
57
58         CookieManager only works with the default session
59         https://bugs.webkit.org/show_bug.cgi?id=168229
60
61         Reviewed by Alex Christensen.
62
63         Update cookie observer API to use a std::function instead of a function pointer and make it work with multiple
64         sessions in the backends that support it.
65
66         * platform/network/CookieStorage.h:
67         * platform/network/cf/CookieStorageCFNet.cpp:
68         (WebCore::cookieChangeCallbackMap):
69         (WebCore::notifyCookiesChanged):
70         (WebCore::startObservingCookieChanges):
71         (WebCore::stopObservingCookieChanges):
72         * platform/network/mac/CookieStorageMac.mm:
73         (-[WebCookieStorageObjCAdapter startListeningForCookieChangeNotificationsWithCallback:]):
74         (-[WebCookieStorageObjCAdapter stopListeningForCookieChangeNotifications]):
75         (WebCore::startObservingCookieChanges):
76         (WebCore::stopObservingCookieChanges):
77         * platform/network/soup/CookieStorageSoup.cpp:
78         (WebCore::cookieChangeCallbackMap):
79         (WebCore::soupCookiesChanged):
80         (WebCore::startObservingCookieChanges):
81         (WebCore::stopObservingCookieChanges):
82
83 2017-02-13  Antoine Quint  <graouts@apple.com>
84
85         REGRESSION: Update volume and scrubbing slider to match HI designs
86         https://bugs.webkit.org/show_bug.cgi?id=168170
87         <rdar://problem/28095266>
88
89         Reviewed by Dean Jackson.
90
91         We bring the designs of the control's background materials, scrubber and
92         volume slider up to spec.
93
94         The first important set of changes is that, on macOS, the materials and colors
95         were incorrect. Buttons and time labels now set a mix-blend-mode to correctly
96         appear vibrant against the media, and the controls bar, volume container
97         and tracks menu now use a new BackgroundTint node to correctly apply both
98         a backdrop-filter and blended tint above it.
99
100         The second important set of changes is the rendering of the sliders. Up to now
101         we would simply style the <input type="range"> track and thumb, applying solid
102         fills and strokes. We now draw sliders in two ways depending on the platform.
103         
104         On macOS, we draw the whole slider with a <canvas> element with "mix-blend-mode"
105         set to "plus-lighter". On iOS, we draw the track as a <div> with "mix-blend-mode"
106         set to "plus-darker" and draw the fill (up to the thumb) in the <canvas> with
107         no blend mode to obtain a pure white color, finally the thumb is rendered by the
108         <input> element. We couldn't draw the pure white color with the track in the
109         same <canvas> due to the "plus-darker" blend mode.
110
111         Test: media/modern-media-controls/background-tint/background-tint.html
112
113         * Modules/modern-media-controls/controls/airplay-button.css:
114         (button.airplay.on):
115         * Modules/modern-media-controls/controls/background-tint.css: Added.
116         (.background-tint):
117         (.background-tint,):
118         (.background-tint > .blur):
119         (.background-tint > .tint):
120         * Modules/modern-media-controls/controls/background-tint.js: Added.
121         (BackgroundTint):
122         * Modules/modern-media-controls/controls/ios-inline-media-controls.css:
123         (.media-controls.ios.inline .scrubber.slider):
124         (.media-controls.ios.inline .scrubber.slider > div):
125         (.media-controls.ios.inline .scrubber.slider > input::-webkit-slider-thumb):
126         (.media-controls.ios.inline .scrubber.slider > .fill): Deleted.
127         * Modules/modern-media-controls/controls/macos-compact-inline-media-controls.css:
128         (.media-controls.mac.inline.compact .volume-slider-container):
129         (.media-controls.mac.inline.compact .volume.slider):
130         (.media-controls.mac.inline.compact .scrubber.slider > input::-webkit-slider-thumb): Deleted.
131         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.css:
132         (.media-controls.mac.fullscreen > .controls-bar):
133         (.media-controls.mac.fullscreen > .controls-bar > .background-tint > div):
134         (.media-controls.mac.fullscreen .volume.slider):
135         (.media-controls.mac.fullscreen button.volume-up):
136         (.media-controls.mac.fullscreen button.rewind):
137         (.media-controls.mac.fullscreen button.forward):
138         (.media-controls.mac.fullscreen .buttons-container.right button):
139         (.media-controls.mac.fullscreen .scrubber):
140         (.media-controls.mac.fullscreen > .controls-bar button): Deleted.
141         (.media-controls.mac.fullscreen button.airplay): Deleted.
142         (.media-controls.mac.fullscreen button.aspect-ratio): Deleted.
143         (.media-controls.mac.fullscreen button.pip): Deleted.
144         (.media-controls.mac.fullscreen button.tracks): Deleted.
145         (.media-controls.mac.fullscreen button.fullscreen): Deleted.
146         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
147         * Modules/modern-media-controls/controls/macos-inline-media-controls.css:
148         (.media-controls.mac.inline .scrubber.slider):
149         (.media-controls.mac.inline .volume-slider-container):
150         (.media-controls.mac.inline .volume-slider-container > .background-tint):
151         (.media-controls.mac.inline .volume-slider-container > .background-tint > div):
152         (.media-controls.mac.inline .volume.slider):
153         (.media-controls.mac.inline button): Deleted.
154         (.media-controls.mac.inline button:active): Deleted.
155         (.media-controls.mac.inline > .controls-bar button): Deleted.
156         (.media-controls.mac.inline > .controls-bar,): Deleted.
157         (.media-controls.mac.inline .volume-slider-container:before): Deleted.
158         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
159         (MacOSInlineMediaControls.prototype.layout):
160         * Modules/modern-media-controls/controls/macos-media-controls.css: Added.
161         (.media-controls.mac button:active):
162         (.media-controls.mac > .controls-bar button):
163         (.media-controls.mac > .controls-bar .time-label):
164         (.media-controls.mac > .controls-bar .slider > canvas):
165         (.media-controls.mac > .controls-bar .slider > input::-webkit-slider-thumb):
166         * Modules/modern-media-controls/controls/scrubber.css: Removed.
167         * Modules/modern-media-controls/controls/scrubber.js:
168         (Scrubber):
169         (Scrubber.prototype.get buffered):
170         (Scrubber.prototype.set buffered):
171         (Scrubber.prototype.draw):
172         (Scrubber.prototype._drawMacOS):
173         (Scrubber.prototype._drawiOS):
174         * Modules/modern-media-controls/controls/slider.css:
175         (.slider):
176         (.slider > canvas,):
177         (.slider > canvas):
178         (.slider > input):
179         (.slider > input,): Deleted.
180         (.slider > .fill): Deleted.
181         (.slider > input::-webkit-slider-thumb): Deleted.
182         * Modules/modern-media-controls/controls/slider.js:
183         (Slider.prototype.set value):
184         (Slider.prototype.set width):
185         (Slider.prototype.commitProperty):
186         (Slider.prototype.layout):
187         (Slider.prototype.draw):
188         (Slider.prototype._handleInputEvent):
189         (Slider.prototype._handleChangeEvent):
190         (addRoundedRect):
191         (Slider.prototype._updateFill): Deleted.
192         * Modules/modern-media-controls/controls/start-button.css:
193         (button.start):
194         * Modules/modern-media-controls/controls/time-control.js:
195         * Modules/modern-media-controls/controls/time-label.css:
196         (.time-label):
197         * Modules/modern-media-controls/controls/tracks-panel.css:
198         (.tracks-panel):
199         (.tracks-panel > .background-tint > div):
200         (.tracks-panel > section):
201         (.tracks-panel > section:first-of-type):
202         (.tracks-panel > section > h3):
203         (.tracks-panel > section > ul):
204         (.tracks-panel > section > ul > li):
205         (.tracks-panel > section > ul > li:focus):
206         (.tracks-panel > section > ul > li.selected:before):
207         (.tracks-panel > section > ul > li.animated):
208         (.tracks-panel-section): Deleted.
209         (.tracks-panel-section:first-of-type): Deleted.
210         (.tracks-panel-section > h3): Deleted.
211         (.tracks-panel-section > ul): Deleted.
212         (.tracks-panel-section > ul > li): Deleted.
213         (.tracks-panel-section > ul > li:focus): Deleted.
214         (.tracks-panel-section > ul > li.selected:before): Deleted.
215         (.tracks-panel-section > ul > li.animated): Deleted.
216         * Modules/modern-media-controls/controls/tracks-panel.js:
217         (TracksPanel.prototype._childrenFromDataSource):
218         (TracksPanel.prototype._childrenFromDataSource.): Deleted.
219         * Modules/modern-media-controls/controls/volume-slider.js:
220         (VolumeSlider):
221         (VolumeSlider.prototype.handleEvent):
222         (VolumeSlider.prototype.draw):
223         * Modules/modern-media-controls/js-files:
224         * Modules/modern-media-controls/media/scrubbing-support.js:
225         (ScrubbingSupport.prototype.get mediaEvents):
226         (ScrubbingSupport.prototype.syncControl):
227         (ScrubbingSupport):
228
229 2017-02-13  Alex Christensen  <achristensen@webkit.org>
230
231         URLs with an invalid IPv4 address should be invalid
232         https://bugs.webkit.org/show_bug.cgi?id=168260
233
234         Reviewed by Tim Horton.
235
236         All URL hosts are fed through the IPv4 parser.  https://webkit.org/ doesn't
237         look enough like an IPv4 address to be considered an invalid IPv4 address, so 
238         we continue to the String host processing.  http://127.0.0.257 does, though, and
239         according to https://url.spec.whatwg.org/#concept-ipv4-parser parsing that URL
240         should fail.
241
242         Covered by newly passing web platform tests.
243
244         * platform/URLParser.cpp:
245         (WebCore::URLParser::parseIPv4Host):
246         (WebCore::URLParser::parseHostAndPort):
247         * platform/URLParser.h:
248
249 2017-02-13  Dan Bernstein  <mitz@apple.com>
250
251         Reverted r212275. It still breaks some Apple-internal builds.
252
253         * platform/spi/mac/TUCallSPI.h:
254
255 2017-02-13  Joseph Pecoraro  <pecoraro@apple.com>
256
257         Address ESLint warnings in modern-media-controls
258         https://bugs.webkit.org/show_bug.cgi?id=168224
259
260         Reviewed by Alexey Proskuryakov.
261
262         * Modules/modern-media-controls/controls/controls-bar.js:
263         * Modules/modern-media-controls/controls/fullscreen-button.js:
264         * Modules/modern-media-controls/controls/layout-node.js:
265         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
266         * Modules/modern-media-controls/controls/media-controls.js:
267         * Modules/modern-media-controls/controls/scheduler.js:
268         * Modules/modern-media-controls/controls/seek-button.js:
269         * Modules/modern-media-controls/controls/tracks-panel.js:
270         * Modules/modern-media-controls/controls/volume-slider.js:
271         * Modules/modern-media-controls/gesture-recognizers/gesture-recognizer.js:
272         * Modules/modern-media-controls/gesture-recognizers/pinch.js:
273         * Modules/modern-media-controls/media/fullscreen-support.js:
274         * Modules/modern-media-controls/media/media-controller.js:
275         * Modules/modern-media-controls/media/placard-support.js:
276         * Modules/modern-media-controls/media/status-support.js:
277         Address pedantic warnings.
278
279 2017-02-13  Dan Bernstein  <mitz@apple.com>
280
281         Restored changes from r212210 in a way that does not break the build.
282
283         * platform/spi/mac/TUCallSPI.h:
284
285 2017-02-13  Zalan Bujtas  <zalan@apple.com>
286
287         FontCascade::widthForSimpleText should skip applyTransforms() when kerning and ligatures are off.
288         https://bugs.webkit.org/show_bug.cgi?id=168251
289         <rdar://problem/30498102>
290
291         Reviewed by Antti Koivisto.
292
293         Covered by existing (perf)tests.
294
295         * platform/graphics/FontCascade.cpp:
296         (WebCore::FontCascade::widthForSimpleText):
297
298 2017-02-12  Brian Burg  <bburg@apple.com>
299
300         Web Inspector: expose system user interface layout direction through InspectorFrontendHost
301         https://bugs.webkit.org/show_bug.cgi?id=168209
302         <rdar://problem/11573736>
303
304         Reviewed by Joseph Pecoraro.
305
306         Forward the UserInterfaceLayoutDirection of the inspector page. If the WebKit client has
307         properly set the UI directionality from system settings in PageClient, this will get inherited
308         automatically by the Inspector's WebPage instance.
309
310         * inspector/InspectorFrontendClient.h:
311         * inspector/InspectorFrontendClientLocal.cpp:
312         (WebCore::InspectorFrontendClientLocal::userInterfaceLayoutDirection):
313         * inspector/InspectorFrontendClientLocal.h:
314
315         * inspector/InspectorFrontendHost.h:
316         * inspector/InspectorFrontendHost.idl:
317         * inspector/InspectorFrontendHost.cpp:
318         (WebCore::InspectorFrontendHost::userInterfaceLayoutDirection):
319         Expose the directionality to the frontend as "ltr" or "rtl" strings.
320
321 2017-02-13  Zalan Bujtas  <zalan@apple.com>
322
323         Simple line layout: Do not measure runs with trailing whitespace when kerning and ligatures are off.
324         https://bugs.webkit.org/show_bug.cgi?id=168247
325         <rdar://problem/30497288>
326
327         Reviewed by Antti Koivisto.
328
329         The width of the run is supposed to be the same with or without the trailing whitespace.
330
331         Covered by performance test.
332
333         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
334         (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style):
335         (WebCore::SimpleLineLayout::TextFragmentIterator::textWidth):
336         * rendering/SimpleLineLayoutTextFragmentIterator.h:
337
338 2017-02-13  Karim H  <karim@karhm.com>
339
340         Added the other missing BSTR roles tag names.
341         https://bugs.webkit.org/show_bug.cgi?id=165545
342
343         Reviewed by Chris Fleizach.
344
345         Test: accessibility/win/bstr-elements-role.html
346
347         * accessibility/AccessibilityRenderObject.cpp:
348         (WebCore::shouldReturnTagNameAsRoleForMSAA):
349
350 2017-02-13  Youenn Fablet  <youennf@gmail.com>
351
352         [WebRTC] Creating RTCPeerConnection with libwebrtc backend is crashing on rwt
353         https://bugs.webkit.org/show_bug.cgi?id=168250
354
355         Reviewed by Alex Christensen.
356
357         Covered by webrtc tests in LayoutTests and in web-platform-tests.
358         Making mock peer connection factory keep a ref of the real libwebrtc peer connection factory.
359         That way, it can create real libwebrtc backends whenever requested by tests.
360
361         Moving LibWebRTCUtils.h routines as static LibWebRTCProvider methods.
362         In the future, we should make them no longer static.
363
364         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
365         (WebCore::LibWebRTCMediaEndpoint::doCreateOffer):
366         (WebCore::LibWebRTCMediaEndpoint::doCreateAnswer):
367         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
368         * WebCore.xcodeproj/project.pbxproj:
369         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp: Renamed from Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCUtils.cpp.
370         (WebCore::LibWebRTCProvider::callOnWebRTCNetworkThread):
371         (WebCore::LibWebRTCProvider::callOnWebRTCSignalingThread):
372         (WebCore::LibWebRTCProvider::factory):
373         (WebCore::LibWebRTCProvider::setPeerConnectionFactory):
374         (WebCore::createActualPeerConnection):
375         (WebCore::LibWebRTCProvider::createPeerConnection):
376         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
377         * platform/mediastream/libwebrtc/LibWebRTCUtils.h: Removed.
378         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
379         (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):
380         * testing/Internals.cpp:
381         * testing/MockLibWebRTCPeerConnection.cpp:
382         (WebCore::useMockRTCPeerConnectionFactory):
383         (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::gotLocalDescription):
384         (WebCore::releaseInNetworkThread):
385         (WebCore::MockLibWebRTCPeerConnection::SetLocalDescription):
386         (WebCore::MockLibWebRTCPeerConnection::SetRemoteDescription):
387         (WebCore::MockLibWebRTCPeerConnection::CreateOffer):
388         (WebCore::MockLibWebRTCPeerConnection::CreateAnswer):
389
390 2017-02-13  Anders Carlsson  <andersca@apple.com>
391
392         Simplify DragController::startDrag
393         https://bugs.webkit.org/show_bug.cgi?id=168240
394
395         Reviewed by Tim Horton.
396
397         Use early returns instead of assigning to a variable that's returned at the end of the function.
398
399         * page/DragController.cpp:
400         (WebCore::DragController::startDrag):
401
402 2017-02-13  Said Abou-Hallawa  <sabouhallawa@apple.com>
403
404         The current frame of an image should not deleted if another frame is asynchronously being decoded
405         https://bugs.webkit.org/show_bug.cgi?id=167618
406
407         Reviewed by Simon Fraser.
408
409         Test: fast/images/animated-image-draw-while-decode.html
410
411         If the memory cache asks the BitmapImage to destroy all its frames while
412         the next frame is being decoded, a thread contention may happen. This can
413         happen when BitmapImage::draw() is called and the next frame is not ready
414         yet for drawing, so the current frame has to be drawn. This will invoke
415         a frame decoding in the same image from the drawing committing thread.
416
417         We can avoid that by destroying all the frames except the current frame if
418         the image is asynchronously decoding its frames. This should not add extra
419         memory overhead because building the image frame cache and then destroying
420         it, when needed, is an on-going process. The frames will be allocated and
421         decoded all the time and all of them can be destroyed except the current one.
422         
423         * platform/graphics/BitmapImage.cpp:
424         (WebCore::BitmapImage::destroyDecodedData):
425         (WebCore::BitmapImage::destroyDecodedDataIfNecessary):
426         The logic of destroying the ImageFrames was split among BitmapImage, ImageSource
427         and ImageFrameCache. Move all the logic to BitmapImage and have ImageFrameCache
428         be responsible only for destroying a range of ImageFrames.
429
430         (WebCore::BitmapImage::draw): add an ASSERT_IMPLIES to ensure the current frame
431         is ready to be rendered if the next frame is being decoded.
432         
433         * platform/graphics/BitmapImage.h: Move a const from ImageFrameCache.h to BitmapImage.h.
434
435         * platform/graphics/ImageFrameCache.cpp:
436         (WebCore::ImageFrameCache::destroyDecodedData):
437         (WebCore::ImageFrameCache::destroyDecodedDataIfNecessary): Deleted.
438         * platform/graphics/ImageFrameCache.h:
439         (WebCore::ImageFrameCache::destroyAllDecodedData):
440         (WebCore::ImageFrameCache::destroyAllDecodedDataExcludeFrame):
441         (WebCore::ImageFrameCache::destroyDecodedDataBeforeFrame):
442         Make ImageFrameCache be responsible for destroying a range of ImageFrames.
443         This range might include all the frames, all the frames but up to a specific
444         frame, or all the frames but exclude one frame in the middle.
445         
446         * platform/graphics/ImageSource.cpp:
447         (WebCore::ImageSource::clear): No need to call clearFrameBufferCache() from clear().
448         The decision to call clearFrameBufferCache() or clear() is moved to
449         BitmapImage::destroyDecodedData().
450          
451         (WebCore::ImageSource::destroyDecodedData): Deleted.
452         (WebCore::ImageSource::destroyDecodedDataIfNecessary): Deleted.
453         These functions are replaced by another set of functions in ImageSource.h.
454         
455         * platform/graphics/ImageSource.h:
456         (WebCore::ImageSource::destroyAllDecodedData):
457         (WebCore::ImageSource::destroyAllDecodedDataExcludeFrame):
458         (WebCore::ImageSource::destroyDecodedDataBeforeFrame):
459         (WebCore::ImageSource::hasDecodingQueue):
460         These are new wrappers which call the corresponding ImageFrameCache functions.
461
462 2017-02-13  Myles C. Maxfield  <mmaxfield@apple.com>
463
464         [Cocoa] Stop soft-linking CTRunGetBaseAdvancesAndOrigins()
465         https://bugs.webkit.org/show_bug.cgi?id=168256
466
467         Reviewed by Alex Christensen.
468
469         Use of this function is already behind a platform guard.
470
471         No new tests because there is no behavior change.
472
473         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
474         (SOFT_LINK): Deleted.
475
476 2017-02-13  Jiewen Tan  <jiewen_tan@apple.com>
477
478         [WebCrypto] WebInspector should indicate webkitSubtle is deprecated
479         https://bugs.webkit.org/show_bug.cgi?id=165913
480         <rdar://problem/30477222>
481
482         Reviewed by Joseph Pecoraro.
483
484         Covered by existing tests.
485
486         * page/Crypto.cpp:
487         (WebCore::Crypto::webkitSubtle):
488
489 2017-02-13  Simon Fraser  <simon.fraser@apple.com>
490
491         Call WKDestroyRenderingResources() on iOS when tabs are backgrounded
492         https://bugs.webkit.org/show_bug.cgi?id=168261
493         rdar://problem/30481079
494
495         Reviewed by Tim Horton.
496
497         Add CABackingStoreCollectBlocking() to QuartzCoreSPI.h, and fix files in WebCore
498         that do a framework include.
499
500         * platform/graphics/cocoa/TextTrackRepresentationCocoa.mm:
501         * platform/graphics/cocoa/WebActionDisablingCALayerDelegate.h:
502         * platform/spi/cocoa/QuartzCoreSPI.h:
503         * platform/spi/mac/NSViewSPI.h:
504
505 2017-02-13  Youenn Fablet  <youenn@apple.com>
506
507         ASSERTION FAILED: !m_bodyLoader
508         https://bugs.webkit.org/show_bug.cgi?id=166986
509
510         Reviewed by Sam Weinig.
511
512         Refactoring to make the unset/set pending activity part of body loader.
513         This allows ensuring to not forget to do that by simply deleting the body loader.
514
515         * Modules/fetch/FetchResponse.cpp:
516         (WebCore::FetchResponse::fetch):
517         (WebCore::FetchResponse::BodyLoader::didSucceed):
518         (WebCore::FetchResponse::BodyLoader::didFail):
519         (WebCore::FetchResponse::BodyLoader::BodyLoader):
520         (WebCore::FetchResponse::BodyLoader::~BodyLoader):
521         (WebCore::FetchResponse::stop):
522         * Modules/fetch/FetchResponse.h:
523
524 2017-02-13  Aakash Jain  <aakash_jain@apple.com>
525
526         Remove unused WebCoreThreadSafe.h
527         https://bugs.webkit.org/show_bug.cgi?id=168236
528
529         Reviewed by Dan Bernstein.
530
531         * platform/ios/wak/WebCoreThreadSafe.h: Removed.
532         * WebCore.xcodeproj/project.pbxproj: Removed WebCoreThreadSafe.h
533         * platform/ios/wak/WebCoreThread.mm: Removed WebCoreThreadSafe.h and included WAKWindow.h directly
534
535 2017-02-13  Anders Carlsson  <andersca@apple.com>
536
537         Fix iOS build.
538
539         * platform/ios/DragImageIOS.mm:
540         (WebCore::deleteDragImage):
541
542 2017-02-13  Sam Weinig  <sam@webkit.org>
543
544         Rename MediaQueryExp.h/cpp to MediaQueryExpression.h/cpp
545         https://bugs.webkit.org/show_bug.cgi?id=168249
546
547         Reviewed by Dean Jackson.
548
549         Fix a FIXME and rename MediaQueryExp.h/cpp to match the class it contains, MediaQueryExpression.
550
551         * CMakeLists.txt:
552         * WebCore.xcodeproj/project.pbxproj:
553         * css/CSSAllInOne.cpp:
554         * css/MediaQuery.h:
555         * css/MediaQueryEvaluator.h:
556         * css/MediaQueryExp.cpp: Removed.
557         * css/MediaQueryExp.h: Removed.
558         * css/MediaQueryExpression.cpp: Copied from Source/WebCore/css/MediaQueryExp.cpp.
559         * css/MediaQueryExpression.h: Copied from Source/WebCore/css/MediaQueryExp.h.
560         * css/parser/MediaQueryParser.h:
561
562 2017-02-13  Aakash Jain  <aakash_jain@apple.com>
563
564         WAKResponder should be exported from WebCore
565         https://bugs.webkit.org/show_bug.cgi?id=168245
566
567         Reviewed by Dan Bernstein.
568
569         * platform/ios/wak/WAKResponder.h:
570
571 2017-02-13  Simon Fraser  <simon.fraser@apple.com>
572
573         Log to the History Channel in a few more places
574         https://bugs.webkit.org/show_bug.cgi?id=168252
575
576         Reviewed by Brady Eidson.
577
578         *** Aliens ***
579
580         * loader/HistoryController.cpp:
581         (WebCore::HistoryController::restoreScrollPositionAndViewState):
582         (WebCore::HistoryController::updateForReload):
583         * loader/NavigationScheduler.cpp:
584         (WebCore::NavigationScheduler::scheduleHistoryNavigation):
585         (WebCore::NavigationScheduler::timerFired):
586         (WebCore::NavigationScheduler::cancel):
587         * page/History.cpp:
588         (WebCore::History::go):
589
590 2017-02-13  Alex Christensen  <achristensen@webkit.org>
591
592         Percent should be allowed in non-special URL hosts
593         https://bugs.webkit.org/show_bug.cgi?id=168255
594
595         Reviewed by Tim Horton.
596
597         In the last few weeks, the spec has consolidated its sets of code points.
598         Now forbidden host code points replace the old invalid host code points with
599         the modification that percents are allowed in non-special hosts because we
600         percent-encode non-ascii code points in non-special hosts.
601         See https://url.spec.whatwg.org/#concept-opaque-host-parser
602
603         Covered by newly passing web platform tests.
604
605         * platform/URLParser.cpp:
606         (WebCore::isC0Control):
607         (WebCore::isInUserInfoEncodeSet):
608         (WebCore::URLParser::hasForbiddenHostCodePoint):
609         (WebCore::URLParser::parseHostAndPort):
610         (WebCore::isInvalidDomainCharacter): Deleted.
611         (WebCore::URLParser::hasInvalidDomainCharacter): Deleted.
612         * platform/URLParser.h:
613
614 2017-02-13  Anders Carlsson  <andersca@apple.com>
615
616         Fix Windows build.
617
618         * platform/win/PasteboardWin.cpp:
619         (WebCore::Pasteboard::setDragImage):
620
621 2017-02-13  Alex Christensen  <achristensen@webkit.org>
622
623         Fix Yosemite build after r211765
624         https://bugs.webkit.org/show_bug.cgi?id=168246
625         <rdar://problem/30494174>
626
627         Reviewed by Brady Eidson.
628
629         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
630         (SOFT_LINK):
631
632 2017-02-13  Anders Carlsson  <andersca@apple.com>
633
634         Add a DragImage class that wraps a DragImageRef
635         https://bugs.webkit.org/show_bug.cgi?id=168131
636
637         Reviewed by Beth Dakin.
638
639         This allows us to get rid of the explicit deleteDragImage calls and will make additional cleanup of the
640         various drag code paths possible. No functionality change.
641
642         * dom/DataTransfer.cpp:
643         (WebCore::DataTransfer::updateDragImage):
644         * page/DragController.cpp:
645         (WebCore::DragController::startDrag):
646         (WebCore::DragController::doImageDrag):
647         (WebCore::DragController::doSystemDrag):
648         * page/DragController.h:
649         * platform/DragImage.cpp:
650         (WebCore::DragImage::DragImage):
651         (WebCore::DragImage::operator=):
652         (WebCore::DragImage::~DragImage):
653         * platform/DragImage.h:
654         * platform/Pasteboard.h:
655         * platform/StaticPasteboard.h:
656         * platform/mac/PasteboardMac.mm:
657         (WebCore::Pasteboard::setDragImage):
658
659 2017-02-13  Chris Dumez  <cdumez@apple.com>
660
661         Regression(r211455): ASSERTION FAILED: frameView || pageCacheState() == InPageCache in com.apple.WebCore: WebCore::Document::destroyRenderTree
662         https://bugs.webkit.org/show_bug.cgi?id=168237
663         <rdar://problem/30494165>
664
665         Reviewed by Gavin Barraclough.
666
667         Drop bad assertion under document::destroyRenderTree() that was introduced in r211455.
668         The assertion seemed like a good idea but the issue is that CachedFrame::destroy()
669         reset's the document's pageCacheState before calling Document::prepareForDestruction().
670
671         No new tests, this fixes assertion hits on our bots.
672
673         * dom/Document.cpp:
674         (WebCore::Document::destroyRenderTree):
675
676 2017-02-13  Myles C. Maxfield  <mmaxfield@apple.com>
677
678         Update custom line breaking iterators to the latest version of Unicode
679         https://bugs.webkit.org/show_bug.cgi?id=168182
680
681         Reviewed by Zalan Bujtas.
682
683         Clean up our breaking code to be more descriptive about the difference between
684         line-break: auto vs line-break: loose | normal | strict. The only difference is
685         that we have some hardcoded tables to speed up character iteration for
686         line-break: auto.
687
688         Tests: TestWebKitAPI WebKit2.LineBreaking
689
690         * rendering/BreakLines.h:
691         (WebCore::nextBreakablePosition):
692         (WebCore::nextBreakablePositionIgnoringNBSP):
693         (WebCore::nextBreakablePositionWithoutShortcut):
694         (WebCore::nextBreakablePositionIgnoringNBSPWithoutShortcut):
695         (WebCore::isBreakable):
696         (WebCore::nextBreakablePositionNonLoosely): Deleted.
697         (WebCore::nextBreakablePositionLoosely): Deleted.
698         (WebCore::nextBreakablePositionLoose): Deleted.
699         (WebCore::nextBreakablePositionIgnoringNBSPLoose): Deleted.
700         * rendering/RenderText.cpp:
701         (WebCore::RenderText::computePreferredLogicalWidths):
702         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
703         (WebCore::SimpleLineLayout::nextBreakablePositionInSegment):
704         * rendering/line/BreakingContext.h:
705         (WebCore::BreakingContext::handleText):
706         (WebCore::BreakingContext::optimalLineBreakLocationForTrailingWord):
707
708 2017-02-13  Youenn Fablet  <youenn@apple.com>
709
710         Remove @getUserMedia identifier
711         https://bugs.webkit.org/show_bug.cgi?id=168216
712
713         Reviewed by Sam Weinig.
714
715         No change of behavior.
716
717         * Modules/mediastream/MediaDevices.idl:
718         * bindings/js/WebCoreBuiltinNames.h:
719
720 2017-02-13  Carlos Garcia Campos  <cgarcia@igalia.com>
721
722         [GTK] Non-accelerated drawing is broken with HiDPI
723         https://bugs.webkit.org/show_bug.cgi?id=168128
724
725         Reviewed by Michael Catanzaro.
726
727         When device scale factor changes, the page notifies the page overlay controller about it. Then overlay root
728         layers are created to be notified about the device scale factor. That causes us to enter in accelerated
729         compositing mode, because the graphics layer factory is called. But the render layer compositor doesn't really
730         enter in accelerated mode, because there aren't page overlays, the accelerated mode is not forced and the website
731         doesn't require acceleration either. This leaves our drawing area in an inconsistent state, it thinks it's in AC
732         mode because it has a layer tree host, but without a root layer attached, so nothing is rendered. The page
733         overlay controller doesn't need to create the layers when device scale factor changes, when an overlay is
734         installed, layers will be created with the current device scale factor anyway.
735
736         * page/PageOverlayController.cpp:
737         (WebCore::PageOverlayController::didChangeDeviceScaleFactor): Return early if not initialized yet.
738
739 2017-02-13  Csaba Osztrogonác  <ossy@webkit.org>
740
741         REGRESSION(r210845) Build broken with ENABLE_MHTML disabled
742         https://bugs.webkit.org/show_bug.cgi?id=167771
743
744         Reviewed by Daniel Bates.
745
746         * loader/DocumentLoader.cpp:
747         (WebCore::DocumentLoader::commitData):
748
749 2017-02-12  Dan Bernstein  <mitz@apple.com>
750
751         Tried to fix USE(APPLE_INTERNAL_SDK) builds after r212211.
752
753         * platform/spi/mac/TUCallSPI.h: Reverted to r212210.
754
755 2017-02-12  Dan Bernstein  <mitz@apple.com>
756
757         Tried to fix USE(APPLE_INTERNAL_SDK) builds after r212211.
758
759         * platform/spi/mac/TUCallSPI.h:
760
761 2017-02-12  Dan Bernstein  <mitz@apple.com>
762
763         Tried to fix USE(APPLE_INTERNAL_SDK) builds after r212211.
764
765         * platform/spi/mac/TUCallSPI.h:
766
767 2017-02-12  Dan Bernstein  <mitz@apple.com>
768
769         Tried to fix USE(APPLE_INTERNAL_SDK) builds after r212211.
770
771         * platform/spi/mac/NSMenuSPI.h: Replaced declaration of deprecated method with its current
772           equivalent.
773
774 2017-02-12  Dan Bernstein  <mitz@apple.com>
775
776         Tried to fix USE(APPLE_INTERNAL_SDK) builds after r212211.
777
778         * platform/spi/mac/NSImmediateActionGestureRecognizerSPI.h:
779
780 2017-02-12  Ryosuke Niwa  <rniwa@webkit.org>
781
782         parserRemoveChild should unload subframes
783         https://bugs.webkit.org/show_bug.cgi?id=168151
784
785         Reviewed by Darin Adler.
786
787         Fix the bug that the adoption agency algorithm does not unload subframes as it disconnects nodes.
788
789         Also moved calls to nodeWillBeRemoved inside NoEventDispatchAssertion to expand on r211965.
790
791         Tests: fast/parser/adoption-agency-clear-focus-range.html
792                fast/parser/adoption-agency-unload-iframe-1.html
793                fast/parser/adoption-agency-unload-iframe-2.html
794
795         * dom/ContainerNode.cpp:
796         (WebCore::ContainerNode::takeAllChildrenFrom): Rewritten using idioms used in removeChildren and parserAppendChild.
797
798         Disconnect all subframes first since this can synchronously dispatch an unload event. Then update DOM ranges,
799         the focused element, and other states in the document.
800
801         Second, use the regular removeBetween, notifyChildNodeRemoved, childrenChanged sequence of calls to disconnect nodes
802         instead of a single call to removeDetachedChildren to properly disconnect child nodes since those nodes may have
803         already come live due to execution of synchronous scripts prior to the adoption agency algorithm has run, or in
804         response to the unload event we just dispatched.
805
806         Third, append these nodes using parserAppendChild to avoid dispatching mutation events.
807
808         (WebCore::willRemoveChild): Removed the call to nodeWillBeRemoved. It's now called within NoEventDispatchAssertion
809         in each call site of willRemoveChild and willRemoveChildren.
810         (WebCore::willRemoveChildren): Ditto.
811         (WebCore::ContainerNode::removeChild): Call nodeWillBeRemoved inside NoEventDispatchAssertion.
812         (WebCore::ContainerNode::replaceAllChildren): Call nodeWillBeRemoved inside NoEventDispatchAssertion.
813         (WebCore::ContainerNode::parserRemoveChild): Disconnect subframes and update document's states.
814
815         * html/parser/HTMLConstructionSite.cpp:
816         (WebCore::executeTakeAllChildrenAndReparentTask): Add a release assert that new parent does not already have a parent. 
817
818 2017-02-12  Ryosuke Niwa  <rniwa@webkit.org>
819
820         REGRESSION (r179497): Crash inside setAttributeNode
821         https://bugs.webkit.org/show_bug.cgi?id=168161
822         <rdar://problem/30451581>
823
824         Reviewed by Andreas Kling.
825
826         The bug was caused by setAttributeNode calling setAttributeInternal with the same element data as the one used
827         to call removeAttributeInternal despite of the fact removeAttributeInternal could have invoked arbitrary scripts
828         and mutated element's m_elementData.
829
830         Fixed the bug by calling with setAttributeInternal with the result of new invocation of ensureUniqueElementData().
831
832         Test: fast/dom/Attr/make-unique-element-data-while-replacing-attr.html
833
834         * dom/Element.cpp:
835         (WebCore::Element::setAttributeNode):
836
837 2017-02-12  Ryosuke Niwa  <rniwa@webkit.org>
838
839         Rebaseline bindings tests after r212207.
840
841         * bindings/scripts/test/JS/JSTestObj.cpp:
842         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
843
844 2017-02-12  Dan Bernstein  <mitz@apple.com>
845
846         [Cocoa] Some -respondsToSelector: checks are unnecessary
847         https://bugs.webkit.org/show_bug.cgi?id=168183
848
849         Reviewed by Tim Horton.
850
851         * English.lproj/Localizable.strings: Removed a string that’s no longer needed after the
852           change to WebKit2/Platform/mac/MenuUtilities.mm.
853
854         * editing/mac/DictionaryLookup.mm:
855         (WebCore::showPopupOrCreateAnimationController): Removed check whether
856           LULookupDefinitionModule responds to +showDefinitionForTerm:relativeToRect:ofView:options:.
857
858         * platform/cocoa/NetworkExtensionContentFilter.mm:
859         (WebCore::NetworkExtensionContentFilter::initialize): Changed to use
860           -[NEFilterSource setSourceAppIdentifier:], without checking, instead of
861           -setSourceAppBundleID:, which does not exist.
862
863         * platform/cocoa/ScrollController.mm:
864         (systemUptime): Deleted.
865         (WebCore::ScrollController::snapRubberBand): Use -[NSProcessInfo systemUptime] directly.
866
867         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
868         (WebCore::MediaPlaybackTargetPickerMac::showPlaybackTargetPicker): Remove unnecessary check.
869
870         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
871         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer): Ditto.
872         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenMode): Ditto.
873         (WebCore::MediaPlayerPrivateAVFoundationObjC::didPassCORSAccessCheck): Replaced
874           -respondsToSelector: check with -isKindOfClass: check corresponding to the above cast.
875         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldDisableSleep): Removed unnecessary
876           check.
877
878         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm:
879         (WebCore::VideoFullscreenLayerManager::setVideoFullscreenLayer): Removed unnecessary checks.
880
881         * platform/graphics/mac/WebGLLayer.mm:
882         (-[WebGLLayer initWithGraphicsContext3D:]): Ditto.
883
884         * platform/mac/PlatformEventFactoryMac.mm:
885         (WebCore::typeForEvent): Removed check whether NSMenu responds to +menuTypeForEvent: and
886           all code to handle that case that it doesn’t.
887
888         * platform/mac/WebVideoFullscreenController.mm:
889         (-[WebVideoFullscreenController applicationDidResignActive:]): Removed check whether
890           NSWindow responds to -isOnActiveSpace.
891         (-[WebVideoFullscreenController updateMenuAndDockForFullscreen]): Removed check whether
892           NSApplication responds to -setPresentationOptions:
893
894         * platform/mac/WebVideoFullscreenInterfaceMac.mm:
895         (-[WebVideoFullscreenInterfaceMacObjC updateIsPlaying:newPlaybackRate:]): Removed
896           unnecessary -respondsToSelector: check.
897         (-[WebVideoFullscreenInterfaceMacObjC setVideoDimensions:]): Ditto.
898         (-[WebVideoFullscreenInterfaceMacObjC setUpPIPForVideoView:withFrame:inWindow:]): Ditto.
899
900         * platform/spi/cf/CFNetworkSPI.h: Moved declarations of
901           -[NSURLCache _initWithMemoryCapacity:diskCapacity:relativePath:] and
902           -[NSURLCache _CFURLCache] to the !USE(APPLE_INTERNAL_SDK) section.
903
904         * platform/spi/cocoa/NEFilterSourceSPI.h: Added declaration of NEFilterSource’
905           sourceAppIdentifier property to the !USE(APPLE_INTERNAL_SDK) section and deleted
906           unconditional declaration of sourceAppBundleID property, which doesn’t exist.
907
908         * platform/spi/cocoa/QuartzCoreSPI.h: Removed redundant declarations.
909
910         * platform/spi/ios/DataDetectorsUISPI.h: Moved declarations of DDDetectionController methods
911           from WebKit2/UIProcess/ios/{WKActionSheetAssistant,WKContentViewInteraction}.mm to here.
912           Removed an unused declaration.
913
914         * platform/spi/mac/LookupSPI.h: Moved redundant declarations into the
915           !USE(APPLE_INTERNAL_SDK) section.
916
917         * platform/spi/mac/NSMenuSPI.h: Changed to import NSMenu_Private.h when using the
918           Apple internal SDK. Cleaned up the declarations for the other case.
919
920         * platform/spi/mac/TUCallSPI.h: Changed to import TUCall_Strings.h when use the Apple
921           internal SDK.
922
923 2017-02-11  Sam Weinig  <sam@webkit.org>
924
925         Remove the remaining functions out of JSDOMBinding
926         https://bugs.webkit.org/show_bug.cgi?id=168179
927
928         Reviewed by Darin Adler.
929
930         Move utility functions into more appropriate locations.
931         - Move hasIteratorMethod to runtime/IteratorOperations.h
932         - Move nonCachingStaticFunctionGetter to runtime/Lookup.h
933         - Move addImpureProperty to CommonVM
934
935         Remove toJS overload that took a Vector<T>. Replace it's usage
936         with toJS<IDLSequence<T>> usage. To make this work, added two
937         new types, IDLIDBKeyData and IDLIDBValue.
938
939         * Modules/indexeddb/IDBCursor.cpp:
940         (WebCore::IDBCursor::setGetResult):
941         * Modules/indexeddb/IDBRequest.cpp:
942         (WebCore::IDBRequest::setResult):
943         (WebCore::IDBRequest::setResultToStructuredClone):
944         Adopt JSDOMConvert infrastructure for conversions using new types.
945
946         * bindings/IDLTypes.h:
947         * bindings/js/JSDOMConvertIndexedDB.h:
948         (WebCore::JSConverter<IDLIDBKeyData>::convert):
949         (WebCore::JSConverter<IDLIDBValue>::convert):
950         Add new types for IDBKeyData and IDBValue.
951
952         * bindings/js/CommonVM.cpp:
953         (WebCore::addImpureProperty):
954         * bindings/js/CommonVM.h:
955         Move addImpureProperty here from JSDOMBinding.
956
957         * bindings/js/IDBBindingUtilities.cpp:
958         (WebCore::idbKeyDataToScriptValue): Deleted.
959         * bindings/js/IDBBindingUtilities.h:
960         Remove unused idbKeyDataToScriptValue, and group like functions
961         together.
962
963         * bindings/js/JSDOMBinding.cpp: Removed.
964         * bindings/js/JSDOMBinding.h:
965         (WebCore::nonCachingStaticFunctionGetter): Deleted.
966         (WebCore::toJS): Deleted.
967         Move/remove functions.
968
969         * bindings/js/JSDOMConvertUnion.h:
970         Update for move of hasIteratorMethod to runtime/IteratorOperations.h
971
972         * bindings/js/JSDOMWindowCustom.cpp:
973         * bindings/js/JSHTMLDocumentCustom.cpp:
974         * bindings/js/JSLocationCustom.cpp:
975         Update for move of nonCachingStaticFunctionGetter to runtime/Lookup.h
976
977         * bindings/js/JSSubtleCryptoCustom.cpp:
978         Remove unneeded include of runtime/IteratorOperations.h
979
980         * bindings/scripts/CodeGeneratorJS.pm:
981         (GenerateOverloadedFunctionOrConstructor):
982         Include runtime/IteratorOperations when needing to distinguish a sequence.
983
984         * html/HTMLDocument.cpp:
985         Replace include of JSDOMBinding.h with CommonVM.h for addImpureProperty.
986
987 2017-02-12  Carlos Garcia Campos  <cgarcia@igalia.com>
988
989         [GTK] Handle caps lock indicator in event modifiers
990         https://bugs.webkit.org/show_bug.cgi?id=168186
991
992         Reviewed by Michael Catanzaro.
993
994         Add helper function to check if caps lock is present in the given modifiers. We need this because in GDK
995         GDK_LOCK_MASK might be either CapsLock or ShiftLock in X11. We use this new method in all platform event
996         implementations to add the appropriate modifiers.
997
998         Fixes: fast/events/special-key-events-in-input-text.html
999
1000         * platform/PlatformKeyboardEvent.h:
1001         * platform/gtk/PlatformKeyboardEventGtk.cpp:
1002         (WebCore::modifiersForGdkKeyEvent):
1003         (WebCore::PlatformKeyboardEvent::modifiersContainCapsLock):
1004         * platform/gtk/PlatformMouseEventGtk.cpp:
1005         (WebCore::PlatformMouseEvent::PlatformMouseEvent):
1006         * platform/gtk/PlatformWheelEventGtk.cpp:
1007         (WebCore::PlatformWheelEvent::PlatformWheelEvent):
1008
1009 2017-02-11  Sam Weinig  <sam@webkit.org>
1010
1011         Remove custom bindings for XSLTProcessor.idl
1012         https://bugs.webkit.org/show_bug.cgi?id=168174
1013
1014         Reviewed by Andreas Kling.
1015
1016         * CMakeLists.txt:
1017         * WebCore.xcodeproj/project.pbxproj:
1018         * bindings/js/JSBindingsAllInOne.cpp:
1019         * bindings/js/JSXSLTProcessorCustom.cpp: Removed.
1020         Remove file.
1021  
1022         * bindings/js/JSDOMBinding.cpp:
1023         (WebCore::jsStringOrUndefined): Deleted.
1024         * bindings/js/JSDOMBinding.h:
1025         Remove now unused jsStringOrUndefined.
1026
1027         * xml/XSLTProcessor.cpp:
1028         (WebCore::XSLTProcessor::setParameter):
1029         (WebCore::XSLTProcessor::getParameter):
1030         (WebCore::XSLTProcessor::removeParameter):
1031         * xml/XSLTProcessor.idl:
1032         Replace custom bindings bindings with early returns. One subtle difference
1033         between the custom bindings and this, is that getParameter will return 
1034         jsNull() rather than jsUndefined() for null String returns. This matches
1035         all other bindings.
1036
1037 2017-02-11  Olivier Blin  <olivier.blin@softathome.com>
1038
1039         [GStreamer][MSE][EME] Fix decryptor assignment
1040         https://bugs.webkit.org/show_bug.cgi?id=168122
1041
1042         Reviewed by Michael Catanzaro.
1043
1044         The new decryptor is a floating reference so we should not use the
1045         adopt GRefPtr constructor, but use the regular assignment operator
1046         that will sink the object (clear the floating flag).
1047
1048         This fixes assertions in debug build.
1049
1050         See previous pipeline fix in r210851 and WPE commit
1051         06020b18831e1c0eead34e2c1a5a4b7d026c227d.
1052
1053         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
1054         (WebCore::AppendPipeline::parseDemuxerSrcPadCaps):
1055         Do not use adoptGRef(), it prevented the object from being sunk.
1056
1057 2017-02-11  Simon Fraser  <simon.fraser@apple.com>
1058
1059         Avoid a redundant scroll to 0,0 when navigating back to a url with no fragment
1060         https://bugs.webkit.org/show_bug.cgi?id=168177
1061
1062         Reviewed by Sam Weinig.
1063
1064         FrameView::scrollToFragment() is called from FrameLoader::scrollToFragmentWithParentBoundary()
1065         when navigating within the page. If the URL had no fragment identifier, this code would
1066         call into FrameView::scrollToAnchor() with an empty name, where maintainScrollPositionAtAnchor()
1067         used the document as the anchor, thus scrolling to 0,0. Later, history().restoreScrollPositionAndViewState()
1068         the restores the scroll position from history.
1069         
1070         This scroll to 0,0 happened to be not visible to the page because of scroll event
1071         coalescing, but it makes implementation of history.scrollRestoration harder, so avoid it
1072         by just returning early from FrameView::scrollToFragment() if there is no fragment,
1073         making sure to clear the document's CSSTarget.
1074
1075         * dom/Document.cpp:
1076         (WebCore::Document::setCSSTarget):
1077         * page/FrameView.cpp:
1078         (WebCore::FrameView::scrollToFragment):
1079         (WebCore::FrameView::scrollToAnchor):
1080
1081 2017-02-11  Chris Dumez  <cdumez@apple.com>
1082
1083         Implement URL's toJSON()
1084         https://bugs.webkit.org/show_bug.cgi?id=167979
1085
1086         Reviewed by Sam Weinig.
1087
1088         Implement URL's toJSON() as per:
1089         - https://url.spec.whatwg.org/#dom-url-tojson
1090
1091         This is already supported by Firefox.
1092
1093         Also, drop URLUtils.idl as it is no longer in the specification.
1094         Merge its content to DOMURL.idl as per the URL specification.
1095
1096         Finally, mark href attribute as stringifier and drop the toString()
1097         operation to match the specification. This fixes a bug where our
1098         toString property was not enumerable but should have been.
1099
1100         Tests: fast/url/url-tojson.html
1101                imported/w3c/web-platform-tests/url/url-tojson.html
1102
1103         * CMakeLists.txt:
1104         * DerivedSources.make:
1105         * WebCore.xcodeproj/project.pbxproj:
1106         * html/DOMURL.idl:
1107         * html/URLUtils.h:
1108         (WebCore::URLUtils<T>::toJSON):
1109         * html/URLUtils.idl: Removed.
1110
1111 2017-02-11  Carlos Garcia Campos  <cgarcia@igalia.com>
1112
1113         [GTK][EFL] Implement MIMETypeRegistry::getPreferredExtensionForMIMEType
1114         https://bugs.webkit.org/show_bug.cgi?id=168163
1115
1116         Reviewed by Michael Catanzaro.
1117
1118         It's missing causing several HTML anchor download tests to fail because the suggested filename missed the
1119         extension. This patch moves MIMETypeRegistry::appendFileExtensionIfNecessary() from the cocoa specific file to the
1120         common file because it's not actually platform specific. MIMETypeRegistry::getPreferredExtensionForMIMEType() is
1121         what platforms should implement.
1122
1123         Fixes: fast/dom/HTMLAnchorElement/anchor-download-user-triggered-synthetic-click.html
1124                fast/dom/HTMLAnchorElement/anchor-download.html
1125                fast/dom/HTMLAnchorElement/anchor-file-blob-download-no-extension.html
1126                fast/dom/HTMLAnchorElement/anchor-nodownload-set.html
1127
1128         * platform/MIMETypeRegistry.cpp:
1129         (WebCore::MIMETypeRegistry::appendFileExtensionIfNecessary):
1130         * platform/cocoa/MIMETypeRegistryCocoa.mm:
1131         (WebCore::MIMETypeRegistry::appendFileExtensionIfNecessary): Deleted.
1132         * platform/efl/MIMETypeRegistryEfl.cpp:
1133         (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType):
1134         * platform/gtk/MIMETypeRegistryGtk.cpp:
1135         (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType):
1136
1137 2017-02-11  Carlos Garcia Campos  <cgarcia@igalia.com>
1138
1139         Unreviewed. Update imageTitle translatable string.
1140
1141         To match mac port. Fixes fast/images/imageDocument-title.html.
1142
1143         * platform/gtk/LocalizedStringsGtk.cpp:
1144         (WebCore::imageTitle):
1145
1146 2017-02-10  John Wilander  <wilander@apple.com>
1147
1148         Updates to Resource Load Statistics: Get the right website data store and introduce timeout for user interaction
1149         https://bugs.webkit.org/show_bug.cgi?id=167474
1150         <rdar://problem/24681808>
1151         <rdar://problem/24703286>
1152         <rdar://problem/30290270>
1153
1154         This patch does the following:
1155         1. Gets the right website data store. API::WebsiteDataStore::defaultDataStore()
1156             does not provide the right data store.
1157         2. Introduces timeout for user interaction. A domain needs interaction every 30
1158             days to stay in that category.
1159         3. Adds grandfathered to the statistics model in preparation for grandfathering of
1160             existing data records.
1161         4. Adds test infrastructure to allow testing of the various rules in place for
1162             data records removal.
1163         5. Fixes various smaller bugs that were found as part of setting up the tests.
1164         6. Regresses the data records removal counting. We need to come up with a thread
1165             safe way of gathering removal statistics from more than one data store now
1166             that we potentially interact with multiple stores.
1167         7. Adds a first set of layout tests for resource load statistics.
1168
1169         Reviewed by Andy Estes.
1170
1171         Tests: http/tests/loading/resourceLoadStatistics/non-prevalent-resource-with-user-interaction.html
1172                http/tests/loading/resourceLoadStatistics/non-prevalent-resource-without-user-interaction.html
1173                http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction-timeout.html
1174                http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction.html
1175                http/tests/loading/resourceLoadStatistics/prevalent-resource-without-user-interaction.html
1176
1177         * dom/Document.cpp:
1178         (WebCore::Document::updateLastHandledUserGestureTimestamp):
1179             This now calls ResourceLoadObserver::logUserInteraction() every time since
1180             we want to keep track of the most recent user interaction.
1181         * loader/ResourceLoadObserver.cpp:
1182         (WebCore::ResourceLoadObserver::statisticsStore):
1183             New getter used by WebResourceLoadStatisticsManager::resetToConsistentState().
1184         (WebCore::reduceTimeResolutionToOneDay):
1185             Convenience function.
1186         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
1187             Reduces time resolution for privacy reasons.
1188         (WebCore::ResourceLoadObserver::logUserInteraction):
1189         (WebCore::ResourceLoadObserver::clearUserInteraction):
1190         (WebCore::ResourceLoadObserver::hasHadUserInteraction):
1191         (WebCore::ResourceLoadObserver::setPrevalentResource):
1192         (WebCore::ResourceLoadObserver::isPrevalentResource):
1193         (WebCore::ResourceLoadObserver::clearPrevalentResource):
1194         (WebCore::ResourceLoadObserver::setTimeToLiveUserInteraction):
1195         (WebCore::ResourceLoadObserver::fireDataModificationHandler):
1196             New functions that allow WebKitTestRunner to stage exact
1197             statistics, fire the handler, and test the outcome.
1198         * loader/ResourceLoadObserver.h:
1199         * loader/ResourceLoadStatistics.cpp:
1200         (WebCore::ResourceLoadStatistics::encode):
1201         (WebCore::ResourceLoadStatistics::decode):
1202         (WebCore::ResourceLoadStatistics::toString):
1203         (WebCore::ResourceLoadStatistics::merge):
1204             Support for statistics mostRecentUserInteraction, grandfathered, and
1205             dataRecordsRemoved.
1206         * loader/ResourceLoadStatistics.h:
1207         * loader/ResourceLoadStatisticsStore.cpp:
1208         (WebCore::ResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
1209             New function that allows WebKitTestRunner to test 
1210             aging out of user interaction.
1211         (WebCore::ResourceLoadStatisticsStore::hasHadRecentUserInteraction):
1212             Now takes into account the timestamp and ages
1213             out user interaction.
1214         (WebCore::ResourceLoadStatisticsStore::prevalentResourceDomainsWithoutUserInteraction):
1215             Now makes use of ResourceLoadStatisticsStore::hasHadRecentUserInteraction().
1216         * loader/ResourceLoadStatisticsStore.h:
1217
1218 2017-02-10  Sam Weinig  <sam@webkit.org>
1219
1220         [WebIDL] Cleanup XMLHttpRequest's bindings
1221         https://bugs.webkit.org/show_bug.cgi?id=168067
1222
1223         Reviewed by Chris Dumez.
1224
1225         * bindings/js/JSDOMBinding.cpp:
1226         (WebCore::jsOwnedStringOrNull): Deleted.
1227         * bindings/js/JSDOMBinding.h:
1228         Remove jsOwnedStringOrNull and inline it into it's one use
1229         in JSXMLHttpRequestCustom.
1230
1231         * bindings/js/JSXMLHttpRequestCustom.cpp:
1232         (WebCore::JSXMLHttpRequest::responseText):
1233         (WebCore::SendFunctor::SendFunctor): Deleted.
1234         (WebCore::SendFunctor::line): Deleted.
1235         (WebCore::SendFunctor::column): Deleted.
1236         (WebCore::SendFunctor::url): Deleted.
1237         (WebCore::SendFunctor::operator()): Deleted.
1238         (WebCore::JSXMLHttpRequest::send): Deleted.
1239         * xml/XMLHttpRequest.cpp:
1240         (WebCore::XMLHttpRequest::send):
1241         * xml/XMLHttpRequest.h:
1242         Remove custom send, replacing it with a single send implementation that
1243         takes a variant.
1244
1245         * xml/XMLHttpRequest.idl:
1246         Cleanup the IDL to better match the spec. Update correct types where trivial.
1247
1248 2017-02-10  Chris Dumez  <cdumez@apple.com>
1249
1250         document.origin doesn't match spec
1251         https://bugs.webkit.org/show_bug.cgi?id=168022
1252
1253         Reviewed by Sam Weinig.
1254
1255         Update document.origin to return the origin in the expected format:
1256         - https://dom.spec.whatwg.org/#dom-document-origin
1257
1258         Change: "https_webkit.org_0 -> "https://webkit.org".
1259
1260         The new behavior matches Firefox and Chrome.
1261
1262         No new tests, updated existing tests.
1263
1264         * dom/Document.cpp:
1265         (WebCore::Document::origin):
1266
1267 2017-02-10  Daniel Bates  <dabates@apple.com>
1268
1269         Attempt to fix the build following <https://trac.webkit.org/changeset/212173>
1270         (https://bugs.webkit.org/show_bug.cgi?id=166774)
1271
1272         * dom/Document.cpp:
1273         (WebCore::Document::detachFromCachedFrame): Use ASSER_UNUSED() instead of ASSERT() since
1274         the parameter cachedFrame is unused in non-debug build.
1275
1276 2017-02-10  Daniel Bates  <dabates@apple.com>
1277
1278         Detach frame from document when entering page cache
1279         https://bugs.webkit.org/show_bug.cgi?id=166774
1280         <rdar://problem/29904368>
1281
1282         Reviewed by Chris Dumez.
1283
1284         When a page enters the page cache it is unnecessary for it to hold a reference to its
1285         associated frame because subsequent interactions with the page do not need to make use
1286         of it. Once a page exits the page cache we associate it with its frame.
1287
1288         * dom/Document.cpp:
1289         (WebCore::Document::frameDestroyed): Update comment to reflect the renaming of disconnectFromFrame().
1290         (WebCore::Document::attachToCachedFrame): Added.
1291         (WebCore::Document::detachFromCachedFrame): Added.
1292         (WebCore::Document::prepareForDestruction): Only call CSSAnimationController::detachFromDocument() if
1293         we have a frame. Substitute detachFromFrame() for disconnectFromFrame() as the latter was renamed to
1294         the former.
1295         (WebCore::Document::hasEverCalledWindowOpen): Deleted.
1296         (WebCore::Document::markHasCalledWindowOpen): Deleted.
1297         (WebCore::Document::disconnectFromFrame): Renamed to detachFromFrame.
1298         * dom/Document.h:
1299         (WebCore::Document::detachFromFrame): Renamed; formerly named disconnectFromFrame(). Changed
1300         visibility from public to private and made this function inline.
1301         * history/CachedFrame.cpp:
1302         (WebCore::CachedFrameBase::pruneDetachedChildFrames): Remove cached child frames that were
1303         removed from the page when it was in the page cache as there is no need to restore such frames.
1304         (WebCore::CachedFrameBase::restore): Call pruneDetachedChildFrames() before restoring the
1305         frame tree.
1306         (WebCore::CachedFrame::CachedFrame): Detach from the frame.
1307         (WebCore::CachedFrame::open): Assert that we have a document and re-attach the frame.
1308         (WebCore::CachedFrame::destroy): Update assertion as this function should only be called for a
1309         frameless document. Only detach the FrameView, DocumentLoader, and Page when the cached frame is for
1310         subframe and is associated with a Page object. Call CSSAnimationController::detachFromDocument() to
1311         detach the animation controller from the document as it is being destroyed. We have to do this here
1312         because the document does not have a frame. And Document::prepareForDestruction() only calls
1313         CSSAnimationController::detachFromDocument() if the document has a frame.
1314         * history/CachedFrame.h:
1315         * history/PageCache.cpp:
1316         (WebCore::canCachePage): Remove logic that prevents caching of a page that called window.open()
1317         or has an opener as it is feasible to keep such pages in the page cache.
1318         * html/HTMLFrameElementBase.cpp:
1319         (WebCore::HTMLFrameElementBase::finishedInsertingSubtree): Fix style nit.
1320         * loader/FrameLoader.cpp:
1321         (WebCore::FrameLoader::frameDetached): Only stop all loaders and stop active DOM objects if the
1322         page is not in- or about to enter- the page cache. A page in the page cache has finished loading
1323         and its active DOM objects are suspended. Also fix style nit in comment.
1324         (WebCore::FrameLoader::detachFromParent): Only stop all loaders if the page is not in- or about to
1325         enter- the page cache. A page in the page cache has finished loading. Also added a comment to explain
1326         that we protect the frame because stopAllLoaders() can cause the frame to be deallocated.
1327         * page/DOMWindow.cpp:
1328         (WebCore::DOMWindow::createWindow): Remove logic to call markHasCalledWindowOpen() as this
1329         function will be removed.
1330         * page/DiagnosticLoggingKeys.cpp:
1331         (WebCore::DiagnosticLoggingKeys::hasCalledWindowOpenKey): Deleted.
1332         (WebCore::DiagnosticLoggingKeys::hasOpenerKey): Deleted.
1333         * page/DiagnosticLoggingKeys.h:
1334         * page/Page.cpp:
1335         (WebCore::Page::openedByWindowOpen): Deleted.
1336         * page/Page.h:
1337         * page/Settings.in: Remove setting allowsPageCacheWithWindowOpener.
1338
1339 2017-02-10  Simon Fraser  <simon.fraser@apple.com>
1340
1341         REGRESSION (r211845): [ios-simulator] LayoutTest compositing/masks/solid-color-masked.html is a flaky failure
1342         https://bugs.webkit.org/show_bug.cgi?id=168054
1343
1344         Reviewed by Tim Horton.
1345
1346         When adding mask layers, there was an ordering dependency. There was a hack in GraphicsLayerCA::setVisibleAndCoverageRects()
1347         to propagate m_intersectsCoverageRect to masks. However, if GraphicsLayerCA::setVisibleAndCoverageRects()
1348         ran on the masked layer before the mask was added, nothing updated the "m_intersectsCoverageRect" state of the mask layer.
1349
1350         Fix by explicitly calling setVisibleAndCoverageRects() on the mask layer, passing the same rects and
1351         viewport-constrained state as for its host layer (we already assume that their geometry matches).
1352
1353         Tested by compositing/masks/solid-color-masked.html
1354
1355         * platform/graphics/ca/GraphicsLayerCA.cpp:
1356         (WebCore::GraphicsLayerCA::setVisibleAndCoverageRects):
1357         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
1358
1359 2017-02-10  Commit Queue  <commit-queue@webkit.org>
1360
1361         Unreviewed, rolling out r212154, r212154, and r212156.
1362         https://bugs.webkit.org/show_bug.cgi?id=168156
1363
1364         broke internal builds (Requested by smfr on #webkit).
1365
1366         Reverted changesets:
1367
1368         "Add a DragImage class that wraps a DragImageRef"
1369         https://bugs.webkit.org/show_bug.cgi?id=168131
1370         http://trac.webkit.org/changeset/212154
1371
1372         "Add a DragImage class that wraps a DragImageRef"
1373         https://bugs.webkit.org/show_bug.cgi?id=168131
1374         http://trac.webkit.org/changeset/212154
1375
1376         "Try to fix the iOS and Windows builds."
1377         http://trac.webkit.org/changeset/212156
1378
1379 2017-02-10  Csaba Osztrogonác  <ossy@webkit.org>
1380
1381         Fix the !ENABLE(WEBGL) build
1382         https://bugs.webkit.org/show_bug.cgi?id=168112
1383
1384         Reviewed by Alex Christensen.
1385
1386         * html/canvas/WebGLRenderingContextBase.h:
1387
1388 2017-02-10  Youenn Fablet  <youenn@apple.com>
1389
1390         [Fetch API] fetch fails when undefined is passed as headers
1391         https://bugs.webkit.org/show_bug.cgi?id=168043
1392
1393         Reviewed by Geoffrey Garen.
1394
1395         Covered by updated test.
1396
1397         * Modules/fetch/FetchInternals.js:
1398         (fillFetchHeaders): Exit early in case of undefined headers, since it is an optional parameter.
1399
1400 2017-02-10  Csaba Osztrogonác  <ossy@webkit.org>
1401
1402         Fix the !ENABLE(WEB_TIMING) build
1403         https://bugs.webkit.org/show_bug.cgi?id=168113
1404
1405         Reviewed by Alex Christensen.
1406
1407         * workers/WorkerGlobalScope.cpp:
1408         (WebCore::WorkerGlobalScope::WorkerGlobalScope):
1409
1410 2017-02-10  Joseph Pecoraro  <pecoraro@apple.com>
1411
1412         Update features.json for Performance Timing APIs
1413         https://bugs.webkit.org/show_bug.cgi?id=168148
1414
1415         Reviewed by Simon Fraser.
1416
1417         * features.json:
1418
1419 2017-02-10  Anders Carlsson  <andersca@apple.com>
1420
1421         Try to fix the iOS and Windows builds.
1422
1423         * platform/ios/DragImageIOS.mm:
1424         (WebCore::deleteDragImage):
1425         * platform/win/PasteboardWin.cpp:
1426         (WebCore::Pasteboard::setDragImage):
1427
1428 2017-02-10  Anders Carlsson  <andersca@apple.com>
1429
1430         Add a DragImage class that wraps a DragImageRef
1431         https://bugs.webkit.org/show_bug.cgi?id=168131
1432
1433         Reviewed by Beth Dakin.
1434
1435         This allows us to get rid of the explicit deleteDragImage calls and will make additional cleanup of the
1436         various drag code paths possible. No functionality change.
1437
1438         * dom/DataTransfer.cpp:
1439         (WebCore::DataTransfer::updateDragImage):
1440         * page/DragController.cpp:
1441         (WebCore::DragController::startDrag):
1442         (WebCore::DragController::doImageDrag):
1443         (WebCore::DragController::doSystemDrag):
1444         * page/DragController.h:
1445         * platform/DragImage.cpp:
1446         (WebCore::DragImage::DragImage):
1447         (WebCore::DragImage::operator=):
1448         (WebCore::DragImage::~DragImage):
1449         * platform/DragImage.h:
1450         * platform/Pasteboard.h:
1451         * platform/StaticPasteboard.h:
1452         * platform/mac/PasteboardMac.mm:
1453         (WebCore::Pasteboard::setDragImage):
1454
1455 2017-02-10  Simon Fraser  <simon.fraser@apple.com>
1456
1457         Make sure the "inwindow" flag propagates to TiledBackings for masks and reflections
1458         https://bugs.webkit.org/show_bug.cgi?id=168127
1459         rdar://problem/30467120
1460
1461         Reviewed by Tim Horton.
1462         
1463         Replace the special-case, but wrong, GraphicsLayer traversal in setIsInWindowIncludingDescendants()
1464         which forgot to hit masks and replica layers with a generic traverse() function, which
1465         is then used for setting 'inWindow' as well as resetting tracked repaints.
1466
1467         Tests: compositing/tiling/tiled-mask-inwindow.html
1468                compositing/tiling/tiled-reflection-inwindow.html
1469
1470         * page/PageOverlayController.cpp:
1471         (WebCore::PageOverlayController::layerWithDocumentOverlays):
1472         (WebCore::PageOverlayController::layerWithViewOverlays):
1473         * platform/graphics/GraphicsLayer.cpp:
1474         (WebCore::GraphicsLayer::setIsInWindow):
1475         (WebCore::GraphicsLayer::setReplicatedByLayer):
1476         (WebCore::GraphicsLayer::traverse):
1477         (WebCore::GraphicsLayer::setIsInWindowIncludingDescendants): Deleted.
1478         * platform/graphics/GraphicsLayer.h:
1479         * rendering/RenderLayerCompositor.cpp:
1480         (WebCore::RenderLayerCompositor::setIsInWindow):
1481         (WebCore::RenderLayerCompositor::resetTrackedRepaintRects):
1482         (WebCore::resetTrackedRepaintRectsRecursive): Deleted.
1483
1484 2017-02-09  Simon Fraser  <simon.fraser@apple.com>
1485
1486         Tiled layers are sometimes left with some tiles when outside the viewport
1487         https://bugs.webkit.org/show_bug.cgi?id=168104
1488         rdar://problem/30459055
1489
1490         Reviewed by Tim Horton.
1491
1492         When the coverage rect of a TiledBacking goes from a non-empty rect to an empty rect, we
1493         shouldn't just early return from TileGrid::revalidateTiles(), otherwise we are left with some
1494         tiles. Run through the function as normal, which will remove all the tiles for an empty coverage rect.
1495         
1496         Minor logging changes.
1497
1498         Test: tiled-drawing/tile-coverage-iframe-to-zero-coverage.html
1499
1500         * platform/graphics/ca/TileGrid.cpp:
1501         (WebCore::TileGrid::revalidateTiles):
1502
1503 2017-02-10  Zalan Bujtas  <zalan@apple.com>
1504
1505         Mail hangs when removing multiple rows from large table.
1506         https://bugs.webkit.org/show_bug.cgi?id=168103
1507         <rdar://problem/30090186>
1508
1509         Reviewed by Ryosuke Niwa.
1510
1511         DeleteSelectionCommand::removeNode doesn't actually destroy table structure items,
1512         but instead it removes their content. In order to be able to continue editing the table after
1513         the delete, we need to ensure that its cells' width and height are > 0. Currently we issue layout on
1514         each table item recursively.
1515         This patch delays the layout until after we've finished with the entire subtree delete (10x progression).
1516
1517         Performance test added.
1518
1519         * editing/DeleteSelectionCommand.cpp:
1520         (WebCore::DeleteSelectionCommand::insertBlockPlaceholderForTableCellIfNeeded):
1521         (WebCore::DeleteSelectionCommand::removeNodeUpdatingStates):
1522         (WebCore::shouldRemoveContentOnly):
1523         (WebCore::DeleteSelectionCommand::removeNode):
1524         * editing/DeleteSelectionCommand.h:
1525
1526 2017-02-10  Joseph Pecoraro  <pecoraro@apple.com>
1527
1528         [Resource Timing] Enable Resource Timing by default in Tests
1529         https://bugs.webkit.org/show_bug.cgi?id=168145
1530
1531         Reviewed by Ryosuke Niwa.
1532
1533         * loader/ResourceTimingInformation.cpp:
1534         (WebCore::ResourceTimingInformation::addResourceTiming):
1535         * testing/InternalSettings.cpp:
1536         (WebCore::InternalSettings::Backup::Backup):
1537         (WebCore::InternalSettings::Backup::restoreTo):
1538         (WebCore::InternalSettings::setResourceTimingEnabled): Deleted.
1539         * testing/InternalSettings.h:
1540         * testing/InternalSettings.idl:
1541         No longer needed for tests.
1542
1543 2017-02-10  Dan Bernstein  <mitz@apple.com>
1544
1545         [Cocoa] Add shouldChangeSelectedRange to WKWebProcessPlugInEditingDelegate
1546         https://bugs.webkit.org/show_bug.cgi?id=168097
1547
1548         Reviewed by Tim Horton.
1549
1550         Added a userTriggered argument to FrameSelection::setSelectedRange so that WebKit2 can
1551         indicate that changes should be agreed to by the delegate.
1552
1553         * editing/FrameSelection.cpp:
1554         (WebCore::FrameSelection::setSelectedRange): If the change is user-triggered, check with
1555           shouldChangeSelection.
1556         * editing/FrameSelection.h:
1557
1558 2017-02-10  Jonathan Bedard  <jbedard@apple.com>
1559
1560         Removing LayoutTestRelay
1561         https://bugs.webkit.org/show_bug.cgi?id=165927
1562
1563         Reviewed by Daniel Bates.
1564         Part 2
1565
1566         LayoutTestRelay uses SPI, since recent versions of the iOS SDK allow for installing apps on
1567         simulators through simctl (iOS 10 and later), use this functionality instead.
1568
1569         * platform/RuntimeApplicationChecks.mm:
1570         (WebCore::IOSApplication::isDumpRenderTree): Update comment to reflect removal of LayoutTestRelay.
1571
1572 2017-02-10  Youenn Fablet  <youenn@apple.com>
1573
1574         [WebRTC] Implement Outgoing libwebrtc audio source support
1575         https://bugs.webkit.org/show_bug.cgi?id=168118
1576
1577         Reviewed by Eric Carlson.
1578
1579         No new automated tests as we need the audio rendering to work to test the whole loop.
1580
1581         Using an AudioSampleDataSource to convert the captured data to libwebrtc expected format.
1582         Capturing and pushing data happens in the capture thread.
1583         Pulling of converted data happens in libwebrtc thread.
1584
1585         Introducing LibWebRTCAudioFormat.h to centralize libwbebrtc expected audio format.
1586
1587         * WebCore.xcodeproj/project.pbxproj:
1588         * platform/audio/WebAudioBufferList.cpp:
1589         (WebCore::WebAudioBufferList::WebAudioBufferList): Missing initialization leads to assertion failure.
1590         * platform/audio/mac/AudioSampleBufferList.cpp:
1591         (WebCore::AudioSampleBufferList::copyFrom): In case of interleaved channels, there is one buffer but two channels.
1592         * platform/audio/mac/AudioSampleDataSource.cpp:
1593         (WebCore::AudioSampleDataSource::pushSamples):
1594         (WebCore::AudioSampleDataSource::pullAvalaibleSamplesAsChunks):
1595         * platform/audio/mac/AudioSampleDataSource.h:
1596         * platform/mediastream/libwebrtc/LibWebRTCAudioFormat.h: Added.
1597         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
1598         (WebCore::libwebrtcAudioFormat):
1599         (WebCore::RealtimeOutgoingAudioSource::RealtimeOutgoingAudioSource):
1600         (WebCore::RealtimeOutgoingAudioSource::sourceMutedChanged):
1601         (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):
1602         (WebCore::RealtimeOutgoingAudioSource::pullAudioData):
1603         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
1604
1605 2017-02-10  Ryosuke Niwa  <rniwa@webkit.org>
1606
1607         HTMLConstructionSiteTask::Insert should never be called on a node with a parent
1608         https://bugs.webkit.org/show_bug.cgi?id=168099
1609
1610         Reviewed by Sam Weinig.
1611
1612         insertAlreadyParsedChild always use HTMLConstructionSiteTask::InsertAlreadyParsedChild instead
1613         of using HTMLConstructionSiteTask::Insert when fostering a child.
1614
1615         Also combine the step to take all children and re-parenting into a single task instead of
1616         separately issuing TakeAllChildren and Reparent tasks.
1617
1618         No new tests since this is a refactoring.
1619
1620         * html/parser/HTMLConstructionSite.cpp:
1621         (WebCore::insert): Now asserts that the child node never have a parent.
1622         (WebCore::executeInsertAlreadyParsedChildTask): Moved the code to remove the parent here.
1623         (WebCore::executeTakeAllChildrenAndReparentTask): Renamed from executeTakeAllChildrenTask
1624         now that this function also does the reparenting.
1625         (WebCore::executeTask):
1626         (WebCore::HTMLConstructionSite::reparent): Removed the variant only used with takeAllChildren.
1627         (WebCore::HTMLConstructionSite::insertAlreadyParsedChild): Always use InsertAlreadyParsedChild
1628         instead of calling fosterParent which uses Insert when fostering parents.
1629         (WebCore::HTMLConstructionSite::takeAllChildrenAndReparent): Renamed from takeAllChildren.
1630         * html/parser/HTMLConstructionSite.h:
1631         (WebCore::HTMLConstructionSiteTask:Operation):
1632         * html/parser/HTMLTreeBuilder.cpp:
1633         (WebCore::HTMLTreeBuilder::callTheAdoptionAgency):
1634
1635 2017-02-10  Dave Hyatt  <hyatt@apple.com>
1636
1637         [CSS Parser] Make intercap property values serialize correctly
1638         https://bugs.webkit.org/show_bug.cgi?id=168073
1639
1640         Reviewed by Zalan Bujtas.
1641
1642         Fix CSS value keywords to preserve case when the value contains capital
1643         letters. Examples include optimizeSpeed, translateX, scaleY, etc.
1644
1645         * css/CSSPrimitiveValueMappings.h:
1646         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
1647         (WebCore::CSSPrimitiveValue::operator EPointerEvents):
1648         (WebCore::CSSPrimitiveValue::operator TextRenderingMode):
1649         (WebCore::CSSPrimitiveValue::operator EImageRendering):
1650         (WebCore::CSSPrimitiveValue::operator EColorInterpolation):
1651         (WebCore::CSSPrimitiveValue::operator EColorRendering):
1652         (WebCore::CSSPrimitiveValue::operator EShapeRendering):
1653         * css/MediaQueryEvaluator.cpp:
1654         (WebCore::colorGamutEvaluate):
1655         * css/SVGCSSValueKeywords.in:
1656         * css/TransformFunctions.cpp:
1657         (WebCore::transformOperationType):
1658         (WebCore::transformsForValue):
1659         * css/makevalues.pl:
1660         * css/parser/CSSParserFastPaths.cpp:
1661         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
1662         (WebCore::parseTransformTranslateArguments):
1663         (WebCore::parseSimpleTransformValue):
1664         * css/parser/CSSPropertyParser.cpp:
1665         (WebCore::consumeTransformValue):
1666         * css/parser/CSSPropertyParserHelpers.cpp:
1667         (WebCore::CSSPropertyParserHelpers::parseColorFunctionParameters):
1668
1669 2017-02-10  Zan Dobersek  <zdobersek@igalia.com>
1670
1671         [EME] Implement MediaKeySession::load()
1672         https://bugs.webkit.org/show_bug.cgi?id=168041
1673
1674         Reviewed by Xabier Rodriguez-Calvar.
1675
1676         Implement the MediaKeySession::load() method, tracing the steps as they
1677         are defined in the EME specification. The only exception is step 8.3,
1678         which requires additional facility that tracks currently open sessions
1679         and provides information whether for a given session ID there's already
1680         a MediaKeySession that's not yet been closed.
1681
1682         Session ID sanitization is done through the CDM::sanitizeSessionId()
1683         method, which relays the task to the CDMPrivate implementation.
1684
1685         The CDMInstance::loadSession() virtual method is called with the session
1686         type, sanitized ID, the Document's origin (in string form) and the
1687         callback that's invoked upon completion of the task. The callback
1688         checks whether the operation was successful, or examines the reason for
1689         the load failure in case it wasn't, rejecting the promise in the latter
1690         case either immediately or in the following task at the latest.
1691
1692         When the load was successful, the optional known keys, expiration time
1693         and message are handled appropriately, and the promise is resolved.
1694
1695         MockCDM::sanitizeSessionId() implementation only treats
1696         'valid-loaded-session' as a valid session ID.
1697         MockCDMInstance::loadSession() implementation is kept slim for now, only
1698         providing the 'license-renewal' message when invoking the passed-in
1699         callback. Known keys and expiration time will also be tested once the
1700         relevant MediaKeySession algorithms are implemented.
1701
1702         Test: media/encrypted-media/mock-MediaKeySession-load.html
1703
1704         * Modules/encryptedmedia/CDM.cpp:
1705         (WebCore::CDM::sanitizeSessionId):
1706         * Modules/encryptedmedia/CDM.h:
1707         * Modules/encryptedmedia/CDMInstance.h:
1708         * Modules/encryptedmedia/CDMPrivate.h:
1709         * Modules/encryptedmedia/MediaKeySession.cpp:
1710         (WebCore::MediaKeySession::load):
1711         * testing/MockCDMFactory.cpp:
1712         (WebCore::MockCDM::sanitizeSessionId):
1713         (WebCore::MockCDMInstance::loadSession):
1714         * testing/MockCDMFactory.h:
1715
1716 2017-02-10  Zan Dobersek  <zdobersek@igalia.com>
1717
1718         [EME] Implement MediaKeySession::sessionClosed()
1719         https://bugs.webkit.org/show_bug.cgi?id=168039
1720
1721         Reviewed by Xabier Rodriguez-Calvar.
1722
1723         Implement the 'session closed' algorithm for MediaKeySession by
1724         following the specified steps. After this algorithm is run, the
1725         session should be considered closed, which we track via the m_closed
1726         member variable on the class. This is set to true before the promise
1727         that's accessible through the 'closed' attribute is resolved.
1728
1729         Because the algorithm requires the CDM instance to store any record
1730         of key usage when the session's type is 'persistent-usage-record', the
1731         storeRecordOfKeyUsage() virtual method is added to the CDMInstance
1732         interface. MockCDMInstance implementation is left unimplemented for now.
1733
1734         JSMediaKeySession::closed() accessor now has a custom implementation
1735         that creates a deferred promise for that object if there's none yet, and
1736         shares it with the wrapped class through the registerClosedPromise()
1737         method, storing a reference to the promise in the m_closedPromise
1738         member variable, or resolving the promise immediately if the session was
1739         already closed.
1740
1741         Test cases added to media/encrypted-media/mock-MediaKeySession-close.html.
1742
1743         * Modules/encryptedmedia/CDMInstance.h:
1744         * Modules/encryptedmedia/MediaKeySession.cpp:
1745         (WebCore::MediaKeySession::registerClosedPromise):
1746         (WebCore::MediaKeySession::sessionClosed):
1747         * Modules/encryptedmedia/MediaKeySession.h:
1748         * bindings/js/JSMediaKeySessionCustom.cpp:
1749         (WebCore::JSMediaKeySession::closed):
1750         * testing/MockCDMFactory.cpp:
1751         (WebCore::MockCDMInstance::storeRecordOfKeyUsage):
1752         * testing/MockCDMFactory.h:
1753
1754 2017-02-10  Zan Dobersek  <zdobersek@igalia.com>
1755
1756         [EME] Implement MediaKeySession::updateKeyStatuses(), MediaKeyStatusMap
1757         https://bugs.webkit.org/show_bug.cgi?id=167888
1758
1759         Reviewed by Xabier Rodriguez-Calvar.
1760
1761         Implement MediaKeySession::updateKeyStatuses(), transforming the passed-in
1762         KeyStatusVector into a Vector mapping the key IDs to MediaKeyStatus values.
1763         A keystatuseschange event is fired on the MediaKeySession object afterwards.
1764         The queueing of the task that runs the 'attemp to resume playback' on the
1765         related HTMLMediaElement objects isn't done yet since that algorithm isn't
1766         implemented yet.
1767
1768         The statuses Vector is stored on the MediaKeySession object. That Vector is
1769         then exposed through the MediaKeyStatusMap object, each such object being
1770         unique to one MediaKeySession object. The implementation of MediaKeyStatusMap
1771         thus keeps a reference to the session object as long as that object is alive,
1772         and queries the MediaKeySession::statuses() getter to access the Vector that
1773         contains status information for all the key IDs.
1774
1775         MediaKeyStatusMap::Iterator object keeps a reference to the MediaKeyStatusMap
1776         object and accesses the statuses by indexing into the status Vector of the
1777         related MediaKeySession object.
1778
1779         CDMInstance::updateLicense() now accepts the session ID string as the first
1780         argument, making it possible to specify which session should be updated.
1781
1782         MockCDMFactory::keysForSessionWithID() returns an optional reference to the
1783         Vector value in the session map that lists all the key IDs that are being
1784         stored for that session.
1785
1786         MockCDMInstance::updateLicense() now detects the 'keys-changed' entry in the
1787         passed-in response data, and upon detecting that constructs a KeyStatusVector
1788         object containing all the keys for that session. KeyStatus::Usable is returned
1789         for each object at the moment, but this should be adjustable in the future
1790         through additional parameters passed through the response data. The Vector
1791         object is then passed to the callback and is then passed to the 'update key
1792         statuses' algorithm in MediaKeySession.
1793
1794         Covered by a test case in media/encrypted-media/mock-MediaKeySession-update.html.
1795
1796         * Modules/encryptedmedia/CDMInstance.h:
1797         * Modules/encryptedmedia/MediaKeySession.cpp:
1798         (WebCore::MediaKeySession::MediaKeySession):
1799         (WebCore::MediaKeySession::~MediaKeySession):
1800         (WebCore::MediaKeySession::update):
1801         (WebCore::MediaKeySession::updateKeyStatuses):
1802         * Modules/encryptedmedia/MediaKeySession.h:
1803         * Modules/encryptedmedia/MediaKeyStatusMap.cpp:
1804         (WebCore::MediaKeyStatusMap::MediaKeyStatusMap):
1805         (WebCore::MediaKeyStatusMap::detachSession):
1806         (WebCore::MediaKeyStatusMap::size):
1807         (WebCore::keyIdsMatch):
1808         (WebCore::MediaKeyStatusMap::has):
1809         (WebCore::MediaKeyStatusMap::get):
1810         (WebCore::MediaKeyStatusMap::Iterator::Iterator):
1811         (WebCore::MediaKeyStatusMap::Iterator::next):
1812         * Modules/encryptedmedia/MediaKeyStatusMap.h:
1813         (WebCore::MediaKeyStatusMap::create):
1814         * Modules/encryptedmedia/MediaKeyStatusMap.idl:
1815         * testing/MockCDMFactory.cpp:
1816         (WebCore::MockCDMFactory::keysForSessionWithID):
1817         (WebCore::MockCDMInstance::updateLicense):
1818         * testing/MockCDMFactory.h:
1819
1820 2017-02-09  Simon Fraser  <simon.fraser@apple.com>
1821
1822         Improve IOSurfacePool logging
1823         https://bugs.webkit.org/show_bug.cgi?id=168098
1824
1825         Reviewed by Tim Horton.
1826
1827         Pass a string to DUMP_POOL_STATISTICS so we can tell what's triggering the
1828         logging.
1829
1830         * platform/graphics/cg/IOSurfacePool.cpp:
1831         (WebCore::IOSurfacePool::takeSurface):
1832         (WebCore::IOSurfacePool::addSurface):
1833         (WebCore::IOSurfacePool::evict):
1834         (WebCore::IOSurfacePool::collectionTimerFired):
1835         (WebCore::IOSurfacePool::showPoolStatistics):
1836         * platform/graphics/cg/IOSurfacePool.h:
1837
1838 2017-02-09  Alex Christensen  <achristensen@webkit.org>
1839
1840         Unreviewed, rolling out r212040.
1841
1842         Broke build.  I'm not surprised
1843
1844         Reverted changeset:
1845
1846         "[WebRTC][Mac] Activate libwebrtc"
1847         https://bugs.webkit.org/show_bug.cgi?id=167293
1848         http://trac.webkit.org/changeset/212040
1849
1850 2017-02-09  Chris Dumez  <cdumez@apple.com>
1851
1852         [Mac][WK2] Use MIME type to add file extension to downloads' suggested filenames when missing
1853         https://bugs.webkit.org/show_bug.cgi?id=168077
1854         <rdar://problem/30412595>
1855
1856         Reviewed by Alex Christensen.
1857
1858         Add utility function to MIMETypeRegistry that appends an extension to
1859         a filename if necessary, based on a provided MIME type.
1860
1861         Tests: fast/dom/HTMLAnchorElement/anchor-file-blob-download-no-extension.html
1862                http/tests/download/anchor-download-no-extension.html
1863
1864         * platform/MIMETypeRegistry.cpp:
1865         (WebCore::MIMETypeRegistry::appendFileExtensionIfNecessary):
1866         * platform/MIMETypeRegistry.h:
1867         * platform/cocoa/MIMETypeRegistryCocoa.mm:
1868         (WebCore::MIMETypeRegistry::appendFileExtensionIfNecessary):
1869
1870 2017-02-09  Youenn Fablet  <youenn@apple.com>
1871
1872         [WebRTC][Mac] Activate libwebrtc
1873         https://bugs.webkit.org/show_bug.cgi?id=167293
1874
1875         Reviewed by Alex Christensen.
1876
1877         * Configurations/WebCore.xcconfig:
1878         * Configurations/WebCoreTestSupport.xcconfig:
1879
1880 2017-02-09  Philip Rogers  <pdr@google.com>
1881
1882         SVG clip-path references can clip out later content
1883         https://bugs.webkit.org/show_bug.cgi?id=164181
1884
1885         Reviewed by Said Abou-Hallawa.
1886
1887         RenderSVGResourceClipper can modify the GraphicsContext state (through the path-only
1888         clipping codepath) so we need to ensure RenderLayer::setupClipPath saves the context
1889         and its caller restores it back so later content is not clipped as well.
1890
1891         This patch is based on a chromium patch by fs@opera.com:
1892         https://chromium.googlesource.com/chromium/src/+/b3f7e7d2c4afb3c7e5c7eb438ff5933cbe2109b3
1893
1894         Test: css3/masking/clip-path-reference-restore.html
1895
1896         * rendering/RenderLayer.cpp:
1897         (WebCore::RenderLayer::setupClipPath): Add a GC save and return true to restore. Also switch to downcast instead of static_cast.
1898
1899 2017-02-09  Filip Pizlo  <fpizlo@apple.com>
1900
1901         SharedArrayBuffer does not need to be in the transfer list
1902         https://bugs.webkit.org/show_bug.cgi?id=168079
1903
1904         Reviewed by Geoffrey Garen and Keith Miller.
1905
1906         Tests: workers/sab/multi-memory-multi-buffer.html
1907                workers/sab/multi-memory.html
1908                workers/sab/no-transfer.html
1909                workers/sab/postMessage-clones.html
1910                workers/sab/sent-from-worker-no-transfer.html
1911                workers/sab/sent-from-worker-transfer.html
1912
1913         The SAB API that we originally implemented required that SABs get put in transfer lists
1914         when they are sent to workers.
1915         
1916         The new SAB API that everyone is converging towards requires that you do not put the
1917         SAB in the transfer list. That's supposed to be an error. Instead, anytime that a SAB
1918         is part of any message to or from a dedicated worker then it is automatically shared.
1919         
1920         The new API provides a lot more clarity about what is supposed to happen in contexts
1921         that support transfering but don't support sharing.
1922         
1923         Right now this patch allows both styles to work, but I hope we can disable the transfer
1924         list capability soon.
1925
1926         * bindings/js/IDBBindingUtilities.cpp:
1927         (WebCore::deserializeIDBValueToJSValue):
1928         * bindings/js/JSMessageEventCustom.cpp:
1929         (WebCore::JSMessageEvent::data):
1930         * bindings/js/SerializedScriptValue.cpp:
1931         (WebCore::CloneSerializer::serialize):
1932         (WebCore::CloneSerializer::CloneSerializer):
1933         (WebCore::CloneSerializer::dumpIfTerminal):
1934         (WebCore::CloneDeserializer::deserialize):
1935         (WebCore::CloneDeserializer::CloneDeserializer):
1936         (WebCore::CloneDeserializer::readTerminal):
1937         (WebCore::SerializedScriptValue::SerializedScriptValue):
1938         (WebCore::SerializedScriptValue::create):
1939         (WebCore::SerializedScriptValue::deserialize):
1940         * bindings/js/SerializedScriptValue.h:
1941         (): Deleted.
1942         * dom/CustomEvent.cpp:
1943         (WebCore::CustomEvent::trySerializeDetail):
1944         * dom/ErrorEvent.cpp:
1945         (WebCore::ErrorEvent::trySerializeError):
1946         * dom/MessageEvent.cpp:
1947         (WebCore::MessageEvent::trySerializeData):
1948         * dom/PopStateEvent.cpp:
1949         (WebCore::PopStateEvent::trySerializeState):
1950         * workers/DedicatedWorkerGlobalScope.cpp:
1951         (WebCore::DedicatedWorkerGlobalScope::postMessage):
1952         * workers/Worker.cpp:
1953         (WebCore::Worker::postMessage):
1954
1955 2017-02-09  Brent Fulgham  <bfulgham@apple.com>
1956
1957         Unreviewed build fix after r212025.
1958
1959         inDocument -> isConnected
1960
1961         * html/FormAssociatedElement.cpp:
1962         (WebCore::FormAssociatedElement::didMoveToNewDocument):
1963         (WebCore::FormAssociatedElement::resetFormAttributeTargetObserver):
1964         * html/HTMLFormElement.cpp:
1965         (WebCore::HTMLFormElement::formElementIndex):
1966
1967 2017-02-09  Chris Dumez  <cdumez@apple.com>
1968
1969         Make sure Event keeps its current target element alive
1970         https://bugs.webkit.org/show_bug.cgi?id=167885
1971         <rdar://problem/30376972>
1972
1973         Reviewed by Brent Fulgham.
1974
1975         Make sure Event keeps its current target element alive to avoid
1976         crashes if it is accessed by JS after it has been garbage collected.
1977
1978         Test: fast/events/currentTarget-gc-crash.html
1979
1980         * dom/Event.cpp:
1981         (WebCore::Event::setCurrentTarget):
1982         * dom/Event.h:
1983         (WebCore::Event::currentTarget):
1984
1985 2017-02-09  Ryosuke Niwa  <rniwa@webkit.org>
1986
1987         Crash in render tree after dynamically mutating the slot value
1988         https://bugs.webkit.org/show_bug.cgi?id=167502
1989
1990         Reviewed by Antti Koivisto.
1991
1992         The crash was caused by attributeChanged not destructing the render tree after an assigned element had been
1993         removed from its slot. Since the style resolver can no longer find this element in the flat tree, we need to
1994         delete its render object as if the element had been removed from the DOM tree.
1995
1996         Tests: fast/html/details-summary-slot.html
1997                fast/shadow-dom/shadow-slot-attribute-change-crash.html
1998
1999         * dom/Element.cpp:
2000         (WebCore::Element::attributeChanged):
2001         * html/HTMLSummaryElement.cpp:
2002         (WebCore::SummarySlotElement): Added. Always use the default slot regardless of the slot attribute's value.
2003         (WebCore::HTMLSummaryElement::create): Use SummarySlotElement
2004
2005 2017-02-09  Antti Koivisto  <antti@apple.com>
2006
2007         Details element doesn't work correctly when mutating content between closing and opening
2008         https://bugs.webkit.org/show_bug.cgi?id=167310
2009
2010         Reviewed by Ryosuke Niwa.
2011
2012         Tests: fast/html/details-close-modify-open.html
2013                fast/shadow-dom/slot-remove-mutate-add.html
2014
2015         * dom/SlotAssignment.cpp:
2016         (WebCore::SlotAssignment::didChangeSlot):
2017
2018             Always reset the slot assignment when content is mutated.
2019
2020 2017-02-09  Chris Dumez  <cdumez@apple.com>
2021
2022         Crash under FormSubmission::create()
2023         https://bugs.webkit.org/show_bug.cgi?id=167200
2024         <rdar://problem/30096323>
2025
2026         Reviewed by Darin Adler.
2027
2028         The issue is that FormSubmission::create() was iterating over
2029         form.associatedElements() as was calling Element::appendFormData()
2030         in the loop. HTMLObjectElement::appendFormData() was calling
2031         pluginWidget(PluginLoadingPolicy::Load) which causes a synchronous
2032         layout and can fire events (such as focus event) synchronously.
2033         Firing those events synchronously allows the JS to modify the
2034         form.associatedElements() vector we are currently iterating on.
2035
2036         To avoid this issue, we now call pluginWidget(PluginLoadingPolicy::DoNotLoad)
2037         in HTMLObjectElement::appendFormData() as we are not allowed to fire
2038         synchronous events at this point. I also added a security assertion
2039         in FormSubmission::create() to catch cases where we fire JS events
2040         while iterating over the form associated elements to more easily
2041         notice these things in the future.
2042
2043         Test: fast/forms/formsubmission-appendFormData-crash.html
2044
2045         * html/HTMLObjectElement.cpp:
2046         (WebCore::HTMLObjectElement::appendFormData):
2047         * loader/FormSubmission.cpp:
2048         (WebCore::FormSubmission::create):
2049
2050 2017-02-09  Chris Dumez  <cdumez@apple.com>
2051
2052         Crash under HTMLFormElement::registerFormElement()
2053         https://bugs.webkit.org/show_bug.cgi?id=167162
2054
2055         Reviewed by Ryosuke Niwa.
2056
2057         didMoveToNewDocument() was re-registering FormAttributeTargetObserver
2058         even if the element's inDocument was not set yet. As a result, it was
2059         possible for FormAssociatedElement::resetFormOwner() to be called
2060         when the element was in the tree but with its inDocument still being
2061         false (because insertedInto() has not been called yet). This could
2062         end up calling HTMLFormElement::registerFormElement() even though
2063         the element is still recognized as detached. This is an issue because
2064         HTMLFormElement::m_associatedElements's order and its corresponding
2065         indexes (m_associatedElementsBeforeIndex / m_associatedElementsAfterIndex)
2066         rely on the position of the element with regards to the form element
2067         (before / inside / after).
2068
2069         To address the issue, we now only register the FormAttributeTargetObserver
2070         in didMoveToNewDocument() if the inDocument flag is set to true. This
2071         is similar to what is done at other call sites of
2072         resetFormAttributeTargetObserver(). We also ignore the form content
2073         attribute in HTMLFormElement::formElementIndex() if the element is
2074         not connected.
2075
2076         As per the HTML specification [1], the form content attribute is only
2077         taken if the element is connected (i.e. inDocument flag is true).
2078
2079         Note that FormAssociatedElement::findAssociatedForm() was already
2080         ignoring the form content attribute if the element is disconnected.
2081
2082         [1] https://html.spec.whatwg.org/#reset-the-form-owner (step 3)
2083
2084         Test: fast/forms/registerFormElement-crash.html
2085
2086         * html/FormAssociatedElement.cpp:
2087         (WebCore::FormAssociatedElement::didMoveToNewDocument):
2088         Only call resetFormAttributeTargetObserver() if inDocument flag is set,
2089         similarly to what is done at other call sites.
2090
2091         (WebCore::FormAssociatedElement::resetFormAttributeTargetObserver):
2092         Add an assertion to make sure no one call this method on an element that
2093         is not connected.
2094
2095         * html/HTMLFormElement.cpp:
2096         (WebCore::HTMLFormElement::formElementIndex):
2097         Ignore the form content attribute if the element is not connected, as
2098         per the HTML specification [1].
2099
2100 2017-02-09  Antti Koivisto  <antti@apple.com>
2101
2102         Tear down existing renderers when adding a shadow root.
2103         https://bugs.webkit.org/show_bug.cgi?id=167117
2104
2105         Reviewed by Andreas Kling.
2106
2107         Adding a shadow root may cause children no longer be part of the flat tree. If they had renderers
2108         tear down code would no longer reach them.
2109
2110         Test: fast/shadow-dom/attach-shadow-teardown.html
2111
2112         * dom/Element.cpp:
2113         (WebCore::Element::addShadowRoot):
2114
2115             Tear down existing render tree when adding a shadow root.
2116
2117 2017-02-09  Brent Fulgham  <bfulgham@apple.com>
2118
2119         Handle synchronous layout when setting a selection range
2120         https://bugs.webkit.org/show_bug.cgi?id=167092
2121         <rdar://problem/30041640>
2122
2123         Reviewed by Antti Koivisto.
2124
2125         The 'innerTextElement' of a form control can change during layout due
2126         to arbitrary JavaScript executing. Handle the case where the inner text
2127         element has changed so that current render box height is while setting
2128         a selection range.
2129
2130         Test: fast/forms/input-type-change-during-selection.html
2131
2132         * html/HTMLTextFormControlElement.cpp:
2133         (WebCore::HTMLTextFormControlElement::setSelectionRange):
2134
2135 2017-02-09  Alex Christensen  <achristensen@webkit.org>
2136
2137         Fix CMake build.
2138
2139         * PlatformMac.cmake:
2140
2141 2017-02-09  Brent Fulgham  <bfulgham@apple.com>
2142
2143         Disconnect shadow children of root when detaching a frame
2144         https://bugs.webkit.org/show_bug.cgi?id=166851
2145         <rdar://problem/29930443>
2146
2147         Reviewed by Andy Estes.
2148
2149         If the root of the tree we are disconnecting has a shadow element, include it in the set of
2150         things to disconnect.
2151
2152         Tests: fast/shadow-dom/shadow-at-root-during-disconnect.html
2153
2154         * dom/ContainerNodeAlgorithms.cpp:
2155         (WebCore::disconnectSubframes):
2156
2157 2017-02-09  Alexey Proskuryakov  <ap@apple.com>
2158
2159         Remove unused WebThreadRunSync
2160         https://bugs.webkit.org/show_bug.cgi?id=168024
2161
2162         Reviewed by Tim Horton.
2163
2164         * platform/ios/wak/WebCoreThreadRun.cpp:
2165         * platform/ios/wak/WebCoreThreadRun.h:
2166         * platform/ios/wak/WebCoreThreadSystemInterface.cpp:
2167         (InitWebCoreThreadSystemInterface):
2168
2169 2017-02-09  Ryan Haddad  <ryanhaddad@apple.com>
2170
2171         Unreviewed, rolling out r211802.
2172
2173         This change caused fast/regions/inline-block-inside-anonymous-
2174         overflow-with-covered-controls.html to be a flaky failure.
2175
2176         Reverted changeset:
2177
2178         "[Modern Media Controls] Improve handling of <video> with only
2179         audio tracks"
2180         https://bugs.webkit.org/show_bug.cgi?id=167836
2181         http://trac.webkit.org/changeset/211802
2182
2183 2017-02-09  Alex Christensen  <achristensen@webkit.org>
2184
2185         Fix i386 libwebrtc build
2186         https://bugs.webkit.org/show_bug.cgi?id=168038
2187
2188         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h:
2189         DataChannelInterface::buffered_amount returns a uint64_t, and we want a size_t.
2190         If this overflows, then we've run out of memory and crashed a long time ago.
2191
2192 2017-02-09  Andreas Kling  <akling@apple.com>
2193
2194         Document::settings() should return a const Settings&.
2195         <https://webkit.org/b/168061>
2196
2197         Reviewed by Geoffrey Garen.
2198
2199         - Make Document::settings() return a const reference.
2200         - Added Document::mutableSettings() for all your non-const needs.
2201         - Fixed up settings generator to produce const getters.
2202         - Simplify a few settings() call sites that exposed themselves.
2203
2204         * Modules/applepay/ApplePaySession.cpp:
2205         (WebCore::shouldDiscloseApplePayCapability):
2206         * Modules/mediastream/UserMediaRequest.cpp:
2207         (WebCore::canCallGetUserMedia):
2208         * css/CSSFontFace.cpp:
2209         (WebCore::CSSFontFace::appendSources):
2210         * css/CSSFontSelector.cpp:
2211         (WebCore::resolveGenericFamily):
2212         * css/StyleResolver.h:
2213         (WebCore::StyleResolver::settings):
2214         * dom/Document.h:
2215         (WebCore::Document::settings):
2216         (WebCore::Document::mutableSettings):
2217         * html/FTPDirectoryDocument.cpp:
2218         (WebCore::createTemplateDocumentData):
2219         * html/HTMLCanvasElement.cpp:
2220         (WebCore::shouldEnableWebGL):
2221         * html/HTMLEmbedElement.cpp:
2222         (WebCore::HTMLEmbedElement::rendererIsNeeded):
2223         * html/HTMLSelectElement.cpp:
2224         (WebCore::HTMLSelectElement::menuListDefaultEventHandler):
2225         * html/ImageDocument.cpp:
2226         (WebCore::ImageDocument::updateDuringParsing):
2227         * page/csp/ContentSecurityPolicy.cpp:
2228         (WebCore::ContentSecurityPolicy::allowContentSecurityPolicySourceStarToMatchAnyProtocol):
2229         * page/make_settings.pl:
2230         (printGetterAndSetter):
2231         * rendering/SimpleLineLayout.cpp:
2232         (WebCore::SimpleLineLayout::toggleSimpleLineLayout):
2233
2234 2017-02-09  Jer Noble  <jer.noble@apple.com>
2235
2236         Make passing PlatformAudioData in audioSamplesAvaliable const-correct.
2237         https://bugs.webkit.org/show_bug.cgi?id=168051
2238
2239         Reviewed by Eric Carlson.
2240
2241         Modify all the functions which take a (conceptually) read-only audio buffer const-correct.
2242
2243         Drive-by fix: AudioSampleBufferList::copyFrom() set a ivar pointer to the passed in
2244         AudioBufferList. Ensure that the ivar is reset when copyFrom() returns by using a
2245         SetForScope.
2246
2247         * platform/audio/mac/AudioSampleBufferList.cpp:
2248         (WebCore::AudioSampleBufferList::copyFrom):
2249         * platform/audio/mac/AudioSampleBufferList.h:
2250         * platform/audio/mac/AudioSampleDataSource.cpp:
2251         (WebCore::AudioSampleDataSource::pushSamplesInternal):
2252         (WebCore::AudioSampleDataSource::pushSamples):
2253         * platform/audio/mac/AudioSampleDataSource.h:
2254         * platform/mediastream/RealtimeMediaSource.cpp:
2255         (WebCore::RealtimeMediaSource::audioSamplesAvailable):
2256         * platform/mediastream/RealtimeMediaSource.h:
2257         (WebCore::RealtimeMediaSource::Observer::audioSamplesAvailable):
2258         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
2259         (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable):
2260         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.h:
2261         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
2262         (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):
2263         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
2264
2265 2017-02-09  Jer Noble  <jer.noble@apple.com>
2266
2267         Fix some logging statements in MediaPlayerPrivateMediaStreamAVFObjC
2268         https://bugs.webkit.org/show_bug.cgi?id=168063
2269
2270         Reviewed by Eric Carlson.
2271
2272         Make the format string match the types passed in (i.e., floats, not strings).
2273
2274         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
2275         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateSampleTimes):
2276
2277 2017-02-09  Eric Carlson  <eric.carlson@apple.com>
2278
2279         [MediaStream Mac] Handle NULL m_sampleBufferDisplayLayer
2280         https://bugs.webkit.org/show_bug.cgi?id=168060
2281
2282         Reviewed by Jer Noble.
2283
2284         No new tests, this avoids an occasional crash on the bots.
2285
2286         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
2287         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::layerStatusDidChange): Don't assume
2288         m_sampleBufferDisplayLayer is valid.
2289
2290 2017-02-09  Chris Dumez  <cdumez@apple.com>
2291
2292         Object.getPrototypeOf(NodeFilter) should be Function.prototype, not Object.prototype
2293         https://bugs.webkit.org/show_bug.cgi?id=167964
2294
2295         Reviewed by Youenn Fablet.
2296
2297         Object.getPrototypeOf(NodeFilter) should be Function.prototype, not Object.prototype
2298         after the following WebIDL spec change:
2299         - https://github.com/heycam/webidl/issues/96
2300
2301         This aligns our behavior with other browsers as the spec has been updated to match
2302         the majority.
2303
2304         No new tests, rebaselined existing test.
2305
2306         * bindings/scripts/CodeGeneratorJS.pm:
2307         (GenerateConstructorHelperMethods):
2308         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
2309         (WebCore::JSTestCallbackInterfaceConstructor::prototypeForStructure):
2310
2311 2017-02-09  Miguel Gomez  <magomez@igalia.com>
2312
2313         [GTK] scroll with transparent background not repainted after scrollY >= 32768
2314         https://bugs.webkit.org/show_bug.cgi?id=154283
2315
2316         Reviewed by Carlos Garcia Campos.
2317
2318         Due to a limitation of the pixman backend, which uses 16 bits to hold signed integers, cairo is
2319         not able to draw anything when using transformation matrices with values bigger than 32768. When
2320         drawing patterns into large pages, the matrices values can overflow those 16 bits, so cairo doesn't
2321         draw anything in, which causes the reported transparent backgrounds.
2322
2323         The patch modifies the transformation matrices both from the current context and the pattern we
2324         are painting, to avoid them to hold values that cannot stored in 16 bits.
2325
2326         There's still the possibility that this happens, but it would require using a pattern with a size
2327         bigger than 32768.
2328
2329         Based on a previous patch by Gwang Yoon Hwang  <yoon@igalia.com>.
2330
2331         No new tests.
2332
2333         * platform/graphics/cairo/CairoUtilities.cpp:
2334         (WebCore::drawPatternToCairoContext):
2335
2336 2017-02-09  Brent Fulgham  <bfulgham@apple.com>
2337
2338         Unreviewed build fix after r211965.
2339
2340         * dom/Document.cpp:
2341         (WebCore::Document::adoptNode): inDocument -> isConnected
2342
2343 2017-02-09  Ryosuke Niwa  <rniwa@webkit.org>
2344
2345         Adopting a child node of a script element can run script
2346         https://bugs.webkit.org/show_bug.cgi?id=167318
2347
2348         Reviewed by Darin Adler.
2349
2350         The bug was caused by ScriptElement::childrenChanged indiscriminately running the script.
2351         Do this only if some node has been inserted as spec'ed:
2352
2353         https://html.spec.whatwg.org/multipage/scripting.html#script-processing-model
2354         "The script element is connected and a node or document fragment is inserted into
2355         the script element, after any script elements inserted at that time."
2356
2357         Split NonContentsChildChanged into NonContentsChildInserted and NonContentsChildRemoved to disambiguate
2358         non-contents child such as text and element being removed or inserted. New behavior matches that of
2359         Gecko and Chrome as well as the latest HTML5 specification.
2360
2361         Also deploy NoEventDispatchAssertion in more places. Unfortunately, this results in some DOM trees
2362         internal to WebKit to be mutated while there is NoEventDispatchAssertion in the stack. Added a new RAII
2363         object "EventAllowedScope" to temporarily disable this assertion within such a tree. CachedSVGFont's
2364         ensureCustomFontData used to completely disable this assertion but we no longer have to do this either.
2365
2366         To clarify the new semantics, renamed isEventDispatchForbidden to isEventAllowedInMainThread with
2367         the negated boolean value, and added a new variant isEventDispatchAllowedInSubtree, which checks
2368         isEventDispatchForbidden() is true or if the node was one of an internal DOM node or its descendent
2369         held by EventAllowedScope.
2370
2371         Inspired by https://chromium.googlesource.com/chromium/src/+/604e798ec6ee30f44d57a5c4a44ce3dab3a871ed
2372
2373         Tests: fast/html/script-must-not-run-when-child-is-adopted.html
2374                fast/html/script-must-not-run-when-child-is-removed.html
2375
2376         * dom/CharacterData.cpp:
2377         (WebCore::CharacterData::notifyParentAfterChange): Added NoEventDispatchAssertion.
2378         * dom/ContainerNode.cpp:
2379         (WebCore::ContainerNode::insertBefore): Added NoEventDispatchAssertion around TreeScope's adoptIfNeeded
2380         and insertBeforeCommon as done elsewhere.
2381         (WebCore::ContainerNode::appendChildCommon): Added NoEventDispatchAssertion.
2382         (WebCore::ContainerNode::changeForChildInsertion): Use NonContentsChildInserted here.
2383         (WebCore::ContainerNode::notifyChildRemoved): Added NoEventDispatchAssertion.
2384         (WebCore::ContainerNode::replaceChild): Moved adoptIfNeeded into NoEventDispatchAssertion.
2385         (WebCore::ContainerNode::removeChild): Added NoEventDispatchAssertion.
2386         (WebCore::ContainerNode::parserRemoveChild): Added NoEventDispatchAssertion.
2387         (WebCore::ContainerNode::removeChildren): Call childrenChanged in NoEventDispatchAssertion.
2388         (WebCore::ContainerNode::appendChildWithoutPreInsertionValidityCheck): Moved adoptIfNeeded into
2389         NoEventDispatchAssertion.
2390         (WebCore::dispatchChildInsertionEvents): Check the forbidden-ness more precisely.
2391         (WebCore::dispatchChildRemovalEvents): Ditto.
2392         * dom/ContainerNode.h:
2393         (WebCore::ContainerNode::ChildChange::isInsertion): Added.
2394         * dom/ContainerNodeAlgorithms.cpp:
2395         (WebCore::notifyChildNodeInserted): Check the forbidden-ness more precisely. Here, we check against
2396         insertionPoint since EventAllowedScope checks against the root node.
2397         * dom/Document.cpp:
2398         (WebCore::Document::adoptNode): Assert the node to be adopted has not been inserted back, or else
2399         remove() had resulted in an exception before calling TreeScope::adoptIfNeeded.
2400         * dom/Element.cpp:
2401         (WebCore::Element::childrenChanged):
2402         * dom/NoEventDispatchAssertion.h:
2403         (WebCore::NoEventDispatchAssertion::isEventDispatchForbidden): Added a new variant that takes a node.
2404         If this node is a descendent of a node "marked as safe" by EventAllowedScope, then we don't consider
2405         the event dispatch to be forbidden.
2406         (WebCore::NoEventDispatchAssertion::dropTemporarily): Deleted.
2407         (WebCore::NoEventDispatchAssertion::restoreDropped): Deleted.
2408         (WebCore::NoEventDispatchAssertion::EventAllowedScope): Added. A RAII object which marks descendants of
2409         a given node as "safe" for the purpose of checking isEventDispatchForbidden.
2410         (WebCore::NoEventDispatchAssertion::EventAllowedScope::EventAllowedScope): Added. There can be a chain
2411         of EventAllowedScope objects in the stack. s_currentScope points to the most recently instantiated
2412         RAII object, and each instance remembers prior instance. 
2413         (WebCore::NoEventDispatchAssertion::EventAllowedScope::~EventAllowedScope): Added.
2414         (WebCore::NoEventDispatchAssertion::EventAllowedScope::isAllowedNode): Added. Returns true if the given
2415         node is a descendent of any node held by instances of EventAllowedScope.
2416         (WebCore::NoEventDispatchAssertion::EventAllowedScope::isAllowedNodeInternal): Added. A helper function
2417         for isAllowedNode.
2418         * dom/Node.cpp:
2419         (WebCore::Node::dispatchSubtreeModifiedEvent): Check the forbidden-ness more precisely.
2420         * dom/ScriptElement.cpp:
2421         (WebCore::ScriptElement::childrenChanged): Only prepare the script if we've inserted nodes.
2422         (WebCore::ScriptElement::executeClassicScript): Assert isEventDispatchForbidden is false since running
2423         arbitrary author scripts can, indeed, result dispatch any events.
2424         * dom/ScriptElement.h:
2425         * html/HTMLElement.cpp:
2426         (WebCore::textToFragment): Made this a static local function and not return an exception since there
2427         is no way appendChild called in this function can throw an exception.
2428         (WebCore::HTMLElement::setInnerText): Create EventAllowedScope for the fragment. It's called called by
2429         HTMLTextAreaElement's childrenChanged to update its UA shadow tree, and it's dispatching as event on
2430         a new fragment can't execute arbitrary scripts since it has never been exposed to author scripts.
2431         Because of the precise-ness of this check, this does not disable the assertion for "this" element.
2432         HTMLTextFormControlElement::setInnerTextValue explicitly creates another EventAllowedScope to mark
2433         the shadow tree into which the fragment is inserted safe.
2434         (WebCore::HTMLElement::setOuterText):
2435         * html/HTMLElement.h:
2436         * html/HTMLScriptElement.cpp:
2437         (WebCore::HTMLScriptElement::childrenChanged):
2438         * html/HTMLTextFormControlElement.cpp:
2439         (WebCore::HTMLTextFormControlElement::setInnerTextValue): See above (setInnerText).
2440         * html/track/VTTCue.cpp:
2441         (WebCore::VTTCue::createCueRenderingTree): Create EventAllowedScope for the cloned fragment here since
2442         the VTT tree is never exposed to author scripts.
2443         (WebCore::VTTCue::updateDisplayTree): Ditto.
2444         * loader/cache/CachedSVGFont.cpp:
2445         (WebCore::CachedSVGFont::ensureCustomFontData): Use EventAllowedScope to disable assertions only on
2446         the new SVG document we just created instead of disabling for all DOM trees.
2447         * svg/SVGScriptElement.cpp:
2448         (WebCore::SVGScriptElement::childrenChanged):
2449
2450 2017-02-09  Andreas Kling  <akling@apple.com>
2451
2452         Document should always have a Settings.
2453         <https://webkit.org/b/120172>
2454
2455         Reviewed by Antti Koivisto.
2456
2457         Since a Document can't move between Frames, and it's either frameless
2458         or partnered with a Frame provided at construction time, we know that
2459         it will never need to switch between different Settings objects either.
2460
2461         Give Document a Ref<Settings> that contains either the Frame's Settings
2462         or a default-constructed Settings object if frameless.
2463         Document::settings() is promoted to a reference getter.
2464
2465         The bulk of this patch is removing now-unnecessary null checks.
2466
2467         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
2468         (WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory):
2469         * Modules/plugins/PluginReplacement.h:
2470         (WebCore::ReplacementPlugin::isEnabledBySettings):
2471         * Modules/plugins/QuickTimePluginReplacement.h:
2472         * Modules/plugins/QuickTimePluginReplacement.mm:
2473         (WebCore::QuickTimePluginReplacement::isEnabledBySettings):
2474         * Modules/plugins/YouTubePluginReplacement.cpp:
2475         (WebCore::YouTubePluginReplacement::isEnabledBySettings):
2476         * Modules/plugins/YouTubePluginReplacement.h:
2477         * Modules/webaudio/AudioContext.cpp:
2478         (WebCore::AudioContext::constructCommon):
2479         * bindings/js/CachedScriptFetcher.cpp:
2480         (WebCore::CachedScriptFetcher::requestScriptWithCache):
2481         * css/CSSFontFace.cpp:
2482         (WebCore::CSSFontFace::appendSources):
2483         (WebCore::CSSFontFace::webFontsShouldAlwaysFallBack):
2484         * css/CSSFontSelector.cpp:
2485         (WebCore::CSSFontSelector::fallbackFontCount):
2486         (WebCore::CSSFontSelector::fallbackFontAt):
2487         * css/StyleBuilderConverter.h:
2488         (WebCore::StyleBuilderConverter::convertResize):
2489         * css/StyleBuilderCustom.h:
2490         (WebCore::StyleBuilderCustom::applyValueFontFamily):
2491         * css/StyleResolver.cpp:
2492         (WebCore::StyleResolver::StyleResolver):
2493         (WebCore::StyleResolver::defaultStyleForElement):
2494         (WebCore::StyleResolver::adjustRenderStyle):
2495         (WebCore::StyleResolver::checkForGenericFamilyChange):
2496         (WebCore::StyleResolver::initializeFontStyle):
2497         * css/StyleResolver.h:
2498         (WebCore::StyleResolver::settings):
2499         (WebCore::StyleResolver::documentSettings): Deleted.
2500         * css/parser/CSSParser.cpp:
2501         (WebCore::CSSParserContext::CSSParserContext):
2502         * dom/Document.cpp:
2503         (WebCore::Document::Document):
2504         (WebCore::Document::setReadyState):
2505         (WebCore::Document::setVisualUpdatesAllowed):
2506         (WebCore::Document::defaultCharsetForLegacyBindings):
2507         (WebCore::Document::recalcStyle):
2508         (WebCore::Document::implicitClose):
2509         (WebCore::Document::minimumLayoutDelay):
2510         (WebCore::Document::setDomain):
2511         (WebCore::Document::audioPlaybackRequiresUserGesture):
2512         (WebCore::Document::videoPlaybackRequiresUserGesture):
2513         (WebCore::Document::storageBlockingStateDidChange):
2514         (WebCore::Document::isTelephoneNumberParsingEnabled):
2515         (WebCore::Document::initSecurityContext):
2516         (WebCore::Document::initDNSPrefetch):
2517         (WebCore::Document::getCachedLocale):
2518         (WebCore::Document::shouldEnforceContentDispositionAttachmentSandbox):
2519         (WebCore::Document::settings): Deleted.
2520         * dom/Document.h:
2521         (WebCore::Document::settings):
2522         * dom/Element.cpp:
2523         (WebCore::subpixelMetricsEnabled):
2524         * dom/ExtensionStyleSheets.cpp:
2525         (WebCore::ExtensionStyleSheets::pageUserSheet):
2526         * dom/ScriptExecutionContext.cpp:
2527         (WebCore::ScriptExecutionContext::dispatchErrorEvent):
2528         * dom/ScriptableDocumentParser.cpp:
2529         (WebCore::ScriptableDocumentParser::ScriptableDocumentParser):
2530         * dom/ScriptedAnimationController.cpp:
2531         (WebCore::ScriptedAnimationController::requestAnimationFrameEnabled):
2532         * dom/make_names.pl:
2533         (printConstructorInterior):
2534         * editing/Editor.cpp:
2535         * editing/markup.cpp:
2536         (WebCore::createMarkupInternal):
2537         * html/FTPDirectoryDocument.cpp:
2538         (WebCore::createTemplateDocumentData):
2539         * html/HTMLAnchorElement.cpp:
2540         (WebCore::HTMLAnchorElement::setActive):
2541         (WebCore::HTMLAnchorElement::sendPings):
2542         (WebCore::HTMLAnchorElement::treatLinkAsLiveForEventType):
2543         * html/HTMLAppletElement.cpp:
2544         (WebCore::HTMLAppletElement::canEmbedJava):
2545         * html/HTMLCanvasElement.cpp:
2546         (WebCore::HTMLCanvasElement::getContext2d):
2547         (WebCore::shouldEnableWebGL):
2548         (WebCore::HTMLCanvasElement::shouldAccelerate):
2549         * html/HTMLFormElement.cpp:
2550         (WebCore::HTMLFormElement::submitImplicitly):
2551         * html/HTMLFrameElementBase.cpp:
2552         (WebCore::HTMLFrameElementBase::setLocation):
2553         * html/HTMLImageElement.cpp:
2554         (WebCore::HTMLImageElement::updateImageControls):
2555         * html/HTMLImageLoader.cpp:
2556         (WebCore::HTMLImageLoader::sourceURI):
2557         * html/HTMLInputElement.cpp:
2558         (WebCore::HTMLInputElement::setupDateTimeChooserParameters):
2559         * html/HTMLLinkElement.cpp:
2560         (WebCore::HTMLLinkElement::process):
2561         * html/HTMLMediaElement.cpp:
2562         (WebCore::HTMLMediaElement::HTMLMediaElement):
2563         (WebCore::HTMLMediaElement::mediaPlayerMediaKeysStorageDirectory):
2564         (WebCore::HTMLMediaElement::mediaPlayerAcceleratedCompositingEnabled):
2565         (WebCore::HTMLMediaElement::enterFullscreen):
2566         (WebCore::HTMLMediaElement::exitFullscreen):
2567         (WebCore::HTMLMediaElement::mediaPlayerNeedsSiteSpecificHacks):
2568         (WebCore::HTMLMediaElement::mediaPlayerNetworkInterfaceName):
2569         (WebCore::HTMLMediaElement::setMediaControlsDependOnPageScaleFactor):
2570         (WebCore::HTMLMediaElement::doesHaveAttribute):
2571         * html/HTMLVideoElement.cpp:
2572         (WebCore::HTMLVideoElement::HTMLVideoElement):
2573         * html/MediaElementSession.cpp:
2574         (WebCore::MediaElementSession::wirelessVideoPlaybackDisabled):
2575         (WebCore::MediaElementSession::requiresFullscreenForVideoPlayback):
2576         (WebCore::MediaElementSession::allowsAutomaticMediaDataLoading):
2577         (WebCore::MediaElementSession::allowsPictureInPicture):
2578         (WebCore::MediaElementSession::maximumMediaSourceBufferSize):
2579         * html/parser/HTMLParserOptions.cpp:
2580         (WebCore::HTMLParserOptions::HTMLParserOptions):
2581         * html/shadow/MediaControlElements.cpp:
2582         (WebCore::MediaControlFullscreenButtonElement::defaultEventHandler):
2583         * loader/LinkLoader.cpp:
2584         (WebCore::LinkLoader::loadLink):
2585         * page/csp/ContentSecurityPolicy.cpp:
2586         (WebCore::ContentSecurityPolicy::allowContentSecurityPolicySourceStarToMatchAnyProtocol):
2587         * rendering/SimpleLineLayout.cpp:
2588         (WebCore::SimpleLineLayout::toggleSimpleLineLayout):
2589         * style/StyleFontSizeFunctions.cpp:
2590         (WebCore::Style::computedFontSizeFromSpecifiedSize):
2591         (WebCore::Style::fontSizeForKeyword):
2592         (WebCore::Style::legacyFontSizeForPixelSize):
2593         * style/StyleScope.cpp:
2594         (WebCore::Style::Scope::collectActiveStyleSheets):
2595         * xml/XMLHttpRequest.cpp:
2596         (WebCore::XMLHttpRequest::usesDashboardBackwardCompatibilityMode):
2597
2598 2017-02-09  Antti Koivisto  <antti@apple.com>
2599
2600         Use all cacheable speculatively loaded responses
2601         https://bugs.webkit.org/show_bug.cgi?id=168052
2602
2603         Reviewed by Andreas Kling.
2604
2605         * platform/network/CacheValidation.cpp:
2606         (WebCore::isStatusCodeCacheableByDefault):
2607         (WebCore::isStatusCodePotentiallyCacheable):
2608
2609         Moved here from WebKit2.
2610
2611         * platform/network/CacheValidation.h:
2612
2613 2017-02-09  Eric Carlson  <eric.carlson@apple.com>
2614
2615         [MediaStream] Remove legacy Navigator.webkitGetUserMedia
2616         https://bugs.webkit.org/show_bug.cgi?id=168016
2617
2618         Reviewed by Youenn Fablet.
2619
2620         No new tests, existing tests updated.
2621
2622         * WebCore.xcodeproj/project.pbxproj: NavigatorUserMedia.
2623         * DerivedSources.make: Ditto.
2624         * CMakeLists.txt: Ditto.
2625         * Modules/mediastream/NavigatorUserMedia.idl: Removed.
2626         * Modules/mediastream/NavigatorUserMedia.js: Removed.
2627         * WebCore.xcodeproj/project.pbxproj:
2628         * page/Navigator.idl: Add some whitespace to force derived sources to be rebuild correctly.
2629
2630 2017-02-09  Antoine Quint  <graouts@apple.com>
2631
2632         [Modern Media Controls] Tapping the skip back button on iOS inline media controls make the controls disappear
2633         https://bugs.webkit.org/show_bug.cgi?id=168049
2634         <rdar://problem/30442660>
2635
2636         Reviewed by Eric Carlson.
2637
2638         Calling elementAtPoint() on the Document will not return an element in the ShadowRoot,
2639         we need to call it on the ShadowRoot. So we now iterate over ancestors of the controls
2640         bar to find the ShadowRoot, if any, and check whether the tapped element is contained
2641         within the controls bar. We only fade the controls bar out if the tapped element is
2642         outside of the controls bar hierarchy.
2643
2644         Test: media/modern-media-controls/media-controller/media-controller-ios-do-not-hide-controls-when-tapping-button.html
2645
2646         * Modules/modern-media-controls/controls/controls-bar.js:
2647         (ControlsBar.prototype.gestureRecognizerStateDidChange):
2648
2649 2017-02-09  Jer Noble  <jer.noble@apple.com>
2650
2651         Configure MockRealtimeAudioSourceMac to generate stereo audio
2652         https://bugs.webkit.org/show_bug.cgi?id=168027
2653
2654         Reviewed by Eric Carlson.
2655
2656         Update MockRealtimeAudioSourceMac to generate stereo audio.
2657
2658         First, because the pattern of creating a AudioBufferList structure (with all it's quirks and
2659         weird requirements) was repeated multiple places, add a new wrapper around ABL called
2660         WebAudioBufferList which takes care of correctly initializing the ABL structure and manages
2661         the lifetime of its data members.
2662
2663         * WebCore.xcodeproj/project.pbxproj:
2664         * platform/audio/PlatformAudioData.h: Added.
2665         (WebCore::PlatformAudioData::kind):
2666         * platform/audio/WebAudioBufferList.cpp: Added.
2667         (WebCore::WebAudioBufferList::WebAudioBufferList):
2668         (WebCore::WebAudioBufferList::buffers):
2669         (WebCore::WebAudioBufferList::bufferCount):
2670         (WebCore::WebAudioBufferList::buffer):
2671         * platform/audio/WebAudioBufferList.h: Added.
2672         (WebCore::WebAudioBufferList::list):
2673         (WebCore::WebAudioBufferList::operator AudioBufferList&):
2674         (WebCore::WebAudioBufferList::kind):
2675         (isType):
2676
2677         Then update existing code to work in terms of WebAudioBufferList:
2678
2679         * platform/audio/mac/AudioSampleBufferList.cpp:
2680         (WebCore::AudioSampleBufferList::AudioSampleBufferList):
2681         (WebCore::AudioSampleBufferList::mixFrom):
2682         (WebCore::AudioSampleBufferList::copyFrom):
2683         (WebCore::AudioSampleBufferList::copyTo):
2684         (WebCore::AudioSampleBufferList::reset):
2685         (WebCore::AudioSampleBufferList::configureBufferListForStream): Deleted.
2686         * platform/audio/mac/AudioSampleBufferList.h:
2687         (WebCore::AudioSampleBufferList::bufferList):
2688         * platform/audio/mac/AudioSampleDataSource.cpp:
2689         (WebCore::AudioSampleDataSource::pushSamples):
2690         * platform/audio/mac/AudioSampleDataSource.h:
2691         * platform/mediastream/RealtimeMediaSource.cpp:
2692         (WebCore::RealtimeMediaSource::audioSamplesAvailable):
2693         * platform/mediastream/RealtimeMediaSource.h:
2694         (WebCore::RealtimeMediaSource::Observer::audioSamplesAvailable):
2695         * platform/mediastream/mac/AVAudioCaptureSource.h:
2696         * platform/mediastream/mac/AVAudioCaptureSource.mm:
2697         (WebCore::AVAudioCaptureSource::captureOutputDidOutputSampleBufferFromConnection):
2698         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
2699         (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable):
2700         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.h:
2701         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
2702         (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):
2703         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
2704
2705         Finally, actually update MockRealtimeAudioSource to emit stereo samples. Importantly, set
2706         the correct values for the m_streamFormat; mBytesPerFrame and mBytesPerPacket are not
2707         multiplied by the channelCount. When generating audio, write to both channels of data.
2708
2709         * platform/mediastream/mac/MockRealtimeAudioSourceMac.h:
2710         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
2711         (WebCore::MockRealtimeAudioSourceMac::emitSampleBuffers):
2712         (WebCore::MockRealtimeAudioSourceMac::reconfigure):
2713         (WebCore::MockRealtimeAudioSourceMac::render):
2714
2715 2017-02-09  Antti Koivisto  <antti@apple.com>
2716
2717         Nullptr crash under styleForFirstLetter
2718         https://bugs.webkit.org/show_bug.cgi?id=167756
2719         rdar://problem/30029354
2720
2721         Reviewed by Zalan Bujtas.
2722
2723         Don't know how we get here. Paper over the crash.
2724
2725         * rendering/RenderBlock.cpp:
2726         (WebCore::styleForFirstLetter):
2727
2728             Use parent first line style if we compute null style for the first letter renderer.
2729
2730 2017-02-09  Antoine Quint  <graouts@apple.com>
2731
2732         [Modern Media Controls] Playing an <audio> element on iOS makes the controls disappear
2733         https://bugs.webkit.org/show_bug.cgi?id=168047
2734         <rdar://problem/30441939>
2735
2736         Reviewed by Eric Carlson.
2737
2738         The controls bar auto-hide behavior is disabled for <audio> elements, but on iOS we have
2739         a TapGestureRecognizer to identify when controls are tapped to toggle controls visibility.
2740         This gesture recognizer would be on at all times, but it should only be enabled when
2741         fadesToIdle is set to true.
2742
2743         Test: media/modern-media-controls/media-controller/media-controller-ios-only-enable-tap-gesture-recognizer-with-fades-when-idle.html
2744
2745         * Modules/modern-media-controls/controls/controls-bar.js:
2746         (ControlsBar.prototype.set fadesWhileIdle):
2747
2748 2017-02-09  Antoine Quint  <graouts@apple.com>
2749
2750         [Modern Media Controls] <audio> element does not show any background on iOS
2751         https://bugs.webkit.org/show_bug.cgi?id=168046
2752         <rdar://problem/30441872>
2753
2754         Reviewed by Eric Carlson.
2755
2756         Use a solid gray background for <audio> elements on iOS.
2757
2758         Test: media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-audio-background.html
2759
2760         * Modules/modern-media-controls/controls/ios-inline-media-controls.css:
2761         (:host(audio) .media-controls.ios.inline > .controls-bar:before):
2762
2763 2017-02-09  Antoine Quint  <graouts@apple.com>
2764
2765         [Modern Media Controls] Controls fail to instantiate in an XHTML document
2766         https://bugs.webkit.org/show_bug.cgi?id=168045
2767         <rdar://problem/30290095>
2768
2769         Reviewed by Eric Carlson.
2770
2771         Always use valid HTML and XHTML strings when creating HTML elements.
2772
2773         Test: media/modern-media-controls/media-controller/media-controller-in-xhtml.xhtml
2774
2775         * Modules/modern-media-controls/controls/button.js:
2776         (Button):
2777         * Modules/modern-media-controls/controls/buttons-container.js:
2778         * Modules/modern-media-controls/controls/controls-bar.js:
2779         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
2780         * Modules/modern-media-controls/controls/media-controls.js:
2781         * Modules/modern-media-controls/controls/slider.js:
2782         * Modules/modern-media-controls/controls/status-label.js:
2783         * Modules/modern-media-controls/controls/time-control.js:
2784         * Modules/modern-media-controls/controls/time-label.js:
2785         * Modules/modern-media-controls/controls/tracks-panel.js:
2786
2787 2017-02-09  Michael Catanzaro  <mcatanzaro@igalia.com>
2788
2789         Unreviewed, fix typo in comment
2790
2791         * loader/DocumentWriter.cpp:
2792         (WebCore::DocumentWriter::replaceDocument):
2793
2794 2017-02-09  Andreas Kling  <akling@apple.com>
2795
2796         Disallow accelerated rendering for ginormous 2D canvases.
2797         <https://webkit.org/b/167968>
2798         <rdar://problem/30119483>
2799
2800         Reviewed by Antti Koivisto.
2801
2802         Add a "maximumAccelerated2dCanvasSize" setting that defaults to 5120x2880
2803         which is the 5K resolution for 16:9.
2804
2805         Also added a way to include the "accelerates drawing" flag in layer tree dumps.
2806
2807         Test: compositing/canvas/accelerated-canvas-compositing-size-limit.html
2808
2809         * html/HTMLCanvasElement.cpp:
2810         (WebCore::HTMLCanvasElement::shouldAccelerate):
2811         * page/Frame.h:
2812         * page/Settings.in:
2813         * platform/graphics/GraphicsLayer.cpp:
2814         (WebCore::GraphicsLayer::dumpProperties):
2815         * platform/graphics/GraphicsLayerClient.h:
2816         * rendering/RenderLayerCompositor.cpp:
2817         (WebCore::RenderLayerCompositor::layerTreeAsText):
2818         * testing/Internals.cpp:
2819         (WebCore::toLayerTreeFlags):
2820         * testing/Internals.h:
2821         * testing/Internals.idl:
2822
2823 2017-02-09  Antti Koivisto  <antti@apple.com>
2824
2825         Remove most cases of #if ENABLE(CACHE_PARTITIONING)
2826         https://bugs.webkit.org/show_bug.cgi?id=167990
2827
2828         Reviewed by Sam Weinig.
2829
2830         We'll just return empty string for the partition if partitioning is not enabled.
2831
2832         * html/DOMURL.cpp:
2833         (WebCore::DOMURL::revokeObjectURL):
2834         * inspector/InspectorPageAgent.cpp:
2835         (WebCore::InspectorPageAgent::cachedResource):
2836         * loader/FrameLoader.cpp:
2837         (WebCore::FrameLoader::loadURL):
2838         * loader/archive/cf/LegacyWebArchive.cpp:
2839         (WebCore::LegacyWebArchive::create):
2840         * loader/cache/CachedResource.h:
2841         (WebCore::CachedResource::url):
2842         (WebCore::CachedResource::cachePartition):
2843         * loader/cache/CachedResourceLoader.cpp:
2844         (WebCore::CachedResourceLoader::requestUserCSSStyleSheet):
2845         (WebCore::CachedResourceLoader::requestResource):
2846         * loader/cache/CachedResourceRequest.cpp:
2847         (WebCore::CachedResourceRequest::setDomainForCachePartition):
2848         * loader/cache/CachedResourceRequest.h:
2849         * loader/cache/MemoryCache.cpp:
2850         (WebCore::MemoryCache::add):
2851         (WebCore::MemoryCache::revalidationSucceeded):
2852         (WebCore::MemoryCache::resourceForRequestImpl):
2853         (WebCore::MemoryCache::addImageToCache):
2854         (WebCore::MemoryCache::removeImageFromCache):
2855         (WebCore::MemoryCache::remove):
2856         (WebCore::MemoryCache::removeResourcesWithOrigin):
2857         (WebCore::MemoryCache::removeResourcesWithOrigins):
2858         (WebCore::MemoryCache::getOriginsWithCache):
2859         (WebCore::MemoryCache::originsWithCache):
2860         * loader/cache/MemoryCache.h:
2861         * page/SecurityOrigin.cpp:
2862         (WebCore::SecurityOrigin::domainForCachePartition):
2863         * page/SecurityOrigin.h:
2864         * platform/SchemeRegistry.cpp:
2865         (WebCore::cachePartitioningSchemes):
2866         (WebCore::SchemeRegistry::shouldPartitionCacheForURLScheme):
2867         * platform/SchemeRegistry.h:
2868         * platform/ios/WebCoreSystemInterfaceIOS.mm:
2869         * platform/mac/WebCoreSystemInterface.h:
2870         * platform/mac/WebCoreSystemInterface.mm:
2871         * platform/network/ResourceRequestBase.cpp:
2872         (WebCore::ResourceRequestBase::setAsIsolatedCopy):
2873         (WebCore::ResourceRequestBase::setCachePartition):
2874         (WebCore::ResourceRequestBase::partitionName):
2875         * platform/network/ResourceRequestBase.h:
2876         (WebCore::ResourceRequestBase::cachePartition):
2877         (WebCore::ResourceRequestBase::setDomainForCachePartition):
2878         * platform/network/cf/ResourceRequest.h:
2879         (WebCore::ResourceRequest::cachePartition): Deleted.
2880         (WebCore::ResourceRequest::setCachePartition): Deleted.
2881         (WebCore::ResourceRequest::setDomainForCachePartition): Deleted.
2882         * platform/network/cf/ResourceRequestCFNet.cpp:
2883         (WebCore::ResourceRequest::doUpdatePlatformRequest):
2884         (WebCore::ResourceRequest::doUpdateResourceRequest):
2885         (WebCore::ResourceRequest::partitionName): Deleted.
2886         (WebCore::ResourceRequest::doPlatformSetAsIsolatedCopy): Deleted.
2887         * platform/network/cf/ResourceResponse.h:
2888         * platform/network/cocoa/ResourceRequestCocoa.mm:
2889         (WebCore::ResourceRequest::doUpdateResourceRequest):
2890         (WebCore::ResourceRequest::doUpdatePlatformRequest):
2891         * testing/Internals.cpp:
2892         (WebCore::Internals::isLoadingFromMemoryCache):
2893
2894 2017-02-09  Ryosuke Niwa  <rniwa@webkit.org>
2895
2896         Add Web Bluetooth as Not Considering
2897         https://bugs.webkit.org/show_bug.cgi?id=168042
2898
2899         Reviewed by Yusuke Suzuki.
2900
2901         Add Web Bluetooth as a feature not being considered to be implemented in WebKit.
2902
2903         * features.json:
2904
2905 2017-02-08  Simon Fraser  <simon.fraser@apple.com>
2906
2907         Put names on more UIViews for ease of debugging
2908         https://bugs.webkit.org/show_bug.cgi?id=168035
2909
2910         Reviewed by Tim Horton.
2911
2912         Name the page overlay layers.
2913
2914         * page/PageOverlayController.cpp:
2915         (WebCore::PageOverlayController::createRootLayersIfNeeded):
2916         (WebCore::PageOverlayController::installPageOverlay):
2917
2918 2017-02-08  Commit Queue  <commit-queue@webkit.org>
2919
2920         Unreviewed, rolling out r211912.
2921         https://bugs.webkit.org/show_bug.cgi?id=168034
2922
2923         http/tests/media/media-stream/disconnected-frame-permission-
2924         denied.html should be updated (Requested by youenn on
2925         #webkit).
2926
2927         Reverted changeset:
2928
2929         "[MediaStream] Remove legacy Navigator.webkitGetUserMedia"
2930         https://bugs.webkit.org/show_bug.cgi?id=168016
2931         http://trac.webkit.org/changeset/211912
2932
2933 2017-02-08  Youenn Fablet  <youennf@gmail.com>
2934
2935         HTML Link elements should load data URLs as same origin
2936         https://bugs.webkit.org/show_bug.cgi?id=168032
2937         <rdar://problem/30275036>
2938
2939         Reviewed by Alex Christensen.
2940
2941         Test: fast/dom/data-url-css-link-element-cors-active.html
2942
2943         Making CSS data URLs resources considered as same origin when loaded through link elements.
2944         In the future, we should consider remove the data URL same origin flag and fully align with the fetch and HTML spec.
2945
2946         * html/HTMLLinkElement.cpp:
2947         (WebCore::HTMLLinkElement::process):
2948
2949 2017-02-08  Sam Weinig  <sam@webkit.org>
2950
2951         REGRESSION (r193286): Promise chain no longer prevent UI refresh
2952         <rdar://problem/28062149>
2953         https://bugs.webkit.org/show_bug.cgi?id=161291
2954
2955         Reviewed by Geoffrey Garen.
2956
2957         Add new subtest to js/dom/Promise.html
2958
2959         * dom/Microtasks.cpp:
2960         (WebCore::MicrotaskQueue::append):
2961         (WebCore::MicrotaskQueue::remove):
2962         (WebCore::MicrotaskQueue::performMicrotaskCheckpoint):
2963         * dom/Microtasks.h:
2964         The microtask queue needs to be completely drained, even of new microtasks added while
2965         the previous task was run. Remove the m_tasksAppendedDuringMicrotaskCheckpoint as it is
2966         no longer needed.
2967
2968 2017-02-08  Eric Carlson  <eric.carlson@apple.com>
2969
2970         [MediaStream] Remove legacy Navigator.webkitGetUserMedia
2971         https://bugs.webkit.org/show_bug.cgi?id=168016
2972
2973         Reviewed by Youenn Fablet.
2974
2975         No new tests, existing tests updated.
2976
2977         * WebCore.xcodeproj/project.pbxproj: NavigatorUserMedia.
2978         * DerivedSources.make: Ditto.
2979         * CMakeLists.txt: Ditto.
2980         * Modules/mediastream/NavigatorUserMedia.idl: Removed.
2981         * Modules/mediastream/NavigatorUserMedia.js: Removed.
2982         * WebCore.xcodeproj/project.pbxproj:
2983         * page/Navigator.idl: Add some whitespace to force derived sources to be rebuild correctly.
2984
2985 2017-02-08  Chris Dumez  <cdumez@apple.com>
2986
2987         Use smaller tiles in windows that are not active to facilitate App Napping
2988         https://bugs.webkit.org/show_bug.cgi?id=167997
2989         <rdar://problem/30358835>
2990
2991         Reviewed by Simon Fraser.
2992
2993         Use smaller / non-adaptative tiles in windows that are not active to facilitate
2994         App Napping after <https://trac.webkit.org/r197594>.
2995
2996         Test: compositing/tiling/non-active-window-tiles-size.html
2997
2998         * page/FrameView.cpp:
2999         (WebCore::FrameView::contentsResized):
3000         (WebCore::FrameView::addedOrRemovedScrollbar):
3001         (WebCore::FrameView::computeScrollability):
3002         (WebCore::FrameView::updateTiledBackingAdaptiveSizing):
3003         (WebCore::FrameView::unobscuredContentSizeChanged):
3004         (WebCore::FrameView::setViewExposedRect):
3005         * page/FrameView.h:
3006         * page/Page.cpp:
3007         (WebCore::Page::setActivityState):
3008         (WebCore::Page::isWindowActive):
3009         * page/Page.h:
3010         * platform/graphics/TiledBacking.h:
3011         * platform/graphics/ca/TileController.cpp:
3012         (WebCore::TileController::setTileSizeUpdateDelayDisabledForTesting):
3013         (WebCore::TileController::notePendingTileSizeChange):
3014         * platform/graphics/ca/TileController.h:
3015         * testing/Internals.cpp:
3016         (WebCore::Internals::resetToConsistentState):
3017         (WebCore::Internals::disableTileSizeUpdateDelay):
3018         * testing/Internals.h:
3019         * testing/Internals.idl:
3020
3021 2017-02-08  Chris Dumez  <cdumez@apple.com>
3022
3023         Unreviewed, rolling out r211907.
3024
3025         Broke the build
3026
3027         Reverted changeset:
3028
3029         "[MediaStream] Remove legacy Navigator.webkitGetUserMedia"
3030         https://bugs.webkit.org/show_bug.cgi?id=168016
3031         http://trac.webkit.org/changeset/211907
3032
3033 2017-02-08  Eric Carlson  <eric.carlson@apple.com>
3034
3035         [MediaStream] Remove legacy Navigator.webkitGetUserMedia
3036         https://bugs.webkit.org/show_bug.cgi?id=168016
3037
3038         Reviewed by Youenn Fablet.
3039
3040         No new tests, existing tests updated.
3041
3042         * WebCore.xcodeproj/project.pbxproj: NavigatorUserMedia.
3043         * DerivedSources.make: Ditto.
3044         * CMakeLists.txt: Ditto.
3045         * Modules/mediastream/NavigatorUserMedia.idl: Removed.
3046         * Modules/mediastream/NavigatorUserMedia.js: Removed.
3047         * WebCore.xcodeproj/project.pbxproj:
3048
3049 2017-02-08  Wenson Hsieh  <wenson_hsieh@apple.com>
3050
3051         Add kUTTypeUTF8PlainText and kUTTypeJPEG to the list of compatible content types in DragData
3052         https://bugs.webkit.org/show_bug.cgi?id=167942
3053         <rdar://problem/30315079>
3054
3055         Reviewed by Tim Horton.
3056
3057         Adds UTI types for dragging UTF8 plain text and JPEG images to the list of supported types in DragDataMac.mm.
3058         Also handles reading these types in PasteboardMac.mm. I verified manually with a test app that if a platform
3059         NSView vends only UTF8 plaintext or JPEG images when dragging, WebKit is able to read the contents of the
3060         pasteboard as text and an image, respectively.
3061
3062         New TestWebKitAPI tests in DragAndDropPasteboardTests.mm.
3063
3064         * platform/mac/DragDataMac.mm:
3065         (WebCore::DragData::containsCompatibleContent):
3066         * platform/mac/PasteboardMac.mm:
3067         (WebCore::Pasteboard::read):
3068
3069 2017-02-08  Said Abou-Hallawa  <sabouhallawa@apple.com>
3070
3071         getIntersectionList always returns empty NodeList until layout is complete
3072         https://bugs.webkit.org/show_bug.cgi?id=81423
3073
3074         Reviewed by Simon Fraser.
3075
3076         Layout needs to be forced before trying to figure out which SVGElements
3077         intersect with a given SVGRect. We do the same thing in the DOM API
3078         Element::getBoundingClientRect().
3079
3080         Test: svg/custom/intersection-list-before-layout.html
3081
3082         * svg/SVGSVGElement.cpp:
3083         (WebCore::SVGSVGElement::getIntersectionList):
3084
3085 2017-02-08  Antoine Quint  <graouts@apple.com>
3086
3087         [Modern Media Controls] Implement reduced and tight padding modes
3088         https://bugs.webkit.org/show_bug.cgi?id=167933
3089         <rdar://problem/30396994>
3090
3091         Reviewed by Dean Jackson.
3092
3093         The design specs for modern media controls mandate the following for inline media controls:
3094
3095             - controls at or below 300pt width use a 12pt left margin for the left buttons container,
3096             and a 12pt right margin for the right buttons container, and 16pth button margin inside
3097             both containers ("reduced padding mode").
3098
3099             - when dropping at or below 120pt width, controls use an 8pt left margin for
3100             the left buttons container, and an 8pt right margin for the right buttons container, and
3101             12pt button margin inside both containers and a shorter bar (25pt) ("compact mode").
3102
3103             - in the case of audio controls, at 400pt or less, controls switch to 12pt margins and
3104             button margins for both buttons containers ("tight padding mode").
3105
3106         The "compact" mode was already implemented as a dedicated MacOSInlineMediaControls subclass.
3107         Since we now have a more generic need to vary the metrics used for inline media controls on
3108         macOS, we add new features to MacOSInlineMediaControls to support varying metrics based on
3109         the controls' "layoutTraits" property.
3110
3111         So MediaController is changed such that it knows to use the new TightPadding and ReducedPadding
3112         layout traits based on the conditions defined above, and _updateControlsIfNeeded() is changed
3113         to set the "layoutTraits" property on the controls whenever called, which in our case is most
3114         relevantly a "resize" event on the shadow root or a TrackEvent on the video tracks (to determine
3115         when we're possibly changing between a video and audio file).
3116
3117         As a result, the "layoutTraits" setter is called on MacOSInlineMediaControls, which updates
3118         the metrics for the various buttons containers, but also notifies the buttons contained
3119         within that layout traits may have changed, since some buttons support a "compact" appearance
3120         that is shorter and require a different image file. To that end, IconButton has been updated
3121         so that it may be notified of a layout traits change through a new layoutTraitsDidChange()
3122         method, that checks whether the current layout traits differ from those last used when loading
3123         the icon.
3124
3125         Tests: media/modern-media-controls/icon-button/icon-button-change-layout-traits.html
3126                media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-compact-buttons-styles.html
3127                media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-compact-controls-bar-styles.html
3128                media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-compact.html
3129                media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-reduced-padding.html
3130                media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-tight-padding.html
3131                media/modern-media-controls/media-controller/media-controller-compact.html
3132                media/modern-media-controls/media-controller/media-controller-reduced-padding.html
3133                media/modern-media-controls/media-controller/media-controller-tight-padding.html
3134
3135         * Modules/modern-media-controls/controls/icon-button.js:
3136         (IconButton.prototype.set iconName):
3137         (IconButton.prototype.layoutTraitsDidChange):
3138         (IconButton.prototype._loadImage):
3139         * Modules/modern-media-controls/controls/layout-item.js:
3140         * Modules/modern-media-controls/controls/macos-compact-inline-media-controls.js: Removed.
3141         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
3142         (MacOSInlineMediaControls.prototype.get layoutTraits):
3143         (MacOSInlineMediaControls.prototype.set layoutTraits):
3144         (MacOSInlineMediaControls.prototype._matchLayoutTraits):
3145         * Modules/modern-media-controls/js-files:
3146         * Modules/modern-media-controls/media/media-controller.js:
3147         (MediaController):
3148         (MediaController.prototype.get layoutTraits):
3149         (MediaController.prototype.handleEvent):
3150         (MediaController.prototype._updateControlsIfNeeded):
3151         (MediaController.prototype._controlsClassForLayoutTraits):
3152         (MediaController.prototype._shouldFadeBetweenControls): Deleted.
3153         (MediaController.prototype._controlsClass): Deleted.
3154         * WebCore.xcodeproj/project.pbxproj:
3155
3156 2017-02-08  Aakash Jain  <aakash_jain@apple.com>
3157
3158         Move private methods from WKGraphics.h to a separate header file
3159         https://bugs.webkit.org/show_bug.cgi?id=167996
3160
3161         Reviewed by Alexey  Proskuryakov.
3162
3163         * platform/ios/wak/WKGraphicsInternal.h: Added.
3164         * WebCore.xcodeproj/project.pbxproj: Added WKGraphicsInternal.h
3165         * platform/ios/wak/WKGraphics.h: Moved methods to WKGraphicsInternal.h
3166         * platform/graphics/mac/GraphicsContextMac.mm: Included new header file.
3167         * platform/ios/wak/WKGraphics.mm: Same.
3168
3169 2017-02-08  Brady Eidson  <beidson@apple.com>
3170
3171         Opt-out iBooks from synchronous willSendRequest on iOS.
3172         <rdar://problem/30129966> and https://bugs.webkit.org/show_bug.cgi?id=168006
3173
3174         Reviewed by Brent Fulgham.
3175
3176         No new tests (Not a testable behavior change at this time).
3177
3178         * platform/network/mac/ResourceHandleMac.mm:
3179         (WebCore::synchronousWillSendRequestEnabled): iBooks never gets synchronous willSendRequest:
3180
3181 2017-02-08  Sam Weinig  <sam@webkit.org>
3182
3183         Split JSDOMConstructor.h/cpp up by class
3184         https://bugs.webkit.org/show_bug.cgi?id=167958
3185
3186         Reviewed by Tim Horton.
3187
3188         Splits JSDOMConstructor up by class.
3189         - Renames DOMConstructorObject to JSDOMConstructorBase.
3190         - Renames DOMConstructorWithDocument to JSDOMConstructorWithDocument.
3191         - Renames DOMConstructorJSBuiltinObject to JSDOMBuiltinConstructorBase.
3192         - Renames JSBuiltinConstructor to JSDOMBuiltinConstructor.
3193
3194         * CMakeLists.txt:
3195         * WebCore.xcodeproj/project.pbxproj:
3196         * bindings/js/JSBindingsAllInOne.cpp:
3197         Add new files.
3198
3199         * bindings/js/JSDOMBinding.h:
3200         (WebCore::propertyNameToString): Deleted.
3201         (WebCore::propertyNameToAtomicString): Deleted.
3202         * bindings/js/JSDOMBuiltinConstructor.h: Copied from Source/WebCore/bindings/js/JSDOMConstructor.h.
3203         * bindings/js/JSDOMBuiltinConstructorBase.cpp: Copied from Source/WebCore/bindings/js/JSDOMConstructor.cpp.
3204         * bindings/js/JSDOMBuiltinConstructorBase.h: Copied from Source/WebCore/bindings/js/JSDOMConstructor.h.
3205         * bindings/js/JSDOMConstructor.cpp: Removed.
3206         * bindings/js/JSDOMConstructor.h: Remove all classes other than JSDOMConstructor.
3207         * bindings/js/JSDOMConstructorBase.cpp: Copied from Source/WebCore/bindings/js/JSDOMConstructor.cpp.
3208         * bindings/js/JSDOMConstructorBase.h: Copied from Source/WebCore/bindings/js/JSDOMConstructor.h.
3209         * bindings/js/JSDOMConstructorNotConstructable.h: Copied from Source/WebCore/bindings/js/JSDOMConstructor.h.
3210         * bindings/js/JSDOMConstructorWithDocument.cpp: Copied from Source/WebCore/bindings/js/JSDOMConstructor.cpp.
3211         * bindings/js/JSDOMConstructorWithDocument.h: Copied from Source/WebCore/bindings/js/JSDOMConstructor.h.
3212         * bindings/js/JSDOMNamedConstructor.h: Copied from Source/WebCore/bindings/js/JSDOMConstructor.h.
3213
3214         * bindings/js/JSDOMConvertStrings.h:
3215         (WebCore::propertyNameToString):
3216         (WebCore::propertyNameToAtomicString):
3217         Move these here from JSDOMBinding.
3218
3219         * bindings/js/JSHTMLElementCustom.cpp:
3220         (WebCore::constructJSHTMLElement):
3221         * bindings/js/JSMutationObserverCustom.cpp:
3222         (WebCore::constructJSMutationObserver):
3223         * bindings/js/JSReadableStreamPrivateConstructors.cpp:
3224         * bindings/js/JSStorageCustom.cpp:
3225         * bindings/js/JSUserMessageHandlersNamespaceCustom.cpp:
3226         (WebCore::JSUserMessageHandlersNamespace::getOwnPropertySlotDelegate):
3227         * bindings/js/JSWorkerCustom.cpp:
3228         (WebCore::constructJSWorker):
3229         * bindings/scripts/CodeGeneratorJS.pm:
3230         (GetConstructorTemplateClassName):
3231         (GenerateConstructorDeclaration):
3232         Update includes/names.
3233
3234         * dom/StaticRange.cpp:
3235         (WebCore::StaticRange::~StaticRange):
3236         * dom/StaticRange.h:
3237         Add out-of-line destructor, so Node.h does not have to be included.
3238
3239 2017-02-08  Joseph Pecoraro  <pecoraro@apple.com>
3240
3241         Initialize the main RunLoop in iOS WebKitLegacy
3242         https://bugs.webkit.org/show_bug.cgi?id=167953
3243
3244         Reviewed by Alexey Proskuryakov.
3245
3246         * platform/ios/wak/WebCoreThread.mm:
3247         (StartWebThread):
3248         Initialize the main runloop on the main thread during iOS WebKit initialization.
3249
3250 2017-02-08  Aakash Jain  <aakash_jain@apple.com>
3251
3252         Move private methods from WKContentObservation.h to a separate header file
3253         https://bugs.webkit.org/show_bug.cgi?id=167998
3254
3255         Reviewed by Alexey Proskuryakov.
3256
3257         * WebCore.xcodeproj/project.pbxproj: Added WKContentObservationInternal.h
3258         * platform/ios/wak/WKContentObservationInternal.h: Added.
3259         * platform/ios/wak/WKContentObservation.h: Moved methods to WKContentObservationInternal.h
3260         * platform/ios/wak/WKContentObservation.cpp: Included new header file.
3261         * page/DOMTimer.cpp: Same.
3262         * page/DOMWindow.cpp: Same.
3263         * style/RenderTreeUpdater.cpp: Same.
3264
3265 2017-02-08  Youenn Fablet  <youenn@apple.com>
3266
3267         RTCPeerConnection constructor can take null as input
3268         https://bugs.webkit.org/show_bug.cgi?id=167992
3269
3270         Reviewed by Chris Dumez.
3271
3272         Covered by updated test.
3273
3274         RTCPeerConnection takes an optional Dictionary as input.
3275         As per https://heycam.github.io/webidl/#es-dictionary, null is converted to an empty dictionary.
3276
3277         * Modules/mediastream/RTCPeerConnection.js:
3278         (initializeRTCPeerConnection):
3279
3280 2017-02-08  Andreas Kling  <akling@apple.com>
3281
3282         No need for CachedFrame to detach custom scrollbars.
3283         <https://webkit.org/b/167995>
3284
3285         Reviewed by Sam Weinig.
3286
3287         Custom scrollbars have already been torn down with the rest of the render tree
3288         by the time we're creating a CachedFrame.
3289
3290         * history/CachedFrame.cpp:
3291         (WebCore::CachedFrame::CachedFrame):
3292
3293 2017-02-08  Zalan Bujtas  <zalan@apple.com>
3294
3295         Simple line layout: Fix printReason for unsupported overflow values.
3296         https://bugs.webkit.org/show_bug.cgi?id=168000
3297
3298         Reviewed by Simon Fraser.
3299
3300         Not testable.
3301
3302         * rendering/SimpleLineLayout.cpp:
3303         (WebCore::SimpleLineLayout::canUseForStyle):
3304         (WebCore::SimpleLineLayout::printReason):
3305
3306 2017-02-08  Aakash Jain  <aakash_jain@apple.com>
3307
3308         Remove WebCoreObjCDeallocWithWebThreadLock from header file
3309         https://bugs.webkit.org/show_bug.cgi?id=167987
3310
3311         Reviewed by Alexey Proskuryakov.
3312
3313         * platform/ios/wak/WebCoreThread.mm: Added WebCoreObjCDeallocWithWebThreadLock.
3314         * platform/ios/wak/WebCoreThreadMessage.h: Removed WebCoreObjCDeallocWithWebThreadLock.
3315
3316 2017-02-08  Aakash Jain  <aakash_jain@apple.com>
3317
3318         Move WKMouseInRect to WAKView.mm
3319         https://bugs.webkit.org/show_bug.cgi?id=167989
3320
3321         Reviewed by Alexey Proskuryakov.
3322
3323         * platform/ios/wak/WAKAppKitStubs.h: Removed WKMouseInRect.
3324         * platform/ios/wak/WAKAppKitStubs.m:
3325         (WKMouseInRect): Deleted.
3326         * platform/ios/wak/WAKView.mm: 
3327         (-[WAKView mouse:inRect:]): Added the logic of WKMouseInRect here instead of separate function call.
3328
3329 2017-02-08  Aakash Jain  <aakash_jain@apple.com>
3330
3331         Remove unused method WebCore::PluginData::pluginNameForMimeType
3332         https://bugs.webkit.org/show_bug.cgi?id=167986
3333
3334         Reviewed by Anders Carlsson.
3335
3336         * plugins/PluginData.cpp:
3337         (WebCore::PluginData::pluginNameForWebVisibleMimeType): Deleted.
3338         * plugins/PluginData.h: Removed pluginNameForWebVisibleMimeType.
3339
3340 2017-02-08  Carlos Garcia Campos  <cgarcia@igalia.com>
3341
3342         [GTK] Fix translatable form validation messages
3343         https://bugs.webkit.org/show_bug.cgi?id=167984
3344
3345         Reviewed by Michael Catanzaro.
3346
3347         Most of them are just wrong. Use the same mesages than mac, which also makes some tests pass.
3348
3349         Fixes: fast/forms/validation-message-maxLength.html
3350                fast/forms/validationMessage.html
3351
3352         * platform/gtk/LocalizedStringsGtk.cpp:
3353         (WebCore::validationMessageValueMissingText):
3354         (WebCore::validationMessageValueMissingForCheckboxText):
3355         (WebCore::validationMessageValueMissingForFileText):
3356         (WebCore::validationMessageValueMissingForMultipleFileText):
3357         (WebCore::validationMessageValueMissingForRadioText):
3358         (WebCore::validationMessageValueMissingForSelectText):
3359         (WebCore::validationMessageTypeMismatchText):
3360         (WebCore::validationMessageTypeMismatchForEmailText):
3361         (WebCore::validationMessageTypeMismatchForMultipleEmailText):
3362         (WebCore::validationMessageTypeMismatchForURLText):
3363         (WebCore::validationMessagePatternMismatchText):
3364         (WebCore::validationMessageTooShortText):
3365         (WebCore::validationMessageTooLongText):
3366         (WebCore::validationMessageRangeUnderflowText):
3367         (WebCore::validationMessageRangeOverflowText):
3368         (WebCore::validationMessageStepMismatchText):
3369         (WebCore::validationMessageBadInputForNumberText):
3370
3371 2017-02-08  Chris Dumez  <cdumez@apple.com>
3372
3373         Add support for enhanced privacy diagnostic logging
3374         https://bugs.webkit.org/show_bug.cgi?id=167948
3375         <rdar://problem/30385112>
3376
3377         Reviewed by Antti Koivisto.
3378
3379         Add new logDiagnosticMessageWithEnhancedPrivacy() method to DiagnosticLoggingClient
3380         that is used for enhanced privacy logging. Start using this new API to log domains
3381         that are visited.
3382
3383         * loader/EmptyClients.cpp:
3384         * loader/FrameLoader.cpp:
3385         (WebCore::logNavigation):
3386         (WebCore::FrameLoader::loadWithDocumentLoader):
3387         * page/DiagnosticLoggingClient.h:
3388         * page/DiagnosticLoggingKeys.cpp:
3389         (WebCore::DiagnosticLoggingKeys::domainVisitedKey):
3390         * page/DiagnosticLoggingKeys.h:
3391
3392 2017-02-08  Carlos Garcia Campos  <cgarcia@igalia.com>
3393
3394         [GStreamer] Critical warnings when media player is destroyed
3395         https://bugs.webkit.org/show_bug.cgi?id=167981
3396
3397         Reviewed by Xabier Rodriguez-Calvar.
3398
3399         It can happen that the source doesn't have a parent when we try to disconnect the element-added signal.
3400
3401         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3402         (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer):
3403         (WebCore::MediaPlayerPrivateGStreamer::sourceChanged):
3404
3405 2017-02-08  Miguel Gomez  <magomez@igalia.com>
3406
3407         [GTK] Reduce TiledBackingStore tile coverage when on memory pressure state
3408         https://bugs.webkit.org/show_bug.cgi?id=167980
3409
3410         Reviewed by Carlos Garcia Campos.
3411
3412         Use a smaller coverAreaMultiplier in the TiledBackingStore when in memory pressure situation, to reduce
3413         the amount of tiles created.
3414
3415         No new tests.
3416
3417         * platform/graphics/texmap/coordinated/TiledBackingStore.cpp:
3418         (WebCore::TiledBackingStore::createTilesIfNeeded):
3419         (WebCore::TiledBackingStore::createTiles):
3420         * platform/graphics/texmap/coordinated/TiledBackingStore.h:
3421
3422 2017-02-08  Zan Dobersek  <zdobersek@igalia.com>
3423
3424         [EME] Implement MediaKeySession::remove()
3425         https://bugs.webkit.org/show_bug.cgi?id=167870
3426
3427         Reviewed by Xabier Rodriguez-Calvar.
3428
3429         Implement MediaKeySession::remove() as outlined in the specification.
3430
3431         The CDMInstance::removeSessionData() virtual method is added. CDMInstance
3432         implementors should remove any session data stored for the session that's
3433         represented by the passed-in session ID and session type.
3434
3435         Once the session data is removed, the passed-in callback should be invoked
3436         by the CDMInstance object so that MediaKeySession can immediately queue a
3437         task in which it updates key statuses and expiration, reject the promise if