Do not unregister MessagePorts on deallocation if it has been disentangled
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-04-17  Tadeu Zagallo  <tzagallo@apple.com>
2
3         Do not unregister MessagePorts on deallocation if it has been disentangled
4         https://bugs.webkit.org/show_bug.cgi?id=184285
5         <rdar://problem/39256714>
6
7         Reviewed by Darin Adler.
8
9         Test: workers/message-port-gc.html
10
11         * dom/MessagePort.cpp:
12         (WebCore::MessagePort::deref const):
13
14 2018-04-17  Basuke Suzuki  <Basuke.Suzuki@sony.com>
15
16         [Curl] Fix timing of reporting error to the client
17         https://bugs.webkit.org/show_bug.cgi?id=184707
18
19         Before checking the result code, check the status of callback invocation and
20         do the right thing.
21
22         Reviewed by Youenn Fablet.
23
24         No new tests because there's no new behavior.
25
26         * platform/network/curl/CurlRequest.cpp:
27         (WebCore::CurlRequest::didCompleteTransfer):
28         * platform/network/curl/CurlRequest.h:
29         (WebCore::CurlRequest::needToInvokeDidReceiveResponse const):
30
31 2018-04-17  Basuke Suzuki  <Basuke.Suzuki@sony.com>
32
33         [Curl] Export authentication information to be used by the client.
34         https://bugs.webkit.org/show_bug.cgi?id=184709
35
36         Just added getters for username and password member variables.
37
38         Reviewed by Alex Christensen.
39
40         No new tests because there's no new behavior.
41
42         * platform/network/curl/CurlRequest.h:
43         (WebCore::CurlRequest::user const):
44         (WebCore::CurlRequest::password const):
45
46 2018-04-17  Chris Dumez  <cdumez@apple.com>
47
48         REGRESSION (r229831): CMD-clicking an iCloud web app link unexpectedly opens that link in a new tab and the current tab
49         https://bugs.webkit.org/show_bug.cgi?id=184678
50         <rdar://problem/39422122>
51
52         Reviewed by Alex Christensen.
53
54         Frament navigations need to happen synchronously for Web-compatibility. Because of this,
55         r225657 added code to make sure that if the client does not make the navigation policy
56         decision synchronously for frament navigations, then we'll stop waiting for the client
57         and proceed with the navigation. However, r229831 make the navigation policy decision
58         IPC decision, meaning that even if the client responds synchronously, it would be
59         asynchronously from WebCore's point of view. As a result, we would always ignore the
60         client's policy decision when doing a fragment navigation.
61
62         This is an issue on iclould.com because the web-app links are fragment URLs. When you
63         CMD+click one of these link, we do the navigation policy check. As a result of this
64         check, Safari responds IGNORE to the policy decision and instead decides to load the
65         link in a new tab (because CMD key is pressed). Due to the bug mentioned above, we
66         would not obey the IGNORE policy decision from Safari and load the link in the current
67         tab, even though Safari would already be loading it in a new tab.
68
69         To address the issue, I reintroduced a synchronous code path for navigation policy
70         decision making, backed by synchronous IPC. This synchronous code path is now used for
71         fragment navigations to restore pre-r229831 behavior. If the client does not answer
72         synchronously, we'll proceed with the navigation anyway, as was happening pre-r229831.
73
74         Test: http/tests/navigation/fragment-navigation-policy-ignore.html
75
76         * loader/EmptyClients.cpp:
77         (WebCore::EmptyFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
78         * loader/EmptyFrameLoaderClient.h:
79         * loader/FrameLoader.cpp:
80         (WebCore::FrameLoader::loadURL):
81         (WebCore::FrameLoader::loadWithDocumentLoader):
82         * loader/FrameLoaderClient.h:
83         * loader/PolicyChecker.cpp:
84         (WebCore::PolicyChecker::checkNavigationPolicy):
85         * loader/PolicyChecker.h:
86
87 2018-04-17  Matt Lewis  <jlewis3@apple.com>
88
89         Unreviewed, rolling out r230713.
90
91         This caused internal build failures.
92
93         Reverted changeset:
94
95         "Implement checked cast for DDResultRef once
96         DDResultGetTypeID() is available"
97         https://bugs.webkit.org/show_bug.cgi?id=184554
98         https://trac.webkit.org/changeset/230713
99
100 2018-04-17  Chris Dumez  <cdumez@apple.com>
101
102         Add bindings code for RemoteDOMWindow
103         https://bugs.webkit.org/show_bug.cgi?id=184653
104
105         Reviewed by Ryosuke Niwa.
106
107         Add bindings code for RemoteDOMWindow. A RemoteDOMWindow behaves exactly like a cross-origin
108         DOMWindow, which is backed by a RemoteDOMWindow object instead of a DOMWindow one. Since
109         a RemoteDOMWindow is always cross origin, we do not need cross-origin checks and the bindings
110         code is identical to the DOMWindow code paths from cross-origin handling.
111
112         No new tests, this code will be used and tested via Bug 184515.
113
114         * CMakeLists.txt:
115         * DerivedSources.make:
116         * Sources.txt:
117         * WebCore.xcodeproj/project.pbxproj:
118         * bindings/js/JSBindingsAllInOne.cpp:
119         * bindings/js/JSDOMWindowCustom.cpp:
120         (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
121         (WebCore::JSDOMWindow::getOwnPropertySlot):
122         (WebCore::JSDOMWindow::getOwnPropertySlotByIndex):
123         (WebCore::addCrossOriginWindowOwnPropertyNames):
124         * bindings/js/JSDOMWindowCustom.h:
125
126         * bindings/js/JSRemoteDOMWindowBase.cpp: Added.
127         (WebCore::JSRemoteDOMWindowBase::JSRemoteDOMWindowBase):
128         (WebCore::JSRemoteDOMWindowBase::destroy):
129         (WebCore::JSRemoteDOMWindowBase::javaScriptRuntimeFlags):
130         (WebCore::toJS):
131         (WebCore::toJSRemoteDOMWindow):
132         * bindings/js/JSRemoteDOMWindowBase.h: Added.
133         JSRemoteDOMWindow unfortunately currently needs to be a global object because of:
134         1. a JSProxy's target needs to be a JSGlobalObject currently
135         2. The 'structure()->setGlobalObject(vm, &window);' call in
136            JSDOMWindowProxy::setWindow(VM&, JSDOMGlobalObject&) which requires a JSGlobalObject.
137         Ideally, this wouldn't be the case in the future but this would require some code refactoring.
138         Our DOM global objects normally subclass JSDOMGlobalObject so I decided to subclass JSDOMGlobalObject,
139         which brings some things our bindings code expect. However, subclassing JSDOMGlobalObject directly is
140         problematic because it does not hold the m_wrapped implementation pointer. To address this issue, all
141         our our DOM global objects have a JS*Base base class which subclasses JSDOMGlobalObject and stores the
142         m_wrapped implementation pointer. I followed the same pattern here.
143
144         (WebCore::toJS):
145         * bindings/js/JSRemoteDOMWindowCustom.cpp: Added.
146         (WebCore::JSRemoteDOMWindow::getOwnPropertySlot):
147         (WebCore::JSRemoteDOMWindow::getOwnPropertySlotByIndex):
148         (WebCore::JSRemoteDOMWindow::put):
149         (WebCore::JSRemoteDOMWindow::putByIndex):
150         (WebCore::JSRemoteDOMWindow::deleteProperty):
151         (WebCore::JSRemoteDOMWindow::deletePropertyByIndex):
152         (WebCore::JSRemoteDOMWindow::getOwnPropertyNames):
153         (WebCore::JSRemoteDOMWindow::defineOwnProperty):
154         (WebCore::JSRemoteDOMWindow::getPrototype):
155         (WebCore::JSRemoteDOMWindow::preventExtensions):
156         (WebCore::JSRemoteDOMWindow::toStringName):
157         * bindings/scripts/CodeGeneratorJS.pm:
158         (IsDOMGlobalObject):
159         (GenerateHeader):
160         (GenerateOverloadDispatcher):
161         (GenerateImplementation):
162         * page/RemoteDOMWindow.idl: Added.
163
164 2018-04-17  David Kilzer  <ddkilzer@apple.com>
165
166         Implement checked cast for DDResultRef once DDResultGetTypeID() is available
167         <https://webkit.org/b/184554>
168         <rdar://problem/36241894>
169
170         Reviewed by Brent Fulgham.
171
172         * editing/cocoa/DataDetection.mm:
173         (WebCore::detectItemAtPositionWithRange): Implement checked cast
174         for DDResultRef.
175
176 2018-04-17  Said Abou-Hallawa  <sabouhallawa@apple.com>
177
178         Animated GIF imagery with finite looping are falling one loop short
179         https://bugs.webkit.org/show_bug.cgi?id=183153
180
181         Reviewed by Simon Fraser.
182
183         The Netscape Looping Application Extension is a block which may be added
184         to a GIF file to tell the viewer to loop through the entire GIF frames.
185         This is communicated through two bytes designated for the "loopCount" in
186         this block.
187
188         The entire block may not be found in the GIF, in which case the GIF is 
189         supposed to animate its entire frames only once.
190
191         If the block exists and loopCount = 0, this means the image has to loop
192         through its frames indefinitely.
193
194         If the block exist and loopCount > 0, this should mean the image has to
195         loop through its frames loopCount + 1 times. The extra loop seems to be
196         the consensus among most of the GIF generators and viewers. For example,
197         if the image designer wants the image to loop through its frames n times:
198         -- The GIF generator (e.g. Adobe Photoshop and https://ezgif.com/maker) 
199            will write n - 1 for loopCount. However http://gifmaker.me and 
200            http://gifmaker.org write n for loopCount.
201         -- The browser (e.g. Chrome 65.0.3325 181 and FireFox Quantum 59.0.2) will
202            translate loopCount = n - 1 to: animate GIF once + loop n - 1, which 
203            means loop the GIF n times.
204
205         Because the specs are not really clear about this, we are going to consider
206         the agreed-upon behavior among most of the web browsers the specs here.
207
208         * platform/graphics/cg/ImageDecoderCG.cpp:
209         (WebCore::ImageDecoderCG::repetitionCount const):
210         * platform/image-decoders/gif/GIFImageDecoder.cpp:
211         (WebCore::GIFImageDecoder::repetitionCount const):
212
213 2018-04-17  Saam Barati  <sbarati@apple.com>
214
215         Add system trace points for process launch and for initializeWebProcess
216         https://bugs.webkit.org/show_bug.cgi?id=184669
217
218         Reviewed by Simon Fraser.
219
220         No testing needed because there is no new functionality here.
221
222         * loader/FrameLoader.cpp:
223         (WebCore::FrameLoader::provisionalLoadStarted):
224         (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
225         * loader/SubresourceLoader.cpp:
226         (WebCore::SubresourceLoader::willSendRequestInternal):
227         (WebCore::SubresourceLoader::didFinishLoading):
228         (WebCore::SubresourceLoader::didFail):
229         (WebCore::SubresourceLoader::didCancel):
230
231 2018-04-17  Eric Carlson  <eric.carlson@apple.com>
232
233         [iOS] AirPlay device name is sometimes wrong
234         https://bugs.webkit.org/show_bug.cgi?id=184543
235         <rdar://problem/39105498>
236
237         Reviewed by Jer Noble.
238
239         No new tests, this can only be tested with a specific hardware setup.
240
241         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
242         (WebCore::exernalDeviceDisplayNameForPlayer): Get the device name from the AVOutputContext
243         when possible.
244
245 2018-04-17  Carlos Alberto Lopez Perez  <clopez@igalia.com>
246
247         [GTK] Build fix after r230529 (WaylandCompositorDisplay leaks its wl_display)
248         https://bugs.webkit.org/show_bug.cgi?id=184406
249
250         Rubber-stamped by Michael Catanzaro.
251
252         Fix build with clang 3.8
253
254         No new tests, it is a build fix.
255
256         * platform/graphics/wayland/PlatformDisplayWayland.cpp:
257         (WebCore::PlatformDisplayWayland::create):
258
259 2018-04-16  Antoine Quint  <graouts@apple.com>
260
261         Layout Test animations/needs-layout.html is a flaky Image Failure.
262         https://bugs.webkit.org/show_bug.cgi?id=172397
263
264         Reviewed by Dean Jackson.
265
266         Animations that animate a transform and uses a relative value for either the x or y components
267         require a layout before starting, which CSSAnimationController would perform in the call to
268         CSSAnimationControllerPrivate::animationTimerFired() made immediately after a CSS animation was
269         created.
270
271         We now perform a similar task where upon setting new blending keyframes we compute a flag indicating
272         if the keyframe effect is animating a transform with relative x or y components. Then, when we perform
273         the first invalidation task, which runs in the next run loop after a change to the timing model has
274         been made, such as a call to play() on a CSSAnimation made in the TreeResolver::createAnimatedElementUpdate()
275         where the CSSAnimation was created, we call forceLayout() on this element's FrameView. We also ensure
276         we commit animations on the compositor immediately after that too, instead of waiting until the next
277         DisplayRefreshMonitor callback.
278
279         * animation/DocumentTimeline.cpp:
280         (WebCore::DocumentTimeline::performInvalidationTask):
281         (WebCore::DocumentTimeline::updateAnimations):
282         * animation/KeyframeEffectReadOnly.cpp:
283         (WebCore::KeyframeEffectReadOnly::forceLayoutIfNeeded):
284         (WebCore::KeyframeEffectReadOnly::setBlendingKeyframes):
285         (WebCore::KeyframeEffectReadOnly::computedNeedsForcedLayout):
286         (WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions):
287         * animation/KeyframeEffectReadOnly.h:
288
289 2018-04-16  Pablo Saavedra  <psaavedra@igalia.com>
290
291         Inconsistent EGL defines in ImageBufferCairo
292         https://bugs.webkit.org/show_bug.cgi?id=184661
293
294         Reviewed by Žan Doberšek.
295
296         On revision r219391 libepoxy is added. The headers in
297         ImageBufferCairo.cpp become inconsistent when 2D canvas is enabled
298         (-DENABLE_ACCELERATED_2D_CANVAS=ON) due to a redefinition error during
299         the Webkit build:
300
301             ...
302             /usr/include/GLES2/gl2.h:503:82: error: 'voi
303             epoxy_glAttachShader(GLuint, GLuint)' redeclared as different kind
304             of symbol
305             GL_APICALL void         GL_APIENTRY glAttachShader (GLuint
306             program, GLuint shader);
307
308         No new tests.
309
310         * platform/graphics/cairo/ImageBufferCairo.cpp:
311
312 2018-04-16  Filip Pizlo  <fpizlo@apple.com>
313
314         MutationObserver should be in an IsoHeap
315         https://bugs.webkit.org/show_bug.cgi?id=184671
316         <rdar://problem/36081981>
317
318         Reviewed by Sam Weinig.
319
320         No new tests because no new behavior.
321
322         * dom/MutationObserver.cpp:
323         * dom/MutationObserver.h:
324
325 2018-04-16  Youenn Fablet  <youenn@apple.com>
326
327         Use NetworkLoadChecker to handle synchronous HTTP loads
328         https://bugs.webkit.org/show_bug.cgi?id=184240
329
330         Reviewed by Chris Dumez.
331
332         Update LoaderStrategy::loadResourceSynchronously to pass FetchOptions directly.
333         Update various call sites accordingly. This allows NetworkProcess to do all necessary checks.
334         Add an option to disable security checks if NetworkProcess does it for WebProcess.
335         This option will be also used for regular asynchronous loads in future patches.
336
337         Update DocumentThreadableLoader to bypass preflighting and response validation checks in case they are done in NetworkProcess.
338
339         Covered by existing and rebased tests.
340
341         * loader/CrossOriginPreflightChecker.cpp:
342         (WebCore::CrossOriginPreflightChecker::doPreflight):
343         * loader/DocumentThreadableLoader.cpp:
344         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
345         (WebCore::DocumentThreadableLoader::loadRequest):
346         * loader/FrameLoader.cpp:
347         (WebCore::FrameLoader::loadResourceSynchronously):
348         * loader/FrameLoader.h:
349         * loader/LoaderStrategy.h:
350         * xml/XSLTProcessorLibxslt.cpp:
351         (WebCore::docLoaderFunc):
352         * xml/parser/XMLDocumentParserLibxml2.cpp:
353         (WebCore::openFunc):
354
355 2018-04-16  Christopher Reid  <chris.reid@sony.com>
356
357         [WinCairo] Media elements should be enabled by default
358         https://bugs.webkit.org/show_bug.cgi?id=184597
359
360         Reviewed by Per Arne Vollan.
361
362         Enabling media elements by default with media foundation.
363
364         * page/SettingsDefaultValues.h:
365
366 2018-04-16  Christopher Reid  <chris.reid@sony.com>
367
368         [Curl] Add the Accept-Language field to curl request headers
369         https://bugs.webkit.org/show_bug.cgi?id=184605
370
371         Reviewed by Alex Christensen.
372
373         Add Accept-Language field to curl request headers
374
375         * platform/network/curl/CurlRequest.cpp:
376         * platform/network/curl/CurlRequest.h:
377
378 2018-04-16  Chris Dumez  <cdumez@apple.com>
379
380         Move more WindowProxy-related logic from ScriptController to WindowProxyController
381         https://bugs.webkit.org/show_bug.cgi?id=184640
382
383         Reviewed by Ryosuke Niwa.
384
385         Move more WindowProxy-related logic from ScriptController to WindowProxyController,
386         for clarity.
387
388         * bindings/js/JSDOMWindowProxy.cpp:
389         (WebCore::JSDOMWindowProxy::attachDebugger):
390         * bindings/js/JSDOMWindowProxy.h:
391         * bindings/js/ScriptCachedFrameData.cpp:
392         (WebCore::ScriptCachedFrameData::ScriptCachedFrameData):
393         (WebCore::ScriptCachedFrameData::restore):
394         * bindings/js/ScriptController.cpp:
395         (WebCore::ScriptController::~ScriptController):
396         (WebCore::ScriptController::initScriptForWindowProxy):
397         * bindings/js/ScriptController.h:
398         (WebCore::ScriptController::existingCacheableBindingRootObject const):
399         * bindings/js/WindowProxyController.cpp:
400         (WebCore::collectGarbageAfterWindowProxyDestruction):
401         (WebCore::WindowProxyController::~WindowProxyController):
402         (WebCore::WindowProxyController::clearWindowProxiesNotMatchingDOMWindow):
403         (WebCore::WindowProxyController::setDOMWindowForWindowProxy):
404         (WebCore::WindowProxyController::attachDebugger):
405         * bindings/js/WindowProxyController.h:
406         * loader/FrameLoader.cpp:
407         (WebCore::FrameLoader::clear):
408         * page/Page.cpp:
409         (WebCore::Page::setDebugger):
410
411 2018-04-16  Thibault Saunier  <tsaunier@igalia.com>
412
413         [GStreamer] Set *TrackPrivateGStreamer::active based on GstStream default select in constructor
414         https://bugs.webkit.org/show_bug.cgi?id=184652
415
416         Reviewed by Philippe Normand.
417
418         In the constructor we should mark selected streams based on the default values from GstStream,
419         if the user changes them, they will be updated as required later on.
420
421         No new tests are added as we already have a few ones that are currently disabled in
422         the mediastream testsuite. This patch is part of the work to enable them.
423
424         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp:
425         (WebCore::AudioTrackPrivateGStreamer::AudioTrackPrivateGStreamer):
426         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp:
427         (WebCore::VideoTrackPrivateGStreamer::VideoTrackPrivateGStreamer):
428
429 2018-04-16  Thibault Saunier  <tsaunier@igalia.com>
430
431         [GStreamer] Set TrackPrivateBaseGStreamer metadata information even if no client is avalaible
432         https://bugs.webkit.org/show_bug.cgi?id=184651
433
434         Reviewed by Philippe Normand.
435
436         We can't notify the client if none is connected, but still we need to fill our metadatas from
437         the provided GstTagList, especially in the case of playbin3 where the client is not set yet
438         at construct time but the metadata might already be preset (and won't be updated later on).
439
440         No new tests are added as we already have a few ones that are currently disabled in
441         the mediastream testsuite. This patch is part of the work to enable them.
442
443         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
444         (WebCore::TrackPrivateBaseGStreamer::notifyTrackOfTagsChanged):
445
446 2018-04-16  Antoine Quint  <graouts@apple.com>
447
448         [Web Animations] Ensure we never return -0 through the API
449         https://bugs.webkit.org/show_bug.cgi?id=184644
450
451         Reviewed by Dean Jackson.
452
453         We could sometimes return -0 instead of 0, which is surprising and leads to an error in WPT tests.
454         This would happen when playbackRate < 0.
455
456         * animation/WebAnimationUtilities.h:
457         (WebCore::secondsToWebAnimationsAPITime):
458
459 2018-04-15  Antoine Quint  <graouts@apple.com>
460
461         [Web Animations] Animations do not naturally get a finish event
462         https://bugs.webkit.org/show_bug.cgi?id=184639
463         <rdar://problem/39397649>
464
465         Reviewed by Jon Lee.
466
467         We must call updateFinishedState() when an animation gets sampled as it means its timeline's time has progressed
468         and it may have crossed to a finished state. Calling updateFinishedState() when sampling means that we'll correctly
469         set the animation's hold time to its end value, which means that currentTime() will now always be clamped to return
470         the end time once its has reached it, so we must not schedule animations to resolve immediately anymore since otherwise
471         they will keep being scheduled in a loop.
472
473         * animation/WebAnimation.cpp:
474         (WebCore::WebAnimation::timeToNextRequiredTick const):
475         (WebCore::WebAnimation::resolve):
476
477 2018-04-15  Chris Dumez  <cdumez@apple.com>
478
479         Change Event's returnValue so it doesn't expose a new primitive
480         https://bugs.webkit.org/show_bug.cgi?id=184415
481
482         Reviewed by Darin Adler.
483
484         Update Event.returnValue setter to match the latest DOM specification after:
485         - https://github.com/whatwg/dom/pull/626
486
487         In particular, the returnValue setter is now a no-op if the new flag value
488         is true. If the input flag value is false, it only sets the 'canceled' flag
489         if the event is cancelable and the event’s in passive listener flag is unset.
490
491         Test: imported/w3c/web-platform-tests/dom/events/Event-returnValue.html
492
493         * dom/Event.cpp:
494         (WebCore::Event::setLegacyReturnValue):
495         (WebCore::Event::setCanceledFlagIfPossible):
496         (WebCore::Event::preventDefault):
497         * dom/Event.h:
498
499 2018-04-14  Thibault Saunier  <tsaunier@igalia.com>
500
501         [GStreamer] Expose a method to retrieve the GstStream from a TrackPrivateBaseGStreamer
502         https://bugs.webkit.org/show_bug.cgi?id=184620
503
504         Reviewed by Philippe Normand.
505
506         This is a minor change, a dedicated test doesn't really make sense here.
507
508         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h:
509         (WebCore::TrackPrivateBaseGStreamer::stream):
510
511 2018-04-13  Ryosuke Niwa  <rniwa@webkit.org>
512
513         WebKit crashes when libwebrtc.dylib is missing
514         https://bugs.webkit.org/show_bug.cgi?id=184607
515
516         Rubber-stamped by Jer Noble.
517
518         Don't call LibWebRTC related code when libwebrtc is not available.
519
520         * dom/Document.cpp:
521         (WebCore::Document::prepareForDestruction):
522         (WebCore::Document::suspend):
523
524 2018-04-13  Chris Dumez  <cdumez@apple.com>
525
526         Split WindowProxy handling out of ScriptController and into a new class owned by AbstractFrame
527         https://bugs.webkit.org/show_bug.cgi?id=184591
528
529         Reviewed by Sam Weinig.
530
531         Split WindowProxy handling out of ScriptController and into a new class owned by AbstractFrame.
532         RemoteFrames do not need a ScriptController but do need to maintain WindowProxies.
533         This is work towards fixing Bug 184515.
534
535         * Sources.txt:
536         * WebCore.xcodeproj/project.pbxproj:
537         * bindings/js/DOMWrapperWorld.cpp:
538         (WebCore::DOMWrapperWorld::~DOMWrapperWorld):
539         (WebCore::DOMWrapperWorld::clearWrappers):
540         * bindings/js/DOMWrapperWorld.h:
541         (WebCore::DOMWrapperWorld::didCreateWindowProxy):
542         (WebCore::DOMWrapperWorld::didDestroyWindowProxy):
543         * bindings/js/JSBindingsAllInOne.cpp:
544         * bindings/js/JSDOMWindowBase.cpp:
545         (WebCore::toJSDOMWindow):
546         * bindings/js/JSDOMWindowProxy.cpp:
547         (WebCore::toJS):
548         (WebCore::toJSDOMWindowProxy):
549         * bindings/js/ScriptCachedFrameData.cpp:
550         (WebCore::ScriptCachedFrameData::ScriptCachedFrameData):
551         (WebCore::ScriptCachedFrameData::restore):
552         * bindings/js/ScriptController.cpp:
553         (WebCore::ScriptController::~ScriptController):
554         (WebCore::ScriptController::evaluateInWorld):
555         (WebCore::ScriptController::loadModuleScriptInWorld):
556         (WebCore::ScriptController::linkAndEvaluateModuleScriptInWorld):
557         (WebCore::ScriptController::evaluateModule):
558         (WebCore::ScriptController::clearWindowProxiesNotMatchingDOMWindow):
559         (WebCore::ScriptController::setDOMWindowForWindowProxy):
560         (WebCore::ScriptController::initScriptForWindowProxy):
561         (WebCore::ScriptController::setupModuleScriptHandlers):
562         (WebCore::ScriptController::windowProxyController):
563         (WebCore::ScriptController::enableEval):
564         (WebCore::ScriptController::enableWebAssembly):
565         (WebCore::ScriptController::disableEval):
566         (WebCore::ScriptController::disableWebAssembly):
567         (WebCore::ScriptController::attachDebugger):
568         (WebCore::ScriptController::updateDocument):
569         (WebCore::ScriptController::collectIsolatedContexts):
570         (WebCore::ScriptController::windowScriptNPObject):
571         (WebCore::ScriptController::executeIfJavaScriptURL):
572         * bindings/js/ScriptController.h:
573         (WebCore::ScriptController::globalObject):
574         * bindings/js/ScriptControllerMac.mm:
575         (WebCore::ScriptController::windowScriptObject):
576         * bindings/js/ScriptState.cpp:
577         (WebCore::mainWorldExecState):
578         * bindings/js/WindowProxyController.cpp: Added.
579         (WebCore::WindowProxyController::WindowProxyController):
580         (WebCore::WindowProxyController::destroyWindowProxy):
581         (WebCore::WindowProxyController::createWindowProxy):
582         (WebCore::WindowProxyController::windowProxies):
583         (WebCore::WindowProxyController::createWindowProxyWithInitializedScript):
584         * bindings/js/WindowProxyController.h: Added.
585         (WebCore::WindowProxyController::releaseWindowProxies):
586         (WebCore::WindowProxyController::setWindowProxies):
587         (WebCore::WindowProxyController::windowProxy):
588         (WebCore::WindowProxyController::existingWindowProxy const):
589         (WebCore::WindowProxyController::globalObject):
590         * loader/FrameLoader.cpp:
591         (WebCore::FrameLoader::dispatchDidClearWindowObjectInWorld):
592         * page/AbstractFrame.cpp:
593         (WebCore::AbstractFrame::AbstractFrame):
594         * page/AbstractFrame.h:
595         (WebCore::AbstractFrame::windowProxyController):
596         (WebCore::AbstractFrame::windowProxyController const):
597
598 2018-04-13  Brady Eidson  <beidson@apple.com>
599
600         Introduce SuspendedPageProxy to keep old web processes around after their WebPageProxy has been swapped to a new one.
601         https://bugs.webkit.org/show_bug.cgi?id=184559
602
603         Reviewed by Alex Christensen.
604
605         Covered by new API test.
606
607         WebCore changes rework the meaning of a "ForSuspension" policy to simply navigate the page to about:blank.
608
609         * loader/DocumentLoader.cpp:
610         (WebCore::DocumentLoader::redirectReceived):
611         (WebCore::DocumentLoader::willSendRequest):
612         (WebCore::DocumentLoader::startLoadingMainResource):
613         * loader/DocumentLoader.h:
614
615         * loader/FrameLoader.cpp:
616         (WebCore::FrameLoader::init):
617         (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
618
619 2018-04-13  Chris Dumez  <cdumez@apple.com>
620
621         input.webkitEntries does not work as expected when folder contains accented chars
622         https://bugs.webkit.org/show_bug.cgi?id=184517
623         <rdar://problem/39265537>
624
625         Reviewed by Alex Christensen.
626
627         Use String::fromUTF8() to construct a WTF String from the char* returned by
628         dirname() in FileSystem::directoryName(). Previously, we were just calling
629         the String constructor, which would treat the input as latin 1 instead of
630         UTF-8.
631
632         Change is covered by an API test rather than a layout test due to file versioning
633         limitations.
634
635         * platform/posix/FileSystemPOSIX.cpp:
636         (WebCore::FileSystem::directoryName):
637
638 2018-04-13  Yusuke Suzuki  <utatane.tea@gmail.com>
639
640         [WebCore] Use @getByIdDirectPrivate / @putByIdDirectPrivate in WebCore JS
641         https://bugs.webkit.org/show_bug.cgi?id=184401
642
643         Rubber stamped by Saam Barati.
644
645         Apply bug 183970 changes to WebCore JS too. This offers solid type checking
646         with @getByIdDirectPrivate().
647
648         * Modules/mediastream/RTCPeerConnection.js:
649         (initializeRTCPeerConnection):
650         (getLocalStreams):
651         (getStreamById):
652         (addStream):
653         * Modules/mediastream/RTCPeerConnectionInternals.js:
654         (isRTCPeerConnection):
655         * Modules/streams/ReadableByteStreamController.js:
656         (enqueue):
657         (error):
658         (close):
659         (getter.byobRequest):
660         * Modules/streams/ReadableByteStreamInternals.js:
661         (privateInitializeReadableStreamBYOBReader):
662         (privateInitializeReadableByteStreamController):
663         (privateInitializeReadableStreamBYOBRequest):
664         (isReadableByteStreamController):
665         (isReadableStreamBYOBRequest):
666         (isReadableStreamBYOBReader):
667         (readableByteStreamControllerCancel):
668         (readableByteStreamControllerError):
669         (readableByteStreamControllerClose):
670         (readableByteStreamControllerClearPendingPullIntos):
671         (readableByteStreamControllerGetDesiredSize):
672         (readableStreamHasBYOBReader):
673         (readableStreamHasDefaultReader):
674         (readableByteStreamControllerHandleQueueDrain):
675         (readableByteStreamControllerPull):
676         (readableByteStreamControllerShouldCallPull):
677         (readableByteStreamControllerCallPullIfNeeded):
678         (readableByteStreamControllerEnqueue):
679         (readableByteStreamControllerEnqueueChunk):
680         (readableByteStreamControllerRespondWithNewView):
681         (readableByteStreamControllerRespond):
682         (readableByteStreamControllerRespondInternal):
683         (readableByteStreamControllerRespondInReadableState):
684         (readableByteStreamControllerRespondInClosedState):
685         (readableByteStreamControllerProcessPullDescriptors):
686         (readableByteStreamControllerFillDescriptorFromQueue):
687         (readableByteStreamControllerShiftPendingDescriptor):
688         (readableByteStreamControllerInvalidateBYOBRequest):
689         (readableByteStreamControllerCommitDescriptor):
690         (readableStreamFulfillReadIntoRequest):
691         (readableByteStreamControllerPullInto):
692         (readableStreamAddReadIntoRequest):
693         * Modules/streams/ReadableStream.js:
694         (initializeReadableStream):
695         (pipeThrough):
696         * Modules/streams/ReadableStreamBYOBReader.js:
697         (cancel):
698         (read):
699         (releaseLock):
700         (getter.closed):
701         * Modules/streams/ReadableStreamBYOBRequest.js:
702         (respond):
703         (respondWithNewView):
704         (getter.view):
705         * Modules/streams/ReadableStreamDefaultController.js:
706         (error):
707         * Modules/streams/ReadableStreamDefaultReader.js:
708         (cancel):
709         (read):
710         (releaseLock):
711         (getter.closed):
712         * Modules/streams/ReadableStreamInternals.js:
713         (privateInitializeReadableStreamDefaultReader):
714         (readableStreamReaderGenericInitialize):
715         (readableStreamDefaultControllerError):
716         (readableStreamPipeTo):
717         (readableStreamTee):
718         (isReadableStream):
719         (isReadableStreamDefaultReader):
720         (isReadableStreamDefaultController):
721         (readableStreamError):
722         (readableStreamDefaultControllerCallPullIfNeeded):
723         (readableStreamDefaultControllerGetDesiredSize):
724         (readableStreamReaderGenericCancel):
725         (readableStreamCancel):
726         (readableStreamDefaultControllerCancel):
727         (readableStreamDefaultControllerPull):
728         (readableStreamDefaultControllerClose):
729         (readableStreamClose):
730         (readableStreamFulfillReadRequest):
731         (readableStreamDefaultReaderRead):
732         (readableStreamAddReadRequest):
733         (isReadableStreamDisturbed):
734         (readableStreamReaderGenericRelease):
735         (readableStreamDefaultControllerCanCloseOrEnqueue):
736         (privateInitializeReadableStreamDefaultController): Deleted.
737         * Modules/streams/StreamInternals.js:
738         (validateAndNormalizeQueuingStrategy):
739         * Modules/streams/WritableStream.js:
740         (initializeWritableStream):
741         (abort):
742         (close):
743         (write):
744         (getter.closed):
745         (getter.ready):
746         (getter.state):
747         * Modules/streams/WritableStreamInternals.js:
748         (isWritableStream):
749         (syncWritableStreamStateWithQueue):
750         (errorWritableStream):
751         (callOrScheduleWritableStreamAdvanceQueue):
752         * bindings/js/JSDOMBindingInternals.js:
753         (mapLikeForEach):
754
755 2018-04-12  Antoine Quint  <graouts@apple.com>
756
757         [Web Animations] Turn CSS Animations and CSS Transitions as Web Animations on by default
758         https://bugs.webkit.org/show_bug.cgi?id=184569
759         <rdar://problem/38671301>
760
761         Reviewed by Jon Lee.
762
763         We now set the CSS Animations and CSS Transitions as Web Animations flag on by default. To ensure that some remaining
764         tests pass with this flag on, we expose a way to get to a PseudoElement via a new internals.pseudoElement() method. This
765         allows tests that used internals.pauseAnimationAtTimeOnPseudoElement() and internals.pauseTransitionAtTimeOnPseudoElement()
766         to now work with the Web Animations API.
767
768         * page/RuntimeEnabledFeatures.h:
769         * testing/Internals.cpp:
770         (WebCore::Internals::pseudoElement):
771         * testing/Internals.h:
772         * testing/Internals.idl:
773
774 2018-04-13  Sergio Villar Senin  <svillar@igalia.com>
775
776         [WebVR][OpenVR] Implement requestPresent()/exitPresent() and getLayers()
777         https://bugs.webkit.org/show_bug.cgi?id=184530
778
779         Reviewed by Žan Doberšek.
780
781         WebVR apps should invoke requestPresent() to start presenting contents of a VRLayerInit
782         (right now a HTML canvas with a WebGL context) on the VRDisplay. This request might fail for
783         a variety of reasons and can be eventually cancelled with exitPresent(). Once we are
784         presenting we could access the presenting layers (right now just one) with getLayers().
785
786         Note that we are not presenting anything to the HMD yet, that will be done later in a follow
787         up patch.
788
789         I took the chance to correct a mistak in the VRDisplayCapabilities object which has a method
790         that should be called maxLayers instead of maxLayer.
791
792         * Modules/webvr/VRDisplay.cpp:
793         (WebCore::VRDisplay::requestPresent):
794         (WebCore::VRDisplay::stopPresenting):
795         (WebCore::VRDisplay::exitPresent):
796         (WebCore::VRDisplay::getLayers const):
797         (WebCore::VRDisplay::isPresenting const): Deleted. Implemented in the header file.
798         * Modules/webvr/VRDisplay.h:
799         (WebCore::VRDisplay::isPresenting const):
800         * Modules/webvr/VRDisplayCapabilities.h:
801         (WebCore::VRDisplayCapabilities::maxLayers const): Renamed from maxLayer().
802         (WebCore::VRDisplayCapabilities::maxLayer const): Deleted.
803         * Modules/webvr/VRDisplayCapabilities.idl:
804
805 2018-04-13  Miguel Gomez  <magomez@igalia.com>
806
807         REGRESSION(r230627): [GTK][WPE] Possible deadlock when destroying the player in non AC mode
808         https://bugs.webkit.org/show_bug.cgi?id=184583
809
810         Reviewed by Carlos Garcia Campos.
811
812         In non AC mode, ensure that a deadlock can't happen when destroying MediaPlayerPrivateGStreamerBase.
813
814         Covered by existent tests.
815
816         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
817         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
818         (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
819         (WebCore::MediaPlayerPrivateGStreamerBase::cancelRepaint):
820         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
821
822 2018-04-13  Miguel Gomez  <magomez@igalia.com>
823
824         [GTK] [gstreamer] video won't unpause when built with -DUSE_GSTREAMER_GL=OFF
825         https://bugs.webkit.org/show_bug.cgi?id=183362
826
827         Reviewed by Carlos Garcia Campos.
828
829         Remove the drawCancelled flag and use a new one to indicate that the player is being destroyed.
830         That new flag is only enabled on destruction and it's not modified by cancelRepaint(), which
831         can be used to handle the pause event without avoiding future renderings. Also cancelRepaint()
832         has only effect when not in AC mode.
833
834         Covered by existent tests.
835
836         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
837         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
838         (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
839         (WebCore::MediaPlayerPrivateGStreamerBase::cancelRepaint):
840         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
841
842 2018-04-13  Xabier Rodriguez Calvar  <calvaris@igalia.com>
843
844         [GStreamer] Convert GStreamerUtilities in GStreamerCommon and include the GStreamer smart pointer traits
845         https://bugs.webkit.org/show_bug.cgi?id=184533
846
847         Reviewed by Philippe Normand.
848
849         Renamed GStreamerUtilities* files into GStreamerCommon* and
850         modified files including them accordingly. Include
851         GRefPtrGStreamer.h and GUniquePtrGStreamer.h in GStreamerCommon.h
852         to avoid problems destroying objects when those files are
853         forgotten to be included.
854
855         * Modules/webaudio/AudioContext.cpp:
856         * platform/GStreamer.cmake:
857         * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
858         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h:
859         * platform/graphics/gstreamer/GStreamerCommon.cpp: Renamed from Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.cpp.
860         * platform/graphics/gstreamer/GStreamerCommon.h: Renamed from Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.h.
861         * platform/graphics/gstreamer/ImageGStreamer.h:
862         * platform/graphics/gstreamer/ImageGStreamerCairo.cpp:
863         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp:
864         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.h:
865         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
866         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
867         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
868         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
869         * platform/graphics/gstreamer/MediaSampleGStreamer.cpp:
870         * platform/graphics/gstreamer/MediaSampleGStreamer.h:
871         * platform/graphics/gstreamer/TextCombinerGStreamer.cpp:
872         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
873         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h:
874         * platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
875         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h:
876         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
877         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.cpp:
878         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h:
879         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
880         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
881         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
882         * platform/graphics/gstreamer/mse/AppendPipeline.h:
883         * platform/graphics/gstreamer/mse/GStreamerMediaDescription.cpp:
884         * platform/graphics/gstreamer/mse/GStreamerMediaDescription.h:
885         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
886         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
887         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h:
888         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
889         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp:
890         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
891         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.h:
892
893 2018-04-12  Christopher Reid  <chris.reid@sony.com>
894
895         [Curl] Fix clang build error in CurlContext.cpp
896         https://bugs.webkit.org/show_bug.cgi?id=184561
897
898         Reviewed by Darin Adler.
899
900         MSVC allows explicit template specialization in classes but gcc/clang do not.
901
902         * platform/network/curl/CurlContext.cpp:
903
904 2018-04-12  Christopher Reid  <chris.reid@sony.com>
905
906         [Curl] Cookie Database on memory path should be :memory:
907         https://bugs.webkit.org/show_bug.cgi?id=184572
908
909         Reviewed by Alex Christensen.
910
911         CookieJarDB::isOnMemory is comparing the database path with :onmemory: but it should be using :memory:
912         For reference, see: https://www.sqlite.org/inmemorydb.html
913
914         * platform/network/curl/CookieJarDB.h:
915
916 2018-04-12  Daniel Bates  <dabates@apple.com>
917
918         Attmept to fix the Windows build following <https://trac.webkit.org/changeset/230602/>
919         (https://bugs.webkit.org/show_bug.cgi?id=184386)
920
921         Visual Studio cannot prove that all cases in the switch are covered :(
922         So, add an ASSERT_NOT_REACHED() and a return a value outside of the switch block. 
923
924         * loader/cache/CachedResourceLoader.cpp:
925         (WebCore::destinationForType):
926
927 2018-04-12  Chris Dumez  <cdumez@apple.com>
928
929         Introduce remote variants of Frame / DOMWindow classes
930         https://bugs.webkit.org/show_bug.cgi?id=184467
931         <rdar://problem/39011267>
932
933         Reviewed by Ryosuke Niwa.
934
935         Introduce remote variants of Frame / DOMWindow classes, for when these frames / windows
936         are hosted on another WebProcess. Those will be used in a follow-up patch.
937
938         The hierarchy is as follows (class naming will be improved in a follow-up patch to minimise
939         patch size):
940         - AbstractFrame: A frame that can be either local or remote (hosted on another WebProcess)
941             - Frame: A local frame
942             - RemoteFrame: A frame hosted on another WebProcess. A RemoteFrame's window is also remote.
943         - AbstractDOMWindow: A window that be either local or remote (hosted on another WebProcess)
944             - DOMWindow: A local DOMWindow
945             - RemoteDOMWindow: A window hosted on another WebProcess. A RemoteDOMWindow's frame is also
946               remote. A RemoteDOMWindow is always cross-origin.
947
948         This patch introduces global identifiers (unique across all WebProcesses) for both Frames and
949         Windows. This is useful as we need to know which Frame / DOMWindow a particular RemoteFrame /
950         RemoteDOMWindow is pointing to.
951
952         Follow-up patch will add support for converting a local DOMWindow / Frame into a remote ones,
953         when a newly opened window (via window.open) is navigated cross-origin (Bug 184515).
954
955         Other things we'll need to implement in follow-ups:
956         - RemoteDOMWindow will need to know about its opener in order to support the window.opener
957           API. Internally, the opener will be stored as a RemoteFrame so that window.opener always
958           returns the current window in the opener frame (which changes upon navigation).
959         - Nullify a RemoteDOMWindow's frame whenever the window it is pointing to becomes frameless.
960           A frameless window behaves very differently (e.g. very little API is exposed to the Web).
961           This happens when either the newly opened window is either closed or navigated.
962
963         * Sources.txt:
964         * WebCore.xcodeproj/project.pbxproj:
965         * loader/ContentFilter.cpp:
966         (WebCore::ContentFilter::didDecide):
967         * page/AbstractDOMWindow.cpp: Added.
968         (WebCore::AbstractDOMWindow::AbstractDOMWindow):
969         (WebCore::AbstractDOMWindow::~AbstractDOMWindow):
970         * page/AbstractDOMWindow.h: Added.
971         (WebCore::AbstractDOMWindow::identifier const):
972         * page/AbstractFrame.cpp: Added.
973         (WebCore::AbstractFrame::AbstractFrame):
974         (WebCore::AbstractFrame::~AbstractFrame):
975         * page/AbstractFrame.h: Added.
976         (WebCore::AbstractFrame::window const):
977         * page/DOMWindow.cpp:
978         (WebCore::DOMWindow::DOMWindow):
979         * page/DOMWindow.h:
980         (isType):
981         * page/Frame.cpp:
982         (WebCore::Frame::window const):
983         (WebCore::Frame::virtualWindow const):
984         * page/Frame.h:
985         (isType):
986         * page/GlobalFrameIdentifier.h: Added.
987         (WebCore::GlobalFrameIdentifier::encode const):
988         (WebCore::GlobalFrameIdentifier::decode):
989         * page/GlobalWindowIdentifier.h: Added.
990         (WebCore::operator==):
991         (WebCore::GlobalWindowIdentifier::hash const):
992         (WebCore::GlobalWindowIdentifier::encode const):
993         (WebCore::GlobalWindowIdentifier::decode):
994         (WTF::GlobalWindowIdentifierHash::hash):
995         (WTF::GlobalWindowIdentifierHash::equal):
996         (WTF::HashTraits<WebCore::GlobalWindowIdentifier>::emptyValue):
997         (WTF::HashTraits<WebCore::GlobalWindowIdentifier>::constructDeletedValue):
998         (WTF::HashTraits<WebCore::GlobalWindowIdentifier>::isDeletedValue):
999
1000         * page/RemoteDOMWindow.cpp: Added.
1001         (WebCore::RemoteDOMWindow::RemoteDOMWindow):
1002         (WebCore::RemoteDOMWindow::~RemoteDOMWindow):
1003         (WebCore::RemoteDOMWindow::self const):
1004         (WebCore::RemoteDOMWindow::location const):
1005         (WebCore::RemoteDOMWindow::close):
1006         (WebCore::RemoteDOMWindow::closed const):
1007         (WebCore::RemoteDOMWindow::focus):
1008         (WebCore::RemoteDOMWindow::blur):
1009         (WebCore::RemoteDOMWindow::length const):
1010         (WebCore::RemoteDOMWindow::top const):
1011         (WebCore::RemoteDOMWindow::opener const):
1012         (WebCore::RemoteDOMWindow::parent const):
1013         (WebCore::RemoteDOMWindow::postMessage):
1014         The DOM API exposed on RemoteDOMWindow is only the subset of the DOMWindow API that is exposed cross origin,
1015         since remote DOMWindow are always from a different origin. The short-term plan is to implement these in a
1016         follow-up by relying on IPC (synchronous when necessary) to fetch the information from the real window in
1017         the WebProcess where it lives. Longer term, we should probably keep RemoteDOMWindow members in sync with the
1018         DOMWindow they're pointing to, so we do not have to rely on synchronous IPC.
1019
1020         * page/RemoteDOMWindow.h: Added.
1021         (isType):
1022         * page/RemoteFrame.cpp: Added.
1023         (WebCore::RemoteFrame::RemoteFrame):
1024         (WebCore::RemoteFrame::~RemoteFrame):
1025         (WebCore::RemoteFrame::virtualWindow const):
1026         * page/RemoteFrame.h: Added.
1027         (isType):
1028
1029 2018-04-12  Daniel Bates  <dabates@apple.com>
1030
1031         Content-Type not enforced for <script> allows for XSS
1032         https://bugs.webkit.org/show_bug.cgi?id=184386
1033         <rdar://problem/39112268>
1034
1035         Reviewed by Brady Eidson.
1036
1037         As per the Fetch standard, <https://fetch.spec.whatwg.org/#should-response-to-request-be-blocked-due-to-mime-type?> (16 March 2018),
1038         we should block JavaScript scripts that are served with MIME type text/csv, or a MIME type
1039         that begins with "audio/", "image/" or "video/".
1040
1041         As a side benefit of this change we now set the destination property [1] on preload requests.
1042
1043         [1] <https://fetch.spec.whatwg.org/#concept-request-destination>
1044
1045         Tests: http/tests/security/script-with-banned-mimetype.html
1046                http/tests/workers/worker-importScripts-banned-mimetype.html
1047
1048         * Sources.txt: Add file FetchIdioms.cpp.
1049         * WebCore.xcodeproj/project.pbxproj: Add files FetchIdioms.{cpp, h}.
1050         * dom/LoadableClassicScript.cpp:
1051         (WebCore::LoadableClassicScript::notifyFinished): Check the MIME type of the response and
1052         block the script if applicable.
1053         * dom/LoadableScript.h: Add error type MIMEType.
1054         * loader/FetchIdioms.cpp: Added.
1055         (WebCore::shouldBlockResponseDueToMIMEType): Implements the "Should response to request be blocked
1056         due to its MIME type?" algorithm from the Fetch standard.
1057         * loader/FetchIdioms.h: Added.
1058         * loader/FetchOptions.h:
1059         (WebCore::isScriptLikeDestination): Implements the definition of "script like" as per <https://fetch.spec.whatwg.org/#request-destination-script-like>.
1060         * loader/cache/CachedResourceLoader.cpp:
1061         (WebCore::CachedResourceLoader::requestImage): Removed logic to set the destination property as
1062         CachedResourceLoader::requestResource() is now responsible for doing this.
1063         (WebCore::CachedResourceLoader::requestFont): Ditto.
1064         (WebCore::CachedResourceLoader::requestTextTrack): Ditto.
1065         (WebCore::CachedResourceLoader::requestCSSStyleSheet): Ditto.
1066         (WebCore::CachedResourceLoader::requestScript): Ditto.
1067         (WebCore::CachedResourceLoader::requestXSLStyleSheet): Ditto.
1068         (WebCore::CachedResourceLoader::requestMedia): Update comment to express that we should assert
1069         that the destination property is either video or audio.
1070         (WebCore::CachedResourceLoader::requestIcon): Remove logic to set the destination property as
1071         CachedResourceLoader::requestResource() is now responsible for doing this.
1072         (WebCore::CachedResourceLoader::requestRawResource): Removed assertion as this function is used to
1073         load many kinds of requests that have different destination properties. The caller is responsible
1074         for setting the appropriate destintion property.
1075         (WebCore::CachedResourceLoader::requestMainResource): Remove logic to set the destination property
1076         as CachedResourceLoader::requestResource() is now responsible for doing this.
1077         (WebCore::destinationForType): Helper function that maps CachedResource::Type to FetchOptions::Destination.
1078         (WebCore::CachedResourceLoader::requestResource): Set the destination property on the request if not
1079         already set.
1080         * loader/cache/CachedResourceLoader.h: Segregate requestRawResource() from the other request functions
1081         and add a comment to explain what it is used for.
1082         * workers/Worker.cpp:
1083         (WebCore::Worker::create):
1084         * workers/WorkerScriptLoader.cpp:
1085         (WebCore::WorkerScriptLoader::loadSynchronously): Set the destination property to FetchOptions::Destination::Script
1086         and store it in an instance variable as we will need to reference it once we receive the HTTP response.
1087         Note that this function is only used to support the Web API importScripts().
1088         (WebCore::WorkerScriptLoader::loadAsynchronously): Store the passed destination property in an
1089         instance as we will need to reference it once we receive the HTTP response.
1090         (WebCore::WorkerScriptLoader::didReceiveResponse): Check the MIME type of the response and
1091         block the script if applicable.
1092         * workers/WorkerScriptLoader.h:
1093         * workers/service/ServiceWorkerJob.cpp:
1094         (WebCore::ServiceWorkerJob::fetchScriptWithContext): Set the destination property to FetchOptions::Destination::Serviceworker.
1095
1096 2018-04-12  Antoine Quint  <graouts@apple.com>
1097
1098         [Web Animations] Fix a host of small CSS Animations and CSS Transitions issues
1099         https://bugs.webkit.org/show_bug.cgi?id=184555
1100
1101         Reviewed by Dean Jackson.
1102
1103         A series of small and intertwined issues were preventing a number of CSS Animations and CSS Trantions
1104         tests to fail when expressed as Web Animations.
1105
1106         * animation/AnimationTimeline.cpp:
1107         (WebCore::AnimationTimeline::updateCSSAnimationsForElement): Pass the old and new RenderStyles to CSSAnimation::create()
1108         since we're refactoring DeclarativeAnimation to create blending keyframes in initialize(), no longer requiring each subclass
1109         to create them.
1110         (WebCore::AnimationTimeline::cssAnimationForElementAndProperty): Return the animation, if any, for a property animated by
1111         a CSS animation, so that we can determine if a property is already being animated when running a CSS Transition.
1112         (WebCore::AnimationTimeline::updateCSSTransitionsForElement): Since a property can be specified twice in a "transition" property,
1113         once via "all" and once explicitly, ensure we look at all currently running transitions for the currently-processed property to
1114         see if we need to cancel this transition. Previously, we used to only see if it had been transitioned in the old style. We also
1115         start transitions even if the duration is 0 provided the delay is a positive, non-zero value. Then, if there is a CSS Animation
1116         for this property already running, use that animation's original unanimated style as the from value.
1117         * animation/AnimationTimeline.h:
1118         * animation/CSSAnimation.cpp:
1119         (WebCore::CSSAnimation::create): The animation name is now set in the CSSAnimation constructor.
1120         (WebCore::CSSAnimation::CSSAnimation): Set the animation name and keep a copy of the unanimated style such that we can
1121         get it when a CSS Transition is created and takes precedence over this CSS Animation.
1122         (WebCore::CSSAnimation::initialize): Deleted.
1123         * animation/CSSAnimation.h:
1124         * animation/CSSTransition.cpp:
1125         (WebCore::CSSTransition::create):
1126         (WebCore::CSSTransition::initialize):
1127         * animation/CSSTransition.h:
1128         * animation/DeclarativeAnimation.cpp:
1129         (WebCore::DeclarativeAnimation::initialize): Call the new computeDeclarativeAnimationBlendingKeyframes() on the KeyframeEffect
1130         directly in this method so that subclasses don't need to create it manually, but most important so that keyframes are created
1131         before timing properties are set based on the backing animation.
1132         * animation/DeclarativeAnimation.h:
1133         * animation/KeyframeEffectReadOnly.cpp:
1134         (WebCore::KeyframeEffectReadOnly::getKeyframes): Ensure we have a CSSValue before trying to serialize it.
1135         (WebCore::KeyframeEffectReadOnly::computeDeclarativeAnimationBlendingKeyframes):
1136         (WebCore::KeyframeEffectReadOnly::computeCSSAnimationBlendingKeyframes): Use the animation's unanimated style to compute keyframes,
1137         instead of a default RenderStyle which would not use the right values for implicit keyframes.
1138         (WebCore::KeyframeEffectReadOnly::stylesWouldYieldNewCSSTransitionsBlendingKeyframes const): Look at the property used to create
1139         the transition rather than that specified on the backing Animation object since it can be CSSPropertyInvalid in the case of
1140         "transition: all".
1141         (WebCore::KeyframeEffectReadOnly::setAnimatedPropertiesInStyle): If we're dealing with a CSS animation, we consider the first and
1142         last keyframes to always have the property listed since the underlying style was provided and should be captured.
1143         * animation/KeyframeEffectReadOnly.h:
1144         * style/StyleTreeResolver.cpp:
1145         (WebCore::Style::TreeResolver::createAnimatedElementUpdate): Apply CSS Animations after CSS Trasitions since they take precedence.
1146
1147 2018-04-12  Antoine Quint  <graouts@apple.com>
1148
1149         [Web Animations] Only cancel declarative animations upon element removal
1150         https://bugs.webkit.org/show_bug.cgi?id=184553
1151
1152         Reviewed by Dean Jackson.
1153
1154         Ensure we only call cancel() on CSSAnimation and CSSTransition objects as we might otherwise reject
1155         the ready promise and produce spurious logging from WPT tests.
1156
1157         * animation/AnimationTimeline.cpp:
1158         (WebCore::AnimationTimeline::cancelDeclarativeAnimationsForElement):
1159         (WebCore::AnimationTimeline::cancelAnimationsForElement): Deleted.
1160         * animation/AnimationTimeline.h:
1161         * dom/Element.cpp:
1162         (WebCore::Element::removedFromAncestor):
1163         * dom/PseudoElement.cpp:
1164         (WebCore::PseudoElement::clearHostElement):
1165         * rendering/updating/RenderTreeUpdater.cpp:
1166         (WebCore::RenderTreeUpdater::tearDownRenderers):
1167
1168 2018-04-12  Ryan Haddad  <ryanhaddad@apple.com>
1169
1170         Unreviewed, rolling out r230554.
1171
1172         The non-ASCII character in the filename causes issues with SVN
1173
1174         Reverted changeset:
1175
1176         "input.webkitEntries does not work as expected when folder
1177         contains accented chars"
1178         https://bugs.webkit.org/show_bug.cgi?id=184517
1179         https://trac.webkit.org/changeset/230554
1180
1181 2018-04-12  Alicia Boya García  <aboya@igalia.com>
1182
1183         [MSE] Add isValid() assertions on PlatformTimeRanges::add() range ends
1184         https://bugs.webkit.org/show_bug.cgi?id=180253
1185
1186         Right now it's checked that start <= end but it's not checked that
1187         neither of them is undefined.
1188
1189         When this happens, the bug can be hard to track down.
1190
1191         The assertion is not enabled for Mac because there is currently a test
1192         that is hitting it.
1193
1194         Reviewed by Jer Noble.
1195
1196         * platform/graphics/PlatformTimeRanges.cpp:
1197         (WebCore::PlatformTimeRanges::add):
1198
1199 2018-04-12  Chris Dumez  <cdumez@apple.com>
1200
1201         Process::setIdentifier() / Process::identifier() do not need a lock
1202         https://bugs.webkit.org/show_bug.cgi?id=184544
1203
1204         Reviewed by Brady Eidson.
1205
1206         Process::setIdentifier() / Process::identifier() do not need a lock.
1207         Process::setIdentifier() gets called in ChildProcess::initialize(),
1208         before we start any background threads. It is then safe to query
1209         this process identifier later on from background threads without
1210         locks.
1211
1212         * platform/Process.cpp:
1213         (WebCore::Process::setIdentifier):
1214         (WebCore::Process::identifier):
1215
1216 2018-04-12  Antoine Quint  <graouts@apple.com>
1217
1218         Unreviewed, fix the Windows build.
1219
1220         * animation/DocumentTimeline.cpp:
1221         (WebCore::DocumentTimeline::computeExtentOfAnimation const):
1222
1223 2018-04-12  Antoine Quint  <graouts@apple.com>
1224
1225         [Web Animations] Suspend animations when required
1226         https://bugs.webkit.org/show_bug.cgi?id=184541
1227
1228         Reviewed by Jon Lee.
1229
1230         Animations managed by CSSAnimationController get suspended under a number of scenarios, we now add the possibility
1231         to suspend animations on a DocumentTimeline as well such that Web Animations and CSS Animations and CSS Transitions
1232         implemented as Web Animations get suspended under the same conditions as well. We also update the implementation for
1233         Internals::numberOfActiveAnimations() such that tests checking that animations get suspended pass.
1234
1235         * animation/DocumentTimeline.cpp:
1236         (WebCore::DocumentTimeline::suspendAnimations): When asked to be suspended, the DocumentTimeline cancels pending
1237         invalidation tasks and updates all of the animations it manages, including those running on the compositor.
1238         (WebCore::DocumentTimeline::resumeAnimations): When asked to be resumed, the DocumentTimeline resumes animations
1239         it manages and rewinds its invalidation timer.
1240         (WebCore::DocumentTimeline::animationsAreSuspended):
1241         (WebCore::DocumentTimeline::numberOfActiveAnimationsForTesting const): Called by Internals::numberOfActiveAnimations(),
1242         this returns the number of animations managed by this timeline that are not suspended.
1243         (WebCore::DocumentTimeline::currentTime):
1244         (WebCore::DocumentTimeline::timingModelDidChange): Ensure the invalidation timer is not rewound if the timeline
1245         is suspended.
1246         * animation/DocumentTimeline.h:
1247         * animation/WebAnimation.cpp:
1248         (WebCore::WebAnimation::setTimeline): When moving to a new timeline, ensure we match the new timeline's animation state.
1249         (WebCore::WebAnimation::setSuspended): Toggle the accelerated running state of any backing hardware animations when
1250         the suspension state of an animation changes.
1251         * animation/WebAnimation.h:
1252         (WebCore::WebAnimation::isSuspended const):
1253         * dom/Document.cpp:
1254         (WebCore::Document::didBecomeCurrentDocumentInFrame):
1255         (WebCore::Document::resume):
1256         * dom/Document.h:
1257         * history/CachedFrame.cpp:
1258         (WebCore::CachedFrameBase::restore):
1259         * page/Frame.cpp:
1260         (WebCore::Frame::clearTimers):
1261         * page/Page.cpp:
1262         (WebCore::Page::setIsVisibleInternal):
1263         (WebCore::Page::hiddenPageCSSAnimationSuspensionStateChanged):
1264         * testing/Internals.cpp:
1265         (WebCore::Internals::numberOfActiveAnimations const):
1266         (WebCore::Internals::animationsAreSuspended const):
1267         (WebCore::Internals::suspendAnimations const):
1268         (WebCore::Internals::resumeAnimations const):
1269
1270 2018-04-12  Antoine Quint  <graouts@apple.com>
1271
1272         [Web Animations] Throttle animations when lowPowerMode is on
1273         https://bugs.webkit.org/show_bug.cgi?id=184540
1274
1275         Reviewed by Jon Lee.
1276
1277         Ensure animations are sampled at a lower frequency when lowPowerMode is on.
1278
1279         * animation/DocumentTimeline.cpp:
1280         (WebCore::DocumentTimeline::updateThrottlingState):
1281         (WebCore::DocumentTimeline::animationInterval const):
1282         (WebCore::DocumentTimeline::updateAnimationSchedule):
1283         (WebCore::DocumentTimeline::scheduleAnimationResolution):
1284         * animation/DocumentTimeline.h:
1285         * page/Page.cpp:
1286         (WebCore::Page::handleLowModePowerChange):
1287         * testing/Internals.cpp:
1288         (WebCore::Internals::animationsInterval const):
1289
1290 2018-04-12  Antoine Quint  <graouts@apple.com>
1291
1292         [Web Animations] Ensure elements overlapping with elements animating also get composited
1293         https://bugs.webkit.org/show_bug.cgi?id=184539
1294
1295         Reviewed by Jon Lee.
1296
1297         A number of compositing tests failed because we didn't call into the Web Animations engine while various calls
1298         on RenderLayer and RenderLayerBacking were made. We bring the functionality over from CSSAnimationController to
1299         DocumentTimeline and KeyframeAnimation to KeyframeEffectReadOnly.
1300
1301         * animation/AnimationTimeline.cpp:
1302         (WebCore::AnimationTimeline::animationsForElement const): Update this method's signature to be const since it
1303         should be callable by other const method.
1304         (WebCore::AnimationTimeline::animationsForElement): Deleted.
1305         * animation/AnimationTimeline.h:
1306         * animation/DocumentTimeline.cpp:
1307         (WebCore::DocumentTimeline::computeExtentOfAnimation const): Adapt this method from CSSAnimationController.
1308         (WebCore::DocumentTimeline::isRunningAnimationOnRenderer const): Adapt this method from CSSAnimationController.
1309         (WebCore::DocumentTimeline::isRunningAcceleratedAnimationOnRenderer const): Adapt this method from CSSAnimationController.
1310         * animation/DocumentTimeline.h:
1311         * animation/KeyframeEffectReadOnly.cpp:
1312         (WebCore::KeyframeEffectReadOnly::computeExtentOfTransformAnimation const): Bring this method over from KeyframeAnimation.
1313         (WebCore::containsRotation): Bring this method over from KeyframeAnimation.
1314         (WebCore::KeyframeEffectReadOnly::computeTransformedExtentViaTransformList const): Bring this method over from KeyframeAnimation.
1315         (WebCore::KeyframeEffectReadOnly::computeTransformedExtentViaMatrix const): Bring this method over from KeyframeAnimation.
1316         * animation/KeyframeEffectReadOnly.h:
1317         (WebCore::KeyframeEffectReadOnly::animatedProperties const): DocumentTimeline::computeExtentOfAnimation() needs to get a list
1318         of all animated properties to see if a transform is animated, so we now expose such a list.
1319         * rendering/RenderLayer.cpp:
1320         (WebCore::RenderLayer::currentTransform const): Update this method to call into DocumentTimeline if the CSS Animations
1321         and CSS Transitions as Web Animations flag is on.
1322         (WebCore::RenderLayer::calculateClipRects const): Update this method to call into DocumentTimeline if the CSS Animations
1323         and CSS Transitions as Web Animations flag is on.
1324         * rendering/RenderLayerBacking.cpp:
1325         (WebCore::RenderLayerBacking::updateGeometry): Update this method to call into DocumentTimeline if the CSS Animations
1326         and CSS Transitions as Web Animations flag is on.
1327         * rendering/RenderLayerCompositor.cpp:
1328         (WebCore::RenderLayerCompositor::isRunningTransformAnimation const): Update this method to call into DocumentTimeline
1329         if the CSS Animations and CSS Transitions as Web Animations flag is on.
1330         * rendering/RenderObject.h:
1331         (WebCore::RenderObject::documentTimeline const):
1332
1333 2018-04-11  Antoine Quint  <graouts@apple.com>
1334
1335         [Web Animations] Enable seeking for hardware animations
1336         https://bugs.webkit.org/show_bug.cgi?id=184518
1337
1338         Reviewed by Dean Jackson.
1339
1340         Hardware animations had lagged behind software animations in support and this patch bring their respective level
1341         of support closer to one another. Importantly, we add the ability to seek an animation added to a GraphicsLayerCA
1342         since many tests pause and seek animations to test their state. Animations may also have their playback state changed
1343         along with their current time in the same run loop, so we now maintain a list of pending processing actions for
1344         hardware animations.
1345
1346         * animation/DocumentTimeline.cpp:
1347         (WebCore::DocumentTimeline::updateAnimationSchedule): If we have animations queued up for updates to their accelerated
1348         state we can schedule animation resolution immediately since we've already established we'll have work to do.
1349         (WebCore::DocumentTimeline::updateAnimations): Factor the updates of pending accelerated animations out in a dedicated
1350         method.
1351         (WebCore::DocumentTimeline::applyPendingAcceleratedAnimations): Go through all pending accelerated animations and update
1352         their state.
1353         * animation/KeyframeEffectReadOnly.cpp:
1354         (WebCore::KeyframeEffectReadOnly::setBlendingKeyframes): Update the m_shouldRunAccelerated flag when setting blending keyframes.
1355         (WebCore::KeyframeEffectReadOnly::apply): Ensure we finish accelerated animations if the progress is 1 or null (no longer active).
1356         start accelerated animations if the animation is starting and always resolve styles in software as well to ensure that
1357         hit testing will work as expected.
1358         (WebCore::KeyframeEffectReadOnly::computeShouldRunAccelerated):
1359         (WebCore::KeyframeEffectReadOnly::animationPlayStateDidChange): Called by WebAnimation when play() or pause() is called
1360         with the appropriate flag.
1361         (WebCore::KeyframeEffectReadOnly::animationDidSeek): Called by WebAnimation when the currentTime property is set.
1362         (WebCore::KeyframeEffectReadOnly::addPendingAcceleratedAction): Add the provided action to the list of pending accelerated
1363         actions and notify the animation that the accelerated state needs changing.
1364         (WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions): Called by DocumentTimeline, through WebAnimation, to apply
1365         all pending accelerated actions.
1366         (WebCore::KeyframeEffectReadOnly::backingAnimationForCompositedRenderer const): If we're dealing with a declarative animation,
1367         we already have a backing Animation object, so use it directly. Otherwise, create one and ensure it reflects all timing properties
1368         for the animation.
1369         (WebCore::KeyframeEffectReadOnly::shouldRunAccelerated): Deleted.
1370         (WebCore::KeyframeEffectReadOnly::startOrStopAccelerated): Deleted.
1371         * animation/WebAnimation.cpp:
1372         (WebCore::WebAnimation::setCurrentTime): Call animationDidSeek() on the effect to ensure its accelerated animation gets seeked.
1373         (WebCore::WebAnimation::play): Call animationPlayStateDidChange() on the effect to ensure its accelerated animation is started or resumed.
1374         (WebCore::WebAnimation::pause): Call animationPlayStateDidChange() on the effect to ensure its accelerated animation gets paused.
1375         (WebCore::WebAnimation::acceleratedStateDidChange): 
1376         (WebCore::WebAnimation::applyPendingAcceleratedActions):
1377         (WebCore::WebAnimation::acceleratedRunningStateDidChange): Deleted.
1378         (WebCore::WebAnimation::startOrStopAccelerated): Deleted.
1379         * platform/graphics/GraphicsLayer.h:
1380         (WebCore::GraphicsLayer::seekAnimation):
1381         * platform/graphics/ca/GraphicsLayerCA.cpp:
1382         (WebCore::GraphicsLayerCA::addProcessingActionForAnimation): Add an AnimationProcessingAction to the list of such actions for a
1383         given animation name. In case we already have a Remove action, we ignore the action since the hardware animation will have been
1384         removed by the time we try to apply this processing action.
1385         (WebCore::GraphicsLayerCA::pauseAnimation): Add a Pause processing action.
1386         (WebCore::GraphicsLayerCA::seekAnimation): Add a Seek processing action.
1387         (WebCore::GraphicsLayerCA::removeAnimation): Add a Remove processing action.
1388         (WebCore::GraphicsLayerCA::updateAnimations): First ensure that all animations pending commit are committed and then update
1389         all animations based on the actions added through addProcessingActionForAnimation().
1390         (WebCore::GraphicsLayerCA::seekCAAnimationOnLayer): Generate a new animation based on the new seek time provided.
1391         * platform/graphics/ca/GraphicsLayerCA.h:
1392         (WebCore::GraphicsLayerCA::AnimationProcessingAction::AnimationProcessingAction):
1393         * rendering/RenderBoxModelObject.cpp:
1394         (WebCore::RenderBoxModelObject::animationSeeked):
1395         * rendering/RenderLayerBacking.cpp:
1396         (WebCore::RenderLayerBacking::animationSeeked):
1397         * rendering/RenderLayerCompositor.cpp:
1398         (WebCore::RenderLayerCompositor::requiresCompositingForAnimation const): Fix an issue where we would run the CSSAnimationController
1399         logic even when the legacy animation engine was disabled.
1400
1401 2018-04-12  Xabier Rodriguez Calvar  <calvaris@igalia.com>
1402
1403         Unreviewed, fix GStreamer builds
1404
1405         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1406         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): We were
1407         passing a String to a GST_WARNING call.
1408
1409 2018-04-11  Chris Dumez  <cdumez@apple.com>
1410
1411         input.webkitEntries does not work as expected when folder contains accented chars
1412         https://bugs.webkit.org/show_bug.cgi?id=184517
1413         <rdar://problem/39265537>
1414
1415         Reviewed by Ryosuke Niwa.
1416
1417         Use String::fromUTF8() to construct a WTF String from the char* returned by
1418         dirname() in FileSystem::directoryName(). Previously, we were just calling
1419         the String constructor, which would treat the input as latin 1 instead of
1420         UTF-8.
1421
1422         Test: fast/forms/file/entries-api/webkitEntries-nonascii-folder-name.html
1423
1424         * platform/posix/FileSystemPOSIX.cpp:
1425         (WebCore::FileSystem::directoryName):
1426
1427 2018-04-11  Youenn Fablet  <youenn@apple.com>
1428
1429         Preventively expect UTF8 strings from libwebrtc SDP and error messages
1430         https://bugs.webkit.org/show_bug.cgi?id=184509
1431
1432         Reviewed by Eric Carlson.
1433
1434         Make WebCore code expect any libwebrtc string to contain UTF-8.
1435         Currently SDPs do not contain any UTF-8 specific character
1436         but https://tools.ietf.org/html/rfc4566 allows it.
1437
1438         Add Internals API to set track id so that we can inject UTF-8 inside some WebRTC tests.
1439         Test: webrtc/utf8-sdp.html
1440
1441         * Modules/mediastream/MediaStreamTrack.h:
1442         (WebCore::MediaStreamTrack::setIdForTesting):
1443         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
1444         (WebCore::fromStdString):
1445         (WebCore::fromSessionDescription):
1446         (WebCore::LibWebRTCMediaEndpoint::doSetLocalDescription):
1447         (WebCore::LibWebRTCMediaEndpoint::doSetRemoteDescription):
1448         (WebCore::LibWebRTCMediaEndpoint::mediaStreamFromRTCStream):
1449         (WebCore::LibWebRTCMediaEndpoint::addRemoteTrack):
1450         (WebCore::LibWebRTCMediaEndpoint::addDataChannel):
1451         (WebCore::LibWebRTCMediaEndpoint::OnIceCandidate):
1452         (WebCore::LibWebRTCMediaEndpoint::createSessionDescriptionSucceeded):
1453         (WebCore::LibWebRTCMediaEndpoint::createSessionDescriptionFailed):
1454         (WebCore::LibWebRTCMediaEndpoint::setLocalSessionDescriptionFailed):
1455         (WebCore::LibWebRTCMediaEndpoint::setRemoteSessionDescriptionFailed):
1456         (WebCore::trackId): Deleted.
1457         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
1458         (WebCore::fromStdString):
1459         (WebCore::LibWebRTCPeerConnectionBackend::doAddIceCandidate):
1460         (WebCore::createReceiverForSource):
1461         * platform/mediastream/MediaStreamTrackPrivate.h:
1462         (WebCore::MediaStreamTrackPrivate::setIdForTesting):
1463         * testing/Internals.cpp:
1464         (WebCore::Internals::setMediaStreamTrackIdentifier):
1465         * testing/Internals.h:
1466         * testing/Internals.idl:
1467
1468 2018-04-11  Said Abou-Hallawa  <sabouhallawa@apple.com>
1469
1470         Cache glyphs (using display lists) when painting at high frequency
1471         https://bugs.webkit.org/show_bug.cgi?id=178750
1472         <rdar://problem/35201729>
1473
1474         Reviewed by Antti Koivisto.
1475
1476         This patch adds support for caching of glyph drawing commands when painting
1477         at high frequency. Caching the glyph drawing will be done using DisplayLists.
1478
1479         GlyphDisplayListCache is basically a hash map which maps InlineTextBox
1480         or SimpleLineLayout::Run to DisplayList. Before adding a new entry to it
1481         we have to check whether the conditions for caching the glyph DisplayList
1482         are met or not. If no entry is found for a given run, a new DisplayList
1483         is created and a new entry is add to the cache.
1484
1485         * WebCore.xcodeproj/project.pbxproj:
1486         * page/MemoryRelease.cpp:
1487         (WebCore::releaseNoncriticalMemory): Make GlyphDisplayListCache respond
1488         to memory pressure.
1489
1490         * platform/graphics/FontCascade.cpp:
1491         (WebCore::FontCascade::displayListForTextRun const):
1492         * platform/graphics/FontCascade.h:
1493         (WebCore::FontCascade::displayListForTextRun):
1494         Record the drawing of a glyph run into a DisplayList.
1495
1496         * rendering/GlyphDisplayListCache.h: Added.
1497         (WebCore::GlyphDisplayListCache::singleton):
1498         (WebCore::GlyphDisplayListCache::get):
1499         (WebCore::GlyphDisplayListCache::remove):
1500         (WebCore::GlyphDisplayListCache::clear):
1501         (WebCore::GlyphDisplayListCache::size const):
1502         (WebCore::GlyphDisplayListCache::sizeInBytes const):
1503         A simple cache for the TextRun DisplayList. Adding a new entry in the
1504         cache happens under restricted conditions. So this cache is not expected
1505         to grow much.
1506
1507         * rendering/InlineTextBox.cpp:
1508         (WebCore::InlineTextBox::~InlineTextBox):
1509         (WebCore::InlineTextBox::paint):
1510         (WebCore::InlineTextBox::paintMarkedTexts):
1511         (WebCore::InlineTextBox::paintMarkedTextBackground):
1512         (WebCore::InlineTextBox::paintMarkedTextForeground):
1513         (WebCore::InlineTextBox::paintMarkedTextDecoration):
1514         (WebCore::InlineTextBox::paintCompositionBackground):
1515         (WebCore::InlineTextBox::paintCompositionUnderlines const):
1516         (WebCore::InlineTextBox::paintCompositionUnderline const):
1517         * rendering/InlineTextBox.h:
1518         (WebCore::InlineTextBox::paintMarkedTexts):
1519         InlineTextBox::paintMarkedTextForeground() now requires PaintInfo to know
1520         whether the entry in the GlyphDisplayListCache should be removed or not.
1521         Change all the GraphicsContext arguments to be PaintInfo.
1522
1523         * rendering/SimpleLineLayout.cpp:
1524         (WebCore::SimpleLineLayout::Layout::~Layout):
1525         * rendering/SimpleLineLayout.h:
1526         * rendering/SimpleLineLayoutFunctions.cpp:
1527         (WebCore::SimpleLineLayout::paintFlow):
1528         (WebCore::SimpleLineLayout::simpleLineLayoutWillBeDeleted):
1529         * rendering/SimpleLineLayoutFunctions.h:
1530         * rendering/SimpleLineLayoutResolver.h:
1531         (WebCore::SimpleLineLayout::RunResolver::Run::simpleRun const):
1532         Implement the glyph caching for SimpleLineLayout::Run.
1533
1534         * rendering/TextPainter.cpp:
1535         (WebCore::TextPainter::paintTextOrEmphasisMarks): If the DisplayList is
1536         available, replay it back into the GraphicsContext. Make sure to reset to
1537         the DisplayList pointer to nullptr after painting.
1538
1539         (WebCore::TextPainter::clearGlyphDisplayLists):
1540         (WebCore::TextPainter::shouldUseGlyphDisplayList): Check whether we should
1541         use DisplayList to the draw glyph run.
1542
1543         * rendering/TextPainter.h:
1544         (WebCore::TextPainter::setGlyphDisplayListIfNeeded): Check whether we should
1545         should use DisplayList to the draw glyph run and if we should, ensure first
1546         the DisplayList is cached and set it in the TextPainter so it uses it when
1547         the run is painted.
1548
1549         (WebCore::TextPainter::removeGlyphDisplayList): Remove the cached DisplayList
1550         entry for a glyph layout run.
1551
1552 2018-04-11  Brent Fulgham  <bfulgham@apple.com>
1553
1554         GraphicsLayerCA::createPlatformCALayer always disables extended color in its backing store
1555         https://bugs.webkit.org/show_bug.cgi?id=184367
1556         <rdar://problem/39249074>
1557
1558         Reviewed by Simon Fraser.
1559
1560         'createPlatformCALayer' always passes a nil widget, which early returns from 'screenSupportsExtendedColor'
1561         with false. Instead, we should just pass the widget (nil or not) to the screen properties methods,
1562         which will use the primary screen if no screen is specified. I.e., we shouldn't do an early return
1563         here if the passed widget is nil.
1564
1565         * platform/mac/PlatformScreenMac.mm:
1566         (WebCore::screenSupportsExtendedColor):
1567
1568 2018-04-11  Youenn Fablet  <youenn@apple.com>
1569
1570         Pass FetchOptions and SecurityOrigin as load parameters from WebProcess to NetworkProcess
1571         https://bugs.webkit.org/show_bug.cgi?id=184374
1572
1573         Reviewed by Chris Dumez.
1574
1575         Add support for SecurityOrigin encode/decode routines.
1576
1577         * page/SecurityOrigin.h:
1578
1579 2018-04-11  Thibault Saunier  <tsaunier@igalia.com>
1580
1581         [GStreamer] Use of playbin3 when USE_PLAYBIN3 environment variable is set
1582         https://bugs.webkit.org/show_bug.cgi?id=184498
1583
1584         Reviewed by Philippe Normand.
1585
1586         [GStreamer] Use of playbin3 when USE_PLAYBIN3 environment variable is set
1587
1588         This is the same behaviour as with playbin itself.
1589
1590         Make sure to keep using "playbin" for MediaSource.
1591
1592         No test added as this is basically a small rework of the way we expose a feature.
1593
1594         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp:
1595         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h:
1596         * platform/graphics/gstreamer/GRefPtrGStreamer.cpp:
1597         * platform/graphics/gstreamer/GRefPtrGStreamer.h:
1598         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp:
1599         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.h:
1600         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1601         (WebCore::MediaPlayerPrivateGStreamer::load):
1602         (WebCore::MediaPlayerPrivateGStreamer::enableTrack):
1603         (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
1604         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
1605         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
1606         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
1607         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
1608         (WebCore::TrackPrivateBaseGStreamer::disconnect):
1609         (WebCore::TrackPrivateBaseGStreamer::tagsChanged):
1610         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h:
1611         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp:
1612         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h:
1613
1614 2018-04-10  Alex Christensen  <achristensen@webkit.org>
1615
1616         IDN spoofing with Hebrew combining characters
1617         https://bugs.webkit.org/show_bug.cgi?id=184472
1618         <rdar://problem/39148687>
1619
1620         Reviewed by Brent Fulgham.
1621
1622         Covered by new API tests.
1623
1624         * platform/mac/WebCoreNSURLExtras.mm:
1625         (WebCore::isLookalikeCharacter):
1626         Punycode-encode hosts with Hebrew combining marks that look like dots
1627         and Vav with a combining dot above like we do with dotless i and j.
1628
1629 2018-04-11  Brent Fulgham  <bfulgham@apple.com>
1630
1631         Show punycode if URL contains Latin dum character
1632         https://bugs.webkit.org/show_bug.cgi?id=184477
1633         <rdar://problem/39121999>
1634
1635         Reviewed by David Kilzer.
1636
1637         Revise our "lookalike character" logic to include the small
1638         Latin dum character.
1639
1640         Test: fast/url/host.html
1641
1642         * platform/mac/WebCoreNSURLExtras.mm:
1643         (WebCore::isLookalikeCharacter):
1644
1645 2018-04-11  Michael Catanzaro  <mcatanzaro@igalia.com>
1646
1647         [GTK] WaylandCompositorDisplay leaks its wl_display
1648         https://bugs.webkit.org/show_bug.cgi?id=184406
1649
1650         Reviewed by Carlos Garcia Campos.
1651
1652         Well, this was harder than expected. We really just want to fix a small leak in the WebKit
1653         layer, but that requires a change in how WaylandCompositorDisplay calls the
1654         PlatformDisplayWayland constructor, to pass NativeDisplayOwned::Yes. That means
1655         WaylandCompositorDisplay can no longer use PlatformDisplayWayland's protected default
1656         constructor. Problem is that the normal PlatformDisplayWayland constructor calls
1657         PlatformDisplayWayland::initialize, which calls PlatformDisplayWayland::registryGlobal,
1658         which is a virtual function. The WaylandCompositorDisplay portion of the object is not
1659         constructed yet at this point, so WaylandCompositorDisplay::registryGlobal will never be
1660         called if we do that. I had to revert the previous version of this fix due to this problem.
1661         It had broken accelerated compositing.
1662
1663         I'm reminded of Effective C++ item #9: Never call virtual functions during construction or
1664         destruction ("because such calls will never go to a more derived class than that of the
1665         currently executing constructor or destructor"). This code is fragile and likely to break
1666         again in the future, so let's refactor it a bit. Instead of calling initialize in the
1667         constructor, we'll call it from create functions. We'll have to add a couple create
1668         functions, and make the constructor protected to ensure it's not possible to create a
1669         PlatformDisplayWayland without initializing it. For good parallelism, do the same for the
1670         other PlatformDisplay classes.
1671
1672         This commit additionally removes PlatformDisplayWayland's protected default constructor,
1673         since it's not needed anymore.
1674
1675         The NativeDisplayOwned arguments to the PlatformDisplay constructors are now mandatory,
1676         instead of using NativeDisplayOwned::No as the default value, since that was dangerously
1677         close to being the cause of this leak, and the constructors are now accessed from private
1678         create functions anyway. Some more caution when using default parameter values is warranted
1679         in the future.
1680
1681         Lastly, since we have to change PlatformDisplay::createPlatformDisplay to use the new create
1682         functions, take the opportunity to move things around a bit for clarity. There should be no
1683         change in behavior. I was just disappointed that the PlatformDisplayWPE creation was at the
1684         bottom of the function, after a comment indicating that normal display creation has failed,
1685         which is not the case for WPE.
1686
1687         This all might have been a bit overkill, since the leak could probably have been fixed by
1688         passing nullptr to the PlatformDisplayWayland constructor for the wl_display and not
1689         removing WaylandCompositorDisplay's call to PlatformDisplayWayland::initialize. But the
1690         correctness of that code would then rely on implementation details of initialize, so this
1691         refactor seems better.
1692
1693         No new tests since there *should* be no behavior change. Then again, I'm touching
1694         PlatformDisplay, and history shows we don't have the greatest track record of touching this
1695         code without introducing problems.
1696
1697         * platform/graphics/PlatformDisplay.cpp:
1698         (WebCore::PlatformDisplay::createPlatformDisplay):
1699         * platform/graphics/PlatformDisplay.h:
1700         * platform/graphics/wayland/PlatformDisplayWayland.cpp:
1701         (WebCore::PlatformDisplayWayland::create):
1702         (WebCore::PlatformDisplayWayland::create):
1703         (WebCore::PlatformDisplayWayland::createHeadless):
1704         (WebCore::PlatformDisplayWayland::PlatformDisplayWayland):
1705         (WebCore::PlatformDisplayWayland::initialize):
1706         * platform/graphics/wayland/PlatformDisplayWayland.h:
1707         * platform/graphics/win/PlatformDisplayWin.h:
1708         * platform/graphics/wpe/PlatformDisplayWPE.cpp:
1709         (WebCore::create):
1710         * platform/graphics/wpe/PlatformDisplayWPE.h:
1711         * platform/graphics/x11/PlatformDisplayX11.cpp:
1712         (WebCore::PlatformDisplayX11::create):
1713         (WebCore::PlatformDisplayX11::create):
1714         (WebCore::PlatformDisplayX11::createHeadless):
1715         * platform/graphics/x11/PlatformDisplayX11.h:
1716
1717 2018-04-11  Jianjun Zhu  <jianjun.zhu@intel.com>
1718
1719         Fix a WebRTC data channel issue for non-ASCII characters.
1720
1721         At the sender side, buffer size are calulcated after UTF8 encoding. At the
1722         receiver side, strings are constructed with UTF8 data.
1723
1724         https://bugs.webkit.org/show_bug.cgi?id=184481
1725
1726         Reviewed by Youenn Fablet.
1727
1728         Updated test:
1729         LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCDataChannel-send-expected.txt
1730
1731         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp:
1732         (WebCore::LibWebRTCDataChannelHandler::sendStringData):
1733         (WebCore::LibWebRTCDataChannelHandler::OnMessage):
1734
1735 2018-04-11  Antti Koivisto  <antti@apple.com>
1736
1737         ImageFrame type used by non-Cocoa image decoder should not be the same as that used by ImageSource
1738         https://bugs.webkit.org/show_bug.cgi?id=184418
1739
1740         Reviewed by Said Abou-Hallawa.
1741
1742         ScalableImageDecoder uses ImageFrame class which is meant to be an implementation detail of ImageSource.
1743         There are bunch of fields and methods in the type that are only used by one or the other client. For hackability
1744         there should be an unrelated frame type for ScalableImageDecoder.
1745
1746         This patch adds ScalableImageDecoderFrame type used in ScalableImageDecoder only. It then cleans up
1747         unneeded things from both ImageFrame and ScalableImageDecoderFrame.
1748
1749         * platform/ImageDecoders.cmake:
1750         * platform/graphics/ImageFrame.cpp:
1751         (WebCore::ImageFrame::operator=):
1752         (WebCore::ImageFrame::clearImage):
1753         (WebCore::ImageFrame::size const):
1754         (WebCore::ImageFrame::initialize): Deleted.
1755         * platform/graphics/ImageFrame.h:
1756         (WebCore::ImageFrame::setDisposalMethod): Deleted.
1757         (WebCore::ImageFrame::disposalMethod const): Deleted.
1758         (WebCore::ImageFrame::backingStore const): Deleted.
1759         (WebCore::ImageFrame::hasBackingStore const): Deleted.
1760         * platform/image-decoders/ScalableImageDecoder.cpp:
1761         (WebCore::ScalableImageDecoder::frameIsCompleteAtIndex const):
1762         (WebCore::ScalableImageDecoder::frameDurationAtIndex const):
1763         (WebCore::ScalableImageDecoder::createFrameImageAtIndex):
1764         * platform/image-decoders/ScalableImageDecoder.h:
1765         * platform/image-decoders/ScalableImageDecoderFrame.cpp: Copied from Source/WebCore/platform/graphics/ImageFrame.cpp.
1766         (WebCore::ScalableImageDecoderFrame::ScalableImageDecoderFrame):
1767         (WebCore::ScalableImageDecoderFrame::~ScalableImageDecoderFrame):
1768         (WebCore::ScalableImageDecoderFrame::operator=):
1769         (WebCore::ScalableImageDecoderFrame::setDecodingStatus):
1770         (WebCore::ScalableImageDecoderFrame::decodingStatus const):
1771         (WebCore::ScalableImageDecoderFrame::clearImage):
1772         (WebCore::ScalableImageDecoderFrame::clear):
1773         (WebCore::ScalableImageDecoderFrame::initialize):
1774         (WebCore::ScalableImageDecoderFrame::size const):
1775         (WebCore::ImageFrame::ImageFrame): Deleted.
1776         (WebCore::ImageFrame::~ImageFrame): Deleted.
1777         (WebCore::ImageFrame::defaultFrame): Deleted.
1778         (WebCore::ImageFrame::operator=): Deleted.
1779         (WebCore::ImageFrame::setDecodingStatus): Deleted.
1780         (WebCore::ImageFrame::decodingStatus const): Deleted.
1781         (WebCore::ImageFrame::clearImage): Deleted.
1782         (WebCore::ImageFrame::clear): Deleted.
1783         (WebCore::ImageFrame::initialize): Deleted.
1784         (WebCore::ImageFrame::size const): Deleted.
1785         (WebCore::ImageFrame::hasNativeImage const): Deleted.
1786         (WebCore::ImageFrame::hasFullSizeNativeImage const): Deleted.
1787         (WebCore::ImageFrame::hasDecodedNativeImageCompatibleWithOptions const): Deleted.
1788         (WebCore::ImageFrame::singlePixelSolidColor const): Deleted.
1789         * platform/image-decoders/ScalableImageDecoderFrame.h: Copied from Source/WebCore/platform/graphics/ImageFrame.h.
1790         (WebCore::ScalableImageDecoderFrame::ScalableImageDecoderFrame):
1791         (WebCore::ScalableImageDecoderFrame::disposalMethod const):
1792         (WebCore::ScalableImageDecoderFrame::hasAlpha const):
1793         (WebCore::ScalableImageDecoderFrame::hasBackingStore const):
1794         (WebCore::ImageFrame::ImageFrame): Deleted.
1795         (WebCore::ImageFrame::isInvalid const): Deleted.
1796         (WebCore::ImageFrame::isPartial const): Deleted.
1797         (WebCore::ImageFrame::isComplete const): Deleted.
1798         (WebCore::ImageFrame::sizeRespectingOrientation const): Deleted.
1799         (WebCore::ImageFrame::frameBytes const): Deleted.
1800         (WebCore::ImageFrame::subsamplingLevel const): Deleted.
1801         (WebCore::ImageFrame::setDisposalMethod): Deleted.
1802         (WebCore::ImageFrame::disposalMethod const): Deleted.
1803         (WebCore::ImageFrame::nativeImage const): Deleted.
1804         (WebCore::ImageFrame::setOrientation): Deleted.
1805         (WebCore::ImageFrame::orientation const): Deleted.
1806         (WebCore::ImageFrame::setDuration): Deleted.
1807         (WebCore::ImageFrame::duration const): Deleted.
1808         (WebCore::ImageFrame::setHasAlpha): Deleted.
1809         (WebCore::ImageFrame::hasAlpha const): Deleted.
1810         (WebCore::ImageFrame::hasNativeImage): Deleted.
1811         (WebCore::ImageFrame::hasFullSizeNativeImage): Deleted.
1812         (WebCore::ImageFrame::hasMetadata const): Deleted.
1813         (WebCore::ImageFrame::backingStore const): Deleted.
1814         (WebCore::ImageFrame::hasBackingStore const): Deleted.
1815         * platform/image-decoders/bmp/BMPImageDecoder.cpp:
1816         (WebCore::BMPImageDecoder::frameBufferAtIndex):
1817         * platform/image-decoders/bmp/BMPImageDecoder.h:
1818         * platform/image-decoders/bmp/BMPImageReader.h:
1819         (WebCore::BMPImageReader::setBuffer):
1820         * platform/image-decoders/gif/GIFImageDecoder.cpp:
1821         (WebCore::GIFImageDecoder::findFirstRequiredFrameToDecode):
1822         (WebCore::GIFImageDecoder::frameBufferAtIndex):
1823         (WebCore::GIFImageDecoder::clearFrameBufferCache):
1824         (WebCore::GIFImageDecoder::haveDecodedRow):
1825         (WebCore::GIFImageDecoder::frameComplete):
1826         (WebCore::GIFImageDecoder::initFrameBuffer):
1827         * platform/image-decoders/gif/GIFImageDecoder.h:
1828         * platform/image-decoders/gif/GIFImageReader.cpp:
1829         (GIFImageReader::parse):
1830         * platform/image-decoders/gif/GIFImageReader.h:
1831         (GIFFrameContext::GIFFrameContext):
1832         * platform/image-decoders/ico/ICOImageDecoder.cpp:
1833         (WebCore::ICOImageDecoder::frameBufferAtIndex):
1834         * platform/image-decoders/ico/ICOImageDecoder.h:
1835         * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
1836         (WebCore::JPEGImageDecoder::frameBufferAtIndex):
1837         (WebCore::setPixel):
1838         (WebCore::JPEGImageDecoder::outputScanlines):
1839         (WebCore::JPEGImageDecoder::jpegComplete):
1840         * platform/image-decoders/jpeg/JPEGImageDecoder.h:
1841         * platform/image-decoders/png/PNGImageDecoder.cpp:
1842         (WebCore::PNGImageDecoder::frameBufferAtIndex):
1843         (WebCore::PNGImageDecoder::rowAvailable):
1844         (WebCore::PNGImageDecoder::readChunks):
1845         (WebCore::PNGImageDecoder::clearFrameBufferCache):
1846         (WebCore::PNGImageDecoder::initFrameBuffer):
1847         (WebCore::PNGImageDecoder::frameComplete):
1848         * platform/image-decoders/png/PNGImageDecoder.h:
1849         * platform/image-decoders/webp/WEBPImageDecoder.cpp:
1850         (WebCore::WEBPImageDecoder::frameBufferAtIndex):
1851         (WebCore::WEBPImageDecoder::findFirstRequiredFrameToDecode):
1852         (WebCore::WEBPImageDecoder::decodeFrame):
1853         (WebCore::WEBPImageDecoder::initFrameBuffer):
1854         (WebCore::WEBPImageDecoder::applyPostProcessing):
1855         (WebCore::WEBPImageDecoder::clearFrameBufferCache):
1856         * platform/image-decoders/webp/WEBPImageDecoder.h:
1857
1858 2018-04-11  Antoine Quint  <graouts@apple.com>
1859
1860         [Web Animations] Turn Web Animations on by default
1861         https://bugs.webkit.org/show_bug.cgi?id=184491
1862
1863         Reviewed by Simon Fraser.
1864
1865         * page/RuntimeEnabledFeatures.h:
1866
1867 2018-04-11  Ryosuke Niwa  <rniwa@webkit.org>
1868
1869         Fix warning in HashTools.h for newer versions of clang
1870         https://bugs.webkit.org/show_bug.cgi?id=184489
1871
1872         Reviewed by Alexey Proskuryakov.
1873
1874         Removed "register" storage class specififer as it has been deprecated in C++11.
1875
1876         * platform/HashTools.h:
1877
1878 2018-04-10  Wenson Hsieh  <wenson_hsieh@apple.com>
1879
1880         FrameSelection::appearanceUpdateTimerFired should be robust against layout passes underneath it
1881         https://bugs.webkit.org/show_bug.cgi?id=183395
1882         <rdar://problem/38055732>
1883
1884         Reviewed by Zalan Bujtas.
1885
1886         In the case where a FrameSelection updates its appearance when m_appearanceUpdateTimer is fired, the
1887         FrameSelection's Frame is unprotected, and can be removed by arbitrary script. This patch applies a simple
1888         mitigation by wrapping the Frame in a Ref when firing the appearance update timer.
1889
1890         Test: editing/selection/iframe-update-selection-appearance.html
1891
1892         * editing/FrameSelection.cpp:
1893         (WebCore::FrameSelection::appearanceUpdateTimerFired):
1894
1895 2018-04-10  Brent Fulgham  <bfulgham@apple.com>
1896
1897         Unreviewed follow-up to r230468.
1898
1899         Switch some RELEASE_ASSERTs in hot codepaths to normal DEBUG asserts.
1900
1901         * page/mac/EventHandlerMac.mm:
1902         (WebCore::lastEventIsMouseUp):
1903         (WebCore::EventHandler::sendFakeEventsAfterWidgetTracking):
1904         * platform/mac/EventLoopMac.mm:
1905         (WebCore::EventLoop::cycle):
1906
1907 2018-04-10  Wenson Hsieh  <wenson_hsieh@apple.com>
1908
1909         Unreviewed, fix the iOS build
1910
1911         I accidentally exported an inline function in r230506.
1912
1913         * page/ViewportConfiguration.h:
1914         (WebCore::ViewportConfiguration::viewSize const):
1915
1916 2018-04-10  Nan Wang  <n_wang@apple.com>
1917
1918         AX: Expose strong password fields on iOS
1919         https://bugs.webkit.org/show_bug.cgi?id=184465
1920         <rdar://problem/39325104>
1921
1922         Reviewed by Chris Fleizach.
1923
1924         Exposed the strong password field on iOS. And made sure
1925         we are returning its actual value in accessibilityValue.
1926
1927         Test: accessibility/ios-simulator/strong-password-field.html
1928
1929         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1930         (-[WebAccessibilityObjectWrapper _accessibilityIsStrongPasswordField]):
1931         (-[WebAccessibilityObjectWrapper accessibilityValue]):
1932
1933 2018-04-10  Fujii Hironori  <Hironori.Fujii@sony.com>
1934
1935         [Win] Add UserAgentWin.cpp
1936         https://bugs.webkit.org/show_bug.cgi?id=184438
1937
1938         Reviewed by Michael Catanzaro.
1939
1940         No new tests (No behavior change).
1941
1942         * PlatformWin.cmake:
1943         * platform/win/UserAgentWin.cpp: Added.
1944         (WebCore::standardUserAgent):
1945         (WebCore::standardUserAgentForURL):
1946
1947 2018-04-10  Wenson Hsieh  <wenson_hsieh@apple.com>
1948
1949         [Extra zoom mode] Add a mechanism to zoom to fixed scales when double tapping in extra zoom mode
1950         https://bugs.webkit.org/show_bug.cgi?id=184435
1951         <rdar://problem/38726260>
1952
1953         Reviewed by Dean Jackson.
1954
1955         Expose the size of the platform view. By default, in extra zoom mode, this *not* the same as the minimum layout
1956         size, since we lay out at a large width and then shrink down to real device dimensions when computing the
1957         initial scale (see r229063).
1958
1959         ViewGestureGeometryCollector uses this in the process of computing a target zoom scale when double tapping.
1960
1961         * page/ViewportConfiguration.h:
1962         (WebCore::ViewportConfiguration::viewSize const):
1963
1964 2018-04-10  Fujii Hironori  <Hironori.Fujii@sony.com>
1965
1966         [Win][WebKit] LibWebRTCProvider::webRTCAvailable is an undefined symbol
1967         https://bugs.webkit.org/show_bug.cgi?id=184437
1968
1969         Reviewed by Michael Catanzaro.
1970
1971         No new tests (No behavior change).
1972
1973         * PlatformWin.cmake: Added LibWebRTCProviderWin.cpp.
1974         * platform/mediastream/libwebrtc/LibWebRTCProviderWin.cpp: Added.
1975         (WebCore::LibWebRTCProvider::webRTCAvailable):
1976
1977 2018-04-10  Chris Dumez  <cdumez@apple.com>
1978
1979         Unreviewed build fix.
1980
1981         Those enum value names were too generic and would cause conflicts.
1982
1983         * Modules/webvr/VRDisplayCapabilities.h:
1984         (WebCore::VRDisplayCapabilities::hasPosition const):
1985         (WebCore::VRDisplayCapabilities::hasOrientation const):
1986         (WebCore::VRDisplayCapabilities::hasExternalDisplay const):
1987         (WebCore::VRDisplayCapabilities::canPresent const):
1988         * platform/vr/VRPlatformDisplay.h:
1989         * platform/vr/openvr/VRPlatformDisplayOpenVR.cpp:
1990         (WebCore::VRPlatformDisplayOpenVR::VRPlatformDisplayOpenVR):
1991
1992 2018-04-10  Chris Dumez  <cdumez@apple.com>
1993
1994         Avoid constructing a service worker RegistrationStore for private sessions
1995         https://bugs.webkit.org/show_bug.cgi?id=184463
1996         <rdar://problem/36613948>
1997
1998         Reviewed by Youenn Fablet.
1999
2000         Avoid constructing a service worker RegistrationStore for private sessions since there
2001         is no need for persistence and the registrationDatabaseDirectory is the empty string in
2002         such cases.
2003
2004         * workers/service/server/SWServer.cpp:
2005         (WebCore::SWServer::removeRegistration):
2006         (WebCore::SWServer::clearAll):
2007         (WebCore::SWServer::clear):
2008         (WebCore::SWServer::SWServer):
2009         (WebCore::SWServer::didFinishActivation):
2010         * workers/service/server/SWServer.h:
2011
2012 2018-04-10  Chris Dumez  <cdumez@apple.com>
2013
2014         Unreviewed build fix.
2015
2016         * page/LayoutContext.cpp:
2017         (WebCore::LayoutContext::~LayoutContext):
2018         * page/LayoutContext.h:
2019
2020 2018-04-10  Jeremy Jones  <jeremyj@apple.com>
2021
2022         MediaSessionManageriOS should defer creation of MPVolumeView until it needs to monitor AirPlay routes
2023         https://bugs.webkit.org/show_bug.cgi?id=184373
2024         <rdar://problem/35177606>
2025
2026         Reviewed by Eric Carlson.
2027
2028         No change of behavior.
2029
2030         This delays the creation of MPVolumeView until airplay routes are monitored.
2031         MPVolumeView is now also released when monitoring ends. 
2032         This makes sure the MP* objects are only accessed from a UI safe thread. WebCore's "MainThread" may be different that the UI thread.
2033         Since this state change is necessarily asynchronous, starting and stopping must prevent races to keep state coherent.
2034
2035         * platform/audio/ios/MediaSessionManagerIOS.mm:
2036         (-[WebMediaSessionHelper initWithCallback:]):
2037         (-[WebMediaSessionHelper dealloc]):
2038         (-[WebMediaSessionHelper startMonitoringAirPlayRoutes]):
2039         (-[WebMediaSessionHelper stopMonitoringAirPlayRoutes]):
2040         (-[WebMediaSessionHelper allocateVolumeView]): Deleted.
2041         (-[WebMediaSessionHelper setVolumeView:]): Deleted.
2042
2043 2018-04-10  Sihui Liu  <sihui_liu@apple.com>
2044
2045         Loading of multipart response was cancelled because of content policy set in WebFrameLoaderClient::dispatchDecidePolicyForResponse
2046         https://bugs.webkit.org/show_bug.cgi?id=184268
2047         <rdar://problem/39144446>
2048
2049         Reviewed by Chris Dumez.
2050
2051         The assertion is no longer true after the change, because multiple resources could have same
2052         url. Used if condition here to make sure we only delete specified resource.
2053
2054         No new tests. Updated an existing test to test the stop loading case by not using injected 
2055         bundle policy: http/tests/multipart/multipart-html.php.
2056
2057         * loader/cache/CachedResourceLoader.cpp:
2058         (WebCore::CachedResourceLoader::removeCachedResource):
2059
2060 2018-04-10  Zalan Bujtas  <zalan@apple.com>
2061
2062         Do not layout images when we only need the overflow information.
2063         https://bugs.webkit.org/show_bug.cgi?id=175331
2064
2065         Reviewed by Simon Fraser.
2066
2067         This improves MotionMark's Simple Leaves by ~10%. 
2068
2069         Covered by existing tests.
2070
2071         * rendering/RenderImage.cpp:
2072         (WebCore::RenderImage::layout):
2073
2074 2018-04-10  Zan Dobersek  <zdobersek@igalia.com>
2075
2076         [TexMap] TextureMapperLayer unnecessarily duplicates state in GraphicsLayerTransform
2077         https://bugs.webkit.org/show_bug.cgi?id=183868
2078
2079         Reviewed by Carlos Garcia Campos.
2080
2081         Drop the GraphicsLayerTransform member variable from TextureMapperLayer
2082         and instead compute all the required transform information in the
2083         computeTransformsRecursive() method. These computations are not too
2084         expensive, and in turn we can drop an object from this class' state that
2085         was only duplicating a bunch of state variables.
2086
2087         No new tests -- no change in functionality.
2088
2089         * platform/graphics/texmap/TextureMapperLayer.cpp:
2090         (WebCore::TextureMapperLayer::computeTransformsRecursive):
2091         (WebCore::TextureMapperLayer::paintSelf):
2092         (WebCore::TextureMapperLayer::paintSelfAndChildren):
2093         (WebCore::TextureMapperLayer::paintSelfAndChildrenWithReplica):
2094         (WebCore::TextureMapperLayer::replicaTransform):
2095         (WebCore::TextureMapperLayer::computeOverlapRegions):
2096         (WebCore::TextureMapperLayer::setPosition):
2097         (WebCore::TextureMapperLayer::setSize):
2098         (WebCore::TextureMapperLayer::setAnchorPoint):
2099         (WebCore::TextureMapperLayer::setPreserves3D):
2100         (WebCore::TextureMapperLayer::setTransform):
2101         (WebCore::TextureMapperLayer::setChildrenTransform):
2102         (WebCore::TextureMapperLayer::syncAnimations):
2103         (WebCore::TextureMapperLayer::setScrollPositionDeltaIfNeeded):
2104         * platform/graphics/texmap/TextureMapperLayer.h:
2105
2106 2018-04-09  Brent Fulgham  <bfulgham@apple.com>
2107
2108         Add ProcessPrivilege assertions to places that access NSApp
2109         https://bugs.webkit.org/show_bug.cgi?id=184322
2110         <rdar://problem/39194560>
2111
2112         Reviewed by Per Arne Vollan.
2113
2114         Add ProcessPrivilege assertions to places where we interact with NSApp so
2115         that we can prevent accidentally using them in the WebContent process.
2116
2117         * page/mac/EventHandlerMac.mm:
2118         (WebCore::lastEventIsMouseUp):
2119         (WebCore::EventHandler::sendFakeEventsAfterWidgetTracking):
2120         * platform/mac/EventLoopMac.mm:
2121         (WebCore::EventLoop::cycle):
2122         * platform/mac/PasteboardMac.mm:
2123         (WebCore::Pasteboard::setDragImage):
2124
2125 2018-04-09  John Wilander  <wilander@apple.com>
2126
2127         Refactor Ignore HSTS code
2128         https://bugs.webkit.org/show_bug.cgi?id=184433
2129         <rdar://problem/39298238>
2130
2131         Reviewed by Darin Adler.
2132
2133         This patch refactors our ignore HSTS code. The convenience functions are moved
2134         out of CFNetwork SPI in PAL, and into where they are used. It also switches
2135         from performSelector: calls to straight function calls, after checking that
2136         there is a responder.
2137
2138         * platform/network/mac/WebCoreURLResponse.mm:
2139         (WebCore::schemeWasUpgradedDueToDynamicHSTS):
2140             Add convenience function here since it was moved out of
2141             CFNetworkSPI.h.
2142
2143 2018-04-09  Brady Eidson  <beidson@apple.com>
2144
2145         Expand WebCore policy concept of "shouldContinue" to allow for more than true/false
2146         https://bugs.webkit.org/show_bug.cgi?id=184424
2147
2148         Reviewed by Alex Christensen.
2149
2150         No new tests (No behavior change, refactor only)
2151
2152         Specifically this expands the "shouldContinue" bool to be an enum class with:
2153         -Yes
2154         -No
2155         -ForSuspension
2156
2157         * loader/DocumentLoader.cpp:
2158         (WebCore::DocumentLoader::willSendRequest):
2159         * loader/FrameLoader.cpp:
2160         (WebCore::FrameLoader::loadURL):
2161         (WebCore::FrameLoader::load):
2162         (WebCore::FrameLoader::loadWithDocumentLoader):
2163         (WebCore::FrameLoader::loadPostRequest):
2164         (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
2165         (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy):
2166         * loader/FrameLoader.h:
2167         * loader/PolicyChecker.cpp:
2168         (WebCore::PolicyChecker::checkNavigationPolicy):
2169         (WebCore::PolicyChecker::checkNewWindowPolicy):
2170         * loader/PolicyChecker.h:
2171
2172 2018-04-09  Sihui Liu  <sihui_liu@apple.com>
2173
2174         REGRESSION(r229929): localStorage is broken for WebInspector
2175         https://bugs.webkit.org/show_bug.cgi?id=184382
2176         <rdar://problem/39257355>
2177
2178         Reviewed by Chris Dumez.
2179
2180         Removed an if condition that caused false positive cases of database error. As per 
2181         https://www.sqlite.org/c3ref/errcode.html, return value of sqlite3_errcode() is undefined
2182         on successful API call, so we should not use the code to check if there is an error. We
2183         should only use it when there is an error.
2184         After moving this condition, LocalStorage might return empty string instead of NULL on
2185         sqlite3_column_blob() error.
2186
2187         Modified a test to cover this case: 
2188         TestWebKitAPI/Tests/WebKitCocoa/LocalStoragePersistence.mm.
2189
2190         * platform/sql/SQLiteStatement.cpp:
2191         (WebCore::SQLiteStatement::getColumnBlobAsString):
2192
2193 2018-04-09  Brent Fulgham  <bfulgham@apple.com>
2194
2195         WebCore::EventHandler::targetPositionInWindowForSelectionAutoscroll is directly accessing NSScreen
2196         https://bugs.webkit.org/show_bug.cgi?id=184344
2197         <rdar://problem/39224969>
2198
2199         Reviewed by Per Arne Vollan.
2200
2201         The implementation of targetPositionInWindowForSelectionAutoscroll uses the display ID to get the
2202         screen boundaries of the current display. This causes a bunch of interaction with NSScreen that
2203         we do not want to allow in the WebContent process.
2204
2205         Instead, we should just use the cached screen information the WebContent process already possesses.
2206
2207         This patch makes the following changes:
2208         1. We now retrieve the screen rect of the page's display from the cache, rather than interacting with
2209            the WindowServer directly.
2210         2. Add a new 'toUserSpaceForPrimaryScreen' so we don't have to deal with a nil NSWindow when computing
2211            the user space version of the coordinates. A nil Window just means we want to get coordinates in
2212            terms of the primary display.
2213         3. Keep track of the primary display so we can refer to it later.
2214         4. Modify the IPC messages to include the primary display's ID so we can easily access it later.
2215         5. Modify the PlatformScreen methods to actually use the primary display when appropriate, rather
2216            than whichever screen happened to hash to the lowest value.
2217
2218         * page/mac/EventHandlerMac.mm:
2219         (WebCore::EventHandler::targetPositionInWindowForSelectionAutoscroll const): Use new methods that
2220         don't require WindowServer access.
2221         * platform/PlatformScreen.h:
2222         * platform/mac/PlatformScreenMac.mm:
2223         (WebCore::displayID): Assert if we hit this code in the WebContent process.
2224         (WebCore::firstScreen): Ditto.
2225         (WebCore::window): Ditto.
2226         (WebCore::screen): Ditto.
2227         (WebCore::primaryScreenID): Added.
2228         (WebCore::getScreenProperties): Modify to return a pair consisting of the primary display ID and
2229         the HashSet of screen settings.
2230         (WebCore::setScreenProperties): Update to also track the primary display ID.
2231         (WebCore::screenProperties): Update to use the primary display ID.
2232         (WebCore::screenHasInvertedColors): Ditto.
2233         (WebCore::toUserSpaceForPrimaryScreen): Added.
2234
2235 2018-04-09  Said Abou-Hallawa  <sabouhallawa@apple.com>
2236
2237         Make InlineTextBox::createTextRun() take a const lvalue reference String
2238         https://bugs.webkit.org/show_bug.cgi?id=184182
2239
2240         Reviewed by Zalan Bujtas.
2241
2242         InlineTextBox::createTextRun() takes a non-const lvalue reference String.
2243         It is tempting to change the signature of this method to take a const lvalue 
2244         reference. But this was done intentionally. TextRun is effectively a StringView:
2245         it does not own the passed string. Having the argument a non-const lvalue
2246         reference makes the compiler prevent calls like createTextRun("abc").
2247
2248         To have a better way to express the lifetime of TextRun, this patch does
2249         the following:
2250
2251         -- It makes TextRun::m_text of type String instead of StringView.
2252         -- It adds a new constructor which takes const String&. This constructor
2253            will addRef the underlying StringImpl when assigning it to m_text.
2254         -- It keeps the constructor which takes a StringView. The caller of this
2255            constructor still has to make sure the underlying String outlives the
2256            TextRun. To avoid copying the underlying buffer of the StringView, we
2257            will not use  StringView::toString(). Instead we will use
2258            StringView::toStringWithoutCopying() which makes the returned String 
2259            accesses the same buffer the StringView uses. In this case, the returned
2260            String is effectively a StringView.
2261
2262         * page/DebugPageOverlays.cpp:
2263         (WebCore::drawRightAlignedText):
2264         * platform/graphics/TextRun.cpp:
2265         * platform/graphics/TextRun.h:
2266         (WebCore::TextRun::TextRun):
2267         (WebCore::TextRun::subRun const):
2268         (WebCore::TextRun::length const):
2269         (WebCore::TextRun::setText):
2270         (WebCore::TextRun::string const): Deleted.
2271         * rendering/InlineTextBox.cpp:
2272         (WebCore::InlineTextBox::localSelectionRect const):
2273         (WebCore::InlineTextBox::paint):
2274         (WebCore::InlineTextBox::paintPlatformDocumentMarker):
2275         (WebCore::InlineTextBox::paintMarkedTextBackground):
2276         (WebCore::InlineTextBox::paintMarkedTextForeground):
2277         (WebCore::InlineTextBox::paintMarkedTextDecoration):
2278         (WebCore::InlineTextBox::offsetForPosition const):
2279         (WebCore::InlineTextBox::positionForOffset const):
2280         (WebCore::InlineTextBox::createTextRun const):
2281         There is no need for this function to take a String argument anymore. The
2282         reason for passing the String was to guarantee its lifetime by keeping
2283         a copy of it in the caller side. Now there is no need for that. The TextRun
2284         itself will keep this copy.
2285
2286         * rendering/InlineTextBox.h:
2287         * rendering/RenderText.cpp:
2288         (WebCore::RenderText::computeCanUseSimplifiedTextMeasuring const):
2289         RenderText::text() returns StringImpl. The compiler wants us to be more
2290         explicit about which constructor of TextRun to call.
2291
2292         * rendering/SimpleLineLayout.cpp:
2293         (WebCore::SimpleLineLayout::canUseForFontAndText):
2294         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
2295         (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style):
2296         RenderStyle::hyphenString() returns an AtomicString.
2297
2298 2018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
2299
2300         Unreviewed, rolling out r230390.
2301
2302         Broke accelerated compositing
2303
2304         Reverted changeset:
2305
2306         "[GTK] WaylandCompositorDisplay leaks its wl_display"
2307         https://bugs.webkit.org/show_bug.cgi?id=184406
2308         https://trac.webkit.org/changeset/230390
2309
2310 2018-04-03  Sergio Villar Senin  <svillar@igalia.com>
2311
2312         [OpenVR][WebVR] Retrieve FrameData in WebVR's rAF
2313         https://bugs.webkit.org/show_bug.cgi?id=184265
2314
2315         Reviewed by Žan Doberšek.
2316
2317         VRFrameData contains all the required information to properly render a VR scene like view
2318         and projection matrices, pose data (position & orientation) and linear & angular velocity
2319         among others. The getFrameData() call must be issued inside a WebVR's own
2320         requestAnimationFrame.
2321
2322         * Modules/webvr/VRDisplay.cpp:
2323         (WebCore::VRDisplay::getFrameData const):
2324         (WebCore::VRDisplay::getPose const):
2325         (WebCore::VRDisplay::requestAnimationFrame):
2326         (WebCore::VRDisplay::cancelAnimationFrame):
2327         * Modules/webvr/VRDisplay.h:
2328         * Modules/webvr/VREyeParameters.h:
2329         (WebCore::VREyeParameters::rawOffset const): Required to compute view matrices.
2330         * Modules/webvr/VRFrameData.cpp:
2331         (WebCore::matrixToArray):
2332         (WebCore::VRFrameData::leftProjectionMatrix const):
2333         (WebCore::VRFrameData::leftViewMatrix const):
2334         (WebCore::VRFrameData::rightProjectionMatrix const):
2335         (WebCore::VRFrameData::rightViewMatrix const):
2336         (WebCore::projectionMatrixFromFieldOfView):
2337         (WebCore::rotationMatrixFromQuaternion):
2338         (WebCore::applyHeadToEyeTransform):
2339         (WebCore::VRFrameData::update):
2340         (WebCore::VRFrameData::timestamp const): Deleted.
2341         * Modules/webvr/VRFrameData.h:
2342         (WebCore::VRFrameData::timestamp const):
2343         * Modules/webvr/VRPose.cpp:
2344         (WebCore::optionalFloat3ToJSCArray):
2345         (WebCore::VRPose::position const):
2346         (WebCore::VRPose::linearVelocity const):
2347         (WebCore::VRPose::linearAcceleration const):
2348         (WebCore::VRPose::orientation const):
2349         (WebCore::VRPose::angularVelocity const):
2350         (WebCore::VRPose::angularAcceleration const):
2351         * Modules/webvr/VRPose.h:
2352         (WebCore::VRPose::create):
2353         (WebCore::VRPose::update):
2354         (WebCore::VRPose::VRPose):
2355         * platform/vr/VRPlatformDisplay.h:
2356         (WebCore::VRPlatformTrackingInfo::Quaternion::Quaternion):
2357         (WebCore::VRPlatformTrackingInfo::Quaternion::conjugate):
2358         (WebCore::VRPlatformTrackingInfo::Quaternion::operator*):
2359         (WebCore::VRPlatformTrackingInfo::Float3::Float3): Just a group of 3 floats used to store
2360         both velocity and acceleration in a format which is very convenient to later generate JSC
2361         arrays.
2362         (WebCore::VRPlatformTrackingInfo::clear):
2363         * platform/vr/openvr/VRPlatformDisplayOpenVR.cpp:
2364         (WebCore::VRPlatformDisplayOpenVR::VRPlatformDisplayOpenVR):
2365         (WebCore::rotationMatrixToQuaternion):
2366         (WebCore::VRPlatformDisplayOpenVR::getTrackingInfo):
2367         * platform/vr/openvr/VRPlatformDisplayOpenVR.h:
2368
2369 2018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
2370
2371         [GTK] WaylandCompositorDisplay leaks its wl_display
2372         https://bugs.webkit.org/show_bug.cgi?id=184406
2373
2374         Reviewed by Carlos Garcia Campos.
2375
2376         Remove the protected default constructor, for good measure.
2377
2378         * platform/graphics/wayland/PlatformDisplayWayland.h:
2379
2380 2018-04-08  Fujii Hironori  <Hironori.Fujii@sony.com>
2381
2382         [CMake] WebKit should link to WebCore as a PRIVATE library if WebCore is a static library
2383         https://bugs.webkit.org/show_bug.cgi?id=184127
2384
2385         Reviewed by Konstantin Tokarev.
2386
2387         No new tests (No behaviour changes).
2388
2389         * CMakeLists.txt: Added a interface library WebCoreHeaderInterface.
2390
2391 2018-04-08  Yusuke Suzuki  <utatane.tea@gmail.com>
2392
2393         Use alignas instead of compiler-specific attributes
2394         https://bugs.webkit.org/show_bug.cgi?id=183508
2395
2396         Reviewed by Mark Lam.
2397
2398         Use alignas instead of aligned.
2399
2400         * platform/graphics/cpu/arm/filters/FELightingNEON.cpp:
2401         * platform/graphics/cpu/arm/filters/FELightingNEON.h:
2402         (WebCore::FELighting::platformApplyNeon):
2403
2404 2018-04-08  Michael Catanzaro  <mcatanzaro@igalia.com>
2405
2406         [WPE][GTK] Remove applicationDirectoryPath() and sharedResourcePath()
2407         https://bugs.webkit.org/show_bug.cgi?id=184381
2408
2409         Reviewed by Carlos Garcia Campos.
2410
2411         These are unused.
2412
2413         * platform/FileSystem.h:
2414         * platform/glib/FileSystemGlib.cpp:
2415         (WebCore::FileSystem::applicationDirectoryPath): Deleted.
2416         (WebCore::FileSystem::sharedResourcesPath): Deleted.
2417
2418 2018-04-07  Daniel Bates  <dabates@apple.com>
2419
2420         Have WorkerScriptLoader::loadAsynchronously() take a FetchOptions
2421         https://bugs.webkit.org/show_bug.cgi?id=184385
2422
2423         Reviewed by Youenn Fablet.
2424
2425         Currently we pass various FetchOptions to WorkerScriptLoader::loadAsynchronously()
2426         so that it can build up a ThreadableLoaderOptions structure to pass to the loader.
2427         Each time we want to set another FetchOptions option we need to add a new parameter.
2428         Instead we should have WorkerScriptLoader::loadAsynchronously() take a FetchOptions.
2429         This will make it straightforward for a caller to set new loader options as needed.
2430         In particular, this will make it straightforward to support setting the request's
2431         destination flag (i.e. FetchOptions::destination) to support blocking scripts with
2432         a non-JavaScript MIME type in a subsequent commit.
2433
2434         No functionality changed. So, no new tests.
2435
2436         * loader/ResourceLoaderOptions.h:
2437         (WebCore::ResourceLoaderOptions::ResourceLoaderOptions): Modified to take a FetchOptions
2438         by value so as to support both move and copy semantics.
2439         * loader/ThreadableLoader.cpp:
2440         (WebCore::ThreadableLoaderOptions::ThreadableLoaderOptions):  Added helper constructor
2441         that takes a FetchOptions.
2442         * loader/ThreadableLoader.h:
2443         * workers/Worker.cpp:
2444         (WebCore::Worker::create): Instantiate and pass a FetchOptions to the loader for the mode,
2445         cache policy, and redirect policy.
2446         * workers/WorkerScriptLoader.cpp:
2447         (WebCore::WorkerScriptLoader::loadAsynchronously): Modified to take a FetchOptions and
2448         instantiate a ThreadableLoaderOptions from it.
2449         * workers/WorkerScriptLoader.h:
2450         * workers/WorkerScriptLoaderClient.h:
2451         (WebCore::WorkerScriptLoaderClient::isServiceWorkerClient const): Deleted. This function
2452         is no longer needed because the Service Worker client now passes the service worker mode
2453         directly to the loader.
2454         * workers/service/ServiceWorkerJob.cpp:
2455         (WebCore::ServiceWorkerJob::fetchScriptWithContext): Instantiate and pass a FetchOptions
2456         to the loader.
2457         * workers/service/ServiceWorkerJob.h:
2458
2459 2018-04-07  Timothy Hatcher  <timothy@apple.com>
2460
2461         Use the system's link color when system appearance is desired for a WebView.
2462
2463         https://bugs.webkit.org/show_bug.cgi?id=184353
2464         rdar://problem/9420053
2465
2466         Reviewed by Wenson Hsieh.
2467
2468         Have Document consult RenderTheme via StyleColor for the various link colors.
2469         This allows the system to have different colors than the standard hardcoded ones.
2470         This adds StyleColor::Options, to avoid multiple booleans being passed around,
2471         since the "for visited link" state is now needed in RenderTheme.
2472
2473         * WebCore.xcodeproj/project.pbxproj: Made StyleColor.h private, since RenderTheme.h includes it.
2474         * css/StyleColor.cpp:
2475         (WebCore::StyleColor::colorFromKeyword): Use options instead of a bool.
2476         (WebCore::StyleColor::isSystemColor): Consider CSSValueWebkitLink the start of system colors.
2477         * css/StyleColor.h:
2478         * css/StyleResolver.cpp:
2479         (WebCore::StyleResolver::colorFromPrimitiveValue const): Use StyleColor::Options.
2480         * css/parser/CSSParser.cpp:
2481         (WebCore::CSSParser::parseSystemColor): Use StyleColor::Options.
2482         * dom/Document.cpp:
2483         (WebCore::Document::resetLinkColor): Ask StyleColor for the link color instead of hardcoding it.
2484         (WebCore::Document::resetVisitedLinkColor): Ditto.
2485         (WebCore::Document::resetActiveLinkColor): Ditto.
2486         (WebCore::Document::styleColorOptions const): Added. Helper to get the options used.
2487         * dom/Document.h:
2488         * html/canvas/CanvasRenderingContext2D.cpp:
2489         (WebCore::CanvasRenderingContext2D::drawFocusIfNeededInternal): Use StyleColor::Options.
2490         * rendering/RenderTheme.cpp:
2491         (WebCore::RenderTheme::systemColor const): Add default values here, moved from Document.
2492         (WebCore::RenderTheme::focusRingColor): Use StyleColor::Options.
2493         * rendering/RenderTheme.h:
2494         (WebCore::RenderTheme::platformFocusRingColor const): Use StyleColor::Options.
2495         * rendering/RenderThemeGtk.cpp:
2496         (WebCore::RenderThemeGtk::systemColor const): Use StyleColor::Options.
2497         * rendering/RenderThemeGtk.h:
2498         * rendering/RenderThemeIOS.h:
2499         * rendering/RenderThemeIOS.mm:
2500         (WebCore::RenderThemeIOS::systemColor const): Use StyleColor::Options.
2501         * rendering/RenderThemeMac.h:
2502         * rendering/RenderThemeMac.mm:
2503         (WebCore::RenderThemeMac::platformFocusRingColor const): Use StyleColor::Options.
2504         (WebCore::RenderThemeMac::platformColorsDidChange): Clear m_systemVisitedLinkColor.
2505         (WebCore::RenderThemeMac::systemColor const): Use StyleColor::Options.
2506         (WebCore::RenderThemeMac::adjustMenuListStyle const): Ditto.
2507         * rendering/RenderThemeWin.cpp:
2508         (WebCore::RenderThemeWin::systemColor const): Use StyleColor::Options.
2509         * rendering/RenderThemeWin.h:
2510         * rendering/TextPaintStyle.cpp:
2511         (WebCore::computeTextPaintStyle): Use StyleColor::Options.
2512
2513 2018-04-06  Youenn Fablet  <youenn@apple.com>
2514
2515         Response headers should be filtered when sent from NetworkProcess to WebProcess
2516         https://bugs.webkit.org/show_bug.cgi?id=184310
2517
2518         Reviewed by Ryosuke Niwa.
2519
2520         Did some refactoring to allow ResourceResponse to use header value parsing routines.
2521         We add sanitization levels for regular responses in case responses might be exposed to scripts or not.
2522         If not exposed to scripts, additional filtering is done.
2523
2524         Add internal API to get unfiltered response headers from a fetch response.
2525         Test: http/wpt/service-workers/header-filtering.https.html
2526
2527         * Modules/fetch/FetchResponse.h:
2528         * loader/CrossOriginPreflightResultCache.cpp:
2529         (WebCore::CrossOriginPreflightResultCacheItem::parse):
2530         * platform/network/HTTPParsers.h:
2531         (WebCore::addToAccessControlAllowList):
2532         (WebCore::parseAccessControlAllowList):
2533         * platform/network/ResourceResponseBase.cpp:
2534         (WebCore::isSafeToKeepRedirectionResponseHeader):
2535         (WebCore::isCrossOriginSafeToKeepResponseHeader):
2536         (WebCore::ResourceResponseBase::sanitizeHTTPHeaderFields):
2537         * platform/network/ResourceResponseBase.h:
2538         * testing/ServiceWorkerInternals.cpp:
2539         (WebCore::ServiceWorkerInternals::fetchResponseHeaderList):
2540         * testing/ServiceWorkerInternals.h:
2541         * testing/ServiceWorkerInternals.idl:
2542
2543 2018-04-06  Michael Catanzaro  <mcatanzaro@igalia.com>
2544
2545         Unreviewed, fix unused parameter warning when credential storage is disabled
2546
2547         * platform/network/soup/NetworkStorageSessionSoup.cpp:
2548         (WebCore::NetworkStorageSession::getCredentialFromPersistentStorage):
2549
2550 2018-04-06  Eric Carlson  <eric.carlson@apple.com>
2551
2552         [Extra zoom mode] Block playback until fullscreen begins
2553         https://bugs.webkit.org/show_bug.cgi?id=184371
2554         <rdar://problem/39250891>
2555
2556         Reviewed by Youenn Fablet.
2557
2558         * html/HTMLMediaElement.cpp:
2559         (WebCore::HTMLMediaElement::updatePlayState): Return early when waiting to enter fullscreen.
2560         (WebCore::HTMLMediaElement::enterFullscreen): Set m_waitingToEnterFullscreen.
2561         (WebCore::HTMLMediaElement::exitFullscreen): Clear m_waitingToEnterFullscreen.
2562         (WebCore::HTMLMediaElement::didBecomeFullscreenElement): Ditto.
2563         * html/HTMLMediaElement.h:
2564
2565 2018-04-06  Brent Fulgham  <bfulgham@apple.com>
2566
2567         WebCore::screenSupportsExtendedColor improperly calls NSScreen functions in the WebContent process
2568         https://bugs.webkit.org/show_bug.cgi?id=184364
2569         <rdar://problem/39246314>
2570
2571         Reviewed by Per Arne Vollan.
2572
2573         The WebContent process is interacting directly with NSScreen to determine if the current screen
2574         has extended color support. This should be brokered from the UIProcess.
2575         
2576         Tested by fast/media/mq-color-gamut.html.
2577
2578         * platform/ScreenProperties.h:
2579         (WebCore::ScreenProperties::encode const): Add screenSupportsExtendedColor.
2580         (WebCore::ScreenProperties::decode): Ditto.
2581         * platform/mac/PlatformScreenMac.mm:
2582         (WebCore::getScreenProperties): Retrieve extended color support.
2583         (WebCore::screenSupportsExtendedColor): Retrieve cached version when in the WebContent
2584         process. Assert that NSScreen is not accessed in the WebContent process.
2585
2586 2018-04-06  Fujii Hironori  <Hironori.Fujii@sony.com>
2587
2588         [Win][WebCore] Expose a constant for scrollbar pixels per line (cScrollbarPixelsPerLine)
2589         https://bugs.webkit.org/show_bug.cgi?id=184296
2590
2591         Reviewed by Alex Christensen.
2592
2593         No new tests (No behavior changes).
2594
2595         * platform/PlatformWheelEvent.h: Placed cScrollbarPixelsPerLine definition.
2596         * platform/win/WheelEventWin.cpp:
2597         (WebCore::PlatformWheelEvent::PlatformWheelEvent): Removed cScrollbarPixelsPerLine definition.
2598
2599 2018-04-06  Brent Fulgham  <bfulgham@apple.com>
2600
2601         Unreviewed test fix after r230323
2602
2603         * platform/mac/PlatformScreenMac.mm:
2604         (WebCore::screenSupportsExtendedColor): Remove assertion hit during test runs.
2605
2606 2018-04-06  Brent Fulgham  <bfulgham@apple.com>
2607
2608         WebCore::screenColorSpace is retrieving CGColorSpace from NSScreen directly
2609         https://bugs.webkit.org/show_bug.cgi?id=184343
2610         <rdar://problem/39224881>
2611
2612         Reviewed by Per Arne Vollan.
2613
2614         Revise ScreenProperties to serialize the screen's color space, and later
2615         retrieve that in the WebContent process. This allows us to close off
2616         the CGSWindowServer connection.
2617
2618         * platform/ScreenProperties.h:
2619         (WebCore::ScreenProperties::encode const): Add CGColorSpaceRef support.
2620         (WebCore::ScreenProperties::decode): Ditto.
2621         * platform/mac/PlatformScreenMac.mm:
2622         (WebCore::displayID): Add assertion to prevent use in WebContent process.
2623         (WebCore::firstScreen): Ditto.
2624         (WebCore::getScreenProperties): Add support for CGColorSpaceRef.
2625         (WebCore::screenColorSpace): Retrieve cached version when in WebContent process.
2626         Assert that NSScreen is not accessed in WebContent process.
2627
2628 2018-04-06  Ms2ger  <Ms2ger@igalia.com>
2629
2630         Implement createImageBitmap(Blob)
2631         https://bugs.webkit.org/show_bug.cgi?id=183247
2632
2633         Reviewed by Dean Jackson.
2634
2635         Tests:
2636             - imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage.html
2637             - imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args.html
2638
2639         * fileapi/FileReaderLoader.h:
2640         (WebCore::FileReaderLoader::url): expose the Blob's URL.
2641         * html/ImageBitmap.cpp: implement createImageBitmap(Blob).
2642         * html/ImageBitmap.h: allow the BlobImageObserver class access to the creation function.
2643         * loader/cache/CachedImage.cpp: reuse extracted code.
2644         (WebCore::CachedImage::isPDFResource const):
2645         (WebCore::CachedImage::isPostScriptResource const):
2646         (WebCore::CachedImage::createImage):
2647         * platform/graphics/Image.cpp: extract some code from CachedImage to reuse.
2648         (WebCore::Image::create):
2649         (WebCore::Image::isPDFResource):
2650         (WebCore::Image::isPostScriptResource):
2651         * platform/graphics/Image.h: add declarations.
2652
2653 2018-04-06  Zalan Bujtas  <zalan@apple.com>
2654
2655         Flex child does not get repainted when it is inserted back to the render tree.
2656         https://bugs.webkit.org/show_bug.cgi?id=184361
2657         <rdar://problem/34528716>
2658
2659         Reviewed by Antti Koivisto.
2660
2661         As with any regular block children, we should issue full repaint for flexbox items on their
2662         first layout (see RenderBlockFlow::layoutBlockChild()).
2663
2664         Test: fast/flexbox/missing-repaint-when-flext-item-never-had-layout.html
2665
2666         * rendering/RenderFlexibleBox.cpp:
2667         (WebCore::RenderFlexibleBox::layoutAndPlaceChildren):
2668
2669 2018-04-06  Ms2ger  <Ms2ger@igalia.com>
2670
2671         Support transferring ImageBitmap objects
2672         https://bugs.webkit.org/show_bug.cgi?id=183131
2673
2674         Reviewed by Dean Jackson.
2675
2676         Test: imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-transfer.html
2677
2678         * bindings/js/SerializedScriptValue.cpp:
2679         (WebCore::CloneSerializer::serialize): thread through ImageBitmaps.
2680         (WebCore::CloneSerializer::CloneSerializer): thread through ImageBitmaps.
2681         (WebCore::CloneSerializer::fillTransferMap): don't require a mutable reference.
2682         (WebCore::CloneSerializer::dumpImageBitmap): add.
2683         (WebCore::CloneSerializer::dumpIfTerminal): check for ImageBitmap.
2684         (WebCore::CloneDeserializer::deserialize): thread through ImageBitmaps.
2685         (WebCore::CloneDeserializer::CloneDeserializer): thread through ImageBitmaps.
2686         (WebCore::CloneDeserializer::readImageBitmap): add.
2687         (WebCore::CloneDeserializer::readTerminal): check for ImageBitmap.
2688         (WebCore::SerializedScriptValue::SerializedScriptValue): thread through ImageBitmaps.
2689         (WebCore::SerializedScriptValue::create): thread through ImageBitmaps.
2690         (WebCore::containsDuplicates): add.
2691         (WebCore::SerializedScriptValue::deserialize): handle ImageBitmap arguments.
2692         * bindings/js/SerializedScriptValue.h: update signatures, add member.
2693         * html/ImageBitmap.cpp:
2694         (WebCore::ImageBitmap::create): add.
2695         (WebCore::ImageBitmap::detachBitmaps): add.
2696         * html/ImageBitmap.h: add signatures.
2697
2698 2018-04-06  Said Abou-Hallawa  <sabouhallawa@apple.com>
2699
2700         When recording the drawing, the DisplayList should be initialized with the GraphicsContextState of the underlying GraphicsContext
2701         https://bugs.webkit.org/show_bug.cgi?id=184336
2702
2703         Reviewed by Antti Koivisto.
2704
2705         The state of the drawing context has to be transfered to the recording 
2706         DisplayList before recording. Many recording GraphicsContext functions 
2707         will behave wrongly if it gets the default state.
2708
2709         * html/canvas/CanvasRenderingContext2DBase.cpp:
2710         (WebCore::DisplayListDrawingContext::DisplayListDrawingContext):
2711         (WebCore::CanvasRenderingContext2DBase::drawingContext const):
2712         * platform/graphics/ca/GraphicsLayerCA.cpp:
2713         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
2714         * platform/graphics/displaylists/DisplayListRecorder.cpp:
2715         (WebCore::DisplayList::Recorder::Recorder):
2716         * platform/graphics/displaylists/DisplayListRecorder.h:
2717         (WebCore::DisplayList::Recorder::ContextState::ContextState):
2718         (WebCore::DisplayList::Recorder::ContextState::cloneForSave const):
2719         * platform/graphics/displaylists/DisplayListReplayer.cpp:
2720         (WebCore::DisplayList::Replayer::replay):
2721         * platform/graphics/displaylists/DisplayListReplayer.h:
2722         (WebCore::DisplayList::Replayer::replay): If we do not have a clipping
2723         rectangle and we want to record all the drawing, we need a default value
2724         for the clipping rectangle and we want no clipping to happen.
2725
2726 2018-04-06  Daniel Bates  <dabates@apple.com>
2727
2728         Emit a more informative message when a script is blocked due to "X-Content-Type: nosniff"
2729         https://bugs.webkit.org/show_bug.cgi?id=184359
2730
2731         Reviewed by Per Arne Vollan.
2732
2733         Emphasize in the message that the script was blocked from executing.
2734
2735         Test: http/tests/security/contentTypeOptions/nosniff-importScript-blocked.html
2736
2737         * dom/LoadableClassicScript.cpp:
2738         (WebCore::LoadableClassicScript::notifyFinished):
2739         * workers/WorkerScriptLoader.cpp:
2740         (WebCore::WorkerScriptLoader::didReceiveResponse):
2741
2742 2018-04-06  Daniel Bates  <dabates@apple.com>
2743
2744         importScripts() should throw exception with a reason when it fails to load a script from the network
2745         https://bugs.webkit.org/show_bug.cgi?id=184345
2746
2747         Reviewed by Alexey Proskuryakov.
2748
2749         Currently importScripts() throws a NetworkError exception without a reason when
2750         it fails to load a script from the network. It is ambiguous whether the load failed
2751         due to an access control failure or some other error. Instead we should include
2752         the reason the load failed in the thrown exception.
2753
2754         * workers/WorkerGlobalScope.cpp:
2755         (WebCore::WorkerGlobalScope::importScripts):
2756
2757 2018-04-06  Daniel Bates  <dabates@apple.com>
2758
2759         Attempt to fix the build after <https://trac.webkit.org/changeset/230338>
2760         (https://bugs.webkit.org/show_bug.cgi?id=184360)
2761
2762         Make lambdas mutable so that we can WTFMove() their captured arguments.
2763
2764         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2765         (WebCore::LibWebRTCMediaEndpoint::createSessionDescriptionFailed):
2766         (WebCore::LibWebRTCMediaEndpoint::setLocalSessionDescriptionFailed):
2767         (WebCore::LibWebRTCMediaEndpoint::setRemoteSessionDescriptionFailed):
2768
2769 2018-04-06  Daniel Bates  <dabates@apple.com>
2770
2771         Have class Exception take String by value instead of a String&&
2772         https://bugs.webkit.org/show_bug.cgi?id=184360
2773
2774         Reviewed by Alexey Proskuryakov.
2775
2776         For convenience support instantiating an Exception with either an lvalue String or
2777         rvalue String.
2778
2779         Although it can be argued that having Exception take a String by value instead of String&&
2780         can lead to missed opportunities to WTFMove() a String object into Exception such mistakes
2781         are just that, missed opportunities. That is, correctness is not affected and we may perform
2782         an unnecessary ref/deref of the underlying StringImpl when instantiating an Exception. If
2783         such missed opportunities show up in profiles and such mistakes happen often then we can
2784         re-evaluate the decision to have Exception take a String by value.
2785
2786         * Modules/cache/DOMCache.cpp:
2787         (WebCore::DOMCache::put): Simplify code now that Exception takes a String by value.
2788         * Modules/fetch/FetchResponse.cpp:
2789         (WebCore::FetchResponse::BodyLoader::didFail): Ditto.
2790         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2791         (WebCore::LibWebRTCMediaEndpoint::createSessionDescriptionFailed): Move String into Exception to avoid an
2792         unnecessary ref/de-ref.
2793         (WebCore::LibWebRTCMediaEndpoint::setLocalSessionDescriptionFailed): Ditto.
2794         (WebCore::LibWebRTCMediaEndpoint::setRemoteSessionDescriptionFailed): Ditto.
2795         * dom/Exception.h:
2796         (WebCore::Exception::Exception): Take String by value. Also use uniform initializer syntax.
2797
2798 2018-04-06  Antti Koivisto  <antti@apple.com>
2799
2800         Tighten ImageSource to have BitmapImage pointer instead of Image
2801         https://bugs.webkit.org/show_bug.cgi?id=184356
2802
2803         Reviewed by Said Abou-Hallawa.
2804
2805         ImageSource is an implementation detail of BitmapImage, not a generic type.
2806
2807         * loader/ImageLoader.cpp:
2808         (WebCore::ImageLoader::decode):
2809         * platform/graphics/BitmapImage.h:
2810         * platform/graphics/Image.h:
2811         (WebCore::Image::decode): Deleted.
2812         (WebCore::Image::imageFrameAvailableAtIndex): Deleted.
2813
2814         Also make some BitmapImage specific functions non-virtual and remove them from Image.
2815
2816         * platform/graphics/ImageSource.cpp:
2817         (WebCore::ImageSource::ImageSource):
2818         * platform/graphics/ImageSource.h:
2819         (WebCore::ImageSource::create):
2820
2821         Make constructors private.
2822
2823         * platform/graphics/cg/GraphicsContext3DCG.cpp:
2824         (WebCore::GraphicsContext3D::ImageExtractor::extractImage):
2825
2826 2018-04-06  Brent Fulgham  <bfulgham@apple.com>
2827
2828         Unreviewed test fix after r230323
2829
2830         * platform/mac/PlatformScreenMac.mm:
2831         (WebCore::screen): Remove assertion we still hit due to event handling code.
2832
2833 2018-04-05  Youenn Fablet  <youenn@apple.com>
2834
2835         REGRESSION (r230223): LayoutTest http/tests/contentextensions/css-display-none-overflows-rule-data-1.html is crashing
2836         https://bugs.webkit.org/show_bug.cgi?id=184306
2837
2838         Reviewed by Ryosuke Niwa.
2839
2840         Add an option to not compile CSS rules since they are not useful in NetworkProcess.
2841         Covered by tests no longer crashing in Debug WK2 bots.
2842
2843         * contentextensions/ContentExtension.cpp:
2844         (WebCore::ContentExtensions::ContentExtension::create):
2845         (WebCore::ContentExtensions::ContentExtension::ContentExtension):
2846         * contentextensions/ContentExtension.h:
2847         * contentextensions/ContentExtensionsBackend.cpp:
2848         (WebCore::ContentExtensions::ContentExtensionsBackend::addContentExtension):
2849         * contentextensions/ContentExtensionsBackend.h:
2850
2851 2018-04-05  Brent Fulgham  <bfulgham@apple.com>
2852
2853         WebContent process is calling CGDisplayUsesInvertedPolarity
2854         https://bugs.webkit.org/show_bug.cgi?id=184337
2855         <rdar://problem/39215702>
2856
2857         Reviewed by Zalan Bujtas.
2858
2859         The PlatformScreenMac code is still calling display-related routines directly, specifically
2860         CGDisplayUsesInvertedPolarity and CGDisplayUsesForceToGray. These should be brokered from
2861         the UIProcess.
2862         
2863         There's also no reason to avoid the brokering behavior on current WebKit builds. Remove
2864         the compile guards so all macOS builds use this behavior.
2865         
2866         Finally, add some ProcessPrivilege assertions to guard against accidentally calling these
2867         routines in the future.
2868
2869         Tested by existing regression tests.
2870
2871         * platform/PlatformScreen.h:
2872         * platform/ScreenProperties.h:
2873         (WebCore::ScreenProperties::encode const): Add new values.
2874         (WebCore::ScreenProperties::decode):
2875         * platform/mac/PlatformScreenMac.mm:
2876         (WebCore::displayID): Add assertion that this is not calling display-related routines in
2877         the WebContent process.
2878         (WebCore::firstScreen): Ditto.
2879         (WebCore::screenProperties): Moved higher in the file so it can be reused. Add calls to
2880         CGDisplayUsesInvertedPolarity and CGDisplayUsesForceToGray.
2881         (WebCore::getScreenProperties): Moved higher in the file so it can be reused. Stop
2882         double-hashing displayID.
2883         (WebCore::screenIsMonochrome): Use cached values in WebContent process. Assert if this
2884         code attempts a display-related routine in the WebContent process.
2885         (WebCore::screenHasInvertedColors): Ditto.
2886         (WebCore::screenDepth): Add assertion that this is not calling display-related routines in
2887         the WebContent process.
2888         (WebCore::screenDepthPerComponent): Ditto.
2889         (WebCore::screenRect): Ditto.
2890         (WebCore::screenAvailableRect): Ditto.
2891         (WebCore::screen): Ditto.
2892         (WebCore::screenColorSpace): Ditto.
2893         (WebCore::screenSupportsExtendedColor): Ditto.
2894
2895 2018-04-05  John Wilander  <wilander@apple.com>
2896
2897         Resource Load Statistics: Apply cookie blocking to setCookiesFromDOM()
2898         https://bugs.webkit.org/show_bug.cgi?id=184346
2899         <rdar://problem/39226036>
2900
2901         Reviewed by Brent Fulgham.
2902
2903         Since these cookies can't be seen and are not sent in requests, I
2904         can't write an automated test for them. This really should have been
2905         done as part of: https://bugs.webkit.org/show_bug.cgi?id=180682.
2906         That said, I have tested this manually.
2907
2908         * platform/network/mac/CookieJarMac.mm:
2909         (WebCore::setCookiesFromDOM):
2910
2911 2018-04-05  Zalan Bujtas  <zalan@apple.com>
2912
2913         Folding anonymous blocks should not result in deleting content.
2914         https://bugs.webkit.org/show_bug.cgi?id=184339
2915         <rdar://problem/37327428>
2916
2917         Reviewed by Antti Koivisto.
2918
2919         While folding multiple anonymous blocks (moving the children from next sibling over to previous sibling)
2920         we should ensure that the block we are about to destroy does not gain new descendants.
2921         In case of 4 sibling anonymous blocks (A B C D), while destroying B
2922         1. we move C's children to A and destroy C.
2923         2. While destroying C, we notice B and C as sibling anonymous blocks and we move
2924         D's children over to B (even though B is going to be destroyed as we climb back on the stack).
2925         
2926         In this patch, B is detached from the tree before we start moving renderers around so that a subsequent folding won't
2927         find B anymore as a candidate.
2928
2929         Test: fast/block/crash-while-folding-anonymous-blocks.html
2930
2931         * rendering/updating/RenderTreeBuilderBlock.cpp:
2932         (WebCore::RenderTreeBuilder::Block::detach):
2933
2934 2018-04-05  Andy Estes  <aestes@apple.com>
2935
2936         Mark Payment Request as "Supported" in features.json
2937         https://bugs.webkit.org/show_bug.cgi?id=184338
2938
2939         Reviewed by Anders Carlsson.
2940
2941         * features.json:
2942
2943 2018-04-05  Chris Dumez  <cdumez@apple.com>
2944
2945         Unreviewed, rolling out r230042.
2946
2947         It is no longer needed now that it is safe to construct a
2948         SecurityOrigin from an on-main thread
2949
2950         Reverted changeset:
2951
2952         "WebSocket::didReceiveMessage() may construct a SecurityOrigin
2953         object on a non-main thread"
2954         https://bugs.webkit.org/show_bug.cgi?id=184068
2955         https://trac.webkit.org/changeset/230042
2956
2957 2018-04-05  Yusuke Suzuki  <utatane.tea@gmail.com>
2958
2959         [WTF] Remove StaticLock
2960         https://bugs.webkit.org/show_bug.cgi?id=184332
2961
2962         Reviewed by Mark Lam.
2963
2964         No behavior change.
2965
2966         * Modules/webdatabase/Database.cpp:
2967         (WebCore::Database::Database):
2968         (WebCore::Database::performOpenAndVerify):
2969         (WebCore::Database::closeDatabase):
2970         (WebCore::Database::getCachedVersion const):
2971         (WebCore::Database::setCachedVersion):
2972         * Modules/webdatabase/DatabaseTracker.cpp:
2973         (WebCore::DatabaseTracker::openDatabaseMutex):
2974         * Modules/webdatabase/DatabaseTracker.h:
2975         * Modules/websockets/WebSocket.cpp:
2976         (WebCore::WebSocket::allActiveWebSocketsMutex):
2977         * Modules/websockets/WebSocket.h:
2978         * bridge/objc/WebScriptObject.mm:
2979         * crypto/CryptoAlgorithmRegistry.cpp:
2980         (WebCore::CryptoAlgorithmRegistry::identifier):
2981         (WebCore::CryptoAlgorithmRegistry::name):
2982         (WebCore::CryptoAlgorithmRegistry::create):
2983         (WebCore::CryptoAlgorithmRegistry::registerAlgorithm):
2984         * dom/Node.cpp:
2985         * platform/URL.cpp:
2986         * platform/graphics/FontCache.cpp:
2987         * platform/graphics/MediaPlayer.cpp:
2988         * platform/ios/QuickLook.mm:
2989         * platform/ios/WebSQLiteDatabaseTrackerClient.mm:
2990         * platform/ios/wak/WebCoreThread.mm:
2991         * platform/ios/wak/WebCoreThreadRun.cpp:
2992         * platform/network/cf/LoaderRunLoopCF.cpp:
2993         (WebCore::loaderRunLoop):
2994         * platform/network/curl/CurlContext.cpp:
2995         (WebCore::CurlShareHandle::mutexFor):
2996         * platform/network/curl/CurlContext.h:
2997         * platform/sql/SQLiteDatabaseTracker.cpp:
2998         (WebCore::SQLiteDatabaseTracker::incrementTransactionInProgressCount):
2999         (WebCore::SQLiteDatabaseTracker::decrementTransactionInProgressCount):
3000         * platform/text/TextEncodingRegistry.cpp:
3001         (WebCore::buildBaseTextCodecMaps):
3002         (WebCore::newTextCodec):
3003         (WebCore::atomicCanonicalTextEncodingName):
3004         * workers/WorkerThread.cpp:
3005         (WebCore::WorkerThread::workerThreadCount):
3006         (WebCore::WorkerThread::WorkerThread):
3007         (WebCore::WorkerThread::~WorkerThread):
3008         (WebCore::WorkerThread::releaseFastMallocFreeMemoryInAllThreads):
3009
3010 2018-04-04  Youenn Fablet  <youenn@apple.com>
3011
3012         WebRTC data channel only applications require capture permissions for direct connections
3013         https://bugs.webkit.org/show_bug.cgi?id=174500
3014         <rdar://problem/34134281>
3015
3016         Reviewed by Eric Carlson.
3017
3018         Test: webrtc/datachannel/mdns-ice-candidates.html
3019
3020         Add support at PeerConnectionBackend to obfuscate any gathered host candidate
3021         by replacing the IP address with an opaque name that can be resolved by MDNS.
3022         An opaque name is generated for each IP address and is scoped by the document owning the peer connection object.
3023
3024         Add support to resolve any such MDNS ICE candidate.
3025         A limit of 250 ms is fixed for the resolution to happen.
3026         After 250 ms, the candidate is discarded.
3027
3028         Add an experimental flag around this feature, off by default.
3029
3030         * Modules/mediastream/PeerConnectionBackend.cpp:
3031         (WebCore::extractIPAddres):
3032         (WebCore::PeerConnectionBackend::addIceCandidate):
3033         (WebCore::PeerConnectionBackend::addIceCandidateSucceeded):
3034         (WebCore::PeerConnectionBackend::addIceCandidateFailed):
3035         (WebCore::PeerConnectionBackend::newICECandidate):
3036         (WebCore::PeerConnectionBackend::doneGatheringCandidates):
3037         (WebCore::PeerConnectionBackend::registerMDNSName):
3038         (WebCore::PeerConnectionBackend::finishedRegisteringMDNSName):
3039         * Modules/mediastream/PeerConnectionBackend.h:
3040         * Modules/mediastream/RTCIceCandidate.h:
3041         (WebCore::RTCIceCandidate::setCandidate):
3042         * Modules/mediastream/RTCPeerConnection.h:
3043         * dom/Document.cpp:
3044         (WebCore::Document::prepareForDestruction):
3045         (WebCore::Document::suspend):
3046         * page/RuntimeEnabledFeatures.h:
3047         (WebCore::RuntimeEnabledFeatures::mdnsICECandidatesEnabled const):
3048         (WebCore::RuntimeEnabledFeatures::setMDNSICECandidatesEnabled):
3049         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
3050
3051 2018-04-04  Brian Burg  <bburg@apple.com>
3052
3053         [Cocoa] WebDriver: test imported/w3c/webdriver/tests/cookies/add_cookie.py::test_add_non_session_cookie fails
3054         https://bugs.webkit.org/show_bug.cgi?id=184314
3055         <rdar://problem/39186578>
3056
3057         Reviewed by Timothy Hatcher.
3058
3059         Covered by several tests in add_cookie.py per the bug title.
3060
3061         * platform/network/cocoa/CookieCocoa.mm:
3062         (WebCore::Cookie::operator NSHTTPCookie * const):
3063         By converting an integral UNIX timestamp to |maxAge| fractional seconds into the future, we introduce unwanted
3064         precision that is truncated when switching back to a UNIX timestamp later. Always round up maxAge so that
3065         the truncated value and actual value are the same.
3066
3067 2018-04-04  Alex Christensen  <achristensen@webkit.org>
3068
3069         Move PingHandle to WebKitLegacy
3070         https://bugs.webkit.org/show_bug.cgi?id=184145
3071
3072         Reviewed by Youenn Fablet.
3073
3074         * WebCore.xcodeproj/project.pbxproj:
3075         * platform/network/PingHandle.h: Removed.
3076
3077 2018-04-04  Per Arne Vollan  <pvollan@apple.com>
3078
3079         The layout test fast/canvas/canvas-blending-global-alpha.html is failing when the WebContent process does not have WindowServer access.
3080         https://bugs.webkit.org/show_bug.cgi?id=183752
3081         <rdar://problem/38635731>
3082
3083         The test is failing because the system is only providing software rendering when there is no access
3084         to the WindowServer, and software rendering is producing slightly different results than hardware
3085         rendering. To enable accelerated rendering, the GPU to be used for IOSurface rendering needs to be
3086         selected by handing over the OpenGL display mask to the IOSurface CGContext.
3087
3088         Reviewed by Brent Fulgham.
3089
3090         No new tests, covered by existing tests.
3091
3092         * platform/graphics/GraphicsContext3D.h:
3093         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
3094         (WebCore::GraphicsContext3D::getOpenGLDisplayMask):
3095         * platform/graphics/cocoa/IOSurface.mm:
3096         (WebCore::IOSurface::ensurePlatformContext):
3097
3098 2018-04-04  Said Abou-Hallawa  <sabouhallawa@apple.com>
3099
3100         Track the paint frequency through a new class named PaintFrequencyTracker
3101         https://bugs.webkit.org/show_bug.cgi?id=184311
3102
3103         Reviewed by Antti Koivisto.
3104
3105         PaintFrequencyTracker is a class which detects when a layer is painted 
3106         frequently. SinglePaintFrequencyTracking is used in conjunction with
3107         PaintFrequencyTracker to recored a single paint timing.
3108
3109         * rendering/PaintFrequencyTracker.h: Added.
3110         (WebCore::PaintFrequencyTracker::begin):
3111         (WebCore::PaintFrequencyTracker::end):
3112         (WebCore::PaintFrequencyTracker::paintingFrequently const):
3113         Simplify the logic for tracking the paint frequency and move it from
3114         RenderLayer.cpp.
3115
3116         (WebCore::SinglePaintFrequencyTracking::SinglePaintFrequencyTracking):
3117         (WebCore::SinglePaintFrequencyTracking::~SinglePaintFrequencyTracking):
3118         A convenient way to bracket the begin() and the end() methods of
3119         PaintFrequencyTracker.
3120
3121         * rendering/RenderLayer.cpp:
3122         (WebCore::RenderLayer::paintLayerContents):
3123         (WebCore::RenderLayer::calculateClipRects const):
3124         (WebCore::PaintFrequencyInfo::PaintFrequencyInfo): Deleted.
3125         (WebCore::PaintFrequencyInfo::setPaintedCacheableResource): Deleted.
3126         (WebCore::PaintFrequencyInfo::paintingFrequently const): Deleted.
3127         (WebCore::PaintFrequencyInfo::updatePaintFrequency): Deleted.
3128         (WebCore::PaintFrequencyInfo::paintingCacheableResource): Deleted.
3129         * rendering/RenderLayer.h:
3130         Rename PaintFrequencyInfo to PaintFrequencyTracker and move it a separate
3131         header file.
3132
3133 2018-04-04  Jer Noble  <jer.noble@apple.com>
3134
3135         RELEASE_ASSERT in CaptionUserPreferencesMediaAF::CaptionUserPreferencesMediaAF() when MediaToolbox.framework missing
3136         https://bugs.webkit.org/show_bug.cgi?id=184247
3137         <rdar://problem/39007591>
3138
3139         Rubber-stamped by Eric Carlson.
3140
3141         Use SOFT_LINK_FRAMEWORK_OPTIONAL for frameworks which are not guaranteed to be present.
3142
3143         * page/CaptionUserPreferencesMediaAF.cpp:
3144         (WebCore::CaptionUserPreferencesMediaAF::CaptionUserPreferencesMediaAF):
3145
3146 2018-04-04  Brent Fulgham  <bfulgham@apple.com>
3147
3148         Failures from mach port reference handling should be fatal
3149         https://bugs.webkit.org/show_bug.cgi?id=184202
3150         <rdar://problem/37771114>
3151
3152         Reviewed by Anders Carlsson.
3153
3154         We may corrupt the Mach port space by improperly matching the equivalent of reference counting
3155         retains (mach_port_mod_refs) with releases (mach_port_deallocate).
3156
3157         Our current implementation of MachSendRights::create does not grab a reference if the passed
3158         port is MACH_PORT_DEAD, but we unconditionally call mach_port_deallocate on the port, which
3159         could lead to a reference count mismatch.
3160
3161         Likewise, our MachSendRight destructor does not release the port if it has changed to MACH_PORT_DEAD
3162         (e.g., if a child process dies), again leading to a mismatch in retain/releases.
3163
3164         Finally, failures in mach_port_deallocate should be fatal because they indicate that the
3165         application was attempting to remove an unowned right. This is a fatal condition for Mach, and
3166         should lead to an abort. 
3167
3168         This patch does the following:
3169
3170         1. It creates a helper function that does the right thing for safely deallocating a mach port.
3171         2. It uses it in multiple places.
3172         3. It revises 'MachSendRight::create" so that it properly handles the condition of a dead port.
3173         4. It revises the MachSendRight destructor to properly handle the condition of a dead port.
3174
3175         No new tests, no change in behavior expected.
3176
3177         * SourcesCocoa.txt: Update for move of MachSendRight files.
3178         * WebCore.xcodeproj/project.pbxproj: Ditto.
3179         * page/cocoa/ResourceUsageThreadCocoa.mm:
3180         (WebCore::getMachThreads): Added.
3181         (WebCore::cpuUsage): Use the new cleanup helper function.
3182         * platform/cocoa/MachSendRight.cpp: Removed.
3183         * platform/cocoa/MachSendRight.h: Removed.
3184         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm:
3185         (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenLayer):
3186         * platform/graphics/cocoa/IOSurface.h:
3187         * platform/graphics/cocoa/IOSurface.mm:
3188
3189 2018-04-04  Youenn Fablet  <youenn@apple.com>
3190
3191         Remove unused HTTP header names
3192         https://bugs.webkit.org/show_bug.cgi?id=184272
3193
3194         Reviewed by Alex Christensen.
3195
3196         No change of behavior.
3197         Removed some names that are not used in the code base.
3198         This allows to strengthen filtering of responses sent to WebProcess.
3199         Added two headers used by web inspector.
3200         Updated existing code to use indexed HTTP header names.
3201
3202         * html/parser/XSSAuditor.cpp:
3203         (WebCore::XSSAuditor::init):
3204         * inspector/agents/InspectorPageAgent.cpp:
3205         (WebCore::InspectorPageAgent::sourceMapURLForResource):
3206         * platform/network/HTTPHeaderNames.in:
3207
3208 2018-04-04  Beth Dakin  <bdakin@apple.com>
3209
3210         Fix the !HAVE(AVFOUNDATION_VIDEO_OUTPUT) build
3211         https://bugs.webkit.org/show_bug.cgi?id=184309
3212         -and corresponding-
3213         rdar://problem/39179126
3214
3215         Reviewed by Jer Noble.
3216
3217         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3218         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoFullscreenInlineImage):
3219         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenLayer):
3220
3221 2018-04-04  Youenn Fablet  <youenn@apple.com>
3222
3223         MockRealtimeVideoSourceMac should produce kCVPixelFormatType_420YpCbCr8Planar buffers
3224         https://bugs.webkit.org/show_bug.cgi?id=184304
3225
3226         Reviewed by Eric Carlson.
3227
3228         Allows covering RealtimeOutgoingVideoSourceMac code path handling native buffers produced by capture video sources.
3229         ARGB buffer coverage is done through canvas capture streams.
3230
3231         * platform/mediastream/mac/MockRealtimeVideoSourceMac.h:
3232         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
3233         (WebCore::MockRealtimeVideoSourceMac::CMSampleBufferFromPixelBuffer):
3234
3235 2018-04-04  Youenn Fablet  <youenn@apple.com>
3236
3237         Introduce a ThreadSafeRefCounted parameter to ensure being destroyed on the main thread
3238         https://bugs.webkit.org/show_bug.cgi?id=183988
3239
3240         Reviewed by Darin Adler.
3241
3242         No change of behavior, TrackPrivate remains destroyed on the main thread.
3243
3244         * platform/graphics/TrackPrivateBase.h:
3245         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
3246         (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable):
3247         (WebCore::AudioTrackPrivateMediaStreamCocoa::render):
3248
3249 2018-04-04  Carlos Garcia Campos  <cgarcia@igalia.com>
3250
3251         Unreviewed. Fix the build with libsoup < 2.49.91 after r230251.
3252
3253         Stop using ResourceHandle in SoupNetworkSession.
3254
3255         * platform/network/soup/SoupNetworkSession.cpp:
3256         (WebCore::SoupNetworkSession::SoupNetworkSession):
3257         (WebCore::authenticateCallback): Deleted.
3258         (WebCore::requestStartedCallback): Deleted.
3259
3260 2018-04-03  Alex Christensen  <achristensen@webkit.org>
3261
3262         Remove unused libsoup ResourceHandle implementation
3263         https://bugs.webkit.org/show_bug.cgi?id=184048
3264
3265         Reviewed by Michael Catanzaro.
3266
3267         This code is unused since r228901 so let's remove it!
3268
3269         * platform/network/ResourceHandle.h:
3270         * platform/network/ResourceHandleInternal.h:
3271         (WebCore::ResourceHandleInternal::ResourceHandleInternal):
3272         * platform/network/soup/ResourceHandleSoup.cpp:
3273         (WebCore::ResourceHandle::~ResourceHandle):
3274         (WebCore::ResourceHandleInternal::soupSession):
3275         (WebCore::ResourceHandle::cancelledOrClientless):
3276         (WebCore::ResourceHandle::ensureReadBuffer):
3277         (WebCore::ResourceHandle::currentStreamPosition const):
3278         (WebCore::ResourceHandle::platformContinueSynchronousDidReceiveResponse):
3279         (WebCore::ResourceHandle::didStartRequest):
3280         (WebCore::ResourceHandle::start):
3281         (WebCore::ResourceHandle::releaseForDownload):
3282         (WebCore::ResourceHandle::sendPendingRequest):
3283         (WebCore::ResourceHandle::cancel):
3284         (WebCore::ResourceHandle::shouldUseCredentialStorage):
3285         (WebCore::ResourceHandle::continueDidReceiveAuthenticationChallenge):
3286         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
3287         (WebCore::ResourceHandle::receivedRequestToContinueWithoutCredential):
3288         (WebCore::ResourceHandle::receivedCredential):
3289         (WebCore::ResourceHandle::receivedCancellation):
3290         (WebCore::ResourceHandle::receivedChallengeRejection):
3291         (WebCore::ResourceHandle::platformSetDefersLoading):
3292         (WebCore::sessionFromContext): Deleted.
3293         (WebCore::ResourceHandle::create): Deleted.
3294         (WebCore::ResourceHandle::ResourceHandle): Deleted.
3295         (WebCore::isAuthenticationFailureStatusCode): Deleted.
3296         (WebCore::tlsErrorsChangedCallback): Deleted.
3297         (WebCore::gotHeadersCallback): Deleted.
3298         (WebCore::applyAuthenticationToRequest): Deleted.
3299         (WebCore::restartedCallback): Deleted.
3300         (WebCore::shouldRedirect): Deleted.
3301         (WebCore::shouldRedirectAsGET): Deleted.
3302         (WebCore::continueAfterWillSendRequest): Deleted.
3303         (WebCore::doRedirect): Deleted.
3304         (WebCore::redirectSkipCallback): Deleted.
3305         (WebCore::wroteBodyDataCallback): Deleted.
3306         (WebCore::cleanupSoupRequestOperation): Deleted.
3307         (WebCore::nextMultipartResponsePartCallback): Deleted.
3308         (WebCore::sendRequestCallback): Deleted.
3309         (WebCore::continueAfterDidReceiveResponse): Deleted.
3310         (WebCore::startingCallback): Deleted.
3311         (WebCore::networkEventCallback): Deleted.
3312         (WebCore::createSoupMessageForHandleAndRequest): Deleted.
3313         (WebCore::createSoupRequestAndMessageForHandle): Deleted.
3314         (WebCore::ResourceHandle::timeoutFired): Deleted.
3315         (WebCore::waitingToSendRequest): Deleted.
3316         (WebCore::readCallback): Deleted.
3317
3318 2018-04-03  Ross Kirsling  <ross.kirsling@sony.com>
3319
3320         Add missing WEBCORE_EXPORTs (for Windows shared library build)
3321         https://bugs.webkit.org/show_bug.cgi?id=184279
3322
3323         Reviewed by Alex Christensen.
3324
3325         * dom/Element.h:
3326         * dom/Node.h:
3327         * editing/FrameSelection.h:
3328         * html/DOMURL.h:
3329         * html/HTMLFormElement.h:
3330         * html/canvas/CanvasRenderingContext.h:
3331         * platform/graphics/GraphicsContext.h:
3332         * platform/graphics/PlatformDisplay.h:
3333         * platform/graphics/cairo/CairoOperations.h:
3334         * platform/graphics/cairo/GraphicsContextImplCairo.h:
3335         * platform/graphics/texmap/TextureMapperLayer.h:
3336         * platform/network/HTTPHeaderMap.h:
3337         * platform/network/ResourceRequestBase.h:
3338         * platform/network/ResourceResponseBase.h:
3339         * platform/network/curl/AuthenticationChallenge.h:
3340         * platform/network/curl/CurlFormDataStream.h:
3341         * platform/network/curl/CurlRequest.h:
3342         * platform/network/curl/CurlSSLHandle.h:
3343         * platform/network/curl/ResourceError.h:
3344         * platform/network/curl/ResourceResponse.h:
3345
3346 2018-04-03  Youenn Fablet  <youenn@apple.com>
3347
3348         RealtimeOutgoingVideoSourceMac should pass a ObjCFrameBuffer buffer
3349         https://bugs.webkit.org/show_bug.cgi?id=184281
3350         rdar://problem/39153262
3351
3352         Reviewed by Jer Noble.
3353
3354         Covered by manual testing by going to WebRTC web sites.
3355
3356         * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp:
3357         (WebCore::RealtimeOutgoingVideoSourceCocoa::sampleBufferUpdated):
3358
3359 2018-04-03  Filip Pizlo  <fpizlo@apple.com>
3360
3361         GC shouldn't do object distancing
3362         https://bugs.webkit.org/show_bug.cgi?id=184195
3363
3364         Reviewed by Saam Barati.
3365
3366         No new tests because no change in behavior.
3367
3368         * Sources.txt:
3369         * WebCore.xcodeproj/project.pbxproj:
3370         * bindings/js/JSDOMGlobalObject.cpp:
3371         (WebCore::JSDOMGlobalObject::JSDOMGlobalObject):
3372         * bindings/js/JSDOMGlobalObject.h:
3373         * bindings/js/JSDOMWindowBase.cpp:
3374         (WebCore::JSDOMWindowBase::JSDOMWindowBase):
3375         * dom/Document.cpp:
3376         (WebCore::Document::threadLocalCache): Deleted.
3377         * dom/Document.h:
3378         * page/OriginThreadLocalCache.cpp: Removed.
3379         * page/OriginThreadLocalCache.h: Removed.
3380
3381 2018-04-03  Brent Fulgham  <bfulgham@apple.com>
3382
3383         Guard against keychain/certificate access outside the network process
3384         https://bugs.webkit.org/show_bug.cgi?id=184214
3385         <rdar://problem/38734795>
3386
3387         Reviewed by Youenn Fablet.
3388
3389         Use the ProcessPrivilege assertions to guard against accessing the Keychain from
3390         a non-Networking process.
3391
3392         * Modules/webauthn/cocoa/LocalAuthenticator.mm:
3393         (WebCore::LocalAuthenticator::makeCredential): Assert if we access the keychain from
3394         a proces other than the Network or UI process.
3395         (WebCore::LocalAuthenticator::getAssertion): Ditto.
3396         (WebCore::LocalAuthenticator::issueClientCertificate const): Ditto.
3397         * crypto/mac/SerializedCryptoKeyWrapMac.mm:
3398         (WebCore::createAndStoreMasterKey): Ditto.
3399         (WebCore::findMasterKey): Ditto.
3400         (WebCore::deleteDefaultWebCryptoMasterKey): Ditto.
3401         * platform/mac/SSLKeyGeneratorMac.mm:
3402         (WebCore::signedPublicKeyAndChallengeString): Ditto.
3403         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
3404         (WebCore::createPrivateStorageSession): Ditto.
3405         * platform/network/mac/ResourceHandleMac.mm:
3406         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge): Ditto.
3407
3408 2018-04-03  Youenn Fablet  <youenn@apple.com>
3409
3410         NetworkResourceLoader does not need to expose all redirect response headers
3411         https://bugs.webkit.org/show_bug.cgi?id=184114
3412         <rdar://problem/39010557>
3413
3414         Reviewed by Ryosuke Niwa.
3415
3416         No JS observable change of behavior.
3417         Behavior change is observable for injected bundles since they will no longer get access to the full response.
3418         List of response headers correspond to the one currently being used/exposed for redirections.
3419
3420         Test: http/wpt/loading/redirect-headers.html
3421
3422         * page/RuntimeEnabledFeatures.h:
3423         (WebCore::RuntimeEnabledFeatures::setRestrictedHTTPResponseAccess):
3424         (WebCore::RuntimeEnabledFeatures::restrictedHTTPResponseAccess const):
3425         * platform/network/ResourceResponseBase.cpp:
3426         (WebCore::isSafeToKeepRedirectionHeader):
3427         (WebCore::ResourceResponseBase::sanitizeRedirectionHTTPHeaderFields):
3428         * platform/network/ResourceResponseBase.h:
3429
3430 2018-04-03  Andy Estes  <aestes@apple.com>
3431
3432         [Mac] Prioritize file promises over filenames during drag and drop
3433         https://bugs.webkit.org/show_bug.cgi?id=184237
3434         <rdar://problem/38278076>
3435
3436         Reviewed by Wenson Hsieh.
3437
3438         When performing a drag operation where the pasteboard contains both a file path and a file
3439         promise, we have historically preferred to accept the file path. Some versions of Photos.app
3440         will provide both a low-resolution thumbnail as a file path and its high-resolution
3441         counterpart as a file promise when dragging a photo, and our current logic leads us to
3442         choose the low-quality thumbnail.
3443
3444         This patch changes our logic to prefer file promises over file paths. This matches the
3445         behavior of Finder and ensures we accept high-resolution assets from Photos.app.
3446
3447         Covered by existing file promise drag tests. beginDragWithFilePromises() was updated to
3448         write a bogus file path to the pasteboard along with the legitimate file promise.
3449
3450         * platform/mac/DragDataMac.mm:
3451         (WebCore::DragData::asFilenames const):
3452         * platform/mac/PasteboardMac.mm:
3453         (WebCore::Pasteboard::read):
3454         (WebCore::Pasteboard::readFilePaths):
3455         * platform/mac/PlatformPasteboardMac.mm:
3456         (WebCore::PlatformPasteboard::numberOfFiles const):
3457
3458 2018-04-03  Mark Lam  <mark.lam@apple.com>
3459
3460         Fix mis-application of WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION macro.
3461         https://bugs.webkit.org/show_bug.cgi?id=184276
3462         <rdar://problem/39109543>
3463
3464         Rubber-stamped by Michael Saboff.
3465
3466         * bindings/scripts/CodeGeneratorJS.pm:
3467         (GenerateImplementation):
3468         * bindings/scripts/test/JS/JSInterfaceName.cpp:
3469         (WebCore::toJSNewlyCreated):
3470         * bindings/scripts/test/JS/JSMapLike.cpp:
3471         (WebCore::toJSNewlyCreated):
3472         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
3473         (WebCore::toJSNewlyCreated):
3474         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
3475         (WebCore::toJSNewlyCreated):
3476         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
3477         (WebCore::toJSNewlyCreated):
3478         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
3479         (WebCore::toJSNewlyCreated):
3480         * bindings/scripts/test/JS/JSTestCallTracer.cpp:
3481         (WebCore::toJSNewlyCreated):
3482         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
3483         (WebCore::toJSNewlyCreated):
3484         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
3485         (WebCore::toJSNewlyCreated):
3486         * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp:
3487         (WebCore::toJSNewlyCreated):
3488         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
3489         (WebCore::toJSNewlyCreated):
3490         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
3491         (WebCore::toJSNewlyCreated):
3492         * bindings/scripts/test/JS/JSTestException.cpp:
3493         (WebCore::toJSNewlyCreated):
3494         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
3495         (WebCore::toJSNewlyCreated):
3496         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
3497         (WebCore::toJSNewlyCreated):
3498         * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp:
3499         (WebCore::toJSNewlyCreated):
3500         * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp:
3501         (WebCore::toJSNewlyCreated):
3502         * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp:
3503         (WebCore::toJSNewlyCreated):
3504         * bindings/scripts/test/JS/JSTestIterable.cpp:
3505         (WebCore::toJSNewlyCreated):
3506         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
3507         (WebCore::toJSNewlyCreated):
3508         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp:
3509         (WebCore::toJSNewlyCreated):
3510         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp:
3511         (WebCore::toJSNewlyCreated):
3512         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp:
3513         (WebCore::toJSNewlyCreated):
3514         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
3515         (WebCore::toJSNewlyCreated):
3516         * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp:
3517         (WebCore::toJSNewlyCreated):
3518         * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp:
3519         (WebCore::toJSNewlyCreated):
3520         * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp:
3521         (WebCore::toJSNewlyCreated):
3522         * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp:
3523         (WebCore::toJSNewlyCreated):
3524         * bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp:
3525         (WebCore::toJSNewlyCreated):
3526         * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp:
3527         (WebCore::toJSNewlyCreated):
3528         * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp:
3529         (WebCore::toJSNewlyCreated):
3530         * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp:
3531         (WebCore::toJSNewlyCreated):
3532         * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp:
3533         (WebCore::toJSNewlyCreated):
3534         * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp:
3535         (WebCore::toJSNewlyCreated):
3536         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp:
3537         (WebCore::toJSNewlyCreated):
3538         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp:
3539         (WebCore::toJSNewlyCreated):
3540         * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp:
3541         (WebCore::toJSNewlyCreated):
3542         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp:
3543         (WebCore::toJSNewlyCreated):
3544         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp:
3545         (WebCore::toJSNewlyCreated):
3546         * bindings/scripts/test/JS/JSTestNode.cpp:
3547         (WebCore::toJSNewlyCreated):
3548         * bindings/scripts/test/JS/JSTestObj.cpp:
3549         (WebCore::toJSNewlyCreated):
3550         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
3551         (WebCore::toJSNewlyCreated):
3552         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
3553         (WebCore::toJSNewlyCreated):
3554         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
3555         (WebCore::toJSNewlyCreated):
3556         * bindings/scripts/test/JS/JSTestPluginInterface.cpp:
3557         (WebCore::toJSNewlyCreated):
3558         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
3559         (WebCore::toJSNewlyCreated):
3560         * bindings/scripts/test/JS/JSTestSerialization.cpp:
3561         (WebCore::toJSNewlyCreated):
3562         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
3563         (WebCore::toJSNewlyCreated):
3564         * bindings/scripts/test/JS/JSTestStringifier.cpp:
3565         (WebCore::toJSNewlyCreated):
3566         * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp:
3567         (WebCore::toJSNewlyCreated):
3568         * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp:
3569         (WebCore::toJSNewlyCreated):
3570         * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp:
3571         (WebCore::toJSNewlyCreated):
3572         * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp:
3573         (WebCore::toJSNewlyCreated):
3574         * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp:
3575         (WebCore::toJSNewlyCreated):
3576         * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp:
3577         (WebCore::toJSNewlyCreated):
3578         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
3579         (WebCore::toJSNewlyCreated):
3580
3581 2018-04-03  Yousuke Kimoto  <yousuke.kimoto@sony.com>
3582
3583         [CMake] gperf path should be given when WebCore/css/makevalues.pl is executed
3584         https://bugs.webkit.org/show_bug.cgi?id=184224
3585
3586         Reviewed by Konstantin Tokarev.
3587
3588         When a building evironment doens't include a path to gperf,
3589         WebCore/css/makevalue.pl failes due to failing to execute gperf,
3590         so the full path to gperf should be given like WebCore/css/makeprop.pl.
3591
3592         No new tests, no Web-facing behavior change.
3593
3594         * CMakeLists.txt: gperf path is given to css/makevalues.pl.
3595         * css/makevalues.pl: Add an argument to handle a given gperf path.
3596
3597 2018-04-03  Chris Dumez  <cdumez@apple.com>
3598
3599         Drop MainFrame class
3600         https://bugs.webkit.org/show_bug.cgi?id=184191
3601
3602         Reviewed by Darin Adler.
3603
3604         Drop MainFrame class and move contents into Page / Frame since there is a 1:1
3605         relationship between the Page and the MainFrame.
3606
3607         This is ground work for introducing LocalFrame / RemoteFrame concepts.
3608
3609         * Modules/applepay/ApplePaySession.cpp:
3610         (WebCore::ApplePaySession::create):
3611         (WebCore::ApplePaySession::supportsVersion):
3612         (WebCore::ApplePaySession::canMakePayments):
3613         (WebCore::ApplePaySession::canMakePaymentsWithActiveCard):
3614         (WebCore::ApplePaySession::openPaymentSetup):
3615         (WebCore::ApplePaySession::paymentCoordinator const):
3616         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
3617         (WebCore::paymentCoordinator):
3618         * Modules/mediastream/MediaDevicesEnumerationRequest.cpp:
3619         * Modules/mediastream/UserMediaRequest.cpp:
3620         * Modules/plugins/QuickTimePluginReplacement.mm:
3621         * Sources.txt:
3622         * WebCore.xcodeproj/project.pbxproj:
3623         * accessibility/AccessibilityObject.cpp:
3624         (WebCore::AccessibilityObject::mainFrame const):
3625         (WebCore::AccessibilityObject::visiblePositionForBounds const):
3626         * accessibility/AccessibilityObject.h:
3627         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
3628         * bindings/js/ScriptController.cpp:
3629         * bindings/js/ScriptState.cpp:
3630         * contentextensions/ContentExtensionsBackend.cpp:
3631         * css/MediaQueryEvaluator.cpp:
3632         (WebCore::displayModeEvaluate):
3633         * dom/DOMImplementation.cpp:
3634         * dom/Document.cpp:
3635         * dom/DocumentMarkerController.cpp:
3636         * dom/Element.cpp:
3637         (WebCore::Element::removedFromAncestor):
3638         * dom/EventDispatcher.cpp:
3639         * dom/ScriptedAnimationController.cpp:
3640         * editing/Editor.cpp:
3641         (WebCore::Editor::scanSelectionForTelephoneNumbers):
3642         * editing/EditorCommand.cpp:
3643         * editing/SelectionRectGatherer.cpp:
3644         (WebCore::SelectionRectGatherer::Notifier::~Notifier):
3645         * editing/cocoa/WebContentReaderCocoa.mm:
3646         * editing/markup.cpp:
3647         * history/CachedFrame.cpp:
3648         * history/CachedPage.cpp:
3649         * history/PageCache.cpp:
3650         (WebCore::destroyRenderTree):
3651         * html/HTMLMediaElement.cpp:
3652         * html/HTMLPlugInImageElement.cpp:
3653         * html/ImageDocument.cpp:
3654         * html/MediaElementSession.cpp:
3655         (WebCore::isMainContentForPurposesOfAutoplay):
3656         * html/canvas/WebGLRenderingContextBase.cpp:
3657         * inspector/InspectorClient.cpp:
3658         * inspector/InspectorController.cpp:
3659         * inspector/InspectorFrontendClientLocal.cpp:
3660         * inspector/InspectorFrontendHost.cpp:
3661         * inspector/InspectorInstrumentation.cpp:
3662         * inspector/InspectorOverlay.cpp:
3663         * inspector/PageScriptDebugServer.cpp:
3664         * inspector/agents/InspectorApplicationCacheAgent.cpp:
3665         * inspector/agents/InspectorCanvasAgent.cpp:
3666         * inspector/agents/InspectorDOMAgent.cpp:
3667         * inspector/agents/InspectorPageAgent.cpp:
3668         (WebCore::InspectorPageAgent::mainFrame):
3669         * inspector/agents/InspectorPageAgent.h:
3670         * inspector/agents/page/PageDebuggerAgent.cpp:
3671         * inspector/agents/page/PageRuntimeAgent.cpp:
3672         * loader/DocumentLoader.cpp:
3673         * loader/DocumentWriter.cpp:
3674         * loader/FrameLoader.cpp:
3675         (WebCore::FrameLoader::loadWithDocumentLoader):
3676         (WebCore::FrameLoader::setState):
3677         * loader/HistoryController.cpp:
3678         * loader/NavigationDisabler.h:
3679         * loader/ProgressTracker.cpp:
3680         * loader/ResourceLoadObserver.cpp:
3681         * loader/ResourceLoader.cpp:
3682         * loader/SubframeLoader.cpp:
3683         * loader/SubresourceLoader.cpp:
3684         * loader/appcache/ApplicationCacheHost.cpp:
3685         * loader/archive/mhtml/MHTMLArchive.cpp:
3686         * loader/cache/CachedResource.cpp:
3687         * loader/cache/CachedResourceLoader.cpp:
3688         * page/AutoscrollController.cpp:
3689         * page/Chrome.cpp:
3690         * page/ContextMenuController.cpp:
3691         * page/DOMWindow.cpp:
3692         * page/DebugPageOverlays.cpp:
3693         (WebCore::MouseWheelRegionOverlay::updateRegion):
3694         (WebCore::NonFastScrollableRegionOverlay::updateRegion):
3695         (WebCore::RegionOverlay::create):
3696         (WebCore::RegionOverlay::RegionOverlay):
3697         (WebCore::RegionOverlay::~RegionOverlay):
3698         (WebCore::DebugPageOverlays::ensureRegionOverlayForPage):
3699         (WebCore::DebugPageOverlays::showRegionOverlay):
3700         (WebCore::DebugPageOverlays::hideRegionOverlay):
3701         (WebCore::DebugPageOverlays::regionChanged):
3702         (WebCore::DebugPageOverlays::regionOverlayForPage const):
3703         (WebCore::DebugPageOverlays::updateOverlayRegionVisibility):
3704         (WebCore::DebugPageOverlays::settingsChanged):
3705         * page/DebugPageOverlays.h:
3706         (WebCore::DebugPageOverlays::hasOverlaysForPage const):
3707         (WebCore::DebugPageOverlays::hasOverlays):
3708         (WebCore::DebugPageOverlays::didLayout):
3709         (WebCore::DebugPageOverlays::didChangeEventHandlers):
3710         * page/DragController.cpp:
3711         (WebCore::DragController::performDragOperation):
3712         (WebCore::DragController::tryDHTMLDrag):
3713         (WebCore::DragController::beginDrag):
3714         (WebCore::DragController::doSystemDrag):
3715         * page/EventHandler.cpp:
3716         (WebCore::EventHandler::handleMousePressEvent):
3717         (WebCore::EventHandler::mouseMoved):
3718         (WebCore::EventHandler::handleMouseReleaseEvent):
3719         (WebCore::EventHandler::handleWheelEvent):
3720         (WebCore::EventHandler::clearLatchedState):
3721         (WebCore::EventHandler::defaultWheelEventHandler):
3722         * page/FocusController.cpp:
3723         * page/Frame.cpp:
3724         (WebCore::Frame::Frame):
3725         (WebCore::Frame::dropChildren):
3726         (WebCore::Frame::selfOnlyRef):
3727         (WebCore::Frame::selfOnlyDeref):
3728         * page/Frame.h:
3729         (WebCore::Frame::mainFrame const):
3730         * page/FrameTree.cpp:
3731         * page/FrameView.cpp:
3732         (WebCore::FrameView::setFrameRect):
3733         (WebCore::FrameView::setContentsSize):
3734         (WebCore::FrameView::didChangeScrollOffset):
3735         (WebCore::FrameView::setViewExposedRect):
3736         * page/History.cpp:
3737         * page/MainFrame.cpp: Removed.
3738         * page/MainFrame.h: Removed.
3739         * page/MemoryRelease.cpp:
3740         * page/Page.cpp:
3741         (WebCore::Page::Page):
3742         (WebCore::m_applicationManifest):
3743         (WebCore::Page::setDeviceScaleFactor):
3744         (WebCore::Page::latchingState):
3745         (WebCore::Page::pushNewLatchingState):
3746         (WebCore::Page::resetLatchingState):
3747         (WebCore::Page::popLatchingState):
3748         (WebCore::Page::removeLatchingStateForTarget):
3749         (WebCore::Page::setPaymentCoordinator):
3750         * page/Page.h:
3751         (WebCore::Page::mainFrame):
3752         (WebCore::Page::mainFrame const):
3753         (WebCore::Page::wheelEventDeltaFilter):
3754         (WebCore::Page::pageOverlayController):
3755         (WebCore::Page::servicesOverlayController):
3756         (WebCore::Page::paymentCoordinator const):
3757         (WebCore::Page::applicationManifest const):
3758         (WebCore::Page::performanceLogging const):
3759         * page/PageConsoleClient.cpp:
3760         * page/PageDebuggable.cpp:
3761         * page/PageGroup.cpp:
3762         * page/PageGroupLoadDeferrer.cpp:
3763         * page/PageOverlay.cpp:
3764         (WebCore::PageOverlay::controller const):
3765         * page/PageOverlayController.cpp:
3766         (WebCore::PageOverlayController::PageOverlayController):
3767         (WebCore::PageOverlayController::createRootLayersIfNeeded):
3768         (WebCore::PageOverlayController::layerWithDocumentOverlays):
3769         (WebCore::PageOverlayController::layerWithViewOverlays):
3770         (WebCore::PageOverlayController::installPageOverlay):
3771         (WebCore::PageOverlayController::updateForceSynchronousScrollLayerPositionUpdates):
3772         (WebCore::PageOverlayController::didChangeViewExposedRect):
3773         (WebCore::PageOverlayController::updateSettingsForLayer):
3774         (WebCore::PageOverlayController::deviceScaleFactor const):
3775         (WebCore::PageOverlayController::notifyFlushRequired):
3776         (WebCore::PageOverlayController::tiledBackingUsageChanged):
3777         * page/PageOverlayController.h:
3778         * page/PageSerializer.cpp:
3779         * page/PerformanceLogging.cpp:
3780         (WebCore::PerformanceLogging::PerformanceLogging):
3781         (WebCore::PerformanceLogging::didReachPointOfInterest):
3782         * page/PerformanceLogging.h:
3783         * page/PerformanceMonitor.cpp:
3784         * page/ResourceUsageOverlay.cpp:
3785         (WebCore::ResourceUsageOverlay::~ResourceUsageOverlay):
3786         (WebCore::ResourceUsageOverlay::initialize):
3787         * page/SettingsBase.cpp:
3788         * page/SpatialNavigation.cpp:
3789         * page/UserContentProvider.cpp:
3790         * page/ios/FrameIOS.mm:
3791         * page/mac/DragControllerMac.mm:
3792         * page/mac/EventHandlerMac.mm:
3793         (WebCore::latchingIsLockedToPlatformFrame):
3794         (WebCore::latchingIsLockedToAncestorOfThisFrame):
3795         (WebCore::EventHandler::clearOrScheduleClearingLatchedStateIfNeeded):
3796         (WebCore::EventHandler::platformPrepareForWheelEvents):
3797         (WebCore::EventHandler::platformRecordWheelEvent):
3798         (WebCore::EventHandler::platformCompleteWheelEvent):
3799         (WebCore::EventHandler::platformCompletePlatformWidgetWheelEvent):
3800         * page/mac/PageMac.mm:
3801         * page/mac/ServicesOverlayController.h:
3802         (WebCore::ServicesOverlayController::page const):
3803         * page/mac/ServicesOverlayController.mm:
3804         (WebCore::ServicesOverlayController::Highlight::Highlight):
3805         (WebCore::ServicesOverlayController::Highlight::notifyFlushRequired):
3806         (WebCore::ServicesOverlayController::Highlight::deviceScaleFactor const):
3807         (WebCore::ServicesOverlayController::ServicesOverlayController):
3808         (WebCore::ServicesOverlayController::invalidateHighlightsOfType):
3809         (WebCore::ServicesOverlayController::buildPotentialHighlightsIfNeeded):
3810         (WebCore::ServicesOverlayController::remainingTimeUntilHighlightShouldBeShown const):
3811         (WebCore::ServicesOverlayController::buildPhoneNumberHighlights):
3812         (WebCore::ServicesOverlayController::buildSelectionHighlight):
3813         (WebCore::ServicesOverlayController::hasRelevantSelectionServices):
3814         (WebCore::ServicesOverlayController::createOverlayIfNeeded):
3815         (WebCore::ServicesOverlayController::telephoneNumberRangesForFocusedFrame):
3816         (WebCore::ServicesOverlayController::findTelephoneNumberHighlightContainingSelectionHighlight):
3817         (WebCore::ServicesOverlayController::mouseEvent):
3818         (WebCore::ServicesOverlayController::handleClick):
3819         (WebCore::ServicesOverlayController::mainFrame const):
3820         * page/scrolling/AsyncScrollingCoordinator.cpp:
3821         * page/scrolling/ScrollingCoordinator.cpp:
3822         * page/scrolling/ios/ScrollingCoordinatorIOS.mm:
3823         * page/scrolling/mac/ScrollingCoordinatorMac.mm:
3824         * platform/graphics/ca/win/CACFLayerTreeHost.cpp:
3825         * plugins/DOMMimeType.cpp:
3826         * plugins/PluginInfoProvider.cpp:
3827         (WebCore::PluginInfoProvider::refresh):
3828         * rendering/RenderBox.cpp:
3829         * rendering/RenderLayer.cpp:
3830         * rendering/RenderLayerBacking.cpp:
3831         * rendering/RenderLayerCompositor.cpp:
3832         (WebCore::RenderLayerCompositor::hasAnyAdditionalCompositedLayers const):
3833         (WebCore::RenderLayerCompositor::updateCompositingLayers):
3834         (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers):
3835         (WebCore::RenderLayerCompositor::attachRootLayer):
3836         (WebCore::RenderLayerCompositor::detachRootLayer):
3837         (WebCore::RenderLayerCompositor::rootLayerAttachmentChanged):
3838         * rendering/RenderObject.cpp:
3839         * replay/UserInputBridge.cpp:
3840         * storage/StorageEventDispatcher.cpp:
3841         * style/StyleTreeResolver.cpp:
3842         (WebCore::Style::suspendMemoryCacheClientCalls):
3843         * svg/SVGSVGElement.cpp:
3844         * svg/graphics/SVGImage.cpp:
3845         * testing/InternalSettings.cpp:
3846         * testing/Internals.cpp:
3847         (WebCore::Internals::Internals):
3848         (WebCore::Internals::installMockPageOverlay):
3849         (WebCore::Internals::pageOverlayLayerTreeAsText const):
3850         * testing/MockPageOverlay.cpp:
3851         * testing/MockPageOverlay.h:
3852         * testing/MockPageOverlayClient.cpp:
3853         (WebCore::MockPageOverlayClient::installOverlay):
3854         (WebCore::MockPageOverlayClient::layerTreeAsText):
3855         * testing/MockPageOverlayClient.h:
3856         * testing/MockPaymentCoordinator.cpp:
3857         (WebCore::MockPaymentCoordinator::MockPaymentCoordinator):
3858         (WebCore::MockPaymentCoordinator::showPaymentUI):
3859         (WebCore::MockPaymentCoordinator::completeMerchantValidation):
3860         (WebCore::MockPaymentCoordinator::changeShippingOption):
3861         (WebCore::MockPaymentCoordinator::changePaymentMethod):
3862         (WebCore::MockPaymentCoordinator::acceptPayment):
3863         (WebCore::MockPaymentCoordinator::cancelPayment):
3864         * testing/MockPaymentCoordinator.h:
3865         * workers/service/context/ServiceWorkerThreadProxy.cpp:
3866
3867 2018-04-03  Sihui Liu  <sihui_liu@apple.com>
3868
3869         The referer header is not set after redirect
3870         https://bugs.webkit.org/show_bug.cgi?id=182644
3871         <rdar://problem/37479048>
3872
3873         Reviewed by Youenn Fablet.
3874
3875         Update referrer policy and recompute referrer in redirection check, so Referer header would be set after it's removed from cross-origin request.
3876
3877         Add support for Referrer-Policy header, so referrer policy would be changed based on redirect response. 
3878
3879         * Sources.txt:
3880         * WebCore.xcodeproj/project.pbxproj:
3881         * dom/Document.cpp:
3882         (WebCore::Document::processReferrerPolicy):
3883         * loader/CrossOriginAccessControl.cpp:
3884         (WebCore::updateRequestReferrer):
3885         * loader/CrossOriginAccessControl.h:
3886         * loader/ResourceLoader.h:
3887         (WebCore::ResourceLoader::setReferrerPolicy):
3888         (WebCore::ResourceLoader::referrerPolicy const):
3889         * loader/SubresourceLoader.cpp:
3890         (WebCore::SubresourceLoader::checkRedirectionCrossOriginAccessControl):
3891         (WebCore::SubresourceLoader::updateReferrerPolicy):
3892         * loader/SubresourceLoader.h:
3893         * loader/cache/CachedResourceRequest.cpp:
3894         (WebCore::CachedResourceRequest::setAsPotentiallyCrossOrigin):
3895         (WebCore::CachedResourceRequest::updateForAccessControl):
3896         (WebCore::CachedResourceRequest::updateReferrerOriginAndUserAgentHeaders):
3897         * platform/ReferrerPolicy.cpp: Added.
3898         (WebCore::parseReferrerPolicy):
3899         * platform/ReferrerPolicy.h:
3900         * platform/network/HTTPHeaderNames.in:
3901
3902 2018-04-03  Chris Dumez  <cdumez@apple.com>
3903
3904         Make SecurityOrigin safe to create and use from any thread
3905         https://bugs.webkit.org/show_bug.cgi?id=184216
3906
3907         Reviewed by Youenn Fablet.
3908
3909         We found that we have a decent amount of code constructing and using SecurityOrigin
3910         objects from non-main threads. Unfortunately, this was not safe, mostly due to
3911         SecurityOrigin's reliance on the SchemeRegistry.
3912
3913         This patch makes it safe to construct a SecurityOrigin on any thread A and use
3914         it later on the same thread A. However, developers still need to call isolatedCopy()
3915         if they want to pass such object to another thread B.
3916
3917         * page/SecurityOrigin.cpp:
3918         (WebCore::SecurityOrigin::canDisplay const):
3919         * page/SecurityOrigin.h:
3920         * page/SecurityPolicy.cpp:
3921         (WebCore::originAccessMapLock):
3922         (WebCore::originAccessMap):
3923         (WebCore::SecurityPolicy::isAccessWhiteListed):
3924         (WebCore::SecurityPolicy::addOriginAccessWhitelistEntry):
3925         (WebCore::SecurityPolicy::removeOriginAccessWhitelistEntry):
3926         (WebCore::SecurityPolicy::resetOriginAccessWhitelists):
3927         * platform/SchemeRegistry.cpp:
3928         (WebCore::schemeRegistryLock):
3929         (WebCore::allBuiltinSchemes):
3930         (WebCore::builtinLocalURLSchemes):
3931         (WebCore::localURLSchemes):
3932         (WebCore::displayIsolatedURLSchemes):
3933         (WebCore::builtinSecureSchemes):
3934         (WebCore::secureSchemes):
3935         (WebCore::builtinSchemesWithUniqueOrigins):
3936         (WebCore::schemesWithUniqueOrigins):
3937         (WebCore::builtinEmptyDocumentSchemes):
3938         (WebCore::emptyDocumentSchemes):
3939         (WebCore::schemesForbiddenFromDomainRelaxation):
3940         (WebCore::builtinCanDisplayOnlyIfCanRequestSchemes):
3941         (WebCore::canDisplayOnlyIfCanRequestSchemes):
3942         (WebCore::notAllowingJavascriptURLsSchemes):