[iOS DnD] ENABLE_DRAG_SUPPORT should be turned off for iOS 10 and enabled by default
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-08-09  Wenson Hsieh  <wenson_hsieh@apple.com>
2
3         [iOS DnD] ENABLE_DRAG_SUPPORT should be turned off for iOS 10 and enabled by default
4         https://bugs.webkit.org/show_bug.cgi?id=175392
5         <rdar://problem/33783207>
6
7         Reviewed by Tim Horton and Megan Gardner.
8
9         Tweak FeatureDefines to enable drag and drop by default, and disable only on unsupported platforms (i.e. iOS 10).
10         No change in behavior.
11
12         * Configurations/FeatureDefines.xcconfig:
13
14 2017-08-09  Kirill Ovchinnikov  <kirill.ovchinnikov@lge.com>
15
16         Old subtitle track is not deleted on 'src' attribute change event
17         https://bugs.webkit.org/show_bug.cgi?id=175031
18
19         Reviewed by Eric Carlson.
20
21         Test: media/track/text-track-src-change.html
22
23         * html/HTMLMediaElement.cpp:
24         (WebCore::HTMLMediaElement::textTrackReadyStateChanged):
25         * html/HTMLTrackElement.cpp:
26         (WebCore::HTMLTrackElement::loadTimerFired):
27         * html/shadow/MediaControls.cpp:
28         (WebCore::MediaControls::clearTextDisplayContainer):
29         * html/shadow/MediaControls.h:
30
31 2017-08-09  Ryan Haddad  <ryanhaddad@apple.com>
32
33         Unreviewed, rolling out r220457.
34
35         This change introduced API test failures.
36
37         Reverted changeset:
38
39         "WTF::Function does not allow for reference / non-default
40         constructible return types"
41         https://bugs.webkit.org/show_bug.cgi?id=175244
42         http://trac.webkit.org/changeset/220457
43
44 2017-08-09  Don Olmstead  <don.olmstead@sony.com>
45
46         [WinCairo] Fix build after rev 220399
47         https://bugs.webkit.org/show_bug.cgi?id=175360
48
49         Reviewed by Žan Doberšek.
50
51         No new tests. No change in behavior.
52
53         * platform/graphics/texmap/TextureMapperGLHeaders.h:
54
55 2017-08-09  Nan Wang  <n_wang@apple.com>
56
57         AX: crash at WebCore::AccessibilityObject::supportsARIALiveRegion() const + 24
58         https://bugs.webkit.org/show_bug.cgi?id=175340
59         <rdar://problem/33782159>
60
61         Reviewed by Chris Fleizach.
62
63         When adding a psuedo element child to a RenderBlockFlow element, there might be a chance where
64         the element has already been layed out but we are still holding onto its stale children. Fixed it
65         by notifying AX correctly when inserting/removing children during layout.
66
67         Test: accessibility/add-children-pseudo-element.html
68
69         * rendering/RenderBlockFlow.cpp:
70         (WebCore::RenderBlockFlow::insertFloatingObject):
71         (WebCore::RenderBlockFlow::removeFloatingObject):
72
73 2017-08-09  Charlie Turner  <cturner@igalia.com>
74
75         [GStreamer][MSE] Add missing lock around getStreamByTrackId
76         https://bugs.webkit.org/show_bug.cgi?id=175323
77
78         Reviewed by Xabier Rodriguez-Calvar.
79
80         Covered by existing tests.
81
82         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
83         (WebCore::PlaybackPipeline::enqueueSample): Ensure the media source
84         lock is taken before modifiying the track queues indirectly via the
85         iterator use in getTrackId.
86
87 2017-08-09  Daniel Bates  <dabates@apple.com>
88
89         REGRESSION (r219013): OAuth flows are broken when redirecting back to application after authentication
90         https://bugs.webkit.org/show_bug.cgi?id=175247
91         <rdar://problem/33679804>
92
93         Reviewed by Brady Eidson.
94
95         Add SPI so that Safari can differentiate between a form submission and a redirected form submission
96         and have PolicyCheck notify the frame loader client if the navigation was in response to receiving a
97         redirect response. This is the WebKit portion to fix an issue when a native app makes use of an OAuth
98         OAuth flow that bounces to Safari for user login and then bounce back to the app. Microsoft Graph's
99         OAuth flow is one example.
100
101         Safari was differentiating between a form submission and a redirected form submission based on the
102         nullity of WKNavigationAction.sourceFrame because in both cases the navigation type was WKNavigationTypeFormSubmitted.
103         The navigation type is the same for both navigations because WebKit always used the navigation
104         action from the original request for the redirect request when the original request redirected.
105         Prior to r219013, WKNavigationAction.sourceFrame would be nil for a form submission that redirects.
106         Following r219013, WKNavigationAction.sourceFrame is non-nil unless the navigation was initiated by
107         API. In particular, WKNavigationAction.sourceFrame is non-nil for the redirect navigation corresponding
108         to a form submission that redirects.
109
110         * loader/EmptyClients.cpp:
111         (WebCore::EmptyFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
112         * loader/FrameLoaderClient.h:
113         Have dispatchDecidePolicyForNavigationAction() take a boolean as to whether the navigation was in
114         response to receiving a redirect response.
115         * loader/PolicyChecker.cpp:
116         (WebCore::PolicyChecker::checkNavigationPolicy): Notify the frame loader client whether the navigation
117         is in response to receiving a redirect response.
118
119 2017-08-09  Sam Weinig  <sam@webkit.org>
120
121         WTF::Function does not allow for reference / non-default constructible return types
122         https://bugs.webkit.org/show_bug.cgi?id=175244
123
124         Reviewed by Chris Dumez.
125
126         * bindings/js/JSCustomElementInterface.h:
127         (WebCore::JSCustomElementInterface::invokeCallback):
128         Update the default value for the addArguments parameter to be an empty lambda, rather than
129         default initialization, which leads to a null WTF::Function. This allows us to remove support
130         for calling null WTF::Function. No change in behavior.
131
132 2017-08-09  Andy Estes  <aestes@apple.com>
133
134         [QuickLook] Use case-insensitive comparison of preview MIME types
135         https://bugs.webkit.org/show_bug.cgi?id=175350
136         <rdar://problem/33761159>
137
138         Reviewed by Brady Eidson.
139
140         MIME types are case-insensitive, but PreviewLoader was using a case-sensitive comparison to
141         determine if a MIME type was supported by QLPreviewConverter. As a result we would fail to
142         preview Excel macro-enabled workbooks, since CFNetwork would sniff a MIME type of
143         "application/vnd.ms-excel.sheet.macroEnabled.12" but QuickLook contained
144         "application/vnd.ms-excel.sheet.macroenabled.12" in its set of supported MIME type strings.
145
146         Fix this by copying the QuickLook supported MIME type set into a HashSet using
147         ASCIICaseInsensitiveHash and using that HashSet for MIME type checks.
148
149         Test: quicklook/excel-macro-enabled.html
150
151         * loader/ios/PreviewLoader.mm:
152         (WebCore::PreviewLoader::shouldCreateForMIMEType):
153
154 2017-08-09  Ms2ger  <Ms2ger@igalia.com>
155
156         Remove unnecessary copies of PlatformMediaSessionManager::m_sessions
157         https://bugs.webkit.org/show_bug.cgi?id=175375
158
159         Reviewed by Sam Weinig.
160
161         Remove unnecessary copies of PlatformMediaSessionManager::m_sessions.
162
163         These should have been removed in r207688.
164
165         No new tests: no behavior change.
166
167         * platform/audio/PlatformMediaSessionManager.cpp:
168         (WebCore::PlatformMediaSessionManager::applicationWillBecomeInactive const):
169         (WebCore::PlatformMediaSessionManager::applicationDidBecomeActive const):
170         (WebCore::PlatformMediaSessionManager::applicationDidEnterBackground const):
171         (WebCore::PlatformMediaSessionManager::applicationWillEnterForeground const):
172
173 2017-08-09  Chris Dumez  <cdumez@apple.com>
174
175         Reinstate active flag for iterators
176         https://bugs.webkit.org/show_bug.cgi?id=175312
177
178         Reviewed by Sam Weinig.
179
180         NodeIterator / TreeWalker should no longer allow recursive filters
181         after the following change to the DOM specification:
182         - https://github.com/whatwg/dom/pull/359
183
184         This patch aligns our behavior with the latest specification.
185
186         No new tests, updated existing tests.
187
188         * dom/NodeIterator.cpp:
189         (WebCore::NodeIterator::nextNode):
190         (WebCore::NodeIterator::previousNode):
191         Note that we now also call m_candidateNode.clear() before returning an
192         exception. This was a pre-existing bug that we failed to do so in the
193         exception case but it became more obvious after this change now that
194         we throw. This was causing traversal/moz-bug559526.html to fail
195         otherwise (the filter was called one too many times). The test case
196         is passing in Firefox (The filter is called 4 times and they throw
197         each time).
198
199         * dom/Traversal.cpp:
200         (WebCore::NodeIteratorBase::NodeIteratorBase):
201         (WebCore::NodeIteratorBase::acceptNode):
202         * dom/Traversal.h:
203         * dom/TreeWalker.cpp:
204
205 2017-08-09  Antti Koivisto  <antti@apple.com>
206
207         RenderQuote should not mutate render tree
208         https://bugs.webkit.org/show_bug.cgi?id=175328
209
210         Reviewed by Zalan Bujtas.
211
212         RenderQuote text renderers are currently created and deleted in a quirky fashion using a linked list.
213         This patch moves to a simpler model that guarantees the mutations are always done in controlled fashion
214         during render tree update.
215
216         * dom/Document.cpp:
217         (WebCore::Document::updateTextRenderer):
218
219             Move text renderer updating to Document so we can set the inRenderTreeUpdate bit for it too.
220
221         * dom/Document.h:
222         * dom/Text.cpp:
223         (WebCore::Text::updateRendererAfterContentChange):
224         * rendering/RenderDescendantIterator.h:
225         (WebCore::RenderDescendantIteratorAdapter<T>::at):
226         (WebCore::RenderDescendantConstIteratorAdapter<T>::at const):
227
228             Add at() function for starting iteration from a specified renderer.
229
230         * rendering/RenderQuote.cpp:
231         (WebCore::RenderQuote::insertedIntoTree):
232         (WebCore::RenderQuote::willBeRemovedFromTree):
233
234             Register and unregister quotes to RenderView.
235             Don't do any mutations.
236
237         (WebCore::RenderQuote::styleDidChange):
238
239             Invalidate the text renderer but don't mutate it.
240
241         (WebCore::RenderQuote::updateTextRenderer):
242         (WebCore::RenderQuote::computeText const):
243         (WebCore::RenderQuote::updateRenderers):
244
245             Compute depth of all render quotes and update the text renderer as needed.
246
247         (WebCore::RenderQuote::willBeDestroyed): Deleted.
248         (WebCore::RenderQuote::attachQuote): Deleted.
249         (WebCore::RenderQuote::detachQuote): Deleted.
250         (WebCore::RenderQuote::updateDepth): Deleted.
251
252             Get rid of the linked list.
253
254         * rendering/RenderQuote.h:
255         * rendering/RenderView.cpp:
256         (WebCore::RenderView::registerQuote):
257         (WebCore::RenderView::unregisterQuote):
258
259             Maintain a render tree order ListHashSet of RenderQuotes.
260
261         (WebCore::RenderView::updateSpecialRenderers):
262
263             Add a function for making additional render tree mutations at the end of a render tree update.
264             Currently this just invokes RenderQuote::updateRenderers.
265
266         * rendering/RenderView.h:
267         * style/RenderTreeUpdater.cpp:
268         (WebCore::RenderTreeUpdater::commit):
269
270             Call RenderView::updateSpecialRenderers after committing all other changes.
271
272 2017-08-09  Zan Dobersek  <zdobersek@igalia.com>
273
274         [Soup] Incorrect conversion in msToSoupDate()
275         https://bugs.webkit.org/show_bug.cgi?id=175320
276
277         Reviewed by Carlos Garcia Campos.
278
279         Original patch by VaL Doroshchuk.
280
281         * platform/network/soup/NetworkStorageSessionSoup.cpp:
282         (WebCore::msToSoupDate): monthFromDayInYear() returns a value in the [0,11] range,
283         while soup_date_new() expects a month value in the [1,12] range. The return value
284         must be thus incremented by one to match that expectation.
285
286 2017-08-08  Wenson Hsieh  <wenson_hsieh@apple.com>
287
288         Unreviewed, rolling out r220393.
289
290         This patch regresses the performance of WebPage::editorState.
291
292         Reverted changeset:
293
294         "[iOS WK2] WKWebView schedules nonstop layout after pressing
295         cmb+b,i,u inside a contenteditable div"
296         https://bugs.webkit.org/show_bug.cgi?id=175116
297         http://trac.webkit.org/changeset/220393
298
299 2017-08-08  Chris Dumez  <cdumez@apple.com>
300
301         [Beacon] Add support for CORS-preflighting for WK2 / NETWORK_SESSION
302         https://bugs.webkit.org/show_bug.cgi?id=175264
303         <rdar://problem/33547793>
304
305         Reviewed by Youenn Fablet.
306
307         Pass additional information when creating a PingHandle so that the PingLoad
308         can deal with CORS-preflighting on Network process side.
309
310         Tests: http/wpt/beacon/cors/cors-preflight-arraybufferview-failure.html
311                http/wpt/beacon/cors/cors-preflight-arraybufferview-success.html
312                http/wpt/beacon/cors/cors-preflight-blob-failure.html
313                http/wpt/beacon/cors/cors-preflight-blob-success.html
314                http/wpt/beacon/cors/cors-preflight-cookie.html
315
316         * WebCore.xcodeproj/project.pbxproj:
317         * loader/CrossOriginAccessControl.cpp:
318         (WebCore::validatePreflightResponse):
319         * loader/CrossOriginAccessControl.h:
320         * loader/CrossOriginPreflightChecker.cpp:
321         (WebCore::CrossOriginPreflightChecker::validatePreflightResponse):
322         * loader/CrossOriginPreflightResultCache.h:
323         * loader/LoaderStrategy.h:
324         * loader/PingLoader.cpp:
325         (WebCore::PingLoader::loadImage):
326         (WebCore::PingLoader::sendPing):
327         (WebCore::PingLoader::sendViolationReport):
328         (WebCore::PingLoader::startPingLoad):
329         * loader/PingLoader.h:
330         * loader/cache/CachedResource.cpp:
331         (WebCore::CachedResource::load):
332         * page/SecurityOrigin.h:
333
334 2017-08-08  Sam Weinig  <sam@webkit.org>
335
336         Address review feedback from https://bugs.webkit.org/show_bug.cgi?id=175246.
337
338         * bindings/js/DOMPromiseProxy.h:
339         * css/FontFaceSet.cpp:
340         * css/FontFaceSet.h:
341
342 2017-08-08  Devin Rousso  <drousso@apple.com>
343
344         Web Inspector: Canvas: support editing WebGL shaders
345         https://bugs.webkit.org/show_bug.cgi?id=124211
346         <rdar://problem/15448958>
347
348         Reviewed by Matt Baker.
349
350         Test: inspector/canvas/updateShader.html
351
352         * inspector/InspectorCanvasAgent.h:
353         * inspector/InspectorCanvasAgent.cpp:
354         (WebCore::InspectorCanvasAgent::updateShader):
355
356         * html/canvas/WebGLRenderingContextBase.h:
357         * html/canvas/WebGLRenderingContextBase.cpp:
358         (WebCore::WebGLRenderingContextBase::linkProgram):
359         (WebCore::WebGLRenderingContextBase::linkProgramWithoutInvalidatingAttribLocations):
360         Normally, when a program is linked, it invalidates any WebGLUniformLocation associated with
361         the program by incrementing its `linkCount`. In order to allow live editing of shaders, we
362         need to be able to compile and link a shader without invalidating these locations. This
363         patch moves the shader linking logic to its own function that is called by `linkProgram` so
364         that InspectorCanvasAgent can compile and link without invalidation.
365
366 2017-08-08  Sam Weinig  <sam@webkit.org>
367
368         [WebIDL] Add support for Promise<> attributes
369         https://bugs.webkit.org/show_bug.cgi?id=175246
370
371         Reviewed by Yusuke Suzuki.
372
373         Introduces and adopts DOMPromiseProxy, a new class for binding promises in a more
374         straightforward and safe (from a wrapper world perspective) way.
375
376         * CMakeLists.txt:
377         * WebCore.xcodeproj/project.pbxproj:
378         * bindings/js/JSFontFaceCustom.cpp: Removed.
379         * bindings/js/JSFontFaceSetCustom.cpp: Removed.
380         * bindings/js/JSMediaKeySessionCustom.cpp: Removed.
381         * bindings/js/JSServiceWorkerContainerCustom.cpp: Removed.
382         * bindings/js/JSWebGPUCommandBufferCustom.cpp: Removed.
383
384             Remove custom bindings only needed for promise attributes. Add DOMPromiseProxy.h
385
386         * Modules/encryptedmedia/MediaKeySession.cpp:
387         (WebCore::MediaKeySession::sessionClosed):
388         (WebCore::MediaKeySession::registerClosedPromise): Deleted.
389         * Modules/encryptedmedia/MediaKeySession.h:
390         * Modules/encryptedmedia/MediaKeySession.idl:
391
392             Replace custom promise code using the registerPromise idiom with DOMPromiseProxy.
393
394         * bindings/IDLTypes.h:
395
396             Add StorageType type alias to allow specifying a specific form for storage. This allows
397             use to use Ref<> for interfaces in DOMPromiseProxy.
398
399         (WebCore::IDLWrapper::convertToParameterType):
400             
401             Also add convertToParameterType, an annoying hack to workaround the fact WTF::Function
402             can't return references / no
403
404         * bindings/js/DOMPromiseProxy.h: Added.
405         (WebCore::DOMPromiseProxy<IDLType>):
406         
407             DOMPromiseProxy is a new class (set of classes) to represent promises that works with the 
408             standard toJS<> / JSDOMConvert infrastructure used by the bindings generator. From the
409             implementation perspective, it is similar to DOMPromiseDeferred, but instead of receiving
410             one as a parameter, you can initialize it directly in your constructor and start using it.
411
412             From the bindings perspective, a DOMPromiseProxy can be converted into a JS Promise by calling
413             its promise function, which will either create a new promise, or return a cached one.
414
415             To make this work, DOMPromiseProxy maintains a Vector of DeferredPromises that hold onto those
416             actualized promises. The reason it has a Vector, is that we need one DeferredPromises per
417             DOMWrapperWorld, just like we need one wrapper for an interface per DOMWrapperWorld in the 
418             wrapper cache. In most cases, only the normal world will be in play, so the Vector has an inline
419             capacity of one.
420             
421             In addition, DOMPromiseProxy maintains a Variant of either an Exception or the result value type.
422             This allows the DOMPromiseProxy to be resolved or rejected at anytime. Then, when the bindings
423             request the promise, the stored result / exception can be resolved / rejected into the promise.
424
425         (WebCore::DOMPromiseProxy<IDLVoid>):
426
427             For void promises, we need slightly different semantics (resolve takes no parameters, Value is
428             a bit indicating resolved state), so it is specialized.
429
430         (WebCore::DOMPromiseProxyWithResolveCallback<IDLType>):
431
432             In addition to the void specialization, we have DOMPromiseProxyWithResolveCallback. Instead of
433             storing the value of the resolution directly, this specialization allows the owner to specify
434             callback to be called when the resolved value is needed. This is needed to avoid reference
435             cycles when the resolved value is the owner such as is the case with FontFace and FontFaceSet.
436
437         * bindings/js/JSDOMConvertPromise.h:
438         (WebCore::JSConverter<IDLPromise<T>>::convert):
439         Add converter that calls through to the DOMPromiseProxy function promise.
440
441         * bindings/js/JSDOMPromiseDeferred.cpp:
442         (WebCore::DeferredPromise::callFunction):
443         (WebCore::DeferredPromise::reject):
444         * bindings/js/JSDOMPromiseDeferred.h:
445         (WebCore::DeferredPromise::create):
446         (WebCore::DeferredPromise::DeferredPromise):
447
448             Add a new create function for DeferredPromise that creates the JSPromiseDeferred for you.
449             Also adds a mode to DeferredPromise to allow keeping the promise after resolution. Maintain
450             the old behavior as the default.
451
452             Change reject to take an Exception as sink rather than an r-value, to allow DOMPromiseProxy
453             to copy a Exception into multiple DeferredPromises. For callers already moving into reject,
454             this should be no change.
455
456         * bindings/scripts/CodeGeneratorJS.pm:
457         (AddToIncludesForIDLType):
458         (GenerateParametersCheck):
459         (GenerateImplementationFunctionCall):
460         (NativeToJSValueDOMConvertNeedsState):
461         (NativeToJSValueDOMConvertNeedsGlobalObject):
462
463             Add support DOMPromiseProxy. For now, this means a new extended attribute, [PromiseProxy],
464             but once I convert all the existing promises over to using DOMPromiseProxy, it will be removed.
465             
466             Also specify the right #includes for promises and necessary parameters for conversion.
467
468         * bindings/scripts/IDLAttributes.json:
469         
470             Add [PromiseProxy], a temporary extended attribute for using DOMPromiseProxy.
471
472         * css/FontFace.cpp:
473         * css/FontFace.h:
474         * css/FontFace.idl:
475         * css/FontFaceSet.cpp:
476         * css/FontFaceSet.h:
477         * css/FontFaceSet.idl:
478
479             Replace custom promise code using the registerPromise idiom with DOMPromiseProxyWithResolveCallback.
480             The callback is necessary for these two classes since the value the resolve is themselves, and using
481             a normal resolve would create a cycle.
482
483         * html/canvas/WebGPUCommandBuffer.cpp:
484         * html/canvas/WebGPUCommandBuffer.h:
485         * html/canvas/WebGPUCommandBuffer.idl:
486         * platform/graphics/cocoa/GPUCommandBufferMetal.mm:
487         * platform/graphics/gpu/GPUCommandBuffer.cpp:
488         * platform/graphics/gpu/GPUCommandBuffer.h:
489
490             Replace custom promise code using the registerPromise idiom with DOMPromiseProxy.
491
492         * page/NavigatorBase.cpp:
493         (WebCore::NavigatorBase::NavigatorBase):
494         * page/NavigatorBase.h:
495
496             Forward declare ServiceWorkerContainer and add an explicit constructor to allow
497             removing #include of ServiceWorkerContainer.h in the header, avoiding an #include cycle.
498
499         * workers/ServiceWorkerContainer.cpp:
500         * workers/ServiceWorkerContainer.h:
501         * workers/ServiceWorkerContainer.idl:
502
503             Replace custom promise code using the registerPromise idiom with DOMPromiseProxy.
504
505         * bindings/scripts/test/JS/JSTestObj.cpp:
506         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
507         * bindings/scripts/test/TestObj.idl:
508
509             Add / update tests.
510
511 2017-08-08  John Wilander  <wilander@apple.com>
512
513         Resource Load Statistics: Merge of dataRecordsRemoved should use std::max()
514         https://bugs.webkit.org/show_bug.cgi?id=175348
515         <rdar://problem/33785695>
516
517         Reviewed by Chris Dumez.
518
519         No new tests. Online change of a statistic that doesn't affect logic flow.
520
521         * loader/ResourceLoadStatistics.cpp:
522         (WebCore::ResourceLoadStatistics::merge):
523             Now uses std::max() instead of addition.
524
525 2017-08-08  Brent Fulgham  <bfulgham@apple.com>
526
527         Sandbox flags do not support document.domain control
528         https://bugs.webkit.org/show_bug.cgi?id=175281
529         <rdar://problem/33778936>
530
531         Reviewed by Chris Dumez.
532
533         Update the 'setDomain' logic to honor the sandbox properties as defined in the current
534         HTML5 specification. This brings us in line with how Chrome and other browsers have
535         worked for some time.
536
537         Test: fast/frames/sandboxed-iframe-domain.html
538
539         * dom/Document.cpp:
540         (WebCore::Document::setDomain): Add check for sandbox flag (with appropriate error message)
541         * dom/SecurityContext.h:
542
543 2017-08-08  Jeremy Jones  <jeremyj@apple.com>
544
545         Change fast seek logic to prevent ping-ponging.
546         https://bugs.webkit.org/show_bug.cgi?id=175167
547         rdar://problem/32936116
548
549         Reviewed by Jer Noble.
550
551         Updated test: media/video-fast-seek.html
552
553         Changed fast seek behavior to always seek early than seek time; and after current time when seeking forward.
554         This prevents ping-ponging, where a fast seek overshoots the target looking for a keyframe.
555         A subsequent seek will suddenly be on the other side of current time and
556         will search in the opposite direction for a key frame; repeat.
557
558         * html/HTMLMediaElement.cpp:
559         (WebCore::HTMLMediaElement::fastSeek):
560
561 2017-08-08  Ms2ger  <Ms2ger@igalia.com>
562
563         Unreviewed. Correct the function name in a debug message.
564         https://bugs.webkit.org/show_bug.cgi?id=175262
565
566         No new tests: debug logs are not tested.
567
568         * platform/audio/PlatformMediaSessionManager.cpp:
569         (WebCore::PlatformMediaSessionManager::applicationDidBecomeActive const):
570
571 2017-08-08  Brent Fulgham  <bfulgham@apple.com>
572
573         Unreviewed build fix after r220376.
574
575         Don't attempt to use isPublicSuffix when building without that
576         feature enabled.
577
578         * dom/Document.cpp:
579         (WebCore::Document::domainIsRegisterable const):
580
581 2017-08-08  Michael Catanzaro  <mcatanzaro@igalia.com>
582
583         [CMake] Properly test if compiler supports compiler flags
584         https://bugs.webkit.org/show_bug.cgi?id=174490
585
586         Reviewed by Konstantin Tokarev.
587
588         * CMakeLists.txt:
589         * PlatformGTK.cmake:
590         * PlatformWPE.cmake:
591
592 2017-08-08  Zan Dobersek  <zdobersek@igalia.com>
593
594         [GStreamer] Don't use GraphicsContext3D in VideoTextureCoperGStreamer
595         https://bugs.webkit.org/show_bug.cgi?id=174774
596
597         Reviewed by Carlos Garcia Campos.
598
599         VideoTextureCoperGStreamer class creates a new GraphicsContext3D internally
600         that's used to render to whichever OpenGL context is current. Such usage
601         doesn't add anything to the user since there's no underlying offscreen-based
602         OpenGL context created, and instead all GraphicsContext3D calls are directly
603         translated to usual OpenGL API calls. We should avoid using GraphicsContext3D
604         in such cases and instead use direct OpenGL API calls.
605
606         This patch achieves that for the VideoTextureCoperGStreamer class. A
607         GraphicsContext3D object is still created because it's needed to construct an
608         instance of the TextureMapperShaderProgram class, but this will be removed as
609         soon as TextureMapperShaderProgram drops the GraphicsContext3D dependence.
610
611         No new tests -- no change in behavior.
612
613         * platform/graphics/gstreamer/VideoTextureCopierGStreamer.cpp:
614         (WebCore::VideoTextureCopierGStreamer::VideoTextureCopierGStreamer):
615         (WebCore::VideoTextureCopierGStreamer::~VideoTextureCopierGStreamer):
616         (WebCore::VideoTextureCopierGStreamer::copyVideoTextureToPlatformTexture):
617         * platform/graphics/gstreamer/VideoTextureCopierGStreamer.h:
618         (WebCore::VideoTextureCopierGStreamer::resultTexture):
619
620 2017-08-08  Zan Dobersek  <zdobersek@igalia.com>
621
622         [TexMap] Drop GC3D* type usage from TextureMapperPlatformLayer{Buffer,Proxy}
623         https://bugs.webkit.org/show_bug.cgi?id=175314
624
625         Reviewed by Carlos Garcia Campos.
626
627         Switch to using OpenGL types in the TextureMapperPlatformLayerBuffer and
628         TextureMapperPlatformLayerProxy classes, instead of the equivalent GC3D*
629         types provided in the GraphicsTypes3D.h header.
630
631         No new tests -- no change in behavior.
632
633         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
634         (WebCore::TextureMapperPlatformLayerBuffer::TextureMapperPlatformLayerBuffer):
635         (WebCore::TextureMapperPlatformLayerBuffer::canReuseWithoutReset):
636         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.h:
637         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
638         (WebCore::TextureMapperPlatformLayerProxy::getAvailableBuffer):
639         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
640
641 2017-08-08  Zan Dobersek  <zdobersek@igalia.com>
642
643         [TexMap] Don't use GraphicsContext3D in ClipStack
644         https://bugs.webkit.org/show_bug.cgi?id=174776
645
646         Reviewed by Carlos Garcia Campos.
647
648         Any GraphicsContext3D object that's passed to ClipStack methods is of the
649         render-to-current-context nature, meaning there's no internally owned GL
650         context that has to be properly handled and all calls are simply passed to
651         OpenGL APIs. We should drop such (non-)usage of GraphicsContext3D in favor
652         of direct OpenGL API invocations.
653
654         This patch covers TextureMapper's ClipStack. Call sites to the apply() and
655         applyIfNeeded() are modified to not pass a reference to any
656         GraphicsContext3D object. Internally, OpenGL API entrypoints and constants
657         are used instead of GraphicsContext3D invocations.
658
659         No new tests -- no change in behavior.
660
661         * platform/graphics/texmap/BitmapTextureGL.cpp:
662         (WebCore::BitmapTextureGL::clearIfNeeded):
663         (WebCore::BitmapTextureGL::bindAsSurface):
664         * platform/graphics/texmap/ClipStack.cpp:
665         (WebCore::ClipStack::apply):
666         (WebCore::ClipStack::applyIfNeeded):
667         * platform/graphics/texmap/ClipStack.h:
668         * platform/graphics/texmap/TextureMapperGL.cpp:
669         (WebCore::TextureMapperGL::bindDefaultSurface):
670         (WebCore::TextureMapperGL::beginScissorClip):
671         (WebCore::TextureMapperGL::beginClip):
672         (WebCore::TextureMapperGL::endClip):
673
674 2017-08-08  Javier Fernandez  <jfernandez@igalia.com>
675
676         Not possible to remove the 'li' element inside the table cell
677         https://bugs.webkit.org/show_bug.cgi?id=173148
678
679         Reviewed by Ryosuke Niwa.
680
681         We need to add a new case for breaking out empty list items when they are
682         at the start of an editable area. Since list items can be also inside
683         table cells, we need to consider this kind of elements as well.
684
685         Tests: editing/deleting/delete-list-items-in-table-cell-1.html
686                editing/deleting/delete-list-items-in-table-cell-2.html
687                editing/deleting/delete-list-items-in-table-cell-3.html
688                editing/deleting/delete-list-items-in-table-cell-4.html
689                editing/deleting/delete-list-items-in-table-cell-5.html
690                editing/deleting/delete-list-items-in-table-cell-6.html
691                editing/deleting/delete-list-items-in-table-cell-7.html
692                editing/deleting/delete-list-items-in-table-cell-8.html
693
694         * editing/TypingCommand.cpp:
695         (WebCore::TypingCommand::deleteKeyPressed):
696
697 2017-08-08  Zan Dobersek  <zdobersek@igalia.com>
698
699         [TexMap] Isolate the TextureMapperPlatformLayerProxyProvider class
700         https://bugs.webkit.org/show_bug.cgi?id=175316
701
702         Reviewed by Carlos Garcia Campos.
703
704         Move the TextureMapperPlatformLayerProxyProvider class (which is the type
705         aliased to PlatformLayer for threaded CoordGraphics) into its own header
706         file. This prevents including the TextureMapperPlatformLayerProxy.h header
707         file in MediaPlayerPrivateGStreamerBase.h, avoiding spilling OpenGL types
708         and function declarations before the GStreamer GL headers include them
709         later in the MediaPlayerPrivateGStreamerBase implementation file.
710
711         In the MediaPlayerPrivateGStreamerBase.h header file, only the new header
712         is included, and a forward declaration of the TextureMapperPlatformLayerProxy
713         class is used. proxy() and swapBuffersIfNeeded() methods are moved into
714         the implementation file to avoid requiring the full definition of the
715         TextureMapperPlatformLayerProxy class.
716
717         Similar is done for the TextureMapperGC3DPlatformLayer class and the
718         Cairo-specific implementation of the ImageBufferData class. The
719         CoordinatedGraphicsLayer implementation file also gains an include of the
720         TextureMapperPlatformLayerProxyProvider.h header since it requires the full
721         definition of that class.
722
723         No new tests -- no change in behavior.
724
725         * platform/graphics/cairo/ImageBufferCairo.cpp:
726         (WebCore::ImageBufferData::proxy const):
727         * platform/graphics/cairo/ImageBufferDataCairo.h:
728         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
729         (WebCore::MediaPlayerPrivateGStreamerBase::updateTexture):
730         (WebCore::MediaPlayerPrivateGStreamerBase::proxy const):
731         (WebCore::MediaPlayerPrivateGStreamerBase::swapBuffersIfNeeded):
732         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
733         * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.cpp:
734         * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.h:
735         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
736         * platform/graphics/texmap/TextureMapperPlatformLayerProxyProvider.h: Added.
737         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
738
739 2017-08-08  Zan Dobersek  <zdobersek@igalia.com>
740
741         Unreviewed. Follow-up to r220392 that fixes build on configurations
742         that disable USE(GSTREAMER_GL).
743
744         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
745         (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):
746         When creating the BitmapTextureGL object, also provide an initialized
747         TextureMapperContextAttributes object.
748
749 2017-08-08  Zan Dobersek  <zdobersek@igalia.com>
750
751         [TexMap] Group GL header file inclusions in a single header file
752         https://bugs.webkit.org/show_bug.cgi?id=175313
753
754         Reviewed by Carlos Garcia Campos.
755
756         Add a helper header file to the TextureMapper subsystem that includes
757         the OpenGL headers, properly addressing the build configuration to
758         include headers as provided by either libepoxy, the OpenGL ES library,
759         or the OpenGL library.
760
761         TextureMapperContextAttributes implementation file is the only one
762         that can leverage the header at the moment, but more will follow.
763
764         * platform/graphics/texmap/TextureMapperContextAttributes.cpp:
765         * platform/graphics/texmap/TextureMapperGLHeaders.h: Copied from Source/WebCore/platform/graphics/texmap/TextureMapperContextAttributes.cpp.
766
767 2017-08-08  Wenson Hsieh  <wenson_hsieh@apple.com>
768
769         [iOS WK2] WKWebView schedules nonstop layout after pressing cmb+b,i,u inside a contenteditable div
770         https://bugs.webkit.org/show_bug.cgi?id=175116
771         <rdar://problem/28279301>
772
773         Reviewed by Darin Adler and Ryosuke Niwa.
774
775         WebCore support for WebPage::editorState refactoring. See WebKit ChangeLogs for more detail.
776
777         Tests: EditorStateTests.TypingAttributesBold
778                EditorStateTests.TypingAttributesItalic
779                EditorStateTests.TypingAttributesUnderline
780                EditorStateTests.TypingAttributesTextAlignmentAbsoluteAlignmentOptions
781                EditorStateTests.TypingAttributesTextAlignmentStartEnd
782                EditorStateTests.TypingAttributesTextAlignmentDirectionalText
783                EditorStateTests.TypingAttributesTextColor
784                EditorStateTests.TypingAttributesMixedStyles
785                EditorStateTests.TypingAttributesLinkColor
786
787         * css/StyleProperties.cpp:
788         (WebCore::StyleProperties::propertyAsColor const):
789         (WebCore::StyleProperties::propertyAsValueID const):
790
791         Introduces some helper functions in StyleProperties to convert CSS property values to Color or a CSSValueID.
792
793         * css/StyleProperties.h:
794         * editing/EditingStyle.cpp:
795         (WebCore::EditingStyle::hasStyle):
796
797         Pull out logic in selectionStartHasStyle that asks for a style TriState into EditingStyle::hasStyle. This is
798         because WebPage::editorState will now query for multiple styles at the selection start, but
799         selectionStartHasStyle currently recomputes styleAtSelectionStart every time it is called. To prevent extra work
800         from being done, we can just call selectionStartHasStyle once and use ask for EditingStyle::hasStyle on the
801         computed EditingStyle at selection start.
802
803         * editing/EditingStyle.h:
804         * editing/Editor.cpp:
805         (WebCore::Editor::selectionStartHasStyle const):
806
807 2017-08-08  Zan Dobersek  <zdobersek@igalia.com>
808
809         [TexMap] Add TextureMapperContextAttributes
810         https://bugs.webkit.org/show_bug.cgi?id=175311
811
812         Reviewed by Carlos Garcia Campos.
813
814         Add and use TextureMapperContextAttributes, a slim struct that holds
815         information about the type and extensions supported by the OpenGL
816         context that's being used for one specific TextureMapperGL instance.
817
818         This struct is initialized in the TextureMapperGL constructor for the
819         OpenGL context that's been made current on that thread, and that will
820         be used for that TextureMapperGL instance through its lifetime. The
821         struct is then also copied into any BitmapTextureGL objects that have
822         been created through this TextureMapperGL (or its texture pool).
823
824         The struct is initialized with information about GLES2 support (which
825         is at this point done through the USE_OPENGL_ES_2 macro) and about
826         specific OpenGL extensions that are supported. These are then used in
827         TextureMapperGL (NPOT textures) and BitmapTextureGL (BGRA support,
828         sub-image unpacking) to deploy specific optimizations or workarounds.
829
830         This ultimately serves as a replacement for clunky static functions
831         that need to operate on GraphicsContext3D objects to retrieve this
832         information.
833
834         No new tests -- no change in behavior.
835
836         * platform/TextureMapper.cmake:
837         * platform/graphics/texmap/BitmapTextureGL.cpp:
838         (WebCore::BitmapTextureGL::BitmapTextureGL):
839         (WebCore::BitmapTextureGL::updateContentsNoSwizzle):
840         (WebCore::BitmapTextureGL::updateContents):
841         (WebCore::driverSupportsSubImage): Deleted.
842         * platform/graphics/texmap/BitmapTextureGL.h:
843         (WebCore::BitmapTextureGL::create):
844         * platform/graphics/texmap/BitmapTexturePool.cpp:
845         (WebCore::BitmapTexturePool::BitmapTexturePool):
846         (WebCore::BitmapTexturePool::createTexture):
847         * platform/graphics/texmap/BitmapTexturePool.h:
848         * platform/graphics/texmap/TextureMapperContextAttributes.cpp: Added.
849         (WebCore::TextureMapperContextAttributes::initialize):
850         * platform/graphics/texmap/TextureMapperContextAttributes.h: Added.
851         * platform/graphics/texmap/TextureMapperGL.cpp:
852         (WebCore::TextureMapperGL::TextureMapperGL):
853         (WebCore::TextureMapperGL::drawTexture):
854         (WebCore::TextureMapperGL::drawTexturedQuadWithProgram):
855         (WebCore::TextureMapperGL::createTexture):
856         (WebCore::driverSupportsNPOTTextures): Deleted.
857         * platform/graphics/texmap/TextureMapperGL.h:
858
859 2017-08-08  Zan Dobersek  <zdobersek@igalia.com>
860
861         [TexMap] Don't expose GraphicsContext3D object
862         https://bugs.webkit.org/show_bug.cgi?id=175310
863
864         Reviewed by Carlos Garcia Campos.
865
866         Remove the GraphicsContext3D getter from the TextureMapperGL class. Instead,
867         the clearColor() method is added that's to be used by the CoordinatedGraphicsScene
868         class which was accessing the GraphicsContext3D object for this purpose.
869
870         * platform/graphics/texmap/TextureMapper.h:
871         * platform/graphics/texmap/TextureMapperGL.cpp:
872         (WebCore::TextureMapperGL::clearColor):
873         * platform/graphics/texmap/TextureMapperGL.h:
874         (WebCore::TextureMapperGL::graphicsContext3D const): Deleted.
875
876 2017-08-07  Simon Fraser  <simon.fraser@apple.com>
877
878         RenderStyle:diff() was inadvertently doing deep compares of StyleRareNonInheritedData etc
879         https://bugs.webkit.org/show_bug.cgi?id=175304
880
881         Reviewed by Tim Horton.
882
883         r210758 changed DataRef::get() from returning a pointer to a reference. This caused all the places
884         in RenderStyle::diff() and related functions, where we intended to do a quick pointer comparison,
885         to doing deep compares via operator!=. This made the code slightly slower.
886
887         Fix by exposing ptr() on DataRef and using it wherever we wish to do pointer comparison.
888
889         * rendering/style/DataRef.h:
890         (WebCore::DataRef::ptr const):
891         * rendering/style/RenderStyle.cpp:
892         (WebCore::RenderStyle::inheritedDataShared const):
893         (WebCore::RenderStyle::changeAffectsVisualOverflow const):
894         (WebCore::RenderStyle::changeRequiresLayout const):
895         (WebCore::RenderStyle::changeRequiresRecompositeLayer const):
896         (WebCore::RenderStyle::listStyleImage const): Expand the function onto multiple lines.
897
898 2017-08-07  Simon Fraser  <simon.fraser@apple.com>
899
900         Add a fast path for rotate() and rotateZ() transform parsing
901         https://bugs.webkit.org/show_bug.cgi?id=175308
902
903         Reviewed by Zalan Bujtas.
904
905         Fast paths only existed for translate-related functions, matrix3d() and scale3d(). Add
906         rotate() and rotateX(), which gives a small boost to one of the MotionMark tests.
907
908         * css/parser/CSSParserFastPaths.cpp:
909         (WebCore::parseSimpleAngle):
910         (WebCore::parseTransformAngleArgument):
911         (WebCore::parseSimpleTransformValue):
912         (WebCore::transformCanLikelyUseFastPath):
913
914 2017-08-07  Simon Fraser  <simon.fraser@apple.com>
915
916         Re-order the tests in RenderLayerCompositor::requiresCompositingLayer() for performance
917         https://bugs.webkit.org/show_bug.cgi?id=175306
918
919         Reviewed by Tim Horton.
920
921         Re-order the tests for compositing reasons so that reasons more likely to happen are higher in the list.
922
923         * rendering/RenderLayerCompositor.cpp:
924         (WebCore::RenderLayerCompositor::requiresCompositingLayer const):
925         (WebCore::RenderLayerCompositor::requiresOwnBackingStore const):
926
927 2017-08-07  Simon Fraser  <simon.fraser@apple.com>
928
929         Avoid a hash lookup in FilterInfo::remove()
930         https://bugs.webkit.org/show_bug.cgi?id=175301
931
932         Reviewed by Sam Weinig.
933
934         FilterInfo::remove() always called map().remove(&layer)), even when layer.m_hasFilterInfo
935         was false (and even asserted that layer.m_hasFilterInfo == map().contains(&layer)).
936
937         So we can early return if layer.m_hasFilterInfo is false.
938
939         * rendering/RenderLayerFilterInfo.cpp:
940         (WebCore::RenderLayer::FilterInfo::getIfExists):
941         (WebCore::RenderLayer::FilterInfo::remove):
942
943 2017-08-07  Simon Fraser  <simon.fraser@apple.com>
944
945         Make TransformOperation::type() non-virtual
946         https://bugs.webkit.org/show_bug.cgi?id=175297
947
948         Reviewed by Sam Weinig.
949
950         Store the OperationType in the base class so that type() and isSameType() can
951         be non-virtual.
952
953         Small perf win on some benchmarks.
954
955         * platform/graphics/transforms/IdentityTransformOperation.h:
956         * platform/graphics/transforms/Matrix3DTransformOperation.h:
957         * platform/graphics/transforms/MatrixTransformOperation.h:
958         * platform/graphics/transforms/PerspectiveTransformOperation.h:
959         * platform/graphics/transforms/RotateTransformOperation.cpp:
960         (WebCore::RotateTransformOperation::blend):
961         * platform/graphics/transforms/RotateTransformOperation.h:
962         * platform/graphics/transforms/ScaleTransformOperation.cpp:
963         (WebCore::ScaleTransformOperation::blend):
964         * platform/graphics/transforms/ScaleTransformOperation.h:
965         * platform/graphics/transforms/SkewTransformOperation.cpp:
966         (WebCore::SkewTransformOperation::blend):
967         * platform/graphics/transforms/SkewTransformOperation.h:
968         * platform/graphics/transforms/TransformOperation.h:
969         (WebCore::TransformOperation::TransformOperation):
970         (WebCore::TransformOperation::type const):
971         (WebCore::TransformOperation::isSameType const):
972         * platform/graphics/transforms/TranslateTransformOperation.cpp:
973         (WebCore::TranslateTransformOperation::blend):
974         * platform/graphics/transforms/TranslateTransformOperation.h:
975
976 2017-08-07  Simon Fraser  <simon.fraser@apple.com>
977
978         Inline ~Color and Color::isExtended()
979         https://bugs.webkit.org/show_bug.cgi?id=175293
980
981         Reviewed by Zalan Bujtas.
982
983         The Color destructor and Color::isExtended() show up on profiles, so inline them.
984         Before r207265 the destructor was inlined.
985         
986         Also make sure that LengthSize::operator== is inlined, which it was not (according
987         to profiles).
988
989         * platform/LengthSize.h:
990         (WebCore::operator==):
991         * platform/graphics/Color.cpp:
992         (WebCore::Color::~Color): Deleted.
993         (WebCore::Color::isExtended const): Deleted.
994         * platform/graphics/Color.h:
995         (WebCore::Color::~Color):
996         (WebCore::Color::isExtended const):
997
998 2017-08-04  Brent Fulgham  <bfulgham@apple.com>
999
1000         Implement the HTML5 same-origin restriction specification
1001         https://bugs.webkit.org/show_bug.cgi?id=175226
1002         <rdar://problem/11079948>
1003
1004         Reviewed by Chris Dumez.
1005
1006         Follow the algorithms defined in the HTML5 specification for relaxing
1007         the same-origin restriction. We were missing a few steps related to
1008         checking for public suffix and presence of a browsing context.
1009
1010         Tested by new TestWebKitAPI tests.
1011
1012         * dom/Document.cpp:
1013         (WebCore::Document::domainIsRegisterable): Added helper function.
1014         (WebCore::Document::setDomain):
1015
1016 2017-08-07  Devin Rousso  <drousso@apple.com>
1017
1018         Web Inspector: Preview Canvas path when viewing a recording
1019         https://bugs.webkit.org/show_bug.cgi?id=174967
1020
1021         Reviewed by Brian Burg.
1022
1023         Tests: fast/canvas/2d.currentPoint.html
1024                fast/canvas/2d.getPath.modification.html
1025                fast/canvas/2d.getPath.newobject.html
1026                fast/canvas/2d.setPath.html
1027
1028         * html/canvas/CanvasPath.idl:
1029         * html/canvas/CanvasPath.h:
1030         * html/canvas/CanvasPath.cpp:
1031         (WebCore::CanvasPath::currentX const):
1032         (WebCore::CanvasPath::currentY const):
1033
1034         * html/canvas/CanvasRenderingContext2D.idl:
1035         * html/canvas/CanvasRenderingContext2D.h:
1036         * html/canvas/CanvasRenderingContext2D.cpp:
1037         (WebCore::CanvasRenderingContext2D::setPath):
1038         (WebCore::CanvasRenderingContext2D::getPath const):
1039
1040         * page/RuntimeEnabledFeatures.h:
1041         (WebCore::RuntimeEnabledFeatures::setInspectorAdditionsEnabled):
1042         (WebCore::RuntimeEnabledFeatures::inspectorAdditionsEnabled const):
1043         Add runtime flag for added IDL items above so that they are only usable within the inspector
1044         process. The runtime flag is not enabled from anywhere else as of now.
1045
1046         * inspector/InspectorCanvas.cpp:
1047         (WebCore::InspectorCanvas::buildInitialState):
1048         Send current path as part of the InitialState.
1049         Drive-by: deduplicate more string values.
1050
1051 2017-08-07  Chris Dumez  <cdumez@apple.com>
1052
1053         Update sendBeacon() to rely on FetchBody instead of the whole FetchRequest
1054         https://bugs.webkit.org/show_bug.cgi?id=175280
1055
1056         Reviewed by Youenn Fablet.
1057
1058         Update sendBeacon() to rely on FetchBody instead of the whole FetchRequest. FetchBody
1059         for data extraction is really the only thing we need at the moment.
1060         The new code also properly sets the CORS mode, which will be needed for Bug 175264.
1061
1062         * Modules/beacon/NavigatorBeacon.cpp:
1063         (WebCore::NavigatorBeacon::sendBeacon):
1064
1065 2017-08-07  Michael Catanzaro  <mcatanzaro@igalia.com>
1066
1067         -Wimplicit-fallthrough warning in ComputedStyleExtractor::propertyValue
1068         https://bugs.webkit.org/show_bug.cgi?id=174469
1069         <rdar://problem/33311638>
1070
1071         Reviewed by Simon Fraser.
1072
1073         Add a RELEASE_ASSERT_NOT_REACHED to silence this warning.
1074
1075         * css/CSSComputedStyleDeclaration.cpp:
1076         (WebCore::ComputedStyleExtractor::propertyValue):
1077
1078 2017-08-06  Filip Pizlo  <fpizlo@apple.com>
1079
1080         Primitive auxiliaries and JSValue auxiliaries should have separate gigacages
1081         https://bugs.webkit.org/show_bug.cgi?id=174919
1082
1083         Reviewed by Keith Miller.
1084
1085         No new tests because no change in behavior.
1086         
1087         Adapting to API changes - we now specify the AlignedMemoryAllocator differently and we need to be
1088         specific about which Gigacage we're using.
1089
1090         * bindings/js/WebCoreJSClientData.cpp:
1091         (WebCore::JSVMClientData::JSVMClientData):
1092         * platform/graphics/cocoa/GPUBufferMetal.mm:
1093         (WebCore::GPUBuffer::GPUBuffer):
1094
1095 2017-08-07  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1096
1097         [Curl] Add abstraction layer of cookie jar implementation for Curl port
1098         https://bugs.webkit.org/show_bug.cgi?id=174943
1099
1100         Reviewed by Brent Fulgham.
1101
1102         * platform/network/curl/CookieJarCurl.cpp:
1103         (WebCore::CookieJarCurlFileSystem::setCookiesFromDOM):
1104         (WebCore::CookieJarCurlFileSystem::cookiesForDOM):
1105         (WebCore::CookieJarCurlFileSystem::cookieRequestHeaderFieldValue):
1106         (WebCore::CookieJarCurlFileSystem::cookiesEnabled):
1107         (WebCore::CookieJarCurlFileSystem::getRawCookies):
1108         (WebCore::CookieJarCurlFileSystem::deleteCookie):
1109         (WebCore::CookieJarCurlFileSystem::getHostnamesWithCookies):
1110         (WebCore::CookieJarCurlFileSystem::deleteCookiesForHostnames):
1111         (WebCore::CookieJarCurlFileSystem::deleteAllCookies):
1112         (WebCore::CookieJarCurlFileSystem::deleteAllCookiesModifiedSince):
1113         (WebCore::cookiesForDOM):
1114         (WebCore::setCookiesFromDOM):
1115         (WebCore::cookieRequestHeaderFieldValue):
1116         (WebCore::cookiesEnabled):
1117         (WebCore::getRawCookies):
1118         (WebCore::deleteCookie):
1119         (WebCore::getHostnamesWithCookies):
1120         (WebCore::deleteCookiesForHostnames):
1121         (WebCore::deleteAllCookies):
1122         (WebCore::deleteAllCookiesModifiedSince):
1123         * platform/network/curl/CookieJarCurl.h: Added.
1124         * platform/network/curl/CurlContext.cpp:
1125         * platform/network/curl/CurlContext.h:
1126         (WebCore::CurlContext::cookieJar):
1127
1128 2017-08-07  Brady Eidson  <beidson@apple.com>
1129
1130         Implement most of ServiceWorkerContainer::addRegistration.
1131         https://bugs.webkit.org/show_bug.cgi?id=175237
1132
1133         Reviewed by Andy Estes.
1134
1135         No new tests (Covered by changes to existing tests).
1136
1137         There's still so much supporting infrastructure to add with these early patches
1138         that I'm still moving them in baby steps for now, hence not implementing
1139         register() all in one shot.
1140         
1141         Things will start moving very quickly once we no longer need to add lots of new
1142         primitives in each change.
1143         
1144         * CMakeLists.txt:
1145         * DerivedSources.make:
1146         * WebCore.xcodeproj/project.pbxproj:
1147         
1148         * page/DOMWindow.cpp:
1149         (WebCore::DOMWindow::navigator const):
1150         
1151         * page/Navigator.cpp:
1152         (WebCore::Navigator::Navigator): Make the constructor take a ScriptExecutionContext for 
1153           creation of objects where its import (e.g. ServiceWorkerContainer).
1154         * page/Navigator.h:
1155
1156         * page/WorkerNavigator.cpp:
1157         (WebCore::WorkerNavigator::WorkerNavigator): Ditto.
1158         * page/WorkerNavigator.h:
1159
1160         * page/NavigatorBase.cpp:
1161         (WebCore::NavigatorBase::NavigatorBase): Create the ServiceWorkerContainer upfront with
1162           the passed-in ScriptExecutionContext.
1163         (WebCore::NavigatorBase::serviceWorker):
1164         * page/NavigatorBase.h:
1165         
1166         Make ServiceWorkerContainer into an ActiveDOMObject. This will eventually be necessary for
1167         Document suspension reasons, but is also necessary because it also needs to be a
1168         ContextDestructionObserver (which ActiveDOMObject is):
1169         * workers/ServiceWorkerContainer.cpp:
1170         (WebCore::ServiceWorkerContainer::ServiceWorkerContainer):
1171         (WebCore::ServiceWorkerContainer::ready):
1172         (WebCore::ServiceWorkerContainer::addRegistration):
1173         (WebCore::ServiceWorkerContainer::getRegistration):
1174         (WebCore::ServiceWorkerContainer::getRegistrations):
1175         (WebCore::ServiceWorkerContainer::activeDOMObjectName const):
1176         (WebCore::ServiceWorkerContainer::canSuspendForDocumentSuspension const):
1177         (WebCore::rejectLater): Deleted.
1178         (WebCore::ServiceWorkerContainer::eventTargetInterface const): Deleted.
1179         (WebCore::ServiceWorkerContainer::scriptExecutionContext const): Deleted.
1180         * workers/ServiceWorkerContainer.h:
1181         * workers/ServiceWorkerContainer.idl:
1182
1183         Add updateViaCache, etc:
1184         * workers/ServiceWorkerRegistration.cpp:
1185         (WebCore::ServiceWorkerRegistration::updateViaCache const):
1186         (WebCore::ServiceWorkerRegistration::update):
1187         (WebCore::ServiceWorkerRegistration::unregister):
1188         * workers/ServiceWorkerRegistration.h:
1189         * workers/ServiceWorkerRegistration.idl:
1190
1191         * workers/ServiceWorkerUpdateViaCache.h: Copied from Source/WebCore/workers/ServiceWorkerRegistration.idl.
1192         * workers/ServiceWorkerUpdateViaCache.idl: Copied from Source/WebCore/workers/ServiceWorkerRegistration.idl.
1193
1194         * workers/WorkerGlobalScope.cpp:
1195         (WebCore::WorkerGlobalScope::navigator):
1196         (WebCore::WorkerGlobalScope::navigator const): Deleted.
1197         * workers/WorkerGlobalScope.h:
1198
1199         * workers/WorkerType.h: Copied from Source/WebCore/workers/ServiceWorkerRegistration.idl.
1200         * workers/WorkerType.idl: Copied from Source/WebCore/workers/ServiceWorkerRegistration.idl.
1201
1202 2017-08-07  Ryan Haddad  <ryanhaddad@apple.com>
1203
1204         Unreviewed, rolling out r220299.
1205
1206         This change caused LayoutTest inspector/dom-debugger/dom-
1207         breakpoints.html to fail.
1208
1209         Reverted changeset:
1210
1211         "Web Inspector: capture async stack trace when workers/main
1212         context posts a message"
1213         https://bugs.webkit.org/show_bug.cgi?id=167084
1214         http://trac.webkit.org/changeset/220299
1215
1216 2017-08-07  Brian Burg  <bburg@apple.com>
1217
1218         Cleanup: simplify WebSockets code for RuntimeEnabledFeatures
1219         https://bugs.webkit.org/show_bug.cgi?id=175190
1220
1221         Reviewed by Sam Weinig.
1222
1223         This runtime enabled flag is not used by anything. It was added
1224         for V8 in <https://bugs.webkit.org/show_bug.cgi?id=29896>.
1225
1226         * Modules/websockets/WebSocket.cpp:
1227         (WebCore::WebSocket::setIsAvailable): Deleted.
1228         (WebCore::WebSocket::isAvailable): Deleted.
1229         * Modules/websockets/WebSocket.h:
1230         * Modules/websockets/WebSocket.idl:
1231         * page/RuntimeEnabledFeatures.cpp:
1232         (WebCore::RuntimeEnabledFeatures::webSocketEnabled const): Deleted.
1233         * page/RuntimeEnabledFeatures.h:
1234
1235 2017-08-07  Brian Burg  <bburg@apple.com>
1236
1237         Remove CANVAS_PATH compilation guard
1238         https://bugs.webkit.org/show_bug.cgi?id=175207
1239
1240         Reviewed by Sam Weinig.
1241
1242         * Configurations/FeatureDefines.xcconfig:
1243         * html/canvas/DOMPath.h:
1244         * html/canvas/DOMPath.idl:
1245
1246 2017-08-07  Carlos Alberto Lopez Perez  <clopez@igalia.com>
1247
1248         [WPE][CMake] Only pass pkg-config CFLAGS from (E)GL when not using libepoxy.
1249         https://bugs.webkit.org/show_bug.cgi?id=175125
1250
1251         Reviewed by Michael Catanzaro.
1252
1253         No change of behavior, covered by existing tests.
1254
1255         * CMakeLists.txt: Instead of negating 3 times the use of libepoxy
1256         move the logic for (E)GL detection inside an else() block.
1257
1258 2017-08-07  Antti Koivisto  <antti@apple.com>
1259
1260         REGRESSION (r219121): Airmail 3 prints header part only.
1261         https://bugs.webkit.org/show_bug.cgi?id=175258
1262         <rdar://problem/33601173>
1263
1264         Reviewed by Andreas Kling.
1265
1266         When a WK1 WebViw is printed via AppKit view hierarchy it won't explictly set the page width
1267         but uses the existing width. r219121 assumes that all printing code paths set the page width.
1268
1269         No test, there appears to be no good way to test AppKit printing behaviors without adding complicated
1270         new testing infrastructure.
1271
1272         * rendering/RenderView.cpp:
1273         (WebCore::RenderView::layout):
1274
1275             If we are in printing layout and don't have page width set yet then use the current view width.
1276             This matches the behavior prior r219121.
1277
1278 2017-08-05  Youenn Fablet  <youenn@apple.com>
1279
1280         [Fetch API] Response should keep all ResourceResponse information
1281         https://bugs.webkit.org/show_bug.cgi?id=175099
1282
1283         Reviewed by Sam Weinig.
1284
1285         No change of behavior, covered by existing tests.
1286
1287         Disabling filtering of resource response at DocumentThreadableLoader for fetch API and doing the filtering at FetchResponse level.
1288         This requires passing the tainting parameter to FetchResponse. For that purpose, we store the tainting on the ResourceResponse itself.
1289         This allows mimicking the concept of internal response from the fetch spec.
1290         This might be useful for future developments related to caching the responses.
1291
1292         The body is now also stored in FetchResponse so a flag is added to ensure we only expose the body if allowed.
1293
1294         Changing storage of opaque redirect information to keep the redirection information in the response.
1295
1296         * Modules/fetch/FetchBodyOwner.cpp:
1297         (WebCore::FetchBodyOwner::blob):
1298         (WebCore::FetchBodyOwner::consumeNullBody):
1299         * Modules/fetch/FetchBodyOwner.h:
1300         * Modules/fetch/FetchLoader.cpp:
1301         (WebCore::FetchLoader::start):
1302         * Modules/fetch/FetchResponse.cpp:
1303         (WebCore::FetchResponse::BodyLoader::didReceiveResponse):
1304         (WebCore::FetchResponse::consume):
1305         (WebCore::FetchResponse::consumeBodyAsStream):
1306         (WebCore::FetchResponse::createReadableStreamSource):
1307         * Modules/fetch/FetchResponse.h:
1308         * loader/DocumentThreadableLoader.cpp:
1309         (WebCore::DocumentThreadableLoader::responseReceived):
1310         (WebCore::DocumentThreadableLoader::didReceiveResponse):
1311         (WebCore::DocumentThreadableLoader::didFinishLoading):
1312         (WebCore::DocumentThreadableLoader::loadRequest):
1313         * loader/DocumentThreadableLoader.h:
1314         * loader/SubresourceLoader.cpp:
1315         (WebCore::SubresourceLoader::willSendRequestInternal):
1316         * loader/cache/CachedResource.cpp:
1317         (WebCore::CachedResource::setBodyDataFrom):
1318         (WebCore::CachedResource::setResponse):
1319         * platform/network/ResourceResponseBase.cpp:
1320         (WebCore::ResourceResponseBase::crossThreadData const):
1321         (WebCore::ResourceResponseBase::fromCrossThreadData):
1322         (WebCore::ResourceResponseBase::filter):
1323         * platform/network/ResourceResponseBase.h:
1324         (WebCore::ResourceResponseBase::setTainting):
1325         (WebCore::ResourceResponseBase::tainting const):
1326         (WebCore::ResourceResponseBase::encode const):
1327         (WebCore::ResourceResponseBase::decode):
1328
1329 2017-08-05  Carlos Garcia Campos  <cgarcia@igalia.com>
1330
1331         WebDriver: use in-view center point for clicks instead of bounding box center point
1332         https://bugs.webkit.org/show_bug.cgi?id=174863
1333
1334         Reviewed by Simon Fraser.
1335
1336         Make DOMRect, and FloatPoint::narrowPrecision() available to WebKit layer. Also add
1337         FrameView::clientToDocumentPoint().
1338
1339         * WebCore.xcodeproj/project.pbxproj:
1340         * dom/Element.h:
1341         * page/FrameView.h:
1342         * platform/graphics/FloatPoint.h:
1343
1344 2017-08-05  Carlos Garcia Campos  <cgarcia@igalia.com>
1345
1346         getClientRects doesn't work with list box option elements
1347         https://bugs.webkit.org/show_bug.cgi?id=175016
1348
1349         Reviewed by Darin Adler.
1350
1351         Since HTMLOptionElement and HTMLOptGroupElement don't have a renderer, we are always returning an empty list
1352         from getClientRects. This is working fine in both chromium and firefox, option elements return its own bounding
1353         box and group elements return the bounding box of the group label and all its children items.
1354
1355         Test: fast/dom/HTMLSelectElement/listbox-items-client-rects.html
1356
1357         * dom/Element.cpp:
1358         (WebCore::listBoxElementBoundingBox): Helper function to return the bounding box of a HTMLOptionElement or
1359         HTMLOptGroupElement element.
1360         (WebCore::Element::getClientRects): Use listBoxElementBoundingBox() in case of HTMLOptionElement or
1361         HTMLOptGroupElement.
1362         (WebCore::Element::boundingClientRect): Ditto.
1363
1364 2017-08-04  Youenn Fablet  <youenn@apple.com>
1365
1366         [Cache API] Add Cache and CacheStorage IDL definitions
1367         https://bugs.webkit.org/show_bug.cgi?id=175201
1368
1369         Reviewed by Brady Eidson.
1370
1371         Covered by activated tests.
1372         Adding IDLs as per https://www.w3.org/TR/service-workers-1/#idl-index.
1373         Implementation is guarded by a runtime flag which is off by default.
1374         It is off for DRT but on for WTR.
1375
1376         * CMakeLists.txt:
1377         * DerivedSources.make:
1378         * Modules/cache/Cache.cpp: Added.
1379         (WebCore::Cache::match):
1380         (WebCore::Cache::matchAll):
1381         (WebCore::Cache::add):
1382         (WebCore::Cache::addAll):
1383         (WebCore::Cache::put):
1384         (WebCore::Cache::remove):
1385         (WebCore::Cache::keys):
1386         * Modules/cache/Cache.h: Added.
1387         (WebCore::Cache::create):
1388         (WebCore::Cache::Cache):
1389         * Modules/cache/Cache.idl: Added.
1390         * Modules/cache/CacheQueryOptions.h: Added.
1391         * Modules/cache/CacheQueryOptions.idl: Added.
1392         * Modules/cache/CacheStorage.cpp: Added.
1393         (WebCore::CacheStorage::match):
1394         (WebCore::CacheStorage::has):
1395         (WebCore::CacheStorage::open):
1396         (WebCore::CacheStorage::remove):
1397         (WebCore::CacheStorage::keys):
1398         * Modules/cache/CacheStorage.h: Added.
1399         (WebCore::CacheStorage::create):
1400         * Modules/cache/CacheStorage.idl: Added.
1401         * Modules/cache/DOMWindowCaches.cpp: Added.
1402         (WebCore::DOMWindowCaches::DOMWindowCaches):
1403         (WebCore::DOMWindowCaches::supplementName):
1404         (WebCore::DOMWindowCaches::from):
1405         (WebCore::DOMWindowCaches::caches):
1406         (WebCore::DOMWindowCaches::caches const):
1407         * Modules/cache/DOMWindowCaches.h: Added.
1408         * Modules/cache/DOMWindowCaches.idl: Added.
1409         * Modules/cache/WorkerGlobalScopeCaches.cpp: Added.
1410         (WebCore::WorkerGlobalScopeCaches::supplementName):
1411         (WebCore::WorkerGlobalScopeCaches::from):
1412         (WebCore::WorkerGlobalScopeCaches::caches):
1413         (WebCore::WorkerGlobalScopeCaches::caches const):
1414         * Modules/cache/WorkerGlobalScopeCaches.h: Added.
1415         * Modules/cache/WorkerGlobalScopeCaches.idl: Added.
1416         * WebCore.xcodeproj/project.pbxproj:
1417         * page/RuntimeEnabledFeatures.h:
1418         (WebCore::RuntimeEnabledFeatures::setCacheAPIEnabled):
1419         (WebCore::RuntimeEnabledFeatures::cacheAPIEnabled const):
1420
1421 2017-08-04  Brady Eidson  <beidson@apple.com>
1422
1423         Have navigator.serviceWorker() actually return a ServiceWorkerContainer object.
1424         https://bugs.webkit.org/show_bug.cgi?id=175215
1425
1426         Reviewed by Youenn Fablet.
1427
1428         * page/NavigatorBase.cpp:
1429         (WebCore::NavigatorBase::serviceWorker): Actually create and remember an object.
1430         * page/NavigatorBase.h:
1431
1432         * workers/ServiceWorkerContainer.cpp:
1433         (WebCore::rejectLater): Asynchronously reject the given promise with an error message.
1434         (WebCore::ServiceWorkerContainer::ServiceWorkerContainer):
1435         (WebCore::ServiceWorkerContainer::refEventTarget): Ref the underlying Navigator.
1436         (WebCore::ServiceWorkerContainer::derefEventTarget): Deref the underlying Navigator.
1437         (WebCore::ServiceWorkerContainer::ready): rejectLater the promise.
1438         (WebCore::ServiceWorkerContainer::addRegistration): Ditto.
1439         (WebCore::ServiceWorkerContainer::getRegistration): Ditto.
1440         (WebCore::ServiceWorkerContainer::getRegistrations): Ditto.
1441         * workers/ServiceWorkerContainer.h:
1442
1443 2017-08-04  Chris Dumez  <cdumez@apple.com>
1444
1445         [Beacon] Update sendBeacon to use the CachedResourceLoader
1446         https://bugs.webkit.org/show_bug.cgi?id=175192
1447         <rdar://problem/33725923>
1448
1449         Reviewed by Youenn Fablet.
1450
1451         Update sendBeacon to use the FetchRequest / CachedResourceLoader instead of
1452         the PingLoader. This gets us closer to the specification which is based on
1453         Fetch and reduces code duplication. This also fixes an issue where our
1454         Origin header was not properly set on Beacon resquests.
1455
1456         In a follow-up, we will implement in CachedResourceLoader Fetch's quota for
1457         inflight keepalive requests which is needed to fully support sendBeacon().
1458
1459         * Modules/beacon/NavigatorBeacon.cpp:
1460         (WebCore::NavigatorBeacon::sendBeacon):
1461         * Modules/beacon/NavigatorBeacon.h:
1462         * loader/LinkLoader.cpp:
1463         (WebCore::createLinkPreloadResourceClient):
1464         * loader/PingLoader.cpp:
1465         * loader/PingLoader.h:
1466         * loader/ResourceLoadInfo.cpp:
1467         (WebCore::toResourceType):
1468         * loader/SubresourceLoader.cpp:
1469         (WebCore::logResourceLoaded):
1470         * loader/cache/CachedResource.cpp:
1471         (WebCore::CachedResource::defaultPriorityForResourceType):
1472         (WebCore::CachedResource::load):
1473         * loader/cache/CachedResource.h:
1474         * loader/cache/CachedResourceLoader.cpp:
1475         (WebCore::createResource):
1476         (WebCore::CachedResourceLoader::requestBeaconResource):
1477         (WebCore::contentTypeFromResourceType):
1478         (WebCore::CachedResourceLoader::checkInsecureContent const):
1479         (WebCore::CachedResourceLoader::allowedByContentSecurityPolicy const):
1480         (WebCore::isResourceSuitableForDirectReuse):
1481         * loader/cache/CachedResourceLoader.h:
1482
1483 2017-08-04  John Wilander  <wilander@apple.com>
1484
1485         Resource Load Statistics: Report user interaction immediately, but only when needed
1486         https://bugs.webkit.org/show_bug.cgi?id=175090
1487         <rdar://problem/33685546>
1488
1489         Reviewed by Chris Dumez.
1490
1491         Test: http/tests/loading/resourceLoadStatistics/user-interaction-only-reported-once-within-short-period-of-time.html
1492
1493         * loader/ResourceLoadObserver.cpp:
1494         (WebCore::ResourceLoadObserver::ResourceLoadObserver):
1495         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
1496             Now tells the UI process immediately but also records that it has
1497             done so to avoid doing it when not needed.
1498         (WebCore::ResourceLoadObserver::scheduleNotificationIfNeeded):
1499             Conditional throttling gone, now always throttles.
1500         (WebCore::ResourceLoadObserver::notifyObserver):
1501             Renamed from ResourceLoadObserver::notificationTimerFired().
1502         (WebCore::ResourceLoadObserver::clearState):
1503             New function to allow the test runner to reset the web process'
1504             statistics state now that we keep track of whether or not we've
1505             reported user interaction to the UI process.
1506         (WebCore::ResourceLoadObserver::setShouldThrottleObserverNotifications): Deleted.
1507         (WebCore::ResourceLoadObserver::notificationTimerFired): Deleted.
1508         * loader/ResourceLoadObserver.h:
1509         (): Deleted.
1510         * testing/Internals.cpp:
1511         (WebCore::Internals::resetToConsistentState):
1512         (WebCore::Internals::setResourceLoadStatisticsShouldThrottleObserverNotifications): Deleted.
1513             No longer needed since user interaction is always communicated
1514             immediately.
1515         * testing/Internals.h:
1516         * testing/Internals.idl:
1517
1518 2017-08-04  Matt Baker  <mattbaker@apple.com>
1519
1520         Web Inspector: capture async stack trace when workers/main context posts a message
1521         https://bugs.webkit.org/show_bug.cgi?id=167084
1522         <rdar://problem/30033673>
1523
1524         Reviewed by Brian Burg.
1525
1526         Add instrumentation to DOMWindow to support showing asynchronous
1527         stack traces when the debugger pauses in a MessageEvent handler.
1528
1529         Test: inspector/debugger/async-stack-trace.html
1530
1531         * inspector/InspectorInstrumentation.cpp:
1532         (WebCore::InspectorInstrumentation::didPostMessageImpl):
1533         (WebCore::InspectorInstrumentation::didFailPostMessageImpl):
1534         (WebCore::InspectorInstrumentation::willDispatchPostMessageImpl):
1535         (WebCore::InspectorInstrumentation::didDispatchPostMessageImpl):
1536
1537         * inspector/InspectorInstrumentation.h:
1538         (WebCore::InspectorInstrumentation::didPostMessage):
1539         (WebCore::InspectorInstrumentation::didFailPostMessage):
1540         (WebCore::InspectorInstrumentation::willDispatchPostMessage):
1541         (WebCore::InspectorInstrumentation::didDispatchPostMessage):
1542
1543         * inspector/PageDebuggerAgent.cpp:
1544         (WebCore::PageDebuggerAgent::didClearAsyncStackTraceData):
1545         (WebCore::PageDebuggerAgent::didPostMessage):
1546         (WebCore::PageDebuggerAgent::didFailPostMessage):
1547         (WebCore::PageDebuggerAgent::willDispatchPostMessage):
1548         (WebCore::PageDebuggerAgent::didDispatchPostMessage):
1549         * inspector/PageDebuggerAgent.h:
1550
1551         * page/DOMWindow.cpp:
1552         (WebCore::DOMWindow::postMessage):
1553         (WebCore::DOMWindow::postMessageTimerFired):
1554
1555 2017-08-04  Devin Rousso  <drousso@apple.com>
1556
1557         Web Inspector: add source view for WebGL shader programs
1558         https://bugs.webkit.org/show_bug.cgi?id=138593
1559         <rdar://problem/18936194>
1560
1561         Reviewed by Matt Baker.
1562
1563         Test: inspector/canvas/requestShaderSource.html
1564
1565         * inspector/InspectorCanvasAgent.h:
1566         * inspector/InspectorCanvasAgent.cpp:
1567         (WebCore::InspectorCanvasAgent::requestShaderSource):
1568
1569         * inspector/InspectorShaderProgram.h:
1570         * inspector/InspectorShaderProgram.cpp:
1571         (WebCore::InspectorShaderProgram::shaderForType):
1572
1573 2017-08-04  Matt Lewis  <jlewis3@apple.com>
1574
1575         Unreviewed, rolling out r220288.
1576
1577         This broke multiple builds.
1578
1579         Reverted changeset:
1580
1581         "Use MPAVRoutingController instead of deprecated versions."
1582         https://bugs.webkit.org/show_bug.cgi?id=175063
1583         http://trac.webkit.org/changeset/220288
1584
1585 2017-08-03  Filip Pizlo  <fpizlo@apple.com>
1586
1587         The allocator used to allocate memory for MarkedBlocks and LargeAllocations should not be the Subspace itself
1588         https://bugs.webkit.org/show_bug.cgi?id=175141
1589
1590         Reviewed by Mark Lam.
1591
1592         No new tests because no new behavior.
1593         
1594         Just adapting to an API change.
1595
1596         * ForwardingHeaders/heap/FastMallocAlignedMemoryAllocator.h: Added.
1597         * bindings/js/WebCoreJSClientData.cpp:
1598         (WebCore::JSVMClientData::JSVMClientData):
1599
1600 2017-08-04  Chris Dumez  <cdumez@apple.com>
1601
1602         Match newly-clarified spec on textarea defaultValue/value/child text content
1603         https://bugs.webkit.org/show_bug.cgi?id=173878
1604
1605         Reviewed by Darin Adler.
1606
1607         Update HTMLTextArea.defaultValue to match align with other browsers and match the
1608         latest HTML specification:
1609         - https://html.spec.whatwg.org/#dom-textarea-defaultvalue
1610
1611         The defaultValue getter should return the child text content:
1612         - https://dom.spec.whatwg.org/#concept-child-text-content
1613         Our code was traversing all Text descendants, not just the children.
1614
1615         The defaultValue setter should act as the setter of the Element's textContent
1616         IDL attribute. Previously, we had a custom logic that was only removing the
1617         text children.
1618
1619         Test: imported/w3c/web-platform-tests/html/semantics/forms/the-textarea-element/value-defaultValue-textContent.html
1620
1621         * dom/ScriptElement.cpp:
1622         (WebCore::ScriptElement::scriptContent const):
1623         * dom/TextNodeTraversal.cpp:
1624         (WebCore::TextNodeTraversal::childTextContent):
1625         * dom/TextNodeTraversal.h:
1626         * html/HTMLTextAreaElement.cpp:
1627         (WebCore::HTMLTextAreaElement::defaultValue const):
1628         (WebCore::HTMLTextAreaElement::setDefaultValue):
1629         * html/HTMLTitleElement.cpp:
1630         (WebCore::HTMLTitleElement::text const):
1631
1632 2017-08-04  Said Abou-Hallawa  <sabouhallawa@apple.com>
1633
1634         RenderImageResourceStyleImage::image() should return the nullImage() if the image is not available
1635         https://bugs.webkit.org/show_bug.cgi?id=174874
1636         <rdar://problem/33530130>
1637
1638         Reviewed by Simon Fraser.
1639
1640         If an <img> element has a non-CachedImage content data, e.g. -webkit-named-image,
1641         RenderImageResourceStyleImage will be created and  attached to the RenderImage.
1642         RenderImageResourceStyleImage::m_cachedImage will be set to null at the 
1643         beginning because the m_styleImage->isCachedImage() is false in this case.
1644         When ImageLoader finishes loading the url of the src attribute,
1645         RenderImageResource::setCachedImage() will be called to set m_cachedImage.
1646
1647         A crash will happen when the RenderImage is destroyed. Destroying the 
1648         RenderImage calls RenderImageResourceStyleImage::shutdown() which checks
1649         m_cachedImage and finds it not null, so it calls RenderImageResourceStyleImage::image()
1650         which ends up calling CSSNamedImageValue::image() which returns a null pointer
1651         because the size is empty. RenderImageResourceStyleImage::shutdown() calls
1652         image()->stopAnimation() without checking the return value of image().
1653
1654         Another crash will happen later when deleting the CachedImage from the memory
1655         cache if CachedImage::canDestroyDecodedData() is called because the client
1656         it gets from m_clients is a freed pointer. This happens because RenderImageResourceStyleImage
1657         has m_styleImage of type StyleGeneratedImage but its m_cachedImage is set
1658         by RenderImageResource::setCachedImage(). When RenderImageResourceStyleImage::shutdown()
1659         is called, it calls  StyleGeneratedImage::removeClient() which does not 
1660         know anything about RenderImageResourceStyleImage::m_cachedImage. So we 
1661         end up having a freed pointer in the m_clients of the CachedImage.
1662
1663         Test: fast/images/image-element-image-content-data.html
1664
1665         * rendering/RenderImageResourceStyleImage.cpp:
1666         (WebCore::RenderImageResourceStyleImage::shutdown):  Revert back the changes
1667         of r208511 in this function. Add a call to image()->stopAnimation() without
1668         checking the return of image() since it will return the nullImage() if
1669         the image not available. There is no need to check m_cachedImage before 
1670         calling image() because image() does not check or access m_cachedImage.
1671
1672         If m_styleImage is not a CachedStyleImage but m_cachedImage is not null,
1673         we need to remove m_renderer from the set of the clients of this m_cachedImage.
1674
1675         (WebCore::RenderImageResourceStyleImage::image const): The base class method
1676         RenderImageResource::image() returns the nullImage() if the image not
1677         available. This is because CachedImage::imageForRenderer() returns
1678         the nullImage() if the image is not available; see CachedImage.h. We should
1679         do the same for the derived class for consistency.
1680
1681 2017-08-04  Jeremy Jones  <jeremyj@apple.com>
1682
1683         Use MPAVRoutingController instead of deprecated versions.
1684         https://bugs.webkit.org/show_bug.cgi?id=175063
1685
1686         Reviewed by Tim Horton.
1687
1688         No new tests because no behavior change. This uses a different platform class to present
1689         an interface.
1690
1691         Remove deprecated MPAudioVideoRoutingPopoverController and MPAVRoutingSheet
1692         Add MPMediaControlsViewController.
1693
1694         * platform/spi/ios/MediaPlayerSPI.h:
1695
1696 2017-08-04  Matt Baker  <mattbaker@apple.com>
1697
1698         Web Inspector: REGRESSION (r220233): Check for null pointer passed to WebGLRenderingContextBase::deleteProgram
1699         https://bugs.webkit.org/show_bug.cgi?id=175196
1700         <rdar://problem/33727603>
1701
1702         Reviewed by Devin Rousso.
1703
1704         * html/canvas/WebGLRenderingContextBase.cpp:
1705         (WebCore::WebGLRenderingContextBase::deleteProgram):
1706
1707 2017-08-04  Matt Lewis  <jlewis3@apple.com>
1708
1709         Unreviewed, rolling out r220271.
1710
1711         Rolling out due to Layout Test failing on iOS Simulator.
1712
1713         Reverted changeset:
1714
1715         "Remove STREAMS_API compilation guard"
1716         https://bugs.webkit.org/show_bug.cgi?id=175165
1717         http://trac.webkit.org/changeset/220271
1718
1719 2017-08-03  Sam Weinig  <sam@webkit.org>
1720
1721         [Cleanup] Remove ScriptGlobalObject
1722         https://bugs.webkit.org/show_bug.cgi?id=175173
1723
1724         Reviewed by Darin Adler.
1725
1726         ScriptGlobalObject's two functions were only being used in
1727         four places. Three of those uses (ScriptGlobalObject::set in 
1728         InspectorFrontendClientLocal, WebInspectorUI, and RemoteWebInspectorUI)
1729         were merged into the new function addSelfToGlobalObjectInWorld on
1730         InspectorFrontendHost. The remaining function (ScriptGlobalObject::get
1731         in InspectorFrontendHost) was easily inlined.
1732
1733         * CMakeLists.txt:
1734         * WebCore.xcodeproj/project.pbxproj:
1735         * bindings/js/JSBindingsAllInOne.cpp:
1736         * bindings/js/ScriptGlobalObject.cpp: Removed.
1737         * bindings/js/ScriptGlobalObject.h: Removed.
1738         Removed ScriptGlobalObject.
1739
1740         * inspector/InspectorFrontendClientLocal.cpp:
1741         (WebCore::InspectorFrontendClientLocal::windowObjectCleared):
1742         Remove call to ScriptGlobalObject::set and use addSelfToGlobalObjectInWorld instead.
1743
1744         * inspector/InspectorFrontendHost.h:
1745         * inspector/InspectorFrontendHost.cpp:
1746         (WebCore::InspectorFrontendHost::showContextMenu):
1747         Inline ScriptGlobalObject::get.
1748
1749         (WebCore::InspectorFrontendHost::addSelfToGlobalObjectInWorld):
1750         Add helper which inlines ScriptGlobalObject::set and works
1751         as a helper for the three inspector frontends.
1752
1753 2017-08-04  Ryan Haddad  <ryanhaddad@apple.com>
1754
1755         Unreviewed, rolling out r220268.
1756
1757         This change caused assertion failures on macOS and iOS Debug
1758         WK2.
1759
1760         Reverted changeset:
1761
1762         "Resource Load Statistics: Report user interaction
1763         immediately, but only when needed"
1764         https://bugs.webkit.org/show_bug.cgi?id=175090
1765         http://trac.webkit.org/changeset/220268
1766
1767 2017-08-04  Youenn Fablet  <youenn@apple.com>
1768
1769         Remove STREAMS_API compilation guard
1770         https://bugs.webkit.org/show_bug.cgi?id=175165
1771
1772         Reviewed by Darin Adler.
1773
1774         No change of behavior.
1775
1776         * Configurations/FeatureDefines.xcconfig:
1777         * Modules/fetch/FetchBody.cpp:
1778         (WebCore::FetchBody::consumeAsStream):
1779         * Modules/fetch/FetchBody.h:
1780         * Modules/fetch/FetchBodyOwner.cpp:
1781         (WebCore::FetchBodyOwner::isDisturbedOrLocked const):
1782         (WebCore::FetchBodyOwner::blobLoadingSucceeded):
1783         (WebCore::FetchBodyOwner::blobLoadingFailed):
1784         (WebCore::FetchBodyOwner::blobChunk):
1785         * Modules/fetch/FetchBodyOwner.h:
1786         * Modules/fetch/FetchResponse.cpp:
1787         (WebCore::FetchResponse::BodyLoader::didSucceed):
1788         (WebCore::FetchResponse::BodyLoader::didFail):
1789         (WebCore::FetchResponse::BodyLoader::didReceiveData):
1790         * Modules/fetch/FetchResponse.h:
1791         * Modules/fetch/FetchResponse.idl:
1792         * Modules/fetch/FetchResponse.js:
1793         (initializeFetchResponse):
1794         * Modules/fetch/FetchResponseSource.cpp:
1795         * Modules/fetch/FetchResponseSource.h:
1796         * Modules/streams/ByteLengthQueuingStrategy.idl:
1797         * Modules/streams/ByteLengthQueuingStrategy.js:
1798         * Modules/streams/CountQueuingStrategy.idl:
1799         * Modules/streams/CountQueuingStrategy.js:
1800         * Modules/streams/ReadableByteStreamController.idl:
1801         * Modules/streams/ReadableByteStreamController.js:
1802         * Modules/streams/ReadableByteStreamInternals.js:
1803         * Modules/streams/ReadableStream.idl:
1804         * Modules/streams/ReadableStream.js:
1805         * Modules/streams/ReadableStreamBYOBReader.idl:
1806         * Modules/streams/ReadableStreamBYOBReader.js:
1807         * Modules/streams/ReadableStreamBYOBRequest.idl:
1808         * Modules/streams/ReadableStreamBYOBRequest.js:
1809         * Modules/streams/ReadableStreamDefaultController.idl:
1810         * Modules/streams/ReadableStreamDefaultController.js:
1811         * Modules/streams/ReadableStreamDefaultReader.idl:
1812         * Modules/streams/ReadableStreamDefaultReader.js:
1813         * Modules/streams/ReadableStreamInternals.js:
1814         * Modules/streams/ReadableStreamSource.h:
1815         * Modules/streams/ReadableStreamSource.idl:
1816         * Modules/streams/StreamInternals.js:
1817         * Modules/streams/WritableStream.idl:
1818         * Modules/streams/WritableStream.js:
1819         * Modules/streams/WritableStreamInternals.js:
1820         * bindings/js/JSDOMGlobalObject.cpp:
1821         (WebCore::isReadableByteStreamAPIEnabled):
1822         (WebCore::JSDOMGlobalObject::addBuiltinGlobals):
1823         * bindings/js/JSReadableStreamPrivateConstructors.cpp:
1824         * bindings/js/JSReadableStreamPrivateConstructors.h:
1825         * bindings/js/JSReadableStreamSourceCustom.cpp:
1826         * bindings/js/ReadableStreamDefaultController.cpp:
1827         * bindings/js/ReadableStreamDefaultController.h:
1828         * page/RuntimeEnabledFeatures.h:
1829         * testing/Internals.cpp:
1830         * testing/Internals.h:
1831         * testing/Internals.idl:
1832
1833 2017-08-04  Zan Dobersek  <zdobersek@igalia.com>
1834
1835         [EME][GStreamer] Register ClearKey CDMFactory
1836         https://bugs.webkit.org/show_bug.cgi?id=175136
1837
1838         Reviewed by Xabier Rodriguez-Calvar.
1839
1840         Register the ClearKey CDM factory in CDMFactoryGStreamer. A CDMFactoryClearKey
1841         singleton object is introduced and used for that registration.
1842
1843         The basic CDMFactoryClearKey and CDMPrivateClearKey methods are implemented,
1844         marking `org.w3.clearkey` as the supported key system and `keyids` as the
1845         supported init data type. Additional logic around key system configurations,
1846         distinctive identifiers, persistent state and related restrictions and
1847         requirements is implemented.
1848
1849         This improves the ClearKey EME tests a bit, now progressing to the point of
1850         failing with a NotAllowedError exception due to the CDMInstance object failing
1851         to properly initialize because of missing implementation.
1852
1853         No new tests -- relevant tests have underlying baselines updated to reflect
1854         changes in behavior.
1855
1856         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
1857         (WebCore::CDMFactoryClearKey::singleton):
1858         (WebCore::CDMFactoryClearKey::supportsKeySystem):
1859         (WebCore::CDMPrivateClearKey::supportsInitDataType const):
1860         (WebCore::CDMPrivateClearKey::supportsConfiguration const):
1861         (WebCore::CDMPrivateClearKey::supportsConfigurationWithRestrictions const):
1862         (WebCore::CDMPrivateClearKey::supportsSessionTypeWithConfiguration const):
1863         (WebCore::CDMPrivateClearKey::supportsRobustness const):
1864         (WebCore::CDMPrivateClearKey::distinctiveIdentifiersRequirement const):
1865         (WebCore::CDMPrivateClearKey::persistentStateRequirement const):
1866         * platform/encryptedmedia/clearkey/CDMClearKey.h:
1867         * platform/graphics/gstreamer/eme/CDMFactoryGStreamer.cpp:
1868         (WebCore::CDMFactory::platformRegisterFactories):
1869
1870 2017-08-04  John Wilander  <wilander@apple.com>
1871
1872         Resource Load Statistics: Report user interaction immediately, but only when needed
1873         https://bugs.webkit.org/show_bug.cgi?id=175090
1874         <rdar://problem/33685546>
1875
1876         Reviewed by Chris Dumez.
1877
1878         Test: http/tests/loading/resourceLoadStatistics/user-interaction-only-reported-once-within-short-period-of-time.html
1879
1880         * loader/ResourceLoadObserver.cpp:
1881         (WebCore::ResourceLoadObserver::ResourceLoadObserver):
1882         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
1883             Now tells the UI process immediately but also records that it has
1884             done so to avoid doing it when not needed.
1885         (WebCore::ResourceLoadObserver::scheduleNotificationIfNeeded):
1886             Conditional throttling gone, now always throttles.
1887         (WebCore::ResourceLoadObserver::notifyObserver):
1888             Renamed from ResourceLoadObserver::notificationTimerFired().
1889         (WebCore::ResourceLoadObserver::clearState):
1890             New function to allow the test runner to reset the web process'
1891             statistics state now that we keep track of whether or not we've
1892             reported user interaction to the UI process.
1893         (WebCore::ResourceLoadObserver::setShouldThrottleObserverNotifications): Deleted.
1894         (WebCore::ResourceLoadObserver::notificationTimerFired): Deleted.
1895         * loader/ResourceLoadObserver.h:
1896         (): Deleted.
1897         * testing/Internals.cpp:
1898         (WebCore::Internals::resetToConsistentState):
1899         (WebCore::Internals::setResourceLoadStatisticsShouldThrottleObserverNotifications): Deleted.
1900             No longer needed since user interaction is always communicated
1901             immediately.
1902         * testing/Internals.h:
1903         * testing/Internals.idl:
1904
1905 2017-08-04  Zan Dobersek  <zdobersek@igalia.com>
1906
1907         [EME] Push CDMFactory into the platform layer
1908         https://bugs.webkit.org/show_bug.cgi?id=175129
1909
1910         Reviewed by Xabier Rodriguez-Calvar.
1911
1912         This is a follow-up to r219678 that moved the majority of CDM abstraction
1913         classes into the platform layer, but missed the CDMFactory class.
1914
1915         The CDMFactory abstraction is now also placed in the platform layer. Only
1916         change to the interface is that the createCDM() method can't accept a CDM
1917         object reference anymore since that class is cemented into the WebCore
1918         layer, and no current implementation used it anyway.
1919
1920         Additionally, the static Vector object of registered factories is moved
1921         under the CDMFactory class, along with the register and unregister
1922         functions. The platformRegisterFactories() function is added to allow for
1923         platform-specific factory registrations to occur when the registered
1924         factories are queried for the first time. Empty implementation for this
1925         function is provided for non-GStreamer platforms, while for GStreamer
1926         the implementation is kept in CDMFactoryGStreamer.cpp. It's still empty
1927         for now, but it will register the ClearKey factory there in the near
1928         future.
1929
1930         No new tests -- none affected, only refactoring.
1931
1932         * CMakeLists.txt:
1933         * Modules/encryptedmedia/CDM.cpp:
1934         (WebCore::createCDMPrivateForKeySystem):
1935         (WebCore::CDM::supportsKeySystem):
1936         (WebCore::CDM::CDM):
1937         (): Deleted.
1938         (WebCore::CDM::registerCDMFactory): Deleted.
1939         (WebCore::CDM::unregisterCDMFactory): Deleted.
1940         * Modules/encryptedmedia/CDM.h:
1941         (WebCore::CDMFactory::~CDMFactory): Deleted.
1942         * PlatformWPE.cmake:
1943         * platform/GStreamer.cmake:
1944         * platform/encryptedmedia/CDMFactory.cpp: Added.
1945         (WebCore::CDMFactory::registerFactory):
1946         (WebCore::CDMFactory::unregisterFactory):
1947         (WebCore::CDMFactory::platformRegisterFactories):
1948         * platform/encryptedmedia/CDMFactory.h: Added.
1949         (WebCore::CDMFactory::~CDMFactory):
1950         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
1951         (WebCore::CDMFactoryClearKey::createCDM):
1952         * platform/encryptedmedia/clearkey/CDMClearKey.h:
1953         * platform/encryptedmedia/gstreamer/CDMFactoryGStreamer.cpp: Added.
1954         (WebCore::CDMFactory::platformRegisterFactories):
1955         * testing/MockCDMFactory.cpp:
1956         (WebCore::m_weakPtrFactory):
1957         (WebCore::MockCDMFactory::unregister):
1958         (WebCore::MockCDMFactory::createCDM):
1959         * testing/MockCDMFactory.h:
1960
1961 2017-08-04  Frederic Wang  <fwang@igalia.com>
1962
1963         ScrollingTreeOverflowScrollingNodeIOS uses the wrong fixed position rectangle
1964         https://bugs.webkit.org/show_bug.cgi?id=175135
1965
1966         Reviewed by Simon Fraser.
1967
1968         This patch modifies ScrollingTreeOverflowScrollingNodeIOS::updateChildNodesAfterScroll so
1969         that it uses the fixed position rectangle relative of the first frame ancestor instead of
1970         the one of the main frame. This makes it consistent with ScrollingTreeFrameScrollingNodeIOS
1971         and RenderLayerCompositor. This fixes some flickering issues on iOS.
1972
1973         Test: fast/scrolling/ios/fixed-inside-overflow-inside-iframe.html
1974
1975         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
1976         (WebCore::ScrollingTreeFrameScrollingNode::fixedPositionRect): Helper function to get the
1977         fixed position rect to use for that frame.
1978         * page/scrolling/ScrollingTreeNode.cpp:
1979         (WebCore::ScrollingTreeNode::enclosingFrameNode const): Helper function to get the enclosing
1980         frame for this scrolling node or null if there is none.
1981         * page/scrolling/ScrollingTreeNode.h: Declare enclosingFrameNode.
1982
1983 2017-08-04  Zan Dobersek  <zdobersek@igalia.com>
1984
1985         Unreviewed. Removing redundant NotImplemented.h header inclusions
1986         and cleaning up whitespace issues in libgcrypt-specific CryptoKeyEC
1987         and CryptoKeyRSA implementation files.
1988
1989         * crypto/gcrypt/CryptoKeyECGCrypt.cpp:
1990         * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:
1991
1992 2017-08-04  Jeremy Jones  <jeremyj@apple.com>
1993
1994         Remove unnecesary call to status bar SPI.
1995         https://bugs.webkit.org/show_bug.cgi?id=175176
1996         rdar://problem/20887306
1997
1998         Reviewed by Darin Adler.
1999
2000         No new tests because no behavior change.
2001
2002         This removes an obsolete call to SPI.
2003
2004         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
2005         (VideoFullscreenInterfaceAVKit::cleanupFullscreen):
2006
2007 2017-08-03  Zan Dobersek  <zdobersek@igalia.com>
2008
2009         [GCrypt] Implement CryptoKeyEC PKCS#8 imports
2010         https://bugs.webkit.org/show_bug.cgi?id=173647
2011
2012         Reviewed by Jiewen Tan.
2013
2014         No new tests -- affected tests are now passing and are unskipped.
2015
2016         Implement libgcrypt-based support for PKCS#8 imports of EC keys.
2017
2018         Existing libtasn1 utilities are used to achieve this. First, the provided key data
2019         is decoded against the PrivateKeyInfo ASN.1 definition. First, the version member
2020         of that structure is validated, followed by the algorithm member. The latter is
2021         also properly tested depending on this being an import of an ECDSA or ECDH key.
2022
2023         Data of the parameters member is decoded against the ECParameters ASN.1 definition,
2024         and the namedCurve object identifier is validated, making sure it represents a
2025         valid EC curve and that this curve maches the one specified for the import
2026         operation.
2027
2028         Data of the privateKey member is decoded against the ECPrivateKey ASN.1 definition.
2029         The version member of that structure is properly validated. The optional parameters
2030         member of that structure is already decoded against the ECParameters ASN.1
2031         definition. If present, it is checked to contain a valid EC curve identifier that
2032         matches the specified curve.
2033
2034         The optional publicKey member of the ECPrivateKey structure is validated, testing
2035         that its data matches in size an uncompressed EC point, and that the first byte
2036         of this data is 0x04, as expected for an uncompressed EC point.
2037
2038         What's left is the private key data on the initial ECPrivateKey structure. That
2039         data is retrieved and validated, making sure its size matches the size of the
2040         specified curve. The `private-key` s-expression is then constructed, embedding
2041         the curve name and the validated private key data. This s-expression is then used
2042         to construct an EC context.
2043
2044         If the optional publicKey data was provided, it's used to set the `q` parameter
2045         for this EC context. Otherwise, the value for `q` is computed on-the-fly for the
2046         specified EC and the provided private key. The `q` point is then tested through
2047         the gcry_mpi_ec_curve_point() function, making sure that the derived point is
2048         indeed located on the given EC.
2049
2050         Finally, with the private key properly validated, a new CryptoKeyEC object is
2051         constructed, using the `private-key` s-expression and the parameters that were
2052         specified for this import operation.
2053
2054         * crypto/gcrypt/CryptoKeyECGCrypt.cpp:
2055         (WebCore::CryptoKeyEC::platformImportPkcs8):
2056         * crypto/gcrypt/GCryptUtilities.h:
2057
2058 2017-08-03  Chris Dumez  <cdumez@apple.com>
2059
2060         Fix parsing of <meta http-equiv=refresh> to allow time starting with a '.' without a leading 0
2061         https://bugs.webkit.org/show_bug.cgi?id=175132
2062
2063         Reviewed by Darin Adler.
2064
2065         Fix parsing of <meta http-equiv=refresh> to allow time starting with a '.', without
2066         a leading 0. This is as per https://github.com/whatwg/html/pull/2852.
2067
2068         The latest spec is at:
2069         - https://html.spec.whatwg.org/multipage/semantics.html#attr-meta-http-equiv-refresh
2070
2071         Test: imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/parsing.html
2072
2073         * html/parser/HTMLParserIdioms.cpp:
2074         (WebCore::parseHTTPRefreshInternal):
2075
2076 2017-08-03  Brian Burg  <bburg@apple.com>
2077
2078         Remove ENABLE(WEB_SOCKET) guards
2079         https://bugs.webkit.org/show_bug.cgi?id=167044
2080
2081         Reviewed by Joseph Pecoraro.
2082
2083         * Configurations/FeatureDefines.xcconfig:
2084         * Modules/websockets/ThreadableWebSocketChannel.cpp:
2085         * Modules/websockets/ThreadableWebSocketChannel.h:
2086         * Modules/websockets/ThreadableWebSocketChannelClientWrapper.cpp:
2087         * Modules/websockets/ThreadableWebSocketChannelClientWrapper.h:
2088         * Modules/websockets/WebSocket.cpp:
2089         * Modules/websockets/WebSocket.h:
2090         * Modules/websockets/WebSocket.idl:
2091         * Modules/websockets/WebSocketChannel.cpp:
2092         * Modules/websockets/WebSocketChannel.h:
2093         * Modules/websockets/WebSocketChannelClient.h:
2094         * Modules/websockets/WebSocketDeflateFramer.cpp:
2095         * Modules/websockets/WebSocketDeflateFramer.h:
2096         * Modules/websockets/WebSocketDeflater.cpp:
2097         * Modules/websockets/WebSocketDeflater.h:
2098         * Modules/websockets/WebSocketExtensionDispatcher.cpp:
2099         * Modules/websockets/WebSocketExtensionDispatcher.h:
2100         * Modules/websockets/WebSocketExtensionParser.cpp:
2101         * Modules/websockets/WebSocketExtensionParser.h:
2102         * Modules/websockets/WebSocketExtensionProcessor.h:
2103         * Modules/websockets/WebSocketFrame.cpp:
2104         * Modules/websockets/WebSocketFrame.h:
2105         * Modules/websockets/WebSocketHandshake.cpp:
2106         * Modules/websockets/WebSocketHandshake.h:
2107         * Modules/websockets/WorkerThreadableWebSocketChannel.cpp:
2108         * Modules/websockets/WorkerThreadableWebSocketChannel.h:
2109         * dom/Document.cpp:
2110         (WebCore::Document::Document):
2111         (WebCore::Document::idbConnectionProxy):
2112         (WebCore::Document::socketProvider):
2113         * dom/Document.h:
2114         * dom/ScriptExecutionContext.h:
2115         * inspector/InspectorInstrumentation.cpp:
2116         (WebCore::InspectorInstrumentation::didSendWebSocketFrameImpl):
2117         * inspector/InspectorInstrumentation.h:
2118         (WebCore::InspectorInstrumentation::didSendWebSocketFrame):
2119         * inspector/InspectorNetworkAgent.cpp:
2120         * inspector/InspectorNetworkAgent.h:
2121         * page/RuntimeEnabledFeatures.cpp:
2122         (WebCore::RuntimeEnabledFeatures::webSocketEnabled const):
2123         * page/RuntimeEnabledFeatures.h:
2124         * page/SocketProvider.cpp:
2125         * page/SocketProvider.h:
2126         * workers/WorkerGlobalScope.cpp:
2127         (WebCore::WorkerGlobalScope::WorkerGlobalScope):
2128         * workers/WorkerGlobalScope.h:
2129         * workers/WorkerMessagingProxy.cpp:
2130         (WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
2131         * workers/WorkerThread.cpp:
2132         (WebCore::WorkerThread::WorkerThread):
2133         (WebCore::WorkerThread::socketProvider):
2134         * workers/WorkerThread.h:
2135
2136 2017-08-03  Don Olmstead  <don.olmstead@sony.com>
2137
2138         Remove LayoutUnit dependency in TextStream
2139         https://bugs.webkit.org/show_bug.cgi?id=175110
2140
2141         Reviewed by Zalan Bujtas.
2142
2143         No new tests. No change in behavior.
2144
2145         * CMakeLists.txt:
2146         * WebCore.xcodeproj/project.pbxproj:
2147         * platform/LayoutUnit.cpp: Added.
2148         (WebCore::operator<<):
2149         * platform/LayoutUnit.h:
2150         * platform/text/TextStream.cpp:
2151         * platform/text/TextStream.h:
2152
2153 2017-08-03  Jeremy Jones  <jeremyj@apple.com>
2154
2155         Improve WebKitLegacy video fullscreen animation begin and end rects.
2156         https://bugs.webkit.org/show_bug.cgi?id=175152
2157         rdar://problem/32840576
2158
2159         Reviewed by Eric Carlson.
2160
2161         No new tests, becuase this change has no effect on the DOM.
2162
2163         This change uses different rects for fullscreen animation to prevent the animation
2164         from failing, and to improve the aesthetics of the animation.
2165
2166         * platform/mac/WebVideoFullscreenController.mm:
2167         (frameExpandedToRatioOfFrame):
2168         (-[WebVideoFullscreenController enterFullscreen:]):
2169         (-[WebVideoFullscreenController exitFullscreen]):
2170         (-[WebVideoFullscreenWindow animateFromRect:toRect:withSubAnimation:controllerAction:]):
2171         (constrainFrameToRatioOfFrame): Deleted.
2172
2173 2017-08-03  Jer Noble  <jer.noble@apple.com>
2174
2175         [EME][Mac] SecureStop left on disk in Private Browsing mode.
2176         https://bugs.webkit.org/show_bug.cgi?id=175162
2177
2178         Reviewed by Eric Carlson.
2179
2180         Return an empty string from mediaKeysStorageDirectory() when the page indicates that storage should
2181         be ephemeral(). Previously, an empty string in this case would be treated as an error. Instead, treat
2182         an empty string as valid, and do not try to store or retrieve session information to disk in that case.
2183
2184         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
2185         (WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory const):
2186         * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
2187         (WebCore::CDMSessionAVContentKeySession::releaseKeys):
2188         (WebCore::CDMSessionAVContentKeySession::update):
2189         (WebCore::CDMSessionAVContentKeySession::generateKeyReleaseMessage):
2190         (WebCore::CDMSessionAVContentKeySession::contentKeySession):
2191         * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm:
2192         (WebCore::CDMSessionMediaSourceAVFObjC::storagePath const):
2193
2194 2017-08-03  Youenn Fablet  <youenn@apple.com>
2195
2196         [Fetch API] Add support for Request keepalive getter
2197         https://bugs.webkit.org/show_bug.cgi?id=175151
2198
2199         Reviewed by Chris Dumez.
2200
2201         Test: imported/w3c/web-platform-tests/fetch/api/request/request-keepalive.html
2202
2203         Adding keepalive as a fetch option.
2204         Adding initialization and getter of keepalive into FetchRequest.
2205
2206         * Modules/fetch/FetchRequest.cpp:
2207         (WebCore::buildOptions):
2208         * Modules/fetch/FetchRequest.h:
2209         * Modules/fetch/FetchRequest.idl:
2210         * loader/FetchOptions.h:
2211
2212 2017-08-03  Yoshiaki Jitsukawa  <jitsu@rd.scei.sony.co.jp>
2213
2214         [PAL] Move spi/cf directory into PAL
2215         https://bugs.webkit.org/show_bug.cgi?id=175057
2216
2217         Reviewed by Antti Koivisto.
2218
2219         * WebCore.xcodeproj/project.pbxproj:
2220         * loader/cocoa/DiskCacheMonitorCocoa.mm:
2221         * loader/cocoa/SubresourceLoaderCocoa.mm:
2222         * loader/mac/ResourceLoaderMac.mm:
2223         * platform/cf/CoreMediaSoftLink.cpp:
2224         * platform/cf/CoreMediaSoftLink.h:
2225         * platform/mac/PluginBlacklist.mm:
2226         * platform/mac/WebCoreNSStringExtras.mm:
2227         * platform/mac/WebGLBlacklist.mm:
2228         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
2229         * platform/network/NetworkStorageSession.h:
2230         * platform/network/cf/CookieJarCFNet.cpp:
2231         * platform/network/cf/CredentialStorageCFNet.cpp:
2232         * platform/network/cf/ResourceHandleCFNet.cpp:
2233         * platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp:
2234         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
2235         * platform/network/cf/ResourceRequestCFNet.cpp:
2236         * platform/network/cf/ResourceRequestCFNet.h:
2237         * platform/network/cf/ResourceResponse.h:
2238         * platform/network/cf/ResourceResponseCFNet.cpp:
2239         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
2240         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
2241         * platform/network/cocoa/CookieStorageObserver.h:
2242         * platform/network/cocoa/CredentialCocoa.h:
2243         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
2244         * platform/network/cocoa/ResourceRequestCocoa.mm:
2245         * platform/network/cocoa/ResourceResponseCocoa.mm:
2246         * platform/network/ios/ResourceRequestIOS.mm:
2247         * platform/network/mac/CookieJarMac.mm:
2248         * platform/network/mac/FormDataStreamMac.mm:
2249         * platform/network/mac/ResourceHandleMac.mm:
2250         * platform/network/mac/ResourceRequestMac.mm:
2251         * platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
2252         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
2253         * platform/network/mac/WebCoreURLResponse.h:
2254         * testing/cocoa/WebArchiveDumpSupport.mm:
2255
2256 2017-08-03  Youenn Fablet  <youenn@apple.com>
2257
2258         Remove FETCH_API compilation guard
2259         https://bugs.webkit.org/show_bug.cgi?id=175154
2260
2261         Reviewed by Chris Dumez.
2262
2263         No change of behavior.
2264
2265         * Configurations/FeatureDefines.xcconfig:
2266         * Modules/fetch/DOMWindowFetch.cpp:
2267         * Modules/fetch/DOMWindowFetch.h:
2268         * Modules/fetch/DOMWindowFetch.idl:
2269         * Modules/fetch/FetchBody.cpp:
2270         * Modules/fetch/FetchBody.h:
2271         * Modules/fetch/FetchBody.idl:
2272         * Modules/fetch/FetchBodyConsumer.cpp:
2273         * Modules/fetch/FetchBodyConsumer.h:
2274         * Modules/fetch/FetchBodyOwner.cpp:
2275         * Modules/fetch/FetchBodyOwner.h:
2276         * Modules/fetch/FetchHeaders.cpp:
2277         * Modules/fetch/FetchHeaders.h:
2278         * Modules/fetch/FetchHeaders.idl:
2279         * Modules/fetch/FetchInternals.js:
2280         * Modules/fetch/FetchLoader.cpp:
2281         * Modules/fetch/FetchLoader.h:
2282         * Modules/fetch/FetchLoaderClient.h:
2283         * Modules/fetch/FetchRequest.cpp:
2284         * Modules/fetch/FetchRequest.h:
2285         * Modules/fetch/FetchRequest.idl:
2286         * Modules/fetch/FetchResponse.cpp:
2287         * Modules/fetch/FetchResponse.h:
2288         * Modules/fetch/FetchResponse.idl:
2289         * Modules/fetch/FetchResponse.js:
2290         * Modules/fetch/FetchResponseSource.cpp:
2291         * Modules/fetch/FetchResponseSource.h:
2292         * Modules/fetch/WorkerGlobalScopeFetch.cpp:
2293         * Modules/fetch/WorkerGlobalScopeFetch.h:
2294         * Modules/fetch/WorkerGlobalScopeFetch.idl:
2295         * page/RuntimeEnabledFeatures.h:
2296         (WebCore::RuntimeEnabledFeatures::fetchAPIEnabled const):
2297
2298 2017-08-03  Devin Rousso  <drousso@apple.com>
2299
2300         Web Inspector: add button to open Inspector^2
2301         https://bugs.webkit.org/show_bug.cgi?id=175108
2302
2303         Reviewed by Brian Burg.
2304
2305         This patch just exposes a function to the inspector page. No new functionality was added.
2306
2307         * inspector/InspectorFrontendHost.idl:
2308         * inspector/InspectorFrontendHost.h:
2309         * inspector/InspectorFrontendHost.cpp:
2310         (WebCore::InspectorFrontendHost::inspectInspector):
2311
2312 2017-08-03  Matt Baker  <mattbaker@apple.com>
2313
2314         Web Inspector: Instrument WebGLProgram created/deleted
2315         https://bugs.webkit.org/show_bug.cgi?id=175059
2316
2317         Reviewed by Devin Rousso.
2318
2319         Tests: inspector/canvas/shaderProgram-add-remove-webgl.html
2320                inspector/canvas/shaderProgram-add-remove-webgl2.html
2321
2322         This patch adds instrumentation to WebGLRenderingContextBase for tracking
2323         WebGLPrograms. A new helper class, InspectorShaderProgram, is used by
2324         the CanvasAgent to hold related data.
2325
2326         * CMakeLists.txt:
2327         * WebCore.xcodeproj/project.pbxproj:
2328
2329         * html/canvas/WebGLRenderingContextBase.cpp:
2330         (WebCore::WebGLRenderingContextBase::createProgram):
2331         (WebCore::WebGLRenderingContextBase::deleteProgram):
2332
2333         * inspector/InspectorCanvasAgent.cpp:
2334         (WebCore::InspectorCanvasAgent::enable):
2335         (WebCore::InspectorCanvasAgent::frameNavigated):
2336         (WebCore::InspectorCanvasAgent::didCreateProgram):
2337         (WebCore::InspectorCanvasAgent::willDeleteProgram):
2338         (WebCore::InspectorCanvasAgent::clearCanvasData):
2339         (WebCore::InspectorCanvasAgent::unbindCanvas):
2340         (WebCore::InspectorCanvasAgent::unbindProgram):
2341         (WebCore::InspectorCanvasAgent::assertInspectorProgram):
2342         (WebCore::InspectorCanvasAgent::findInspectorProgram):
2343         * inspector/InspectorCanvasAgent.h:
2344
2345         * inspector/InspectorInstrumentation.cpp:
2346         (WebCore::InspectorInstrumentation::didCreateCSSCanvasImpl):
2347         (WebCore::InspectorInstrumentation::didChangeCSSCanvasClientNodesImpl):
2348         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContextImpl):
2349         (WebCore::InspectorInstrumentation::didChangeCanvasMemoryImpl):
2350         (WebCore::InspectorInstrumentation::recordCanvasActionImpl):
2351         (WebCore::InspectorInstrumentation::didFinishRecordingCanvasFrameImpl):
2352         (WebCore::InspectorInstrumentation::didCreateProgramImpl):
2353         (WebCore::InspectorInstrumentation::willDeleteProgramImpl):
2354
2355         * inspector/InspectorInstrumentation.h:
2356         (WebCore::InspectorInstrumentation::recordCanvasActionImpl):
2357         (WebCore::InspectorInstrumentation::didCreateCSSCanvas):
2358         (WebCore::InspectorInstrumentation::didChangeCSSCanvasClientNodes):
2359         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContext):
2360         (WebCore::InspectorInstrumentation::didChangeCanvasMemory):
2361         (WebCore::InspectorInstrumentation::recordCanvasAction):
2362         (WebCore::InspectorInstrumentation::didFinishRecordingCanvasFrame):
2363         (WebCore::InspectorInstrumentation::didCreateProgram):
2364         (WebCore::InspectorInstrumentation::willDeleteProgram):
2365
2366         * inspector/InspectorShaderProgram.cpp: Added.
2367         (WebCore::InspectorShaderProgram::create):
2368         (WebCore::InspectorShaderProgram::InspectorShaderProgram):
2369         (WebCore::InspectorShaderProgram::context const):
2370         * inspector/InspectorShaderProgram.h: Added.
2371
2372 2017-08-03  Matt Lewis  <jlewis3@apple.com>
2373
2374         Unreviewed, rolling out r220209.
2375
2376         This caused internal build failures.
2377
2378         Reverted changeset:
2379
2380         "Use MPAVRoutingController instead of deprecated versions."
2381         https://bugs.webkit.org/show_bug.cgi?id=175063
2382         http://trac.webkit.org/changeset/220209
2383
2384 2017-08-03  Brady Eidson  <beidson@apple.com>
2385
2386         Add SW IDLs and stub out basic functionality.
2387         https://bugs.webkit.org/show_bug.cgi?id=175115
2388
2389         Reviewed by Chris Dumez.
2390
2391         No new tests (Currently no behavior change).
2392
2393         Overall note: This feature is EnabledAtRuntime as opposed to EnabledBySetting because
2394         the Settings-based code generation is completely broken for non-Document contexts,
2395         whereas the RuntimeEnabledFeatures-based generation is not.
2396     
2397         * CMakeLists.txt:
2398         * Configurations/FeatureDefines.xcconfig:
2399         * DerivedSources.make:
2400         * WebCore.xcodeproj/project.pbxproj:
2401
2402         * bindings/scripts/preprocess-idls.pl: Handle the new global scope c'tor file.
2403
2404         * bindings/js/JSServiceWorkerContainerCustom.cpp: Added.
2405         (WebCore::JSServiceWorkerContainer::ready const):
2406
2407         * bindings/js/JSWorkerGlobalScopeBase.cpp:
2408         (WebCore::toJSWorkerGlobalScope): Refactor to handle both types of derived workers.
2409         (WebCore::toJSServiceWorkerGlobalScope):
2410         * bindings/js/JSWorkerGlobalScopeBase.h:
2411
2412         * dom/EventNames.h:
2413         * dom/EventTargetFactory.in:
2414
2415         * features.json: Change status of feature.
2416
2417         * page/Navigator.idl:
2418         * page/NavigatorBase.cpp:
2419         (WebCore::NavigatorBase::serviceWorker):
2420         * page/NavigatorBase.h:
2421         * page/NavigatorServiceWorker.idl: Added.
2422
2423         * page/RuntimeEnabledFeatures.h:
2424         (WebCore::RuntimeEnabledFeatures::serviceWorkerEnabled const):
2425         (WebCore::RuntimeEnabledFeatures::setServiceWorkerEnabled):
2426
2427         * workers/ServiceWorker.cpp: Added.
2428         (WebCore::ServiceWorker::postMessage):
2429         (WebCore::ServiceWorker::~ServiceWorker):
2430         (WebCore::ServiceWorker::scriptURL const):
2431         (WebCore::ServiceWorker::state const):
2432         (WebCore::ServiceWorker::eventTargetInterface const):
2433         (WebCore::ServiceWorker::scriptExecutionContext const):
2434         * workers/ServiceWorker.h: Added.
2435         * workers/ServiceWorker.idl: Added.
2436
2437         * workers/ServiceWorkerContainer.cpp: Added.
2438         (WebCore::ServiceWorkerContainer::~ServiceWorkerContainer):
2439         (WebCore::ServiceWorkerContainer::controller const):
2440         (WebCore::ServiceWorkerContainer::ready):
2441         (WebCore::ServiceWorkerContainer::addRegistration):
2442         (WebCore::ServiceWorkerContainer::getRegistration):
2443         (WebCore::ServiceWorkerContainer::getRegistrations):
2444         (WebCore::ServiceWorkerContainer::startMessages):
2445         (WebCore::ServiceWorkerContainer::eventTargetInterface const):
2446         (WebCore::ServiceWorkerContainer::scriptExecutionContext const):
2447         * workers/ServiceWorkerContainer.h: Added.
2448         * workers/ServiceWorkerContainer.idl: Added.
2449
2450         * workers/ServiceWorkerGlobalScope.cpp: Added.
2451         (WebCore::ServiceWorkerGlobalScope::registration):
2452         (WebCore::ServiceWorkerGlobalScope::skipWaiting):
2453         * workers/ServiceWorkerGlobalScope.h: Added.
2454         * workers/ServiceWorkerGlobalScope.idl: Added.
2455
2456         * workers/ServiceWorkerRegistration.cpp: Added.
2457         (WebCore::ServiceWorkerRegistration::~ServiceWorkerRegistration):
2458         (WebCore::ServiceWorkerRegistration::installing):
2459         (WebCore::ServiceWorkerRegistration::waiting):
2460         (WebCore::ServiceWorkerRegistration::active):
2461         (WebCore::ServiceWorkerRegistration::scope const):
2462         (WebCore::ServiceWorkerRegistration::update):
2463         (WebCore::ServiceWorkerRegistration::unregister):
2464         (WebCore::ServiceWorkerRegistration::eventTargetInterface const):
2465         (WebCore::ServiceWorkerRegistration::scriptExecutionContext const):
2466         * workers/ServiceWorkerRegistration.h: Added.
2467         * workers/ServiceWorkerRegistration.idl: Added.
2468
2469 2017-08-03  Yoshiaki Jitsukawa  <jitsu@rd.scei.sony.co.jp>
2470
2471         [WebCore] Sort Xcode project files
2472         https://bugs.webkit.org/show_bug.cgi?id=175121
2473
2474         Reviewed by Antti Koivisto.
2475
2476         * WebCore.xcodeproj/project.pbxproj:
2477
2478 2017-08-02  Sam Weinig  <sam@webkit.org>
2479
2480         [WebIDL] Convert MutationCallback to be a normal generated callback
2481         https://bugs.webkit.org/show_bug.cgi?id=174140
2482
2483         Reviewed by Darin Adler.
2484
2485         To make this work more nicely, I:
2486         - Added the ability to for non-nullable interfaces in sequences to be passed
2487           via a Ref<> rather than a RefPtr<> as a parameter to a callback function.
2488           (e.g. callback MyCallback = void (sequence<Foo> foos) will now have the 
2489           signature, CallbackResult<void> handleEvent(const Vector<Ref<Foo>>&) rather
2490           than CallbackResult<void> handleEvent(const Vector<RefPtr<Foo>>&).
2491         - Added a new extended attribute for callback functions called [CallbackThisObject=Type]
2492           which allows you to specify that the callback needs a this object in addition
2493           to its arguments. When specified, the first argument of the C++ implementation
2494           function will now correspond to the this object, with the remaining arguments
2495           shifted over one.
2496         - Converted callback objects to all inherit directly from ActiveDOMCallback rather
2497           than having the generated JS callback derived class inherit from it. This allows
2498           us to have access to a callback's canInvokeCallback() function anywhere (needed
2499           for MutationCallback) as well as giving a place to put an optional virtual 
2500           visitJSFunction to allow marking weak callbacks (while not an ideal layering, 
2501           this matches what we do in EventListener). This change requires each callback to
2502           have a bit more code to import the ActiveDOMCallback's constructor and requires
2503           non-JS derived callbacks to pass a ScriptExecutionContext (e.g. the Document).
2504
2505         * CMakeLists.txt:
2506         * DerivedSources.make:
2507         * WebCore.xcodeproj/project.pbxproj:
2508         * bindings/js/JSMutationCallback.cpp: Removed.
2509         * bindings/js/JSMutationCallback.h: Removed.
2510         Remove custom JSMutationCallback.h/cpp
2511
2512         * Modules/geolocation/PositionCallback.h:
2513         * Modules/geolocation/PositionErrorCallback.h:
2514         * Modules/notifications/NotificationPermissionCallback.h:
2515         * Modules/webaudio/AudioBufferCallback.h:
2516         * Modules/webdatabase/DatabaseCallback.h:
2517         * Modules/webdatabase/SQLStatementCallback.h:
2518         * Modules/webdatabase/SQLStatementErrorCallback.h:
2519         * Modules/webdatabase/SQLTransactionCallback.h:
2520         * Modules/webdatabase/SQLTransactionErrorCallback.h:
2521         * css/MediaQueryListListener.h:
2522         * dom/NodeFilter.h:
2523         * dom/RequestAnimationFrameCallback.h:
2524         * dom/StringCallback.h:
2525         * fileapi/BlobCallback.h:
2526         * html/VoidCallback.h:
2527         * page/IntersectionObserverCallback.h:
2528         * page/PerformanceObserverCallback.h:
2529         Add ActiveDOMCallback as a base class. Import the ActiveDOMCallback constructor.
2530
2531         * Modules/mediastream/MediaDevicesRequest.cpp:
2532         (WebCore::MediaDevicesRequest::filterDeviceList):
2533         (WebCore::MediaDevicesRequest::start):
2534         * Modules/mediastream/MediaDevicesRequest.h:
2535         Change filterDeviceList to take a Vector of Refs.
2536
2537         * bindings/IDLTypes.h:
2538         Add InnerParameterType and NullableInnerParameterType type hooks
2539         and specialize wrappers to use Ref for InnerParameterType, and RefPtr
2540         for NullableInnerParameterType.
2541
2542         * bindings/js/JSCallbackData.cpp:
2543         * bindings/js/JSCallbackData.h:
2544         Add support for passing a this object and give JSCallbackDataWeak a visitJSFunction
2545         to allow marking the underlying function.
2546
2547         * bindings/js/JSMutationObserverCustom.cpp:
2548         (WebCore::JSMutationObserver::visitAdditionalChildren):
2549         (WebCore::constructJSMutationObserver): Deleted.
2550         Remove the custom constructor and replace it with a custom visitAdditionalChildren
2551         that calls the new ActiveDOMObject's visitJSFunction.
2552
2553         * bindings/scripts/CodeGenerator.pm:
2554         (ParseType):
2555         Add helper to parse a type and cache the result.
2556
2557         * bindings/scripts/CodeGeneratorJS.pm:
2558         (GenerateCallbackHeaderContent):
2559         (GenerateCallbackImplementationContent):
2560         (GetJSCallbackDataType): Deleted.
2561         - Add support for [CallbackThisObject]. When [CallbackThisObject] is not specified, use jsUndefined() 
2562           as the this object as specified by WebIDL.
2563         - Stop inheriting from ActiveDOMCallback now that callbacks need to do this themselves.
2564         - Add a visitJSFunction override for weak callback functions which calls into the callback data.
2565
2566         * bindings/scripts/IDLAttributes.json:
2567         Add [CallbackThisObject].
2568
2569         * bindings/scripts/IDLParser.pm:
2570         (ParseType):
2571         Add entry point to parse a single type.
2572
2573         * css/FontFaceSet.h:
2574         Use Ref rather than RefPtr for the faces sequence.
2575
2576         * dom/ActiveDOMCallback.h:
2577         (WebCore::ActiveDOMCallback::visitJSFunction):
2578         Add an optional visitJSFunction virtual function so that derived classes
2579         have a way of marking underlying function objects.
2580
2581         * dom/MutationCallback.h:
2582         Convert to support generation (return a CallbackResult, inherit from ActiveDOMObject).
2583
2584         * dom/MutationCallback.idl: Added.
2585         Added to generate the callback. Uses the new [CallbackThisObject].
2586
2587         * dom/MutationObserver.cpp:
2588         (WebCore::MutationObserver::deliver):
2589         Switch to call idiomatic handleEvent, and pass *this as the first parameter
2590         which will be translated into the this object.
2591
2592         * dom/MutationObserver.h:
2593         (WebCore::MutationObserver::callback):
2594         Expose the callback so it can marked during GC.
2595
2596         * dom/MutationObserver.idl:
2597         Remove CustomConstructor and replace it with a custom mark function.
2598
2599         * dom/NativeNodeFilter.cpp:
2600         * dom/NativeNodeFilter.h:
2601         * inspector/InspectorDatabaseAgent.cpp:
2602         Pass now needed ScriptExecutionContext to non-js based callbacks.
2603
2604         * bindings/scripts/test/JS/JSTestCallbackFunction.cpp:
2605         * bindings/scripts/test/JS/JSTestCallbackFunctionRethrow.cpp:
2606         * bindings/scripts/test/JS/JSTestCallbackFunctionWithThisObject.cpp: Added.
2607         * bindings/scripts/test/JS/JSTestCallbackFunctionWithThisObject.h: Added.
2608         * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp:
2609         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
2610         * bindings/scripts/test/JS/JSTestCallbackInterface.h:
2611         * bindings/scripts/test/JS/JSTestVoidCallbackFunction.cpp:
2612         * bindings/scripts/test/TestCallbackFunctionWithThisObject.idl: Added.
2613         * bindings/scripts/test/TestCallbackInterface.idl:
2614         Add/update tests.
2615
2616 2017-08-03  Jeremy Jones  <jeremyj@apple.com>
2617
2618         Use MPAVRoutingController instead of deprecated versions.
2619         https://bugs.webkit.org/show_bug.cgi?id=175063
2620
2621         Reviewed by Tim Horton.
2622
2623         No new tests because no behavior change. This uses a different platform class to present
2624         an interface.
2625
2626         Remove deprecated MPAudioVideoRoutingPopoverController and MPAVRoutingSheet
2627         Add MPMediaControlsViewController.
2628
2629         * platform/spi/ios/MediaPlayerSPI.h:
2630
2631 2017-08-03  Chris Dumez  <cdumez@apple.com>
2632
2633         Improve our support for referrer policies
2634         https://bugs.webkit.org/show_bug.cgi?id=175069
2635         <rdar://problem/33677313>
2636
2637         Reviewed by Darin Adler.
2638
2639         Improve our support for referrer policies. In particular, we now support the
2640         additional following ones: "same-origin", "origin-when-cross-origin" and
2641         "strict-origin-when-cross-origin".
2642
2643         This is as per the following specification:
2644         - https://www.w3.org/TR/referrer-policy/#referrer-policies
2645
2646         Also refactor the code a bit for clarity: I merged the ReferrerPolicy enum and the
2647         FetchOptions::ReferrerPolicy one.
2648
2649         Tests: http/tests/referrer-policy/origin-when-cross-origin/cross-origin-http-http.html
2650                http/tests/referrer-policy/origin-when-cross-origin/cross-origin-http.https.html
2651                http/tests/referrer-policy/origin-when-cross-origin/same-origin.html
2652                http/tests/referrer-policy/same-origin/cross-origin-http-http.html
2653                http/tests/referrer-policy/same-origin/cross-origin-http.https.html
2654                http/tests/referrer-policy/same-origin/same-origin.html
2655                http/tests/referrer-policy/strict-origin-when-cross-origin/cross-origin-http-http.html
2656                http/tests/referrer-policy/strict-origin-when-cross-origin/cross-origin-http.https.html
2657                http/tests/referrer-policy/strict-origin-when-cross-origin/same-origin.html
2658                http/tests/referrer-policy/strict-origin/cross-origin-http-http.html
2659                http/tests/referrer-policy/strict-origin/cross-origin-http.https.html
2660                http/tests/referrer-policy/strict-origin/same-origin.html
2661
2662         * Modules/fetch/FetchLoader.cpp:
2663         (WebCore::FetchLoader::start):
2664         * Modules/fetch/FetchReferrerPolicy.h:
2665         * Modules/fetch/FetchReferrerPolicy.idl:
2666         * Modules/fetch/FetchRequest.h:
2667         * Modules/fetch/FetchRequestInit.h:
2668         * dom/Document.cpp:
2669         (WebCore::Document::processReferrerPolicy):
2670         (WebCore::Document::applyQuickLookSandbox):
2671         (WebCore::Document::applyContentDispositionAttachmentSandbox):
2672         * dom/Document.h:
2673         * loader/FetchOptions.h:
2674         * loader/FrameNetworkingContext.h:
2675         * loader/PingLoader.cpp:
2676         (WebCore::PingLoader::sendBeacon):
2677         Drop explicit call to SecurityPolicy::shouldHideReferrer(). This is already called inside
2678         SecurityPolicy::generateReferrerHeader() and used only when needed, depending on the
2679         actual referrer policy.
2680
2681         * loader/cache/CachedResourceLoader.cpp:
2682         (WebCore::CachedResourceLoader::updateHTTPRequestHeaders):
2683         * loader/cache/CachedResourceRequest.cpp:
2684         (WebCore::CachedResourceRequest::updateReferrerOriginAndUserAgentHeaders):
2685         * page/SecurityPolicy.cpp:
2686         (WebCore::referrerToOriginString):
2687         (WebCore::SecurityPolicy::generateReferrerHeader):
2688         * page/SecurityPolicy.h:
2689         * platform/ReferrerPolicy.h:
2690
2691 2017-08-03  Daniel Bates  <dabates@apple.com>
2692
2693         Support ::marker pseudo-element
2694         https://bugs.webkit.org/show_bug.cgi?id=141477
2695
2696         Reviewed by David Hyatt.
2697
2698         Implements the ::marker pseudo element as per the CSS Pseudo-Element Module Level 4
2699         spec., <https://drafts.csswg.org/css-pseudo-4> (Editor's Draft, 24 July 2017).
2700
2701         The ::marker pseudo element is a convenience pseudo element that allows a person to
2702         style the appearance of a list item marker. For example, to render all list item
2703         markers in bolded, blue text you would define a stylesheet with the following content:
2704
2705         li::marker {
2706             color: blue;
2707             font-weight: bold;
2708         }
2709
2710         and this could be applied to a page that contains markup of the form:
2711
2712         <ol>
2713             <li>Item 1</li>
2714             <li>Item 2</li>
2715             ...
2716             <li>Item N-1</li>
2717             <li>Item N</li>
2718         </ol>
2719
2720         Formerly to the achieve the same effect you would need to use a stylesheet of the form:
2721
2722         li {
2723             color: blue;
2724             font-weight: bold;
2725         }
2726
2727         .list-item-content {
2728             all: initial;
2729         }
2730
2731         and then write your markup to have the form:
2732
2733         <ol>
2734             <li><span class="list-item-content">Item 1</span></li>
2735             <li><span class="list-item-content">Item 2</span></li>
2736             ...
2737             <li><span class="list-item-content">Item N-1</span></li>
2738             <li><span class="list-item-content">Item N</span></li>
2739         </ol>
2740
2741         The ::marker pseudo element only supports stylizing all font properties and the color property
2742         of a list item marker.
2743
2744         Tests: fast/lists/list-marker-with-display.html
2745                http/wpt/css/css-pseudo-4/marker-and-other-pseudo-elements.html
2746                http/wpt/css/css-pseudo-4/marker-color.html
2747                http/wpt/css/css-pseudo-4/marker-font-properties.html
2748                http/wpt/css/css-pseudo-4/marker-inherit-values.html
2749
2750         * css/CSSSelector.cpp:
2751         (WebCore::CSSSelector::pseudoId): Return the pseudo id for the ::marker pseudo element.
2752         * css/CSSSelector.h: Add enumerator PseudoElementMarker to the pseudo element enum.
2753         * css/RuleSet.cpp:
2754         (WebCore::determinePropertyWhitelistType): Return whitelist type PropertyWhitelistMarker for ::marker
2755         so that we match rules against the acceptable rules for ::marker.
2756         * css/RuleSet.h: Add enumerator PropertyWhitelistMarker to the property whitelist type enum.
2757         * css/SelectorPseudoElementTypeMap.in: Add "marker" to the list of pseudo element types.
2758         * css/StyleResolver.cpp:
2759         (WebCore::isValidMarkerStyleProperty): Determines if the specified CSS property is valid inside ::marker.
2760         (WebCore::StyleResolver::CascadedProperties::addMatch): Only recognize CSS properties in the content block
2761         of ::marker that match the ::marker whitelist policy.
2762         * rendering/RenderListItem.cpp:
2763         (WebCore::RenderListItem::computeMarkerStyle): Computes the style object for the list item marker. We
2764         apply the user-agent style to the marker here as opposed to defining ::marker in the UA sheet as per
2765         the spec. as an optimization to avoid having the style resolver apply the pseudo element to all elements.
2766         For now, we always inherit style from the originating element (list item). Added FIXME to selectively
2767         inherit styles.
2768         (WebCore::RenderListItem::styleDidChange): Always apply the list marker style to the list marker renderer.
2769         * rendering/RenderListItem.h:
2770         * rendering/style/RenderStyleConstants.h: Add pseudo ID for the ::marker pseudo element.
2771
2772 2017-08-03  Antti Koivisto  <antti@apple.com>
2773
2774         Factor common code in Style::*ChangeInvalidation into helper functions
2775         https://bugs.webkit.org/show_bug.cgi?id=174312
2776
2777         Reviewed by Andreas Kling.
2778
2779         There is a lot of copy code here.
2780
2781         * Style/StyleInvalidationFunctions.h: Added.
2782         (WebCore::Style::traverseRuleFeaturesInShadowTree):
2783         (WebCore::Style::traverseRuleFeaturesForSlotted):
2784         (WebCore::Style::traverseRuleFeatures):
2785
2786             Add functions for traversing rule features that may affect style of an element.
2787             Use lambdas to implement client-specific behavior.
2788
2789         * WebCore.xcodeproj/project.pbxproj:
2790         * style/AttributeChangeInvalidation.cpp:
2791         (WebCore::Style::mayBeAffectedByAttributeChange):
2792         (WebCore::Style::AttributeChangeInvalidation::invalidateStyle):
2793         (WebCore::Style::mayBeAffectedByHostRules): Deleted.
2794         (WebCore::Style::mayBeAffectedBySlottedRules): Deleted.
2795         * style/ClassChangeInvalidation.cpp:
2796         (WebCore::Style::ClassChangeInvalidation::invalidateStyle):
2797         (WebCore::Style::mayBeAffectedByHostRules): Deleted.
2798         (WebCore::Style::mayBeAffectedBySlottedRules): Deleted.
2799         * style/IdChangeInvalidation.cpp:
2800         (WebCore::Style::IdChangeInvalidation::invalidateStyle):
2801         (WebCore::Style::mayBeAffectedByHostRules): Deleted.
2802         (WebCore::Style::mayBeAffectedBySlottedRules): Deleted.
2803
2804 2017-08-03  Zan Dobersek  <zdobersek@igalia.com>
2805
2806         [EME] CDM constructor assigns CDMPrivate member multiple times
2807         https://bugs.webkit.org/show_bug.cgi?id=175128
2808
2809         Reviewed by Xabier Rodriguez-Calvar.
2810
2811         In the CDM class constructor, iterate over the registered CDM
2812         factories, finding one that supports the specified key system.
2813         A CDMPrivate object is created through that factory, and the
2814         iteration is now stopped at that point, while previously it
2815         contined to potentially create CDMPrivate objects through
2816         other factories.
2817
2818         Helper createCDMPrivateForKeySystem() function is removed.
2819
2820         * Modules/encryptedmedia/CDM.cpp:
2821         (WebCore::CDM::CDM):
2822         (WebCore::createCDMPrivateForKeySystem): Deleted.
2823
2824 2017-08-03  Emilio Cobos Álvarez  <ecobos@igalia.com>
2825
2826         Don't always recalc the style of display: contents elements.
2827         https://bugs.webkit.org/show_bug.cgi?id=172753
2828
2829         Reviewed by Antti Koivisto.
2830
2831         No new tests (no functionality change). This only removes an
2832         inefficiency.
2833
2834         * dom/Element.cpp:
2835         (WebCore::Element::existingComputedStyle):
2836         * dom/Element.h:
2837         * style/RenderTreeUpdater.cpp:
2838         (WebCore::RenderTreeUpdater::updateRenderTree):
2839         (WebCore::RenderTreeUpdater::updateElementRenderer):
2840         * style/StyleTreeResolver.cpp:
2841         (WebCore::Style::renderOrDisplayContentsStyle):
2842         (WebCore::Style::TreeResolver::resolveElement):
2843         (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
2844         (WebCore::Style::shouldResolveElement):
2845         (WebCore::Style::TreeResolver::resolveComposedTree):
2846
2847 2017-08-02  Devin Rousso  <drousso@apple.com>
2848
2849         Web Inspector: add stack trace information for each RecordingAction
2850         https://bugs.webkit.org/show_bug.cgi?id=174663
2851
2852         Reviewed by Joseph Pecoraro.
2853
2854         Tests: inspector/canvas/recording-2d.html
2855                inspector/model/recording.html
2856
2857         * inspector/InspectorCanvas.h:
2858         * inspector/InspectorCanvas.cpp:
2859         (WebCore::InspectorCanvas::indexForData):
2860         (WebCore::InspectorCanvas::buildAction):
2861
2862 2017-08-02  Yusuke Suzuki  <utatane.tea@gmail.com>
2863
2864         Merge WTFThreadData to Thread::current
2865         https://bugs.webkit.org/show_bug.cgi?id=174716
2866
2867         Reviewed by Mark Lam.
2868
2869         Use Thread::current() instead.
2870
2871         * fileapi/AsyncFileStream.cpp:
2872         * platform/ThreadGlobalData.cpp:
2873         (WebCore::ThreadGlobalData::ThreadGlobalData):
2874         * platform/graphics/cocoa/WebCoreDecompressionSession.h:
2875         * platform/ios/wak/WebCoreThread.mm:
2876         (StartWebThread):
2877         * workers/WorkerThread.cpp:
2878         (WebCore::WorkerThread::workerThread):
2879
2880 2017-08-02  Sam Weinig  <sam@webkit.org>
2881
2882         Fix crashes in GC creating a document fragment on a background thread
2883         https://bugs.webkit.org/show_bug.cgi?id=175111
2884
2885         Reviewed by Chris Dumez.
2886
2887         r220095 (https://webkit.org/b/175006) change JSHTMLTemplateElement from using a
2888         private name + property to manager the lifetime of the reference DocumentFragment
2889         to using the idiomatic visitAdditionalChildren. Unfortunately, the function to access
2890         the DocumentFragment lazily creates it. If this lazy creation happens on a GC thread,
2891         badness ensues. This introduces an accessor that returns the DocumentFragment if it
2892         has been created or null if it has not.
2893
2894         * bindings/js/JSHTMLTemplateElementCustom.cpp:
2895         (WebCore::JSHTMLTemplateElement::visitAdditionalChildren):
2896         * html/HTMLTemplateElement.cpp:
2897         (WebCore::HTMLTemplateElement::contentIfAvailable):
2898         * html/HTMLTemplateElement.h:
2899
2900 2017-08-02  Sam Weinig  <sam@webkit.org>
2901
2902         [WebIDL] Simplify [EnabledBySettings] extended attribute code to not require passing a global object to finishCreation
2903         https://bugs.webkit.org/show_bug.cgi?id=175087
2904
2905         Reviewed by Chris Dumez.
2906
2907         * bindings/scripts/CodeGeneratorJS.pm:
2908         (GenerateImplementation):
2909         (GeneratePrototypeDeclaration):
2910         Remove unnecessary passing of the global object to finishCreation for [EnabledBySettings].
2911
2912         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
2913         * bindings/scripts/test/JS/JSTestNode.cpp:
2914         * bindings/scripts/test/JS/JSTestObj.cpp:
2915         Update tests.
2916
2917 2017-08-02  Andy Estes  <aestes@apple.com>
2918
2919         REGRESSION (r207155): Unable to switch sheets when previewing Numbers '09 spreadsheets
2920         https://bugs.webkit.org/show_bug.cgi?id=175098
2921         <rdar://problem/31416763>
2922
2923         Reviewed by Daniel Bates.
2924
2925         r207155 enabled sandboxing on the frame displaying a QuickLook preview. This restricted
2926         frames within the sandbox from navigating their sandboxed siblings or ancestors, which
2927         breaks the functionality of multi-sheet Numbers '09 spreadsheet previews. These previews
2928         contain a frameset with a table of contents frame and a content frame, and the table of
2929         contents frame needs to be able to navigate the content frame when the sheet selection
2930         changes.
2931
2932         Fix this by disabling the SandboxNavigation flag in the QuickLook sandbox. Frames within the
2933         sandbox will be able to navigate each other, but will not be able to navigate the top frame
2934         (due to SandboxTopNavigation still being enabled), nor will they be able to navigate any
2935         other ancestor frame outside the sandbox (due to QuickLook previews being in a different
2936         origin than the hosting frame). These two cases are covered by existing tests.
2937
2938         Test: quicklook/multi-sheet-numbers-09.html
2939
2940         * dom/Document.cpp:
2941         (WebCore::Document::applyQuickLookSandbox): Added a call to
2942         disableSandboxFlags(SandboxNavigation) after applying the content security policy.
2943         * dom/SecurityContext.h:
2944         (WebCore::SecurityContext::disableSandboxFlags): Defined disableSandboxFlags().
2945
2946 2017-08-02  Jer Noble  <jer.noble@apple.com>
2947
2948         [MSE] Removing samples when presentation order does not match decode order can cause bad behavior.
2949         https://bugs.webkit.org/show_bug.cgi?id=175091
2950
2951         Reviewed by Eric Carlson.
2952
2953         Address follow-up comments to r219519.
2954
2955         * Modules/mediasource/SourceBuffer.cpp:
2956         (WebCore::SourceBuffer::removeCodedFrames):
2957
2958 2017-08-02  Jeremy Jones  <jeremyj@apple.com>
2959
2960         Remove unused and obsolete setting mediaDocumentEntersFullscreenAutomatically
2961         https://bugs.webkit.org/show_bug.cgi?id=175080
2962
2963         Reviewed by Jon Lee.
2964
2965         No new tests because this only removes unused code.
2966
2967         This is obsolete because of the alternate solution in
2968         https://bugs.webkit.org/show_bug.cgi?id=174850
2969
2970         * page/Settings.in:
2971
2972 2017-08-02  Filip Pizlo  <fpizlo@apple.com>
2973
2974         GPUBuffer::length() should return the size of the array buffer backing the GPU buffer, not the rounded-up GPU buffer length
2975         https://bugs.webkit.org/show_bug.cgi?id=175079
2976
2977         Reviewed by Simon Fraser.
2978
2979         This fixes a failure in the GPU.BufferCreate unit test.
2980         
2981         The problem is that in order to have a Metal buffer wrap memory we allocated, we have to tell Metal
2982         that the memory is page-aligned. This means that the Metal buffer reports back a page-aligned size,
2983         which is different than what the test expected.
2984         
2985         It seems that it's most convenient for our GPUBuffer class to return the unaligned length, rather
2986         than the aligned length. This is just a simple matter of returning the length from the ArrayBuffer
2987         rather than the Metal buffer.
2988         
2989         This fixes the unit test and is probably more sensible for actual users of this class, since the page
2990         alignment of the length is a goofy implementation detail.
2991
2992         * platform/graphics/cocoa/GPUBufferMetal.mm:
2993         (WebCore::GPUBuffer::length const):
2994
2995 2017-08-01  Brian Burg  <bburg@apple.com>
2996
2997         HTML file input elements do not support file extensions in the "accept" attribute
2998         https://bugs.webkit.org/show_bug.cgi?id=95698
2999         <rdar://problem/12231850>
3000
3001         Reviewed by Darin Adler.
3002
3003         Serialize the accepted file extensions so they can be accessed in the UI process.
3004
3005         * platform/FileChooser.h:
3006         * platform/FileChooser.cpp:
3007         (WebCore::FileChooser::invalidate): Modernize.
3008         (WebCore::FileChooserSettings::acceptTypes const): Deleted.
3009         This is dead code, it was only used by Chromium.
3010
3011 2017-08-02  Fujii Hironori  <Hironori.Fujii@sony.com>
3012
3013         Use LazyNeverDestroyed instead of DEFINE_GLOBAL for QualifiedName
3014         https://bugs.webkit.org/show_bug.cgi?id=175010
3015         <rdar://problem/33647818>
3016
3017         Reviewed by Alex Christensen.
3018
3019         No new tests because no behavior change.
3020
3021         Stop using DEFINE_GLOBAL hack in favor of LazyNeverDestroyed.
3022
3023         * contentextensions/ContentExtensionParser.cpp:
3024         (WebCore::ContentExtensions::isValidCSSSelector):
3025         Call QualifiedName::init().
3026         * dom/DOMAllInOne.cpp: Remove the warning. Include QualifiedName.cpp.
3027         * dom/QualifiedName.cpp:
3028         (WebCore::QualifiedName::init): Call LazyNeverDestroyed::construct
3029         instead of placement new.
3030         * dom/QualifiedName.h: Use LazyNeverDestroyed.
3031
3032 2017-08-01  Joseph Pecoraro  <pecoraro@apple.com>
3033
3034         CFString leak dragging an image - allocation under PlatformPasteboard::writeObjectRepresentations
3035         https://bugs.webkit.org/show_bug.cgi?id=175064
3036
3037         Reviewed by Tim Horton.
3038
3039         * platform/ios/PlatformPasteboardIOS.mm:
3040         (WebCore::PlatformPasteboard::writeObjectRepresentations):
3041         Adopt a created string into the RetainPtr.
3042
3043         * platform/ios/WebItemProviderPasteboard.h:
3044         * platform/ios/WebItemProviderPasteboard.mm:
3045         (-[WebItemProviderRegistrationInfoList dealloc]):
3046         Release suggestedName and switch from -strong to -copy.
3047
3048 2017-08-01  Chris Dumez  <cdumez@apple.com>
3049
3050         Unreviewed, update Beacon API status to "In Development".
3051
3052         * features.json:
3053
3054 2017-08-01  Chris Dumez  <cdumez@apple.com>
3055
3056         Add initial support for navigator.sendBeacon
3057         https://bugs.webkit.org/show_bug.cgi?id=175007
3058         <rdar://problem/33547728>
3059
3060         Reviewed by Sam Weinig.
3061
3062         Add initial support for navigator.sendBeacon behind an experimental
3063         feature runtime flag. The specification is available at:
3064         - https://w3c.github.io/beacon/
3065
3066         The current implementation supports sending beacons with all types of
3067         payloads except for ReadableStream. Some functionality is incomplete
3068         and will be taken care of in follow-up patches:
3069         - Support for CORS preflight for the cases where it is required. We currently
3070           return false and do not send the beacon in such cases.
3071         - Better support for redirects.
3072         - Use a more power-friendly network priority for beacon requests.
3073
3074         Tests: http/tests/blink/sendbeacon/*
3075                http/tests/security/mixedContent/beacon/insecure-beacon-in-iframe.html
3076                http/wpt/beacon/*
3077                imported/blink/fast/beacon/*
3078                imported/w3c/web-platform-tests/beacon/*
3079
3080         * CMakeLists.txt:
3081         * DerivedSources.make:
3082         * Modules/beacon/NavigatorBeacon.cpp: Added.
3083         (WebCore::NavigatorBeacon::sendBeacon):
3084         * Modules/beacon/NavigatorBeacon.h: Added.
3085         * Modules/beacon/NavigatorBeacon.idl: Added.
3086         * WebCore.xcodeproj/project.pbxproj:
3087         * loader/PingLoader.cpp:
3088         (WebCore::PingLoader::sendBeacon):
3089         * loader/PingLoader.h:
3090
3091 2017-08-01  Filip Pizlo  <fpizlo@apple.com>
3092
3093         Bmalloc and GC should put auxiliaries (butterflies, typed array backing stores) in a gigacage (separate multi-GB VM region)
3094         https://bugs.webkit.org/show_bug.cgi?id=174727
3095
3096         Reviewed by Mark Lam.
3097
3098         No new tests because no change in behavior.
3099         
3100         Needed to teach Metal how to allocate in the Gigacage.
3101
3102         * platform/graphics/cocoa/GPUBufferMetal.mm:
3103         (WebCore::GPUBuffer::GPUBuffer):
3104         (WebCore::GPUBuffer::contents):
3105
3106 2017-08-01  Fujii Hironori  <Hironori.Fujii@sony.com>
3107
3108         [WinCairo] Implement Font::platformBoundsForGlyph
3109         https://bugs.webkit.org/show_bug.cgi?id=174813
3110
3111         Reviewed by Alex Christensen.
3112
3113         Test: fast/text/emphasis.html
3114
3115         * platform/graphics/win/SimpleFontDataCairoWin.cpp:
3116         (WebCore::Font::platformBoundsForGlyph): Implemented by copying
3117         the code from Font::boundsForGDIGlyph().
3118
3119 2017-08-01  Zalan Bujtas  <zalan@apple.com>
3120
3121         REGRESSION (r217197): New Yorker website hangs for a long time on load, lots of blank tiles
3122         https://bugs.webkit.org/show_bug.cgi?id=175009
3123         <rdar://problem/33505791>
3124
3125         Reviewed by Simon Fraser.
3126
3127         This patch ensures that we report the desktop, non-frame-flattened frame size for media queries in subframes.
3128         Some websites don't expect the iframes to be expanded to the size of the content and when the media query
3129         callback mutates the content (triggering frame resize), they might end up getting into a never ending layout.
3130
3131         Test: fast/frames/flattening/media-query-growing-content.html
3132
3133         * css/MediaQueryEvaluator.cpp:
3134         (WebCore::orientationEvaluate):
3135         (WebCore::aspectRatioEvaluate):
3136         (WebCore::heightEvaluate):
3137         (WebCore::widthEvaluate):
3138         * page/FrameView.cpp:
3139         (WebCore::FrameView::layout):
3140         (WebCore::FrameView::layoutSizeForMediaQuery const):
3141         (WebCore::FrameView::evaluateMediaQueryList):
3142         * page/FrameView.h:
3143
3144 2017-07-26  Jiewen Tan  <jiewen_tan@apple.com>
3145
3146         Add tests to detect mistakes in backward compatibility when the structured clone algorithm is changed in the future
3147         https://bugs.webkit.org/show_bug.cgi?id=173998
3148
3149         Reviewed by Darin Adler.
3150
3151         * bindings/js/SerializedScriptValue.cpp:
3152         Add a comment.
3153
3154 2017-08-01  Matt Lewis  <jlewis3@apple.com>
3155
3156         Unreviewed, rolling out r220089.
3157
3158         This caused multiple crashes on macOS Debug testers.
3159
3160         Reverted changeset:
3161
3162         "Use LazyNeverDestroyed instead of DEFINE_GLOBAL for
3163         QualifiedName"
3164         https://bugs.webkit.org/show_bug.cgi?id=175010
3165         http://trac.webkit.org/changeset/220089
3166
3167 2017-08-01  Sam Weinig  <sam@webkit.org>
3168
3169         [WebIDL] Swap a custom attribute for a custom mark function for HTMLTemplateElement
3170         https://bugs.webkit.org/show_bug.cgi?id=175006
3171
3172         Reviewed by Chris Dumez.
3173
3174         Use the standard way of augmenting GC, visitAdditionalChildren, rather
3175         than using a private name to create ownership.
3176
3177         * bindings/js/JSHTMLTemplateElementCustom.cpp:
3178         (WebCore::JSHTMLTemplateElement::visitAdditionalChildren):
3179         (WebCore::JSHTMLTemplateElement::content const): Deleted.
3180         * html/HTMLTemplateElement.idl:
3181
3182 2017-08-01  Zan Dobersek  <zdobersek@igalia.com>
3183
3184         [GCrypt] Gather crypto constants in a single location
3185         https://bugs.webkit.org/show_bug.cgi?id=174091
3186
3187         Reviewed by Jiewen Tan.
3188
3189         Gather common constants used across the libgcrypt-specific Web Crypto
3190         implementations in a single place -- in the GCryptUtilities.h header,
3191         inside the CryptoConstants namespace. The various ASN.1 object identifiers
3192         and other helper values are placed inside, in the std::array<uint8_t, N>
3193         container.
3194
3195         Additionally, CryptoConstants::matches() helper function is provided. It
3196         compares the provided data-and-size pair with the given std::array
3197         container and returns true if the std::memcmp() call returns 0.
3198
3199         Changes in CryptoKeyEC and CryptoKeyRSA consist mostly of switching to the
3200         use of CryptoConstants::matches() and the CryptoConstants data arrays, as
3201         well as some whitespace cleanup.
3202
3203         Additionallity in CryptoKeyEC, the helper functions covering various curve
3204         attributes are reordered, renamed and reorganized for simplicity.
3205
3206         No new tests -- no changes in behavior.
3207
3208         * crypto/gcrypt/CryptoKeyECGCrypt.cpp:
3209         (WebCore::curveIdentifier):
3210         (WebCore::curveSize):
3211         (WebCore::curveUncompressedFieldElementSize):
3212         (WebCore::curveUncompressedPointSize):
3213         (WebCore::CryptoKeyEC::platformImportRaw):
3214         (WebCore::CryptoKeyEC::platformImportJWKPublic):
3215         (WebCore::CryptoKeyEC::platformImportJWKPrivate):
3216         (WebCore::supportedAlgorithmIdentifier):
3217         (WebCore::curveForIdentifier):
3218         (WebCore::CryptoKeyEC::platformImportSpki):
3219         (WebCore::CryptoKeyEC::platformExportRaw):
3220         (WebCore::CryptoKeyEC::platformAddFieldElements):
3221         (WebCore::CryptoKeyEC::platformExportSpki):
3222         (WebCore::CryptoKeyEC::platformExportPkcs8):
3223         (WebCore::uncompressedPointSizeForCurve): Deleted.
3224         (WebCore::uncompressedFieldElementSizeForCurve): Deleted.
3225         * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:
3226         (WebCore::supportedAlgorithmIdentifier):
3227         (WebCore::CryptoKeyRSA::importPkcs8):
3228         (WebCore::CryptoKeyRSA::exportSpki):
3229         (WebCore::CryptoKeyRSA::exportPkcs8):
3230         * crypto/gcrypt/GCryptUtilities.h:
3231         (WebCore::CryptoConstants::matches):
3232
3233 2017-07-31  Fujii Hironori  <Hironori.Fujii@sony.com>
3234
3235         Use LazyNeverDestroyed instead of DEFINE_GLOBAL for MediaFeatureNames
3236         https://bugs.webkit.org/show_bug.cgi?id=175008
3237
3238         Reviewed by Alex Christensen.
3239
3240         No new tests because no behavior change.
3241
3242         Stop using DEFINE_GLOBAL hack in favor of LazyNeverDestroyed.
3243
3244         * css/MediaFeatureNames.cpp:
3245         (WebCore::MediaFeatureNames::init): Do not include
3246         <wtf/StaticConstructors.h>. Use LazyNeverDestroyed instead of
3247         DEFINE_GLOBAL. Call LazyNeverDestroyed::construct instead of
3248         placement new.
3249         * css/MediaFeatureNames.h: Use LazyNeverDestroyed.
3250         * css/MediaQueryEvaluator.cpp:
3251         (WebCore::MediaQueryEvaluator::evaluate const): Dereference with ->.
3252
3253 2017-07-31  Fujii Hironori  <Hironori.Fujii@sony.com>
3254
3255         Use LazyNeverDestroyed instead of DEFINE_GLOBAL for QualifiedName
3256         https://bugs.webkit.org/show_bug.cgi?id=175010
3257
3258         Reviewed by Alex Christensen.
3259
3260         No new tests because no behavior change.
3261
3262         Stop using DEFINE_GLOBAL hack in favor of LazyNeverDestroyed.
3263
3264         * dom/DOMAllInOne.cpp: Remove the warning. Include QualifiedName.cpp.
3265         * dom/QualifiedName.cpp:
3266         (WebCore::QualifiedName::init): Call LazyNeverDestroyed::construct
3267         instead of placement new.
3268         * dom/QualifiedName.h: Use LazyNeverDestroyed.
3269
3270 2017-07-31  Matt Rajca  <mrajca@apple.com>
3271
3272         Support quirk for letting media autoplay if the user interacted with at least one media element.
3273         https://bugs.webkit.org/show_bug.cgi?id=175005
3274         <rdar://problem/33476038>
3275
3276         Reviewed by Eric Carlson.
3277
3278         If the user has interacted with at least one media element, let other media elements auto-play
3279         as a quirk.
3280
3281         * dom/Document.cpp:
3282         (WebCore::Document::updateIsPlayingMedia):
3283         * dom/Document.h:
3284         (WebCore::Document::noteUserInteractionWithMediaElement):
3285         * html/HTMLMediaElement.cpp:
3286         (WebCore::HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture):
3287         * html/MediaElementSession.cpp:
3288         (WebCore::needsDocumentLevelMediaUserGestureQuirk):
3289         (WebCore::MediaElementSession::playbackPermitted const):
3290         * page/MediaProducer.h:
3291
3292 2017-07-31  Nan Wang  <n_wang@apple.com>
3293
3294         AX: CFEqual is failing on text markers with exact same data
3295         https://bugs.webkit.org/show_bug.cgi?id=175002
3296         <rdar://problem/33636985>
3297
3298         Reviewed by Chris Fleizach.
3299
3300         We should zero the memory of the TextMarkerData instance so that it
3301         can be tested for byte-equivalence.
3302
3303         Made sure this change won't break any of the existing tests.
3304
3305         * accessibility/AXObjectCache.cpp:
3306         (WebCore::AXObjectCache::textMarkerDataForVisiblePosition):
3307         (WebCore::AXObjectCache::textMarkerDataForFirstPositionInTextControl):
3308
3309 2017-07-28  Matt Rajca  <mrajca@apple.com>
3310
3311         Propagate user gesture tokens when script elements are loaded.
3312         https://bugs.webkit.org/show_bug.cgi?id=174959
3313
3314         Reviewed by Eric Carlson.
3315
3316         Propagate user gesture tokens when script elements are loaded (i.e. between the time an
3317         element is created and its onload handler is invoked).
3318
3319         * dom/ScriptElement.cpp:
3320         (WebCore::ScriptElement::ScriptElement):
3321         (WebCore::ScriptElement::dispatchLoadEventRespectingUserGestureIndicator):
3322         (WebCore::ScriptElement::executeScriptAndDispatchEvent):
3323         (WebCore::ScriptElement::executePendingScript):
3324         * dom/ScriptElement.h:
3325
3326 2017-07-31  Matt Lewis  <jlewis3@apple.com>
3327
3328         Unreviewed, rolling out r220048.
3329
3330         This revision caused multiple crashes in fast/images. See
3331         webkit.org/b/174990
3332
3333         Reverted changeset:
3334
3335         "RenderImageResourceStyleImage::image() should return the
3336         nullImage() if the image is not available"
3337         https://bugs.webkit.org/show_bug.cgi?id=174874
3338         http://trac.webkit.org/changeset/220048
3339
3340 2017-07-31  Sam Weinig  <sam@webkit.org>
3341
3342         Remove unnecessary exceptions from storage code
3343         https://bugs.webkit.org/show_bug.cgi?id=174572
3344
3345         Reviewed by Chris Dumez.
3346
3347         Remove checks for canAccessStorage() and the exceptions they would cause.
3348         These were used for Storage in ephemeral sessions, but they are now supported.
3349         Add checks for a null frame to functions that can mutate the storage, as the
3350         frame is needed for that, and it retains our existing behavior for disconnected
3351         frames. By removing these checks / exceptions, we can fully generate Storage.idl.
3352
3353         * CMakeLists.txt:
3354         * WebCore.xcodeproj/project.pbxproj:
3355         * bindings/js/JSBindingsAllInOne.cpp:
3356         * bindings/js/JSStorageCustom.cpp: Removed.
3357         Remove JSStorageCustom.cpp
3358
3359         * loader/EmptyClients.cpp:
3360         * page/DOMWindow.cpp:
3361         (WebCore::DOMWindow::sessionStorage):
3362         (WebCore::DOMWindow::localStorage):
3363         * storage/StorageArea.h:
3364         Remove canAccessStorage.
3365
3366         * storage/Storage.cpp:
3367         (WebCore::Storage::length):
3368         (WebCore::Storage::key):
3369         (WebCore::Storage::getItem):
3370         (WebCore::Storage::setItem):
3371         (WebCore::Storage::removeItem):
3372         (WebCore::Storage::clear):
3373         (WebCore::Storage::contains):
3374         (WebCore::Storage::isSupportedPropertyName):
3375         (WebCore::Storage::supportedPropertyNames):
3376         * storage/Storage.h:
3377         * storage/Storage.idl:
3378         Remove canAccessStorage checks and corresponding exceptions. Add supportedPropertyNames
3379         to allow the removal of the [CustomGetOwnPropertyNames].
3380
3381 2017-07-31  Matt Lewis  <jlewis3@apple.com>
3382
3383         Unreviewed, rolling out r220060.
3384
3385         This broke our internal builds. Contact reviewer of patch for
3386         more information.
3387
3388         Reverted changeset:
3389
3390         "Merge WTFThreadData to Thread::current"
3391         https://bugs.webkit.org/show_bug.cgi?id=174716
3392         http://trac.webkit.org/changeset/220060
3393
3394 2017-07-31  Yusuke Suzuki  <utatane.tea@gmail.com>
3395
3396         Merge WTFThreadData to Thread::current
3397         https://bugs.webkit.org/show_bug.cgi?id=174716
3398
3399         Reviewed by Sam Weinig.
3400
3401         Use Thread::current() instead.
3402
3403         * fileapi/AsyncFileStream.cpp:
3404         * platform/ThreadGlobalData.cpp:
3405         (WebCore::ThreadGlobalData::ThreadGlobalData):
3406         * platform/graphics/cocoa/WebCoreDecompressionSession.h:
3407         * platform/ios/wak/WebCoreThread.mm:
3408         (StartWebThread):
3409         * workers/WorkerThread.cpp:
3410         (WebCore::WorkerThread::workerThread):
3411
3412 2017-07-31  Xabier Rodriguez Calvar  <calvaris@igalia.com>
3413
3414         Created a bool pretty printer at WTF for debugging purposes
3415         https://bugs.webkit.org/show_bug.cgi?id=174893
3416
3417         Reviewed by Darin Adler.
3418
3419         Use WTF::boolPrettyPrinter in debugging messages.
3420
3421         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3422         (WebCore::MediaPlayerPrivateGStreamerBase::supportsKeySystem):
3423         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
3424         (WebCore::MediaPlayerPrivateGStreamerMSE::seek):
3425
3426 2017-07-30  Zan Dobersek  <zdobersek@igalia.com>
3427
3428         Unreviewed. Suppress the -Wextra compiler warning when building with GCC 6.3.0,
3429         explicitly initializing the RefCounted<> base class in the
3430         FetchHeaders(const FetchHeaders&) constructor.
3431
3432         Note that while that's the signature of the copy constructor for the FetchHeaders
3433         class, the base RefCounted<> class is not copyable, so the default RefCounted<>
3434         constructor is used, but the FetchHeaders resources are normally copied into the
3435         new object from the one that's passed in.
3436
3437         * Modules/fetch/FetchHeaders.h:
3438         (WebCore::FetchHeaders::FetchHeaders):
3439
3440 2017-07-30  Darin Adler  <darin@apple.com>
3441
3442         Remove code in HTMLObjectElement attribute parsing that forces style resolution and layout
3443         https://bugs.webkit.org/show_bug.cgi?id=130653
3444
3445         Reviewed by Antti Koivisto.
3446
3447         Also fixes a bug where load events are delivered prematurely in some cases
3448         when an object, embed, frame, or iframe element is still loading.
3449