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