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