Unreviewed, fix the iOS build
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-04-10  Wenson Hsieh  <wenson_hsieh@apple.com>
2
3         Unreviewed, fix the iOS build
4
5         I accidentally exported an inline function in r230506.
6
7         * page/ViewportConfiguration.h:
8         (WebCore::ViewportConfiguration::viewSize const):
9
10 2018-04-10  Nan Wang  <n_wang@apple.com>
11
12         AX: Expose strong password fields on iOS
13         https://bugs.webkit.org/show_bug.cgi?id=184465
14         <rdar://problem/39325104>
15
16         Reviewed by Chris Fleizach.
17
18         Exposed the strong password field on iOS. And made sure
19         we are returning its actual value in accessibilityValue.
20
21         Test: accessibility/ios-simulator/strong-password-field.html
22
23         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
24         (-[WebAccessibilityObjectWrapper _accessibilityIsStrongPasswordField]):
25         (-[WebAccessibilityObjectWrapper accessibilityValue]):
26
27 2018-04-10  Fujii Hironori  <Hironori.Fujii@sony.com>
28
29         [Win] Add UserAgentWin.cpp
30         https://bugs.webkit.org/show_bug.cgi?id=184438
31
32         Reviewed by Michael Catanzaro.
33
34         No new tests (No behavior change).
35
36         * PlatformWin.cmake:
37         * platform/win/UserAgentWin.cpp: Added.
38         (WebCore::standardUserAgent):
39         (WebCore::standardUserAgentForURL):
40
41 2018-04-10  Wenson Hsieh  <wenson_hsieh@apple.com>
42
43         [Extra zoom mode] Add a mechanism to zoom to fixed scales when double tapping in extra zoom mode
44         https://bugs.webkit.org/show_bug.cgi?id=184435
45         <rdar://problem/38726260>
46
47         Reviewed by Dean Jackson.
48
49         Expose the size of the platform view. By default, in extra zoom mode, this *not* the same as the minimum layout
50         size, since we lay out at a large width and then shrink down to real device dimensions when computing the
51         initial scale (see r229063).
52
53         ViewGestureGeometryCollector uses this in the process of computing a target zoom scale when double tapping.
54
55         * page/ViewportConfiguration.h:
56         (WebCore::ViewportConfiguration::viewSize const):
57
58 2018-04-10  Fujii Hironori  <Hironori.Fujii@sony.com>
59
60         [Win][WebKit] LibWebRTCProvider::webRTCAvailable is an undefined symbol
61         https://bugs.webkit.org/show_bug.cgi?id=184437
62
63         Reviewed by Michael Catanzaro.
64
65         No new tests (No behavior change).
66
67         * PlatformWin.cmake: Added LibWebRTCProviderWin.cpp.
68         * platform/mediastream/libwebrtc/LibWebRTCProviderWin.cpp: Added.
69         (WebCore::LibWebRTCProvider::webRTCAvailable):
70
71 2018-04-10  Chris Dumez  <cdumez@apple.com>
72
73         Unreviewed build fix.
74
75         Those enum value names were too generic and would cause conflicts.
76
77         * Modules/webvr/VRDisplayCapabilities.h:
78         (WebCore::VRDisplayCapabilities::hasPosition const):
79         (WebCore::VRDisplayCapabilities::hasOrientation const):
80         (WebCore::VRDisplayCapabilities::hasExternalDisplay const):
81         (WebCore::VRDisplayCapabilities::canPresent const):
82         * platform/vr/VRPlatformDisplay.h:
83         * platform/vr/openvr/VRPlatformDisplayOpenVR.cpp:
84         (WebCore::VRPlatformDisplayOpenVR::VRPlatformDisplayOpenVR):
85
86 2018-04-10  Chris Dumez  <cdumez@apple.com>
87
88         Avoid constructing a service worker RegistrationStore for private sessions
89         https://bugs.webkit.org/show_bug.cgi?id=184463
90         <rdar://problem/36613948>
91
92         Reviewed by Youenn Fablet.
93
94         Avoid constructing a service worker RegistrationStore for private sessions since there
95         is no need for persistence and the registrationDatabaseDirectory is the empty string in
96         such cases.
97
98         * workers/service/server/SWServer.cpp:
99         (WebCore::SWServer::removeRegistration):
100         (WebCore::SWServer::clearAll):
101         (WebCore::SWServer::clear):
102         (WebCore::SWServer::SWServer):
103         (WebCore::SWServer::didFinishActivation):
104         * workers/service/server/SWServer.h:
105
106 2018-04-10  Chris Dumez  <cdumez@apple.com>
107
108         Unreviewed build fix.
109
110         * page/LayoutContext.cpp:
111         (WebCore::LayoutContext::~LayoutContext):
112         * page/LayoutContext.h:
113
114 2018-04-10  Jeremy Jones  <jeremyj@apple.com>
115
116         MediaSessionManageriOS should defer creation of MPVolumeView until it needs to monitor AirPlay routes
117         https://bugs.webkit.org/show_bug.cgi?id=184373
118         <rdar://problem/35177606>
119
120         Reviewed by Eric Carlson.
121
122         No change of behavior.
123
124         This delays the creation of MPVolumeView until airplay routes are monitored.
125         MPVolumeView is now also released when monitoring ends. 
126         This makes sure the MP* objects are only accessed from a UI safe thread. WebCore's "MainThread" may be different that the UI thread.
127         Since this state change is necessarily asynchronous, starting and stopping must prevent races to keep state coherent.
128
129         * platform/audio/ios/MediaSessionManagerIOS.mm:
130         (-[WebMediaSessionHelper initWithCallback:]):
131         (-[WebMediaSessionHelper dealloc]):
132         (-[WebMediaSessionHelper startMonitoringAirPlayRoutes]):
133         (-[WebMediaSessionHelper stopMonitoringAirPlayRoutes]):
134         (-[WebMediaSessionHelper allocateVolumeView]): Deleted.
135         (-[WebMediaSessionHelper setVolumeView:]): Deleted.
136
137 2018-04-10  Sihui Liu  <sihui_liu@apple.com>
138
139         Loading of multipart response was cancelled because of content policy set in WebFrameLoaderClient::dispatchDecidePolicyForResponse
140         https://bugs.webkit.org/show_bug.cgi?id=184268
141         <rdar://problem/39144446>
142
143         Reviewed by Chris Dumez.
144
145         The assertion is no longer true after the change, because multiple resources could have same
146         url. Used if condition here to make sure we only delete specified resource.
147
148         No new tests. Updated an existing test to test the stop loading case by not using injected 
149         bundle policy: http/tests/multipart/multipart-html.php.
150
151         * loader/cache/CachedResourceLoader.cpp:
152         (WebCore::CachedResourceLoader::removeCachedResource):
153
154 2018-04-10  Zalan Bujtas  <zalan@apple.com>
155
156         Do not layout images when we only need the overflow information.
157         https://bugs.webkit.org/show_bug.cgi?id=175331
158
159         Reviewed by Simon Fraser.
160
161         This improves MotionMark's Simple Leaves by ~10%. 
162
163         Covered by existing tests.
164
165         * rendering/RenderImage.cpp:
166         (WebCore::RenderImage::layout):
167
168 2018-04-10  Zan Dobersek  <zdobersek@igalia.com>
169
170         [TexMap] TextureMapperLayer unnecessarily duplicates state in GraphicsLayerTransform
171         https://bugs.webkit.org/show_bug.cgi?id=183868
172
173         Reviewed by Carlos Garcia Campos.
174
175         Drop the GraphicsLayerTransform member variable from TextureMapperLayer
176         and instead compute all the required transform information in the
177         computeTransformsRecursive() method. These computations are not too
178         expensive, and in turn we can drop an object from this class' state that
179         was only duplicating a bunch of state variables.
180
181         No new tests -- no change in functionality.
182
183         * platform/graphics/texmap/TextureMapperLayer.cpp:
184         (WebCore::TextureMapperLayer::computeTransformsRecursive):
185         (WebCore::TextureMapperLayer::paintSelf):
186         (WebCore::TextureMapperLayer::paintSelfAndChildren):
187         (WebCore::TextureMapperLayer::paintSelfAndChildrenWithReplica):
188         (WebCore::TextureMapperLayer::replicaTransform):
189         (WebCore::TextureMapperLayer::computeOverlapRegions):
190         (WebCore::TextureMapperLayer::setPosition):
191         (WebCore::TextureMapperLayer::setSize):
192         (WebCore::TextureMapperLayer::setAnchorPoint):
193         (WebCore::TextureMapperLayer::setPreserves3D):
194         (WebCore::TextureMapperLayer::setTransform):
195         (WebCore::TextureMapperLayer::setChildrenTransform):
196         (WebCore::TextureMapperLayer::syncAnimations):
197         (WebCore::TextureMapperLayer::setScrollPositionDeltaIfNeeded):
198         * platform/graphics/texmap/TextureMapperLayer.h:
199
200 2018-04-09  Brent Fulgham  <bfulgham@apple.com>
201
202         Add ProcessPrivilege assertions to places that access NSApp
203         https://bugs.webkit.org/show_bug.cgi?id=184322
204         <rdar://problem/39194560>
205
206         Reviewed by Per Arne Vollan.
207
208         Add ProcessPrivilege assertions to places where we interact with NSApp so
209         that we can prevent accidentally using them in the WebContent process.
210
211         * page/mac/EventHandlerMac.mm:
212         (WebCore::lastEventIsMouseUp):
213         (WebCore::EventHandler::sendFakeEventsAfterWidgetTracking):
214         * platform/mac/EventLoopMac.mm:
215         (WebCore::EventLoop::cycle):
216         * platform/mac/PasteboardMac.mm:
217         (WebCore::Pasteboard::setDragImage):
218
219 2018-04-09  John Wilander  <wilander@apple.com>
220
221         Refactor Ignore HSTS code
222         https://bugs.webkit.org/show_bug.cgi?id=184433
223         <rdar://problem/39298238>
224
225         Reviewed by Darin Adler.
226
227         This patch refactors our ignore HSTS code. The convenience functions are moved
228         out of CFNetwork SPI in PAL, and into where they are used. It also switches
229         from performSelector: calls to straight function calls, after checking that
230         there is a responder.
231
232         * platform/network/mac/WebCoreURLResponse.mm:
233         (WebCore::schemeWasUpgradedDueToDynamicHSTS):
234             Add convenience function here since it was moved out of
235             CFNetworkSPI.h.
236
237 2018-04-09  Brady Eidson  <beidson@apple.com>
238
239         Expand WebCore policy concept of "shouldContinue" to allow for more than true/false
240         https://bugs.webkit.org/show_bug.cgi?id=184424
241
242         Reviewed by Alex Christensen.
243
244         No new tests (No behavior change, refactor only)
245
246         Specifically this expands the "shouldContinue" bool to be an enum class with:
247         -Yes
248         -No
249         -ForSuspension
250
251         * loader/DocumentLoader.cpp:
252         (WebCore::DocumentLoader::willSendRequest):
253         * loader/FrameLoader.cpp:
254         (WebCore::FrameLoader::loadURL):
255         (WebCore::FrameLoader::load):
256         (WebCore::FrameLoader::loadWithDocumentLoader):
257         (WebCore::FrameLoader::loadPostRequest):
258         (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
259         (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy):
260         * loader/FrameLoader.h:
261         * loader/PolicyChecker.cpp:
262         (WebCore::PolicyChecker::checkNavigationPolicy):
263         (WebCore::PolicyChecker::checkNewWindowPolicy):
264         * loader/PolicyChecker.h:
265
266 2018-04-09  Sihui Liu  <sihui_liu@apple.com>
267
268         REGRESSION(r229929): localStorage is broken for WebInspector
269         https://bugs.webkit.org/show_bug.cgi?id=184382
270         <rdar://problem/39257355>
271
272         Reviewed by Chris Dumez.
273
274         Removed an if condition that caused false positive cases of database error. As per 
275         https://www.sqlite.org/c3ref/errcode.html, return value of sqlite3_errcode() is undefined
276         on successful API call, so we should not use the code to check if there is an error. We
277         should only use it when there is an error.
278         After moving this condition, LocalStorage might return empty string instead of NULL on
279         sqlite3_column_blob() error.
280
281         Modified a test to cover this case: 
282         TestWebKitAPI/Tests/WebKitCocoa/LocalStoragePersistence.mm.
283
284         * platform/sql/SQLiteStatement.cpp:
285         (WebCore::SQLiteStatement::getColumnBlobAsString):
286
287 2018-04-09  Brent Fulgham  <bfulgham@apple.com>
288
289         WebCore::EventHandler::targetPositionInWindowForSelectionAutoscroll is directly accessing NSScreen
290         https://bugs.webkit.org/show_bug.cgi?id=184344
291         <rdar://problem/39224969>
292
293         Reviewed by Per Arne Vollan.
294
295         The implementation of targetPositionInWindowForSelectionAutoscroll uses the display ID to get the
296         screen boundaries of the current display. This causes a bunch of interaction with NSScreen that
297         we do not want to allow in the WebContent process.
298
299         Instead, we should just use the cached screen information the WebContent process already possesses.
300
301         This patch makes the following changes:
302         1. We now retrieve the screen rect of the page's display from the cache, rather than interacting with
303            the WindowServer directly.
304         2. Add a new 'toUserSpaceForPrimaryScreen' so we don't have to deal with a nil NSWindow when computing
305            the user space version of the coordinates. A nil Window just means we want to get coordinates in
306            terms of the primary display.
307         3. Keep track of the primary display so we can refer to it later.
308         4. Modify the IPC messages to include the primary display's ID so we can easily access it later.
309         5. Modify the PlatformScreen methods to actually use the primary display when appropriate, rather
310            than whichever screen happened to hash to the lowest value.
311
312         * page/mac/EventHandlerMac.mm:
313         (WebCore::EventHandler::targetPositionInWindowForSelectionAutoscroll const): Use new methods that
314         don't require WindowServer access.
315         * platform/PlatformScreen.h:
316         * platform/mac/PlatformScreenMac.mm:
317         (WebCore::displayID): Assert if we hit this code in the WebContent process.
318         (WebCore::firstScreen): Ditto.
319         (WebCore::window): Ditto.
320         (WebCore::screen): Ditto.
321         (WebCore::primaryScreenID): Added.
322         (WebCore::getScreenProperties): Modify to return a pair consisting of the primary display ID and
323         the HashSet of screen settings.
324         (WebCore::setScreenProperties): Update to also track the primary display ID.
325         (WebCore::screenProperties): Update to use the primary display ID.
326         (WebCore::screenHasInvertedColors): Ditto.
327         (WebCore::toUserSpaceForPrimaryScreen): Added.
328
329 2018-04-09  Said Abou-Hallawa  <sabouhallawa@apple.com>
330
331         Make InlineTextBox::createTextRun() take a const lvalue reference String
332         https://bugs.webkit.org/show_bug.cgi?id=184182
333
334         Reviewed by Zalan Bujtas.
335
336         InlineTextBox::createTextRun() takes a non-const lvalue reference String.
337         It is tempting to change the signature of this method to take a const lvalue 
338         reference. But this was done intentionally. TextRun is effectively a StringView:
339         it does not own the passed string. Having the argument a non-const lvalue
340         reference makes the compiler prevent calls like createTextRun("abc").
341
342         To have a better way to express the lifetime of TextRun, this patch does
343         the following:
344
345         -- It makes TextRun::m_text of type String instead of StringView.
346         -- It adds a new constructor which takes const String&. This constructor
347            will addRef the underlying StringImpl when assigning it to m_text.
348         -- It keeps the constructor which takes a StringView. The caller of this
349            constructor still has to make sure the underlying String outlives the
350            TextRun. To avoid copying the underlying buffer of the StringView, we
351            will not use  StringView::toString(). Instead we will use
352            StringView::toStringWithoutCopying() which makes the returned String 
353            accesses the same buffer the StringView uses. In this case, the returned
354            String is effectively a StringView.
355
356         * page/DebugPageOverlays.cpp:
357         (WebCore::drawRightAlignedText):
358         * platform/graphics/TextRun.cpp:
359         * platform/graphics/TextRun.h:
360         (WebCore::TextRun::TextRun):
361         (WebCore::TextRun::subRun const):
362         (WebCore::TextRun::length const):
363         (WebCore::TextRun::setText):
364         (WebCore::TextRun::string const): Deleted.
365         * rendering/InlineTextBox.cpp:
366         (WebCore::InlineTextBox::localSelectionRect const):
367         (WebCore::InlineTextBox::paint):
368         (WebCore::InlineTextBox::paintPlatformDocumentMarker):
369         (WebCore::InlineTextBox::paintMarkedTextBackground):
370         (WebCore::InlineTextBox::paintMarkedTextForeground):
371         (WebCore::InlineTextBox::paintMarkedTextDecoration):
372         (WebCore::InlineTextBox::offsetForPosition const):
373         (WebCore::InlineTextBox::positionForOffset const):
374         (WebCore::InlineTextBox::createTextRun const):
375         There is no need for this function to take a String argument anymore. The
376         reason for passing the String was to guarantee its lifetime by keeping
377         a copy of it in the caller side. Now there is no need for that. The TextRun
378         itself will keep this copy.
379
380         * rendering/InlineTextBox.h:
381         * rendering/RenderText.cpp:
382         (WebCore::RenderText::computeCanUseSimplifiedTextMeasuring const):
383         RenderText::text() returns StringImpl. The compiler wants us to be more
384         explicit about which constructor of TextRun to call.
385
386         * rendering/SimpleLineLayout.cpp:
387         (WebCore::SimpleLineLayout::canUseForFontAndText):
388         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
389         (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style):
390         RenderStyle::hyphenString() returns an AtomicString.
391
392 2018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
393
394         Unreviewed, rolling out r230390.
395
396         Broke accelerated compositing
397
398         Reverted changeset:
399
400         "[GTK] WaylandCompositorDisplay leaks its wl_display"
401         https://bugs.webkit.org/show_bug.cgi?id=184406
402         https://trac.webkit.org/changeset/230390
403
404 2018-04-03  Sergio Villar Senin  <svillar@igalia.com>
405
406         [OpenVR][WebVR] Retrieve FrameData in WebVR's rAF
407         https://bugs.webkit.org/show_bug.cgi?id=184265
408
409         Reviewed by Žan Doberšek.
410
411         VRFrameData contains all the required information to properly render a VR scene like view
412         and projection matrices, pose data (position & orientation) and linear & angular velocity
413         among others. The getFrameData() call must be issued inside a WebVR's own
414         requestAnimationFrame.
415
416         * Modules/webvr/VRDisplay.cpp:
417         (WebCore::VRDisplay::getFrameData const):
418         (WebCore::VRDisplay::getPose const):
419         (WebCore::VRDisplay::requestAnimationFrame):
420         (WebCore::VRDisplay::cancelAnimationFrame):
421         * Modules/webvr/VRDisplay.h:
422         * Modules/webvr/VREyeParameters.h:
423         (WebCore::VREyeParameters::rawOffset const): Required to compute view matrices.
424         * Modules/webvr/VRFrameData.cpp:
425         (WebCore::matrixToArray):
426         (WebCore::VRFrameData::leftProjectionMatrix const):
427         (WebCore::VRFrameData::leftViewMatrix const):
428         (WebCore::VRFrameData::rightProjectionMatrix const):
429         (WebCore::VRFrameData::rightViewMatrix const):
430         (WebCore::projectionMatrixFromFieldOfView):
431         (WebCore::rotationMatrixFromQuaternion):
432         (WebCore::applyHeadToEyeTransform):
433         (WebCore::VRFrameData::update):
434         (WebCore::VRFrameData::timestamp const): Deleted.
435         * Modules/webvr/VRFrameData.h:
436         (WebCore::VRFrameData::timestamp const):
437         * Modules/webvr/VRPose.cpp:
438         (WebCore::optionalFloat3ToJSCArray):
439         (WebCore::VRPose::position const):
440         (WebCore::VRPose::linearVelocity const):
441         (WebCore::VRPose::linearAcceleration const):
442         (WebCore::VRPose::orientation const):
443         (WebCore::VRPose::angularVelocity const):
444         (WebCore::VRPose::angularAcceleration const):
445         * Modules/webvr/VRPose.h:
446         (WebCore::VRPose::create):
447         (WebCore::VRPose::update):
448         (WebCore::VRPose::VRPose):
449         * platform/vr/VRPlatformDisplay.h:
450         (WebCore::VRPlatformTrackingInfo::Quaternion::Quaternion):
451         (WebCore::VRPlatformTrackingInfo::Quaternion::conjugate):
452         (WebCore::VRPlatformTrackingInfo::Quaternion::operator*):
453         (WebCore::VRPlatformTrackingInfo::Float3::Float3): Just a group of 3 floats used to store
454         both velocity and acceleration in a format which is very convenient to later generate JSC
455         arrays.
456         (WebCore::VRPlatformTrackingInfo::clear):
457         * platform/vr/openvr/VRPlatformDisplayOpenVR.cpp:
458         (WebCore::VRPlatformDisplayOpenVR::VRPlatformDisplayOpenVR):
459         (WebCore::rotationMatrixToQuaternion):
460         (WebCore::VRPlatformDisplayOpenVR::getTrackingInfo):
461         * platform/vr/openvr/VRPlatformDisplayOpenVR.h:
462
463 2018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
464
465         [GTK] WaylandCompositorDisplay leaks its wl_display
466         https://bugs.webkit.org/show_bug.cgi?id=184406
467
468         Reviewed by Carlos Garcia Campos.
469
470         Remove the protected default constructor, for good measure.
471
472         * platform/graphics/wayland/PlatformDisplayWayland.h:
473
474 2018-04-08  Fujii Hironori  <Hironori.Fujii@sony.com>
475
476         [CMake] WebKit should link to WebCore as a PRIVATE library if WebCore is a static library
477         https://bugs.webkit.org/show_bug.cgi?id=184127
478
479         Reviewed by Konstantin Tokarev.
480
481         No new tests (No behaviour changes).
482
483         * CMakeLists.txt: Added a interface library WebCoreHeaderInterface.
484
485 2018-04-08  Yusuke Suzuki  <utatane.tea@gmail.com>
486
487         Use alignas instead of compiler-specific attributes
488         https://bugs.webkit.org/show_bug.cgi?id=183508
489
490         Reviewed by Mark Lam.
491
492         Use alignas instead of aligned.
493
494         * platform/graphics/cpu/arm/filters/FELightingNEON.cpp:
495         * platform/graphics/cpu/arm/filters/FELightingNEON.h:
496         (WebCore::FELighting::platformApplyNeon):
497
498 2018-04-08  Michael Catanzaro  <mcatanzaro@igalia.com>
499
500         [WPE][GTK] Remove applicationDirectoryPath() and sharedResourcePath()
501         https://bugs.webkit.org/show_bug.cgi?id=184381
502
503         Reviewed by Carlos Garcia Campos.
504
505         These are unused.
506
507         * platform/FileSystem.h:
508         * platform/glib/FileSystemGlib.cpp:
509         (WebCore::FileSystem::applicationDirectoryPath): Deleted.
510         (WebCore::FileSystem::sharedResourcesPath): Deleted.
511
512 2018-04-07  Daniel Bates  <dabates@apple.com>
513
514         Have WorkerScriptLoader::loadAsynchronously() take a FetchOptions
515         https://bugs.webkit.org/show_bug.cgi?id=184385
516
517         Reviewed by Youenn Fablet.
518
519         Currently we pass various FetchOptions to WorkerScriptLoader::loadAsynchronously()
520         so that it can build up a ThreadableLoaderOptions structure to pass to the loader.
521         Each time we want to set another FetchOptions option we need to add a new parameter.
522         Instead we should have WorkerScriptLoader::loadAsynchronously() take a FetchOptions.
523         This will make it straightforward for a caller to set new loader options as needed.
524         In particular, this will make it straightforward to support setting the request's
525         destination flag (i.e. FetchOptions::destination) to support blocking scripts with
526         a non-JavaScript MIME type in a subsequent commit.
527
528         No functionality changed. So, no new tests.
529
530         * loader/ResourceLoaderOptions.h:
531         (WebCore::ResourceLoaderOptions::ResourceLoaderOptions): Modified to take a FetchOptions
532         by value so as to support both move and copy semantics.
533         * loader/ThreadableLoader.cpp:
534         (WebCore::ThreadableLoaderOptions::ThreadableLoaderOptions):  Added helper constructor
535         that takes a FetchOptions.
536         * loader/ThreadableLoader.h:
537         * workers/Worker.cpp:
538         (WebCore::Worker::create): Instantiate and pass a FetchOptions to the loader for the mode,
539         cache policy, and redirect policy.
540         * workers/WorkerScriptLoader.cpp:
541         (WebCore::WorkerScriptLoader::loadAsynchronously): Modified to take a FetchOptions and
542         instantiate a ThreadableLoaderOptions from it.
543         * workers/WorkerScriptLoader.h:
544         * workers/WorkerScriptLoaderClient.h:
545         (WebCore::WorkerScriptLoaderClient::isServiceWorkerClient const): Deleted. This function
546         is no longer needed because the Service Worker client now passes the service worker mode
547         directly to the loader.
548         * workers/service/ServiceWorkerJob.cpp:
549         (WebCore::ServiceWorkerJob::fetchScriptWithContext): Instantiate and pass a FetchOptions
550         to the loader.
551         * workers/service/ServiceWorkerJob.h:
552
553 2018-04-07  Timothy Hatcher  <timothy@apple.com>
554
555         Use the system's link color when system appearance is desired for a WebView.
556
557         https://bugs.webkit.org/show_bug.cgi?id=184353
558         rdar://problem/9420053
559
560         Reviewed by Wenson Hsieh.
561
562         Have Document consult RenderTheme via StyleColor for the various link colors.
563         This allows the system to have different colors than the standard hardcoded ones.
564         This adds StyleColor::Options, to avoid multiple booleans being passed around,
565         since the "for visited link" state is now needed in RenderTheme.
566
567         * WebCore.xcodeproj/project.pbxproj: Made StyleColor.h private, since RenderTheme.h includes it.
568         * css/StyleColor.cpp:
569         (WebCore::StyleColor::colorFromKeyword): Use options instead of a bool.
570         (WebCore::StyleColor::isSystemColor): Consider CSSValueWebkitLink the start of system colors.
571         * css/StyleColor.h:
572         * css/StyleResolver.cpp:
573         (WebCore::StyleResolver::colorFromPrimitiveValue const): Use StyleColor::Options.
574         * css/parser/CSSParser.cpp:
575         (WebCore::CSSParser::parseSystemColor): Use StyleColor::Options.
576         * dom/Document.cpp:
577         (WebCore::Document::resetLinkColor): Ask StyleColor for the link color instead of hardcoding it.
578         (WebCore::Document::resetVisitedLinkColor): Ditto.
579         (WebCore::Document::resetActiveLinkColor): Ditto.
580         (WebCore::Document::styleColorOptions const): Added. Helper to get the options used.
581         * dom/Document.h:
582         * html/canvas/CanvasRenderingContext2D.cpp:
583         (WebCore::CanvasRenderingContext2D::drawFocusIfNeededInternal): Use StyleColor::Options.
584         * rendering/RenderTheme.cpp:
585         (WebCore::RenderTheme::systemColor const): Add default values here, moved from Document.
586         (WebCore::RenderTheme::focusRingColor): Use StyleColor::Options.
587         * rendering/RenderTheme.h:
588         (WebCore::RenderTheme::platformFocusRingColor const): Use StyleColor::Options.
589         * rendering/RenderThemeGtk.cpp:
590         (WebCore::RenderThemeGtk::systemColor const): Use StyleColor::Options.
591         * rendering/RenderThemeGtk.h:
592         * rendering/RenderThemeIOS.h:
593         * rendering/RenderThemeIOS.mm:
594         (WebCore::RenderThemeIOS::systemColor const): Use StyleColor::Options.
595         * rendering/RenderThemeMac.h:
596         * rendering/RenderThemeMac.mm:
597         (WebCore::RenderThemeMac::platformFocusRingColor const): Use StyleColor::Options.
598         (WebCore::RenderThemeMac::platformColorsDidChange): Clear m_systemVisitedLinkColor.
599         (WebCore::RenderThemeMac::systemColor const): Use StyleColor::Options.
600         (WebCore::RenderThemeMac::adjustMenuListStyle const): Ditto.
601         * rendering/RenderThemeWin.cpp:
602         (WebCore::RenderThemeWin::systemColor const): Use StyleColor::Options.
603         * rendering/RenderThemeWin.h:
604         * rendering/TextPaintStyle.cpp:
605         (WebCore::computeTextPaintStyle): Use StyleColor::Options.
606
607 2018-04-06  Youenn Fablet  <youenn@apple.com>
608
609         Response headers should be filtered when sent from NetworkProcess to WebProcess
610         https://bugs.webkit.org/show_bug.cgi?id=184310
611
612         Reviewed by Ryosuke Niwa.
613
614         Did some refactoring to allow ResourceResponse to use header value parsing routines.
615         We add sanitization levels for regular responses in case responses might be exposed to scripts or not.
616         If not exposed to scripts, additional filtering is done.
617
618         Add internal API to get unfiltered response headers from a fetch response.
619         Test: http/wpt/service-workers/header-filtering.https.html
620
621         * Modules/fetch/FetchResponse.h:
622         * loader/CrossOriginPreflightResultCache.cpp:
623         (WebCore::CrossOriginPreflightResultCacheItem::parse):
624         * platform/network/HTTPParsers.h:
625         (WebCore::addToAccessControlAllowList):
626         (WebCore::parseAccessControlAllowList):
627         * platform/network/ResourceResponseBase.cpp:
628         (WebCore::isSafeToKeepRedirectionResponseHeader):
629         (WebCore::isCrossOriginSafeToKeepResponseHeader):
630         (WebCore::ResourceResponseBase::sanitizeHTTPHeaderFields):
631         * platform/network/ResourceResponseBase.h:
632         * testing/ServiceWorkerInternals.cpp:
633         (WebCore::ServiceWorkerInternals::fetchResponseHeaderList):
634         * testing/ServiceWorkerInternals.h:
635         * testing/ServiceWorkerInternals.idl:
636
637 2018-04-06  Michael Catanzaro  <mcatanzaro@igalia.com>
638
639         Unreviewed, fix unused parameter warning when credential storage is disabled
640
641         * platform/network/soup/NetworkStorageSessionSoup.cpp:
642         (WebCore::NetworkStorageSession::getCredentialFromPersistentStorage):
643
644 2018-04-06  Eric Carlson  <eric.carlson@apple.com>
645
646         [Extra zoom mode] Block playback until fullscreen begins
647         https://bugs.webkit.org/show_bug.cgi?id=184371
648         <rdar://problem/39250891>
649
650         Reviewed by Youenn Fablet.
651
652         * html/HTMLMediaElement.cpp:
653         (WebCore::HTMLMediaElement::updatePlayState): Return early when waiting to enter fullscreen.
654         (WebCore::HTMLMediaElement::enterFullscreen): Set m_waitingToEnterFullscreen.
655         (WebCore::HTMLMediaElement::exitFullscreen): Clear m_waitingToEnterFullscreen.
656         (WebCore::HTMLMediaElement::didBecomeFullscreenElement): Ditto.
657         * html/HTMLMediaElement.h:
658
659 2018-04-06  Brent Fulgham  <bfulgham@apple.com>
660
661         WebCore::screenSupportsExtendedColor improperly calls NSScreen functions in the WebContent process
662         https://bugs.webkit.org/show_bug.cgi?id=184364
663         <rdar://problem/39246314>
664
665         Reviewed by Per Arne Vollan.
666
667         The WebContent process is interacting directly with NSScreen to determine if the current screen
668         has extended color support. This should be brokered from the UIProcess.
669         
670         Tested by fast/media/mq-color-gamut.html.
671
672         * platform/ScreenProperties.h:
673         (WebCore::ScreenProperties::encode const): Add screenSupportsExtendedColor.
674         (WebCore::ScreenProperties::decode): Ditto.
675         * platform/mac/PlatformScreenMac.mm:
676         (WebCore::getScreenProperties): Retrieve extended color support.
677         (WebCore::screenSupportsExtendedColor): Retrieve cached version when in the WebContent
678         process. Assert that NSScreen is not accessed in the WebContent process.
679
680 2018-04-06  Fujii Hironori  <Hironori.Fujii@sony.com>
681
682         [Win][WebCore] Expose a constant for scrollbar pixels per line (cScrollbarPixelsPerLine)
683         https://bugs.webkit.org/show_bug.cgi?id=184296
684
685         Reviewed by Alex Christensen.
686
687         No new tests (No behavior changes).
688
689         * platform/PlatformWheelEvent.h: Placed cScrollbarPixelsPerLine definition.
690         * platform/win/WheelEventWin.cpp:
691         (WebCore::PlatformWheelEvent::PlatformWheelEvent): Removed cScrollbarPixelsPerLine definition.
692
693 2018-04-06  Brent Fulgham  <bfulgham@apple.com>
694
695         Unreviewed test fix after r230323
696
697         * platform/mac/PlatformScreenMac.mm:
698         (WebCore::screenSupportsExtendedColor): Remove assertion hit during test runs.
699
700 2018-04-06  Brent Fulgham  <bfulgham@apple.com>
701
702         WebCore::screenColorSpace is retrieving CGColorSpace from NSScreen directly
703         https://bugs.webkit.org/show_bug.cgi?id=184343
704         <rdar://problem/39224881>
705
706         Reviewed by Per Arne Vollan.
707
708         Revise ScreenProperties to serialize the screen's color space, and later
709         retrieve that in the WebContent process. This allows us to close off
710         the CGSWindowServer connection.
711
712         * platform/ScreenProperties.h:
713         (WebCore::ScreenProperties::encode const): Add CGColorSpaceRef support.
714         (WebCore::ScreenProperties::decode): Ditto.
715         * platform/mac/PlatformScreenMac.mm:
716         (WebCore::displayID): Add assertion to prevent use in WebContent process.
717         (WebCore::firstScreen): Ditto.
718         (WebCore::getScreenProperties): Add support for CGColorSpaceRef.
719         (WebCore::screenColorSpace): Retrieve cached version when in WebContent process.
720         Assert that NSScreen is not accessed in WebContent process.
721
722 2018-04-06  Ms2ger  <Ms2ger@igalia.com>
723
724         Implement createImageBitmap(Blob)
725         https://bugs.webkit.org/show_bug.cgi?id=183247
726
727         Reviewed by Dean Jackson.
728
729         Tests:
730             - imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage.html
731             - imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args.html
732
733         * fileapi/FileReaderLoader.h:
734         (WebCore::FileReaderLoader::url): expose the Blob's URL.
735         * html/ImageBitmap.cpp: implement createImageBitmap(Blob).
736         * html/ImageBitmap.h: allow the BlobImageObserver class access to the creation function.
737         * loader/cache/CachedImage.cpp: reuse extracted code.
738         (WebCore::CachedImage::isPDFResource const):
739         (WebCore::CachedImage::isPostScriptResource const):
740         (WebCore::CachedImage::createImage):
741         * platform/graphics/Image.cpp: extract some code from CachedImage to reuse.
742         (WebCore::Image::create):
743         (WebCore::Image::isPDFResource):
744         (WebCore::Image::isPostScriptResource):
745         * platform/graphics/Image.h: add declarations.
746
747 2018-04-06  Zalan Bujtas  <zalan@apple.com>
748
749         Flex child does not get repainted when it is inserted back to the render tree.
750         https://bugs.webkit.org/show_bug.cgi?id=184361
751         <rdar://problem/34528716>
752
753         Reviewed by Antti Koivisto.
754
755         As with any regular block children, we should issue full repaint for flexbox items on their
756         first layout (see RenderBlockFlow::layoutBlockChild()).
757
758         Test: fast/flexbox/missing-repaint-when-flext-item-never-had-layout.html
759
760         * rendering/RenderFlexibleBox.cpp:
761         (WebCore::RenderFlexibleBox::layoutAndPlaceChildren):
762
763 2018-04-06  Ms2ger  <Ms2ger@igalia.com>
764
765         Support transferring ImageBitmap objects
766         https://bugs.webkit.org/show_bug.cgi?id=183131
767
768         Reviewed by Dean Jackson.
769
770         Test: imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-transfer.html
771
772         * bindings/js/SerializedScriptValue.cpp:
773         (WebCore::CloneSerializer::serialize): thread through ImageBitmaps.
774         (WebCore::CloneSerializer::CloneSerializer): thread through ImageBitmaps.
775         (WebCore::CloneSerializer::fillTransferMap): don't require a mutable reference.
776         (WebCore::CloneSerializer::dumpImageBitmap): add.
777         (WebCore::CloneSerializer::dumpIfTerminal): check for ImageBitmap.
778         (WebCore::CloneDeserializer::deserialize): thread through ImageBitmaps.
779         (WebCore::CloneDeserializer::CloneDeserializer): thread through ImageBitmaps.
780         (WebCore::CloneDeserializer::readImageBitmap): add.
781         (WebCore::CloneDeserializer::readTerminal): check for ImageBitmap.
782         (WebCore::SerializedScriptValue::SerializedScriptValue): thread through ImageBitmaps.
783         (WebCore::SerializedScriptValue::create): thread through ImageBitmaps.
784         (WebCore::containsDuplicates): add.
785         (WebCore::SerializedScriptValue::deserialize): handle ImageBitmap arguments.
786         * bindings/js/SerializedScriptValue.h: update signatures, add member.
787         * html/ImageBitmap.cpp:
788         (WebCore::ImageBitmap::create): add.
789         (WebCore::ImageBitmap::detachBitmaps): add.
790         * html/ImageBitmap.h: add signatures.
791
792 2018-04-06  Said Abou-Hallawa  <sabouhallawa@apple.com>
793
794         When recording the drawing, the DisplayList should be initialized with the GraphicsContextState of the underlying GraphicsContext
795         https://bugs.webkit.org/show_bug.cgi?id=184336
796
797         Reviewed by Antti Koivisto.
798
799         The state of the drawing context has to be transfered to the recording 
800         DisplayList before recording. Many recording GraphicsContext functions 
801         will behave wrongly if it gets the default state.
802
803         * html/canvas/CanvasRenderingContext2DBase.cpp:
804         (WebCore::DisplayListDrawingContext::DisplayListDrawingContext):
805         (WebCore::CanvasRenderingContext2DBase::drawingContext const):
806         * platform/graphics/ca/GraphicsLayerCA.cpp:
807         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
808         * platform/graphics/displaylists/DisplayListRecorder.cpp:
809         (WebCore::DisplayList::Recorder::Recorder):
810         * platform/graphics/displaylists/DisplayListRecorder.h:
811         (WebCore::DisplayList::Recorder::ContextState::ContextState):
812         (WebCore::DisplayList::Recorder::ContextState::cloneForSave const):
813         * platform/graphics/displaylists/DisplayListReplayer.cpp:
814         (WebCore::DisplayList::Replayer::replay):
815         * platform/graphics/displaylists/DisplayListReplayer.h:
816         (WebCore::DisplayList::Replayer::replay): If we do not have a clipping
817         rectangle and we want to record all the drawing, we need a default value
818         for the clipping rectangle and we want no clipping to happen.
819
820 2018-04-06  Daniel Bates  <dabates@apple.com>
821
822         Emit a more informative message when a script is blocked due to "X-Content-Type: nosniff"
823         https://bugs.webkit.org/show_bug.cgi?id=184359
824
825         Reviewed by Per Arne Vollan.
826
827         Emphasize in the message that the script was blocked from executing.
828
829         Test: http/tests/security/contentTypeOptions/nosniff-importScript-blocked.html
830
831         * dom/LoadableClassicScript.cpp:
832         (WebCore::LoadableClassicScript::notifyFinished):
833         * workers/WorkerScriptLoader.cpp:
834         (WebCore::WorkerScriptLoader::didReceiveResponse):
835
836 2018-04-06  Daniel Bates  <dabates@apple.com>
837
838         importScripts() should throw exception with a reason when it fails to load a script from the network
839         https://bugs.webkit.org/show_bug.cgi?id=184345
840
841         Reviewed by Alexey Proskuryakov.
842
843         Currently importScripts() throws a NetworkError exception without a reason when
844         it fails to load a script from the network. It is ambiguous whether the load failed
845         due to an access control failure or some other error. Instead we should include
846         the reason the load failed in the thrown exception.
847
848         * workers/WorkerGlobalScope.cpp:
849         (WebCore::WorkerGlobalScope::importScripts):
850
851 2018-04-06  Daniel Bates  <dabates@apple.com>
852
853         Attempt to fix the build after <https://trac.webkit.org/changeset/230338>
854         (https://bugs.webkit.org/show_bug.cgi?id=184360)
855
856         Make lambdas mutable so that we can WTFMove() their captured arguments.
857
858         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
859         (WebCore::LibWebRTCMediaEndpoint::createSessionDescriptionFailed):
860         (WebCore::LibWebRTCMediaEndpoint::setLocalSessionDescriptionFailed):
861         (WebCore::LibWebRTCMediaEndpoint::setRemoteSessionDescriptionFailed):
862
863 2018-04-06  Daniel Bates  <dabates@apple.com>
864
865         Have class Exception take String by value instead of a String&&
866         https://bugs.webkit.org/show_bug.cgi?id=184360
867
868         Reviewed by Alexey Proskuryakov.
869
870         For convenience support instantiating an Exception with either an lvalue String or
871         rvalue String.
872
873         Although it can be argued that having Exception take a String by value instead of String&&
874         can lead to missed opportunities to WTFMove() a String object into Exception such mistakes
875         are just that, missed opportunities. That is, correctness is not affected and we may perform
876         an unnecessary ref/deref of the underlying StringImpl when instantiating an Exception. If
877         such missed opportunities show up in profiles and such mistakes happen often then we can
878         re-evaluate the decision to have Exception take a String by value.
879
880         * Modules/cache/DOMCache.cpp:
881         (WebCore::DOMCache::put): Simplify code now that Exception takes a String by value.
882         * Modules/fetch/FetchResponse.cpp:
883         (WebCore::FetchResponse::BodyLoader::didFail): Ditto.
884         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
885         (WebCore::LibWebRTCMediaEndpoint::createSessionDescriptionFailed): Move String into Exception to avoid an
886         unnecessary ref/de-ref.
887         (WebCore::LibWebRTCMediaEndpoint::setLocalSessionDescriptionFailed): Ditto.
888         (WebCore::LibWebRTCMediaEndpoint::setRemoteSessionDescriptionFailed): Ditto.
889         * dom/Exception.h:
890         (WebCore::Exception::Exception): Take String by value. Also use uniform initializer syntax.
891
892 2018-04-06  Antti Koivisto  <antti@apple.com>
893
894         Tighten ImageSource to have BitmapImage pointer instead of Image
895         https://bugs.webkit.org/show_bug.cgi?id=184356
896
897         Reviewed by Said Abou-Hallawa.
898
899         ImageSource is an implementation detail of BitmapImage, not a generic type.
900
901         * loader/ImageLoader.cpp:
902         (WebCore::ImageLoader::decode):
903         * platform/graphics/BitmapImage.h:
904         * platform/graphics/Image.h:
905         (WebCore::Image::decode): Deleted.
906         (WebCore::Image::imageFrameAvailableAtIndex): Deleted.
907
908         Also make some BitmapImage specific functions non-virtual and remove them from Image.
909
910         * platform/graphics/ImageSource.cpp:
911         (WebCore::ImageSource::ImageSource):
912         * platform/graphics/ImageSource.h:
913         (WebCore::ImageSource::create):
914
915         Make constructors private.
916
917         * platform/graphics/cg/GraphicsContext3DCG.cpp:
918         (WebCore::GraphicsContext3D::ImageExtractor::extractImage):
919
920 2018-04-06  Brent Fulgham  <bfulgham@apple.com>
921
922         Unreviewed test fix after r230323
923
924         * platform/mac/PlatformScreenMac.mm:
925         (WebCore::screen): Remove assertion we still hit due to event handling code.
926
927 2018-04-05  Youenn Fablet  <youenn@apple.com>
928
929         REGRESSION (r230223): LayoutTest http/tests/contentextensions/css-display-none-overflows-rule-data-1.html is crashing
930         https://bugs.webkit.org/show_bug.cgi?id=184306
931
932         Reviewed by Ryosuke Niwa.
933
934         Add an option to not compile CSS rules since they are not useful in NetworkProcess.
935         Covered by tests no longer crashing in Debug WK2 bots.
936
937         * contentextensions/ContentExtension.cpp:
938         (WebCore::ContentExtensions::ContentExtension::create):
939         (WebCore::ContentExtensions::ContentExtension::ContentExtension):
940         * contentextensions/ContentExtension.h:
941         * contentextensions/ContentExtensionsBackend.cpp:
942         (WebCore::ContentExtensions::ContentExtensionsBackend::addContentExtension):
943         * contentextensions/ContentExtensionsBackend.h:
944
945 2018-04-05  Brent Fulgham  <bfulgham@apple.com>
946
947         WebContent process is calling CGDisplayUsesInvertedPolarity
948         https://bugs.webkit.org/show_bug.cgi?id=184337
949         <rdar://problem/39215702>
950
951         Reviewed by Zalan Bujtas.
952
953         The PlatformScreenMac code is still calling display-related routines directly, specifically
954         CGDisplayUsesInvertedPolarity and CGDisplayUsesForceToGray. These should be brokered from
955         the UIProcess.
956         
957         There's also no reason to avoid the brokering behavior on current WebKit builds. Remove
958         the compile guards so all macOS builds use this behavior.
959         
960         Finally, add some ProcessPrivilege assertions to guard against accidentally calling these
961         routines in the future.
962
963         Tested by existing regression tests.
964
965         * platform/PlatformScreen.h:
966         * platform/ScreenProperties.h:
967         (WebCore::ScreenProperties::encode const): Add new values.
968         (WebCore::ScreenProperties::decode):
969         * platform/mac/PlatformScreenMac.mm:
970         (WebCore::displayID): Add assertion that this is not calling display-related routines in
971         the WebContent process.
972         (WebCore::firstScreen): Ditto.
973         (WebCore::screenProperties): Moved higher in the file so it can be reused. Add calls to
974         CGDisplayUsesInvertedPolarity and CGDisplayUsesForceToGray.
975         (WebCore::getScreenProperties): Moved higher in the file so it can be reused. Stop
976         double-hashing displayID.
977         (WebCore::screenIsMonochrome): Use cached values in WebContent process. Assert if this
978         code attempts a display-related routine in the WebContent process.
979         (WebCore::screenHasInvertedColors): Ditto.
980         (WebCore::screenDepth): Add assertion that this is not calling display-related routines in
981         the WebContent process.
982         (WebCore::screenDepthPerComponent): Ditto.
983         (WebCore::screenRect): Ditto.
984         (WebCore::screenAvailableRect): Ditto.
985         (WebCore::screen): Ditto.
986         (WebCore::screenColorSpace): Ditto.
987         (WebCore::screenSupportsExtendedColor): Ditto.
988
989 2018-04-05  John Wilander  <wilander@apple.com>
990
991         Resource Load Statistics: Apply cookie blocking to setCookiesFromDOM()
992         https://bugs.webkit.org/show_bug.cgi?id=184346
993         <rdar://problem/39226036>
994
995         Reviewed by Brent Fulgham.
996
997         Since these cookies can't be seen and are not sent in requests, I
998         can't write an automated test for them. This really should have been
999         done as part of: https://bugs.webkit.org/show_bug.cgi?id=180682.
1000         That said, I have tested this manually.
1001
1002         * platform/network/mac/CookieJarMac.mm:
1003         (WebCore::setCookiesFromDOM):
1004
1005 2018-04-05  Zalan Bujtas  <zalan@apple.com>
1006
1007         Folding anonymous blocks should not result in deleting content.
1008         https://bugs.webkit.org/show_bug.cgi?id=184339
1009         <rdar://problem/37327428>
1010
1011         Reviewed by Antti Koivisto.
1012
1013         While folding multiple anonymous blocks (moving the children from next sibling over to previous sibling)
1014         we should ensure that the block we are about to destroy does not gain new descendants.
1015         In case of 4 sibling anonymous blocks (A B C D), while destroying B
1016         1. we move C's children to A and destroy C.
1017         2. While destroying C, we notice B and C as sibling anonymous blocks and we move
1018         D's children over to B (even though B is going to be destroyed as we climb back on the stack).
1019         
1020         In this patch, B is detached from the tree before we start moving renderers around so that a subsequent folding won't
1021         find B anymore as a candidate.
1022
1023         Test: fast/block/crash-while-folding-anonymous-blocks.html
1024
1025         * rendering/updating/RenderTreeBuilderBlock.cpp:
1026         (WebCore::RenderTreeBuilder::Block::detach):
1027
1028 2018-04-05  Andy Estes  <aestes@apple.com>
1029
1030         Mark Payment Request as "Supported" in features.json
1031         https://bugs.webkit.org/show_bug.cgi?id=184338
1032
1033         Reviewed by Anders Carlsson.
1034
1035         * features.json:
1036
1037 2018-04-05  Chris Dumez  <cdumez@apple.com>
1038
1039         Unreviewed, rolling out r230042.
1040
1041         It is no longer needed now that it is safe to construct a
1042         SecurityOrigin from an on-main thread
1043
1044         Reverted changeset:
1045
1046         "WebSocket::didReceiveMessage() may construct a SecurityOrigin
1047         object on a non-main thread"
1048         https://bugs.webkit.org/show_bug.cgi?id=184068
1049         https://trac.webkit.org/changeset/230042
1050
1051 2018-04-05  Yusuke Suzuki  <utatane.tea@gmail.com>
1052
1053         [WTF] Remove StaticLock
1054         https://bugs.webkit.org/show_bug.cgi?id=184332
1055
1056         Reviewed by Mark Lam.
1057
1058         No behavior change.
1059
1060         * Modules/webdatabase/Database.cpp:
1061         (WebCore::Database::Database):
1062         (WebCore::Database::performOpenAndVerify):
1063         (WebCore::Database::closeDatabase):
1064         (WebCore::Database::getCachedVersion const):
1065         (WebCore::Database::setCachedVersion):
1066         * Modules/webdatabase/DatabaseTracker.cpp:
1067         (WebCore::DatabaseTracker::openDatabaseMutex):
1068         * Modules/webdatabase/DatabaseTracker.h:
1069         * Modules/websockets/WebSocket.cpp:
1070         (WebCore::WebSocket::allActiveWebSocketsMutex):
1071         * Modules/websockets/WebSocket.h:
1072         * bridge/objc/WebScriptObject.mm:
1073         * crypto/CryptoAlgorithmRegistry.cpp:
1074         (WebCore::CryptoAlgorithmRegistry::identifier):
1075         (WebCore::CryptoAlgorithmRegistry::name):
1076         (WebCore::CryptoAlgorithmRegistry::create):
1077         (WebCore::CryptoAlgorithmRegistry::registerAlgorithm):
1078         * dom/Node.cpp:
1079         * platform/URL.cpp:
1080         * platform/graphics/FontCache.cpp:
1081         * platform/graphics/MediaPlayer.cpp:
1082         * platform/ios/QuickLook.mm:
1083         * platform/ios/WebSQLiteDatabaseTrackerClient.mm:
1084         * platform/ios/wak/WebCoreThread.mm:
1085         * platform/ios/wak/WebCoreThreadRun.cpp:
1086         * platform/network/cf/LoaderRunLoopCF.cpp:
1087         (WebCore::loaderRunLoop):
1088         * platform/network/curl/CurlContext.cpp:
1089         (WebCore::CurlShareHandle::mutexFor):
1090         * platform/network/curl/CurlContext.h:
1091         * platform/sql/SQLiteDatabaseTracker.cpp:
1092         (WebCore::SQLiteDatabaseTracker::incrementTransactionInProgressCount):
1093         (WebCore::SQLiteDatabaseTracker::decrementTransactionInProgressCount):
1094         * platform/text/TextEncodingRegistry.cpp:
1095         (WebCore::buildBaseTextCodecMaps):
1096         (WebCore::newTextCodec):
1097         (WebCore::atomicCanonicalTextEncodingName):
1098         * workers/WorkerThread.cpp:
1099         (WebCore::WorkerThread::workerThreadCount):
1100         (WebCore::WorkerThread::WorkerThread):
1101         (WebCore::WorkerThread::~WorkerThread):
1102         (WebCore::WorkerThread::releaseFastMallocFreeMemoryInAllThreads):
1103
1104 2018-04-04  Youenn Fablet  <youenn@apple.com>
1105
1106         WebRTC data channel only applications require capture permissions for direct connections
1107         https://bugs.webkit.org/show_bug.cgi?id=174500
1108         <rdar://problem/34134281>
1109
1110         Reviewed by Eric Carlson.
1111
1112         Test: webrtc/datachannel/mdns-ice-candidates.html
1113
1114         Add support at PeerConnectionBackend to obfuscate any gathered host candidate
1115         by replacing the IP address with an opaque name that can be resolved by MDNS.
1116         An opaque name is generated for each IP address and is scoped by the document owning the peer connection object.
1117
1118         Add support to resolve any such MDNS ICE candidate.
1119         A limit of 250 ms is fixed for the resolution to happen.
1120         After 250 ms, the candidate is discarded.
1121
1122         Add an experimental flag around this feature, off by default.
1123
1124         * Modules/mediastream/PeerConnectionBackend.cpp:
1125         (WebCore::extractIPAddres):
1126         (WebCore::PeerConnectionBackend::addIceCandidate):
1127         (WebCore::PeerConnectionBackend::addIceCandidateSucceeded):
1128         (WebCore::PeerConnectionBackend::addIceCandidateFailed):
1129         (WebCore::PeerConnectionBackend::newICECandidate):
1130         (WebCore::PeerConnectionBackend::doneGatheringCandidates):
1131         (WebCore::PeerConnectionBackend::registerMDNSName):
1132         (WebCore::PeerConnectionBackend::finishedRegisteringMDNSName):
1133         * Modules/mediastream/PeerConnectionBackend.h:
1134         * Modules/mediastream/RTCIceCandidate.h:
1135         (WebCore::RTCIceCandidate::setCandidate):
1136         * Modules/mediastream/RTCPeerConnection.h:
1137         * dom/Document.cpp:
1138         (WebCore::Document::prepareForDestruction):
1139         (WebCore::Document::suspend):
1140         * page/RuntimeEnabledFeatures.h:
1141         (WebCore::RuntimeEnabledFeatures::mdnsICECandidatesEnabled const):
1142         (WebCore::RuntimeEnabledFeatures::setMDNSICECandidatesEnabled):
1143         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
1144
1145 2018-04-04  Brian Burg  <bburg@apple.com>
1146
1147         [Cocoa] WebDriver: test imported/w3c/webdriver/tests/cookies/add_cookie.py::test_add_non_session_cookie fails
1148         https://bugs.webkit.org/show_bug.cgi?id=184314
1149         <rdar://problem/39186578>
1150
1151         Reviewed by Timothy Hatcher.
1152
1153         Covered by several tests in add_cookie.py per the bug title.
1154
1155         * platform/network/cocoa/CookieCocoa.mm:
1156         (WebCore::Cookie::operator NSHTTPCookie * const):
1157         By converting an integral UNIX timestamp to |maxAge| fractional seconds into the future, we introduce unwanted
1158         precision that is truncated when switching back to a UNIX timestamp later. Always round up maxAge so that
1159         the truncated value and actual value are the same.
1160
1161 2018-04-04  Alex Christensen  <achristensen@webkit.org>
1162
1163         Move PingHandle to WebKitLegacy
1164         https://bugs.webkit.org/show_bug.cgi?id=184145
1165
1166         Reviewed by Youenn Fablet.
1167
1168         * WebCore.xcodeproj/project.pbxproj:
1169         * platform/network/PingHandle.h: Removed.
1170
1171 2018-04-04  Per Arne Vollan  <pvollan@apple.com>
1172
1173         The layout test fast/canvas/canvas-blending-global-alpha.html is failing when the WebContent process does not have WindowServer access.
1174         https://bugs.webkit.org/show_bug.cgi?id=183752
1175         <rdar://problem/38635731>
1176
1177         The test is failing because the system is only providing software rendering when there is no access
1178         to the WindowServer, and software rendering is producing slightly different results than hardware
1179         rendering. To enable accelerated rendering, the GPU to be used for IOSurface rendering needs to be
1180         selected by handing over the OpenGL display mask to the IOSurface CGContext.
1181
1182         Reviewed by Brent Fulgham.
1183
1184         No new tests, covered by existing tests.
1185
1186         * platform/graphics/GraphicsContext3D.h:
1187         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
1188         (WebCore::GraphicsContext3D::getOpenGLDisplayMask):
1189         * platform/graphics/cocoa/IOSurface.mm:
1190         (WebCore::IOSurface::ensurePlatformContext):
1191
1192 2018-04-04  Said Abou-Hallawa  <sabouhallawa@apple.com>
1193
1194         Track the paint frequency through a new class named PaintFrequencyTracker
1195         https://bugs.webkit.org/show_bug.cgi?id=184311
1196
1197         Reviewed by Antti Koivisto.
1198
1199         PaintFrequencyTracker is a class which detects when a layer is painted 
1200         frequently. SinglePaintFrequencyTracking is used in conjunction with
1201         PaintFrequencyTracker to recored a single paint timing.
1202
1203         * rendering/PaintFrequencyTracker.h: Added.
1204         (WebCore::PaintFrequencyTracker::begin):
1205         (WebCore::PaintFrequencyTracker::end):
1206         (WebCore::PaintFrequencyTracker::paintingFrequently const):
1207         Simplify the logic for tracking the paint frequency and move it from
1208         RenderLayer.cpp.
1209
1210         (WebCore::SinglePaintFrequencyTracking::SinglePaintFrequencyTracking):
1211         (WebCore::SinglePaintFrequencyTracking::~SinglePaintFrequencyTracking):
1212         A convenient way to bracket the begin() and the end() methods of
1213         PaintFrequencyTracker.
1214
1215         * rendering/RenderLayer.cpp:
1216         (WebCore::RenderLayer::paintLayerContents):
1217         (WebCore::RenderLayer::calculateClipRects const):
1218         (WebCore::PaintFrequencyInfo::PaintFrequencyInfo): Deleted.
1219         (WebCore::PaintFrequencyInfo::setPaintedCacheableResource): Deleted.
1220         (WebCore::PaintFrequencyInfo::paintingFrequently const): Deleted.
1221         (WebCore::PaintFrequencyInfo::updatePaintFrequency): Deleted.
1222         (WebCore::PaintFrequencyInfo::paintingCacheableResource): Deleted.
1223         * rendering/RenderLayer.h:
1224         Rename PaintFrequencyInfo to PaintFrequencyTracker and move it a separate
1225         header file.
1226
1227 2018-04-04  Jer Noble  <jer.noble@apple.com>
1228
1229         RELEASE_ASSERT in CaptionUserPreferencesMediaAF::CaptionUserPreferencesMediaAF() when MediaToolbox.framework missing
1230         https://bugs.webkit.org/show_bug.cgi?id=184247
1231         <rdar://problem/39007591>
1232
1233         Rubber-stamped by Eric Carlson.
1234
1235         Use SOFT_LINK_FRAMEWORK_OPTIONAL for frameworks which are not guaranteed to be present.
1236
1237         * page/CaptionUserPreferencesMediaAF.cpp:
1238         (WebCore::CaptionUserPreferencesMediaAF::CaptionUserPreferencesMediaAF):
1239
1240 2018-04-04  Brent Fulgham  <bfulgham@apple.com>
1241
1242         Failures from mach port reference handling should be fatal
1243         https://bugs.webkit.org/show_bug.cgi?id=184202
1244         <rdar://problem/37771114>
1245
1246         Reviewed by Anders Carlsson.
1247
1248         We may corrupt the Mach port space by improperly matching the equivalent of reference counting
1249         retains (mach_port_mod_refs) with releases (mach_port_deallocate).
1250
1251         Our current implementation of MachSendRights::create does not grab a reference if the passed
1252         port is MACH_PORT_DEAD, but we unconditionally call mach_port_deallocate on the port, which
1253         could lead to a reference count mismatch.
1254
1255         Likewise, our MachSendRight destructor does not release the port if it has changed to MACH_PORT_DEAD
1256         (e.g., if a child process dies), again leading to a mismatch in retain/releases.
1257
1258         Finally, failures in mach_port_deallocate should be fatal because they indicate that the
1259         application was attempting to remove an unowned right. This is a fatal condition for Mach, and
1260         should lead to an abort. 
1261
1262         This patch does the following:
1263
1264         1. It creates a helper function that does the right thing for safely deallocating a mach port.
1265         2. It uses it in multiple places.
1266         3. It revises 'MachSendRight::create" so that it properly handles the condition of a dead port.
1267         4. It revises the MachSendRight destructor to properly handle the condition of a dead port.
1268
1269         No new tests, no change in behavior expected.
1270
1271         * SourcesCocoa.txt: Update for move of MachSendRight files.
1272         * WebCore.xcodeproj/project.pbxproj: Ditto.
1273         * page/cocoa/ResourceUsageThreadCocoa.mm:
1274         (WebCore::getMachThreads): Added.
1275         (WebCore::cpuUsage): Use the new cleanup helper function.
1276         * platform/cocoa/MachSendRight.cpp: Removed.
1277         * platform/cocoa/MachSendRight.h: Removed.
1278         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm:
1279         (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenLayer):
1280         * platform/graphics/cocoa/IOSurface.h:
1281         * platform/graphics/cocoa/IOSurface.mm:
1282
1283 2018-04-04  Youenn Fablet  <youenn@apple.com>
1284
1285         Remove unused HTTP header names
1286         https://bugs.webkit.org/show_bug.cgi?id=184272
1287
1288         Reviewed by Alex Christensen.
1289
1290         No change of behavior.
1291         Removed some names that are not used in the code base.
1292         This allows to strengthen filtering of responses sent to WebProcess.
1293         Added two headers used by web inspector.
1294         Updated existing code to use indexed HTTP header names.
1295
1296         * html/parser/XSSAuditor.cpp:
1297         (WebCore::XSSAuditor::init):
1298         * inspector/agents/InspectorPageAgent.cpp:
1299         (WebCore::InspectorPageAgent::sourceMapURLForResource):
1300         * platform/network/HTTPHeaderNames.in:
1301
1302 2018-04-04  Beth Dakin  <bdakin@apple.com>
1303
1304         Fix the !HAVE(AVFOUNDATION_VIDEO_OUTPUT) build
1305         https://bugs.webkit.org/show_bug.cgi?id=184309
1306         -and corresponding-
1307         rdar://problem/39179126
1308
1309         Reviewed by Jer Noble.
1310
1311         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1312         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoFullscreenInlineImage):
1313         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenLayer):
1314
1315 2018-04-04  Youenn Fablet  <youenn@apple.com>
1316
1317         MockRealtimeVideoSourceMac should produce kCVPixelFormatType_420YpCbCr8Planar buffers
1318         https://bugs.webkit.org/show_bug.cgi?id=184304
1319
1320         Reviewed by Eric Carlson.
1321
1322         Allows covering RealtimeOutgoingVideoSourceMac code path handling native buffers produced by capture video sources.
1323         ARGB buffer coverage is done through canvas capture streams.
1324
1325         * platform/mediastream/mac/MockRealtimeVideoSourceMac.h:
1326         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
1327         (WebCore::MockRealtimeVideoSourceMac::CMSampleBufferFromPixelBuffer):
1328
1329 2018-04-04  Youenn Fablet  <youenn@apple.com>
1330
1331         Introduce a ThreadSafeRefCounted parameter to ensure being destroyed on the main thread
1332         https://bugs.webkit.org/show_bug.cgi?id=183988
1333
1334         Reviewed by Darin Adler.
1335
1336         No change of behavior, TrackPrivate remains destroyed on the main thread.
1337
1338         * platform/graphics/TrackPrivateBase.h:
1339         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
1340         (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable):
1341         (WebCore::AudioTrackPrivateMediaStreamCocoa::render):
1342
1343 2018-04-04  Carlos Garcia Campos  <cgarcia@igalia.com>
1344
1345         Unreviewed. Fix the build with libsoup < 2.49.91 after r230251.
1346
1347         Stop using ResourceHandle in SoupNetworkSession.
1348
1349         * platform/network/soup/SoupNetworkSession.cpp:
1350         (WebCore::SoupNetworkSession::SoupNetworkSession):
1351         (WebCore::authenticateCallback): Deleted.
1352         (WebCore::requestStartedCallback): Deleted.
1353
1354 2018-04-03  Alex Christensen  <achristensen@webkit.org>
1355
1356         Remove unused libsoup ResourceHandle implementation
1357         https://bugs.webkit.org/show_bug.cgi?id=184048
1358
1359         Reviewed by Michael Catanzaro.
1360
1361         This code is unused since r228901 so let's remove it!
1362
1363         * platform/network/ResourceHandle.h:
1364         * platform/network/ResourceHandleInternal.h:
1365         (WebCore::ResourceHandleInternal::ResourceHandleInternal):
1366         * platform/network/soup/ResourceHandleSoup.cpp:
1367         (WebCore::ResourceHandle::~ResourceHandle):
1368         (WebCore::ResourceHandleInternal::soupSession):
1369         (WebCore::ResourceHandle::cancelledOrClientless):
1370         (WebCore::ResourceHandle::ensureReadBuffer):
1371         (WebCore::ResourceHandle::currentStreamPosition const):
1372         (WebCore::ResourceHandle::platformContinueSynchronousDidReceiveResponse):
1373         (WebCore::ResourceHandle::didStartRequest):
1374         (WebCore::ResourceHandle::start):
1375         (WebCore::ResourceHandle::releaseForDownload):
1376         (WebCore::ResourceHandle::sendPendingRequest):
1377         (WebCore::ResourceHandle::cancel):
1378         (WebCore::ResourceHandle::shouldUseCredentialStorage):
1379         (WebCore::ResourceHandle::continueDidReceiveAuthenticationChallenge):
1380         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
1381         (WebCore::ResourceHandle::receivedRequestToContinueWithoutCredential):
1382         (WebCore::ResourceHandle::receivedCredential):
1383         (WebCore::ResourceHandle::receivedCancellation):
1384         (WebCore::ResourceHandle::receivedChallengeRejection):
1385         (WebCore::ResourceHandle::platformSetDefersLoading):
1386         (WebCore::sessionFromContext): Deleted.
1387         (WebCore::ResourceHandle::create): Deleted.
1388         (WebCore::ResourceHandle::ResourceHandle): Deleted.
1389         (WebCore::isAuthenticationFailureStatusCode): Deleted.
1390         (WebCore::tlsErrorsChangedCallback): Deleted.
1391         (WebCore::gotHeadersCallback): Deleted.
1392         (WebCore::applyAuthenticationToRequest): Deleted.
1393         (WebCore::restartedCallback): Deleted.
1394         (WebCore::shouldRedirect): Deleted.
1395         (WebCore::shouldRedirectAsGET): Deleted.
1396         (WebCore::continueAfterWillSendRequest): Deleted.
1397         (WebCore::doRedirect): Deleted.
1398         (WebCore::redirectSkipCallback): Deleted.
1399         (WebCore::wroteBodyDataCallback): Deleted.
1400         (WebCore::cleanupSoupRequestOperation): Deleted.
1401         (WebCore::nextMultipartResponsePartCallback): Deleted.
1402         (WebCore::sendRequestCallback): Deleted.
1403         (WebCore::continueAfterDidReceiveResponse): Deleted.
1404         (WebCore::startingCallback): Deleted.
1405         (WebCore::networkEventCallback): Deleted.
1406         (WebCore::createSoupMessageForHandleAndRequest): Deleted.
1407         (WebCore::createSoupRequestAndMessageForHandle): Deleted.
1408         (WebCore::ResourceHandle::timeoutFired): Deleted.
1409         (WebCore::waitingToSendRequest): Deleted.
1410         (WebCore::readCallback): Deleted.
1411
1412 2018-04-03  Ross Kirsling  <ross.kirsling@sony.com>
1413
1414         Add missing WEBCORE_EXPORTs (for Windows shared library build)
1415         https://bugs.webkit.org/show_bug.cgi?id=184279
1416
1417         Reviewed by Alex Christensen.
1418
1419         * dom/Element.h:
1420         * dom/Node.h:
1421         * editing/FrameSelection.h:
1422         * html/DOMURL.h:
1423         * html/HTMLFormElement.h:
1424         * html/canvas/CanvasRenderingContext.h:
1425         * platform/graphics/GraphicsContext.h:
1426         * platform/graphics/PlatformDisplay.h:
1427         * platform/graphics/cairo/CairoOperations.h:
1428         * platform/graphics/cairo/GraphicsContextImplCairo.h:
1429         * platform/graphics/texmap/TextureMapperLayer.h:
1430         * platform/network/HTTPHeaderMap.h:
1431         * platform/network/ResourceRequestBase.h:
1432         * platform/network/ResourceResponseBase.h:
1433         * platform/network/curl/AuthenticationChallenge.h:
1434         * platform/network/curl/CurlFormDataStream.h:
1435         * platform/network/curl/CurlRequest.h:
1436         * platform/network/curl/CurlSSLHandle.h:
1437         * platform/network/curl/ResourceError.h:
1438         * platform/network/curl/ResourceResponse.h:
1439
1440 2018-04-03  Youenn Fablet  <youenn@apple.com>
1441
1442         RealtimeOutgoingVideoSourceMac should pass a ObjCFrameBuffer buffer
1443         https://bugs.webkit.org/show_bug.cgi?id=184281
1444         rdar://problem/39153262
1445
1446         Reviewed by Jer Noble.
1447
1448         Covered by manual testing by going to WebRTC web sites.
1449
1450         * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp:
1451         (WebCore::RealtimeOutgoingVideoSourceCocoa::sampleBufferUpdated):
1452
1453 2018-04-03  Filip Pizlo  <fpizlo@apple.com>
1454
1455         GC shouldn't do object distancing
1456         https://bugs.webkit.org/show_bug.cgi?id=184195
1457
1458         Reviewed by Saam Barati.
1459
1460         No new tests because no change in behavior.
1461
1462         * Sources.txt:
1463         * WebCore.xcodeproj/project.pbxproj:
1464         * bindings/js/JSDOMGlobalObject.cpp:
1465         (WebCore::JSDOMGlobalObject::JSDOMGlobalObject):
1466         * bindings/js/JSDOMGlobalObject.h:
1467         * bindings/js/JSDOMWindowBase.cpp:
1468         (WebCore::JSDOMWindowBase::JSDOMWindowBase):
1469         * dom/Document.cpp:
1470         (WebCore::Document::threadLocalCache): Deleted.
1471         * dom/Document.h:
1472         * page/OriginThreadLocalCache.cpp: Removed.
1473         * page/OriginThreadLocalCache.h: Removed.
1474
1475 2018-04-03  Brent Fulgham  <bfulgham@apple.com>
1476
1477         Guard against keychain/certificate access outside the network process
1478         https://bugs.webkit.org/show_bug.cgi?id=184214
1479         <rdar://problem/38734795>
1480
1481         Reviewed by Youenn Fablet.
1482
1483         Use the ProcessPrivilege assertions to guard against accessing the Keychain from
1484         a non-Networking process.
1485
1486         * Modules/webauthn/cocoa/LocalAuthenticator.mm:
1487         (WebCore::LocalAuthenticator::makeCredential): Assert if we access the keychain from
1488         a proces other than the Network or UI process.
1489         (WebCore::LocalAuthenticator::getAssertion): Ditto.
1490         (WebCore::LocalAuthenticator::issueClientCertificate const): Ditto.
1491         * crypto/mac/SerializedCryptoKeyWrapMac.mm:
1492         (WebCore::createAndStoreMasterKey): Ditto.
1493         (WebCore::findMasterKey): Ditto.
1494         (WebCore::deleteDefaultWebCryptoMasterKey): Ditto.
1495         * platform/mac/SSLKeyGeneratorMac.mm:
1496         (WebCore::signedPublicKeyAndChallengeString): Ditto.
1497         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
1498         (WebCore::createPrivateStorageSession): Ditto.
1499         * platform/network/mac/ResourceHandleMac.mm:
1500         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge): Ditto.
1501
1502 2018-04-03  Youenn Fablet  <youenn@apple.com>
1503
1504         NetworkResourceLoader does not need to expose all redirect response headers
1505         https://bugs.webkit.org/show_bug.cgi?id=184114
1506         <rdar://problem/39010557>
1507
1508         Reviewed by Ryosuke Niwa.
1509
1510         No JS observable change of behavior.
1511         Behavior change is observable for injected bundles since they will no longer get access to the full response.
1512         List of response headers correspond to the one currently being used/exposed for redirections.
1513
1514         Test: http/wpt/loading/redirect-headers.html
1515
1516         * page/RuntimeEnabledFeatures.h:
1517         (WebCore::RuntimeEnabledFeatures::setRestrictedHTTPResponseAccess):
1518         (WebCore::RuntimeEnabledFeatures::restrictedHTTPResponseAccess const):
1519         * platform/network/ResourceResponseBase.cpp:
1520         (WebCore::isSafeToKeepRedirectionHeader):
1521         (WebCore::ResourceResponseBase::sanitizeRedirectionHTTPHeaderFields):
1522         * platform/network/ResourceResponseBase.h:
1523
1524 2018-04-03  Andy Estes  <aestes@apple.com>
1525
1526         [Mac] Prioritize file promises over filenames during drag and drop
1527         https://bugs.webkit.org/show_bug.cgi?id=184237
1528         <rdar://problem/38278076>
1529
1530         Reviewed by Wenson Hsieh.
1531
1532         When performing a drag operation where the pasteboard contains both a file path and a file
1533         promise, we have historically preferred to accept the file path. Some versions of Photos.app
1534         will provide both a low-resolution thumbnail as a file path and its high-resolution
1535         counterpart as a file promise when dragging a photo, and our current logic leads us to
1536         choose the low-quality thumbnail.
1537
1538         This patch changes our logic to prefer file promises over file paths. This matches the
1539         behavior of Finder and ensures we accept high-resolution assets from Photos.app.
1540
1541         Covered by existing file promise drag tests. beginDragWithFilePromises() was updated to
1542         write a bogus file path to the pasteboard along with the legitimate file promise.
1543
1544         * platform/mac/DragDataMac.mm:
1545         (WebCore::DragData::asFilenames const):
1546         * platform/mac/PasteboardMac.mm:
1547         (WebCore::Pasteboard::read):
1548         (WebCore::Pasteboard::readFilePaths):
1549         * platform/mac/PlatformPasteboardMac.mm:
1550         (WebCore::PlatformPasteboard::numberOfFiles const):
1551
1552 2018-04-03  Mark Lam  <mark.lam@apple.com>
1553
1554         Fix mis-application of WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION macro.
1555         https://bugs.webkit.org/show_bug.cgi?id=184276
1556         <rdar://problem/39109543>
1557
1558         Rubber-stamped by Michael Saboff.
1559
1560         * bindings/scripts/CodeGeneratorJS.pm:
1561         (GenerateImplementation):
1562         * bindings/scripts/test/JS/JSInterfaceName.cpp:
1563         (WebCore::toJSNewlyCreated):
1564         * bindings/scripts/test/JS/JSMapLike.cpp:
1565         (WebCore::toJSNewlyCreated):
1566         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
1567         (WebCore::toJSNewlyCreated):
1568         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
1569         (WebCore::toJSNewlyCreated):
1570         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
1571         (WebCore::toJSNewlyCreated):
1572         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
1573         (WebCore::toJSNewlyCreated):
1574         * bindings/scripts/test/JS/JSTestCallTracer.cpp:
1575         (WebCore::toJSNewlyCreated):
1576         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
1577         (WebCore::toJSNewlyCreated):
1578         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
1579         (WebCore::toJSNewlyCreated):
1580         * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp:
1581         (WebCore::toJSNewlyCreated):
1582         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
1583         (WebCore::toJSNewlyCreated):
1584         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
1585         (WebCore::toJSNewlyCreated):
1586         * bindings/scripts/test/JS/JSTestException.cpp:
1587         (WebCore::toJSNewlyCreated):
1588         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
1589         (WebCore::toJSNewlyCreated):
1590         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
1591         (WebCore::toJSNewlyCreated):
1592         * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp:
1593         (WebCore::toJSNewlyCreated):
1594         * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp:
1595         (WebCore::toJSNewlyCreated):
1596         * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp:
1597         (WebCore::toJSNewlyCreated):
1598         * bindings/scripts/test/JS/JSTestIterable.cpp:
1599         (WebCore::toJSNewlyCreated):
1600         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
1601         (WebCore::toJSNewlyCreated):
1602         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp:
1603         (WebCore::toJSNewlyCreated):
1604         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp:
1605         (WebCore::toJSNewlyCreated):
1606         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp:
1607         (WebCore::toJSNewlyCreated):
1608         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
1609         (WebCore::toJSNewlyCreated):
1610         * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp:
1611         (WebCore::toJSNewlyCreated):
1612         * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp:
1613         (WebCore::toJSNewlyCreated):
1614         * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp:
1615         (WebCore::toJSNewlyCreated):
1616         * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp:
1617         (WebCore::toJSNewlyCreated):
1618         * bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp:
1619         (WebCore::toJSNewlyCreated):
1620         * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp:
1621         (WebCore::toJSNewlyCreated):
1622         * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp:
1623         (WebCore::toJSNewlyCreated):
1624         * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp:
1625         (WebCore::toJSNewlyCreated):
1626         * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp:
1627         (WebCore::toJSNewlyCreated):
1628         * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp:
1629         (WebCore::toJSNewlyCreated):
1630         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp:
1631         (WebCore::toJSNewlyCreated):
1632         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp:
1633         (WebCore::toJSNewlyCreated):
1634         * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp:
1635         (WebCore::toJSNewlyCreated):
1636         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp:
1637         (WebCore::toJSNewlyCreated):
1638         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp:
1639         (WebCore::toJSNewlyCreated):
1640         * bindings/scripts/test/JS/JSTestNode.cpp:
1641         (WebCore::toJSNewlyCreated):
1642         * bindings/scripts/test/JS/JSTestObj.cpp:
1643         (WebCore::toJSNewlyCreated):
1644         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
1645         (WebCore::toJSNewlyCreated):
1646         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
1647         (WebCore::toJSNewlyCreated):
1648         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
1649         (WebCore::toJSNewlyCreated):
1650         * bindings/scripts/test/JS/JSTestPluginInterface.cpp:
1651         (WebCore::toJSNewlyCreated):
1652         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
1653         (WebCore::toJSNewlyCreated):
1654         * bindings/scripts/test/JS/JSTestSerialization.cpp:
1655         (WebCore::toJSNewlyCreated):
1656         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
1657         (WebCore::toJSNewlyCreated):
1658         * bindings/scripts/test/JS/JSTestStringifier.cpp:
1659         (WebCore::toJSNewlyCreated):
1660         * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp:
1661         (WebCore::toJSNewlyCreated):
1662         * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp:
1663         (WebCore::toJSNewlyCreated):
1664         * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp:
1665         (WebCore::toJSNewlyCreated):
1666         * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp:
1667         (WebCore::toJSNewlyCreated):
1668         * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp:
1669         (WebCore::toJSNewlyCreated):
1670         * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp:
1671         (WebCore::toJSNewlyCreated):
1672         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
1673         (WebCore::toJSNewlyCreated):
1674
1675 2018-04-03  Yousuke Kimoto  <yousuke.kimoto@sony.com>
1676
1677         [CMake] gperf path should be given when WebCore/css/makevalues.pl is executed
1678         https://bugs.webkit.org/show_bug.cgi?id=184224
1679
1680         Reviewed by Konstantin Tokarev.
1681
1682         When a building evironment doens't include a path to gperf,
1683         WebCore/css/makevalue.pl failes due to failing to execute gperf,
1684         so the full path to gperf should be given like WebCore/css/makeprop.pl.
1685
1686         No new tests, no Web-facing behavior change.
1687
1688         * CMakeLists.txt: gperf path is given to css/makevalues.pl.
1689         * css/makevalues.pl: Add an argument to handle a given gperf path.
1690
1691 2018-04-03  Chris Dumez  <cdumez@apple.com>
1692
1693         Drop MainFrame class
1694         https://bugs.webkit.org/show_bug.cgi?id=184191
1695
1696         Reviewed by Darin Adler.
1697
1698         Drop MainFrame class and move contents into Page / Frame since there is a 1:1
1699         relationship between the Page and the MainFrame.
1700
1701         This is ground work for introducing LocalFrame / RemoteFrame concepts.
1702
1703         * Modules/applepay/ApplePaySession.cpp:
1704         (WebCore::ApplePaySession::create):
1705         (WebCore::ApplePaySession::supportsVersion):
1706         (WebCore::ApplePaySession::canMakePayments):
1707         (WebCore::ApplePaySession::canMakePaymentsWithActiveCard):
1708         (WebCore::ApplePaySession::openPaymentSetup):
1709         (WebCore::ApplePaySession::paymentCoordinator const):
1710         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
1711         (WebCore::paymentCoordinator):
1712         * Modules/mediastream/MediaDevicesEnumerationRequest.cpp:
1713         * Modules/mediastream/UserMediaRequest.cpp:
1714         * Modules/plugins/QuickTimePluginReplacement.mm:
1715         * Sources.txt:
1716         * WebCore.xcodeproj/project.pbxproj:
1717         * accessibility/AccessibilityObject.cpp:
1718         (WebCore::AccessibilityObject::mainFrame const):
1719         (WebCore::AccessibilityObject::visiblePositionForBounds const):
1720         * accessibility/AccessibilityObject.h:
1721         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1722         * bindings/js/ScriptController.cpp:
1723         * bindings/js/ScriptState.cpp:
1724         * contentextensions/ContentExtensionsBackend.cpp:
1725         * css/MediaQueryEvaluator.cpp:
1726         (WebCore::displayModeEvaluate):
1727         * dom/DOMImplementation.cpp:
1728         * dom/Document.cpp:
1729         * dom/DocumentMarkerController.cpp:
1730         * dom/Element.cpp:
1731         (WebCore::Element::removedFromAncestor):
1732         * dom/EventDispatcher.cpp:
1733         * dom/ScriptedAnimationController.cpp:
1734         * editing/Editor.cpp:
1735         (WebCore::Editor::scanSelectionForTelephoneNumbers):
1736         * editing/EditorCommand.cpp:
1737         * editing/SelectionRectGatherer.cpp:
1738         (WebCore::SelectionRectGatherer::Notifier::~Notifier):
1739         * editing/cocoa/WebContentReaderCocoa.mm:
1740         * editing/markup.cpp:
1741         * history/CachedFrame.cpp:
1742         * history/CachedPage.cpp:
1743         * history/PageCache.cpp:
1744         (WebCore::destroyRenderTree):
1745         * html/HTMLMediaElement.cpp:
1746         * html/HTMLPlugInImageElement.cpp:
1747         * html/ImageDocument.cpp:
1748         * html/MediaElementSession.cpp:
1749         (WebCore::isMainContentForPurposesOfAutoplay):
1750         * html/canvas/WebGLRenderingContextBase.cpp:
1751         * inspector/InspectorClient.cpp:
1752         * inspector/InspectorController.cpp:
1753         * inspector/InspectorFrontendClientLocal.cpp:
1754         * inspector/InspectorFrontendHost.cpp:
1755         * inspector/InspectorInstrumentation.cpp:
1756         * inspector/InspectorOverlay.cpp:
1757         * inspector/PageScriptDebugServer.cpp:
1758         * inspector/agents/InspectorApplicationCacheAgent.cpp:
1759         * inspector/agents/InspectorCanvasAgent.cpp:
1760         * inspector/agents/InspectorDOMAgent.cpp:
1761         * inspector/agents/InspectorPageAgent.cpp:
1762         (WebCore::InspectorPageAgent::mainFrame):
1763         * inspector/agents/InspectorPageAgent.h:
1764         * inspector/agents/page/PageDebuggerAgent.cpp:
1765         * inspector/agents/page/PageRuntimeAgent.cpp:
1766         * loader/DocumentLoader.cpp:
1767         * loader/DocumentWriter.cpp:
1768         * loader/FrameLoader.cpp:
1769         (WebCore::FrameLoader::loadWithDocumentLoader):
1770         (WebCore::FrameLoader::setState):
1771         * loader/HistoryController.cpp:
1772         * loader/NavigationDisabler.h:
1773         * loader/ProgressTracker.cpp:
1774         * loader/ResourceLoadObserver.cpp:
1775         * loader/ResourceLoader.cpp:
1776         * loader/SubframeLoader.cpp:
1777         * loader/SubresourceLoader.cpp:
1778         * loader/appcache/ApplicationCacheHost.cpp:
1779         * loader/archive/mhtml/MHTMLArchive.cpp:
1780         * loader/cache/CachedResource.cpp:
1781         * loader/cache/CachedResourceLoader.cpp:
1782         * page/AutoscrollController.cpp:
1783         * page/Chrome.cpp:
1784         * page/ContextMenuController.cpp:
1785         * page/DOMWindow.cpp:
1786         * page/DebugPageOverlays.cpp:
1787         (WebCore::MouseWheelRegionOverlay::updateRegion):
1788         (WebCore::NonFastScrollableRegionOverlay::updateRegion):
1789         (WebCore::RegionOverlay::create):
1790         (WebCore::RegionOverlay::RegionOverlay):
1791         (WebCore::RegionOverlay::~RegionOverlay):
1792         (WebCore::DebugPageOverlays::ensureRegionOverlayForPage):
1793         (WebCore::DebugPageOverlays::showRegionOverlay):
1794         (WebCore::DebugPageOverlays::hideRegionOverlay):
1795         (WebCore::DebugPageOverlays::regionChanged):
1796         (WebCore::DebugPageOverlays::regionOverlayForPage const):
1797         (WebCore::DebugPageOverlays::updateOverlayRegionVisibility):
1798         (WebCore::DebugPageOverlays::settingsChanged):
1799         * page/DebugPageOverlays.h:
1800         (WebCore::DebugPageOverlays::hasOverlaysForPage const):
1801         (WebCore::DebugPageOverlays::hasOverlays):
1802         (WebCore::DebugPageOverlays::didLayout):
1803         (WebCore::DebugPageOverlays::didChangeEventHandlers):
1804         * page/DragController.cpp:
1805         (WebCore::DragController::performDragOperation):
1806         (WebCore::DragController::tryDHTMLDrag):
1807         (WebCore::DragController::beginDrag):
1808         (WebCore::DragController::doSystemDrag):
1809         * page/EventHandler.cpp:
1810         (WebCore::EventHandler::handleMousePressEvent):
1811         (WebCore::EventHandler::mouseMoved):
1812         (WebCore::EventHandler::handleMouseReleaseEvent):
1813         (WebCore::EventHandler::handleWheelEvent):
1814         (WebCore::EventHandler::clearLatchedState):
1815         (WebCore::EventHandler::defaultWheelEventHandler):
1816         * page/FocusController.cpp:
1817         * page/Frame.cpp:
1818         (WebCore::Frame::Frame):
1819         (WebCore::Frame::dropChildren):
1820         (WebCore::Frame::selfOnlyRef):
1821         (WebCore::Frame::selfOnlyDeref):
1822         * page/Frame.h:
1823         (WebCore::Frame::mainFrame const):
1824         * page/FrameTree.cpp:
1825         * page/FrameView.cpp:
1826         (WebCore::FrameView::setFrameRect):
1827         (WebCore::FrameView::setContentsSize):
1828         (WebCore::FrameView::didChangeScrollOffset):
1829         (WebCore::FrameView::setViewExposedRect):
1830         * page/History.cpp:
1831         * page/MainFrame.cpp: Removed.
1832         * page/MainFrame.h: Removed.
1833         * page/MemoryRelease.cpp:
1834         * page/Page.cpp:
1835         (WebCore::Page::Page):
1836         (WebCore::m_applicationManifest):
1837         (WebCore::Page::setDeviceScaleFactor):
1838         (WebCore::Page::latchingState):
1839         (WebCore::Page::pushNewLatchingState):
1840         (WebCore::Page::resetLatchingState):
1841         (WebCore::Page::popLatchingState):
1842         (WebCore::Page::removeLatchingStateForTarget):
1843         (WebCore::Page::setPaymentCoordinator):
1844         * page/Page.h:
1845         (WebCore::Page::mainFrame):
1846         (WebCore::Page::mainFrame const):
1847         (WebCore::Page::wheelEventDeltaFilter):
1848         (WebCore::Page::pageOverlayController):
1849         (WebCore::Page::servicesOverlayController):
1850         (WebCore::Page::paymentCoordinator const):
1851         (WebCore::Page::applicationManifest const):
1852         (WebCore::Page::performanceLogging const):
1853         * page/PageConsoleClient.cpp:
1854         * page/PageDebuggable.cpp:
1855         * page/PageGroup.cpp:
1856         * page/PageGroupLoadDeferrer.cpp:
1857         * page/PageOverlay.cpp:
1858         (WebCore::PageOverlay::controller const):
1859         * page/PageOverlayController.cpp:
1860         (WebCore::PageOverlayController::PageOverlayController):
1861         (WebCore::PageOverlayController::createRootLayersIfNeeded):
1862         (WebCore::PageOverlayController::layerWithDocumentOverlays):
1863         (WebCore::PageOverlayController::layerWithViewOverlays):
1864         (WebCore::PageOverlayController::installPageOverlay):
1865         (WebCore::PageOverlayController::updateForceSynchronousScrollLayerPositionUpdates):
1866         (WebCore::PageOverlayController::didChangeViewExposedRect):
1867         (WebCore::PageOverlayController::updateSettingsForLayer):
1868         (WebCore::PageOverlayController::deviceScaleFactor const):
1869         (WebCore::PageOverlayController::notifyFlushRequired):
1870         (WebCore::PageOverlayController::tiledBackingUsageChanged):
1871         * page/PageOverlayController.h:
1872         * page/PageSerializer.cpp:
1873         * page/PerformanceLogging.cpp:
1874         (WebCore::PerformanceLogging::PerformanceLogging):
1875         (WebCore::PerformanceLogging::didReachPointOfInterest):
1876         * page/PerformanceLogging.h:
1877         * page/PerformanceMonitor.cpp:
1878         * page/ResourceUsageOverlay.cpp:
1879         (WebCore::ResourceUsageOverlay::~ResourceUsageOverlay):
1880         (WebCore::ResourceUsageOverlay::initialize):
1881         * page/SettingsBase.cpp:
1882         * page/SpatialNavigation.cpp:
1883         * page/UserContentProvider.cpp:
1884         * page/ios/FrameIOS.mm:
1885         * page/mac/DragControllerMac.mm:
1886         * page/mac/EventHandlerMac.mm:
1887         (WebCore::latchingIsLockedToPlatformFrame):
1888         (WebCore::latchingIsLockedToAncestorOfThisFrame):
1889         (WebCore::EventHandler::clearOrScheduleClearingLatchedStateIfNeeded):
1890         (WebCore::EventHandler::platformPrepareForWheelEvents):
1891         (WebCore::EventHandler::platformRecordWheelEvent):
1892         (WebCore::EventHandler::platformCompleteWheelEvent):
1893         (WebCore::EventHandler::platformCompletePlatformWidgetWheelEvent):
1894         * page/mac/PageMac.mm:
1895         * page/mac/ServicesOverlayController.h:
1896         (WebCore::ServicesOverlayController::page const):
1897         * page/mac/ServicesOverlayController.mm:
1898         (WebCore::ServicesOverlayController::Highlight::Highlight):
1899         (WebCore::ServicesOverlayController::Highlight::notifyFlushRequired):
1900         (WebCore::ServicesOverlayController::Highlight::deviceScaleFactor const):
1901         (WebCore::ServicesOverlayController::ServicesOverlayController):
1902         (WebCore::ServicesOverlayController::invalidateHighlightsOfType):
1903         (WebCore::ServicesOverlayController::buildPotentialHighlightsIfNeeded):
1904         (WebCore::ServicesOverlayController::remainingTimeUntilHighlightShouldBeShown const):
1905         (WebCore::ServicesOverlayController::buildPhoneNumberHighlights):
1906         (WebCore::ServicesOverlayController::buildSelectionHighlight):
1907         (WebCore::ServicesOverlayController::hasRelevantSelectionServices):
1908         (WebCore::ServicesOverlayController::createOverlayIfNeeded):
1909         (WebCore::ServicesOverlayController::telephoneNumberRangesForFocusedFrame):
1910         (WebCore::ServicesOverlayController::findTelephoneNumberHighlightContainingSelectionHighlight):
1911         (WebCore::ServicesOverlayController::mouseEvent):
1912         (WebCore::ServicesOverlayController::handleClick):
1913         (WebCore::ServicesOverlayController::mainFrame const):
1914         * page/scrolling/AsyncScrollingCoordinator.cpp:
1915         * page/scrolling/ScrollingCoordinator.cpp:
1916         * page/scrolling/ios/ScrollingCoordinatorIOS.mm:
1917         * page/scrolling/mac/ScrollingCoordinatorMac.mm:
1918         * platform/graphics/ca/win/CACFLayerTreeHost.cpp:
1919         * plugins/DOMMimeType.cpp:
1920         * plugins/PluginInfoProvider.cpp:
1921         (WebCore::PluginInfoProvider::refresh):
1922         * rendering/RenderBox.cpp:
1923         * rendering/RenderLayer.cpp:
1924         * rendering/RenderLayerBacking.cpp:
1925         * rendering/RenderLayerCompositor.cpp:
1926         (WebCore::RenderLayerCompositor::hasAnyAdditionalCompositedLayers const):
1927         (WebCore::RenderLayerCompositor::updateCompositingLayers):
1928         (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers):
1929         (WebCore::RenderLayerCompositor::attachRootLayer):
1930         (WebCore::RenderLayerCompositor::detachRootLayer):
1931         (WebCore::RenderLayerCompositor::rootLayerAttachmentChanged):
1932         * rendering/RenderObject.cpp:
1933         * replay/UserInputBridge.cpp:
1934         * storage/StorageEventDispatcher.cpp:
1935         * style/StyleTreeResolver.cpp:
1936         (WebCore::Style::suspendMemoryCacheClientCalls):
1937         * svg/SVGSVGElement.cpp:
1938         * svg/graphics/SVGImage.cpp:
1939         * testing/InternalSettings.cpp:
1940         * testing/Internals.cpp:
1941         (WebCore::Internals::Internals):
1942         (WebCore::Internals::installMockPageOverlay):
1943         (WebCore::Internals::pageOverlayLayerTreeAsText const):
1944         * testing/MockPageOverlay.cpp:
1945         * testing/MockPageOverlay.h:
1946         * testing/MockPageOverlayClient.cpp:
1947         (WebCore::MockPageOverlayClient::installOverlay):
1948         (WebCore::MockPageOverlayClient::layerTreeAsText):
1949         * testing/MockPageOverlayClient.h:
1950         * testing/MockPaymentCoordinator.cpp:
1951         (WebCore::MockPaymentCoordinator::MockPaymentCoordinator):
1952         (WebCore::MockPaymentCoordinator::showPaymentUI):
1953         (WebCore::MockPaymentCoordinator::completeMerchantValidation):
1954         (WebCore::MockPaymentCoordinator::changeShippingOption):
1955         (WebCore::MockPaymentCoordinator::changePaymentMethod):
1956         (WebCore::MockPaymentCoordinator::acceptPayment):
1957         (WebCore::MockPaymentCoordinator::cancelPayment):
1958         * testing/MockPaymentCoordinator.h:
1959         * workers/service/context/ServiceWorkerThreadProxy.cpp:
1960
1961 2018-04-03  Sihui Liu  <sihui_liu@apple.com>
1962
1963         The referer header is not set after redirect
1964         https://bugs.webkit.org/show_bug.cgi?id=182644
1965         <rdar://problem/37479048>
1966
1967         Reviewed by Youenn Fablet.
1968
1969         Update referrer policy and recompute referrer in redirection check, so Referer header would be set after it's removed from cross-origin request.
1970
1971         Add support for Referrer-Policy header, so referrer policy would be changed based on redirect response. 
1972
1973         * Sources.txt:
1974         * WebCore.xcodeproj/project.pbxproj:
1975         * dom/Document.cpp:
1976         (WebCore::Document::processReferrerPolicy):
1977         * loader/CrossOriginAccessControl.cpp:
1978         (WebCore::updateRequestReferrer):
1979         * loader/CrossOriginAccessControl.h:
1980         * loader/ResourceLoader.h:
1981         (WebCore::ResourceLoader::setReferrerPolicy):
1982         (WebCore::ResourceLoader::referrerPolicy const):
1983         * loader/SubresourceLoader.cpp:
1984         (WebCore::SubresourceLoader::checkRedirectionCrossOriginAccessControl):
1985         (WebCore::SubresourceLoader::updateReferrerPolicy):
1986         * loader/SubresourceLoader.h:
1987         * loader/cache/CachedResourceRequest.cpp:
1988         (WebCore::CachedResourceRequest::setAsPotentiallyCrossOrigin):
1989         (WebCore::CachedResourceRequest::updateForAccessControl):
1990         (WebCore::CachedResourceRequest::updateReferrerOriginAndUserAgentHeaders):
1991         * platform/ReferrerPolicy.cpp: Added.
1992         (WebCore::parseReferrerPolicy):
1993         * platform/ReferrerPolicy.h:
1994         * platform/network/HTTPHeaderNames.in:
1995
1996 2018-04-03  Chris Dumez  <cdumez@apple.com>
1997
1998         Make SecurityOrigin safe to create and use from any thread
1999         https://bugs.webkit.org/show_bug.cgi?id=184216
2000
2001         Reviewed by Youenn Fablet.
2002
2003         We found that we have a decent amount of code constructing and using SecurityOrigin
2004         objects from non-main threads. Unfortunately, this was not safe, mostly due to
2005         SecurityOrigin's reliance on the SchemeRegistry.
2006
2007         This patch makes it safe to construct a SecurityOrigin on any thread A and use
2008         it later on the same thread A. However, developers still need to call isolatedCopy()
2009         if they want to pass such object to another thread B.
2010
2011         * page/SecurityOrigin.cpp:
2012         (WebCore::SecurityOrigin::canDisplay const):
2013         * page/SecurityOrigin.h:
2014         * page/SecurityPolicy.cpp:
2015         (WebCore::originAccessMapLock):
2016         (WebCore::originAccessMap):
2017         (WebCore::SecurityPolicy::isAccessWhiteListed):
2018         (WebCore::SecurityPolicy::addOriginAccessWhitelistEntry):
2019         (WebCore::SecurityPolicy::removeOriginAccessWhitelistEntry):
2020         (WebCore::SecurityPolicy::resetOriginAccessWhitelists):
2021         * platform/SchemeRegistry.cpp:
2022         (WebCore::schemeRegistryLock):
2023         (WebCore::allBuiltinSchemes):
2024         (WebCore::builtinLocalURLSchemes):
2025         (WebCore::localURLSchemes):
2026         (WebCore::displayIsolatedURLSchemes):
2027         (WebCore::builtinSecureSchemes):
2028         (WebCore::secureSchemes):
2029         (WebCore::builtinSchemesWithUniqueOrigins):
2030         (WebCore::schemesWithUniqueOrigins):
2031         (WebCore::builtinEmptyDocumentSchemes):
2032         (WebCore::emptyDocumentSchemes):
2033         (WebCore::schemesForbiddenFromDomainRelaxation):
2034         (WebCore::builtinCanDisplayOnlyIfCanRequestSchemes):
2035         (WebCore::canDisplayOnlyIfCanRequestSchemes):
2036         (WebCore::notAllowingJavascriptURLsSchemes):
2037         (WebCore::SchemeRegistry::registerURLSchemeAsLocal):
2038         (WebCore::SchemeRegistry::removeURLSchemeRegisteredAsLocal):
2039         (WebCore::schemesAllowingLocalStorageAccessInPrivateBrowsing):
2040         (WebCore::schemesAllowingDatabaseAccessInPrivateBrowsing):
2041         (WebCore::builtinCORSEnabledSchemes):
2042         (WebCore::CORSEnabledSchemes):
2043         (WebCore::ContentSecurityPolicyBypassingSchemes):
2044         (WebCore::cachePartitioningSchemes):
2045         (WebCore::serviceWorkerSchemes):
2046         (WebCore::alwaysRevalidatedSchemes):
2047         (WebCore::SchemeRegistry::shouldTreatURLSchemeAsLocal):
2048         (WebCore::SchemeRegistry::registerURLSchemeAsNoAccess):
2049         (WebCore::SchemeRegistry::shouldTreatURLSchemeAsNoAccess):
2050         (WebCore::SchemeRegistry::registerURLSchemeAsDisplayIsolated):
2051         (WebCore::SchemeRegistry::shouldTreatURLSchemeAsDisplayIsolated):
2052         (WebCore::SchemeRegistry::registerURLSchemeAsSecure):
2053         (WebCore::SchemeRegistry::shouldTreatURLSchemeAsSecure):
2054         (WebCore::SchemeRegistry::canDisplayOnlyIfCanRequest):
2055         (WebCore::SchemeRegistry::registerAsCanDisplayOnlyIfCanRequest):
2056         (WebCore::SchemeRegistry::registerURLSchemeAsBypassingContentSecurityPolicy):
2057         (WebCore::SchemeRegistry::removeURLSchemeRegisteredAsBypassingContentSecurityPolicy):
2058         (WebCore::SchemeRegistry::schemeShouldBypassContentSecurityPolicy):
2059         (WebCore::SchemeRegistry::registerURLSchemeAsCachePartitioned):
2060         (WebCore::SchemeRegistry::shouldPartitionCacheForURLScheme):
2061         (WebCore::SchemeRegistry::registerURLSchemeServiceWorkersCanHandle):
2062         (WebCore::SchemeRegistry::canServiceWorkersHandleURLScheme):
2063         (WebCore::SchemeRegistry::isServiceWorkerContainerCustomScheme):
2064         * platform/SchemeRegistry.h:
2065
2066 2018-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2067
2068         [SOUP] Stop using ResourceHandle to load GResources
2069         https://bugs.webkit.org/show_bug.cgi?id=184259
2070
2071         Reviewed by Sergio Villar Senin.
2072
2073         GResources are loaded in the WebProcess using ResourceHandle because soup handles them transparently. But now
2074         that we no longer use ResourceHandle, we can add a simple loader for GResources, similar to the one used for
2075         data URLS, since loading a GResource is a matter of calling g_resources_lookup_data() in the end.
2076
2077         * SourcesGTK.txt:
2078         * SourcesWPE.txt:
2079         * loader/ResourceLoader.cpp:
2080         (WebCore::ResourceLoader::start): Check if resource to load is a GResource and call loadGResource().
2081         * loader/ResourceLoader.h:
2082         * loader/soup/ResourceLoaderSoup.cpp: Added.
2083         (WebCore::ResourceLoader::loadGResource): Load the GResource in a GTask thread.
2084         * platform/SharedBuffer.cpp:
2085         (WebCore::SharedBuffer::DataSegment::data const):
2086         (WebCore::SharedBuffer::DataSegment::size const):
2087         * platform/SharedBuffer.h:
2088         * platform/glib/SharedBufferGlib.cpp:
2089         (WebCore::SharedBuffer::SharedBuffer):
2090         (WebCore::SharedBuffer::create):
2091
2092 2018-04-02  Carlos Garcia Campos  <cgarcia@igalia.com>
2093
2094         [Enchant] Clean up TextCheckerEnchant
2095         https://bugs.webkit.org/show_bug.cgi?id=184233
2096
2097         Reviewed by Michael Catanzaro.
2098
2099         Several cleanups and improvements:
2100
2101         * platform/text/enchant/TextCheckerEnchant.cpp:
2102         (WebCore::TextCheckerEnchant::singleton): Make TextCheckerEnchant a singleton since it's always used as a
2103         singleton.
2104         (WebCore::TextCheckerEnchant::EnchantDictDeleter::operator() const):
2105         (WebCore::TextCheckerEnchant::TextCheckerEnchant):
2106         (WebCore::TextCheckerEnchant::ignoreWord): Convert to utf8 once instead of on every loop iteration.
2107         (WebCore::TextCheckerEnchant::learnWord): Ditton.
2108         (WebCore::TextCheckerEnchant::checkSpellingOfWord): m_enchantDictionaries is now a Vector of std::unique_ptr.
2109         (WebCore::TextCheckerEnchant::getGuessesForWord): Convert to utf8 once instead of on every loop iteration.
2110         (WebCore::TextCheckerEnchant::updateSpellCheckingLanguages): Get only the first language instead of building a
2111         vector to get its first item. Use WTFMove to replace m_enchantDictionaries with the new Vector.
2112         (WebCore::TextCheckerEnchant::loadedSpellCheckingLanguages const): Use a lambda to get the list of languages
2113         already converted to String and iterate only once.
2114         (WebCore::TextCheckerEnchant::availableSpellCheckingLanguages const): Ditto.
2115         (WebCore::enchantDictDescribeCallback): Deleted.
2116         (WebCore::TextCheckerEnchant::~TextCheckerEnchant): Deleted.
2117         (WebCore::TextCheckerEnchant::freeEnchantBrokerDictionaries): Deleted.
2118         * platform/text/enchant/TextCheckerEnchant.h:
2119
2120 2018-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2121
2122         [GTK] Segfaults in enchant_broker_free_dict()
2123         https://bugs.webkit.org/show_bug.cgi?id=183738
2124
2125         Reviewed by Michael Catanzaro.
2126
2127         Check enchant_broker_request_dict() didn't return nullptr before adding it to the m_enchantDictionaries vector.
2128
2129         * platform/text/enchant/TextCheckerEnchant.cpp:
2130         (WebCore::TextCheckerEnchant::updateSpellCheckingLanguages):
2131
2132 2018-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2133
2134         [GTK] NetworkProcess from WebKitGtk+ 2.19.9x SIGSEVs in NetworkStorageSession (secret search callback)
2135         https://bugs.webkit.org/show_bug.cgi?id=183346
2136
2137         Reviewed by Michael Catanzaro.
2138
2139         This might happen if a request is cancelled right after the password request starts and before it finishes. We
2140         should cancel the password search when the network request is cancelled, not only when the NetworkStorageSession
2141         is destroyed.
2142
2143         * platform/network/NetworkStorageSession.h:
2144         * platform/network/soup/NetworkStorageSessionSoup.cpp:
2145         (WebCore::NetworkStorageSession::~NetworkStorageSession):
2146         (WebCore::SecretServiceSearchData::SecretServiceSearchData): Helper struct to keep the request cancellable and
2147         completion handler.
2148         (WebCore::NetworkStorageSession::getCredentialFromPersistentStorage): Create a SecretServiceSearchData for the
2149         request.
2150         * platform/network/soup/ResourceHandleSoup.cpp:
2151         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge): Pass the request cancellable to
2152         NetworkStorageSession::getCredentialFromPersistentStorage().
2153
2154 2018-04-02  Eric Carlson  <eric.carlson@apple.com>
2155
2156         [Extra zoom mode] Replace video with a placeholder image during fullscreen transition
2157         https://bugs.webkit.org/show_bug.cgi?id=184188
2158         <rdar://problem/38940307>
2159
2160         Reviewed by Youenn Fablet.
2161
2162         * html/HTMLMediaElement.cpp:
2163         (WebCore::HTMLMediaElement::willExitFullscreen):
2164         * html/HTMLMediaElement.h:
2165         * platform/cocoa/VideoFullscreenChangeObserver.h:
2166         * platform/cocoa/VideoFullscreenModelVideoElement.h:
2167         * platform/cocoa/VideoFullscreenModelVideoElement.mm:
2168         (VideoFullscreenModelVideoElement::willExitFullscreen):
2169         * platform/graphics/MediaPlayer.cpp:
2170         (WebCore::MediaPlayer::updateVideoFullscreenInlineImage):
2171         * platform/graphics/MediaPlayer.h:
2172         * platform/graphics/MediaPlayerPrivate.h:
2173         (WebCore::MediaPlayerPrivateInterface::updateVideoFullscreenInlineImage):
2174         * platform/graphics/VideoFullscreenLayerManager.h:
2175         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
2176         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2177         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem):
2178         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoFullscreenInlineImage):
2179         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenLayer):
2180         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastPixelBuffer):
2181         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastImage):
2182         (WebCore::MediaPlayerPrivateAVFoundationObjC::paintWithVideoOutput):
2183         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2184         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenLayer):
2185         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
2186         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVideoFullscreenLayer):
2187         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.h:
2188         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm:
2189         (WebCore::VideoFullscreenLayerManagerObjC::setVideoLayer):
2190         (WebCore::VideoFullscreenLayerManagerObjC::updateVideoFullscreenInlineImage):
2191         (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenLayer):
2192         * platform/ios/VideoFullscreenInterfaceAVKit.h:
2193         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
2194         (VideoFullscreenInterfaceAVKit::exitFullscreen):
2195         (VideoFullscreenInterfaceAVKit::preparedToExitFullscreen):
2196         (VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason):
2197         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
2198         (VideoFullscreenControllerContext::willExitFullscreen):
2199
2200 2018-04-02  Eric Carlson  <eric.carlson@apple.com>
2201
2202         Define AVKit softlink macro
2203         https://bugs.webkit.org/show_bug.cgi?id=184241
2204
2205         Reviewed by Jer Noble.
2206
2207         No new tests, no functional change.
2208
2209         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
2210         * platform/ios/PlaybackSessionInterfaceAVKit.mm:
2211         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
2212         * platform/ios/WebAVPlayerController.mm:
2213         * platform/mac/PlaybackSessionInterfaceMac.mm:
2214         * platform/mac/VideoFullscreenInterfaceMac.mm:
2215
2216 2018-04-02  Wenson Hsieh  <wenson_hsieh@apple.com>
2217
2218         [Extra zoom mode] Update date picker UI to latest specifications
2219         https://bugs.webkit.org/show_bug.cgi?id=184234
2220         <rdar://problem/38804760>
2221
2222         Reviewed by Timothy Hatcher.
2223
2224         Tweak localizable strings. Day, month and year labels should be fully capitalized, and there needs to be a
2225         string for the "Set" button title.
2226
2227         * English.lproj/Localizable.strings:
2228         * platform/LocalizedStrings.cpp:
2229         (WebCore::datePickerSetButtonTitle):
2230         (WebCore::datePickerDayLabelTitle):
2231         (WebCore::datePickerMonthLabelTitle):
2232         (WebCore::datePickerYearLabelTitle):
2233         * platform/LocalizedStrings.h:
2234
2235 2018-04-02  Ryosuke Niwa  <rniwa@webkit.org>
2236
2237         REGRESSION(r228260):WebHTMLView beeps at every keydown for Chinese/Japanese/Korean Input Method
2238         https://bugs.webkit.org/show_bug.cgi?id=184231
2239
2240         Reviewed by Alexey Proskuryakov.
2241
2242         The bug was caused by EventHandler::internalKeyEvent calling setDefaultHandled and expecting it to stay true
2243         after dispatching the event even though m_defaultHandled is always cleared after r228260. This results in
2244         EventHandler::internalKeyEvent returning false, and resulting in a beep.
2245
2246         Unfortunately, no new tests since there is no facility to detect this case in layout tests, and we can't
2247         easily emulate or trigger a real input method in API tests.
2248
2249         * page/EventHandler.cpp:
2250         (WebCore::EventHandler::internalKeyEvent):
2251
2252 2018-04-02  Jer Noble  <jer.noble@apple.com>
2253
2254         AudioBufferSourceNode start method causes OfflineAudioContext to start running
2255         https://bugs.webkit.org/show_bug.cgi?id=181939
2256         <rdar://problem/36755393>
2257
2258         Reviewed by Eric Carlson.
2259
2260         Test: webaudio/offlineaudiocontext-restriction.html
2261
2262         Don't respect playback restrictions for offline AudioContexts.
2263
2264         * Modules/webaudio/AudioContext.cpp:
2265         (WebCore::AudioContext::constructCommon):
2266         * Modules/webaudio/AudioContext.h:
2267         (WebCore::AudioContext::isOfflineContext const):
2268         (WebCore::AudioContext::userGestureRequiredForAudioStart const):
2269         (WebCore::AudioContext::pageConsentRequiredForAudioStart const):
2270         (WebCore::AudioContext::isOfflineContext): Deleted.
2271
2272 2018-04-02  Alejandro G. Castro  <alex@igalia.com>
2273
2274         [GTK] Make libwebrtc backend buildable for GTK  port
2275         https://bugs.webkit.org/show_bug.cgi?id=178860
2276
2277         Reviewed by Youenn Fablet.
2278
2279         This is the first step to add webrtc support to the GTK port using
2280         the libwebrtc backend.
2281
2282         No new tests, no new feature added, it should be tested by current
2283         tests.
2284
2285         * CMakeLists.txt: Add the new files to the compilation and set the
2286         new includes in the libwebrtc library.
2287         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2288         Reorder the includes alphabetically and add some that are missing.
2289         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
2290         Ditto.
2291         * Sources.txt: Add new file to the compilation.
2292         * platform/mediastream/gstreamer/RealtimeIncomingAudioSourceLibWebRTC.cpp:
2293         Added. Initial implementation for GTK and WPE.
2294         * platform/mediastream/gstreamer/RealtimeIncomingAudioSourceLibWebRTC.h:
2295         Added. Ditto.
2296         * platform/mediastream/gstreamer/RealtimeIncomingVideoSourceLibWebRTC.cpp:
2297         Added. Ditto.
2298         * platform/mediastream/gstreamer/RealtimeIncomingVideoSourceLibWebRTC.h:
2299         Added. Ditto.
2300         * platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp:
2301         Added. Ditto.
2302         * platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.h:
2303         Added. Ditto.
2304         * platform/mediastream/gstreamer/RealtimeOutgoingVideoSourceLibWebRTC.cpp:
2305         Added. Ditto.
2306         * platform/mediastream/gstreamer/RealtimeOutgoingVideoSourceLibWebRTC.h:
2307         Added. Ditto.
2308         * platform/mediastream/libwebrtc/LibWebRTCProviderGlib.cpp: Added includes
2309         for the compilation.
2310         * platform/mediastream/libwebrtc/LibWebRTCProviderGlib.h: Added, inherit from
2311         the LibWebRTCProvider to adapt for glib.
2312
2313 2018-04-01  Yusuke Suzuki  <utatane.tea@gmail.com>
2314
2315         Use WTF::Lock instead of GMutex
2316         https://bugs.webkit.org/show_bug.cgi?id=184227
2317
2318         Reviewed by Saam Barati.
2319
2320         Prefer WTF::Lock over GMutex since these locks are just protecting WebKit C++ fields.
2321
2322         No behavior change.
2323
2324         * platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp:
2325         (WebCore::AudioSourceProviderGStreamer::AudioSourceProviderGStreamer):
2326         (WebCore::AudioSourceProviderGStreamer::~AudioSourceProviderGStreamer):
2327         (WebCore::AudioSourceProviderGStreamer::provideInput):
2328         (WebCore::AudioSourceProviderGStreamer::handleAudioBuffer):
2329         (WebCore::AudioSourceProviderGStreamer::clearAdapters):
2330         * platform/audio/gstreamer/AudioSourceProviderGStreamer.h:
2331         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2332         (WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase):
2333         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
2334         (WebCore::MediaPlayerPrivateGStreamerBase::naturalSize const):
2335         (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):
2336         (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
2337         (WebCore::MediaPlayerPrivateGStreamerBase::flushCurrentBuffer):
2338         (WebCore::MediaPlayerPrivateGStreamerBase::paint):
2339         (WebCore::MediaPlayerPrivateGStreamerBase::copyVideoTextureToPlatformTexture):
2340         (WebCore::MediaPlayerPrivateGStreamerBase::nativeImageForCurrentTime):
2341         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
2342         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
2343         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
2344
2345 2018-03-31  Brent Fulgham  <bfulgham@apple.com>
2346
2347         Show punycode if URL contains hyphen character
2348         https://bugs.webkit.org/show_bug.cgi?id=184221
2349         <rdar://problem/38044633>
2350
2351         Reviewed by Darin Adler.
2352
2353         Revise our "lookalike character" logic to include the hyphen,
2354         non-breaking hyphen, and minus sign.
2355
2356         Test: fast/url/host.html
2357
2358         * platform/mac/WebCoreNSURLExtras.mm:
2359         (WebCore::isLookalikeCharacter):
2360
2361 2018-03-31  Filip Pizlo  <fpizlo@apple.com>
2362
2363         JSObject shouldn't do index masking
2364         https://bugs.webkit.org/show_bug.cgi?id=184194
2365
2366         Reviewed by Yusuke Suzuki.
2367
2368         No new tests because no new behavior.
2369
2370         * bindings/js/JSDOMConvertSequences.h:
2371         (WebCore::Detail::NumericSequenceConverter::convertArray):
2372         (WebCore::Detail::SequenceConverter::convertArray):
2373
2374 2018-03-30  Chris Dumez  <cdumez@apple.com>
2375
2376         REGRESSION (r229828): Facebook login popup is blank
2377         https://bugs.webkit.org/show_bug.cgi?id=184206
2378         <rdar://problem/39057006>
2379
2380         Reviewed by Wenson Hsieh.
2381
2382         Since r229828, we freeze the layer tree during the navigation policy check.
2383         We freeze in WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction()
2384         and unfreeze in WebFrameLoaderClient::didDecidePolicyForNavigationAction().
2385
2386         WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction() gets called
2387         from PolicyChecker::checkNavigationPolicy() which has 3 call sites in
2388         FrameLoader and one in DocumentLoader for redirects. The call sites in
2389         FrameLoader were taking care of calling didDecidePolicyForNavigationAction()
2390         on the FrameLoaderClient in their completion handler, but the DocumentLoader
2391         call site was failing to do so. As a result, the layer tree would stay frozen.
2392
2393         To make this a lot less error prone, I moved the call to
2394         WebFrameLoaderClient::didDecidePolicyForNavigationAction() to
2395         PolicyChecker::checkNavigationPolicy(), inside the completion handler passed
2396         to WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(). This way,
2397         even if new code starts calling PolicyChecker::checkNavigationPolicy(), we
2398         do not need to worry about letting the client know when the policy decision
2399         is made.
2400
2401         No new tests, covered by existing redirection tests with the
2402         new assertion I added.
2403
2404         * loader/FrameLoader.cpp:
2405         (WebCore::FrameLoader::continueFragmentScrollAfterNavigationPolicy):
2406         (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
2407         * loader/PolicyChecker.cpp:
2408         (WebCore::PolicyChecker::checkNavigationPolicy):
2409
2410 2018-03-30  Devin Rousso  <webkit@devinrousso.com>
2411
2412         Web Inspector: tint all pixels drawn by shader program when hovering ShaderProgramTreeElement
2413         https://bugs.webkit.org/show_bug.cgi?id=175223
2414
2415         Reviewed by Matt Baker.
2416
2417         Test: inspector/canvas/setShaderProgramHighlighted.html
2418
2419         * html/canvas/InspectorShaderProgram.h:
2420         (WebCore::InspectorShaderProgram::highlighted):
2421         (WebCore::InspectorShaderProgram::setHighlighted):
2422
2423         * html/canvas/WebGLRenderingContextBase.cpp:
2424         (WebCore::InspectorScopedShaderProgramHighlight::InspectorScopedShaderProgramHighlight):
2425         (WebCore::InspectorScopedShaderProgramHighlight::~InspectorScopedShaderProgramHighlight):
2426         (WebCore::InspectorScopedShaderProgramHighlight::showHighlight):
2427         (WebCore::InspectorScopedShaderProgramHighlight::hideHighlight):
2428         (WebCore::InspectorScopedShaderProgramHighlight::saveBlendValue):
2429         (WebCore::InspectorScopedShaderProgramHighlight::hasBufferBinding):
2430         (WebCore::InspectorScopedShaderProgramHighlight::hasFramebufferParameterAttachment):
2431         (WebCore::WebGLRenderingContextBase::drawArrays):
2432         (WebCore::WebGLRenderingContextBase::drawElements):
2433         If the current shader program has been marked as highlighted, apply a blend right before
2434         `drawArrays` and `drawElements` is called, tinting the resulting pixels so that they are
2435         visually distinguished from pixels drawn by other shader programs.
2436
2437         * inspector/InspectorCanvasAgent.h:
2438         * inspector/InspectorCanvasAgent.cpp:
2439         (WebCore::InspectorCanvasAgent::setShaderProgramHighlighted):
2440         (WebCore::InspectorCanvasAgent::isShaderProgramHighlighted):
2441
2442         * inspector/InspectorInstrumentation.h:
2443         * inspector/InspectorInstrumentation.cpp:
2444         (WebCore::InspectorInstrumentation::isShaderProgramHighlighted):
2445         (WebCore::InspectorInstrumentation::isShaderProgramHighlightedImpl):
2446
2447 2018-03-30  Wenson Hsieh  <wenson_hsieh@apple.com>
2448
2449         [Extra zoom mode] Adopt list view controller UI for numeric input types
2450         https://bugs.webkit.org/show_bug.cgi?id=184184
2451         <rdar://problem/37238916>
2452
2453         Reviewed by Timothy Hatcher.
2454
2455         Add a localized string for the OK button shown on number pads in extra zoomed form controls.
2456
2457         * English.lproj/Localizable.strings:
2458         * platform/LocalizedStrings.cpp:
2459         (WebCore::numberPadOKButtonTitle):
2460         * platform/LocalizedStrings.h:
2461
2462 2018-03-30  Ryosuke Niwa  <rniwa@webkit.org>
2463
2464         Copying a list from Microsoft Word to TinyMCE fails when mso-list is the first property
2465         https://bugs.webkit.org/show_bug.cgi?id=182938
2466         <rdar://problem/37683007>
2467
2468         Reviewed by Wenson Hsieh.
2469
2470         Made the logic to detect Microsoft Word's mso-list CSS property more generic by detecting
2471         inline styles which start with "mso-list:" and one which line-break right before it: "\nmso-list:"
2472
2473         Tests: PasteHTML.PreservesMSOList
2474
2475         * editing/markup.cpp:
2476         (WebCore::StyledMarkupAccumulator::shouldPreserveMSOListStyleForElement):
2477
2478 2018-03-30  Youenn Fablet  <youenn@apple.com>
2479
2480         NetworkLoadChecker should upgrade redirects if needed
2481         https://bugs.webkit.org/show_bug.cgi?id=184098
2482
2483         Reviewed by Chris Dumez.
2484
2485         Test: imported/w3c/web-platform-tests/beacon/upgrade-beacon.https.html
2486
2487         * page/csp/ContentSecurityPolicy.h:
2488
2489 2018-03-30  Daniel Bates  <dabates@apple.com>
2490
2491         ASSERTION FAILED: ASSERT(!containsImage || MIMETypeRegistry::isSupportedImageResourceMIMEType([resource MIMEType])) in -[NSPasteboard(WebExtras) _web_writePromisedRTFDFromArchive:containsImage:]
2492         https://bugs.webkit.org/show_bug.cgi?id=184161
2493
2494         Reviewed by Per Arne Vollan.
2495
2496         Fixes an assertion failure when quiting an app that uses a Legacy WebKit web view
2497         after dragging-and-dropping a PDF embedded using an HTML image element into the
2498         same web view.
2499
2500         When performing a drag-and-drop of a PDF document image (WebCore::PDFDocumentImage) we create a WebArchive
2501         from the main frame's WebHTMLView and promise AppKit that will provide a Rich Text Format (RTF) document
2502         from this archive if needed. For some reason, on app termination AppKit requests that the WebHTMLView
2503         fullfill its RTF document promise for the WebArchive created at the start of the drag operation. WebKit
2504         expects that the created WebArchive is either for an inline image (e.g. <img>) or an image document that
2505         has a supported image resource MIME type (by querying MIMETypeRegistry::isSupportedImageResourceMIMEType())
2506         and checks for these cases in this order. PDF/PostScript are not listed in the set of supported image
2507         resource MIME types. So, the first check fails and WebKit assumes that the WebArchive was created from
2508         an image document of a supported image resource MIME type. However, the WebArchive was created from a
2509         WebHTMLView and has MIME type text/html. Therefore the assertion fails. We need to add PDF and PostScript
2510         to the set of supported image resource MIME types so that WebKit does not fall back to the WebHTMLView
2511         code path. Historically, PDF and PostScript were in the set supported image resource MIME types. Over time
2512         the set of MIME types for image resouces (images loaded as a document) became identical to the set of MIME
2513         types for images loaded inline (e.g. <img>) and this set omitted the MIME types for PDF and PostScript.
2514
2515         Additionally it is sufficient to implement MIMETypeRegistry::isSupportedImageResourceMIMEType() in terms
2516         of MIMETypeRegistry::isSupportedImageMIMEType() and MIMETypeRegistry::isPDFOrPostScriptMIMEType() instead
2517         of allocating a dedicated HashSet for the supported image resource MIME types (as we currently do).
2518
2519         * dom/DOMImplementation.cpp:
2520         (WebCore::DOMImplementation::createDocument): Assert that PDF is a supported image MIME type before
2521         instantiating an ImageDocument.
2522         * platform/MIMETypeRegistry.cpp:
2523         (WebCore::initializeSupportedImageMIMETypes): Remove unnecessary allocation of a HashSet for the support
2524         image resource MIME types.
2525         (WebCore::MIMETypeRegistry::isSupportedImageResourceMIMEType): Write in terms of MIMETypeRegistry::isSupportedImageMIMEType()
2526         and MIMETypeRegistry::isPDFOrPostScriptMIMEType().
2527         (WebCore::MIMETypeRegistry::getSupportedImageResourceMIMETypes): Deleted.
2528         * platform/MIMETypeRegistry.h:
2529
2530 2018-03-29  Antoine Quint  <graouts@apple.com>
2531
2532         [Web Animations] CSSTransition objects should have fill: backwards to allow seeking prior to start time
2533         https://bugs.webkit.org/show_bug.cgi?id=184129
2534
2535         Reviewed by Dean Jackson.
2536
2537         In order to allow a CSS Transition to be seeked prior to its start time, it needs to have its fill mode set
2538         to backwards. Adding code to set the fill mode in CSSTransition::initialize() yields early timing model
2539         invalidation and we could get in a situation where stylesWouldYieldNewCSSTransitionsBlendingKeyframes()
2540         was called before we had a chance to create blending keyframes for a CSS transitions, since the call
2541         to create blending keyframes is made after the call to initialize(), so we now cater for this case.
2542
2543         * animation/CSSTransition.cpp:
2544         (WebCore::CSSTransition::initialize):
2545         * animation/CSSTransition.h:
2546         * animation/KeyframeEffectReadOnly.cpp:
2547         (WebCore::KeyframeEffectReadOnly::stylesWouldYieldNewCSSTransitionsBlendingKeyframes const):
2548
2549 2018-03-30  Daniel Bates  <dabates@apple.com>
2550
2551         Remove unused MIMETypeRegistry::getSupportedImageMIMETypesForEncoding()
2552         https://bugs.webkit.org/show_bug.cgi?id=184154
2553
2554         Reviewed by Per Arne Vollan.
2555
2556         * platform/MIMETypeRegistry.cpp:
2557         (WebCore::MIMETypeRegistry::getSupportedImageMIMETypesForEncoding): Deleted.
2558         * platform/MIMETypeRegistry.h:
2559
2560 2018-03-30  Ryan Haddad  <ryanhaddad@apple.com>
2561
2562         Unreviewed, rolling out r230102.
2563
2564         Caused assertion failures on JSC bots.
2565
2566         Reverted changeset:
2567
2568         "A stack overflow in the parsing of a builtin (called by
2569         createExecutable) cause a crash instead of a catchable js
2570         exception"
2571         https://bugs.webkit.org/show_bug.cgi?id=184074
2572         https://trac.webkit.org/changeset/230102
2573
2574 2018-03-30  Robin Morisset  <rmorisset@apple.com>
2575
2576         A stack overflow in the parsing of a builtin (called by createExecutable) cause a crash instead of a catchable js exception
2577         https://bugs.webkit.org/show_bug.cgi?id=184074
2578         <rdar://problem/37165897>
2579
2580         Reviewed by Keith Miller.
2581
2582         I had to slightly change the type of some bindings between JSC and WebCore. No functional change intended on the WebCore side.
2583
2584         * bindings/js/JSReadableStreamPrivateConstructors.cpp:
2585         (WebCore::JSBuiltinReadableStreamDefaultReaderPrivateConstructor::initializeExecutable):
2586         (WebCore::JSBuiltinReadableStreamDefaultControllerPrivateConstructor::initializeExecutable):
2587         (WebCore::JSBuiltinReadableByteStreamControllerPrivateConstructor::initializeExecutable):
2588         (WebCore::JSBuiltinReadableStreamBYOBReaderPrivateConstructor::initializeExecutable):
2589         (WebCore::JSBuiltinReadableStreamBYOBRequestPrivateConstructor::initializeExecutable):
2590         * bindings/scripts/CodeGeneratorJS.pm:
2591         (GenerateConstructorHelperMethods):
2592         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
2593         (WebCore::JSTestClassWithJSBuiltinConstructorConstructor::initializeExecutable):
2594         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
2595         (WebCore::JSTestJSBuiltinConstructorConstructor::initializeExecutable):
2596
2597 2018-03-29  Antoine Quint  <graouts@apple.com>
2598
2599         [Web Animations] Correctly obtain the timing function for a given keyframe
2600         https://bugs.webkit.org/show_bug.cgi?id=184146
2601
2602         Reviewed by Dean Jackson.
2603
2604         The way we would get the timing function for a given KeyframeValue stored in a KeyframeList was really suboptimal.
2605         When keyframes were created, we would set the animated element's style on each keyframe, and set keyframe-specific
2606         properties and values on top. When figuring out the timing function for a KeyframeValue, we would look at its render
2607         style, go through its list of animations, which could include animations that are irrelevant to this specific keyframe
2608         list since all animations from the animated element are referenced, and we would have to look up the correct animation
2609         by name and get the timing function, even though the timing function stored on the animation was now specific to this
2610         particular keyframe.
2611
2612         We now simply set a m_timingFunction member on a KeyframeValue, which is null if no explicit animation-timing-function
2613         was provided for this keyframe in CSS, and otherwise set to a valid TimingFunction.
2614
2615         This fixes our behavior for a 4 existing animation tests when opted into the CSS Animations and CSS Transitions as
2616         Web Animations feature.
2617
2618         * animation/KeyframeEffectReadOnly.cpp:
2619         (WebCore::KeyframeEffectReadOnly::timingFunctionForKeyframeAtIndex):
2620         * css/StyleResolver.cpp:
2621         (WebCore::StyleResolver::keyframeStylesForAnimation):
2622         * page/animation/KeyframeAnimation.cpp:
2623         (WebCore::KeyframeAnimation::fetchIntervalEndpointsForProperty const):
2624         * platform/animation/TimingFunction.cpp:
2625         (WebCore::TimingFunction::createFromCSSText):
2626         (WebCore::TimingFunction::createFromCSSValue):
2627         * platform/animation/TimingFunction.h:
2628         * rendering/RenderLayerBacking.cpp:
2629         (WebCore::RenderLayerBacking::startAnimation):
2630         * rendering/style/KeyframeList.cpp:
2631         (WebCore::KeyframeValue::timingFunction const): Deleted.
2632         * rendering/style/KeyframeList.h:
2633         (WebCore::KeyframeValue::timingFunction const):
2634         (WebCore::KeyframeValue::setTimingFunction):
2635
2636 2018-03-29  Ryosuke Niwa  <rniwa@webkit.org>
2637
2638         Copying a list from Microsoft Word to TinyMCE fails when mso-list is on tags other than P
2639         https://bugs.webkit.org/show_bug.cgi?id=182954
2640         <rdar://problem/37713141>
2641
2642         Reviewed by Wenson Hsieh.
2643
2644         Fixed the bug by relaxing the restriction that we only preserve mso-list on p.
2645
2646         Tests: PasteHTML.PreservesMSOListOnH4
2647
2648         * editing/markup.cpp:
2649         (WebCore::StyledMarkupAccumulator::shouldPreserveMSOListStyleForElement):
2650
2651 2018-03-29  JF Bastien  <jfbastien@apple.com>
2652
2653         Use Forward.h instead of forward-declaring WTF::String
2654         https://bugs.webkit.org/show_bug.cgi?id=184172
2655         <rdar://problem/39026146>
2656
2657         Reviewed by Yusuke Suzuki.
2658
2659         As part of #184164 I'm changing WTF::String, and the forward
2660         declarations are just wrong because I'm making it templated. We
2661         should use Forward.h anyways, so do that instead.
2662
2663         * css/makeprop.pl:
2664         * platform/cocoa/PlaybackSessionInterface.h:
2665         * platform/ios/Device.h:
2666         * platform/ios/PlaybackSessionInterfaceAVKit.h:
2667         * platform/ios/VideoFullscreenInterfaceAVKit.h:
2668         * platform/win/PathWalker.h:
2669         * testing/js/WebCoreTestSupport.h:
2670
2671 2018-03-29  Ross Kirsling  <ross.kirsling@sony.com>
2672
2673         MSVC __forceinline slows down JSC release build fivefold after r229391
2674         https://bugs.webkit.org/show_bug.cgi?id=184062
2675
2676         Reviewed by Alex Christensen.
2677
2678         * platform/graphics/FormatConverter.cpp:
2679         Factor ALWAYS_INLINE_EXCEPT_MSVC out to WTF.
2680
2681 2018-03-29  Ryan Haddad  <ryanhaddad@apple.com>
2682
2683         Unreviewed, rolling out r230087.
2684
2685         Introduced LayoutTest failures.
2686
2687         Reverted changeset:
2688
2689         "FrameSelection::appearanceUpdateTimerFired should be robust
2690         against layout passes underneath it"
2691         https://bugs.webkit.org/show_bug.cgi?id=183395
2692         https://trac.webkit.org/changeset/230087
2693
2694 2018-03-29  Wenson Hsieh  <wenson_hsieh@apple.com>
2695
2696         FrameSelection::appearanceUpdateTimerFired should be robust against layout passes underneath it
2697         https://bugs.webkit.org/show_bug.cgi?id=183395
2698         <rdar://problem/38055732>
2699
2700         Reviewed by Zalan Bujtas.
2701
2702         In the case where a FrameSelection updates its appearance when m_appearanceUpdateTimer is fired, the
2703         FrameSelection's Frame is unprotected, and can be removed by arbitrary script. This patch applies a simple
2704         mitigation by wrapping the Frame in a Ref when firing the appearance update timer, and ensuring that layout is
2705         really up to date before calling updateAppearanceAfterLayoutOrStyleChange() from the timer.
2706
2707         Test: editing/selection/iframe-update-selection-appearance.html
2708
2709         * editing/FrameSelection.cpp:
2710         (WebCore::FrameSelection::appearanceUpdateTimerFired):
2711
2712 2018-03-29  Daniel Bates  <dabates@apple.com>
2713
2714         Substitute ArchiveFactory::isArchiveMIMEType() for ArchiveFactory::isArchiveMimeType().
2715
2716         * loader/DocumentLoader.cpp:
2717         (WebCore::DocumentLoader::commitLoad):
2718         * loader/archive/ArchiveFactory.cpp:
2719         (WebCore::ArchiveFactory::isArchiveMIMEType):
2720         (WebCore::ArchiveFactory::isArchiveMimeType): Deleted.
2721         * loader/archive/ArchiveFactory.h:
2722         * platform/MIMETypeRegistry.h:
2723
2724 2018-03-29  Daniel Bates  <dabates@apple.com>
2725
2726         MIMETypeRegistry should return const HashSets
2727         https://bugs.webkit.org/show_bug.cgi?id=184150
2728
2729         Reviewed by Per Arne Vollan.
2730
2731         Only getSupportedNonImageMIMETypes() needs to return a non-const HashSet so that
2732         LegacyWebKit can modify the set of non-image MIME types.
2733
2734         * platform/MIMETypeRegistry.cpp:
2735         (WebCore::MIMETypeRegistry::getSupportedImageMIMETypes):
2736         (WebCore::MIMETypeRegistry::getSupportedImageResourceMIMETypes):
2737         (WebCore::MIMETypeRegistry::getSupportedImageMIMETypesForEncoding):
2738         (WebCore::MIMETypeRegistry::getSupportedMediaMIMETypes):
2739         (WebCore::MIMETypeRegistry::getPDFMIMETypes):
2740         (WebCore::MIMETypeRegistry::getUnsupportedTextMIMETypes):
2741         * platform/MIMETypeRegistry.h:
2742
2743 2018-03-29  Brady Eidson  <beidson@apple.com>
2744
2745         Update Service Worker feature status.
2746         https://bugs.webkit.org/show_bug.cgi?id=184139
2747
2748         Reviewed by Chris Dumez.
2749
2750         * features.json:
2751
2752 2018-03-29  Chris Dumez  <cdumez@apple.com>
2753
2754         Drop DOMWindow::frames() / DOMWindow::window() methods
2755         https://bugs.webkit.org/show_bug.cgi?id=184112
2756
2757         Reviewed by Daniel Bates.
2758
2759         Drop DOMWindow::frames() / DOMWindow::window() methods as they are just aliases for DOMWindow::self().
2760
2761         * page/DOMWindow.h:
2762         * page/DOMWindow.idl:
2763
2764 2018-03-29  Commit Queue  <commit-queue@webkit.org>
2765
2766         Unreviewed, rolling out r230062.
2767         https://bugs.webkit.org/show_bug.cgi?id=184128
2768
2769         Broke mac port. web content process crashes while loading any
2770         web page (Requested by rniwa on #webkit).
2771
2772         Reverted changeset:
2773
2774         "MSVC __forceinline slows down JSC release build fivefold
2775         after r229391"
2776         https://bugs.webkit.org/show_bug.cgi?id=184062
2777         https://trac.webkit.org/changeset/230062
2778
2779 2018-03-28  Antoine Quint  <graouts@apple.com>
2780
2781         [Web Animations] Implement more CSSPropertyBlendingClient methods
2782         https://bugs.webkit.org/show_bug.cgi?id=184077
2783
2784         Reviewed by Dean Jackson.
2785
2786         We only had stubs for several of the CSSPropertyBlendingClient methods and thus always implied that we
2787         were animating non-matching transform, filter and backdrop-filter properties. We now implement those using
2788         the same code used in KeyframeAnimation. This allows for 31 new tests to opt into the CSS Animations and
2789         CSS Transitions as Web Animations feature.
2790
2791         We also ensure we only run a CSSAnimationController assertion in FrameView::didDestroyRenderTree() if
2792         we're not using the CSS Animations and CSS Transitions as Web Animations feature.
2793
2794         * animation/KeyframeEffectReadOnly.cpp:
2795         (WebCore::KeyframeEffectReadOnly::copyPropertiesFromSource):
2796         (WebCore::KeyframeEffectReadOnly::updateBlendingKeyframes):
2797         (WebCore::KeyframeEffectReadOnly::setBlendingKeyframes):
2798         (WebCore::KeyframeEffectReadOnly::checkForMatchingTransformFunctionLists):
2799         (WebCore::KeyframeEffectReadOnly::checkForMatchingFilterFunctionLists):
2800         (WebCore::KeyframeEffectReadOnly::checkForMatchingBackdropFilterFunctionLists):
2801         (WebCore::KeyframeEffectReadOnly::computeCSSAnimationBlendingKeyframes):
2802         (WebCore::KeyframeEffectReadOnly::computeCSSTransitionBlendingKeyframes):
2803         * animation/KeyframeEffectReadOnly.h:
2804         * page/FrameView.cpp:
2805         (WebCore::FrameView::didDestroyRenderTree):
2806
2807 2018-03-28  Chris Dumez  <cdumez@apple.com>
2808
2809         Align XMLHttpRequest's open() / send() / abort() with the latest specification
2810         https://bugs.webkit.org/show_bug.cgi?id=184108
2811
2812         Reviewed by Youenn Fablet.
2813
2814         Align XMLHttpRequest's open() / send() / abort() with the latest specification:
2815         - https://xhr.spec.whatwg.org
2816
2817         No new tests, rebaselined existing layout tests.
2818
2819         * xml/XMLHttpRequest.cpp:
2820         (WebCore::XMLHttpRequest::open):
2821         Align with https://xhr.spec.whatwg.org/#the-open()-method:
2822         - Change the order of some steps to match the order in the spec. In particular,
2823           open() no longer resets the state to UNSENT or abort any existing load when it
2824           fails early due to being passed a bad method.
2825
2826         (WebCore::XMLHttpRequest::createRequest):
2827         Align with https://xhr.spec.whatwg.org/#the-send()-method:
2828         - Use the simpler "upload listener flag" logic from the spec instead of our more
2829           complex m_uploadEventsAllowed flag. This avoids constructing a SecurityOrigin
2830           objects on a background thread when XHR is used inside Web Workers, which was
2831           not thread-safe.
2832         - Set the upload complete flag when the request has no body as per step 9.
2833         - After firing the loadstartEvent, return early if the state is no longer OPEN or
2834           if the send flag is unset, as per step 11.3.
2835
2836         (WebCore::XMLHttpRequest::abort):
2837         Align with https://xhr.spec.whatwg.org/#the-abort()-method:
2838         - Only set the state to UNSENT if the state is still DONE after firing the error
2839           events, as per step 3.
2840
2841         (WebCore::XMLHttpRequest::didSendData):
2842         Use new "upload listener flag".
2843
2844         (WebCore::XMLHttpRequest::dispatchErrorEvents):
2845         Align with https://xhr.spec.whatwg.org/#request-error-steps:
2846         - Stop firing a progress event in case of error as this is not as per specification
2847           and Firefox does not fire those either.
2848
2849         * xml/XMLHttpRequest.h:
2850
2851 2018-03-28  Timothy Hatcher  <timothy@apple.com>
2852
2853         Consolidate NSColor to WebCore::Color conversion and fix system colors.
2854
2855         https://bugs.webkit.org/show_bug.cgi?id=184096
2856         rdar://problem/38918925
2857
2858         Reviewed by Tim Horton.
2859
2860         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2861         (CreateCGColorIfDifferent): Use CGColor property on NSColor, don't manually create new CGColor.
2862         * platform/graphics/mac/ColorMac.h:
2863         * platform/graphics/mac/ColorMac.mm:
2864         (WebCore::makeRGBAFromNSColor): Move pattern code from RenderThemeMac's convertNSColorToColor.
2865         Also use nextafter for proper RGBA float conversion.
2866         * platform/mac/PlatformPasteboardMac.mm:
2867         (WebCore::PlatformPasteboard::color): Use colorFromNSColor.
2868         * rendering/RenderThemeMac.mm:
2869         (WebCore::RenderThemeMac::platformActiveSelectionBackgroundColor const): Use colorFromNSColor.
2870         (WebCore::RenderThemeMac::platformInactiveSelectionBackgroundColor const): Ditto.
2871         (WebCore::RenderThemeMac::platformActiveListBoxSelectionBackgroundColor const): Ditto.
2872         (WebCore::RenderThemeMac::systemColor const): Ditto.
2873         (WebCore::paintAttachmentTitleBackground): Ditto.
2874         (WebCore::convertNSColorToColor): Deleted.
2875
2876 2018-03-28  Said Abou-Hallawa  <sabouhallawa@apple.com>
2877
2878         The SVGAnimatedProperty wrappers have to be detached from the referenced values before the SVGAnimatedType is deleted
2879         https://bugs.webkit.org/show_bug.cgi?id=183972
2880
2881         Reviewed by Daniel Bates.
2882
2883         If the SVGAnimatedType is a list type, e.g. SVGLengthListValues, the wrappers
2884         of the animated properties have to be detached from the items in the list
2885         before it's deleted.
2886
2887         * svg/SVGAnimateElementBase.cpp:
2888         (WebCore::SVGAnimateElementBase::clearAnimatedType):
2889
2890 2018-03-28  Ross Kirsling  <ross.kirsling@sony.com>
2891
2892         MSVC __forceinline slows down JSC release build fivefold after r229391
2893         https://bugs.webkit.org/show_bug.cgi?id=184062
2894
2895         Reviewed by Alex Christensen.
2896
2897         * platform/graphics/FormatConverter.cpp:
2898         Factor ALWAYS_INLINE_EXCEPT_MSVC out to WTF.
2899
2900 2018-03-28  Zalan Bujtas  <zalan@apple.com>
2901
2902         Make it possible to override the screen size
2903         https://bugs.webkit.org/show_bug.cgi?id=184111
2904         <rdar://problem/38972181>
2905
2906         Reviewed by Tim Horton.
2907
2908         We just call screenSize() atm.
2909
2910         * page/Chrome.cpp:
2911         (WebCore::Chrome::overrideScreenSize const):
2912         * page/Chrome.h:
2913         * page/ChromeClient.h:
2914         * platform/HostWindow.h:
2915         * platform/PlatformScreen.h:
2916         * platform/ios/PlatformScreenIOS.mm:
2917         (WebCore::screenRect):
2918         (WebCore::overrideScreenSize):
2919
2920 2018-03-28  Timothy Hatcher  <timothy@apple.com>
2921
2922         Include the 'text' color keyword as a system color.
2923
2924         https://bugs.webkit.org/show_bug.cgi?id=184113
2925         rdar://problem/38779267
2926
2927         Reviewed by Tim Horton.
2928
2929         * css/StyleColor.cpp:
2930         (WebCore::StyleColor::isColorKeyword): Don't check CSSValueMenu, it is a system color and is included.
2931         (WebCore::StyleColor::isSystemColor): Include CSSValueText. Check CSSValueWebkitFocusRingColor in the range,
2932         since it is immediately after CSSValueAppleSystemYellow.
2933
2934 2018-03-28  Wenson Hsieh  <wenson_hsieh@apple.com>
2935
2936         [iOS] Multiple select appearance doesn't update when selecting or deselecting rows in the picker view
2937         https://bugs.webkit.org/show_bug.cgi?id=184110
2938         <rdar://problem/38796648>
2939
2940         Reviewed by Tim Horton.
2941
2942         HTMLSelectElement::optionSelectedByUser is invoked upon user interaction with a select menu. This currently
2943         takes two separate codepaths, depending on whether or not the menu list appearance is being used to render the
2944         select. If a menu list appearance is used, we call selectOption(), which updates validity, updates the element
2945         renderer, and then dispatches a `change` event if needed.
2946
2947         However, if updateSelectedState() is used, we only update form validity and then dispatch the `change` event
2948         without updating the renderer, leaving it stale.
2949
2950         Test: fast/forms/ios/ipad/multiple-select-updates-renderer.html
2951
2952         * html/HTMLSelectElement.cpp:
2953         (WebCore::HTMLSelectElement::optionSelectedByUser):
2954
2955         Update the renderer after updating the DOM to reflect the selected option.
2956
2957 2018-03-28  Daniel Bates  <dabates@apple.com>
2958
2959         Substitute "strong password confirmation auto fill" for "strong confirmation password auto fill"
2960         <rdar://problem/36518856>
2961
2962         * English.lproj/Localizable.strings:
2963         * platform/LocalizedStrings.cpp:
2964         (WebCore::AXAutoFillStrongConfirmationPasswordLabel):
2965
2966 2018-03-28  Daniel Bates  <dabates@apple.com>
2967
2968         WebSocket cookie incorrectly stored
2969         https://bugs.webkit.org/show_bug.cgi?id=184100
2970         <rdar://problem/37928715>
2971
2972         Reviewed by Brent Fulgham.
2973
2974         A cookie received in a WebSocket response should be stored with respect to the
2975         origin of the WebSocket server in order for it to be sent in a subsequent request.
2976
2977         Also removed a FIXME about implementing support for the long since
2978         deprecated Set-Cookie2 header.
2979
2980         Test: http/tests/websocket/tests/hybi/websocket-cookie-overwrite-behavior.html
2981
2982         * Modules/websockets/WebSocketChannel.cpp:
2983         (WebCore::WebSocketChannel::processBuffer):
2984         * Modules/websockets/WebSocketHandshake.h:
2985
2986 2018-03-28  Chris Dumez  <cdumez@apple.com>
2987
2988         Do process swap when opening a cross-origin URL via window.open(url, '_blank', 'noopener')
2989         https://bugs.webkit.org/show_bug.cgi?id=183962
2990         <rdar://problem/38817833>
2991
2992         Reviewed by Brady Eidson.
2993
2994         Pass extra bits of information to the UIProcess via NavigationAction:
2995         - Is it a cross origin navigation caused by window.open()
2996         - Does the navigated frame have an opener
2997
2998         This information is useful to determine on UIProcess side if we want
2999         to swap WebProcess.
3000
3001         * loader/FrameLoadRequest.h:
3002         (WebCore::FrameLoadRequest::setIsCrossOriginWindowOpenNavigation):
3003         (WebCore::FrameLoadRequest::isCrossOriginWindowOpenNavigation const):
3004         * loader/FrameLoader.cpp:
3005         (WebCore::FrameLoader::loadURL):
3006         * loader/NavigationAction.h:
3007         (WebCore::NavigationAction::setIsCrossOriginWindowOpenNavigation):
3008         (WebCore::NavigationAction::isCrossOriginWindowOpenNavigation const):
3009         (WebCore::NavigationAction::setOpener):
3010         (WebCore::NavigationAction::opener const):
3011         * page/DOMWindow.cpp:
3012         (WebCore::DOMWindow::createWindow):
3013
3014 2018-03-28  Chris Dumez  <cdumez@apple.com>
3015
3016         Thread safety issue in IDBFactory' shouldThrowSecurityException()
3017         https://bugs.webkit.org/show_bug.cgi?id=184064
3018
3019         Reviewed by Ryosuke Niwa.
3020
3021         shouldThrowSecurityException() gets called on a non-main thread but
3022         it ended up using the SchemeRegistry via SecurityOrigin::canAccessDatabase()
3023         which calls SecurityOrigin::isLocal().
3024
3025         Since using the SchemeRegistry from the background thread is not safe
3026         (we recently added locks which we're trying to remove), and since SecurityOrigin
3027         methods are often called from background threads, this patch make SecurityOrigin::isLocal()
3028         safe to call from a background thread. To achieve this, we now query the SchemeRegistry
3029         in the SecurityOrigin constructor instead as SecurityOrigin objects are expected to be
3030         constructed on the main thread.
3031
3032         * page/SecurityOrigin.cpp:
3033         (WebCore::SecurityOrigin::SecurityOrigin):
3034         (WebCore::SecurityOrigin::isLocal const): Deleted.
3035         * page/SecurityOrigin.h:
3036         (WebCore::SecurityOrigin::isLocal const):
3037
3038 2018-03-28  Ryan Haddad  <ryanhaddad@apple.com>
3039
3040         Unreviewed, rolling out r230033.
3041
3042         The LayoutTests modified in this change fail an assertion on
3043         WK1.
3044
3045         Reverted changeset:
3046
3047         "[Web Animations] Implement more CSSPropertyBlendingClient
3048         methods"
3049         https://bugs.webkit.org/show_bug.cgi?id=184077
3050         https://trac.webkit.org/changeset/230033
3051
3052 2018-03-28  Chris Dumez  <cdumez@apple.com>
3053
3054         WebSocket::didReceiveMessage() may construct a SecurityOrigin object on a non-main thread
3055         https://bugs.webkit.org/show_bug.cgi?id=184068
3056
3057         Reviewed by Youenn Fablet.
3058
3059         WebSocket::didReceiveMessage() may construct a SecurityOrigin object on a non-main thread,
3060         which is not safe. We now use SecurityOriginData since we only need an origin String and
3061         it is safe to construct a SecurityOriginData on any thread.
3062
3063         * Modules/websockets/WebSocket.cpp:
3064         (WebCore::WebSocket::didReceiveMessage):
3065
3066 2018-03-28  Wenson Hsieh  <wenson_hsieh@apple.com>
3067
3068         [Extra zoom mode] Make boosted text autosizing values switchable at runtime
3069         https://bugs.webkit.org/show_bug.cgi?id=184092
3070         <rdar://problem/38939917>
3071
3072         Reviewed by Tim Horton.
3073
3074         In r228697, we introduced a new set of boosted text autosizing constants tuned for extra zoom mode, which are
3075         currently hard-coded as default values in SettingsBase. However, we've since identified cases where clients may
3076         want to opt in or out of boosted text autosizing values and just use the existing values.
3077
3078         This replaces settings to adjust text autosizing constants with a flag to enable or disable boosted text
3079         autosizing; when changed, we update all three text autosizing parameters to their default or boosted values, and
3080         then trigger style recalculation.
3081
3082         Test: TextAutosizingBoost.ChangeAutosizingBoostAtRuntime
3083
3084         * page/Settings.yaml:
3085         * page/SettingsBase.cpp:
3086         (WebCore::SettingsBase::shouldEnableTextAutosizingBoostChanged):
3087         (WebCore::SettingsBase::defaultOneLineTextMultiplierCoefficient): Deleted.
3088         (WebCore::SettingsBase::defaultMultiLineTextMultiplierCoefficient): Deleted.
3089         (WebCore::SettingsBase::defaultMaxTextAutosizingScaleIncrease): Deleted.
3090
3091         Changed these to constant values instead of helper functions, and also introduced boosted text autosizing
3092         constants for use in extra zoom mode.
3093
3094         * page/SettingsBase.h:
3095         (WebCore::SettingsBase::oneLineTextMultiplierCoefficient const):
3096         (WebCore::SettingsBase::multiLineTextMultiplierCoefficient const):
3097         (WebCore::SettingsBase::maxTextAutosizingScaleIncrease const):
3098         * rendering/RenderThemeIOS.mm:
3099         (WebCore::RenderThemeIOS::extraDefaultStyleSheet):
3100
3101         Tweak the stylesheet to make `-webkit-text-size-adjust: auto` overridable by web content. Adding the !important
3102         is breaking many websites that positioned text such that it is positioned within layout viewport bounds without
3103         text autosizing.
3104
3105 2018-03-28  Brent Fulgham  <bfulgham@apple.com>
3106
3107         Avoid uninitialized mach ports
3108         https://bugs.webkit.org/show_bug.cgi?id=184090
3109         <rdar://problem/37261129>
3110
3111         Reviewed by Chris Dumez.
3112
3113         It is possible for mach_port_allocate to return an error, but we rarely check its return value. The value
3114         of the argument passed to mach_port_allocate is not guaranteed to be valid when it returns an error, so
3115         there is a potential for us to try to use invalid ports.
3116
3117         We should always check return values, and ensure that the mach port variables we seek to initialize are
3118         kept in a valid state.
3119
3120         No new tests, no Web-facing behavior change.
3121
3122         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
3123         (WebCore::attachToAppleGraphicsControl): Initialize masterPort to a default value.
3124
3125 2018-03-28  Antoine Quint  <graouts@apple.com>
3126
3127         [Web Animations] Implement more CSSPropertyBlendingClient methods
3128         https://bugs.webkit.org/show_bug.cgi?id=184077
3129
3130         Reviewed by Dean Jackson.
3131
3132         We only had stubs for several of the CSSPropertyBlendingClient methods and thus always implied that we
3133         were animating non-matching transform, filter and backdrop-filter properties. We now implement those using
3134         the same code used in KeyframeAnimation. This allows for 31 new tests to opt into the CSS Animations and
3135         CSS Transitions as Web Animations feature.
3136
3137         * animation/KeyframeEffectReadOnly.cpp:
3138         (WebCore::KeyframeEffectReadOnly::copyPropertiesFromSource):
3139         (WebCore::KeyframeEffectReadOnly::updateBlendingKeyframes):
3140         (WebCore::KeyframeEffectReadOnly::setBlendingKeyframes):
3141         (WebCore::KeyframeEffectReadOnly::checkForMatchingTransformFunctionLists):
3142         (WebCore::KeyframeEffectReadOnly::checkForMatchingFilterFunctionLists):
3143         (WebCore::KeyframeEffectReadOnly::checkForMatchingBackdropFilterFunctionLists):
3144         (WebCore::KeyframeEffectReadOnly::computeCSSAnimationBlendingKeyframes):
3145         (WebCore::KeyframeEffectReadOnly::computeCSSTransitionBlendingKeyframes):
3146         * animation/KeyframeEffectReadOnly.h:
3147
3148 2018-03-28  Antoine Quint  <graouts@apple.com>
3149
3150         [Web Animations] Comparing two matching FramesTimingFunction objects fails
3151         https://bugs.webkit.org/show_bug.cgi?id=184078
3152
3153         Reviewed by Jon Lee.
3154
3155         Fix a stupid mistake in the == operator for FramesTimingFunction. Without a correct check, we would mistakenly interrupt and
3156         restart any transition with a frames() timing function when we check that the Animation objects are similar.
3157
3158         * platform/animation/TimingFunction.h:
3159
3160 2018-03-28  Miguel Gomez  <magomez@igalia.com>
3161
3162         [GTK][WPE] Remove UpdateAtlas
3163         https://bugs.webkit.org/show_bug.cgi?id=184042
3164
3165         Reviewed by Žan Doberšek.
3166
3167         Remove UpdateAtlas and AreaAllocator classes. Instead of using UpdateAtlas as a cache
3168         of buffers to render tiles with cairo, allocate a new buffer for each tile instead.
3169
3170         Covered by existent tests.
3171
3172         * loader/EmptyClients.h:
3173         * page/ChromeClient.h:
3174         * platform/TextureMapper.cmake:
3175         * platform/graphics/texmap/coordinated/AreaAllocator.cpp: Removed.
3176         * platform/graphics/texmap/coordinated/AreaAllocator.h: Removed.
3177         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
3178         (WebCore::CoordinatedGraphicsLayer::updateContentBuffers):
3179         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
3180         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
3181         * platform/graphics/texmap/coordinated/SurfaceUpdateInfo.h:
3182         (): Deleted.
3183         * platform/graphics/texmap/coordinated/UpdateAtlas.cpp: Removed.
3184         * platform/graphics/texmap/coordinated/UpdateAtlas.h: Removed.
3185         * testing/Internals.cpp:
3186         (WebCore::Internals::resetToConsistentState):
3187
3188 2018-03-27  Michael Catanzaro  <mcatanzaro@igalia.com>
3189
3190         Unreviewed, rolling out r230008.
3191
3192         Lots of HTTP test failures
3193
3194         Reverted changeset:
3195
3196         "Remove unused libsoup ResourceHandle implementation"
3197         https://bugs.webkit.org/show_bug.cgi?id=184048
3198         https://trac.webkit.org/changeset/230008
3199
3200 2018-03-27  Chris Dumez  <cdumez@apple.com>
3201
3202         Make it possible to call ContentSecurityPolicy::upgradeInsecureRequestIfNeeded() from non-main threads
3203         https://bugs.webkit.org/show_bug.cgi?id=184029
3204
3205         Reviewed by Youenn Fablet.
3206
3207         Make it possible to call ContentSecurityPolicy::upgradeInsecureRequestIfNeeded() from non-main threads
3208         by having it use SecurityOriginData (which is safe to construct on non-main threads) instead of
3209         SecurityOrigin (which isn't).
3210
3211         ContentSecurityPolicy::upgradeInsecureRequestIfNeeded() is already called from non-main thread in
3212         FetchLoader, XHR and WebSocket when used in workers. This wasn't safe.
3213
3214         * loader/DocumentWriter.cpp:
3215         (WebCore::DocumentWriter::begin):
3216         * page/csp/ContentSecurityPolicy.cpp:
3217         (WebCore::ContentSecurityPolicy::upgradeInsecureRequestIfNeeded const):
3218         (WebCore::ContentSecurityPolicy::setUpgradeInsecureRequests):
3219         (WebCore::ContentSecurityPolicy::takeNavigationRequestsToUpgrade):
3220         (WebCore::ContentSecurityPolicy::setInsecureNavigationRequestsToUpgrade):
3221         * page/csp/ContentSecurityPolicy.h:
3222
3223 2018-03-27  Daniel Bates  <dabates@apple.com>
3224
3225         Attempt to fix media control layout tests after <https://trac.webkit.org/changeset/230006/>
3226         (https://bugs.webkit.org/show_bug.cgi?id=179983)
3227
3228         Exempt elements in user agent shadow DOM from having to perform a potentially CORS-
3229         enabled fetch for a mask image to try to fix the following tests from timing out:
3230             media/modern-media-controls/media-controller/media-controller-inline-to-fullscreen-to-inline.html
3231             media/modern-media-controls/media-controller/media-controller-inline-to-fullscreen-to-pip-to-inline.html
3232
3233         * style/StylePendingResources.cpp:
3234         (WebCore::Style::loadPendingImage):
3235
3236 2018-03-27  Per Arne Vollan  <pvollan@apple.com>
3237
3238         The layout test fast/canvas/webgl/read-pixels-test.html is timing out.
3239         https://bugs.webkit.org/show_bug.cgi?id=183923
3240         <rdar://problem/38756869>
3241
3242         Reviewed by Brent Fulgham.
3243
3244         The test is timing out when we do not interact directly with the WindowServer, causing
3245         OpenGL to fall back to software rendering. In this mode, any call to CGLChoosePixelFormat
3246         requesting an accelerated pixel format will fail because it cannot determine which GPU is
3247         connected to the display.
3248
3249         OpenGL treats all GPUs as if they were offline when used in a process (like the WebContent
3250         process) that does not directly control the display.
3251
3252         We can get correct behavior if we tell OpenGL which GPU is currently connected to the
3253         display, and if we instruct CGLChoosePixelFormat to create an offline renderer pixel format
3254         by including the 'kCGLPFAAllowOfflineRenderers' flag in its arguments.
3255
3256         We can use CGLSetVirtualScreen with an OpenGL display mask that tells the OpenGL framework
3257         which GPU it should use.
3258
3259         See https://developer.apple.com/library/content/technotes/tn2229/_index.html#//apple_ref/doc/uid/DTS40008924-CH1-SUBSECTION7
3260         for details on how the virtual screen is found from the OpenGL display mask.
3261
3262         No new tests, covered by existing tests.
3263
3264         * WebCore.xcodeproj/project.pbxproj:
3265         * platform/graphics/GraphicsContext3D.h:
3266         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
3267         (WebCore::setPixelFormat):
3268         (WebCore::identifyAndSetCurrentGPU):
3269         (WebCore::GraphicsContext3D::GraphicsContext3D):
3270         (WebCore::GraphicsContext3D::setOpenGLDisplayMask):
3271         (WebCore::GraphicsContext3D::allowOfflineRenderers):
3272
3273 2018-03-27  Jiewen Tan  <jiewen_tan@apple.com>
3274
3275         [WebAuthN] Implement authenticatorGetAssertion
3276         https://bugs.webkit.org/show_bug.cgi?id=183881
3277         <rdar://problem/37258628>
3278
3279         Reviewed by Brent Fulgham.
3280
3281         This patch does the following few things:
3282         1) It implements the spec: https://www.w3.org/TR/webauthn/#op-get-assertion as of 5 December 2017.
3283         2) It tweaks encoding/decoding of PublicKeyCredentialRequestOptions such that options can be passed
3284         between UI and Web processes.
3285         3) It refines the way how LocalAuthenticator::makeCredential find intersection between
3286         excludeCredentialDescriptorList and existing credentials in the authenticator, such that it is faster.
3287         Basically, it takes the CredentialID from the list and treat it as an ASCII string and put it into a
3288         HashSet<String>. It should not matter if a duplicated CredentialID is added. If the hash set is not
3289         empty, the algorithm then queries Keychain for all CredentialIDs related to the current RP ID once.
3290         For every queried CredentialID, the algorithm then treats it as an ASCII string as well and look for
3291         a match in the hash set to produce the intersetction. The new way is also employed in
3292         LocalAuthenticator::getAssertion as well.
3293         4) It abstracts the way to produce authData and thus reorders a bit of code in
3294         LocalAuthenticator::makeCredential.
3295
3296         Covered by API tests.
3297
3298         * Modules/webauthn/AuthenticatorManager.cpp:
3299         (WebCore::AuthenticatorManager::create const):
3300         (WebCore::AuthenticatorManager::discoverFromExternalSource const):
3301         * Modules/webauthn/PublicKeyCredentialCreationOptions.h:
3302         * Modules/webauthn/PublicKeyCredentialRequestOptions.h:
3303         (WebCore::PublicKeyCredentialRequestOptions::encode const):
3304         (WebCore::PublicKeyCredentialRequestOptions::decode):
3305         * Modules/webauthn/cocoa/LocalAuthenticator.h:
3306         * Modules/webauthn/cocoa/LocalAuthenticator.mm:
3307         (WebCore::LocalAuthenticatorInternal::buildAuthData):
3308         (WebCore::LocalAuthenticatorInternal::produceHashSet):
3309         (WebCore::LocalAuthenticator::makeCredential):
3310         (WebCore::LocalAuthenticator::getAssertion):
3311         (WebCore::LocalAuthenticator::issueClientCertificate const):
3312         * WebCore.xcodeproj/project.pbxproj:
3313
3314 2018-03-27  Chris Dumez  <cdumez@apple.com>
3315
3316         Avoid constructing SecurityOrigin objects from non-main threads
3317         https://bugs.webkit.org/show_bug.cgi?id=184024
3318
3319         Reviewed by Youenn Fablet.
3320
3321         Avoid constructing SecurityOrigin objects from non-main threads as much as possible
3322         as it is not safe. This patch gets rid of most offending cases but not all of them
3323         yet, which is why I haven't added a ASSERT(isMainThread()) to the SecurityOrigin
3324         constructor yet.
3325
3326         For example, ContentSecurityPolicy::upgradeInsecureRequestIfNeeded() currently
3327         gets called from non-main threads and construct a SecurityOrigin. Fixing this
3328         will require some refactoring that would have made this patch much larger.
3329
3330         * loader/DocumentLoader.cpp:
3331         (WebCore::DocumentLoader::matchRegistration):
3332         * page/EventSource.cpp:
3333         (WebCore::EventSource::didReceiveResponse):
3334         * page/SecurityOrigin.cpp:
3335         (WebCore::SecurityOrigin::SecurityOrigin):
3336         * page/SecurityOrigin.h:
3337         (WebCore::SecurityOrigin::isPotentiallyTrustworthy const):
3338         * testing/Internals.cpp:
3339         (WebCore::Internals::hasServiceWorkerRegistration):
3340         * workers/DedicatedWorkerGlobalScope.cpp:
3341         (WebCore::DedicatedWorkerGlobalScope::create):
3342         (WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope):
3343         * workers/DedicatedWorkerGlobalScope.h:
3344         * workers/DedicatedWorkerThread.cpp:
3345         (WebCore::DedicatedWorkerThread::createWorkerGlobalScope):
3346         * workers/DedicatedWorkerThread.h:
3347         * workers/WorkerGlobalScope.cpp:
3348         (WebCore::WorkerGlobalScope::WorkerGlobalScope):
3349         * workers/WorkerGlobalScope.h:
3350         * workers/WorkerLocation.cpp:
3351         (WebCore::WorkerLocation::origin const):
3352         * workers/WorkerThread.cpp:
3353         (WebCore::WorkerThreadStartupData::WorkerThreadStartupData):
3354         (WebCore::WorkerThread::workerThread):
3355         * workers/WorkerThread.h:
3356         * workers/service/SWClientConnection.h:
3357         * workers/service/ServiceWorkerContainer.cpp:
3358         (WebCore::ServiceWorkerContainer::getRegistration):
3359         (WebCore::ServiceWorkerContainer::getRegistrations):
3360         * workers/service/ServiceWorkerGlobalScope.cpp:
3361         (WebCore::ServiceWorkerGlobalScope::create):
3362         (WebCore::ServiceWorkerGlobalScope::ServiceWorkerGlobalScope):
3363         * workers/service/ServiceWorkerGlobalScope.h:
3364         * workers/service/ServiceWorkerProvider.cpp:
3365         (WebCore::ServiceWorkerProvider::mayHaveServiceWorkerRegisteredForOrigin):
3366         * workers/service/ServiceWorkerProvider.h:
3367         * workers/service/context/ServiceWorkerThread.cpp:
3368         (WebCore::ServiceWorkerThread::createWorkerGlobalScope):
3369         (WebCore::fireMessageEvent):
3370         (WebCore::ServiceWorkerThread::postMessageToServiceWorker):
3371         * workers/service/context/ServiceWorkerThread.h:
3372
3373 2018-03-27  Alex Christensen  <achristensen@webkit.org>
3374
3375         Remove unused libsoup ResourceHandle implementation
3376         https://bugs.webkit.org/show_bug.cgi?id=184048
3377
3378         Reviewed by Michael Catanzaro.
3379
3380         This code is unused since r228901 so let's remove it!
3381
3382         * platform/network/ResourceHandle.h:
3383         * platform/network/ResourceHandleInternal.h:
3384         (WebCore::ResourceHandleInternal::ResourceHandleInternal):
3385         * platform/network/soup/ResourceHandleSoup.cpp:
3386         (WebCore::ResourceHandle::~ResourceHandle):
3387         (WebCore::ResourceHandleInternal::soupSession):
3388         (WebCore::ResourceHandle::cancelledOrClientless):
3389         (WebCore::ResourceHandle::ensureReadBuffer):
3390         (WebCore::ResourceHandle::currentStreamPosition const):
3391         (WebCore::ResourceHandle::platformContinueSynchronousDidReceiveResponse):
3392         (WebCore::ResourceHandle::didStartRequest):
3393         (WebCore::ResourceHandle::start):
3394         (WebCore::ResourceHandle::releaseForDownload):
3395         (WebCore::ResourceHandle::sendPendingRequest):
3396         (WebCore::ResourceHandle::cancel):
3397         (WebCore::ResourceHandle::shouldUseCredentialStorage):
3398         (WebCore::ResourceHandle::continueDidReceiveAuthenticationChallenge):
3399         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
3400         (WebCore::ResourceHandle::receivedRequestToContinueWithoutCredential):
3401         (WebCore::ResourceHandle::receivedCredential):
3402         (WebCore::ResourceHandle::receivedCancellation):
3403         (WebCore::ResourceHandle::receivedChallengeRejection):
3404         (WebCore::ResourceHandle::platformSetDefersLoading):
3405         (WebCore::sessionFromContext): Deleted.
3406         (WebCore::ResourceHandle::create): Deleted.
3407         (WebCore::ResourceHandle::ResourceHandle): Deleted.
3408         (WebCore::isAuthenticationFailureStatusCode): Deleted.
3409         (WebCore::tlsErrorsChangedCallback): Deleted.
3410         (WebCore::gotHeadersCallback): Deleted.
3411         (WebCore::applyAuthenticationToRequest): Deleted.
3412         (WebCore::restartedCallback): Deleted.
3413         (WebCore::shouldRedirect): Deleted.
3414         (WebCore::shouldRedirectAsGET): Deleted.
3415         (WebCore::continueAfterWillSendRequest): Deleted.
3416         (WebCore::doRedirect): Deleted.
3417         (WebCore::redirectSkipCallback): Deleted.
3418         (WebCore::wroteBodyDataCallback): Deleted.
3419         (WebCore::cleanupSoupRequestOperation): Deleted.
3420         (WebCore::nextMultipartResponsePartCallback): Deleted.
3421         (WebCore::sendRequestCallback): Deleted.
3422         (WebCore::continueAfterDidReceiveResponse): Deleted.
3423         (WebCore::startingCallback): Deleted.