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