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