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