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