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