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