10af92c8adf8d1b9375c00b1eff3b97e0ad0ae9a
[WebKit-https.git] / Source / WebKit2 / ChangeLog
1 2016-12-21  Beth Dakin  <bdakin@apple.com>
2
3         Holding down on candidates in the TouchBar should show panel on screen
4         https://bugs.webkit.org/show_bug.cgi?id=166367
5         -and corresponding-
6         <rdar://problem/28479236>
7
8         Reviewed by Tim Horton.
9
10         The showCandidates() helper function is not needed. We can call the AppKit method 
11         directly at the one call site.
12         * UIProcess/Cocoa/WebViewImpl.h:
13         * UIProcess/Cocoa/WebViewImpl.mm:
14
15         The panel should appear under the selection, so offset the selection rect.
16         (WebKit::WebViewImpl::handleRequestedCandidates):
17
18         No more showCandidates() since we can call it directly. 
19         (WebKit::WebViewImpl::showCandidates): Deleted.
20
21 2016-12-20  Taras Tsugrii  <ttsugrii@fb.com>
22
23         Fix undefined behavior caused by macro expansion producing 'defined'
24         https://bugs.webkit.org/show_bug.cgi?id=166047
25
26         Reviewed by Darin Adler.
27
28         * Shared/API/Cocoa/WKFoundation.h:
29
30 2016-12-20  Brent Fulgham  <bfulgham@apple.com>
31
32         Address some style problems found by static analysis
33         https://bugs.webkit.org/show_bug.cgi?id=165975
34
35         Reviewed by Alex Christensen.
36
37         Avoid passing large ANGLE data structures through the ANGLEWebKitBridge methods.
38
39         * Shared/WebBackForwardListItem.cpp:
40         (WebKit::WebBackForwardListItem::create):
41         (WebKit::WebBackForwardListItem::WebBackForwardListItem):
42         * Shared/WebBackForwardListItem.h:
43
44 2016-12-20  Simon Fraser  <simon.fraser@apple.com>
45
46         [iOS WK2] Switching or closing a tab leads to all-white tab content if the status bar is double height
47         https://bugs.webkit.org/show_bug.cgi?id=166286
48         rdar://problem/29593525
49
50         Reviewed by Tim Horton.
51
52         A double-height status bar triggers view resize while snapshotting in the background,
53         which also triggers calls to _endAnimatedResize on tab resume. However, it was possible
54         for _endAnimatedResize to re-enter via synchronizeDynamicViewportUpdate()/didCommitLayerTree(),
55         causing us to use a nil _resizeAnimationView for scale computations, thus setting a zero
56         scale on the WKContentView.
57
58         Fix by checking _dynamicViewportUpdateMode again after the call to synchronizeDynamicViewportUpdate(),
59         and do a belt-and-braces check for a nil _resizeAnimationView.
60
61         * UIProcess/API/Cocoa/WKWebView.mm:
62         (-[WKWebView _endAnimatedResize]):
63
64 2016-12-20  Andy Estes  <aestes@apple.com>
65
66         [Cocoa] REGRESSION (r209558): Calling decisionHandler multiple times in webView:decidePolicyForNavigationAction:decisionHandler: leads to a crash
67         https://bugs.webkit.org/show_bug.cgi?id=165992
68         <rdar://problem/29693817>
69
70         Reviewed by Brady Eidson.
71
72         r209558 added additional move semantics to the decisionHandler block passed to
73         -webView:decidePolicyForNavigationAction:decisionHandler:, resulting in a null pointer
74         dereference in clients that call the decisionHandler block more than once.
75
76         None of the completion handlers we expose in the WebKit API are intended to be called more
77         than once, and we ASSERT in CompletionHandlerCallChecker::didCallCompletionHandler() that
78         this doesn't happen.
79
80         This change strenghtens that protection by returning immediately in completion handlers
81         called more than once. And in programs linked on or after WebKit 603.1.17, an NSException is
82         thrown if a completion handler is called a second time, like we do for completion handlers
83         that are never called.
84
85         New API test: WebKit2.DuplicateCompletionHandlerCalls
86
87         * Shared/Cocoa/CompletionHandlerCallChecker.h: Declared completionHandlerHasBeenCalled().
88         * Shared/Cocoa/CompletionHandlerCallChecker.mm:
89         (WebKit::shouldThrowExceptionForDuplicateCompletionHandlerCall): Added. Returns true if the
90         program is linked on or after
91         LibraryVersion::FirstWithExceptionsForDuplicateCompletionHandlerCalls.
92         (WebKit::CompletionHandlerCallChecker::completionHandlerHasBeenCalled): Added. Returns
93         whether or not the completion handler has been called. If it has, and
94         shouldThrowExceptionForDuplicateCompletionHandlerCall() returns true, throws an
95         NSInternalInconsistencyException.
96         * UIProcess/API/Cocoa/WKWebView.mm:
97         (-[WKWebView _setInputDelegate:]): Added an early return if the completion handler has
98         already been called.
99         * UIProcess/Cocoa/NavigationState.mm:
100         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction): Ditto.
101         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse): Ditto.
102         (WebKit::NavigationState::NavigationClient::didReceiveAuthenticationChallenge): Ditto.
103         * UIProcess/Cocoa/UIDelegate.mm:
104         (WebKit::UIDelegate::UIClient::runJavaScriptAlert): Ditto.
105         (WebKit::UIDelegate::UIClient::runJavaScriptConfirm): Ditto.
106         (WebKit::UIDelegate::UIClient::runJavaScriptPrompt): Ditto.
107         (WebKit::UIDelegate::UIClient::exceededDatabaseQuota): Ditto.
108         (WebKit::UIDelegate::UIClient::runOpenPanel): Ditto.
109         (WebKit::UIDelegate::UIClient::reachedApplicationCacheOriginQuota): Ditto.
110         * UIProcess/Cocoa/VersionChecks.h: Added
111         FirstWithExceptionsForDuplicateCompletionHandlerCalls with the version number for 603.1.17.
112
113 2016-12-20  Dean Jackson  <dino@apple.com>
114
115         Remove INDIE_UI
116         https://bugs.webkit.org/show_bug.cgi?id=165881
117         <rdar://problem/29672532>
118
119         Reviewed by Simon Fraser.
120
121         The Indie UI work has been discontinued.
122
123         * Configurations/FeatureDefines.xcconfig:
124
125 2016-12-20  Wenson Hsieh  <wenson_hsieh@apple.com>
126
127         Implement the updated port/area-based Scroll Snap Module Level 1 Spec
128         https://bugs.webkit.org/show_bug.cgi?id=165317
129         <rdar://problem/29490956>
130
131         Reviewed by Dean Jackson.
132
133         Remove unused code for adopting scroll snapping in the PDF plugin.
134
135         * WebProcess/Plugins/PDF/PDFPlugin.mm:
136         (WebKit::PDFPlugin::didCalculateSizes):
137
138 2016-12-19  Yusuke Suzuki  <utatane.tea@gmail.com>
139
140         [ES6] Enable ES6 Modules
141         https://bugs.webkit.org/show_bug.cgi?id=165849
142
143         Reviewed by Geoffrey Garen.
144
145         * Shared/WebPreferencesDefinitions.h:
146         * UIProcess/API/C/WKPreferences.cpp:
147         (WKPreferencesSetES6ModulesEnabled): Deleted.
148         (WKPreferencesGetES6ModulesEnabled): Deleted.
149         * UIProcess/API/C/WKPreferencesRefPrivate.h:
150         * WebProcess/InjectedBundle/InjectedBundle.cpp:
151         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
152         * WebProcess/WebPage/WebPage.cpp:
153         (WebKit::WebPage::updatePreferences):
154
155 2016-12-19  Keith Rollin  <krollin@apple.com>
156
157         Fix unwanted deletion of record/replay files
158         https://bugs.webkit.org/show_bug.cgi?id=166040
159
160         Reviewed by Alex Christensen.
161
162         As part of some refactoring, the objects that create the meta files
163         that are part of the record/replay cache would get deleted. They were
164         always getting opened in "write" mode", which would truncate the
165         files. Fix this so that the files are opened in the right modes for
166         record, replay, and neither.
167
168         * NetworkProcess/capture/NetworkCaptureManager.cpp:
169         (WebKit::NetworkCapture::Manager::initialize):
170
171 2016-12-19  Gavin Barraclough  <barraclough@apple.com>
172
173         [CSS Parser] Enable CSS Deferred Parsing
174         https://bugs.webkit.org/show_bug.cgi?id=165869
175
176         Unreviewed rollout – looks like this regressed performance.
177
178         * Shared/WebPreferencesDefinitions.h:
179
180 2016-12-19  Anders Carlsson  <andersca@apple.com>
181
182         REGRESSION: Crash in com.apple.WebKit:IPC::Connection::platformCanSendOutgoingMessages() const + 0
183         https://bugs.webkit.org/show_bug.cgi?id=165817
184         rdar://problem/29626731
185
186         Reviewed by Dan Bernstein.
187
188         If the receive right is invalidated before we send the message, the kernel won't be able to create a send right,
189         and we'll crash due to mach_msg returning MACH_SEND_INVALID_RIGHT.
190         
191         Fix this by immediately creating a send right, and passing MACH_MSG_TYPE_MOVE_SEND to the attachment constructor.
192
193         * WebProcess/WebPage/WebInspector.cpp:
194         (WebKit::WebInspector::openFrontendConnection):
195
196 2016-12-18  Simon Fraser  <simon.fraser@apple.com>
197
198         Expose a way for MiniBrowser to simulate header and footer banners
199         https://bugs.webkit.org/show_bug.cgi?id=166005
200
201         Reviewed by Wenson Hsieh.
202         
203         Expose testing SPI that allows a client to simulate the presence of header
204         and footer banners. These are simply plumbed through to set FrameView's
205         m_headerHeight and m_footerHeight.
206
207         * UIProcess/API/Cocoa/WKWebView.mm:
208         (-[WKWebView _setHeaderBannerHeightForTesting:]):
209         (-[WKWebView _setFooterBannerHeightForTesting:]):
210         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
211         * UIProcess/WebPageProxy.cpp:
212         (WebKit::WebPageProxy::setHeaderBannerHeightForTesting):
213         (WebKit::WebPageProxy::setFooterBannerHeightForTesting):
214         * UIProcess/WebPageProxy.h:
215         * WebProcess/WebPage/WebPage.cpp:
216         (WebKit::WebPage::setHeaderBannerHeightForTesting):
217         (WebKit::WebPage::setFooterBannerHeightForTesting):
218         * WebProcess/WebPage/WebPage.h:
219         * WebProcess/WebPage/WebPage.messages.in:
220
221 2016-12-16  Dave Hyatt  <hyatt@apple.com>
222
223         [CSS Values] Make separate wrapper classes for the deprecated CSS Values OM
224         https://bugs.webkit.org/show_bug.cgi?id=165968
225
226         Reviewed by Andreas Kling.
227
228         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSValue.cpp:
229         (WebKit::kit):
230         (WebKit::core):
231         (WebKit::wrapCSSValue):
232         (webkit_dom_css_value_constructor):
233         (webkit_dom_css_value_get_css_text):
234         (webkit_dom_css_value_set_css_text):
235         (webkit_dom_css_value_get_css_value_type):
236         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSValuePrivate.h:
237
238 2016-12-17  Wenson Hsieh  <wenson_hsieh@apple.com>
239
240         Visual viewports: bottom fixed elements disappear behind the keyboard
241         https://bugs.webkit.org/show_bug.cgi?id=165983
242         <rdar://problem/29409852>
243
244         Reviewed by Simon Fraser.
245
246         Accounts for input view bounds in WebPageProxy::computeCustomFixedPositionRect. To do this, we introduce and
247         pass unobscuredContentRectRespectingInputViewBounds along with the regular unobscuredContentRect (which does not
248         respect the obscuring keyboard rect). This unobscuredContentRectRespectingInputViewBounds is then used when
249         computing the origin of the updated layout viewport rect (and also, when we are _not_ below minimum scale),
250         
251         Additionally, the size is computed using the (unconstrained) unobscured rect. This is because we previously
252         would use the document-constrained version of the unobscured rect, which caused the layout viewport to shrink
253         when approaching the max scroll extents of the document while the keyboard is up, since the unobscured rect
254         would spill out of the document rect. However, using this unconstrained rect's size also means that if the user
255         rubber-bands out of the document rect, we would end up pushing the layout viewport rect out of the document,
256         with no way of adjusting it back in without the user scrolling to push the layout viewport into back document
257         bounds. To address this, we move the layout rect to be within document bounds after computing its size and
258         location.
259
260         Added a new layout test: fast/visual-viewport/ios/fixed-element-on-bottom-with-keyboard.html, and also tweaked
261         fixed-caret-position-after-scroll.html to cover these changes.
262
263         * Shared/VisibleContentRectUpdateInfo.cpp:
264         (WebKit::operator<<):
265         * Shared/VisibleContentRectUpdateInfo.h:
266         (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
267         (WebKit::VisibleContentRectUpdateInfo::unobscuredContentRectRespectingInputViewBounds):
268         * UIProcess/API/Cocoa/WKWebView.mm:
269         (-[WKWebView _updateContentRectsWithState:]):
270         (-[WKWebView _inputViewBounds]):
271
272         Returns the current bounds of the input view. For testing purposes.
273
274         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
275         * UIProcess/WebPageProxy.h:
276         (WebKit::WebPageProxy::unobscuredContentRectRespectingInputViewBounds):
277         * UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm:
278         (WebKit::RemoteScrollingCoordinatorProxy::customFixedPositionRect):
279         * UIProcess/ios/WKContentView.h:
280         * UIProcess/ios/WKContentView.mm:
281         (-[WKContentView _computeUnobscuredContentRectRespectingInputViewBounds:unobscuredContentRect:inputViewBounds:scale:]):
282
283         Helper to compute the unobscured rect, accounting for the bounds of the current input view.
284
285         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
286         (-[WKContentView _didCommitLayerTree:]):
287         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]): Deleted.
288         * UIProcess/ios/WebPageProxyIOS.mm:
289         (WebKit::WebPageProxy::computeCustomFixedPositionRect):
290         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
291         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
292
293 2016-12-16  Ryosuke Niwa  <rniwa@webkit.org>
294
295         Deleting a character converted from pinyin after an image causes a Safari crash
296         https://bugs.webkit.org/show_bug.cgi?id=165839
297
298         Reviewed by Darin Adler.
299
300         The crash was caused by the payload of the IPC not being decoded correctly when the encoded attributed string
301         contains a NSTextAttachment but send<> would still gladly send it to the UIProcess.
302
303         Fixed it by omitting the image as done in r176412 since encoding NSFileWrapper, etc... would require
304         quite a bit of work, and IME doesn't really need to see the image in its attributed string.
305
306         * WebProcess/WebPage/mac/WebPageMac.mm:
307         (WebKit::WebPage::attributedSubstringForCharacterRangeAsync): Fixed the bug.
308
309 2016-12-16  Andy Estes  <aestes@apple.com>
310
311         Add a setting to suppress keyboard input during provisional navigation
312         https://bugs.webkit.org/show_bug.cgi?id=165830
313
314         Reviewed by Brent Fulgham.
315
316         * Shared/WebPreferencesDefinitions.h: Defined
317         shouldSuppressKeyboardDOMEventsDuringProvisionalNavigation.
318         * UIProcess/API/C/WKPreferences.cpp:
319         (WKPreferencesSetShouldSuppressKeyboardInputDuringProvisionalNavigation): Added.
320         (WKPreferencesGetShouldSuppressKeyboardInputDuringProvisionalNavigation): Added.
321         * UIProcess/API/C/WKPreferencesRefPrivate.h: Declared a getter and setter for the new
322         preference.
323         * UIProcess/API/Cocoa/WKPreferences.mm:
324         (-[WKPreferences _shouldSuppressKeyboardInputDuringProvisionalNavigation]): Added.
325         (-[WKPreferences _setShouldSuppressKeyboardInputDuringProvisionalNavigation:]): Added.
326         * UIProcess/API/Cocoa/WKPreferencesPrivate.h: Declared a property for the new preference.
327         * WebProcess/WebPage/WebPage.cpp:
328         (WebKit::WebPage::updatePreferences): Mapped the new preference to its corresponding
329         WebCore::Setting.
330
331 2016-12-16  Chris Dumez  <cdumez@apple.com>
332
333         HTML form validation bubble should be dismissed on navigation
334         https://bugs.webkit.org/show_bug.cgi?id=165960
335         <rdar://problem/29668086>
336
337         Reviewed by Simon Fraser.
338
339         Dismiss HTML form validation bubble on top-level navigation on WK2.
340
341         * UIProcess/WebPageProxy.cpp:
342         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
343
344 2016-12-16  Jer Noble  <jer.noble@apple.com>
345
346         Small refactor: Use HashCountedSet rather than HashMap<..., int> to store client counts in WebPlaybackSessionManager{,Proxy}.
347         https://bugs.webkit.org/show_bug.cgi?id=165807
348
349         Reviewed by Eric Carlson.
350
351         * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.h:
352         * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.mm:
353         (WebKit::WebPlaybackSessionManagerProxy::addClientForContext):
354         (WebKit::WebPlaybackSessionManagerProxy::removeClientForContext):
355         * WebProcess/cocoa/WebPlaybackSessionManager.h:
356         * WebProcess/cocoa/WebPlaybackSessionManager.mm:
357         (WebKit::WebPlaybackSessionManager::addClientForContext):
358         (WebKit::WebPlaybackSessionManager::removeClientForContext):
359
360 2016-12-16  Wenson Hsieh  <wenson_hsieh@apple.com>
361
362         Visual viewports: carets and selection UI are incorrectly positioned when editing fixed elements
363         https://bugs.webkit.org/show_bug.cgi?id=165767
364         <rdar://problem/29602382>
365
366         Reviewed by Simon Fraser.
367
368         When focusing an input, the position of the caret on iOS is determined by the overridden layout viewport rect in
369         the web process. However, this rect is not updated until the end the scroll gesture. Whereas this is fine for
370         non-fixed inputs since their document location does not change, fixed inputs effectively change their position
371         in the document as the user scrolls. This causes the caret to be 'left behind' in the document position it was
372         in at the start of the scroll. To fix this, we deactivate the selection when exiting stable state if the
373         assisted node is in a fixed position container, and reenable it upon receiving the next stable state EditorState
374         update (as indicated by postLayoutData().isStableStateUpdate). Additionally, we apply similar treatment to the
375         web selection assistant -- this time, we need to force the selection view to hide (analagous to deactivating
376         the text selection assistant) and show it again upon receiving the next selection change update when the WebPage
377         (in the web process) is stable.
378
379         Furthermore, adds test support for querying text caret and selection rects, as well as perform a callback after
380         the WebPage has indicated that it is stable, both as SPI on the WKWebView.
381
382         Covered by 4 new layout tests in fast/editing/caret/ios and fast/editing/selection/ios.
383
384         * Platform/spi/ios/UIKitSPI.h:
385         * Shared/EditorState.cpp:
386         (WebKit::EditorState::PostLayoutData::encode):
387         (WebKit::EditorState::PostLayoutData::decode):
388         * Shared/EditorState.h:
389
390         Introduce isStableStateUpdate, which is true when the WebPage is known to be in stable state, as well as
391         insideFixedPosition, which is true when the current selection is inside a fixed position container.
392
393         * Shared/mac/RemoteLayerTreeTransaction.h:
394         (WebKit::RemoteLayerTreeTransaction::isInStableState):
395         (WebKit::RemoteLayerTreeTransaction::setIsInStableState):
396         * Shared/mac/RemoteLayerTreeTransaction.mm:
397         (WebKit::RemoteLayerTreeTransaction::encode):
398         (WebKit::RemoteLayerTreeTransaction::decode):
399         (WebKit::RemoteLayerTreeTransaction::description):
400         * UIProcess/API/Cocoa/WKWebView.mm:
401         (-[WKWebView _didCommitLayerTree:]):
402         (-[WKWebView _uiTextCaretRect]):
403
404         Introduced a new SPI method for fetching the current rect of the text assistant's caret view, at keyPath
405         "selectionView.selection.caretRect".
406
407         (-[WKWebView _uiTextSelectionRects]):
408
409         Renamed (and refactored) from _uiTextSelectionRectViews, which was previously fetching an array of UIViews. I
410         found this to cause character-granularity-rect.html to fail due to the array of UIViews here being empty, so I
411         refactored this to simply return an array of rects from the keyPath "selectionView.selection.selectionRects" for
412         the text selection assistant and @"selectionView.selectionRects" for the web selection assistant.
413
414         (-[WKWebView _doAfterNextStablePresentationUpdate:]):
415
416         Runs the given block after both the UI process and web processes agree that the visible content rect state is 
417         stable. To do this, we fire presentation updates until the UI process (via RemoteLayerTreeTransactions)
418         discovers that the web page is in stable state. This is used solely for testing purposes.
419
420         (-[WKWebView _firePresentationUpdateForPendingStableStatePresentationCallbacks]):
421         (-[WKWebView _uiTextSelectionRectViews]): Deleted.
422         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
423         * UIProcess/WebPageProxy.h:
424         (WebKit::WebPageProxy::inStableState):
425         * UIProcess/ios/WKContentView.mm:
426         (-[WKContentView _didExitStableState]):
427
428         Deactivate the text selection if the assisted node is inside a fixed container.
429
430         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
431         * UIProcess/ios/WKContentViewInteraction.h:
432         * UIProcess/ios/WKContentViewInteraction.mm:
433         (-[WKContentView setupInteraction]):
434         (-[WKContentView cleanupInteraction]):
435         (-[WKContentView shouldHideSelectionWhenScrolling]):
436         (-[WKContentView _uiTextSelectionRects]):
437         (-[WKContentView _didEndScrollingOrZooming]):
438         (-[WKContentView _updateChangedSelection:]):
439
440         If the EditorState was created after a stable state update, reactivate the text selection assistant if it exists.
441         Additionally, if we are deferring the end scrolling selection update until after the first stable editor state
442         update arrives from the web process, we need to also call [_textSelectionAssistant didEndScrollingOverflow]
443         and [_webSelectionAssistant didEndScrollingOrZoomingPage] here instead of doing so immediately after scrolling
444         finishes. This ensures that selection UI (the callout and selection highlights) do not flicker from their old
445         position to the new position when scrolling finishes.
446
447         * WebProcess/WebPage/WebPage.cpp:
448         (WebKit::WebPage::willCommitLayerTree):
449         * WebProcess/WebPage/ios/WebPageIOS.mm:
450         (WebKit::WebPage::platformEditorState):
451         (WebKit::WebPage::updateVisibleContentRects):
452
453         When updating the layout viewport override rect, also recompute the caret if needed and send an updated
454         EditorState over to the UI process.
455
456 2016-12-16  Claudio Saavedra  <csaavedra@igalia.com>
457
458         [WK2] SharedMemory: include cleanups
459         https://bugs.webkit.org/show_bug.cgi?id=165950
460
461         Reviewed by Žan Doberšek.
462
463         The WTFString include is not needed in the header, so move to the
464         Unix file. Use the existing UNIX_DOMAIN_SOCKETS define. Also
465         include the WTFOptional header where needed.
466
467         * Platform/SharedMemory.h:
468         * Platform/unix/SharedMemoryUnix.cpp:
469
470 2016-12-16  Joonghun Park  <jh718.park@samsung.com>
471
472         [EFL] Fix build break since r209907. Unreviewed.
473         https://bugs.webkit.org/show_bug.cgi?id=165954
474
475         * UIProcess/efl/TextCheckerEfl.cpp: Change the remaining TextBreakIterator to UBreakIterator
476         (WebKit::nextWordOffset):
477         (WebKit::TextChecker::checkTextOfParagraph):
478
479 2016-12-15  Darin Adler  <darin@apple.com>
480
481         Use asString instead of toWTFString, toString, or getString when we already checked isString
482         https://bugs.webkit.org/show_bug.cgi?id=165895
483
484         Reviewed by Yusuke Suzuki.
485
486         * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
487         (WebKit::NPRuntimeObjectMap::convertJSValueToNPVariant): Use asString/value instead of toWTFString.
488
489 2016-12-15  Chris Dumez  <cdumez@apple.com>
490
491         Make sure HTML validation bubble's state is updated after layout
492         https://bugs.webkit.org/show_bug.cgi?id=165922
493         <rdar://problem/29694730>
494
495         Reviewed by Simon Fraser.
496
497         Make sure HTML validation bubble's state is updated after layout.
498         In particular, if the validation bubble's associated element has
499         moved or is no longer visible, we now hide the bubble.
500
501         * WebProcess/WebCoreSupport/WebValidationMessageClient.cpp:
502         (WebKit::WebValidationMessageClient::showValidationMessage):
503         (WebKit::WebValidationMessageClient::hideValidationMessage):
504         (WebKit::WebValidationMessageClient::updateValidationBubbleStateIfNeeded):
505         * WebProcess/WebCoreSupport/WebValidationMessageClient.h:
506
507 2016-12-15  Alex Christensen  <achristensen@webkit.org>
508
509         Improve NetworkSession logging
510         https://bugs.webkit.org/show_bug.cgi?id=165941
511
512         Reviewed by Tim Horton.
513
514         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
515         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
516         (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]):
517         (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
518         One of the "didReceiveResponse completionHandler (cancel)" messages was wrong,
519         and other messages could have more useful information without being overwhelming.
520
521 2016-12-15  Myles C. Maxfield  <mmaxfield@apple.com>
522
523         Sort Xcode project files
524         https://bugs.webkit.org/show_bug.cgi?id=165937
525
526         Reviewed by Simon Fraser.
527
528         * WebKit2.xcodeproj/project.pbxproj:
529
530 2016-12-15  Anders Carlsson  <andersca@apple.com>
531
532         Add more mach_msg logging instrumentation
533         https://bugs.webkit.org/show_bug.cgi?id=165914
534
535         Reviewed by Darin Adler.
536
537         * Platform/IPC/mac/ConnectionMac.mm:
538         (IPC::Connection::sendMessage):
539         (IPC::Connection::sendOutgoingMessage):
540         * Platform/IPC/mac/MachMessage.h:
541         (IPC::MachMessage::messageName):
542         (IPC::MachMessage::setMessageName):
543
544 2016-12-15  Konstantin Tokarev  <annulen@yandex.ru>
545
546         Added missing override and final specifiers
547         https://bugs.webkit.org/show_bug.cgi?id=165903
548
549         Reviewed by Darin Adler.
550
551         * UIProcess/API/gtk/WebKitGeolocationProvider.h:
552         * UIProcess/WebFormSubmissionListenerProxy.h:
553         * UIProcess/WebFramePolicyListenerProxy.h:
554         * WebProcess/Automation/WebAutomationSessionProxy.h:
555         * WebProcess/InjectedBundle/API/gtk/DOM/GObjectXPathNSResolver.h:
556         * WebProcess/MediaCache/WebMediaKeyStorageManager.h:
557         * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.h:
558         * WebProcess/WebCoreSupport/WebPlugInClient.h:
559         * WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.h:
560         * WebProcess/WebPage/FindController.h:
561
562 2016-12-15  Simon Fraser  <simon.fraser@apple.com>
563
564         [iOS WK2] Don't disable position:fixed when a form element has focus
565         https://bugs.webkit.org/show_bug.cgi?id=165891
566         rdar://problem/29271694
567
568         Reviewed by Wenson Hsieh.
569
570         Before visual viewports, we had to lay out position:fixed relative to the document rect (effectively
571         disabling position:fixed) when a form element was focused, to ensure that we could scroll to inputs
572         inside position:Fixed.
573
574         When visual viewports are enabled, we can do a better job of this, and keep position:fixed active.
575         
576         Test: fast/visual-viewport/ios/zoomed-focus-in-fixed.html
577
578         * UIProcess/API/Cocoa/WKWebView.mm: 
579         (-[WKWebView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]): Soon this will use
580         insideFixed to have better scroll-into-view behavior.
581         (-[WKWebView _zoomToFocusRect:selectionRect:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]): Deleted.
582         * UIProcess/API/Cocoa/WKWebViewInternal.h:
583         * UIProcess/ios/WKContentView.h:
584         * UIProcess/ios/WKContentView.mm:
585         (-[WKContentView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]):
586         (-[WKContentView _zoomToFocusRect:selectionRect:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]): Deleted.
587         * UIProcess/ios/WKContentViewInteraction.mm:
588         (-[WKContentView _displayFormNodeInputView]):
589         * UIProcess/ios/WebPageProxyIOS.mm:
590         (WebKit::WebPageProxy::computeCustomFixedPositionRect): Don't fall back to using the documentRect as the fixed
591         position rect if visual viewports are enabled.
592         * WebProcess/WebPage/ios/WebPageIOS.mm:
593         (WebKit::WebPage::getAssistedNodeInformation): Don't reset the customtFixedPositionRect around computing element
594         coordinates if visual viewports are enabled.
595
596 2016-12-15  Andreas Kling  <akling@apple.com>
597
598         Always clear RenderLayer backing stores when going into page cache.
599         <https://webkit.org/b/165901>
600
601         Reviewed by Simon Fraser.
602
603         * WebProcess/WebProcess.cpp:
604         (WebKit::WebProcess::WebProcess):
605
606 2016-12-15  Darin Adler  <darin@apple.com>
607
608         Remove custom binding for MediaDevices
609         https://bugs.webkit.org/show_bug.cgi?id=165894
610
611         Reviewed by Eric Carlson.
612
613         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
614         Added include of MediaConstraintsImpl.h, now needed because we
615         removed some unneeded includes from the WebCore headers.
616
617 2016-12-15  Dave Hyatt  <hyatt@apple.com>
618
619         [CSS Parser] Enable CSS Deferred Parsing
620         https://bugs.webkit.org/show_bug.cgi?id=165869
621
622         Reviewed by Sam Weinig.
623
624         * Shared/WebPreferencesDefinitions.h:
625
626 2016-12-14  Andreas Kling  <akling@apple.com>
627
628         Only send Messages::WebPageProxy::DidSaveToPageCache once when entering page cache.
629         <https://webkit.org/b/165887>
630
631         Reviewed by Brady Eidson.
632
633         We were sending one of these IPC messages per frame when a page enters the page cache,
634         and we really only need one, so only do it for the main frame.
635
636         (This message is used to adopt the page cache on the UI process side, in case another
637         web process currently owns the cache. That happens in WebProcessPool::processDidCachePage().)
638
639         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
640         (WebKit::WebFrameLoaderClient::didSaveToPageCache):
641
642 2016-12-14  Simon Fraser  <simon.fraser@apple.com>
643
644         Fix cause of viewport-related flakiness in iOS tests
645         https://bugs.webkit.org/show_bug.cgi?id=165878
646
647         Reviewed by Tim Horton.
648
649         When TestController::platformConfigureViewForTest() changes the view size for a flexible
650         viewport test, the page would not have updated with the new scale by the time the load event
651         fired, causing flakiness depending on test order.
652
653         This was caused by code added in r170325 that delayed visible content rect updates until
654         after the UI process has received the transaction after didCommitLoad. So fix by overriding
655         this mechanism if the view has been resized.
656
657         * Shared/VisibleContentRectUpdateInfo.cpp:
658         (WebKit::VisibleContentRectUpdateInfo::encode):
659         (WebKit::VisibleContentRectUpdateInfo::decode):
660         (WebKit::operator<<):
661         * Shared/VisibleContentRectUpdateInfo.h:
662         (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
663         (WebKit::VisibleContentRectUpdateInfo::isFirstUpdateForNewViewSize):
664         (WebKit::operator==):
665         * UIProcess/API/Cocoa/WKWebView.mm:
666         (-[WKWebView _frameOrBoundsChanged]):
667         (-[WKWebView _updateContentRectsWithState:]):
668         * UIProcess/DrawingAreaProxy.cpp:
669         (WebKit::DrawingAreaProxy::setSize):
670         * UIProcess/DrawingAreaProxy.h:
671         * UIProcess/WebPageProxy.cpp:
672         (WebKit::WebPageProxy::WebPageProxy):
673         * UIProcess/WebPageProxy.h:
674         * UIProcess/ios/WKContentView.h:
675         * UIProcess/ios/WKContentView.mm:
676         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
677         * WebProcess/WebPage/ios/WebPageIOS.mm:
678         (WebKit::WebPage::updateVisibleContentRects):
679
680 2016-12-04  Sam Weinig  <sam@webkit.org>
681
682         [WebIDL] Add support for converting dictionaries to JS
683         https://bugs.webkit.org/show_bug.cgi?id=165367
684
685         Reviewed by Chris Dumez.
686
687         * CMakeLists.txt:
688         Add missing directories to look in for headers.
689
690 2016-12-14  Anders Carlsson  <andersca@apple.com>
691
692         Add WKContextRefreshPlugIns
693         https://bugs.webkit.org/show_bug.cgi?id=165879
694         rdar://problem/29602414
695
696         Reviewed by Tim Horton.
697
698         * UIProcess/API/C/WKContext.cpp:
699         (WKContextRefreshPlugIns):
700         * UIProcess/API/C/WKContext.h:
701         * UIProcess/WebProcessPool.cpp:
702         (WebKit::WebProcessPool::refreshPlugins):
703         * UIProcess/WebProcessPool.h:
704         * WebProcess/Plugins/WebPluginInfoProvider.h:
705         * WebProcess/WebProcess.cpp:
706         (WebKit::WebProcess::refreshPlugins):
707         * WebProcess/WebProcess.h:
708         * WebProcess/WebProcess.messages.in:
709
710 2016-12-14  Tim Horton  <timothy_horton@apple.com>
711
712         API Test Fullscreen.TopContentInset is asserting on Yosemite
713         https://bugs.webkit.org/show_bug.cgi?id=165877
714
715         Reviewed by Brady Eidson.
716
717         * UIProcess/WebPageProxy.cpp:
718         (WebKit::WebPageProxy::setTopContentInset):
719         * WebProcess/WebPage/WebPage.cpp:
720         * WebProcess/WebPage/WebPage.h:
721         * WebProcess/WebPage/WebPage.messages.in:
722         We don't use fences on Yosemite, but this codepath still tried to.
723         Instead of guarding with PLATFORM(COCOA), make use of the more accurate
724         HAVE(COREANIMATION_FENCES) guard.
725
726 2016-12-14  Anders Carlsson  <andersca@apple.com>
727
728         Add some instrumentation to try to detect a crash on the bots
729         https://bugs.webkit.org/show_bug.cgi?id=165866
730
731         Reviewed by Sam Weinig.
732
733         * Platform/IPC/mac/ConnectionMac.mm:
734         (IPC::Connection::sendMessage):
735
736 2016-12-14  Dave Hyatt  <hyatt@apple.com>
737
738         [CSS Parser] Implement deferred parsing of properties, @media, @supports and @keyframes
739         https://bugs.webkit.org/show_bug.cgi?id=165743
740
741         Reviewed by Dean Jackson.
742
743         Repurpose the newCSSParserEnabled preference for deferred parsing. Just change the name
744         from "new" to "deferred."
745
746         * Shared/WebPreferencesDefinitions.h:
747         * UIProcess/API/C/WKPreferences.cpp:
748         (WKPreferencesSetDeferredCSSParserEnabled):
749         (WKPreferencesGetDeferredCSSParserEnabled):
750         (WKPreferencesSetNewCSSParserEnabled): Deleted.
751         (WKPreferencesGetNewCSSParserEnabled): Deleted.
752         * UIProcess/API/C/WKPreferencesRefPrivate.h:
753         * WebProcess/WebPage/WebPage.cpp:
754         (WebKit::WebPage::updatePreferences):
755
756 2016-12-14  Brent Fulgham  <bfulgham@apple.com>
757
758         Unreviewed test fix after r209806.
759
760         Plugin-common doesn't define 'home-subpath'. Instead it has 'home-library-subpath'. Switch to the correct
761         function. Also, 'home-library-subpath' adds '/Library' to the path, so revise the arguments so that we
762         do not generate paths like '/home/username/Library/Library/Keychains'.
763
764         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
765
766 2016-12-14  Brent Fulgham  <bfulgham@apple.com>
767
768         Unreviewed test fix after r209779.
769
770         The 'Keygen' element requires the ability to create new keys in '$HOME/Library/Keychains'. Remove the
771         WebProcess and Plugin sandbox restrictions on per-user Keychain creation to support this use.
772
773         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
774         * WebProcess/com.apple.WebProcess.sb.in:
775
776 2016-12-13  Yusuke Suzuki  <utatane.tea@gmail.com>
777
778         Use JSValue::toWTFString instead of calling toString(exec) and value(exec)
779         https://bugs.webkit.org/show_bug.cgi?id=165795
780
781         Reviewed by Saam Barati.
782
783         * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
784         (WebKit::NPRuntimeObjectMap::convertJSValueToNPVariant):
785
786 2016-12-14  Enrique Ocaña González  <eocanha@igalia.com>
787
788         REGRESSION(r207879-207891): [GStreamer] Introduced many layout test failures and crashes, bots exiting early
789         https://bugs.webkit.org/show_bug.cgi?id=164022
790
791         Reviewed by Xabier Rodriguez-Calvar.
792
793         * Shared/WebPreferencesDefinitions.h:
794         New GStreamerEnabled preference, defaults to true.
795         * WebProcess/WebPage/WebPage.cpp: Ditto.
796         (WebKit::WebPage::updatePreferences):
797
798 2016-12-13  Commit Queue  <commit-queue@webkit.org>
799
800         Unreviewed, rolling out r209792.
801         https://bugs.webkit.org/show_bug.cgi?id=165841
802
803         Cause build failures (Requested by yusukesuzuki on #webkit).
804
805         Reverted changeset:
806
807         "Use JSValue::toWTFString instead of calling toString(exec)
808         and value(exec)"
809         https://bugs.webkit.org/show_bug.cgi?id=165795
810         http://trac.webkit.org/changeset/209792
811
812 2016-12-13  Yusuke Suzuki  <utatane.tea@gmail.com>
813
814         Use JSValue::toWTFString instead of calling toString(exec) and value(exec)
815         https://bugs.webkit.org/show_bug.cgi?id=165795
816
817         Reviewed by Saam Barati.
818
819         * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
820         (WebKit::NPRuntimeObjectMap::convertJSValueToNPVariant):
821
822 2016-12-13  Alex Christensen  <achristensen@webkit.org>
823
824         Fix CMake build.
825
826         * PlatformMac.cmake:
827
828 2016-12-13  Jer Noble  <jer.noble@apple.com>
829
830         Fullscreen in WebKit2 does not restore topContentInset upon exiting; leaves top of page not visible
831         https://bugs.webkit.org/show_bug.cgi?id=165697
832
833         Delegate the values of topContentInset() from WebViewImpl (used by WKWebView and WKView) to the
834         WebPageProxy, so that setting the topContentInset() on WebPageProxy is reflected in the getters
835         for the two view classes.
836
837         Reviewed by Tim Horton.
838
839         * UIProcess/Cocoa/WebViewImpl.h:
840         (WebKit::WebViewImpl::topContentInset): Deleted.
841         * UIProcess/Cocoa/WebViewImpl.mm:
842         (WebKit::WebViewImpl::updateContentInsetsIfAutomatic):
843         (WebKit::WebViewImpl::topContentInset):
844         (WebKit::WebViewImpl::setTopContentInset):
845         (WebKit::WebViewImpl::dispatchSetTopContentInset):
846         * UIProcess/mac/WKFullScreenWindowController.mm:
847         (-[WKFullScreenWindowController enterFullScreen:]):
848         (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]):
849         (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]):
850         (-[WKFullScreenWindowController _saveTopContentInset]): Deleted.
851         (-[WKFullScreenWindowController _restoreTopContentInset]): Deleted.
852
853 2016-12-13  Brent Fulgham  <bfulgham@apple.com>
854
855         [Mac][WK2] Tighten Keychain directory access
856         https://bugs.webkit.org/show_bug.cgi?id=165818
857         <rdar://problem/16863857>
858
859         Reviewed by Anders Carlsson.
860
861         Lock down Keychain directory access to just the file-read-data, file-read-metadata, and
862         file-write-data operations we actually need.
863
864         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
865         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
866         * WebProcess/com.apple.WebProcess.sb.in:
867
868 2016-12-13  Andy Estes  <aestes@apple.com>
869
870         [Cocoa] Implement -shouldInsertText: on WKWebProcessPlugInEditingDelegate
871         https://bugs.webkit.org/show_bug.cgi?id=165785
872         <rdar://problem/26929398>
873
874         Reviewed by Darin Adler.
875
876         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInEditingDelegate.h: Defined
877         WKEditorInsertAction and declared
878         -_webProcessPlugInBrowserContextController:shouldInsertText:replacingRange:givenAction:.
879         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
880         (toWK): Added. Mapped a WebCore::EditorInsertAction to a WKEditorInsertAction.
881         (-[WKWebProcessPlugInBrowserContextController _setEditingDelegate:]): Implemented
882         EditorClient::shouldInsertText() by calling
883         -_webProcessPlugInBrowserContextController:shouldInsertText:replacingRange:givenAction: with
884         the text, wrapped range handle, and action. Added shouldInsertText to DelegateMethods and
885         initialized it according to whether the delegate responds to shouldInsertText:.
886
887 2016-12-13  Joseph Pecoraro  <pecoraro@apple.com>
888
889         NSArray leaks seen in Safari, allocated under WKIconDatabaseTryCopyCGImageArrayForURL
890         https://bugs.webkit.org/show_bug.cgi?id=165809
891
892         Reviewed by Dan Bernstein.
893
894         * UIProcess/API/C/cg/WKIconDatabaseCG.cpp:
895         (WKIconDatabaseTryCopyCGImageArrayForURL):
896         Avoid an extra retain on already newly created array.
897
898 2016-12-13  Eric Carlson  <eric.carlson@apple.com>
899
900         Annotate MediaStream and WebRTC idl with EnabledAtRuntime flag
901         https://bugs.webkit.org/show_bug.cgi?id=165251
902
903         Reviewed by Youenn Fablet.
904
905         * WebProcess/WebPage/WebPage.cpp:
906         (WebKit::WebPage::updatePreferences): Update the media stream and peer connection runtime
907         feature instead of the setting.
908
909 2016-12-13  Sergio Villar Senin  <svillar@igalia.com>
910
911         Fix GTK build after r209733
912         https://bugs.webkit.org/show_bug.cgi?id=165794
913
914         Document::visibilityState() now returns an IDL string enumeration.
915
916         Reviewed by Žan Doberšek.
917
918         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocument.cpp:
919         (webkit_dom_document_get_visibility_state):
920
921 2016-12-12  Dean Jackson  <dino@apple.com>
922
923         [iOS] MediaDocument "Done" button should navigate the page back
924         https://bugs.webkit.org/show_bug.cgi?id=165779
925
926         Reviewed by Sam Weinig.
927
928         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h:
929         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm:
930         (WebKit::WebVideoFullscreenModelContext::requestFullscreenMode):
931         (WebKit::WebVideoFullscreenManagerProxy::requestFullscreenMode):
932         * WebProcess/cocoa/WebVideoFullscreenManager.h:
933         * WebProcess/cocoa/WebVideoFullscreenManager.messages.in:
934         * WebProcess/cocoa/WebVideoFullscreenManager.mm:
935         (WebKit::WebVideoFullscreenManager::requestFullscreenMode):
936
937 2016-12-12  Tim Horton  <timothy_horton@apple.com>
938
939         Provide SPI to avoid blocking on painting when coming into view
940         https://bugs.webkit.org/show_bug.cgi?id=165780
941         <rdar://problem/29009559>
942
943         Reviewed by Simon Fraser.
944
945         By default, when parenting a WKWebView which was previously in-window,
946         we block on painting to ensure that we don't flash stale content.
947         We added SPI to disable this behavior to WKWebViewConfiguration, but
948         some clients might want the behavior most of the time, but sometimes
949         instead want to not block the UI process main thread, but instead do
950         their own work (e.g. removing a snapshot) when painting eventually occurs.
951
952         * UIProcess/API/Cocoa/WKWebView.mm:
953         (-[WKWebView _doAfterNextPresentationUpdateWithoutWaitingForPainting:]):
954         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
955         Tell WebPageProxy not to block on painting next time we are parented,
956         and use doAfterNextPresentationUpdate to call the block when the painting
957         does eventually happen. This SPI must be called before - but in the same
958         runloop cycle - the WKWebView is brought back in-window to work correctly.
959         
960         * UIProcess/WebPageProxy.cpp:
961         (WebKit::WebPageProxy::dispatchActivityStateChange):
962         * UIProcess/WebPageProxy.h:
963         (WebKit::WebPageProxy::skipWaitingForPaintAfterNextViewDidMoveToWindow):
964         If we would block because we're coming in-window, but the bit to skip
965         blocking the next time we get brought in-window is set, reset the bit, 
966         and avoid blocking.
967
968 2016-12-12  Chris Dumez  <cdumez@apple.com>
969
970         Document.visibilityState should use an IDL string enumeration
971         https://bugs.webkit.org/show_bug.cgi?id=165774
972
973         Reviewed by Daniel Bates.
974
975         * Shared/API/c/WKSharedAPICast.h:
976         (WebKit::toPageVisibilityState):
977
978 2016-12-11  Konstantin Tokarev  <annulen@yandex.ru>
979
980         Unreviewed attempt to fix EFL and Mac/cmake builds after r209665.
981         https://bugs.webkit.org/show_bug.cgi?id=165686
982
983         * PlatformEfl.cmake: WebKit2 should precede other target so that right
984         config.h comes first in include path.
985
986 2016-12-11  Tim Horton  <timothy_horton@apple.com>
987
988         Quarter-second stalls scrolling images that are links because of sync getPositionInformation
989         https://bugs.webkit.org/show_bug.cgi?id=165707
990
991         Reviewed by Simon Fraser.
992
993         * UIProcess/ios/WKContentViewInteraction.mm:
994         (-[WKContentView positionInformationForActionSheetAssistant:]):
995         (-[WKContentView updatePositionInformationForActionSheetAssistant:]):
996         For now, synchronously block when presenting the action sheet if we
997         don't have a snapshot ready.
998
999         * WebProcess/WebPage/ios/WebPageIOS.mm:
1000         (WebKit::WebPage::getPositionInformation):
1001         Respect includeSnapshot in another place in getPositionInformation,
1002         so that many getPositionInformations don't have to do extra snapshotting work.
1003
1004 2016-12-10  Filip Pizlo  <fpizlo@apple.com>
1005
1006         The DOM should have an advancing wavefront opaque root barrier
1007         https://bugs.webkit.org/show_bug.cgi?id=165712
1008
1009         Reviewed by Yusuke Suzuki.
1010         
1011         Propagate the JSDOMWindowBase::commonVM() -> commonVM() change.
1012
1013         * Shared/linux/WebMemorySamplerLinux.cpp:
1014         (WebKit::WebMemorySampler::sampleWebKit):
1015         * Shared/mac/WebMemorySampler.mac.mm:
1016         (WebKit::WebMemorySampler::sampleWebKit):
1017         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1018         (WebKit::InjectedBundle::javaScriptObjectsCount):
1019         * WebProcess/Plugins/Netscape/JSNPObject.cpp:
1020         (WebKit::JSNPObject::callMethod):
1021         (WebKit::JSNPObject::callObject):
1022         (WebKit::JSNPObject::callConstructor):
1023         (WebKit::JSNPObject::put):
1024         (WebKit::JSNPObject::deleteProperty):
1025         (WebKit::JSNPObject::getOwnPropertyNames):
1026         (WebKit::JSNPObject::propertyGetter):
1027         * WebProcess/WebPage/WebPage.cpp:
1028         (WebKit::WebPage::runJavaScriptInMainFrame):
1029         (WebKit::WebPage::getBytecodeProfile):
1030         (WebKit::WebPage::getSamplingProfilerOutput):
1031         * WebProcess/WebProcess.cpp:
1032         (WebKit::WebProcess::getWebCoreStatistics):
1033
1034 2016-12-11  Konstantin Tokarev  <annulen@yandex.ru>
1035
1036         Unreviewed build fix for EFL after r209665
1037
1038         * UIProcess/efl/TextCheckerClientEfl.h:
1039
1040 2016-12-10  Konstantin Tokarev  <annulen@yandex.ru>
1041
1042         [cmake] Include WTF, JSC, and WebCore headers automatically to targers using them
1043         https://bugs.webkit.org/show_bug.cgi?id=165686
1044
1045         Reviewed by Michael Catanzaro.
1046
1047         This change reduces duplication of include path lists between modules,
1048         and reduces future need for fixes like r209605 (broken build because of
1049         WebCore header suddenly becoming used in WebKit2).
1050
1051         * CMakeLists.txt:
1052         * PlatformEfl.cmake:
1053         * PlatformGTK.cmake:
1054         * PlatformMac.cmake:
1055
1056 2016-12-10  Antti Koivisto  <antti@apple.com>
1057
1058         CrashTracer: com.apple.WebKit.Networking at WTF::ThreadSafeRefCounted<WebKit::NetworkCache::IOChannel>::deref
1059         https://bugs.webkit.org/show_bug.cgi?id=165659
1060         <rdar://problem/27077977>
1061
1062         Reviewed by Darin Adler.
1063
1064         * NetworkProcess/cache/NetworkCacheIOChannel.h:
1065         * NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm:
1066         (WebKit::NetworkCache::IOChannel::~IOChannel):
1067
1068             Add non-inlined destructor and release assert against double deletion to narrow down this crash.
1069
1070 2016-12-09  Brent Fulgham  <bfulgham@apple.com>
1071
1072         WebCore::Timer is not compatible with UIProcess
1073         https://bugs.webkit.org/show_bug.cgi?id=165706
1074         <rdar://problem/29360564>
1075
1076         Reviewed by Andy Estes.
1077
1078         Anders has explained to me (at least twice) that WebCore::Timer must not
1079         be used in UIProcess code. A recent bug fix introduced a WebCore::Timer,
1080         which led to another crash.
1081         
1082         This patch switches from WebCore::Timer to WTF::RunLoop::Timer to avoid
1083         the problem.
1084
1085         * UIProcess/Cocoa/NavigationState.h:
1086         * UIProcess/Cocoa/NavigationState.mm:
1087         (WebKit::NavigationState::NavigationState):
1088
1089 2016-12-09  Eric Carlson  <eric.carlson@apple.com>
1090
1091         Annotate MediaStream and WebRTC idl with EnabledAtRuntime flag
1092         https://bugs.webkit.org/show_bug.cgi?id=165251
1093
1094         Reviewed by Dean Jackson.
1095
1096         Based on a patch by Dr Alex Gouaillard <agouaillard@gmail.com>
1097
1098         * Shared/WebPreferencesDefinitions.h: Add peerConnectionEnabled.
1099
1100         * UIProcess/API/C/WKPreferences.cpp:
1101         (WKPreferencesSetPeerConnectionEnabled): Added.
1102         (WKPreferencesGetPeerConnectionEnabled): Added.
1103         * UIProcess/API/C/WKPreferencesRef.h:
1104
1105         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1106         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): Add WebKitMediaStreamEnabled
1107           and WebKitPeerConnectionEnabled.
1108
1109         * WebProcess/WebPage/WebPage.cpp:
1110         (WebKit::WebPage::updatePreferences): Initialize the peerConnection preference.
1111
1112 2016-12-09  Brady Eidson  <beidson@apple.com>
1113
1114         Re-landing:
1115         Add _WKIconLoadingDelegate SPI.
1116         https://bugs.webkit.org/show_bug.cgi?id=164894
1117
1118         Reviewed by Alex Christensen.
1119
1120         With this client, WebCore will ask the FrameLoaderClient about each icon found in the <head>.
1121
1122         WebKit2 will then ask the embedding app - for each icon - if it wants that icon to load.
1123
1124         For icons the app decides to load, WebKit will pass the data to the app without storing locally.
1125
1126         * UIProcess/API/APIIconLoadingClient.h: Copied from Source/WebCore/html/LinkIconCollector.h.
1127         (API::IconLoadingClient::~IconLoadingClient):
1128         (API::IconLoadingClient::getLoadDecisionForIcon):
1129
1130         * UIProcess/API/Cocoa/WKWebView.mm:
1131         (-[WKWebView _initializeWithConfiguration:]):
1132         (-[WKWebView _iconLoadingDelegate]):
1133         (-[WKWebView _setIconLoadingDelegate:]):
1134         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1135
1136         * UIProcess/API/Cocoa/_WKIconLoadingDelegate.h: Copied from Source/WebCore/html/LinkIconCollector.h.
1137
1138         * UIProcess/API/Cocoa/_WKLinkIconParameters.h: Copied from Source/WebCore/html/LinkIconCollector.h.
1139         * UIProcess/API/Cocoa/_WKLinkIconParameters.mm: Copied from Source/WebCore/html/LinkIconCollector.h.
1140         (-[_WKLinkIconParameters _initWithLinkIcon:]):
1141         (-[_WKLinkIconParameters url]):
1142         (-[_WKLinkIconParameters mimeType]):
1143         (-[_WKLinkIconParameters size]):
1144         (-[_WKLinkIconParameters iconType]):
1145         * UIProcess/API/Cocoa/_WKLinkIconParametersInternal.h: Copied from Source/WebCore/html/LinkIconCollector.h.
1146
1147         * UIProcess/Cocoa/IconLoadingDelegate.h: Copied from Source/WebCore/html/LinkIconCollector.h.
1148         * UIProcess/Cocoa/IconLoadingDelegate.mm: Added.
1149         (WebKit::IconLoadingDelegate::IconLoadingDelegate):
1150         (WebKit::IconLoadingDelegate::~IconLoadingDelegate):
1151         (WebKit::IconLoadingDelegate::createIconLoadingClient):
1152         (WebKit::IconLoadingDelegate::delegate):
1153         (WebKit::IconLoadingDelegate::setDelegate):
1154         (WebKit::IconLoadingDelegate::IconLoadingClient::IconLoadingClient):
1155         (WebKit::IconLoadingDelegate::IconLoadingClient::~IconLoadingClient):
1156         (WebKit::IconLoadingDelegate::IconLoadingClient::getLoadDecisionForIcon):
1157
1158         * UIProcess/WebPageProxy.cpp:
1159         (WebKit::WebPageProxy::setIconLoadingClient):
1160         (WebKit::WebPageProxy::getLoadDecisionForIcon):
1161         (WebKit::WebPageProxy::finishedLoadingIcon):
1162         * UIProcess/WebPageProxy.h:
1163         (WebKit::WebPageProxy::iconLoadingClient):
1164         * UIProcess/WebPageProxy.messages.in:
1165
1166         * WebKit2.xcodeproj/project.pbxproj:
1167
1168         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1169         (WebKit::WebFrameLoaderClient::useIconLoadingClient):
1170         (WebKit::WebFrameLoaderClient::getLoadDecisionForIcon):
1171         (WebKit::WebFrameLoaderClient::finishedLoadingIcon):
1172         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1173         (WebKit::WebFrameLoaderClient::setUseIconLoadingClient):
1174
1175         * WebProcess/WebPage/WebPage.cpp:
1176         (WebKit::WebPage::didGetLoadDecisionForIcon):
1177         (WebKit::WebPage::setUseIconLoadingClient):
1178         * WebProcess/WebPage/WebPage.h:
1179         * WebProcess/WebPage/WebPage.messages.in:
1180
1181 2016-12-09  Simon Fraser  <simon.fraser@apple.com>
1182
1183         Fix initialization of contentUpdateFrequency
1184         https://bugs.webkit.org/show_bug.cgi?id=165705
1185         rdar://problem/29602039
1186
1187         Reviewed by Tim Horton.
1188
1189         The value that controls web content update frequency was not being initialized.
1190
1191         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1192         (-[WKWebViewConfiguration init]):
1193
1194 2016-12-09  Anders Carlsson  <andersca@apple.com>
1195
1196         Once we can send Mach messages again, make sure to send any pending outgoing messages
1197         https://bugs.webkit.org/show_bug.cgi?id=165693
1198
1199         Reviewed by Brady Eidson.
1200
1201         * Platform/IPC/mac/ConnectionMac.mm:
1202         (IPC::Connection::initializeSendSource):
1203
1204 2016-12-09  Beth Dakin  <bdakin@apple.com>
1205
1206         Password fields should not show the emoji button in TouchBar
1207         https://bugs.webkit.org/show_bug.cgi?id=165673
1208         -and corresponding-
1209         rdar://problem/29235739
1210
1211         Reviewed by Wenson Hsieh.
1212
1213         This patch adds a new member variable for the password touch bar and password 
1214         candidateListTouchBarItem. Since this TouchBar will actually have a different set 
1215         of identifiers than the plain text TouchBar, it should just have its own variable.
1216         * UIProcess/Cocoa/WebViewImpl.h:
1217         * UIProcess/Cocoa/WebViewImpl.mm:
1218
1219         Return m_passwordTextCandidateListTouchBarItem when appropriate.
1220         (WebKit::WebViewImpl::candidateListTouchBarItem):
1221
1222         The candidate list should be the only item for passwords.
1223         (WebKit::passwordTextTouchBarDefaultItemIdentifiers):
1224
1225         Account for m_passwordTextTouchBar.
1226         (WebKit::WebViewImpl::updateTouchBarAndRefreshTextBarIdentifiers):
1227         (WebKit::WebViewImpl::setUpTextTouchBar):
1228         (WebKit::WebViewImpl::textTouchBar):
1229
1230         The empty candidates array is not needed. We can just set @[ ] as the candidates 
1231         for the m_passwordTextCandidateListTouchBarItem. Safe guards already exist in the 
1232         other parts of the code to prevent us from requesting or setting other candidates 
1233         when in a password field. 
1234         (WebKit::WebViewImpl::updateTextTouchBar):
1235
1236 2016-12-09  Keith Rollin  <krollin@apple.com>
1237
1238         Fix string specification in print format
1239         https://bugs.webkit.org/show_bug.cgi?id=165650
1240
1241         Reviewed by Alex Christensen.
1242
1243         Change "%{public}s" string specifier to something that can be changed
1244         to "%s" at compile time when the build environment doesn't support the
1245         former.
1246
1247         * NetworkProcess/capture/NetworkCaptureLogging.h:
1248         * NetworkProcess/capture/NetworkCaptureManager.cpp:
1249         (WebKit::NetworkCapture::Manager::initialize):
1250         (WebKit::NetworkCapture::Manager::findMatch):
1251         (WebKit::NetworkCapture::Manager::findExactMatch):
1252         (WebKit::NetworkCapture::Manager::findBestFuzzyMatch):
1253         (WebKit::NetworkCapture::Manager::fuzzyMatchURLs):
1254         (WebKit::NetworkCapture::Manager::logPlayedBackResource):
1255         (WebKit::NetworkCapture::Manager::openCacheFile):
1256         (WebKit::NetworkCapture::Manager::getLine):
1257         * NetworkProcess/capture/NetworkCaptureRecorder.cpp:
1258         (WebKit::NetworkCapture::Recorder::recordRequestSent):
1259         (WebKit::NetworkCapture::Recorder::recordResponseReceived):
1260         (WebKit::NetworkCapture::Recorder::recordRedirectReceived):
1261         (WebKit::NetworkCapture::Recorder::recordRedirectSent):
1262         (WebKit::NetworkCapture::Recorder::writeEvents):
1263         * NetworkProcess/capture/NetworkCaptureResource.cpp:
1264         (WebKit::NetworkCapture::Resource::url):
1265         (WebKit::NetworkCapture::Resource::EventStream::nextEvent):
1266         * NetworkProcess/capture/NetworkDataTaskReplay.cpp:
1267         (WebKit::NetworkCapture::NetworkDataTaskReplay::NetworkDataTaskReplay):
1268         (WebKit::NetworkCapture::NetworkDataTaskReplay::~NetworkDataTaskReplay):
1269         (WebKit::NetworkCapture::NetworkDataTaskReplay::resume):
1270         (WebKit::NetworkCapture::NetworkDataTaskReplay::suspend):
1271         (WebKit::NetworkCapture::NetworkDataTaskReplay::complete):
1272         (WebKit::NetworkCapture::NetworkDataTaskReplay::invalidateAndCancel):
1273         (WebKit::NetworkCapture::NetworkDataTaskReplay::enqueueEventHandler):
1274         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayRequestSent):
1275         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayResponseReceived):
1276         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayRedirectReceived):
1277         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayRedirectSent):
1278         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayDataReceived):
1279         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayFinished):
1280         (WebKit::NetworkCapture::NetworkDataTaskReplay::didReceiveResponse):
1281
1282 2016-12-09  Jeremy Jones  <jeremyj@apple.com>
1283
1284         WebView doesn't become first responder in element fullscreen.
1285         https://bugs.webkit.org/show_bug.cgi?id=165664
1286         rdar://problem/28927252
1287
1288         Reviewed by Tim Horton.
1289
1290         WebView was being set as the first responder while the contentView was still hidden.
1291         A view can not become first responder while it or its ancestor is hidden.
1292
1293         This change waits until after the contentView is visible to make the web view the first responder.
1294
1295         * UIProcess/mac/WKFullScreenWindowController.mm:
1296         (-[WKFullScreenWindowController enterFullScreen:]):
1297         (-[WKFullScreenWindowController _startEnterFullScreenAnimationWithDuration:]):
1298
1299 2016-12-09  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
1300
1301         Unreviewed build fix. Thanks to Konstantin Tokarev and Csaba Osztrogonác
1302         for pointing out the fix.
1303
1304         * CMakeLists.txt: add WebCore/html/canvas to include paths.
1305
1306 2016-12-09  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
1307
1308         [GTK] Fix build after r209558
1309         https://bugs.webkit.org/show_bug.cgi?id=165653
1310
1311         Unreviewed build fix.
1312
1313         * UIProcess/API/APIPolicyClient.h: include WebsitePolicies.h.
1314         * UIProcess/API/gtk/WebKitPolicyClient.cpp: ditto.
1315         * UIProcess/API/gtk/WebKitPolicyDecision.cpp:
1316         (webkit_policy_decision_use):  pass empty structure to new required argument.
1317
1318 2016-12-09  Gavin Barraclough  <barraclough@apple.com>
1319
1320         Revert - Add _WKIconLoadingDelegate SPI
1321         https://bugs.webkit.org/show_bug.cgi?id=164894
1322
1323         Unreviewed rollout due to performance regression.
1324
1325         * PlatformMac.cmake:
1326         * UIProcess/API/APIIconLoadingClient.h: Removed.
1327         * UIProcess/API/Cocoa/WKWebView.mm:
1328         (-[WKWebView _initializeWithConfiguration:]):
1329         (-[WKWebView _iconLoadingDelegate]): Deleted.
1330         (-[WKWebView _setIconLoadingDelegate:]): Deleted.
1331         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1332         * UIProcess/API/Cocoa/_WKIconLoadingDelegate.h: Removed.
1333         * UIProcess/API/Cocoa/_WKLinkIconParameters.h: Removed.
1334         * UIProcess/API/Cocoa/_WKLinkIconParameters.mm: Removed.
1335         * UIProcess/API/Cocoa/_WKLinkIconParametersInternal.h: Removed.
1336         * UIProcess/Cocoa/IconLoadingDelegate.h: Removed.
1337         * UIProcess/Cocoa/IconLoadingDelegate.mm: Removed.
1338         * UIProcess/WebPageProxy.cpp:
1339         (WebKit::WebPageProxy::setIconLoadingClient): Deleted.
1340         (WebKit::WebPageProxy::getLoadDecisionForIcon): Deleted.
1341         (WebKit::WebPageProxy::finishedLoadingIcon): Deleted.
1342         * UIProcess/WebPageProxy.h:
1343         (WebKit::WebPageProxy::iconLoadingClient): Deleted.
1344         * UIProcess/WebPageProxy.messages.in:
1345         * WebKit2.xcodeproj/project.pbxproj:
1346         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1347         (WebKit::WebFrameLoaderClient::useIconLoadingClient): Deleted.
1348         (WebKit::WebFrameLoaderClient::getLoadDecisionForIcon): Deleted.
1349         (WebKit::WebFrameLoaderClient::finishedLoadingIcon): Deleted.
1350         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1351         (WebKit::WebFrameLoaderClient::setUseIconLoadingClient): Deleted.
1352         (): Deleted.
1353         * WebProcess/WebPage/WebPage.cpp:
1354         (WebKit::WebPage::didGetLoadDecisionForIcon): Deleted.
1355         (WebKit::WebPage::setUseIconLoadingClient): Deleted.
1356         * WebProcess/WebPage/WebPage.h:
1357         * WebProcess/WebPage/WebPage.messages.in:
1358
1359 2016-12-08  Keith Rollin  <krollin@apple.com>
1360
1361         Move FileHandle to WebCore FileHandle.h
1362         https://bugs.webkit.org/show_bug.cgi?id=165562
1363
1364         Reviewed by Alex Christensen.
1365
1366         Move FileHandle from NetworkCaptureTypes.h (which can now be deleted)
1367         to WebCore. Update client code to use the new version.
1368
1369         * NetworkProcess/capture/NetworkCaptureEvent.cpp:
1370         * NetworkProcess/capture/NetworkCaptureEvent.h:
1371         * NetworkProcess/capture/NetworkCaptureManager.cpp:
1372         (WebKit::NetworkCapture::Manager::initialize):
1373         (WebKit::NetworkCapture::Manager::terminate):
1374         (WebKit::NetworkCapture::Manager::logRecordedResource):
1375         (WebKit::NetworkCapture::Manager::logLoadedResource):
1376         (WebKit::NetworkCapture::Manager::logPlayedBackResource):
1377         (WebKit::NetworkCapture::Manager::openCacheFile):
1378         (WebKit::NetworkCapture::Manager::ensureFileHandle): Deleted.
1379         (WebKit::NetworkCapture::Manager::printToFile): Deleted.
1380         * NetworkProcess/capture/NetworkCaptureManager.h:
1381         * NetworkProcess/capture/NetworkCaptureRecorder.cpp:
1382         (WebKit::NetworkCapture::Recorder::writeEvents):
1383         * NetworkProcess/capture/NetworkCaptureTypes.h: Removed.
1384         * WebKit2.xcodeproj/project.pbxproj:
1385
1386 2016-12-08  Anders Carlsson  <andersca@apple.com>
1387
1388         Attempt to fix the iOS build.
1389
1390         * Platform/IPC/mac/MachMessage.cpp:
1391
1392 2016-12-08  Anders Carlsson  <andersca@apple.com>
1393
1394         Defer sending Mach messages if the queue is full
1395         https://bugs.webkit.org/show_bug.cgi?id=165622
1396         rdar://problem/29518036
1397
1398         Reviewed by Brady Eidson.
1399
1400         * Platform/IPC/Connection.cpp:
1401         Include MachMessage.h so the Connection destructor can do its thing.
1402
1403         * Platform/IPC/Connection.h:
1404         Add new members.
1405
1406         * Platform/IPC/mac/ConnectionMac.mm:
1407         (IPC::Connection::platformInvalidate):
1408         Null out the pending outgoing mach message.
1409
1410         (IPC::Connection::sendMessage):
1411         New helper that will send a Mach message. If we time out, store the message in m_pendingOutgoingMachMessage.
1412         When our send source will be triggered we'll try to send the message again.
1413
1414         (IPC::Connection::platformCanSendOutgoingMessages):
1415         We can only send messages if we don't have a pending outgoing message.
1416
1417         (IPC::Connection::sendOutgoingMessage):
1418         Call the newly added sendMessage function.
1419
1420         (IPC::Connection::initializeSendSource):
1421         Add the DISPATCH_MACH_SEND_POSSIBLE mask (and DISPATCH_MACH_SEND_DEAD which was previously implicit).
1422         In our event handler, check for DISPATCH_MACH_SEND_POSSIBLE and try to send the pending outgoing message again.
1423
1424         * Platform/IPC/mac/MachMessage.cpp:
1425         (IPC::MachMessage::create):
1426         Rename length to size.
1427
1428         (IPC::MachMessage::MachMessage):
1429         Initialize m_shouldFreeDescriptors.
1430
1431         (IPC::MachMessage::~MachMessage):
1432         Call mach_msg_destroy, which will free the descriptors.
1433
1434         (IPC::MachMessage::leakDescriptors):
1435         Set m_shouldFreeDescriptors to false.
1436
1437         * Platform/IPC/mac/MachMessage.h:
1438         (IPC::MachMessage::size):
1439         (IPC::MachMessage::length): Deleted.
1440
1441 2016-12-08  Chelsea Pugh  <cpugh@apple.com>
1442
1443         [iOS] WKWebView should not allow app links to be opened on back or forward navigation
1444         https://bugs.webkit.org/show_bug.cgi?id=165502
1445
1446         Reviewed by Dan Bernstein.
1447
1448         * UIProcess/WebPageProxy.cpp:
1449         (WebKit::WebPageProxy::decidePolicyForNavigationAction): Add a condition to shouldOpenAppLinks
1450         (which we use when creating a NavigationAction) that the navigationActionData is not a navigation
1451         of type BackForward. This way, we don't open app links when a navigation is done via back or
1452         forward.
1453
1454 2016-12-08  Filip Pizlo  <fpizlo@apple.com>
1455
1456         Enable SharedArrayBuffer, remove the flag
1457         https://bugs.webkit.org/show_bug.cgi?id=165614
1458
1459         Rubber stamped by Geoffrey Garen.
1460
1461         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1462         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1463
1464 2016-12-08  Alex Christensen  <achristensen@webkit.org>
1465
1466         Add SPI for sending WebsiteSettings to WebProcess during navigation
1467         https://bugs.webkit.org/show_bug.cgi?id=165517
1468         <rdar://29341068>
1469
1470         We add the ability for the navigation client to send settings to the WebProcess 
1471         based on the URL of the document being navigated to. This approach adds no new IPC 
1472         messages and allows the application to decide what settings to use during navigation 
1473         instead of declaratively before navigation. Right now there is only one setting, 
1474         whether to disable content blockers, but this infrastructure can be used for more settings.
1475
1476         Reviewed by Anders Carlsson.
1477
1478         * CMakeLists.txt:
1479         * PlatformMac.cmake:
1480         * Shared/API/APIObject.h:
1481         * Shared/API/c/WKBase.h:
1482         * Shared/WebsitePolicies.h: Added.
1483         (WebKit::WebsitePolicies::encode):
1484         (WebKit::WebsitePolicies::decode):
1485         * UIProcess/API/APINavigationClient.h:
1486         (API::NavigationClient::decidePolicyForNavigationAction):
1487         (API::NavigationClient::decidePolicyForNavigationResponse):
1488         * UIProcess/API/APIPolicyClient.h:
1489         (API::PolicyClient::decidePolicyForNavigationAction):
1490         (API::PolicyClient::decidePolicyForNewWindowAction):
1491         (API::PolicyClient::decidePolicyForResponse):
1492         * UIProcess/API/APIWebsitePolicies.cpp: Added.
1493         (API::WebsitePolicies::create):
1494         * UIProcess/API/APIWebsitePolicies.h: Added.
1495         * UIProcess/API/C/WKAPICast.h:
1496         * UIProcess/API/C/WKFramePolicyListener.cpp:
1497         (WKFramePolicyListenerUse):
1498         (WKFramePolicyListenerUseWithPolicies):
1499         * UIProcess/API/C/WKFramePolicyListener.h:
1500         * UIProcess/API/C/WKPage.cpp:
1501         (WKPageSetPagePolicyClient):
1502         * UIProcess/API/C/WKWebsitePolicies.cpp: Added.
1503         (WKWebsitePoliciesGetTypeID):
1504         (WKWebsitePoliciesCreate):
1505         (WKWebsitePoliciesSetContentBlockersEnabled):
1506         (WKWebsitePoliciesGetContentBlockersEnabled):
1507         * UIProcess/API/C/WKWebsitePolicies.h: Added.
1508         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
1509         * UIProcess/API/Cocoa/_WKWebsitePolicies.h: Added.
1510         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm: Added.
1511         (-[_WKWebsitePolicies dealloc]):
1512         (-[_WKWebsitePolicies init]):
1513         (-[_WKWebsitePolicies setContentBlockersEnabled:]):
1514         (-[_WKWebsitePolicies contentBlockersEnabled]):
1515         (-[_WKWebsitePolicies description]):
1516         (-[_WKWebsitePolicies _apiObject]):
1517         * UIProcess/API/Cocoa/_WKWebsitePoliciesInternal.h: Added.
1518         (WebKit::wrapper):
1519         * UIProcess/Automation/WebAutomationSession.cpp:
1520         (WebKit::WebAutomationSession::reloadBrowsingContext):
1521         * UIProcess/Cocoa/NavigationState.h:
1522         * UIProcess/Cocoa/NavigationState.mm:
1523         (WebKit::NavigationState::setNavigationDelegate):
1524         (WebKit::tryAppLink):
1525         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
1526         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse):
1527         * UIProcess/WebFormSubmissionListenerProxy.cpp:
1528         (WebKit::WebFormSubmissionListenerProxy::continueSubmission):
1529         * UIProcess/WebFrameListenerProxy.cpp:
1530         (WebKit::WebFrameListenerProxy::receivedPolicyDecision):
1531         * UIProcess/WebFrameListenerProxy.h:
1532         * UIProcess/WebFramePolicyListenerProxy.cpp:
1533         (WebKit::WebFramePolicyListenerProxy::use):
1534         (WebKit::WebFramePolicyListenerProxy::download):
1535         (WebKit::WebFramePolicyListenerProxy::ignore):
1536         * UIProcess/WebFramePolicyListenerProxy.h:
1537         (WebKit::WebFramePolicyListenerProxy::create):
1538         * UIProcess/WebFrameProxy.cpp:
1539         (WebKit::WebFrameProxy::receivedPolicyDecision):
1540         * UIProcess/WebFrameProxy.h:
1541         * UIProcess/WebInspectorProxy.cpp:
1542         (WebKit::decidePolicyForNavigationAction):
1543         * UIProcess/WebPageProxy.cpp:
1544         (WebKit::WebPageProxy::receivedPolicyDecision):
1545         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1546         * UIProcess/WebPageProxy.h:
1547         * UIProcess/WebPageProxy.messages.in:
1548         * WebKit2.xcodeproj/project.pbxproj:
1549         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1550         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1551
1552 2016-12-08  Antti Koivisto  <antti@apple.com>
1553
1554         Salt network cache hashes
1555         https://bugs.webkit.org/show_bug.cgi?id=164924
1556
1557         Reviewed by Alex Christensen.
1558
1559         To enhance privacy make cache content unidentifiable from file names alone.
1560         This is done by generating a unique persistent salt for each cache instance.
1561         It is used when computing hashes used in file names.
1562
1563         The patch also replaces plain text partition directory names with salted hashes.
1564
1565         * NetworkProcess/cache/NetworkCache.cpp:
1566         (WebKit::NetworkCache::Cache::makeCacheKey):
1567         (WebKit::NetworkCache::makeCacheKey): Deleted.
1568         * NetworkProcess/cache/NetworkCache.h:
1569
1570             Increment cache version.
1571
1572         * NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
1573         (WebKit::NetworkCache::BlobStorage::BlobStorage):
1574         (WebKit::NetworkCache::BlobStorage::add):
1575         (WebKit::NetworkCache::BlobStorage::get):
1576
1577             Use salt for blob content hash.
1578
1579         * NetworkProcess/cache/NetworkCacheBlobStorage.h:
1580         * NetworkProcess/cache/NetworkCacheData.cpp:
1581         (WebKit::NetworkCache::computeSHA1):
1582
1583             For simplicity all SHA1s are now salted.
1584
1585         (WebKit::NetworkCache::makeSalt):
1586         (WebKit::NetworkCache::readOrMakeSalt):
1587
1588             Read salt if it exists, generate and persist it otherwise.
1589
1590         * NetworkProcess/cache/NetworkCacheData.h:
1591         * NetworkProcess/cache/NetworkCacheKey.cpp:
1592         (WebKit::NetworkCache::Key::Key):
1593
1594             Remove the "No partition" string and just empty.
1595             That was only needed to have a directory name of some sort.
1596
1597         (WebKit::NetworkCache::Key::computeHash):
1598
1599             Use salt for key hash.
1600
1601         (WebKit::NetworkCache::Key::computePartitionHash):
1602
1603             Separate hash for partition.
1604
1605         * NetworkProcess/cache/NetworkCacheKey.h:
1606         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
1607         (WebKit::NetworkCache::makeSubresourcesKey):
1608         (WebKit::NetworkCache::SpeculativeLoadManager::PendingFrameLoad::saveToDiskIfReady):
1609         (WebKit::NetworkCache::SpeculativeLoadManager::retrieveSubresourcesEntry):
1610         * NetworkProcess/cache/NetworkCacheStorage.cpp:
1611         (WebKit::NetworkCache::makeSaltFilePath):
1612         (WebKit::NetworkCache::Storage::open):
1613
1614             Cache can't be opened if we can't read or persist a salt.
1615
1616         (WebKit::NetworkCache::traverseRecordsFiles):
1617         (WebKit::NetworkCache::Storage::Storage):
1618         (WebKit::NetworkCache::Storage::synchronize):
1619         (WebKit::NetworkCache::Storage::recordDirectoryPathForKey):
1620
1621             Use the partition hash in the directory name instead of a plain text name.
1622
1623         (WebKit::NetworkCache::decodeRecordHeader):
1624         (WebKit::NetworkCache::Storage::readRecord):
1625         (WebKit::NetworkCache::Storage::encodeRecord):
1626         (WebKit::NetworkCache::Storage::traverse):
1627         (WebKit::NetworkCache::Storage::clear):
1628         * NetworkProcess/cache/NetworkCacheStorage.h:
1629         (WebKit::NetworkCache::Storage::salt):
1630
1631 2016-12-08  Eric Carlson  <eric.carlson@apple.com>
1632
1633         Fix the EFL build.
1634
1635         * UIProcess/WebPageProxy.cpp:
1636         (WebKit::WebPageProxy::isPlayingMediaDidChange): Add another ENABLE(MEDIA_STREAM) guard.
1637
1638 2016-12-08  Tomas Popela  <tpopela@redhat.com>
1639
1640         [GTK] Process accelerated compositing env variables only if they are really enabled
1641         https://bugs.webkit.org/show_bug.cgi?id=165300
1642
1643         Don't process the WEBKIT_FORCE_COMPOSITING_MODE and
1644         WEBKIT_DISABLE_COMPOSITING_MODE env variables if they are disabled
1645         (eg. WEBKIT_DISABLE_COMPOSITING_MODE=0).
1646
1647         Reviewed by Michael Catanzaro.
1648
1649         * UIProcess/gtk/WebPreferencesGtk.cpp:
1650         (WebKit::WebPreferences::platformInitializeStore):
1651
1652 2016-12-08  Alex Christensen  <achristensen@webkit.org>
1653
1654         Fix CMake build.
1655
1656         * CMakeLists.txt:
1657         Add the new NetworkProcess/capture include directory to find new headers from r209498.
1658         * NetworkProcess/capture/NetworkCaptureEvent.cpp:
1659         (WebKit::NetworkCapture::Response::Response):
1660         (WebKit::NetworkCapture::Error::Error):
1661         The String constructor was ambiguous after r209498 because URL has an operator NSString* and String has an NSString constructor.
1662         We should get rid of operator NSString* and operator String on URL.
1663         * UIProcess/WebPageProxy.cpp:
1664         * UIProcess/WebPageProxy.h:
1665         Add some ENABLE(MEDIA_STREAM) macros to fix the build without it enabled after r209512.
1666
1667 2016-12-08  Alex Christensen  <achristensen@webkit.org>
1668
1669         Fix iOS debug build after r209498
1670         https://bugs.webkit.org/show_bug.cgi?id=164527
1671
1672         * NetworkProcess/capture/NetworkCaptureLogging.h:
1673         Logs were causing compile warnings/errors.  Disable logs for now.
1674
1675 2016-12-07  Dean Jackson  <dino@apple.com>
1676
1677         Remove runtime toggle for pointer-lock
1678         https://bugs.webkit.org/show_bug.cgi?id=165577
1679         <rdar://problems/29566996>
1680
1681         Reviewed by Jon Lee.
1682
1683         Remove any runtime calls to check if pointer-lock is enabled. It's
1684         either compiled in or out.
1685
1686         * Shared/WebPreferencesDefinitions.h:
1687         * UIProcess/API/C/WKPreferences.cpp:
1688         (WKPreferencesSetPointerLockEnabled): Deleted.
1689         (WKPreferencesGetPointerLockEnabled): Deleted.
1690         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1691         * WebProcess/WebPage/WebPage.cpp:
1692         (WebKit::WebPage::updatePreferences):
1693
1694 2016-12-07  Eric Carlson  <eric.carlson@apple.com>
1695
1696         [MediaStream][Mac] Revoke sandbox extensions when capture ends
1697         https://bugs.webkit.org/show_bug.cgi?id=165476
1698
1699         Reviewed by Brady Eidson.
1700
1701         Track media capture by process so it is possible to revoke the sandbox extensions issued to
1702         a web process when capture stops. Allocate WK2 user media permission manager lazily rather
1703         than every time a page is created as most pages won't need one.
1704
1705         * CMakeLists.txt: Add new files.
1706
1707         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1708         (WebKit::UserMediaPermissionRequestManagerProxy::UserMediaPermissionRequestManagerProxy): Register
1709           with process manager.
1710         (WebKit::UserMediaPermissionRequestManagerProxy::~UserMediaPermissionRequestManagerProxy):
1711         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted): Move sandbox 
1712           extension code to the process manager.
1713         (WebKit::UserMediaPermissionRequestManagerProxy::stopCapture): New.
1714         (WebKit::UserMediaPermissionRequestManagerProxy::startedCaptureSession): New, report state
1715           change to the process manager.
1716         (WebKit::UserMediaPermissionRequestManagerProxy::endedCaptureSession): Ditto.
1717         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
1718
1719         * UIProcess/UserMediaProcessManager.cpp: Added.
1720         (WebKit::ProcessState::ProcessState):
1721         (WebKit::ProcessState::managers):
1722         (WebKit::ProcessState::sandboxExtensionsGranted):
1723         (WebKit::ProcessState::setSandboxExtensionsGranted):
1724         (WebKit::stateMap):
1725         (WebKit::processState):
1726         (WebKit::ProcessState::addRequestManager):
1727         (WebKit::ProcessState::removeRequestManager):
1728         (WebKit::UserMediaProcessManager::singleton):
1729         (WebKit::UserMediaProcessManager::addUserMediaPermissionRequestManagerProxy):
1730         (WebKit::UserMediaProcessManager::removeUserMediaPermissionRequestManagerProxy):
1731         (WebKit::UserMediaProcessManager::willCreateMediaStream):
1732         (WebKit::UserMediaProcessManager::startedCaptureSession):
1733         (WebKit::UserMediaProcessManager::endedCaptureSession):
1734         * UIProcess/UserMediaProcessManager.h: Added.
1735
1736         * UIProcess/WebPageProxy.cpp:
1737         (WebKit::WebPageProxy::WebPageProxy): Don't allocate m_userMediaPermissionRequestManager.
1738         (WebKit::WebPageProxy::resetState): Set m_userMediaPermissionRequestManager to null.
1739         (WebKit::WebPageProxy::userMediaPermissionRequestManager): Allocate m_userMediaPermissionRequestManager
1740           lazily as most pages don't need it.
1741         (WebKit::WebPageProxy::requestUserMediaPermissionForFrame): Call userMediaPermissionRequestManager().
1742         (WebKit::WebPageProxy::enumerateMediaDevicesForFrame): Ditto.
1743         (WebKit::WebPageProxy::clearUserMediaState): Ditto.
1744         (WebKit::WebPageProxy::isPlayingMediaDidChange): Report capture state changes to the request
1745           manager proxy.
1746         * UIProcess/WebPageProxy.h:
1747
1748         * WebKit2.xcodeproj/project.pbxproj: Add new files.
1749
1750         * WebProcess/MediaStream/MediaDeviceSandboxExtensions.cpp: Added.
1751         (WebKit::MediaDeviceSandboxExtensions::MediaDeviceSandboxExtensions):
1752         (WebKit::MediaDeviceSandboxExtensions::encode):
1753         (WebKit::MediaDeviceSandboxExtensions::decode):
1754         (WebKit::MediaDeviceSandboxExtensions::operator[]):
1755         (WebKit::MediaDeviceSandboxExtensions::size):
1756         * WebProcess/MediaStream/MediaDeviceSandboxExtensions.h: Added.
1757
1758         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
1759         (WebKit::UserMediaPermissionRequestManager::~UserMediaPermissionRequestManager): Sandbox extension
1760           is now in a HashMap, not a Vector.
1761         (WebKit::UserMediaPermissionRequestManager::grantUserMediaDeviceSandboxExtensions): Record
1762           IDs with extensions so they can be revoked later.
1763         (WebKit::UserMediaPermissionRequestManager::revokeUserMediaDeviceSandboxExtensions): New.
1764         (WebKit::UserMediaPermissionRequestManager::grantUserMediaDevicesSandboxExtension): Deleted.
1765         * WebProcess/MediaStream/UserMediaPermissionRequestManager.h:
1766
1767         * WebProcess/WebPage/WebPage.cpp:
1768         (WebKit::WebPage::grantUserMediaDeviceSandboxExtensions):
1769         (WebKit::WebPage::revokeUserMediaDeviceSandboxExtensions):
1770         (WebKit::WebPage::grantUserMediaDevicesSandboxExtension): Deleted.
1771         * WebProcess/WebPage/WebPage.h:
1772         * WebProcess/WebPage/WebPage.messages.in:
1773
1774 2016-12-07  Jeremy Jones  <jeremyj@apple.com>
1775
1776         One esc to exit fullscreen and pointer lock
1777         https://bugs.webkit.org/show_bug.cgi?id=165416
1778         rdar://problem/29430711
1779
1780         Reviewed by Jer Noble.
1781
1782         Fix a crash when didLosePointerLock is not specified.
1783
1784         * UIProcess/API/C/WKPage.cpp:
1785         (WKPageSetPageUIClient):
1786
1787 2016-12-07  Keith Rollin  <krollin@apple.com>
1788
1789         Network event record/replay
1790         https://bugs.webkit.org/show_bug.cgi?id=164527
1791         <rdar://problem/29168157>
1792
1793         Reviewed by Alex Christensen.
1794
1795         Add WebKit2/NetworkProcess/capture/* for recording the network events
1796         that occur when loading a page and for replaying them later. Update
1797         NetworkLoad to invoke capture facilities. Add preferences for enabling
1798         record or replay.
1799
1800         * CMakeLists.txt:
1801         * NetworkProcess/NetworkLoad.cpp:
1802         (WebKit::NetworkLoad::NetworkLoad):
1803         (WebKit::NetworkLoad::initializeForRecord):
1804         (WebKit::NetworkLoad::initializeForReplay):
1805         (WebKit::NetworkLoad::initialize):
1806         (WebKit::NetworkLoad::setDefersLoading):
1807         (WebKit::NetworkLoad::continueWillSendRequest):
1808         (WebKit::NetworkLoad::sharedWillSendRedirectedRequest):
1809         (WebKit::NetworkLoad::notifyDidReceiveResponse):
1810         (WebKit::NetworkLoad::didReceiveData):
1811         (WebKit::NetworkLoad::didCompleteWithError):
1812         * NetworkProcess/NetworkLoad.h:
1813         * NetworkProcess/NetworkProcess.cpp:
1814         (WebKit::NetworkProcess::initializeNetworkProcess):
1815         (WebKit::NetworkProcess::terminate):
1816         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1817         (WebKit::NetworkProcessCreationParameters::encode):
1818         (WebKit::NetworkProcessCreationParameters::decode):
1819         * NetworkProcess/NetworkProcessCreationParameters.h:
1820         * NetworkProcess/capture/NetworkCaptureEvent.cpp: Added.
1821         (WebKit::NetworkCapture::copyHeaders):
1822         (WebKit::NetworkCapture::KeyValuePair::KeyValuePair):
1823         (WebKit::NetworkCapture::ResourceRequest::ResourceRequest):
1824         (WebKit::NetworkCapture::ResourceRequest::operator WebCore::ResourceRequest):
1825         (WebKit::NetworkCapture::ResourceResponse::ResourceResponse):
1826         (WebKit::NetworkCapture::ResourceResponse::operator WebCore::ResourceResponse):
1827         (WebKit::NetworkCapture::ResourceError::ResourceError):
1828         (WebKit::NetworkCapture::ResourceError::operator WebCore::ResourceError):
1829         (WebKit::NetworkCapture::JSONCoder::encode):
1830         (WebKit::NetworkCapture::JSONCoder::decode):
1831         (WebKit::NetworkCapture::JSONCoder<String>::encode):
1832         (WebKit::NetworkCapture::JSONCoder<String>::decode):
1833         (WebKit::NetworkCapture::JSONCoder<CaptureTimeType>::encode):
1834         (WebKit::NetworkCapture::JSONCoder<CaptureTimeType>::decode):
1835         (WebKit::NetworkCapture::JSONCoder<KeyValuePair>::encode):
1836         (WebKit::NetworkCapture::JSONCoder<KeyValuePair>::decode):
1837         (WebKit::NetworkCapture::JSONCoder<Vector<T>>::encode):
1838         (WebKit::NetworkCapture::JSONCoder<Vector<T>>::decode):
1839         (WebKit::NetworkCapture::JSONCoder<ResourceRequest>::encode):
1840         (WebKit::NetworkCapture::JSONCoder<ResourceRequest>::decode):
1841         (WebKit::NetworkCapture::JSONCoder<ResourceResponse>::encode):
1842         (WebKit::NetworkCapture::JSONCoder<ResourceResponse>::decode):
1843         (WebKit::NetworkCapture::JSONCoder<ResourceError>::encode):
1844         (WebKit::NetworkCapture::JSONCoder<ResourceError>::decode):
1845         (WebKit::NetworkCapture::JSONCoder<WebCore::SharedBuffer>::encode):
1846         (WebKit::NetworkCapture::JSONCoder<WebCore::SharedBuffer>::decode):
1847         (WebKit::NetworkCapture::JSONCoder<RequestSentEvent>::encode):
1848         (WebKit::NetworkCapture::JSONCoder<RequestSentEvent>::decode):
1849         (WebKit::NetworkCapture::JSONCoder<ResponseReceivedEvent>::encode):
1850         (WebKit::NetworkCapture::JSONCoder<ResponseReceivedEvent>::decode):
1851         (WebKit::NetworkCapture::JSONCoder<RedirectReceivedEvent>::encode):
1852         (WebKit::NetworkCapture::JSONCoder<RedirectReceivedEvent>::decode):
1853         (WebKit::NetworkCapture::JSONCoder<RedirectSentEvent>::encode):
1854         (WebKit::NetworkCapture::JSONCoder<RedirectSentEvent>::decode):
1855         (WebKit::NetworkCapture::JSONCoder<DataReceivedEvent>::encode):
1856         (WebKit::NetworkCapture::JSONCoder<DataReceivedEvent>::decode):
1857         (WebKit::NetworkCapture::JSONCoder<FinishedEvent>::encode):
1858         (WebKit::NetworkCapture::JSONCoder<FinishedEvent>::decode):
1859         (WebKit::NetworkCapture::eventToString):
1860         (WebKit::NetworkCapture::stringToEvent):
1861         * NetworkProcess/capture/NetworkCaptureEvent.h: Added.
1862         (WebKit::NetworkCapture::TimedEvent::TimedEvent):
1863         * NetworkProcess/capture/NetworkCaptureLogging.h: Added.
1864         * NetworkProcess/capture/NetworkCaptureManager.cpp: Added.
1865         (WebKit::NetworkCapture::Manager::singleton):
1866         (WebKit::NetworkCapture::Manager::initialize):
1867         (WebKit::NetworkCapture::Manager::terminate):
1868         (WebKit::NetworkCapture::Manager::findMatch):
1869         (WebKit::NetworkCapture::Manager::findExactMatch):
1870         (WebKit::NetworkCapture::Manager::findBestFuzzyMatch):
1871         (WebKit::NetworkCapture::Manager::fuzzyMatchURLs):
1872         (WebKit::NetworkCapture::Manager::loadResources):
1873         (WebKit::NetworkCapture::Manager::reportLoadPath):
1874         (WebKit::NetworkCapture::Manager::reportRecordPath):
1875         (WebKit::NetworkCapture::Manager::reportReplayPath):
1876         (WebKit::NetworkCapture::Manager::requestToPath):
1877         (WebKit::NetworkCapture::Manager::stringToHash):
1878         (WebKit::NetworkCapture::Manager::hashToPath):
1879         (WebKit::NetworkCapture::Manager::logRecordedResource):
1880         (WebKit::NetworkCapture::Manager::logLoadedResource):
1881         (WebKit::NetworkCapture::Manager::logPlayedBackResource):
1882         (WebKit::NetworkCapture::Manager::ensureFileHandle):
1883         (WebKit::NetworkCapture::Manager::openCacheFile):
1884         (WebKit::NetworkCapture::Manager::readFile):
1885         (WebKit::NetworkCapture::Manager::getLine):
1886         (WebKit::NetworkCapture::Manager::getWord):
1887         (WebKit::NetworkCapture::Manager::printToFile):
1888         * NetworkProcess/capture/NetworkCaptureManager.h: Added.
1889         (WebKit::NetworkCapture::Manager::isRecording):
1890         (WebKit::NetworkCapture::Manager::isReplaying):
1891         (WebKit::NetworkCapture::Manager::mode):
1892         * NetworkProcess/capture/NetworkCaptureRecorder.cpp: Added.
1893         (WebKit::NetworkCapture::Recorder::recordRequestSent):
1894         (WebKit::NetworkCapture::Recorder::recordResponseReceived):
1895         (WebKit::NetworkCapture::Recorder::recordRedirectReceived):
1896         (WebKit::NetworkCapture::Recorder::recordRedirectSent):
1897         (WebKit::NetworkCapture::Recorder::recordDataReceived):
1898         (WebKit::NetworkCapture::Recorder::recordFinish):
1899         (WebKit::NetworkCapture::Recorder::writeEvents):
1900         * NetworkProcess/capture/NetworkCaptureRecorder.h: Added.
1901         (WebKit::NetworkCapture::Recorder::recordEvent):
1902         * NetworkProcess/capture/NetworkCaptureReplayer.cpp: Added.
1903         (WebKit::NetworkCapture::Replayer::replayResource):
1904         * NetworkProcess/capture/NetworkCaptureReplayer.h: Added.
1905         * NetworkProcess/capture/NetworkCaptureResource.cpp: Added.
1906         (WebKit::NetworkCapture::Resource::Resource):
1907         (WebKit::NetworkCapture::Resource::url):
1908         (WebKit::NetworkCapture::Resource::baseURL):
1909         (WebKit::NetworkCapture::Resource::queryParameters):
1910         (WebKit::NetworkCapture::Resource::eventStream):
1911         (WebKit::NetworkCapture::Resource::EventStream::EventStream):
1912         (WebKit::NetworkCapture::Resource::EventStream::nextEvent):
1913         * NetworkProcess/capture/NetworkCaptureResource.h: Added.
1914         * NetworkProcess/capture/NetworkCaptureTypes.h: Added.
1915         (WebKit::NetworkCapture::TypeHolder::forEachTypeImpl):
1916         (WebKit::NetworkCapture::TypeHolder::forEachType):
1917         * NetworkProcess/capture/NetworkDataTaskReplay.cpp: Added.
1918         (WebKit::NetworkCapture::NetworkDataTaskReplay::NetworkDataTaskReplay):
1919         (WebKit::NetworkCapture::NetworkDataTaskReplay::~NetworkDataTaskReplay):
1920         (WebKit::NetworkCapture::NetworkDataTaskReplay::resume):
1921         (WebKit::NetworkCapture::NetworkDataTaskReplay::suspend):
1922         (WebKit::NetworkCapture::NetworkDataTaskReplay::cancel):
1923         (WebKit::NetworkCapture::NetworkDataTaskReplay::complete):
1924         (WebKit::NetworkCapture::NetworkDataTaskReplay::invalidateAndCancel):
1925         (WebKit::NetworkCapture::NetworkDataTaskReplay::enqueueEventHandler):
1926         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayRequestSent):
1927         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayResponseReceived):
1928         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayRedirectReceived):
1929         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayRedirectSent):
1930         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayDataReceived):
1931         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayFinished):
1932         (WebKit::NetworkCapture::NetworkDataTaskReplay::didReceiveResponse):
1933         (WebKit::NetworkCapture::NetworkDataTaskReplay::didFinish):
1934         * NetworkProcess/capture/NetworkDataTaskReplay.h: Added.
1935         (WebKit::NetworkCapture::NetworkDataTaskReplay::create):
1936         * NetworkProcess/capture/json.hpp: Added.
1937         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1938         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
1939         * WebKit2.xcodeproj/project.pbxproj:
1940         * config.h:
1941
1942 2016-12-07  Anders Carlsson  <andersca@apple.com>
1943
1944         Fix build.
1945
1946         * Platform/IPC/mac/ConnectionMac.mm:
1947         (IPC::Connection::open):
1948
1949 2016-12-07  Anders Carlsson  <andersca@apple.com>
1950
1951         Rename the connection sources to better indicate what data direction they are used for
1952         https://bugs.webkit.org/show_bug.cgi?id=165548
1953
1954         Reviewed by Tim Horton.
1955
1956         * Platform/IPC/Connection.h:
1957         * Platform/IPC/mac/ConnectionMac.mm:
1958         (IPC::Connection::platformInvalidate):
1959         (IPC::Connection::platformInitialize):
1960         (IPC::createReceiveSource):
1961         (IPC::Connection::initializeSendSource):
1962         (IPC::Connection::receiveSourceEventHandler):
1963         (IPC::createDataAvailableSource): Deleted.
1964         (IPC::Connection::initializeDeadNameSource): Deleted.
1965         Rename m_deadNameSource to m_sendSource, and m_receivePortDataAvailableSource to m_receiveSource.
1966
1967         (IPC::Connection::open):
1968         Initialize the send source before we attempt to send a first message.
1969
1970 2016-12-07  Simon Fraser  <simon.fraser@apple.com>
1971
1972         Fix use of enum in a WK2 C SPI header.
1973         rdar://problem/28725583
1974
1975         Followup to correctly prefix the enum values.
1976
1977         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
1978         (WKBundlePageSetEventThrottlingBehaviorOverride):
1979         * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
1980
1981 2016-12-07  Simon Fraser  <simon.fraser@apple.com>
1982
1983         Fix use of enum in a WK2 C SPI header.
1984         rdar://problem/28725583
1985
1986         Reviewed by Dan Bernstein.
1987
1988         Use correct enum style for a C SPI header and fix the callers.
1989
1990         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
1991         (WKBundlePageSetEventThrottlingBehaviorOverride):
1992         * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
1993
1994 2016-12-07  Beth Dakin  <bdakin@apple.com>
1995
1996         Remove iCloud Pages and Keynote site-specific hacks
1997         https://bugs.webkit.org/show_bug.cgi?id=165544
1998         -and corresponding-
1999         rdar://problem/29082536
2000
2001         Reviewed by Wenson Hsieh.
2002
2003         * WebProcess/WebPage/WebPage.cpp:
2004         (WebKit::needsHiddenContentEditableQuirk):
2005         (WebKit::needsPlainTextQuirk):
2006
2007 2016-12-05  Ada Chan  <adachan@apple.com>
2008
2009         Add a getter for serverTrust in _WKObservablePageState
2010         https://bugs.webkit.org/show_bug.cgi?id=165433
2011
2012         Reviewed by Anders Carlsson.
2013
2014         * UIProcess/API/C/mac/WKPagePrivateMac.h:
2015         * UIProcess/API/C/mac/WKPagePrivateMac.mm:
2016         (-[WKObservablePageState serverTrust]):
2017
2018 2016-12-07  Jer Noble  <jer.noble@apple.com>
2019
2020         Exiting Element Fullscreen mode loses focus on WKWebView.
2021         https://bugs.webkit.org/show_bug.cgi?id=165512
2022
2023         Reviewed by Eric Carlson.
2024
2025         Setting 'window.contentView.hidden = YES' will reset the first-responder (whereas
2026         previously setting 'window.contentView.layer.hidden = YES' did not). Grab the first-
2027         responder before doing so, so that it can be reset correctly when moving the WKWebView
2028         back to it's original window.
2029
2030         * UIProcess/mac/WKFullScreenWindowController.mm:
2031         (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]):
2032
2033 2016-12-07  Alex Christensen  <achristensen@webkit.org>
2034
2035         Fix CMake build after r209418.
2036         https://bugs.webkit.org/show_bug.cgi?id=165484
2037
2038         * PlatformMac.cmake:
2039
2040 2016-12-07  Philippe Normand  <pnormand@igalia.com>
2041
2042         Unreviewed, GTK build fix after r209407.
2043
2044         * Platform/IPC/unix/ConnectionUnix.cpp:
2045         (IPC::Connection::processMessage):
2046         * UIProcess/LegacySessionStateCodingNone.cpp:
2047         (WebKit::decodeLegacySessionState):
2048
2049 2016-12-06  Ryan Haddad  <ryanhaddad@apple.com>
2050
2051         Unreviewed, rolling out r209422.
2052
2053         This change caused assertion failures during API tests.
2054
2055         Reverted changeset:
2056
2057         "[MediaStream][Mac] Revoke sandbox extensions when capture
2058         ends"
2059         https://bugs.webkit.org/show_bug.cgi?id=165476
2060         http://trac.webkit.org/changeset/209422
2061
2062 2016-12-06  Dean Jackson  <dino@apple.com>
2063
2064         Include default value in Experimental Feature information
2065         https://bugs.webkit.org/show_bug.cgi?id=165509
2066         <rdar://problems/29547177>
2067
2068         Reviewed by Tim Horton.
2069
2070         Add a defaultValue member variable to experimental
2071         features, both the C++ and ObjC interfaces.
2072
2073         * UIProcess/API/APIExperimentalFeature.cpp:
2074         (API::ExperimentalFeature::create):
2075         (API::ExperimentalFeature::ExperimentalFeature):
2076         * UIProcess/API/APIExperimentalFeature.h:
2077         * UIProcess/API/Cocoa/_WKExperimentalFeature.h:
2078         * UIProcess/API/Cocoa/_WKExperimentalFeature.mm:
2079         (-[_WKExperimentalFeature description]):
2080         (-[_WKExperimentalFeature defaultValue]):
2081         * UIProcess/WebPreferences.cpp:
2082         (WebKit::createExperimentalFeaturesVector):
2083
2084 2016-12-06  Commit Queue  <commit-queue@webkit.org>
2085
2086         Unreviewed, rolling out r209391.
2087         https://bugs.webkit.org/show_bug.cgi?id=165501
2088
2089         requires explicit nullptr checks so missing env vars don't
2090         flip AC mode (Requested by mcatanzaro on #webkit).
2091
2092         Reverted changeset:
2093
2094         "[GTK] Process accelerated compositing env variables only if
2095         they are really enabled"
2096         https://bugs.webkit.org/show_bug.cgi?id=165300
2097         http://trac.webkit.org/changeset/209391
2098
2099 2016-12-06  Alexey Proskuryakov  <ap@apple.com>
2100
2101         Correct SDKROOT values in xcconfig files
2102         https://bugs.webkit.org/show_bug.cgi?id=165487
2103         rdar://problem/29539209
2104
2105         Reviewed by Dan Bernstein.
2106
2107         Fix suggested by Dan Bernstein.
2108
2109         * Configurations/DebugRelease.xcconfig:
2110
2111 2016-12-06  Andreas Kling  <akling@apple.com>
2112
2113         [Cocoa] Add some memory usage related information to sysdiagnose state dumps
2114         <https://webkit.org/b/165375>
2115         <rdar://problem/29057243>
2116
2117         Reviewed by Darin Adler.
2118
2119         Follow-up to address two more review comments.
2120
2121         * WebProcess/cocoa/WebProcessCocoa.mm:
2122         (WebKit::WebProcess::registerWithStateDumper): Use adoptNS() instead of autorelease for NSStrings.
2123
2124 2016-12-06  Eric Carlson  <eric.carlson@apple.com>
2125
2126         [MediaStream][Mac] Revoke sandbox extensions when capture ends
2127         https://bugs.webkit.org/show_bug.cgi?id=165476
2128
2129         Reviewed by Brady Eidson.
2130         
2131         Track media capture by process so it is possible to revoke the sandbox extensions issued to
2132         a web process when capture stops.
2133
2134         * CMakeLists.txt: Add new files.
2135
2136         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2137         (WebKit::UserMediaPermissionRequestManagerProxy::UserMediaPermissionRequestManagerProxy): Register
2138           with process manager.
2139         (WebKit::UserMediaPermissionRequestManagerProxy::~UserMediaPermissionRequestManagerProxy):
2140         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted): Move sandbox 
2141           extension code to the process manager.
2142         (WebKit::UserMediaPermissionRequestManagerProxy::stopCapture): New.
2143         (WebKit::UserMediaPermissionRequestManagerProxy::startedCaptureSession): New, report state
2144           change to the process manager.
2145         (WebKit::UserMediaPermissionRequestManagerProxy::endedCaptureSession): Ditto.
2146         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
2147
2148         * UIProcess/UserMediaProcessManager.cpp: Added.
2149         (WebKit::ProcessState::ProcessState):
2150         (WebKit::ProcessState::managers):
2151         (WebKit::ProcessState::sandboxExtensionsGranted):
2152         (WebKit::ProcessState::setSandboxExtensionsGranted):
2153         (WebKit::stateMap):
2154         (WebKit::processState):
2155         (WebKit::ProcessState::addRequestManager):
2156         (WebKit::ProcessState::removeRequestManager):
2157         (WebKit::UserMediaProcessManager::singleton):
2158         (WebKit::UserMediaProcessManager::addUserMediaPermissionRequestManagerProxy):
2159         (WebKit::UserMediaProcessManager::removeUserMediaPermissionRequestManagerProxy):
2160         (WebKit::UserMediaProcessManager::willCreateMediaStream):
2161         (WebKit::UserMediaProcessManager::startedCaptureSession):
2162         (WebKit::UserMediaProcessManager::endedCaptureSession):
2163         * UIProcess/UserMediaProcessManager.h: Added.
2164
2165         * UIProcess/WebPageProxy.cpp:
2166         (WebKit::WebPageProxy::isPlayingMediaDidChange): Report capture state changes to the request
2167           manager proxy.
2168         * UIProcess/WebPageProxy.h:
2169
2170         * WebKit2.xcodeproj/project.pbxproj: Add new files.
2171
2172         * WebProcess/MediaStream/MediaDeviceSandboxExtensions.cpp: Added.
2173         (WebKit::MediaDeviceSandboxExtensions::MediaDeviceSandboxExtensions):
2174         (WebKit::MediaDeviceSandboxExtensions::encode):
2175         (WebKit::MediaDeviceSandboxExtensions::decode):
2176         (WebKit::MediaDeviceSandboxExtensions::operator[]):
2177         (WebKit::MediaDeviceSandboxExtensions::size):
2178         * WebProcess/MediaStream/MediaDeviceSandboxExtensions.h: Added.
2179
2180         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
2181         (WebKit::UserMediaPermissionRequestManager::~UserMediaPermissionRequestManager): Sandbox extension
2182           is now in a HashMap, not a Vector.
2183         (WebKit::UserMediaPermissionRequestManager::grantUserMediaDeviceSandboxExtensions): Record
2184           IDs with extensions so they can be revoked later.
2185         (WebKit::UserMediaPermissionRequestManager::revokeUserMediaDeviceSandboxExtensions): New.
2186         (WebKit::UserMediaPermissionRequestManager::grantUserMediaDevicesSandboxExtension): Deleted.
2187         * WebProcess/MediaStream/UserMediaPermissionRequestManager.h:
2188
2189         * WebProcess/WebPage/WebPage.cpp:
2190         (WebKit::WebPage::grantUserMediaDeviceSandboxExtensions):
2191         (WebKit::WebPage::revokeUserMediaDeviceSandboxExtensions):
2192         (WebKit::WebPage::grantUserMediaDevicesSandboxExtension): Deleted.
2193         * WebProcess/WebPage/WebPage.h:
2194         * WebProcess/WebPage/WebPage.messages.in:
2195
2196 2016-12-06  Anders Carlsson  <andersca@apple.com>
2197
2198         Add a new MachMessage class and use it for sending outgoing messages
2199         https://bugs.webkit.org/show_bug.cgi?id=165484
2200
2201         Reviewed by Sam Weinig.
2202
2203         * Platform/IPC/mac/ConnectionMac.mm:
2204         (IPC::Connection::sendOutgoingMessage):
2205         Instead of trying to randomly use memory from the stack as well as using mmap for the message data for out of line messages
2206         (which makes no sense at all, since the body data is already mmapped), just always create a MachMessage object and use it.
2207         
2208         (IPC::machMessageSize): Deleted.
2209         This has been moved to MachMessage::messageSize().
2210         
2211         * Platform/IPC/mac/MachMessage.cpp: Added.
2212         (IPC::MachMessage::create):
2213         Allocate extra memory to store the actual buffer.
2214
2215         (IPC::MachMessage::MachMessage):
2216         Initialize variables. m_size isn't really used right now, but will be in a subsequent patch.
2217
2218         (IPC::MachMessage::header):
2219         Return the header.
2220         
2221         * Platform/IPC/mac/MachMessage.h: Added.
2222         (IPC::MachMessage::length):
2223
2224         * WebKit2.xcodeproj/project.pbxproj:
2225         Add new files.
2226
2227 2016-12-06  Simon Fraser  <simon.fraser@apple.com>
2228
2229         Enable visual viewports by default on Mac, and iOS Wk2
2230         https://bugs.webkit.org/show_bug.cgi?id=165452
2231
2232         Reviewed by Zalan Bujtas.
2233
2234         Turn visual viewports on by default for WK2.
2235
2236         * Shared/WebPreferencesDefinitions.h:
2237
2238 2016-12-06  Daniel Bates  <dabates@apple.com>
2239
2240         WebKitTestRunner: Plugins are disabled in new windows
2241         https://bugs.webkit.org/show_bug.cgi?id=165410
2242
2243         Reviewed by Alex Christensen.
2244
2245         Remove SPI exposed to explicitly toggle plugins from WebKitTestRunner.
2246         Instead we will update WebKitTestRunner to make use of the SPI
2247         WKBundleOverrideBoolPreferenceForTestRunner() to toggle plugins in
2248         all windows.
2249
2250         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
2251         (WKBundleSetPluginsEnabled): Deleted.
2252         * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
2253         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2254         (WebKit::InjectedBundle::setPluginsEnabled): Deleted.
2255
2256 2016-12-05  Anders Carlsson  <andersca@apple.com>
2257
2258         Don't memcpy out of line data
2259         https://bugs.webkit.org/show_bug.cgi?id=165434
2260
2261         Reviewed by Sam Weinig.
2262
2263         Change the Decoder constructor to take a buffer deallocator parameter. If the buffer deallocator is null, the
2264         data will be copied as before. Otherwise, the memory will be adopted by the Decoder object, and will be deallocated
2265         by invoking the data deallocator.
2266
2267         * Platform/IPC/Decoder.cpp:
2268         (IPC::copyBuffer):
2269         Add a new helper.
2270
2271         (IPC::Decoder::Decoder):
2272         Copy the buffer if the deallocator is null.
2273
2274         (IPC::Decoder::~Decoder):
2275         Invoke the deallocator or call fastFree if it is null.
2276
2277         (IPC::Decoder::unwrapForTesting):
2278         Update constructor.
2279         
2280         (IPC::roundUpToAlignment):
2281         (IPC::Decoder::alignBufferPosition):
2282         (IPC::Decoder::decodeVariableLengthByteArray):
2283         (IPC::decodeValueFromBuffer):
2284         Change all these to deal with const pointers.
2285
2286         * Platform/IPC/Decoder.h:
2287         Add new members.
2288
2289         * Platform/IPC/mac/ConnectionMac.mm:
2290         (IPC::createMessageDecoder):
2291         When we have out of line data, pass a deallocator that calls vm_deallocate, instead of copying the data
2292         and then immediately throwing the original away.
2293
2294 2016-12-06  Tim Horton  <timothy_horton@apple.com>
2295
2296         Almost half-second stall scrolling apple.com because of synchronous getPositionInformation
2297         https://bugs.webkit.org/show_bug.cgi?id=165403
2298         <rdar://problem/29493285>
2299
2300         Reviewed by Enrica Casucci.
2301
2302         When retrieving interaction information, we don't always need to do
2303         snapshots for 3D Touch or the action sheet, especially if we're
2304         synchronously blocking the UI process main thread waiting for the reply.
2305
2306         Add a new InteractionInformationRequest, which allows callers of
2307         getPositionInformation and requestPositionInformation to specify which
2308         optional pieces of information they would like to compute.
2309
2310         * Shared/AssistedNodeInformation.h:
2311         Fix a incorrect comment.
2312
2313         * Shared/ios/InteractionInformationRequest.cpp: Added.
2314         (WebKit::InteractionInformationRequest::encode):
2315         (WebKit::InteractionInformationRequest::decode):
2316         (WebKit::InteractionInformationRequest::isValidForRequest):
2317         * Shared/ios/InteractionInformationRequest.h: Added.
2318         (WebKit::InteractionInformationRequest::InteractionInformationRequest):
2319         * WebKit2.xcodeproj/project.pbxproj:
2320         Add InteractionInformationRequest, which encapsulates all of the
2321         parameters required to generate an InteractionInformationAtPosition.
2322         Previously, that was just a point, but now we have two new parameters:
2323         whether we should generate a snapshot of the element, and whether
2324         we should generate a TextIndicator if the element is a link.
2325
2326         * Shared/ios/InteractionInformationAtPosition.h:
2327         * Shared/ios/InteractionInformationAtPosition.mm:
2328         (WebKit::InteractionInformationAtPosition::encode):
2329         (WebKit::InteractionInformationAtPosition::decode):
2330         (WebKit::InteractionInformationAtPosition::mergeCompatibleOptionalInformation):
2331         Adopt InteractionInformationRequest.
2332
2333         * UIProcess/WebPageProxy.h:
2334         * UIProcess/ios/WebPageProxyIOS.mm:
2335         (WebKit::WebPageProxy::getPositionInformation):
2336         (WebKit::WebPageProxy::requestPositionInformation):
2337         * UIProcess/ios/WKActionSheetAssistant.mm:
2338         (-[WKActionSheetAssistant initialPresentationRectInHostViewForSheet]):
2339         (-[WKActionSheetAssistant presentationRectInHostViewForSheet]):
2340         (-[WKActionSheetAssistant showImageSheet]):
2341         (-[WKActionSheetAssistant showLinkSheet]):
2342         * UIProcess/ios/WKPDFView.mm:
2343         (-[WKPDFView annotation:isBeingPressedAtPoint:controller:]):
2344         * WebProcess/WebPage/WebPage.h:
2345         * WebProcess/WebPage/WebPage.messages.in:
2346         Adopt InteractionInformationRequest.
2347         
2348         * UIProcess/ios/WKContentViewInteraction.h:
2349         * UIProcess/ios/WKContentViewInteraction.mm:
2350         (-[WKContentView _showAttachmentSheet]):
2351         (-[WKContentView ensurePositionInformationIsUpToDate:]):
2352         If we have a outstanding asynchronous position information request
2353         for the current point, instead of sending a second separate request,
2354         just wait for the async one to come in.
2355
2356         (-[WKContentView requestAsynchronousPositionInformationUpdate:]):
2357         If asked to do an asynchronous request with more optional bits than
2358         the current otherwise-valid response's request, update the position information.
2359
2360         (-[WKContentView gestureRecognizerShouldBegin:]):
2361         The design of this mechanism is that during the highlight long press,
2362         we do an async position information update, and then when we actually
2363         begin a 3D Touch gesture, we hope to already have the requisite snapshots
2364         ready (so that we can avoid synchronously blocking for them, there).
2365         So, in the highlight long-press async request, ask for all the goodies.
2366
2367         (-[WKContentView hasSelectablePositionAtPoint:]):
2368         (-[WKContentView pointIsNearMarkedText:]):
2369         (-[WKContentView pointIsInAssistedNode:]):
2370         (-[WKContentView _didNotHandleTapAsClick:]):
2371         (-[WKContentView _positionInformationDidChange:]):
2372         If we get a position information update for the same point, but with less
2373         goodies attached (the snapshot/link indicator), copy them over from the old
2374         position information, so that we never accidentally "downgrade" our info.
2375
2376         (-[WKContentView updatePositionInformationForActionSheetAssistant:]):
2377         (-[WKContentView actionSheetAssistant:willStartInteractionWithElement:]):
2378         (-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]):
2379         (-[WKContentView _dataForPreviewItemController:atPosition:type:]):
2380         (-[WKContentView _presentedViewControllerForPreviewItemController:]):        
2381         More adoption.
2382         
2383         * WebProcess/WebPage/ios/WebPageIOS.mm:
2384         (WebKit::WebPage::handleTap):
2385         (WebKit::WebPage::handleTwoFingerTapAtPoint):
2386         (WebKit::WebPage::commitPotentialTap):
2387         Adopt InteractionInformationRequest.
2388
2389         (WebKit::WebPage::getPositionInformation):
2390         (WebKit::WebPage::requestPositionInformation):
2391         Copy the request into the response.
2392         Only snapshot if the request wants a snapshot.
2393         Only make a link indicator if the request wants one.
2394
2395 2016-12-06  Daniel Bates  <dabates@apple.com>
2396
2397         Cleanup: Rename some HTTP 0.9-specific functions to conform to WebKit Code Style Guidelines
2398         https://bugs.webkit.org/show_bug.cgi?id=165451
2399
2400         Reviewed by Alex Christensen.
2401
2402         * NetworkProcess/NetworkDataTask.cpp:
2403         (WebKit::NetworkDataTask::didReceiveResponse):
2404
2405 2016-12-06  Daniel Bates  <dabates@apple.com>
2406
2407         Remove unused InjectedBundle::overrideXSSAuditorEnabledForTestRunner()
2408         https://bugs.webkit.org/show_bug.cgi?id=165408
2409
2410         Reviewed by Alex Christensen.
2411
2412         InjectedBundle::overrideXSSAuditorEnabledForTestRunner() is unused. This function was only
2413         called by WKBundleOverrideXSSAuditorEnabledForTestRunner(), which was removed in r106005.
2414
2415         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2416         (WebKit::InjectedBundle::overrideXSSAuditorEnabledForTestRunner): Deleted.
2417         * WebProcess/InjectedBundle/InjectedBundle.h:
2418
2419 2016-12-04  Darin Adler  <darin@apple.com>
2420
2421         Use ASCIICType more, and improve it a little bit
2422         https://bugs.webkit.org/show_bug.cgi?id=165360
2423
2424         Reviewed by Sam Weinig.
2425
2426         * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
2427         (WebKit::capitalizeRFC822HeaderFieldName): Removed unneeded checks to simplify code.
2428
2429 2016-12-06  Dave Hyatt  <hyatt@apple.com>
2430
2431         [CSS Parser] Turn on the new CSS parser
2432         https://bugs.webkit.org/show_bug.cgi?id=165213
2433
2434         Reviewed by Zalan Bujtas.
2435
2436         * Shared/WebPreferencesDefinitions.h:
2437
2438 2016-12-06  Tomas Popela  <tpopela@redhat.com>
2439
2440         [GTK] Process accelerated compositing env variables only if they are really enabled
2441         https://bugs.webkit.org/show_bug.cgi?id=165300
2442
2443         Don't process the WEBKIT_FORCE_COMPOSITING_MODE and
2444         WEBKIT_DISABLE_COMPOSITING_MODE env variables if they are disabled
2445         (eg. WEBKIT_DISABLE_COMPOSITING_MODE=0).
2446
2447         Reviewed by Michael Catanzaro.
2448
2449         * UIProcess/gtk/WebPreferencesGtk.cpp:
2450         (WebKit::WebPreferences::platformInitializeStore):
2451
2452 2016-12-06  Sam Weinig  <sam@webkit.org>
2453
2454         [WebIDL] Add support for converting dictionaries to JS
2455         https://bugs.webkit.org/show_bug.cgi?id=165367
2456
2457         Reviewed by Darin Adler and Alex Christensen.
2458
2459         * CMakeLists.txt:
2460         Add missing directories to look in for headers.
2461
2462 2016-12-05  Tim Horton  <timothy_horton@apple.com>
2463
2464         Try to fix the iOS Simulator build.
2465
2466         * UIProcess/mac/RemoteLayerTreeHost.mm:
2467         (WebKit::RemoteLayerTreeHost::mapAllIOSurfaceBackingStore):
2468
2469 2016-12-03  Simon Fraser  <simon.fraser@apple.com>
2470
2471         Minor reformat and renames in -didUpdateVisibleRect:
2472         https://bugs.webkit.org/show_bug.cgi?id=165365
2473
2474         Reviewed by Dave Hyatt.
2475         
2476         didUpdateVisibleRect:... has lots of parameters. Put one on each line.
2477
2478         Rename the rects to make it clear they are "content" rects (i.e. in document coordinates).
2479
2480         * UIProcess/ios/WKContentView.h:
2481         * UIProcess/ios/WKContentView.mm:
2482         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
2483
2484 2016-12-05  Tim Horton  <timothy_horton@apple.com>
2485
2486         Adopt CAMachPort-as-layer-contents
2487         https://bugs.webkit.org/show_bug.cgi?id=141687
2488         <rdar://problem/19393233>
2489
2490         Reviewed by Darin Adler.
2491
2492         * Shared/mac/RemoteLayerBackingStore.h:
2493         * Shared/mac/RemoteLayerBackingStore.mm:
2494         (WebKit::RemoteLayerBackingStore::decode):
2495         On the UI process side, instead of actually looking up the surface,
2496         just keep the MachSendRight around, to later be turned into a CAMachPort.
2497
2498         (WebKit::RemoteLayerBackingStore::applyBackingStoreToLayer):
2499         Make a CAMachPort and leak our send right into it. CAMachPort
2500         will adopt the port and destroy it when needed.
2501
2502         (WebKit::RemoteLayerBackingStore::setBufferVolatility):
2503         Tiny style fix.
2504
2505         * Shared/mac/RemoteLayerTreePropertyApplier.h:
2506         * Shared/mac/RemoteLayerTreePropertyApplier.mm:
2507         (WebKit::applyPropertiesToLayer):
2508         (WebKit::RemoteLayerTreePropertyApplier::applyProperties):
2509         * UIProcess/DrawingAreaProxy.h:
2510         (WebKit::DrawingAreaProxy::prepareForAppSuspension):
2511         * UIProcess/ios/WebPageProxyIOS.mm:
2512         (WebKit::WebPageProxy::applicationDidFinishSnapshottingAfterEnteringBackground):
2513         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h:
2514         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
2515         (WebKit::RemoteLayerTreeDrawingAreaProxy::prepareForAppSuspension):
2516         * UIProcess/mac/RemoteLayerTreeHost.h:
2517         * UIProcess/mac/RemoteLayerTreeHost.mm:
2518         (WebKit::RemoteLayerTreeHost::updateLayerTree):
2519         (WebKit::RemoteLayerTreeHost::mapAllIOSurfaceBackingStore):
2520         * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
2521         (WebKit::PlatformCALayerRemote::recursiveBuildTransaction):
2522         Two supporting changes in order to fix the two regressions that this
2523         caused when we tried to land it two years ago:
2524
2525         When an app is being suspended, resolve all CAMachPort backing store
2526         into actual IOSurfaces. Otherwise, any live CAMachPorts will keep a
2527         +1 on their respective IOSurface's use count, causing us to fail to
2528         mark them volatile, keeping the app alive for more time (re-trying the
2529         volatility change), and increasing the likelihood of background jetsam.
2530
2531         If the debugging tile map is enabled, do not use CAMachPort, because
2532         we don't have a great way to plumb the same CAMachPort to two layers
2533         (and it doesn't seem to work even if you do). Instead, just map the
2534         IOSurface into the UI process like we used to.
2535
2536 2016-12-05  Dean Jackson  <dino@apple.com>
2537
2538         pointer lock needs to be feature detectable
2539         https://bugs.webkit.org/show_bug.cgi?id=165426
2540         <rdar://problem/29486715>
2541
2542         Reviewed by Antoine Quint.
2543
2544         Set the RuntimeEnabledFeature as preferences
2545         change.
2546
2547         * UIProcess/API/C/WKPreferences.cpp:
2548         (WKPreferencesSetPointerLockEnabled):
2549         (WKPreferencesGetPointerLockEnabled):
2550         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2551         * WebProcess/WebPage/WebPage.cpp:
2552         (WebKit::WebPage::updatePreferences):
2553
2554 2016-12-05  Andreas Kling  <akling@apple.com>
2555
2556         [Cocoa] Add some memory usage related information to sysdiagnose state dumps
2557         <https://webkit.org/b/165375>
2558         <rdar://problem/29057243>
2559
2560         Reviewed by Darin Adler.
2561
2562         Add two new entries to the sysdiagnose state dumps for WebContent processes:
2563         "Memory Usage Stats" and "JavaScript Object Counts".
2564
2565         The first category contains all the interesting stuff from task_info()
2566         along with some WebCore and JavaScriptCore object/memory counters.
2567
2568         The second category contains a list of all the JS object types currently live
2569         on the heap, along with a count.
2570
2571         * WebProcess/cocoa/WebProcessCocoa.mm:
2572         (WebKit::WebProcess::registerWithStateDumper): Add two new entries to the
2573         state dictionary: "Memory Usage Stats" and "JavaScript Object Counts".
2574
2575 2016-12-05  Csaba Osztrogonác  <ossy@webkit.org>
2576
2577         Unreviewed cmake buildfix after r209307.
2578
2579         * PlatformMac.cmake:
2580
2581 2016-12-03  Dan Bernstein  <mitz@apple.com>
2582
2583         [Cocoa] Expose InjectedBundlePageEditorClient via the Objective-C bundle SPI
2584         https://bugs.webkit.org/show_bug.cgi?id=165276
2585         <rdar://problem/29467040>
2586
2587         Reviewed by Darin Adler.
2588
2589         Test: TestWebKitAPI/Tests/WebKit2Cocoa/BundleEditingDelegate.mm
2590
2591         * Shared/Cocoa/APIObject.mm:
2592         (API::Object::newObject): Wrap InjectedBundleRangeHandle in WKWebProcessPlugInRangeHandle.
2593
2594         * WebKit2.xcodeproj/project.pbxproj: Added references to new files, making
2595           WKWebProcessPlugInEditingDelegate.h and WKWebProcessPlugInRangeHandle.h private headers.
2596
2597         * WebProcess/InjectedBundle/API/APIInjectedBundleEditorClient.h: Added. An base class
2598           based on InjectedBundlePageEditorClient.
2599         (API::InjectedBundle::EditorClient::~EditorClient):
2600         (API::InjectedBundle::EditorClient::shouldBeginEditing):
2601         (API::InjectedBundle::EditorClient::shouldEndEditing):
2602         (API::InjectedBundle::EditorClient::shouldInsertNode):
2603         (API::InjectedBundle::EditorClient::shouldInsertText):
2604         (API::InjectedBundle::EditorClient::shouldDeleteRange):
2605         (API::InjectedBundle::EditorClient::shouldChangeSelectedRange):
2606         (API::InjectedBundle::EditorClient::shouldApplyStyle):
2607         (API::InjectedBundle::EditorClient::didBeginEditing):
2608         (API::InjectedBundle::EditorClient::didEndEditing):
2609         (API::InjectedBundle::EditorClient::didChange):
2610         (API::InjectedBundle::EditorClient::didChangeSelection):
2611         (API::InjectedBundle::EditorClient::willWriteToPasteboard):
2612         (API::InjectedBundle::EditorClient::getPasteboardDataForRange):
2613         (API::InjectedBundle::EditorClient::didWriteToPasteboard):
2614
2615         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInEditingDelegate.h: Added. Declares
2616           the new delegate protocol, currently comprising three methods corresponding to
2617           willWriteToPasteboard, getPasteboardDataForRange, and didWriteToPasteboard.
2618
2619         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.h:
2620         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm:
2621         (-[WKWebProcessPlugInFrame jsRangeForRangeHandle:inWorld:]): Added. Gets the JS wrapper for
2622           the specified range handle.
2623
2624         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.h: Added.
2625         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.mm: Added.
2626         (-[WKWebProcessPlugInRangeHandle dealloc]): Call the InjectedBundleRangeHandle destructor.
2627         (+[WKWebProcessPlugInRangeHandle rangeHandleWithJSValue:inContext:]): Get or create an
2628           InjectedBundleRangeHandle for the specified object.
2629         (-[WKWebProcessPlugInRangeHandle frame]): Return the range’s owner document’s frame.
2630         (-[WKWebProcessPlugInRangeHandle _rangeHandle]): Return the InjectedBundleRangeHandle.
2631         (-[WKWebProcessPlugInRangeHandle _apiObject]): Ditto.
2632
2633         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandleInternal.h: Added.
2634         (WebKit::wrapper):
2635
2636         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
2637         (WKBundlePageSetEditorClient): Updated for WebPage change.
2638
2639         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
2640         (-[WKWebProcessPlugInBrowserContextController _editingDelegate]): Added. Returns the
2641           delegate.
2642         (-[WKWebProcessPlugInBrowserContextController _setEditingDelegate:]): Added. Defines a
2643           Client class, which derives from API::InjectedBundle::EditorClient, and invokes the
2644           delegate methods. Instantiates a Client and sets it on the WebPage.
2645
2646         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerPrivate.h:
2647           Declared new _editingDelegate property.
2648
2649         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
2650         (WebKit::InjectedBundleRangeHandle::document): Added. Returns an InjectedBundleNodeHandle
2651           for the range’s owner document.
2652         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.h:
2653
2654         * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp:
2655         (WebKit::InjectedBundlePageEditorClient::InjectedBundlePageEditorClient): Added. Calls
2656           initialize().
2657         (WebKit::InjectedBundlePageEditorClient::shouldBeginEditing): Updated for type change.
2658         (WebKit::InjectedBundlePageEditorClient::shouldEndEditing): Ditto.
2659         (WebKit::InjectedBundlePageEditorClient::shouldInsertNode): Ditto.
2660         (WebKit::InjectedBundlePageEditorClient::shouldInsertText): Ditto.
2661         (WebKit::InjectedBundlePageEditorClient::shouldDeleteRange): Ditto.
2662         (WebKit::InjectedBundlePageEditorClient::shouldChangeSelectedRange): Ditto.
2663         (WebKit::InjectedBundlePageEditorClient::shouldApplyStyle): Ditto.
2664         (WebKit::InjectedBundlePageEditorClient::didBeginEditing): Ditto.
2665         (WebKit::InjectedBundlePageEditorClient::didEndEditing): Ditto.
2666         (WebKit::InjectedBundlePageEditorClient::didChange): Ditto.
2667         (WebKit::InjectedBundlePageEditorClient::didChangeSelection): Ditto.
2668         (WebKit::InjectedBundlePageEditorClient::willWriteToPasteboard): Ditto.
2669         (WebKit::InjectedBundlePageEditorClient::getPasteboardDataForRange): Ditto.
2670         (WebKit::InjectedBundlePageEditorClient::didWriteToPasteboard): Ditto.
2671         * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h: Now derives from
2672           API::InjectedBundle::EditorClient.
2673
2674         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
2675         (WebKit::WebEditorClient::shouldDeleteRange): Ditto.
2676         (WebKit::WebEditorClient::shouldBeginEditing): Ditto.
2677         (WebKit::WebEditorClient::shouldEndEditing): Ditto.
2678         (WebKit::WebEditorClient::shouldInsertNode): Ditto.
2679         (WebKit::WebEditorClient::shouldInsertText): Ditto.
2680         (WebKit::WebEditorClient::shouldChangeSelectedRange): Ditto.
2681         (WebKit::WebEditorClient::shouldApplyStyle): Ditto.
2682         (WebKit::WebEditorClient::didBeginEditing): Ditto.
2683         (WebKit::WebEditorClient::respondToChangedContents): Ditto.
2684         (WebKit::WebEditorClient::respondToChangedSelection): Ditto.
2685         (WebKit::WebEditorClient::didEndEditing): Ditto.
2686         (WebKit::WebEditorClient::didWriteSelectionToPasteboard): Ditto.
2687         (WebKit::WebEditorClient::willWriteSelectionToPasteboard): Ditto.
2688         (WebKit::WebEditorClient::getClientPasteboardDataForRange): Ditto.
2689
2690         * WebProcess/WebPage/WebPage.cpp:
2691         (WebKit::WebPage::WebPage): Initialize m_editorClient.
2692         (WebKit::WebPage::setInjectedBundleEditorClient): Replaces
2693           initializeInjectedBundleEditorClient and just sets m_editorClient.
2694         (WebKit::WebPage::close): Resets m_editorClient.
2695
2696         * WebProcess/WebPage/WebPage.h: Changed m_editorClient to a unique_ptr.
2697
2698 2016-12-02  Said Abou-Hallawa  <sabouhallawa@apple.com>
2699
2700         [iOS] Add a WebView private configuration for changing the WebContent update frequency
2701         https://bugs.webkit.org/show_bug.cgi?id=165289
2702         <rdar://problem/29472577>
2703
2704         Reviewed by Tim Horton.
2705         
2706         Expose a preference which allows us to control the fps of web content updates.
2707
2708         * UIProcess/API/APIPageConfiguration.h:
2709         (API::PageConfiguration::contentUpdateFrequency):
2710         (API::PageConfiguration::setContentUpdateFrequency):
2711         * UIProcess/API/Cocoa/WKWebView.mm:
2712         (-[WKWebView _initializeWithConfiguration:]):
2713         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2714         (-[WKWebViewConfiguration copyWithZone:]):
2715         (-[WKWebViewConfiguration _contentUpdateFrequency]):
2716         (-[WKWebViewConfiguration _setContentUpdateFrequency:]):
2717         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
2718         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h:
2719         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
2720         (-[WKOneShotDisplayLinkHandler initWithDrawingAreaProxy:]):
2721         (WebKit::RemoteLayerTreeDrawingAreaProxy::contentUpdateFrequency):
2722
2723 2016-12-02  Andy Estes  <aestes@apple.com>
2724
2725         [Cocoa] Adopt the PRODUCT_BUNDLE_IDENTIFIER build setting
2726         https://bugs.webkit.org/show_bug.cgi?id=164492
2727
2728         Reviewed by Dan Bernstein.
2729
2730         * Configurations/DatabaseService.xcconfig: Set PRODUCT_BUNDLE_IDENTIFIER to
2731         $(PRODUCT_NAME).
2732         * Configurations/NetworkService.xcconfig: Ditto.
2733         * Configurations/PluginService.32.xcconfig: Ditto.
2734         * Configurations/PluginService.64.xcconfig: Ditto.
2735         * Configurations/WebContentService.xcconfig: Ditto.
2736         * Configurations/WebKit.xcconfig: Set PRODUCT_BUNDLE_IDENTIFIER to
2737         com.apple.$(PRODUCT_NAME:rfc1034identifier).
2738         * DatabaseProcess/EntryPoint/mac/XPCService/DatabaseService/Info.plist: Changed
2739         CFBundleIdentifier's value from ${PRODUCT_NAME} to ${PRODUCT_BUNDLE_IDENTIFIER}.
2740         * Info.plist: Changed CFBundleIdentifier's value from com.apple.${PRODUCT_NAME} to
2741         ${PRODUCT_BUNDLE_IDENTIFIER}.
2742         * NetworkProcess/EntryPoint/mac/XPCService/NetworkService/Info-OSX-10.9-10.10.plist: Changed
2743         CFBundleIdentifier's value from ${PRODUCT_NAME} to ${PRODUCT_BUNDLE_IDENTIFIER}.
2744         * NetworkProcess/EntryPoint/mac/XPCService/NetworkService/Info-OSX.plist: Ditto.
2745         * NetworkProcess/EntryPoint/mac/XPCService/NetworkService/Info-iOS.plist: Ditto.
2746         * PluginProcess/EntryPoint/mac/XPCService/PluginService.32-64-10.9-10.10.Info.plist: Ditto.
2747         * PluginProcess/EntryPoint/mac/XPCService/PluginService.32-64.Info.plist: Ditto.
2748         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-OSX-10.9-10.10.plist: Ditto.
2749         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-OSX.plist: Ditto.
2750         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-iOS.plist: Ditto.
2751
2752 2016-12-02  Brent Fulgham  <bfulgham@apple.com>
2753
2754         [Mac] Update sandbox profiles to use modern syntax and avoid duplication
2755         https://bugs.webkit.org/show_bug.cgi?id=165332
2756         <rdar://problem/26898991>
2757
2758         Reviewed by Anders Carlsson.
2759
2760         Update the Mac sandbox profiles to reflect that modern Cocoa applications
2761         communicate with cfprefsd, rather than plists on disk (and have done so
2762         for the past several releases).
2763
2764         Get rid of some duplicated rules, as well as old compatibility rules that
2765         are never triggered under supported operating systems.
2766
2767         * DatabaseProcess/mac/com.apple.WebKit.Databases.sb.in:
2768         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
2769         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
2770         * WebProcess/com.apple.WebProcess.sb.in:
2771
2772 2016-12-02  Gustavo Sverzut Barbieri  <barbieri@profusion.mobi>
2773
2774         Fix build break when disabling some features.
2775         https://bugs.webkit.org/show_bug.cgi?id=165254
2776
2777         The EFL port was broken if SPELLCHECK was disabled or
2778         PLUGIN_ARCHITECTURE is not x11.
2779
2780         Reviewed by Michael Catanzaro.
2781
2782         * UIProcess/efl/TextCheckerEfl.cpp:
2783         (WebKit::TextChecker::checkTextOfParagraph):
2784         (WebKit::TextChecker::checkSpellingOfString):
2785         Fix UNUSED_PARAM() usage if SPELLCHECK is disabled.
2786         * UIProcess/efl/WebPageProxyEfl.cpp:
2787         Isolate methods within #if PLUGIN_ARCHITECTURE(X11).
2788
2789 2016-12-01  Jiewen Tan  <jiewen_tan@apple.com>
2790
2791         Add a runtime flag for SubtleCrypto
2792         https://bugs.webkit.org/show_bug.cgi?id=164982
2793
2794         Reviewed by Brent Fulgham.
2795
2796         * Shared/WebPreferencesDefinitions.h:
2797         * UIProcess/API/C/WKPreferences.cpp:
2798         (WKPreferencesSetSubtleCryptoEnabled):
2799         (WKPreferencesGetSubtleCryptoEnabled):
2800         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2801         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2802         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
2803         * WebProcess/WebPage/WebPage.cpp:
2804         (WebKit::WebPage::updatePreferences):
2805
2806 2016-12-01  Saam Barati  <sbarati@apple.com>
2807
2808         Rename CallFrame::callee() to CallFrame::jsCallee()
2809         https://bugs.webkit.org/show_bug.cgi?id=165293
2810
2811         Reviewed by Keith Miller.
2812
2813         * WebProcess/Plugins/Netscape/JSNPMethod.cpp:
2814         (WebKit::callMethod):
2815         * WebProcess/Plugins/Netscape/JSNPObject.cpp:
2816         (WebKit::callNPJSObject):
2817         (WebKit::constructWithConstructor):
2818
2819 2016-12-01  Chris Dumez  <cdumez@apple.com>
2820
2821         [iOS][WK2] Tapping an element generates a 'click' event that has 0 as timeStamp
2822         https://bugs.webkit.org/show_bug.cgi?id=165270
2823         <rdar://problem/29224355>
2824
2825         Reviewed by Simon Fraser.
2826
2827         Tapping an element generates a 'click' event that has 0 as timeStamp
2828         instead of having a proper timeStamp value. This is breaking some
2829         sites.
2830
2831         * WebProcess/WebPage/ios/WebPageIOS.mm:
2832         (WebKit::WebPage::handleSyntheticClick):
2833         (WebKit::WebPage::completeSyntheticClick):
2834
2835 2016-12-01  Tim Horton  <timothy_horton@apple.com>
2836
2837         Try to fix the EFL/Gtk build
2838
2839         * UIProcess/efl/WebProcessPoolEfl.cpp:
2840         (WebKit::WebProcessPool::platformResolvePathsForSandboxExtensions):
2841         * UIProcess/gtk/WebProcessPoolGtk.cpp:
2842         (WebKit::WebProcessPool::platformResolvePathsForSandboxExtensions):
2843
2844 2016-12-01  Tim Horton  <timothy_horton@apple.com>
2845
2846         Every WKWebView initialization spends a few milliseconds hitting the disk
2847         https://bugs.webkit.org/show_bug.cgi?id=165268
2848         <rdar://problem/29010113>
2849
2850         Reviewed by Brady Eidson.
2851
2852         Every WKWebView init currently involves doing directory creation and
2853         symlink resolution for a number of paths (to create sandbox extensions
2854         for all of our storage directories), which means touching the disk a
2855         lot during init. All of these paths are immutable per-WebProcessPool,
2856         so, instead, cache them on WebProcessPool and create sandbox extensions
2857         from the already-resolved paths. This is a sizable (~4x) speedup when
2858         initializing subsequent web views.
2859
2860         * Shared/SandboxExtension.h:
2861         (WebKit::SandboxExtension::createHandleWithoutResolvingPath):
2862         Add createHandleWithoutResolvingPath, which makes a sandbox extension
2863         handle without doing symlink resolution.
2864
2865         (WebKit::resolvePathForSandboxExtension):
2866         (WebKit::resolveAndCreateReadWriteDirectoryForSandboxExtension):
2867         Add two functions that do the same resolution that SandboxExtension::createHandle
2868         and ::createHandleForReadWriteDirectory do, but just return the paths,
2869         for later use with createHandleWithoutResolvingPath.
2870
2871         * Shared/mac/SandboxExtensionMac.mm:
2872         (WebKit::resolveAndCreateReadWriteDirectoryForSandboxExtension):
2873         (WebKit::resolvePathForSandboxExtension):
2874         (WebKit::SandboxExtension::createHandleWithoutResolvingPath):
2875         (WebKit::SandboxExtension::createHandle):
2876         (WebKit::SandboxExtension::createHandleForReadWriteDirectory):
2877         Implement the aforementioned functions, and reimplement the existing
2878         createHandle{ForReadWriteDirectory} functions in terms of them.
2879
2880         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2881         (WebKit::WebProcessPool::platformDefaultIconDatabasePath):
2882         Stop wasting time generating and resolving a platform default icon
2883         database path, since we don't actually use it for anything anymore except
2884         to determine whether the icon database is enabled, and we only want to
2885         enable it if the client has provided a path.
2886
2887         (WebKit::WebProcessPool::platformResolvePathsForSandboxExtensions):
2888         (WebKit::WebProcessPool::platformInitializeWebProcess):
2889         * UIProcess/WebProcessPool.cpp:
2890         (WebKit::m_hiddenPageThrottlingTimer):
2891         (WebKit::WebProcessPool::resolvePathsForSandboxExtensions):
2892         (WebKit::WebProcessPool::createNewWebProcess):
2893         * UIProcess/WebProcessPool.h:
2894         Resolve paths in resolvePathsForSandboxExtensions, and use the resolved
2895         paths along with createHandleWithoutResolvingPath in order to effectively
2896         cache the resolution operation.
2897
2898 2016-12-01  Antti Koivisto  <antti@apple.com>
2899
2900         Revert r208931
2901         https://bugs.webkit.org/show_bug.cgi?id=164924
2902
2903         PLT regression.
2904
2905         * NetworkProcess/cache/NetworkCache.cpp:
2906         (WebKit::NetworkCache::makeCacheKey):
2907         (WebKit::NetworkCache::Cache::makeCacheKey): Deleted.
2908         * NetworkProcess/cache/NetworkCache.h:
2909         * NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
2910         (WebKit::NetworkCache::BlobStorage::BlobStorage):
2911         (WebKit::NetworkCache::BlobStorage::add):
2912         (WebKit::NetworkCache::BlobStorage::get):
2913         * NetworkProcess/cache/NetworkCacheBlobStorage.h:
2914         * NetworkProcess/cache/NetworkCacheData.cpp:
2915         (WebKit::NetworkCache::computeSHA1):
2916         (WebKit::NetworkCache::makeSalt): Deleted.
2917         (WebKit::NetworkCache::readOrMakeSalt): Deleted.
2918         * NetworkProcess/cache/NetworkCacheData.h:
2919         * NetworkProcess/cache/NetworkCacheKey.cpp:
2920         (WebKit::NetworkCache::noPartitionString):
2921         (WebKit::NetworkCache::Key::Key):
2922         (WebKit::NetworkCache::Key::hasPartition):
2923         (WebKit::NetworkCache::Key::computeHash):
2924         (WebKit::NetworkCache::Key::hashAsString):
2925         (WebKit::NetworkCache::Key::computePartitionHash): Deleted.
2926         * NetworkProcess/cache/NetworkCacheKey.h:
2927         (WebKit::NetworkCache::Key::hash):
2928         (WebKit::NetworkCache::Key::partitionHash): Deleted.
2929         (WebKit::NetworkCache::Key::hashAsString): Deleted.
2930         (WebKit::NetworkCache::Key::partitionHashAsString): Deleted.
2931         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
2932         (WebKit::NetworkCache::makeSubresourcesKey):
2933         (WebKit::NetworkCache::constructRevalidationRequest):
2934         (WebKit::NetworkCache::SpeculativeLoadManager::PendingFrameLoad::saveToDiskIfReady):
2935         (WebKit::NetworkCache::SpeculativeLoadManager::retrieveSubresourcesEntry):
2936         * NetworkProcess/cache/NetworkCacheStorage.cpp:
2937         (WebKit::NetworkCache::Storage::open):
2938         (WebKit::NetworkCache::traverseRecordsFiles):
2939         (WebKit::NetworkCache::Storage::Storage):
2940         (WebKit::NetworkCache::Storage::recordDirectoryPathForKey):
2941         (WebKit::NetworkCache::decodeRecordHeader):
2942         (WebKit::NetworkCache::Storage::readRecord):
2943         (WebKit::NetworkCache::Storage::encodeRecord):
2944         (WebKit::NetworkCache::Storage::traverse):
2945         (WebKit::NetworkCache::makeSaltFilePath): Deleted.
2946         * NetworkProcess/cache/NetworkCacheStorage.h:
2947         (WebKit::NetworkCache::Storage::salt): Deleted.
2948
2949 2016-11-30  Sam Weinig  <sam@webkit.org>
2950
2951         [WebIDL] Remove custom bindings for File and Blob constructors
2952         https://bugs.webkit.org/show_bug.cgi?id=165218
2953
2954         Reviewed by Darin Adler.
2955
2956         * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
2957         (WebKit::NetworkBlobRegistry::registerBlobURL):
2958         * NetworkProcess/FileAPI/NetworkBlobRegistry.h:
2959         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2960         (WebKit::NetworkConnectionToWebProcess::registerBlobURL):
2961         * NetworkProcess/NetworkConnectionToWebProcess.h:
2962         * WebProcess/FileAPI/BlobRegistryProxy.cpp:
2963         (WebKit::BlobRegistryProxy::registerBlobURL):
2964         * WebProcess/FileAPI/BlobRegistryProxy.h:
2965         Avoid copies of the BlobPart Vector.
2966
2967 2016-11-30  Carlos Garcia Campos  <cgarcia@igalia.com>
2968
2969         [GTK] UI process crash in WebKit::WaylandCompositor::Surface::prepareTextureForPainting
2970         https://bugs.webkit.org/show_bug.cgi?id=164911
2971
2972         Reviewed by Michael Catanzaro.
2973
2974         The problem is that m_buffer is nullptr in Surface::prepareTextureForPainting() even though we have already an
2975         image. We only use the buffer to get the image size, so we could save the image size when the image is created,
2976         and then we don't need to care about the buffer anymore.
2977
2978         * UIProcess/gtk/WaylandCompositor.cpp:
2979         (WebKit::WaylandCompositor::Surface::prepareTextureForPainting):
2980         (WebKit::WaylandCompositor::Surface::commit):
2981         * UIProcess/gtk/WaylandCompositor.h:
2982
2983 2016-11-30  Antoine Quint  <graouts@apple.com>
2984
2985         [Modern Media Controls] Add an HTML comment flag to turn the feature on
2986         https://bugs.webkit.org/show_bug.cgi?id=165226
2987
2988         Reviewed by Dean Jackson.
2989
2990         Add new methods to set the Modern Media Controls preference.
2991
2992         * UIProcess/API/C/WKPreferences.cpp:
2993         (WKPreferencesSetModernMediaControlsEnabled):
2994         (WKPreferencesGetModernMediaControlsEnabled):
2995         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2996
2997 2016-11-30  Said Abou-Hallawa  <sabouhallawa@apple.com>
2998
2999         Add separate settings and preferences to enable/disable async decoding for large images and animated images
3000         https://bugs.webkit.org/show_bug.cgi?id=165177
3001
3002         Reviewed by Simon Fraser.
3003         
3004         Hook up the async image decoding settings for WebKit2.
3005
3006         * Shared/WebPreferencesDefinitions.h:
3007         * UIProcess/API/Cocoa/WKPreferences.mm:
3008         (-[WKPreferences _largeImageAsyncDecodingEnabled]):
3009         (-[WKPreferences _setLargeImageAsyncDecodingEnabled:]):
3010         (-[WKPreferences _animatedImageAsyncDecodingEnabled]):
3011         (-[WKPreferences _setAnimatedImageAsyncDecodingEnabled:]):
3012         (-[WKPreferences _asyncImageDecodingEnabled]): Deleted.
3013         (-[WKPreferences _setAsyncImageDecodingEnabled:]): Deleted.
3014         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
3015         * WebProcess/InjectedBundle/InjectedBundle.cpp:
3016         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
3017         * WebProcess/WebPage/WebPage.cpp:
3018         (WebKit::WebPage::updatePreferences):
3019
3020 2016-11-30  Chris Dumez  <cdumez@apple.com>
3021
3022         [iOS][WK2] Turn on HTML interactive form validation feature
3023         https://bugs.webkit.org/show_bug.cgi?id=165212
3024         <rdar://problem/29444356>
3025
3026         Reviewed by Simon Fraser.
3027
3028         Turn on HTML interactive form validation feature on iOS WK2
3029         now that we have a native UI.
3030
3031         * Shared/WebPreferencesDefinitions.h:
3032
3033 2016-11-30  Brent Fulgham  <bfulgham@apple.com>
3034
3035         Correct plugin sandbox after r208611
3036         https://bugs.webkit.org/show_bug.cgi?id=165187
3037         <rdar://problem/29431165>
3038
3039         Reviewed by Alex Christensen.
3040
3041         In r208611 I removed the 'else' clause of a Scheme conditional
3042         that was needed to properly run plugins (such as Flash Player).
3043
3044         This change retains the relevant current sandbox content, while
3045         still stripping out the old code that is no longer needed.
3046
3047         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
3048
3049 2016-11-29  Carlos Garcia Campos  <cgarcia@igalia.com>
3050
3051         [GTK] Database process should not initialize gtk
3052         https://bugs.webkit.org/show_bug.cgi?id=165138
3053
3054         Reviewed by Sergio Villar Senin.
3055
3056         It doesn't use GTK+ at all.
3057
3058         * DatabaseProcess/gtk/DatabaseProcessMainGtk.cpp:
3059         (WebKit::DatabaseProcessMainUnix):
3060         (): Deleted.
3061
3062 2016-11-29  Gavin Barraclough  <barraclough@apple.com>
3063
3064         Remove WebPage::SetPageSuppressed
3065         https://bugs.webkit.org/show_bug.cgi?id=165158
3066
3067         Unreviewed revert accidental change.
3068
3069         * WebProcess/WebPage/WebPage.cpp:
3070         (WebKit::WebPage::setActivityState):
3071
3072 2016-11-29  Gavin Barraclough  <barraclough@apple.com>
3073
3074         Remove WebPage::SetPageSuppressed
3075         https://bugs.webkit.org/show_bug.cgi?id=165158
3076
3077         Reviewed by Tim Horton.
3078
3079         This was scaffolding. We've now refactored to the point that the information driving throttling originates
3080         from the UI process (so UI and web processes can have a consistent view of what should throttle), but we
3081         don't need a separate message to handle this - necessary state to determine is provided in ActivityState.
3082
3083         * UIProcess/WebPageProxy.cpp:
3084         (WebKit::WebPageProxy::updateThrottleState):
3085             - used to send SetPageSuppressed; no longer does.
3086         * UIProcess/WebPageProxy.h:
3087             - removed m_pageSuppressed (was used to avoid duplicated messages).
3088         * WebProcess/WebPage/WebPage.cpp:
3089         (WebKit::WebPage::updateThrottleState):
3090             - compute throttle state based on m_activityState.
3091         (WebKit::WebPage::setActivityState):
3092             - update throttle state whenever activity state changes.
3093         (WebKit::WebPage::updatePreferences):
3094             - update throttle state whenever preferences change (throttling can be disabled via preference).
3095         (WebKit::WebPage::setPageSuppressed): Deleted.
3096             - Removed WebPage::SetPageSuppressed.
3097         * WebProcess/WebPage/WebPage.h:
3098             - Removed WebPage::SetPageSuppressed.
3099             - Added m_processSuppressionEnabled, to cache preference state.
3100         * WebProcess/WebPage/WebPage.messages.in:
3101             - Removed WebPage::SetPageSuppressed.
3102
3103 2016-11-29  Andy Estes  <aestes@apple.com>
3104
3105         [Cocoa] Enable two clang warnings recommended by Xcode
3106         https://bugs.webkit.org/show_bug.cgi?id=164498
3107
3108         Reviewed by Mark Lam.
3109
3110         * Configurations/Base.xcconfig: Enabled CLANG_WARN_INFINITE_RECURSION and CLANG_WARN_SUSPICIOUS_MOVE.
3111
3112 2016-11-29  Eric Carlson  <eric.carlson@apple.com>
3113
3114         [MediaStream] Don't request user permission for a device if it has already been granted in the current browsing context
3115         https://bugs.webkit.org/show_bug.cgi?id=164760
3116         <rdar://problem/29261266>
3117
3118         Reviewed by Youenn Fablet.
3119
3120         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
3121         (WebKit::FrameAuthorizationState::FrameAuthorizationState):
3122         (WebKit::FrameAuthorizationState::hasPermissionToUseCaptureDevice):
3123         (WebKit::FrameAuthorizationState::setHasPermissionToUseCaptureDevice):
3124         (WebKit::FrameAuthorizationState::reset):
3125         (WebKit::FrameAuthorizationState::securityOriginsAreEqual):
3126         (WebKit::UserMediaPermissionRequestManagerProxy::stateForRequest):
3127         (WebKit::UserMediaPermissionRequestManagerProxy::invalidateRequests):
3128         (WebKit::UserMediaPermissionRequestManagerProxy::createRequest):
3129         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasDenied):
3130         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted):
3131         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
3132         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
3133         (WebKit::FrameAuthorizationState::~FrameAuthorizationState):
3134         (WebKit::FrameAuthorizationState::frameID):
3135         * UIProcess/UserMediaPermissionRequestProxy.cpp:
3136         (WebKit::UserMediaPermissionRequestProxy::UserMediaPermissionRequestProxy):
3137         * UIProcess/UserMediaPermissionRequestProxy.h:
3138         (WebKit::UserMediaPermissionRequestProxy::create):
3139         (WebKit::UserMediaPermissionRequestProxy::frameID):
3140         (WebKit::UserMediaPermissionRequestProxy::userMediaDocumentSecurityOrigin):
3141         (WebKit::UserMediaPermissionRequestProxy::topLevelDocumentSecurityOrigin):
3142         * UIProcess/WebPageProxy.cpp:
3143         (WebKit::WebPageProxy::didCommitLoadForFrame):
3144         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
3145         (WebKit::UserMediaPermissionRequestManager::removeMediaRequestFromMaps):
3146
3147 2016-11-29  Wenson Hsieh  <wenson_hsieh@apple.com>
3148
3149         Scroll snapping on Mac should use AppKit animations
3150         https://bugs.webkit.org/show_bug.cgi?id=147261
3151         <rdar://problem/29395293>
3152
3153         Reviewed by Brent Fulgham.
3154
3155         Add some logic to plumb filtered wheel velocity over to WebCore in the case of mainframe scrolling. See
3156         WebCore/ChangeLog for more details.
3157
3158         * WebProcess/WebPage/EventDispatcher.cpp:
3159         (WebKit::EventDispatcher::wheelEvent):
3160
3161 2016-11-21  Brian Burg  <bburg@apple.com>
3162
3163         Web Automation: add ObjC SPI to set whether a page is controlled by automation
3164         https://bugs.webkit.org/show_bug.cgi?id=165001
3165         <rdar://problem/29350432>
3166
3167         Reviewed by Dan Bernstein.
3168
3169         Add SPI property to WKWebViewConfiguration and plumb it through to
3170         initialize WebPageProxy::m_controlledByAutomation. This is propagated
3171         to the WebProcess on creation via WebPageCreationParameters.
3172
3173         * UIProcess/API/APIPageConfiguration.cpp:
3174         (API::PageConfiguration::copy):
3175         * UIProcess/API/APIPageConfiguration.h:
3176         (API::PageConfiguration::isControlledByAutomation):
3177         (API::PageConfiguration::setControlledByAutomation):
3178         * UIProcess/API/Cocoa/WKWebView.mm:
3179         (-[WKWebView _initializeWithConfiguration:]):
3180         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
3181         (-[WKWebViewConfiguration init]):
3182         (-[WKWebViewConfiguration copyWithZone:]):
3183         (-[WKWebViewConfiguration _isControlledByAutomation]):
3184         (-[WKWebViewConfiguration _setControlledByAutomation:]):
3185         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
3186         * UIProcess/WebPageProxy.cpp:
3187         (WebKit::WebPageProxy::WebPageProxy):
3188
3189 2016-11-28  Carlos Garcia Campos  <cgarcia@igalia.com>
3190
3191         [GTK] BadDamage X Window System error in WebKit::AcceleratedBackingStoreX11::update when called from WebPageProxy::exitAcceleratedCompositingMode
3192         https://bugs.webkit.org/show_bug.cgi?id=164303
3193
3194         Reviewed by Michael Catanzaro.
3195
3196         Trap also BadDrawable and BadDamage X errors when creating the surface and damage.
3197
3198         * UIProcess/gtk/AcceleratedBackingStoreX11.cpp:
3199         (WebKit::AcceleratedBackingStoreX11::update):
3200
3201 2016-11-28  Chris Dumez  <cdumez@apple.com>
3202
3203         [Mac][WK2] Enable HTML interactive form validation
3204         https://bugs.webkit.org/show_bug.cgi?id=165123
3205         <rdar://problem/28944652>
3206
3207         Reviewed by Simon Fraser.
3208
3209         Enable HTML interactive form validation now that we have a native UI
3210         for it.
3211
3212         * Shared/WebPreferencesDefinitions.h:
3213
3214 2016-11-28  Brent Fulgham  <bfulgham@apple.com>
3215
3216         Generated sandbox profile is not being put in the correct Resources directory
3217         https://bugs.webkit.org/show_bug.cgi?id=165126
3218
3219         Reviewed by Tim Horton.
3220
3221         * WebKit2.xcodeproj/project.pbxproj: Copy the generated file to the 'PlugInSandboxProfiles'
3222         sub-directory.
3223
3224 2016-11-28  Ryan Haddad  <ryanhaddad@apple.com>
3225
3226         Unreviewed, rolling out r209008.
3227
3228         This change appears to have caused two fast/mediastrem
3229         LayoutTests to fail.
3230
3231         Reverted changeset:
3232
3233         "[MediaStream] Don't request user permission for a device if
3234         it has already been granted in the current browsing context"
3235         https://bugs.webkit.org/show_bug.cgi?id=164760
3236         http://trac.webkit.org/changeset/209008
3237
3238 2016-11-28  Andrew Gold  <agold@apple.com>
3239
3240         Support for HTML Media Capture API
3241         https://bugs.webkit.org/show_bug.cgi?id=43239
3242
3243         Reviewed by Tim Horton.
3244
3245         In order to enable media capture on iOS, we must first use the AVFoundation API to 
3246         check/request capture permission from the user for Safari. Then, Safari must request
3247         permission on behalf of the webpage to use the capture devices. Additionally, Safari
3248         must present UI when the capture is taking place, so WebKit needs to notify the client
3249         of a capture session beginning and ending. To do this, we added four methods to 
3250         WKUIDelegatePrivate to request permission from the user, check for permissions, notify
3251         that a capture session has begun, and notify that a capture session has ended. Additionally,
3252         we added a private method to WKWebView that allows the client to stop a capture session.
3253
3254         * UIProcess/API/APIUIClient.h:
3255         (API::UIClient::didBeginCaptureSession): Notifies the client of a capture session beginning.
3256         (API::UIClient::didEndCaptureSession): Notifies the client of a capture session ending.
3257
3258         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: Added new delegate methods to request permission,
3259         check for permission, notify of a capture session beginning, and notify of a capture session
3260         ending.
3261
3262         * UIProcess/API/Cocoa/WKWebView.mm:
3263         (-[WKWebView _stopMediaCapture]): Cancels a media capture session.
3264         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3265
3266         * UIProcess/Cocoa/UIDelegate.h:
3267         * UIProcess/Cocoa/UIDelegate.mm:
3268         (WebKit::UIDelegate::setDelegate): Added the new delegate methods.
3269         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
3270         First checks if the user has authorized the client application access capture devices,
3271         then uses the WKUIDelegate to request permission for a site from the user.
3272         (WebKit::UIDelegate::UIClient::checkUserMediaPermissionForOrigin): Checks the client
3273         for permission to access capture devices.
3274         (WebKit::UIDelegate::UIClient::didBeginCaptureSession): Notifies the client of a capture
3275         session beginning.
3276         (WebKit::UIDelegate::UIClient::didEndCaptureSession): Notifies the client of a capture
3277         session ending.
3278
3279         * UIProcess/WebPageProxy.cpp:
3280         (WebKit::WebPageProxy::isPlayingMediaDidChange): Calls UIDelegate method to notify the
3281         client of a capture session beginning/ending.
3282
3283 2016-11-28  Eric Carlson  <eric.carlson@apple.com>
3284
3285         [MediaStream] Don't request user permission for a device if it has already been granted in the current browsing context
3286         https://bugs.webkit.org/show_bug.cgi?id=164760
3287         <rdar://problem/29261266>
3288
3289         Reviewed by Youenn Fablet.
3290
3291         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
3292         (WebKit::FrameAuthorizationState::FrameAuthorizationState):
3293         (WebKit::FrameAuthorizationState::hasPermissionToUseCaptureDevice):
3294         (WebKit::FrameAuthorizationState::setHasPermissionToUseCaptureDevice):
3295         (WebKit::FrameAuthorizationState::reset):
3296         (WebKit::FrameAuthorizationState::securityOriginsAreEqual):
3297         (WebKit::UserMediaPermissionRequestManagerProxy::stateForRequest):
3298         (WebKit::UserMediaPermissionRequestManagerProxy::invalidateRequests):
3299         (WebKit::UserMediaPermissionRequestManagerProxy::createRequest):
3300         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasDenied):
3301         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted):
3302         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
3303         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
3304         (WebKit::FrameAuthorizationState::~FrameAuthorizationState):
3305         (WebKit::FrameAuthorizationState::frameID):
3306         * UIProcess/UserMediaPermissionRequestProxy.cpp:
3307         (WebKit::UserMediaPermissionRequestProxy::UserMediaPermissionRequestProxy):
3308         * UIProcess/UserMediaPermissionRequestProxy.h:
3309         (WebKit::UserMediaPermissionRequestProxy::create):
3310         (WebKit::UserMediaPermissionRequestProxy::frameID):
3311         (WebKit::UserMediaPermissionRequestProxy::userMediaDocumentSecurityOrigin):
3312         (WebKit::UserMediaPermissionRequestProxy::topLevelDocumentSecurityOrigin):
3313         * UIProcess/WebPageProxy.cpp:
3314         (WebKit::WebPageProxy::didCommitLoadForFrame):
3315         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
3316         (WebKit::UserMediaPermissionRequestManager::removeMediaRequestFromMaps):
3317
3318 2016-11-27  Dean Jackson  <dino@apple.com>
3319
3320         Removed a WTFLogAlways I left in with a recent commit.
3321
3322         * UIProcess/Cocoa/WebViewImpl.mm:
3323         (-[WKAccessibilitySettingsObserver _settingsDidChange:]):
3324
3325 2016-11-27  Csaba Osztrogonác  <ossy@webkit.org>
3326
3327         Fix unused-private-field build warning in WebKit2/Platform/SharedMemory.h
3328         https://bugs.webkit.org/show_bug.cgi?id=165069
3329
3330         Reviewed by Darin Adler.
3331
3332         * Platform/SharedMemory.h:
3333
3334 2016-11-26  Simon Fraser  <simon.fraser@apple.com>
3335
3336         Fix the iOS build.
3337
3338         * WebProcess/WebPage/ios/WebPageIOS.mm:
3339         (WebKit::WebPage::eventThrottlingDelay):
3340
3341 2016-11-26  Yusuke Suzuki  <utatane.tea@gmail.com>
3342
3343         [WTF] Import std::optional reference implementation as WTF::Optional
3344         https://bugs.webkit.org/show_bug.cgi?id=164199
3345
3346         Reviewed by Saam Barati and Sam Weinig.
3347
3348         * NetworkProcess/NetworkDataTask.cpp:
3349         (WebKit::NetworkDataTask::didReceiveResponse):
3350         * NetworkProcess/NetworkLoad.h:
3351         * NetworkProcess/cache/NetworkCache.cpp:
3352         (WebKit::NetworkCache::responseHasExpired):
3353         * NetworkProcess/cache/NetworkCacheCoders.h:
3354         (WebKit::NetworkCache::Coder<std::optional<T>>::encode):
3355         (WebKit::NetworkCache::Coder<std::optional<T>>::decode):
3356         (WebKit::NetworkCache::Coder<Optional<T>>::encode): Deleted.
3357         (WebKit::NetworkCache::Coder<Optional<T>>::decode): Deleted.
3358         * NetworkProcess/cache/NetworkCacheData.cpp:
3359         (WebKit::NetworkCache::readOrMakeSalt):
3360         * NetworkProcess/cache/NetworkCacheData.h:
3361         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
3362         (WebKit::NetworkCache::SpeculativeLoadManager::PreloadedEntry::PreloadedEntry):
3363         (WebKit::NetworkCache::SpeculativeLoadManager::PreloadedEntry::revalidationRequest):
3364         (WebKit::NetworkCache::SpeculativeLoadManager::addPreloadedEntry):
3365         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.h:
3366         * NetworkProcess/cache/NetworkCacheStatistics.cpp:
3367         (WebKit::NetworkCache::Statistics::recordNotUsingCacheForRequest):
3368         (WebKit::NetworkCache::Statistics::recordRetrievalFailure):
3369         (WebKit::NetworkCache::Statistics::queryWasEverRequested):
3370         * NetworkProcess/cache/NetworkCacheStatistics.h:
3371         * NetworkProcess/cache/NetworkCacheStorage.cpp:
3372         (WebKit::NetworkCache::Storage::storeBodyAsBlob):
3373         (WebKit::NetworkCache::Storage::encodeRecord):
3374         (WebKit::NetworkCache::Storage::dispatchWriteOperation):
3375         * NetworkProcess/cache/NetworkCacheStorage.h:
3376         * Platform/IPC/ArgumentCoders.h:
3377         (IPC::ArgumentCoder<std::optional<T>>::encode):
3378         (IPC::ArgumentCoder<std::optional<T>>::decode):
3379         (IPC::ArgumentCoder<WTF::Optional<T>>::encode): Deleted.
3380         (IPC::ArgumentCoder<WTF::Optional<T>>::decode): Deleted.
3381         * Platform/IPC/Connection.h:
3382         (IPC::Connection::sendWithReply):
3383         * Platform/SharedMemory.h:
3384         * Platform/unix/SharedMemoryUnix.cpp:
3385         (WebKit::SharedMemory::map):
3386         * Scripts/webkit/messages.py:
3387         (class_template_headers):
3388         * Shared/API/APISecurityOrigin.h:
3389         (API::SecurityOrigin::create):
3390         * Shared/API/Cocoa/_WKRemoteObjectInterface.mm:
3391         * Shared/API/c/WKSecurityOriginRef.cpp:
3392         (WKSecurityOriginGetPort):
3393         * Shared/SessionState.h:
3394         * Shared/WebPageCreationParameters.h:
3395         * Shared/mac/ObjCObjectGraph.mm:
3396         (WebKit::typeFromObject):
3397         * Shared/mac/SecItemShim.cpp:
3398         (WebKit::sendSecItemRequest):
3399         * UIProcess/API/C/WKKeyValueStorageManager.cpp:
3400         (WKKeyValueStorageManagerGetStorageDetailsByOrigin):
3401         * UIProcess/API/Cocoa/WKSecurityOrigin.mm:
3402         (-[WKSecurityOrigin port]):
3403         * UIProcess/API/Cocoa/WKWebView.mm:
3404         (-[WKWebView _didCommitLayerTree:]):
3405         (-[WKWebView _navigationGestureDidEnd]):
3406         * UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h:
3407         (WebKit::toWebsiteDataType):
3408         * UIProcess/API/efl/EwkView.cpp:
3409         (EwkView::setCursor):
3410         * UIProcess/API/mac/WKView.mm:
3411         (toCoreScrollbarStyle):
3412         (toAPIScrollbarStyle):
3413         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp:
3414         (WebKit::WebPaymentCoordinatorProxy::completeShippingMethodSelection):
3415         (WebKit::WebPaymentCoordinatorProxy::completeShippingContactSelection):
3416         (WebKit::WebPaymentCoordinatorProxy::completePaymentMethodSelection):
3417         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h:
3418         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in:
3419         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
3420         (WebKit::toPKPaymentSummaryItem):
3421         (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingMethodSelection):
3422         (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingContactSelection):
3423         (WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentMethodSelection):
3424         * UIProcess/Automation/WebAutomationSession.cpp:
3425         (WebKit::WebAutomationSession::webFrameIDForHandle):
3426         (WebKit::WebAutomationSession::switchToBrowsingContext):
3427         (WebKit::WebAutomationSession::evaluateJavaScriptFunction):
3428         (WebKit::WebAutomationSession::resolveChildFrameHandle):
3429         (WebKit::WebAutomationSession::resolveParentFrameHandle):
3430         (WebKit::WebAutomationSession::computeElementLayout):
3431         * UIProcess/Automation/WebAutomationSession.h:
3432         * UIProcess/Cocoa/WebViewImpl.h:
3433         * UIProcess/Cocoa/WebViewImpl.mm:
3434         (WebKit::WebViewImpl::updateViewExposedRect):
3435         (WebKit::WebViewImpl::setOverlayScrollbarStyle):
3436         (WebKit::WebViewImpl::overlayScrollbarStyle):
3437         * UIProcess/DrawingAreaProxy.cpp:
3438         (WebKit::DrawingAreaProxy::setViewExposedRect):
3439         * UIProcess/DrawingAreaProxy.h:
3440         (WebKit::DrawingAreaProxy::viewExposedRect):
3441         * UIProcess/InspectorServer/WebSocketServerConnection.cpp:
3442         (WebKit::WebSocketServerConnection::didReceiveSocketStreamData):
3443         * UIProcess/InspectorServer/WebSocketServerConnection.h:
3444         * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp:
3445         (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll):
3446         * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h:
3447         * UIProcess/Scrolling/RemoteScrollingTree.cpp:
3448         (WebKit::RemoteScrollingTree::scrollingTreeNodeDidScroll):
3449         * UIProcess/Scrolling/RemoteScrollingTree.h:
3450         * UIProcess/Storage/LocalStorageDatabaseTracker.cpp:
3451         (WebKit::fileCreationTime):
3452         (WebKit::fileModificationTime):
3453         * UIProcess/Storage/LocalStorageDatabaseTracker.h:
3454         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
3455         (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame):
3456         * UIProcess/WebBackForwardList.cpp:
3457         (WebKit::WebBackForwardList::backForwardListState):
3458         (WebKit::WebBackForwardList::restoreFromState):