DeleteSelectionCommand should be robust when starting and ending editable positions...
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-08-23  Wenson Hsieh  <wenson_hsieh@apple.com>
2
3         DeleteSelectionCommand should be robust when starting and ending editable positions cannot be found
4         https://bugs.webkit.org/show_bug.cgi?id=175914
5         <rdar://problem/29792688>
6
7         Reviewed by Ryosuke Niwa.
8
9         DeleteSelectionCommand can cause a null dereference if editable start and end positions are not found. This can
10         happen when attempting to delete after selecting the contents within a canvas or output element with `read-write`
11         `-webkit-user-modify` style. To fix this, we make the initialization step of the DeleteSelectionCommand robust
12         when editable start and end positions are missing.
13
14         Test: editing/execCommand/forward-delete-read-write-canvas.html
15
16         * editing/DeleteSelectionCommand.cpp:
17         (WebCore::DeleteSelectionCommand::initializePositionData):
18
19         Make this initialization helper indicate failure via a bool return value. DeleteSelectionCommand::doApply bails
20         early if initializePositionData returned false.
21
22         (WebCore::DeleteSelectionCommand::doApply):
23         * editing/DeleteSelectionCommand.h:
24
25 2017-08-23  Youenn Fablet  <youenn@apple.com>
26
27         [Cache API] Unify WebCore and WebKit error handling
28         https://bugs.webkit.org/show_bug.cgi?id=175902
29         <rdar://problem/34045933>
30
31         Unreviewed.
32
33         * Modules/cache/DOMCache.h: Fixing Windows build.
34
35 2017-08-23  Ryan Haddad  <ryanhaddad@apple.com>
36
37         Unreviewed, rolling out r221109.
38
39         This change caused assertion failures on iOS and macOS debug
40         bots.
41
42         Reverted changeset:
43
44         "Stop using PolicyCallback for new window policies"
45         https://bugs.webkit.org/show_bug.cgi?id=175907
46         http://trac.webkit.org/changeset/221109
47
48 2017-08-23  Jer Noble  <jer.noble@apple.com>
49
50         [EME] WebCoreDecompressionSession should only report having an available frame if it has one for the current time.
51         https://bugs.webkit.org/show_bug.cgi?id=175901
52
53         Reviewed by Eric Carlson.
54
55         The WebCoreDecompressionSession will trigger the hasAvailableFrame callback whenever a frame is decoded,
56         regardless of its presentation time. For formats which have out-of-order decoding, the newly decoded frame could
57         have a presentation time far in the future. Instead, only fire the callback if the decoded frame's presentation
58         times contains the timebase's current time.
59
60         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
61         (WebCore::WebCoreDecompressionSession::enqueueDecodedSample):
62
63 2017-08-23  Youenn Fablet  <youenn@apple.com>
64
65         [Cache API] Unify WebCore and WebKit error handling
66         https://bugs.webkit.org/show_bug.cgi?id=175902
67
68         Reviewed by Alex Christensen.
69
70         No change of behavior.
71
72         Introducing a DOMCache namespace enclosing structures, callbacks and function definitions
73         previously found in either WebCore::CacheStorageConnection or WebKit::CacheStorage.
74
75         Some previously used callbacks had no way to pass errors in WebCore while they had in WebKit.
76         Updated Cache, CacheStorage, CacheStorageConnection and WorkerCacheStorageConnection to deal with these potential errors.
77
78         * CMakeLists.txt:
79         * Modules/cache/Cache.cpp:
80         (WebCore::FetchTasksHandler::FetchTasksHandler):
81         (WebCore::FetchTasksHandler::records const):
82         (WebCore::FetchTasksHandler::addRecord):
83         (WebCore::Cache::addAll):
84         (WebCore::Cache::put):
85         (WebCore::Cache::retrieveRecords):
86         (WebCore::queryCacheMatch):
87         (WebCore::Cache::batchDeleteOperation):
88         (WebCore::toConnectionRecord):
89         (WebCore::Cache::batchPutOperation):
90         (WebCore::Cache::updateRecords):
91         * Modules/cache/Cache.h:
92         * Modules/cache/CacheStorage.cpp:
93         (WebCore::CacheStorage::retrieveCaches):
94         (WebCore::CacheStorage::open):
95         (WebCore::CacheStorage::remove):
96         * Modules/cache/CacheStorage.h:
97         * Modules/cache/CacheStorageConnection.cpp:
98         (WebCore::CacheStorageConnection::open):
99         (WebCore::CacheStorageConnection::remove):
100         (WebCore::CacheStorageConnection::retrieveCaches):
101         (WebCore::CacheStorageConnection::batchDeleteOperation):
102         (WebCore::CacheStorageConnection::batchPutOperation):
103         (WebCore::CacheStorageConnection::openOrRemoveCompleted):
104         (WebCore::CacheStorageConnection::updateCaches):
105         (WebCore::CacheStorageConnection::updateRecords):
106         (WebCore::CacheStorageConnection::deleteRecordsCompleted):
107         (WebCore::CacheStorageConnection::putRecordsCompleted):
108         * Modules/cache/CacheStorageConnection.h:
109         (WebCore::CacheStorageConnection::openCompleted):
110         (WebCore::CacheStorageConnection::removeCompleted):
111         (WebCore::CacheStorageConnection::doOpen):
112         (WebCore::CacheStorageConnection::doRemove):
113         (WebCore::CacheStorageConnection::doBatchDeleteOperation):
114         (WebCore::CacheStorageConnection::doBatchPutOperation):
115         * Modules/cache/WorkerCacheStorageConnection.cpp:
116         (WebCore::toCrossThreadRecordData):
117         (WebCore::fromCrossThreadRecordData):
118         (WebCore::WorkerCacheStorageConnection::doOpen):
119         (WebCore::WorkerCacheStorageConnection::doRemove):
120         (WebCore::WorkerCacheStorageConnection::doRetrieveCaches):
121         (WebCore::recordsDataFromRecords):
122         (WebCore::recordsDataOrErrorFromRecords):
123         (WebCore::recordsFromRecordsData):
124         (WebCore::recordsOrErrorFromRecordsData):
125         (WebCore::WorkerCacheStorageConnection::doRetrieveRecords):
126         (WebCore::WorkerCacheStorageConnection::doBatchDeleteOperation):
127         (WebCore::WorkerCacheStorageConnection::doBatchPutOperation):
128         * Modules/cache/DOMCache.cpp: Added.
129         * Modules/cache/DOMCache.h: Added.
130         * Modules/cache/WorkerCacheStorageConnection.h:
131         * WebCore.xcodeproj/project.pbxproj:
132
133 2017-08-23  Yusuke Suzuki  <utatane.tea@gmail.com>
134
135         [JSC] Optimize Map iteration with intrinsic
136         https://bugs.webkit.org/show_bug.cgi?id=174355
137
138         Reviewed by Saam Barati.
139
140         * bindings/js/SerializedScriptValue.cpp:
141         (WebCore::CloneSerializer::serialize):
142
143 2017-08-23  Alex Christensen  <achristensen@webkit.org>
144
145         Stop using PolicyCallback for new window policies
146         https://bugs.webkit.org/show_bug.cgi?id=175907
147
148         Reviewed by Andy Estes.
149
150         PolicyCallback is an artifact from the days before C++11.  Let's use lambdas instead!
151         No change in behaviour.
152
153         * loader/PolicyCallback.cpp:
154         (WebCore::PolicyCallback::set):
155         (WebCore::PolicyCallback::call):
156         (WebCore::PolicyCallback::cancel):
157         * loader/PolicyCallback.h:
158         * loader/PolicyChecker.cpp:
159         (WebCore::PolicyChecker::checkNewWindowPolicy):
160         (WebCore::PolicyChecker::continueAfterNewWindowPolicy): Deleted.
161         * loader/PolicyChecker.h:
162
163 2017-08-23  Alex Christensen  <achristensen@webkit.org>
164
165         Stop using PolicyChecker for ContentPolicy
166         https://bugs.webkit.org/show_bug.cgi?id=175904
167
168         Reviewed by Tim Horton.
169
170         PolicyChecker is an artifact from the days before C++11.  Now we have lambdas which
171         have a cleaner flow than one class that exists to be effectively one of three lambda types.
172         Let's remove them one at a time, starting with ContentPolicy checks.
173         
174         No change in behaviour.
175
176         * loader/DocumentLoader.cpp:
177         (WebCore::DocumentLoader::responseReceived):
178         * loader/FrameLoader.cpp:
179         (WebCore::FrameLoader::checkContentPolicy):
180         * loader/FrameLoader.h:
181         * loader/PolicyCallback.cpp:
182         (WebCore::PolicyCallback::set):
183         (WebCore::PolicyCallback::call):
184         (WebCore::PolicyCallback::cancel):
185         * loader/PolicyCallback.h:
186         * loader/PolicyChecker.cpp:
187         (WebCore::PolicyChecker::checkContentPolicy): Deleted.
188         (WebCore::PolicyChecker::continueAfterContentPolicy): Deleted.
189         * loader/PolicyChecker.h:
190
191 2017-08-23  Jer Noble  <jer.noble@apple.com>
192
193         Build fix for 32-bit Mac after r221098. Make sure constant used in WebCoreDecompressionSession is SoftLinked.
194
195         * platform/cf/CoreMediaSoftLink.cpp:
196         * platform/cf/CoreMediaSoftLink.h:
197
198 2017-08-23  Jer Noble  <jer.noble@apple.com>
199
200         Track VideoPlaybackQuality metrics when using WebCoreDecompressionSession.
201         https://bugs.webkit.org/show_bug.cgi?id=175835
202         <rdar://problem/34022234>
203
204         Reviewed by Eric Carlson.
205
206         Test: platform/mac/media/media-source/videoplaybackquality-decompressionsession.html
207
208         Track the total number of frames decoded, dropped, & corrupted, as well as the total
209         delay imposed by decoding in the WebCoreDecompressionSession.
210
211         Drive-by fix: implement frame dropping by skipping frames whose presentation times are
212         before the video's current time and which aren't depended upon by other frames.
213
214         * platform/cf/CoreMediaSoftLink.cpp:
215         * platform/cf/CoreMediaSoftLink.h:
216         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
217         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::videoPlaybackQualityMetrics):
218         * platform/graphics/cocoa/WebCoreDecompressionSession.h:
219         (WebCore::WebCoreDecompressionSession::totalVideoFrames):
220         (WebCore::WebCoreDecompressionSession::droppedVideoFrames):
221         (WebCore::WebCoreDecompressionSession::corruptedVideoFrames):
222         (WebCore::WebCoreDecompressionSession::totalFrameDelay):
223         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
224         (WebCore::WebCoreDecompressionSession::shouldDecodeSample):
225         (WebCore::WebCoreDecompressionSession::decodeSample):
226         (WebCore::WebCoreDecompressionSession::handleDecompressionOutput):
227
228 2017-08-23  Andy Estes  <aestes@apple.com>
229
230         [Payment Request] Update to "In Development" in features.json
231         https://bugs.webkit.org/show_bug.cgi?id=175897
232
233         Reviewed by Sam Weinig.
234
235         * features.json:
236
237 2017-08-22  Dean Jackson  <dino@apple.com>
238
239         Default passive touch event listeners on the root
240         https://bugs.webkit.org/show_bug.cgi?id=175346
241         <rdar://problem/33164597>
242
243         Reviewed by Sam Weinig.
244
245         Make any touchstart or touchmove event listeners passive by default
246         if they are on the document, window, body or document element targets.
247         This follows the "intervention" first implemented by Chrome/Blink:
248
249         https://github.com/WICG/interventions/issues/35
250         https://docs.google.com/document/d/1II7oSIpd8pK91V5kEM3tDLKcIj398jOJn8Niqy6_loI/edit
251         https://github.com/whatwg/dom/issues/365
252
253         If the event listener explicitly defines "passive" to false in their
254         options dictionary, then they'll still get a non-passive listener.
255
256         NOTE: Any fallout from this bug should be collected in:
257         https://bugs.webkit.org/show_bug.cgi?id=175869
258         Please do not revert this change just because a site is broken. We'll
259         gather the issues and see if we can evangelise or detect via code.
260
261         Tests: fast/events/touch/ios/passive-by-default-on-document-and-window.html
262                fast/events/touch/ios/passive-by-default-overridden-on-document-and-window.html
263
264         * dom/EventNames.h:
265         (WebCore::EventNames::isTouchScrollBlockingEventType const): Added this helper
266         to identify the types of touches we want to check for.
267         * dom/EventTarget.cpp:
268         (WebCore::EventTarget::addEventListener): Check for the event being one of the touch-types
269         that we care about, and the target being one of the Node/Window types we care about. If
270         so, tell the event listener to be passive.
271         * dom/EventTarget.h: Use an optional for the passive member.
272         (WebCore::EventTarget::AddEventListenerOptions::AddEventListenerOptions):
273         * dom/EventTarget.idl: Change "passive" to not have a default value, so we
274         can detect if it was explicitly set to false.
275
276 2017-08-23  Tim Horton  <timothy_horton@apple.com>
277
278         Try to fix the WinCairo build after r221068
279
280         * platform/win/PlatformScreenWin.cpp:
281
282 2017-08-23  Youenn Fablet  <youenn@apple.com>
283
284         [Cache API] Enable persistent coder to encode FetchOptions
285         https://bugs.webkit.org/show_bug.cgi?id=175883
286
287         Reviewed by Alex Christensen.
288
289         No change of behavior.
290         Adding encode/decode routines for FetchOptions.
291
292         * loader/FetchOptions.h:
293         (WebCore::FetchOptions::encode const):
294         (WebCore::FetchOptions::decode):
295         * platform/ReferrerPolicy.h:
296
297 2017-08-23  Yusuke Suzuki  <utatane.tea@gmail.com>
298
299         Race condition in StartWebThread causing crash
300         https://bugs.webkit.org/show_bug.cgi?id=175852
301
302         Reviewed by Mark Lam.
303
304         When starting web thread, the main thread waits for completion of web thread initialization
305         by using pthread_cond_t. However, the main thread may be woken up due to the existence of
306         the spurious wake up of pthread_cond_t.
307
308         Instead, we should use WTF::Lock and WTF::Condition. Since our StartWebThread already calls
309         WTF::initializeThreading, it is safe to use WTF::Lock and WTF::Condition. And our WTF::Condition
310         does not have the spurious wake up problem as described in Condition.h.
311
312         * platform/ios/wak/WebCoreThread.mm:
313         (RunWebThread):
314         (StartWebThread):
315
316 2017-08-23  Brent Fulgham  <bfulgham@apple.com>
317
318         Ensure media controls host exists before using it
319         https://bugs.webkit.org/show_bug.cgi?id=175833
320         <rdar://problem/34001219>
321
322         Reviewed by Jer Noble.
323
324         Although we ensure that the media controls shadow root exists before updating the text track
325         container, we don't check that the media controls host has been created yet. We do check
326         and create in other places in HTMLMediaElement.
327
328         * html/HTMLMediaElement.cpp:
329         (WebCore::HTMLMediaElement::updateTextTrackDisplay): 
330
331 2017-08-23  Carlos Alberto Lopez Perez  <clopez@igalia.com>
332
333         [WPE] Some event handlers not working.
334         https://bugs.webkit.org/show_bug.cgi?id=175864
335
336         Reviewed by Michael Catanzaro.
337
338         Share the EventHandler implementation with the GTK port and add ifdefs where needed.
339
340         Covered by existing tests.
341
342         * PlatformGTK.cmake:
343         * PlatformWPE.cmake:
344         * page/wpe/EventHandlerWPE.cpp: Removed.
345         * platform/glib/EventHandlerGlib.cpp: Renamed from Source/WebCore/page/gtk/EventHandlerGtk.cpp.
346         (WebCore::EventHandler::shouldTurnVerticalTicksIntoHorizontal const):
347
348 2017-08-22  Tim Horton  <timothy_horton@apple.com>
349
350         _WKThumbnailView should use the screen color space instead of sRGB
351         https://bugs.webkit.org/show_bug.cgi?id=175858
352         <rdar://problem/33925559>
353
354         Reviewed by Dean Jackson.
355
356         * platform/PlatformScreen.h:
357         * platform/ios/PlatformScreenIOS.mm:
358         (WebCore::screenColorSpace):
359         * platform/mac/PlatformScreenMac.mm:
360         (WebCore::screenColorSpace):
361         (WebCore::screenSupportsExtendedColor):
362         * platform/win/PlatformScreenWin.cpp:
363         (WebCore::screenColorSpace):
364         Add screenColorSpace, which returns the active color space for the
365         given Widget's screen. On Windows, just fall back to sRGB like we usually do.
366
367 2017-08-22  Ryosuke Niwa  <rniwa@webkit.org>
368
369         Consolidate the code to normalize MIME type in DataTransfer
370         https://bugs.webkit.org/show_bug.cgi?id=175810
371
372         Rubber-stamped by Wenson Hsieh.
373
374         Address the forgotten review comment by Wenson.
375
376         Tests: editing/pasteboard/datatransfer-getdata-plaintext.html
377
378         * dom/DataTransfer.cpp:
379         (WebCore::DataTransfer::clearData):
380
381 2017-08-20  Wenson Hsieh  <wenson_hsieh@apple.com>
382
383         [iOS WK2] WKWebView schedules nonstop layout after pressing cmb+b,i,u inside a contenteditable div
384         https://bugs.webkit.org/show_bug.cgi?id=175116
385         <rdar://problem/28279301>
386
387         Reviewed by Darin Adler and Ryosuke Niwa.
388
389         WebCore support for WebPage::editorState refactoring. See WebKit ChangeLogs for more detail.
390
391         Tests: EditorStateTests.TypingAttributesBold
392                EditorStateTests.TypingAttributesItalic
393                EditorStateTests.TypingAttributesUnderline
394                EditorStateTests.TypingAttributesTextAlignmentAbsoluteAlignmentOptions
395                EditorStateTests.TypingAttributesTextAlignmentStartEnd
396                EditorStateTests.TypingAttributesTextAlignmentDirectionalText
397                EditorStateTests.TypingAttributesTextColor
398                EditorStateTests.TypingAttributesMixedStyles
399                EditorStateTests.TypingAttributesLinkColor
400
401         * css/StyleProperties.cpp:
402         (WebCore::StyleProperties::propertyAsColor const):
403         (WebCore::StyleProperties::propertyAsValueID const):
404
405         Introduces some helper functions in StyleProperties to convert CSS property values to Color or a CSSValueID.
406
407         * css/StyleProperties.h:
408         * editing/EditingStyle.cpp:
409         (WebCore::EditingStyle::hasStyle):
410
411         Pull out logic in selectionStartHasStyle that asks for a style TriState into EditingStyle::hasStyle. This is
412         because WebPage::editorState will now query for multiple styles at the selection start, but
413         selectionStartHasStyle currently recomputes styleAtSelectionStart every time it is called. To prevent extra work
414         from being done, we can just call selectionStartHasStyle once and use ask for EditingStyle::hasStyle on the
415         computed EditingStyle at selection start.
416
417         * editing/EditingStyle.h:
418         * editing/Editor.cpp:
419         (WebCore::Editor::selectionStartHasStyle const):
420
421 2017-08-22  Wenson Hsieh  <wenson_hsieh@apple.com>
422
423         [WK2] EditorState updates should be rolled into the layer update lifecycle when possible
424         https://bugs.webkit.org/show_bug.cgi?id=175370
425         <rdar://problem/33799806>
426
427         Reviewed by Ryosuke Niwa.
428
429         Remove didChangeSelectionAndUpdateLayout -- EditorState updates that are scheduled due to missing post-layout
430         data will now be scheduled for the next presentation update. Additionally, add editor client hooks to notify the
431         WebKit layer when we've updated the current composition. See WebKit ChangeLog for more details. This patch
432         adjusts and rebaselines existing layout tests.
433
434         * editing/Editor.cpp:
435         (WebCore::SetCompositionScope::SetCompositionScope):
436         (WebCore::SetCompositionScope::~SetCompositionScope):
437
438         Introduce a helper RAII class to ensure that we ignore selection changes during the scope of
439         Editor::setComposition and call out to the client with WebEditorClient::didUpdateComposition afterwards. This
440         also maintains a UserTypingGestureIndicator over its lifetime, so we don't additionally need to create a
441         UserTypingGestureIndicator in Editor::setComposition.
442
443         (WebCore::Editor::setComposition):
444         * editing/FrameSelection.cpp:
445         (WebCore::FrameSelection::setSelection):
446         (WebCore::FrameSelection::updateAndRevealSelection):
447         (WebCore::FrameSelection::setSelectedRange):
448         * editing/FrameSelection.h:
449         (WebCore::FrameSelection::defaultSetSelectionOptions):
450
451         Plumb state about whether or not the selection change was triggered by the user to FrameSelection::setSelection,
452         and if so, notify the editing client. A separate SetSelectionOptions flag is used here instead of
453         RevealSelection to avoid calling out to the client in places where we want to reveal the selection regardless of
454         whether or not the selection is user triggered.
455
456         * loader/EmptyClients.cpp:
457         * page/EditorClient.h:
458
459 2017-08-21  Ryosuke Niwa  <rniwa@webkit.org>
460
461         Consolidate the code to normalize MIME type in DataTransfer
462         https://bugs.webkit.org/show_bug.cgi?id=175810
463
464         Reviewed by Wenson Hsieh.
465
466         Factored out the code to convert MIME type to lowercase after stripping whitespace,
467         and treat "text" as "text/plain" and "url" as "text/uri-list".
468
469         Specifications:
470         https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-getdata-2
471         https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-setdata-2
472         https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-cleardata-2
473
474         Stripping of whitespace only happens in WebKit/Blink but it's probably required for compatbility.
475         Spec bug: https://github.com/whatwg/html/issues/2946
476
477         Test: editing/pasteboard/datatransfer-getdata-plaintext.html
478
479         * dom/DataTransfer.cpp:
480         (WebCore::normalizeType):
481         (WebCore::DataTransfer::clearData):
482         (WebCore::DataTransfer::getData const):
483         (WebCore::DataTransfer::setData):
484         * platform/gtk/PasteboardGtk.cpp:
485         (WebCore::selectionDataTypeFromHTMLClipboardType):
486         * platform/ios/PasteboardIOS.mm:
487         (WebCore::cocoaTypeFromHTMLClipboardType):
488         * platform/mac/PasteboardMac.mm:
489         (WebCore::cocoaTypeFromHTMLClipboardType):
490         * platform/win/PasteboardWin.cpp:
491         (WebCore::clipboardTypeFromMIMEType):
492
493 2017-08-22  Matt Lewis  <jlewis3@apple.com>
494
495         Unreviewed, rolling out r221033.
496
497         This revision caused assertion failures on all Open Source
498         Debug testers. See Radar for more information.
499
500         Reverted changeset:
501
502         "Ensure media controls host exists before using it"
503         https://bugs.webkit.org/show_bug.cgi?id=175833
504         http://trac.webkit.org/changeset/221033
505
506 2017-08-22  Per Arne Vollan  <pvollan@apple.com>
507
508         [Win] Fix compile errors.
509         https://bugs.webkit.org/show_bug.cgi?id=175860
510
511         Reviewed by Brent Fulgham.
512
513         Add required header files. 
514
515         * platform/network/cf/CookieJarCFNet.cpp:
516
517 2017-08-22  Brent Fulgham  <bfulgham@apple.com>
518
519         Correct SOUP builds after r221017 and r221050.
520         https://bugs.webkit.org/show_bug.cgi?id=175846
521
522         Reviewed by Michael Catanzaro.
523
524         * platform/network/soup/CookieJarSoup.cpp:
525         (WebCore::cookiesForDOM): Revise return type.
526
527 2017-08-22  Brent Fulgham  <bfulgham@apple.com>
528
529         Correct SOUP and cURL builds after r221017.
530         https://bugs.webkit.org/show_bug.cgi?id=175846
531
532         Reviewed by Michael Catanzaro.
533
534         Correct the method signatures for 'cookiesForDOM' on the SOUP and cURL backends.
535         Note that these ports will need to add specific logic to find/filter secure cookies
536         if requested by the caller.
537
538         * platform/network/curl/CookieJarCurl.cpp:
539         (WebCore::CookieJarCurlFileSystem::cookiesForDOM):
540         (WebCore::cookiesForDOM):
541         * platform/network/curl/CookieJarCurl.h:
542         * platform/network/soup/CookieJarSoup.cpp:
543         (WebCore::cookiesForDOM):
544
545 2017-08-22  Chris Dumez  <cdumez@apple.com>
546
547         [EnabledBySetting] in WebIDL uses Document but does not include Document.h
548         https://bugs.webkit.org/show_bug.cgi?id=175843
549
550         Reviewed by Sam Weinig.
551
552         * bindings/scripts/CodeGeneratorJS.pm:
553         (GenerateImplementation):
554
555 2017-08-22  Jer Noble  <jer.noble@apple.com>
556
557         Refactor videoPerformanceQuality() MediaPlayer methods into single call.
558         https://bugs.webkit.org/show_bug.cgi?id=175830
559
560         Reviewed by Eric Carlson.
561
562         Allow MediaPlayerPrivate subclasses to return all the metrics required for VideoPerformanceQuality in
563         a single call. For clients which incur significant overhead to request this data, this reduces the cost
564         of requesting data by the number of calls removed.
565
566         * html/HTMLMediaElement.cpp:
567         (WebCore::HTMLMediaElement::getVideoPlaybackQuality):
568         * platform/graphics/MediaPlayer.cpp:
569         (WebCore::MediaPlayer::videoPlaybackQualityMetrics):
570         (WebCore::MediaPlayer::totalVideoFrames): Deleted.
571         (WebCore::MediaPlayer::droppedVideoFrames): Deleted.
572         (WebCore::MediaPlayer::corruptedVideoFrames): Deleted.
573         (WebCore::MediaPlayer::totalFrameDelay): Deleted.
574         * platform/graphics/MediaPlayer.h:
575         (WebCore::PlatformVideoPlaybackQualityMetrics::PlatformVideoPlaybackQualityMetrics):
576         * platform/graphics/MediaPlayerPrivate.h:
577         (WebCore::MediaPlayerPrivateInterface::videoPlaybackQualityMetrics):
578         (WebCore::MediaPlayerPrivateInterface::totalVideoFrames): Deleted.
579         (WebCore::MediaPlayerPrivateInterface::droppedVideoFrames): Deleted.
580         (WebCore::MediaPlayerPrivateInterface::corruptedVideoFrames): Deleted.
581         (WebCore::MediaPlayerPrivateInterface::totalFrameDelay): Deleted.
582         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
583         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
584         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::videoPlaybackQualityMetrics):
585         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::totalVideoFrames): Deleted.
586         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::droppedVideoFrames): Deleted.
587         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::corruptedVideoFrames): Deleted.
588         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::totalFrameDelay): Deleted.
589         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
590         * platform/mock/mediasource/MockMediaPlayerMediaSource.cpp:
591         (WebCore::MockMediaPlayerMediaSource::videoPlaybackQualityMetrics):
592         (WebCore::MockMediaPlayerMediaSource::totalVideoFrames): Deleted.
593         (WebCore::MockMediaPlayerMediaSource::droppedVideoFrames): Deleted.
594         (WebCore::MockMediaPlayerMediaSource::corruptedVideoFrames): Deleted.
595         (WebCore::MockMediaPlayerMediaSource::totalFrameDelay): Deleted.
596         * platform/mock/mediasource/MockMediaPlayerMediaSource.h:
597         * platform/mock/mediasource/MockMediaSourcePrivate.cpp:
598         (WebCore::MockMediaSourcePrivate::videoPlaybackQualityMetrics):
599         * platform/mock/mediasource/MockMediaSourcePrivate.h:
600
601 2017-08-22  Brent Fulgham  <bfulgham@apple.com>
602
603         Ensure media controls host exists before using it
604         https://bugs.webkit.org/show_bug.cgi?id=175833
605         <rdar://problem/34001219>
606
607         Reviewed by Jer Noble.
608
609         Although we ensure that the media controls shadow root exists before updating the text track
610         container, we don't check that the media controls host has been created yet. We do check
611         and create in other places in HTMLMediaElement.
612
613         Tests: media/track/track-display-before-controls-crash.html
614
615         * html/HTMLMediaElement.cpp:
616         (WebCore::HTMLMediaElement::updateTextTrackDisplay): 
617
618 2017-08-22  Youenn Fablet  <youenn@apple.com>
619
620         [Cache API] Optimize whitespace trimming in Vary header values
621         https://bugs.webkit.org/show_bug.cgi?id=175837
622
623         Reviewed by Alex Christensen.
624
625         No change of behavior.
626
627         Introducing a StringView version of stripLeadingAndTrailingHTTPSpaces.
628
629         * Modules/cache/Cache.cpp:
630         (WebCore::hasResponseVaryStarHeaderValue):
631         * platform/network/HTTPParsers.h:
632         (WebCore::stripLeadingAndTrailingHTTPSpaces):
633
634 2017-08-22  Alex Christensen  <achristensen@webkit.org>
635
636         Remove ChromeClient::scrollbarsModeDidChange
637         https://bugs.webkit.org/show_bug.cgi?id=175805
638
639         Reviewed by Daniel Bates.
640
641         No change in behavior.  It was never called, and no implementations did anything.
642
643         * loader/EmptyClients.h:
644         * page/Chrome.cpp:
645         (WebCore::Chrome::scrollbarsModeDidChange const): Deleted.
646         * page/Chrome.h:
647         * page/ChromeClient.h:
648         * platform/HostWindow.h:
649
650 2017-08-22  Devin Rousso  <webkit@devinrousso.com>
651
652         Web Inspector: provide way for ShaderPrograms to be enabled/disabled
653         https://bugs.webkit.org/show_bug.cgi?id=175400
654
655         Reviewed by Matt Baker.
656
657         Test: inspector/canvas/setShaderProgramDisabled.html
658
659         * inspector/InspectorShaderProgram.h:
660         (WebCore::InspectorShaderProgram::disabled):
661         (WebCore::InspectorShaderProgram::setDisabled):
662
663         * html/canvas/WebGLRenderingContextBase.cpp:
664         (WebCore::WebGLRenderingContextBase::drawArrays):
665         (WebCore::WebGLRenderingContextBase::drawElements):
666         If the current program is disabled, return early. This will prevent the current shader
667         program from drawing anything to the canvas.
668
669         * inspector/InspectorCanvasAgent.h:
670         * inspector/InspectorCanvasAgent.cpp:
671         (WebCore::InspectorCanvasAgent::setShaderProgramDisabled):
672         (WebCore::InspectorCanvasAgent::isShaderProgramDisabled):
673         * inspector/InspectorInstrumentation.h:
674         * inspector/InspectorInstrumentation.cpp:
675         (WebCore::InspectorInstrumentation::isShaderProgramDisabled):
676         (WebCore::InspectorInstrumentation::isShaderProgramDisabledImpl):
677
678 2017-08-22  Youenn Fablet  <youenn@apple.com>
679
680         [Cache API] Add support for overwriting responses with put on an existing record
681         https://bugs.webkit.org/show_bug.cgi?id=175825
682
683         Reviewed by Geoffrey Garen.
684
685         Tests: http/wpt/cache-storage/cache-put-keys.https.any.html
686                http/wpt/cache-storage/cache-put-keys.https.any.worker.html
687
688         Adding support for the new response update counter.
689         Overwriting local cached response with new retrieved response when the counter is different.
690         Adding support for passing this value from/to workers.
691
692         * Modules/cache/Cache.cpp:
693         (WebCore::Cache::queryCacheWithTargetStorage):
694         (WebCore::toConnectionRecord):
695         (WebCore::Cache::updateRecords):
696         * Modules/cache/CacheStorageConnection.cpp:
697         (WebCore::CacheStorageConnection::Record::copy const):
698         * Modules/cache/CacheStorageConnection.h:
699         * Modules/cache/CacheStorageRecord.h:
700         * Modules/cache/WorkerCacheStorageConnection.cpp:
701         (WebCore::toCrossThreadRecordData):
702         (WebCore::fromCrossThreadRecordData):
703
704 2017-08-22  Alex Christensen  <achristensen@webkit.org>
705
706         Remove ChromeClient::hasOpenedPopup
707         https://bugs.webkit.org/show_bug.cgi?id=175804
708
709         Reviewed by Sam Weinig.
710
711         No change in behavior.  All implementations just returned false.
712
713         * loader/EmptyClients.h:
714         * page/Chrome.cpp:
715         (WebCore::Chrome::hasOpenedPopup const): Deleted.
716         * page/Chrome.h:
717         * page/ChromeClient.h:
718         * rendering/RenderMenuList.cpp:
719         (RenderMenuList::showPopup):
720
721 2017-08-22  Andy Estes  <aestes@apple.com>
722
723         [Payment Request] Implement error checking for show(), abort(), and canMakePayment()
724         https://bugs.webkit.org/show_bug.cgi?id=175789
725
726         Reviewed by Brady Eidson.
727
728         Implement many of the exceptions and promise rejections specified for PaymentRequest's
729         show(), abort(), and canMakePayment() methods. Also implement basic state tracking.
730
731         * Modules/paymentrequest/PaymentRequest.cpp:
732         (WebCore::PaymentRequest::create): Changed serializedMethodData from a
733         HashMap<String, String> to a Vector<PaymentRequest::Method>.
734         (WebCore::PaymentRequest::PaymentRequest):
735         (WebCore::PaymentRequest::show): Added promise rejection for invalid state, updated the
736         state to Interactive, stored the promise in m_showPromise, and dispatched finishShowing().
737         (WebCore::PaymentRequest::finishShowing): Added JSON parsing of payment method serialized
738         data and exception propagation. If there are no exceptions, rejected m_showPromise with
739         NotSupportedError since we don't yet support any payment methods.
740         (WebCore::PaymentRequest::abort): Added promise rejection for invalid state and stored the
741         promise in m_abortPromise. Dispatched a lambda to update the state to Closed, reject
742         m_showPromise, and resolve m_abortPromise.
743         (WebCore::PaymentRequest::canMakePayment): Added promise rejection for invalid state and
744         stored the promise in m_canMakePaymentPromise. Dispatched a lambda to resolve
745         m_canMakePaymentPromise with false since we don't yet support any payment methods.
746         * Modules/paymentrequest/PaymentRequest.h:
747         * Modules/paymentrequest/PaymentRequest.idl: Annotated abort() with MayThrowException.
748
749 2017-08-22  Brent Fulgham  <bfulgham@apple.com> and Pranjal Jumde  <pjumde@apple.com>
750
751         Disable access to secure cookies if an HTTPS site loads mixed content
752         https://bugs.webkit.org/show_bug.cgi?id=157053
753         <rdar://problem/11290808>
754
755         Reviewed by Dan Bates.
756
757         Tests: http/tests/security/mixedContent/insecure-css-with-secure-cookies.html
758                http/tests/security/mixedContent/insecure-image-with-securecookie-block.html
759                http/tests/security/mixedContent/insecure-image-with-securecookie.html
760                http/tests/security/mixedContent/insecure-script-with-secure-cookies.html
761                http/tests/security/mixedContent/redirect-https-to-http-image-secure-cookies-block.html
762                http/tests/security/mixedContent/redirect-https-to-http-image-secure-cookies.html
763
764         * dom/SecurityContext.h: 
765         (WebCore::SecurityContext::secureCookiesAccessed): Added.
766         (WebCore::SecurityContext::setSecureCookiesAccessed): Added.
767         * loader/CookieJar.cpp:
768         (WebCore::cookies): Pass Document as non-const so we can call 'setSecureCookiesAccessed' if necessary.
769         * loader/CookieJar.h:
770         * loader/MixedContentChecker.cpp:
771         (WebCore::MixedContentChecker::canRunInsecureContent): Updated checks to avoid running insecure content
772         if secure cookies were accessed. 
773         * platform/CookiesStrategy.h:
774         (WebCore::CookiesStrategy::cookiesForDOM): Pass new argument indicating whether secure cookies should be included in the response.
775         * platform/network/PlatformCookieJar.h:
776         * platform/network/cf/CookieJarCFNet.cpp:
777         (copyCookiesForURLWithFirstPartyURL): Revise to accept new 'IncludeSecureCookiesOrNot' argument.
778         (WebCore::cookiesForSession): Updated to accept new 'IncludeSecureCookiesOrNot' argument. Also determine if secure cookies were
779         included in the response, and return this to the caller.
780         (WebCore::cookieRequestHeaderFieldValue): Revise for new 'copyCookiesForURLWithFirstPartyURL' signature.
781         (WebCore::getRawCookies): Ditto.
782         * platform/network/mac/CookieJarMac.mm:
783         (WebCore::cookiesForSession): Updated checks to keep track of secure cookies and filter out secure cookies if insecure content
784         was accessed.
785         (WebCore::cookiesForDOM): Update for new arguments and to return a pair.
786         (WebCore::cookieRequestHeaderFieldValue): Ditto.
787
788 2017-08-22  Jer Noble  <jer.noble@apple.com>
789
790         Autoplay Muted Videos Don't Play When Outside Viewport
791         https://bugs.webkit.org/show_bug.cgi?id=175748
792         <rdar://problem/33974383>
793
794         Reviewed by Eric Carlson.
795
796         Test: media/video-restricted-invisible-autoplay-not-allowed-source.html
797
798         The media session is notified that its client (the media element) will begin autoplaying inside
799         prepareForLoad(), where the m_autoplaying flag is also set. But loading via <source> elements does not go
800         through prepareForLoad(); the HTML standard states that the <source> element loading path does not trigger the
801         "media element load algorithm" which is implemented in prepareForLoad(). Since the m_autoplaying flag is
802         initially set to true, notify the media session that the element will begin autoplaying inside the element's
803         constructor.
804
805         Drive-by fix: Doing the above causes other tests to crash, as purturbing play state during style change can cause
806         re-entrancy in the native controls code, or fail, since we will transition from autoplay -> play even if there's
807         not yet a src or source to the media element. Add a task queue for updating the autoplay state and check the ready
808         state before allowing autoplay to transition to play.
809
810         * html/HTMLMediaElement.cpp:
811         (WebCore::HTMLMediaElement::HTMLMediaElement):
812         (WebCore::HTMLMediaElement::~HTMLMediaElement):
813         (WebCore::HTMLMediaElement::canTransitionFromAutoplayToPlay const):
814         (WebCore::HTMLMediaElement::isVisibleInViewportChanged):
815
816 2017-08-21  Matt Rajca  <mrajca@apple.com>
817
818         Call updateIsPlayingMedia whenever m_userHasInteractedWithMediaElement changes
819         https://bugs.webkit.org/show_bug.cgi?id=175796
820
821         Reviewed by Eric Carlson.
822
823         Test: media/video-user-gesture-tracking.html
824
825         The page media state depends on m_userHasInteractedWithMediaElement, so force it to update
826         as soon as m_userHasInteractedWithMediaElement changes. This fixes an issue where the media
827         state would not reflect the user interaction flag until a call to updateIsPlayingMedia was made.
828
829         * dom/Document.cpp:
830         (WebCore::Document::noteUserInteractionWithMediaElement):
831         * dom/Document.h:
832         (WebCore::Document::noteUserInteractionWithMediaElement): Deleted.
833         * testing/Internals.cpp:
834         (WebCore::Internals::pageMediaState):
835
836 2017-08-22  Zan Dobersek  <zdobersek@igalia.com>
837
838         GLContext: zero-initialize the GLContext pointer in ThreadGlobalGLContext
839         https://bugs.webkit.org/show_bug.cgi?id=175819
840
841         Reviewed by Xabier Rodriguez-Calvar.
842
843         * platform/graphics/GLContext.cpp: The ThreadGlobalGLContext object is
844         allocated on heap, so the embedded GLContext pointer can contain a
845         non-null value that can cause problems when e.g. checking for a current
846         GLContext on some specific thread on which a GLContext hasn't yet been
847         made current. Zero-initializing this pointer will avoid false positives
848         that can occur in these circumstances.
849
850 2017-08-21  Youenn Fablet  <youenn@apple.com>
851
852         [Cache API] Add support for Cache.add/addAll
853         https://bugs.webkit.org/show_bug.cgi?id=175677
854
855         Reviewed by Alex Christensen.
856
857         Covered by rebased tests.
858
859         Cache.addAll implementation is then as follow:
860         - Fetch the resources in parallel.
861         - Wait for all them to complete using FetchTaskCounter.
862         - If an error happens in any load or if the response is not as expected for Cache API, reject the promise.
863         - Call the batch put operation with all received FetchResponse objects.
864
865         FetchTaskCounter is responsible to wait for each response to arrive.
866         It then checks whether the response is fine,
867         If not, the addAll promise is rejected.
868         Otherwise, it waits for the body to be received.
869
870         Introducing a helper routine to create a FetchRequest from a given RequestInfo.
871         Introducing a helper routine to check for Vary Header '*' value in response headers.
872
873         * Modules/cache/Cache.cpp:
874         (WebCore::Cache::doMatch):
875         (WebCore::Cache::add):
876         (WebCore::queryCacheMatch):
877         (WebCore::hasResponseVaryStarHeaderValue):
878         (WebCore::FetchTaskCounter::FetchTaskCounter):
879         (WebCore::FetchTaskCounter::~FetchTaskCounter):
880         (WebCore::FetchTaskCounter::addRecord):
881         (WebCore::FetchTaskCounter::isDone const):
882         (WebCore::FetchTaskCounter::reject):
883         (WebCore::Cache::requestFromInfo):
884         (WebCore::Cache::addAll):
885         (WebCore::Cache::put):
886         (WebCore::Cache::remove):
887         (WebCore::Cache::keys):
888         (WebCore::toConnectionRecord):
889         (WebCore::Cache::batchPutOperation):
890         * Modules/cache/Cache.h:
891
892 2017-08-21  Myles C. Maxfield  <mmaxfield@apple.com>
893
894         DataInteractionTests.ExternalSourceAttributedStringToContentEditable hits a debug assertion
895         https://bugs.webkit.org/show_bug.cgi?id=175787
896         <rdar://problem/33996612>
897
898         Reviewed by Wenson Hsieh.
899
900         The variation axis values of San Francisco changed from the GX-style scale to the CSS-style
901         scale. Previously, we were normalizing the values we got from Core Text to fit the CSS scale;
902         however, this is no longer necessary since the font now does this itself.
903
904         The assertion was getting hit because the normalized values were huge and were overflowing
905         a single FontSelectionValue (and going negative). This patch adds handling for this
906         situation.
907
908         Test: DataInteractionTests.ExternalSourceBoldSystemAttributedStringToContentEditable
909
910         * platform/graphics/FontSelectionAlgorithm.h: Typedef the backing type for a FontSelectionValue.
911         (WebCore::FontSelectionValue::rawValue const):
912         (WebCore::FontSelectionValue::maximumValue):
913         (WebCore::FontSelectionValue::minimumValue):
914         (WebCore::FontSelectionValue::FontSelectionValue):
915         * platform/graphics/cocoa/FontCacheCoreText.cpp: Opt-out of normalization for San Francisco.
916         (WebCore::variationCapabilitiesForFontDescriptor):
917         (WebCore::capabilitiesForFontDescriptor):
918
919 2017-08-21  Chris Dumez  <cdumez@apple.com>
920
921         [Beacon] Content extensions should be able to intercept Beacon / Ping redirects
922         https://bugs.webkit.org/show_bug.cgi?id=175746
923         <rdar://problem/33946050>
924
925         Reviewed by Alex Christensen.
926
927         Update PingLoad to process content extension rules upon redirect. This allows content
928         extensions to block and upgrade to HTTPS beacon / ping loads.
929
930         Because ping loads can outlive the WebProcess, the content extensions rules are passed
931         to the NetworkProcess when starting the Ping load. The PingLoad can then consult those
932         rules upon redirect, on the NetworkProcess side.
933
934         Tests: http/wpt/beacon/contentextensions/beacon-blocked.html
935                http/wpt/beacon/contentextensions/beacon-redirect-blocked.html
936
937         * contentextensions/ContentExtensionActions.h:
938         * contentextensions/ContentExtensionsBackend.cpp:
939         (WebCore::ContentExtensions::ContentExtensionsBackend::forEach):
940         (WebCore::ContentExtensions::ContentExtensionsBackend::processContentExtensionRulesForPingLoad):
941         * contentextensions/ContentExtensionsBackend.h:
942         * page/Page.h:
943         * page/UserContentProvider.cpp:
944         (WebCore::UserContentProvider::forEachContentExtension):
945         * page/UserContentProvider.h:
946
947 2017-08-21  Brady Eidson  <beidson@apple.com>
948
949         ASSERTION FAILED: !m_connections.contains(&connection) in WebCore::SWServer::unregisterConnection(WebCore::SWServer::Connection&).
950         https://bugs.webkit.org/show_bug.cgi?id=175795
951
952         Rubber-stamped by Andy Estes.
953
954         * workers/service/server/SWServer.cpp:
955         (WebCore::SWServer::unregisterConnection): Flip the ASSERT to be... correct.
956
957 2017-08-21  Daniel Bates  <dabates@apple.com>
958
959         Cleanup TextPainter
960         https://bugs.webkit.org/show_bug.cgi?id=175782
961
962         Reviewed by Myles C. Maxfield.
963
964         Remove redundant mention of "text" in the name of TextPainter member functions, add separate
965         setters for selection and non-selection shadows, and do some other minor cleanups.
966
967         * rendering/InlineTextBox.cpp:
968         (WebCore::InlineTextBox::paint): Update code for renamed functions.
969         * rendering/SimpleLineLayoutFunctions.cpp:
970         (WebCore::SimpleLineLayout::paintFlow): Ditto.
971         * rendering/TextPainter.cpp: Include ShadowData.h.
972         (WebCore::ShadowApplier::ShadowApplier): Use C++11 brace-initialization syntax.
973         (WebCore::ShadowApplier::isLastShadowIteration): Moved from TextPainter.h.
974         (WebCore::ShadowApplier::shadowIsCompletelyCoveredByText): Ditto.
975         (WebCore::TextPainter::paintTextOrEmphasisMarks): Renamed; formerly named drawTextOrEmphasisMarks.
976         (WebCore::TextPainter::paintTextWithShadows): Update code for renamed functions.
977         (WebCore::TextPainter::paintRange): Renamed; formerly named paintTextInRange.
978         (WebCore::TextPainter::paint): Renamed; formerly named paintText.
979         (WebCore::TextPainter::drawTextOrEmphasisMarks): Renamed to paintTextOrEmphasisMarks() to match
980         the naming convention of all the other paint functions in this class.
981         (WebCore::TextPainter::paintTextInRange): Renamed to paintRange.
982         (WebCore::TextPainter::paintText): Renamed to paint.
983         * rendering/TextPainter.h: Forward declare ShadowData.
984         (WebCore::TextPainter::setStyle): Renamed; formerly named setTextPaintStyle.
985         (WebCore::TextPainter::setSelectionStyle): Renamed; formerly named setSelectionPaintStyle.
986         (WebCore::TextPainter::setShadow): Added.
987         (WebCore::TextPainter::setSelectionShadow): Added.
988         (WebCore::TextPainter::setEmphasisMark): Renamed; formerly named addEmphasis. 
989         (WebCore::TextPainter::setTextPaintStyle): Renamed to setStyle.
990         (WebCore::TextPainter::setSelectionPaintStyle): Renamed to setSelectionStyle.
991         (WebCore::TextPainter::addEmphasis): Renamed to setEmphasisMark.
992         (WebCore::TextPainter::addTextShadow): Split functionality into setShadow and setSelectionShadow.
993         (WebCore::ShadowApplier::isLastShadowIteration): Moved to TextPainter.cpp.
994         (WebCore::ShadowApplier::shadowIsCompletelyCoveredByText): Ditto.
995
996 2017-08-21  Myles C. Maxfield  <mmaxfield@apple.com>
997
998         Addressing post-review comments after r220725
999         https://bugs.webkit.org/show_bug.cgi?id=175382
1000
1001         Reviewed by Darin Adler.
1002
1003         * css/CSSFontFace.cpp:
1004         (WebCore::CSSFontFace::setUnicodeRange):
1005
1006 2017-08-21  Youenn Fablet  <youenn@apple.com>
1007
1008         [Cache API] Add support for CacheStorage.match
1009         https://bugs.webkit.org/show_bug.cgi?id=175747
1010
1011         Reviewed by Chris Dumez.
1012
1013         Covered by rebased tests.
1014
1015         Introducing Cache::doMatch so that CacheStorage can use it.
1016         Make Cache::match use Cache::doMatch as well.
1017
1018         Implementing CacheStorage.match as per spec:
1019         - If name is provided, query only the cache with the given name.
1020         - Otherwise pick the first matching response in the caches.
1021         The sequential asynchronous search is done in doSequentialMatch.
1022
1023         Making sure that response with a status code are returning false to isNull.
1024         This allows passing more tests.
1025
1026         * Modules/cache/Cache.cpp:
1027         (WebCore::Cache::match):
1028         (WebCore::Cache::doMatch):
1029         (WebCore::Cache::matchAll):
1030         (WebCore::toConnectionRecord):
1031         * Modules/cache/Cache.h:
1032         * Modules/cache/CacheStorage.cpp:
1033         (WebCore::doSequentialMatch):
1034         (WebCore::copyCaches):
1035         (WebCore::CacheStorage::match):
1036         * platform/network/ResourceResponseBase.cpp:
1037         (WebCore::ResourceResponseBase::setHTTPStatusCode):
1038
1039 2017-08-21  Dean Jackson  <dino@apple.com>
1040
1041         Persistent WebGL Warning "vertex WARNING: 0:1: extension 'GL_ARB_gpu_shader5' is not supported" in Safari 10.1.2
1042         https://bugs.webkit.org/show_bug.cgi?id=175783
1043         <rdar://problem/33623867>
1044
1045         Reviewed by Alex Christensen.
1046
1047         The version of ANGLE we use inserts this line into each shader:
1048         #extension GL_ARB_gpu_shader5 : enable
1049         It causes our lower-level GLSL compiler to give a warning, which is
1050         confusing to developers because they didn't write this code.
1051
1052         Until we upgrade our OpenGL support to version 4.1, we should remove
1053         this error message from the log returned to the developer.
1054         See https://bugs.webkit.org/show_bug.cgi?id=175785
1055
1056         Test: fast/canvas/webgl/no-info-log-for-simple-shaders.html
1057
1058         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
1059         (WebCore::GraphicsContext3D::getUnmangledInfoLog): Search for and remove
1060         this warning.
1061
1062 2017-08-21  Andy Estes  <aestes@apple.com>
1063
1064         [Payment Request] Use ExistingExceptionError to propagate JS exceptions thrown during JSON stringification
1065         https://bugs.webkit.org/show_bug.cgi?id=175776
1066
1067         Reviewed by Darin Adler.
1068
1069         * Modules/paymentrequest/PaymentRequest.cpp:
1070         (WebCore::PaymentRequest::create):
1071         * Modules/paymentrequest/PaymentRequest.h:
1072
1073 2017-08-21  Yoshiaki Jitsukawa  <Yoshiaki.Jitsukawa@sony.com>
1074
1075         [PAL] Move spi/mac directory into PAL
1076         https://bugs.webkit.org/show_bug.cgi?id=175649
1077
1078         Reviewed by Myles C. Maxfield.
1079
1080         * WebCore.xcodeproj/project.pbxproj:
1081         * editing/cocoa/DataDetection.mm:
1082         * editing/mac/DictionaryLookup.h:
1083         * editing/mac/DictionaryLookup.mm:
1084         * page/mac/ServicesOverlayController.mm:
1085         * page/mac/WheelEventDeltaFilterMac.mm:
1086         * page/scrolling/mac/ScrollingMomentumCalculatorMac.mm:
1087         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
1088         * platform/graphics/avfoundation/MediaPlaybackTargetMac.mm:
1089         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
1090         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
1091         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1092         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
1093         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1094         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1095         * platform/graphics/mac/FontCacheMac.mm:
1096         * platform/graphics/mac/MediaPlayerPrivateQTKit.h:
1097         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
1098         * platform/graphics/mac/MediaTimeQTKit.h:
1099         * platform/mac/MediaRemoteSoftLink.cpp:
1100         * platform/mac/MediaRemoteSoftLink.h:
1101         * platform/mac/PasteboardWriter.mm:
1102         * platform/mac/PlatformEventFactoryMac.mm:
1103         * platform/mac/ScrollAnimatorMac.mm:
1104         * platform/mac/ScrollbarThemeMac.mm:
1105         * platform/mac/VideoFullscreenInterfaceMac.mm:
1106         * platform/mac/WebVideoFullscreenController.mm:
1107         * rendering/RenderThemeMac.mm:
1108
1109 2017-08-21  Adrian Perez de Castro  <aperez@igalia.com>
1110
1111         [GTK][WPE][GSTREAMER_GL] Overriden virtual function not marked “override” in MediaPlayerPrivateGStreamerBase.h
1112         https://bugs.webkit.org/show_bug.cgi?id=175780
1113
1114         Reviewed by Konstantin Tokarev.
1115
1116         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: Add missing "override" qualifier.
1117
1118 2017-08-21  Brady Eidson  <beidson@apple.com>
1119
1120         Split the one SWServer::Connection into SWClientConnection and SWServer::Connection.
1121         https://bugs.webkit.org/show_bug.cgi?id=175745
1122
1123         Reviewed by Andy Estes.
1124
1125         No new tests (No behavior change).
1126
1127         Each of these has a much different environment that it lives in, so being the same object
1128         hinders clean development.
1129         
1130         This split will also make it easier for the WebCore objects to directly handle WK2 messages.
1131         
1132         * CMakeLists.txt:
1133         * WebCore.xcodeproj/project.pbxproj:
1134         
1135         * platform/Logging.h:
1136
1137         * workers/service/ServiceWorkerContainer.cpp:
1138         (WebCore::ServiceWorkerContainer::addRegistration):
1139         (WebCore::ServiceWorkerContainer::scheduleJob):
1140         * workers/service/ServiceWorkerContainer.h:
1141
1142         * workers/service/ServiceWorkerProvider.h:
1143
1144         * workers/service/server/SWClientConnection.cpp: Copied from Source/WebCore/workers/service/server/SWServer.cpp.
1145         (WebCore::SWClientConnection::SWClientConnection):
1146         (WebCore::SWClientConnection::~SWClientConnection):
1147         (WebCore::SWClientConnection::scheduleJob):
1148         (WebCore::SWClientConnection::jobRejectedInServer):
1149         * workers/service/server/SWClientConnection.h: Copied from Source/WebCore/workers/service/server/SWServer.h.
1150
1151         * workers/service/server/SWServer.cpp:
1152         (WebCore::SWServer::Connection::Connection):
1153         (WebCore::SWServer::Connection::~Connection):
1154         (WebCore::SWServer::~SWServer):
1155         (WebCore::SWServer::Connection::scheduleJobInServer):
1156         (WebCore::SWServer::scheduleJob):
1157         (WebCore::SWServer::registerConnection):
1158         (WebCore::SWServer::unregisterConnection):
1159         (WebCore::SWServer::Connection::scheduleJob): Deleted.
1160         (WebCore::SWServer::Connection::jobRejected): Deleted.
1161         * workers/service/server/SWServer.h:
1162         (WebCore::SWServer::Connection::server):
1163         (WebCore::SWServer::Connection::~Connection): Deleted.
1164
1165 2017-08-21  Andy Estes  <aestes@apple.com>
1166
1167         [Payment Request] Implement the PaymentRequest constructor
1168         https://bugs.webkit.org/show_bug.cgi?id=175755
1169
1170         Reviewed by Darin Adler.
1171
1172         * Modules/paymentrequest/PaymentDetailsModifier.h: Changed total to an std::optional<PaymentItem>.
1173         * Modules/paymentrequest/PaymentRequest.cpp:
1174         (WebCore::isWellFormedCurrencyCode): Implements the IsWellFormedCurrencyCode abstract operation from ECMA 402.
1175         (WebCore::isValidDecimalMonetaryValue): Implements the "valid decimal monetary value" validity checker.
1176         (WebCore::checkAndCanonicalizeAmount): Implements the "check and canonicalize amount" validity checker.
1177         (WebCore::checkAndCanonicalizeTotal): Implements the "check and canonicalize total" validity checker.
1178         (WebCore::PaymentRequest::create): Implements the PaymentRequest Constructor
1179         (WebCore::PaymentRequest::PaymentRequest):
1180         (WebCore::PaymentRequest::id const): Implements the PaymentRequest id attribute.
1181         (WebCore::PaymentRequest::shippingType const): Implements the PaymentRequest shippingType attribute.
1182         * Modules/paymentrequest/PaymentRequest.h:
1183         * Modules/paymentrequest/PaymentRequest.idl: Annotated PaymentRequest with ConstructorMayThrowException.
1184         * WebCore.xcodeproj/project.pbxproj:
1185
1186 2017-08-21  Per Arne Vollan  <pvollan@apple.com>
1187
1188         [Win] DRT should only allow any https certificate for localhost.
1189         https://bugs.webkit.org/show_bug.cgi?id=175147
1190
1191         Reviewed by Brent Fulgham.
1192
1193         Disabling validation of certificate chains, breaks SSL on Windows. In order
1194         for SSL tests to succeed on Windows, we should avoid disabling it.
1195
1196         No new tests, covered by existing tests.
1197
1198         * platform/network/cf/ResourceHandleCFNet.cpp:
1199         (WebCore::ResourceHandle::createCFURLConnection):
1200
1201 2017-08-21  Zan Dobersek  <zdobersek@igalia.com>
1202
1203         [EME] HTMLMediaElement: basic implementations of 'Attempt to Decrypt', 'Attempt to Resume Playback If Necessary'
1204         https://bugs.webkit.org/show_bug.cgi?id=175761
1205
1206         Reviewed by Xabier Rodriguez-Calvar.
1207
1208         Add initial and incomplete implementations of the 'Attempt to Decrypt' and
1209         'Attempt to Resume Playback If Necessary' algorithms.  The implementations
1210         are interleaved with the specification text for clarity.
1211
1212         'Attempt to Decrypt' implementation doesn't yet address the encrypted block
1213         queue or the 'decryption blocked waiting for key' flag since it's not yet
1214         clear whether it would make more sense for this state to reside lower, in
1215         the platform layer. The gist of the algorithm is to invoke the decryption
1216         attempt through the MediaPlayer object, passing along the CDMInstance object
1217         retrieved from the MediaKeys object that is associated with this media
1218         element.
1219
1220         'Attempt to Resume Playback if Necessary' implementation similarly for now
1221         omits the various state flag operations. The main task at this point is to
1222         dispatch the 'Attempt to Decrypt' algorithm.
1223
1224         HTMLMediaElement::cdmClientAttemptToResumePlaybackIfNecessary() method now
1225         invokes the attemptToResumePlaybackIfNecessary() method.
1226
1227         MediaKeys::hasOpenSessions() is introduced, returning true if any session
1228         that was created through this MediaKeys instance is still open. This allows
1229         the 'Attempt to Decrypt' algorithm to proceed with the decryption attempt
1230         dispatch into the MediaPlayer hierarchy.
1231
1232         For that, the MediaPlayer::attemptToDecryptWithInstance() method is added,
1233         which simply dispatches the mirror method on MediaPlayerPrivate interface.
1234         This will enable the platform-layer implementations to use the passed-in
1235         CDMInstance object for decryption purposes.
1236
1237         * Modules/encryptedmedia/MediaKeySession.h:
1238         * Modules/encryptedmedia/MediaKeys.cpp:
1239         (WebCore::MediaKeys::hasOpenSessions const):
1240         * Modules/encryptedmedia/MediaKeys.h:
1241         * html/HTMLMediaElement.cpp:
1242         (WebCore::HTMLMediaElement::attemptToDecrypt):
1243         (WebCore::HTMLMediaElement::attemptToResumePlaybackIfNecessary):
1244         (WebCore::HTMLMediaElement::cdmClientAttemptToResumePlaybackIfNecessary):
1245         * html/HTMLMediaElement.h: Mark cdmClientAttemptToResumePlaybackIfNecessary() as final.
1246         * platform/graphics/MediaPlayer.cpp:
1247         (WebCore::MediaPlayer::attemptToDecryptWithInstance):
1248         * platform/graphics/MediaPlayer.h:
1249         * platform/graphics/MediaPlayerPrivate.h:
1250         (WebCore::MediaPlayerPrivateInterface::attemptToDecryptWithInstance):
1251
1252 2017-08-20  Zan Dobersek  <zdobersek@igalia.com>
1253
1254         [EME] Add basic implementation of HTMLMediaElement::setMediaKeys()
1255         https://bugs.webkit.org/show_bug.cgi?id=175717
1256
1257         Reviewed by Xabier Rodriguez-Calvar.
1258
1259         Add an initial and incomplete implementation of HTMLMediaElement::setMediaKeys(),
1260         interleaved with the specification wording of how this operation should behave.
1261         The implementation still doesn't cover cases of CDM instances being already
1262         associated with a different HTMLMediaElement, of CDM instances that can't be
1263         disassociated from the current HTMLMediaElement, and of failures during both
1264         association and disassociation of MediaKeys with the HTMLMediaElement.
1265
1266         The HTMLMediaElement (as a CDMClient inheritor) has to be attached or detached
1267         from the MediaKeys object as appropriate. This attachment allows MediaKeys to
1268         initiate an attempt to resume playback whenever the key statuses of the
1269         associated MediaKeys object are updated.
1270
1271         Upon association and disassociation with MediaKeys, the CDMInstance object of
1272         that specific MediaKeys instance is attached to or detached from the MediaPlayer
1273         instance. This allows the platform layer to gather information about the
1274         CDMInstance that will be used for decryption of media content for this specific
1275         media element.
1276
1277         Additionally, the detachment from both MediaKeys and MediaPlayer is done upon
1278         HTMLMediaElement destruction.
1279
1280         Upon setting the MediaKeys object, a task is queued that launches the 'Attempt to
1281         Resume Playback If Necessary' algorithm. A placeholder method is added that will
1282         implement the algorithm in the future.
1283
1284         The HTMLMediaElement::mediaKeys() getter is also implemented, returning pointer
1285         held in m_mediaKeys.
1286
1287         Covered to a degree by existing imported W3C tests, with a setMediaKeys()-oriented
1288         test having WPE-specific baseline update.
1289
1290         * Modules/encryptedmedia/MediaKeys.h:
1291         (WebCore::MediaKeys::cdmInstance const):
1292         * html/HTMLMediaElement.cpp:
1293         (WebCore::HTMLMediaElement::~HTMLMediaElement):
1294         (WebCore::HTMLMediaElement::mediaKeys const):
1295         (WebCore::HTMLMediaElement::setMediaKeys):
1296         (WebCore::HTMLMediaElement::attemptToResumePlaybackIfNecessary):
1297         (WebCore::HTMLMediaElement::contextDestroyed):
1298         * html/HTMLMediaElement.h:
1299         * platform/graphics/MediaPlayer.cpp:
1300         (WebCore::MediaPlayer::cdmInstanceAttached):
1301         (WebCore::MediaPlayer::cdmInstanceDetached):
1302         * platform/graphics/MediaPlayer.h:
1303         * platform/graphics/MediaPlayerPrivate.h:
1304         (WebCore::MediaPlayerPrivateInterface::cdmInstanceAttached):
1305         (WebCore::MediaPlayerPrivateInterface::cdmInstanceDetached):
1306
1307 2017-08-20  Chris Dumez  <cdumez@apple.com>
1308
1309         Simplify calls to LoaderStrategy::startPingLoad()
1310         https://bugs.webkit.org/show_bug.cgi?id=175756
1311
1312         Reviewed by Sam Weinig.
1313
1314         Simplify calls to LoaderStrategy::startPingLoad() by passing the Frame to it
1315         and let its implementation gets what it needs from the frame. This reduces
1316         the number of parameters to startPingLoad() and is more easily extensible.
1317
1318         * dom/Document.h:
1319         * loader/LoaderStrategy.h:
1320         * loader/PingLoader.cpp:
1321         (WebCore::PingLoader::loadImage):
1322         (WebCore::PingLoader::sendPing):
1323         (WebCore::PingLoader::sendViolationReport):
1324         (WebCore::PingLoader::startPingLoad):
1325         * loader/PingLoader.h:
1326         * loader/cache/CachedResource.cpp:
1327         (WebCore::CachedResource::load):
1328
1329 2017-08-20  Antti Koivisto  <antti@apple.com>
1330
1331         Factor :before/:after render tree mutations into a RenderTreeUpdater helper class
1332         https://bugs.webkit.org/show_bug.cgi?id=175752
1333
1334         Reviewed by Andreas Kling.
1335
1336         Move code that constructs generated content renderers out from PseudoElement.
1337         Also refactor the related code from RenderTreeUpdater main class into
1338         RenderTreeUpdater::GeneratedContent helper class.
1339
1340         * WebCore.xcodeproj/project.pbxproj:
1341         * dom/PseudoElement.cpp:
1342         (WebCore::PseudoElement::resolveCustomStyle): Deleted.
1343
1344             Not needed anymore.
1345
1346         (WebCore::PseudoElement::didAttachRenderers): Deleted.
1347
1348             Moves to createContentRenderers in GeneratedContent.
1349
1350         (WebCore::PseudoElement::didRecalcStyle): Deleted.
1351
1352             Moves to updateStyleForContentRenderers in GeneratedContent.
1353
1354         * dom/PseudoElement.h:
1355         * style/RenderTreeUpdater.cpp:
1356         (WebCore::RenderTreeUpdater::RenderTreeUpdater):
1357         (WebCore::RenderTreeUpdater::~RenderTreeUpdater):
1358         (WebCore::RenderTreeUpdater::commit):
1359         (WebCore::RenderTreeUpdater::updateBeforeDescendants):
1360         (WebCore::RenderTreeUpdater::updateAfterDescendants):
1361         (WebCore::needsPseudoElement): Deleted.
1362         (WebCore::RenderTreeUpdater::updateBeforeOrAfterPseudoElement): Deleted.
1363         (WebCore::RenderTreeUpdater::updateQuotesUpTo): Deleted.
1364
1365             Quotes and other :before/:after support moves to GeneratedContent helpwe.
1366
1367         * style/RenderTreeUpdater.h:
1368         (WebCore::RenderTreeUpdater::generatedContent):
1369         * style/RenderTreeUpdaterGeneratedContent.cpp: Added.
1370         (WebCore::RenderTreeUpdater::GeneratedContent::GeneratedContent):
1371         (WebCore::RenderTreeUpdater::GeneratedContent::updateBeforePseudoElement):
1372         (WebCore::RenderTreeUpdater::GeneratedContent::updateAfterPseudoElement):
1373         (WebCore::RenderTreeUpdater::GeneratedContent::updateRemainingQuotes):
1374         (WebCore::RenderTreeUpdater::GeneratedContent::updateQuotesUpTo):
1375         (WebCore::createContentRenderers):
1376         (WebCore::updateStyleForContentRenderers):
1377         (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement):
1378         (WebCore::RenderTreeUpdater::GeneratedContent::needsPseudoElement):
1379         * style/RenderTreeUpdaterGeneratedContent.h: Added.
1380
1381 2017-08-19  Andy Estes  <aestes@apple.com>
1382
1383         [Payment Request] Add interface stubs
1384         https://bugs.webkit.org/show_bug.cgi?id=175730
1385
1386         Reviewed by Youenn Fablet.
1387
1388         * DerivedSources.make:
1389         * Modules/paymentrequest/PaymentAddress.h: Added.
1390         * Modules/paymentrequest/PaymentAddress.idl: Added.
1391         * Modules/paymentrequest/PaymentComplete.h: Added.
1392         * Modules/paymentrequest/PaymentComplete.idl: Added.
1393         * Modules/paymentrequest/PaymentCurrencyAmount.h: Added.
1394         * Modules/paymentrequest/PaymentCurrencyAmount.idl: Added.
1395         * Modules/paymentrequest/PaymentDetailsBase.h: Added.
1396         * Modules/paymentrequest/PaymentDetailsBase.idl: Added.
1397         * Modules/paymentrequest/PaymentDetailsInit.h: Added.
1398         * Modules/paymentrequest/PaymentDetailsInit.idl: Added.
1399         * Modules/paymentrequest/PaymentDetailsModifier.h: Added.
1400         * Modules/paymentrequest/PaymentDetailsModifier.idl: Added.
1401         * Modules/paymentrequest/PaymentDetailsUpdate.h: Added.
1402         * Modules/paymentrequest/PaymentDetailsUpdate.idl: Added.
1403         * Modules/paymentrequest/PaymentItem.h: Added.
1404         * Modules/paymentrequest/PaymentItem.idl: Added.
1405         * Modules/paymentrequest/PaymentMethodData.h: Added.
1406         * Modules/paymentrequest/PaymentMethodData.idl: Added.
1407         * Modules/paymentrequest/PaymentOptions.h: Added.
1408         * Modules/paymentrequest/PaymentOptions.idl: Added.
1409         * Modules/paymentrequest/PaymentRequest.cpp: Added.
1410         (WebCore::PaymentRequest::create):
1411         (WebCore::PaymentRequest::PaymentRequest):
1412         (WebCore::PaymentRequest::~PaymentRequest):
1413         (WebCore::PaymentRequest::show):
1414         (WebCore::PaymentRequest::abort):
1415         (WebCore::PaymentRequest::canMakePayment):
1416         * Modules/paymentrequest/PaymentRequest.h: Added.
1417         * Modules/paymentrequest/PaymentRequest.idl: Added.
1418         * Modules/paymentrequest/PaymentRequestUpdateEvent.cpp: Added.
1419         (WebCore::PaymentRequestUpdateEvent::~PaymentRequestUpdateEvent):
1420         (WebCore::PaymentRequestUpdateEvent::updateWith):
1421         * Modules/paymentrequest/PaymentRequestUpdateEvent.h: Added.
1422         * Modules/paymentrequest/PaymentRequestUpdateEvent.idl: Added.
1423         * Modules/paymentrequest/PaymentRequestUpdateEventInit.h: Added.
1424         * Modules/paymentrequest/PaymentRequestUpdateEventInit.idl: Added.
1425         * Modules/paymentrequest/PaymentResponse.cpp: Added.
1426         (WebCore::PaymentResponse::complete):
1427         * Modules/paymentrequest/PaymentResponse.h: Added.
1428         * Modules/paymentrequest/PaymentResponse.idl: Added.
1429         * Modules/paymentrequest/PaymentShippingOption.h: Added.
1430         * Modules/paymentrequest/PaymentShippingOption.idl: Added.
1431         * Modules/paymentrequest/PaymentShippingType.h: Added.
1432         * Modules/paymentrequest/PaymentShippingType.idl: Added.
1433         * WebCore.xcodeproj/project.pbxproj:
1434         * dom/EventNames.h:
1435         * dom/EventNames.in:
1436         * dom/EventTargetFactory.in:
1437
1438 2017-08-19  Sam Weinig  <sam@webkit.org>
1439
1440         [WebCrypto] Remove the KeyAlgorithm type hierarchy
1441         https://bugs.webkit.org/show_bug.cgi?id=175750
1442
1443         Reviewed by Chris Dumez.
1444
1445         Removes the unnecessary indirection that existed to generate a
1446         KeyAlgorithm dictionary (or rather, one of its derived dictionaries)
1447         for a CryptoKey. We were calling the virtual buildAlgorithm(), which
1448         return a std::unique_ptr<KeyAlgorithm>, which we then casted to the 
1449         correct derived class and called dictionary() on. This can now be
1450         simplified by making each CryptoKey derived class override a function
1451         that returns the KeyAlgorithm variant.
1452
1453         * crypto/CryptoKey.cpp:
1454         (WebCore::CryptoKey::algorithm const): Deleted.
1455         * crypto/CryptoKey.h:
1456         (WebCore::CryptoKey::extractable const):
1457         (WebCore::KeyAlgorithm::~KeyAlgorithm): Deleted.
1458         (WebCore::KeyAlgorithm::name const): Deleted.
1459         (WebCore::KeyAlgorithm::KeyAlgorithm): Deleted.
1460         * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:
1461         (WebCore::CryptoKeyRSA::algorithm const):
1462         (WebCore::CryptoKeyRSA::buildAlgorithm const): Deleted.
1463         * crypto/keys/CryptoKeyAES.cpp:
1464         (WebCore::CryptoKeyAES::algorithm const):
1465         (WebCore::AesKeyAlgorithm::dictionary const): Deleted.
1466         (WebCore::CryptoKeyAES::buildAlgorithm const): Deleted.
1467         * crypto/keys/CryptoKeyAES.h:
1468         * crypto/keys/CryptoKeyEC.cpp:
1469         (WebCore::CryptoKeyEC::algorithm const):
1470         (WebCore::EcKeyAlgorithm::dictionary const): Deleted.
1471         (WebCore::CryptoKeyEC::buildAlgorithm const): Deleted.
1472         * crypto/keys/CryptoKeyEC.h:
1473         (WebCore::EcKeyAlgorithm::EcKeyAlgorithm): Deleted.
1474         (WebCore::EcKeyAlgorithm::namedCurve const): Deleted.
1475         * crypto/keys/CryptoKeyHMAC.cpp:
1476         (WebCore::CryptoKeyHMAC::algorithm const):
1477         (WebCore::HmacKeyAlgorithm::dictionary const): Deleted.
1478         (WebCore::CryptoKeyHMAC::buildAlgorithm const): Deleted.
1479         * crypto/keys/CryptoKeyHMAC.h:
1480         * crypto/keys/CryptoKeyRSA.cpp:
1481         (WebCore::RsaKeyAlgorithm::dictionary const): Deleted.
1482         (WebCore::RsaHashedKeyAlgorithm::dictionary const): Deleted.
1483         * crypto/keys/CryptoKeyRSA.h:
1484         (WebCore::RsaKeyAlgorithm::RsaKeyAlgorithm): Deleted.
1485         (WebCore::RsaKeyAlgorithm::modulusLength const): Deleted.
1486         (WebCore::RsaKeyAlgorithm::publicExponent const): Deleted.
1487         * crypto/keys/CryptoKeyRaw.cpp:
1488         (WebCore::CryptoKeyRaw::algorithm const):
1489         (WebCore::RawKeyAlgorithm::dictionary const): Deleted.
1490         (WebCore::CryptoKeyRaw::buildAlgorithm const): Deleted.
1491         * crypto/keys/CryptoKeyRaw.h:
1492         (WebCore::RawKeyAlgorithm::RawKeyAlgorithm): Deleted.
1493         * crypto/mac/CryptoKeyRSAMac.cpp:
1494         (WebCore::CryptoKeyRSA::algorithm const):
1495         (WebCore::CryptoKeyRSA::buildAlgorithm const): Deleted.
1496
1497 2017-08-19  Sam Weinig  <sam@webkit.org>
1498
1499         [Mac] Change uint8_t* to Vector<uint8_t> type in all crypto algorithm implementation
1500         https://bugs.webkit.org/show_bug.cgi?id=164939
1501
1502         Reviewed by Chris Dumez.
1503
1504         Address FIXMEs, replacing uint8_t*/size_t parameters with Vector<uint8_t>&.
1505
1506         * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
1507         (WebCore::transformAES_CBC):
1508         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
1509         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
1510         * crypto/mac/CryptoAlgorithmAES_KWMac.cpp:
1511         (WebCore::wrapKeyAES_KW):
1512         (WebCore::unwrapKeyAES_KW):
1513         (WebCore::CryptoAlgorithmAES_KW::platformWrapKey):
1514         (WebCore::CryptoAlgorithmAES_KW::platformUnwrapKey):
1515         * crypto/mac/CryptoAlgorithmHMACMac.cpp:
1516         (WebCore::calculateSignature):
1517         (WebCore::CryptoAlgorithmHMAC::platformSign):
1518         (WebCore::CryptoAlgorithmHMAC::platformVerify):
1519         * crypto/mac/CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp:
1520         (WebCore::encryptRSAES_PKCS1_v1_5):
1521         (WebCore::decryptRSAES_PKCS1_v1_5):
1522         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt):
1523         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt):
1524         * crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
1525         (WebCore::signRSASSA_PKCS1_v1_5):
1526         (WebCore::verifyRSASSA_PKCS1_v1_5):
1527         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign):
1528         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify):
1529         * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp:
1530         (WebCore::encryptRSA_OAEP):
1531         (WebCore::decryptRSA_OAEP):
1532         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
1533         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
1534
1535 2017-08-18  Ryosuke Niwa  <rniwa@webkit.org>
1536
1537         Forbid setDragImage after dragstart
1538         https://bugs.webkit.org/show_bug.cgi?id=175751
1539
1540         Reviewed by Wenson Hsieh.
1541
1542         Removed the code to allow setting the drag mage after dragstart had happened.
1543
1544         The feature was apparently used in Mac WebKit1 port but using it today causes the drag image
1545         to disapepar while the user is moving the mouse cursor and being drawn once it's stopped
1546         and results in the contionus flickering of the drag image.
1547
1548         The feaure was never supported in WebKit2 and doesn't match the HTML5 specification:
1549         https://html.spec.whatwg.org/multipage/dnd.html#concept-dnd-rw
1550         https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-setdragimage
1551         or the behaviors of other browsers such as Chrome and Firefox.
1552
1553         No new tests. This patch simply removes code.
1554
1555         * dom/DataTransfer.cpp:
1556         (WebCore::DataTransfer::setDragImage):
1557         (WebCore::DataTransfer::canSetDragImage const): Deleted.
1558         * dom/DataTransfer.h:
1559         (WebCore::DataTransfer::makeDragImageWritable): Deleted.
1560         * page/EventHandler.cpp:
1561         (WebCore::EventHandler::handleDrag):
1562
1563 2017-08-18  Sam Weinig  <sam@webkit.org>
1564
1565         [WebCrypto] Get rid of CryptoKeyData class and all its subclasses
1566         https://bugs.webkit.org/show_bug.cgi?id=169806
1567
1568         Reviewed by Chris Dumez.
1569
1570         - Replaces the CryptoKeyData type hierarchy 
1571
1572             CryptoKeyData
1573               - CryptoKeyDataOctetSequence
1574               - CryptoKeyDataRSAComponents
1575
1576           with the renamed CryptoKeyRSAComponents.
1577
1578         - Removes pure virtual exportData function on CryptoKey, and all
1579           the implementations except the one on CryptoKeyRSA, which now is
1580           non-virtual, and returns a CryptoKeyRSAComponents. Update the one
1581           external caller, SerializedScriptValue, to handle this.
1582
1583         * CMakeLists.txt:
1584         * WebCore.xcodeproj/project.pbxproj:
1585         * bindings/js/SerializedScriptValue.cpp:
1586         * crypto/CryptoAlgorithm.h:
1587         * crypto/CryptoKey.h:
1588         * crypto/CryptoKeyData.h: Removed.
1589         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
1590         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
1591         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
1592         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
1593         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
1594         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
1595         * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:
1596         (WebCore::CryptoKeyRSA::create):
1597         (WebCore::CryptoKeyRSA::exportData const):
1598         * crypto/keys/CryptoKeyAES.cpp:
1599         (WebCore::CryptoKeyAES::exportData const): Deleted.
1600         * crypto/keys/CryptoKeyAES.h:
1601         * crypto/keys/CryptoKeyDataOctetSequence.cpp: Removed.
1602         * crypto/keys/CryptoKeyDataOctetSequence.h: Removed.
1603         * crypto/keys/CryptoKeyDataRSAComponents.cpp: Removed.
1604         * crypto/keys/CryptoKeyDataRSAComponents.h: Removed.
1605         * crypto/keys/CryptoKeyEC.cpp:
1606         (WebCore::CryptoKeyEC::exportData const): Deleted.
1607         * crypto/keys/CryptoKeyEC.h:
1608         * crypto/keys/CryptoKeyHMAC.cpp:
1609         (WebCore::CryptoKeyHMAC::exportData const): Deleted.
1610         * crypto/keys/CryptoKeyHMAC.h:
1611         * crypto/keys/CryptoKeyRSA.cpp:
1612         (WebCore::CryptoKeyRSA::importJwk):
1613         (WebCore::CryptoKeyRSA::exportJwk const):
1614         * crypto/keys/CryptoKeyRSA.h:
1615         * crypto/keys/CryptoKeyRSAComponents.cpp: Copied from crypto/keys/CryptoKeyDataRSAComponents.cpp.
1616         (WebCore::CryptoKeyRSAComponents::CryptoKeyRSAComponents):
1617         (WebCore::CryptoKeyRSAComponents::~CryptoKeyRSAComponents):
1618         (WebCore::CryptoKeyDataRSAComponents::CryptoKeyDataRSAComponents): Deleted.
1619         (WebCore::CryptoKeyDataRSAComponents::~CryptoKeyDataRSAComponents): Deleted.
1620         * crypto/keys/CryptoKeyRSAComponents.h: Copied from crypto/keys/CryptoKeyDataRSAComponents.h.
1621         (WebCore::CryptoKeyRSAComponents::createPublic):
1622         (WebCore::CryptoKeyRSAComponents::createPrivate):
1623         (WebCore::CryptoKeyRSAComponents::createPrivateWithAdditionalData):
1624         * crypto/keys/CryptoKeyRaw.cpp:
1625         (WebCore::CryptoKeyRaw::exportData const): Deleted.
1626         * crypto/keys/CryptoKeyRaw.h:
1627         * crypto/mac/CryptoKeyRSAMac.cpp:
1628         (WebCore::getPrivateKeyComponents):
1629         (WebCore::CryptoKeyRSA::create):
1630         (WebCore::CryptoKeyRSA::exportData const):
1631
1632 2017-08-18  Youenn Fablet  <youenn@apple.com>
1633
1634         [Cache API] Add support for being loaded responses
1635         https://bugs.webkit.org/show_bug.cgi?id=175732
1636
1637         Reviewed by Chris Dumez.
1638
1639         Covered by existing and rebased tests.
1640
1641         Introducing a callback-based method to consume the body when the load is finished.
1642         Using that new method in Cache::put and calling batchPutOperation when the load is finished.
1643
1644         Fixing the case of a fetch response being cloned, in which case its body should be marked as ReadableStream.
1645
1646         * Modules/cache/Cache.cpp:
1647         (WebCore::Cache::put): Changing order of checks to reduce test flakiness risks as there is not yet support for putting responses with ReadableStream.
1648         (WebCore::toConnectionRecord):
1649         (WebCore::Cache::batchPutOperation):
1650         * Modules/cache/Cache.h:
1651         * Modules/fetch/FetchBody.cpp:
1652         (WebCore::FetchBody::readableStreamBody): Deleted.
1653         * Modules/fetch/FetchBody.h:
1654         (WebCore::FetchBody::loadingBody):
1655         (WebCore::FetchBody::setAsReadableStream):
1656         * Modules/fetch/FetchResponse.cpp:
1657         (WebCore::FetchResponse::BodyLoader::didSucceed):
1658         (WebCore::FetchResponse::BodyLoader::didFail):
1659         (WebCore::FetchResponse::consumeBody):
1660         (WebCore::FetchResponse::consumeBodyWhenLoaded):
1661         * Modules/fetch/FetchResponse.h:
1662
1663 2017-08-18  Chris Dumez  <cdumez@apple.com>
1664
1665         [Beacon] Improve error reporting
1666         https://bugs.webkit.org/show_bug.cgi?id=175723
1667
1668         Reviewed by Darin Adler.
1669
1670         Have Ping loads such as beacons report errors via their completion handler.
1671         The Beacon API is using this error to log a console message when beacon loads
1672         fail, provided that the page is still alive.
1673
1674         Test: http/wpt/beacon/beacon-async-error-logging.html
1675
1676         * Modules/beacon/NavigatorBeacon.cpp:
1677         (WebCore::NavigatorBeacon::NavigatorBeacon):
1678         (WebCore::NavigatorBeacon::~NavigatorBeacon):
1679         (WebCore::NavigatorBeacon::from):
1680         (WebCore::NavigatorBeacon::supplementName):
1681         (WebCore::NavigatorBeacon::notifyFinished):
1682         (WebCore::NavigatorBeacon::logError):
1683         (WebCore::NavigatorBeacon::sendBeacon):
1684         * Modules/beacon/NavigatorBeacon.h:
1685         * loader/LoaderStrategy.h:
1686         * loader/cache/CachedResource.cpp:
1687         (WebCore::CachedResource::load):
1688         * loader/cache/CachedResourceLoader.cpp:
1689         (WebCore::CachedResourceLoader::requestBeaconResource):
1690         * loader/cache/CachedResourceLoader.h:
1691         * platform/network/PingHandle.h:
1692
1693 2017-08-18  Sam Weinig  <sam@webkit.org>
1694
1695         Remove the deprecated WebKitSubtleCrypto interface
1696         https://bugs.webkit.org/show_bug.cgi?id=164938
1697         <rdar://problem/29894563>
1698
1699         Reviewed by Chris Dumez.
1700
1701         Remove WebKitSubtleCrypto and all of its helper classes / functionality.
1702
1703         * CMakeLists.txt:
1704         * DerivedSources.cpp:
1705         * DerivedSources.make:
1706         * WebCore.xcodeproj/project.pbxproj:
1707         * bindings/js/JSCryptoAlgorithmDictionary.cpp: Removed.
1708         * bindings/js/JSCryptoAlgorithmDictionary.h: Removed.
1709         * bindings/js/JSCryptoKeySerializationJWK.cpp: Removed.
1710         * bindings/js/JSCryptoKeySerializationJWK.h: Removed.
1711         * bindings/js/JSCryptoOperationData.cpp: Removed.
1712         * bindings/js/JSCryptoOperationData.h: Removed.
1713         * bindings/js/JSWebKitSubtleCryptoCustom.cpp: Removed.
1714         * crypto/CryptoAlgorithm.cpp:
1715         (WebCore::CryptoAlgorithm::deriveKey): Deleted.
1716         (WebCore::CryptoAlgorithm::encryptForWrapKey): Deleted.
1717         (WebCore::CryptoAlgorithm::decryptForUnwrapKey): Deleted.
1718         * crypto/CryptoAlgorithm.h:
1719         * crypto/CryptoAlgorithmParametersDeprecated.h: Removed.
1720         * crypto/CryptoKeySerialization.h: Removed.
1721         * crypto/WebKitSubtleCrypto.cpp: Removed.
1722         * crypto/WebKitSubtleCrypto.h: Removed.
1723         * crypto/WebKitSubtleCrypto.idl: Removed.
1724         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
1725         (WebCore::CryptoAlgorithmAES_CBC::keyAlgorithmMatches const): Deleted.
1726         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
1727         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
1728         (WebCore::CryptoAlgorithmAES_KW::encryptForWrapKey): Deleted.
1729         (WebCore::CryptoAlgorithmAES_KW::decryptForUnwrapKey): Deleted.
1730         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
1731         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
1732         (WebCore::CryptoAlgorithmHMAC::keyAlgorithmMatches const): Deleted.
1733         * crypto/algorithms/CryptoAlgorithmHMAC.h:
1734         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
1735         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
1736         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
1737         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::keyAlgorithmMatches const): Deleted.
1738         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
1739         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
1740         (WebCore::CryptoAlgorithmRSA_OAEP::keyAlgorithmMatches const): Deleted.
1741         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
1742         * crypto/algorithms/CryptoAlgorithmSHA1.cpp:
1743         * crypto/algorithms/CryptoAlgorithmSHA1.h:
1744         * crypto/algorithms/CryptoAlgorithmSHA224.cpp:
1745         * crypto/algorithms/CryptoAlgorithmSHA224.h:
1746         * crypto/algorithms/CryptoAlgorithmSHA256.cpp:
1747         * crypto/algorithms/CryptoAlgorithmSHA256.h:
1748         * crypto/algorithms/CryptoAlgorithmSHA384.cpp:
1749         * crypto/algorithms/CryptoAlgorithmSHA384.h:
1750         * crypto/algorithms/CryptoAlgorithmSHA512.cpp:
1751         * crypto/algorithms/CryptoAlgorithmSHA512.h:
1752         * crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp:
1753         * crypto/gcrypt/CryptoAlgorithmAES_KWGCrypt.cpp:
1754         (WebCore::CryptoAlgorithmAES_KW::platformEncrypt): Deleted.
1755         (WebCore::CryptoAlgorithmAES_KW::platformDecrypt): Deleted.
1756         * crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp:
1757         * crypto/gcrypt/CryptoAlgorithmRSAES_PKCS1_v1_5GCrypt.cpp:
1758         * crypto/gcrypt/CryptoAlgorithmRSASSA_PKCS1_v1_5GCrypt.cpp:
1759         * crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp:
1760         * crypto/keys/CryptoKeySerializationRaw.cpp: Removed.
1761         * crypto/keys/CryptoKeySerializationRaw.h: Removed.
1762         * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
1763         * crypto/mac/CryptoAlgorithmAES_KWMac.cpp:
1764         (WebCore::CryptoAlgorithmAES_KW::platformEncrypt): Deleted.
1765         (WebCore::CryptoAlgorithmAES_KW::platformDecrypt): Deleted.
1766         * crypto/mac/CryptoAlgorithmHMACMac.cpp:
1767         * crypto/mac/CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp:
1768         * crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
1769         * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp:
1770         * crypto/parameters/CryptoAlgorithmAesCbcParamsDeprecated.h: Removed.
1771         * crypto/parameters/CryptoAlgorithmAesKeyGenParamsDeprecated.h: Removed.
1772         * crypto/parameters/CryptoAlgorithmHmacKeyParamsDeprecated.h: Removed.
1773         * crypto/parameters/CryptoAlgorithmHmacParamsDeprecated.h: Removed.
1774         * crypto/parameters/CryptoAlgorithmRsaKeyGenParamsDeprecated.h: Removed.
1775         * crypto/parameters/CryptoAlgorithmRsaKeyParamsWithHashDeprecated.h: Removed.
1776         * crypto/parameters/CryptoAlgorithmRsaOaepParamsDeprecated.h: Removed.
1777         * crypto/parameters/CryptoAlgorithmRsaSsaParamsDeprecated.h: Removed.
1778         * features.json:
1779         * page/Crypto.cpp:
1780         * page/Crypto.h:
1781         * page/Crypto.idl:
1782
1783 2017-08-18  Tim Horton  <timothy_horton@apple.com>
1784
1785         Remove classic mode screen scale clamping
1786         https://bugs.webkit.org/show_bug.cgi?id=175739
1787         <rdar://problem/33894531>
1788
1789         Reviewed by Andy Estes.
1790
1791         * platform/ios/PlatformScreenIOS.mm:
1792         (WebCore::screenScaleFactor):
1793         This code is no longer needed.
1794
1795 2017-08-18  Daewoong Jang  <daewoong.jang@navercorp.com>
1796
1797         [Curl] Improve multi-threaded networking
1798         https://bugs.webkit.org/show_bug.cgi?id=175713
1799
1800         Reviewed by Alex Christensen.
1801
1802         * platform/Curl.cmake:
1803         * platform/network/ResourceHandleInternal.h:
1804         (WebCore::ResourceHandleInternal::ResourceHandleInternal):
1805         (WebCore::ResourceHandleInternal::m_failureTimer): Deleted.
1806         * platform/network/curl/CurlCacheManager.cpp:
1807         (WebCore::CurlCacheManager::didReceiveResponse):
1808         * platform/network/curl/CurlDownload.cpp:
1809         (WebCore::CurlDownload::init):
1810         (WebCore::CurlDownload::start):
1811         (WebCore::CurlDownload::cancel):
1812         (WebCore::CurlDownload::retain):
1813         (WebCore::CurlDownload::release):
1814         (WebCore::CurlDownload::setupRequest):
1815         (WebCore::CurlDownload::notifyFinish):
1816         (WebCore::CurlDownload::notifyFail):
1817         * platform/network/curl/CurlDownload.h:
1818         * platform/network/curl/CurlJobManager.cpp:
1819         (WebCore::CurlJobList::isEmpty const):
1820         (WebCore::CurlJobList::startJobs):
1821         (WebCore::CurlJobList::finishJobs):
1822         (WebCore::CurlJobList::notifyResult):
1823         (WebCore::CurlJobManager::add):
1824         (WebCore::CurlJobManager::cancel):
1825         (WebCore::CurlJobManager::callOnJobThread):
1826         (WebCore::CurlJobManager::startThreadIfNeeded):
1827         (WebCore::CurlJobManager::updateJobList):
1828         (WebCore::CurlJobManager::workerThread):
1829         (WebCore::CurlJobList::append): Deleted.
1830         (WebCore::CurlJobList::cancel): Deleted.
1831         (WebCore::CurlJobList::complete): Deleted.
1832         (WebCore::CurlJobList::withJob): Deleted.
1833         (WebCore::CurlJobList::withCurlHandle): Deleted.
1834         (WebCore::CurlJob::invoke): Deleted.
1835         (WebCore::CurlJobManager::updateJobs): Deleted.
1836         * platform/network/curl/CurlJobManager.h:
1837         (WebCore::CurlJob::CurlJob): Deleted.
1838         (WebCore::CurlJob::~CurlJob): Deleted.
1839         (WebCore::CurlJob::operator=): Deleted.
1840         (WebCore::CurlJob::curlHandle const): Deleted.
1841         (WebCore::CurlJob::ticket const): Deleted.
1842         (WebCore::CurlJob::finished): Deleted.
1843         (WebCore::CurlJob::error): Deleted.
1844         (WebCore::CurlJob::cancel): Deleted.
1845         (WebCore::CurlJobManager::isActiveJob const): Deleted.
1846         * platform/network/curl/MultipartHandle.cpp:
1847         (WebCore::MultipartHandle::didReceiveData):
1848         * platform/network/curl/ResourceHandleCurl.cpp:
1849         (WebCore::ResourceHandleInternal::~ResourceHandleInternal):
1850         (WebCore::ResourceHandle::start):
1851         (WebCore::ResourceHandle::cancel):
1852         (WebCore::ResourceHandle::platformSetDefersLoading):
1853         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
1854         (WebCore::ResourceHandle::receivedCredential):
1855         (WebCore::ResourceHandle::receivedRequestToContinueWithoutCredential):
1856         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
1857         (WebCore::ResourceHandleInternal::initialize): Deleted.
1858         (WebCore::ResourceHandleInternal::applyAuthentication): Deleted.
1859         (WebCore::getFormElementsCount): Deleted.
1860         (WebCore::ResourceHandleInternal::setupPUT): Deleted.
1861         (WebCore::ResourceHandleInternal::setupPOST): Deleted.
1862         (WebCore::ResourceHandleInternal::setupFormData): Deleted.
1863         (WebCore::ResourceHandleInternal::didFinish): Deleted.
1864         (WebCore::ResourceHandleInternal::didFail): Deleted.
1865         (WebCore::ResourceHandleInternal::calculateWebTimingInformations): Deleted.
1866         (WebCore::ResourceHandleInternal::handleLocalReceiveResponse): Deleted.
1867         (WebCore::isHttpInfo): Deleted.
1868         (WebCore::isHttpRedirect): Deleted.
1869         (WebCore::isHttpAuthentication): Deleted.
1870         (WebCore::isHttpNotModified): Deleted.
1871         (WebCore::isAppendableHeader): Deleted.
1872         (WebCore::removeLeadingAndTrailingQuotes): Deleted.
1873         (WebCore::getProtectionSpace): Deleted.
1874         (WebCore::ResourceHandleInternal::willPrepareSendData): Deleted.
1875         (WebCore::ResourceHandleInternal::didReceiveHeaderLine): Deleted.
1876         (WebCore::ResourceHandleInternal::didReceiveAllHeaders): Deleted.
1877         (WebCore::ResourceHandleInternal::didReceiveContentData): Deleted.
1878         (WebCore::ResourceHandleInternal::readCallback): Deleted.
1879         (WebCore::ResourceHandleInternal::headerCallback): Deleted.
1880         (WebCore::ResourceHandleInternal::writeCallback): Deleted.
1881         (WebCore::ResourceHandleInternal::dispatchSynchronousJob): Deleted.
1882         (WebCore::ResourceHandleInternal::handleDataURL): Deleted.
1883         * platform/network/curl/ResourceHandleCurlDelegate.cpp: Added.
1884         (WebCore::ResourceHandleCurlDelegate::ResourceHandleCurlDelegate):
1885         (WebCore::ResourceHandleCurlDelegate::~ResourceHandleCurlDelegate):
1886         (WebCore::ResourceHandleCurlDelegate::hasHandle const):
1887         (WebCore::ResourceHandleCurlDelegate::releaseHandle):
1888         (WebCore::ResourceHandleCurlDelegate::start):
1889         (WebCore::ResourceHandleCurlDelegate::cancel):
1890         (WebCore::ResourceHandleCurlDelegate::setDefersLoading):
1891         (WebCore::ResourceHandleCurlDelegate::setAuthentication):
1892         (WebCore::ResourceHandleCurlDelegate::dispatchSynchronousJob):
1893         (WebCore::ResourceHandleCurlDelegate::retain):
1894         (WebCore::ResourceHandleCurlDelegate::release):
1895         (WebCore::ResourceHandleCurlDelegate::setupRequest):
1896         (WebCore::ResourceHandleCurlDelegate::notifyFinish):
1897         (WebCore::ResourceHandleCurlDelegate::notifyFail):
1898         (WebCore::ResourceHandleCurlDelegate::response):
1899         (WebCore::ResourceHandleCurlDelegate::setupAuthentication):
1900         (WebCore::removeLeadingAndTrailingQuotes):
1901         (WebCore::ResourceHandleCurlDelegate::getProtectionSpace):
1902         (WebCore::isHttpInfo):
1903         (WebCore::isHttpRedirect):
1904         (WebCore::isHttpAuthentication):
1905         (WebCore::isHttpNotModified):
1906         (WebCore::isAppendableHeader):
1907         (WebCore::ResourceHandleCurlDelegate::didReceiveHeaderLine):
1908         (WebCore::ResourceHandleCurlDelegate::didReceiveAllHeaders):
1909         (WebCore::ResourceHandleCurlDelegate::didReceiveContentData):
1910         (WebCore::ResourceHandleCurlDelegate::handleLocalReceiveResponse):
1911         (WebCore::ResourceHandleCurlDelegate::prepareSendData):
1912         (WebCore::ResourceHandleCurlDelegate::didFinish):
1913         (WebCore::ResourceHandleCurlDelegate::didFail):
1914         (WebCore::ResourceHandleCurlDelegate::handleDataURL):
1915         (WebCore::ResourceHandleCurlDelegate::setupPOST):
1916         (WebCore::ResourceHandleCurlDelegate::setupPUT):
1917         (WebCore::ResourceHandleCurlDelegate::getFormElementsCount):
1918         (WebCore::ResourceHandleCurlDelegate::setupFormData):
1919         (WebCore::ResourceHandleCurlDelegate::applyAuthentication):
1920         (WebCore::ResourceHandleCurlDelegate::setWebTimings):
1921         (WebCore::ResourceHandleCurlDelegate::didReceiveHeader):
1922         (WebCore::ResourceHandleCurlDelegate::didReceiveData):
1923         (WebCore::ResourceHandleCurlDelegate::willSendData):
1924         (WebCore::ResourceHandleCurlDelegate::didReceiveHeaderCallback):
1925         (WebCore::ResourceHandleCurlDelegate::didReceiveDataCallback):
1926         (WebCore::ResourceHandleCurlDelegate::willSendDataCallback):
1927         * platform/network/curl/ResourceHandleCurlDelegate.h: Added.
1928
1929 2017-08-18  Ryosuke Niwa  <rniwa@webkit.org>
1930
1931         iOS 10 debug build fix.
1932
1933         * dom/DataTransfer.cpp:
1934         (WebCore::DataTransfer::DataTransfer):
1935
1936 2017-08-18  Ryosuke Niwa  <rniwa@webkit.org>
1937
1938         Rename DataTransferAccessPolicy to match spec and refactor related node
1939         https://bugs.webkit.org/show_bug.cgi?id=175704
1940
1941         Reviewed by Wenson Hsieh.
1942
1943         Renamed DataTransferAccessPolicy to DataTransfer::StoreMode to match the drag data store mode concept
1944         in the HTML5 specification:
1945         https://html.spec.whatwg.org/multipage/dnd.html#drag-data-store-mode
1946
1947         DataTransfer in addition to those states can be disassociated from the drag data store when it becomes
1948         no longer valid. We also support a special mode which allows only updating the drag image.
1949         These two states, Invalid and DragImageWritable, are added in addition to the three states in the spec.
1950
1951         Also split DragAndDrop type of DataTransfer into DragAndDropData and DragAndDropFiles, and refactored
1952         the related code.
1953
1954         No new tests since there should be no behavioral change.
1955
1956         * WebCore.xcodeproj/project.pbxproj:
1957         * dom/DataTransfer.cpp:
1958         (WebCore::DataTransfer::DataTransfer): No longer takes forFileDrag boolean since it's folded into type.
1959         (WebCore::DataTransfer::createForCopyAndPaste):
1960         (WebCore::DataTransfer::~DataTransfer):
1961         (WebCore::DataTransfer::setAccessPolicy): Deleted.
1962         (WebCore::DataTransfer::canReadTypes const):
1963         (WebCore::DataTransfer::canReadData const):
1964         (WebCore::DataTransfer::canWriteData const):
1965         (WebCore::DataTransfer::createForInputEvent):
1966         (WebCore::DataTransfer::createForDrag):
1967         (WebCore::DataTransfer::createForDrop):
1968         (WebCore::DataTransfer::canSetDragImage const):
1969         * dom/DataTransfer.h:
1970         (WebCore::DataTransfer::makeInvalidForSecurity): Added.
1971         (WebCore::DataTransfer::makeDragImageWritable): Added.
1972         * dom/DataTransferAccessPolicy.h: Removed.
1973         * editing/Editor.cpp:
1974         (WebCore::dispatchClipboardEvent): Moved and renamed from dispatchCPPEvent. Now computes the store mode
1975         inside the function to match the spec: https://w3c.github.io/clipboard-apis/#fire-a-clipboard-event
1976         (WebCore::Editor::canDHTMLCut):
1977         (WebCore::Editor::canDHTMLCopy):
1978         (WebCore::Editor::canDHTMLPaste):
1979         (WebCore::Editor::tryDHTMLCopy):
1980         (WebCore::Editor::tryDHTMLCut):
1981         (WebCore::Editor::tryDHTMLPaste):
1982         (WebCore::Editor::dispatchCPPEvent): Deleted.
1983         * editing/Editor.h:
1984         * page/DragController.cpp:
1985         (WebCore::createDataTransferToUpdateDrag): Extracted to share code.
1986         (WebCore::DragController::dragExited):
1987         (WebCore::DragController::performDragOperation):
1988         (WebCore::DragController::tryDHTMLDrag):
1989         * page/EventHandler.cpp:
1990         (WebCore::EventHandler::invalidateDataTransfer):
1991         (WebCore::EventHandler::handleDrag):
1992
1993 2017-08-18  Said Abou-Hallawa  <sabouhallawa@apple.com>
1994
1995         Followup (r220289): RenderImageResourceStyleImage code clean up
1996         https://bugs.webkit.org/show_bug.cgi?id=175444
1997
1998         Reviewed by Darin Adler.
1999
2000         RenderImageResourceStyleImage may be created with a StyleImage of type
2001         StyleGeneratedImage. It may also be associated with a CachedImage which 
2002         is loaded through a source URL. In this case, adding and removing m_renderer
2003         as a client of the CachedImage will be done through 
2004         RenderImageResource::setCachedImage().
2005
2006         RenderImageResource::setCachedImage() is already called from 
2007         ImageLoader::updateRenderer() when the CachedImage finishes loading. This
2008         call adds m_renderer to the clients of the CachedImage. 
2009         RenderImageResource::setCachedImage() will also be called from 
2010         RenderImageResourceStyleImage::shutdown() via RenderImageResource::shutdown()
2011         to remove m_renderer from the clients of CachedImage by passing a null pointer.
2012
2013         * rendering/RenderImage.cpp:
2014         (WebCore::RenderImage::styleWillChange):
2015         * rendering/RenderImageResource.cpp:
2016         (WebCore::RenderImageResource::initialize):
2017         (WebCore::RenderImageResource::shutdown):
2018         (WebCore::RenderImageResource::setCachedImage):
2019         (WebCore::RenderImageResource::resetAnimation):
2020         (WebCore::RenderImageResource::image const):
2021         (WebCore::RenderImageResource::setContainerSizeForRenderer):
2022         (WebCore::RenderImageResource::imageSize const):
2023         (WebCore::RenderImageResource::~RenderImageResource): Deleted.
2024         (WebCore::RenderImageResource::errorOccurred const): Deleted.
2025         (WebCore::RenderImageResource::imageHasRelativeWidth const): Deleted.
2026         (WebCore::RenderImageResource::imageHasRelativeHeight const): Deleted.
2027         (WebCore::RenderImageResource::intrinsicSize const): Deleted.
2028         (WebCore::RenderImageResource::getImageSize const): Deleted.
2029         * rendering/RenderImageResource.h:
2030         (WebCore::RenderImageResource::initialize):
2031         (WebCore::RenderImageResource::renderer const):
2032         (WebCore::RenderImageResource::errorOccurred const):
2033         (WebCore::RenderImageResource::imageHasRelativeWidth const):
2034         (WebCore::RenderImageResource::imageHasRelativeHeight const):
2035         (WebCore::RenderImageResource::imageSize const):
2036         (WebCore::RenderImageResource::intrinsicSize const):
2037         (WebCore::RenderImageResource::imagePtr const):
2038         * rendering/RenderImageResourceStyleImage.cpp:
2039         (WebCore::RenderImageResourceStyleImage::initialize):
2040         (WebCore::RenderImageResourceStyleImage::shutdown):
2041         (WebCore::RenderImageResourceStyleImage::image const):
2042         (WebCore::RenderImageResourceStyleImage::setContainerSizeForRenderer):
2043         (WebCore::RenderImageResourceStyleImage::~RenderImageResourceStyleImage): Deleted.
2044         * rendering/RenderImageResourceStyleImage.h:
2045         * rendering/RenderSnapshottedPlugIn.cpp:
2046         (WebCore::RenderSnapshottedPlugIn::RenderSnapshottedPlugIn):
2047         * rendering/svg/RenderSVGImage.cpp:
2048         (WebCore::RenderSVGImage::RenderSVGImage):
2049
2050 2017-08-18  Jiewen Tan  <jiewen_tan@apple.com>
2051
2052         [WebCrypto][Mac] Replace CCECCryptorGetKeyComponents with CCECCryptorExportKey for exporting ECC JWKs
2053         https://bugs.webkit.org/show_bug.cgi?id=175657
2054         <rdar://problem/33797150>
2055
2056         Reviewed by Brent Fulgham.
2057
2058         CCECCryptorGetKeyComponents returns components in unpadded formats. In some minor cases, the ECC components
2059         do need padding. Therefore, we occasionally see some corrupted outputs in JWKs. To overcome that, this patch
2060         replaces CCECCryptorGetKeyComponents with CCECCryptorExportKey which does padding all the time.
2061
2062         In the meantime, this patch also makes export* methods return OperationError if any error occur in the
2063         underlying operations though very unlikely.
2064
2065         Test: crypto/subtle/ecdsa-generate-export-import-jwk-sign-verify.html
2066
2067         * crypto/algorithms/CryptoAlgorithmECDH.cpp:
2068         (WebCore::CryptoAlgorithmECDH::exportKey):
2069         * crypto/algorithms/CryptoAlgorithmECDSA.cpp:
2070         (WebCore::CryptoAlgorithmECDSA::exportKey):
2071         * crypto/gcrypt/CryptoKeyECGCrypt.cpp:
2072         (WebCore::CryptoKeyEC::platformAddFieldElements const):
2073         * crypto/keys/CryptoKeyEC.cpp:
2074         (WebCore::CryptoKeyEC::exportRaw const):
2075         (WebCore::CryptoKeyEC::exportJwk const):
2076         (WebCore::CryptoKeyEC::exportSpki const):
2077         (WebCore::CryptoKeyEC::exportPkcs8 const):
2078         * crypto/keys/CryptoKeyEC.h:
2079         * crypto/mac/CryptoKeyECMac.cpp:
2080         (WebCore::CryptoKeyEC::platformExportRaw const):
2081         (WebCore::CryptoKeyEC::platformAddFieldElements const):
2082         (WebCore::CryptoKeyEC::platformExportSpki const):
2083         (WebCore::CryptoKeyEC::platformExportPkcs8 const):
2084
2085 2017-08-18  Per Arne Vollan  <pvollan@apple.com>
2086
2087         [Win] accessibility/heading-crash-after-hidden.html is a flaky crash.
2088         https://bugs.webkit.org/show_bug.cgi?id=173536
2089
2090         Reviewed by Brent Fulgham.
2091
2092         If the tree state is dirty, accessible objects are deleted while iterating over children
2093         under AccessibilityNodeObject::textUnderElement when the style is updated. Make sure the
2094         style is updated before this method is called.
2095
2096         No new tests, covered by existing tests.
2097
2098         * accessibility/win/AccessibilityObjectWrapperWin.cpp:
2099         (WebCore::AccessibilityObjectWrapper::accessibilityAttributeValue):
2100
2101 2017-08-18  Youenn Fablet  <youenn@apple.com>
2102
2103         [Cache API] Add response body storage
2104         https://bugs.webkit.org/show_bug.cgi?id=175658
2105
2106         Reviewed by Alex Christensen.
2107
2108         Covered by rebased tests.
2109         Tests are still flaky until waiting for end of fetch load is implemented.
2110
2111         Adding a response body within CacheStorageConnection::Record.
2112         Adding ability to pass this body from/to the main thread.
2113
2114         Adding response body consumption into a CacheStorageConnection::Record.
2115         Adding response body setting from a CacheStorageConnection::Record.
2116
2117         * Modules/beacon/NavigatorBeacon.cpp:
2118         (WebCore::NavigatorBeacon::sendBeacon):
2119         * Modules/cache/Cache.cpp:
2120         (WebCore::Cache::put):
2121         (WebCore::toConnectionRecord):
2122         (WebCore::Cache::updateRecords):
2123         * Modules/cache/CacheStorageConnection.cpp:
2124         (WebCore::CacheStorageConnection::copyResponseBody):
2125         (WebCore::CacheStorageConnection::isolatedResponseBody):
2126         (WebCore::CacheStorageConnection::Record::copy const):
2127         * Modules/cache/CacheStorageConnection.h:
2128         * Modules/cache/WorkerCacheStorageConnection.cpp:
2129         (WebCore::toCrossThreadRecordData):
2130         (WebCore::fromCrossThreadRecordData):
2131         * Modules/fetch/FetchBody.cpp:
2132         (WebCore::FetchBody::bodyAsFormData const):
2133         (WebCore::FetchBody::take):
2134         (WebCore::FetchBody::bodyForInternalRequest const): Deleted.
2135         * Modules/fetch/FetchBody.h:
2136         (WebCore::FetchBody::setAsFormData):
2137         * Modules/fetch/FetchBodyConsumer.h:
2138         (WebCore::FetchBodyConsumer::setData):
2139         * Modules/fetch/FetchRequest.cpp:
2140         (WebCore::FetchRequest::resourceRequest const):
2141         * Modules/fetch/FetchResponse.cpp:
2142         (WebCore::FetchResponse::consumeBody):
2143         (WebCore::FetchResponse::setBodyData):
2144         * Modules/fetch/FetchResponse.h:
2145
2146 2017-08-18  Youenn Fablet  <youenn@apple.com>
2147
2148         [Fetch API] Add support for a callback-based fetch
2149         https://bugs.webkit.org/show_bug.cgi?id=175710
2150
2151         Reviewed by Alex Christensen.
2152
2153         No change of behavior.
2154
2155         Moving from a DOMPromise to a Callback taking an ExceptionOr<FetchResponse&>.
2156         Updating window and worker call sites.
2157
2158         * Modules/fetch/DOMWindowFetch.cpp:
2159         (WebCore::DOMWindowFetch::fetch):
2160         * Modules/fetch/FetchResponse.cpp:
2161         (WebCore::FetchResponse::fetch):
2162         (WebCore::FetchResponse::BodyLoader::didFail):
2163         (WebCore::FetchResponse::BodyLoader::BodyLoader):
2164         (WebCore::FetchResponse::BodyLoader::didReceiveResponse):
2165         (WebCore::FetchResponse::BodyLoader::stop):
2166         * Modules/fetch/FetchResponse.h:
2167         * Modules/fetch/WorkerGlobalScopeFetch.cpp:
2168         (WebCore::WorkerGlobalScopeFetch::fetch):
2169
2170 2017-08-18  Brady Eidson  <beidson@apple.com>
2171
2172         Bounce ServiceWorker jobs to the Storage Process.
2173         https://bugs.webkit.org/show_bug.cgi?id=175650
2174
2175         Reviewed by Andy Estes.
2176
2177         No new tests (Covered by both changes and consistencies in existing tests)
2178
2179         This lays the groundwork for the SW job queue being in the StorageProcess by actually
2180         setting up some objects for IPC communication and actually sending things over the wire.
2181
2182         The main point of IPC is the WebCore abstract base class "SWServer::Connection"
2183
2184         A collection of them will soon be managed by the SWServer itself in the StorageProcess.
2185
2186         That object will be the stand-in for IPC on both the WebProcess and StorageProcess side.
2187
2188         Currently, any job that we try to schedule still immediately rejects (though now it does
2189         so asynchronously instead of synchronously).
2190
2191         * CMakeLists.txt:
2192         * WebCore.xcodeproj/project.pbxproj:
2193
2194         * dom/ExceptionData.h: Copied from Source/WebCore/workers/service/ServiceWorkerProvider.h.
2195         (WebCore::ExceptionData::toException const):
2196         (WebCore::ExceptionData::encode const):
2197         (WebCore::ExceptionData::decode):
2198
2199         * workers/service/ServiceWorkerContainer.cpp:
2200         (WebCore::ServiceWorkerContainer::addRegistration):
2201         (WebCore::ServiceWorkerContainer::scheduleJob):
2202         * workers/service/ServiceWorkerContainer.h:
2203
2204         * workers/service/ServiceWorkerJob.cpp:
2205         (WebCore::ServiceWorkerJob::failedWithException):
2206         (WebCore::ServiceWorkerJob::data const):
2207         * workers/service/ServiceWorkerJob.h:
2208
2209         * workers/service/ServiceWorkerJobData.h: Copied from Source/WebCore/workers/service/ServiceWorkerProvider.h.
2210         (WebCore::ServiceWorkerJobData::encode const):
2211         (WebCore::ServiceWorkerJobData::decode):
2212
2213         * workers/service/ServiceWorkerJobType.h: Copied from Source/WebCore/workers/service/ServiceWorkerProvider.h.
2214
2215         * workers/service/ServiceWorkerProvider.h:
2216
2217         * workers/service/ServiceWorkerRegistrationParameters.h:
2218
2219         * workers/service/server/SWServer.cpp: Copied from Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.cpp.
2220         (WebCore::SWServer::Connection::scheduleJob):
2221         (WebCore::SWServer::Connection::jobRejected):
2222         * workers/service/server/SWServer.h: Copied from Source/WebCore/workers/service/ServiceWorkerProvider.h.
2223         (WebCore::SWServer::Connection::~Connection):
2224
2225 2017-08-18  Chris Dumez  <cdumez@apple.com>
2226
2227         [Beacon] Add support for quota limitation
2228         https://bugs.webkit.org/show_bug.cgi?id=175443
2229         <rdar://problem/33729002>
2230
2231         Reviewed by Youenn Fablet.
2232
2233         LoaderStrategy::startPingLoad() now takes a completion handler parameter, allowing CachedResource::load()
2234         to know when a Beacon load is complete. This was needed in order for the fetch in-flight keepalive request
2235         quota limit to work properly for beacon loads as well. We need to know when the beacon load completes in
2236         order to know if the beacon is in-flight or not and only free up its allocated quota once it is no longer
2237         in-flight.
2238
2239         No new tests, updated existing test.
2240
2241         * loader/LoaderStrategy.h:
2242         * loader/PingLoader.cpp:
2243         (WebCore::PingLoader::startPingLoad):
2244         * loader/cache/CachedResource.cpp:
2245         (WebCore::CachedResource::load):
2246         * platform/network/PingHandle.h:
2247
2248 2017-08-18  Youenn Fablet  <youenn@apple.com>
2249
2250         [Cache API] Add a WK2 implementation of CacheStorageConnection
2251         https://bugs.webkit.org/show_bug.cgi?id=175640
2252
2253         Reviewed by Alex Christensen & Chris Dumez.
2254
2255         * Modules/cache/CacheStorageConnection.cpp: Adding Internal error.
2256         * Modules/cache/CacheStorageConnection.h: Ditto.
2257         * WebCore.xcodeproj/project.pbxproj: Exporting CacheQueryOptions.h header.
2258
2259 2017-08-18  Antti Koivisto  <antti@apple.com>
2260
2261         Factor render tree mutation code from RenderListItem to RenderTreeUpdater
2262         https://bugs.webkit.org/show_bug.cgi?id=175718
2263
2264         Reviewed by Andreas Kling.
2265
2266         We already stopped doing layout time mutations. We can now move the code out too.
2267
2268         * WebCore.xcodeproj/project.pbxproj:
2269         * rendering/RenderListItem.cpp:
2270         (WebCore::isHTMLListElement):
2271         (WebCore::getParentOfFirstLineBox): Deleted.
2272         (WebCore::firstNonMarkerChild): Deleted.
2273         (WebCore::RenderListItem::updateMarkerRenderer): Deleted.
2274
2275             Moved to RenderTreeUpdater::ListItem.
2276
2277         * rendering/RenderListItem.h:
2278         * rendering/RenderListMarker.cpp:
2279         (WebCore::RenderListMarker::willBeDestroyed):
2280         * rendering/TextAutoSizing.cpp:
2281         (WebCore::TextAutoSizingValue::adjustTextNodeSizes):
2282         * style/RenderTreeUpdater.cpp:
2283         (WebCore::RenderTreeUpdater::pushParent):
2284         (WebCore::RenderTreeUpdater::popParent):
2285         (WebCore::RenderTreeUpdater::updateBeforeDescendants):
2286         (WebCore::RenderTreeUpdater::updateAfterDescendants):
2287
2288             Factor pre/post update into functions.
2289
2290         (WebCore::RenderTreeUpdater::updateBeforeOrAfterPseudoElement):
2291         * style/RenderTreeUpdater.h:
2292         * style/RenderTreeUpdaterListItem.cpp: Added.
2293
2294             Mutation functions move here.
2295
2296         (WebCore::getParentOfFirstLineBox):
2297         (WebCore::firstNonMarkerChild):
2298         (WebCore::RenderTreeUpdater::ListItem::updateMarker):
2299         * style/RenderTreeUpdaterListItem.h: Added.
2300
2301 2017-08-18  Ms2ger  <Ms2ger@gmail.com>
2302
2303         [GTK] Show controls if a video element isn't allowed to play inline.
2304         https://bugs.webkit.org/show_bug.cgi?id=141705
2305
2306         Reviewed by Xabier Rodriguez-Calvar.
2307
2308         Test: covered by media/video-fullscreeen-only-controls.html [sic].
2309
2310         * Modules/mediacontrols/mediaControlsGtk.js:
2311         (ControllerGtk.prototype.shouldHaveControls):
2312
2313 2017-08-18  Zan Dobersek  <zdobersek@igalia.com>
2314
2315         [EME] MediaKeySession has to initiate playback resume on HTMLMediaElement
2316         https://bugs.webkit.org/show_bug.cgi?id=175671
2317
2318         Reviewed by Xabier Rodriguez-Calvar.
2319
2320         In MediaKeySession::updateKeyStatuses(), HTMLMediaElement objects that are
2321         associated with the MediaKeys instance that created this session have to
2322         be notified in order to run the 'Attempt to Resume Playback If Necessary'
2323         algorithm.
2324
2325         MediaKeys object now tracks the sessions that were created through it.
2326         MediaKeySession object is passed a MediaKeys reference, and has that
2327         reference invalidated if/when the MediaKeys object is destroyed.
2328
2329         In MediaKeySession::updateKeyStatuses(), a task is now queued, notifying
2330         the MediaKeys object, if any, that the associated HTMLMediaElement
2331         instances have to run the mentioned algorithm. The associated media
2332         elements are stored through CDMClient pointers, with HTMLMediaElement
2333         class inheriting from the newly-introduced CDMClient interface.
2334
2335         HTMLMediaElement::cdmClientAttemptToResumePlaybackIfNecessary() is left
2336         unimplemented for now. The object will attach itself to and detach from
2337         the associated MediaKeys object in setMediaKeys() and the destructor,
2338         enabling the MediaKeys object to properly dispatch the playback resume
2339         requests for the attached clients.
2340
2341         * Modules/encryptedmedia/CDMClient.h: Copied from Source/WebCore/Modules/encryptedmedia/MediaKeys.h.
2342         (WebCore::CDMClient::~CDMClient):
2343         * Modules/encryptedmedia/MediaKeySession.cpp:
2344         (WebCore::MediaKeySession::create):
2345         (WebCore::MediaKeySession::MediaKeySession):
2346         (WebCore::MediaKeySession::detachKeys):
2347         (WebCore::MediaKeySession::updateKeyStatuses):
2348         * Modules/encryptedmedia/MediaKeySession.h:
2349         * Modules/encryptedmedia/MediaKeys.cpp:
2350         (WebCore::MediaKeys::~MediaKeys):
2351         (WebCore::MediaKeys::createSession):
2352         (WebCore::MediaKeys::attachCDMClient):
2353         (WebCore::MediaKeys::detachCDMClient):
2354         (WebCore::MediaKeys::attemptToResumePlaybackOnClients):
2355         * Modules/encryptedmedia/MediaKeys.h:
2356         * html/HTMLMediaElement.cpp:
2357         (WebCore::HTMLMediaElement::cdmClientAttemptToResumePlaybackIfNecessary):
2358         * html/HTMLMediaElement.h:
2359
2360 2017-08-18  Commit Queue  <commit-queue@webkit.org>
2361
2362         Unreviewed, rolling out r220854.
2363         https://bugs.webkit.org/show_bug.cgi?id=175716
2364
2365         I'm not sure we really need this (Requested by KaL on
2366         #webkit).
2367
2368         Reverted changeset:
2369
2370         "[GTK][WPE] Add NTLM authentication enabled API"
2371         https://bugs.webkit.org/show_bug.cgi?id=122952
2372         http://trac.webkit.org/changeset/220854
2373
2374 2017-08-17  Wenson Hsieh  <wenson_hsieh@apple.com>
2375
2376         [Input Events] Rename inputType "formatForeColor" to "formatFontColor"
2377         https://bugs.webkit.org/show_bug.cgi?id=175703
2378
2379         Reviewed by Ryosuke Niwa.
2380
2381         Renames an inputType value to match the spec. There is no other change in behavior.
2382         Rebaselines fast/events/input-events-selection-forecolor-data.html and fast/events/input-events-forecolor-data.html.
2383
2384         * editing/EditCommand.cpp:
2385         (WebCore::inputTypeNameForEditingAction):
2386
2387 2017-08-17  Daewoong Jang  <daewoong.jang@navercorp.com>
2388
2389         [Curl] Improve multi-threaded networking
2390         https://bugs.webkit.org/show_bug.cgi?id=175253
2391
2392         Reviewed by Alex Christensen.
2393
2394         * platform/network/curl/CurlContext.cpp:
2395         (WebCore::CurlMultiHandle::CurlMultiHandle):
2396         (WebCore::CurlHandle::CurlHandle):
2397         (WebCore::CurlHandle::initialize):
2398         (WebCore::CurlHandle::setSslKeyPassword):
2399         (WebCore::CurlHandle::setSslErrors):
2400         (WebCore::CurlHandle::getSslErrors):
2401         * platform/network/curl/CurlContext.h:
2402         * platform/network/curl/CurlDownload.cpp:
2403         (WebCore::CurlDownload::init):
2404         (WebCore::CurlDownload::getResponse const):
2405         (WebCore::CurlDownload::setupRequest):
2406         (WebCore::CurlDownload::didReceiveHeader):
2407         (WebCore::CurlDownload::didReceiveData):
2408         (WebCore::CurlDownload::headerCallback):
2409         (WebCore::CurlDownload::getTempPath const): Deleted.
2410         (WebCore::CurlDownload::getUrl const): Deleted.
2411         (WebCore::CurlDownload::downloadFinishedCallback): Deleted.
2412         (WebCore::CurlDownload::downloadFailedCallback): Deleted.
2413         (WebCore::CurlDownload::receivedDataCallback): Deleted.
2414         (WebCore::CurlDownload::receivedResponseCallback): Deleted.
2415         * platform/network/curl/CurlDownload.h:
2416         * platform/network/curl/ResourceError.h:
2417         (WebCore::ResourceError::ResourceError):
2418         (WebCore::ResourceError::sslErrors const):
2419         (WebCore::ResourceError::setSSLErrors): Deleted.
2420         * platform/network/curl/ResourceHandleCurl.cpp:
2421         (WebCore::ResourceHandleInternal::initialize):
2422         (WebCore::ResourceHandleInternal::didFail):
2423         (WebCore::ResourceHandleInternal::dispatchSynchronousJob):
2424         * platform/network/curl/SSLHandle.cpp:
2425         (WebCore::allowedClientHosts):
2426         (WebCore::addAllowedClientCertificate):
2427         (WebCore::getSSLClientCertificate):
2428         (WebCore::certVerifyCallback):
2429         (WebCore::setSSLVerifyOptions):
2430         (WebCore::setSSLClientCertificate): Deleted.
2431         * platform/network/curl/SSLHandle.h:
2432
2433 2017-08-17  Chris Dumez  <cdumez@apple.com>
2434
2435         Regression(r220817): We should only copy the original request headers for Ping loads
2436         https://bugs.webkit.org/show_bug.cgi?id=175679
2437
2438         Reviewed by Youenn Fablet.
2439
2440         For performance reason, we should only copy the original request headers for Ping loads
2441         (Beacon at the moment), not for all CachedResourceRequests.
2442
2443         * loader/LoaderStrategy.h:
2444         * loader/cache/CachedResource.cpp:
2445         (WebCore::CachedResource::CachedResource):
2446         (WebCore::CachedResource::load):
2447         * loader/cache/CachedResource.h:
2448         (WebCore::CachedResource::shouldUsePingLoad):
2449         (WebCore::CachedResource::setOriginalRequestHeaders):
2450         * loader/cache/CachedResourceLoader.cpp:
2451         (WebCore::CachedResourceLoader::requestResource):
2452         * loader/cache/CachedResourceRequest.cpp:
2453         (WebCore::CachedResourceRequest::CachedResourceRequest):
2454         * loader/cache/CachedResourceRequest.h:
2455         (WebCore::CachedResourceRequest::releaseResourceRequest):
2456         (WebCore::CachedResourceRequest::releaseOriginalRequestHeaders): Deleted.
2457
2458 2017-08-17  Don Olmstead  <don.olmstead@sony.com>
2459
2460         [PAL] Relocate SessionID to root
2461         https://bugs.webkit.org/show_bug.cgi?id=175684
2462
2463         Reviewed by Alex Christensen.
2464
2465         No new tests. No change in functionality.
2466
2467         * dom/Document.h:
2468         * html/HTMLMediaElement.cpp:
2469         * loader/cache/CachedResource.h:
2470         * loader/cache/CachedResourceLoader.cpp:
2471         * loader/cache/MemoryCache.h:
2472         * loader/cocoa/DiskCacheMonitorCocoa.h:
2473         * page/CacheStorageProvider.h:
2474         * page/Page.h:
2475         * page/PlugInClient.h:
2476         * page/SocketProvider.h:
2477         * platform/CookiesStrategy.h:
2478         * platform/WebCoreCrossThreadCopier.cpp:
2479         * platform/network/CacheValidation.h:
2480         * platform/network/NetworkStorageSession.cpp:
2481         * platform/network/NetworkStorageSession.h:
2482         * platform/network/cf/SocketStreamHandleImpl.h:
2483         * platform/network/curl/SocketStreamHandleImpl.h:
2484         * platform/network/soup/SocketStreamHandleImpl.h:
2485         * workers/WorkerGlobalScope.h:
2486         * workers/service/ServiceWorkerContainer.h:
2487         * workers/service/ServiceWorkerRegistrationParameters.h:
2488
2489 2017-08-17  Wenson Hsieh  <wenson_hsieh@apple.com>
2490
2491         Fix the build on other platforms after r220865
2492         https://bugs.webkit.org/show_bug.cgi?id=175683
2493
2494         Reviewed by Tim Horton.
2495
2496         Instead of special casing iOS 10 behavior with __IPHONE_OS_VERSION_MAX_ALLOWED < 110000, revert to special
2497         casing iOS 11 behavior with __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000. This is because other targets that are
2498         neither iOS 10 nor 11 will fail the "before iOS 11" compile-time check, and subsequently assume that item
2499         providers exist. To fix this, flip the compiler-time checks and the order of codeblocks in the
2500         PlatformPasteboard::write methods.
2501
2502         There is no change in behavior.
2503
2504         * platform/ios/PlatformPasteboardIOS.mm:
2505         (WebCore::registerItemToPasteboard):
2506         (WebCore::PlatformPasteboard::write):
2507
2508 2017-08-17  Michael Catanzaro  <mcatanzaro@igalia.com>
2509
2510         -Wreturn-type warnings in CryptoKey.cpp and SubtleCrypto.cpp
2511         https://bugs.webkit.org/show_bug.cgi?id=175675
2512
2513         Reviewed by Jiewen Tan.
2514
2515         * crypto/CryptoKey.cpp:
2516         (WebCore::CryptoKey::algorithm const):
2517         * crypto/SubtleCrypto.cpp:
2518         (WebCore::toCryptoKeyUsageBitmap):
2519         (WebCore::toKeyData):
2520
2521 2017-08-17  Andreas Kling  <akling@apple.com>
2522
2523         Disable CSS regions at compile time
2524         https://bugs.webkit.org/show_bug.cgi?id=175630
2525
2526         Reviewed by Antti Koivisto.
2527
2528         * Configurations/FeatureDefines.xcconfig:
2529
2530 2017-08-17  Wenson Hsieh  <wenson_hsieh@apple.com>
2531
2532         [iOS] Respect type fidelities when copying image elements to the pasteboard
2533         https://bugs.webkit.org/show_bug.cgi?id=175638
2534         <rdar://problem/26556043>
2535
2536         Reviewed by Ryosuke Niwa.
2537
2538         Ensures that we respect type fidelities when copying on iOS, by unifying pasteboard writing codepaths across
2539         dragging and copying. When dragging and copying, we now generate and set UIItemProviders on the UIPasteboard.
2540
2541         Tests: ActionSheetTests.CopyImageElementWithHREF
2542                ActionSheetTests.CopyImageElementWithoutHREF
2543
2544         * platform/PlatformPasteboard.h:
2545
2546         Remove all variants of the writeObjectRepresentations helper method. Now that both paths for writing to the
2547         pasteboard are unified, it's no longer useful to separate out item-provider-based pasteboard logic.
2548
2549         * platform/ios/AbstractPasteboard.h:
2550         * platform/ios/PlatformPasteboardIOS.mm:
2551
2552         Replaces -setItemsUsingRegistrationInfoLists: with -setRegistrationInfoLists:. Rather than have a helper that
2553         both sets up item providers and item registration lists, split this functionality out into two setters. This is
2554         because UIPasteboard does not need to know about the registration info lists used to set up the item providers
2555         in the first place, but internal drag-and-drop clients require this information immediately when starting a drag
2556         in order to construct custom drag previews.
2557
2558         (WebCore::richTextRepresentationsForPasteboardWebContent):
2559         (WebCore::registerItemToPasteboard):
2560
2561         Add a new helper to register item providers to the pasteboard, given an WebItemProviderRegistrationInfoList.
2562
2563         (WebCore::PlatformPasteboard::write):
2564         (WebCore::PlatformPasteboard::writeObjectRepresentations): Deleted.
2565
2566         Refactors PlatformPasteboard::write to always generate and set item providers, unless we're building for an SDK
2567         prior to iOS 11. For images, strings and URLs, we can simply transition to using the new item-provider-based
2568         codepaths used for drag and drop. For web content, we add two additional UTIs that were present when copying,
2569         but not when dragging: flat RTFD and a string constant used to indicate to UIKit that the pasteboard contains
2570         rich text.
2571
2572         * platform/ios/WebItemProviderPasteboard.h:
2573         * platform/ios/WebItemProviderPasteboard.mm:
2574         (-[WebItemProviderRegistrationInfoList init]):
2575         (-[WebItemProviderRegistrationInfoList addData:forType:]):
2576         (-[WebItemProviderRegistrationInfoList addRepresentingObject:]):
2577         (-[WebItemProviderRegistrationInfoList numberOfItems]):
2578         (-[WebItemProviderRegistrationInfoList itemAtIndex:]):
2579         (-[WebItemProviderRegistrationInfoList itemProvider]):
2580         (-[WebItemProviderRegistrationInfoList description]):
2581
2582         Make some small tweaks in WebItemProviderPasteboard (and related classes):
2583         1. Transition to preferredPresentationSize from estimatedDisplayedSize, which is now deprecated.
2584         2. Remove calls to -initWithItemProviderData:typeIdentifier:error:, which is deprecated.
2585         3. Rename _items to _representations to better reflect the role of WebItemProviderRegistrationInfo.
2586         4. Implement -description for WebItemProviderRegistrationInfoList for debugging purposes.
2587
2588         (-[WebItemProviderPasteboard valuesForPasteboardType:inItemSet:]):
2589         (-[WebItemProviderPasteboard setRegistrationInfoLists:]):
2590         (-[WebItemProviderPasteboard setItemsUsingRegistrationInfoLists:]): Deleted.
2591
2592 2017-08-17  Youenn Fablet  <youenn@apple.com>
2593
2594         Add a DOMPromiseDeferred method to handle ExceptionOr<> results
2595         https://bugs.webkit.org/show_bug.cgi?id=175603
2596
2597         Reviewed by Darin Adler.
2598
2599         No change of behavior.
2600
2601         Introduce DOMPromiseDeferred::settle to reject/resolve a promise with an ExceptionOr<>.
2602         Making batchPutOperation/batchDeleteOperation take a Function with an ExceptionOr<>.
2603         Using DOMPromiseDeferred::settle in Cache put/remove.
2604         Updated CacheStorageConnection to create ExceptionOr<> from CacheStorageConnection::Error.
2605
2606         * Modules/cache/Cache.cpp:
2607         (WebCore::Cache::put):
2608         (WebCore::Cache::remove):
2609         (WebCore::Cache::batchDeleteOperation):
2610         (WebCore::Cache::batchPutOperation):
2611         * Modules/cache/Cache.h:
2612         * Modules/cache/CacheStorage.cpp:
2613         (WebCore::CacheStorage::open):
2614         (WebCore::CacheStorage::remove):
2615         * Modules/cache/CacheStorageConnection.cpp:
2616         (WebCore::CacheStorageConnection::errorToException):
2617         * Modules/cache/CacheStorageConnection.h:
2618         (WebCore::CacheStorageConnection::errorToException):
2619         (WebCore::CacheStorageConnection::exceptionOrResult):
2620         * bindings/js/JSDOMPromiseDeferred.h:
2621         (WebCore::DOMPromiseDeferred::settle):
2622         (WebCore::DOMPromiseDeferred<void>::settle):
2623
2624 2017-08-17  Zan Dobersek  <zdobersek@igalia.com>
2625
2626         [GStreamer] AppendPipeline: support dispatch of decryption-specific GstStructure into the pipeline
2627         https://bugs.webkit.org/show_bug.cgi?id=175668
2628
2629         Reviewed by Xabier Rodriguez-Calvar.
2630
2631         Add the AppendPipeline::dispatchDecryptionStructure() method. Callers can
2632         pass in a GstStructure object that contains all the information the
2633         decryption elements in the pipeline will require to properly decrypt the
2634         content. In case the decryptor element isn't available yet, the
2635         GstStructure is stored and dispatched when that element becomes available.
2636
2637         The dispatch itself simply creates a new custom GstEvent that adopts the
2638         given GstStructure object, sends that into the pipeline element, and
2639         shifts the state to 'ongoing'.
2640
2641         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
2642         (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsinkFromAnyThread):
2643         (WebCore::AppendPipeline::dispatchPendingDecryptionStructure):
2644         (WebCore::AppendPipeline::dispatchDecryptionStructure):
2645         * platform/graphics/gstreamer/mse/AppendPipeline.h: Remove a redundant private: label.
2646
2647 2017-08-17  Zan Dobersek  <zdobersek@igalia.com>
2648
2649         [GStreamer] GstStructure shouldn't be handled through GRefPtr
2650         https://bugs.webkit.org/show_bug.cgi?id=175673
2651
2652         Reviewed by Xabier Rodriguez-Calvar.
2653
2654         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
2655         (webkitMediaCommonEncryptionDecryptTransformCaps): GstStructure isn't
2656         ref-counted, so it should be handled through the GUniquePtr<GstStructure>
2657         smart pointer.
2658
2659 2017-08-17  Youenn Fablet  <youenn@apple.com>
2660
2661         [Mac/iOS] Increase the audio buffer size when audio capture is on but web audio is not used
2662         https://bugs.webkit.org/show_bug.cgi?id=175631
2663
2664         Reviewed by Eric Carlson.
2665
2666         * platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
2667         (PlatformMediaSessionManager::updateSessionState): Change value from 128 to the equivalent of 20ms when audio capture happens but not web audio.
2668
2669 2017-08-17  Antti Koivisto  <antti@apple.com>
2670
2671         RenderListItem - Avoid render tree mutation during layout
2672         https://bugs.webkit.org/show_bug.cgi?id=175666
2673
2674         Reviewed by Andreas Kling.
2675
2676         Mutations should be done by RenderTreeUpdater only.
2677
2678         * rendering/RenderListItem.cpp:
2679         (WebCore::RenderListItem::updateMarkerRenderer):
2680
2681             This is now called by RenderTreeUpdater only.
2682             Remove code dealing with this being called at layout time.
2683             Merged marker construction code from styleDidChange here and renamed for clarity.
2684
2685         (WebCore::RenderListItem::layout):
2686         (WebCore::RenderListItem::computePreferredLogicalWidths):
2687
2688             Remove mutating calls.
2689
2690         (WebCore::RenderListItem::styleDidChange): Deleted.
2691         (WebCore::RenderListItem::insertOrMoveMarkerRendererIfNeeded): Deleted.
2692         * rendering/RenderListItem.h:
2693         * rendering/TextAutoSizing.cpp:
2694         (WebCore::TextAutoSizingValue::adjustTextNodeSizes):
2695
2696             Call updateMarkerRenderer.
2697
2698         * style/RenderTreeUpdater.cpp:
2699         (WebCore::RenderTreeUpdater::popParent):
2700         (WebCore::RenderTreeUpdater::updateBeforeOrAfterPseudoElement):
2701
2702             Call updateMarkerRenderer.
2703
2704 2017-08-17  Don Olmstead  <don.olmstead@sony.com>
2705
2706         [PAL] Move SessionID into PAL
2707         https://bugs.webkit.org/show_bug.cgi?id=174192
2708
2709         Reviewed by Antti Koivisto.
2710
2711         No new tests. No change in behavior.
2712
2713         * CMakeLists.txt:
2714         * Modules/websockets/WebSocketChannel.cpp:
2715         (WebCore::WebSocketChannel::connect):
2716         * WebCore.xcodeproj/project.pbxproj:
2717         * dom/Document.cpp:
2718         (WebCore::Document::sessionID const):
2719         * dom/Document.h:
2720         * dom/ScriptExecutionContext.h:
2721         * html/HTMLMediaElement.cpp:
2722         (WebCore::HTMLMediaElement::elementWithID):
2723         (WebCore::HTMLMediaElement::finishParsingChildren):
2724         (WebCore::HTMLMediaElement::scheduleEvent):
2725         (WebCore::HTMLMediaElement::canPlayType const):
2726         (WebCore::HTMLMediaElement::load):
2727         (WebCore::HTMLMediaElement::loadResource):
2728         (WebCore::HTMLMediaElement::textTracksAreReady const):
2729         (WebCore::HTMLMediaElement::textTrackModeChanged):
2730         (WebCore::HTMLMediaElement::noneSupported):
2731         (WebCore::HTMLMediaElement::mediaLoadingFailedFatally):
2732         (WebCore::HTMLMediaElement::mediaLoadingFailed):
2733         (WebCore::HTMLMediaElement::setReadyState):
2734         (WebCore::HTMLMediaElement::addPlayedRange):
2735         (WebCore::HTMLMediaElement::seekTask):
2736         (WebCore::HTMLMediaElement::refreshCachedTime const):
2737         (WebCore::HTMLMediaElement::currentMediaTime const):
2738         (WebCore::HTMLMediaElement::setWebkitPreservesPitch):
2739         (WebCore::HTMLMediaElement::ended const):
2740         (WebCore::HTMLMediaElement::playInternal):
2741         (WebCore::HTMLMediaElement::pause):
2742         (WebCore::HTMLMediaElement::togglePlayState):
2743         (WebCore::HTMLMediaElement::beginScrubbing):
2744         (WebCore::HTMLMediaElement::playbackProgressTimerFired):
2745         (WebCore::HTMLMediaElement::mediaPlayerDidAddTextTrack):
2746         (WebCore::HTMLMediaElement::didAddTextTrack):
2747         (WebCore::HTMLMediaElement::didRemoveTextTrack):
2748         (WebCore::controllerJSValue):
2749         (WebCore::HTMLMediaElement::configureTextTracks):
2750         (WebCore::HTMLMediaElement::selectNextSourceChild):
2751         (WebCore::HTMLMediaElement::sourceWasAdded):
2752         (WebCore::HTMLMediaElement::sourceWasRemoved):
2753         (WebCore::HTMLMediaElement::mediaPlayerTimeChanged):
2754         (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged):
2755         (WebCore::HTMLMediaElement::potentiallyPlaying const):
2756         (WebCore::HTMLMediaElement::endedPlayback const):
2757         (WebCore::HTMLMediaElement::stoppedDueToErrors const):
2758         (WebCore::HTMLMediaElement::updatePlayState):
2759         (WebCore::HTMLMediaElement::userCancelledLoad):
2760         (WebCore::HTMLMediaElement::canSuspendForDocumentSuspension const):
2761         (WebCore::HTMLMediaElement::addEventListener):
2762         (WebCore::HTMLMediaElement::isFullscreen const):
2763         (WebCore::HTMLMediaElement::toggleStandardFullscreenState):
2764         (WebCore::HTMLMediaElement::waitForPreparedForInlineThen):
2765         (WebCore::HTMLMediaElement::setVideoFullscreenLayer):
2766         (WebCore::HTMLMediaElement::updateTextTrackDisplay):
2767         (WebCore::HTMLMediaElement::mediaControls const):
2768         (WebCore::HTMLMediaElement::configureTextTrackDisplay):
2769         (WebCore::HTMLMediaElement::setMediaGroup):
2770         (WebCore::HTMLMediaElement::setControllerForBindings):
2771         (WebCore::HTMLMediaElement::isBlockedOnMediaController const):
2772         (WebCore::HTMLMediaElement::prepareMediaFragmentURI):
2773         (WebCore::HTMLMediaElement::didAddUserAgentShadowRoot):
2774         (WebCore::HTMLMediaElement::fileSize const):
2775         (WebCore::HTMLMediaElement::mediaSessionTitle const):
2776         (WebCore::needsSeekingSupportQuirk):
2777         (WebCore::HTMLMediaElement::supportsSeeking const):
2778         (WebCore::HTMLMediaElement::doesHaveAttribute const):
2779         (WebCore::HTMLMediaElement::isVideoTooSmallForInlinePlayback):
2780         * loader/DocumentLoader.cpp:
2781         (WebCore::DocumentLoader::continueAfterContentPolicy):
2782         * loader/EmptyClients.cpp:
2783         * loader/FrameLoaderClient.h:
2784         * loader/cache/CachedCSSStyleSheet.cpp:
2785         (WebCore::CachedCSSStyleSheet::CachedCSSStyleSheet):
2786         * loader/cache/CachedCSSStyleSheet.h:
2787         * loader/cache/CachedFont.cpp:
2788         (WebCore::CachedFont::CachedFont):
2789         * loader/cache/CachedFont.h:
2790         * loader/cache/CachedImage.cpp:
2791         (WebCore::CachedImage::CachedImage):
2792         * loader/cache/CachedImage.h:
2793         * loader/cache/CachedRawResource.cpp:
2794         (WebCore::CachedRawResource::CachedRawResource):
2795         * loader/cache/CachedRawResource.h:
2796         * loader/cache/CachedResource.cpp:
2797         (WebCore::CachedResource::CachedResource):
2798         * loader/cache/CachedResource.h:
2799         (WebCore::CachedResource::sessionID const):
2800         * loader/cache/CachedResourceLoader.cpp:
2801         (WebCore::createResource):
2802         (WebCore::CachedResourceLoader::sessionID const):
2803         * loader/cache/CachedResourceLoader.h:
2804         * loader/cache/CachedSVGDocument.cpp:
2805         (WebCore::CachedSVGDocument::CachedSVGDocument):
2806         * loader/cache/CachedSVGDocument.h:
2807         * loader/cache/CachedSVGFont.cpp:
2808         (WebCore::CachedSVGFont::CachedSVGFont):
2809         * loader/cache/CachedSVGFont.h:
2810         * loader/cache/CachedScript.cpp:
2811         (WebCore::CachedScript::CachedScript):
2812         * loader/cache/CachedScript.h:
2813         * loader/cache/CachedTextTrack.cpp:
2814         (WebCore::CachedTextTrack::CachedTextTrack):
2815         * loader/cache/CachedTextTrack.h:
2816         * loader/cache/CachedXSLStyleSheet.cpp:
2817         (WebCore::CachedXSLStyleSheet::CachedXSLStyleSheet):
2818         * loader/cache/CachedXSLStyleSheet.h:
2819         * loader/cache/MemoryCache.cpp:
2820         (WebCore::MemoryCache::sessionResourceMap const):
2821         (WebCore::MemoryCache::ensureSessionResourceMap):
2822         (WebCore::MemoryCache::resourceForRequest):
2823         (WebCore::MemoryCache::addImageToCache):
2824         (WebCore::MemoryCache::removeImageFromCache):
2825         (WebCore::MemoryCache::forEachSessionResource):
2826         (WebCore::MemoryCache::removeResourcesWithOrigins):
2827         (WebCore::MemoryCache::originsWithCache const):
2828         (WebCore::MemoryCache::evictResources):
2829         * loader/cache/MemoryCache.h:
2830         * loader/cocoa/DiskCacheMonitorCocoa.h:
2831         (WebCore::DiskCacheMonitor::sessionID const):
2832         * loader/cocoa/DiskCacheMonitorCocoa.mm:
2833         (WebCore::DiskCacheMonitor::monitorFileBackingStoreCreation):
2834         (WebCore::DiskCacheMonitor::DiskCacheMonitor):
2835         * page/CacheStorageProvider.h:
2836         * page/DatabaseProvider.h:
2837         * page/Page.cpp:
2838         (WebCore::Page::Page):
2839         (WebCore::Page::enableLegacyPrivateBrowsing):
2840         (WebCore::Page::sessionID const):
2841         (WebCore::Page::setSessionID):
2842         * page/Page.h:
2843         * page/PlugInClient.h:
2844         * page/SocketProvider.cpp:
2845         (WebCore::SocketProvider::createSocketStreamHandle):
2846         * page/SocketProvider.h:
2847         * platform/CookiesStrategy.h:
2848         * platform/WebCoreCrossThreadCopier.cpp:
2849         (WTF::PAL::SessionID>::copy):
2850         (WTF::WebCore::SessionID>::copy): Deleted.
2851         * platform/WebCoreCrossThreadCopier.h:
2852         * platform/network/CacheValidation.cpp:
2853         (WebCore::headerValueForVary):
2854         (WebCore::collectVaryingRequestHeaders):
2855         (WebCore::verifyVaryingRequestHeaders):
2856         * platform/network/CacheValidation.h:
2857         * platform/network/NetworkStorageSession.cpp:
2858         (WebCore::NetworkStorageSession::globalSessionMap):
2859         (WebCore::NetworkStorageSession::storageSession):
2860         (WebCore::NetworkStorageSession::destroySession):
2861         * platform/network/NetworkStorageSession.h:
2862         (WebCore::NetworkStorageSession::sessionID const):
2863         * platform/network/NetworkStorageSessionStub.cpp:
2864         (WebCore::NetworkStorageSession::NetworkStorageSession):
2865         (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession):
2866         (WebCore::NetworkStorageSession::ensureSession):
2867         (WebCore::NetworkStorageSession::defaultStorageSession):
2868         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
2869         (WebCore::NetworkStorageSession::NetworkStorageSession):
2870         (WebCore::NetworkStorageSession::switchToNewTestingSession):
2871         (WebCore::NetworkStorageSession::defaultStorageSession):
2872         (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession):
2873         (WebCore::NetworkStorageSession::ensureSession):
2874         * platform/network/cf/SocketStreamHandleImpl.h:
2875         (WebCore::SocketStreamHandleImpl::create):
2876         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
2877         (WebCore::SocketStreamHandleImpl::SocketStreamHandleImpl):
2878         * platform/network/curl/SocketStreamHandleImpl.h:
2879         (WebCore::SocketStreamHandleImpl::create):
2880         * platform/network/soup/NetworkStorageSessionSoup.cpp:
2881         (WebCore::NetworkStorageSession::NetworkStorageSession):
2882         (WebCore::NetworkStorageSession::defaultStorageSession):
2883         (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession):
2884         (WebCore::NetworkStorageSession::ensureSession):
2885         (WebCore::NetworkStorageSession::switchToNewTestingSession):
2886         * platform/network/soup/SocketStreamHandleImpl.h:
2887         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
2888         (WebCore::SocketStreamHandleImpl::create):
2889         * workers/DedicatedWorkerGlobalScope.cpp:
2890         (WebCore::DedicatedWorkerGlobalScope::create):
2891         (WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope):
2892         * workers/DedicatedWorkerGlobalScope.h:
2893         * workers/DedicatedWorkerThread.cpp:
2894         (WebCore::DedicatedWorkerThread::DedicatedWorkerThread):
2895         (WebCore::DedicatedWorkerThread::createWorkerGlobalScope):
2896         * workers/DedicatedWorkerThread.h:
2897         * workers/Worker.cpp:
2898         (WebCore::Worker::notifyFinished):
2899         * workers/WorkerGlobalScope.cpp:
2900         (WebCore::WorkerGlobalScope::WorkerGlobalScope):
2901         * workers/WorkerGlobalScope.h:
2902         * workers/WorkerGlobalScopeProxy.h:
2903         * workers/WorkerMessagingProxy.cpp:
2904         (WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
2905         * workers/WorkerMessagingProxy.h:
2906         * workers/WorkerThread.cpp:
2907         (WebCore::WorkerThreadStartupData::WorkerThreadStartupData):
2908         (WebCore::WorkerThread::WorkerThread):
2909         * workers/WorkerThread.h:
2910         * workers/service/ServiceWorkerContainer.h:
2911         * workers/service/ServiceWorkerRegistrationParameters.h:
2912
2913 2017-08-17  Carlos Garcia Campos  <cgarcia@igalia.com>
2914
2915         [GTK][WPE] Add NTLM authentication enabled API
2916         https://bugs.webkit.org/show_bug.cgi?id=122952
2917
2918         Reviewed by Michael Catanzaro.
2919
2920         Add/remove NTLM feature to/from soup session depending on whether the feature is enabled or disabled.
2921
2922         * platform/network/soup/SoupNetworkSession.cpp:
2923         (WebCore::SoupNetworkSession::SoupNetworkSession):
2924         (WebCore::SoupNetworkSession::setInitialNTLMAuthenticationEnabled):
2925         (WebCore::SoupNetworkSession::setNTLMAuthenticationEnabled):
2926         * platform/network/soup/SoupNetworkSession.h:
2927
2928 2017-08-16  Ryosuke Niwa  <rniwa@webkit.org>
2929
2930         Add the support for mutating clipboard data via DataTransferItemList
2931         https://bugs.webkit.org/show_bug.cgi?id=175639
2932
2933         Reviewed by Wenson Hsieh.
2934
2935         Added the support for adding plaintext data via dataTransfer.items.add, clearing data via clear,
2936         and removing an entry via remove. When DataTransferItem is removed from DataTransferItemList,
2937         we must put into the disabled mode.
2938
2939         To support the removal of DataTransferItem, this patch replaces a reference to DataTransfer by
2940         a WeakPtr to DataTransferItemList, and stops forwarding ref from DataTransferItem to DataTransfer.
2941         This means that DataTransfer can now be GC'ed before DataTransferItem is GC'ed.
2942
2943         Because the identify and the order of DataTransferItems need to be preserved, we can't simply
2944         re-popluate m_itemList in DataTransferItemList. Instead, whenever the clipboard content is mutated,
2945         we make the parallel modifications to m_itemList. This includes changes made via DataTransfer
2946         methods such as setData and clearData.
2947
2948         Test: editing/pasteboard/datatransfer-items-copy-plaintext.html
2949
2950         * dom/DataTransfer.cpp:
2951         (WebCore::DataTransfer::clearData): Invoke didClearStringData when m_itemList exists.
2952         (WebCore::DataTransfer::setData): Ditto.
2953         (WebCore::DataTransfer::createForInputEvent):
2954         (WebCore::DataTransfer::createForDrag):
2955         (WebCore::DataTransfer::createForDrop):
2956         * dom/DataTransferItem.cpp:
2957         (WebCore::DataTransferItem::create):
2958         (WebCore::DataTransferItem::DataTransferItem):
2959         (WebCore::DataTransferItem::clearListAndPutIntoDisabledMode): Added.
2960         (WebCore::DataTransferItem::type const): Moved from the header.
2961         (WebCore::DataTransferItem::getAsString const):
2962         (WebCore::DataTransferItem::getAsFile const):
2963         * dom/DataTransferItem.h:
2964         (WebCore::DataTransferItem::ref): Deleted.
2965         (WebCore::DataTransferItem::deref): Deleted.
2966         (WebCore::DataTransferItem::isFile const): Added.
2967         (WebCore::DataTransferItem::type const): Move to the cpp file.
2968         * dom/DataTransferItemList.cpp:
2969         (WebCore::isSupportedType): Moved.
2970         (WebCore::DataTransferItemList::DataTransferItemList): Moved from the header.
2971         (WebCore::DataTransferItemList::~DataTransferItemList): Added.
2972         (WebCore::DataTransferItemList::item):
2973         (WebCore::DataTransferItemList::add): Implemented the variant to add string data.
2974         (WebCore::DataTransferItemList::remove): Implemented. For now, we don't have to deal with removing
2975         a file since a writable dataTransfer never contains a File object.
2976         (WebCore::DataTransferItemList::clear): Implemented.
2977         (WebCore::DataTransferItemList::ensureItems const):
2978         (WebCore::removeStringItemOfLowercasedType): Added.
2979         (WebCore::DataTransferItemList::didClearStringData): Called when dataTransfer.clear is called.
2980         (WebCore::DataTransferItemList::didSetStringData): Ditto for 
2981         * dom/DataTransferItemList.h:
2982         (WebCore::DataTransferItemList): Added a WeakPtrFactory. Also use a vector of Ref<DataTransferItem>
2983         instead of unique_ptr<DataTransferItem> since DataTransferItem can outlive DataTransferItemList.
2984         (WebCore::DataTransferItemList::dataTransfer): Added.
2985         * dom/DataTransferItemList.idl:
2986
2987 2017-08-16  Andy Estes  <aestes@apple.com>
2988
2989         [Apple Pay] Rename PaymentRequest to ApplePaySessionPaymentRequest
2990         https://bugs.webkit.org/show_bug.cgi?id=175648
2991
2992         Reviewed by Tim Horton.
2993
2994         The W3C Payment Request API defines an interface called PaymentRequest, which conflicts with
2995         an existing Apple Pay class. This patch renames PaymentRequest to
2996         ApplePaySessionPaymentRequest so that a follow-on patch can introduce PaymentRequest for the
2997         W3C API.
2998
2999         * Modules/applepay/ApplePayError.h:
3000         * Modules/applepay/ApplePayLineItem.h:
3001         * Modules/applepay/ApplePayPaymentRequest.h:
3002         * Modules/applepay/ApplePaySession.cpp:
3003         (WebCore::convertAndValidateTotal):
3004         (WebCore::convertAndValidate):
3005         (WebCore::ApplePaySession::ApplePaySession):
3006         (WebCore::ApplePaySession::didSelectShippingMethod):
3007         * Modules/applepay/ApplePaySession.h:
3008         * Modules/applepay/ApplePaySessionPaymentRequest.cpp: Renamed from Source/WebCore/Modules/applepay/PaymentRequest.cpp.
3009         (WebCore::ApplePaySessionPaymentRequest::ApplePaySessionPaymentRequest):
3010         (WebCore::ApplePaySessionPaymentRequest::~ApplePaySessionPaymentRequest):
3011         (WebCore::ApplePaySessionPaymentRequest::isValidSupportedNetwork):
3012         * Modules/applepay/ApplePaySessionPaymentRequest.h: Renamed from Source/WebCore/Modules/applepay/PaymentRequest.h.
3013         * Modules/applepay/ApplePayShippingMethodSelectedEvent.cpp:
3014         (WebCore::convert):
3015         (WebCore::ApplePayShippingMethodSelectedEvent::ApplePayShippingMethodSelectedEvent):
3016         * Modules/applepay/ApplePayShippingMethodSelectedEvent.h:
3017         * Modules/applepay/PaymentCoordinator.cpp:
3018         (WebCore::PaymentCoordinator::beginPaymentSession):
3019         (WebCore::PaymentCoordinator::didSelectShippingMethod):
3020         * Modules/applepay/PaymentCoordinator.h:
3021         * Modules/applepay/PaymentCoordinatorClient.h:
3022         * Modules/applepay/PaymentHeaders.h:
3023         * Modules/applepay/PaymentRequestValidator.cpp:
3024         (WebCore::PaymentRequestValidator::validate):
3025         (WebCore::PaymentRequestValidator::validateTotal):
3026         (WebCore::validateMerchantCapabilities):
3027         (WebCore::validateShippingMethod):
3028         (WebCore::validateShippingMethods):
3029         * Modules/applepay/PaymentRequestValidator.h:
3030         * WebCore.xcodeproj/project.pbxproj:
3031         * loader/EmptyClients.cpp:
3032
3033 2017-08-16  Chris Dumez  <cdumez@apple.com>
3034
3035         Cross origin Beacon requests with a ArrayBuffer / ArrayBufferView payload should not do a CORS preflight
3036         https://bugs.webkit.org/show_bug.cgi?id=175628
3037         <rdar://problem/33919278>
3038
3039         Reviewed by Geoffrey Garen.
3040
3041         Cross origin Beacon requests with a ArrayBuffer / ArrayBufferView payload should not do a CORS preflight.
3042         To achieve this, the following changes were made:
3043         1. Revert r220779 which caused us to use a non CORS-safelisted Content-Type header for such payload
3044         2. Teach PingLoad how to deal with "simple" cross origin requests (i.e. Don't assume we need a CORS
3045            preflight merely because the fetch mode is set to "cors").
3046
3047         Test: http/wpt/beacon/cors/crossorigin-arraybufferview-no-preflight.html
3048
3049         * Modules/fetch/FetchBody.cpp:
3050         (WebCore::FetchBody::extract):
3051         * loader/CrossOriginAccessControl.h:
3052         * loader/LoaderStrategy.h:
3053         * loader/PingLoader.cpp:
3054         (WebCore::PingLoader::loadImage):
3055         (WebCore::PingLoader::sendPing):
3056         (WebCore::PingLoader::sendViolationReport):
3057         (WebCore::PingLoader::startPingLoad):
3058         * loader/PingLoader.h:
3059         * loader/cache/CachedResource.cpp:
3060         (WebCore::CachedResource::CachedResource):
3061         (WebCore::CachedResource::load):
3062         * loader/cache/CachedResource.h:
3063         * loader/cache/CachedResourceRequest.cpp:
3064         (WebCore::CachedResourceRequest::CachedResourceRequest):
3065         * loader/cache/CachedResourceRequest.h:
3066         (WebCore::CachedResourceRequest::releaseOriginalRequestHeaders):
3067         * platform/network/HTTPHeaderValues.cpp:
3068         * platform/network/HTTPHeaderValues.h:
3069
3070 2017-08-16  Matt Baker  <mattbaker@apple.com>
3071
3072         Web Inspector: capture async stack trace when workers/main context posts a message
3073         https://bugs.webkit.org/show_bug.cgi?id=167084
3074         <rdar://problem/30033673>
3075
3076         Reviewed by Brian Burg.
3077
3078         Add instrumentation to DOMWindow to support showing asynchronous
3079         stack traces when the debugger pauses in a MessageEvent handler.
3080
3081         Test: inspector/debugger/async-stack-trace.html
3082
3083         * inspector/InspectorInstrumentation.cpp:
3084         (WebCore::InspectorInstrumentation::didPostMessageImpl):
3085         (WebCore::InspectorInstrumentation::didFailPostMessageImpl):
3086         (WebCore::InspectorInstrumentation::willDispatchPostMessageImpl):
3087         (WebCore::InspectorInstrumentation::didDispatchPostMessageImpl):
3088
3089         * inspector/InspectorInstrumentation.h:
3090         (WebCore::InspectorInstrumentation::didPostMessage):
3091         (WebCore::InspectorInstrumentation::didFailPostMessage):
3092         (WebCore::InspectorInstrumentation::willDispatchPostMessage):
3093         (WebCore::InspectorInstrumentation::didDispatchPostMessage):
3094
3095         * inspector/PageDebuggerAgent.cpp:
3096         (WebCore::PageDebuggerAgent::didClearAsyncStackTraceData):
3097         (WebCore::PageDebuggerAgent::didPostMessage):
3098         (WebCore::PageDebuggerAgent::didFailPostMessage):
3099         (WebCore::PageDebuggerAgent::willDispatchPostMessage):
3100         (WebCore::PageDebuggerAgent::didDispatchPostMessage):
3101         * inspector/PageDebuggerAgent.h:
3102
3103         * page/DOMWindow.cpp:
3104         (WebCore::DOMWindow::postMessage):
3105         (WebCore::DOMWindow::postMessageTimerFired):
3106
3107 2017-08-16  Timothy Horton  <timothy_horton@apple.com>
3108
3109         Try to fix the build
3110
3111         * platform/ios/PlatformPasteboardIOS.mm:
3112
3113 2017-08-16  Simon Fraser  <simon.fraser@apple.com>
3114
3115         Build fix after r220812
3116
3117         Fix builds where LOG_DISABLED is defined.
3118
3119         * css/MediaQueryEvaluator.cpp:
3120
3121 2017-08-16  Simon Fraser  <simon.fraser@apple.com>
3122
3123         Add a log channel for media queries
3124         https://bugs.webkit.org/show_bug.cgi?id=175591
3125
3126         Reviewed by Zalan Bujtas.
3127
3128         Add a "MediaQueries" log channel which logs data about media query evaluation.
3129
3130         * css/MediaList.cpp:
3131         (WebCore::MediaQuerySet::MediaQuerySet):
3132         (WebCore::operator<<):
3133         * css/MediaList.h:
3134         * css/MediaQuery.cpp:
3135         (WebCore::operator<<):
3136         * css/MediaQuery.h:
3137         * css/MediaQueryEvaluator.cpp:
3138         (WebCore::operator<<):
3139         (WebCore::MediaQueryEvaluator::evaluate const):
3140         (WebCore::aspectRatioValueAsString):
3141         (WebCore::orientationEvaluate):
3142         (WebCore::aspectRatioEvaluate):
3143         (WebCore::deviceAspectRatioEvaluate):
3144         (WebCore::evaluateResolution):
3145         (WebCore::deviceHeightEvaluate):
3146         (WebCore::deviceWidthEvaluate):
3147         (WebCore::heightEvaluate):
3148         (WebCore::widthEvaluate):
3149         * css/MediaQueryExpression.cpp:
3150         (WebCore::operator<<):
3151         * css/MediaQueryExpression.h:
3152         * css/MediaQueryMatcher.cpp:
3153         (WebCore::MediaQueryMatcher::styleResolverChanged):
3154         * css/StyleResolver.cpp:
3155         (WebCore::StyleResolver::hasMediaQueriesAffectedByViewportChange const):
3156         (WebCore::StyleResolver::hasMediaQueriesAffectedByAccessibilitySettingsChange const):
3157         * dom/InlineStyleSheetOwner.cpp:
3158         (WebCore::InlineStyleSheetOwner::createSheet):
3159         * html/HTMLImageElement.cpp:
3160         (WebCore::HTMLImageElement::bestFitSourceFromPictureElement):
3161         * html/HTMLLinkElement.cpp:
3162         (WebCore::HTMLLinkElement::process):
3163         * html/HTMLMediaElement.cpp:
3164         (WebCore::HTMLMediaElement::selectNextSourceChild):
3165         * html/HTMLPictureElement.cpp:
3166         (WebCore::HTMLPictureElement::viewportChangeAffectedPicture const):
3167         * html/parser/HTMLPreloadScanner.cpp:
3168         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
3169         * page/FrameView.cpp:
3170         (WebCore::FrameView::layout):
3171         * platform/Logging.cpp:
3172         (WebCore::initializeLogChannelsIfNecessary):
3173         * platform/Logging.h:
3174         * platform/URL.cpp:
3175         (WebCore::isSchemeFirstChar):
3176         (WebCore::operator<<):
3177         * platform/URL.h:
3178
3179 2017-08-16  Sam Weinig  <sam@webkit.org>
3180
3181         [WebIDL] Remove the need for JSSubtleCryptoCustom.cpp
3182         https://bugs.webkit.org/show_bug.cgi?id=175526
3183
3184         Reviewed by Chris Dumez.
3185
3186         - Generates bindings for all of SubtleCrypto except AlgorithmIdentifier normalization, 
3187           which is defined in the WebCrypto spec to happen after normal IDL operations.
3188         - Adds initial support for IDL object types in unions (some, unneeded at the moment,
3189           edge cases remain).
3190
3191         * CMakeLists.txt:
3192         * WebCore.xcodeproj/project.pbxproj:
3193         * bindings/js/JSSubtleCryptoCustom.cpp: Removed.
3194
3195             Remove JSSubtleCryptoCustom.cpp, added CryptoKeyFormat.h
3196
3197         * bindings/js/JSDOMConvertObject.h:
3198
3199             Add needed, when included in generated code, #include of StrongInlines.h
3200
3201         * bindings/js/JSDOMConvertUnion.h:
3202         
3203             Add initial support for object (needed for AlgorithmIdentifier which is 
3204             (object or DOMString)). Remaining support will be handled by https://webkit.org/b/175616
3205
3206             Also add remaining spec comments while in the area.
3207
3208         * bindings/js/JSDOMPromiseDeferred.cpp:
3209         (WebCore::DeferredPromise::reject):
3210
3211             Add support for the special ExistingExceptionError error code. Capturing
3212             the current exception and using it as the rejection value.
3213
3214         * crypto/SubtleCrypto.cpp:
3215         (WebCore::SubtleCrypto::~SubtleCrypto):
3216         (WebCore::toHashIdentifier):
3217         (WebCore::normalizeCryptoAlgorithmParameters):
3218         (WebCore::toCryptoKeyUsageBitmap):
3219         (WebCore::rejectWithException):
3220         (WebCore::normalizeJsonWebKey):
3221         (WebCore::toKeyData):
3222         (WebCore::copyToVector):
3223         (WebCore::isSupportedExportKey):
3224         (WebCore::SubtleCrypto::encrypt):
3225         (WebCore::SubtleCrypto::decrypt):
3226         (WebCore::SubtleCrypto::sign):
3227         (WebCore::SubtleCrypto::verify):
3228         (WebCore::SubtleCrypto::digest):
3229         (WebCore::SubtleCrypto::generateKey):
3230         (WebCore::SubtleCrypto::deriveKey):
3231         (WebCore::SubtleCrypto::deriveBits):
3232         (WebCore::SubtleCrypto::importKey):
3233         (WebCore::SubtleCrypto::exportKey):
3234         (WebCore::SubtleCrypto::wrapKey):
3235         (WebCore::SubtleCrypto::unwrapKey):
3236         * crypto/SubtleCrypto.h:
3237         * crypto/SubtleCrypto.idl:
3238
3239             Moves implementation from JSSubtleCryptoCustom.cpp -> here. Important changes that come
3240             with that are:
3241             - All parameters are now converted / type checked for us.
3242             - Rather than throwing exceptions and expecting the bindings layer to convert
3243               them to promise rejections, all rejections are now explicitly made.
3244             - Algorithms are no longer checked for being supported twice, once in normalizeCryptoAlgorithmParameters
3245               and then again in the operation. We instead rely on normalizeCryptoAlgorithmParameters to return
3246               an Exception if its not supported.
3247             - Shaves 251 lines off the file.
3248
3249         * crypto/CryptoKeyFormat.h: Added.
3250
3251             Add new header for unified key format enum. (For bindings purposes, SubtleCrypto
3252             re aliases it to SubtleCrypto::KeyFormat).
3253
3254         * bindings/js/JSWebKitSubtleCryptoCustom.cpp:
3255         * crypto/CryptoAlgorithm.cpp:
3256         * crypto/CryptoAlgorithm.h:
3257         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
3258         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
3259         * crypto/algorithms/CryptoAlgorithmAES_CFB.cpp:
3260         * crypto/algorithms/CryptoAlgorithmAES_CFB.h:
3261         * crypto/algorithms/CryptoAlgorithmAES_CTR.cpp:
3262         * crypto/algorithms/CryptoAlgorithmAES_CTR.h:
3263         * crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:
3264         * crypto/algorithms/CryptoAlgorithmAES_GCM.h:
3265         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
3266         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
3267         * crypto/algorithms/CryptoAlgorithmECDH.cpp:
3268         * crypto/algorithms/CryptoAlgorithmECDH.h:
3269         * crypto/algorithms/CryptoAlgorithmECDSA.cpp:
3270         * crypto/algorithms/CryptoAlgorithmECDSA.h:
3271         * crypto/algorithms/CryptoAlgorithmHKDF.cpp:
3272         * crypto/algorithms/CryptoAlgorithmHKDF.h:
3273         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
3274         * crypto/algorithms/CryptoAlgorithmHMAC.h:
3275         * crypto/algorithms/CryptoAlgorithmPBKDF2.cpp:
3276         * crypto/algorithms/CryptoAlgorithmPBKDF2.h:
3277         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
3278         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
3279         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
3280         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
3281         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
3282         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
3283         * crypto/algorithms/CryptoAlgorithmRSA_PSS.cpp:
3284         * crypto/algorithms/CryptoAlgorithmRSA_PSS.h:
3285
3286             Use CryptoKeyFormat enum directly, rather than SubtleCrypto::KeyFormat,
3287             to allow not including SubtleCrypto.h.
3288
3289         * crypto/parameters/CryptoAlgorithmEcdsaParams.h:
3290         * crypto/parameters/CryptoAlgorithmHkdfParams.h:
3291         * crypto/parameters/CryptoAlgorithmHmacKeyParams.h:
3292         * crypto/parameters/CryptoAlgorithmPbkdf2Params.h:
3293         * crypto/parameters/CryptoAlgorithmRsaHashedImportParams.h:
3294         * crypto/parameters/CryptoAlgorithmRsaHashedKeyGenParams.h:
3295         * crypto/parameters/EcdsaParams.idl:
3296         * crypto/parameters/HkdfParams.idl:
3297         * crypto/parameters/HmacKeyParams.idl:
3298         * crypto/parameters/Pbkdf2Params.idl:
3299         * crypto/parameters/RsaHashedImportParams.idl:
3300         * crypto/parameters/RsaHashedKeyGenParams.idl:
3301
3302             Update IDLs and implementations to use the correct definition of HashAlgorithmIdentifier,
3303             which is (object or DOMString), now that it is supported.
3304
3305 2017-08-16  Youenn Fablet  <youenn@apple.com>
3306
3307         [Cache API] Implement Worker connection to the Cache storage engine
3308         https://bugs.webkit.org/show_bug.cgi?id=175599
3309
3310         Reviewed by Chris Dumez.
3311
3312         Covered by existing tests.
3313
3314         Adding a WorkerCacheStorageConnection to connect workers Cache/CacheStorage
3315         to the cache storage engine.
3316         WorkerCacheStorageConnection does this by hopping to the main thread to call the document cache storage connection to do the actual job.
3317         Doing some CacheStorageConnection refactoring to share code with WK2 implementation of the cache storage connection. 
3318
3319         * Modules/cache/CacheQueryOptions.h:
3320         (WebCore::CacheQueryOptions::isolatedCopy const):
3321         * Modules/cache/CacheStorageConnection.cpp:
3322         (WebCore::CacheStorageConnection::open):
3323         (WebCore::CacheStorageConnection::remove):
3324         (WebCore::CacheStorageConnection::retrieveCaches):
3325         (WebCore::CacheStorageConnection::retrieveRecords):
3326         (WebCore::CacheStorageConnection::batchDeleteOperation):
3327         (WebCore::CacheStorageConnection::batchPutOperation):
3328         (WebCore::CacheStorageConnection::openOrRemoveCompleted):
3329         (WebCore::CacheStorageConnection::updateCaches):
3330         (WebCore::CacheStorageConnection::updateRecords):
3331         (WebCore::CacheStorageConnection::removeRecordsCompleted):
3332         (WebCore::CacheStorageConnection::putRecordsCompleted):
3333         * Modules/cache/CacheStorageConnection.h:
3334         (WebCore::CacheStorageConnection::openCompleted):
3335         (WebCore::CacheStorageConnection::removeCompleted):
3336         (WebCore::CacheStorageConnection::doOpen):
3337         (WebCore::CacheStorageConnection::doRemove):
3338         (WebCore::CacheStorageConnection::doRetrieveCaches):
3339         (WebCore::CacheStorageConnection::doRetrieveRecords):
3340         (WebCore::CacheStorageConnection::doBatchDeleteOperation):
3341         (WebCore::CacheStorageConnection::doBatchPutOperation):
3342         * Modules/cache/WorkerCacheStorageConnection.cpp: Added.
3343         (WebCore::toCrossThreadRecordData):
3344         (WebCore::fromCrossThreadRecordData):
3345         (WebCore::WorkerCacheStorageConnection::create):
3346         (WebCore::WorkerCacheStorageConnection::WorkerCacheStorageConnection):
3347         (WebCore::WorkerCacheStorageConnection::doOpen):
3348         (WebCore::WorkerCacheStorageConnection::doRemove):
3349         (WebCore::WorkerCacheStorageConnection::doRetrieveCaches):
3350         (WebCore::WorkerCacheStorageConnection::doRetrieveRecords):
3351         (WebCore::WorkerCacheStorageConnection::doBatchDeleteOperation):
3352         (WebCore::WorkerCacheStorageConnection::doBatchPutOperation):
3353         * Modules/cache/WorkerCacheStorageConnection.h: Added.
3354         * Modules/cache/WorkerGlobalScopeCaches.cpp:
3355         (WebCore::WorkerGlobalScopeCaches::caches const):
3356         * WebCore.xcodeproj/project.pbxproj:
3357         * loader/FetchOptions.h:
3358         (WebCore::FetchOptions::isolatedCopy const):
3359         * workers/WorkerGlobalScope.cpp:
3360         (WebCore::WorkerGlobalScope::cacheStorageConnection):
3361         * workers/WorkerGlobalScope.h:
3362
3363 2017-08-16  Yoshiaki Jitsukawa  <Yoshiaki.Jitsukawa@sony.com>
3364
3365         [PAL] Move spi/ios and spi/win directories into PAL
3366         https://bugs.webkit.org/show_bug.cgi?id=175171
3367
3368         Reviewed by Antti Koivisto.
3369
3370         * PlatformWin.cmake:
3371         * WebCore.xcodeproj/project.pbxproj:
3372         * editing/cocoa/DataDetection.mm:
3373         * loader/ios/PreviewLoader.mm:
3374         * page/CaptionUserPreferencesMediaAF.cpp:
3375         * page/cocoa/MemoryReleaseCocoa.mm:
3376         * page/cocoa/SettingsCocoa.mm:
3377         * page/ios/UserAgentIOS.mm:
3378         * platform/audio/ios/MediaSessionManagerIOS.mm:
3379         * platform/graphics/ca/PlatformCALayer.cpp:
3380         * platform/graphics/cocoa/FontCascadeCocoa.mm:
3381         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
3382         * platform/graphics/opentype/OpenTypeCG.h:
3383         * platform/graphics/win/SimpleFontDataCGWin.cpp:
3384         * platform/graphics/win/SimpleFontDataDirect2D.cpp:
3385         * platform/ios/Device.h:
3386         * platform/ios/PlatformPasteboardIOS.mm:
3387         * platform/ios/PlatformScreenIOS.mm:
3388         * platform/ios/QuickLookSoftLink.h:
3389         * platform/ios/QuickLookSoftLink.mm:
3390         * platform/ios/ValidationBubbleIOS.mm:
3391         * platform/ios/WebItemProviderPasteboard.mm:
3392         * platform/network/ios/PreviewConverter.mm:
3393         * platform/sql/SQLiteFileSystem.cpp:
3394         * rendering/RenderThemeIOS.mm:
3395
3396 2017-08-16  Tim Horton  <timothy_horton@apple.com>
3397
3398         2-3% of main thread time under UTTypeCreatePreferredIdentifierForTag on wunderground map
3399         https://bugs.webkit.org/show_bug.cgi?id=175618
3400
3401         Reviewed by Simon Fraser.
3402
3403         No new tests, just a perf win.
3404
3405         UTTypeCreatePreferredIdentifierForTag is fairly expensive, and is called
3406         under every toDataURL, which the Wunderground wundermap does a /lot/.
3407
3408         Keep a 16-item LRU cache of MIMEType->UTI mappings.
3409
3410         Also, make other callers of UTTypeCreatePreferredIdentifierForTag use
3411         the UTIUtilities version so they can share in the caching.
3412
3413         Also, as a drive-by, add and make other callers use mimeTypeFromUTI too,
3414         and make the UTIUtilities operate on Strings for a slightly more WebCore-y feel.
3415
3416         * editing/ios/EditorIOS.mm:
3417         (WebCore::Editor::WebContentReader::readImage):
3418         * platform/MIMETypeRegistry.cpp:
3419         (WebCore::initializeSupportedImageMIMETypes):
3420         (WebCore::initializeSupportedImageMIMETypesForEncoding):
3421         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
3422        &n