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