httpCookieStore.getAllCookies() does not always call completion block
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-08-02  Sihui Liu  <sihui_liu@apple.com>
2
3         httpCookieStore.getAllCookies() does not always call completion block
4         https://bugs.webkit.org/show_bug.cgi?id=188242
5
6         Reviewed by Chris Dumez.
7
8         Take background assertion for network process to keep it alive during cookieStore API calls.
9
10         * UIProcess/GenericCallback.h:
11         * UIProcess/WebCookieManagerProxy.cpp:
12         (WebKit::WebCookieManagerProxy::getHostnamesWithCookies):
13         (WebKit::WebCookieManagerProxy::deleteCookie):
14         (WebKit::WebCookieManagerProxy::deleteAllCookiesModifiedSince):
15         (WebKit::WebCookieManagerProxy::setCookie):
16         (WebKit::WebCookieManagerProxy::setCookies):
17         (WebKit::WebCookieManagerProxy::getAllCookies):
18         (WebKit::WebCookieManagerProxy::getCookies):
19         (WebKit::WebCookieManagerProxy::setHTTPCookieAcceptPolicy):
20         (WebKit::WebCookieManagerProxy::getHTTPCookieAcceptPolicy):
21
22 2018-08-02  Sihui Liu  <sihui_liu@apple.com>
23
24         [Cocoa] setCookie API fails to set session cookies for defaultDataStore if processPool created but not used
25         https://bugs.webkit.org/show_bug.cgi?id=188209
26
27         Reviewed by Geoffrey Garen.
28
29         If defaultDataStore is already created when launching network process, it means user 
30         probably set cookies for default session via API, so we should update m_websiteDataStore to 
31         make sure pendingCookies is passed to network process.
32
33         * UIProcess/WebProcessPool.cpp:
34         (WebKit::WebProcessPool::ensureNetworkProcess):
35
36 2018-08-02  Alex Christensen  <achristensen@webkit.org>
37
38         Use WTF::Variant for WebPreferencesStore::Value
39         https://bugs.webkit.org/show_bug.cgi?id=188250
40
41         Reviewed by Sam Weinig.
42
43         It was conceptually a variant. This just uses an actual WTF::Variant.
44         Since it's encoded and decoded, I wrote variadic template encoders and decoders
45         like we have for other types (Expected, std::tuple, KeyValuePair, etc.)
46
47         * Platform/IPC/ArgumentCoders.h:
48         (IPC::VariantCoder::encode):
49         (IPC::VariantCoder::decode):
50         Introduce ArgumentCoder<Variant>, which encodes which type the Variant currently
51         holds followed by the encoding of the current type.
52         * Platform/IPC/Decoder.cpp:
53         (IPC::Decoder::Decoder):
54         * Platform/IPC/Decoder.h:
55         * Platform/IPC/mac/ConnectionMac.mm:
56         (IPC::createMessageDecoder):
57         Use move semantics to prevent an unnecessary copy of the Vector<Attachment>
58         * Scripts/PreferencesTemplates/WebPreferencesStoreDefaultsMap.cpp.erb:
59         * Shared/WebPreferencesStore.cpp:
60         (WebKit::WebPreferencesStore::decode):
61         Use modern std::optional-based decoding supported by the new Variant decoding.
62         (WebKit::valueForKey):
63         Use WTF::get and WTF::holds_alternative instead of custom type checks.
64         (WebKit::WebPreferencesStore::Value::encode const): Deleted.
65         (WebKit::WebPreferencesStore::Value::decode): Deleted.
66         (WebKit::as<String>): Deleted.
67         (WebKit::as<bool>): Deleted.
68         (WebKit::as<uint32_t>): Deleted.
69         (WebKit::as<double>): Deleted.
70         * Shared/WebPreferencesStore.h:
71         (WebKit::WebPreferencesStore::Value::Value): Deleted.
72         (WebKit::WebPreferencesStore::Value::operator=): Deleted.
73         (WebKit::WebPreferencesStore::Value::~Value): Deleted.
74         (WebKit::WebPreferencesStore::Value::type const): Deleted.
75         (WebKit::WebPreferencesStore::Value::asString const): Deleted.
76         (WebKit::WebPreferencesStore::Value::asBool const): Deleted.
77         (WebKit::WebPreferencesStore::Value::asUInt32 const): Deleted.
78         (WebKit::WebPreferencesStore::Value::asDouble const): Deleted.
79         (WebKit::WebPreferencesStore::Value::destroy): Deleted.
80         (): Deleted.
81         Use WTF::Variant instead of a custom type/union pair.
82
83 2018-08-02  Alex Christensen  <achristensen@webkit.org>
84
85         Check with SafeBrowsing during navigation in WKWebView
86         https://bugs.webkit.org/show_bug.cgi?id=188133
87
88         Reviewed by Chris Dumez.
89
90         This turns WebFramePolicyListenerProxy into an object that now listens for the results
91         of two processes happening in parallel: the API::NavigationClient's decidePolicyForNavigation{Action, Response}
92         (which it was already waiting for) and, on platforms that support it, the SafariSafeBrowsing framework's check.
93         The first result is stored as it waits for the second result unless the first result is the API::NavigationClient
94         saying to cancel or convert the navigation to a download, in which cases we don't care what the safe browsing
95         framework results are because we won't show the URL in the browser.
96
97         Nothing is done with the safe browsing results yet.
98
99         * UIProcess/Cocoa/SafeBrowsingResultCocoa.mm: Added.
100         (WebKit::SafeBrowsingResult::SafeBrowsingResult):
101         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
102         (WebKit::WebPageProxy::beginSafeBrowsingCheck):
103         * UIProcess/SafeBrowsingResult.h: Added.
104         (WebKit::SafeBrowsingResult::provider const):
105         (WebKit::SafeBrowsingResult::isPhishing const):
106         (WebKit::SafeBrowsingResult::isMalware const):
107         (WebKit::SafeBrowsingResult::isUnwantedSoftware const):
108         (WebKit::SafeBrowsingResult::isKnownToBeUnsafe const):
109         * UIProcess/WebFramePolicyListenerProxy.cpp:
110         (WebKit::WebFramePolicyListenerProxy::WebFramePolicyListenerProxy):
111         (WebKit::WebFramePolicyListenerProxy::didReceiveSafeBrowsingResults):
112         (WebKit::WebFramePolicyListenerProxy::use):
113         (WebKit::WebFramePolicyListenerProxy::download):
114         (WebKit::WebFramePolicyListenerProxy::ignore):
115         * UIProcess/WebFramePolicyListenerProxy.h:
116         (WebKit::WebFramePolicyListenerProxy::create):
117         * UIProcess/WebFrameProxy.cpp:
118         (WebKit::WebFrameProxy::setUpPolicyListenerProxy):
119         * UIProcess/WebFrameProxy.h:
120         * UIProcess/WebPageProxy.cpp:
121         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
122         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
123         (WebKit::WebPageProxy::decidePolicyForResponse):
124         * UIProcess/WebPageProxy.h:
125         * WebKit.xcodeproj/project.pbxproj:
126
127 2018-08-02  Wenson Hsieh  <wenson_hsieh@apple.com>
128
129         [iOS] Keyboard becomes unresponsive after pressing delete while pressing down on a character key with accents
130         https://bugs.webkit.org/show_bug.cgi?id=188251
131         <rdar://problem/37842108>
132
133         Reviewed by Tim Horton.
134
135         Fixes a bug in key event handling where invoking -handleKeyWebEvent:withCompletionHandler: from within the
136         completion callback of a previous call to -handleKeyWebEvent:withCompletionHandler: would cause the completion
137         callback to be cleared out prematurely. In some cases (as described in the title of this bug), UIKit exercises
138         this codepath and subsequently hangs due to their completion block never getting invoked by WebKit.
139
140         Test: KeyboardInputTests.CanHandleKeyEventInCompletionHandler
141
142         * UIProcess/ios/WKContentViewInteraction.h:
143         * UIProcess/ios/WKContentViewInteraction.mm:
144         (-[WKContentView handleKeyWebEvent:withCompletionHandler:]):
145         (-[WKContentView _didHandleKeyEvent:eventWasHandled:]):
146
147 2018-08-01  Dan Bernstein  <mitz@apple.com>
148
149         Optionally expose Attr::style to JavaScript
150         https://bugs.webkit.org/show_bug.cgi?id=188226
151         <rdar://problem/42818113>
152
153         Reviewed by Darin Adler.
154
155         * Shared/WebProcessCreationParameters.cpp:
156         (WebKit::WebProcessCreationParameters::encode const): Encode new attrStyleEnabled member.
157         (WebKit::WebProcessCreationParameters::decode): Decode new attrStyleEnabled member.
158         * Shared/WebProcessCreationParameters.h: Define new attrStyleEnabled member, initialized to
159           false.
160
161         * UIProcess/API/APIProcessPoolConfiguration.cpp:
162         (API::ProcessPoolConfiguration::copy): Copy new m_attrStyleEnabled member.
163         * UIProcess/API/APIProcessPoolConfiguration.h: Define new m_attrStyleEnabled member.
164
165         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h: Declare new attrStyleEnabled boolean
166           property.
167         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
168         (-[_WKProcessPoolConfiguration attrStyleEnabled]): New accessor.
169         (-[_WKProcessPoolConfiguration setAttrStyleEnabled:]): Ditto.
170
171         * UIProcess/WebProcessPool.cpp:
172         (WebKit::WebProcessPool::initializeNewWebProcess): Initialize parameters.attrStyleEnabled
173           from the configuration.
174
175         * WebProcess/WebProcess.cpp:
176         (WebKit::WebProcess::initializeWebProcess): Set the attrStyleEnabled runtime feature based
177           on the creation parameters.
178
179 2018-08-02  David Fenton  <david_fenton@apple.com>
180
181         Unreviewed, rolling out r234489.
182
183         Caused 50+ crashes and 60+ API failures on iOS
184
185         Reverted changeset:
186
187         "[WTF] Rename String::format to String::deprecatedFormat"
188         https://bugs.webkit.org/show_bug.cgi?id=188191
189         https://trac.webkit.org/changeset/234489
190
191 2018-08-01  Tomas Popela  <tpopela@redhat.com>
192
193         [WTF] Rename String::format to String::deprecatedFormat
194         https://bugs.webkit.org/show_bug.cgi?id=188191
195
196         Reviewed by Darin Adler.
197
198         It should be replaced with string concatenation.
199
200         * NetworkProcess/soup/NetworkProcessSoup.cpp:
201         (WebKit::buildAcceptLanguages):
202         * Platform/IPC/win/ConnectionWin.cpp:
203         (IPC::Connection::createServerAndClientIdentifiers):
204         * Shared/WebMemorySampler.cpp:
205         (WebKit::WebMemorySampler::writeHeaders):
206         * Shared/win/WebEventFactory.cpp:
207         (WebKit::keyIdentifierFromEvent):
208         * Shared/wpe/WebEventFactory.cpp:
209         (WebKit::identifierStringForKeyEvent):
210         * UIProcess/API/APINavigation.cpp:
211         (API::Navigation::loggingString const):
212         * UIProcess/API/glib/IconDatabase.cpp:
213         (WebKit::IconDatabase::performURLImport):
214         * UIProcess/Cocoa/ViewGestureController.cpp:
215         (WebKit::ViewGestureController::SnapshotRemovalTracker::startWatchdog):
216         * UIProcess/SuspendedPageProxy.cpp:
217         (WebKit::SuspendedPageProxy::loggingString const):
218         * UIProcess/WebBackForwardList.cpp:
219         (WebKit::WebBackForwardList::loggingString):
220         * UIProcess/WebInspectorUtilities.cpp:
221         (WebKit::inspectorPageGroupIdentifierForPage):
222         * UIProcess/WebProcessPool.cpp:
223         (WebKit::WebProcessPool::processDidFinishLaunching):
224         (WebKit::WebProcessPool::startMemorySampler):
225         * UIProcess/gtk/InputMethodFilter.cpp:
226         (WebKit::InputMethodFilter::logHandleKeyboardEventForTesting):
227         (WebKit::InputMethodFilter::logHandleKeyboardEventWithCompositionResultsForTesting):
228         (WebKit::InputMethodFilter::logConfirmCompositionForTesting):
229         (WebKit::InputMethodFilter::logSetPreeditForTesting):
230
231 2018-08-01  Tim Horton  <timothy_horton@apple.com>
232
233         Using the keyboard arrow keys to scroll a webpage is very slow, not smooth, takes too long
234         https://bugs.webkit.org/show_bug.cgi?id=188239
235         <rdar://problem/22997654>
236
237         Reviewed by Simon Fraser.
238
239         Instead of depending on key repeat to drive scrolling with arrow keys held down,
240         run a display link that animates the scroll. We still do a single discrete scroll
241         first (so that you can tap the key and shift by line/page), but then on the first
242         repeat we ramp up to a constant velocity determined by the desired increment,
243         stopping when the key is lifted or a different key is pressed.
244
245         * UIProcess/API/Cocoa/WKWebView.mm:
246         (-[WKWebView _scrollByContentOffset:animated:]):
247         (-[WKWebView _scrollByContentOffset:]): Deleted.
248         * UIProcess/API/Cocoa/WKWebViewInternal.h:
249         Add animated parameter to scrollByContentOffset, and plumb it through to UIScrollView.
250
251         * UIProcess/ios/WKContentViewInteraction.h:
252         Add a WKKeyboardScrollingAnimator member.
253         Conform to WKKeyboardScrollable.
254
255         * UIProcess/ios/WKContentViewInteraction.mm:
256         (-[WKContentView setupInteraction]):
257         Install the WKKeyboardScrollingAnimator.
258
259         (-[WKContentView cleanupInteraction]):
260         Uninstall the WKKeyboardScrollingAnimator.
261
262         (-[WKContentView unscaledView]):
263         Fix a stupid style nit.
264
265         (-[WKContentView handleKeyWebEvent:]):
266         Give WKKeyboardScrollingAnimator the first shot at incoming keyboard events.
267         It will only consume events here if it's already performing a scrolling animation
268         (because otherwise they should go straight through to the page).
269
270         (-[WKContentView _interpretKeyEvent:isCharEvent:]):
271         Give WKKeyboardScrollingAnimator a shot at handling keyboard events that
272         the web content did not handle. We will only start a scrolling animation
273         if the page did not handle an event that would start a scroll.
274
275         (-[WKContentView isKeyboardScrollable]):
276         Part of WKKeyboardScrollable; only report ourselves as scrollable if
277         we would previously have allowed scrolling from keyboard events (if
278         we're not in contenteditable, and don't have a <select> focused).
279
280         (-[WKContentView distanceForScrollingIncrement:]):
281         Part of WKKeyboardScrollable; compute the distance for each scrolling increment.
282
283         (-[WKContentView scrollByContentOffset:animated:]):
284         Part of WKKeyboardScrollable; plumb scrolls up to WKWebView.
285
286         (-[WKContentView _scrollOffsetForEvent:]): Moved to WKKeyboardScrollingAnimator.mm.
287
288         * UIProcess/ios/WKKeyboardScrollingAnimator.h: Added.
289         * UIProcess/ios/WKKeyboardScrollingAnimator.mm: Added.
290         (-[WKKeyboardScrollingAnimator init]):
291         (-[WKKeyboardScrollingAnimator initWithScrollable:]):
292         (-[WKKeyboardScrollingAnimator invalidate]):
293         (-[WKKeyboardScrollingAnimator _scrollOffsetForEvent:]):
294         Compute the scroll offset given a particular event. This is moved from WKContentView;
295         otherwise the primary change is that it now asks the WKKeyboardScrollable
296         for the distance instead of computing it directly.
297
298         (-[WKKeyboardScrollingAnimator beginWithEvent:]):
299         If we're currently in the initial state (WaitingForFirstEvent), and
300         a given event should start a scroll, transition into WaitingForRepeat,
301         and do a single animated scroll of the appropriate distance.
302
303         (-[WKKeyboardScrollingAnimator handleKeyEvent:]):
304         If this key event should terminate a scroll (because it is either a keyup
305         or a non-scrolling keydown), shut down any running animations.
306
307         If this is the first key repeat after the initial scroll, start a scrolling
308         animation.
309
310         Eat the event if it either started or continued a scroll.
311
312         (-[WKKeyboardScrollingAnimator startAnimatedScroll]):
313         (-[WKKeyboardScrollingAnimator stopAnimatedScroll]):
314         Helpers to start and stop the display link and do some bookkeeping.
315
316         (-[WKKeyboardScrollingAnimator displayLinkFired:]):
317         Ask the WKKeyboardScrollable to scroll the content based on the frame time,
318         an acceleration curve, and the current animation's scrolling increment.
319
320         * WebKit.xcodeproj/project.pbxproj:
321
322 2018-08-01  Chris Dumez  <cdumez@apple.com>
323
324         Make sure cookies get flushed to disk before exiting or suspending the network process
325         https://bugs.webkit.org/show_bug.cgi?id=188241
326         <rdar://problem/42831831>
327
328         Reviewed by Alex Christensen and Geoffrey Garen.
329
330         Make sure cookies get flushed to disk before exiting or suspending the network process,
331         to make sure they do not get lost.
332
333         * NetworkProcess/NetworkProcess.cpp:
334         (WebKit::NetworkProcess::didClose):
335         (WebKit::NetworkProcess::actualPrepareToSuspend):
336         (WebKit::NetworkProcess::platformSyncAllCookies):
337         * NetworkProcess/NetworkProcess.h:
338         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
339         (WebKit::NetworkProcess::syncAllCookies):
340         (WebKit::NetworkProcess::platformSyncAllCookies):
341         * Shared/ChildProcess.cpp:
342         (WebKit::ChildProcess::didClose):
343         (WebKit::callExitNow):
344         (WebKit::callExitSoon):
345         (WebKit::ChildProcess::initialize):
346         (WebKit::didCloseOnConnectionWorkQueue): Deleted.
347         * Shared/ChildProcess.h:
348         (WebKit::ChildProcess::shouldCallExitWhenConnectionIsClosed const):
349
350 2018-08-01  Alex Christensen  <achristensen@webkit.org>
351
352         Move all calls to ResourceLoader::start to WebKitLegacy
353         https://bugs.webkit.org/show_bug.cgi?id=184946
354
355         Reviewed by Andy Estes.
356
357         * WebProcess/Network/WebLoaderStrategy.cpp:
358         (WebKit::WebLoaderStrategy::setDefersLoading):
359         * WebProcess/Network/WebLoaderStrategy.h:
360
361 2018-08-01  Nan Wang  <n_wang@apple.com>
362
363         AX: AOM: Add ARIA IDL Attribute Reflection
364         https://bugs.webkit.org/show_bug.cgi?id=184676
365         <rdar://problem/39476882>
366
367         Added ARIA property string reflection on Element, behind
368         a new runtime flag. 
369         Spec: https://w3c.github.io/aria/#idl-interface
370
371         Reviewed by Chris Fleizach.
372
373         * Shared/WebPreferences.yaml:
374         * UIProcess/API/C/WKPreferences.cpp:
375         (WKPreferencesSetAriaReflectionEnabled):
376         (WKPreferencesGetAriaReflectionEnabled):
377         * UIProcess/API/C/WKPreferencesRefPrivate.h:
378
379 2018-08-01  Alex Christensen  <achristensen@webkit.org>
380
381         Allow WebFramePolicyListenerProxy to be used multiple times
382         https://bugs.webkit.org/show_bug.cgi?id=188229
383
384         Reviewed by Chris Dumez.
385
386         This fixes a regression from r234210 in clients that misuse the API.
387
388         * UIProcess/WebFramePolicyListenerProxy.cpp:
389         (WebKit::WebFramePolicyListenerProxy::use):
390         (WebKit::WebFramePolicyListenerProxy::download):
391         (WebKit::WebFramePolicyListenerProxy::ignore):
392
393 2018-08-01  Aditya Keerthi  <akeerthi@apple.com>
394
395         [iOS] Color picker should have a border when presented in a popover
396         https://bugs.webkit.org/show_bug.cgi?id=188207
397
398         Reviewed by Wenson Hsieh.
399
400         The color picker should have a border when presented in a popover. This matches
401         the behavior of color pickers in other parts of iOS.
402
403         Since the popover will resize its view to fill its size, we first place the
404         color picker in a container view. The container view can then fill the popover,
405         while the smaller color picker is centered in it's container - creating the
406         appearance of a border.
407
408         * UIProcess/ios/forms/WKFormColorControl.mm:
409         (-[WKColorPopover initWithView:]):
410         * UIProcess/ios/forms/WKFormColorPicker.mm:
411
412 2018-08-01  Commit Queue  <commit-queue@webkit.org>
413
414         Unreviewed, rolling out r234443 and r234445.
415         https://bugs.webkit.org/show_bug.cgi?id=188224
416
417         Revision caused 3 api failures across all platforms.
418         (Requested by Truitt on #webkit).
419
420         Reverted changesets:
421
422         "Add configuration for automatic process pre-warming"
423         https://bugs.webkit.org/show_bug.cgi?id=187108
424         https://trac.webkit.org/changeset/234443
425
426         "Add configuration for automatic process pre-warming"
427         https://bugs.webkit.org/show_bug.cgi?id=187108
428         https://trac.webkit.org/changeset/234445
429
430 2018-08-01  Aditya Keerthi  <akeerthi@apple.com>
431
432         [iOS] WKColorPicker's selection indicator doesn't always cover the selected swatch
433         https://bugs.webkit.org/show_bug.cgi?id=188124
434
435         Reviewed by Wenson Hsieh.
436
437         - On iPhone, the size of an individual color swatch can change on rotation. In
438         this case, we should resize the selection indicator along with the swatch. Added
439         a new delegate method to WKColorMatrixViewDelegate to notify the color picker if
440         the matrix was redrawn. We then resize the selection indicator to match the
441         selected swatch's size.
442
443         - On iPad, the selection indicator should have rounded corners if it's at the
444         corner of the color picker. Otherwise, part of the indicator will be hidden by
445         the popover. The selected swatch's position is checked before drawing the
446         indicator. If it's at one of the four corners of the picker, the appropriate mask
447         is applied to the color selection indicator's border.
448
449         * UIProcess/ios/forms/WKFormColorPicker.h:
450         * UIProcess/ios/forms/WKFormColorPicker.mm:
451         (-[WKColorMatrixView layoutSubviews]):
452         (-[WKColorPicker initWithView:]):
453         (-[WKColorPicker drawSelectionIndicatorForColorButton:]):
454         (-[WKColorPicker colorMatrixViewDidLayoutSubviews:]):
455         (-[WKColorPicker colorMatrixView:didTapColorButton:]):
456         (-[WKColorPicker didPanColors:]):
457
458 2018-08-01  Zan Dobersek  <zdobersek@igalia.com>
459
460         [CoordGraphics] Move CoordinatedBackingStore to WebCore
461         https://bugs.webkit.org/show_bug.cgi?id=188158
462
463         Reviewed by Carlos Garcia Campos.
464
465         Move the CoordinatedBackingStore class from WebKit to WebCore. It has no
466         dependency on anything in the WebKit layer, and it's more suitable to
467         future needs to keep it in the WebCore layer.
468
469         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
470         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
471         * SourcesGTK.txt:
472         * SourcesWPE.txt:
473
474 2018-07-31  Alex Christensen  <achristensen@webkit.org>
475
476         REGRESSION (r231107): MoviStar+ launches to a blank black screen
477         https://bugs.webkit.org/show_bug.cgi?id=188139
478
479         Reviewed by Brent Fulgham.
480
481         Add infrastructure to check UIProcess SDK from the WebProcess and NetworkProcess for linked-on-or-after checks.
482
483         * NetworkProcess/NetworkProcessCreationParameters.cpp:
484         (WebKit::NetworkProcessCreationParameters::encode const):
485         (WebKit::NetworkProcessCreationParameters::decode):
486         * NetworkProcess/NetworkProcessCreationParameters.h:
487         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
488         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
489         * Shared/WebProcessCreationParameters.cpp:
490         (WebKit::WebProcessCreationParameters::encode const):
491         (WebKit::WebProcessCreationParameters::decode):
492         * Shared/WebProcessCreationParameters.h:
493         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
494         (WebKit::WebProcessPool::platformInitializeWebProcess):
495         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
496         * WebProcess/cocoa/WebProcessCocoa.mm:
497         (WebKit::WebProcess::platformInitializeWebProcess):
498
499 2018-07-31  Ryosuke Niwa  <rniwa@webkit.org>
500
501         Add configuration for automatic process pre-warming
502         https://bugs.webkit.org/show_bug.cgi?id=187108
503
504         Reviewed by Ryosuke Niwa.
505
506         Added the missing availability macros.
507
508         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
509
510 2018-07-31  Ben Richards  <benton_richards@apple.com>
511
512         Add configuration for automatic process pre-warming
513         https://bugs.webkit.org/show_bug.cgi?id=187108
514
515         Reviewed by Ryosuke Niwa.
516
517         Added configurations to allow setting the maximum number of processes that should be automatically prewarmed.
518
519         * UIProcess/API/APIProcessPoolConfiguration.cpp:
520         (API::ProcessPoolConfiguration::copy):
521         * UIProcess/API/APIProcessPoolConfiguration.h:
522         * UIProcess/API/C/WKContext.cpp:
523         (WKContextSetMaximumNumberOfPrewarmedProcesses):
524         * UIProcess/API/C/WKContextPrivate.h:
525         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
526         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
527         (-[_WKProcessPoolConfiguration setMaximumPrewarmedProcessCount:]):
528         (-[_WKProcessPoolConfiguration maximumPrewarmedProcessCount]):
529         * UIProcess/WebPageProxy.cpp:
530         (WebKit::WebPageProxy::didFinishLoadForFrame): Moved call to notifyProcessPoolToPrewarm from didFirstVisuallyNonEmptyLayoutForFrame to here.
531         This is to try to ensure that frame loading and prewarming don't happen at the same time as this would be heavy for some devices.
532         (WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame):
533         * UIProcess/WebProcessPool.cpp:
534         (WebKit::WebProcessPool::setMaximumNumberOfProcesses): Condition changed so that calling setMaximumNumberOfProcesses after warmInitialProcess
535         doesn't result in a crash.
536         (WebKit::WebProcessPool::setMaximumNumberOfPrewarmedProcesses):
537         (WebKit::WebProcessPool::warmInitialProcess):
538         (WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
539         * UIProcess/WebProcessPool.h:
540
541 2018-07-31  Stephan Szabo  <stephan.szabo@sony.com>
542
543         [WinCairo] <select> elements do not popup options
544         https://bugs.webkit.org/show_bug.cgi?id=188172
545
546         Reviewed by Fujii Hironori.
547
548         * PlatformWin.cmake: Add WebPopupMenuProxyWin
549         * Shared/PlatformPopupMenuData.cpp:
550         (WebKit::PlatformPopupMenuData::encode const): Encode
551         windows parameters
552         (WebKit::PlatformPopupMenuData::decode): Decode windows
553         parameters
554         * Shared/PlatformPopupMenuData.h: Add the windows specific
555         parameters (based on removed Windows implementation)
556         * UIProcess/win/PageClientImpl.cpp:
557         (WebKit::PageClientImpl::createPopupMenuProxy):
558         * UIProcess/win/WebPopupMenuProxyWin.cpp: Added. (based on
559         removed Windows implementation plus some fixes/api changes
560         since the removal)
561         (WebKit::isASCIIPrintable):
562         (WebKit::translatePoint):
563         (WebKit::WebPopupMenuProxyWin::WebPopupMenuProxyWndProc):
564         (WebKit::WebPopupMenuProxyWin::wndProc):
565         (WebKit::WebPopupMenuProxyWin::registerWindowClass):
566         (WebKit::WebPopupMenuProxyWin::WebPopupMenuProxyWin):
567         (WebKit::WebPopupMenuProxyWin::~WebPopupMenuProxyWin):
568         (WebKit::WebPopupMenuProxyWin::showPopupMenu):
569         (WebKit::WebPopupMenuProxyWin::hidePopupMenu):
570         (WebKit::WebPopupMenuProxyWin::calculatePositionAndSize):
571         (WebKit::WebPopupMenuProxyWin::clientRect const):
572         (WebKit::WebPopupMenuProxyWin::invalidateItem):
573         (WebKit::WebPopupMenuProxyWin::scrollSize const):
574         (WebKit::WebPopupMenuProxyWin::setScrollOffset):
575         (WebKit::WebPopupMenuProxyWin::visibleSize const):
576         (WebKit::WebPopupMenuProxyWin::contentsSize const):
577         (WebKit::WebPopupMenuProxyWin::scrollableAreaBoundingBox const):
578         (WebKit::WebPopupMenuProxyWin::scrollTo):
579         (WebKit::WebPopupMenuProxyWin::invalidateScrollbarRect):
580         (WebKit::WebPopupMenuProxyWin::onMouseActivate):
581         (WebKit::WebPopupMenuProxyWin::onSize):
582         (WebKit::WebPopupMenuProxyWin::onKeyDown):
583         (WebKit::WebPopupMenuProxyWin::onChar):
584         (WebKit::WebPopupMenuProxyWin::onMouseMove):
585         (WebKit::WebPopupMenuProxyWin::onLButtonDown):
586         (WebKit::WebPopupMenuProxyWin::onLButtonUp):
587         (WebKit::WebPopupMenuProxyWin::onMouseWheel):
588         (WebKit::WebPopupMenuProxyWin::onPaint):
589         (WebKit::WebPopupMenuProxyWin::onPrintClient):
590         (WebKit::WebPopupMenuProxyWin::down):
591         (WebKit::WebPopupMenuProxyWin::up):
592         (WebKit::WebPopupMenuProxyWin::paint):
593         (WebKit::WebPopupMenuProxyWin::setFocusedIndex):
594         (WebKit::WebPopupMenuProxyWin::visibleItems const):
595         (WebKit::WebPopupMenuProxyWin::listIndexAtPoint const):
596         (WebKit::WebPopupMenuProxyWin::focusedIndex const):
597         (WebKit::WebPopupMenuProxyWin::focusFirst):
598         (WebKit::WebPopupMenuProxyWin::focusLast):
599         (WebKit::WebPopupMenuProxyWin::incrementWheelDelta):
600         (WebKit::WebPopupMenuProxyWin::reduceWheelDelta):
601         (WebKit::WebPopupMenuProxyWin::scrollToRevealSelection):
602         * UIProcess/win/WebPopupMenuProxyWin.h: Added. (based on
603         removed Windows implementation plus some fixes/api changes
604         since then)
605         (WebKit::WebPopupMenuProxyWin::create):
606         (WebKit::WebPopupMenuProxyWin::hide):
607         (WebKit::WebPopupMenuProxyWin::scrollbar const):
608         (WebKit::WebPopupMenuProxyWin::itemHeight const):
609         (WebKit::WebPopupMenuProxyWin::windowRect const):
610         (WebKit::WebPopupMenuProxyWin::wheelDelta const):
611         (WebKit::WebPopupMenuProxyWin::setWasClicked):
612         (WebKit::WebPopupMenuProxyWin::wasClicked const):
613         (WebKit::WebPopupMenuProxyWin::scrollbarCapturingMouse const):
614         (WebKit::WebPopupMenuProxyWin::setScrollbarCapturingMouse):
615         * WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp:
616         (WebKit::WebPopupMenu::setUpPlatformData): Make the data to
617         pass between processes.
618
619 2018-07-31  John Wilander  <wilander@apple.com>
620
621         Resource Load Statistics: Remove partitioned cookies for reduced complexity, lower memory footprint, and ability to support more platforms
622         https://bugs.webkit.org/show_bug.cgi?id=188109
623         <rdar://problem/42664391>
624
625         Reviewed by Brent Fulgham, Chris Dumez, and Alex Christensen.
626
627         This patch removes cookie partitioning which reduces the model to just
628         blocked cookies (in third-party contexts) and first-party cookie access.
629
630         Several of the changes are renaming to reflect that there are no more
631         cookie partitions. However, the compile-time check remains for now since
632         this change is not ready to ship.
633
634         The API changes are mostly in C APIs used for layout tests. The slight
635         change in Cocoa API is that there no longer is a functionality to
636         "enable" cookie partitioning. The boolean member is still there but it
637         no longer does anything.
638
639         The functional changes are in WebKit::ResourceLoadStatisticsMemoryStore
640         and WebKit::NetworkDataTaskCocoa where cookie partitioning used to be
641         managed and applied respectively. The IPC communication has changed to
642         reflect this.
643
644         * NetworkProcess/NetworkProcess.cpp:
645         (WebKit::NetworkProcess::updatePrevalentDomainsToBlockCookiesFor):
646             Name change from updatePrevalentDomainsToPartitionOrBlockCookies().
647             No longer supports the partitioned category.
648         (WebKit::NetworkProcess::removeAllStorageAccess):
649             Now supports a completion handler. This change was made to address
650             flakiness that came after layout test changes that were needed because
651             of the removal of partitioned cookies.
652         (WebKit::NetworkProcess::updatePrevalentDomainsToPartitionOrBlockCookies): Deleted.
653         * NetworkProcess/NetworkProcess.h:
654         * NetworkProcess/NetworkProcess.messages.in:
655             Partitioning removed from message name.
656             RemoveAllStorageAccess message now supports a completion handler
657             as explained above
658         * NetworkProcess/NetworkProcessCreationParameters.cpp:
659         (WebKit::NetworkProcessCreationParameters::encode const):
660             Removed parameter cookieStoragePartitioningEnabled.
661         (WebKit::NetworkProcessCreationParameters::decode):
662             Removed parameter cookieStoragePartitioningEnabled.
663         * NetworkProcess/NetworkProcessCreationParameters.h:
664         * NetworkProcess/NetworkResourceLoader.cpp:
665         (WebKit::NetworkResourceLoader::logCookieInformation):
666             No longer takes partitioning into account.
667         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
668         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
669         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
670             Now only applies cookie blocking.
671         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
672             Now only applies cookie blocking.
673         (WebKit::NetworkDataTaskCocoa::applyCookiePartitioningPolicy): Deleted.
674         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
675         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
676             Removed the call to setCookieStoragePartitioningEnabled().
677         (WebKit::NetworkProcess::setCookieStoragePartitioningEnabled): Deleted.
678         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
679         (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
680         (-[WKNetworkSessionDelegate URLSession:task:_schemeUpgraded:completionHandler:]):
681             WebCore::NetworkStorageSession::shouldBlockCookies() now takes a
682             frame ID and page ID to resolve cookie access with the Storage
683             Access API. This was previously handled by
684             WebCore::NetworkStorageSession::cookieStoragePartition().
685         * UIProcess/API/C/WKCookieManager.cpp:
686         (WKCookieManagerSetCookieStoragePartitioningEnabled): Deleted.
687         * UIProcess/API/C/WKCookieManager.h:
688         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
689         (WKWebsiteDataStoreStatisticsUpdateCookieBlocking):
690         (WKWebsiteDataStoreSetStatisticsHasHadNonRecentUserInteraction): Deleted.
691             There is no longer a difference between recent and non-recent
692             user interaction so this test function was removed.
693         (WKWebsiteDataStoreSetStatisticsTimeToLiveCookiePartitionFree): Deleted.
694         (WKWebsiteDataStoreStatisticsUpdateCookiePartitioning): Deleted.
695         (WKWebsiteDataStoreSetStatisticsShouldPartitionCookiesForHost): Deleted.
696             Deleted because partitioning is no longer a thing.
697         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
698         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
699             Deprecated _isCookieStoragePartitioningEnabled() and
700             _setCookieStoragePartitioningEnabled() via WK_API_DEPRECATED.
701         * UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm:
702         (WebKit::ResourceLoadStatisticsMemoryStore::registerUserDefaultsIfNeeded):
703             Removed support for ResourceLoadStatisticsTimeToLiveCookiePartitionFree.
704         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
705         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
706             No longer sets a parameter based on cookieStoragePartitioningEnabled().
707         (WebKit::WebProcessPool::setCookieStoragePartitioningEnabled):
708             Added a FIXME comment that this setter no longer does anything meaningful.
709             Removed the IPC call to the network process to propagate the setting.
710         * UIProcess/Network/NetworkProcessProxy.cpp:
711         (WebKit::NetworkProcessProxy::clearCallbackStates):
712             Name change from m_updatePartitionOrBlockCookiesCallbackMap to
713             m_updateBlockCookiesCallbackMap.
714         (WebKit::NetworkProcessProxy::updatePrevalentDomainsToBlockCookiesFor):
715             Name change plus it now just takes one vector of strings named domainsToBlock.
716         (WebKit::NetworkProcessProxy::didUpdateBlockCookies):
717             Name change from didUpdatePartitionOrBlockCookies().
718         (WebKit::NetworkProcessProxy::storageAccessRequestResult):
719             Just moved to its right place.
720         (WebKit::NetworkProcessProxy::removeAllStorageAccess):
721             Now take a completion handler.
722         (WebKit::NetworkProcessProxy::didRemoveAllStorageAccess):
723             To call the completion handler.
724         (WebKit::NetworkProcessProxy::updatePrevalentDomainsToPartitionOrBlockCookies): Deleted.
725             Name change.
726         (WebKit::NetworkProcessProxy::didUpdatePartitionOrBlockCookies): Deleted.
727             Name change.
728         * UIProcess/Network/NetworkProcessProxy.h:
729         * UIProcess/Network/NetworkProcessProxy.messages.in:
730             Name change and added completion handler message for removeAllStorageAccess().
731         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
732         (WebKit::ResourceLoadStatisticsMemoryStore::hasStorageAccess):
733         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccess):
734         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccessUnderOpener):
735         (WebKit::ResourceLoadStatisticsMemoryStore::scheduleStatisticsProcessingRequestIfNecessary):
736         (WebKit::ResourceLoadStatisticsMemoryStore::logUserInteraction):
737         (WebKit::ResourceLoadStatisticsMemoryStore::mergeWithDataFromDecoder):
738         (WebKit::ResourceLoadStatisticsMemoryStore::clear):
739         (WebKit::ResourceLoadStatisticsMemoryStore::wasAccessedAsFirstPartyDueToUserInteraction const):
740         (WebKit::ResourceLoadStatisticsMemoryStore::shouldBlockAndKeepCookies):
741         (WebKit::ResourceLoadStatisticsMemoryStore::shouldBlockAndPurgeCookies):
742         (WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlocking):
743         (WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlockingForDomains):
744         (WebKit::ResourceLoadStatisticsMemoryStore::clearBlockingStateForDomains):
745         (WebKit::ResourceLoadStatisticsMemoryStore::resetCookieBlockingState):
746         (WebKit::ResourceLoadStatisticsMemoryStore::removeAllStorageAccess):
747         (WebKit::ResourceLoadStatisticsMemoryStore::logNonRecentUserInteraction): Deleted.
748             There is no longer a difference between recent and non-recent
749             user interaction so this test function was removed.
750         (WebKit::ResourceLoadStatisticsMemoryStore::setTimeToLiveCookiePartitionFree): Deleted.
751         (WebKit::ResourceLoadStatisticsMemoryStore::shouldPartitionCookies): Deleted.
752         (WebKit::ResourceLoadStatisticsMemoryStore::shouldBlockCookies): Deleted.
753             Now split into shouldBlockAndKeepCookies() and shouldBlockAndPurgeCookies().
754         (WebKit::ResourceLoadStatisticsMemoryStore::updateCookiePartitioning): Deleted.
755         (WebKit::ResourceLoadStatisticsMemoryStore::updateCookiePartitioningForDomains): Deleted.
756         (WebKit::ResourceLoadStatisticsMemoryStore::clearPartitioningStateForDomains): Deleted.
757         (WebKit::ResourceLoadStatisticsMemoryStore::resetCookiePartitioningState): Deleted.
758         * UIProcess/ResourceLoadStatisticsMemoryStore.h:
759         * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp:
760         (WebKit::ResourceLoadStatisticsPersistentStorage::startMonitoringDisk):
761             Added an empty completion handler to the m_memoryStore.clear() call.
762         * UIProcess/WebCookieManagerProxy.cpp:
763         (WebKit::WebCookieManagerProxy::setCookieStoragePartitioningEnabled): Deleted.
764         * UIProcess/WebCookieManagerProxy.h:
765         * UIProcess/WebResourceLoadStatisticsStore.cpp:
766         (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
767         (WebKit::WebResourceLoadStatisticsStore::removeAllStorageAccess):
768             Now has a completion handler.
769         (WebKit::WebResourceLoadStatisticsStore::scheduleCookieBlockingUpdate):
770         (WebKit::WebResourceLoadStatisticsStore::scheduleCookieBlockingUpdateForDomains):
771         (WebKit::WebResourceLoadStatisticsStore::scheduleClearBlockingStateForDomains):
772         (WebKit::WebResourceLoadStatisticsStore::scheduleCookieBlockingStateReset):
773         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemory):
774             Now supports a completion handler for removeAllStorageAccess().
775         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
776         (WebKit::WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToBlockCookiesForHandler):
777         (WebKit::WebResourceLoadStatisticsStore::logNonRecentUserInteraction): Deleted.
778             There is no longer a difference between recent and non-recent
779             user interaction so this test function was removed.
780         (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdate): Deleted.
781             Renamed to scheduleCookieBlockingUpdate().
782         (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdateForDomains): Deleted.
783             Renamed to scheduleCookieBlockingUpdateForDomains().
784         (WebKit::WebResourceLoadStatisticsStore::scheduleClearPartitioningStateForDomains): Deleted.
785             Renamed to scheduleClearBlockingStateForDomains().
786         (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningStateReset): Deleted.
787             Renamed to scheduleCookieBlockingStateReset().
788         (WebKit::WebResourceLoadStatisticsStore::setTimeToLiveCookiePartitionFree): Deleted.
789         (WebKit::WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToPartitionOrBlockCookiesHandler): Deleted.
790             Renamed callUpdatePrevalentDomainsToBlockCookiesForHandler().
791         * UIProcess/WebResourceLoadStatisticsStore.h:
792         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
793         (WebKit::WebsiteDataStore::updatePrevalentDomainsToBlockCookiesFor):
794         (WebKit::WebsiteDataStore::removeAllStorageAccessHandler):
795             Now supports a completion handler for removeAllStorageAccess().
796         (WebKit::WebsiteDataStore::networkProcessDidCrash):
797             Name change in function called to get rid of "partitioning."
798         (WebKit::WebsiteDataStore::updatePrevalentDomainsToPartitionOrBlockCookies): Deleted.
799             Renamed updatePrevalentDomainsToBlockCookiesFor().
800         * UIProcess/WebsiteData/WebsiteDataStore.h:
801
802 2018-07-31  Rob Buis  <rbuis@igalia.com>
803
804         Remove ResourceResponse::cacheBodyKey API
805         https://bugs.webkit.org/show_bug.cgi?id=188192
806
807         Reviewed by Frédéric Wang.
808
809         Remove unused API.
810
811         * NetworkProcess/cache/NetworkCacheEntry.cpp:
812         (WebKit::NetworkCache::Entry::decodeStorageRecord):
813
814 2018-07-30  Sihui Liu  <sihui_liu@apple.com>
815
816         Add support for fetching and remove type  _WKWebsiteDataTypeHSTSCache
817         https://bugs.webkit.org/show_bug.cgi?id=187379
818         <rdar://problem/41879559>
819
820         WKWebsiteDataStore should support _WKWebsiteDataTypeHSTSCache so Safari could list HSTS cache entries
821         and be able to remove them on a per-domain basis.
822
823         Reviewed by Geoffrey Garen.
824
825         * NetworkProcess/NetworkProcess.cpp:
826         (WebKit::NetworkProcess::fetchWebsiteData):
827         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
828         * NetworkProcess/NetworkProcess.h:
829         * NetworkProcess/NetworkProcess.messages.in:
830         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
831         (WebKit::filterPreloadHSTSEntry):
832         (WebKit::NetworkProcess::getHostNamesWithHSTSCache):
833         (WebKit::NetworkProcess::deleteHSTSCacheForHostNames):
834         * Shared/WebsiteData/WebsiteData.cpp:
835         (WebKit::WebsiteData::encode const):
836         (WebKit::WebsiteData::decode):
837         * Shared/WebsiteData/WebsiteData.h:
838         * UIProcess/Network/NetworkProcessProxy.cpp:
839         (WebKit::NetworkProcessProxy::deleteWebsiteDataForOrigins):
840         * UIProcess/Network/NetworkProcessProxy.h:
841         * UIProcess/WebsiteData/WebsiteDataRecord.cpp:
842         (WebKit::WebsiteDataRecord::displayNameForCookieHostName):
843         (WebKit::WebsiteDataRecord::displayNameForHostName):
844         (WebKit::WebsiteDataRecord::addHSTSCacheHostname):
845         (WebKit::WebsiteDataRecord::displayNameForPluginDataHostName): Deleted.
846         * UIProcess/WebsiteData/WebsiteDataRecord.h:
847         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
848         (WebKit::WebsiteDataStore::fetchDataAndApply):
849         (WebKit::WebsiteDataStore::removeData):
850
851 2018-07-30  Simon Fraser  <simon.fraser@apple.com>
852
853         Shrink GraphicsLayerCA
854         https://bugs.webkit.org/show_bug.cgi?id=188141
855
856         Reviewed by Zalan Bujtas.
857
858         Shrink GraphicsLayerCA from 1040 to 880 bytes by:
859         * moving all the clone-related stuff into the lazily-allocated m_layerClones
860         * moving all the animation-related stuff into the lazily-allocated m_animations
861         * making enums be 8-bit
862         * re-ordering data members
863
864         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
865         (WebKit::updateCustomAppearance):
866         (WebKit::RemoteLayerTreePropertyApplier::applyProperties):
867         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
868         (WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
869         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
870         (WebKit::PlatformCALayerRemote::requiresCustomAppearanceUpdateOnBoundsChange const):
871
872 2018-07-30  Wenson Hsieh  <wenson_hsieh@apple.com>
873
874         REGRESSION (r230817): Terrible performance when selecting text on Stash code review
875         https://bugs.webkit.org/show_bug.cgi?id=188144
876         <rdar://problem/42642489>
877
878         Reviewed by Darin Adler.
879
880         After r230817, mouse events were serially dispatched to the web process and handled before the subsequent mouse
881         event. However, this resulted in rapid-fire mouse move events filling up the mouse event queue in the case where
882         mouse move events were being handled by the web process at a slower rate than the UI process was enqueueing
883         them. To mitigate this, r231511 introduced a mechanism for replacing the most recently enqueued mouse move event
884         with an incoming mouse move event.
885
886         However, when a user with a force-click-enabled trackpad performs a mouse drag, a rapid stream of
887         "mouseforcechanged" events is interleaved alongside the stream of "mousemove" events. This renders r231511
888         ineffective, since the most recently queued event is often a "mouseforcechanged" event instead of a "mousemove".
889         On the stash code review page, this can result in hundreds of mouse events being backed up in the mouse event
890         queue, causing perceived slowness when selecting text.
891
892         To fix this, we extend the mechanism introduced in r231511, such that it is capable of replacing both
893         "mouseforcechanged" and "mousemove" events in the queue. Rather than consider only the most recently queued
894         item, we instead find the most recently queued event that matches the type of the incoming event, remove it from
895         the queue, and then append the incoming event to the end of the queue. To avoid the risk of removing the only
896         "mousemove" or "mouseforcechanged" event in the middle of a mouse down and mouse up, we also bail when searching
897         backwards for an event to replace if we come across any event that is neither of these types.
898
899         This effectively throttles the rate at which mouseforcechanged or mousemove events are dispatched when a user
900         with force-click-enabled hardware clicks and drags the mouse across the page.
901
902         * UIProcess/WebPageProxy.cpp:
903         (WebKit::removeOldRedundantEvent):
904         (WebKit::WebPageProxy::handleMouseEvent):
905
906 2018-07-30  Devin Rousso  <webkit@devinrousso.com>
907
908         Add missing CoreGraphics SPI
909         https://bugs.webkit.org/show_bug.cgi?id=188177
910
911         Reviewed by Joseph Pecoraro.
912
913         * WebProcess/cocoa/WebProcessCocoa.mm:
914
915 2018-07-30  Rob Buis  <rbuis@igalia.com>
916
917         https://bugs.webkit.org/show_bug.cgi?id=188137
918         Merge PlatformCookieJar functions into NetworkStorageSession
919
920         Adapt callsites to use NetworkStorageSession instead of CookieJar functions.
921
922         Reviewed by Alex Christensen.
923
924         * NetworkProcess/Cookies/WebCookieManager.cpp:
925         (WebKit::WebCookieManager::getHostnamesWithCookies):
926         (WebKit::WebCookieManager::deleteCookiesForHostname):
927         (WebKit::WebCookieManager::deleteAllCookies):
928         (WebKit::WebCookieManager::deleteAllCookiesModifiedSince):
929         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
930         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
931         (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM):
932         (WebKit::NetworkConnectionToWebProcess::cookiesEnabled):
933         (WebKit::NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue):
934         (WebKit::NetworkConnectionToWebProcess::getRawCookies):
935         (WebKit::NetworkConnectionToWebProcess::deleteCookie):
936         * NetworkProcess/NetworkProcess.cpp:
937         (WebKit::NetworkProcess::fetchWebsiteData):
938         (WebKit::NetworkProcess::deleteWebsiteData):
939         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
940         * NetworkProcess/NetworkResourceLoader.cpp:
941         (WebKit::logCookieInformationInternal):
942         * NetworkProcess/cache/NetworkCache.cpp:
943         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
944
945 2018-07-30  Alex Christensen  <achristensen@webkit.org>
946
947         Add RefCounted CompletionHandler wrapping abstraction for sending policy decisions back to WebProcess
948         https://bugs.webkit.org/show_bug.cgi?id=188089
949
950         Reviewed by Geoffrey Garen and Said Abou-Hallawa.
951
952         This will be necessary for when I add an asynchronous parallel step to decidePolicyForNavigationAction.
953         We will want to wait for that asynchronous step for decidePolicyForNavigationActionSync but not for a client.
954
955         No change in behavior.
956
957         * UIProcess/WebPageProxy.cpp:
958         (WebKit::WebPageProxy::PolicyDecisionSender::create):
959         (WebKit::WebPageProxy::PolicyDecisionSender::operator()):
960         (WebKit::WebPageProxy::PolicyDecisionSender::PolicyDecisionSender):
961         (WebKit::WebPageProxy::receivedPolicyDecision):
962         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
963         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
964         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
965         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
966         (WebKit::WebPageProxy::decidePolicyForResponse):
967         * UIProcess/WebPageProxy.h:
968         * UIProcess/WebPageProxy.messages.in:
969         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
970         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
971
972 2018-07-30  David Fenton  <david_fenton@apple.com>
973
974         Unreviewed, rolling out r234327.
975
976         Caused 2 crashes on macOS and iOS debug API tests
977
978         Reverted changeset:
979
980         "Add RefCounted CompletionHandler wrapping abstraction for
981         sending policy decisions back to WebProcess"
982         https://bugs.webkit.org/show_bug.cgi?id=188089
983         https://trac.webkit.org/changeset/234327
984
985 2018-07-30  Chris Dumez  <cdumez@apple.com>
986
987         Potential null dereference under WebPage::applicationDidBecomeActive()
988         https://bugs.webkit.org/show_bug.cgi?id=188170
989         <rdar://problem/37493418>
990
991         Reviewed by Wenson Hsieh.
992
993         WebPage::m_page gets nulled out when the page is closed but the WebPage object may receive IPC
994         until it gets destroyed. Therefore, we need to null-check m_page before using it in IPC message
995         handlers.
996
997         * WebProcess/WebPage/ios/WebPageIOS.mm:
998         (WebKit::WebPage::applicationDidEnterBackground):
999         (WebKit::WebPage::applicationWillEnterForeground):
1000         (WebKit::WebPage::applicationDidBecomeActive):
1001
1002 2018-07-29  Wenson Hsieh  <wenson_hsieh@apple.com>
1003
1004         Fix incorrect guards around a method declaration in PageClient.h
1005         https://bugs.webkit.org/show_bug.cgi?id=188153
1006
1007         Reviewed by Tim Horton.
1008
1009         `WebCore::DragItem` is forward declared under `ENABLE(DRAG_SUPPORT)`, but `startDrag` is declared under
1010         `PLATFORM(COCOA)`. If `ENABLE(DRAG_SUPPORT)` is off but `PLATFORM(COCOA)` is on, the build breaks.
1011
1012         We fix this by moving `startDrag` under `ENABLE(DRAG_SUPPORT)`.
1013
1014         * UIProcess/PageClient.h:
1015         (WebKit::PageClient::startDrag):
1016
1017 2018-07-28  Andy Estes  <aestes@apple.com>
1018
1019         [Wi-Fi Assertions] Pass a ResumptionReason to resumeWiFiAssertions
1020         https://bugs.webkit.org/show_bug.cgi?id=188142
1021         <rdar://problem/42628842>
1022
1023         Reviewed by Darin Adler.
1024
1025         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1026         (WebKit::NetworkProcess::platformProcessDidResume):
1027         (WebKit::NetworkProcess::platformProcessDidTransitionToForeground):
1028
1029 2018-07-28  Darin Adler  <darin@apple.com>
1030
1031         [Cocoa] Update more WebCore Objective-C code to be ARC compatible
1032         https://bugs.webkit.org/show_bug.cgi?id=188140
1033
1034         Reviewed by Sam Weinig.
1035
1036         * UIProcess/mac/WKFullScreenWindowController.mm:
1037         (-[WKFullScreenWindowController enterFullScreen:]): Removed the call to
1038         setAction: since the full screen placeholder view now always uses the
1039         cancelOperation: method.
1040
1041         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1042         (WebKit::PDFPlugin::lookupTextAtLocation): Updated to use the new
1043         DictionaryLookup function that returns a tuple instead of using an out argument.
1044         * WebProcess/WebPage/mac/WebPageMac.mm:
1045         (WebKit::WebPage::performDictionaryLookupAtLocation): Ditto.
1046         (WebKit::WebPage::performDictionaryLookupForSelection): Ditto.
1047
1048 2018-07-27  Chris Dumez  <cdumez@apple.com>
1049
1050         Fix thread-safety issues related to RealtimeMediaSource::audioSamplesAvailable()
1051         https://bugs.webkit.org/show_bug.cgi?id=188097
1052         <rdar://problem/42558823>
1053
1054         Reviewed by Eric Carlson.
1055
1056         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
1057
1058 2018-07-27  Alex Christensen  <achristensen@webkit.org>
1059
1060         Don't include WebPageProxy.h just for UndoOrRedo
1061         https://bugs.webkit.org/show_bug.cgi?id=188086
1062
1063         Reviewed by Saam Barati.
1064
1065         * Shared/UndoOrRedo.h: Added.
1066         * UIProcess/Cocoa/WebViewImpl.h:
1067         * UIProcess/Cocoa/WebViewImpl.mm:
1068         (WebKit::WebViewImpl::registerEditCommand):
1069         * UIProcess/PageClient.h:
1070         * UIProcess/WebEditCommandProxy.cpp:
1071         (WebKit::WebEditCommandProxy::unapply):
1072         (WebKit::WebEditCommandProxy::reapply):
1073         * UIProcess/WebPageProxy.cpp:
1074         (WebKit::WebPageProxy::registerEditCommandForUndo):
1075         (WebKit::WebPageProxy::canUndoRedo):
1076         (WebKit::WebPageProxy::executeUndoRedo):
1077         (WebKit::WebPageProxy::canUndo):
1078         (WebKit::WebPageProxy::canRedo):
1079         * UIProcess/WebPageProxy.h:
1080         * UIProcess/WebPageProxy.messages.in:
1081         * UIProcess/ios/PageClientImplIOS.h:
1082         * UIProcess/ios/PageClientImplIOS.mm:
1083         (WebKit::PageClientImpl::registerEditCommand):
1084         (WebKit::PageClientImpl::canUndoRedo):
1085         (WebKit::PageClientImpl::executeUndoRedo):
1086         * UIProcess/mac/PageClientImplMac.h:
1087         * UIProcess/mac/PageClientImplMac.mm:
1088         (WebKit::PageClientImpl::registerEditCommand):
1089         (WebKit::PageClientImpl::canUndoRedo):
1090         (WebKit::PageClientImpl::executeUndoRedo):
1091         * UIProcess/mac/WebContextMenuProxyMac.mm:
1092         * WebKit.xcodeproj/project.pbxproj:
1093         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
1094         (WebKit::WebEditorClient::canUndo const):
1095         (WebKit::WebEditorClient::canRedo const):
1096         (WebKit::WebEditorClient::undo):
1097         (WebKit::WebEditorClient::redo):
1098
1099 2018-07-27  Alex Christensen  <achristensen@webkit.org>
1100
1101         Make CompletionHandler more const correct
1102         https://bugs.webkit.org/show_bug.cgi?id=186543
1103
1104         Reviewed by Saam Barati.
1105
1106         * NetworkProcess/PingLoad.cpp:
1107         (WebKit::PingLoad::willPerformHTTPRedirection):
1108         * NetworkProcess/cache/CacheStorageEngine.cpp:
1109         (WebKit::CacheStorage::Engine::clearAllCaches):
1110         * UIProcess/Automation/SimulatedInputDispatcher.cpp:
1111         (WebKit::SimulatedInputDispatcher::transitionInputSourceToState):
1112         * UIProcess/Automation/WebAutomationSession.cpp:
1113         (WebKit::WebAutomationSession::simulateMouseInteraction):
1114         (WebKit::WebAutomationSession::simulateKeyboardInteraction):
1115         * UIProcess/Cocoa/AutomationSessionClient.mm:
1116         (WebKit::AutomationSessionClient::requestNewPageWithOptions):
1117         (WebKit::AutomationSessionClient::requestSwitchToPage):
1118         (WebKit::AutomationSessionClient::requestHideWindowOfPage):
1119         (WebKit::AutomationSessionClient::requestRestoreWindowOfPage):
1120         * UIProcess/Cocoa/UIDelegate.mm:
1121         (WebKit::UIDelegate::ContextMenuClient::menuFromProposedMenu):
1122         (WebKit::UIDelegate::UIClient::createNewPage):
1123         (WebKit::UIDelegate::UIClient::runJavaScriptAlert):
1124         (WebKit::UIDelegate::UIClient::runJavaScriptConfirm):
1125         (WebKit::UIDelegate::UIClient::runJavaScriptPrompt):
1126         (WebKit::UIDelegate::UIClient::requestStorageAccessConfirm):
1127         (WebKit::UIDelegate::UIClient::decidePolicyForGeolocationPermissionRequest):
1128         (WebKit::UIDelegate::UIClient::runBeforeUnloadConfirmPanel):
1129         (WebKit::UIDelegate::UIClient::decidePolicyForNotificationPermissionRequest):
1130         (WebKit::UIDelegate::UIClient::runOpenPanel):
1131         * UIProcess/WebPageProxy.cpp:
1132         (WebKit::WebPageProxy::createNewPage):
1133         (WebKit::WebPageProxy::webGLPolicyForURL):
1134         (WebKit::WebPageProxy::resolveWebGLPolicyForURL):
1135         (WebKit::WebPageProxy::getWindowFrame):
1136         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1137         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess):
1138         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
1139         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
1140         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioning):
1141
1142 2018-07-27  Simon Fraser  <simon.fraser@apple.com>
1143
1144         Be more conservative with compositing layer creation when memory is low
1145         https://bugs.webkit.org/show_bug.cgi?id=187866
1146         rdar://problem/42366345
1147
1148         Reviewed by Zalan Bujtas.
1149         
1150         When process physical footprint is above a fraction of the jetsam limit, be more conservative in making
1151         compositing layers. We avoid compositing for these situations:
1152         1. Layers with 3D transforms which are affine (like translateZ(0)).
1153         2. Layers with will-change
1154         3. Layers for canvases (other than WebGL/WebGPU)
1155         
1156         We reuse some macOS code in MemoryPressureHandler() but choose different thresholds for iOS,
1157         falling into "conservative mode" at 50% of jetsam limit, and "strict mode" at 65%.
1158         Compositing chooses to be more conservative in either "conservative" or "strict" memory modes.
1159         
1160         Plumb through a "compositingPolicyOverride" both so that on-device testing isn't
1161         flakily falling into a different mode, and so that we can impose the conservative
1162         mode for testing.
1163
1164         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
1165         (WKBundlePageSetCompositingPolicyOverride):
1166         * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
1167
1168 2018-07-27  Alex Christensen  <achristensen@webkit.org>
1169
1170         Add RefCounted CompletionHandler wrapping abstraction for sending policy decisions back to WebProcess
1171         https://bugs.webkit.org/show_bug.cgi?id=188089
1172
1173         Reviewed by Geoffrey Garen.
1174
1175         This will be necessary for when I add an asynchronous parallel step to decidePolicyForNavigationAction.
1176         We will want to wait for that asynchronous step for decidePolicyForNavigationActionSync but not for a client.
1177
1178         No change in behavior.
1179
1180         * UIProcess/WebPageProxy.cpp:
1181         (WebKit::WebPageProxy::PolicyDecisionSender::create):
1182         (WebKit::WebPageProxy::PolicyDecisionSender::operator()):
1183         (WebKit::WebPageProxy::PolicyDecisionSender::PolicyDecisionSender):
1184         (WebKit::WebPageProxy::receivedPolicyDecision):
1185         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
1186         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1187         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
1188         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
1189         (WebKit::WebPageProxy::decidePolicyForResponse):
1190         * UIProcess/WebPageProxy.h:
1191         * UIProcess/WebPageProxy.messages.in:
1192         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1193         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1194
1195 2018-07-27  Saam Barati  <sbarati@apple.com>
1196
1197         Use SPI to compute the jetsam limit on iOS instead of hardcoding 840MB
1198         https://bugs.webkit.org/show_bug.cgi?id=188091
1199         <rdar://problem/42647697>
1200
1201         Reviewed by Simon Fraser.
1202
1203         Give the Network/Storage/WebContent process the com.apple.private.memorystatus
1204         entitlement. This allows them to read the process jetsam limit.
1205
1206         * Configurations/Databases-iOS.entitlements:
1207         * Configurations/Network-iOS.entitlements:
1208         * Configurations/WebContent-iOS.entitlements:
1209
1210 2018-07-03  David Fenton  <david_fenton@apple.com>
1211
1212         Unreviewed, rolling out r233461.
1213
1214         assertions triggered on ios11 Debug wk2
1215
1216         Reverted changeset:
1217
1218         "[iOS] Add assert to catch improper use of WebCore::Timer in
1219         UI Process"
1220         https://bugs.webkit.org/show_bug.cgi?id=185330
1221         https://trac.webkit.org/changeset/233461
1222
1223 2018-07-27  Alex Christensen  <achristensen@webkit.org>
1224
1225         Remove unused WKNavigationDelegatePrivate decidePolicyForNavigationAction SPI
1226         https://bugs.webkit.org/show_bug.cgi?id=188077
1227
1228         Reviewed by Darin Adler.
1229
1230         The one client has moved to the version with userInfo, and it never used the SPI
1231         on old operating systems.
1232
1233         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
1234         * UIProcess/Cocoa/NavigationState.h:
1235         * UIProcess/Cocoa/NavigationState.mm:
1236         (WebKit::NavigationState::setNavigationDelegate):
1237         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
1238
1239 2018-07-27  Alex Christensen  <achristensen@webkit.org>
1240
1241         Begin making WKWebViewConfiguration a wrapper around an API::PageConfiguration
1242         https://bugs.webkit.org/show_bug.cgi?id=188030
1243
1244         Reviewed by Sam Weinig.
1245
1246         Eventually WKWebViewConfiguration should become just a API::ObjectStorage<API::PageConfiguration>.
1247         The transition includes adding fields that exist in WKWebViewConfiguration to API::PageConfiguration
1248         and making WKWebViewConfiguration's getters and setters just call API::PageConfiguration's corresponding methods
1249         instead of having an ivar for each value then copying it to an API::PageConfiguration we construct in
1250         the WKWebView constructor.  To transition incrementally, I've added a RefPtr<API::PageConfiguration> ivar to
1251         WKWebViewConfiguration and moved a few ivars to use the values stored in that API::PageConfiguration instead.
1252         I've arbitrarily chosen _treatsSHA1SignedCertificatesAsInsecure and _urlSchemeHandlers as the first two 
1253         properties to transition, and I'll continue transitioning each ivar in small, easy-to-review bunches.
1254
1255         * UIProcess/API/APIPageConfiguration.cpp:
1256         (API::PageConfiguration::copy const):
1257         (API::PageConfiguration::urlSchemeHandlerForURLScheme):
1258         (API::PageConfiguration::setURLSchemeHandlerForURLScheme):
1259         * UIProcess/API/APIPageConfiguration.h:
1260         (API::PageConfiguration::urlSchemeHandlers):
1261         * UIProcess/API/Cocoa/WKWebView.mm:
1262         (-[WKWebView _initializeWithConfiguration:]):
1263         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1264         (-[WKWebViewConfiguration init]):
1265         (-[WKWebViewConfiguration copyWithZone:]):
1266         (-[WKWebViewConfiguration setURLSchemeHandler:forURLScheme:]):
1267         (-[WKWebViewConfiguration urlSchemeHandlerForURLScheme:]):
1268         (-[WKWebViewConfiguration copyPageConfiguration]):
1269         (-[WKWebViewConfiguration _treatsSHA1SignedCertificatesAsInsecure]):
1270         (-[WKWebViewConfiguration _setTreatsSHA1SignedCertificatesAsInsecure:]):
1271         (-[WKWebViewConfiguration _urlSchemeHandlers]): Deleted.
1272         * UIProcess/API/Cocoa/WKWebViewConfigurationInternal.h:
1273
1274 2018-07-27  Chris Dumez  <cdumez@apple.com>
1275
1276         Loading a file URL and then issuing a reload right away causes the load to fail due to sandboxing
1277         https://bugs.webkit.org/show_bug.cgi?id=188078
1278         <rdar://problem/42562493>
1279
1280         Unreviewed, follow-up fix after r234290 to address assertion hits on the bots. Make the fix
1281         specific to reloads as we know the existing provisional sandbox extension is for the same
1282         URL then.
1283
1284         * WebProcess/WebPage/WebPage.cpp:
1285         (WebKit::WebPage::reload):
1286         (WebKit::WebPage::SandboxExtensionTracker::beginLoad):
1287         (WebKit::WebPage::SandboxExtensionTracker::beginReload):
1288         * WebProcess/WebPage/WebPage.h:
1289
1290 2018-07-26  Andy VanWagoner  <andy@vanwagoner.family>
1291
1292         [INTL] Remove INTL sub-feature compile flags
1293         https://bugs.webkit.org/show_bug.cgi?id=188081
1294
1295         Reviewed by Michael Catanzaro.
1296
1297         * Configurations/FeatureDefines.xcconfig:
1298
1299 2018-07-26  Chris Dumez  <cdumez@apple.com>
1300
1301         Loading a file URL and then issuing a reload right away causes the load to fail due to sandboxing
1302         https://bugs.webkit.org/show_bug.cgi?id=188078
1303         <rdar://problem/42562493>
1304
1305         Reviewed by Geoff Garen.
1306
1307         When WebPageProxy::loadFile() is called, we create a SandboxExtension::Handle for the resource path provided
1308         by the caller and pass it to the WebProcess. WebPage::loadRequest() then calls SandboxExtensionTracker::beginLoad()
1309         to store this handle in m_provisionalSandboxExtension for later consumption.
1310
1311         If a reload is issued before this sandbox extension has been consumed, then the following happens:
1312         1. WebPageProxy::reload() does NOT create a SandboxExtension::Handle because it has already issued one earlier.
1313            maybeInitializeSandboxExtensionHandle() returns early due to m_process->hasAssumedReadAccessToURL(url) check.
1314         2. WebPage::reload() then calls SandboxExtensionTracker::beginLoad() with a null handle, which overwrites the
1315            previous m_provisionalSandboxExtension its needs.
1316         3. The load fails because the WebContent process is missing the sandbox extension.
1317
1318         To address the issue, SandboxExtensionTracker::beginLoad() is updated to only overwrite m_provisionalSandboxExtension
1319         if the new handle is not null. This avoids inadvertently clearing a valid sandbox extension we may need for the load,
1320         since the UIProcess sends us a null handle if it previously sent us a sandbox extension for the path in question.
1321
1322         * WebProcess/WebPage/WebPage.cpp:
1323         (WebKit::WebPage::SandboxExtensionTracker::beginLoad):
1324
1325 2018-07-26  Chris Dumez  <cdumez@apple.com>
1326
1327         It should be possible to use WTF::CallbackAggregator from a background thread
1328         https://bugs.webkit.org/show_bug.cgi?id=188084
1329
1330         Reviewed by Alex Christensen.
1331
1332         This code was passing CallbackAggregator objects for background thread and not being
1333         careful on which thread the CallbackAggregator gets destroyed. This patch fixes this
1334         since the CallbackAggregator destructor no longer takes care of dispatching to the
1335         main thread.
1336
1337         * NetworkProcess/cache/CacheStorageEngine.cpp:
1338         (WebKit::CacheStorage::Engine::clearAllCaches):
1339         (WebKit::CacheStorage::Engine::clearCachesForOrigin):
1340
1341 2018-07-26  Ross Kirsling  <ross.kirsling@sony.com>
1342
1343         String(View) should have a splitAllowingEmptyEntries function instead of a flag parameter
1344         https://bugs.webkit.org/show_bug.cgi?id=187963
1345
1346         Reviewed by Alex Christensen.
1347
1348         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
1349         (WebKit::CacheStorage::updateVaryInformation):
1350         * NetworkProcess/capture/NetworkCaptureManager.cpp:
1351         (WebKit::NetworkCapture::Manager::fuzzyMatchURLs):
1352         * Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm:
1353         (WebKit::getPluginInfoFromPropertyLists):
1354         (WebKit::PluginVersion::parse):
1355         * Shared/Plugins/Netscape/unix/NetscapePluginModuleUnix.cpp:
1356         (WebKit::NetscapePluginModule::parseMIMEDescription):
1357         * Shared/Plugins/unix/PluginSearchPath.cpp:
1358         (WebKit::pluginsDirectories):
1359         * Shared/mac/ChildProcessMac.mm:
1360         (WebKit::ChildProcess::initializeSandbox):
1361         * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.cpp:
1362         * UIProcess/Automation/WebAutomationSession.cpp:
1363         (WebKit::fileCanBeAcceptedForUpload):
1364         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
1365         (WebKit::ProcessLauncher::launchProcess):
1366         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
1367         (WebKit::ProcessLauncher::launchProcess):
1368         * UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp:
1369         (WebKit::PluginProcessProxy::scanPlugin):
1370         * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
1371         (WebKit::isTransparentSilverlightBackgroundValue):
1372         Update split/splitAllowingEmptyEntries usage.
1373
1374 2018-07-26  Alex Christensen  <achristensen@webkit.org>
1375
1376         Fix assertions introduced in r234210
1377         https://bugs.webkit.org/show_bug.cgi?id=188074
1378
1379         Reviewed by Chris Dumez.
1380
1381         There is a client that uses WKFramePolicyListenerUseWithPolicies to send website policies as
1382         a response to the WKPageNavigationClient's decidePolicyForNavigationResponse.  That is wasting
1383         effort to generate policies that don't change anything. Once that client adopts WKWebView
1384         they won't be able to do this any more, so temporarily remove the assertion.
1385         Also, make the assertion about process swapping a release assert to prevent that client
1386         from adopting WKFramePolicyListenerUseInNewProcessWithPolicies for navigation responses.
1387         It should only be used for navigation actions.
1388
1389         * UIProcess/WebPageProxy.cpp:
1390         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
1391         (WebKit::WebPageProxy::decidePolicyForResponse):
1392
1393 2018-07-26  Commit Queue  <commit-queue@webkit.org>
1394
1395         Unreviewed, rolling out r234181 and r234189.
1396         https://bugs.webkit.org/show_bug.cgi?id=188075
1397
1398         These are not needed right now (Requested by thorton on
1399         #webkit).
1400
1401         Reverted changesets:
1402
1403         "Enable Web Content Filtering on watchOS"
1404         https://bugs.webkit.org/show_bug.cgi?id=187979
1405         https://trac.webkit.org/changeset/234181
1406
1407         "HAVE(PARENTAL_CONTROLS) should be true on watchOS"
1408         https://bugs.webkit.org/show_bug.cgi?id=187985
1409         https://trac.webkit.org/changeset/234189
1410
1411 2018-07-26  Chris Dumez  <cdumez@apple.com>
1412
1413         ERROR: Unhandled web process message 'WebPage:SetUseDarkAppearance' when browsing in dark mode
1414         https://bugs.webkit.org/show_bug.cgi?id=188028
1415
1416         Reviewed by Wenson Hsieh.
1417
1418         The issue was that the WebViewImpl constructor was calling setUseDarkAppearance() *before* calling
1419         initializeWebPage(), which would cause us to send IPC the WebContent process for a pageID that does
1420         not exist on WebProcess side yet.
1421
1422         To address the issue, the WebViewImpl constructor no longer calls setUseDarkAppearance() and WebPageProxy
1423         no longer holds a flag indicates is dark appearance is used. Instead, the WebPageProxy asks the WebView
1424         for the value whenever it needs to, via the PageClient.
1425
1426         * UIProcess/Cocoa/WebViewImpl.h:
1427         * UIProcess/Cocoa/WebViewImpl.mm:
1428         (WebKit::WebViewImpl::WebViewImpl):
1429         (WebKit::WebViewImpl::effectiveAppearanceDidChange):
1430         (WebKit::WebViewImpl::setUseDarkAppearance): Deleted.
1431         * UIProcess/PageClient.h:
1432         * UIProcess/WebPageProxy.cpp:
1433         (WebKit::WebPageProxy::creationParameters):
1434         (WebKit::WebPageProxy::useDarkAppearance const):
1435         (WebKit::WebPageProxy::effectiveAppearanceDidChange):
1436         (WebKit::WebPageProxy::showPlaybackTargetPicker):
1437         (WebKit::WebPageProxy::setUseDarkAppearance): Deleted.
1438         * UIProcess/WebPageProxy.h:
1439         (WebKit::WebPageProxy::useDarkAppearance const): Deleted.
1440         * UIProcess/mac/PageClientImplMac.h:
1441         * UIProcess/mac/PageClientImplMac.mm:
1442         (WebKit::PageClientImpl::effectiveAppearanceIsDark const):
1443
1444 2018-07-26  Sihui Liu  <sihui_liu@apple.com>
1445
1446         Remove a forward protocol declaration of '_WKWebViewPrintProvider'
1447         https://bugs.webkit.org/show_bug.cgi?id=188012
1448         <rdar://problem/42309526>
1449
1450         Reviewed by Darin Adler.
1451
1452         @procotol() expressions emit invalid protocol metadata when used with forward @protocol declarations. 
1453         Clang is going to make it an error for using a forward-declared protocol in a @protocol expression, so
1454         we need to stop doing this.
1455
1456         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1457
1458 2018-07-26  Chris Dumez  <cdumez@apple.com>
1459
1460         Disable Dark Mode in the Plugin process to avoid rendering issues
1461         https://bugs.webkit.org/show_bug.cgi?id=188059
1462         <rdar://problem/42369281>
1463
1464         Reviewed by Tim Horton.
1465
1466         Plugins generally do not support dark mode and this causes rendering issues so
1467         disable dark mode in the plugin process.
1468
1469         * PluginProcess/mac/PluginProcessMac.mm:
1470         (WebKit::PluginProcess::platformInitializePluginProcess):
1471
1472 2018-07-26  Chris Dumez  <cdumez@apple.com>
1473
1474         WebSiteData-related methods should take in CompletionHandlers instead of Functions
1475         https://bugs.webkit.org/show_bug.cgi?id=188027
1476
1477         Reviewed by Alex Christensen.
1478
1479         WebSiteData-related methods should take in CompletionHandlers instead of Functions since
1480         they are need to be called and are only called once.
1481
1482         * UIProcess/Network/NetworkProcessProxy.cpp:
1483         (WebKit::NetworkProcessProxy::fetchWebsiteData):
1484         (WebKit::NetworkProcessProxy::deleteWebsiteData):
1485         (WebKit::NetworkProcessProxy::deleteWebsiteDataForOrigins):
1486         * UIProcess/Network/NetworkProcessProxy.h:
1487         * UIProcess/Plugins/PluginProcessProxy.cpp:
1488         (WebKit::PluginProcessProxy::fetchWebsiteData):
1489         (WebKit::PluginProcessProxy::deleteWebsiteData):
1490         (WebKit::PluginProcessProxy::deleteWebsiteDataForHostNames):
1491         * UIProcess/Plugins/PluginProcessProxy.h:
1492         * UIProcess/Storage/StorageProcessProxy.cpp:
1493         (WebKit::StorageProcessProxy::fetchWebsiteData):
1494         (WebKit::StorageProcessProxy::deleteWebsiteData):
1495         (WebKit::StorageProcessProxy::deleteWebsiteDataForOrigins):
1496         * UIProcess/Storage/StorageProcessProxy.h:
1497         * UIProcess/WebProcessProxy.cpp:
1498         (WebKit::WebProcessProxy::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores):
1499         (WebKit::WebProcessProxy::topPrivatelyControlledDomainsWithWebsiteData):
1500         (WebKit::WebProcessProxy::fetchWebsiteData):
1501         (WebKit::WebProcessProxy::deleteWebsiteData):
1502         (WebKit::WebProcessProxy::deleteWebsiteDataForOrigins):
1503         * UIProcess/WebProcessProxy.h:
1504
1505 2018-07-26  Miguel Gomez  <magomez@igalia.com>
1506
1507         [GTK][WPE] Improve the way request displayRefresh notifications
1508         https://bugs.webkit.org/show_bug.cgi?id=188005
1509
1510         Reviewed by Žan Doberšek.
1511
1512         Add a new interface ThreadedDisplayRefreshMonitor::Client and use it to pipe the the
1513         requestDisplayRefreshMonitorUpdate and handleDisplayRefreshMonitorUpdate to the
1514         ThreadedCoordinatedLayerTreeHost.
1515
1516         In response to requestDisplayRefreshMonitorUpdate, the LayerTreeHost will force a layer
1517         flush that in the end causes a repaint, which generates the requested display refresh
1518         event.
1519
1520         In response to handleDisplayRefreshMonitorUpdate, the call to renderNextFrame will happen,
1521         and if the DisplayRefreshMonitor has been rescheduled, renderNextFrame will also force
1522         a new layer flush, causing the repaint that will generate the display refreh event.
1523
1524         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
1525         (WebKit::ThreadedCompositor::create):
1526         (WebKit::ThreadedCompositor::ThreadedCompositor):
1527         (WebKit::m_displayRefreshMonitor):
1528         (WebKit::ThreadedCompositor::handleDisplayRefreshMonitorUpdate):
1529         (WebKit::ThreadedCompositor::requestDisplayRefreshMonitorUpdate): Deleted.
1530         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
1531         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp:
1532         (WebKit::ThreadedDisplayRefreshMonitor::ThreadedDisplayRefreshMonitor):
1533         (WebKit::ThreadedDisplayRefreshMonitor::requestRefreshCallback):
1534         (WebKit::ThreadedDisplayRefreshMonitor::dispatchDisplayRefreshCallback):
1535         (WebKit::ThreadedDisplayRefreshMonitor::invalidate):
1536         (WebKit::ThreadedDisplayRefreshMonitor::displayRefreshCallback):
1537         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.h:
1538         (WebKit::ThreadedDisplayRefreshMonitor::create):
1539         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
1540         (WebKit::CoordinatedLayerTreeHost::renderNextFrame):
1541         (WebKit::CoordinatedLayerTreeHost::flushLayersAndForceRepaint):
1542         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
1543         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
1544         (WebKit::ThreadedCoordinatedLayerTreeHost::ThreadedCoordinatedLayerTreeHost):
1545         (WebKit::ThreadedCoordinatedLayerTreeHost::requestDisplayRefreshMonitorUpdate):
1546         (WebKit::ThreadedCoordinatedLayerTreeHost::handleDisplayRefreshMonitorUpdate):
1547         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
1548
1549 2018-07-25  Brent Fulgham  <bfulgham@apple.com>
1550
1551         [macOS] Update sandboxes for revised OpenCL calls and streaming media
1552         https://bugs.webkit.org/show_bug.cgi?id=188013
1553         <rdar://problem/42594262>
1554
1555         Reviewed by Eric Carlson.
1556
1557         Testing logs from recent Mojave builds shows that OpenCL is checking more CPU-specific values as part of WebKit
1558         painting operations. We need to allow these checks in the sandbox to support these more optimized drawing operations.
1559
1560         I also corrected some sandbox violations I found while investigating streaming media issues.
1561
1562         * WebProcess/com.apple.WebProcess.sb.in:
1563
1564 2018-07-25  Jeremy Jones  <jeremyj@apple.com>
1565
1566         Mask AVBackgroundView to the corner radius.
1567         https://bugs.webkit.org/show_bug.cgi?id=187976
1568         rdar://problem/41810866
1569
1570         Reviewed by Jon Lee.
1571
1572         This changes sets the appropriate mask to the layer so the corners look correct.
1573
1574         * UIProcess/ios/fullscreen/WKFullscreenStackView.mm:
1575         (-[WKFullscreenStackView init]):
1576
1577 2018-07-25  Zalan Bujtas  <zalan@apple.com>
1578
1579         REGRESSION(r227577) Text on TV & Movies page doesn't wrap properly in iTunes
1580         https://bugs.webkit.org/show_bug.cgi?id=188018
1581         <rdar://problem/42517520>
1582
1583         Reviewed by Dean Jackson.
1584
1585         * WebProcess/WebPage/WebPage.cpp:
1586         (WebKit::m_credentialsMessenger):
1587
1588 2018-07-25  Tim Horton  <timothy_horton@apple.com>
1589
1590         Fix the build.
1591
1592         * UIProcess/mac/ServicesController.mm:
1593         (WebKit::hasCompatibleServicesForItems):
1594         I can't even.
1595
1596 2018-07-25  Tim Horton  <timothy_horton@apple.com>
1597
1598         Crashing on some builds that don't have async NSSharingService API
1599         https://bugs.webkit.org/show_bug.cgi?id=188015
1600         <rdar://problem/42593935>
1601
1602         Reviewed by Eric Carlson.
1603
1604         * UIProcess/mac/ServicesController.mm:
1605         (WebKit::hasCompatibleServicesForItems):
1606
1607 2018-07-25  Chris Dumez  <cdumez@apple.com>
1608
1609         navigator.userAgent may return outdated value after webView.customUserAgent is set
1610         https://bugs.webkit.org/show_bug.cgi?id=188009
1611         <rdar://problem/42566456>
1612
1613         Reviewed by Alex Christensen.
1614
1615         Let the page know when the user agent changes.
1616
1617         * WebProcess/WebPage/WebPage.cpp:
1618         (WebKit::WebPage::setUserAgent):
1619
1620 2018-07-25  Alex Christensen  <achristensen@webkit.org>
1621
1622         Use CompletionHandler for policy decisions
1623         https://bugs.webkit.org/show_bug.cgi?id=187975
1624
1625         Reviewed by Chris Dumez.
1626
1627         * UIProcess/WebFramePolicyListenerProxy.cpp:
1628         (WebKit::WebFramePolicyListenerProxy::WebFramePolicyListenerProxy):
1629         (WebKit::WebFramePolicyListenerProxy::use):
1630         (WebKit::WebFramePolicyListenerProxy::download):
1631         (WebKit::WebFramePolicyListenerProxy::ignore):
1632         (WebKit::WebFramePolicyListenerProxy::receivedPolicyDecision): Deleted.
1633         (WebKit::WebFramePolicyListenerProxy::setNavigation): Deleted.
1634         * UIProcess/WebFramePolicyListenerProxy.h:
1635         (WebKit::WebFramePolicyListenerProxy::create):
1636         (WebKit::WebFramePolicyListenerProxy::policyListenerType const): Deleted.
1637         (WebKit::WebFramePolicyListenerProxy::listenerID const): Deleted.
1638         (): Deleted.
1639         * UIProcess/WebFrameProxy.cpp:
1640         (WebKit::WebFrameProxy::setUpPolicyListenerProxy):
1641         (WebKit::WebFrameProxy::receivedPolicyDecision): Deleted.
1642         (WebKit::WebFrameProxy::activePolicyListenerProxy): Deleted.
1643         (WebKit::WebFrameProxy::changeWebsiteDataStore): Deleted.
1644         * UIProcess/WebFrameProxy.h:
1645         * UIProcess/WebPageProxy.cpp:
1646         (WebKit::WebPageProxy::receivedPolicyDecision):
1647         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1648         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
1649         (WebKit::WebPageProxy::decidePolicyForResponse):
1650         * UIProcess/WebPageProxy.h:
1651
1652 2018-07-25  Commit Queue  <commit-queue@webkit.org>
1653
1654         Unreviewed, rolling out r234196.
1655         https://bugs.webkit.org/show_bug.cgi?id=188011
1656
1657         broke API tests (Requested by alexchristensen on #webkit).
1658
1659         Reverted changeset:
1660
1661         "Use CompletionHandler for policy decisions"
1662         https://bugs.webkit.org/show_bug.cgi?id=187975
1663         https://trac.webkit.org/changeset/234196
1664
1665 2018-07-25  Alex Christensen  <achristensen@webkit.org>
1666
1667         Use CompletionHandler for policy decisions
1668         https://bugs.webkit.org/show_bug.cgi?id=187975
1669
1670         Reviewed by Chris Dumez.
1671
1672         * UIProcess/WebFramePolicyListenerProxy.cpp:
1673         (WebKit::WebFramePolicyListenerProxy::WebFramePolicyListenerProxy):
1674         (WebKit::WebFramePolicyListenerProxy::use):
1675         (WebKit::WebFramePolicyListenerProxy::download):
1676         (WebKit::WebFramePolicyListenerProxy::ignore):
1677         (WebKit::WebFramePolicyListenerProxy::receivedPolicyDecision): Deleted.
1678         (WebKit::WebFramePolicyListenerProxy::setNavigation): Deleted.
1679         * UIProcess/WebFramePolicyListenerProxy.h:
1680         (WebKit::WebFramePolicyListenerProxy::create):
1681         (WebKit::WebFramePolicyListenerProxy::policyListenerType const): Deleted.
1682         (WebKit::WebFramePolicyListenerProxy::listenerID const): Deleted.
1683         (): Deleted.
1684         * UIProcess/WebFrameProxy.cpp:
1685         (WebKit::WebFrameProxy::setUpPolicyListenerProxy):
1686         (WebKit::WebFrameProxy::receivedPolicyDecision): Deleted.
1687         (WebKit::WebFrameProxy::activePolicyListenerProxy): Deleted.
1688         (WebKit::WebFrameProxy::changeWebsiteDataStore): Deleted.
1689         * UIProcess/WebFrameProxy.h:
1690         * UIProcess/WebPageProxy.cpp:
1691         (WebKit::WebPageProxy::receivedPolicyDecision):
1692         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1693         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
1694         (WebKit::WebPageProxy::decidePolicyForResponse):
1695         * UIProcess/WebPageProxy.h:
1696
1697 2018-07-25  Brent Fulgham  <bfulgham@apple.com>
1698
1699         [macOS] PluginProcess needs TCC entitlements for media capture
1700         https://bugs.webkit.org/show_bug.cgi?id=187981
1701         <rdar://problem/42433634>
1702
1703         Reviewed by Chris Dumez.
1704
1705         The changes needed in Bug 185526 are also needed for the plugin process, or else the UIProcess
1706         (e.g., Safari) is not able to pass the user's camera/microphone access permission to the plugin process.
1707
1708         This patch has the following changes:
1709
1710         1. Rename "WebContent-OSX-restricted.entitlements" to "WebContent-or-Plugin-OSX-restricted.entitlements"
1711         2. Rename "process-webcontent-entitlements.sh" to "process-webcontent-or-plugin-entitlements.sh"
1712         3. Add a run-script step to the Plugin.64 and Plugin.32 builds to add the relevant entitlements.
1713         4. Silence some Flash plugin sandbox exceptions triggered after activating the camera.
1714
1715         * Configurations/WebContent-or-Plugin-OSX-restricted.entitlements: Renamed from Source/WebKit/Configurations/WebContent-OSX-restricted.entitlements.
1716         * Resources/PlugInSandboxProfiles/com.macromedia.Flash Player ESR.plugin.sb: Address sandbox violations needed by camera use.
1717         * Resources/PlugInSandboxProfiles/com.macromedia.Flash Player.plugin.sb: Ditto.
1718         * Scripts/process-webcontent-or-plugin-entitlements.sh: Renamed from Source/WebKit/Scripts/process-webcontent-entitlements.sh.
1719         * WebKit.xcodeproj/project.pbxproj: Update for renaming, and perform entitlement steps on Plugin process.
1720
1721 2018-07-24  Tim Horton  <timothy_horton@apple.com>
1722
1723         Enable Web Content Filtering on watchOS
1724         https://bugs.webkit.org/show_bug.cgi?id=187979
1725         <rdar://problem/42559346>
1726
1727         Reviewed by Wenson Hsieh.
1728
1729         * Configurations/FeatureDefines.xcconfig:
1730
1731 2018-07-24  Aditya Keerthi  <akeerthi@apple.com>
1732
1733         [Datalist][macOS] Display suggestions for input[type=color]
1734         https://bugs.webkit.org/show_bug.cgi?id=187794
1735
1736         Reviewed by Tim Horton.
1737
1738         An input[type=color] element that has an associated datalist element should
1739         display the color values provided. We now support 1-12 suggested colors, that
1740         will be displayed at the top of the color selection popover. If no suggestions
1741         are specified we keep the existing default colors.
1742
1743         Created an NSPopoverColorWell subclass that allows custom colors to be specified
1744         in the form of an NSColorList.
1745
1746         Also fixed a bug where an additional color well was displayed when clicking on
1747         the input element.
1748
1749         * Shared/WebCoreArgumentCoders.cpp:
1750         (IPC::ArgumentCoder<Color>::decode):
1751         * Shared/WebCoreArgumentCoders.h:
1752         * UIProcess/API/gtk/PageClientImpl.cpp:
1753         (WebKit::PageClientImpl::createColorPicker):
1754         * UIProcess/API/gtk/PageClientImpl.h:
1755         * UIProcess/PageClient.h:
1756         * UIProcess/WebPageProxy.cpp:
1757         (WebKit::WebPageProxy::showColorPicker):
1758         * UIProcess/WebPageProxy.h:
1759         * UIProcess/WebPageProxy.messages.in:
1760         * UIProcess/ios/PageClientImplIOS.h:
1761         * UIProcess/ios/PageClientImplIOS.mm:
1762         (WebKit::PageClientImpl::createColorPicker):
1763         * UIProcess/mac/PageClientImplMac.h:
1764         * UIProcess/mac/PageClientImplMac.mm:
1765         (WebKit::PageClientImpl::createColorPicker):
1766         * UIProcess/mac/WebColorPickerMac.h:
1767         * UIProcess/mac/WebColorPickerMac.mm:
1768         (WebKit::WebColorPickerMac::create):
1769         (WebKit::WebColorPickerMac::WebColorPickerMac):
1770         (WebKit::WebColorPickerMac::showColorPicker):
1771         (+[WKPopoverColorWell _colorPopoverCreateIfNecessary:]):
1772         (-[WKPopoverColorWell _showPopover]):
1773         (-[WKPopoverColorWell setSuggestedColors:]):
1774         (-[WKColorPopoverMac initWithFrame:inView:]):
1775         (-[WKColorPopoverMac setAndShowPicker:withColor:suggestions:]):
1776         (-[WKColorPanelMac setAndShowPicker:withColor:suggestions:]):
1777         * WebProcess/WebCoreSupport/WebColorChooser.cpp:
1778         (WebKit::WebColorChooser::WebColorChooser):
1779         (WebKit::WebColorChooser::reattachColorChooser):
1780
1781 2018-07-24  Alex Christensen  <achristensen@webkit.org>
1782
1783         Modernize NavigationState
1784         https://bugs.webkit.org/show_bug.cgi?id=187966
1785
1786         Reviewed by Andy Estes.
1787
1788         Don't ignore switch warnings any more.
1789         Use BlockPtr.
1790
1791         * UIProcess/Cocoa/NavigationState.mm:
1792         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
1793         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse):
1794
1795 2018-07-24  Alex Christensen  <achristensen@webkit.org>
1796
1797         Remove WebFramePolicyListenerProxy::changeWebsiteDataStore
1798         https://bugs.webkit.org/show_bug.cgi?id=187967
1799
1800         Reviewed by Andy Estes.
1801
1802         We need to call WebFrameProxy::changeWebsiteDataStore if the _WKWebsitePolicies has a WKWebsiteDataStore.
1803         We're doing that in a weird way that is not in the right layer.  Inside the call to WebFramePolicyListenerProxy::use
1804         we can inform the frame if there's a new WebsiteDataStore.
1805         
1806         No change in behavior, as verified by the WebKit.WebsitePoliciesDataStore API test.
1807         This is a step towards using lambdas in WebFramePolicyListenerProxy.
1808
1809         * UIProcess/API/APINavigationClient.h:
1810         (API::NavigationClient::decidePolicyForNavigationAction):
1811         (API::NavigationClient::decidePolicyForNavigationResponse):
1812         * UIProcess/API/APIPolicyClient.h:
1813         (API::PolicyClient::decidePolicyForNavigationAction):
1814         (API::PolicyClient::decidePolicyForNewWindowAction):
1815         (API::PolicyClient::decidePolicyForResponse):
1816         * UIProcess/API/C/WKFramePolicyListener.cpp:
1817         (WKFramePolicyListenerUse):
1818         (WKFramePolicyListenerUseInNewProcess):
1819         (useWithPolicies):
1820         * UIProcess/API/C/WKPage.cpp:
1821         (WKPageSetPagePolicyClient):
1822         (WKPageSetPageNavigationClient):
1823         * UIProcess/Cocoa/NavigationState.mm:
1824         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
1825         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse):
1826         * UIProcess/WebFramePolicyListenerProxy.cpp:
1827         (WebKit::WebFramePolicyListenerProxy::use):
1828         (WebKit::WebFramePolicyListenerProxy::changeWebsiteDataStore): Deleted.
1829         * UIProcess/WebFramePolicyListenerProxy.h:
1830         * UIProcess/WebPageProxy.cpp:
1831         * UIProcess/mac/PageClientImplMac.mm:
1832
1833 2018-07-24  Ryan Haddad  <ryanhaddad@apple.com>
1834
1835         Unreviewed, rolling out r234121.
1836
1837         Caused perf test failures.
1838
1839         Reverted changeset:
1840
1841         "We should cache the compiled sandbox profile in a data vault"
1842         https://bugs.webkit.org/show_bug.cgi?id=184991
1843         https://trac.webkit.org/changeset/234121
1844
1845 2018-07-24  Jeff Miller  <jeffm@apple.com>
1846
1847         WKUIDelegate needs an alternate decideDatabaseQuotaForSecurityOrigin method that provides the database name and display name
1848         https://bugs.webkit.org/show_bug.cgi?id=187567
1849
1850         Reviewed by Alex Christensen.
1851
1852         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
1853         Declare alternate decideDatabaseQuotaForSecurityOrigin method, copying the existing FIXME comment
1854         from the old method.
1855         
1856         * UIProcess/Cocoa/UIDelegate.h:
1857         Add flag for new delegate method.
1858         
1859         * UIProcess/Cocoa/UIDelegate.mm:
1860         (WebKit::UIDelegate::setDelegate):
1861         Initialize new flag.
1862         
1863         (WebKit::UIDelegate::UIClient::exceededDatabaseQuota):
1864         Prefer the new UIDelegate method that takes the database name and display name, falling back to the
1865         existing method if the client doesn't implement it.
1866
1867 2018-07-24  Stephan Szabo  <stephan.szabo@sony.com>
1868
1869         [WinCairo] Add support to WebView for setting tooltips
1870         https://bugs.webkit.org/show_bug.cgi?id=187930
1871
1872         Reviewed by Fujii Hironori.
1873
1874         * UIProcess/win/PageClientImpl.cpp:
1875         (WebKit::PageClientImpl::toolTipChanged): Set tooltip on WebView
1876         * UIProcess/win/WebView.cpp:
1877         (WebKit::WebView::setToolTip): Add support for updating the
1878         tooltip text in Windows.
1879         * UIProcess/win/WebView.h:
1880
1881 2018-07-24  Alex Christensen  <achristensen@webkit.org>
1882
1883         Reduce getters/setters in WebFramePolicyListenerProxy
1884         https://bugs.webkit.org/show_bug.cgi?id=187830
1885
1886         Reviewed by Dean Jackson.
1887
1888         This is a step towards making it a lambda, which has no getters or setters.
1889         No change in behavior.
1890
1891         setApplyPolicyInNewProcessIfPossible can be replaced by passing another parameter.
1892         This bit was just piggy-backing on the WebFramePolicyListenerProxy.
1893
1894         isMainFrame was only used in an assert, which has a corresponding ObjC exception in
1895         NavigationState::NavigationClient::decidePolicyForNavigationAction for the one relevant client.
1896
1897         * UIProcess/API/C/WKFramePolicyListener.cpp:
1898         (WKFramePolicyListenerUseInNewProcess):
1899         (useWithPolicies):
1900         (WKFramePolicyListenerUseWithPolicies):
1901         (WKFramePolicyListenerUseInNewProcessWithPolicies):
1902         * UIProcess/Cocoa/NavigationState.mm:
1903         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
1904         * UIProcess/WebFramePolicyListenerProxy.cpp:
1905         (WebKit::WebFramePolicyListenerProxy::receivedPolicyDecision):
1906         (WebKit::WebFramePolicyListenerProxy::use):
1907         (WebKit::WebFramePolicyListenerProxy::download):
1908         (WebKit::WebFramePolicyListenerProxy::ignore):
1909         (WebKit::WebFramePolicyListenerProxy::isMainFrame const): Deleted.
1910         * UIProcess/WebFramePolicyListenerProxy.h:
1911         (WebKit::WebFramePolicyListenerProxy::setApplyPolicyInNewProcessIfPossible): Deleted.
1912         (WebKit::WebFramePolicyListenerProxy::applyPolicyInNewProcessIfPossible const): Deleted.
1913         * UIProcess/WebFrameProxy.cpp:
1914         (WebKit::WebFrameProxy::receivedPolicyDecision):
1915         * UIProcess/WebFrameProxy.h:
1916         * UIProcess/WebPageProxy.cpp:
1917         (WebKit::WebPageProxy::receivedPolicyDecision):
1918         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1919         * UIProcess/WebPageProxy.h:
1920         * UIProcess/WebProcessPool.cpp:
1921         (WebKit::WebProcessPool::processForNavigation):
1922         (WebKit::WebProcessPool::processForNavigationInternal):
1923         * UIProcess/WebProcessPool.h:
1924
1925 2018-07-24  Alex Christensen  <achristensen@webkit.org>
1926
1927         Remove WebFramePolicyListenerProxy::invalidate
1928         https://bugs.webkit.org/show_bug.cgi?id=187833
1929
1930         Reviewed by Dean Jackson.
1931
1932         When we're invalidating the listener, calling ignore instead will at worst cause
1933         an ignored message to be sent.  The load will be cancelled either way.
1934         Removing the invalidate method gets it closer to being a lambda.
1935
1936         * UIProcess/WebFramePolicyListenerProxy.cpp:
1937         (WebKit::WebFramePolicyListenerProxy::invalidate): Deleted.
1938         * UIProcess/WebFramePolicyListenerProxy.h:
1939         * UIProcess/WebFrameProxy.cpp:
1940         (WebKit::WebFrameProxy::webProcessWillShutDown):
1941         (WebKit::WebFrameProxy::setUpPolicyListenerProxy):
1942
1943 2018-07-24  Chris Dumez  <cdumez@apple.com>
1944
1945         WebFullScreenManagerProxy does not need to be ref counted
1946         https://bugs.webkit.org/show_bug.cgi?id=187928
1947
1948         Reviewed by Eric Carlson.
1949
1950         WebFullScreenManagerProxy does not need to be ref counted, it is owned by WebPageProxy.
1951         It is also error-prone because WebFullScreenManagerProxy has a raw pointer to its WebPageProxy
1952         and anybody could extend the lifetime of the WebFullScreenManagerProxy by refing it, which
1953         would make the WebPageProxy pointer stale.
1954
1955         * UIProcess/WebFullScreenManagerProxy.cpp:
1956         (WebKit::WebFullScreenManagerProxy::WebFullScreenManagerProxy):
1957         (WebKit::WebFullScreenManagerProxy::willEnterFullScreen):
1958         (WebKit::WebFullScreenManagerProxy::didEnterFullScreen):
1959         (WebKit::WebFullScreenManagerProxy::willExitFullScreen):
1960         (WebKit::WebFullScreenManagerProxy::didExitFullScreen):
1961         (WebKit::WebFullScreenManagerProxy::setAnimatingFullScreen):
1962         (WebKit::WebFullScreenManagerProxy::requestExitFullScreen):
1963         (WebKit::WebFullScreenManagerProxy::saveScrollPosition):
1964         (WebKit::WebFullScreenManagerProxy::restoreScrollPosition):
1965         (WebKit::WebFullScreenManagerProxy::setFullscreenInsets):
1966         (WebKit::WebFullScreenManagerProxy::setFullscreenAutoHideDuration):
1967         (WebKit::WebFullScreenManagerProxy::setFullscreenControlsHidden):
1968         (WebKit::WebFullScreenManagerProxy::invalidate):
1969         * UIProcess/WebFullScreenManagerProxy.h:
1970         * UIProcess/WebPageProxy.cpp:
1971         (WebKit::m_resetRecentCrashCountTimer):
1972         (WebKit::WebPageProxy::reattachToWebProcess):
1973         * UIProcess/WebPageProxy.h:
1974
1975 2018-07-24  Zan Dobersek  <zdobersek@igalia.com>
1976
1977         [TextureMapper] Separate repaint counter state from debug visuals
1978         https://bugs.webkit.org/show_bug.cgi?id=187946
1979
1980         Reviewed by Carlos Garcia Campos.
1981
1982         Instead of managing the repaint counter visibility along with the
1983         debug border visuals, do that together with the repaint count value.
1984
1985         In the CoordinatedGraphicsScene class, remove the helper
1986         setLayerRepaintCountIfNeeded() method that's only been called in one
1987         place, and instead set the repaint count information on the
1988         TextureMapperLayer object directly from setLayerState(). The repaint
1989         counter visiblity and count value are gathered from the new struct
1990         that's kept on the CoordinatedGraphicsLayerState object.
1991
1992         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
1993         (WebKit::CoordinatedGraphicsScene::setLayerState):
1994         (WebKit::CoordinatedGraphicsScene::setLayerRepaintCountIfNeeded): Deleted.
1995         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
1996
1997 2018-07-24  Thibault Saunier  <tsaunier@igalia.com>
1998
1999         [WPE][GTK] Implement WebRTC based on libwebrtc
2000         https://bugs.webkit.org/show_bug.cgi?id=186932
2001
2002         Reviewed by Philippe Normand.
2003
2004         * WebProcess/Network/webrtc/LibWebRTCProvider.h: Use LibWebRTCProviderGlib when building WPE or GTK ports.
2005
2006 2018-07-23  Stephan Szabo  <stephan.szabo@sony.com>
2007
2008         [WinCairo] Add implementation for setting cursors
2009         https://bugs.webkit.org/show_bug.cgi?id=187868
2010
2011         Reviewed by Fujii Hironori.
2012
2013         * UIProcess/win/PageClientImpl.cpp:
2014         (WebKit::PageClientImpl::setCursor): Set cursor on the webview
2015         * UIProcess/win/WebView.cpp:
2016         (WebKit::WebView::setCursor): Add implementation to set the
2017         web cursor to update the Windows cursor
2018         * UIProcess/win/WebView.h:
2019
2020 2018-07-23  Jeremy Jones  <jeremyj@apple.com>
2021
2022         Crash when loadViewIfRequired called while WKFullScreenViewController is being deallocated.
2023         https://bugs.webkit.org/show_bug.cgi?id=187920
2024         rdar://problem/41324023
2025
2026         Reviewed by Eric Carlson.
2027
2028         Clear dangling weak-ref.
2029         Prevent async playback state calls from instantiating the interface.
2030         Release WKFullScreenViewController when it is no longer needed.
2031
2032         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
2033         (-[WKFullScreenViewController dealloc]):
2034         (-[WKFullScreenViewController setPlaying:]):
2035         (-[WKFullScreenViewController setAnimating:]):
2036         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
2037         (-[WKFullScreenWindowController _completedExitFullScreen]):
2038
2039 2018-07-23  Timothy Horton  <timothy_horton@apple.com>
2040
2041         Try to fix the build.
2042
2043         * UIProcess/mac/ServicesController.mm:
2044         (WebKit::hasCompatibleServicesForItems):
2045
2046 2018-07-23  Ben Richards  <benton_richards@apple.com>
2047
2048         We should cache the compiled sandbox profile in a data vault
2049         https://bugs.webkit.org/show_bug.cgi?id=184991
2050
2051         Reviewed by Ryosuke Niwa.
2052
2053         This patch changes a few things (note: data vaults and sandbox entitlements are only used in internal builds):
2054         (1) Instead of compiling a sandbox every time a process is launched, processes now look for a cached sandbox
2055             in a process specific data vault on macOS platforms. (ChildProcessMac.mm)
2056         (2) If a valid cached sandbox is not found, a process will create the data vault (or ensure that it exists),
2057             compile a sandbox, and cache it.
2058         (3) In order to create process specific data vaults, each process now has their own <process name>-OSX-sandbox.entitlements
2059             file which contains an entitlement with a process specific "storage class" which ensures that each process
2060             can only ever access its own data vault. (See the article on confluence "Data Vaults and Restricted Files" for more info)
2061         (4) The sandbox entitlements file for the Network, WebContent and Plugin services are loaded dynamically
2062             through Scripts/<process name>-process-entitlements.sh which is triggered in a new build phase for each service.
2063             The Storage process sandbox entitlements are loaded directly in Configurations/StorageService.xcconfig.
2064             The reason that the sandbox entitlements are applied dynamically is so that these sandbox entitlements
2065             are only applied when WK_USE_RESTRICTED_ENTITLEMENTS is YES. This means that open source builds will still work.
2066
2067         * Configurations/Network-OSX-sandbox.entitlements: Added.
2068         * Configurations/Plugin-OSX-sandbox.entitlements: Added.
2069         * Configurations/Storage-OSX-sandbox.entitlements: Added.
2070         * Configurations/StorageService.xcconfig:
2071         * Configurations/WebContent-OSX-sandbox.entitlements: Added.
2072         * Configurations/WebKit.xcconfig:
2073         * NetworkProcess/NetworkProcess.h:
2074         * PluginProcess/PluginProcess.h:
2075         * Scripts/process-network-entitlements.sh: Added.
2076         * Scripts/process-plugin-entitlements.sh: Added.
2077         * Scripts/process-webcontent-entitlements.sh:
2078         * Shared/ChildProcess.h:
2079         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
2080         (WebKit::XPCServiceInitializer):
2081         * Shared/SandboxInitializationParameters.h:
2082         (WebKit::SandboxInitializationParameters::setOverrideSandboxProfilePath):
2083         (WebKit::SandboxInitializationParameters::overrideSandboxProfilePath const):
2084         (WebKit::SandboxInitializationParameters::setSandboxProfile):
2085         (WebKit::SandboxInitializationParameters::sandboxProfile const):
2086         (): Deleted.
2087         * Shared/mac/ChildProcessMac.mm:
2088         (WebKit::SandboxProfileDeleter::operator()):
2089         (WebKit::SandboxParametersDeleter::operator()):
2090         (WebKit::SandboxInfo::SandboxInfo):
2091         (WebKit::fileContents):
2092         (WebKit::processStorageClass):
2093         (WebKit::setAndSerializeSandboxParameters):
2094         (WebKit::getUserCacheDirectory):
2095         (WebKit::sandboxDataVaultParentDirectory):
2096         (WebKit::sandboxDirectory):
2097         (WebKit::sandboxFilePath):
2098         (WebKit::ensureSandboxCacheDirectory):
2099         (WebKit::writeSandboxDataToCacheFile):
2100         (WebKit::compileAndCacheSandboxProfile):
2101         (WebKit::tryApplyCachedSandbox):
2102         (WebKit::webKit2Bundle):
2103         (WebKit::sandboxProfilePath):
2104         (WebKit::compileAndApplySandboxSlowCase):
2105         (WebKit::applySandbox):
2106         (WebKit::initializeSandboxParameters):
2107         (WebKit::ChildProcess::initializeSandbox):
2108         * Shared/mac/SandboxInitialiationParametersMac.mm:
2109         (WebKit::SandboxInitializationParameters::SandboxInitializationParameters):
2110         * StorageProcess/StorageProcess.h:
2111         * WebKit.xcodeproj/project.pbxproj:
2112         * WebProcess/WebProcess.h:
2113
2114 2018-07-23  Tim Horton  <timothy_horton@apple.com>
2115
2116         Creating and loading content in a WKWebView triggers Main Thread Checker warnings under ServicesController
2117         https://bugs.webkit.org/show_bug.cgi?id=186963
2118         <rdar://problem/41393682>
2119
2120         Reviewed by Timothy Hatcher.
2121
2122         * UIProcess/mac/ServicesController.h:
2123         * UIProcess/mac/ServicesController.mm:
2124         (WebKit::hasCompatibleServicesForItems):
2125         (WebKit::ServicesController::refreshExistingServices):
2126         Adopt async ShareKit SPI that is actually thread-safe instead of the not-quite-safe
2127         synchronous API. Request all three sets of services immediately, and dispatch
2128         to the Web Content processes when all three have returned.
2129
2130 2018-07-23  Chris Dumez  <cdumez@apple.com>
2131
2132         WebResourceLoadStatisticsStore fails to unregister itself as a MessageReceiver in its destructor
2133         https://bugs.webkit.org/show_bug.cgi?id=187910
2134         <rdar://problem/42356526>
2135
2136         Reviewed by Brent Fulgham.
2137
2138         The WebResourceLoadStatisticsStore was only removing itself as a MessageReceiver from the WebProcessProxy
2139         and that WebProcessProxy's connection was getting closed. However, it is possible for the
2140         WebResourceLoadStatisticsStore to get destroyed before this happens. This would lead to crashes such as
2141         the one in <rdar://problem/42356526>.
2142
2143         To address the issue, we let the WebsiteDataStore take care of registering / unregistering the
2144         WebResourceLoadStatisticsStore as a MessageReceiver with the WebProcessProxy. This is more reliable since
2145         the WebsiteDataStore is the one that subclasses WebProcessLifetimeObserver. Make sure the
2146         WebResourceLoadStatisticsStore is removed as a MessageReceiver whenever the WebsiteDataStore is destroyed
2147         or WebsiteDataStore::m_resourceLoadStatistics gets cleared.
2148
2149         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2150         * UIProcess/WebResourceLoadStatisticsStore.h:
2151         Drop logic to add / remove the WebResourceLoadStatisticsStore as a receiver now that the
2152         WebsiteDataStore takes care of it.
2153
2154         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2155         (WebKit::WebsiteDataStore::~WebsiteDataStore):
2156         Make sure the WebResourceLoadStatisticsStore gets unregistered as a MessageReceiver from all associated
2157         WebProcessProxy objects when the WebsiteDataStore gets destroyed.
2158
2159         (WebKit::WebsiteDataStore::webProcessWillOpenConnection):
2160         (WebKit::WebsiteDataStore::webProcessDidCloseConnection):
2161         Register / Unregister the WebResourceLoadStatisticsStore as a MessageReceiver with the WebProcessProxy.
2162
2163         (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
2164         Make sure we unregister the WebResourceLoadStatisticsStore as a MessageReceiver with all associated
2165         WebProcessProxy objects before we clear m_resourceLoadStatistics as this will causes the
2166         WebResourceLoadStatisticsStore to get destroyed.
2167
2168         (WebKit::WebsiteDataStore::unregisterWebResourceLoadStatisticsStoreAsMessageReceiver):
2169         (WebKit::WebsiteDataStore::registerWebResourceLoadStatisticsStoreAsMessageReceiver):
2170         Add utility functions to register / unregister WebResourceLoadStatisticsStore as a MessageReceiver with
2171         all associated WebProcessProxy objects.
2172
2173         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
2174         Register the new WebResourceLoadStatisticsStore as a MessageReceiver with all associated WebProcessProxy
2175         objects in case setResourceLoadStatisticsEnabled(true) gets called *after* we've already started
2176         WebProcesses.
2177
2178         * UIProcess/WebsiteData/WebsiteDataStore.h:
2179
2180 2018-07-23  John Wilander  <wilander@apple.com>
2181
2182         Resource Load Statistics: Add logging of Storage Access API use in experimental debug mode
2183         https://bugs.webkit.org/show_bug.cgi?id=187918
2184         <rdar://problem/42509062>
2185
2186         Reviewed by Jiewen Tan.
2187
2188         Tested manually by looking at log output.
2189
2190         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
2191         (WebKit::ResourceLoadStatisticsMemoryStore::removeDataRecords):
2192             This is just a clean-up change.
2193         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccess):
2194         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccessUnderOpener):
2195             Both these now log proper info in debug mode.
2196
2197 2018-07-23  Aditya Keerthi  <akeerthi@apple.com>
2198
2199         [iOS] Add support for input[type=color]
2200         https://bugs.webkit.org/show_bug.cgi?id=187871
2201
2202         Reviewed by Tim Horton.
2203
2204         Created WKFormColorControl to display a color picker once a color input gains
2205         focus. The control is presented as an inputView on iPhone and as a popover on
2206         iPad. The picker itself consists of two color matrices. The first is a set of 12
2207         default colors, displayed on the top row of the picker. In a subsequent patch,
2208         this top row will be made customizable through the use of the datalist element.
2209         The second matrix is a grid of 120 colors, provided by the system. Colors can be
2210         selected from either matrix by tapping or with a pan gesture.
2211
2212         WKColorMatrixView represents a single color matrix and is comprised of
2213         WKColorButtons that represent each color in the matrix.
2214
2215         * Shared/AssistedNodeInformation.h:
2216         * UIProcess/API/Cocoa/_WKFocusedElementInfo.h:
2217         * UIProcess/ios/PageClientImplIOS.h:
2218         * UIProcess/ios/PageClientImplIOS.mm:
2219         (WebKit::PageClientImpl::createColorPicker):
2220         * UIProcess/ios/WKContentViewInteraction.mm:
2221         (-[WKFocusedElementInfo initWithAssistedNodeInformation:isUserInitiated:userObject:]):
2222         (-[WKContentView _requiresKeyboardWhenFirstResponder]):
2223         (-[WKContentView inputView]):
2224         (-[WKContentView requiresAccessoryView]):
2225         (isAssistableInputType):
2226         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
2227         (-[WKContentView actionNameForFocusedFormControlView:]):
2228         * UIProcess/ios/forms/WKFormColorControl.h: Added.
2229         * UIProcess/ios/forms/WKFormColorControl.mm: Added.
2230         (-[WKColorPopover initWithView:]):
2231         (-[WKColorPopover controlView]):
2232         (-[WKColorPopover controlBeginEditing]):
2233         (-[WKColorPopover controlEndEditing]):
2234         (-[WKFormColorControl initWithView:]):
2235         (-[WKFormColorControl assistantView]):
2236         (-[WKFormColorControl beginEditing]):
2237         (-[WKFormColorControl endEditing]):
2238         * UIProcess/ios/forms/WKFormColorPicker.h: Added.
2239         * UIProcess/ios/forms/WKFormColorPicker.mm: Added.
2240         (+[WKColorButton colorButtonWithColor:]):
2241         (-[WKColorMatrixView initWithFrame:]):
2242         (-[WKColorMatrixView initWithFrame:colorMatrix:]):
2243         (-[WKColorMatrixView layoutSubviews]):
2244         (-[WKColorMatrixView colorButtonTapped:]):
2245         (+[WKColorPicker defaultTopColorMatrix]):
2246         (-[WKColorPicker initWithView:]):
2247         (-[WKColorPicker setControlValueFromUIColor:]):
2248         (-[WKColorPicker controlView]):
2249         (-[WKColorPicker controlBeginEditing]):
2250         (-[WKColorPicker controlEndEditing]):
2251         (-[WKColorPicker colorMatrixView:didTapColorButton:]):
2252         (-[WKColorPicker didPanColors:]):
2253         * WebKit.xcodeproj/project.pbxproj:
2254         * WebProcess/WebPage/ios/WebPageIOS.mm:
2255         (WebKit::isAssistableElement):
2256         (WebKit::WebPage::getAssistedNodeInformation):
2257
2258 2018-07-23  Stephan Szabo  <stephan.szabo@sony.com>
2259
2260         [WinCairo] Fix detection of held modifier keys for key events
2261         https://bugs.webkit.org/show_bug.cgi?id=187862
2262
2263         Reviewed by Fujii Hironori.
2264
2265         * Shared/win/WebEventFactory.cpp:
2266         (WebKit::IsKeyInDownState): Use requested modifier not VK_MENU
2267
2268 2018-07-20  Jer Noble  <jer.noble@apple.com>
2269
2270         REGRESSION(r233925): Can't go into PiP twice
2271         https://bugs.webkit.org/show_bug.cgi?id=187876
2272         <rdar://problem/42444520>
2273
2274         Reviewed by Jon Lee.
2275
2276         We fail to enter PiP the second time because the video fullscreen interface no longer has a
2277         model, and so gives a contentSize of 0x0. This happens because we disassociate the
2278         interface from the model in didCleanupFullscreen. However, the interface and model can still
2279         be re-used if they're kept alive by another client. We should delay disassociating the model
2280         from the interface until just before the model is destroyed in removeClientForContext.
2281
2282         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
2283         (WebKit::VideoFullscreenManagerProxy::removeClientForContext):
2284         (WebKit::VideoFullscreenManagerProxy::didCleanupFullscreen):
2285
2286 2018-07-20  John Wilander  <wilander@apple.com>
2287
2288         Resource Load Statistics: Enable basic functionality in experimental debug mode
2289         https://bugs.webkit.org/show_bug.cgi?id=187835
2290         <rdar://problem/42408590>
2291
2292         Reviewed by Chris Dumez.
2293
2294         This patch makes the experimental ITP Debug Mode feature work, at least
2295         to a basic level. This means:
2296         - Debug logging on the INFO level.
2297         - Permanently treat 3rdpartytestwebkit.org as a prevalent resource.
2298         - Support manual setting of a custom permanently prevalent resource through user
2299           defaults on Cocoa platforms.
2300
2301         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2302         (WKWebsiteDataStoreSetResourceLoadStatisticsDebugModeWithCompletionHandler):
2303         (WKWebsiteDataStoreSetResourceLoadStatisticsPrevalentResourceForDebugMode):
2304             Test infrastructure.
2305         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
2306         * UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm:
2307         (WebKit::ResourceLoadStatisticsMemoryStore::registerUserDefaultsIfNeeded):
2308             Used to pick up custom set prevalent resource on Cocoa platforms (for debug mode).
2309         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
2310         (WebKit::ResourceLoadStatisticsMemoryStore::isPrevalentDueToDebugMode):
2311         (WebKit::ResourceLoadStatisticsMemoryStore::processStatisticsAndDataRecords):
2312             Now skips processing of debug mode prevalent resources so that they
2313             stay prevalent.
2314         (WebKit::ResourceLoadStatisticsMemoryStore::ensurePrevalentResourcesForDebugMode):
2315             Convenience function to make 3rdpartytestwebkit.org and any custom domain
2316             set through ResourceLoadStatisticsMemoryStore::setPrevalentResourceForDebugMode()
2317             be prevalent resources.
2318         (WebKit::ResourceLoadStatisticsMemoryStore::setResourceLoadStatisticsDebugMode):
2319         (WebKit::ResourceLoadStatisticsMemoryStore::setPrevalentResourceForDebugMode):
2320             Sets a custom domain to always be treated as prevalent in debug mode.
2321         (WebKit::ResourceLoadStatisticsMemoryStore::clear):
2322             Now makes sure 3rdpartytestwebkit.org and any custom domain set through
2323             ResourceLoadStatisticsMemoryStore::setPrevalentResourceForDebugMode()
2324             are prevalent resources even after a clear of the store.
2325         (WebKit::debugLogDomainsInBatches):
2326             We may have too many domain names to fit in a single log statement.
2327             This function logs them in batches of 50, if we have more than 50.
2328         (WebKit::ResourceLoadStatisticsMemoryStore::updateCookiePartitioning):
2329             Now makes use of debugLogDomainsInBatches() in debug mode.
2330         * UIProcess/ResourceLoadStatisticsMemoryStore.h:
2331         (WebKit::ResourceLoadStatisticsMemoryStore::isDebugModeEnabled const):
2332         * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp:
2333         (WebKit::ResourceLoadStatisticsPersistentStorage::populateMemoryStoreFromDisk):
2334             Now accepts a non-empty memory store in debug mode. This is to support a
2335             pre-populated store with 3rdpartytestwebkit.org and any custom domain already
2336             set as prevalent.
2337         (WebKit::ResourceLoadStatisticsPersistentStorage::setResourceLoadStatisticsDebugMode):
2338         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2339         (WebKit::WebResourceLoadStatisticsStore::setResourceLoadStatisticsDebugMode):
2340         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResourceForDebugMode):
2341         * UIProcess/WebResourceLoadStatisticsStore.h:
2342         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2343         (WebKit::WebsiteDataStore::setResourceLoadStatisticsDebugMode):
2344         * UIProcess/WebsiteData/WebsiteDataStore.h:
2345
2346 2018-07-20  Tim Horton  <timothy_horton@apple.com>
2347
2348         Occasional crash under -[WKFormInputSession setSuggestions:]
2349         https://bugs.webkit.org/show_bug.cgi?id=187869
2350         <rdar://problem/41357063>
2351
2352         Reviewed by Dean Jackson.
2353
2354         * UIProcess/ios/WKContentViewInteraction.h:
2355         * UIProcess/ios/WKContentViewInteraction.mm:
2356         (-[WKContentView inputDelegate]):
2357         Make inputDelegate weak.
2358
2359 2018-07-20  Brent Fulgham  <bfulgham@apple.com>
2360
2361         [macOS] Relax WebKit sandbox to permit proper App Store behavior
2362         https://bugs.webkit.org/show_bug.cgi?id=187831
2363         <rdar://problem/42047455>
2364
2365         Reviewed by Alexey Proskuryakov.
2366
2367         The Mac App Store is unable to perform some gift card redemption tasks on macOS due to missing sandbox permissions.
2368         This patch adds those permissions.
2369
2370         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
2371
2372 2018-07-20  Brady Eidson  <beidson@apple.com>
2373
2374         Add WKNavigation/WKNavigationAction related SPI.
2375         https://bugs.webkit.org/show_bug.cgi?id=187826
2376
2377         Reviewed by Chris Dumez.
2378
2379         * UIProcess/API/APINavigationAction.h:
2380
2381         * UIProcess/API/C/mac/WKPagePrivateMac.h:
2382         * UIProcess/API/C/mac/WKPagePrivateMac.mm:
2383         (WKPageLoadURLRequestReturningNavigation):
2384
2385         * UIProcess/API/Cocoa/WKNavigationAction.mm:
2386         (-[WKNavigationAction _mainFrameNavigation]):
2387         * UIProcess/API/Cocoa/WKNavigationActionPrivate.h:
2388
2389         * UIProcess/API/glib/WebKitUIClient.cpp:
2390
2391         * UIProcess/WebPageProxy.cpp:
2392         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2393         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
2394
2395 2018-07-20  Philippe Normand  <pnormand@igalia.com>
2396
2397         [GTK][WPE] enable-media-capabilities websetting
2398         https://bugs.webkit.org/show_bug.cgi?id=187847
2399
2400         Reviewed by Carlos Garcia Campos.
2401
2402         Add a new WebKitSetting for the MediaCapabilities spec defined in:
2403         https://wicg.github.io/media-capabilities/
2404
2405         * UIProcess/API/glib/WebKitSettings.cpp:
2406         (webKitSettingsSetProperty):
2407         (webKitSettingsGetProperty):
2408         (webkit_settings_class_init):
2409         (webkit_settings_get_enable_media_capabilities):
2410         (webkit_settings_set_enable_media_capabilities):
2411         * UIProcess/API/gtk/WebKitSettings.h:
2412         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
2413         * UIProcess/API/wpe/WebKitSettings.h:
2414
2415 2018-07-20  Carlos Garcia Campos  <cgarcia@igalia.com>
2416
2417         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.21.5 release.
2418
2419         * gtk/NEWS: Add release notes for 2.21.5.
2420         * webkitglib-symbols.map: Remove symbols.
2421
2422 2018-07-19  Chris Dumez  <cdumez@apple.com>
2423
2424         Null pointer dereference under WebPage::autofillLoginCredentials()
2425         https://bugs.webkit.org/show_bug.cgi?id=187823
2426         <rdar://problem/37152195>
2427
2428         Reviewed by David Kilzer.
2429
2430         Deal with m_assistedNode being null under WebPage::autofillLoginCredentials().
2431
2432         * WebProcess/WebPage/ios/WebPageIOS.mm:
2433         (WebKit::WebPage::autofillLoginCredentials):
2434
2435 2018-07-19  Chris Dumez  <cdumez@apple.com>
2436
2437         [ITP] Crash under ResourceLoadStatisticsMemoryStore::removeDataRecords()
2438         https://bugs.webkit.org/show_bug.cgi?id=187821
2439         <rdar://problem/42112693>
2440
2441         Reviewed by David Kilzer.
2442
2443         In two cases, ResourceLoadStatisticsMemoryStore (which lives on a background queue) needs to call WebPageProxy
2444         operations on the main thread and then dispatch back on the background queue when the operation completes.
2445         However, it is possible for the ResourceLoadStatisticsMemoryStore to get destroyed on the background queue
2446         during this time and we would then crash when trying to use m_workQueue to re-dispatch. To address the issue,
2447         I now ref the work queue in the lambda so that we're guaranteed to be able to re-dispatch to the background
2448         queue. When we're back on the background queue, we'll realize that weakThis in gone and we'll call the callback
2449         and return early.
2450
2451         Note that I am not checking weakThis on the main thread as this would not be safe. weakThis should only be
2452         used on the background queue.
2453
2454         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
2455         (WebKit::ResourceLoadStatisticsMemoryStore::removeDataRecords):
2456         (WebKit::ResourceLoadStatisticsMemoryStore::grandfatherExistingWebsiteData):
2457
2458 2018-07-19  Fujii Hironori  <Hironori.Fujii@sony.com>
2459
2460         Move WebFrameListenerProxy to WebFramePolicyListenerProxy, its only subclass
2461         https://bugs.webkit.org/show_bug.cgi?id=187825
2462         <rdar://problem/42405081>
2463
2464         Unreviewed build fix for Windows port.
2465
2466         RefPtr.h(45): error C2027: use of undefined type 'API::Navigation'
2467
2468         * UIProcess/win/WebInspectorProxyWin.cpp: Include "APINavigation.h".
2469
2470 2018-07-19  Alex Christensen  <achristensen@webkit.org>
2471
2472         Move WebFrameListenerProxy to WebFramePolicyListenerProxy, its only subclass
2473         https://bugs.webkit.org/show_bug.cgi?id=187825
2474
2475         Reviewed by Brady Eidson.
2476
2477         * CMakeLists.txt:
2478         * UIProcess/API/C/WKPage.cpp:
2479         * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
2480         * UIProcess/Automation/WebAutomationSession.cpp:
2481         * UIProcess/Cocoa/WebViewImpl.mm:
2482         * UIProcess/RemoteWebInspectorProxy.cpp:
2483         * UIProcess/WebFormSubmissionListenerProxy.h:
2484         (WebKit::WebFormSubmissionListenerProxy::create):
2485         (WebKit::WebFormSubmissionListenerProxy::WebFormSubmissionListenerProxy):
2486         * UIProcess/WebFrameListenerProxy.cpp: Removed.
2487         * UIProcess/WebFrameListenerProxy.h: Removed.
2488         * UIProcess/WebFramePolicyListenerProxy.cpp:
2489         (WebKit::WebFramePolicyListenerProxy::WebFramePolicyListenerProxy):
2490         (WebKit::WebFramePolicyListenerProxy::receivedPolicyDecision):
2491         (WebKit::WebFramePolicyListenerProxy::changeWebsiteDataStore):
2492         (WebKit::WebFramePolicyListenerProxy::invalidate):
2493         (WebKit::WebFramePolicyListenerProxy::isMainFrame const):
2494         (WebKit::WebFramePolicyListenerProxy::setNavigation):
2495         * UIProcess/WebFramePolicyListenerProxy.h:
2496         (WebKit::WebFramePolicyListenerProxy::listenerID const):
2497         (WebKit::WebFramePolicyListenerProxy::operator new): Deleted.
2498         * UIProcess/WebFrameProxy.cpp:
2499         (WebKit::WebFrameProxy::activePolicyListenerProxy):
2500         * UIProcess/WebFrameProxy.h:
2501         * UIProcess/WebInspectorProxy.cpp:
2502         * UIProcess/WebProcessPool.cpp:
2503         * UIProcess/ios/ViewGestureControllerIOS.mm:
2504         * UIProcess/mac/ViewGestureControllerMac.mm:
2505         * UIProcess/mac/WKInspectorViewController.mm:
2506         * WebKit.xcodeproj/project.pbxproj:
2507
2508 2018-07-19  Jon Lee  <jonlee@apple.com>
2509
2510         Update iOS fullscreen alert text again
2511         https://bugs.webkit.org/show_bug.cgi?id=187797
2512         rdar://problem/42373783
2513
2514         Reviewed by Jer Noble.
2515
2516         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
2517         (-[WKFullScreenViewController _showPhishingAlert]):
2518
2519 2018-07-19  Brady Eidson  <beidson@apple.com>
2520
2521         Add an SPI policy action to allow clients to explicitly ask for a new process on a navigation.
2522         https://bugs.webkit.org/show_bug.cgi?id=187789
2523
2524         Reviewed by Andy Estes.
2525
2526         At navigation policy time, when a client says "use/allow", they can now say "use/allow in a new process if possible"
2527
2528         * UIProcess/API/C/WKFramePolicyListener.cpp:
2529         (WKFramePolicyListenerUseInNewProcess):
2530         (WKFramePolicyListenerUseInNewProcessWithPolicies):
2531         * UIProcess/API/C/WKFramePolicyListener.h:
2532
2533         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
2534
2535         * UIProcess/Cocoa/NavigationState.mm:
2536         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
2537
2538         * UIProcess/WebFrameListenerProxy.h:
2539         (WebKit::WebFrameListenerProxy::setApplyPolicyInNewProcessIfPossible):
2540         (WebKit::WebFrameListenerProxy::applyPolicyInNewProcessIfPossible const):
2541
2542         * UIProcess/WebPageProxy.cpp:
2543         (WebKit::WebPageProxy::receivedPolicyDecision):
2544
2545         * UIProcess/WebProcessPool.cpp:
2546         (WebKit::WebProcessPool::processForNavigation):
2547         (WebKit::WebProcessPool::processForNavigationInternal):
2548         * UIProcess/WebProcessPool.h:
2549
2550 2018-07-19  Youenn Fablet  <youenn@apple.com>
2551
2552         Ensure experimentalPlugInSandboxProfilesEnabled is set on PluginProcess
2553         https://bugs.webkit.org/show_bug.cgi?id=187729
2554
2555         Reviewed by Ryosuke Niwa.
2556
2557         experimentalPlugInSandboxProfilesEnabled flag is used at initialization of the plugin process sandbox.
2558         This flag value should be set according to the value of this flag in the UIProcess.
2559         We set this value in the plugin process manager.
2560         At launch of the plugin process, this flag will also be passed to it so that it is set properly.
2561
2562         * PluginProcess/EntryPoint/mac/XPCService/PluginServiceEntryPoint.mm:
2563         (WebKit::PluginServiceInitializerDelegate::getExtraInitializationData):
2564         * PluginProcess/mac/PluginProcessMac.mm:
2565         (WebKit::PluginProcess::platformInitializeProcess):
2566         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
2567         * UIProcess/API/C/WKPreferences.cpp:
2568         (WKPreferencesSetPluginSandboxProfilesEnabledForAllPlugins):
2569         (WKPreferencesGetPluginSandboxProfilesEnabledForAllPlugins):
2570         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2571         * UIProcess/API/Cocoa/WKPreferences.mm:
2572         (-[WKPreferences _setExperimentalPlugInSandboxProfilesEnabled:]):
2573         (-[WKPreferences _experimentalPlugInSandboxProfilesEnabled]):
2574         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2575         * UIProcess/Plugins/PluginProcessManager.h:
2576         (WebKit::PluginProcessManager::experimentalPlugInSandboxProfilesEnabled const):
2577         * UIProcess/Plugins/mac/PluginProcessManagerMac.mm:
2578         (WebKit::PluginProcessManager::setExperimentalPlugInSandboxProfilesEnabled):
2579         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
2580         (WebKit::PluginProcessProxy::platformGetLaunchOptions):
2581
2582 2018-07-18  Ricky Mondello  <rmondello@apple.com>
2583
2584         Let clients override _WKThumbnailView's background color
2585
2586         https://bugs.webkit.org/show_bug.cgi?id=187788
2587
2588         Reviewed by Tim Horton.
2589
2590         * UIProcess/API/Cocoa/_WKThumbnailView.h: Declare a property.
2591         * UIProcess/API/Cocoa/_WKThumbnailView.mm: Define an ivar.
2592         (-[_WKThumbnailView updateLayer]): Consult the background color.
2593         (-[_WKThumbnailView setOverrideBackgroundColor:]): Notably, call -updateLayer.
2594         (-[_WKThumbnailView overrideBackgroundColor]): Added.
2595
2596 2018-07-18  Jer Noble  <jer.noble@apple.com>
2597
2598         CRASH at WebKit: WebKit::WebFullScreenManagerProxy::saveScrollPosition
2599         https://bugs.webkit.org/show_bug.cgi?id=187769
2600         <rdar://problem/42160666>
2601
2602         Reviewed by Tim Horton.
2603
2604         Null-check all uses of _page and _manager in WKFullScreenWindowControllerIOS.
2605
2606         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
2607         (WebKit::WKWebViewState::applyTo):
2608         (WebKit::WKWebViewState::store):
2609         (-[WKFullScreenWindowController enterFullScreen]):
2610         (-[WKFullScreenWindowController beganExitFullScreenWithInitialFrame:finalFrame:]):
2611         (-[WKFullScreenWindowController _completedExitFullScreen]):
2612
2613 2018-07-18  Chris Dumez  <cdumez@apple.com>
2614
2615         WebContent crash in WebProcess::ensureNetworkProcessConnection
2616         https://bugs.webkit.org/show_bug.cgi?id=187791
2617         <rdar://problem/41995022>
2618
2619         Reviewed by Ryosuke Niwa.
2620
2621         If the WebProcessProxy::GetNetworkProcessConnection synchronous IPC between the WebProcess
2622         and the UIProcess succeeded but we received an invalid connection identifier, then try
2623         once more. This may indicate the network process has crashed, in which case it will be
2624         relaunched.
2625
2626         * WebProcess/WebProcess.cpp:
2627         (WebKit::getNetworkProcessConnection):
2628         (WebKit::WebProcess::ensureNetworkProcessConnection):
2629
2630 2018-07-18  Per Arne Vollan  <pvollan@apple.com>
2631
2632         The WebContent process does not suspend when MiniBrowser is minimized.
2633         https://bugs.webkit.org/show_bug.cgi?id=187708
2634
2635         Reviewed by Chris Dumez.
2636
2637         Using the NSRunLoop runloop type prevents the WebContent process from suspending. Instead, use the new
2638         _WebKit runloop type. Also do not leak a boost to the WebContent process, since this also prevents the
2639         WebContent process from going to sleep. Calling SetApplicationIsDaemon prevents the WebContent process
2640         from being assigned the application process priority level. To block WindowServer connections, call
2641         CGSSetDenyWindowServerConnections(true) instead. Finally, App nap must be manually enabled, since the
2642         WebContent process is no longer a NSApplication.
2643
2644         * Configurations/WebContentService.xcconfig:
2645         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
2646         (WebKit::shouldLeakBoost):
2647         * WebProcess/WebPage/WebPage.cpp:
2648         (WebKit::WebPage::updateThrottleState):
2649         * WebProcess/cocoa/WebProcessCocoa.mm:
2650         (WebKit::WebProcess::platformInitializeProcess):
2651
2652 2018-07-18  Chris Dumez  <cdumez@apple.com>
2653
2654         Crash under WebKit::SuspendedPageProxy::webProcessDidClose(WebKit::WebProcessProxy&)
2655         https://bugs.webkit.org/show_bug.cgi?id=187780
2656
2657         Reviewed by Brady Eidson.
2658
2659         Protect |this| in SuspendedPageProxy::webProcessDidClose() since the call to
2660         WebPageProxy::suspendedPageClosed() may destroy us before the method is done
2661         executing.
2662
2663         * UIProcess/SuspendedPageProxy.cpp:
2664         (WebKit::SuspendedPageProxy::webProcessDidClose):
2665
2666 2018-07-18  Jer Noble  <jer.noble@apple.com>
2667
2668         -_beginAnimatedResizeWithUpdates: can leave view in bad state if called during an existing animation
2669         https://bugs.webkit.org/show_bug.cgi?id=187739
2670
2671         Reviewed by Tim Horton.
2672
2673         It's not enough to reset _dynamicViewportUpdateMode to NotResizing; other parts of the code
2674         check whether _resizeAnimationView is non-nil, the contentView may be hidden, etc. Add a new
2675         internal method _cancelAnimatedResize that cleans up state when a call to
2676         _beginAnimatedResizeWithUpdates: fails.
2677
2678         * UIProcess/API/Cocoa/WKWebView.mm:
2679         (-[WKWebView _processDidExit]):
2680         (-[WKWebView _cancelAnimatedResize]):
2681         (-[WKWebView _didCompleteAnimatedResize]):
2682         (-[WKWebView _beginAnimatedResizeWithUpdates:]):
2683
2684 2018-07-18  Jer Noble  <jer.noble@apple.com>
2685
2686         PiP from Element Fullscreen should match AVKit's behavior
2687         https://bugs.webkit.org/show_bug.cgi?id=187623
2688
2689         Reviewed by Jon Lee.
2690
2691         * UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
2692         (WebKit::PlaybackSessionManagerProxy::controlsManagerContextId const):
2693         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
2694         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
2695         (WebKit::VideoFullscreenModelContext::willEnterPictureInPicture):
2696         (WebKit::VideoFullscreenModelContext::didEnterPictureInPicture):
2697         (WebKit::VideoFullscreenModelContext::failedToEnterPictureInPicture):
2698         (WebKit::VideoFullscreenModelContext::willExitPictureInPicture):
2699         (WebKit::VideoFullscreenModelContext::didExitPictureInPicture):
2700         (WebKit::VideoFullscreenModelContext::failedToExitPictureInPicture):
2701         (WebKit::VideoFullscreenManagerProxy::controlsManagerInterface):
2702         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
2703         (WKFullScreenViewControllerVideoFullscreenModelClient::setParent):
2704         (WKFullScreenViewControllerVideoFullscreenModelClient::setInterface):
2705         (WKFullScreenViewControllerVideoFullscreenModelClient::interface const):
2706         (-[WKFullScreenViewController initWithWebView:]):
2707         (-[WKFullScreenViewController dealloc]):
2708         (-[WKFullScreenViewController videoControlsManagerDidChange]):
2709         (-[WKFullScreenViewController ensurePiPAnimator]):
2710         (-[WKFullScreenViewController willEnterPictureInPicture]):
2711         (-[WKFullScreenViewController didEnterPictureInPicture]):
2712         (-[WKFullScreenViewController failedToEnterPictureInPicture]):
2713         (-[WKFullScreenViewController loadView]):
2714         (-[WKFullScreenViewController viewWillAppear:]):
2715         * UIProcess/Cocoa/WebViewImpl.mm:
2716         (WebKit::WebViewImpl::videoControlsManagerDidChange):
2717         * UIProcess/mac/WKFullScreenWindowController.h:
2718         * UIProcess/mac/WKFullScreenWindowController.mm:
2719         (WebKit::WKFullScreenWindowControllerVideoFullscreenModelClient::setParent):
2720         (WebKit::WKFullScreenWindowControllerVideoFullscreenModelClient::setInterface):
2721         (WebKit::WKFullScreenWindowControllerVideoFullscreenModelClient::interface const):
2722         (-[WKFullScreenWindowController initWithWindow:webView:page:]):
2723         (-[WKFullScreenWindowController dealloc]):
2724         (-[WKFullScreenWindowController videoControlsManagerDidChange]):
2725         (-[WKFullScreenWindowController willEnterPictureInPicture]):
2726
2727 2018-07-18  Jer Noble  <jer.noble@apple.com>
2728
2729         Dissociate the VideoFullscreenInterface from its VideoFullscreenModel before removing it from the manager
2730         https://bugs.webkit.org/show_bug.cgi?id=187775
2731         <rdar://problem/42343229>
2732
2733         Reviewed by Jon Lee.
2734
2735         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
2736         (WebKit::VideoFullscreenManagerProxy::didCleanupFullscreen):
2737
2738 2018-07-18  Wenson Hsieh  <wenson_hsieh@apple.com>
2739
2740         Add SPI to defer running async script until after document load
2741         https://bugs.webkit.org/show_bug.cgi?id=187748
2742         <rdar://problem/42317378>
2743
2744         Reviewed by Ryosuke Niwa and Tim Horton.
2745
2746         Add plumbing for a new ShouldDeferAsynchronousScriptsUntilAfterDocumentLoad configuration that determines
2747         whether async script execution should be deferred until document load (i.e. DOMContentLoaded). This
2748         configuration defaults to NO on all platforms. See WebCore ChangeLog for more detail.
2749
2750         * Shared/WebPreferences.yaml:
2751         * UIProcess/API/Cocoa/WKWebView.mm:
2752         (-[WKWebView _initializeWithConfiguration:]):
2753         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2754         (-[WKWebViewConfiguration init]):
2755         (-[WKWebViewConfiguration copyWithZone:]):
2756         (-[WKWebViewConfiguration _shouldDeferAsynchronousScriptsUntilAfterDocumentLoad]):
2757         (-[WKWebViewConfiguration _setShouldDeferAsynchronousScriptsUntilAfterDocumentLoad:]):
2758         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
2759
2760 2018-07-18  Zan Dobersek  <zdobersek@igalia.com>
2761
2762         [CoordGraphics] Start tracking Nicosia layers in CoordinatedGraphicsState
2763         https://bugs.webkit.org/show_bug.cgi?id=187751
2764
2765         Reviewed by Carlos Garcia Campos.
2766
2767         Start including the Nicosia::CompositionLayer objects in the
2768         CoordinatedGraphicsState struct, under a separate NicosiaState struct.
2769         References to all the layers in a given scene are kept in a HashSet,
2770         and a separate reference to the root layer kept in a separate member
2771         variable.
2772
2773         CompositingCoordinator now takes care of adding or removing the
2774         Nicosia::CompositionLayer objects to the NicosiaState's HashSet, as well
2775         as setting the root layer object when it's being initialized. Additions
2776         and removals of Nicosia::CompositionLayer correspond to the additions
2777         and removals of CoordinatedGraphicsLayer objects to the coordinator's
2778         m_registeredLayers HashMap.
2779
2780         Upon each state commit that's done in CoordinatedGraphicsScene, the
2781         NicosiaState object will be copied into the member variable. Nothing is
2782         done yet with that state object, but in the near future it will be used
2783         to finally commit all the state details into the TextureMapper layers.
2784
2785         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
2786         (WebKit::CoordinatedGraphicsScene::commitSceneState):
2787         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
2788         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
2789         (WebKit::CompositingCoordinator::initializeRootCompositingLayerIfNeeded):
2790         (WebKit::CompositingCoordinator::createGraphicsLayer):
2791         (WebKit::CompositingCoordinator::detachLayer):
2792         (WebKit::CompositingCoordinator::attachLayer):
2793
2794 2018-07-17  Tim Horton  <timothy_horton@apple.com>
2795
2796         REGRESSION (iOS 12): Can't scroll to the bottom of the page in WKWebView while keyboard is up on pages with viewport-fit=cover
2797         https://bugs.webkit.org/show_bug.cgi?id=187743
2798         <rdar://problem/41651546>
2799
2800         Reviewed by Simon Fraser.
2801
2802         UIScrollView's _systemContentInset no longer includes keyboard insets
2803         in apps linked on iOS 12+ when contentInsetAdjustmentBehavior is None.
2804
2805         We use contentInsetAdjustmentBehavior to control adjustment of other
2806         sources of insets, but expect the keyboard inset to always be applied.
2807
2808         For now, barring a more comprehensive way to separate insets, re-add
2809         the keyboard inset in cases where UIKit does not.
2810
2811         * Platform/spi/ios/UIKitSPI.h:
2812         Move some IPI to the SPI header.
2813
2814         * UIProcess/API/Cocoa/WKWebView.mm:
2815         (-[WKWebView _haveSetObscuredInsets]):
2816         * UIProcess/API/Cocoa/WKWebViewInternal.h:
2817         Make it possible for WKScrollView to check whether the client is overriding insets.
2818
2819         * UIProcess/Cocoa/VersionChecks.h:
2820         Add a linkedOnOrAfter() version for this new UIScrollView behavior.
2821
2822         * UIProcess/ios/WKScrollView.mm:
2823         (-[WKScrollView initWithFrame:]):
2824         Force WKScrollView's scroll indicator to always respect insets. We always
2825         want the scroll bars in a sensible place, even if the page sets
2826         viewport-fit=cover.
2827
2828         (-[WKScrollView _adjustForAutomaticKeyboardInfo:animated:lastAdjustment:]):
2829         Store the bottom inset due to the keyboard.
2830
2831         (-[WKScrollView _systemContentInset]):
2832         Add the bottom inset due to the keyboard to the systemContentInset 
2833         in all cases where UIKit does not. Also avoid adding it if the client takes
2834         full control of the insets, because the only client that does (MobileSafari)
2835         includes insets-due-to-keyboard in their custom insets.
2836
2837 2018-07-17  Chris Dumez  <cdumez@apple.com>
2838
2839         RELEASE_ASSERT() under IPC::Connection::sendSync() from PluginProxy::supportsSnapshotting()
2840         https://bugs.webkit.org/show_bug.cgi?id=187740
2841         <rdar://problem/41818955>
2842
2843         Reviewed by Youenn Fablet.
2844
2845         As per the crash trace, PluginProxy::supportsSnapshotting() can be called during layout but does synchronous
2846         IPC. As a result, we need to prevent WebCore re-entrancy by using DoNotProcessIncomingMessagesWhenWaitingForSyncReply
2847         sendOption.
2848
2849         * WebProcess/Plugins/PluginProxy.cpp:
2850         (WebKit::PluginProxy::supportsSnapshotting const):
2851
2852 2018-07-17  Chris Dumez  <cdumez@apple.com>
2853
2854         Turn on PSON in WebKitTestRunner
2855         https://bugs.webkit.org/show_bug.cgi?id=186542
2856
2857         Reviewed by Brady Eidson.
2858
2859         Fix leaking of pre-warmed WebContent processes which became obvious when turning
2860         on process-swap-on-navigation by default in WebKitTestRunner. The issue was that
2861         the WebProcessPool holds a strong reference to its WebProcessProxy objects via
2862         m_processes data members. In turn, WebProcessProxy objects hold a strong reference
2863         to their WebProcessPool via their m_processPool data member. This reference cycle
2864         normally gets broken by calling WebProcessProxy::shutDown() which removes the
2865         WebProcessProxy objects from its WebProcessPool's m_processes container.
2866         WebProcessProxy::shutDown() normally gets called when a WebProcessProxy no longer
2867         has any WebPageProxy objects. However, in the case of unused pre-warmed
2868         WebProcessProxy objects, those never get any page and therefore we'd never break
2869         the reference cycle. To address the issue, pre-warmed WebProcessProxy objects
2870         now only hold a Weak reference to their process pool, only regular WebProcessProxy
2871         objects hold a strong reference to their pool.
2872
2873         * UIProcess/WebProcessPool.cpp:
2874         (WebKit::WebProcessPool::~WebProcessPool):
2875         (WebKit::WebProcessPool::tryTakePrewarmedProcess):
2876         * UIProcess/WebProcessPool.h:
2877         * UIProcess/WebProcessProxy.cpp:
2878         (WebKit::WebProcessProxy::WebProcessProxy):
2879         (WebKit::WebProcessProxy::getLaunchOptions):
2880         (WebKit::WebProcessProxy::markIsNoLongerInPrewarmedPool):
2881         * UIProcess/WebProcessProxy.h:
2882         (WebKit::WebProcessProxy::processPool):
2883         (WebKit::WebProcessProxy::WeakOrStrongPtr::WeakOrStrongPtr):
2884         (WebKit::WebProcessProxy::WeakOrStrongPtr::setIsWeak):
2885         (WebKit::WebProcessProxy::WeakOrStrongPtr::get const):
2886         (WebKit::WebProcessProxy::WeakOrStrongPtr::operator-> const):
2887         (WebKit::WebProcessProxy::WeakOrStrongPtr::operator* const):
2888         (WebKit::WebProcessProxy::WeakOrStrongPtr::operator bool const):
2889         (WebKit::WebProcessProxy::WeakOrStrongPtr::updateStrongReference):
2890
2891 2018-07-17  Wenson Hsieh  <wenson_hsieh@apple.com>
2892
2893         Add an SPI hook to allow clients to yield document parsing and script execution
2894         https://bugs.webkit.org/show_bug.cgi?id=187682
2895         <rdar://problem/42207453>
2896
2897         Reviewed by Ryosuke Niwa.
2898
2899         Add hooks to WKDOMDocument to create and return an internal WKDOMDocumentParserYieldToken object, whose lifetime
2900         is tied to a document parser yield token. See WebCore ChangeLog for more detail.
2901
2902         * WebProcess/InjectedBundle/API/mac/WKDOMDocument.h:
2903         * WebProcess/InjectedBundle/API/mac/WKDOMDocument.mm:
2904         (-[WKDOMDocumentParserYieldToken initWithDocument:]):
2905         (-[WKDOMDocument parserYieldToken]):
2906
2907 2018-07-17  John Wilander  <wilander@apple.com>
2908
2909         Add completion handlers to TestRunner functions setStatisticsLastSeen(), setStatisticsPrevalentResource(), setStatisticsVeryPrevalentResource(), setStatisticsHasHadUserInteraction(), and setStatisticsHasHadNonRecentUserInteraction()
2910         https://bugs.webkit.org/show_bug.cgi?id=187710
2911         <rdar://problem/42252757>
2912
2913         Reviewed by Chris Dumez.
2914
2915         These changes are to back the completion handler functionality of
2916         TestRunner functions:
2917         - setStatisticsLastSeen(),
2918         - setStatisticsPrevalentResource(),
2919         - setStatisticsVeryPrevalentResource(),
2920         - setStatisticsHasHadUserInteraction(), and
2921         - setStatisticsHasHadNonRecentUserInteraction().
2922
2923         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2924         (WKWebsiteDataStoreSetStatisticsLastSeen):
2925         (WKWebsiteDataStoreSetStatisticsPrevalentResource):
2926         (WKWebsiteDataStoreSetStatisticsVeryPrevalentResource):
2927         (WKWebsiteDataStoreSetStatisticsHasHadUserInteraction):
2928         (WKWebsiteDataStoreSetStatisticsHasHadNonRecentUserInteraction):
2929         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
2930         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2931         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
2932         (WebKit::WebResourceLoadStatisticsStore::logNonRecentUserInteraction):
2933         (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction):
2934         (WebKit::WebResourceLoadStatisticsStore::setLastSeen):
2935         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResource):
2936         (WebKit::WebResourceLoadStatisticsStore::setVeryPrevalentResource):
2937         (WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource):
2938         * UIProcess/WebResourceLoadStatisticsStore.h:
2939
2940 2018-07-16  Simon Fraser  <simon.fraser@apple.com>
2941
2942         Add color filter for transforming colors in Dark Mode
2943         https://bugs.webkit.org/show_bug.cgi?id=187717
2944
2945         Reviewed by Dean Jackson.
2946
2947         * Shared/WebCoreArgumentCoders.cpp:
2948         (IPC::ArgumentCoder<FilterOperation>::encode):
2949         (IPC::decodeFilterOperation):
2950
2951 2018-07-16  Tim Horton  <timothy_horton@apple.com>
2952
2953         Black flash in content area when returning to Mail
2954         https://bugs.webkit.org/show_bug.cgi?id=187719
2955         <rdar://problem/42165340>
2956
2957         Reviewed by Wenson Hsieh.
2958
2959         * UIProcess/ios/WebPageProxyIOS.mm:
2960         (WebKit::WebPageProxy::applicationDidFinishSnapshottingAfterEnteringBackground):
2961         This still reproduces sometimes even after r233723, because:
2962
2963         If a pending commit arrives after ApplicationDidEnterBackground (when we
2964         ask the web content process to freeze the layer tree), and after
2965         ApplicationDidFinishSnapshottingAfterEnteringBackground (when we hide
2966         WKContentView), but before the process sleeps, it will cause WKContentView
2967         to be unhidden (potentially including layers with empty surfaces as contents).
2968         Nothing will re-hide WKContentView. Instead, we should wait for the next
2969         *pending* commit, which will necessarily not come until after the application
2970         returns to the foreground because of the strict IPC ordering between
2971         the message that freezes the layer tree and the "next commit" mechanism.
2972
2973 2018-07-16  Said Abou-Hallawa  <sabouhallawa@apple.com>
2974
2975         [iOS] When bringing MobileSafari to the foreground, images, which are pending decoding, won't be drawn into the immediate-paint transaction
2976         https://bugs.webkit.org/show_bug.cgi?id=187375
2977
2978         Reviewed by Simon Fraser.
2979
2980         For immediate-paint transaction, we should force all the images which are 
2981         pending decoding to be repainted before building this transaction.
2982
2983         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2984         (WebKit::PDFPlugin::updateControlTints):
2985         * WebProcess/Plugins/PluginView.cpp:
2986         (WebKit::PluginView::paint):
2987         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
2988         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
2989
2990 2018-07-11  Dean Jackson  <dino@apple.com>
2991
2992         Allow removal of white backgrounds
2993         https://bugs.webkit.org/show_bug.cgi?id=187574
2994         <rdar://problem/41146792>
2995
2996         Reviewed by Simon Fraser.
2997
2998         Add a new WebPreference for punching out white backgrounds.
2999
3000         * Shared/WebPreferences.yaml:
3001         * UIProcess/API/C/WKPreferences.cpp:
3002         (WKPreferencesSetPunchOutWhiteBackgroundsInDarkMode):
3003         (WKPreferencesGetPunchOutWhiteBackgroundsInDarkMode):
3004         * UIProcess/API/C/WKPreferencesRefPrivate.h:
3005         * UIProcess/API/Cocoa/WKWebView.mm:
3006         (-[WKWebView _initializeWithConfiguration:]):
3007         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
3008         (-[WKWebViewConfiguration init]):
3009         (-[WKWebViewConfiguration copyWithZone:]):
3010         (-[WKWebViewConfiguration _punchOutWhiteBackgroundsInDarkMode]):
3011         (-[WKWebViewConfiguration _setPunchOutWhiteBackgroundsInDarkMode:]):
3012         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
3013
3014 2018-07-16  Aditya Keerthi  <akeerthi@apple.com>
3015
3016         [Datalist][macOS] Add suggestions UI for TextFieldInputTypes
3017         https://bugs.webkit.org/show_bug.cgi?id=186531
3018
3019         Reviewed by Tim Horton.
3020
3021         Created WebDataListSuggestionsDropdownMac as a wrapper around the suggestions
3022         view. The suggestions for TextFieldInputTypes are displayed using an NSTableView
3023         in it's own child window. This is done so that suggestions can be presented
3024         outside of the page if the parent window's size is too small. The maximum number
3025         of suggestions that are visible at one time is 6, with additional suggestions made
3026         available by scrolling.
3027
3028         Suggestions in the view can be selected via click or by using arrow keys. If the
3029         input element associated with the suggestions is blurred, or the page is moved in
3030         any way, the suggestions view is hidden.
3031
3032         Added IPC messages to the UIProcess to enable the display of the suggestions view.
3033         This required a new ArgumentCoder for DataListSuggestionInformation.
3034
3035         * Shared/WebCoreArgumentCoders.cpp:
3036         (IPC::ArgumentCoder<DataListSuggestionInformation>::encode):
3037         (IPC::ArgumentCoder<DataListSuggestionInformation>::decode):
3038         * Shared/WebCoreArgumentCoders.h:
3039         * UIProcess/PageClient.h:
3040         * UIProcess/WebDataListSuggestionsDropdown.cpp: Copied from Source/WebKit/WebProcess/WebCoreSupport/WebDataListSuggestionPicker.h.
3041         (WebKit::WebDataListSuggestionsDropdown::WebDataListSuggestionsDropdown):
3042         (WebKit::WebDataListSuggestionsDropdown::~WebDataListSuggestionsDropdown):
3043         (WebKit::WebDataListSuggestionsDropdown::close):
3044         * UIProcess/WebDataListSuggestionsDropdown.h: Copied from Source/WebKit/WebProcess/WebCoreSupport/WebDataListSuggestionPicker.h.
3045         (WebKit::WebDataListSuggestionsDropdown::Client::~Client):
3046         * UIProcess/WebPageProxy.cpp:
3047         (WebKit::WebPageProxy::viewWillStartLiveResize):
3048         (WebKit::WebPageProxy::viewDidLeaveWindow):
3049         (WebKit::WebPageProxy::handleWheelEvent):
3050         (WebKit::WebPageProxy::setPageZoomFactor):
3051         (WebKit::WebPageProxy::setPageAndTextZoomFactors):
3052         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
3053         (WebKit::WebPageProxy::pageDidScroll):
3054         (WebKit::WebPageProxy::showDataListSuggestions):
3055         (WebKit::WebPageProxy::handleKeydownInDataList):
3056         (WebKit::WebPageProxy::endDataListSuggestions):
3057         (WebKit::WebPageProxy::didCloseSuggestions):
3058         (WebKit::WebPageProxy::didSelectOption):
3059         (WebKit::WebPageProxy::resetState):
3060         (WebKit::WebPageProxy::closeOverlayedViews):
3061         * UIProcess/WebPageProxy.h:
3062         * UIProcess/WebPageProxy.messages.in:
3063         * UIProcess/ios/PageClientImplIOS.h:
3064         * UIProcess/ios/PageClientImplIOS.mm:
3065         (WebKit::PageClientImpl::createDataListSuggestionsDropdown):
3066         * UIProcess/mac/PageClientImplMac.h:
3067         * UIProcess/mac/PageClientImplMac.mm:
3068         (WebKit::PageClientImpl::createDataListSuggestionsDropdown):
3069         * UIProcess/mac/WebDataListSuggestionsDropdownMac.h: Copied from Source/WebKit/WebProcess/WebCoreSupport/WebDataListSuggestionPicker.h.
3070         * UIProcess/mac/WebDataListSuggestionsDropdownMac.mm: Added.
3071         (WebKit::WebDataListSuggestionsDropdownMac::create):
3072         (WebKit::WebDataListSuggestionsDropdownMac::~WebDataListSuggestionsDropdownMac):
3073         (WebKit::WebDataListSuggestionsDropdownMac::WebDataListSuggestionsDropdownMac):
3074         (WebKit::WebDataListSuggestionsDropdownMac::show):
3075         (WebKit::WebDataListSuggestionsDropdownMac::didSelectOption):
3076         (WebKit::WebDataListSuggestionsDropdownMac::selectOption):
3077         (WebKit::WebDataListSuggestionsDropdownMac::handleKeydownWithIdentifier):
3078         (WebKit::WebDataListSuggestionsDropdownMac::close):
3079         (-[WKDataListSuggestionCell initWithFrame:]):
3080         (-[WKDataListSuggestionCell setText:]):
3081         (-[WKDataListSuggestionCell setActive:]):
3082         (-[WKDataListSuggestionCell drawRect:]):
3083         (-[WKDataListSuggestionCell mouseEntered:]):
3084         (-[WKDataListSuggestionCell mouseExited:]):
3085         (-[WKDataListSuggestionCell acceptsFirstResponder]):
3086         (-[WKDataListSuggestionTable initWithElementRect:]):
3087         (-[WKDataListSuggestionTable setVisibleRect:]):
3088         (-[WKDataListSuggestionTable currentActiveRow]):
3089         (-[WKDataListSuggestionTable setActiveRow:]):
3090         (-[WKDataListSuggestionTable reload]):
3091         (-[WKDataListSuggestionTable acceptsFirstResponder]):
3092         (-[WKDataListSuggestionTable enclosingScrollView]):
3093         (-[WKDataListSuggestionTable removeFromSuperviewWithoutNeedingDisplay]):
3094         (-[WKDataListSuggestionsView initWithInformation:inView:]):
3095         (-[WKDataListSuggestionsView currentSelectedString]):
3096         (-[WKDataListSuggestionsView updateWithInformation:]):
3097         (-[WKDataListSuggestionsView moveSelectionByDirection:]):
3098         (-[WKDataListSuggestionsView invalidate]):
3099         (-[WKDataListSuggestionsView dropdownRectForElementRect:]):
3100         (-[WKDataListSuggestionsView showSuggestionsDropdown:]):
3101         (-[WKDataListSuggestionsView selectedRow:]):
3102         (-[WKDataListSuggestionsView numberOfRowsInTableView:]):
3103         (-[WKDataListSuggestionsView tableView:heightOfRow:]):
3104         (-[WKDataListSuggestionsView tableView:viewForTableColumn:row:]):
3105         * WebKit.xcodeproj/project.pbxproj:
3106         * WebProcess/WebCoreSupport/WebDataListSuggestionPicker.cpp:
3107         (WebKit::WebDataListSuggestionPicker::handleKeydownWithIdentifier):
3108         (WebKit::WebDataListSuggestionPicker::didSelectOption):
3109         (WebKit::WebDataListSuggestionPicker::didCloseSuggestions):
3110         (WebKit::WebDataListSuggestionPicker::close):
3111         (WebKit::WebDataListSuggestionPicker::displayWithActivationType):
3112         * WebProcess/WebCoreSupport/WebDataListSuggestionPicker.h:
3113
3114 2018-07-16  Jeremy Jones  <jeremyj@apple.com>
3115
3116         Fullscreen requires active document.
3117         https://bugs.webkit.org/show_bug.cgi?id=186226
3118         rdar://problem/36187413
3119
3120         Reviewed by Jer Noble.
3121
3122         This change guarantees the document to be visible for both element fullscreen and video fullscreen.
3123
3124         User gesture is not enough to guarantee that the document is visible when fullscreen is initiated
3125         because JavaScript can spin wait before initiating fullscreen. During that spin the page or window might
3126         be hidden.
3127
3128         Document::hidden() can't be relied upon because it won't update while JavaScript spins.
3129
3130         This change adds a sync call to the UI process to get the current UI visibility state.
3131
3132         * UIProcess/WebPageProxy.cpp:
3133         (WebKit::WebPageProxy::getIsViewVisible):
3134         * UIProcess/WebPageProxy.h:
3135         * UIProcess/WebPageProxy.messages.in:
3136         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3137         (WebKit::WebChromeClient::isViewVisible):
3138         * WebProcess/WebCoreSupport/WebChromeClient.h:
3139
3140 2018-07-16  Tim Horton  <timothy_horton@apple.com>
3141
3142         REGRESSION (r233502): Camera in <input type=file> becomes unresponsive after attempting to dismiss it
3143         https://bugs.webkit.org/show_bug.cgi?id=187706
3144         <rdar://problem/42137088>
3145
3146         Reviewed by Wenson Hsieh.
3147
3148         * UIProcess/ios/forms/WKFileUploadPanel.mm:
3149         Remove an unused member.
3150
3151         (-[WKFileUploadPanel _dismissDisplayAnimated:]):
3152         Allow us to dismiss the camera view controller in addition to the menu.
3153
3154 2018-07-16  Alex Christensen  <achristensen@webkit.org>
3155
3156         Reduce size of NetworkLoadMetrics and therefore ResourceResponse
3157         https://bugs.webkit.org/show_bug.cgi?id=187671
3158
3159         Reviewed by Darin Adler.
3160
3161         * Shared/WebCoreArgumentCoders.h:
3162
3163 2018-07-16  Sihui Liu  <sihui_liu@apple.com>
3164
3165         IndexedDB: closeAndDeleteDatabasesForOrigins should remove all databases for those origins
3166         https://bugs.webkit.org/show_bug.cgi?id=187631
3167         <rdar://problem/42164227>
3168
3169         Reviewed by Brady Eidson.
3170
3171         We need to return all origins, both openingOrigin and mainFrameOrigin, of IndexedDB so users
3172         could be better aware of which origins are using databases and decide what they want to 
3173         remove.
3174
3175         * StorageProcess/StorageProcess.cpp:
3176         (WebKit::StorageProcess::indexedDatabaseOrigins):
3177         * StorageProcess/StorageProcess.h:
3178
3179 2018-07-15  Carlos Garcia Campos  <cgarcia@igalia.com>
3180
3181         [SOUP] http/tests/misc/bubble-drag-events.html crashes
3182         https://bugs.webkit.org/show_bug.cgi?id=182352
3183
3184         Reviewed by Youenn Fablet.
3185
3186         PingLoad is not refcounted and deletes itself when the load finishes. The problem is that the network data
3187         task can also finish the load, causing the PingLoad to be deleted early. We tried to fix it in r233032 in the
3188         network data task soup implementation, but it caused regressions.
3189
3190         * NetworkProcess/PingLoad.cpp:
3191         (WebKit::PingLoad::didReceiveChallenge): Create a weak ref for the ping load before calling the operation completion
3192         handler and return early after the completion handler if it was deleted.
3193         (WebKit::PingLoad::didReceiveResponseNetworkSession): Ditto.
3194         * NetworkProcess/PingLoad.h:
3195         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
3196         (WebKit::NetworkDataTaskSoup::continueAuthenticate): Revert r233032.
3197
3198 2018-07-13  Timothy Hatcher  <timothy@apple.com>
3199
3200         Add _drawsBackground to WKWebViewConfiguration.
3201         https://bugs.webkit.org/show_bug.cgi?id=187665
3202         rdar://problem/42182268
3203
3204         Reviewed by Tim Horton.
3205
3206         * UIProcess/API/APIPageConfiguration.cpp:
3207         (API::PageConfiguration::copy const): Copy m_drawsBackground, and some missing values.
3208         * UIProcess/API/APIPageConfiguration.h:
3209         (API::PageConfiguration::drawsBackground const): Added.
3210         (API::PageConfiguration::setDrawsBackground): Added.
3211         * UIProcess/API/Cocoa/WKWebView.mm:
3212         (-[WKWebView _initializeWithConfiguration:]): Transfer _drawsBackground to page config.
3213         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
3214         (-[WKWebViewConfiguration init]): Set _drawsBackground to YES.
3215         (-[WKWebViewConfiguration encodeWithCoder:]): Encode _drawsBackground.
3216         (-[WKWebViewConfiguration initWithCoder:]): Decode _drawsBackground.
3217         (-[WKWebViewConfiguration copyWithZone:]): Copy _drawsBackground.
3218         (-[WKWebViewConfiguration _drawsBackground]): Added.
3219         (-[WKWebViewConfiguration _setDrawsBackground:]): Added.
3220         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
3221         * UIProcess/WebPageProxy.cpp: Set m_drawsBackground based on configuration.
3222
3223 2018-07-13  Tim Horton  <timothy_horton@apple.com>
3224
3225         WebKit sometimes holds WiFi/BT assertions while the Networking process is suspended
3226         https://bugs.webkit.org/show_bug.cgi?id=187662
3227         <rdar://problem/41999448>
3228
3229         Reviewed by Chris Dumez.
3230
3231         Inform WiFiAssertions when the Networking process is first going into the background,
3232         so it has a chance of dropping its assertions even in cases where the system
3233         suspends the process before we receive prepareToSuspend.
3234
3235         * NetworkProcess/NetworkProcess.cpp:
3236         (WebKit::NetworkProcess::processDidTransitionToForeground):
3237         (WebKit::NetworkProcess::processDidTransitionToBackground):
3238         * NetworkProcess/NetworkProcess.h:
3239         * NetworkProcess/NetworkProcess.messages.in:
3240         * NetworkProcess/curl/NetworkProcessCurl.cpp:
3241         (WebKit::NetworkProcess::platformProcessDidTransitionToForeground):
3242         (WebKit::NetworkProcess::platformProcessDidTransitionToBackground):
3243         * NetworkProcess/soup/NetworkProcessSoup.cpp:
3244         (WebKit::NetworkProcess::platformProcessDidTransitionToForeground):
3245         (WebKit::NetworkProcess::platformProcessDidTransitionToBackground):
3246         * UIProcess/Network/NetworkProcessProxy.cpp:
3247         (WebKit::NetworkProcessProxy::sendProcessDidTransitionToForeground):
3248         (WebKit::NetworkProcessProxy::sendProcessDidTransitionToBackground):
3249         * UIProcess/Network/NetworkProcessProxy.h:
3250         * UIProcess/WebProcessPool.cpp:
3251         (WebKit::WebProcessPool::updateProcessAssertions):
3252         Plumb the foreground/background transition to NetworkProcess.
3253
3254         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
3255         (WebKit::NetworkProcess::platformPrepareToSuspend):
3256         (WebKit::NetworkProcess::platformProcessDidTransitionToBackground):
3257         (WebKit::NetworkProcess::platformProcessDidTransitionToForeground):
3258         Make use of SuspensionReason to explain to WiFiAssertions the
3259         difference between prepareToSuspend and didTransitionToBackground,
3260         so that it can adjust the timing of dropping the assertion.
3261
3262 2018-07-13  Tim Horton  <timothy_horton@apple.com>
3263
3264         REGRESSION (r231676): watchOS WebKit usually doesn't load in the background
3265         https://bugs.webkit.org/show_bug.cgi?id=187663
3266         <rdar://problem/42181185>
3267
3268         Reviewed by Chris Dumez.
3269
3270         * UIProcess/ios/WebPageProxyIOS.mm:
3271         (WebKit::WebPageProxy::applicationDidEnterBackground):
3272         "Screen lock" is very aggressive on watchOS; we want to do our usual
3273         30 seconds of loading in the background when you drop your wrist,
3274         so disable this power optimization on that platform.
3275
3276 2018-07-13  Chris Dumez  <cdumez@apple.com>
3277
3278         WebResourceLoader may try to send a IPC with a destination ID that is 0
3279         https://bugs.webkit.org/show_bug.cgi?id=187654
3280         <rdar://problem/39265927>
3281
3282         Reviewed by Brady Eidson.
3283
3284         WebResourceLoader may try to send a IPC with a destination ID that is 0 according to release
3285         assertion hits we see in the wild. This can lead to HashMap corruption on recipient side when
3286         trying to lookup a key that is 0.
3287
3288         As per the crash traces, we see it starts from WebLoaderStrategy::internallyFailedLoadTimerFired()
3289         which is likely due to the Network process crashing. WebLoaderStrategy::networkProcessCrashed()
3290         calls scheduleInternallyFailedLoad() on each ResourceLoader and clears the WebResourceLoaders in
3291         m_webResourceLoaders. When a ResourceLoader is cancelled (marked as failed), we clear its identifier
3292         and we normally null out the WebLoaderStrategy's coreLoader. However, if we cannot find the
3293         WebResourceLoader in m_webResourceLoaders (because that map was already cleared) then the
3294         WebResourceLoader's coreLoader may not get nulled out, even if the coreLoader's identifier has
3295         been reset. We have 2 lambdas in WebResourceLoader which keep the WebResourceLoader alive and
3296         try to send IPC and are merely doing a null check on the coreLoader before trying to send the
3297         IPC.
3298
3299         To address the issue, we now clear the WebResourceLoader's coreLoader in
3300         WebLoaderStrategy::networkProcessCrashed(). For robustness, we also check that a coreLoader's
3301         identifier is not 0 before trying to send IPC.
3302
3303         * WebProcess/Network/WebLoaderStrategy.cpp:
3304         (WebKit::WebLoaderStrategy::networkProcessCrashed):
3305         * WebProcess/Network/WebResourceLoader.cpp:
3306         (WebKit::WebResourceLoader::willSendRequest):
3307         (WebKit::WebResourceLoader::didReceiveResponse):
3308
3309 2018-07-13  Zach Li  <zachli@apple.com>
3310
3311         Allow BOCOM and ABC plug-ins to run unsandboxed
3312         https://bugs.webkit.org/show_bug.cgi?id=187652
3313         rdar://problem/42149182
3314
3315         Reviewed by Youenn Fablet.
3316
3317         * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
3318         (WebKit::PluginInfoStore::shouldAllowPluginToRunUnsandboxed):
3319
3320 2018-07-13  Chris Dumez  <cdumez@apple.com>
3321
3322         Add more threading release assertions
3323         https://bugs.webkit.org/show_bug.cgi?id=187647
3324
3325         Reviewed by Alex Christensen.
3326
3327         Add more threading release assertions to help debug <rdar://problem/39265927>.
3328
3329         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3330         (WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess):
3331         (WebKit::NetworkConnectionToWebProcess::~NetworkConnectionToWebProcess):
3332         * UIProcess/WebProcessProxy.cpp:
3333         (WebKit::m_isInPrewarmedPool):
3334         (WebKit::WebProcessProxy::~WebProcessProxy):
3335         (WebKit::WebProcessProxy::shutDown):
3336         (WebKit::WebProcessProxy::didFinishLaunching):
3337
3338 2018-07-13  Christopher Reid  <chris.reid@sony.com>
3339
3340         [WinCairo] Add windows storage process connection implementation
3341         https://bugs.webkit.org/show_bug.cgi?id=187531
3342
3343         Reviewed by Fujii Hironori.
3344
3345         * NetworkProcess/NetworkProcess.cpp:
3346         * Platform/IPC/Attachment.h:
3347         * StorageProcess/StorageProcess.cpp:
3348         * UIProcess/Storage/StorageProcessProxy.cpp:
3349
3350 2018-07-13  Dan Bernstein  <mitz@apple.com>
3351
3352         [macOS] REGRESSION (r233536): Development WebContent service got opted back into Library Validation
3353         https://bugs.webkit.org/show_bug.cgi?id=187640
3354
3355         Reviewed by Daniel Bates.
3356
3357         * Scripts/process-webcontent-entitlements.sh: Add the
3358           com.apple.security.cs.disable-library-validation to the Development service regardless of
3359           whether restricted entitlements are to be used, because that entitlement is not restricted.
3360
3361 2018-07-13  Chris Dumez  <cdumez@apple.com>
3362
3363         NetworkConnectionToWebProcess::m_networkResourceLoaders should use Ref<> for its values
3364         https://bugs.webkit.org/show_bug.cgi?id=187629
3365
3366         Reviewed by Youenn Fablet.
3367
3368         NetworkConnectionToWebProcess::m_networkResourceLoaders should use Ref<> for its values
3369         since they cannot be null.
3370
3371         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3372         (WebKit::NetworkConnectionToWebProcess::didClose):
3373         (WebKit::NetworkConnectionToWebProcess::scheduleResourceLoad):
3374         (WebKit::NetworkConnectionToWebProcess::performSynchronousLoad):
3375         * NetworkProcess/NetworkConnectionToWebProcess.h:
3376
3377 2018-07-12  Alex Christensen  <achristensen@webkit.org>
3378
3379         Reduce size of WebCore::URL
3380         https://bugs.webkit.org/show_bug.cgi?id=186820
3381
3382         Reviewed by Yusuke Suzuki and Youenn Fablet.
3383
3384         * NetworkProcess/cache/NetworkCacheStorage.h:
3385         Increment cache version because of URL encoding change.
3386
3387 2018-07-12  Chris Dumez  <cdumez@apple.com>
3388
3389         [Cocoa] Make sure NetworkProcess::createNetworkConnectionToWebProcess() returns a valid mach port
3390         https://bugs.webkit.org/show_bug.cgi?id=187625
3391
3392         Reviewed by Youenn Fablet.
3393
3394         Make sure NetworkProcess::createNetworkConnectionToWebProcess() returns a valid mach port to help
3395         debug <rdar://problem/41995022>.
3396
3397         * NetworkProcess/NetworkProcess.cpp:
3398         (WebKit::NetworkProcess::createNetworkConnectionToWebProcess):
3399         * UIProcess/Network/NetworkProcessProxy.cpp:
3400         (WebKit::NetworkProcessProxy::didCreateNetworkConnectionToWebProcess):
3401
3402 2018-07-12  Chris Dumez  <cdumez@apple.com>
3403
3404         PingLoad does not need to ref the NetworkConnectionToWebProcess