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