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