b97c1f34381fe5672318c3b21609b2ebc2dc95ad
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2017-07-20  Carlos Garcia Campos  <cgarcia@igalia.com>
2
3         WebDriver: implement page load timeout
4         https://bugs.webkit.org/show_bug.cgi?id=174672
5
6         Reviewed by Brian Burg.
7
8         Always start a timer when waiting for a navigation to complete. When the timer fires, pending callbacks for
9         navigations are removed and invoked with a timeout error. If navigation completes before the timer is fired,
10         then the timer is stopped. All navigation commands now receive the page load strategy and timeout as optional
11         parameters, when not provided the default timeout (300 seconds) is used.
12
13         * UIProcess/Automation/Automation.json:
14         * UIProcess/Automation/WebAutomationSession.cpp:
15         (WebKit::WebAutomationSession::WebAutomationSession):
16         (WebKit::WebAutomationSession::waitForNavigationToComplete):
17         (WebKit::WebAutomationSession::waitForNavigationToCompleteOnPage):
18         (WebKit::WebAutomationSession::waitForNavigationToCompleteOnFrame):
19         (WebKit::WebAutomationSession::loadTimerFired):
20         (WebKit::WebAutomationSession::navigateBrowsingContext):
21         (WebKit::WebAutomationSession::goBackInBrowsingContext):
22         (WebKit::WebAutomationSession::goForwardInBrowsingContext):
23         (WebKit::WebAutomationSession::reloadBrowsingContext):
24         (WebKit::WebAutomationSession::navigationOccurredForFrame):
25         * UIProcess/Automation/WebAutomationSession.h:
26
27 2017-07-23  Takuro Ashie  <ashie@clear-code.com>
28
29         [GTK] Correct a typo in the reference manual of WebKitWebInspector
30         https://bugs.webkit.org/show_bug.cgi?id=174767
31
32         Reviewed by Michael Catanzaro.
33
34         * UIProcess/API/gtk/WebKitWebInspector.cpp:
35
36 2017-07-23  Chris Dumez  <cdumez@apple.com>
37
38         Drop ExceptionCodeDescription class
39         https://bugs.webkit.org/show_bug.cgi?id=174757
40
41         Reviewed by Darin Adler.
42
43         Update GTK bindings to use new API on DOMException instead of
44         ExceptionCodeDescription.
45
46         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMAttr.cpp:
47         (webkit_dom_attr_dispatch_event):
48         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMBlob.cpp:
49         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCDATASection.cpp:
50         (webkit_dom_cdata_section_dispatch_event):
51         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSRule.cpp:
52         (webkit_dom_css_rule_set_css_text):
53         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSRuleList.cpp:
54         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSStyleDeclaration.cpp:
55         (webkit_dom_css_style_declaration_set_property):
56         (webkit_dom_css_style_declaration_set_css_text):
57         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSStyleSheet.cpp:
58         (webkit_dom_css_style_sheet_insert_rule):
59         (webkit_dom_css_style_sheet_delete_rule):
60         (webkit_dom_css_style_sheet_add_rule):
61         (webkit_dom_css_style_sheet_remove_rule):
62         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSValue.cpp:
63         (webkit_dom_css_value_set_css_text):
64         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCharacterData.cpp:
65         (webkit_dom_character_data_dispatch_event):
66         (webkit_dom_character_data_insert_data):
67         (webkit_dom_character_data_delete_data):
68         (webkit_dom_character_data_replace_data):
69         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRect.cpp:
70         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectList.cpp:
71         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMComment.cpp:
72         (webkit_dom_comment_dispatch_event):
73         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMImplementation.cpp:
74         (webkit_dom_dom_implementation_create_document_type):
75         (webkit_dom_dom_implementation_create_document):
76         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMSelection.cpp:
77         (webkit_dom_dom_selection_collapse_to_end):
78         (webkit_dom_dom_selection_collapse_to_start):
79         (webkit_dom_dom_selection_extend):
80         (webkit_dom_dom_selection_get_range_at):
81         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMTokenList.cpp:
82         (webkit_dom_dom_token_list_add):
83         (webkit_dom_dom_token_list_remove):
84         (webkit_dom_dom_token_list_toggle):
85         (webkit_dom_dom_token_list_replace):
86         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMWindow.cpp:
87         (webkit_dom_dom_window_dispatch_event):
88         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDeprecated.cpp:
89         (webkit_dom_node_set_prefix):
90         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocument.cpp:
91         (webkit_dom_document_dispatch_event):
92         (webkit_dom_document_create_element):
93         (webkit_dom_document_create_cdata_section):
94         (webkit_dom_document_create_processing_instruction):
95         (webkit_dom_document_create_attribute):
96         (webkit_dom_document_import_node):
97         (webkit_dom_document_create_element_ns):
98         (webkit_dom_document_create_attribute_ns):
99         (webkit_dom_document_adopt_node):
100         (webkit_dom_document_create_event):
101         (webkit_dom_document_create_expression):
102         (webkit_dom_document_evaluate):
103         (webkit_dom_document_query_selector):
104         (webkit_dom_document_query_selector_all):
105         (webkit_dom_document_set_xml_version):
106         (webkit_dom_document_set_cookie):
107         (webkit_dom_document_set_body):
108         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentFragment.cpp:
109         (webkit_dom_document_fragment_dispatch_event):
110         (webkit_dom_document_fragment_query_selector):
111         (webkit_dom_document_fragment_query_selector_all):
112         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentType.cpp:
113         (webkit_dom_document_type_dispatch_event):
114         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElement.cpp:
115         (webkit_dom_element_dispatch_event):
116         (webkit_dom_element_set_attribute):
117         (webkit_dom_element_set_attribute_node):
118         (webkit_dom_element_remove_attribute_node):
119         (webkit_dom_element_set_attribute_ns):
120         (webkit_dom_element_set_attribute_node_ns):
121         (webkit_dom_element_matches):
122         (webkit_dom_element_closest):
123         (webkit_dom_element_insert_adjacent_element):
124         (webkit_dom_element_insert_adjacent_html):
125         (webkit_dom_element_insert_adjacent_text):
126         (webkit_dom_element_remove):
127         (webkit_dom_element_query_selector):
128         (webkit_dom_element_query_selector_all):
129         (webkit_dom_element_set_inner_html):
130         (webkit_dom_element_set_outer_html):
131         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMEvent.cpp:
132         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMFile.cpp:
133         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMFileList.cpp:
134         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAnchorElement.cpp:
135         (webkit_dom_html_anchor_element_dispatch_event):
136         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAppletElement.cpp:
137         (webkit_dom_html_applet_element_dispatch_event):
138         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAreaElement.cpp:
139         (webkit_dom_html_area_element_dispatch_event):
140         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLBRElement.cpp:
141         (webkit_dom_html_br_element_dispatch_event):
142         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLBaseElement.cpp:
143         (webkit_dom_html_base_element_dispatch_event):
144         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLBodyElement.cpp:
145         (webkit_dom_html_body_element_dispatch_event):
146         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLButtonElement.cpp:
147         (webkit_dom_html_button_element_dispatch_event):
148         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLCanvasElement.cpp:
149         (webkit_dom_html_canvas_element_dispatch_event):
150         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLCollection.cpp:
151         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDListElement.cpp:
152         (webkit_dom_html_d_list_element_dispatch_event):
153         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDirectoryElement.cpp:
154         (webkit_dom_html_directory_element_dispatch_event):
155         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDivElement.cpp:
156         (webkit_dom_html_div_element_dispatch_event):
157         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDocument.cpp:
158         (webkit_dom_html_document_dispatch_event):
159         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLElement.cpp:
160         (webkit_dom_html_element_dispatch_event):
161         (webkit_dom_html_element_set_inner_text):
162         (webkit_dom_html_element_set_outer_text):
163         (webkit_dom_html_element_set_content_editable):
164         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLEmbedElement.cpp:
165         (webkit_dom_html_embed_element_dispatch_event):
166         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFieldSetElement.cpp:
167         (webkit_dom_html_field_set_element_dispatch_event):
168         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFontElement.cpp:
169         (webkit_dom_html_font_element_dispatch_event):
170         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFormElement.cpp:
171         (webkit_dom_html_form_element_dispatch_event):
172         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFrameElement.cpp:
173         (webkit_dom_html_frame_element_dispatch_event):
174         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFrameSetElement.cpp:
175         (webkit_dom_html_frame_set_element_dispatch_event):
176         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHRElement.cpp:
177         (webkit_dom_html_hr_element_dispatch_event):
178         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHeadElement.cpp:
179         (webkit_dom_html_head_element_dispatch_event):
180         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHeadingElement.cpp:
181         (webkit_dom_html_heading_element_dispatch_event):
182         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHtmlElement.cpp:
183         (webkit_dom_html_html_element_dispatch_event):
184         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLIFrameElement.cpp:
185         (webkit_dom_html_iframe_element_dispatch_event):
186         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLImageElement.cpp:
187         (webkit_dom_html_image_element_dispatch_event):
188         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLInputElement.cpp:
189         (webkit_dom_html_input_element_dispatch_event):
190         (webkit_dom_html_input_element_set_max_length):
191         (webkit_dom_html_input_element_set_size):
192         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLIElement.cpp:
193         (webkit_dom_html_li_element_dispatch_event):
194         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLabelElement.cpp:
195         (webkit_dom_html_label_element_dispatch_event):
196         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLegendElement.cpp:
197         (webkit_dom_html_legend_element_dispatch_event):
198         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLinkElement.cpp:
199         (webkit_dom_html_link_element_dispatch_event):
200         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMapElement.cpp:
201         (webkit_dom_html_map_element_dispatch_event):
202         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMarqueeElement.cpp:
203         (webkit_dom_html_marquee_element_dispatch_event):
204         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMenuElement.cpp:
205         (webkit_dom_html_menu_element_dispatch_event):
206         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMetaElement.cpp:
207         (webkit_dom_html_meta_element_dispatch_event):
208         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLModElement.cpp:
209         (webkit_dom_html_mod_element_dispatch_event):
210         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOListElement.cpp:
211         (webkit_dom_html_o_list_element_dispatch_event):
212         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLObjectElement.cpp:
213         (webkit_dom_html_object_element_dispatch_event):
214         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOptGroupElement.cpp:
215         (webkit_dom_html_opt_group_element_dispatch_event):
216         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOptionElement.cpp:
217         (webkit_dom_html_option_element_dispatch_event):
218         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOptionsCollection.cpp:
219         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLParagraphElement.cpp:
220         (webkit_dom_html_paragraph_element_dispatch_event):
221         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLParamElement.cpp:
222         (webkit_dom_html_param_element_dispatch_event):
223         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLPreElement.cpp:
224         (webkit_dom_html_pre_element_dispatch_event):
225         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLQuoteElement.cpp:
226         (webkit_dom_html_quote_element_dispatch_event):
227         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLScriptElement.cpp:
228         (webkit_dom_html_script_element_dispatch_event):
229         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLSelectElement.cpp:
230         (webkit_dom_html_select_element_dispatch_event):
231         (webkit_dom_html_select_element_add):
232         (webkit_dom_html_select_element_set_length):
233         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLStyleElement.cpp:
234         (webkit_dom_html_style_element_dispatch_event):
235         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableCaptionElement.cpp:
236         (webkit_dom_html_table_caption_element_dispatch_event):
237         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableCellElement.cpp:
238         (webkit_dom_html_table_cell_element_dispatch_event):
239         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableColElement.cpp:
240         (webkit_dom_html_table_col_element_dispatch_event):
241         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableElement.cpp:
242         (webkit_dom_html_table_element_dispatch_event):
243         (webkit_dom_html_table_element_insert_row):
244         (webkit_dom_html_table_element_delete_row):
245         (webkit_dom_html_table_element_set_caption):
246         (webkit_dom_html_table_element_set_t_head):
247         (webkit_dom_html_table_element_set_t_foot):
248         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableRowElement.cpp:
249         (webkit_dom_html_table_row_element_dispatch_event):
250         (webkit_dom_html_table_row_element_insert_cell):
251         (webkit_dom_html_table_row_element_delete_cell):
252         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableSectionElement.cpp:
253         (webkit_dom_html_table_section_element_dispatch_event):
254         (webkit_dom_html_table_section_element_insert_row):
255         (webkit_dom_html_table_section_element_delete_row):
256         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTextAreaElement.cpp:
257         (webkit_dom_html_text_area_element_dispatch_event):
258         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTitleElement.cpp:
259         (webkit_dom_html_title_element_dispatch_event):
260         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLUListElement.cpp:
261         (webkit_dom_html_u_list_element_dispatch_event):
262         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMKeyboardEvent.cpp:
263         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMMediaList.cpp:
264         (webkit_dom_media_list_delete_medium):
265         (webkit_dom_media_list_append_medium):
266         (webkit_dom_media_list_set_media_text):
267         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMMouseEvent.cpp:
268         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNamedNodeMap.cpp:
269         (webkit_dom_named_node_map_set_named_item):
270         (webkit_dom_named_node_map_remove_named_item):
271         (webkit_dom_named_node_map_remove_named_item_ns):
272         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNode.cpp:
273         (webkit_dom_node_dispatch_event):
274         (webkit_dom_node_insert_before):
275         (webkit_dom_node_replace_child):
276         (webkit_dom_node_remove_child):
277         (webkit_dom_node_append_child):
278         (webkit_dom_node_clone_node_with_error):
279         (webkit_dom_node_set_node_value):
280         (webkit_dom_node_set_text_content):
281         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNodeIterator.cpp:
282         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNodeList.cpp:
283         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMProcessingInstruction.cpp:
284         (webkit_dom_processing_instruction_dispatch_event):
285         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMRange.cpp:
286         (webkit_dom_range_set_start):
287         (webkit_dom_range_set_end):
288         (webkit_dom_range_set_start_before):
289         (webkit_dom_range_set_start_after):
290         (webkit_dom_range_set_end_before):
291         (webkit_dom_range_set_end_after):
292         (webkit_dom_range_select_node):
293         (webkit_dom_range_select_node_contents):
294         (webkit_dom_range_compare_boundary_points):
295         (webkit_dom_range_delete_contents):
296         (webkit_dom_range_extract_contents):
297         (webkit_dom_range_clone_contents):
298         (webkit_dom_range_insert_node):
299         (webkit_dom_range_surround_contents):
300         (webkit_dom_range_create_contextual_fragment):
301         (webkit_dom_range_compare_node):
302         (webkit_dom_range_intersects_node):
303         (webkit_dom_range_compare_point):
304         (webkit_dom_range_is_point_in_range):
305         (webkit_dom_range_expand):
306         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMStyleSheet.cpp:
307         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMStyleSheetList.cpp:
308         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMText.cpp:
309         (webkit_dom_text_dispatch_event):
310         (webkit_dom_text_split_text):
311         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMTreeWalker.cpp:
312         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMUIEvent.cpp:
313         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMWheelEvent.cpp:
314         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMXPathExpression.cpp:
315         (webkit_dom_xpath_expression_evaluate):
316         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMXPathResult.cpp:
317         (webkit_dom_xpath_result_iterate_next):
318         (webkit_dom_xpath_result_snapshot_item):
319         (webkit_dom_xpath_result_get_number_value):
320         (webkit_dom_xpath_result_get_boolean_value):
321         (webkit_dom_xpath_result_get_single_node_value):
322         (webkit_dom_xpath_result_get_snapshot_length):
323
324 2017-07-22  Wenson Hsieh  <wenson_hsieh@apple.com>
325
326         [iOS WK2] Remove _WKDraggableElementInfo and fold PositionInformationTests into WKRequestActivatedElementInfo
327         https://bugs.webkit.org/show_bug.cgi?id=174758
328
329         Reviewed by Dan Bernstein.
330
331         _WKDraggableElementInfo is no longer used in WebKit, so it should be removed. However, some of the scenarios
332         in PositionInformationTests that depend on _WKDraggableElementInfo are still useful to exercise: namely,
333         performing both synchronous and asynchronous position information updates while an async position information
334         update is in flight. This patch refactors these unit tests into 2 new unit tests in the existing
335         WKRequestActivatedElementInfo test suite.
336
337         * UIProcess/API/Cocoa/WKWebView.mm:
338         (-[WKWebView _draggableElementAtPosition:]): Deleted.
339         (-[WKWebView _requestDraggableElementAtPosition:completionBlock:]): Deleted.
340         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
341         * UIProcess/API/Cocoa/_WKDraggableElementInfo.h: Removed.
342         * UIProcess/API/Cocoa/_WKDraggableElementInfo.mm: Removed.
343         * UIProcess/API/Cocoa/_WKDraggableElementInfoInternal.h: Removed.
344         * UIProcess/ios/WKContentViewInteraction.mm:
345         * WebKit.xcodeproj/project.pbxproj:
346
347 2017-07-22  Wenson Hsieh  <wenson_hsieh@apple.com>
348
349         [Mac WK2] Fix null dereference in asynchronous NSTextInputClient methods when deallocating a WKWebView
350         https://bugs.webkit.org/show_bug.cgi?id=174751
351         <rdar://problem/33132405>
352
353         Reviewed by Darin Adler.
354
355         Tweaks -[WKWebView dealloc] to close the WebPageProxy at an earlier time, prior to destroying the WebViewImpl.
356         This fixes a NSTextInputClient crash in WKWebView when exercising the following scenario:
357
358         (1) Suppose that NSTextInputContext invokes an asynchronous text input query on WKWebView immediately before
359         WKWebView is deallocated, such that WebPageProxy's CallbackMap contains an NSTextInputContext callback at the
360         time that -[WKWebView dealloc] is called. Additionally, suppose that this callback from NSTextInputContext
361         invokes additional NSTextInputClient methods on the WKWebView that involve plumbing through to the WebViewImpl
362         (which is stored as _impl on the WKWebView).
363
364         (2) Observe that when calling [super dealloc] in [WKWebView dealloc], we will destroy the WebViewImpl as a
365         result of setting our unique pointer to _impl to be null. In ~WebViewImpl, we invoke WebPageProxy::close, which
366         in turn invokes WebPageProxy::resetState.
367
368         (3) WebPageProxy::resetState then calls m_callbacks.invalidate(error), which triggers all pending callbacks.
369         This invokes the block described in (1), which causes us to try and call back into WKWebView, invoking
370         NSTextInputClient methods. Without the fix in this patch, these methods currently assume that _impl is nonnull,
371         even though we've already cleared out the pointer in (2), so we segfault with a null dereference.
372
373         After this patch, we close the _page at an earlier time, such that the state is reset before the WebViewImpl
374         (and corresponding _impl unique_ptr in WKWebView) is torn down. This ensures that _impl will not be null for
375         callbacks invoked after beginning to deallocate the WKWebView.
376
377         Forcing this scenario in a custom AppKit root that triggers async NSTextInputClient methods immediately when a
378         WKWebView is being deallocated produces a crash with the same stack trace as what we observe in the radar, but
379         there are no known steps to actually reproduce this crash in shipping software.
380
381         * UIProcess/API/Cocoa/WKWebView.mm:
382         (-[WKWebView dealloc]):
383
384 2017-07-22  Chris Dumez  <cdumez@apple.com>
385
386         REGRESSION(r204565): WKObject is broken
387         https://bugs.webkit.org/show_bug.cgi?id=174736
388         <rdar://problem/33246169>
389
390         Reviewed by Dan Bernstein.
391
392         Revert r204565 as making WKObject a root class caused unexpected crashes.
393         Instead, we now have WKObject inherit from NSProxy (instead of previously
394         NSObject) and we forward calls to the target.
395
396         We also need to provide an implementation for private methods such as
397         isNSString__ to address the issue with NSStrings that r204565 was trying
398         to fix.
399
400         * Shared/Cocoa/APIObject.mm:
401         (API::Object::unwrap):
402         * Shared/Cocoa/WKObject.h:
403         * Shared/Cocoa/WKObject.mm:
404         (-[WKObject dealloc]):
405         (-[WKObject hash]):
406         (-[WKObject isKindOfClass:]):
407         (-[WKObject isMemberOfClass:]):
408         (-[WKObject respondsToSelector:]):
409         (-[WKObject conformsToProtocol:]):
410         (-[WKObject forwardingTargetForSelector:]):
411         (-[WKObject description]):
412         (-[WKObject debugDescription]):
413         (-[WKObject classForCoder]):
414         (-[WKObject classForKeyedArchiver]):
415         (-[WKObject _web_createTarget]):
416         (-[WKObject forwardInvocation:]):
417         (-[WKObject methodSignatureForSelector:]):
418         (-[WKObject isNSObject__]):
419         (-[WKObject isNSArray__]):
420         (-[WKObject isNSCFConstantString__]):
421         (-[WKObject isNSData__]):
422         (-[WKObject isNSDate__]):
423         (-[WKObject isNSDictionary__]):
424         (-[WKObject isNSNumber__]):
425         (-[WKObject isNSOrderedSet__]):
426         (-[WKObject isNSSet__]):
427         (-[WKObject isNSString__]):
428         (-[WKObject isNSTimeZone__]):
429         (-[WKObject isNSValue__]):
430
431 2017-07-21  Chris Dumez  <cdumez@apple.com>
432
433         Drop IDBDatabaseException class
434         https://bugs.webkit.org/show_bug.cgi?id=174743
435
436         Reviewed by Darin Adler.
437
438         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
439         (WebKit::WebIDBConnectionToServer::connectionToServerLost):
440
441 2017-07-21  Brady Eidson  <beidson@apple.com>
442
443         Crash in many WebKit apps marking a connection invalid under Messages::NetworkProcessProxy::canAuthenticateAgainstProtectionSpace.
444         <rdar://problem/28822272> and https://bugs.webkit.org/show_bug.cgi?id=174729
445
446         Reviewed by Tim Horton.
447
448         Previously, when a NetworkLoad generated a "CanAuthenticateAgainstProtectionSpace" event, the message went from
449         Network process -> Web process -> UI process.
450
451         In that case, MESSAGE_CHECKing the validity of the frame in WebPageProxy made sense.
452
453         In r202511 we cut the WebProcess out of this and had Networking go straight to UI process.
454
455         As a result, the message check became invalid. The Networking process cannot possible know the validity of 
456         particular WebPage or WebFrame identifiers.
457
458         We simply need to validate the input in NetworkProcessProxy.
459
460         * UIProcess/Network/NetworkProcessProxy.cpp:
461         (WebKit::NetworkProcessProxy::canAuthenticateAgainstProtectionSpace): Validate both the page and frame ids before
462           passing the call along to the WebPageProxy. Also, if either of those validations fail, respond to the network process.
463
464 2017-07-21  Andy Estes  <aestes@apple.com>
465
466         [iOS] Adopt UIImagePickerControllerImageURL for photo uploads
467         https://bugs.webkit.org/show_bug.cgi?id=174723
468         <rdar://problem/33223962>
469
470         Reviewed by Joseph Pecoraro.
471
472         In iOS 11, use the URL provided by UIImagePickerControllerImageURL, if available, as the
473         file URL for photo uploads. Since we use the UIImagePickerController imageExportPreset of
474         UIImagePickerControllerImageURLExportPresetCompatible, UIKit will take care of converting
475         HEIF images to JPEG for us. For other types (GIF, JPEG, and PNG), it will preserve the
476         original format.
477
478         Since UIImagePickerController now provides GIF and PNG representations, we no longer need to
479         use PHImageManager to access the original assets. This patch removes the
480         PHAsset/PHImageManager code added in r185241.
481
482         * Platform/spi/ios/PhotosSPI.h: Removed.
483         * UIProcess/ios/forms/WKFileUploadPanel.mm:
484         (-[WKFileUploadPanel _uploadItemFromMediaInfo:successBlock:failureBlock:]):
485         (-[WKFileUploadPanel _uploadItemForImage:withAssetURL:successBlock:failureBlock:]): Deleted.
486         * WebKit.xcodeproj/project.pbxproj:
487
488 2017-07-21  Konstantin Tokarev  <annulen@yandex.ru>
489
490         [cmake][Mac] Unreviewed, fix linking WebKitSystemInterface
491
492         After r219560 link_directories() in PlatformXXX.cmake files does not
493         affect corresponding targets.
494
495         * PlatformMac.cmake:
496
497 2017-07-21  Andreas Kling  <akling@apple.com>
498
499         Use more references in event dispatch code
500         https://bugs.webkit.org/show_bug.cgi?id=174681
501
502         Reviewed by Geoffrey Garen.
503
504         * WebProcess/Plugins/PDF/PDFPluginAnnotation.h:
505         * WebProcess/Plugins/PDF/PDFPluginAnnotation.mm:
506         (WebKit::PDFPluginAnnotation::handleEvent):
507         (WebKit::PDFPluginAnnotation::PDFPluginAnnotationEventListener::handleEvent):
508         * WebProcess/Plugins/PDF/PDFPluginPasswordField.h:
509         * WebProcess/Plugins/PDF/PDFPluginPasswordField.mm:
510         (WebKit::PDFPluginPasswordField::handleEvent):
511         * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.h:
512         * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm:
513         (WebKit::PDFPluginTextAnnotation::handleEvent):
514         * WebProcess/Plugins/PluginView.cpp:
515         (WebKit::PluginView::createWebEvent):
516         (WebKit::PluginView::handleEvent):
517         * WebProcess/Plugins/PluginView.h:
518
519 2017-07-21  Chris Dumez  <cdumez@apple.com>
520
521         WebResourceLoadStatisticsStore::m_operatingDates is unsafely modified from several threads
522         https://bugs.webkit.org/show_bug.cgi?id=174721
523         <rdar://problem/33400343>
524
525         Reviewed by Brent Fulgham.
526
527         WebResourceLoadStatisticsStore::m_operatingDates is supposed to only be modified on
528         the background thread. However, WebResourceLoadStatisticsStore::performDailyTasks()
529         was mistakenly calling includeTodayAsOperatingDateIfNecessary() on the main thread,
530         which would modify m_operatingDates. This could lead to crashes such as the
531         one in <rdar://problem/33400343>, as the main thread may modify m_operatingDates
532         while we are interating over it on the background thread to save it to disk.
533
534         * UIProcess/WebResourceLoadStatisticsStore.cpp:
535         (WebKit::WebResourceLoadStatisticsStore::performDailyTasks):
536         (WebKit::WebResourceLoadStatisticsStore::includeTodayAsOperatingDateIfNecessary):
537
538 2017-07-21  Brady Eidson  <beidson@apple.com>
539
540         Get rid of WebCore IconDatabase code.
541         https://bugs.webkit.org/show_bug.cgi?id=174700
542
543         Reviewed by Tim Horton.
544
545         * UIProcess/API/glib/WebKitWebContext.cpp:
546         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
547         (WebKit::WebFrameLoaderClient::useIconLoadingClient): Deleted.
548         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
549
550 2017-07-21  Carlos Garcia Campos  <cgarcia@igalia.com>
551
552         Web Automation: implicit navigations don't cause browsing context switch
553         https://bugs.webkit.org/show_bug.cgi?id=174633
554         <rdar://problem/33387797>
555
556         Reviewed by Brian Burg.
557
558         When a new page load replaces the current frameset, for example when a link in the current browser context has a
559         _top target, there's no explicit context switch, so the web driver doesn't know that the current browsing
560         context is no longer valid. Following commands will still be using the previous frame as the current browsing
561         context, but they don't fail with no such frame because the frame is still alive in the page cache and
562         referenced in the internal maps used in both UI and web processes. This causes test
563         testShouldFocusOnTheReplacementWhenAFrameFollowsALinkToA_TopTargetedPage to fail, since it expects a no such
564         frame exception. When a new page navigation happens we can simply remove references to frames from
565         m_handleWebFrameMap in WebAutomationSession, because any existing frame reference in the map should be for a
566         previous page. With this, before the next command is executed, waitForNavigationToComplete will be called and it
567         will fail with no such frame, condition that is handled to switch to the top level browser context. The test
568         still fails, because the find element command is called with the top level browsing context, returning no such
569         element, instead of no such frame. This is consistent with Chrome.
570
571         * UIProcess/Automation/WebAutomationSession.cpp:
572         (WebKit::WebAutomationSession::navigationOccurredForFrame): Clear the m_handleWebFrameMap when a new page load
573         finished.
574
575 2017-07-21  Carlos Garcia Campos  <cgarcia@igalia.com>
576
577         WebDriver: wait until navigation is complete before running new commands and after a click
578         https://bugs.webkit.org/show_bug.cgi?id=174670
579
580         Reviewed by Brian Burg.
581
582         Add waitForNavigationToComplete method to Automation to allow WebDriver to wait for pending navigations to
583         complete. The new method already receives page load strategy and timeout, but they are not implemented yet.
584
585         * UIProcess/Automation/Automation.json: Add waitForNavigationToComplete method and PageLoadStrategy new type.
586         * UIProcess/Automation/WebAutomationSession.cpp:
587         (WebKit::WebAutomationSession::waitForNavigationToComplete): Call waitForNavigationToCompleteOnPage or
588         waitForNavigationToCompleteOnFrame depending on whether the current borwsing context is the main frame or not.
589         (WebKit::WebAutomationSession::waitForNavigationToCompleteOnPage): Check if there's an ongoing load for the page,
590         and wait for it to complete if needed.
591         (WebKit::WebAutomationSession::waitForNavigationToCompleteOnFrame): Check if there's an ongoing load for the frame,
592         and wait for it to complete if needed.
593         (WebKit::WebAutomationSession::navigateBrowsingContext): Use waitForNavigationToCompleteOnPage() now.
594         (WebKit::WebAutomationSession::goBackInBrowsingContext): Ditto.
595         (WebKit::WebAutomationSession::goForwardInBrowsingContext): Ditto.
596         (WebKit::WebAutomationSession::reloadBrowsingContext): Ditto.
597         (WebKit::WebAutomationSession::navigationOccurredForFrame): Renamed since it now receives the notification for
598         all the frames. Complete page operations if it's a main frame, or frame operations otherwise.
599         * UIProcess/Automation/WebAutomationSession.h:
600         * UIProcess/WebPageProxy.cpp:
601         (WebKit::WebPageProxy::didFinishLoadForFrame): Notify about all frames, not only the main one.
602         (WebKit::WebPageProxy::didFailLoadForFrame): Ditto.
603         (WebKit::WebPageProxy::didSameDocumentNavigationForFrame): Ditto.
604
605 2017-07-20  Carlos Garcia Campos  <cgarcia@igalia.com>
606
607         Unreviewed. Remove WKIconDatabaseCairo.
608
609         * PlatformGTK.cmake:
610         * PlatformWPE.cmake:
611         * UIProcess/API/C/cairo/WKIconDatabaseCairo.cpp: Removed.
612         * UIProcess/API/C/cairo/WKIconDatabaseCairo.h: Removed.
613
614 2017-07-20  Brady Eidson  <beidson@apple.com>
615
616         Get rid of IconDatabase related code in WebKit.
617         https://bugs.webkit.org/show_bug.cgi?id=174693
618
619         Reviewed by Tim Horton.
620
621         This leaves the C-API class but guts it.
622
623         No explanations of the other changes are needed.
624
625         * CMakeLists.txt:
626         * DerivedSources.make:
627         * Shared/WebProcessCreationParameters.cpp:
628         (WebKit::WebProcessCreationParameters::encode):
629         (WebKit::WebProcessCreationParameters::decode):
630         * Shared/WebProcessCreationParameters.h:
631         * UIProcess/API/C/WKContext.cpp:
632         (WKContextGetIconDatabase):
633         (WKContextSetIconDatabasePath):
634         * UIProcess/API/C/WKIconDatabase.cpp:
635         (WKIconDatabaseSetIconDatabaseClient):
636         (WKIconDatabaseRetainIconForURL):
637         (WKIconDatabaseReleaseIconForURL):
638         (WKIconDatabaseSetIconDataForIconURL):
639         (WKIconDatabaseSetIconURLForPageURL):
640         (WKIconDatabaseCopyIconURLForPageURL):
641         (WKIconDatabaseCopyIconDataForPageURL):
642         (WKIconDatabaseEnableDatabaseCleanup):
643         (WKIconDatabaseRemoveAllIcons):
644         (WKIconDatabaseCheckIntegrityBeforeOpening):
645         (WKIconDatabaseClose):
646         * UIProcess/API/C/cg/WKIconDatabaseCG.cpp:
647         (WKIconDatabaseTryGetCGImageForURL):
648         (WKIconDatabaseTryCopyCGImageArrayForURL):
649         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
650         (WebKit::WebProcessPool::platformDefaultIconDatabasePath): Deleted.
651         * UIProcess/WebIconDatabase.cpp: Removed.
652         * UIProcess/WebIconDatabase.h:
653         (WebKit::WebIconDatabase::clearProcessPool): Deleted.
654         * UIProcess/WebIconDatabase.messages.in: Removed.
655         * UIProcess/WebIconDatabaseClient.cpp: Removed.
656         * UIProcess/WebIconDatabaseClient.h: Removed.
657         * UIProcess/WebProcessPool.cpp:
658         (WebKit::m_hiddenPageThrottlingTimer):
659         (WebKit::WebProcessPool::~WebProcessPool):
660         (WebKit::WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled):
661         (WebKit::WebProcessPool::createNewWebProcess):
662         (WebKit::WebProcessPool::setIconDatabasePath): Deleted.
663         (WebKit::WebProcessPool::iconDatabasePath): Deleted.
664         * UIProcess/WebProcessPool.h:
665         * UIProcess/WebProcessProxy.cpp:
666         (WebKit::WebProcessProxy::processWillShutDown):
667         (WebKit::WebProcessProxy::retainIconForPageURL): Deleted.
668         (WebKit::WebProcessProxy::releaseIconForPageURL): Deleted.
669         (WebKit::WebProcessProxy::releaseRemainingIconsForPageURLs): Deleted.
670         * UIProcess/WebProcessProxy.h:
671         * UIProcess/WebProcessProxy.messages.in:
672         * UIProcess/gtk/WebProcessPoolGtk.cpp:
673         (WebKit::WebProcessPool::platformDefaultIconDatabasePath): Deleted.
674         * UIProcess/wpe/WebProcessPoolWPE.cpp:
675         (WebKit::WebProcessPool::platformDefaultIconDatabasePath): Deleted.
676         * WebKit.xcodeproj/project.pbxproj:
677         * WebProcess/IconDatabase/WebIconDatabaseProxy.cpp: Removed.
678         * WebProcess/IconDatabase/WebIconDatabaseProxy.h: Removed.
679         * WebProcess/IconDatabase/WebIconDatabaseProxy.messages.in: Removed.
680         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
681         * WebProcess/WebProcess.cpp:
682         (WebKit::WebProcess::WebProcess):
683         (WebKit::WebProcess::initializeWebProcess):
684         (WebKit::WebProcess::getWebCoreStatistics):
685         * WebProcess/WebProcess.h:
686
687 2017-07-20  David Quesada  <david_quesada@apple.com>
688
689         Add SPI to notify WKNavigationDelegate about client redirects
690         https://bugs.webkit.org/show_bug.cgi?id=174680
691         rdar://problem/33184886
692
693         Reviewed by Brady Eidson.
694
695         * UIProcess/API/APINavigationClient.h:
696         (API::NavigationClient::didPerformClientRedirectForNavigation):
697         Add a new virtual method for navigation clients to implement if they want to be informed
698         when the page is initiating a navigation that is a client redirect.
699
700         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
701         Declare the new WKNavigationDelegate method -_webView:didPerformClientRedirectForNavigation:
702
703         * UIProcess/Cocoa/NavigationState.h:
704         * UIProcess/Cocoa/NavigationState.mm:
705         (WebKit::NavigationState::setNavigationDelegate):
706         (WebKit::NavigationState::NavigationClient::didPerformClientRedirectForNavigation):
707         Add a new method to NavigationState method to tell the WKNavigationDelegate when a
708         client redirect happens.
709
710         * UIProcess/WebPageProxy.cpp:
711         (WebKit::WebPageProxy::didPerformClientRedirectForLoadForFrame):
712         * UIProcess/WebPageProxy.h:
713         * UIProcess/WebPageProxy.messages.in:
714         Allow the WebPageProxy to receive a message from the web process when a client redirect happens.
715
716         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
717         (WebKit::WebFrameLoaderClient::dispatchDidPerformClientRedirect):
718         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
719         Send this new message to the UI process on client redirects.
720
721 2017-07-20  Chris Dumez  <cdumez@apple.com>
722
723         Drop legacy XPathException type
724         https://bugs.webkit.org/show_bug.cgi?id=174679
725
726         Reviewed by Sam Weinig.
727
728         Drop legacy XPathException type and use DOMException instead. Both Firefox and Chrome
729         no longer expose XPathException.
730
731         * UIProcess/Automation/atoms/FindNodes.js:
732         (tryToFindNode):
733
734 2017-07-20  Chris Dumez  <cdumez@apple.com>
735
736         Unreviewed, rolling out r219706.
737
738         Broke iOS build
739
740         Reverted changeset:
741
742         "Drop legacy XPathException type"
743         https://bugs.webkit.org/show_bug.cgi?id=174679
744         http://trac.webkit.org/changeset/219706
745
746 2017-07-20  Chris Dumez  <cdumez@apple.com>
747
748         Drop legacy XPathException type
749         https://bugs.webkit.org/show_bug.cgi?id=174679
750
751         Reviewed by Sam Weinig.
752
753         Drop legacy XPathException type and use DOMException instead. Both Firefox and Chrome
754         no longer expose XPathException.
755
756         * UIProcess/Automation/atoms/FindNodes.js:
757         (tryToFindNode):
758
759 2017-07-20  Chris Dumez  <cdumez@apple.com>
760
761         Avoid unnecessary WorkQueue dispatch in WebResourceLoadStatisticsStore::processStatisticsAndDataRecords()
762         https://bugs.webkit.org/show_bug.cgi?id=174686
763
764         Reviewed by Geoffrey Garen.
765
766         Avoid unnecessary WorkQueue dispatch in WebResourceLoadStatisticsStore::processStatisticsAndDataRecords(). The most common
767         call site is already on the right thread.
768
769         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
770         (-[WKWebsiteDataStore _resourceLoadStatisticsProcessStatisticsAndDataRecords]):
771         * UIProcess/WebResourceLoadStatisticsStore.cpp:
772         (WebKit::WebResourceLoadStatisticsStore::scheduleStatisticsAndDataRecordsProcessing):
773         (WebKit::WebResourceLoadStatisticsStore::processStatisticsAndDataRecords):
774         * UIProcess/WebResourceLoadStatisticsStore.h:
775
776 2017-07-20  Chris Dumez  <cdumez@apple.com>
777
778         Regression(ITP): May get frequently logged out of wsj.com
779         https://bugs.webkit.org/show_bug.cgi?id=174661
780         <rdar://problem/32343256>
781
782         Reviewed by Geoffrey Garen.
783
784         Bump statistics file version to blow away old statistics on disk since those do not
785         take into account associated domains.
786
787         * UIProcess/WebResourceLoadStatisticsStore.cpp:
788
789 2017-07-20  Chris Dumez  <cdumez@apple.com>
790
791         Replace calls to Vector::resize() with calls to more efficient shrink() / grow() when applicable
792         https://bugs.webkit.org/show_bug.cgi?id=174660
793
794         Reviewed by Geoffrey Garen.
795
796         Replace calls to Vector::resize() with calls to more efficient shrink() / grow() when applicable.
797         This essentially replaces a branch to figure out if the new size is less or greater than the
798         current size by an assertion.
799
800         * Platform/IPC/ArgumentCoders.h:
801         * UIProcess/Gamepad/UIGamepadProvider.cpp:
802         (WebKit::UIGamepadProvider::platformGamepadConnected):
803         * UIProcess/WebProcessPool.cpp:
804         (WebKit::WebProcessPool::setInitialConnectedGamepads):
805         * WebProcess/Network/WebLoaderStrategy.cpp:
806         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
807         * WebProcess/WebCoreSupport/WebPasteboardOverrides.cpp:
808         (WebKit::WebPasteboardOverrides::getDataForOverride):
809         * WebProcess/WebPage/ios/WebPageIOS.mm:
810         (WebKit::WebPage::requestAutocorrectionData):
811
812 2017-07-20  Chris Dumez  <cdumez@apple.com>
813
814         Regression(ITP): Can no longer log in on abc.go.com
815         https://bugs.webkit.org/show_bug.cgi?id=174533
816         <rdar://problem/33325881>
817
818         Reviewed by Geoffrey Garen.
819
820         Bump statistics database version to blow away any existing statistics. Without this, SSO providers
821         for which we added a quirk may already be in the database and identified as trackers. The quirk
822         merely prevents the specified SSO providers from being identified as trackers.
823
824         * UIProcess/WebResourceLoadStatisticsStore.cpp:
825
826 2017-07-19  Simon Fraser  <simon.fraser@apple.com>
827
828         getBoundingClientRects not updated for programmatic scrolls
829         https://bugs.webkit.org/show_bug.cgi?id=174538
830         rdar://problem/33049012
831
832         Reviewed by Tim Horton.
833         
834         Feed ViewportRectStability and ScrollingLayerPositionAction into reconcileScrollingState().
835
836         * WebProcess/WebPage/ios/WebPageIOS.mm:
837         (WebKit::WebPage::updateVisibleContentRects):
838
839 2017-07-19  Brady Eidson  <beidson@apple.com>
840
841         iBooks sometimes crashes when closing a book.
842         <rdar://problem/31180331> and https://bugs.webkit.org/show_bug.cgi?id=174658
843
844         Reviewed by Oliver Hunt.
845
846         - LegacyCustomProtocolManagerProxy should not reference a WebProcessPool directly.
847         - LegacyCustomProtocolManagerProxy should invalidate in its destructor.
848
849         * UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.cpp:
850         (WebKit::LegacyCustomProtocolManagerProxy::LegacyCustomProtocolManagerProxy):
851         (WebKit::LegacyCustomProtocolManagerProxy::~LegacyCustomProtocolManagerProxy):
852         (WebKit::LegacyCustomProtocolManagerProxy::startLoading):
853         (WebKit::LegacyCustomProtocolManagerProxy::stopLoading):
854         (WebKit::LegacyCustomProtocolManagerProxy::invalidate):
855         (WebKit::LegacyCustomProtocolManagerProxy::wasRedirectedToRequest):
856         (WebKit::LegacyCustomProtocolManagerProxy::didReceiveResponse):
857         (WebKit::LegacyCustomProtocolManagerProxy::didLoadData):
858         (WebKit::LegacyCustomProtocolManagerProxy::didFailWithError):
859         (WebKit::LegacyCustomProtocolManagerProxy::didFinishLoading):
860         (WebKit::LegacyCustomProtocolManagerProxy::processDidClose): Deleted.
861         * UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.h:
862
863         * UIProcess/Network/NetworkProcessProxy.cpp:
864         (WebKit::NetworkProcessProxy::NetworkProcessProxy):
865         (WebKit::NetworkProcessProxy::didClose):
866         * UIProcess/Network/NetworkProcessProxy.h:
867         (WebKit::NetworkProcessProxy::processPool):
868
869 2017-07-19  Yusuke Suzuki  <utatane.tea@gmail.com>
870
871         [WTF] Implement WTF::ThreadGroup
872         https://bugs.webkit.org/show_bug.cgi?id=174081
873
874         Reviewed by Mark Lam.
875
876         * Shared/AsyncRequest.h:
877
878 2017-07-18  Carlos Garcia Campos  <cgarcia@igalia.com>
879
880         WebDriver: handle invalid selector errors
881         https://bugs.webkit.org/show_bug.cgi?id=174619
882
883         Reviewed by Brian Burg.
884
885         We are currently handling only XPathException and only when it's an invalid expression. In the xpath case, the
886         spec also says "If any item in result is not an element return an error with error code invalid selector.", so
887         we should also handle TYPE_ERR (The expression could not be converted to return the specified type.). However,
888         since the spec says "or other error", I think we can simplify this and simply throw InvalidSelector inside the
889         catch, without checking any specific error. This is causing 14 failures in selenium tests.
890
891         ยง12. Element Retrieval. Step 6: If a DOMException, SyntaxError, XPathException, or other error occurs during the
892         execution of the element location strategy, return error invalid selector.
893         https://www.w3.org/TR/webdriver/#dfn-find
894
895         * UIProcess/Automation/Automation.json: Add InvalidSelector error.
896         * UIProcess/Automation/atoms/FindNodes.js:
897         (tryToFindNode): Raise InvalidSelector in case of error.
898         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
899         (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction): Handle InvalidSelector exceptions.
900
901 2017-07-18  Carlos Garcia Campos  <cgarcia@igalia.com>
902
903         Web Automation: error details not passed to DidEvaluateJavaScriptFunction message when callback was not called before page unload
904         https://bugs.webkit.org/show_bug.cgi?id=174624
905
906         Reviewed by Brian Burg.
907
908         There's a variable errorMessage, but it's unused.
909
910         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
911         (WebKit::WebAutomationSessionProxy::didClearWindowObjectForFrame): Pass errorMessage instead of String() to DidEvaluateJavaScriptFunction.
912
913 2017-07-18  Carlos Garcia Campos  <cgarcia@igalia.com>
914
915         Web Automation: evaluateJavaScriptFunction should always notify the web process before returning early
916         https://bugs.webkit.org/show_bug.cgi?id=174623
917
918         Reviewed by Brian Burg.
919
920         It currently returns early if page, frame or scriptObject are nullptr, in which cases the UI process is not
921         notified. This causes test testShouldNotBeAbleToDoAnythingTheFrameIsDeletedFromUnderUs to hang, because message
922         DidEvaluateJavaScriptFunction is never sent when the given frame no longer exists. We should send
923         DidEvaluateJavaScriptFunction with WindowNotFound in case of page is nullptr and FrameNotFound if the frame is
924         nullptr. The scriptObject early return is actually wrong, because scriptObjectForFrame creates a new script if
925         there's isn't one for the given frame.
926
927         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
928         (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction):
929
930 2017-07-18  Carlos Garcia Campos  <cgarcia@igalia.com>
931
932         Web Automation: pending evaluate script callbacks are stored with the wrong frame ID when using the default main frame
933         https://bugs.webkit.org/show_bug.cgi?id=174622
934
935         Reviewed by Brian Burg.
936
937         The frameHandle argument is optional in evaluateJavaScriptFunction(), when not provided we pass 0 to the web
938         process. The proxy gets the web page main frame when received frame ID is 0, but the given frameID is
939         still used as key of m_webFramePendingEvaluateJavaScriptCallbacksMap and also passed to the javascript function
940         as argument. I think r203442 was actually a workaround to this bug, making it even more hidden. Both
941         m_webFrameScriptObjectMap and m_webFramePendingEvaluateJavaScriptCallbacksMap should never have 0 as a
942         key, since they always use a frame ID, and the frame identifier counter starts at 1. This is causing test
943         testShouldDetectPageLoadsWhileWaitingOnAnAsyncScriptAndReturnAnError to hang, because when the page is unloaded
944         and didClearWindowObjectForFrame is called, we try to get the pending callbacks of frame 1, but they were stored
945         as frame 0 so DidEvaluateJavaScriptFunction message is never sent to the UI process.
946
947         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
948         (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction): Use always the actual frameID from the WebFrame
949         we are using.
950         * WebProcess/Automation/WebAutomationSessionProxy.h: Do not allow 0 as a key of
951         m_webFramePendingEvaluateJavaScriptCallbacksMap and m_webFrameScriptObjectMap.
952
953 2017-07-18  Andy Estes  <aestes@apple.com>
954
955         [Xcode] Enable CLANG_WARN_RANGE_LOOP_ANALYSIS
956         https://bugs.webkit.org/show_bug.cgi?id=174631
957
958         Reviewed by Tim Horton.
959
960         * Configurations/Base.xcconfig:
961         * Shared/API/APIArray.cpp:
962         (API::Array::toStringVector):
963         * UIProcess/Plugins/PlugInAutoStartProvider.cpp:
964         (WebKit::PlugInAutoStartProvider::setAutoStartOriginsArray):
965         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
966         (WebKit::WebUserContentControllerProxy::addProcess):
967         (WebKit::WebUserContentControllerProxy::removeAllUserScripts):
968         (WebKit::WebUserContentControllerProxy::removeAllUserStyleSheets):
969         * UIProcess/ios/forms/WKFileUploadPanel.mm:
970         (-[WKFileUploadPanel presentWithParameters:resultListener:]):
971         * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp:
972         (WebKit::InjectedBundlePageEditorClient::getPasteboardDataForRange):
973
974 2017-07-18  Andy Estes  <aestes@apple.com>
975
976         [Xcode] Enable CLANG_WARN_OBJC_LITERAL_CONVERSION
977         https://bugs.webkit.org/show_bug.cgi?id=174631
978
979         Reviewed by Sam Weinig.
980
981         * Configurations/Base.xcconfig:
982
983 2017-07-18  Andy Estes  <aestes@apple.com>
984
985         [Xcode] Enable CLANG_WARN_NON_LITERAL_NULL_CONVERSION
986         https://bugs.webkit.org/show_bug.cgi?id=174631
987
988         Reviewed by Dan Bernstein.
989
990         * Configurations/Base.xcconfig:
991
992 2017-07-18  Matt Lewis  <jlewis3@apple.com>
993
994         Unreviewed, rolling out r219610.
995
996         This caused an api failure on all platforms for the test
997         SnapshotImageLargeAsyncDecoding
998
999         Reverted changeset:
1000
1001         "Async image decoding for large images should be disabled
1002         after the first time a tile is painted"
1003         https://bugs.webkit.org/show_bug.cgi?id=174451
1004         http://trac.webkit.org/changeset/219610
1005
1006 2017-07-18  Andy Estes  <aestes@apple.com>
1007
1008         [Xcode] Enable CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING
1009         https://bugs.webkit.org/show_bug.cgi?id=174631
1010
1011         Reviewed by Darin Adler.
1012
1013         * Configurations/Base.xcconfig:
1014
1015 2017-07-18  Said Abou-Hallawa  <sabouhallawa@apple.com>
1016
1017         Async image decoding for large images should be disabled after the first time a tile is painted
1018         https://bugs.webkit.org/show_bug.cgi?id=174451
1019
1020         Reviewed by Simon Fraser.
1021
1022         * Shared/mac/RemoteLayerBackingStore.mm:
1023         (WebKit::RemoteLayerBackingStore::drawInContext):
1024         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
1025         (WebKit::CompositingCoordinator::paintContents):
1026         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
1027
1028 2017-07-17  Carlos Garcia Campos  <cgarcia@igalia.com>
1029
1030         Web Automation: link and partial link queries don't work if text link contains trailing or leading whitespaces
1031         https://bugs.webkit.org/show_bug.cgi?id=174499
1032
1033         Reviewed by Brian Burg.
1034
1035         This is causing test test_Driver_Can_Get_Link_By_Link_Test_Ignoring_Trailing_Whitespace to fail.
1036
1037         * UIProcess/Automation/atoms/FindNodes.js:
1038         (switch): Use normalize-space() in in the links xpath expressions.
1039
1040 2017-07-17  Darin Adler  <darin@apple.com>
1041
1042         Improve use of NeverDestroyed
1043         https://bugs.webkit.org/show_bug.cgi?id=174348
1044
1045         Reviewed by Sam Weinig.
1046
1047         * DatabaseProcess/DatabaseProcess.h: Removed unneeded include of
1048         NeverDestroyed.h.
1049         * NetworkProcess/cache/NetworkCacheKey.cpp: Ditto.
1050
1051         * NetworkProcess/capture/NetworkCaptureManager.cpp: Moved include of
1052         NeverDestroyed.h here ...
1053         * NetworkProcess/capture/NetworkCaptureManager.h: ... from here.
1054
1055         * PluginProcess/PluginProcess.cpp: Moved include of NeverDestroyed.h
1056         here ...
1057         * PluginProcess/PluginProcess.h: ... from here.
1058
1059         * Shared/API/Cocoa/_WKRemoteObjectInterface.mm:
1060         (isContainerClass): Removed trivial inefficient use of
1061         LazyNeverDestroyed<HashSet> to check against two classes.
1062         Instead wrote out the boolean expression.
1063
1064         * Shared/mac/SecItemShim.cpp: Removed unneeded include of
1065         NeverDestroyed.h.
1066
1067         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1068         (WebKit::WebProcessPool::platformInitialize): Call
1069         installMemoryPressureHandler instead of WebMemoryPressureHandler::singleton.
1070
1071         * UIProcess/Gamepad/UIGamepadProvider.h: Removed unneeded include
1072         of NeverDestroyed.h.
1073
1074         * UIProcess/Plugins/PluginProcessManager.cpp: Moved include of
1075         NeverDestroyed.h here ...
1076         * UIProcess/Plugins/PluginProcessManager.h: ... from here.
1077
1078         * UIProcess/WebInspectorProxy.cpp: Removed unneeded include
1079         of NeverDestroyed.h.
1080
1081         * UIProcess/WebPageProxy.h: Added now-needed include of
1082         MediaPlaybackTargetContext.h.
1083
1084         * UIProcess/WebPasteboardProxy.cpp: Moved include of
1085         NeverDestroyed.h here ...
1086         * UIProcess/WebPasteboardProxy.h: ... from here.
1087
1088         * UIProcess/ios/WebMemoryPressureHandlerIOS.h: Removed the
1089         WebMemoryPressureHandler class from this header. Callers don't need to
1090         know if there is a class. They simply indicate when it's time to install
1091         the handler. Another way to put it is that this class had no functions
1092         other than the singleton function.
1093
1094         * UIProcess/ios/WebMemoryPressureHandlerIOS.mm:
1095         (WebKit::installMemoryPressureHandler): Replaced the class with this function.
1096         It creates a dispatch source and then resumes it. To avoid having the source
1097         look like a leak, we keep it in a global variable.
1098
1099         * WebProcess/Gamepad/WebGamepadProvider.h: Include Forward.h instead of
1100         NeverDestroyed.h.
1101
1102         * WebProcess/WebCoreSupport/WebPasteboardOverrides.cpp: Moved include of
1103         NeverDestroyed.h here ...
1104         * WebProcess/WebCoreSupport/WebPasteboardOverrides.h: ... from here.
1105
1106         * WebProcess/WebCoreSupport/WebPlatformStrategies.h: Removed unneeded
1107         include of NeverDestroyed.h.
1108
1109 2017-07-17  Timothy Horton  <timothy_horton@apple.com>
1110
1111         Page using safe area constant properties jumps to correct layout after resize
1112         https://bugs.webkit.org/show_bug.cgi?id=174598
1113         <rdar://problem/33364275>
1114
1115         Reviewed by Simon Fraser.
1116
1117         Test: fast/events/ios/rotation/safe-area-insets-during-safari-type-rotation.html
1118
1119         * UIProcess/API/Cocoa/WKWebView.mm:
1120         (-[WKWebView _beginAnimatedResizeWithUpdates:]):
1121         * UIProcess/WebPageProxy.h:
1122         * UIProcess/ios/WebPageProxyIOS.mm:
1123         (WebKit::WebPageProxy::dynamicViewportSizeUpdate):
1124         * WebProcess/WebPage/WebPage.h:
1125         * WebProcess/WebPage/WebPage.messages.in:
1126         * WebProcess/WebPage/ios/WebPageIOS.mm:
1127         (WebKit::WebPage::dynamicViewportSizeUpdate):
1128         Plumb unobscured safe area insets through in the dynamicViewportSizeUpdate,
1129         like we do in VisibleContentRectUpdate (once again sad that these aren't
1130         more similar), so that it will be correct in the during-rotation snapshot,
1131         instead of only becoming correct in the first visible content rect update
1132         post-rotation.
1133
1134 2017-07-17  Chris Dumez  <cdumez@apple.com>
1135
1136         UserMediaPermissionRequestManagerProxy should not use WebCore::Timer
1137         https://bugs.webkit.org/show_bug.cgi?id=174599
1138         <rdar://problem/33362600>
1139
1140         Reviewed by Tim Horton.
1141
1142         UserMediaPermissionRequestManagerProxy should not use WebCore::Timer since it runs in the
1143         UIProcess. Switch to using RunLoop::Timer instead.
1144
1145         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1146         (WebKit::UserMediaPermissionRequestManagerProxy::UserMediaPermissionRequestManagerProxy):
1147         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
1148
1149 2017-07-17  Chris Dumez  <cdumez@apple.com>
1150
1151         NETWORK_SESSION does not need didReceiveAuthenticationChallenge(uint64_t, uint64_t, const AuthenticationChallenge&)
1152         https://bugs.webkit.org/show_bug.cgi?id=174595
1153
1154         Reviewed by Alex Christensen.
1155
1156         * Shared/Authentication/AuthenticationManager.cpp:
1157         (WebKit::AuthenticationManager::didReceiveAuthenticationChallenge):
1158         * Shared/Authentication/AuthenticationManager.h:
1159
1160 2017-07-17  Wenson Hsieh  <wenson_hsieh@apple.com>
1161
1162         [iOS DnD] Web process uses too much memory when beginning a drag on a very large image
1163         https://bugs.webkit.org/show_bug.cgi?id=174585
1164         <rdar://problem/33302541>
1165
1166         Reviewed by Tim Horton.
1167
1168         Add IPC support for serializing/deserializing the size of an image written to the pasteboard. See WebCore
1169         ChangeLogs for more details.
1170
1171         * Shared/WebCoreArgumentCoders.cpp:
1172         (IPC::ArgumentCoder<PasteboardImage>::encode):
1173         (IPC::ArgumentCoder<PasteboardImage>::decode):
1174
1175 2017-07-17  Konstantin Tokarev  <annulen@yandex.ru>
1176
1177         Unreviewed attempt to fix Mac cmake build
1178
1179         * PlatformMac.cmake: Remove reference to file which is gone since r219025
1180
1181 2017-07-17  Michael Catanzaro  <mcatanzaro@igalia.com>
1182
1183         [CMake] Include most CMake modules from WebKitCommon.cmake
1184         https://bugs.webkit.org/show_bug.cgi?id=174546
1185
1186         Reviewed by Konstantin Tokarev.
1187
1188         * CMakeLists.txt:
1189
1190 2017-07-17  Michael Catanzaro  <mcatanzaro@igalia.com>
1191
1192         [CMake] Macros in WebKitMacros.cmake should be prefixed with WEBKIT_ namespace
1193         https://bugs.webkit.org/show_bug.cgi?id=174547
1194
1195         Reviewed by Alex Christensen.
1196
1197         * CMakeLists.txt:
1198
1199 2017-07-17  Alex Christensen  <achristensen@webkit.org>
1200
1201         Modernize content extension code
1202         https://bugs.webkit.org/show_bug.cgi?id=174588
1203
1204         Reviewed by Sam Weinig.
1205
1206         * WebProcess/UserContent/WebUserContentController.cpp:
1207         (WebKit::WebUserContentController::addContentRuleLists):
1208
1209 2017-07-17  Jeremy Jones  <jeremyj@apple.com>
1210
1211         Add video fullscreen transition logging.
1212         https://bugs.webkit.org/show_bug.cgi?id=174474
1213
1214         Reviewed by Jer Noble.
1215
1216         No functional change. Just adds logging.
1217
1218         * Platform/Logging.h:
1219         * WebProcess/cocoa/WebVideoFullscreenManager.mm:
1220         (WebKit::WebVideoFullscreenManager::enterVideoFullscreenForVideoElement):
1221         (WebKit::WebVideoFullscreenManager::exitVideoFullscreenForVideoElement):
1222         (WebKit::WebVideoFullscreenManager::exitVideoFullscreenToModeWithoutAnimation):
1223         (WebKit::WebVideoFullscreenManager::didSetupFullscreen):
1224         (WebKit::WebVideoFullscreenManager::didEnterFullscreen):
1225         (WebKit::WebVideoFullscreenManager::didExitFullscreen):
1226         (WebKit::WebVideoFullscreenManager::didCleanupFullscreen):
1227         (WebKit::WebVideoFullscreenManager::setVideoLayerFrameFenced):
1228
1229 2017-07-17  Konstantin Tokarev  <annulen@yandex.ru>
1230
1231         [CMake] Create targets before WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS is called
1232         https://bugs.webkit.org/show_bug.cgi?id=174557
1233
1234         Reviewed by Michael Catanzaro.
1235
1236         * CMakeLists.txt:
1237
1238 2017-07-17  Carlos Garcia Campos  <cgarcia@igalia.com>
1239
1240         Web Automation: link and partial link queries don't work if the link contains formatting tags
1241         https://bugs.webkit.org/show_bug.cgi?id=174498
1242
1243         Reviewed by Brian Burg.
1244
1245         So, for example, if we find links with text "Foo" and there's a link like <a href=""><bA>Foo</b></a> we fail
1246         with no such element error. This causes test test_Link_With_Formatting_Tags to fail.
1247
1248         * UIProcess/Automation/atoms/FindNodes.js:
1249         (switch): Use descendant-or-self::text() instead of just text() in the links xpath expressions.
1250
1251 2017-07-16  Carlos Garcia Campos  <cgarcia@igalia.com>
1252
1253         Web Automation: FindNodes should throw an error in case of invalid strategy
1254         https://bugs.webkit.org/show_bug.cgi?id=174497
1255
1256         Reviewed by Brian Burg.
1257
1258         We are currently returning null or empty list. According to the spec in 12.2 Find Element and 12.3 Find
1259         Elements, step 4: "If location strategy is not present as a keyword in the table of location strategies, return
1260         error with error code invalid argument.".
1261         https://www.w3.org/TR/webdriver/#find-element.
1262
1263         This is causing test test_should_throw_an_error_if_user_passes_in_invalid_by_when_find_elements to fail.
1264
1265         * UIProcess/Automation/atoms/FindNodes.js:
1266         (switch): Throw an error in case of unknown strategy.
1267         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
1268         (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction): Handle InvalidParameter exceptions.
1269
1270 2017-07-16  Brady Eidson  <beidson@apple.com>
1271
1272         Crash when a WKHTTPCookieStore outlives its owning WKWebsiteDataStore.
1273         <rdar://problem/33341730> and https://bugs.webkit.org/show_bug.cgi?id=174574
1274
1275         Reviewed by Tim Horton.
1276
1277         Instead of holding a weak reference to its owning API::WebsiteDataStore,
1278         API::HTTPCookieStore can hold a strong reference to the owner's implementation
1279         WebKit::WebsiteDataStore.
1280         
1281         * UIProcess/API/APIHTTPCookieStore.cpp:
1282         (API::HTTPCookieStore::HTTPCookieStore):
1283         (API::HTTPCookieStore::cookies):
1284         (API::HTTPCookieStore::setCookie):
1285         (API::HTTPCookieStore::deleteCookie):
1286         (API::HTTPCookieStore::registerObserver):
1287         (API::HTTPCookieStore::unregisterObserver):
1288         (API::HTTPCookieStore::cookieManagerDestroyed):
1289         (API::HTTPCookieStore::registerForNewProcessPoolNotifications):
1290         * UIProcess/API/APIHTTPCookieStore.h:
1291
1292 2017-07-15  Brady Eidson  <beidson@apple.com>
1293
1294         Make sure all CFHTTPCookieStorageRefs we create are scheduled.
1295         <rdar://problem/33221110> and https://bugs.webkit.org/show_bug.cgi?id=174513
1296
1297         Reviewed by Tim Horton.
1298
1299         Whenever we create a CFHTTPCookieStorage from identifying data it is unscheduled.
1300         We need to schedule it on the appropriate RunLoop.
1301         
1302         This patch also cleans up the creation of the identifying data itself.
1303         
1304         * NetworkProcess/mac/RemoteNetworkingContext.mm:
1305         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
1306
1307         * Shared/cf/CookieStorageUtilsCF.h: Added.
1308         * Shared/cf/CookieStorageUtilsCF.mm: Added.
1309         (WebKit::cookieStorageFromIdentifyingData):
1310         (WebKit::identifyingDataFromCookieStorage):
1311
1312         * Shared/mac/ChildProcessMac.mm:
1313         (WebKit::ChildProcess::setSharedHTTPCookieStorage):
1314
1315         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1316         (WebKit::WebProcessPool::platformInitializeWebProcess):
1317         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
1318
1319         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1320         (WebKit::WebsiteDataStore::parameters):
1321
1322         * WebKit.xcodeproj/project.pbxproj:
1323
1324         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
1325         (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession):
1326
1327 2017-07-15  Wenson Hsieh  <wenson_hsieh@apple.com>
1328
1329         [iOS WK2] Presenting an action sheet on an image map prevents selection UI from updating
1330         https://bugs.webkit.org/show_bug.cgi?id=174539
1331         <rdar://problem/33307395>
1332
1333         Reviewed by Darin Adler.
1334
1335         Small tweak to avoid presenting at the element rect or text rect if the interaction information failed to
1336         capture valid bounds for the element. We instead fall back to presenting at the touch location. This addresses
1337         problems when presenting the action sheet popover on image maps on iPad, where GetPositionInformation fails to
1338         capture correct data about for the <area>.
1339
1340         * UIProcess/ios/WKActionSheetAssistant.mm:
1341         (presentationStyleForView):
1342
1343 2017-07-14  Jonathan Bedard  <jbedard@apple.com>
1344
1345         Add iOS 11 SPI
1346         https://bugs.webkit.org/show_bug.cgi?id=174430
1347         <rdar://problem/33269288>
1348
1349         Reviewed by Tim Horton.
1350
1351         * Platform/spi/ios/UIKitSPI.h: Add drag-and-drop SPI for iOS 11.
1352         * UIProcess/ios/WKContentViewInteraction.mm: Move UIKit SPI to UIKitSPI.h.
1353
1354 2017-07-14  Jeff Miller  <jeffm@apple.com>
1355
1356         -[WKWebProcessBundleParameters setParametersForKeyWithDictionary:] passing wrong parameters to -setParameter:forKey
1357         https://bugs.webkit.org/show_bug.cgi?id=174524
1358
1359         Reviewed by Sam Weinig.
1360
1361         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessBundleParameters.mm:
1362         (-[WKWebProcessBundleParameters setParametersForKeyWithDictionary:]):
1363         Pass the dictionary key and value in the correct order.
1364
1365 2017-07-14  Brent Fulgham  <bfulgham@apple.com>
1366
1367         Monitor directory for new statistics files after a delete operation
1368         https://bugs.webkit.org/show_bug.cgi?id=174521
1369         <rdar://problem/33322189>
1370
1371         Reviewed by Chris Dumez.
1372
1373         Create a FileMonitor to watch the data directory when the statistics file is
1374         deleted by an external process. If it sees the file get created externally, merge
1375         those data into the in-memory store.
1376
1377         * UIProcess/Storage/ResourceLoadStatisticsPersistentStorage.cpp:
1378         (WebKit::ResourceLoadStatisticsPersistentStorage::startMonitoringDisk): Added.
1379         (WebKit::ResourceLoadStatisticsPersistentStorage::monitorDirectoryForNewStatistics):
1380         * UIProcess/Storage/ResourceLoadStatisticsPersistentStorage.h:
1381
1382 2017-07-14  Matt Lewis  <jlewis3@apple.com>
1383
1384         Unreviewed, rolling out r219516.
1385
1386         This caused an API failure on macOS.
1387
1388         Reverted changeset:
1389
1390         "Make sure all CFHTTPCookieStorageRefs we create are
1391         scheduled."
1392         https://bugs.webkit.org/show_bug.cgi?id=174513
1393         http://trac.webkit.org/changeset/219516
1394
1395 2017-07-14  Daniel Bates  <dabates@apple.com>
1396
1397         REGRESSION (r219013): Compute source frame info for frameless document
1398         https://bugs.webkit.org/show_bug.cgi?id=174385
1399         <rdar://problem/33217736>
1400
1401         Reviewed by Brady Eidson.
1402
1403         Fixes an issue where we would crash in WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction()
1404         when computing the frame info for a now-frameless document. One way this can happen is when the frame
1405         that contains the document that initiated the navigation is removed from the page.
1406
1407         * UIProcess/WebPageProxy.cpp:
1408         (WebKit::WebPageProxy::decidePolicyForNavigationAction): Check that we have a valid page ID before
1409         looking up the WebPage object corresponding to it.
1410         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1411         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): Compute a FrameInfoData
1412         object from the source document directly as opposed to using WebFrame::info() as the latter requires
1413         that we have a valid WebCore frame and the source document may not have a frame.
1414
1415 2017-07-14  Jer Noble  <jer.noble@apple.com>
1416
1417         Allow clients to override their own hardware media requirements where no fallback media exists.
1418         https://bugs.webkit.org/show_bug.cgi?id=174426
1419         <rdar://problem/32537704>
1420
1421         Reviewed by Eric Carlson.
1422
1423         Add a new WKWebViewConfiguration property, as well as a new WKPreferences function, both to control
1424         WebCore's new allowMediaContentTypesRequiringHardwareSupportAsFallback setting.
1425
1426         * Shared/WebPreferencesDefinitions.h:
1427         * UIProcess/API/C/WKPreferences.cpp:
1428         (WKPreferencesGetAllowMediaContentTypesRequiringHardwareSupportAsFallback):
1429         (WKPreferencesSetAllowMediaContentTypesRequiringHardwareSupportAsFallback):
1430         * UIProcess/API/C/WKPreferencesRef.h:
1431         * UIProcess/API/Cocoa/WKWebView.mm:
1432         (-[WKWebView _initializeWithConfiguration:]):
1433         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1434         (-[WKWebViewConfiguration init]):
1435         (-[WKWebViewConfiguration copyWithZone:]):
1436         (-[WKWebViewConfiguration _setAllowMediaContentTypesRequiringHardwareSupportAsFallback:]):
1437         (-[WKWebViewConfiguration _allowMediaContentTypesRequiringHardwareSupportAsFallback]):
1438         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
1439         * WebProcess/WebPage/WebPage.cpp:
1440         (WebKit::WebPage::updatePreferences):
1441
1442 2017-07-14  Chris Dumez  <cdumez@apple.com>
1443
1444         Possible crash under NetworkSocketStream::didFailSocketStream()
1445         https://bugs.webkit.org/show_bug.cgi?id=174526
1446         <rdar://problem/32831441>
1447
1448         Reviewed by Brent Fulgham.
1449
1450         For robustness, initialize the SocketStreamHandleImpl after the other
1451         data members. We are passing |this| to the SocketStreamHandleImpl when
1452         constructing it so it is unsafe to have uninitialized data members
1453         at this point.
1454
1455         * NetworkProcess/NetworkSocketStream.cpp:
1456         (WebKit::NetworkSocketStream::NetworkSocketStream):
1457         * NetworkProcess/NetworkSocketStream.h:
1458
1459 2017-07-14  Michael Catanzaro  <mcatanzaro@igalia.com>
1460
1461         [CMake] Unclear distinction between WebKitHelpers and WebKitMacros
1462         https://bugs.webkit.org/show_bug.cgi?id=153189
1463
1464         Reviewed by Antonio Gomes.
1465
1466         New location for macros that are exclusively needed here.
1467
1468         * CMakeLists.txt:
1469
1470 2017-07-14  Brady Eidson  <beidson@apple.com>
1471
1472         Make sure all CFHTTPCookieStorageRefs we create are scheduled.
1473         <rdar://problem/33221110> and https://bugs.webkit.org/show_bug.cgi?id=174513
1474
1475         Reviewed by Tim Horton.
1476
1477         Whenever we create a CFHTTPCookieStorage from identifying data it is unscheduled.
1478         We need to schedule it on a RunLoop.
1479         
1480         This patch also cleans up the creation of the identifying data itself.
1481         
1482         * NetworkProcess/mac/RemoteNetworkingContext.mm:
1483         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
1484         
1485         * Shared/cf/CookieStorageUtilsCF.cpp: Added.
1486         (WebKit::cookieStorageFromIdentifyingData):
1487         (WebKit::identifyingDataFromCookieStorage):
1488         * Shared/cf/CookieStorageUtilsCF.h: Added.
1489         
1490         * Shared/mac/ChildProcessMac.mm:
1491         (WebKit::ChildProcess::setSharedHTTPCookieStorage):
1492         
1493         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1494         (WebKit::WebProcessPool::platformInitializeWebProcess):
1495         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
1496         
1497         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1498         (WebKit::WebsiteDataStore::parameters):
1499         
1500         * WebKit.xcodeproj/project.pbxproj:
1501         
1502         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
1503         (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession):
1504
1505 2017-07-14  Chris Dumez  <cdumez@apple.com>
1506
1507         Potential null-dereference under NetworkRTCProvider::resolvedName()
1508         https://bugs.webkit.org/show_bug.cgi?id=174507
1509         <rdar://problem/32597868>
1510
1511         Reviewed by Youenn Fablet.
1512
1513         NetworkRTCProvider::resolvedName() could do a null dereference of m_connection
1514         because m_connection is nullified in NetworkRTCProvider::close() but resolvers
1515         were only closed later on in the NetworkRTCProvider destructor.
1516
1517         To address the issue, we now stop DNS resolvers earlier, in NetworkRTCProvider::close().
1518         Also fix unsafe modification of m_resolvers HashMap when iterating over it.
1519
1520         * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
1521         (WebKit::NetworkRTCProvider::~NetworkRTCProvider):
1522         (WebKit::NetworkRTCProvider::close):
1523         (WebKit::NetworkRTCProvider::Resolver::~Resolver):
1524         (WebKit::NetworkRTCProvider::stopResolver):
1525
1526 2017-07-14  Youenn Fablet  <youenn@apple.com>
1527
1528         Report CoreAudioCaptureSource failure in case shared unit stops working properly
1529         https://bugs.webkit.org/show_bug.cgi?id=174494
1530
1531         Reviewed by Eric Carlson.
1532
1533         In case of capture failure, send a CaptureFailure message so that the
1534         correct behavior happens in the Web process.
1535
1536         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
1537         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
1538         (WebKit::UserMediaCaptureManager::captureFailed):
1539         * WebProcess/cocoa/UserMediaCaptureManager.h:
1540         * WebProcess/cocoa/UserMediaCaptureManager.messages.in:
1541
1542 2017-07-13  Chris Dumez  <cdumez@apple.com>
1543
1544         Better deal with changes to the ResourceLoadStatisticsStore file on disk
1545         https://bugs.webkit.org/show_bug.cgi?id=174487
1546
1547         Reviewed by Brent Fulgham.
1548
1549         Rename WebResourceLoadStatisticsStore's resetDataFromDecoder() to mergeWithDataFromDecoder()
1550         and update it so that it actual merges the data from the disk with the one we have in memory,
1551         instead of replacing it. This avoid data loss.
1552
1553         We leverage the existing WebResourceLoadStatisticsStore::mergeStatistics() to merge the
1554         statistics.
1555
1556         To faciliate merging the operating dates, they are now represented as OperatingDate objects
1557         instead of WallTime objects. OperatingDate only include date precision, no time information.
1558         As a result, the merge 2 vectors of OperatingDate objects, we can:
1559         1. Merge the 2 sorted vectors (using std::merge())
1560         2. Get rid of duplicates (easy because of date-level precision)
1561         3. Drop old dates until the vector has at most 30 items.
1562
1563         * UIProcess/Storage/ResourceLoadStatisticsPersistentStorage.cpp:
1564         (WebKit::ResourceLoadStatisticsPersistentStorage::refreshMemoryStoreFromDisk):
1565         (WebKit::ResourceLoadStatisticsPersistentStorage::populateMemoryStoreFromDisk):
1566         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1567         (WebKit::OperatingDate::fromWallTime):
1568         (WebKit::OperatingDate::today):
1569         (WebKit::OperatingDate::secondsSinceEpoch):
1570         (WebKit::OperatingDate::operator==):
1571         (WebKit::OperatingDate::operator<):
1572         (WebKit::OperatingDate::operator<=):
1573         (WebKit::OperatingDate::OperatingDate):
1574         (WebKit::mergeOperatingDates):
1575         (WebKit::WebResourceLoadStatisticsStore::createEncoderFromData):
1576         (WebKit::WebResourceLoadStatisticsStore::mergeWithDataFromDecoder):
1577         (WebKit::WebResourceLoadStatisticsStore::includeTodayAsOperatingDateIfNecessary):
1578         (WebKit::WebResourceLoadStatisticsStore::hasStatisticsExpired):
1579         * UIProcess/WebResourceLoadStatisticsStore.h:
1580
1581 2017-07-13  Dan Bernstein  <mitz@apple.com>
1582
1583         Removed empty project directories left behind after the rename
1584
1585         * WebKit2.xcodeproj: Removed.
1586
1587 2017-07-13  Matthew Hanson  <matthew_hanson@apple.com>
1588
1589         Fix the cMake builds (GTK and WPE.)
1590         https://bugs.webkit.org/show_bug.cgi?id=174164
1591         rdar://problem/33137595
1592
1593         Reviewed by Dan Bernstein.
1594
1595         * Scripts/generate-forwarding-headers.pl:
1596         (collectFrameworkHeaderPaths):
1597         (createForwardingHeadersForFramework):
1598
1599 2017-07-13  Matthew Hanson  <matthew_hanson@apple.com>
1600
1601         Rename WebKit2.xcodeproj to WebKit.xcodeproj.
1602         https://bugs.webkit.org/show_bug.cgi?id=174164
1603         rdar://problem/33137595
1604
1605         Reviewed by Dan Bernstein.
1606
1607         * WebKit.xcodeproj/project.pbxproj: Renamed from Source/WebKit/WebKit2.xcodeproj/project.pbxproj.
1608
1609 2017-07-13  Matthew Hanson  <matthew_hanson@apple.com>
1610
1611         Update tools and configurations after renaming Source/WebKit2 to Source/WebKit.
1612         https://bugs.webkit.org/show_bug.cgi?id=174164
1613         rdar://problem/33137595
1614
1615         Reviewed by Dan Bernstein.
1616
1617         * PlatformGTK.cmake:
1618         * Shared/API/c/wpe/WebKit.h:
1619
1620 2017-07-13  Michael Catanzaro  <mcatanzaro@igalia.com>
1621
1622         Fix compiler warnings when building with GCC 7
1623         https://bugs.webkit.org/show_bug.cgi?id=174463
1624
1625         Reviewed by Darin Adler.
1626
1627         * Platform/IPC/unix/ConnectionUnix.cpp:
1628         (IPC::Connection::sendOutputMessage):
1629
1630 2017-07-13  Chris Dumez  <cdumez@apple.com>
1631
1632         Moved filesystem code out of WebResourceLoadStatisticsStore class
1633         https://bugs.webkit.org/show_bug.cgi?id=174435
1634
1635         Reviewed by Brent Fulgham.
1636
1637         Moved filesystem code out of WebResourceLoadStatisticsStore class and into
1638         a new ResourceLoadStatisticsPersistentStorage class to decrease complexity.
1639
1640         * CMakeLists.txt:
1641         * UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm:
1642         * UIProcess/Storage/ResourceLoadStatisticsPersistentStorage.cpp: Added.
1643         (WebKit::hasFileChangedSince):
1644         (WebKit::createDecoderForFile):
1645         (WebKit::ResourceLoadStatisticsPersistentStorage::ResourceLoadStatisticsPersistentStorage):
1646         (WebKit::ResourceLoadStatisticsPersistentStorage::~ResourceLoadStatisticsPersistentStorage):
1647         (WebKit::ResourceLoadStatisticsPersistentStorage::storageDirectoryPath):
1648         (WebKit::ResourceLoadStatisticsPersistentStorage::resourceLogFilePath):
1649         (WebKit::ResourceLoadStatisticsPersistentStorage::startMonitoringDisk):
1650         (WebKit::ResourceLoadStatisticsPersistentStorage::stopMonitoringDisk):
1651         (WebKit::ResourceLoadStatisticsPersistentStorage::refreshMemoryStoreFromDisk):
1652         (WebKit::ResourceLoadStatisticsPersistentStorage::populateMemoryStoreFromDisk):
1653         (WebKit::ResourceLoadStatisticsPersistentStorage::writeMemoryStoreToDisk):
1654         (WebKit::ResourceLoadStatisticsPersistentStorage::scheduleOrWriteMemoryStore):
1655         (WebKit::ResourceLoadStatisticsPersistentStorage::clear):
1656         (WebKit::ResourceLoadStatisticsPersistentStorage::finishAllPendingWorkSynchronously):
1657         (WebKit::ResourceLoadStatisticsPersistentStorage::excludeFromBackup):
1658         * UIProcess/Storage/ResourceLoadStatisticsPersistentStorage.h: Added.
1659         * UIProcess/Storage/ios/ResourceLoadStatisticsPersistentStorageIOS.mm: Added.
1660         (WebKit::ResourceLoadStatisticsPersistentStorage::excludeFromBackup):
1661         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1662         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
1663         (WebKit::WebResourceLoadStatisticsStore::processStatisticsAndDataRecords):
1664         (WebKit::WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData):
1665         (WebKit::WebResourceLoadStatisticsStore::applicationWillTerminate):
1666         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
1667         (WebKit::WebResourceLoadStatisticsStore::resetDataFromDecoder):
1668         * UIProcess/WebResourceLoadStatisticsStore.h:
1669         * WebKit2.xcodeproj/project.pbxproj:
1670
1671 2017-07-13  Chris Dumez  <cdumez@apple.com>
1672
1673         Unreviewed, rolling out r219453.
1674
1675         Seems to cause some crashes on the bots
1676
1677         Reverted changeset:
1678
1679         "Moved filesystem code out of WebResourceLoadStatisticsStore
1680         class"
1681         https://bugs.webkit.org/show_bug.cgi?id=174435
1682         http://trac.webkit.org/changeset/219453
1683
1684 2017-07-13  Jeremy Jones  <jeremyj@apple.com>
1685
1686         Fix style. Use #pragma once in VideoFullscreen and PlaybackSession headers.
1687         https://bugs.webkit.org/show_bug.cgi?id=174448
1688
1689         Reviewed by Eric Carlson.
1690
1691         No behavior change.
1692
1693         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h:
1694         * WebProcess/cocoa/WebVideoFullscreenManager.h:
1695
1696 2017-07-13  Jeremy Jones  <jeremyj@apple.com>
1697
1698         Style fix. Replace strongThis with protectedThis.
1699         https://bugs.webkit.org/show_bug.cgi?id=174444
1700
1701         Reviewed by Eric Carlson.
1702
1703         Rename, no behavior change.
1704
1705         * WebProcess/cocoa/WebVideoFullscreenManager.mm:
1706         (WebKit::WebVideoFullscreenManager::didSetupFullscreen):
1707         (WebKit::WebVideoFullscreenManager::didEnterFullscreen):
1708         (WebKit::WebVideoFullscreenManager::didExitFullscreen):
1709         (WebKit::WebVideoFullscreenManager::didCleanupFullscreen):
1710
1711 2017-07-13  Chris Dumez  <cdumez@apple.com>
1712
1713         Moved filesystem code out of WebResourceLoadStatisticsStore class
1714         https://bugs.webkit.org/show_bug.cgi?id=174435
1715
1716         Reviewed by Brent Fulgham.
1717
1718         Moved filesystem code out of WebResourceLoadStatisticsStore class and into
1719         a new ResourceLoadStatisticsPersistentStorage class to decrease complexity.
1720
1721         * CMakeLists.txt:
1722         * UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm:
1723         * UIProcess/Storage/ResourceLoadStatisticsPersistentStorage.cpp: Added.
1724         (WebKit::hasFileChangedSince):
1725         (WebKit::createDecoderForFile):
1726         (WebKit::ResourceLoadStatisticsPersistentStorage::ResourceLoadStatisticsPersistentStorage):
1727         (WebKit::ResourceLoadStatisticsPersistentStorage::~ResourceLoadStatisticsPersistentStorage):
1728         (WebKit::ResourceLoadStatisticsPersistentStorage::storageDirectoryPath):
1729         (WebKit::ResourceLoadStatisticsPersistentStorage::resourceLogFilePath):
1730         (WebKit::ResourceLoadStatisticsPersistentStorage::startMonitoringDisk):
1731         (WebKit::ResourceLoadStatisticsPersistentStorage::stopMonitoringDisk):
1732         (WebKit::ResourceLoadStatisticsPersistentStorage::refreshMemoryStoreFromDisk):
1733         (WebKit::ResourceLoadStatisticsPersistentStorage::populateMemoryStoreFromDisk):
1734         (WebKit::ResourceLoadStatisticsPersistentStorage::writeMemoryStoreToDisk):
1735         (WebKit::ResourceLoadStatisticsPersistentStorage::scheduleOrWriteMemoryStore):
1736         (WebKit::ResourceLoadStatisticsPersistentStorage::clear):
1737         (WebKit::ResourceLoadStatisticsPersistentStorage::finishAllPendingWorkSynchronously):
1738         (WebKit::ResourceLoadStatisticsPersistentStorage::excludeFromBackup):
1739         * UIProcess/Storage/ResourceLoadStatisticsPersistentStorage.h: Added.
1740         * UIProcess/Storage/ios/ResourceLoadStatisticsPersistentStorageIOS.mm: Added.
1741         (WebKit::ResourceLoadStatisticsPersistentStorage::excludeFromBackup):
1742         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1743         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
1744         (WebKit::WebResourceLoadStatisticsStore::processStatisticsAndDataRecords):
1745         (WebKit::WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData):
1746         (WebKit::WebResourceLoadStatisticsStore::applicationWillTerminate):
1747         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
1748         (WebKit::WebResourceLoadStatisticsStore::resetDataFromDecoder):
1749         * UIProcess/WebResourceLoadStatisticsStore.h:
1750         * WebKit2.xcodeproj/project.pbxproj:
1751
1752 2017-07-12  Carlos Garcia Campos  <cgarcia@igalia.com>
1753
1754         Web Automation: evaluateJavaScriptFunction should start the callback timeout after the function is applied
1755         https://bugs.webkit.org/show_bug.cgi?id=174421
1756
1757         Reviewed by Brian Burg.
1758
1759         This is causing selenium test testShouldNotTimeoutIfScriptCallsbackInsideAZeroTimeout to fail, because
1760         JavaScriptTimeout error is generated unexpectedly. When no script timeout is specified, 0 is used by default,
1761         which means we do a setTimeout with 0 and then the script does another setTimeout with 0, but ours is dispatched
1762         before and reportTimeoutError is called. We should start our timeout after applying the function, and only if
1763         the result hasn't been reported yet.
1764
1765         * WebProcess/Automation/WebAutomationSessionProxy.js:
1766         (let.AutomationSessionProxy.prototype.evaluateJavaScriptFunction):
1767
1768 2017-07-12  Wenson Hsieh  <wenson_hsieh@apple.com>
1769
1770         [iOS DnD] [WK2] Add SPI to enable, disable, or follow default behavior for DnD on a WKWebView
1771         https://bugs.webkit.org/show_bug.cgi?id=174440
1772         <rdar://problem/33272627>
1773
1774         Reviewed by Beth Dakin.
1775
1776         Adds a new _dragInteractionPolicy property to WKWebView, which an internal client may use to always allow
1777         dragging out of the web view (_WKDragInteractionPolicyAlwaysEnable), never allow
1778         (_WKDragInteractionPolicyAlwaysDisable) or just use the default device-dependent behavior
1779         (_WKDragInteractionPolicyDefault).
1780
1781         Also removes an extraneous class from WKContentViewInteraction.mm that is no longer used anywhere.
1782
1783         * UIProcess/API/Cocoa/WKWebView.mm:
1784         (-[WKWebView _initializeWithConfiguration:]):
1785
1786         Set _dragInteractionPolicy to _WKDragInteractionPolicyDefault upon initialization.
1787
1788         (-[WKWebView _dragInteractionPolicy]):
1789         (-[WKWebView _setDragInteractionPolicy:]):
1790         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1791         * UIProcess/ios/WKContentViewInteraction.h:
1792         * UIProcess/ios/WKContentViewInteraction.mm:
1793         (shouldEnableDragInteractionForPolicy):
1794         (-[WKContentView _didChangeDragInteractionPolicy]):
1795
1796         Called by the WKWebView when its _dragInteractionPolicy changes. The content view updates its
1797         UIDragInteraction's -enabled property here in response.
1798
1799         (-[WKContentView setupDataInteractionDelegates]):
1800
1801 2017-07-12  Said Abou-Hallawa  <sabouhallawa@apple.com>
1802
1803         Async image decoding for large images should be disabled by default
1804         https://bugs.webkit.org/show_bug.cgi?id=174432
1805
1806         Reviewed by Simon Fraser.
1807
1808         -- Replace every reference to GraphicsLayerPaintFlags::Snapshotting by
1809            GraphicsLayerPaintFlags::None and every GraphicsLayerPaintFlags::None
1810            by AllowAsyncImageDecoding.
1811         -- Replace setting the bit PaintBehaviorSnapshotting in an existing PaintBehavoir 
1812            by resetting the bit PaintBehaviorAllowAsyncImageDecoding.
1813
1814         * Shared/mac/RemoteLayerBackingStore.mm:
1815         (WebKit::RemoteLayerBackingStore::drawInContext):
1816         * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
1817         (WebKit::imageForRect):
1818         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
1819         (WebKit::InjectedBundleRangeHandle::renderedImage):
1820
1821 2017-07-12  Eric Carlson  <eric.carlson@apple.com>
1822
1823         [MediaStream] a capture source failure should end the MediaStreamTrack
1824         https://bugs.webkit.org/show_bug.cgi?id=174375
1825
1826         Reviewed by Youenn Fablet.
1827
1828         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1829         (WebKit::UserMediaPermissionRequestManagerProxy::captureStateChanged): Consolidate start/end.
1830         (WebKit::UserMediaPermissionRequestManagerProxy::startedCaptureSession): Deleted.
1831         (WebKit::UserMediaPermissionRequestManagerProxy::endedCaptureSession): Deleted.
1832         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
1833
1834         * UIProcess/WebPageProxy.cpp:
1835         (WebKit::WebPageProxy::isPlayingMediaDidChange): Call captureStateChanged if the capture 
1836         state changes. Consider interrupted flags.
1837
1838 2017-07-12  Daniel Bates  <dabates@apple.com>
1839
1840         NavigationAction should track whether the navigation was initiated by the main frame
1841         https://bugs.webkit.org/show_bug.cgi?id=174386
1842         <rdar://problem/33245267>
1843
1844         Reviewed by Brady Eidson.
1845
1846         * WebProcess/WebPage/WebInspector.cpp:
1847         (WebKit::WebInspector::openInNewTab): Pass whether the load was initiated by the main frame
1848         when instantiating the NavigationAction.
1849
1850 2017-07-12  Daniel Bates  <dabates@apple.com>
1851
1852         Rename NavigationInitiatedByMainFrame to InitiatedByMainFrame
1853         https://bugs.webkit.org/show_bug.cgi?id=174427
1854
1855         Rubber-stamped by Brady Eidson.
1856
1857         * WebProcess/Plugins/PluginView.cpp:
1858         (WebKit::PluginView::loadURL):
1859         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1860         (WebKit::WebFrameLoaderClient::dispatchCreatePage):
1861         * WebProcess/WebPage/WebInspector.cpp:
1862         (WebKit::WebInspector::openInNewTab):
1863
1864 2017-07-12  Matt Lewis  <jlewis3@apple.com>
1865
1866         Unreviewed, rolling out r219401.
1867
1868         This revision rolled out the previous patch, but after talking
1869         with reviewer, a rebaseline is what was needed.Rolling back in
1870         before rebaseline.
1871
1872         Reverted changeset:
1873
1874         "Unreviewed, rolling out r219379."
1875         https://bugs.webkit.org/show_bug.cgi?id=174400
1876         http://trac.webkit.org/changeset/219401
1877
1878 2017-07-12  Daniel Bates  <dabates@apple.com>
1879
1880         Update description of Secure Contexts experimental flag
1881         https://bugs.webkit.org/show_bug.cgi?id=174401
1882
1883         Reviewed by Simon Fraser.
1884
1885         Change the description of the Secure Contexts experimental flag from "isSecureContext attribute"
1886         to "Secure Contexts API".
1887
1888         * Shared/WebPreferencesDefinitions.h:
1889
1890 2017-07-12  Matt Lewis  <jlewis3@apple.com>
1891
1892         Unreviewed, rolling out r219379.
1893
1894         This revision caused a consistent failure in the test
1895         fast/dom/Window/property-access-on-cached-window-after-frame-
1896         removed.html.
1897
1898         Reverted changeset:
1899
1900         "Remove NAVIGATOR_HWCONCURRENCY"
1901         https://bugs.webkit.org/show_bug.cgi?id=174400
1902         http://trac.webkit.org/changeset/219379
1903
1904 2017-07-12  Zan Dobersek  <zdobersek@igalia.com>
1905
1906         [WPE] Use libepoxy
1907         https://bugs.webkit.org/show_bug.cgi?id=172104
1908
1909         Reviewed by Michael Catanzaro.
1910
1911         * PlatformWPE.cmake: Drop the EGL_INCLUDE_DIRS compilation flags.
1912         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
1913         Include <epoxy/gl.h> when compiling with libepoxy usage enabled.
1914
1915 2017-07-12  Carlos Garcia Campos  <cgarcia@igalia.com>
1916
1917         Web Automation: upstream safaridriver's JavaScript atom implementations
1918         https://bugs.webkit.org/show_bug.cgi?id=172060
1919         <rdar://problem/32168187>
1920
1921         Reviewed by Brian Burg.
1922
1923         * UIProcess/Automation/atoms/ElementAttribute.js: Added.
1924         * UIProcess/Automation/atoms/ElementDisplayed.js: Added.
1925         * UIProcess/Automation/atoms/FindNodes.js: Added.
1926         * UIProcess/Automation/atoms/FormElementClear.js: Added.
1927         * UIProcess/Automation/atoms/FormSubmit.js: Added.
1928
1929 2017-07-11  Dean Jackson  <dino@apple.com>
1930
1931         Remove NAVIGATOR_HWCONCURRENCY
1932         https://bugs.webkit.org/show_bug.cgi?id=174400
1933
1934         Reviewed by Sam Weinig.
1935
1936         * Configurations/FeatureDefines.xcconfig:
1937
1938 2017-07-11  Ansh Shukla  <ansh_shukla@apple.com>
1939
1940         WKWindowFeatures needs to expose scrollbar, fullscreen, and dialog configuration properties
1941         https://bugs.webkit.org/show_bug.cgi?id=174239
1942
1943         Reviewed by Brady Eidson.
1944
1945         Add a new private header to expose getters for window feature properties already available
1946         in the TFB APIWindowFeatures class. These properties are necessary for Safari to adopt more
1947         modern API.
1948
1949         * UIProcess/API/Cocoa/WKWindowFeatures.mm:
1950         (-[WKWindowFeatures _locationBarVisibility]):
1951         (-[WKWindowFeatures _scrollbarsVisibility]):
1952         (-[WKWindowFeatures _fullscreenDisplay]):
1953         (-[WKWindowFeatures _dialogDisplay]):
1954         * UIProcess/API/Cocoa/WKWindowFeaturesInternal.h: Expose some window features as read-only
1955         properties.
1956         * UIProcess/API/Cocoa/WKWindowFeaturesPrivate.h:
1957         * WebKit2.xcodeproj/project.pbxproj:
1958
1959 2017-07-11  Chris Dumez  <cdumez@apple.com>
1960
1961         Avoid duplicating default parameter values in [WKWebsiteDataStore _resourceLoadStatisticsResetToConsistentState]
1962         https://bugs.webkit.org/show_bug.cgi?id=174402
1963
1964         Reviewed by Brent Fulgham.
1965
1966         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1967         (-[WKWebsiteDataStore _resourceLoadStatisticsResetToConsistentState]):
1968         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1969         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
1970         (WebKit::WebResourceLoadStatisticsStore::removeDataRecords):
1971         (WebKit::WebResourceLoadStatisticsStore::processStatisticsAndDataRecords):
1972         (WebKit::WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData):
1973         (WebKit::WebResourceLoadStatisticsStore::performDailyTasks):
1974         (WebKit::WebResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
1975         (WebKit::WebResourceLoadStatisticsStore::setTimeToLiveCookiePartitionFree):
1976         (WebKit::WebResourceLoadStatisticsStore::setMinimumTimeBetweenDataRecordsRemoval):
1977         (WebKit::WebResourceLoadStatisticsStore::setGrandfatheringTime):
1978         (WebKit::WebResourceLoadStatisticsStore::shouldRemoveDataRecords):
1979         (WebKit::WebResourceLoadStatisticsStore::shouldPartitionCookies):
1980         (WebKit::WebResourceLoadStatisticsStore::hasStatisticsExpired):
1981         (WebKit::WebResourceLoadStatisticsStore::setMaxStatisticsEntries):
1982         (WebKit::WebResourceLoadStatisticsStore::setPruneEntriesDownTo):
1983         (WebKit::WebResourceLoadStatisticsStore::pruneStatisticsIfNeeded):
1984         (WebKit::WebResourceLoadStatisticsStore::resetParametersToDefaultValues):
1985         * UIProcess/WebResourceLoadStatisticsStore.h:
1986
1987 2017-07-11  Dean Jackson  <dino@apple.com>
1988
1989         Rolling out r219372.
1990
1991         * Configurations/FeatureDefines.xcconfig:
1992
1993 2017-07-11  Dean Jackson  <dino@apple.com>
1994
1995         Remove NAVIGATOR_HWCONCURRENCY
1996         https://bugs.webkit.org/show_bug.cgi?id=174400
1997
1998         Reviewed by Sam Weinig.
1999
2000         * Configurations/FeatureDefines.xcconfig:
2001
2002 2017-07-11  Dean Jackson  <dino@apple.com>
2003
2004         Viewport fit experimental feature should be always on by default
2005         https://bugs.webkit.org/show_bug.cgi?id=174398
2006         <rdar://problem/33248920>
2007
2008         Reviewed by Simon Fraser.
2009
2010         Even though this is experimental, it should be enabled by default, and
2011         not follow the value of DEFAULT_EXPERIMENTAL_FEATURES_ENABLED.
2012
2013         * Shared/WebPreferencesDefinitions.h:
2014
2015 2017-07-11  Adrian Perez de Castro  <aperez@igalia.com>
2016
2017         Fix typo: ContentRuleListStore::nonLegacyDdefaultStore()
2018         https://bugs.webkit.org/show_bug.cgi?id=174387
2019
2020         Reviewed by Michael Catanzaro.
2021
2022         Rename nonLegacyDdefaultStore() to nonLegacyDefaultStore().
2023
2024         * UIProcess/API/APIContentRuleListStore.cpp:
2025         (API::ContentRuleListStore::nonLegacyDefaultStore):
2026         (API::ContentRuleListStore::defaultStore):
2027         * UIProcess/API/APIContentRuleListStore.h:
2028
2029 2017-07-11  Chris Dumez  <cdumez@apple.com>
2030
2031         Simplify primary domain lambda captures in WebResourceLoadStatisticsStore
2032         https://bugs.webkit.org/show_bug.cgi?id=174381
2033
2034         Reviewed by Brent Fulgham.
2035
2036         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2037         (WebKit::isolatedPrimaryDomain):
2038         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
2039         (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction):
2040         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
2041         (WebKit::WebResourceLoadStatisticsStore::setLastSeen):
2042         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResource):
2043         (WebKit::WebResourceLoadStatisticsStore::isPrevalentResource):
2044         (WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource):
2045         (WebKit::WebResourceLoadStatisticsStore::setGrandfathered):
2046         (WebKit::WebResourceLoadStatisticsStore::isGrandfathered):
2047         (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin):
2048         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin):
2049         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo):
2050         (WebKit::primaryDomain): Deleted.
2051
2052 2017-07-11  Timothy Hatcher  <timothy@hatcher.name>
2053
2054         Fix a build failure in WebDragClient when !PLATFORM(COCOA) && !PLATFORM(GTK).
2055         https://bugs.webkit.org/show_bug.cgi?id=174372
2056
2057         Reviewed by Beth Dakin.
2058
2059         * WebProcess/WebCoreSupport/WebDragClient.cpp:
2060         (WebKit::WebDragClient::didConcludeEditDrag): Added empty method.
2061
2062 2017-07-11  Brent Fulgham  <bfulgham@apple.com>
2063
2064         Reset cookie partitioning state after network process crashes
2065         https://bugs.webkit.org/show_bug.cgi?id=174306
2066         <rdar://problem/33171605>
2067
2068         Reviewed by Chris Dumez.
2069
2070         * UIProcess/Storage/ResourceLoadStatisticsStore.cpp:
2071         (WebKit::ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler): Move cookie
2072         partioning state code to helper function.
2073         (WebKit::ResourceLoadStatisticsStore::resetPartitionCookiesState): Added.
2074         * UIProcess/Storage/ResourceLoadStatisticsStore.h:
2075         * UIProcess/WebProcessPool.cpp:
2076         (WebKit::WebProcessPool::ensureNetworkProcess): Inform the statistics store that
2077         the network process crashed.
2078         (WebKit::WebProcessPool::terminateNetworkProcess): Mark network process as crashed.
2079         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2080         (WebKit::WebResourceLoadStatisticsStore::networkProcessDidCrash): Reset the cookie
2081         partitioning state after a crash.
2082         * UIProcess/WebResourceLoadStatisticsStore.h:
2083         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2084         (WebKit::WebsiteDataStore::notifyResourceLoadStatisticsNetworkProcessDidCrash): Relay
2085         information to the statistics store.
2086         * UIProcess/WebsiteData/WebsiteDataStore.h:
2087
2088 2017-07-11  Timothy Hatcher  <timothy@hatcher.name>
2089
2090         Fix broken build when !ENABLE(INDEXED_DATABASE)
2091         https://bugs.webkit.org/show_bug.cgi?id=174370
2092
2093         Reviewed by Alex Christensen.
2094
2095         * UIProcess/WebProcessPool.cpp:
2096         (WebKit::WebProcessPool::pageAddedToProcess):
2097
2098 2017-07-11  Youenn Fablet  <youenn@apple.com>
2099
2100         Changing the web page muted state for playing audio should not disable other tabs capture
2101         https://bugs.webkit.org/show_bug.cgi?id=174349
2102
2103         Unreviewed.
2104
2105         * UIProcess/WebPageProxy.cpp:
2106         (WebKit::WebPageProxy::activateMediaStreamCaptureInPage): Fixes non MEDIA_STREAM builds.
2107
2108 2017-07-11  Wenson Hsieh  <wenson_hsieh@apple.com>
2109
2110         Address post-review feedback after http://trac.webkit.org/r219310
2111         https://bugs.webkit.org/show_bug.cgi?id=174300
2112         <rdar://problem/33030639>
2113
2114         Reviewed by Simon Fraser.
2115
2116         Removes plumbing introduced in r219310 for telling WKContentView when the user has finished panning or zooming.
2117         This was previously used to reset allowing asynchronous touch event after preventing the web touch events
2118         gesture recognizer from firing.
2119
2120         However, a far simpler (and much less fragile) solution is to just set _canSendTouchEventsAsynchronously to NO
2121         at the beginning of the gesture, before the first `touchstart` event is dispatched. This way, we always ensure
2122         that _canSendTouchEventsAsynchronously is NO when beginning to process a touch event. This approach is correct
2123         because the only place where we query _canSendTouchEventsAsynchronously is in -_webTouchEventsRecognized:, where
2124         (when we are beginning a new gesture) we are guaranteed that -gestureRecognizer:shouldIgnoreWebTouchWithEvent:
2125         has already been called and _canSendTouchEventsAsynchronously is NO.
2126
2127         Confirmed that the LayoutTests added in r219310 still pass.
2128
2129         * UIProcess/API/Cocoa/WKWebView.mm:
2130         (-[WKWebView scrollViewDidEndDragging:willDecelerate:]):
2131         (-[WKWebView scrollViewDidEndZooming:withView:atScale:]):
2132         * UIProcess/PageClient.h:
2133         * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h:
2134         * UIProcess/Scrolling/RemoteScrollingTree.cpp:
2135         (WebKit::RemoteScrollingTree::scrollingTreeNodeDidEndPanGesture): Deleted.
2136         * UIProcess/Scrolling/RemoteScrollingTree.h:
2137         * UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
2138         * UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
2139         (-[WKOverflowScrollViewDelegate scrollViewDidEndDragging:willDecelerate:]):
2140         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::overflowScrollViewDidEndPanGesture): Deleted.
2141         * UIProcess/WebPageProxy.h:
2142         * UIProcess/ios/PageClientImplIOS.h:
2143         * UIProcess/ios/PageClientImplIOS.mm:
2144         (WebKit::PageClientImpl::overflowScrollViewDidEndPanGesture): Deleted.
2145         * UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm:
2146         (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidEndPanGesture): Deleted.
2147         * UIProcess/ios/WKContentViewInteraction.h:
2148         * UIProcess/ios/WKContentViewInteraction.mm:
2149         (-[WKContentView gestureRecognizer:shouldIgnoreWebTouchWithEvent:]):
2150         (-[WKContentView scrollViewDidEndPanOrPinchGesture]): Deleted.
2151         * UIProcess/ios/WebPageProxyIOS.mm:
2152         (WebKit::WebPageProxy::overflowScrollViewDidEndPanGesture): Deleted.
2153
2154 2017-07-11  Brent Fulgham  <bfulgham@apple.com>
2155
2156         Unreviewed clean-up after r219323
2157
2158         Simplify algorithm slightly based on a suggestion Chris Dumez made in the review.
2159
2160         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2161         (WebKit::pruneResources): Don't create a second variable to track the pruning operation.
2162
2163 2017-07-11  Alex Christensen  <achristensen@webkit.org>
2164
2165         SharedBuffer::size should return a size_t
2166         https://bugs.webkit.org/show_bug.cgi?id=174328
2167
2168         Reviewed by Andreas Kling.
2169
2170         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2171         (WebKit::WebResourceLoadStatisticsStore::writeEncoderToDisk):
2172
2173 2017-07-11  Youenn Fablet  <youenn@apple.com>
2174
2175         We should do ICE candidate filtering at the Document level
2176         https://bugs.webkit.org/show_bug.cgi?id=173861
2177         <rdar://problem/33122058>
2178
2179         Reviewed by Eric Carlson.
2180
2181         Removing ICE candidate filtering handling at UIProcess level.
2182         ICE candidate filtering is now disabled at UserMediaRequest level.
2183         WebPage forwards the ICE candidate filtering option to the page so as to set
2184         the default option correctly for every document of the page.
2185
2186         * UIProcess/UserMediaProcessManager.cpp:
2187         (WebKit::UserMediaProcessManager::willCreateMediaStream):
2188         (WebKit::UserMediaProcessManager::endedCaptureSession):
2189         * WebProcess/WebPage/WebPage.cpp:
2190         (WebKit::WebPage::disableICECandidateFiltering):
2191         (WebKit::WebPage::enableICECandidateFiltering):
2192
2193 2017-07-11  Youenn Fablet  <youenn@apple.com>
2194
2195         Changing the web page muted state for playing audio should not disable other tabs capture
2196         https://bugs.webkit.org/show_bug.cgi?id=174349
2197         rdar://problem/33223988
2198
2199         Reviewed by Eric Carlson.
2200
2201         Make sure to mute capturing streams of any other tab if the current tab will start capturing or will unmute existing capturing streams.
2202         Manually tested by having a tab doing capture and another tab playing a video.
2203         Muting or unmuting the tab playing video should not change the capture tab.
2204
2205         * UIProcess/WebPageProxy.cpp:
2206         (WebKit::WebPageProxy::activateMediaStreamCaptureInPage):
2207         (WebKit::WebPageProxy::setMuted):
2208         * UIProcess/WebPageProxy.h:
2209         (WebKit::WebPageProxy::activateMediaStreamCaptureInPage):
2210
2211 2017-07-11  Youenn Fablet  <youenn@apple.com>
2212
2213         NetworkProcess should close listening WebRTC sockets when being suspended
2214         https://bugs.webkit.org/show_bug.cgi?id=174270
2215         rdar://problem/33139844
2216
2217         Reviewed by Chris Dumez.
2218
2219         To prevent potential spinning of the NetworkProcess, NetworkProcess will now close listening sockets when being notified that it will be suspended.
2220         When the network process is being suspended, it will stop creating listening sockets, until it resumes.
2221         Future additional efforts might be to improve select/cancel so that we can stop listening sockets at resume time,
2222         or to reimplement part of the stack using CFStream.
2223
2224         Tested through manual testing by going to a website doing WebRTC, homing out so that the network process is suspended and reopening Safari.
2225
2226         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2227         (WebKit::NetworkConnectionToWebProcess::cleanupForSuspension):
2228         Proxying call to clean for suspension to rtc provider so that it will
2229         close listening sockets.
2230         (WebKit::NetworkConnectionToWebProcess::resumeFromSuspension): Authorizing back listening sockets.
2231         * NetworkProcess/NetworkConnectionToWebProcess.h:
2232         (WebKit::NetworkConnectionToWebProcess::cleanupForSuspension):
2233         Clean-up is done asynchronously as it can happen in background threads.
2234         Hence why passing a callback as parameter.
2235         * NetworkProcess/NetworkProcess.cpp:
2236         (WebKit::NetworkProcess::notifyProcessReadyToSuspend): Helper routine
2237         to notify UI process that network process clean up is done.
2238         (WebKit::TaskCounter::TaskCounter): Helper class to call notifyProcessReadyToSuspend when sded.
2239         (WebKit::TaskCounter::~TaskCounter):
2240         (WebKit::NetworkProcess::actualPrepareToSuspend): Doing the clean-up for each connection that needs it.
2241         Making sure to notify UI process of clean-up being completed once all connections are cleaned.
2242         (WebKit::NetworkProcess::processWillSuspendImminently):
2243         (WebKit::NetworkProcess::prepareToSuspend):
2244         (WebKit::NetworkProcess::processDidResume): Reenable listening sockets.
2245         * NetworkProcess/NetworkProcess.h:
2246         * NetworkProcess/webrtc/LibWebRTCSocketClient.cpp:
2247         (WebKit::LibWebRTCSocketClient::LibWebRTCSocketClient):
2248         * NetworkProcess/webrtc/LibWebRTCSocketClient.h: Adding type getter and making close public.
2249         Used by NetworkRTCProvider to identifiy listening sockets and close them.
2250         * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
2251         (WebKit::NetworkRTCProvider::closeListeningSockets): We close the webrtc socket
2252         and we also notify the Web Process that the socket is closed so that it can take actions to recreate some if needed.
2253         (WebKit::NetworkRTCProvider::finishClosingListeningSockets):
2254         * NetworkProcess/webrtc/NetworkRTCProvider.h:
2255         (WebKit::NetworkRTCProvider::authorizeListeningSockets): Authorize creation of listening sockets.
2256
2257 2017-07-10  Brent Fulgham  <bfulgham@apple.com>
2258
2259         Resource Load Statistics: Prune statistics in orders of importance
2260         https://bugs.webkit.org/show_bug.cgi?id=174215
2261         <rdar://problem/33164403>
2262
2263         Unreviewed test correction.
2264
2265         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2266         (WebKit::pruneResources): The revised algorithm did not update the remaining
2267         count to be pruned, causing a test failure.
2268
2269 2017-07-10  John Wilander  <wilander@apple.com>
2270
2271         Resource Load Statistics: Prune statistics in orders of importance
2272         https://bugs.webkit.org/show_bug.cgi?id=174215
2273         <rdar://problem/33164403>
2274
2275         Reviewed by Chris Dumez.
2276
2277         New functionality. Prunes statistics in this order:
2278         1. Non-prevalent resources without user interaction.
2279         2. Prevalent resources without user interaction.
2280         3. Non-prevalent resources with user interaction.
2281         4. Prevalent resources with user interaction.
2282
2283         * Shared/WebCoreArgumentCoders.cpp:
2284         (IPC::ArgumentCoder<ResourceLoadStatistics>::encode):
2285         (IPC::ArgumentCoder<ResourceLoadStatistics>::decode):
2286             Added timestamp field lastSeen.
2287         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2288         (-[WKWebsiteDataStore _resourceLoadStatisticsSetLastSeen:forHost:]):
2289         (-[WKWebsiteDataStore _resourceLoadStatisticsSetMaxStatisticsEntries:]):
2290         (-[WKWebsiteDataStore _resourceLoadStatisticsSetPruneEntriesDownTo:]):
2291         (-[WKWebsiteDataStore _resourceLoadStatisticsResetToConsistentState]):
2292             Test infrastructure.
2293         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
2294         * UIProcess/Storage/ResourceLoadStatisticsStore.cpp:
2295         (WebKit::ResourceLoadStatisticsStore::setMaxStatisticsEntries):
2296             Test infrastructure.
2297         (WebKit::ResourceLoadStatisticsStore::setPruneEntriesDownTo):
2298             Test infrastructure.
2299         (WebKit::sortAndPrune):
2300             Convenience function.
2301         (WebKit::ResourceLoadStatisticsStore::pruneStatisticsIfNeeded):
2302             The new pruning function.
2303         * UIProcess/Storage/ResourceLoadStatisticsStore.h:
2304         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2305         (WebKit::WebResourceLoadStatisticsStore::processStatisticsAndDataRecords):
2306             Now calls ResourceLoadStatisticsStore::pruneStatisticsIfNeeded().
2307         (WebKit::WebResourceLoadStatisticsStore::setLastSeen):
2308             Test infrastructure.
2309         (WebKit::WebResourceLoadStatisticsStore::setMaxStatisticsEntries):
2310             Test infrastructure.
2311         (WebKit::WebResourceLoadStatisticsStore::setPruneEntriesDownTo):
2312             Test infrastructure.
2313         * UIProcess/WebResourceLoadStatisticsStore.h:
2314
2315 2017-07-10  Dean Jackson  <dino@apple.com>
2316
2317         const() experimental feature should always be on by default
2318         https://bugs.webkit.org/show_bug.cgi?id=174341
2319         <rdar://problem/33228603>
2320
2321         Reviewed by Simon Fraser.
2322
2323         Even though this is experimental, it should be enabled by default, and
2324         not follow the value of DEFAULT_EXPERIMENTAL_FEATURES_ENABLED.
2325
2326         * Shared/WebPreferencesDefinitions.h:
2327
2328 2017-07-10  Chris Dumez  <cdumez@apple.com>
2329
2330         [iOS] _didCommitLayerTree should avoid calling [scrollView setZoomScale] unnecessarily
2331         https://bugs.webkit.org/show_bug.cgi?id=174326
2332         <rdar://problem/33150490>
2333
2334         Reviewed by Simon Fraser.
2335
2336         Only call [scrollView setZoomScale] if the new zoom scale is actually different to
2337         avoid doing unnecessary work in UIKit.
2338
2339         * UIProcess/API/Cocoa/WKWebView.mm:
2340         (-[WKWebView _didCommitLayerTree:]):
2341
2342 2017-07-10  Chris Dumez  <cdumez@apple.com>
2343
2344         Merge ResourceLoadStatisticsStore into WebResourceLoadStatisticsStore
2345         https://bugs.webkit.org/show_bug.cgi?id=174203
2346
2347         Reviewed by Brent Fulgham.
2348
2349         Merge ResourceLoadStatisticsStore into WebResourceLoadStatisticsStore. The 2 classes
2350         have a similar purpose and there is no clean separation between the 2. It makes more
2351         sense to have a single store class for resource load statistics.
2352
2353         If we want to simplify the WebResourceLoadStatisticsStore class, I think it'd make
2354         more sense to split the file system I/O code out. This code adds quite a bit of
2355         complexity.
2356
2357         * CMakeLists.txt:
2358         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2359         (-[WKWebsiteDataStore _resourceLoadStatisticsUpdateCookiePartitioning]):
2360         (-[WKWebsiteDataStore _resourceLoadStatisticsSetShouldPartitionCookies:forHost:]):
2361         (-[WKWebsiteDataStore _resourceLoadStatisticsClearInMemoryAndPersistentStore]):
2362         (-[WKWebsiteDataStore _resourceLoadStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours:]):
2363         (-[WKWebsiteDataStore _resourceLoadStatisticsResetToConsistentState]):
2364         * UIProcess/Storage/ResourceLoadStatisticsStore.cpp: Removed.
2365         * UIProcess/Storage/ResourceLoadStatisticsStore.h: Removed.
2366         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2367         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
2368         (WebKit::WebResourceLoadStatisticsStore::removeDataRecords):
2369         (WebKit::WebResourceLoadStatisticsStore::processStatisticsAndDataRecords):
2370         (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
2371         (WebKit::WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData):
2372         (WebKit::WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded):
2373         (WebKit::WebResourceLoadStatisticsStore::refreshFromDisk):
2374         (WebKit::WebResourceLoadStatisticsStore::writeStoreToDisk):
2375         (WebKit::WebResourceLoadStatisticsStore::startMonitoringStatisticsStorage):
2376         (WebKit::WebResourceLoadStatisticsStore::performDailyTasks):
2377         (WebKit::WebResourceLoadStatisticsStore::submitTelemetry):
2378         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
2379         (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction):
2380         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
2381         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResource):
2382         (WebKit::WebResourceLoadStatisticsStore::isPrevalentResource):
2383         (WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource):
2384         (WebKit::WebResourceLoadStatisticsStore::setGrandfathered):
2385         (WebKit::WebResourceLoadStatisticsStore::isGrandfathered):
2386         (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin):
2387         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin):
2388         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo):
2389         (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdate):
2390         (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdateForDomains):
2391         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemory):
2392         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
2393         (WebKit::WebResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
2394         (WebKit::WebResourceLoadStatisticsStore::setTimeToLiveCookiePartitionFree):
2395         (WebKit::WebResourceLoadStatisticsStore::setGrandfatheringTime):
2396         (WebKit::WebResourceLoadStatisticsStore::ensureResourceStatisticsForPrimaryDomain):
2397         (WebKit::WebResourceLoadStatisticsStore::createEncoderFromData):
2398         (WebKit::WebResourceLoadStatisticsStore::populateFromDecoder):
2399         (WebKit::WebResourceLoadStatisticsStore::clearInMemory):
2400         (WebKit::WebResourceLoadStatisticsStore::mergeStatistics):
2401         (WebKit::WebResourceLoadStatisticsStore::shouldPartitionCookies):
2402         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioning):
2403         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains):
2404         (WebKit::WebResourceLoadStatisticsStore::processStatistics):
2405         (WebKit::WebResourceLoadStatisticsStore::hasHadUnexpiredRecentUserInteraction):
2406         (WebKit::WebResourceLoadStatisticsStore::topPrivatelyControlledDomainsToRemoveWebsiteDataFor):
2407         (WebKit::WebResourceLoadStatisticsStore::includeTodayAsOperatingDateIfNecessary):
2408         (WebKit::WebResourceLoadStatisticsStore::hasStatisticsExpired):
2409         * UIProcess/WebResourceLoadStatisticsStore.h:
2410         * UIProcess/WebResourceLoadStatisticsTelemetry.cpp:
2411         (WebKit::sortedPrevalentResourceTelemetry):
2412         (WebKit::WebResourceLoadStatisticsTelemetry::calculateAndSubmit):
2413         * UIProcess/WebResourceLoadStatisticsTelemetry.h:
2414         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2415         (WebKit::WebsiteDataStore::removeData):
2416         * WebKit2.xcodeproj/project.pbxproj:
2417
2418 2017-07-10  Wenson Hsieh  <wenson_hsieh@apple.com>
2419
2420         [WK2] Ignore touch events that interrupt platform-driven momentum scrolling
2421         https://bugs.webkit.org/show_bug.cgi?id=174300
2422         <rdar://problem/33030639>
2423
2424         Reviewed by Simon Fraser.
2425
2426         Adds support for immediately failing WKContentView's UIWebTouchEventsGestureRecognizer if any touch interrupts
2427         scroll view deceleration. Covered by 3 new LayoutTests (see Source/WebCore/ChangeLog).
2428
2429         * Platform/spi/ios/UIKitSPI.h:
2430         * UIProcess/API/Cocoa/WKWebView.mm:
2431         (-[WKWebView scrollViewDidEndDragging:willDecelerate:]):
2432         (-[WKWebView scrollViewDidEndZooming:withView:atScale:]):
2433         * UIProcess/PageClient.h:
2434         * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h:
2435         * UIProcess/Scrolling/RemoteScrollingTree.cpp:
2436         (WebKit::RemoteScrollingTree::scrollingTreeNodeDidEndPanGesture):
2437         * UIProcess/Scrolling/RemoteScrollingTree.h:
2438         * UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
2439         * UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
2440         (-[WKOverflowScrollViewDelegate scrollViewDidEndDragging:willDecelerate:]):
2441         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::overflowScrollViewDidEndPanGesture):
2442
2443         Adds plumbing in the UI process to alert the WKContentView when scroll view dragging has ended in an overflow
2444         momentum scrolling region (tracked by an overflow scrolling tree node). This parallels UI process plumbing for
2445         ScrollingTreeOverflowScrollingNodeIOS::overflowScrollViewWillStartPanGesture.
2446
2447         * UIProcess/WebPageProxy.h:
2448         * UIProcess/ios/PageClientImplIOS.h:
2449         * UIProcess/ios/PageClientImplIOS.mm:
2450         (WebKit::PageClientImpl::overflowScrollViewDidEndPanGesture):
2451         * UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm:
2452         (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidEndPanGesture):
2453         * UIProcess/ios/WKContentViewInteraction.h:
2454         * UIProcess/ios/WKContentViewInteraction.mm:
2455         (-[WKContentView scrollViewDidEndPanOrPinchGesture]):
2456
2457         When the dragging phase of a scroll gesture ends, ensure that _canSendTouchEventsAsynchronously is reset to NO.
2458         When touches are not being prevented, this flag is set to YES in -scrollViewWillStartPanOrPinchGesture: and
2459         normally reset to NO in -_webTouchEventsRecognized: after all touch points have been released. However, in the
2460         case where we've prematurely failed the web touch events gesture recognizer after -touchesBegan:,
2461         -_webTouchEventsRecognized: will not be called again in a state where all touches have been released. Thus, we
2462         also need to bookend the place where we begin allowing async touch event dispatch in
2463         -scrollViewWillStartPanOrPinchGesture by disallowing async touch event dispatch in
2464         -scrollViewDidEndPanOrPinchGesture.
2465
2466         This has no impact in the normal case where the user scrolls without momentum, since
2467         -scrollViewDidEndPanOrPinchGesture will fire after async touch events have already been disallowed in
2468         -_webTouchEventsRecognized:, and in the case where the page prevents default on touches, scrolling doesn't
2469         happen anyways, so neither scrollViewWillStartPanOrPinchGesture nor scrollViewDidEndPanOrPinchGesture will be
2470         invoked.
2471
2472         (-[WKContentView gestureRecognizer:shouldIgnoreWebTouchWithEvent:]):
2473
2474         Implements a new SPI hook in UIKit. This serves an identical purpose as -shouldIgnoreWebTouch, but additionally
2475         passes the triggering UIEvent, as well as the gesture recognizer itself (following standard convention for
2476         Objective C delegate methods). Here, we return YES in the case where one or more of the touches recognized by
2477         the gesture is currently interrupting scroll deceleration.
2478
2479         * UIProcess/ios/WebPageProxyIOS.mm:
2480         (WebKit::WebPageProxy::overflowScrollViewDidEndPanGesture):
2481
2482 2017-07-10  Brent Fulgham  <bfulgham@apple.com>
2483
2484         [WK2][macOS] Allow access to com.apple.cfnetwork.cfnetworkagent in the Network Process
2485         https://bugs.webkit.org/show_bug.cgi?id=174320
2486         <rdar://problem/33191856>
2487
2488         Reviewed by Geoffrey Garen.
2489
2490         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
2491
2492 2017-07-10  Megan Gardner  <megan_gardner@apple.com>
2493
2494         Add location to NavigationActionData
2495         https://bugs.webkit.org/show_bug.cgi?id=174233
2496         <rdar://problem/29165518>
2497
2498         Reviewed by Simon Fraser.
2499         
2500         Add the root view location of a tap to a NavigationAction to vend to Safari.
2501
2502         * Shared/NavigationActionData.cpp:
2503         (WebKit::NavigationActionData::encode):
2504         (WebKit::NavigationActionData::decode):
2505         * Shared/NavigationActionData.h:
2506         * UIProcess/API/APINavigationAction.h:
2507         * UIProcess/API/Cocoa/WKNavigationAction.mm:
2508         (-[WKNavigationAction description]):
2509         (-[WKNavigationAction _clickLocationInRootViewCoordinates]):
2510         * UIProcess/API/Cocoa/WKNavigationActionPrivate.h:
2511         * WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp:
2512         (WebKit::clickLocationInRootViewCoordinatesForMouseEvent):
2513         (WebKit::InjectedBundleNavigationAction::clickLocationInRootViewCoordinatesForNavigationAction):
2514         (WebKit::InjectedBundleNavigationAction::InjectedBundleNavigationAction):
2515         * WebProcess/InjectedBundle/InjectedBundleNavigationAction.h:
2516         (WebKit::InjectedBundleNavigationAction::clickLocationInRootViewCoordinates):
2517         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2518         (WebKit::WebChromeClient::createWindow):
2519         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2520         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction):
2521         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2522
2523 2017-07-03  Brian Burg  <bburg@apple.com>
2524
2525         Web Replay: remove some unused code
2526         https://bugs.webkit.org/show_bug.cgi?id=173903
2527
2528         Rubber-stamped by Joseph Pecoraro.
2529
2530         * Configurations/FeatureDefines.xcconfig:
2531         * WebProcess/WebPage/WebPage.cpp:
2532         (WebKit::WebPage::tryClose):
2533         (WebKit::WebPage::loadRequest):
2534         (WebKit::WebPage::stopLoadingFrame):
2535         (WebKit::WebPage::stopLoading):
2536         (WebKit::WebPage::reload):
2537         (WebKit::WebPage::contextMenuAtPointInWindow):
2538         (WebKit::handleContextMenuEvent):
2539         (WebKit::handleMouseEvent):
2540         (WebKit::handleWheelEvent):
2541         (WebKit::handleKeyEvent):
2542         (WebKit::WebPage::scroll):
2543         (WebKit::WebPage::logicalScroll):
2544
2545 2017-07-10  Chris Dumez  <cdumez@apple.com>
2546
2547         Further WebResourceLoadStatisticsStore / ResourceLoadStatisticsStore clean up
2548         https://bugs.webkit.org/show_bug.cgi?id=174301
2549
2550         Reviewed by Brent Fulgham.
2551
2552         General clean up and various simplifications / optimizations to WebResourceLoadStatisticsStore
2553         and ResourceLoadStatisticsStore classes.
2554
2555         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2556         (-[WKWebsiteDataStore _resourceLoadStatisticsUpdateCookiePartitioning]):
2557         (-[WKWebsiteDataStore _resourceLoadStatisticsSetShouldPartitionCookies:forHost:]):
2558         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
2559         * UIProcess/Storage/ResourceLoadStatisticsStore.cpp:
2560         (WebKit::ResourceLoadStatisticsStore::create):
2561         (WebKit::ResourceLoadStatisticsStore::ResourceLoadStatisticsStore):
2562         (WebKit::ResourceLoadStatisticsStore::hasHadRecentUserInteraction):
2563         (WebKit::ResourceLoadStatisticsStore::createEncoderFromData):
2564         (WebKit::ResourceLoadStatisticsStore::populateFromDecoder):
2565         (WebKit::ResourceLoadStatisticsStore::clearInMemory):
2566         (WebKit::ResourceLoadStatisticsStore::mergeStatistics):
2567         (WebKit::ResourceLoadStatisticsStore::updateCookiePartitioning):
2568         (WebKit::ResourceLoadStatisticsStore::updateCookiePartitioningForDomains):
2569         (WebKit::ResourceLoadStatisticsStore::processStatistics):
2570         (WebKit::ResourceLoadStatisticsStore::hasHadUnexpiredRecentUserInteraction):
2571         (WebKit::ResourceLoadStatisticsStore::topPrivatelyControlledDomainsToRemoveWebsiteDataFor):
2572         * UIProcess/Storage/ResourceLoadStatisticsStore.h:
2573         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2574         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
2575         (WebKit::WebResourceLoadStatisticsStore::~WebResourceLoadStatisticsStore):
2576         (WebKit::WebResourceLoadStatisticsStore::removeDataRecords):
2577         (WebKit::WebResourceLoadStatisticsStore::processStatisticsAndDataRecords):
2578         (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
2579         (WebKit::WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData):
2580         (WebKit::WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded):
2581         (WebKit::WebResourceLoadStatisticsStore::refreshFromDisk):
2582         (WebKit::WebResourceLoadStatisticsStore::applicationWillTerminate):
2583         (WebKit::WebResourceLoadStatisticsStore::resourceLogFilePath):
2584         (WebKit::WebResourceLoadStatisticsStore::writeStoreToDisk):
2585         (WebKit::WebResourceLoadStatisticsStore::scheduleOrWriteStoreToDisk):
2586         (WebKit::WebResourceLoadStatisticsStore::writeEncoderToDisk):
2587         (WebKit::WebResourceLoadStatisticsStore::startMonitoringStatisticsStorage):
2588         (WebKit::WebResourceLoadStatisticsStore::platformExcludeFromBackup):
2589         (WebKit::WebResourceLoadStatisticsStore::createDecoderFromDisk):
2590         (WebKit::WebResourceLoadStatisticsStore::performDailyTasks):
2591         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
2592         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
2593         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioning):
2594         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains):
2595         (WebKit::WebResourceLoadStatisticsStore::clearInMemory):
2596         (WebKit::WebResourceLoadStatisticsStore::clearInMemoryAndPersistent):
2597         (WebKit::WebResourceLoadStatisticsStore::shouldRemoveDataRecords):
2598         (WebKit::WebResourceLoadStatisticsStore::setDataRecordsBeingRemoved):
2599         * UIProcess/WebResourceLoadStatisticsStore.h:
2600         * UIProcess/WebResourceLoadStatisticsTelemetry.cpp:
2601         (WebKit::sortedPrevalentResourceTelemetry):
2602         (WebKit::WebResourceLoadStatisticsTelemetry::calculateAndSubmit):
2603         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2604         (WebKit::WebsiteDataStore::updateCookiePartitioningForTopPrivatelyOwnedDomains):
2605         (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
2606         * UIProcess/WebsiteData/WebsiteDataStore.h:
2607
2608 2017-07-10  Michael Catanzaro  <mcatanzaro@igalia.com>
2609
2610         [SOUP] Remove WebKitSoupCookieJarSqlite
2611         https://bugs.webkit.org/show_bug.cgi?id=174310
2612
2613         Reviewed by Carlos Garcia Campos.
2614
2615         It seems WebKitSoupCookieJarSqlite uses exactly the same database format as the upstream
2616         SoupCookieJarDb class. WebKitSoupCookieJarSqlite is a copy of SoupCookieJarSqlite that uses
2617         WebCore's SQLite wrapper and WTF stuff. WebKitSoupCookieJarSqlite exists only because
2618         SoupCookieJarDb is relatively new, and the older SoupCookieJarSqlite class existed only in
2619         libsoup-gnome rather than libsoup proper. The advantage of continuing to use our
2620         WebKitSoupCookieJarSqlite class, besides that we already know it works, is that it utilizes
2621         the same SQLiteDatabase class that is used elsewhere in WebKit. But that's not really any
2622         reason to keep the class around, when SoupCookieJarDb does exactly the same thing. It was
2623         introduced in libsoup 2.42 and that is already our minimum required version, so we can
2624         switch now.
2625
2626         This passes a quick sanity-check of Epiphany's cookies dialog and also TestCookieManager.
2627
2628         * PlatformGTK.cmake:
2629         * PlatformWPE.cmake:
2630         * WebProcess/Cookies/soup/WebCookieManagerSoup.cpp:
2631         (WebKit::WebCookieManager::setCookiePersistentStorage):
2632         * WebProcess/Cookies/soup/WebKitSoupCookieJarSqlite.cpp: Removed.
2633         * WebProcess/Cookies/soup/WebKitSoupCookieJarSqlite.h: Removed.
2634
2635 2017-07-10  Myles C. Maxfield  <mmaxfield@apple.com>
2636
2637         REGRESSION(r213590): UI process updates the visible content rects more often than it did in iOS 10
2638         https://bugs.webkit.org/show_bug.cgi?id=174282
2639         <rdar://problem/33144344>
2640
2641         Reviewed by Simon Fraser.
2642
2643         In r213590, we accidentally refactored -[WKWebView _didCommitLayerTree:] to call _scheduleVisibleContentRectUpdate
2644         more often. Instead, this should be triggered from inside the "if" statements. 
2645
2646         No tests because there is no behavior change. Performance change is tested in MotionMark.
2647
2648         * UIProcess/API/Cocoa/WKWebView.mm:
2649         (-[WKWebView _isShowingVideoPictureInPicture]):
2650         (-[WKWebView _initializeWithConfiguration:]):
2651         (-[WKWebView goBack]):
2652         (-[WKWebView _didCommitLayerTree:]):
2653         (-[WKWebView _restorePageStateToUnobscuredCenter:scale:]):
2654         (-[WKWebView _zoomToRect:withOrigin:fitEntireRect:minimumScale:maximumScale:minimumScrollDistance:]):
2655         (-[WKWebView scrollViewWillEndDragging:withVelocity:targetContentOffset:]):
2656         (-[WKWebView scrollViewDidScroll:]):
2657         (-[WKWebView _visibleContentRect]):
2658         (-[WKWebView _frameOrBoundsChanged]):
2659         (-[WKWebView _scheduleVisibleContentRectUpdateAfterScrollInView:]):
2660         (-[WKWebView _updateVisibleContentRects]):
2661         (-[WKWebView _navigationGestureDidBegin]):
2662         (-[WKWebView _reloadWithoutContentBlockers]):
2663         (-[WKWebView _reloadExpiredOnly]):
2664         (-[WKWebView _setObscuredInsets:]):
2665         (-[WKWebView _setUnobscuredSafeAreaInsets:]):
2666         (-[WKWebView _endAnimatedResize]):
2667         (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]):
2668         (-[WKWebView _clearOverrideLayoutParameters]):
2669         (-[WKWebView _requestActivatedElementAtPosition:completionBlock:]):
2670         (-[WKWebView _propertiesOfLayerWithID:]):
2671
2672 2017-07-10  Carlos Garcia Campos  <cgarcia@igalia.com>
2673
2674         [SOUP] SoupCookieJar is never released (resulting in sqlite temp files lying around)
2675         https://bugs.webkit.org/show_bug.cgi?id=166029
2676
2677         Reviewed by Michael Catanzaro.
2678
2679         Clear the SoupNetworkSession and cookie storage after the main loop quits.
2680
2681         * NetworkProcess/soup/NetworkProcessMainSoup.cpp:
2682         (WebKit::NetworkProcessMainUnix):
2683
2684 2017-07-10  Wenson Hsieh  <wenson_hsieh@apple.com>
2685
2686         [WK2] Action sheets for links fail to present in WebKit2 PDF view
2687         https://bugs.webkit.org/show_bug.cgi?id=174307
2688         <rdar://problem/31412128>
2689
2690         Reviewed by Tim Horton.
2691
2692         Currently, presenting an action sheet for a link always uses the WKActionSheetPresentAtClosestIndicatorRect
2693         codepath, which requires text indicator data for the link. However, when showing an action sheet for a link via
2694         WKPDFView, a text indicator for the link is not included, so the popover rect ends up being an empty rect at the
2695         origin, which causes us to bail from presenting the popover.
2696
2697         To address this, we tweak our heuristic for determining which action sheet presentation style to use, so that we
2698         only use the closest indicator rect for a link if the text indicator data is also present (otherwise, we fall
2699         back to using the element rect). All other behavior is the same.
2700
2701         * UIProcess/ios/WKActionSheetAssistant.mm:
2702         (-[WKActionSheetAssistant showImageSheet]):
2703         (presentationStyleForView):
2704
2705         Refactor _shouldPresentAtTouchLocationForElementRect into presentationStyleForView, a static function that
2706         returns a WKActionSheetPresentationStyle.
2707
2708         (-[WKActionSheetAssistant showLinkSheet]):
2709         (-[WKActionSheetAssistant _shouldPresentAtTouchLocationForElementRect:]): Deleted.
2710
2711 2017-07-09  Brady Eidson  <beidson@apple.com>
2712
2713         Remove some obsolete WebKitVersionChecks.
2714         https://bugs.webkit.org/show_bug.cgi?id=174294
2715
2716         Reviewed by Dan Bernstein.
2717
2718         * WebProcess/WebPage/WebPage.cpp:
2719         (WebKit::WebPage::updatePreferences):
2720
2721 2017-07-08  Chris Dumez  <cdumez@apple.com>
2722
2723         Simplify WebResourceLoadStatisticsStore / ResourceLoadStatisticsStore
2724         https://bugs.webkit.org/show_bug.cgi?id=174290
2725
2726         Reviewed by Brent Fulgham.
2727
2728         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2729         (-[WKWebsiteDataStore _resourceLoadStatisticsProcessStatisticsAndDataRecords]):
2730         (-[WKWebsiteDataStore _resourceLoadStatisticsSubmitTelemetry]):
2731         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
2732         Rename a couple of functions in the Cocoa SPI for clarity and to match the name
2733         of their internal implementation.
2734
2735         * UIProcess/Storage/ResourceLoadStatisticsStore.cpp:
2736         (WebKit::ResourceLoadStatisticsStore::create):
2737         (WebKit::ResourceLoadStatisticsStore::ensureResourceStatisticsForPrimaryDomain):
2738         Stylistic changes.
2739
2740         (WebKit::ResourceLoadStatisticsStore::createEncoderFromData):
2741         Make const.
2742
2743         (WebKit::ResourceLoadStatisticsStore::readDataFromDecoder):
2744         Use HashMap::add() instead of HashMap::set(). There is not supposed to have any duplicate
2745         keys so add() is sufficient and more efficient.
2746
2747         (WebKit::ResourceLoadStatisticsStore::clearInMemoryAndPersistent): Removed.
2748         clearInMemoryAndPersistent() was only called from WebResourceLoadStatisticsStore and
2749         the m_deletePersistentStoreHandler / m_grandfatherExistingWebsiteDataHandler were both
2750         set by the WebResourceLoadStatisticsStore as well. Therefore, we don't really need this
2751         function, WebResourceLoadStatisticsStore now calls ResourceLoadStatisticsStore::clearInMemory()
2752         instead and takes care of doing what the m_deletePersistentStoreHandler /
2753         m_grandfatherExistingWebsiteDataHandler handlers were doing on its side.
2754
2755         (WebKit::ResourceLoadStatisticsStore::mergeStatistics):
2756         Pass Vector as rvalue reference, as a preparation for a future optimization. Added FIXME
2757         comment about the optimization.
2758
2759         (WebKit::ResourceLoadStatisticsStore::setNotificationCallback): Removed.
2760         (WebKit::ResourceLoadStatisticsStore::setGrandfatherExistingWebsiteDataCallback): Removed.
2761         (WebKit::ResourceLoadStatisticsStore::setDeletePersistentStoreCallback): Removed.
2762         (WebKit::ResourceLoadStatisticsStore::setFireTelemetryCallback): Removed.
2763         Drop those callback setters. WebResourceLoadStatisticsStore is the only client of
2764         ResourceLoadStatisticsStore and those callbacks were always called as a result of
2765         an operation requested by the WebResourceLoadStatisticsStore. Therefore, those are
2766         not needed. WebResourceLoadStatisticsStore can take care of doing what those
2767         callbacks were doing on its side.
2768
2769         (WebKit::ResourceLoadStatisticsStore::processStatistics):
2770         Pass parameter by const reference since we clearly do not intend to transfer ownership of it.
2771
2772         (WebKit::ResourceLoadStatisticsStore::topPrivatelyControlledDomainsToRemoveWebsiteDataFor):
2773         (WebKit::ResourceLoadStatisticsStore::updateStatisticsForRemovedDataRecords):
2774         (WebKit::ResourceLoadStatisticsStore::handleFreshStartWithEmptyOrNoStore):
2775         Stylistic changes.
2776
2777         (WebKit::ResourceLoadStatisticsStore::shouldRemoveDataRecords): Removed.
2778         (WebKit::ResourceLoadStatisticsStore::dataRecordsBeingRemoved): Removed.
2779         (WebKit::ResourceLoadStatisticsStore::dataRecordsWereRemoved): Removed.
2780         Those were moved to WebResourceLoadStatisticsStore since they do not require
2781         any access to the statistics, and are only used by WebResourceLoadStatisticsStore.
2782
2783         * UIProcess/Storage/ResourceLoadStatisticsStore.h:
2784
2785         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2786         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
2787         Store registering most callbacks on the coreStore. Instead, the logic of those
2788         callbacks is now inlined in the few methods in WebResourceLoadStatisticsStore
2789         that were causing these callbacks to be called.
2790
2791         (WebKit::WebResourceLoadStatisticsStore::removeDataRecords):
2792         Access some methods on WebResourceLoadStatisticsStore instead of the coreStore
2793         since those were moved.
2794
2795         (WebKit::WebResourceLoadStatisticsStore::processStatisticsAndDataRecords):
2796         Drop unnecessary mutable for lambda.
2797
2798         (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
2799         Pass parameter as rvalue reference as a preparation for a future optimization.
2800
2801         (WebKit::WebResourceLoadStatisticsStore::hasStatisticsFileChangedSinceLastSync):
2802         Make const.
2803
2804         (WebKit::WebResourceLoadStatisticsStore::submitTelemetry):
2805         Add assertion to make sure this is called on the main thread.
2806
2807         (WebKit::WebResourceLoadStatisticsStore::fireDataModificationHandler): Removed.
2808         This was dispatching to a background queue to call fireDataModificationHandler()
2809         on the ResourceLoadStatisticsStore. The coreStore would then dispatch back on the
2810         main thread to call the WebResourceLoadStatisticsStore's modification handler.
2811         This modification handler was merely calling processStatisticsAndDataRecords().
2812         Therefore, callers of WebResourceLoadStatisticsStore::fireDataModificationHandler()
2813         can call WebResourceLoadStatisticsStore::processStatisticsAndDataRecords() directly
2814         instead.
2815
2816         (WebKit::WebResourceLoadStatisticsStore::fireTelemetryHandler): Removed.
2817         This was calling ResourceLoadStatisticsStore::fireTelemetryHandler(), which was
2818         calling back WebResourceLoadStatisticsStore's fireTelemetryHandler. The handler
2819         in question was merely calling submitTelemetry(). Therefore, callers of
2820         WebResourceLoadStatisticsStore::fireTelemetryHandler() can call
2821         WebResourceLoadStatisticsStore::submitTelemetry() directly instead.
2822
2823         (WebKit::WebResourceLoadStatisticsStore::clearInMemoryAndPersistent):
2824         Call ResourceLoadStatisticsStore::clearInMemory() instead of clearInMemoryAndPersistent(),
2825         which was removed. ResourceLoadStatisticsStore::clearInMemoryAndPersistent() was calling
2826         clearInMemory() and then 2 of WebResourceLoadStatisticsStore's handlers. Instead, we now
2827         call the functions that those handlers were calling directly, thus eliminating the need
2828         for those handlers.
2829
2830         (WebKit::WebResourceLoadStatisticsStore::setMinimumTimeBetweenDataRecordsRemoval):
2831         Set m_minimumTimeBetweenDataRecordsRemoval directly as it is now store on this class
2832         instead of the coreStore.
2833
2834         (WebKit::WebResourceLoadStatisticsStore::shouldRemoveDataRecords):
2835         (WebKit::WebResourceLoadStatisticsStore::dataRecordsBeingRemoved):
2836         (WebKit::WebResourceLoadStatisticsStore::dataRecordsWereRemoved):
2837         Those were merely moved from the ResourceLoadStatisticsStore.
2838
2839         * UIProcess/WebResourceLoadStatisticsStore.h:
2840
2841         * UIProcess/WebResourceLoadStatisticsTelemetry.cpp:
2842         (WebKit::WebResourceLoadStatisticsTelemetry::calculateAndSubmit):
2843         Check for sortedPrevalentResources.isEmpty() instead of checking if the size
2844         if less than minimumPrevalentResourcesForTelemetry.
2845         ResourceLoadStatisticsStore::sortedPrevalentResourceTelemetry() either returns
2846         an empty vector or a vector with more than minimumPrevalentResourcesForTelemetry
2847         items. Therefore, there is no need to expose minimumPrevalentResourcesForTelemetry.
2848
2849 2017-07-08  Yusuke Suzuki  <utatane.tea@gmail.com>
2850
2851         Drop NOSNIFF compile flag
2852         https://bugs.webkit.org/show_bug.cgi?id=174289
2853
2854         Reviewed by Michael Catanzaro.
2855
2856         * Configurations/FeatureDefines.xcconfig:
2857
2858 2017-07-07  Chris Dumez  <cdumez@apple.com>
2859
2860         [WK2] Use a rolling 30-day uptime for processing statistics
2861         https://bugs.webkit.org/show_bug.cgi?id=174235
2862         <rdar://problem/33164381>
2863
2864         Reviewed by Brent Fulgham.
2865
2866         Follow-up fix for r219274 because it caused this test to time out:
2867         http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction-timeout.html
2868
2869         The test sets TimeToLiveUserInteraction to 0 so our implementation cannot use
2870         0 as magic value to see if it was set. Instead, use std::optional.
2871
2872         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2873         (-[WKWebsiteDataStore _resourceLoadStatisticsResetToConsistentState]):
2874         * UIProcess/Storage/ResourceLoadStatisticsStore.cpp:
2875         (WebKit::ResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
2876         (WebKit::ResourceLoadStatisticsStore::hasStatisticsExpired):
2877         * UIProcess/Storage/ResourceLoadStatisticsStore.h:
2878         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2879         (WebKit::WebResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
2880         * UIProcess/WebResourceLoadStatisticsStore.h:
2881
2882 2017-07-07  Brent Fulgham  <bfulgham@apple.com>
2883
2884         [WK2] Use a rolling 30-day uptime for processing statistics
2885         https://bugs.webkit.org/show_bug.cgi?id=174235
2886         <rdar://problem/33164381>
2887
2888         Reviewed by Chris Dumez.
2889
2890         * UIProcess/API/Cocoa/WKWebsiteDataStore.cpp:
2891         (WebKit::WKWebsiteDataStore::_resourceLoadStatisticsResetToConsistentState): Initialize time-to-live to zero by default.
2892         * UIProcess/Storage/ResourceLoadStatisticsStore.cpp:
2893         (WebKit::ResourceLoadStatisticsStore::createEncoderFromData): Write out vector
2894         of operating dates.
2895         (WebKit::ResourceLoadStatisticsStore::readDataFromDecoder): Read in vector of
2896         operating dates.
2897         (WebKit::ResourceLoadStatisticsStore::hasHadRecentUserInteraction): Check new
2898         convenience method.
2899         (WebKit::ResourceLoadStatisticsStore::markTodayAsOperatingDate): Added.
2900         (WebKit::ResourceLoadStatisticsStore::hasStatisticsExpired): Added.
2901         * UIProcess/Storage/ResourceLoadStatisticsStore.h:
2902         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2903         (WebKit::WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded): When reading
2904         a new data file, update the current operating date (if needed).
2905         (WebKit::WebResourceLoadStatisticsStore::handleDailyTasks): Roll uptime dates as
2906         needed, then handle telemetry.
2907         * UIProcess/WebResourceLoadStatisticsStore.h:
2908
2909 2017-07-07  Wenson Hsieh  <wenson_hsieh@apple.com>
2910
2911         [iOS DnD] For cross-app drags, 'drop' event handlers are never invoked if dataTransfer.dropEffect is not set while dragging
2912         https://bugs.webkit.org/show_bug.cgi?id=174219
2913         <rdar://problem/32083177>
2914
2915         Reviewed by Ryosuke Niwa.
2916
2917         Tweak some testing SPI to return a drop operation flag instead of whether or not the drop operation was not
2918         UIDropOperationCancel.
2919
2920         * UIProcess/API/Cocoa/WKWebView.mm:
2921         (-[WKWebView _simulateDataInteractionUpdated:]):
2922         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2923         * UIProcess/ios/WKContentViewInteraction.h:
2924         * UIProcess/ios/WKContentViewInteraction.mm:
2925         (-[WKContentView _simulateDataInteractionUpdated:]):
2926
2927 2017-07-07  Commit Queue  <commit-queue@webkit.org>
2928
2929         Unreviewed, rolling out r219238, r219239, and r219241.
2930         https://bugs.webkit.org/show_bug.cgi?id=174265
2931
2932         "fast/workers/dedicated-worker-lifecycle.html is flaky"
2933         (Requested by yusukesuzuki on #webkit).
2934
2935         Reverted changesets:
2936
2937         "[WTF] Implement WTF::ThreadGroup"
2938         https://bugs.webkit.org/show_bug.cgi?id=174081
2939         http://trac.webkit.org/changeset/219238
2940
2941         "Unreviewed, build fix after r219238"
2942         https://bugs.webkit.org/show_bug.cgi?id=174081
2943         http://trac.webkit.org/changeset/219239
2944
2945         "Unreviewed, CLoop build fix after r219238"
2946         https://bugs.webkit.org/show_bug.cgi?id=174081
2947         http://trac.webkit.org/changeset/219241
2948
2949 2017-07-07  Antti Koivisto  <antti@apple.com>
2950
2951         WKWebSiteDataStore.removeDataOfTypes should wait until disk cache files are actually removed before invoking completion handler
2952         https://bugs.webkit.org/show_bug.cgi?id=174224
2953         <rdar://problem/33067545>
2954
2955         Reviewed by Sam Weinig.
2956
2957         Currently we dispatch file deletion operations to a background queue and call the completion
2958         handler without waiting for the I/O to complete.
2959
2960         * NetworkProcess/NetworkProcess.cpp:
2961         (WebKit::clearDiskCacheEntries):
2962
2963             Call a new version of NetworkCache::remove() for bulk deletion.
2964             Note that it is fine to call this with an empty vector.
2965
2966         * NetworkProcess/cache/NetworkCache.cpp:
2967         (WebKit::NetworkCache::Cache::remove):
2968
2969             Bulk deletion with a completion handler.
2970
2971         (WebKit::NetworkCache::Cache::deleteFiles): Added.
2972
2973             Factor to a helper function.
2974
2975         * NetworkProcess/cache/NetworkCache.h:
2976         * NetworkProcess/cache/NetworkCacheStorage.cpp:
2977         (WebKit::NetworkCache::Storage::remove):
2978
2979             Remove files for all the provided keys in a queue and invoke the completion handler in the main thread when done.
2980
2981         * NetworkProcess/cache/NetworkCacheStorage.h:
2982
2983 2017-07-06  Chris Dumez  <cdumez@apple.com>
2984
2985         Fix bad usage of static variables in ResourceLoadStatisticsStore
2986         https://bugs.webkit.org/show_bug.cgi?id=174237
2987
2988         Reviewed by Brent Fulgham.
2989
2990         Fix bad usage of static variables in ResourceLoadStatisticsStore. Those can be set via
2991         member functions on ResourceLoadStatisticsStore so they should be data members. The
2992         API to set them is associated to a particular store and there can in theory be several
2993         stores.
2994
2995         * UIProcess/Storage/ResourceLoadStatisticsStore.cpp:
2996         (WebKit::ResourceLoadStatisticsStore::shouldPartitionCookies):
2997         (WebKit::ResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
2998         (WebKit::ResourceLoadStatisticsStore::setTimeToLiveCookiePartitionFree):
2999         (WebKit::ResourceLoadStatisticsStore::setMinimumTimeBetweenDataRecordsRemoval):
3000         (WebKit::ResourceLoadStatisticsStore::setGrandfatheringTime):
3001         (WebKit::ResourceLoadStatisticsStore::hasHadRecentUserInteraction):
3002         (WebKit::ResourceLoadStatisticsStore::handleFreshStartWithEmptyOrNoStore):
3003         (WebKit::ResourceLoadStatisticsStore::shouldRemoveDataRecords):
3004         (WebKit::shouldPartitionCookies): Deleted.
3005         * UIProcess/Storage/ResourceLoadStatisticsStore.h:
3006
3007 2017-07-05  Yusuke Suzuki  <utatane.tea@gmail.com>
3008
3009         [WTF] Implement WTF::ThreadGroup
3010         https://bugs.webkit.org/show_bug.cgi?id=174081
3011
3012         Reviewed by Mark Lam.
3013
3014         * Shared/AsyncRequest.h:
3015         * UIProcess/Storage/ResourceLoadStatisticsStore.h:
3016
3017 2017-07-06  Chris Dumez  <cdumez@apple.com>
3018
3019         Drop unused ResourceLoadStatistics members
3020         https://bugs.webkit.org/show_bug.cgi?id=174226
3021
3022         Reviewed by Brent Fulgham.
3023
3024         * Shared/WebCoreArgumentCoders.cpp:
3025         (IPC::ArgumentCoder<ResourceLoadStatistics>::encode):
3026         (IPC::ArgumentCoder<ResourceLoadStatistics>::decode):
3027         * UIProcess/Storage/ResourceLoadStatisticsStore.cpp:
3028         (WebKit::ResourceLoadStatisticsStore::readDataFromDecoder):
3029
3030 2017-07-06  Wenson Hsieh  <wenson_hsieh@apple.com>
3031
3032         Unreviewed, fix the internal iOS 11 build
3033
3034         It turns out, our internal bots are still on an older version of the iOS 11 SDK that's missing _UIDataOwner in
3035         <UIKit/NSItemProvider+UIKitAdditions_Private.h>. To ensure that we can build on both current and slightly older
3036         versions of the iOS 11 SDK, fall back to using NSInteger instead of _UIDataOwner.
3037
3038         * Platform/spi/ios/UIKitSPI.h:
3039         * UIProcess/ios/WKContentViewInteraction.mm:
3040         (-[WKContentView _dragInteraction:dataOwnerForSession:]):
3041         (-[WKContentView _dropInteraction:dataOwnerForSession:]):
3042
3043 2017-07-06  Wenson Hsieh  <wenson_hsieh@apple.com>
3044
3045         [iOS DnD] [WK2] Add delegate hooks for specifying the data owner for a drag or drop session
3046         https://bugs.webkit.org/show_bug.cgi?id=174139
3047         <rdar://problem/33126212>
3048
3049         Reviewed by Beth Dakin.
3050
3051         Add hooks to query the UI delegate for a _UIDataOwner on both drag and drop sides.
3052
3053         * Platform/spi/ios/UIKitSPI.h:
3054         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
3055         * UIProcess/ios/WKContentViewInteraction.mm:
3056         (-[WKContentView _dragInteraction:dataOwnerForSession:]):
3057         (-[WKContentView _dropInteraction:dataOwnerForSession:]):
3058
3059 2017-07-06  Brent Fulgham  <bfulgham@apple.com>
3060
3061         [WK2] ResourceLoadStatistics should batch its writes
3062         https://bugs.webkit.org/show_bug.cgi?id=174111
3063         <rdar://problem/33115894>
3064
3065         Reviewed by Chris Dumez.
3066
3067         Revise the data writing operation to only write on a specific interval (currently
3068         set to 5 minutes).
3069
3070         Also make 'writeStoreToDisk' simpler to use by moving the deleting (before write) and
3071         creating (after write) of the FileMonitor into the method, rather than requiring this
3072         knowledge in multiple places.
3073
3074         Make sure that we write our statistics file out before exiting so that we do not
3075         lose any data if we exit before the five-minute window has elapsed.
3076
3077         * UIProcess/Storage/ResourceLoadStatisticsStore.cpp:
3078         (WebKit::ResourceLoadStatisticsStore::setWritePersistentStoreCallback): Deleted.
3079         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3080         (WebKit::WebResourceLoadStatisticsStore::processStatisticsAndDataRecords): Remove the stop
3081         and start monitoring into 'writeStoreToDisk'. Also check if enough time has elapsed since
3082         the last write to commit to disk.
3083         (WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver): Remove the
3084         stop and start monitoring into 'writeStoreToDisk'.
3085         (WebKit::WebResourceLoadStatisticsStore::writeStoreToDisk): Add the stop and start monitoring
3086         commands here, so callers don't have to know to do so.
3087
3088 2017-07-06  Chris Dumez  <cdumez@apple.com>
3089
3090         FileMonitor should not be ref counted
3091         https://bugs.webkit.org/show_bug.cgi?id=174166
3092
3093         Reviewed by Brent Fulgham.
3094
3095         Update code using FileMonitor to reflect API change.
3096
3097         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3098         (WebKit::WebResourceLoadStatisticsStore::startMonitoringStatisticsStorage):
3099         (WebKit::WebResourceLoadStatisticsStore::stopMonitoringStatisticsStorage):
3100         * UIProcess/WebResourceLoadStatisticsStore.h:
3101
3102 2017-07-06  Matt Rajca  <mrajca@apple.com>
3103
3104         Fix build with VIDEO support disabled.
3105         https://bugs.webkit.org/show_bug.cgi?id=174217
3106
3107         Unreviewed build fix.
3108
3109         * WebProcess/WebPage/WebPage.cpp:
3110         (WebKit::WebPage::updateWebsitePolicies):
3111
3112 2017-07-06  Chris Dumez  <cdumez@apple.com>
3113
3114         Crash under WebResourceLoadStatisticsStore::persistentStoragePath(WTF::String const&)
3115         https://bugs.webkit.org/show_bug.cgi?id=174205
3116         <rdar://problem/33093552>
3117
3118         Reviewed by Brent Fulgham.
3119
3120         Make sure we isolateCopy() m_statisticsStoragePath before using it from the background
3121         thread.
3122
3123         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3124         (WebKit::WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded):
3125         (WebKit::WebResourceLoadStatisticsStore::refreshFromDisk):
3126         (WebKit::WebResourceLoadStatisticsStore::resourceLogFilePath):
3127         (WebKit::WebResourceLoadStatisticsStore::statisticsFilePath):
3128         (WebKit::WebResourceLoadStatisticsStore::writeStoreToDisk):
3129         (WebKit::WebResourceLoadStatisticsStore::writeEncoderToDisk):
3130         (WebKit::WebResourceLoadStatisticsStore::deleteStoreFromDisk):
3131         (WebKit::WebResourceLoadStatisticsStore::startMonitoringStatisticsStorage):
3132         (WebKit::WebResourceLoadStatisticsStore::syncWithExistingStatisticsStorageIfNeeded):
3133         (WebKit::WebResourceLoadStatisticsStore::persistentStoragePath): Deleted.
3134         * UIProcess/WebResourceLoadStatisticsStore.h:
3135
3136 2017-07-06  Alex Christensen  <achristensen@webkit.org>
3137
3138         Fix CFURLRequestRef serialization after r207330
3139         https://bugs.webkit.org/show_bug.cgi?id=163332
3140
3141         * Shared/mac/WebCoreArgumentCodersMac.mm:
3142         (IPC::ArgumentCoder<ResourceRequest>::encodePlatformData):
3143         The CFURLConnection code was not updated.
3144         We did not catch this because nobody uses the WebKit2 CFURLConnection code, but I need to use it to debug something.
3145
3146 2017-07-06  Chris Dumez  <cdumez@apple.com>
3147
3148         Move ResourceLoadObserver notification throttling logic from WebProcess class to ResourceLoadObserver
3149         https://bugs.webkit.org/show_bug.cgi?id=174194
3150
3151         Reviewed by Brent Fulgham.
3152
3153         Move ResourceLoadObserver notification throttling logic from WebProcess class to
3154         ResourceLoadObserver. This makes more sense and decreases the complexity of the
3155         WebProcess class.
3156
3157         * WebProcess/WebProcess.cpp:
3158         (WebKit::m_webSQLiteDatabaseTracker):
3159         (WebKit::WebProcess::statisticsChangedTimerFired): Deleted.
3160         * WebProcess/WebProcess.h:
3161
3162 2017-07-06  Chris Dumez  <cdumez@apple.com>
3163
3164         WebResourceLoadStatisticsStore should only be constructed when the feature is enabled
3165         https://bugs.webkit.org/show_bug.cgi?id=174189
3166
3167         Reviewed by Brent Fulgham.
3168
3169         Delay the construction of the WebResourceLoadStatisticsStore until the feature gets
3170         enabled via WebsiteDataStore::setResourceLoadStatisticsEnabled(). Previously, we would
3171         always construct a store and then have a boolean on the store to indicate if it is
3172         enabled or not.
3173
3174         Also simplify the initialization process of the WebResourceLoadStatisticsStore, we
3175         used to have:
3176         1. WebResourceLoadStatisticsStore constructor
3177         2. WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver()
3178         3. WebResourceLoadStatisticsStore::setResourceLoadStatisticsEnabled(true)
3179
3180         All 3 steps are now taken care of by the WebResourceLoadStatisticsStore constructor.
3181
3182         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3183         (WebKit::WebProcessPool::platformInitialize):
3184         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3185         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
3186         (WebKit::WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded):
3187         * UIProcess/WebResourceLoadStatisticsStore.h:
3188         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
3189         (WebKit::WebsiteDataStore::platformInitialize):
3190         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3191         (WebKit::WebsiteDataStore::WebsiteDataStore):
3192         (WebKit::WebsiteDataStore::resourceLoadStatisticsEnabled):
3193         (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
3194         * UIProcess/WebsiteData/WebsiteDataStore.h:
3195         (WebKit::WebsiteDataStore::resourceLoadStatistics):
3196         * UIProcess/wpe/WebProcessPoolWPE.cpp:
3197         (WebKit::WebProcessPool::platformInitialize):
3198
3199 2017-07-06  Claudio Saavedra  <csaavedra@igalia.com>
3200
3201         [GTK] It should process MouseMoved events when the parent window is not active
3202         https://bugs.webkit.org/show_bug.cgi?id=116691
3203
3204         Reviewed by Michael Catanzaro.
3205
3206         From reading the comments in the related code, only in Safari it
3207         is desired that MouseMoved events are not processed when the
3208         parent window is not active. In other ports, in particular those
3209         targeting Linux, these events should be processed for consistency
3210         with other browsers.
3211
3212         * UIProcess/WebPageProxy.cpp:
3213         (WebKit::WebPageProxy::setCursor):
3214         * UIProcess/mac/PageClientImpl.mm:
3215         (WebKit::PageClientImpl::setCursor):
3216         * WebProcess/WebPage/WebPage.cpp:
3217         (WebKit::handleMouseEvent):
3218         (WebKit::WebPage::mouseEvent):  No need to always pass a boolean
3219         parameter that is only checked for one type of event. Do the check
3220         internally in handleMouseEvent() only when needed and only in Cocoa.
3221
3222 2017-07-05  Don Olmstead  <don.olmstead@sony.com>
3223
3224         [WTF] Move SoftLinking.h into WTF
3225         https://bugs.webkit.org/show_bug.cgi?id=174000
3226
3227         Reviewed by Alex Christensen.
3228
3229         * Platform/mac/StringUtilities.mm:
3230         * Platform/spi/ios/ManagedConfigurationSPI.h:
3231         * Shared/Cocoa/DataDetectionResult.mm:
3232         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
3233         * Shared/ios/InteractionInformationAtPosition.mm:
3234         * Shared/ios/WebIconUtilities.mm:
3235         * Shared/mac/CookieStorageShim.mm:
3236         * Shared/mac/WebCoreArgumentCodersMac.mm:
3237         * UIProcess/API/Cocoa/_WKElementAction.mm:
3238         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
3239         * UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
3240         * UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
3241         * UIProcess/Cocoa/UIDelegate.mm:
3242         * UIProcess/Cocoa/WebViewImpl.mm:
3243         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
3244         * UIProcess/ios/WKActionSheetAssistant.mm:
3245         * UIProcess/ios/WKContentViewInteraction.mm:
3246         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
3247         * UIProcess/ios/forms/WKFileUploadPanel.mm:
3248         * UIProcess/mac/WKImmediateActionController.mm:
3249         * UIProcess/mac/WebInspectorProxyMac.mm:
3250         * WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.mm:
3251         * WebProcess/WebPage/mac/WebInspectorUIMac.mm:
3252         * WebProcess/cocoa/WebProcessCocoa.mm:
3253
3254 2017-07-05  Brady Eidson  <beidson@apple.com>
3255
3256         Allow navigations in subframes to get a ShouldOpenExternalURLsPolicy of "ShouldAllow".
3257         <rdar://problem/22485589> and https://bugs.webkit.org/show_bug.cgi?id=174178
3258
3259         Reviewed by Alex Christensen.
3260
3261         Adopt to the new constructor for FrameLoadRequest.
3262
3263         * WebProcess/Plugins/PluginView.cpp:
3264         (WebKit::PluginView::loadURL):
3265         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3266         (WebKit::WebFrameLoaderClient::dispatchCreatePage):
3267         * WebProcess/WebPage/WebInspector.cpp:
3268         (WebKit::WebInspector::openInNewTab):
3269
3270 2017-07-05  Ryosuke Niwa  <rniwa@webkit.org>
3271
3272         Remove unnecessary forward declartions now that we include Foundation.h
3273
3274         * UIProcess/API/Cocoa/WKContentRuleListStore.h:
3275
3276 2017-07-05  Ryosuke Niwa  <rniwa@webkit.org>
3277
3278         Make WebKit's public headers on Mac and iOS C++ module safe
3279         https://bugs.webkit.org/show_bug.cgi?id=174175
3280
3281         Reviewed by Alex Christensen.
3282
3283         Fixed the header files.
3284
3285         * UIProcess/API/Cocoa/WKContentRuleList.h:
3286         * UIProcess/API/Cocoa/WKContentRuleListStore.h:
3287         * UIProcess/API/Cocoa/WKUIDelegate.h:
3288
3289 2017-07-05  Chris Dumez  <cdumez@apple.com>
3290
3291         [WK2] WebsiteDataStore::setResourceLoadStatisticsEnabled() updates processPools the store is not associated with
3292         https://bugs.webkit.org/show_bug.cgi?id=174174
3293
3294         Reviewed by Brent Fulgham.
3295
3296         WebsiteDataStore::setResourceLoadStatisticsEnabled() updates processPools the store is not associated with.
3297         Fix this by iterating over WebsiteDataStore::processPools() instead of WebProcessPool::allProcessPools().
3298
3299         Also rename shouldPartitionCookiesForTopPrivatelyOwnedDomains methods / IPC messages to
3300         updateCookiePartitioningForTopPrivatelyOwnedDomains since this is a setter, not a getter.
3301
3302         Finally, drop ShouldPartitionCookiesForTopPrivatelyOwnedDomains IPC message to the NetworkProcessProxy
3303         as well as corresponding methods as those appear to be unused.
3304
3305         * NetworkProcess/NetworkProcess.cpp:
3306         (WebKit::NetworkProcess::updateCookiePartitioningForTopPrivatelyOwnedDomains):
3307         (WebKit::NetworkProcess::shouldPartitionCookiesForTopPrivatelyOwnedDomains): Deleted.
3308         * NetworkProcess/NetworkProcess.h:
3309         * NetworkProcess/NetworkProcess.messages.in:
3310         * UIProcess/Network/NetworkProcessProxy.cpp:
3311         (WebKit::NetworkProcessProxy::shouldPartitionCookiesForTopPrivatelyOwnedDomains): Deleted.
3312         * UIProcess/Network/NetworkProcessProxy.h:
3313         * UIProcess/Network/NetworkProcessProxy.messages.in:
3314         * UIProcess/WebProcessPool.cpp:
3315         (WebKit::WebProcessPool::setResourceLoadStatisticsEnabled):
3316         * UIProcess/WebProcessPool.h:
3317         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3318         (WebKit::WebsiteDataStore::updateCookiePartitioningForTopPrivatelyOwnedDomains):
3319         (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
3320         (WebKit::WebsiteDataStore::registerSharedResourceLoadObserver):
3321         (WebKit::WebsiteDataStore::shouldPartitionCookiesForTopPrivatelyOwnedDomains): Deleted.
3322         * UIProcess/WebsiteData/WebsiteDataStore.h:
3323
3324 2017-07-05  Tim Horton  <timothy_horton@apple.com>
3325
3326         Async Image Decoding: Image flashes away briefly when tapping on tab in iPad tab picker
3327         https://bugs.webkit.org/show_bug.cgi?id=174173
3328         <rdar://problem/32431952>
3329
3330         Reviewed by Geoffrey Garen.
3331
3332         * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
3333         (WebKit::RemoteLayerTreeDrawingArea::addTransactionCallbackID):
3334         When a client uses e.g. doAfterNextPresentationUpdate (or internally,
3335         dispatchAfterEnsuringDrawing), they're doing so in the hopes that the
3336         callback is called after the page is well-painted -- for example, to
3337         remove a snapshot (in the tab picker case, as well as for navigation
3338         gestures), or to *take* a snapshot. In all of these cases, it is
3339         preferable to do a synchronous decode, to ensure that the image does
3340         not flash away temporarily.
3341
3342         Use the existing mechanism that was implemented for the synchronous
3343         activity state change flush to also force synchronous image decoding
3344         any time there is a post-commit transaction callback.
3345
3346 2017-07-05  Wenson Hsieh  <wenson_hsieh@apple.com>
3347
3348         [iOS DnD] [WK2] 3D touch fails to recognize when UIDragInteraction is enabled on phone
3349         https://bugs.webkit.org/show_bug.cgi?id=174171
3350         <rdar://problem/32956929>
3351
3352         Reviewed by Tim Horton.
3353
3354         By default, UIKit defers all competing long press gesture recognizers if dragging is enabled. However, this
3355         would cause 3D touch to be prevented, due to UIKit asking us whether or not we can proceed with the 3D touch
3356         gesture in -_interactionShouldBeginFromPreviewItemController:forPosition:, while the highlight long press
3357         gesture recognizer is being deferred. To address this, we use SPI on UIDragInteraction to allow the highlight
3358         long press gesture recognizer to recognize alongside the drag lift gesture. We then (already) manually cancel
3359         the highlight long press gesture in _dragInteraction:prepareForSession:completion:.
3360
3361         * UIProcess/ios/WKContentViewInteraction.mm:
3362         (-[WKContentView _dragInteraction:shouldDelayCompetingGestureRecognizer:]):
3363
3364 2017-07-03  Myles C. Maxfield  <mmaxfield@apple.com>
3365
3366         Remove copy of ICU headers from WebKit
3367         https://bugs.webkit.org/show_bug.cgi?id=116407
3368
3369         Reviewed by Alex Christensen.
3370
3371         * Configurations/BaseTarget.xcconfig:
3372
3373 2017-07-05  Chris Dumez  <cdumez@apple.com>
3374
3375         Regression(r218821): Bad cast to WebKit::DiagnosticLoggingClient in WKWebView's _setDiagnosticLoggingDelegate
3376         https://bugs.webkit.org/show_bug.cgi?id=174163
3377         <rdar://problem/33067518>
3378
3379         Reviewed by Alex Christensen.
3380
3381         After r218821, WebPageProxy::setDiagnosticLoggingClient() would no longer set the client in
3382         private session. This is an issue because there is code in WKWebView which expects the
3383         DiagnosticLoggingClient to be set and of a specific type. This would lead to bad casts in
3384         WKWebView's _diagnosticLoggingDelegate / _setDiagnosticLoggingDelegate.
3385
3386         To avoid the issue, we now unconditionally update the client in
3387         WebPageProxy::setDiagnosticLoggingClient(). Instead, we implement the logic for disabling
3388         logging in private session in the logging methods themselves, via the
3389         WebPageProxy::effectiveDiagnosticLoggingClient() helper instead.
3390
3391         I also added null checks in WKWebView's _diagnosticLoggingDelegate /
3392         _setDiagnosticLoggingDelegate. Even though the WKWebView sets itself as the diagnostic
3393         logging client, WebPageProxy::diagnosticLoggingClient() can still return null after
3394         calling WebPageProxy::close(). Previously, we would have done a bad cast if the WKWebView's
3395         client would have used this API after calling 'close' as well.
3396
3397         * UIProcess/API/APIDiagnosticLoggingClient.h:
3398         * UIProcess/API/Cocoa/WKWebView.mm:
3399         (-[WKWebView _diagnosticLoggingDelegate]):
3400         (-[WKWebView _setDiagnosticLoggingDelegate:]):
3401         * UIProcess/WebPageProxy.cpp:
3402         (WebKit::WebPageProxy::WebPageProxy):
3403         (WebKit::WebPageProxy::setDiagnosticLoggingClient):
3404         (WebKit::WebPageProxy::close):
3405         (WebKit::WebPageProxy::effectiveDiagnosticLoggingClient):
3406         (WebKit::WebPageProxy::logDiagnosticMessage):
3407         (WebKit::WebPageProxy::logDiagnosticMessageWithResult):
3408         (WebKit::WebPageProxy::logDiagnosticMessageWithValue):
3409         (WebKit::WebPageProxy::logDiagnosticMessageWithEnhancedPrivacy):
3410         * UIProcess/WebPageProxy.h:
3411         (WebKit::WebPageProxy::diagnosticLoggingClient):
3412
3413 2017-07-05  Daniel Bates  <dabates@apple.com>
3414
3415         Do not pass API::FrameInfo for source frame or clear out page of target frame on
3416         API navigation
3417         https://bugs.webkit.org/show_bug.cgi?id=174170
3418         <rdar://problem/33140328>
3419
3420         Reviewed by Brady Eidson.
3421
3422         As a step towards making it straightforward for an embedding client to determine whether
3423         a WebPageProxy::decidePolicyForNavigationAction() callback was initiated from API we
3424         should not pass frame info for the source frame and should not nullify the page pointer
3425         in the target frame info.
3426
3427         Currently we always pass frame info for the source frame and nullify the page pointer
3428         in both the source frame info and target frame info if the navigation was initiated from
3429         API. This seems subtle and error prone. Instead we should not pass frame info for
3430         the source frame and not nullify the page pointer in the target frame info as a step
3431         towards making using this API less error-prone.
3432
3433         * UIProcess/WebPageProxy.cpp:
3434         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3435
3436 2017-07-05  Chris Dumez  <cdumez@apple.com>
3437
3438         Add a few more WebKit2 owners
3439         https://bugs.webkit.org/show_bug.cgi?id=174169
3440
3441         Reviewed by Brady Eidson.
3442
3443         * Owners:
3444
3445 2017-07-05  Brent Fulgham  <bfulgham@apple.com>
3446
3447         [WK2] Prevent ResourceLoadStatistics from triggering a cascade of read/write events
3448         https://bugs.webkit.org/show_bug.cgi?id=174062\
3449         <rdar://problem/33086744>
3450
3451         Reviewed by Chris Dumez.
3452
3453         ResourceLoadStatistics was triggering periods of high CPU use due to a cascade of read/write
3454         operations:
3455         (1) The 'makeRefPtr' call in FileMonitor::startMonitoring was capturing a reference to itself, preventing
3456             the FileMonitor from being destroyed. This caused the file modification handler to fire in response
3457             to our own write events, creating a ridiculous read/write cycle. This problem was addressed in
3458             the short term by stopping the file monitor in WebResourceLoadStatisticsStore::stopMonitoringStatisticsStorage,
3459             rather than relying on the destructor to shut things down. This will be improved in a
3460             subsequent patch.
3461         (2) 'syncWithExistingStatisticsStorageIfNeeded' was creating a FileMonitor during the write operation,
3462             which exacerbated the chain of read/writes already present due to the self-reference described above.
3463         (3) Because VNODE dispatch sources are low level, they do not offer a means of filtering out operations
3464             triggered by the current process. To avoid this, I added code to track the file modification time, so
3465             that we don't bother reading a file that holds data that is older than the in-memory data, even though
3466             we receive a file modification dispatch. Writes seem to trigger a chain of notification events in rapid
3467             succession. Once we've responded to the first of these events, we don't need to to further reads until
3468             the data on disk changes again.    
3469
3470         We also shouldn't allow the ResourceLoadStatistics worker thread to consume high CPU resources. Run it
3471         as utility QoS, avoiding using the CPU when other work is going on.
3472
3473         Drive-by fix: The closure in setWritePersistentStoreCallback() should stop monitoring before writing
3474         data, and should start monitoring after the write completes.
3475
3476         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3477         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore): Run our worker queue
3478         as a utility-level process.
3479         (WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver): Stop checking for
3480         updates before writing, and begin checking again once the write is complete.
3481         (WebKit::WebResourceLoadStatisticsStore::statisticsFileModificationTime): Added.
3482         (WebKit::WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded): Avoid reading the file if it
3483         was last modified on (or before) the time we last read the file.
3484         (WebKit::WebResourceLoadStatisticsStore::refreshFromDisk): Ditto.
3485         (WebKit::WebResourceLoadStatisticsStore::stopMonitoringStatisticsStorage): Explicitly stop file
3486         monitoring so that the active file modification handler will terminate.
3487         (WebKit::WebResourceLoadStatisticsStore::syncWithExistingStatisticsStorageIfNeeded): Do not begin
3488         monitoring the file after syncing, since this is only used as part of an ongoing write operation.
3489
3490 2017-07-05  Jonathan Bedard  <jbedard@apple.com>
3491
3492         Add WebKitPrivateFrameworkStubs for iOS 11
3493         https://bugs.webkit.org/show_bug.cgi?id=173988
3494
3495         Reviewed by David Kilzer.
3496
3497         * Configurations/BaseTarget.xcconfig: iphoneos and iphonesimulator should use the
3498         same directory for private framework stubs.
3499
3500 2017-07-05  Andy Estes  <aestes@apple.com>
3501
3502         [iOS] WKActionSheetAssistants can outlive their host views
3503         https://bugs.webkit.org/show_bug.cgi?id=174160
3504         <rdar://problem/20638607>
3505
3506         Reviewed by Tim Horton.
3507
3508         WKActionSheetAssistant keeps a raw pointer to its host UIView, and nothing clears it when
3509         the host view is deallocated. If the assistant outlives the view, we can end up accessing a
3510         pointer to a deallocated UIView and crashing.
3511
3512         I don't know how to reproduce such a crash, but this patch guards against it by doing the
3513         following:
3514
3515         1. Make _view a WeakObjCPtr in WKActionSheetAssistant to ensure it gets set to nil when the
3516            UIView is deallocated.
3517         2. Call -[WKActionSheetAssistant cleanupSheet] when a WKContentView or WKPDFView is
3518            deallocated, or when the Web process crashes. This will ensure the action sheet is
3519            dismissed and prevent the user from tapping on an action that's no longer valid.
3520
3521         * UIProcess/ios/WKActionSheetAssistant.mm:
3522         (-[WKActionSheetAssistant superviewForSheet]):
3523         (-[WKActionSheetAssistant _presentationRectForSheetGivenPoint:inHostView:]):
3524         (-[WKActionSheetAssistant presentationRectForElementUsingClosestIndicatedRect]):
3525         (-[WKActionSheetAssistant presentationRectForIndicatedElement]):
3526         (-[WKActionSheetAssistant _shouldPresentAtTouchLocationForElementRect:]):
3527         * UIProcess/ios/WKContentViewInteraction.mm:
3528         (-[WKContentView cleanupInteraction]):
3529         * UIProcess/ios/WKPDFView.mm:
3530         (-[WKPDFView dealloc]):
3531
3532 2017-07-05  Frederic Wang  <fwang@igalia.com>
3533
3534         Move ScrolledContentsLayer property to ScrollingStateScrollingNode
3535         https://bugs.webkit.org/show_bug.cgi?id=174134
3536
3537         Reviewed by Simon Fraser.
3538
3539         * Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp:
3540         (ArgumentCoder<ScrollingStateScrollingNode>::encode): Add encoding for scrolled contents
3541         layer.
3542         (ArgumentCoder<ScrollingStateFrameScrollingNode>::encode): Remove encoding for scrolled
3543         contents layer.
3544         (ArgumentCoder<ScrollingStateOverflowScrollingNode>::encode): Ditto.
3545         (ArgumentCoder<ScrollingStateScrollingNode>::decode): Add decoding for scrolled contents
3546         layer.
3547         (ArgumentCoder<ScrollingStateFrameScrollingNode>::decode): Remove decoding for scrolled
3548         contents layer.
3549         (ArgumentCoder<ScrollingStateOverflowScrollingNode>::decode): Ditto.
3550         (WebKit::dump): Move dumping of scrolled contents layer from overflow/frame nodes to
3551         scrolling node.
3552         * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp:
3553         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers): Adjust enum value to use
3554         ScrollingStateScrollingNode::ScrolledContentsLayer.
3555         * UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
3556         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::commitStateBeforeChildren): Ditto.
3557         * UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm:
3558         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers): Ditto.
3559
3560 2017-07-05  Ada Chan  <adachan@apple.com>
3561
3562         Fix crash in UIKit: +[UIViewController _viewControllerForFullScreenPresentationFromView:]
3563         https://bugs.webkit.org/show_bug.cgi?id=174143
3564         <rdar://problem/28384582>
3565
3566         Reviewed by Wenson Hsieh.
3567
3568         In -[WKActionSheet willRotate], we can't guarantee that the action sheet belongs
3569         in a window, and passing nil to +[UIViewController _viewControllerForFullScreenPresentationFromView:]
3570         throws an exception. To fix this, bail early if the result from -hostViewForSheet is nil.
3571
3572         * UIProcess/ios/WKActionSheet.mm:
3573         (-[WKActionSheet willRotate]):
3574
3575 2017-07-05  Eric Carlson  <eric.carlson@apple.com>
3576
3577         [MediaStream] Protect request and web view during gUM client callback
3578         https://bugs.webkit.org/show_bug.cgi?id=174096
3579         <rdar://problem/32833102>
3580
3581         Reviewed by Youenn Fablet.
3582
3583         Retain the message and WebView during asynchronous calls so they won't be 
3584         released if a navigation happens during a call to the UA for getUserMedia 
3585         or enumerateMediaDevices.
3586
3587         * UIProcess/Cocoa/UIDelegate.mm:
3588         (WebKit::requestUserMediaAuthorizationForDevices):
3589         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
3590         (WebKit::UIDelegate::UIClient::checkUserMediaPermissionForOrigin):
3591
3592 2017-07-05  Matt Lewis  <jlewis3@apple.com>
3593
3594         Unreviewed, rolling out r219128.
3595
3596         Spoke with engineer who originally submitted, Patch for APi
3597         test to follow.
3598
3599         Reverted changeset:
3600
3601         "Unreviewed, rolling out r219070."
3602         https://bugs.webkit.org/show_bug.cgi?id=174082
3603         http://trac.webkit.org/changeset/219128
3604
3605 2017-07-05  Matt Lewis  <jlewis3@apple.com>
3606
3607         Unreviewed, rolling out r219070.
3608
3609         This revision caused consistent failures of the API test
3610         UIPasteboardTests.DoNotPastePlainTextAsURL on iOS.
3611
3612         Reverted changeset:
3613
3614         "Pasting single words copied to UIPasteboard inserts URLs in
3615         editable areas"
3616         https://bugs.webkit.org/show_bug.cgi?id=174082
3617         http://trac.webkit.org/changeset/219070
3618
3619 2017-07-05  Zan Dobersek  <zdobersek@igalia.com>
3620
3621         [GLib] Incorrect <glib/gi18n.h> include in WebKitWebsiteData
3622         https://bugs.webkit.org/show_bug.cgi?id=174093
3623
3624         Reviewed by Michael Catanzaro.
3625
3626         * UIProcess/API/glib/WebKitWebsiteData.cpp: Include <glib/gi18n-lib.h>
3627         rather than <glib/gi18n.h>, since the former has to be included in a
3628         library while the latter should only be included in a standalone application.
3629
3630 2017-07-04  Joseph Pecoraro  <pecoraro@apple.com>
3631
3632         Cleanup some StringBuilder use
3633         https://bugs.webkit.org/show_bug.cgi?id=174118
3634
3635         Reviewed by Andreas Kling.
3636
3637         * NetworkProcess/capture/NetworkCaptureManager.cpp:
3638         (WebKit::NetworkCapture::Manager::hashToPath):
3639         * UIProcess/WebPageProxy.cpp:
3640
3641 2017-07-03  Wenson Hsieh  <wenson_hsieh@apple.com>
3642
3643         [iOS DnD] [WK2] Callout bar should reappear after dragging ends for a text selection
3644         https://bugs.webkit.org/show_bug.cgi?id=174116
3645         <rdar://problem/33017845>
3646
3647         Reviewed by Ryosuke Niwa.
3648
3649         -willStartScrollingOverflow -didEndScrollingOverflow are helper methods on both the UIWKTextInteractionAssistant
3650         and UIWebSelectionAssistant that handle hiding selection and callout bar UI during overflow scrolling and making
3651         it reappear after scrolling ends. However, these hooks do not contain logic specific to scrolling, and simply
3652         tell the inner UIWebSelectionView to either show or hide and are safe to invoke outside of the context of
3653         scrolling.
3654
3655         This patch invokes these hooks when beginning a drag on a selection, and when a dragging ends, if it called
3656         -willStartScrollingOverflow to begin with. We should rename these in the future to be something along the lines
3657         of -hideSelectionViewAndControls and -showSelectionViewAndControls, respectively, and adopt these new names in
3658         WebKit. We also move logic to hide the callout out of -itemsForBeginningSession: and into
3659         -willAnimateLiftWithAnimator:, when the lift actually begins.
3660
3661         * UIProcess/ios/WKContentViewInteraction.h:
3662         * UIProcess/ios/WKContentViewInteraction.mm:
3663         (-[WKContentView cleanUpDragSourceSessionState]):
3664         (-[WKContentView _restoreCalloutBarIfNeeded]):
3665         (-[WKContentView dragInteraction:itemsForBeginningSession:]):
3666         (-[WKContentView dragInteraction:willAnimateLiftWithAnimator:session:]):
3667         (-[WKContentView dragInteraction:session:didEndWithOperation:]):
3668
3669 2017-07-03  Matt Rajca  <mrajca@apple.com>
3670
3671         Add/remove appropriate media element behavior restrictions when updateWebsitePolicies is called
3672         https://bugs.webkit.org/show_bug.cgi?id=174103
3673
3674         Reviewed by Alex Christensen.
3675
3676         Currently, when -[WKWebView evaluateJavaScript:completionHandler:] is invoked, we end up simulating
3677         a user gesture unconditionally. This is not desireable for some tests, so I added a private variant
3678         of this method that takes a boolean that is ultimately passed to `executeScript` for the
3679         `forceUserGesture` parameter (instead of unconditionally passing `true`).
3680
3681         * UIProcess/API/C/WKPage.cpp:
3682         (WKPageRunJavaScriptInMainFrame):
3683         * UIProcess/API/Cocoa/WKWebView.mm:
3684         (-[WKWebView evaluateJavaScript:completionHandler:]):
3685         (-[WKWebView _evaluateJavaScript:forceUserGesture:completionHandler:]):
3686         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3687         * UIProcess/WebPageProxy.cpp:
3688         (WebKit::WebPageProxy::runJavaScriptInMainFrame):
3689         * UIProcess/WebPageProxy.h:
3690         * WebProcess/WebPage/WebPage.cpp:
3691         (WebKit::WebPage::runJavaScriptInMainFrame):
3692         (WebKit::WebPage::updateWebsitePolicies): Update behavior restrictions on any existing media elements.
3693         * WebProcess/WebPage/WebPage.h:
3694         * WebProcess/WebPage/WebPage.messages.in:
3695
3696 2017-07-03  Matt Lewis  <jlewis3@apple.com>
3697
3698         Unreviewed, rolling out r219103.
3699
3700         Caused multiple build failures.
3701
3702         Reverted changeset:
3703
3704         "Remove copy of ICU headers from WebKit"
3705         https://bugs.webkit.org/show_bug.cgi?id=116407
3706         http://trac.webkit.org/changeset/219103
3707
3708 2017-07-03  Myles C. Maxfield  <mmaxfield@apple.com>
3709
3710         Remove copy of ICU headers from WebKit
3711         https://bugs.webkit.org/show_bug.cgi?id=116407
3712
3713         Reviewed by Alex Christensen.
3714
3715         Use WTF's copy of ICU headers.
3716
3717         * Configurations/BaseTarget.xcconfig:
3718
3719 2017-07-03  Brady Eidson  <beidson@apple.com>
3720
3721         Switch all WebKit API related to favicons from WebIconDatabase over to new WebCore::IconLoader mechanism.
3722         https://bugs.webkit.org/show_bug.cgi?id=174073
3723
3724         Reviewed by Andy Estes.
3725
3726         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3727         (WebKit::WebFrameLoaderClient::getLoadDecisionForIcons):
3728         (WebKit::WebFrameLoaderClient::dispatchDidReceiveIcon): Deleted.
3729         (WebKit::WebFrameLoaderClient::registerForIconNotification): Deleted.
3730         (WebKit::WebFrameLoaderClient::getLoadDecisionForIcon): Deleted.
3731         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
3732
3733 2017-07-03  Sam Weinig  <sam@webkit.org>
3734
3735         [WebIDL] Remove more unnecessary uses of the preprocessor in idl files
3736         https://bugs.webkit.org/show_bug.cgi?id=174083
3737
3738         Reviewed by Alex Christensen.
3739
3740         * Configurations/FeatureDefines.xcconfig:
3741         Add ENABLE_NAVIGATOR_STANDALONE.
3742
3743 2017-07-03  Matt Lewis  <jlewis3@apple.com>
3744
3745         Unreviewed, rolling out r219083.
3746
3747         The revision caused an API failure on all testing platforms.
3748
3749         Reverted changeset:
3750
3751         "[MediaStream] Protect request and web view during gUM client
3752         callback"
3753         https://bugs.webkit.org/show_bug.cgi?id=174096
3754         http://trac.webkit.org/changeset/219083
3755
3756 2017-07-03  Ryosuke Niwa  <rniwa@webkit.org>
3757
3758         WebContent processes crash when the network process crashes with pending connection requests
3759         https://bugs.webkit.org/show_bug.cgi?id=174065
3760         <rdar://problem/30359835>
3761
3762         Reviewed by Tim Horton.
3763
3764         The bug was caused by the UI process clearing away pending network connection requests whenever the existing
3765         network process crashed. This resulted in WebContent process killing itself inside ensureNetworkProcessConnection.
3766
3767         Fixed the bug by re-launching a new network process when this happens. We don't try to re-launch a new process
3768         if the previous attempt to launch a network process had failed.
3769
3770         This patch splits NetworkProcessProxy::networkProcessCrashedOrFailedToLaunch into networkProcessFailedToLaunch
3771         and networkProcessCrashed to differentiate those two cases, and invoke the respective callbacks in WebProcessPool.
3772
3773         * UIProcess/API/Cocoa/WKProcessPool.mm:
3774         (-[WKProcessPool _networkProcessIdentifier]): Added.
3775         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
3776         * UIProcess/Network/NetworkProcessProxy.cpp:
3777         (WebKit::NetworkProcessProxy::networkProcessCrashed): Added.
3778         (WebKit::NetworkProcessProxy::networkProcessCrashedOrFailedToLaunch): Split into the two following functions.
3779         (WebKit::NetworkProcessProxy::networkProcessFailedToLaunch): Extracted from networkProcessCrashedOrFailedToLaunch.
3780         (WebKit::NetworkProcessProxy::clearCallbackStates): Extracted from networkProcessCrashedOrFailedToLaunch
3781         (WebKit::NetworkProcessProxy::didClose): Call networkProcessCrashed.
3782         (WebKit::NetworkProcessProxy::didFinishLaunching): Call networkProcessFailedToLaunch.
3783         * UIProcess/Network/NetworkProcessProxy.h:
3784         * UIProcess/WebProcessPool.cpp:
3785         (WebKit::WebProcessPool::networkProcessCrashed): Start a new network process when there are pending connection
3786         requests the crached network failed to fullfil.
3787         (WebKit::WebProcessPool::networkProcessFailedToLaunch):
3788         * UIProcess/WebProcessPool.h:
3789
3790 2017-07-03  Eric Carlson  <eric.carlson@apple.com>
3791
3792         [MediaStream] Protect request and web view during gUM client callback
3793         https://bugs.webkit.org/show_bug.cgi?id=174096
3794         <rdar://problem/32833102>
3795
3796         Reviewed by Youenn Fablet.
3797
3798         Retain the message and WebView during asynchronous calls so they won't be 
3799         released if a navigation happens during a call to the UA for getUserMedia 
3800         or enumerateMediaDevices.
3801
3802         * UIProcess/Cocoa/UIDelegate.mm:
3803         (WebKit::requestUserMediaAuthorizationForDevices):
3804         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
3805         (WebKit::UIDelegate::UIClient::checkUserMediaPermissionForOrigin):
3806
3807 2017-07-03  Andy Estes  <aestes@apple.com>
3808
3809         [Xcode] Add an experimental setting to build with ccache
3810         https://bugs.webkit.org/show_bug.cgi?id=173875
3811
3812         Reviewed by Tim Horton.
3813
3814         * Configurations/DebugRelease.xcconfig: Included ccache.xcconfig.
3815
3816 2017-07-03  Chris Dumez  <cdumez@apple.com>
3817
3818         Drop ResourceLoadStatisticsStore's statisticsLock
3819         https://bugs.webkit.org/show_bug.cgi?id=174080
3820
3821         Reviewed by Brent Fulgham.
3822
3823         Drop ResourceLoadStatisticsStore's statisticsLock. It added complexity and was only needed
3824         do that the SPI exposed to WebKitTestRunner would query the store synchronously from the
3825         main thread. Instead, I made the SPI asynchronous and make sure we always access the store
3826         from the same background thread. As a result, there is no longer any need for locking.
3827
3828         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
3829         (-[WKWebsiteDataStore _resourceLoadStatisticsIsPrevalentResource:completionHandler:]):
3830         (-[WKWebsiteDataStore _resourceLoadStatisticsHadUserInteraction:completionHandler:]):
3831         (-[WKWebsiteDataStore _resourceLoadStatisticsIsGrandfathered:completionHandler:]):
3832         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
3833         * UIProcess/Storage/ResourceLoadStatisticsStore.cpp:
3834         (WebKit::ResourceLoadStatisticsStore::isPrevalentResource):
3835         (WebKit::ResourceLoadStatisticsStore::isGrandFathered):
3836         (WebKit::ResourceLoadStatisticsStore::ensureResourceStatisticsForPrimaryDomain):
3837         (WebKit::ResourceLoadStatisticsStore::createEncoderFromData):
3838         (WebKit::ResourceLoadStatisticsStore::readDataFromDecoder):
3839         (WebKit::ResourceLoadStatisticsStore::clearInMemory):
3840         (WebKit::ResourceLoadStatisticsStore::mergeStatistics):
3841         (WebKit::ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler):
3842         (WebKit::ResourceLoadStatisticsStore::processStatistics):
3843         (WebKit::ResourceLoadStatisticsStore::topPrivatelyControlledDomainsToRemoveWebsiteDataFor):
3844         (WebKit::ResourceLoadStatisticsStore::sortedPrevalentResourceTelemetry):
3845         (WebKit::ResourceLoadStatisticsStore::updateStatisticsForRemovedDataRecords):
3846         (WebKit::ResourceLoadStatisticsStore::handleFreshStartWithEmptyOrNoStore):
3847         * UIProcess/Storage/ResourceLoadStatisticsStore.h:
3848         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3849         (WebKit::WebResourceLoadStatisticsStore::processStatisticsAndDataRecords):
3850         (WebKit::WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded):
3851         (WebKit::WebResourceLoadStatisticsStore::refreshFromDisk):
3852         (WebKit::WebResourceLoadStatisticsStore::clearInMemoryData):
3853         (WebKit::WebResourceLoadStatisticsStore::submitTelemetry):
3854         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
3855         (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction):
3856         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
3857         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResource):
3858         (WebKit::WebResourceLoadStatisticsStore::isPrevalentResource):
3859         (WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource):
3860         (WebKit::WebResourceLoadStatisticsStore::setGrandfathered):
3861         (WebKit::WebResourceLoadStatisticsStore::isGrandfathered):
3862         (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin):
3863         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin):
3864         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo):
3865         * UIProcess/WebResourceLoadStatisticsStore.h:
3866
3867 2017-07-03  Wenson Hsieh  <wenson_hsieh@apple.com>
3868
3869         Pasting single words copied to UIPasteboard inserts URLs in editable areas
3870         https://bugs.webkit.org/show_bug.cgi?id=174082
3871         <rdar://problem/33046992>
3872
3873         Reviewed by Tim Horton.
3874
3875         Add a hook to WKPreferences to allow programatic pasting.
3876
3877         * UIProcess/API/Cocoa/WKPreferences.mm:
3878         (-[WKPreferences _setDOMPasteAllowed:]):
3879         (-[WKPreferences _domPasteAllowed]):
3880         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
3881
3882 2017-07-03  Zan Dobersek  <zdobersek@igalia.com>
3883
3884         Unreviewed GTK+ and WPE build fix when building with GCC 4.9.
3885
3886         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
3887         (WebKit::CoordinatedLayerTreeHost::renderNextFrame): Don't use brace-list
3888         initialization to override the m_forceRepaintAsync struct. Instead, manually
3889         assign the OptionalCallbackID() value to the m_forceRepaintAsync.callbackID
3890         member variable, and override the m_forceRepaintAsync.needsFreshFlush member
3891         variable with `false`.
3892
3893 2017-07-03  Zan Dobersek  <zdobersek@igalia.com>
3894
3895         [ThreadedCompositor] Update and retrieve scene attributes under a Lock
3896         https://bugs.webkit.org/show_bug.cgi?id=173762
3897
3898         Reviewed by Carlos Garcia Campos.
3899
3900         Instead of dispatching separate tasks on the composition run loop, update
3901         various scene attributes by locking a common lock object and updating the
3902         appropriate attribute.
3903
3904         In ThreadedCompositor::renderLayerTree(), where these attributes are used
3905         in scene composition, the lock is again obtained and the attributes copied
3906         into local variables, releasing the lock afterwards. The attribute values
3907         in local copies are then used for that renderLayerTree() invocation.
3908
3909         This approach is more efficient than dispatching separate tasks that can
3910         race against renderLayerTree() dispatches.
3911
3912         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
3913         (WebKit::ThreadedCompositor::ThreadedCompositor):
3914         (WebKit::m_displayRefreshMonitor):
3915         (WebKit::ThreadedCompositor::setScaleFactor):
3916         (WebKit::ThreadedCompositor::setScrollPosition):
3917         (WebKit::ThreadedCompositor::setViewportSize):
3918         (WebKit::ThreadedCompositor::setDrawsBackground):
3919         (WebKit::ThreadedCompositor::renderLayerTree):
3920         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
3921
3922 2017-07-01  Dan Bernstein  <mitz@apple.com>
3923
3924         [iOS] Remove code only needed when building for iOS 9.x
3925         https://bugs.webkit.org/show_bug.cgi?id=174068
3926
3927         Reviewed by Tim Horton.
3928
3929         * Configurations/FeatureDefines.xcconfig:
3930         * Configurations/WebKit.xcconfig:
3931         * Platform/spi/ios/UIKitSPI.h:
3932         * UIProcess/API/Cocoa/WKWebView.mm:
3933         (-[WKWebView dealloc]):
3934         * UIProcess/ios/WKContentViewInteraction.mm:
3935         (-[WKFormInputSession setSuggestions:]):
3936         (-[WKFormInputSession invalidate]):
3937         (-[WKContentView insertTextSuggestion:]):
3938         (contentTypeFromFieldName):
3939         (-[WKContentView textInputTraits]):
3940         (-[WKContentView _dataForPreviewItemController:atPosition:type:]):
3941         * WebProcess/WebPage/ios/WebPageIOS.mm:
3942         (WebKit::WebPage::getPositionInformation):
3943         * config.h:
3944
3945 2017-07-01  Brady Eidson  <beidson@apple.com>
3946
3947         When setting a custom cookie storage location on a WKWebsiteDataStore, cookies aren't actually removed.
3948         <rdar://problem/32410662> and https://bugs.webkit.org/show_bug.cgi?id=174035
3949
3950         Reviewed by Alex Christensen.
3951
3952         * UIProcess/API/Cocoa/WKProcessPool.mm:
3953         (-[WKProcessPool _terminateNetworkProcess]):
3954         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
3955         
3956         * UIProcess/WebProcessPool.cpp:
3957         (WebKit::WebProcessPool::ensureNetworkProcess): Take an optional WebsiteDataStore. If one is passed in,
3958           send it to either the existing or new network process.
3959         * UIProcess/WebProcessPool.h:
3960         
3961         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
3962         (WebKit::WebsiteDataStore::parameters): Resolve paths first.
3963
3964         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3965         (WebKit::WebsiteDataStore::fetchDataAndApply):
3966         (WebKit::WebsiteDataStore::removeData):
3967
3968 2017-07-01  Ryosuke Niwa  <rniwa@webkit.org>
3969
3970         Frame.h doesn't need to include FrameLoader.h, IntRect.h, and NavigationScheduler.h
3971         https://bugs.webkit.org/show_bug.cgi?id=174004
3972
3973         Reviewed by Simon Fraser.
3974
3975         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
3976         * WebProcess/WebPage/WebInspector.cpp:
3977
3978 2017-07-01  Dan Bernstein  <mitz@apple.com>
3979
3980         [macOS] Remove code only needed when building for OS X Yosemite
3981         https://bugs.webkit.org/show_bug.cgi?id=174067
3982
3983         Reviewed by Tim Horton.
3984
3985         * Configurations/Base.xcconfig:
3986         * Configurations/BaseTarget.xcconfig:
3987         * Configurations/BaseXPCService.xcconfig:
3988         * Configurations/DebugRelease.xcconfig:
3989         * Configurations/FeatureDefines.xcconfig:
3990         * Configurations/NetworkService.xcconfig:
3991         * Configurations/PluginService.32.xcconfig:
3992         * Configurations/PluginService.64.xcconfig:
3993         * Configurations/Version.xcconfig:
3994         * Configurations/WebContentService.xcconfig:
3995         * Configurations/WebKit.xcconfig:
3996         * DatabaseProcess/mac/com.apple.WebKit.Databases.sb.in:
3997         * NetworkProcess/EntryPoint/mac/XPCService/NetworkService/Info-OSX-10.9-10.10.plist: Removed.
3998         * NetworkProcess/NetworkProcessCreationParameters.cpp:
3999         (WebKit::NetworkProcessCreationParameters::encode):
4000         (WebKit::NetworkProcessCreationParameters::decode):
4001         * NetworkProcess/NetworkProcessCreationParameters.h:
4002         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
4003         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
4004     &nbs