[RenderTreeBuilder] Introduce RenderTreebuilder::takeChild
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-02-12  Zalan Bujtas  <zalan@apple.com>
2
3         [RenderTreeBuilder] Introduce RenderTreebuilder::takeChild
4         https://bugs.webkit.org/show_bug.cgi?id=182707
5         <rdar://problem/37473433>
6
7         Reviewed by Antti Koivisto.
8
9         All takeChild calls should go through RenderTreeBuilder::takeChild from now on.
10         This patch also moves the Ruby related takeChild calls to RenderTreeBuilder.
11
12         No change in functionality.
13
14         * rendering/RenderButton.cpp:
15         (WebCore::RenderButton::takeChild):
16         * rendering/RenderElement.cpp:
17         (WebCore::RenderElement::removeAndDestroyChild):
18         * rendering/RenderFullScreen.cpp:
19         (WebCore::RenderFullScreen::wrapExistingRenderer):
20         (WebCore::RenderFullScreen::unwrapRenderer):
21         * rendering/RenderMenuList.cpp:
22         (RenderMenuList::takeChild):
23         * rendering/RenderRuby.cpp:
24         (WebCore::RenderRubyAsInline::takeChild): Deleted.
25         (WebCore::RenderRubyAsBlock::takeChild): Deleted.
26         * rendering/RenderRuby.h:
27         * rendering/RenderRubyRun.cpp:
28         (WebCore::RenderRubyRun::takeChild): Deleted.
29         * rendering/RenderRubyRun.h:
30         * rendering/updating/RenderTreeBuilder.cpp:
31         (WebCore::RenderTreeBuilder::takeChild):
32         (WebCore::RenderTreeBuilder::takeChildFromRenderRubyAsInline): Deleted.
33         (WebCore::RenderTreeBuilder::takeChildFromRenderRubyAsBlock): Deleted.
34         (WebCore::RenderTreeBuilder::takeChildFromRenderRubyRun): Deleted.
35         * rendering/updating/RenderTreeBuilder.h:
36         * rendering/updating/RenderTreeBuilderFirstLetter.cpp:
37         (WebCore::RenderTreeBuilder::FirstLetter::updateStyle):
38         * rendering/updating/RenderTreeBuilderList.cpp:
39         (WebCore::RenderTreeBuilder::List::updateItemMarker):
40         * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
41         (WebCore::RenderTreeBuilder::MultiColumn::createFragmentedFlow):
42         (WebCore::RenderTreeBuilder::MultiColumn::destroyFragmentedFlow):
43         (WebCore::RenderTreeBuilder::MultiColumn::processPossibleSpannerDescendant):
44         * rendering/updating/RenderTreeBuilderRuby.cpp:
45         (WebCore::RenderTreeBuilder::Ruby::takeChild):
46         * rendering/updating/RenderTreeBuilderTable.cpp:
47         (WebCore::RenderTreeBuilder::Table::collapseAndDestroyAnonymousSiblingRows):
48
49 2018-02-12  Zalan Bujtas  <zalan@apple.com>
50
51         [RenderTreeBuilder] Move RenderBlock::dropAnonymousBoxChild to RenderTreeBuilder
52         https://bugs.webkit.org/show_bug.cgi?id=182704
53         <rdar://problem/37469469>
54
55         Reviewed by Antti Koivisto.
56
57         All the callsites are now in RenderTreeBuilder.
58
59         No change in functionality.
60
61         * rendering/RenderBlock.cpp:
62         (WebCore::RenderBlock::dropAnonymousBoxChild): Deleted.
63         * rendering/RenderBlock.h:
64         * rendering/updating/RenderTreeBuilder.cpp:
65         (WebCore::RenderTreeBuilder::removeAnonymousWrappersForInlineChildrenIfNeeded):
66         (WebCore::RenderTreeBuilder::dropAnonymousBoxChild):
67         * rendering/updating/RenderTreeBuilder.h:
68         * rendering/updating/RenderTreeBuilderBlock.cpp:
69         (WebCore::RenderTreeBuilder::Block::takeChild):
70         (WebCore::RenderTreeBuilder::Block::dropAnonymousBoxChild):
71         * rendering/updating/RenderTreeBuilderBlock.h:
72
73 2018-02-12  Matt Lewis  <jlewis3@apple.com>
74
75         Unreviewed, rolling out r228376.
76
77         This caused accessibility/mac/selection-notification-focus-
78         change.html to become flaky on macOS.
79
80         Reverted changeset:
81
82         "AX: defer focusedUIElement notifications"
83         https://bugs.webkit.org/show_bug.cgi?id=182643
84         https://trac.webkit.org/changeset/228376
85
86 2018-02-12  Ryan Haddad  <ryanhaddad@apple.com>
87
88         [iOS] media tests failing ASSERT_NOT_REACHED() in WebCore::VideoFullscreenInterfaceAVKit::cleanupFullscreen()
89         https://bugs.webkit.org/show_bug.cgi?id=182527
90
91         Reviewed by Alexey Proskuryakov.
92
93         Temporarily remove an assertion from VideoFullscreenInterfaceAVKit to stop tests from crashing on iOS
94         while the root cause is being investigated.
95
96         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
97         (VideoFullscreenInterfaceAVKit::exitFullscreenHandler):
98
99 2018-02-12  Zalan Bujtas  <zalan@apple.com>
100
101         [RenderTreeBuilder] Remove redundant RenderTreeBuilder instance
102         https://bugs.webkit.org/show_bug.cgi?id=182700
103         <rdar://problem/37463958>
104
105         Reviewed by Antti Koivisto.
106
107         * rendering/RenderView.cpp:
108         (WebCore::RenderView::willBeDestroyed):
109
110 2018-02-12  Chris Fleizach  <cfleizach@apple.com>
111
112         AX: defer focusedUIElement notifications
113         https://bugs.webkit.org/show_bug.cgi?id=182643
114         <rdar://problem/37394310>
115
116         Reviewed by Zalan Bujtas.
117
118         Deferring focus changes for accessibility has a number of benefits.
119             1) Reduces the chance of calling into layout during layout.
120             2) Coalesces multiple focus notifications that would be needlessly sent.
121             3) Improves performance by not calling out to the accessibility notification machinery during layout.
122
123         In this patch, I also started making more AXObjectCache calls private. This will reduce the chance that clients
124         will call into AXObjectCache during unexpected times.
125
126         * accessibility/AXObjectCache.cpp:
127         (WebCore::AXObjectCache::deferFocusedUIElementChangeIfNeeded):
128         (WebCore::conditionallyAddNodeToFilterList):
129         (WebCore::filterVectorPairForRemoval):
130         (WebCore::filterMapForRemoval):
131         (WebCore::filterListForRemoval):
132         (WebCore::AXObjectCache::prepareForDocumentDestruction):
133         (WebCore::AXObjectCache::performDeferredCacheUpdate):
134         * accessibility/AXObjectCache.h:
135         * dom/Document.cpp:
136         (WebCore::Document::setFocusedElement):
137
138 2018-02-11  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
139
140         [GTK] Scrolling sometimes jumps around
141         https://bugs.webkit.org/show_bug.cgi?id=178519
142
143         Reviewed by Michael Catanzaro.
144
145         * platform/gtk/ScrollAnimatorGtk.cpp:
146         (WebCore::ScrollAnimatorGtk::computeVelocity): use -1 as the multiplier for the accumulated deltas,
147         since all we need is to make them negative. Multiplying by -1000 leads to very high velocities being
148         returned, causing the viewport to scroll to the end of the page.
149
150 2018-02-10  Wenson Hsieh  <wenson_hsieh@apple.com>
151
152         Remove an unused static variable in DeprecatedGlobalSettings.h
153         https://bugs.webkit.org/show_bug.cgi?id=182672
154
155         Reviewed by Joseph Pecoraro.
156
157         After r227282, this flag is no longer used anywhere. No change in behavior.
158
159         * page/DeprecatedGlobalSettings.h:
160
161 2018-02-10  Zalan Bujtas  <zalan@apple.com>
162
163         [RenderTreeBuilder] Move RenderBlock::takeChild mutation to a RenderTreeBuilder
164         https://bugs.webkit.org/show_bug.cgi?id=182662
165         <rdar://problem/37408571>
166
167         Reviewed by Simon Fraser.
168
169         No change in functionality.
170
171         * rendering/RenderBlock.cpp:
172         (WebCore::RenderBlock::takeChild):
173         (WebCore::canDropAnonymousBlock): Deleted.
174         (WebCore::canMergeContiguousAnonymousBlocks): Deleted.
175         * rendering/RenderBlock.h:
176         (WebCore::RenderBlock::moveAllChildrenIncludingFloatsTo):
177         * rendering/RenderBlockFlow.h:
178         * rendering/updating/RenderTreeBuilder.cpp:
179         (WebCore::RenderTreeBuilder::takenChildFromRenderBlock):
180         * rendering/updating/RenderTreeBuilder.h:
181         * rendering/updating/RenderTreeBuilderBlock.cpp:
182         (WebCore::canDropAnonymousBlock):
183         (WebCore::canMergeContiguousAnonymousBlocks):
184         (WebCore::RenderTreeBuilder::Block::takeChild):
185         * rendering/updating/RenderTreeBuilderBlock.h:
186
187 2018-02-08  Ryosuke Niwa  <rniwa@webkit.org>
188
189         REGRESSION (r223440): Copying & pasting a list from Microsoft Word to TinyMCE fails
190         https://bugs.webkit.org/show_bug.cgi?id=182564
191
192         Reviewed by Wenson Hsieh.
193
194         Turns out that Microsoft Word generates p and span elements with special styles instead of standard
195         ul and ol elements when copying a list items, and TinyMCE has a specialized code path to process
196         this proprietary format of Microsoft Word. The regression was caused by WebKit's sanitization code
197         stripping away these non-standard CSS rules and inline styles.
198
199         To preseve pre-r223440 behavior in TinyMCE, we preserve the following in a HTML markup:
200
201         1. The "html" element at the beginning with xmlns content attributes
202         2. @list rules in a style element starting with "/* List Definitions */" comment
203         3. inline style content attribute with "mso-list" property
204         4. comments conditional sections with "[if !supportLists]" and "[endif]"
205
206         (1) is needed for TinyMCE to trigger the specialized code path for Microsoft Word. (2) contains
207         the information about the structure of list items. (3) is needed to associate each p element with
208         a rule in (2). (4) is needed to strip away the content generated as list markers (e.g. dots).
209
210         We enable this "MSO list quirks" when the content comes from a non-WebKit client or a WebKit client
211         that doesn't enable custom pasteboard data (detected by the content origin being null), and the HTML
212         markup starts with a specific sequence of characters generated by Microsoft Word.
213
214         Test: http/tests/security/clipboard/copy-paste-html-across-origin-strips-mso-list.html
215               PasteHTML.PreservesMSOList
216               PasteHTML.StripsMSOListWhenMissingMSOHTMLElement
217               PasteWebArchive.PreservesMSOList
218               PasteWebArchive.StripsMSOListWhenMissingMSOHTMLElement
219
220         * editing/MarkupAccumulator.cpp:
221         (WebCore::MarkupAccumulator::appendTextSubstring): Added.
222         * editing/MarkupAccumulator.h:
223         * editing/WebContentReader.cpp:
224         (WebCore::FrameWebContentReader::msoListQuirksForMarkup const): Added. Enables the MSO list quirks
225         if the content origin is null. The content origin specifies the pasteboard content's origin if it's
226         copied in WebKit with custom pasteboard data types enabled. In all other applications, it would be
227         set to null.
228         * editing/WebContentReader.h:
229         * editing/cocoa/WebContentReaderCocoa.mm:
230         (WebCore::markupForFragmentInDocument): Moved to markup.cpp as sanitizedMarkupForFragmentInDocument.
231         (WebCore::sanitizeMarkupWithArchive):
232         (WebCore::WebContentReader::readWebArchive): Always disables MSO list quirks since this code path is
233         only used by WebKit's native code to paste content.
234         (WebCore::WebContentMarkupReader::readWebArchive): Calls msoListQuirksForMarkup since this is the code
235         path used by DataTransfer.
236         (WebCore::WebContentReader::readHTML): Always disables MSO list quirks since this code path is only
237         used by WebKit's native code to paste content.
238         (WebCore::WebContentMarkupReader::readHTML): Calls msoListQuirksForMarkup since this is the code path
239         used by DataTransfer.
240         * editing/markup.cpp:
241         (WebCore::sanitizeMarkup): Use sanitizedMarkupForFragmentInDocument to share code.
242         (WebCore::MSOListMode): Added. Set to Preserve if the sanitized markup is the one generated by
243         Microsoft Word, and MSO list quirks should actually kick in. This is unlike MSOListQuirks, which is
244         set to Enable whenever the content COULD be the one generated by Microsoft Word.
245         (WebCore::StyledMarkupAccumulator): Added a special MSO list preservation mode enabled by MSOListMode.
246         (WebCore::StyledMarkupAccumulator::StyledMarkupAccumulator):
247         (WebCore::StyledMarkupAccumulator::appendElement): Preseve (3). Unfortunately, TinyMCE only recognizes
248         mso-list and related properties only if they appear on their own. But we also need to preserve
249         the inline style generated using the computed style since we would lose the inline styles of the text
250         otherwise (e.g. red text and bold font). To workaround this, we generate two style content attributes,
251         one containing computed styles and another one containing mso-list. Luckily, the HTML parsing algorithm
252         dictates that the first attribute always wins when more than one attributes of the same name appears,
253         so we place the computed style's style attribute first so that the pasted content in non-TinyMCE
254         environment will continue to work.
255         (WebCore::StyledMarkupAccumulator::traverseNodesForSerialization):
256         (WebCore::StyledMarkupAccumulator::appendNodeToPreserveMSOList): Added. Generates special markup for
257         the conditional statements and the special style element with @list rules.
258         (WebCore::createMarkupInternal):
259         (WebCore::createMarkup):
260         (WebCore::sanitizedMarkupForFragmentInDocument): Moved from WebContentReaderCocoa.mm. If MSOListQuirks
261         is set to Enable, and the markup starts with a specific sequence of characters, generate the markup
262         with the newly added quirks code in StyledMarkupAccumulator, and wrap it in a special "html" element
263         TinyMCE recognizes.
264         * editing/markup.h:
265         (WebCore::MSOListQuirks): Added. Set to CheckIfNeeded if the content COULD require MSO list quirks.
266
267 2018-02-09  Dean Jackson  <dino@apple.com>
268
269         ImageBitmapRenderingContext should be Runtime guarded
270         https://bugs.webkit.org/show_bug.cgi?id=182665
271         <rdar://problem/37411410>
272
273         Reviewed by Sam Weinig.
274
275         Add a flag to ensure the ImageBitmapRenderingContext interface is only
276         visible when the runtime feature is enabled.
277
278         * bindings/js/WebCoreBuiltinNames.h:
279         * html/canvas/ImageBitmapRenderingContext.idl:
280
281 2018-02-09  Don Olmstead  <don.olmstead@sony.com>
282
283         [CMake] Make PAL headers copies
284         https://bugs.webkit.org/show_bug.cgi?id=182645
285
286         Reviewed by Alex Christensen.
287
288         No new tests. No change in behavior.
289
290         * CMakeLists.txt:
291
292 2018-02-09  Zalan Bujtas  <zalan@apple.com>
293
294         [RenderTreeBuilder] Move RenderRubyRun::takeChild mutation to a RenderTreeBuilder
295         https://bugs.webkit.org/show_bug.cgi?id=182655
296         <rdar://problem/37406801>
297
298         Reviewed by Simon Fraser.
299
300         No change in functionality.
301
302         * rendering/RenderRubyRun.cpp:
303         (WebCore::RenderRubyRun::takeChild):
304         * rendering/updating/RenderTreeBuilder.cpp:
305         (WebCore::RenderTreeBuilder::takeChildFromRenderRubyRun):
306         * rendering/updating/RenderTreeBuilder.h:
307         * rendering/updating/RenderTreeBuilderRuby.cpp:
308         (WebCore::RenderTreeBuilder::Ruby::takeChild):
309         * rendering/updating/RenderTreeBuilderRuby.h:
310
311 2018-02-09  Andy Estes  <aestes@apple.com>
312
313         [Payment Request] Apple Pay sheet does not dismiss when calling complete() with result "unknown" or "fail"
314         https://bugs.webkit.org/show_bug.cgi?id=182658
315         <rdar://problem/37293917>
316
317         Reviewed by Brady Eidson.
318
319         When PaymentResponse::complete() is called with a result of "unknown" or "fail", we should
320         treat this as a fatal error and dismiss the Apple Pay sheet. However, we were adding an
321         error with code "unknown" to the authorization result, which PassKit interprets as a
322         non-fatal error. Instead, we should not set any errors and just use a status code of
323         PaymentAuthorizationStatus::Failure, which PassKit interprets as a fatal error, dismissing
324         the sheet.
325
326         No test possible.
327
328         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
329         (WebCore::ApplePayPaymentHandler::complete):
330
331 2018-02-09  Wenson Hsieh  <wenson_hsieh@apple.com>
332
333         Pasting from Excel no longer provides text/html data
334         https://bugs.webkit.org/show_bug.cgi?id=182636
335         <rdar://problem/37087060>
336
337         Reviewed by Ryosuke Niwa.
338
339         After r222656, we treat images on the pasteboard as files. However, we also have an existing policy which hides
340         text data ("text/uri-list", "text/html", "text/plain") from the page when files are present on the pasteboard.
341         When copying a table, Microsoft Excel writes a rendering of the table to the pasteboard as an image. This means
342         that we'll hide other data types (importantly, 'text/html') upon pasting, even though important clients (such as
343         Google Docs and Confluence) depend on the 'text/html' data in order to correctly handle the paste (rather than
344         paste as an image of a table).
345
346         To fix this, we add an exception to the DataTransfer.getData codepath when the pasteboard contains files.
347         Instead of always returning the empty string for text/html, we still allow pasteboard access, but only read
348         from a limited set of rich text types, i.e. web archive, RTF(D), and HTML markup. Importantly, this prevents
349         us from exposing any file paths that appear as plain text or URLs on the pasteboard. Just as in the regular
350         codepath for getData(), if the pasteboard data comes from the same origin, we allow unsanitized access;
351         otherwise, we use WebContentMarkupReader to extract markup from the pasteboard.
352
353         Tests:  PasteMixedContent.ImageFileAndPlainText
354                 PasteMixedContent.ImageFileAndWebArchive
355                 PasteMixedContent.ImageFileAndHTML
356                 PasteMixedContent.ImageFileAndRTF
357                 PasteMixedContent.ImageFileAndURL
358                 PasteMixedContent.ImageFileWithHTMLAndURL
359                 DataInteractionTests.DataTransferGetDataWhenDroppingImageAndMarkup
360
361         Also rebaselined some layout tests, which cover changes in behavior when dropping on macOS and pasting on iOS.
362
363         * dom/DataTransfer.cpp:
364         (WebCore::DataTransfer::getDataForItem const):
365
366         Augment the codepath handling the case where the pasteboard contains files, such that we allow reading
367         "text/html", but only from rich text types.
368
369         (WebCore::DataTransfer::readStringFromPasteboard const):
370
371         Factor out logic for reading from the pasteboard into a private helper. This is called in two places from
372         getDataForItem: in the normal (existing) path, and in the case where we allow 'text/html' to be read despite
373         files appearing in the pasteboard.
374
375         One important difference here is that this helper now takes a WebContentReadingPolicy, whose purpose is to
376         prevent reading from non-rich-text types when files appear in the pasteboard.
377
378         Another tweak here is that we now use `lowercaseType` instead of the original (unadjusted) `type` when reading
379         from the pasteboard. This doesn't seem to be intended in the first place.
380
381         (WebCore::DataTransfer::types const):
382
383         Tweak the implementation of DataTransfer.types() in the case where files exist on the pasteboard, such that we
384         also add "text/html" if it is present in the list of DOM-safe types.
385
386         * dom/DataTransfer.h:
387         * platform/Pasteboard.h:
388
389         Introduce WebContentReadingPolicy, which indicates whether or not we should limit web content reading from the
390         pasteboard to only rich text types upon paste or drop. Normally, we allow all types to be read as web content
391         (::AnyType), but when files appear on the pasteboard, we force OnlyRichTextTypes to ensure that no other types
392         can unintentionally be read back as web content.
393
394         * platform/StaticPasteboard.h:
395         * platform/gtk/PasteboardGtk.cpp:
396         (WebCore::Pasteboard::read):
397         * platform/ios/PasteboardIOS.mm:
398
399         Teach Pasteboard (on iOS) to respect WebContentReadingPolicy.
400
401         (WebCore::isTypeAllowedByReadingPolicy):
402         (WebCore::Pasteboard::read):
403         (WebCore::Pasteboard::readRespectingUTIFidelities):
404         * platform/mac/PasteboardMac.mm:
405
406         Teach Pasteboard (on macOS) to respect WebContentReadingPolicy.
407
408         (WebCore::Pasteboard::read):
409         * platform/win/PasteboardWin.cpp:
410         (WebCore::Pasteboard::read):
411         * platform/wpe/PasteboardWPE.cpp:
412         (WebCore::Pasteboard::read):
413
414         Adjust non-Cocoa Pasteboard implementations for an interface change.
415
416 2018-02-09  Zalan Bujtas  <zalan@apple.com>
417
418         [RenderTreeBuilder] Move RenderRubyAsInline/AsBlock::takeChild mutation to a RenderTreeBuilder
419         https://bugs.webkit.org/show_bug.cgi?id=182651
420         <rdar://problem/37405042>
421
422         Reviewed by Antti Koivisto.
423
424         No change in functionality.
425
426         * rendering/RenderRuby.cpp:
427         (WebCore::RenderRubyAsInline::takeChild):
428         (WebCore::RenderRubyAsBlock::takeChild):
429         (WebCore::isAnonymousRubyInlineBlock): Deleted.
430         (WebCore::isRubyChildForNormalRemoval): Deleted.
431         (WebCore::findRubyRunParent): Deleted.
432         * rendering/updating/RenderTreeBuilder.cpp:
433         (WebCore::RenderTreeBuilder::takeChildFromRenderRubyAsInline):
434         (WebCore::RenderTreeBuilder::takeChildFromRenderRubyAsBlock):
435         * rendering/updating/RenderTreeBuilder.h:
436         * rendering/updating/RenderTreeBuilderRuby.cpp:
437         (WebCore::findRubyRunParent):
438         (WebCore::RenderTreeBuilder::Ruby::takeChild):
439         * rendering/updating/RenderTreeBuilderRuby.h:
440
441 2018-02-09  Per Arne Vollan  <pvollan@apple.com>
442
443         Assert that NSApp is not running in the WebProcess.
444         https://bugs.webkit.org/show_bug.cgi?id=182553
445
446         Reviewed by Simon Fraser.
447
448         In WebCore, there are a few places where NSApp is referenced. Since the WebContent process
449         is no longer using the NSApplication run loop, and NSApp is no longer guaranteed to be
450         valid, we should make sure that the NSApp is not referenced by the WebContent process or
451         the Network process, by asserting that the NSApplication event loop is running when NSApp
452         is referenced. It is still ok for the UIProcess to reference NSApp. Adding these assert
453         will help catch NSApp references when the NSApplication run loop is not used.
454
455         Also, do not post a fake mouse event in PasteBoard::setDragImage when the NSApplication
456         run loop is not running, since this is only relevant in WK1.
457
458         No new tests, covered by existing tests. 
459
460         * page/mac/EventHandlerMac.mm:
461         (WebCore::lastEventIsMouseUp):
462         (WebCore::EventHandler::sendFakeEventsAfterWidgetTracking):
463         * platform/mac/PasteboardMac.mm:
464         (WebCore::Pasteboard::setDragImage):
465
466 2018-02-09  Zalan Bujtas  <zalan@apple.com>
467
468         [RenderTreeBuilder] Introduce RenderTreeBuilder to willBeDestoryed/removeFromParentAndDestroy
469         https://bugs.webkit.org/show_bug.cgi?id=182635
470         <rdar://problem/37377489>
471
472         Reviewed by Antti Koivisto.
473
474         This patch helps finding callsites where we don't have a RenderTreeBuilder instance.
475
476         No change in functionality.
477
478         * dom/Document.cpp:
479         (WebCore::Document::setFullScreenRenderer):
480         * dom/Document.h:
481         * rendering/RenderBlock.cpp:
482         (WebCore::RenderBlock::willBeDestroyed):
483         (WebCore::RenderBlock::takeChild):
484         * rendering/RenderBlock.h:
485         * rendering/RenderBlockFlow.cpp:
486         (WebCore::RenderBlockFlow::willBeDestroyed):
487         * rendering/RenderBlockFlow.h:
488         * rendering/RenderBox.cpp:
489         (WebCore::RenderBox::willBeDestroyed):
490         * rendering/RenderBox.h:
491         * rendering/RenderBoxModelObject.cpp:
492         (WebCore::RenderBoxModelObject::willBeDestroyed):
493         (WebCore::RenderBoxModelObject::removeAndDestroyAllContinuations):
494         * rendering/RenderBoxModelObject.h:
495         * rendering/RenderButton.cpp:
496         (WebCore::RenderButton::setText):
497         * rendering/RenderCounter.cpp:
498         (WebCore::RenderCounter::willBeDestroyed):
499         * rendering/RenderCounter.h:
500         * rendering/RenderElement.cpp:
501         (WebCore::RenderElement::willBeDestroyed):
502         * rendering/RenderElement.h:
503         * rendering/RenderEmbeddedObject.cpp:
504         (WebCore::RenderEmbeddedObject::willBeDestroyed):
505         * rendering/RenderEmbeddedObject.h:
506         * rendering/RenderFragmentedFlow.cpp:
507         (WebCore::RenderFragmentedFlow::willBeDestroyed):
508         * rendering/RenderFragmentedFlow.h:
509         * rendering/RenderFullScreen.cpp:
510         (WebCore::RenderFullScreen::willBeDestroyed):
511         (WebCore::RenderFullScreen::wrapNewRenderer):
512         (WebCore::RenderFullScreen::wrapExistingRenderer):
513         (WebCore::RenderFullScreen::unwrapRenderer):
514         * rendering/RenderFullScreen.h:
515         * rendering/RenderImage.cpp:
516         (WebCore::RenderImage::willBeDestroyed):
517         * rendering/RenderImage.h:
518         * rendering/RenderInline.cpp:
519         (WebCore::RenderInline::willBeDestroyed):
520         * rendering/RenderInline.h:
521         * rendering/RenderLayerModelObject.cpp:
522         (WebCore::RenderLayerModelObject::willBeDestroyed):
523         * rendering/RenderLayerModelObject.h:
524         * rendering/RenderListBox.cpp:
525         (WebCore::RenderListBox::willBeDestroyed):
526         * rendering/RenderListBox.h:
527         * rendering/RenderListItem.cpp:
528         (WebCore::RenderListItem::willBeDestroyed):
529         * rendering/RenderListItem.h:
530         * rendering/RenderListMarker.cpp:
531         (WebCore::RenderListMarker::willBeDestroyed):
532         * rendering/RenderListMarker.h:
533         * rendering/RenderMenuList.cpp:
534         (WebCore::RenderMenuList::willBeDestroyed):
535         * rendering/RenderMenuList.h:
536         * rendering/RenderMultiColumnFlow.cpp:
537         (WebCore::RenderMultiColumnFlow::handleSpannerRemoval):
538         * rendering/RenderObject.cpp:
539         (WebCore::RenderObject::removeFromParentAndDestroy):
540         (WebCore::RenderObject::willBeDestroyed):
541         (WebCore::RenderObject::destroy):
542         * rendering/RenderObject.h:
543         * rendering/RenderReplaced.cpp:
544         (WebCore::RenderReplaced::willBeDestroyed):
545         * rendering/RenderReplaced.h:
546         * rendering/RenderRuby.cpp:
547         (WebCore::RenderRubyAsInline::takeChild):
548         (WebCore::RenderRubyAsBlock::takeChild):
549         * rendering/RenderSearchField.cpp:
550         (WebCore::RenderSearchField::willBeDestroyed):
551         * rendering/RenderSearchField.h:
552         * rendering/RenderSnapshottedPlugIn.cpp:
553         (WebCore::RenderSnapshottedPlugIn::willBeDestroyed):
554         * rendering/RenderSnapshottedPlugIn.h:
555         * rendering/RenderText.cpp:
556         (WebCore::RenderText::willBeDestroyed):
557         * rendering/RenderText.h:
558         * rendering/RenderTextControlMultiLine.cpp:
559         (WebCore::RenderTextControlMultiLine::willBeDestroyed):
560         * rendering/RenderTextControlMultiLine.h:
561         * rendering/RenderTextFragment.cpp:
562         (WebCore::RenderTextFragment::willBeDestroyed):
563         (WebCore::RenderTextFragment::setText):
564         * rendering/RenderTextFragment.h:
565         * rendering/RenderVideo.cpp:
566         (WebCore::RenderVideo::willBeDestroyed):
567         * rendering/RenderVideo.h:
568         * rendering/RenderView.cpp:
569         (WebCore::RenderView::willBeDestroyed):
570         * rendering/RenderView.h:
571         * rendering/RenderWidget.cpp:
572         (WebCore::RenderWidget::willBeDestroyed):
573         * rendering/RenderWidget.h:
574         * rendering/svg/RenderSVGBlock.cpp:
575         (WebCore::RenderSVGBlock::willBeDestroyed):
576         * rendering/svg/RenderSVGBlock.h:
577         * rendering/svg/RenderSVGImage.cpp:
578         (WebCore::RenderSVGImage::willBeDestroyed):
579         * rendering/svg/RenderSVGImage.h:
580         * rendering/svg/RenderSVGInline.cpp:
581         (WebCore::RenderSVGInline::willBeDestroyed):
582         * rendering/svg/RenderSVGInline.h:
583         * rendering/svg/RenderSVGModelObject.cpp:
584         (WebCore::RenderSVGModelObject::willBeDestroyed):
585         * rendering/svg/RenderSVGModelObject.h:
586         * rendering/svg/RenderSVGResourceContainer.cpp:
587         (WebCore::RenderSVGResourceContainer::willBeDestroyed):
588         * rendering/svg/RenderSVGResourceContainer.h:
589         * rendering/svg/RenderSVGRoot.cpp:
590         (WebCore::RenderSVGRoot::willBeDestroyed):
591         * rendering/svg/RenderSVGRoot.h:
592         * rendering/svg/RenderSVGText.cpp:
593         (WebCore::RenderSVGText::willBeDestroyed):
594         * rendering/svg/RenderSVGText.h:
595         * rendering/updating/RenderTreeBuilder.cpp:
596         (WebCore::RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers):
597         * rendering/updating/RenderTreeBuilderList.cpp:
598         (WebCore::RenderTreeBuilder::List::updateItemMarker):
599         * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
600         (WebCore::RenderTreeBuilder::MultiColumn::destroyFragmentedFlow):
601         * rendering/updating/RenderTreeBuilderRuby.cpp:
602         (WebCore::RenderTreeBuilder::Ruby::moveBlockChildren):
603
604 2018-02-09  Brent Fulgham  <bfulgham@apple.com>
605
606         [macOS, iOS] Expose OS marketing version in UserAgent
607         https://bugs.webkit.org/show_bug.cgi?id=182629
608         <rdar://problem/37370975>
609
610         Reviewed by Daniel Bates.
611
612         Revert back to dynamically reading the operating system marketing version
613         rather than using a hard-coded version.
614
615         * page/cocoa/UserAgent.mm:
616         (WebCore::systemMarketingVersionForUserAgentString):
617
618 2018-02-08  Antoine Quint  <graouts@apple.com>
619
620         [Web Animations] Refactor AnimationEffect and KeyframeEffect into AnimationEffectReadOnly, KeyframeEffectReadOnly and KeyframeEffect
621         https://bugs.webkit.org/show_bug.cgi?id=182608
622
623         Reviewed by Dean Jackson.
624
625         Currently, we have an AnimationEffect class with read-write members and a KeyframeEffect subclass with read-write
626         members. The spec has an AnimationEffectReadOnly class, with read-only members, a KeyframeEffectReadOnly subclass,
627         with read-only members, and then the KeyframeEffect subclass (of KeyframeEffectReadOnly) with read-write members.
628
629         Likewise, currently we have an AnimationEffectTiming class with read-write members. While the spec has this class
630         as well, it also specifies a read-only AnimationEffectTimingReadOnly superclass.
631
632         In this patch we refactor the code to match the spec, which gives us a big boost in our WPT pass rate. The vast
633         majority of the code is just copied from one class to another verbatim. The limited actual code changes, all related
634         to the new subclassing, are:
635
636         - AnimationEffectTimingReadOnly is not actually read-only as far as WebCore is concerned, it actually exposes setters
637         for all of its properties, but the IDL for this class specifies all properties as read-only, so we match the spec. The
638         reason for this is that it is necessary to be able to set members of an AnimationEffectTimingReadOnly object based on
639         a Variant<double, KeyframeEffectOptions> provided to Element.animate() or the KeyframeEffectReadOnly and KeyframeEffect
640         constructors, and the logic to handle properties in such dictionaries is the same as the logic required to set individual
641         members in AnimationEffectTiming. So in essence, the sole role of AnimationTimingEffect is to provide an IDL interface
642         with read-write members, but the parent class is itself read-write as far as WebCore is concerned.
643
644         - AnimationEffectTimingReadOnly exposes a new setProperties() method which takes in a nullable Variant<double, KeyframeEffectOptions>
645         so that code that was previously specific to KeyframeEffect can be factored into this method and both the constructors of
646         KeyframeEffectReadOnly and KeyframeEffect can make use of it without code duplication.
647
648         - The AnimationEffectReadOnly constructor now takes an AnimationEffectTimingReadOnly as input since that class and
649         KeyframeEffectReadOnly expose an AnimationEffectTimingReadOnly object, while KeyframeEffect exposes an
650         AnimationEffectTiming read-write object. This allows the KeyframeEffect constructor to provide the right object type. 
651
652         * CMakeLists.txt:
653         * DerivedSources.make:
654         * Sources.txt:
655         * WebCore.xcodeproj/project.pbxproj:
656         * animation/AnimationEffectReadOnly.cpp: Renamed from Source/WebCore/animation/AnimationEffect.cpp.
657         (WebCore::AnimationEffectReadOnly::AnimationEffectReadOnly):
658         (WebCore::AnimationEffectReadOnly::localTime const):
659         (WebCore::AnimationEffectReadOnly::phase const):
660         (WebCore::AnimationEffectReadOnly::activeTime const):
661         (WebCore::AnimationEffectReadOnly::overallProgress const):
662         (WebCore::AnimationEffectReadOnly::simpleIterationProgress const):
663         (WebCore::AnimationEffectReadOnly::currentIteration const):
664         (WebCore::AnimationEffectReadOnly::currentDirection const):
665         (WebCore::AnimationEffectReadOnly::directedProgress const):
666         (WebCore::AnimationEffectReadOnly::transformedProgress const):
667         (WebCore::AnimationEffectReadOnly::iterationProgress const):
668         (WebCore::AnimationEffectReadOnly::getComputedTiming):
669         * animation/AnimationEffectReadOnly.h: Renamed from Source/WebCore/animation/AnimationEffect.h.
670         (WebCore::AnimationEffectReadOnly::isKeyframeEffectReadOnly const):
671         (WebCore::AnimationEffectReadOnly::timing const):
672         * animation/AnimationEffectReadOnly.idl: Copied from Source/WebCore/animation/AnimationEffect.idl.
673         * animation/AnimationEffectTiming.cpp:
674         (WebCore::AnimationEffectTiming::AnimationEffectTiming):
675         (WebCore::AnimationEffectTiming::setIterationStart): Deleted.
676         (WebCore::AnimationEffectTiming::setIterations): Deleted.
677         (WebCore::AnimationEffectTiming::bindingsDuration const): Deleted.
678         (WebCore::AnimationEffectTiming::setBindingsDuration): Deleted.
679         (WebCore::AnimationEffectTiming::endTime const): Deleted.
680         (WebCore::AnimationEffectTiming::activeDuration const): Deleted.
681         (WebCore::AnimationEffectTiming::setEasing): Deleted.
682         * animation/AnimationEffectTiming.h:
683         (): Deleted.
684         * animation/AnimationEffectTiming.idl:
685         * animation/AnimationEffectTimingReadOnly.cpp: Copied from Source/WebCore/animation/AnimationEffectTiming.cpp.
686         (WebCore::AnimationEffectTimingReadOnly::create):
687         (WebCore::AnimationEffectTimingReadOnly::AnimationEffectTimingReadOnly):
688         (WebCore::AnimationEffectTimingReadOnly::~AnimationEffectTimingReadOnly):
689         (WebCore::AnimationEffectTimingReadOnly::setProperties):
690         (WebCore::AnimationEffectTimingReadOnly::setIterationStart):
691         (WebCore::AnimationEffectTimingReadOnly::setIterations):
692         (WebCore::AnimationEffectTimingReadOnly::bindingsDuration const):
693         (WebCore::AnimationEffectTimingReadOnly::setBindingsDuration):
694         (WebCore::AnimationEffectTimingReadOnly::setEasing):
695         (WebCore::AnimationEffectTimingReadOnly::endTime const):
696         (WebCore::AnimationEffectTimingReadOnly::activeDuration const):
697         * animation/AnimationEffectTimingReadOnly.h: Copied from Source/WebCore/animation/AnimationEffectTiming.h.
698         (WebCore::AnimationEffectTimingReadOnly::isAnimationEffectTiming const):
699         (WebCore::AnimationEffectTimingReadOnly::bindingsDelay const):
700         (WebCore::AnimationEffectTimingReadOnly::setBindingsDelay):
701         (WebCore::AnimationEffectTimingReadOnly::bindingsEndDelay const):
702         (WebCore::AnimationEffectTimingReadOnly::setBindingsEndDelay):
703         (WebCore::AnimationEffectTimingReadOnly::delay const):
704         (WebCore::AnimationEffectTimingReadOnly::setDelay):
705         (WebCore::AnimationEffectTimingReadOnly::endDelay const):
706         (WebCore::AnimationEffectTimingReadOnly::setEndDelay):
707         (WebCore::AnimationEffectTimingReadOnly::fill const):
708         (WebCore::AnimationEffectTimingReadOnly::setFill):
709         (WebCore::AnimationEffectTimingReadOnly::iterationStart const):
710         (WebCore::AnimationEffectTimingReadOnly::iterations const):
711         (WebCore::AnimationEffectTimingReadOnly::iterationDuration const):
712         (WebCore::AnimationEffectTimingReadOnly::setIterationDuration):
713         (WebCore::AnimationEffectTimingReadOnly::direction const):
714         (WebCore::AnimationEffectTimingReadOnly::setDirection):
715         (WebCore::AnimationEffectTimingReadOnly::easing const):
716         (WebCore::AnimationEffectTimingReadOnly::timingFunction const):
717         (WebCore::AnimationEffectTimingReadOnly::classType const):
718         * animation/AnimationEffectTimingReadOnly.idl: Renamed from Source/WebCore/animation/AnimationEffect.idl.
719         * animation/AnimationTimeline.h:
720         * animation/KeyframeEffect.cpp:
721         (WebCore::KeyframeEffect::create):
722         (WebCore::KeyframeEffect::KeyframeEffect):
723         (WebCore::IDLAttributeNameToAnimationPropertyName): Deleted.
724         (WebCore::CSSPropertyIDToIDLAttributeName): Deleted.
725         (WebCore::computeMissingKeyframeOffsets): Deleted.
726         (WebCore::processIterableKeyframes): Deleted.
727         (WebCore::processKeyframeLikeObject): Deleted.
728         (WebCore::processPropertyIndexedKeyframes): Deleted.
729         (WebCore::KeyframeEffect::getKeyframes): Deleted.
730         (WebCore::KeyframeEffect::processKeyframes): Deleted.
731         (WebCore::KeyframeEffect::computeStackingContextImpact): Deleted.
732         (WebCore::KeyframeEffect::apply): Deleted.
733         (WebCore::KeyframeEffect::shouldRunAccelerated): Deleted.
734         (WebCore::KeyframeEffect::getAnimatedStyle): Deleted.
735         (WebCore::KeyframeEffect::setAnimatedPropertiesInStyle): Deleted.
736         (WebCore::KeyframeEffect::startOrStopAccelerated): Deleted.
737         (WebCore::KeyframeEffect::renderer const): Deleted.
738         (WebCore::KeyframeEffect::currentStyle const): Deleted.
739         * animation/KeyframeEffect.h:
740         * animation/KeyframeEffect.idl:
741         * animation/KeyframeEffectReadOnly.cpp: Copied from Source/WebCore/animation/KeyframeEffect.cpp.
742         (WebCore::IDLAttributeNameToAnimationPropertyName):
743         (WebCore::CSSPropertyIDToIDLAttributeName):
744         (WebCore::computeMissingKeyframeOffsets):
745         (WebCore::processIterableKeyframes):
746         (WebCore::processKeyframeLikeObject):
747         (WebCore::processPropertyIndexedKeyframes):
748         (WebCore::KeyframeEffectReadOnly::create):
749         (WebCore::KeyframeEffectReadOnly::KeyframeEffectReadOnly):
750         (WebCore::KeyframeEffectReadOnly::getKeyframes):
751         (WebCore::KeyframeEffectReadOnly::processKeyframes):
752         (WebCore::KeyframeEffectReadOnly::computeStackingContextImpact):
753         (WebCore::KeyframeEffectReadOnly::apply):
754         (WebCore::KeyframeEffectReadOnly::shouldRunAccelerated):
755         (WebCore::KeyframeEffectReadOnly::getAnimatedStyle):
756         (WebCore::KeyframeEffectReadOnly::setAnimatedPropertiesInStyle):
757         (WebCore::KeyframeEffectReadOnly::startOrStopAccelerated):
758         (WebCore::KeyframeEffectReadOnly::renderer const):
759         (WebCore::KeyframeEffectReadOnly::currentStyle const):
760         * animation/KeyframeEffectReadOnly.h: Copied from Source/WebCore/animation/KeyframeEffect.h.
761         (WebCore::KeyframeEffectReadOnly::~KeyframeEffectReadOnly):
762         (WebCore::KeyframeEffectReadOnly::target const):
763         (WebCore::KeyframeEffectReadOnly::iterationComposite const):
764         (WebCore::KeyframeEffectReadOnly::composite const):
765         (WebCore::KeyframeEffectReadOnly::isRunningAccelerated const):
766         * animation/KeyframeEffectReadOnly.idl: Copied from Source/WebCore/animation/KeyframeEffect.idl.
767         * animation/WebAnimation.cpp:
768         (WebCore::WebAnimation::create):
769         (WebCore::WebAnimation::setEffect):
770         * animation/WebAnimation.h:
771         * animation/WebAnimation.idl:
772         * bindings/js/JSAnimationEffectReadOnlyCustom.cpp: Copied from Source/WebCore/bindings/js/JSAnimationEffectCustom.cpp.
773         (WebCore::toJSNewlyCreated):
774         (WebCore::toJS):
775         * bindings/js/JSAnimationEffectTimingReadOnlyCustom.cpp: Renamed from Source/WebCore/bindings/js/JSAnimationEffectCustom.cpp.
776         (WebCore::toJSNewlyCreated):
777         (WebCore::toJS):
778         * bindings/js/JSCustomEventCustom.cpp:
779         (WebCore::JSCustomEvent::detail const): Fix an error introduced in webkit.org/b/179591.
780         * bindings/js/JSWebAnimationCustom.cpp:
781         (WebCore::constructJSWebAnimation):
782         * bindings/js/WebCoreBuiltinNames.h:
783
784 2018-02-09  Andy Estes  <aestes@apple.com>
785
786         [Payment Request] Crash in PaymentRequest::canMakePayment() when Apple Pay payment method data is missing required fields
787         https://bugs.webkit.org/show_bug.cgi?id=182631
788
789         Reviewed by Mark Lam.
790
791         PaymentRequest::canMakePayment() needs to parse each payment method's serialized data to
792         determine if it is a supported payment method. If parsing fails by raising an exception, we
793         intend to skip over that payment method and try the next one. If all payment method data
794         fail to parse, we resolve the returned promise with false. At no point do we intend to
795         propagate the parsing exception up to the calling script, however.
796
797         Even though we intend to swallow any exceptions from parsing, we failed to clear the
798         JavaScript VM's exception state. The next time WebCore tries to execute JavaScript, a
799         release assertion is raised due to seeing an unexpected exception in the VM.
800
801         Fix this by using a CatchScope in PaymentRequest::canMakePayment(), and calling
802         CatchScope::clearException() in the places we intend to swallow exceptions.
803
804         Added a test case to http/tests/paymentrequest/payment-request-canmakepayment-method.https.html.
805
806         * Modules/paymentrequest/PaymentRequest.cpp:
807         (WebCore::PaymentRequest::canMakePayment):
808
809 2018-02-09  Zalan Bujtas  <zalan@apple.com>
810
811         [RenderTreeBuilder] Move multicolumn descendant/sibling removal logic to RenderTreeBuilder
812         https://bugs.webkit.org/show_bug.cgi?id=182628
813         <rdar://problem/37369528>
814
815         Reviewed by Antti Koivisto.
816
817         No change in functionality
818
819         * rendering/RenderBlockFlow.cpp:
820         (WebCore::RenderBlockFlow::takeChild):
821         * rendering/RenderFragmentedFlow.h:
822         * rendering/RenderMultiColumnFlow.cpp:
823         (WebCore::RenderMultiColumnFlow::handleSpannerRemoval): Deleted.
824         (WebCore::RenderMultiColumnFlow::fragmentedFlowRelativeWillBeRemoved): Deleted.
825         * rendering/RenderMultiColumnFlow.h:
826         * rendering/updating/RenderTreeBuilder.cpp:
827         (WebCore::RenderTreeBuilder::multiColumnRelativeWillBeRemoved):
828         * rendering/updating/RenderTreeBuilder.h:
829         * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
830         (WebCore::RenderTreeBuilder::MultiColumn::handleSpannerRemoval):
831         (WebCore::RenderTreeBuilder::MultiColumn::multiColumnRelativeWillBeRemoved):
832         * rendering/updating/RenderTreeBuilderMultiColumn.h:
833
834 2018-02-09  Youenn Fablet  <youenn@apple.com>
835
836         Add support for cache storage of blob response
837         https://bugs.webkit.org/show_bug.cgi?id=182637
838
839         Reviewed by Brady Eidson.
840
841         Covered by updated WPT test.
842         When putting a blob response in cache, create a readable stream to easily get the body.
843         Make clear that caching form data is not supported.
844
845         * Modules/cache/DOMCache.cpp:
846         (WebCore::DOMCache::put):
847         * Modules/fetch/FetchBody.h:
848         (WebCore::FetchBody::isBlob const):
849         (WebCore::FetchBody::isFormData const):
850         * Modules/fetch/FetchResponse.h:
851
852 2018-02-09  Youenn Fablet  <youenn@apple.com>
853
854         Make CoreAudioCaptureSource error logging be release logging
855         https://bugs.webkit.org/show_bug.cgi?id=182614
856
857         Reviewed by Eric Carlson.
858
859         No change of behavior.
860
861         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
862         (WebCore::CoreAudioSharedUnit::addEchoCancellationSource):
863         (WebCore::CoreAudioSharedUnit::setupAudioUnit):
864         (WebCore::CoreAudioSharedUnit::configureMicrophoneProc):
865         (WebCore::CoreAudioSharedUnit::configureSpeakerProc):
866         (WebCore::CoreAudioSharedUnit::checkTimestamps):
867         (WebCore::CoreAudioSharedUnit::provideSpeakerData):
868         (WebCore::CoreAudioSharedUnit::processMicrophoneSamples):
869         (WebCore::CoreAudioSharedUnit::cleanupAudioUnit):
870         (WebCore::CoreAudioSharedUnit::reconfigureAudioUnit):
871         (WebCore::CoreAudioSharedUnit::startInternal):
872         (WebCore::CoreAudioSharedUnit::verifyIsCapturing):
873         (WebCore::CoreAudioSharedUnit::stopInternal):
874         (WebCore::CoreAudioSharedUnit::defaultInputDevice):
875
876 2018-02-09  Carlos Garcia Campos  <cgarcia@igalia.com>
877
878         Add a way to check if a host is an IP address
879         https://bugs.webkit.org/show_bug.cgi?id=182427
880
881         Reviewed by Alex Christensen.
882
883         There are several places where this is needed. We currently just assume that any host ending in a digit is an IP
884         address, except in PublicSuffix where platform specific code is used. This patch adds URL::hostIsIPAddress()
885         platform specific implementations, falling back to current assumption if there isn't an implementation for the
886         platform.
887
888         * page/OriginAccessEntry.cpp:
889         (WebCore::OriginAccessEntry::OriginAccessEntry): Use URL::hostIsIPAddress().
890         * platform/URL.cpp:
891         (WebCore::URL::hostIsIPAddress): Fallback implementation.
892         * platform/URL.h:
893         * platform/mac/PublicSuffixMac.mm:
894         (WebCore::topPrivatelyControlledDomain): Use URL::hostIsIPAddress().
895         * platform/mac/URLMac.mm:
896         (WebCore::URL::hostIsIPAddress): Move implementation from PublicSuffixMac.mm.
897         * platform/network/curl/CookieUtil.cpp:
898         (WebCore::CookieUtil::isIPAddress): Use URL::hostIsIPAddress().
899         * platform/soup/URLSoup.cpp:
900         (WebCore::URL::hostIsIPAddress): Use g_hostname_is_ip_address().
901
902 2018-02-08  Philippe Normand  <pnormand@igalia.com>
903
904         [GStreamer][WebAudio] Winamp2-js woes
905         https://bugs.webkit.org/show_bug.cgi?id=182612
906
907         Reviewed by Xabier Rodriguez Calvar and Carlos Alberto Lopez Perez.
908
909         Test: webaudio/silence-after-playback.html
910
911         * platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp:
912         (WebCore::copyGStreamerBuffersToAudioChannel): Clear the bus if
913         the adapter can't provide enough data. This prevents a nasty noise
914         after playing songs in Winamp.
915         (WebCore::AudioSourceProviderGStreamer::setClient): No need to set
916         the client more than once, this fixes runtime warnings.
917
918 2018-02-09  Zalan Bujtas  <zalan@apple.com>
919
920         [RenderTreeBuilder] Move multicolumn spanner mutation logic to RenderTreeBuilder
921         https://bugs.webkit.org/show_bug.cgi?id=182627
922         <rdar://problem/37367284>
923
924         Reviewed by Antti Koivisto.
925
926         Move spanner triggered mutation logic to RenderTreeBuilder.
927
928         No change in functionality.
929
930         * rendering/RenderFragmentedFlow.h:
931         * rendering/RenderMultiColumnFlow.cpp:
932         (WebCore::RenderMultiColumnFlow::isColumnSpanningDescendant const):
933         (WebCore::findSetRendering): Deleted.
934         (WebCore::isValidColumnSpanner): Deleted.
935         (WebCore::spannerPlacehoderCandidate): Deleted.
936         (WebCore::RenderMultiColumnFlow::processPossibleSpannerDescendant): Deleted.
937         (WebCore::RenderMultiColumnFlow::fragmentedFlowDescendantInserted): Deleted.
938         * rendering/RenderMultiColumnFlow.h:
939         * rendering/RenderObject.cpp:
940         (WebCore::RenderObject::insertedIntoTree):
941         * rendering/updating/RenderTreeBuilder.cpp:
942         (WebCore::RenderTreeBuilder::multiColumnDescendantInserted):
943         * rendering/updating/RenderTreeBuilder.h:
944         * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
945         (WebCore::findSetRendering):
946         (WebCore::spannerPlacehoderCandidate):
947         (WebCore::isValidColumnSpanner):
948         (WebCore::RenderTreeBuilder::MultiColumn::multiColumnDescendantInserted):
949         (WebCore::RenderTreeBuilder::MultiColumn::processPossibleSpannerDescendant):
950         * rendering/updating/RenderTreeBuilderMultiColumn.h:
951
952 2018-02-09  Javier Fernandez  <jfernandez@igalia.com>
953
954         [css-align] Implement the new behavior of 'legacy' for justify-items
955         https://bugs.webkit.org/show_bug.cgi?id=172712
956
957         Reviewed by Antti Koivisto.
958
959         The syntax of the 'justify-items' property accepts a new 'legacy' value,
960         replacing the 'auto' value which is now parsed as invalid.
961
962         https://github.com/w3c/csswg-drafts/issues/1318
963
964         This change affects also to the 'place-items' shorthand, which doesn't
965         accept 'auto' and, for the time being, neither 'legacy'.
966
967         Since the new value 'legacy' is also the default value, I don't expect
968         this change to break content of sites currently using the 'justify-items'
969         property.
970
971         No new tests, rebaselined existing test.
972
973         * css/CSSComputedStyleDeclaration.cpp:
974         (WebCore::valueForItemPositionWithOverflowAlignment):
975         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
976         * css/CSSPrimitiveValueMappings.h:
977         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
978         (WebCore::CSSPrimitiveValue::operator ItemPosition const):
979         * css/CSSProperties.json:
980         * css/StyleResolver.cpp:
981         (WebCore::StyleResolver::adjustRenderStyle):
982         * css/parser/CSSPropertyParser.cpp:
983         (WebCore::isAuto):
984         (WebCore::isNormalOrStretch):
985         (WebCore::consumeSelfPositionOverflowPosition):
986         (WebCore::consumeJustifyItems):
987         (WebCore::consumeSimplifiedDefaultPosition):
988         (WebCore::consumeSimplifiedSelfPosition):
989         (WebCore::CSSPropertyParser::consumePlaceItemsShorthand):
990         (WebCore::CSSPropertyParser::consumePlaceSelfShorthand):
991         * rendering/RenderFlexibleBox.cpp:
992         (WebCore::alignmentOffset):
993         * rendering/RenderGrid.cpp:
994         (WebCore::RenderGrid::columnAxisPositionForChild const):
995         (WebCore::RenderGrid::rowAxisPositionForChild const):
996         * rendering/style/RenderStyle.cpp:
997         (WebCore::resolvedSelfAlignment):
998         (WebCore::RenderStyle::resolvedJustifyItems const):
999         * rendering/style/RenderStyle.h:
1000         (WebCore::RenderStyle::initialJustifyItems):
1001         * rendering/style/RenderStyleConstants.h:
1002         * rendering/style/StyleRareNonInheritedData.cpp:
1003         (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
1004
1005 2018-02-09  Yacine Bandou  <yacine.bandou_ext@softathome.com>
1006
1007         [EME][GStreamer] Add support for encrypted caps in GStreamerUtilities
1008         https://bugs.webkit.org/show_bug.cgi?id=181990
1009
1010         Reviewed by Xabier Rodriguez-Calvar.
1011
1012         Add the support of encrypted caps in GStreamerUtilities.
1013         Refactor the manner that the caps are handled, such as how to extract the resolution
1014         from the video caps or how to check if the caps are encrypted.
1015
1016         The attachTrack function in PlaybackPipeline doesn't need the "structure" parameter,
1017         it is already included in the "caps" parameter.
1018
1019         Replace the "mediaType" parameter by the "caps" parameter in reattachTrack function,
1020         it allows to use the new functions that handle the caps in GStreamerUtilities.
1021
1022         Tests:
1023             media/encrypted-media/clearKey/clearKey-cenc-audio-playback-mse.html
1024             media/encrypted-media/clearKey/clearKey-cenc-video-playback-mse.html
1025
1026         * platform/graphics/gstreamer/GStreamerUtilities.cpp:
1027         (WebCore::getVideoSizeAndFormatFromCaps): Add the support of video encrypted caps.
1028         (WebCore::getVideoResolutionFromCaps):
1029         (WebCore::capsMediaType):
1030         (WebCore::doCapsHaveType):
1031         (WebCore::areEncryptedCaps): Add a new functions in order to handle the caps properly.
1032         * platform/graphics/gstreamer/GStreamerUtilities.h:
1033         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
1034         (WebCore::AppendPipeline::parseDemuxerSrcPadCaps):
1035         * platform/graphics/gstreamer/mse/GStreamerMediaDescription.cpp:
1036         (WebCore::GStreamerMediaDescription::codec const):
1037         (WebCore::GStreamerMediaDescription::isVideo const):
1038         (WebCore::GStreamerMediaDescription::isAudio const):
1039         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
1040         (WebCore::MediaPlayerPrivateGStreamerMSE::trackDetected):
1041         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
1042         (WebCore::PlaybackPipeline::attachTrack):
1043         (WebCore::PlaybackPipeline::reattachTrack):
1044         * platform/graphics/gstreamer/mse/PlaybackPipeline.h:
1045         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
1046         (webKitMediaSrcUpdatePresentationSize): Refactor some parts by using the new added functions.
1047
1048 2018-02-09  Philippe Normand  <pnormand@igalia.com>
1049
1050         [GStreamer] Layout test fast/replaced/border-radius-clip.html crashes with GStreamer-CRITICAL **: gst_segment_to_stream_time: assertion 'segment->format == format' failed in gst_segment_to_stream_time()
1051         https://bugs.webkit.org/show_bug.cgi?id=176802
1052
1053         Reviewed by Xabier Rodriguez Calvar.
1054
1055         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1056         (WebCore::MediaPlayerPrivateGStreamer::load): Prevent the player from loading animated gifs.
1057
1058 2018-02-09  Antti Koivisto  <antti@apple.com>
1059
1060         Move compiled selectors to StyleRule
1061         https://bugs.webkit.org/show_bug.cgi?id=182602
1062
1063         Reviewed by Zalan Bujtas.
1064
1065         Currently they are owned by RuleData. Several RuleData objects can refer to the same StyleRule, requiring recompilation.
1066         Compiled selectors are context-independent so they can be shared between all clients.
1067
1068         * WebCore.xcodeproj/project.pbxproj:
1069         * css/CSSSelectorList.cpp:
1070         (WebCore::CSSSelectorList::listSize const):
1071
1072         Compute the number of complex selectors on the list.
1073
1074         * css/CSSSelectorList.h:
1075         * css/DocumentRuleSets.cpp:
1076         (WebCore::makeRuleSet):
1077         (WebCore::DocumentRuleSets::classInvalidationRuleSets const):
1078
1079         Pass around list index along with the selector index (compiled selectors are found by list index).
1080
1081         * css/ElementRuleCollector.cpp:
1082         (WebCore::ElementRuleCollector::ruleMatches):
1083         * css/RuleSet.cpp:
1084         (WebCore::RuleData::RuleData):
1085         * css/RuleSet.h:
1086         (WebCore::RuleData::compilationStatus const): Deleted.
1087         (WebCore::RuleData::compiledSelectorCodeRef const): Deleted.
1088         (WebCore::RuleData::setCompiledSelector const): Deleted.
1089         (WebCore::RuleData::~RuleData): Deleted.
1090         (WebCore::RuleData::compiledSelectorUsed const): Deleted.
1091         * css/StyleRule.cpp:
1092         (WebCore::StyleRule::StyleRule):
1093         * css/StyleRule.h:
1094
1095             Add CompiledSelector member.
1096
1097         * cssjit/CompiledSelector.h: Added.
1098
1099             Move to a header of its own to keeps dependencies simple.
1100
1101         (WebCore::SelectorCompilationStatus::SelectorCompilationStatus):
1102         (WebCore::SelectorCompilationStatus::operator Status const):
1103         * cssjit/SelectorCompiler.h:
1104         (): Deleted.
1105         (WebCore::SelectorCompilationStatus::SelectorCompilationStatus): Deleted.
1106         (WebCore::SelectorCompilationStatus::operator Status const): Deleted.
1107
1108 2018-02-08  Antoine Quint  <graouts@apple.com>
1109
1110         [Web Animations] Always expose "composite" in output of getKeyframes()
1111         https://bugs.webkit.org/show_bug.cgi?id=182600
1112
1113         Reviewed by Dean Jackson.
1114
1115         The Web Animations spec has changed and whereas the output of getKeyframes() would not feature the "composite" property
1116         for "null" values, it now lists "composite" in all cases.
1117
1118         To support this, we needed to fix an issue in the code generator such that a "null" default value for an optional enum
1119         type was supported.
1120
1121         * animation/KeyframeEffect.cpp:
1122         (WebCore::KeyframeEffect::getKeyframes):
1123         * animation/KeyframeEffect.h:
1124         * animation/KeyframeEffect.idl:
1125         * bindings/scripts/CodeGeneratorJS.pm:
1126         (GenerateDefaultValue):
1127         * bindings/scripts/test/JS/JSTestObj.cpp:
1128         (WebCore::convertDictionary<TestObj::Dictionary>):
1129         (WebCore::convertDictionaryToJS):
1130         * bindings/scripts/test/TestObj.idl:
1131
1132 2018-02-08  Youenn Fablet  <youenn@apple.com>
1133
1134         CoreAudioCaptureSourceIOSListener should be a WebProcess singleton
1135         https://bugs.webkit.org/show_bug.cgi?id=182606
1136         <rdar://problem/37355283>
1137
1138         Reviewed by Eric Carlson.
1139
1140         Not testable right now as this relies on iOS specific Core Audio stack.
1141         Efforts should be made to somehow mock that part and mock interruptions.
1142
1143         Made CoreAudioCaptureSourceFactoryIOS responsible to receive iOS interruption messages.
1144         Before the patch, individual capture sources were receiving these messages.
1145         When there is only one capture source per process this is fine but with more capture sources,
1146         this is messing up things as they all share the same shared unit and we would try to interrupt it or resume it several times.
1147
1148         Also, if we are suspended and there is no more capture source, the shared unit will remain suspended indefinitely, as we will
1149         not process the interruption messages.
1150         With the patch, we always process the messages.
1151         We still go through the active source as done now to limit the changes.
1152         In case of no source, we go to the shared unit.
1153         In the future, we should directly go to the shared unit and clients of the shared unit should see their state being updated.
1154
1155         As a way to prevent staying suspended on iOS, we unsuspend ourselves in CoreAudioCaptureSource constructor.
1156         This is fine as this constructor is only called when getUserMedia grants access to the camera which always goes to the UIProcess.
1157         And the UIProcess is only processing getUserMedia calls if the WebProcess is foregrounded.
1158
1159         * platform/mediastream/ios/CoreAudioCaptureSourceIOS.h:
1160         * platform/mediastream/ios/CoreAudioCaptureSourceIOS.mm:
1161         (-[WebCoreAudioCaptureSourceIOSListener initWithCallback:]):
1162         (WebCore::CoreAudioCaptureSourceFactoryIOS::CoreAudioCaptureSourceFactoryIOS):
1163         (WebCore::CoreAudioCaptureSourceFactoryIOS::~CoreAudioCaptureSourceFactoryIOS):
1164         (WebCore::CoreAudioCaptureSourceFactory::singleton):
1165         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
1166         (WebCore::CoreAudioCaptureSourceFactory::singleton):
1167         (WebCore::CoreAudioCaptureSource::create):
1168         (WebCore::CoreAudioCaptureSourceFactory::beginInterruption):
1169         (WebCore::CoreAudioCaptureSourceFactory::endInterruption):
1170         (WebCore::CoreAudioCaptureSourceFactory::scheduleReconfiguration):
1171         (WebCore::CoreAudioCaptureSource::factory):
1172         (WebCore::CoreAudioCaptureSource::CoreAudioCaptureSource):
1173         (WebCore::CoreAudioCaptureSource::~CoreAudioCaptureSource):
1174         (WebCore::CoreAudioCaptureSource::startProducingData):
1175         (WebCore::CoreAudioCaptureSource::scheduleReconfiguration):
1176         (WebCore::CoreAudioCaptureSource::beginInterruption):
1177         (WebCore::CoreAudioCaptureSource::endInterruption):
1178         * platform/mediastream/mac/CoreAudioCaptureSource.h:
1179         (WebCore::CoreAudioCaptureSourceFactory::setCoreAudioActiveSource):
1180         (WebCore::CoreAudioCaptureSourceFactory::unsetCoreAudioActiveSource):
1181         (WebCore::CoreAudioCaptureSourceFactory::coreAudioActiveSource):
1182
1183 2018-02-08  Chris Dumez  <cdumez@apple.com>
1184
1185         There should be a way to disable [OverrideBuiltins] behavior in a given DOMWrapperWorld
1186         https://bugs.webkit.org/show_bug.cgi?id=182524
1187         <rdar://problem/9057327>
1188
1189         Reviewed by Ryosuke Niwa.
1190
1191         Add new flag on DOMWrapperWorld indicating if the [OverrideBuiltins] behavior should
1192         be enabled in this world or not. The behavior is enabled by default for Web-compatibility.
1193         This flag is queried in accessVisibleNamedProperty() when doing the named property
1194         lookup.
1195
1196         Covered by new API test.
1197
1198         * bindings/js/DOMWrapperWorld.h:
1199         (WebCore::DOMWrapperWorld::disableOverrideBuiltinsBehavior):
1200         (WebCore::DOMWrapperWorld::shouldDisableOverrideBuiltinsBehavior const):
1201         * bindings/js/JSDOMAbstractOperations.h:
1202         (WebCore::accessVisibleNamedProperty):
1203
1204 2018-02-08  Per Arne Vollan  <pvollan@apple.com>
1205
1206         Move WebVideoFullscreenController from WebCore to WebKitLegacy.
1207         https://bugs.webkit.org/show_bug.cgi?id=182615
1208
1209         Reviewed by Eric Carlson.
1210
1211         It is only used by WK1. Also there are a few references to NSApp in WebVideoFullscreenController.mm.
1212         Ideally, we should not reference NSApp in WebCore.
1213
1214         No new tests. No change in behavior.
1215
1216         * SourcesMac.txt:
1217         * WebCore.xcodeproj/project.pbxproj:
1218         * html/HTMLMediaElement.h:
1219         * platform/mac/WebVideoFullscreenController.h: Removed.
1220         * platform/mac/WebVideoFullscreenController.mm: Removed.
1221         * platform/mac/WebVideoFullscreenHUDWindowController.h: Removed.
1222         * platform/mac/WebVideoFullscreenHUDWindowController.mm: Removed.
1223         * platform/mac/WebWindowAnimation.h: Removed.
1224         * platform/mac/WebWindowAnimation.mm: Removed.
1225
1226 2018-02-08  Chris Dumez  <cdumez@apple.com>
1227
1228         Form submission after navigation fails when decidePolicyForNavigationAction is async
1229         https://bugs.webkit.org/show_bug.cgi?id=182412
1230         <rdar://problem/35181099>
1231
1232         Reviewed by Alex Christensen.
1233
1234         When the form is submitted and schedules the load in an iframe that is already loading,
1235         FrameLoader::stopLoading() is called as expected. However, because policy checks can
1236         now be asynchronous, stopLoading() also needs to stop pending policy checks. Otherwise,
1237         continueLoadAfterNavigationPolicy() gets called for a cancelled load and we're in trouble
1238         because the FrameLoader was reused for another load since then.
1239
1240         Test: http/tests/navigation/sync-form-submit-iframe.html
1241
1242         * loader/FrameLoader.cpp:
1243         (WebCore::FrameLoader::stopLoading):
1244
1245 2018-02-08  Zalan Bujtas  <zalan@apple.com>
1246
1247         [RenderTreeBuilder] Do not use RenderTreeBuilder::current() in RenderRubyRun::takeChild
1248         https://bugs.webkit.org/show_bug.cgi?id=182607
1249         <rdar://problem/37355944>
1250
1251         Reviewed by Sam Weinig.
1252
1253         No change in functionality.
1254
1255         * rendering/RenderRubyRun.cpp:
1256         (WebCore::RenderRubyRun::takeChild):
1257
1258 2018-02-08  Antti Koivisto  <antti@apple.com>
1259
1260         Use invalidation rulesets for attribute selectors
1261         https://bugs.webkit.org/show_bug.cgi?id=182569
1262
1263         Reviewed by Zalan Bujtas.
1264
1265         Attribute change style invalidation should use invalidation rulesets, similarly how class change invalidation already does.
1266         We'll invalidate fewer unnecessary elements immediately and enable more significant future gains.
1267
1268         * css/DocumentRuleSets.cpp:
1269         (WebCore::DocumentRuleSets::collectFeatures const):
1270         (WebCore::DocumentRuleSets::classInvalidationRuleSets const):
1271         (WebCore::DocumentRuleSets::attributeInvalidationRuleSets const):
1272
1273         Make and cache invalidation RuleSets for an attribute.
1274
1275         (WebCore::DocumentRuleSets::ancestorAttributeRulesForHTML const): Deleted.
1276         * css/DocumentRuleSets.h:
1277         * css/RuleFeature.cpp:
1278         (WebCore::RuleFeatureSet::recursivelyCollectFeaturesFromSelector):
1279
1280         Collect attribute selectors along with match elements.
1281
1282         (WebCore::RuleFeatureSet::collectFeatures):
1283         (WebCore::RuleFeatureSet::add):
1284         (WebCore::RuleFeatureSet::registerContentAttribute):
1285
1286         Separate hash to deal with invalidation of content:attr(foo) special case.
1287
1288         (WebCore::RuleFeatureSet::clear):
1289         (WebCore::RuleFeatureSet::shrinkToFit):
1290         (WebCore::makeAttributeSelectorKey): Deleted.
1291         * css/RuleFeature.h:
1292         (WebCore::RuleFeature::RuleFeature):
1293         * css/StyleBuilderCustom.h:
1294         (WebCore::StyleBuilderCustom::applyValueContent):
1295         (WebCore::StyleBuilderCustom::applyValueAlt):
1296
1297         Use registerContentAttribute()
1298
1299         * html/HTMLEmbedElement.cpp:
1300         (WebCore::hasTypeOrSrc):
1301         (WebCore::HTMLEmbedElement::parseAttribute):
1302
1303             Invalidate style if both type and src attributes go missing as this changes result of rendererIsNeeded().
1304             This was previously relying on any attribute change invalidating style.
1305
1306         (WebCore::HTMLEmbedElement::rendererIsNeeded):
1307         * style/AttributeChangeInvalidation.cpp:
1308         (WebCore::Style::AttributeChangeInvalidation::invalidateStyle):
1309
1310         Collect the invalidation rulesets for this attribute change.
1311         Also check if any attribute selector actually changes state, unlike with classes attribute changes may
1312         often not lead to a selector becoming non-matching.
1313
1314         (WebCore::Style::AttributeChangeInvalidation::invalidateStyleWithRuleSets):
1315         (WebCore::Style::AttributeChangeInvalidation::invalidateDescendants): Deleted.
1316         * style/AttributeChangeInvalidation.h:
1317         (WebCore::Style::AttributeChangeInvalidation::AttributeChangeInvalidation):
1318         (WebCore::Style::AttributeChangeInvalidation::~AttributeChangeInvalidation):
1319         * style/ClassChangeInvalidation.cpp:
1320         (WebCore::Style::ClassChangeInvalidation::computeInvalidation):
1321
1322         Should not bail on shadow tree invalidation as we may also need to invalidate siblings.
1323
1324 2018-02-08  Zalan Bujtas  <zalan@apple.com>
1325
1326         [RenderTreeBuilder] Introduce RenderTreeBuilder to moveChild(ren)To() functions
1327         https://bugs.webkit.org/show_bug.cgi?id=182596
1328         <rdar://problem/37340553>
1329
1330         Reviewed by Sam Weinig.
1331
1332         This is in preparation for moving mutation code out of moveChildTo/moveChildrenTo. 
1333
1334         No change in functionality.
1335
1336         * rendering/RenderBlock.cpp:
1337         (WebCore::RenderBlock::dropAnonymousBoxChild):
1338         (WebCore::RenderBlock::takeChild):
1339         * rendering/RenderBlock.h:
1340         (WebCore::RenderBlock::moveAllChildrenIncludingFloatsTo):
1341         * rendering/RenderBlockFlow.cpp:
1342         (WebCore::RenderBlockFlow::styleDidChange):
1343         (WebCore::RenderBlockFlow::moveAllChildrenIncludingFloatsTo):
1344         * rendering/RenderBlockFlow.h:
1345         * rendering/RenderBoxModelObject.cpp:
1346         (WebCore::RenderBoxModelObject::moveChildTo):
1347         (WebCore::RenderBoxModelObject::moveChildrenTo):
1348         * rendering/RenderBoxModelObject.h:
1349         (WebCore::RenderBoxModelObject::moveChildTo):
1350         (WebCore::RenderBoxModelObject::moveAllChildrenTo):
1351         (WebCore::RenderBoxModelObject::moveChildrenTo):
1352         * rendering/RenderElement.cpp:
1353         (WebCore::RenderElement::styleDidChange):
1354         (WebCore::RenderElement::removeAnonymousWrappersForInlinesIfNecessary): Deleted.
1355         * rendering/RenderElement.h:
1356         * rendering/RenderRubyRun.cpp:
1357         (WebCore::RenderRubyRun::takeChild):
1358         * rendering/updating/RenderTreeBuilder.cpp:
1359         (WebCore::RenderTreeBuilder::makeChildrenNonInline):
1360         (WebCore::RenderTreeBuilder::splitAnonymousBoxesAroundChild):
1361         (WebCore::RenderTreeBuilder::removeAnonymousWrappersForInlineChildrenIfNeeded):
1362         (WebCore::RenderTreeBuilder::childFlowStateChangesAndNoLongerAffectsParentBlock):
1363         (WebCore::RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers):
1364         * rendering/updating/RenderTreeBuilder.h:
1365         * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
1366         (WebCore::RenderTreeBuilder::MultiColumn::createFragmentedFlow):
1367         (WebCore::RenderTreeBuilder::MultiColumn::destroyFragmentedFlow):
1368         * rendering/updating/RenderTreeBuilderRuby.cpp:
1369         (WebCore::RenderTreeBuilder::Ruby::moveInlineChildren):
1370         (WebCore::RenderTreeBuilder::Ruby::moveBlockChildren):
1371         * rendering/updating/RenderTreeBuilderTable.cpp:
1372         (WebCore::RenderTreeBuilder::Table::collapseAndDestroyAnonymousSiblingRows):
1373
1374 2018-02-08  Matt Lewis  <jlewis3@apple.com>
1375
1376         Unreviewed, rolling out r228261.
1377
1378         This broke an internal build
1379
1380         Reverted changeset:
1381
1382         "Add a way to check if a host is an IP address"
1383         https://bugs.webkit.org/show_bug.cgi?id=182427
1384         https://trac.webkit.org/changeset/228261
1385
1386 2018-02-08  Philippe Normand  <pnormand@igalia.com>
1387
1388         [GStreamer] WebKit improperly handles missing GStreamer elements
1389         https://bugs.webkit.org/show_bug.cgi?id=171205
1390
1391         Reviewed by Michael Catanzaro.
1392
1393         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1394         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): Add a
1395         test checking the videoflip element was correctly created. It
1396         might not be available on some exotic distros such as Gentoo.
1397
1398 2018-02-08  Chris Fleizach  <cfleizach@apple.com>
1399
1400         AX: Defer attribute computation until needed.
1401         https://bugs.webkit.org/show_bug.cgi?id=182386
1402         <rdar://problem/37115277>
1403
1404         Reviewed by Zalan Bujtas.
1405
1406         Accessibility is doing too much work when handling attribute changes. Here's how we can improve this:
1407            1) Defer attribute changes while the tree is dirty (and coalesce them). 
1408            2) Don't create AXObjects when an attribute changes unnecessarily. If no client has requested an ax object, it's likely no work needs to be done
1409                  (with the exception of a few attributes like aria-modal)
1410            3) Stop calculating the entire accessible ARIA label when trying to decide if an element should be ignored. That's generally wasteful and the
1411                  consequence of including more AX elements in the tree is very minimal.
1412
1413         * accessibility/AXObjectCache.cpp:
1414         (WebCore::rendererNeedsDeferredUpdate):
1415         (WebCore::nodeAndRendererAreValid):
1416         (WebCore::AXObjectCache::remove):
1417         (WebCore::AXObjectCache::handleAriaExpandedChange):
1418         (WebCore::AXObjectCache::handleAriaRoleChanged):
1419         (WebCore::AXObjectCache::deferAttributeChangeIfNeeded):
1420         (WebCore::AXObjectCache::shouldProcessAttributeChange):
1421         (WebCore::AXObjectCache::handleAttributeChange):
1422         (WebCore::AXObjectCache::prepareForDocumentDestruction):
1423         (WebCore::AXObjectCache::performDeferredCacheUpdate):
1424         (WebCore::AXObjectCache::deferRecomputeIsIgnoredIfNeeded):
1425         (WebCore::AXObjectCache::deferRecomputeIsIgnored):
1426         (WebCore::AXObjectCache::deferTextChangedIfNeeded):
1427         (WebCore::AXObjectCache::deferSelectedChildrenChangedIfNeeded):
1428         (WebCore::AXObjectCache::handleAttributeChanged): Deleted.
1429         * accessibility/AXObjectCache.h:
1430         (WebCore::AXObjectCache::deferAttributeChangeIfNeeded):
1431         (WebCore::AXObjectCache::handleAttributeChanged): Deleted.
1432         * accessibility/AccessibilityNodeObject.cpp:
1433         (WebCore::AccessibilityNodeObject::hasAttributesRequiredForInclusion const):
1434         * accessibility/AccessibleNode.cpp:
1435         (WebCore::AccessibleNode::notifyAttributeChanged):
1436         * dom/Element.cpp:
1437         (WebCore::Element::attributeChanged): 
1438
1439 2018-02-08  Chris Dumez  <cdumez@apple.com>
1440
1441         Unreviewed, tiny partial rollout of r228260 as it caused some worker failures
1442
1443         * bindings/js/JSDOMGlobalObject.cpp:
1444         (WebCore::toJSDOMGlobalObject):
1445         * bindings/js/JSDOMGlobalObject.h:
1446         * bindings/js/JSErrorHandler.cpp:
1447         (WebCore::JSErrorHandler::handleEvent):
1448         * bindings/js/JSEventListener.cpp:
1449         (WebCore::toJSDOMGlobalObject): Deleted.
1450
1451 2018-02-08  Zalan Bujtas  <zalan@apple.com>
1452
1453         [RenderTreeBuilder] Move RenderElement::removeAnonymousWrappersForInlinesIfNecessary to RenderTreeBuilder
1454         https://bugs.webkit.org/show_bug.cgi?id=182582
1455         <rdar://problem/37327890>
1456
1457         Reviewed by Antti Koivisto.
1458
1459         Tree mutation -> RenderTreeBuilder.
1460
1461         No change in functionality
1462
1463         * rendering/RenderElement.cpp:
1464         (WebCore::RenderElement::styleDidChange):
1465         (WebCore::RenderElement::removeAnonymousWrappersForInlinesIfNecessary): Deleted.
1466         * rendering/RenderElement.h:
1467         * rendering/updating/RenderTreeBuilder.cpp:
1468         (WebCore::removeAnonymousWrappersForInlinesIfNecessary):
1469         (WebCore::RenderTreeBuilder::childFlowStateChangesAndNoLongerAffectsParentBlock):
1470         (WebCore::RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers):
1471         * rendering/updating/RenderTreeBuilder.h:
1472
1473 2018-02-08  Philippe Normand  <pnormand@igalia.com>
1474
1475         [GStreamer] LayoutTest webaudio/silent-audio-interrupted-in-background.html makes its subsequent test flaky crash
1476         https://bugs.webkit.org/show_bug.cgi?id=173916
1477
1478         Reviewed by Xabier Rodriguez Calvar.
1479
1480         This patch fixes two crashes and a runtime warning:
1481
1482         - The provider client configuration should be done from the main
1483         thread but the no-more-pads signal of deinterleave was fired from
1484         a non-main thread.
1485
1486         - The deinterleave pad-removed signal can be fired for a not fully
1487         configured pipeline if the audio context is interrupted. So the
1488         peer quark of the removed pad needs to be checked, it might be a
1489         null pointer.
1490
1491         - The provider connects to the deinterleave signals only when a
1492         client is provided, so the signal disconnection needs to check
1493         that to avoid runtime warnings.
1494
1495         * platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp:
1496         (WebCore::AudioSourceProviderGStreamer::AudioSourceProviderGStreamer):
1497         Create a main thread notifier.
1498         (WebCore::AudioSourceProviderGStreamer::~AudioSourceProviderGStreamer):
1499         Invalidate notifier and check a client was set before
1500         disconnecting from deinterleave signals.
1501         (WebCore::AudioSourceProviderGStreamer::handleRemovedDeinterleavePad):
1502         Check validity of the pad peer.
1503         (WebCore::AudioSourceProviderGStreamer::deinterleavePadsConfigured):
1504         Set client from main thread.
1505         * platform/audio/gstreamer/AudioSourceProviderGStreamer.h:
1506
1507 2018-02-08  Philippe Normand  <pnormand@igalia.com>
1508
1509         [GStreamer][WebAudio] No need for version check in each loop iteration
1510         https://bugs.webkit.org/show_bug.cgi?id=182577
1511
1512         Reviewed by Xabier Rodriguez Calvar.
1513
1514         * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
1515         (webkit_web_audio_src_init): Detect version once only, when creating the element.
1516         (webKitWebAudioSrcLoop): Use boolean variable instead of checking the version every time.
1517
1518 2018-02-08  Frederic Wang  <fwang@igalia.com>
1519
1520         Add scrolling node types to distinguish main frames and subframes.
1521         https://bugs.webkit.org/show_bug.cgi?id=182533
1522
1523         Reviewed by Simon Fraser.
1524
1525         This patch splits FrameScrollingNode type into two types: MainFrameScrollingNode and
1526         SubframeScrollingNode. This is needed because new places in the code are likely to
1527         distinguish them e.g. in ScrollingTreeScrollingNodeDelegateIOS::updateChildNodesAfterScroll
1528         or when iOS frame scrolling is introduced (see bug 173833).
1529
1530         No new tests, behavior unchanged.
1531
1532         * page/scrolling/AsyncScrollingCoordinator.cpp:
1533         (WebCore::AsyncScrollingCoordinator::ensureRootStateNodeForFrameView): This is only called
1534         for main frames, so pass MainFrameScrollingNode.
1535         * page/scrolling/ScrollingCoordinator.cpp:
1536         (WebCore::operator<<): Distinguish subframe and main frame when dumping.
1537         * page/scrolling/ScrollingCoordinator.h: Split FrameScrollingNode into two cases.
1538         * page/scrolling/ScrollingStateFrameScrollingNode.cpp: Add node type to constructor and
1539         ASSERT it remains of type FrameScrollingNode.
1540         (WebCore::ScrollingStateFrameScrollingNode::create):
1541         (WebCore::ScrollingStateFrameScrollingNode::ScrollingStateFrameScrollingNode):
1542         * page/scrolling/ScrollingStateFrameScrollingNode.h: Add node type to constructor.
1543         * page/scrolling/ScrollingStateNode.h:
1544         (WebCore::ScrollingStateNode::isFrameScrollingNode const): Includes the two cases.
1545         * page/scrolling/ScrollingStateTree.cpp:
1546         (WebCore::ScrollingStateTree::createNode): Split FrameScrollingNode into two cases and pass
1547         the node type.
1548         (WebCore::ScrollingStateTree::attachNode): The first case only happens for main frames while
1549         the second case only happens with subframes. Use the appriate node type.
1550         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp: Add node type to constructor and
1551         ASSERT it remains of type FrameScrollingNode.
1552         (WebCore::ScrollingTreeFrameScrollingNode::ScrollingTreeFrameScrollingNode):
1553         * page/scrolling/ScrollingTreeFrameScrollingNode.h: Add node type to constructor.
1554         * page/scrolling/ScrollingTreeNode.h: Includes the two cases.
1555         (WebCore::ScrollingTreeNode::isFrameScrollingNode const):
1556         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.h: Add node type to constructor.
1557         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm: Ditto.
1558         (WebCore::ScrollingTreeFrameScrollingNodeIOS::create):
1559         (WebCore::ScrollingTreeFrameScrollingNodeIOS::ScrollingTreeFrameScrollingNodeIOS):
1560         * page/scrolling/ios/ScrollingTreeIOS.cpp: Split FrameScrollingNode into two cases.
1561         (WebCore::ScrollingTreeIOS::createScrollingTreeNode):
1562         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h: Add node type to constructor.
1563         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm: Ditto.
1564         (WebCore::ScrollingTreeFrameScrollingNodeMac::create):
1565         (WebCore::ScrollingTreeFrameScrollingNodeMac::ScrollingTreeFrameScrollingNodeMac):
1566         * page/scrolling/mac/ScrollingTreeMac.cpp: Split FrameScrollingNode into two cases.
1567         (ScrollingTreeMac::createScrollingTreeNode):
1568         * rendering/RenderLayerCompositor.cpp:
1569         (WebCore::RenderLayerCompositor::reattachSubframeScrollLayers): Distinguish the cases of
1570         main frames and subframes.
1571         (WebCore::scrollCoordinationRoleForNodeType): Split FrameScrollingNode into two cases.
1572         (WebCore::RenderLayerCompositor::updateScrollCoordinationForThisFrame): Distinguish the cases
1573         of main frames and subframes.
1574         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer): Split FrameScrollingNode into
1575         two cases.
1576
1577 2018-02-07  Darin Adler  <darin@apple.com>
1578
1579         Try to fix ErrorEvent tests seen failing on buildbot after fix for bug 179591.
1580
1581         * bindings/js/JSErrorHandler.cpp:
1582         (WebCore::JSErrorHandler::handleEvent): Add back line of code accidentally removed.
1583
1584 2018-02-05  Carlos Garcia Campos  <cgarcia@igalia.com>
1585
1586         Add a way to check if a host is an IP address
1587         https://bugs.webkit.org/show_bug.cgi?id=182427
1588
1589         Reviewed by Alex Christensen.
1590
1591         There are several places where this is needed. We currently just assume that any host ending in a digit is an IP
1592         address, except in PublicSuffix where platform specific code is used. This patch adds URL::hostIsIPAddress()
1593         platform specific implementations, falling back to current assumption if there isn't an implementation for the
1594         platform.
1595
1596         * page/OriginAccessEntry.cpp:
1597         (WebCore::OriginAccessEntry::OriginAccessEntry): Use URL::hostIsIPAddress().
1598         * platform/URL.cpp:
1599         (WebCore::URL::hostIsIPAddress): Fallback implementation.
1600         * platform/URL.h:
1601         * platform/mac/PublicSuffixMac.mm:
1602         (WebCore::topPrivatelyControlledDomain): Use URL::hostIsIPAddress().
1603         * platform/mac/URLMac.mm:
1604         (WebCore::URL::hostIsIPAddress): Move implementation from PublicSuffixMac.mm.
1605         * platform/network/curl/CookieUtil.cpp:
1606         (WebCore::CookieUtil::isIPAddress): Use URL::hostIsIPAddress().
1607         * platform/soup/URLSoup.cpp:
1608         (WebCore::URL::hostIsIPAddress): Use g_hostname_is_ip_address().
1609
1610 2018-01-13  Darin Adler  <darin@apple.com>
1611
1612         Event improvements
1613         https://bugs.webkit.org/show_bug.cgi?id=179591
1614
1615         Reviewed by Chris Dumez.
1616
1617         - removed all use of Deprecated::ScriptValue
1618
1619         - fixed uses of JSC::Strong that can lead to reference cycles in CustomEvent,
1620           MessageEvent, and PopStateEvent, refactoring to share more code
1621
1622         - removed incorrect use of CachedAttribute on attributes that can change values
1623           (should have fixed a bug; can we find a way to test this?)
1624
1625         - did a more thorough job of clearing state from events, including clearing
1626           certain things before dispatching, and clearing more in initKeyboardEvent
1627           (may have fixed some obscure low-severity bugs; can we find a way to test this?)
1628
1629         - removed "dummy" keyboard events
1630
1631         - reworked code that omits details from error events for security reasons;
1632           old approach was "sanitizing" the error by removing the details if not
1633           allowed, new approach is adding the details only if allowed
1634
1635         * Modules/encryptedmedia/NavigatorEME.h: Added forward declaration needed
1636         to compile.
1637
1638         * Modules/indexeddb/IDBCursor.h: Added comment about incorrect use of JSC::Strong.
1639         * Modules/indexeddb/IDBRequest.h: Ditto.
1640         * Modules/paymentrequest/PaymentResponse.h: Ditto.
1641
1642         * WebCore.xcodeproj/project.pbxproj: Added JSValueInWrappedObject.h.
1643
1644         * bindings/js/CommonVM.cpp:
1645         (WebCore::commonVMSlow): Use VM::create instead of VM::createLeaked. Also use
1646         local variable instead of the global.
1647
1648         * bindings/js/DOMWrapperWorld.h: Put the inline bodies of the currentWorld and
1649         worldForDOMObject functions separate from the declarations; long term goal is
1650         that the declarations serve as documentation, and are not interspersed with the
1651         implementations. Changed currentWorld to take a reference instead of a pointer
1652         to ExecState. Added isWorldCompatible function.
1653
1654         * bindings/js/JSCustomElementInterface.cpp:
1655         (WebCore::JSCustomElementInterface::upgradeElement): Use toJSDOMWindow instead
1656         of toJSDOMGlobalObject and added check for null.
1657         (WebCore::JSCustomElementInterface::invokeCallback): Ditto.
1658
1659         * bindings/js/JSCustomEventCustom.cpp:
1660         (WebCore::JSCustomEvent::detail const): Use cachedPropertyValue.
1661         (WebCore::JSCustomEvent::visitAdditionalChildren): Added. Needed now that we are
1662         using JSValueInWrappedObject instead of JSC::Strong.
1663
1664         * bindings/js/JSDOMConvertEventListener.h:
1665         (WebCore::Converter<IDLEventListener<T>>::convert): Pass a reference.
1666         * bindings/js/JSDOMGlobalObject.cpp:
1667         (WebCore::toJSDOMGlobalObject): Ditto.
1668
1669         * bindings/js/JSDOMGlobalObject.cpp:
1670         (WebCore::JSDOMGlobalObject::JSDOMGlobalObject): Moved initialization to nullptr
1671         to the header.
1672         (WebCore::toJSDOMGlobalObject): Deleted.
1673         * bindings/js/JSDOMGlobalObject.h: Updated for the above.
1674
1675         * bindings/js/JSDOMWindowBase.h: Updated includes. Added "DOMWindow.h" but also
1676         expanded the deprecated "JSDOMBinding.h" into all the things it includes.
1677
1678         * bindings/js/JSDOMWindowProxy.cpp:
1679         (WebCore::JSDOMWindowProxy::finishCreation): Tweak argument type to match usage.
1680         (WebCore::JSDOMWindowProxy::create): Moved here from header, rolled in the code
1681         that creates the structure.
1682         (WebCore::JSDOMWindowProxy::setWindow): Take a reference instead of a pointer
1683         or a RefPtr&&.
1684         (WebCore::JSDOMWindowProxy::toWrapped): Use ? : instead of if.
1685         (WebCore::toJS): Pass a reference.
1686         * bindings/js/JSDOMWindowProxy.h: Updated for abvoe changes.
1687
1688         * bindings/js/JSDOMWrapper.cpp:
1689         (WebCore::cloneAcrossWorlds): Added.
1690         * bindings/js/JSDOMWrapper.h: Ditto.
1691
1692         * bindings/js/JSErrorHandler.cpp:
1693         (WebCore::JSErrorHandler::JSErrorHandler): Changed to take a reference.
1694         Marked inline.
1695         (WebCore::JSErrorHandler::create): Moved here from header. No longer inline, but
1696         the constructor is now inline, so same number of levels of function calls, and
1697         less code compiled at the call site and less to compile in the header.
1698         (WebCore::JSErrorHandler::handleEvent): Use toJSDOMWindow instead
1699         of toJSDOMGlobalObject.
1700         * bindings/js/JSErrorHandler.h: Ditto. Also made createJSErrorHandler take
1701         references instead of pointers.
1702
1703         * bindings/js/JSEventListener.cpp:
1704         (WebCore::JSEventListener::create): Moved here from the header.
1705         (WebCore::createEventListenerForEventHandlerAttribute): Updated for change to
1706         currentWorld.
1707         (WebCore::toJSDOMGlobalObject): Moved here from JSDOMGlobalObject.cpp because
1708         this is the only place this function is used now. Also, this was one of four
1709         different overrides and so it was good to delete the other three. Also updated
1710         to take a reference rather than a "must not be null" pointer.
1711         (WebCore::JSEventListener::handleEvent): Coding style tweaks.
1712         (WebCore::JSEventListener::virtualisAttribute const): Deleted. Now isAttribute
1713         is virtual and uses final as needed to remain inline-able and efficient.
1714         (WebCore::JSEventListener::operator== const): Use is<> and downcast<> instead
1715         of JSEventListener::cast.
1716         (WebCore::eventHandlerAttribute):  Updated for change to currentWorld.
1717         (WebCore::setEventHandlerAttribute): Ditto.
1718         (WebCore::setWindowEventHandlerAttribute): Ditto.
1719         (WebCore::setDocumentEventHandlerAttribute): Ditto.
1720
1721         * bindings/js/JSEventListener.h: Moved create functions into the cpp file.
1722         Removed the cast function, since callers can use is<> and downcast<> instead.
1723         Use final rather than override and made isAttribute override the virtual
1724         function in the base class, eliminating virtualIsAttribute.
1725
1726         * bindings/js/JSExtendableMessageEventCustom.cpp:
1727         (WebCore::JSExtendableMessageEvent::data const): Use isWorldCompatible.
1728         Still need to return here and fix the reference cycle for this class.
1729
1730         * bindings/js/JSLazyEventListener.cpp:
1731         (WebCore::eventParameterName): Moved up so it can be used by the constructor.
1732         (WebCore::convertZeroToOne): Added, so that the constructor can fix up text
1733         positions passed in to it as part of initializing a data member.
1734         (WebCore::JSLazyEventListener::JSLazyEventListener): Changed to take
1735         a CreationArguments object instead of lots of separate arguments.
1736         (WebCore::JSLazyEventListener::initializeJSFunction const): Removed unneeded
1737         checks of m_code and m_eventParameterName, both guaranteed not to be null
1738         by the constructor. Tweaked coding style a bit.
1739         (WebCore::JSLazyEventListener::create): Pass CreationArguments object.
1740         * bindings/js/JSLazyEventListener.h: Updated for above changes. Changed the
1741         m_eventParameterName to be a reference since it's always a global string
1742         that is never destroyed.
1743
1744         * bindings/js/JSMessageEventCustom.cpp:
1745         (WebCore::JSMessageEvent::data const): Use cachedPropertyValue and also
1746         updated for the new version of MessageEvent that uses a Variant instead
1747         of a type plus separate functions for each type.
1748         (WebCore::JSMessageEvent::visitAdditionalChildren): Added. Needed now that we are
1749         using JSValueInWrappedObject instead of JSC::Strong.
1750
1751         * bindings/js/JSPopStateEventCustom.cpp:
1752         (WebCore::JSPopStateEvent::state const): Use isWorldCompatible and also updated
1753         to use JSValueInWrappedObject instead of JSC::Strong. Would be nice to share more
1754         code with CustomEvent and MessageEvent, but at the moment they are subtly different.
1755         Changed cacheState from a function to a lambda.
1756         (WebCore::JSPopStateEvent::visitAdditionalChildren): Added. Needed now that we are
1757         using JSValueInWrappedObject instead of JSC::Strong.
1758
1759         * bindings/js/JSValueInWrappedObject.h: Added.
1760
1761         * bindings/js/ScriptCachedFrameData.cpp:
1762         (WebCore::ScriptCachedFrameData::restore): Updated for changes to JSDOMWindowProxy.
1763         * bindings/js/ScriptController.cpp:
1764         (WebCore::ScriptController::createWindowProxy): Ditto.
1765         (WebCore::ScriptController::setDOMWindowForWindowProxy): Ditto.
1766
1767         * bindings/js/WorkerScriptController.cpp: Removed include of ScriptValue.h.
1768         (WebCore::WorkerScriptController::evaluate): Reworked to use the new
1769         canIncludeErrorDetails instead of sanitizeScriptError. Added a FIXME about the
1770         strange handling of the error message out argument.
1771
1772         * bindings/scripts/CodeGeneratorJS.pm:
1773         (GenerateRuntimeEnableConditionalString): Pass a reference to worldForDOMObject.
1774         (GenerateImplementation): Removed an incorrect comment about a removed error
1775         check that is truly unneeded.
1776         (GenerateAttributeGetterBodyDefinition): Pass a reference to worldForDOMObject.
1777         (GenerateAttributeSetterBodyDefinition): Pass references to createJSErrorHandler
1778         and worldForDOMObject.
1779         (GenerateCallWith): Pass a reference to worldForDOMObject.
1780
1781         * bindings/scripts/test/JS/JSTestGlobalObject.cpp: Updated for above changes.
1782         * bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp: Ditto.
1783         * bindings/scripts/test/JS/JSTestObj.cpp: Ditto.
1784
1785         * dom/CustomEvent.cpp:
1786         (WebCore::CustomEvent::CustomEvent): Marked inline. Removed now unneeded
1787         ExecState argument.
1788         (WebCore::CustomEvent::create): Moved here from header. No longer inline, but
1789         the constructor is now inline, so same number of levels of function calls, and
1790         less code compiled at the call site and less to compile in the header.
1791         (WebCore::CustomEvent::initCustomEvent): Updated to use JSValueInWrappedObject.
1792         (WebCore::CustomEvent::trySerializeDetail): Deleted. Now handled by bindings.
1793         * dom/CustomEvent.h: Updated for the above.
1794         * dom/CustomEvent.idl: Added JSCustomMarkFunction and removed
1795         CallWith=ScriptState.
1796
1797         * dom/Document.cpp:
1798         (WebCore::Document::shouldBypassMainWorldContentSecurityPolicy const):
1799         Updated to pass reference to currentWorld but also rewrote to be more direct.
1800
1801         * dom/Element.cpp:
1802         (WebCore::Element::isKeyboardFocusable const): Take a pointer instead of a
1803         reference to the keyboard event. This function can be called with no event;
1804         before this patch we were using a "dummy event".
1805         * dom/Element.h: Ditto.
1806
1807         * dom/ErrorEvent.cpp:
1808         (WebCore::ErrorEvent::error): Use isWorldCompatible.
1809
1810         * dom/Event.cpp:
1811         (WebCore::Event::create): Moved here from header.
1812         (WebCore::Event::createForBindings): Ditto.
1813         (WebCore::Event::initEvent): Updated to use the name m_canceled instead of
1814         the name m_defaultPrevented.
1815         (WebCore::Event::resetBeforeDispatch): Added. Clears m_defaultHandled so
1816         a value left over from a previous dispatch doesn't affect the next dispatch.
1817
1818         * dom/Event.h: Renamed m_defaultPrevented to m_canceled to match specification
1819         terminology and be slightly clearer. Added resetBeforeDispatch. Removed the
1820         setDefaultPrevented function.
1821
1822         * dom/EventDispatcher.cpp:
1823         (WebCore::EventDispatcher::dispatchEvent): Added call to resetBeforeDispatch.
1824
1825         * dom/EventListener.h: Made isAttribute virtual and got rid of virtualIsAttribute,
1826         which was an alternative to using "final" before we had that in the language.
1827
1828         * dom/EventTarget.cpp:
1829         (WebCore::EventTarget::dispatchEvent): Added call to resetBeforeDispatch.
1830
1831         * dom/KeyboardEvent.cpp:
1832         (WebCore::KeyboardEvent::KeyboardEvent): Removed unneeded code that initializes
1833         m_handledByInputMethod to false; we do that in the class definition now.
1834         (WebCore::KeyboardEvent::create): Moved here from header.
1835         (WebCore::KeyboardEvent::createForBindings): Ditto.
1836         (WebCore::KeyboardEvent::initKeyboardEvent): Added code to reset m_charCode,
1837         m_isComposing, m_keyCode, m_repeat, m_underlyingPlatformEvent, m_which, m_code,
1838         and m_key. These are needed now that we can reuse an existing event; we don't
1839         want them getting out of sync with the other data members.
1840         (WebCore::KeyboardEvent::keyCode const): Updated for name change from m_keyEvent
1841         to m_underlyingPlatformEvent.
1842         (WebCore::KeyboardEvent::charCode const): Ditto.
1843         (WebCore::findKeyboardEvent): Deleted. Was unused.
1844         * dom/KeyboardEvent.h: Updated for the above. Removed KeyboardEvent::createForDummy.
1845
1846         * dom/MessageEvent.cpp:
1847         (WebCore::MessageEvent::MessageEvent): Removed unnneded ExecState argument.
1848         Simplified since m_data is now a Variant.
1849         (WebCore::MessageEvent::create): More of the same.
1850         (WebCore::MessageEvent::initMessageEvent): Ditto.
1851         (WebCore::MessageEvent::trySerializeData): Deleted.
1852         (WebCore::MessageEvent::data const): Deleted.
1853         * dom/MessageEvent.h: Use a Variant.
1854         * dom/MessageEvent.idl: Added JSCustomMarkFunction and removed
1855         CallWith=ScriptState and CachedAttribute.
1856
1857         * dom/MouseEvent.h: Removed obsolete comment.
1858         * dom/MouseEvent.idl: Wrap line differently.
1859
1860         * dom/PopStateEvent.cpp:
1861         (WebCore::PopStateEvent::PopStateEvent): Removed unneeded ExecState argument.
1862         Updated to use JSValueInWrappedObject.
1863         (WebCore::PopStateEvent::create): Ditto.
1864         (WebCore::PopStateEvent::trySerializeState): Ditto.
1865         * dom/PopStateEvent.h: Ditto.
1866         * dom/PopStateEvent.idl: Use JSCustomMarkFunction, and don't use
1867         ConstructorCallWith=ScriptState.
1868
1869         * dom/ScriptExecutionContext.cpp:
1870         (WebCore::ScriptExecutionContext::sanitizeScriptError): Deleted.
1871         (WebCore::ScriptExecutionContext::canIncludeErrorDetails): Added.
1872         (WebCore::ScriptExecutionContext::dispatchErrorEvent): Clarify by
1873         using canIncludeErrorDetails instead of sanitizeScriptError.
1874         * dom/ScriptExecutionContext.h: Ditto.
1875
1876         * dom/WheelEvent.cpp:
1877         (WebCore::WheelEvent::WheelEvent): Updated for name change and also to
1878         eliminate m_initializedWithPlatformWheelEvent.
1879         (WebCore::WheelEvent::create): Moved here from header.
1880         (WebCore::WheelEvent::createForBindings): Ditto.
1881         (WebCore::WheelEvent::initWebKitWheelEvent): Renamed from initWheelEvent.
1882         * dom/WheelEvent.h: Renamed initWheelEvent to initWebKitWheelEvent since
1883         there is no standard init function for wheel events and we have this only
1884         for backward compatibility. Got rid of the separate boolean
1885         m_initializedWithPlatformWheelEvent and instead made the renamed
1886         m_wheelEvent, m_underlyingPlatformEvent, optional for when there is no
1887         underlying platform event.
1888
1889         * html/BaseDateAndTimeInputType.cpp:
1890         (WebCore::BaseDateAndTimeInputType::isKeyboardFocusable const): Take a
1891         pointer to the event so we can handle the case where there is no event.
1892         * html/BaseDateAndTimeInputType.h: Ditto.
1893         * html/HTMLAnchorElement.cpp:
1894         (WebCore::HTMLAnchorElement::isKeyboardFocusable const): Ditto.
1895         * html/HTMLAnchorElement.h: Ditto.
1896         * html/HTMLAreaElement.cpp:
1897         (WebCore::HTMLAreaElement::isKeyboardFocusable const): Ditto.
1898         * html/HTMLAreaElement.h: Ditto.
1899         * html/HTMLDocument.cpp: Added include of "DOMWindow.h".
1900         * html/HTMLFormControlElement.cpp:
1901         (WebCore::HTMLFormControlElement::isKeyboardFocusable const): Take
1902         pointer to the event.
1903         * html/HTMLFormControlElement.h: Ditto.
1904         * html/HTMLFrameOwnerElement.cpp:
1905         (WebCore::HTMLFrameOwnerElement::isKeyboardFocusable const): Ditto.
1906         * html/HTMLFrameOwnerElement.h: Ditto.
1907         * html/HTMLIFrameElement.h: Ditto.
1908         * html/HTMLInputElement.cpp:
1909         (WebCore::HTMLInputElement::isKeyboardFocusable const): Ditto.
1910         (WebCore::HTMLInputElement::isTextFormControlKeyboardFocusable const): Ditto.
1911         * html/HTMLInputElement.h: Ditto.
1912         * html/HTMLPlugInElement.cpp:
1913         (WebCore::HTMLPlugInElement::isKeyboardFocusable const): Ditto.
1914         * html/HTMLPlugInElement.h: Ditto.
1915         * html/HTMLSelectElement.cpp:
1916         (WebCore::HTMLSelectElement::isKeyboardFocusable const): Ditto.
1917         * html/HTMLSelectElement.h: Ditto.
1918         * html/HTMLTextAreaElement.cpp:
1919         (WebCore::HTMLTextAreaElement::isKeyboardFocusable const): Ditto.
1920         * html/HTMLTextAreaElement.h: Ditto.
1921         * html/InputType.cpp:
1922         (WebCore::InputType::isKeyboardFocusable const): Ditto.
1923         * html/InputType.h: Ditto.
1924         * html/RadioInputType.cpp:
1925         (WebCore::RadioInputType::isKeyboardFocusable const): Ditto.
1926         * html/RadioInputType.h: Ditto.
1927         * html/TextFieldInputType.cpp:
1928         (WebCore::TextFieldInputType::isKeyboardFocusable const): Ditto.
1929         * html/TextFieldInputType.h: Ditto.
1930
1931         * inspector/CommandLineAPIHost.cpp:
1932         (WebCore::listenerEntriesFromListenerInfo): Pass reference to currentWorld.
1933         Use is<> and downcast<> instead of JSEventListener::cast.
1934         * inspector/PageScriptDebugServer.cpp:
1935         (WebCore::PageScriptDebugServer::isContentScript const): Pass reference to
1936         currentWorld.
1937         * inspector/agents/InspectorDOMAgent.cpp:
1938         (WebCore::InspectorDOMAgent::buildObjectForEventListener):
1939         Use is<> and downcast<> instead of JSEventListener::cast.
1940
1941         * mathml/MathMLElement.cpp:
1942         (WebCore::MathMLElement::isKeyboardFocusable const): Take a
1943         pointer to the event so we can handle the case where there is no event.
1944         * mathml/MathMLElement.h: Ditto.
1945
1946         * page/DOMWindow.cpp:
1947         (WebCore::DOMWindow::dispatchEvent): Added call to resetBeforeDispatch.
1948         All event dispatching paths now need to do this; there are 3.
1949
1950         * page/EventHandler.cpp:
1951         (WebCore::handleWheelEventInAppropriateEnclosingBox): Use the new
1952         underlyingPlatformEvent function, less confusing than calling a function
1953         named wheelEvent() on an object of type WheelEvent. Also, it returns
1954         a const& to std::optional instead of a pointer, so updated for that.
1955         (WebCore::EventHandler::defaultWheelEventHandler): Ditto.
1956         (WebCore::EventHandler::internalKeyEvent): Use preventDefault instead
1957         of setDefaultPrevented(true).
1958         (WebCore::EventHandler::tabsToLinks const): Take a pointer.
1959         (WebCore::EventHandler::defaultArrowEventHandler): Pass a pointer.
1960         (WebCore::EventHandler::defaultTabEventHandler): Ditto.
1961         * page/EventHandler.h: Updated for the above.
1962
1963         * page/EventSource.cpp:
1964         (WebCore::EventSource::dispatchMessageEvent): Pass a reference rather
1965         than a pointer when creating a message event.
1966
1967         * page/FocusController.cpp:
1968         (WebCore::isFocusableElementOrScopeOwner): Use a pointer instead of reference
1969         for keyboard event.
1970         (WebCore::isNonFocusableScopeOwner): Ditto.
1971         (WebCore::isFocusableScopeOwner): Ditto.
1972         (WebCore::shadowAdjustedTabIndex): Ditto.
1973         (WebCore::FocusController::findFocusableElementDescendingIntoSubframes):
1974         Renamed to use simpler terminology than "descending down into frame document".
1975         Changed to take a pointer instead of reference.
1976         (WebCore::FocusController::setInitialFocus): Pass nullptr instead of
1977         using KeyboardEvent::createForDummy.
1978         (WebCore::FocusController::advanceFocus): Pointer instead of reference.
1979         (WebCore::FocusController::advanceFocusInDocumentOrder): Ditto.
1980         (WebCore::FocusController::findFocusableElementAcrossFocusScope): Ditto.
1981         (WebCore::FocusController::findFocusableElementWithinScope): Ditto.
1982         (WebCore::FocusController::nextFocusableElementWithinScope): Ditto.
1983         (WebCore::FocusController::previousFocusableElementWithinScope): Ditto.
1984         (WebCore::FocusController::findFocusableElementOrScopeOwner): Ditto.
1985         (WebCore::FocusController::findElementWithExactTabIndex): Ditto.
1986         (WebCore::nextElementWithGreaterTabIndex): Ditto.
1987         (WebCore::previousElementWithLowerTabIndex): Ditto.
1988         (WebCore::FocusController::nextFocusableElement): Ditto.
1989         (WebCore::FocusController::previousFocusableElement): Ditto.
1990         (WebCore::FocusController::nextFocusableElementOrScopeOwner): Ditto.
1991         (WebCore::FocusController::previousFocusableElementOrScopeOwner): Ditto.
1992         (WebCore::FocusController::findFocusCandidateInContainer): Ditto.
1993         (WebCore::FocusController::advanceFocusDirectionallyInContainer): Ditto.
1994         (WebCore::FocusController::advanceFocusDirectionally): Ditto.
1995         * page/FocusController.h: Updated for the above.
1996
1997         * page/PageConsoleClient.cpp:
1998         (WebCore::objectArgumentAt): Added. Helper to make functions below simpler.
1999         (WebCore::canvasRenderingContext): Factored out logic to get the context
2000         from either a canvas or a canvas rendering context from the functions below.
2001         Also updated to not use ScriptValue and to use auto quite a bit more.
2002         (WebCore::PageConsoleClient::record): Updated to use the functions above.
2003         (WebCore::PageConsoleClient::recordEnd): Ditto.
2004
2005         * page/ios/EventHandlerIOS.mm:
2006         (WebCore::EventHandler::tabsToAllFormControls const): Take a pointer
2007         instead of a reference.
2008         * page/mac/EventHandlerMac.mm:
2009         (WebCore::EventHandler::tabsToAllFormControls const): Ditto.
2010         * page/win/EventHandlerWin.cpp:
2011         (WebCore::EventHandler::tabsToAllFormControls const): Ditto.
2012         * platform/glib/EventHandlerGLib.cpp:
2013         (WebCore::EventHandler::tabsToAllFormControls const): Ditto.
2014         * svg/SVGAElement.cpp:
2015         (WebCore::SVGAElement::isKeyboardFocusable const): Ditto.
2016         * svg/SVGAElement.h: Ditto.
2017
2018         * testing/Internals.cpp:
2019         (WebCore::Internals::isFromCurrentWorld const): Use isWorldCompatible.
2020
2021 2018-02-07  Andy Estes  <aestes@apple.com>
2022
2023         ASSERTION FAILED: vm->currentThreadIsHoldingAPILock() seen with http/tests/paymentrequest/payment-request-show-method.https.html
2024         https://bugs.webkit.org/show_bug.cgi?id=182591
2025
2026         Reviewed by Youenn Fablet.
2027
2028         Fixes assertion failures in http/tests/paymentrequest/payment-request-show-method.https.html.
2029
2030         DOMPromise::whenSettled() calls the JSC API without first aquiring the API lock, and
2031         r228195 added a call to whenSettled() where the lock is not guaranteed to be already
2032         acquired.
2033
2034         Fix this by creating a JSLockHolder in DOMPromise::whenSettled().
2035
2036         * bindings/js/JSDOMPromise.cpp:
2037         (WebCore::DOMPromise::whenSettled):
2038
2039 2018-02-07  Ryan Haddad  <ryanhaddad@apple.com>
2040
2041         Unreviewed, rolling out r228243.
2042
2043         Introduced an assertion failure with API test
2044         FullscreenZoomInitialFrame.WebKit
2045
2046         Reverted changeset:
2047
2048         "Assert that NSApp is not running in the WebProcess."
2049         https://bugs.webkit.org/show_bug.cgi?id=182553
2050         https://trac.webkit.org/changeset/228243
2051
2052 2018-02-07  Christopher Reid  <chris.reid@sony.com>
2053
2054         [Curl] Cookie Database has some warnings when compiled in clang
2055         https://bugs.webkit.org/show_bug.cgi?id=182583
2056
2057         Reviewed by Alex Christensen.
2058
2059         No new tests, no change in behavior.
2060
2061         Fixing unused-parameter, missing-field-initializers, reorder, and pragma-once-outside-header warnings.
2062
2063         * platform/network/NetworkStorageSession.h:
2064         * platform/network/curl/CookieJarCurlDatabase.cpp:
2065         * platform/network/curl/CookieJarDB.cpp:
2066         * platform/network/curl/NetworkStorageSessionCurl.cpp:
2067
2068 2018-02-07  Ryosuke Niwa  <rniwa@webkit.org>
2069
2070         Remove unused CSSParserContext in CSSParser::parseInlineStyleDeclaration
2071         https://bugs.webkit.org/show_bug.cgi?id=182587
2072
2073         Reviewed by Simon Fraser.
2074
2075         Removed the code. There is no need to create an unused CSSParserContext in CSSParser.
2076
2077         * css/parser/CSSParser.cpp:
2078         (WebCore::CSSParser::parseInlineStyleDeclaration):
2079         * css/parser/CSSParser.h:
2080         * css/parser/CSSParserImpl.cpp:
2081         (WebCore::CSSParserImpl::parseInlineStyleDeclaration):
2082         * css/parser/CSSParserImpl.h:
2083
2084 2018-02-07  Ross Kirsling  <ross.kirsling@sony.com>
2085
2086         Add missing #if ENABLE(VIDEO_TRACK) after r228201.
2087         https://bugs.webkit.org/show_bug.cgi?id=182585
2088
2089         Reviewed by Chris Dumez.
2090
2091         * loader/LinkPreloadResourceClients.h:
2092
2093 2018-02-07  Per Arne Vollan  <pvollan@apple.com>
2094
2095         Assert that NSApp is not running in the WebProcess.
2096         https://bugs.webkit.org/show_bug.cgi?id=182553
2097         <rdar://problem/37316144>
2098         
2099         Reviewed by Simon Fraser.
2100
2101         In WebCore, there are a few places where NSApp is referenced. Since the WebContent process
2102         is no longer using the NSApplication run loop, and NSApp is no longer guaranteed to be
2103         valid, we should make sure that the NSApp is not referenced by the WebContent process or
2104         the Network process, by asserting that the NSApplication event loop is running when NSApp
2105         is referenced. It is still ok for the UIProcess to reference NSApp. Adding these assert
2106         will help catch references to NSApp when the NSApplication run loop is not used.
2107         Also, do not post a fake mouse event in PasteBoard::setDragImage when the NSApplication
2108         run loop is not running, since this is only relevant in WK1.
2109
2110         No new tests, covered by existing tests. 
2111
2112         * page/mac/EventHandlerMac.mm:
2113         (WebCore::lastEventIsMouseUp):
2114         (WebCore::EventHandler::sendFakeEventsAfterWidgetTracking):
2115         * platform/mac/PasteboardMac.mm:
2116         (WebCore::Pasteboard::setDragImage):
2117         * platform/mac/WebVideoFullscreenController.mm:
2118         (-[WebVideoFullscreenController windowDidLoad]):
2119         (-[WebVideoFullscreenController updateMenuAndDockForFullscreen]):
2120         * platform/mac/WebWindowAnimation.mm:
2121         (WebCore::WebWindowAnimationDurationFromDuration):
2122
2123 2018-02-07  Youenn Fablet  <youenn@apple.com>
2124
2125         ASSERTION FAILED: m_timeOrigin in Performance::Performance()
2126         https://bugs.webkit.org/show_bug.cgi?id=182558
2127         <rdar://problem/37297551>
2128
2129         Reviewed by Chris Dumez.
2130
2131         Test: http/wpt/fetch/cors-preflight-star.any.serviceworker.html
2132
2133         * loader/CrossOriginPreflightChecker.cpp:
2134         (WebCore::CrossOriginPreflightChecker::startPreflight):
2135
2136 2018-02-07  Wenson Hsieh  <wenson_hsieh@apple.com>
2137
2138         REGRESSION(r226396): File paths are inserted when dropping image files
2139         https://bugs.webkit.org/show_bug.cgi?id=182557
2140         <rdar://problem/37294120>
2141
2142         Reviewed by Ryosuke Niwa.
2143
2144         Reverts unintended changes in <http://trac.webkit.org/r226396>. Before r226396, WebContentReader::readFilenames
2145         (a helper function in macOS-specific code) contained logic to create and insert attachment elements if
2146         ENABLE(ATTACHMENT_ELEMENT); otherwise, it would fall back to inserting the visible URL as a text node. Since we
2147         enable the attachment element on all Cocoa platforms via xcconfig files, this was effectively dead code.
2148
2149         However, when r226396 (which moved this out from macOS to Cocoa platform code) refactored this helper function,
2150         it also moved this chunk of code out of the !ENABLE(ATTACHMENT) conditional and into a PLATFORM(MAC) guard,
2151         which means that we now fall back to inserting file paths as text when attachment elements are disabled. To fix
2152         this, we simply remove the (previously) dead code.
2153
2154         A more subtle difference is that we no longer always return true from WebContentReader::readFilePaths. This
2155         means that when we drop files, we no longer skip over the early return in documentFragmentFromDragData when
2156         we've made a fragment, so we read the file path as a URL. To address this, we just restore the pre-macOS 10.13.4
2157         behavior of initializing the document fragment.
2158
2159         Test: modified editing/pasteboard/drag-files-to-editable-element-as-URLs.html.
2160
2161         * editing/WebContentReader.cpp:
2162         (WebCore::WebContentReader::ensureFragment): Deleted.
2163
2164         Remove this helper, as it was only used in WebContentReader::readFilePaths.
2165
2166         * editing/WebContentReader.h:
2167         * editing/cocoa/WebContentReaderCocoa.mm:
2168         (WebCore::WebContentReader::readFilePaths):
2169
2170 2018-02-07  John Wilander  <wilander@apple.com>
2171
2172         Restrict Referer to just the origin for third parties in private mode and third parties ITP blocks cookies for in regular mode
2173         https://bugs.webkit.org/show_bug.cgi?id=182559
2174         <rdar://problem/36990337>
2175
2176         Reviewed by Andy Estes.
2177
2178         Tests: http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-redirects.html
2179                http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-requests.html
2180                http/tests/security/strip-referrer-to-origin-for-third-party-redirects-in-private-mode.html
2181                http/tests/security/strip-referrer-to-origin-for-third-party-requests-in-private-mode.html
2182
2183         * page/SecurityPolicy.cpp:
2184         (WebCore::SecurityPolicy::referrerToOriginString):
2185             Now exposed within WebCore. This is to make sure we create a proper referrer
2186             string in WebCore::ResourceRequestBase::setExistingHTTPReferrerToOriginString().
2187         (WebCore::referrerToOriginString): Deleted.
2188             Used to be internal.
2189         * page/SecurityPolicy.h:
2190         * platform/network/ResourceRequestBase.cpp:
2191         (WebCore::ResourceRequestBase::setExistingHTTPReferrerToOriginString):
2192             New, exported function used in WebKit. Note that this function does not
2193             set the referrer if the request has none since before.
2194         * platform/network/ResourceRequestBase.h:
2195
2196
2197 2018-02-07  Zalan Bujtas  <zalan@apple.com>
2198
2199         [RenderTreeBuilder] Remove RenderElement::destroyLeftoverChildren.
2200         https://bugs.webkit.org/show_bug.cgi?id=182518
2201         <rdar://problem/37256035>
2202
2203         Reviewed by Antti Koivisto.
2204
2205         Remove leftover children before we call takeChild() on the parent (as opposed to when
2206         we finally call destroy() on the parent).
2207         This patch also explicitly destroys the top level pagination renderers.
2208
2209         Covered by existing tests.
2210
2211         * rendering/RenderElement.cpp:
2212         (WebCore::RenderElement::removeAndDestroyChild):
2213         (WebCore::RenderElement::destroyLeftoverChildren): Deleted.
2214         * rendering/RenderElement.h:
2215         * rendering/RenderObject.cpp:
2216         (WebCore::RenderObject::destroy):
2217         * rendering/updating/RenderTreeUpdater.cpp:
2218         (WebCore::RenderTreeUpdater::tearDownRenderers):
2219         (WebCore::RenderTreeUpdater::tearDownLeftoverPaginationRenderersIfNeeded):
2220         * rendering/updating/RenderTreeUpdater.h:
2221
2222 2018-02-07  Daniel Bates  <dabates@apple.com>
2223
2224         Log error when authentication challenge is blocked due to an insecure request
2225         https://bugs.webkit.org/show_bug.cgi?id=182358
2226
2227         Reviewed by Andy Estes.
2228
2229         Emit an error message to Web Inspector console that explains why an authentication
2230         challenge was blocked so that a developer can fix up their site.
2231
2232         Tests: http/tests/security/mixedContent/insecure-basic-auth-image.https.html
2233                http/tests/security/mixedContent/secure-page-navigates-to-basic-auth-insecure-page.https.html
2234                http/tests/security/mixedContent/secure-page-navigates-to-basic-auth-secure-page-via-insecure-redirect.https.html
2235
2236         * loader/FrameLoader.cpp:
2237         (WebCore::FrameLoader::receivedFirstData): Log to the console an error message
2238         if the document we are loading was forbidden from prompting for credentials.
2239         Also removed duplicate assertion to ensure document is non-null and update
2240         call to LinkLoader::loadLinksFromHeader() to use local variable to access
2241         the document we are loading instead of asking the frame for it, again.
2242         (WebCore::FrameLoader::reportAuthenticationChallengeBlocked): Added.
2243         * loader/FrameLoader.h:
2244
2245         * loader/ResourceLoader.cpp:
2246         (WebCore::ResourceLoader::init):
2247         (WebCore::ResourceLoader::willSendRequestInternal):
2248         Track the decision to forbid asking for credentials due to Fetch spec. requirements (m_canAskClientForCredentials)
2249         independently from the decision to forbid them due to making an insecure request (m_wasInsecureRequestSeen)
2250         so that we know the reason why we blocked asking for credentials when we receive an authentication challenge.
2251
2252         (WebCore::ResourceLoader::didBlockAuthenticationChallenge): Added.
2253         (WebCore::ResourceLoader::isAllowedToAskUserForCredentials const): Modified code now that we track
2254         whether we have seen an insecure request so far independently from decision to forbid prompting for
2255         credentials due to a Fetch spec. requirement.
2256
2257         (WebCore::ResourceLoader::didReceiveAuthenticationChallenge):
2258         Store a bit whether we have seen an insecure request when loading the resource so far. Disallow
2259         asking for credentials if we have seen an insecure request so far. Once we receive a response
2260
2261         * loader/ResourceLoader.h:
2262         (WebCore::ResourceLoader::wasAuthenticationChallengeBlocked const): Added.
2263         (WebCore::ResourceLoader::wasInsecureRequestSeen const): Added.
2264
2265 2018-02-06  Matt Lewis  <jlewis3@apple.com>
2266
2267         Removed the assertions from VideoFullscreenInterfaceAVKit.mm temporarily to stop the resulting crashes during debugging.
2268         https://bugs.webkit.org/show_bug.cgi?id=182527
2269
2270         Unreviewed build fix.
2271
2272         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
2273         (VideoFullscreenInterfaceAVKit::exitFullscreen):
2274         (VideoFullscreenInterfaceAVKit::cleanupFullscreen):
2275
2276 2018-02-07  Zalan Bujtas  <zalan@apple.com>
2277
2278         [RenderTreeBuilder] Move RenderBlock::removeLeftoverAnonymousBlock to RenderTreeBuilder
2279         https://bugs.webkit.org/show_bug.cgi?id=182510
2280         <rdar://problem/37250037>
2281
2282         Reviewed by Antti Koivisto.
2283
2284         Do not reinvent subtree reparenting.
2285
2286         Covered by existing tests.
2287
2288         * rendering/RenderBlock.cpp:
2289         (WebCore::RenderBlock::removeLeftoverAnonymousBlock): Deleted.
2290         * rendering/RenderBlock.h:
2291         * rendering/RenderBoxModelObject.cpp:
2292         (WebCore::RenderBoxModelObject::moveAllChildrenToInternal):
2293         * rendering/RenderBoxModelObject.h:
2294         * rendering/RenderButton.h:
2295         * rendering/RenderElement.cpp:
2296         (WebCore::RenderElement::detachRendererInternal):
2297         (WebCore::RenderElement::attachRendererInternal):
2298         (WebCore::RenderElement::insertChildInternal):
2299         (WebCore::RenderElement::takeChildInternal):
2300         * rendering/RenderElement.h:
2301         * rendering/RenderRuby.h:
2302         * rendering/RenderRubyRun.h:
2303         * rendering/RenderTextControl.h:
2304         * rendering/updating/RenderTreeBuilderBlock.cpp:
2305         (WebCore::RenderTreeBuilder::Block::insertChildIgnoringContinuation):
2306         (WebCore::RenderTreeBuilder::Block::childBecameNonInline):
2307         (WebCore::RenderTreeBuilder::Block::removeLeftoverAnonymousBlock):
2308         * rendering/updating/RenderTreeBuilderBlock.h:
2309
2310 2018-02-06  Don Olmstead  <don.olmstead@sony.com>
2311
2312         Remove WebCore/ForwardingHeaders directory
2313         https://bugs.webkit.org/show_bug.cgi?id=182347
2314
2315         Reviewed by Keith Miller.
2316
2317         No new tests. No change in behavior.
2318
2319         * CMakeLists.txt:
2320         * ForwardingHeaders/bindings/ScriptFunctionCall.h: Removed.
2321         * ForwardingHeaders/bindings/ScriptObject.h: Removed.
2322         * ForwardingHeaders/bindings/ScriptValue.h: Removed.
2323         * ForwardingHeaders/builtins/BuiltinNames.h: Removed.
2324         * ForwardingHeaders/builtins/BuiltinUtils.h: Removed.
2325         * ForwardingHeaders/builtins/JSCBuiltins.h: Removed.
2326         * ForwardingHeaders/bytecode/CodeBlock.h: Removed.
2327         * ForwardingHeaders/bytecode/SpeculatedType.h: Removed.
2328         * ForwardingHeaders/bytecode/UnlinkedFunctionExecutable.h: Removed.
2329         * ForwardingHeaders/debugger/Debugger.h: Removed.
2330         * ForwardingHeaders/domjit/DOMJITAbstractHeap.h: Removed.
2331         * ForwardingHeaders/domjit/DOMJITEffect.h: Removed.
2332         * ForwardingHeaders/domjit/DOMJITGetterSetter.h: Removed.
2333         * ForwardingHeaders/domjit/DOMJITHeapRange.h: Removed.
2334         * ForwardingHeaders/domjit/DOMJITSignature.h: Removed.
2335         * ForwardingHeaders/heap/BlockDirectoryInlines.h: Removed.
2336         * ForwardingHeaders/heap/DeleteAllCodeEffort.h: Removed.
2337         * ForwardingHeaders/heap/FastMallocAlignedMemoryAllocator.h: Removed.
2338         * ForwardingHeaders/heap/GCActivityCallback.h: Removed.
2339         * ForwardingHeaders/heap/GCFinalizationCallback.h: Removed.
2340         * ForwardingHeaders/heap/HandleTypes.h: Removed.
2341         * ForwardingHeaders/heap/Heap.h: Removed.
2342         * ForwardingHeaders/heap/HeapInlines.h: Removed.
2343         * ForwardingHeaders/heap/HeapObserver.h: Removed.
2344         * ForwardingHeaders/heap/IncrementalSweeper.h: Removed.
2345         * ForwardingHeaders/heap/LockDuringMarking.h: Removed.
2346         * ForwardingHeaders/heap/MachineStackMarker.h: Removed.
2347         * ForwardingHeaders/heap/MarkedBlockInlines.h: Removed.
2348         * ForwardingHeaders/heap/MarkingConstraint.h: Removed.
2349         * ForwardingHeaders/heap/RunningScope.h: Removed.
2350         * ForwardingHeaders/heap/SimpleMarkingConstraint.h: Removed.
2351         * ForwardingHeaders/heap/SlotVisitor.h: Removed.
2352         * ForwardingHeaders/heap/SlotVisitorInlines.h: Removed.
2353         * ForwardingHeaders/heap/Strong.h: Removed.
2354         * ForwardingHeaders/heap/StrongInlines.h: Removed.
2355         * ForwardingHeaders/heap/SubspaceInlines.h: Removed.
2356         * ForwardingHeaders/heap/ThreadLocalCache.h: Removed.
2357         * ForwardingHeaders/heap/Weak.h: Removed.
2358         * ForwardingHeaders/heap/WeakInlines.h: Removed.
2359         * ForwardingHeaders/inspector/ConsoleMessage.h: Removed.
2360         * ForwardingHeaders/inspector/ContentSearchUtilities.h: Removed.
2361         * ForwardingHeaders/inspector/IdentifiersFactory.h: Removed.
2362         * ForwardingHeaders/inspector/InjectedScript.h: Removed.
2363         * ForwardingHeaders/inspector/InjectedScriptBase.h: Removed.
2364         * ForwardingHeaders/inspector/InjectedScriptHost.h: Removed.
2365         * ForwardingHeaders/inspector/InjectedScriptManager.h: Removed.
2366         * ForwardingHeaders/inspector/InjectedScriptModule.h: Removed.
2367         * ForwardingHeaders/inspector/InspectorAgentBase.h: Removed.
2368         * ForwardingHeaders/inspector/InspectorAgentRegistry.h: Removed.
2369         * ForwardingHeaders/inspector/InspectorBackendDispatcher.h: Removed.
2370         * ForwardingHeaders/inspector/InspectorBackendDispatchers.h: Removed.
2371         * ForwardingHeaders/inspector/InspectorEnvironment.h: Removed.
2372         * ForwardingHeaders/inspector/InspectorFrontendChannel.h: Removed.
2373         * ForwardingHeaders/inspector/InspectorFrontendDispatchers.h: Removed.
2374         * ForwardingHeaders/inspector/InspectorFrontendRouter.h: Removed.
2375         * ForwardingHeaders/inspector/InspectorProtocolObjects.h: Removed.
2376         * ForwardingHeaders/inspector/InspectorProtocolTypes.h: Removed.
2377         * ForwardingHeaders/inspector/PerGlobalObjectWrapperWorld.h: Removed.
2378         * ForwardingHeaders/inspector/ScriptArguments.h: Removed.
2379         * ForwardingHeaders/inspector/ScriptBreakpoint.h: Removed.
2380         * ForwardingHeaders/inspector/ScriptCallFrame.h: Removed.
2381         * ForwardingHeaders/inspector/ScriptCallStack.h: Removed.
2382         * ForwardingHeaders/inspector/ScriptCallStackFactory.h: Removed.
2383         * ForwardingHeaders/inspector/ScriptDebugListener.h: Removed.
2384         * ForwardingHeaders/inspector/ScriptDebugServer.h: Removed.
2385         * ForwardingHeaders/inspector/agents/InspectorAgent.h: Removed.
2386         * ForwardingHeaders/inspector/agents/InspectorConsoleAgent.h: Removed.
2387         * ForwardingHeaders/inspector/agents/InspectorDebuggerAgent.h: Removed.
2388         * ForwardingHeaders/inspector/agents/InspectorHeapAgent.h: Removed.
2389         * ForwardingHeaders/inspector/agents/InspectorRuntimeAgent.h: Removed.
2390         * ForwardingHeaders/inspector/agents/InspectorScriptProfilerAgent.h: Removed.
2391         * ForwardingHeaders/interpreter/CallFrame.h: Removed.
2392         * ForwardingHeaders/interpreter/FrameTracers.h: Removed.
2393         * ForwardingHeaders/interpreter/ShadowChicken.h: Removed.
2394         * ForwardingHeaders/interpreter/StackVisitor.h: Removed.
2395         * ForwardingHeaders/jit/JITCode.h: Removed.
2396         * ForwardingHeaders/jit/JITMathICForwards.h: Removed.
2397         * ForwardingHeaders/jit/Snippet.h: Removed.
2398         * ForwardingHeaders/jit/SnippetParams.h: Removed.
2399         * ForwardingHeaders/jit/SpillRegistersMode.h: Removed.
2400         * ForwardingHeaders/masm/X86Assembler.h: Removed.
2401         * ForwardingHeaders/parser/ParserError.h: Removed.
2402         * ForwardingHeaders/parser/SourceCode.h: Removed.
2403         * ForwardingHeaders/parser/SourceProvider.h: Removed.
2404         * ForwardingHeaders/parser/SourceProviderCache.h: Removed.
2405         * ForwardingHeaders/profiler/ProfilerDatabase.h: Removed.
2406         * ForwardingHeaders/runtime/ArgList.h: Removed.
2407         * ForwardingHeaders/runtime/ArrayBuffer.h: Removed.
2408         * ForwardingHeaders/runtime/ArrayBufferView.h: Removed.
2409         * ForwardingHeaders/runtime/ArrayPrototype.h: Removed.
2410         * ForwardingHeaders/runtime/AuxiliaryBarrierInlines.h: Removed.
2411         * ForwardingHeaders/runtime/BooleanObject.h: Removed.
2412         * ForwardingHeaders/runtime/CallData.h: Removed.
2413         * ForwardingHeaders/runtime/CatchScope.h: Removed.
2414         * ForwardingHeaders/runtime/CommonIdentifiers.h: Removed.
2415         * ForwardingHeaders/runtime/Completion.h: Removed.
2416         * ForwardingHeaders/runtime/ConfigFile.h: Removed.
2417         * ForwardingHeaders/runtime/ConsoleClient.h: Removed.
2418         * ForwardingHeaders/runtime/ConsoleTypes.h: Removed.
2419         * ForwardingHeaders/runtime/ConstructAbility.h: Removed.
2420         * ForwardingHeaders/runtime/ConstructData.h: Removed.
2421         * ForwardingHeaders/runtime/DataView.h: Removed.
2422         * ForwardingHeaders/runtime/DateInstance.h: Removed.
2423         * ForwardingHeaders/runtime/Error.h: Removed.
2424         * ForwardingHeaders/runtime/ErrorHandlingScope.h: Removed.
2425         * ForwardingHeaders/runtime/ErrorInstance.h: Removed.
2426         * ForwardingHeaders/runtime/ErrorPrototype.h: Removed.
2427         * ForwardingHeaders/runtime/Exception.h: Removed.
2428         * ForwardingHeaders/runtime/ExceptionHelpers.h: Removed.
2429         * ForwardingHeaders/runtime/Float32Array.h: Removed.
2430         * ForwardingHeaders/runtime/Float64Array.h: Removed.
2431         * ForwardingHeaders/runtime/FunctionConstructor.h: Removed.
2432         * ForwardingHeaders/runtime/FunctionExecutable.h: Removed.
2433         * ForwardingHeaders/runtime/FunctionPrototype.h: Removed.
2434         * ForwardingHeaders/runtime/HashMapImpl.h: Removed.
2435         * ForwardingHeaders/runtime/Identifier.h: Removed.
2436         * ForwardingHeaders/runtime/IdentifierInlines.h: Removed.
2437         * ForwardingHeaders/runtime/InitializeThreading.h: Removed.
2438         * ForwardingHeaders/runtime/Int16Array.h: Removed.
2439         * ForwardingHeaders/runtime/Int32Array.h: Removed.
2440         * ForwardingHeaders/runtime/Int8Array.h: Removed.
2441         * ForwardingHeaders/runtime/InternalFunction.h: Removed.
2442         * ForwardingHeaders/runtime/Intrinsic.h: Removed.
2443         * ForwardingHeaders/runtime/IterationKind.h: Removed.
2444         * ForwardingHeaders/runtime/IteratorOperations.h: Removed.
2445         * ForwardingHeaders/runtime/IteratorPrototype.h: Removed.
2446         * ForwardingHeaders/runtime/JSAPIValueWrapper.h: Removed.
2447         * ForwardingHeaders/runtime/JSArray.h: Removed.
2448         * ForwardingHeaders/runtime/JSArrayBuffer.h: Removed.
2449         * ForwardingHeaders/runtime/JSArrayBufferView.h: Removed.
2450         * ForwardingHeaders/runtime/JSCInlines.h: Removed.
2451         * ForwardingHeaders/runtime/JSCJSValue.h: Removed.
2452         * ForwardingHeaders/runtime/JSCJSValueInlines.h: Removed.
2453         * ForwardingHeaders/runtime/JSCallee.h: Removed.
2454         * ForwardingHeaders/runtime/JSCell.h: Removed.
2455         * ForwardingHeaders/runtime/JSCellInlines.h: Removed.
2456         * ForwardingHeaders/runtime/JSDataView.h: Removed.
2457         * ForwardingHeaders/runtime/JSDestructibleObject.h: Removed.
2458         * ForwardingHeaders/runtime/JSDestructibleObjectHeapCellType.h: Removed.
2459         * ForwardingHeaders/runtime/JSExportMacros.h: Removed.
2460         * ForwardingHeaders/runtime/JSFunction.h: Removed.
2461         * ForwardingHeaders/runtime/JSGlobalObject.h: Removed.
2462         * ForwardingHeaders/runtime/JSGlobalObjectInlines.h: Removed.
2463         * ForwardingHeaders/runtime/JSInternalPromise.h: Removed.
2464         * ForwardingHeaders/runtime/JSInternalPromiseDeferred.h: Removed.
2465         * ForwardingHeaders/runtime/JSLock.h: Removed.
2466         * ForwardingHeaders/runtime/JSMap.h: Removed.
2467         * ForwardingHeaders/runtime/JSMapIterator.h: Removed.
2468         * ForwardingHeaders/runtime/JSModuleLoader.h: Removed.
2469         * ForwardingHeaders/runtime/JSModuleRecord.h: Removed.
2470         * ForwardingHeaders/runtime/JSNativeStdFunction.h: Removed.
2471         * ForwardingHeaders/runtime/JSONObject.h: Removed.
2472         * ForwardingHeaders/runtime/JSObject.h: Removed.
2473         * ForwardingHeaders/runtime/JSObjectInlines.h: Removed.
2474         * ForwardingHeaders/runtime/JSPromise.h: Removed.
2475         * ForwardingHeaders/runtime/JSPromiseConstructor.h: Removed.
2476         * ForwardingHeaders/runtime/JSPromiseDeferred.h: Removed.
2477         * ForwardingHeaders/runtime/JSProxy.h: Removed.
2478         * ForwardingHeaders/runtime/JSRunLoopTimer.h: Removed.
2479         * ForwardingHeaders/runtime/JSScriptFetchParameters.h: Removed.
2480         * ForwardingHeaders/runtime/JSScriptFetcher.h: Removed.
2481         * ForwardingHeaders/runtime/JSSegmentedVariableObjectHeapCellType.h: Removed.
2482         * ForwardingHeaders/runtime/JSSet.h: Removed.
2483         * ForwardingHeaders/runtime/JSSetIterator.h: Removed.
2484         * ForwardingHeaders/runtime/JSSourceCode.h: Removed.
2485         * ForwardingHeaders/runtime/JSString.h: Removed.
2486         * ForwardingHeaders/runtime/JSTypedArrays.h: Removed.
2487         * ForwardingHeaders/runtime/JSWithScope.h: Removed.
2488         * ForwardingHeaders/runtime/Lookup.h: Removed.
2489         * ForwardingHeaders/runtime/MapBase.h: Removed.
2490         * ForwardingHeaders/runtime/MapData.h: Removed.
2491         * ForwardingHeaders/runtime/MapDataInlines.h: Removed.
2492         * ForwardingHeaders/runtime/MatchResult.h: Removed.
2493         * ForwardingHeaders/runtime/Microtask.h: Removed.
2494         * ForwardingHeaders/runtime/ObjectConstructor.h: Removed.
2495         * ForwardingHeaders/runtime/ObjectPrototype.h: Removed.
2496         * ForwardingHeaders/runtime/Operations.h: Removed.
2497         * ForwardingHeaders/runtime/PrivateName.h: Removed.
2498         * ForwardingHeaders/runtime/PromiseDeferredTimer.h: Removed.
2499         * ForwardingHeaders/runtime/PropertyNameArray.h: Removed.
2500         * ForwardingHeaders/runtime/Protect.h: Removed.
2501         * ForwardingHeaders/runtime/RegExp.h: Removed.
2502         * ForwardingHeaders/runtime/RegExpObject.h: Removed.
2503         * ForwardingHeaders/runtime/RuntimeFlags.h: Removed.
2504         * ForwardingHeaders/runtime/SamplingProfiler.h: Removed.
2505         * ForwardingHeaders/runtime/ScriptFetchParameters.h: Removed.
2506         * ForwardingHeaders/runtime/ScriptFetcher.h: Removed.
2507         * ForwardingHeaders/runtime/StringObject.h: Removed.
2508         * ForwardingHeaders/runtime/StringPrototype.h: Removed.
2509         * ForwardingHeaders/runtime/Structure.h: Removed.
2510         * ForwardingHeaders/runtime/StructureChain.h: Removed.
2511         * ForwardingHeaders/runtime/StructureInlines.h: Removed.
2512         * ForwardingHeaders/runtime/Symbol.h: Removed.
2513         * ForwardingHeaders/runtime/SymbolTable.h: Removed.
2514         * ForwardingHeaders/runtime/ThrowScope.h: Removed.
2515         * ForwardingHeaders/runtime/TypedArrayController.h: Removed.
2516         * ForwardingHeaders/runtime/TypedArrayInlines.h: Removed.
2517         * ForwardingHeaders/runtime/TypedArrays.h: Removed.
2518         * ForwardingHeaders/runtime/Uint16Array.h: Removed.
2519         * ForwardingHeaders/runtime/Uint32Array.h: Removed.
2520         * ForwardingHeaders/runtime/Uint8Array.h: Removed.
2521         * ForwardingHeaders/runtime/Uint8ClampedArray.h: Removed.
2522         * ForwardingHeaders/runtime/VM.h: Removed.
2523         * ForwardingHeaders/runtime/VMEntryScope.h: Removed.
2524         * ForwardingHeaders/runtime/Watchdog.h: Removed.
2525         * ForwardingHeaders/runtime/WeakGCMap.h: Removed.
2526         * ForwardingHeaders/runtime/WeakGCMapInlines.h: Removed.
2527         * ForwardingHeaders/runtime/WriteBarrier.h: Removed.
2528         * ForwardingHeaders/wasm/WasmModule.h: Removed.
2529         * ForwardingHeaders/wasm/js/JSWebAssemblyModule.h: Removed.
2530         * ForwardingHeaders/yarr/RegularExpression.h: Removed.
2531         * ForwardingHeaders/yarr/Yarr.h: Removed.
2532         * ForwardingHeaders/yarr/YarrInterpreter.h: Removed.
2533         * ForwardingHeaders/yarr/YarrJIT.h: Removed.
2534         * ForwardingHeaders/yarr/YarrPattern.h: Removed.
2535         * Modules/applepay/cocoa/PaymentMerchantSessionCocoa.mm:
2536         * Modules/encryptedmedia/MediaKeyMessageEvent.h:
2537         * Modules/encryptedmedia/MediaKeyMessageEventInit.h:
2538         * Modules/encryptedmedia/MediaKeyStatusMap.h:
2539         * Modules/encryptedmedia/legacy/LegacyCDM.h:
2540         * Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp:
2541         * Modules/encryptedmedia/legacy/WebKitMediaKeyMessageEvent.cpp:
2542         * Modules/encryptedmedia/legacy/WebKitMediaKeyNeededEvent.cpp:
2543         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.h:
2544         * Modules/encryptedmedia/legacy/WebKitMediaKeys.h:
2545         * Modules/fetch/FetchBody.cpp:
2546         * Modules/fetch/FetchRequestInit.h:
2547         * Modules/fetch/FetchResponse.h:
2548         * Modules/indexeddb/IDBCursor.cpp:
2549         * Modules/indexeddb/IDBCursor.h:
2550         * Modules/indexeddb/IDBCursorWithValue.cpp:
2551         * Modules/indexeddb/IDBDatabase.cpp:
2552         * Modules/indexeddb/IDBIndex.cpp:
2553         * Modules/indexeddb/IDBKey.cpp:
2554         * Modules/indexeddb/IDBKeyRange.cpp:
2555         * Modules/indexeddb/IDBObjectStore.cpp:
2556         * Modules/indexeddb/IDBRequest.cpp:
2557         * Modules/indexeddb/IDBRequest.h:
2558         * Modules/indexeddb/client/TransactionOperation.cpp:
2559         * Modules/indexeddb/server/MemoryObjectStore.cpp:
2560         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
2561         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
2562         * Modules/mediacontrols/MediaControlsHost.cpp:
2563         * Modules/mediasource/SourceBuffer.cpp:
2564         * Modules/mediastream/RTCDataChannel.cpp:
2565         * Modules/plugins/QuickTimePluginReplacement.mm:
2566         * Modules/webaudio/AsyncAudioDecoder.cpp:
2567         * Modules/webaudio/AudioBuffer.cpp:
2568         * Modules/webaudio/AudioBuffer.h:
2569         * Modules/webaudio/AudioContext.cpp:
2570         * Modules/webaudio/AudioContext.h:
2571         * Modules/webaudio/AudioParam.h:
2572         * Modules/webaudio/AudioParamTimeline.h:
2573         * Modules/webaudio/PeriodicWave.h:
2574         * Modules/webaudio/RealtimeAnalyser.cpp:
2575         * Modules/webaudio/RealtimeAnalyser.h:
2576         * Modules/webaudio/ScriptProcessorNode.cpp:
2577         * Modules/webaudio/WaveShaperProcessor.h:
2578         * Modules/webauthn/AuthenticatorResponse.h:
2579         * Modules/webauthn/PublicKeyCredential.h:
2580         * Modules/websockets/WebSocket.cpp:
2581         * Modules/websockets/WebSocketChannel.cpp:
2582         * Modules/websockets/WorkerThreadableWebSocketChannel.cpp:
2583         * Modules/webvr/VREyeParameters.h:
2584         * Modules/webvr/VRFrameData.h:
2585         * Modules/webvr/VRPose.h:
2586         * Modules/webvr/VRStageParameters.h:
2587         * PlatformWin.cmake:
2588         * bindings/IDLTypes.h:
2589         * bindings/js/BufferSource.h:
2590         * bindings/js/CachedScriptFetcher.h:
2591         * bindings/js/CachedScriptSourceProvider.h:
2592         * bindings/js/CallTracerTypes.h:
2593         * bindings/js/CommonVM.cpp:
2594         * bindings/js/DOMGCOutputConstraint.cpp:
2595         * bindings/js/DOMGCOutputConstraint.h:
2596         * bindings/js/GCController.cpp:
2597         * bindings/js/GCController.h:
2598         * bindings/js/IDBBindingUtilities.cpp:
2599         * bindings/js/JSCallbackData.cpp:
2600         * bindings/js/JSCallbackData.h:
2601         * bindings/js/JSCustomElementInterface.cpp:
2602         * bindings/js/JSCustomElementInterface.h:
2603         * bindings/js/JSCustomEventCustom.cpp:
2604         * bindings/js/JSCustomXPathNSResolver.cpp:
2605         * bindings/js/JSCustomXPathNSResolver.h:
2606         * bindings/js/JSDOMBinding.h:
2607         * bindings/js/JSDOMBuiltinConstructorBase.cpp:
2608         * bindings/js/JSDOMConstructorBase.cpp:
2609         * bindings/js/JSDOMConvertBase.h:
2610         * bindings/js/JSDOMConvertBufferSource.h:
2611         * bindings/js/JSDOMConvertDate.cpp:
2612         * bindings/js/JSDOMConvertInterface.h:
2613         * bindings/js/JSDOMConvertJSON.h:
2614         * bindings/js/JSDOMConvertNumbers.cpp:
2615         * bindings/js/JSDOMConvertNumbers.h:
2616         * bindings/js/JSDOMConvertObject.h:
2617         * bindings/js/JSDOMConvertRecord.h:
2618         * bindings/js/JSDOMConvertSequences.h:
2619         * bindings/js/JSDOMConvertStrings.cpp:
2620         * bindings/js/JSDOMConvertUnion.h:
2621         * bindings/js/JSDOMExceptionHandling.cpp:
2622         * bindings/js/JSDOMExceptionHandling.h:
2623         * bindings/js/JSDOMGlobalObject.cpp:
2624         * bindings/js/JSDOMGlobalObject.h:
2625         * bindings/js/JSDOMGlobalObjectTask.cpp:
2626         * bindings/js/JSDOMGuardedObject.h:
2627         * bindings/js/JSDOMIterator.cpp:
2628         * bindings/js/JSDOMIterator.h:
2629         * bindings/js/JSDOMMapLike.cpp:
2630         * bindings/js/JSDOMMapLike.h:
2631         * bindings/js/JSDOMPromise.cpp:
2632         * bindings/js/JSDOMPromise.h:
2633         * bindings/js/JSDOMPromiseDeferred.cpp:
2634         * bindings/js/JSDOMPromiseDeferred.h:
2635         * bindings/js/JSDOMWindowBase.cpp:
2636         * bindings/js/JSDOMWindowCustom.cpp:
2637         * bindings/js/JSDOMWindowProxy.cpp:
2638         * bindings/js/JSDOMWindowProxy.h:
2639         * bindings/js/JSDOMWrapper.cpp:
2640         * bindings/js/JSDOMWrapper.h:
2641         * bindings/js/JSDOMWrapperCache.cpp:
2642         * bindings/js/JSDOMWrapperCache.h:
2643         * bindings/js/JSDynamicDowncast.h:
2644         * bindings/js/JSErrorHandler.cpp:
2645         * bindings/js/JSEventCustom.cpp:
2646         * bindings/js/JSEventListener.cpp:
2647         * bindings/js/JSEventListener.h:
2648         * bindings/js/JSHTMLElementCustom.cpp:
2649         * bindings/js/JSHistoryCustom.cpp:
2650         * bindings/js/JSIDBCursorWithValueCustom.cpp:
2651         * bindings/js/JSIDBIndexCustom.cpp:
2652         * bindings/js/JSImageDataCustom.cpp:
2653         * bindings/js/JSLazyEventListener.cpp:
2654         * bindings/js/JSLocationCustom.cpp:
2655         * bindings/js/JSMainThreadExecState.h:
2656         * bindings/js/JSMainThreadExecStateInstrumentation.h:
2657         * bindings/js/JSMessageChannelCustom.cpp:
2658         * bindings/js/JSMessageEventCustom.cpp:
2659         * bindings/js/JSNodeIteratorCustom.cpp:
2660         * bindings/js/JSPopStateEventCustom.cpp:
2661         * bindings/js/JSReadableStreamPrivateConstructors.cpp:
2662         * bindings/js/JSTreeWalkerCustom.cpp:
2663         * bindings/js/JSWebGL2RenderingContextCustom.cpp:
2664         * bindings/js/JSWorkerGlobalScopeBase.cpp:
2665         * bindings/js/ReadableStreamDefaultController.cpp:
2666         * bindings/js/ReadableStreamDefaultController.h:
2667         * bindings/js/ScheduledAction.cpp:
2668         * bindings/js/ScheduledAction.h:
2669         * bindings/js/ScriptCachedFrameData.cpp:
2670         * bindings/js/ScriptCachedFrameData.h:
2671         * bindings/js/ScriptController.cpp:
2672         * bindings/js/ScriptController.h:
2673         * bindings/js/ScriptControllerMac.mm:
2674         * bindings/js/ScriptModuleLoader.cpp:
2675         * bindings/js/ScriptModuleLoader.h:
2676         * bindings/js/ScriptSourceCode.h:
2677         * bindings/js/ScriptState.cpp:
2678         * bindings/js/ScriptWrappable.h:
2679         * bindings/js/ScriptWrappableInlines.h:
2680         * bindings/js/SerializedScriptValue.cpp:
2681         * bindings/js/SerializedScriptValue.h:
2682         * bindings/js/StructuredClone.cpp:
2683         * bindings/js/WebCoreBuiltinNames.h:
2684         * bindings/js/WebCoreJSClientData.cpp:
2685         * bindings/js/WebCoreTypedArrayController.cpp:
2686         * bindings/js/WebCoreTypedArrayController.h:
2687         * bindings/js/WorkerScriptController.cpp:
2688         * bindings/js/WorkerScriptController.h:
2689         * bridge/NP_jsobject.cpp:
2690         * bridge/c/CRuntimeObject.cpp:
2691         * bridge/c/c_class.cpp:
2692         * bridge/c/c_instance.cpp:
2693         * bridge/c/c_runtime.cpp:
2694         * bridge/c/c_utility.cpp:
2695         * bridge/c/c_utility.h:
2696         * bridge/jsc/BridgeJSC.cpp:
2697         * bridge/jsc/BridgeJSC.h:
2698         * bridge/npruntime.cpp:
2699         * bridge/objc/ObjCRuntimeObject.mm:
2700         * bridge/objc/WebScriptObject.mm:
2701         * bridge/objc/WebScriptObjectPrivate.h:
2702         * bridge/objc/objc_instance.mm:
2703         * bridge/objc/objc_runtime.h:
2704         * bridge/objc/objc_runtime.mm:
2705         * bridge/objc/objc_utility.h:
2706         * bridge/objc/objc_utility.mm:
2707         * bridge/runtime_array.cpp:
2708         * bridge/runtime_array.h:
2709         * bridge/runtime_method.cpp:
2710         * bridge/runtime_method.h:
2711         * bridge/runtime_object.cpp:
2712         * bridge/runtime_object.h:
2713         * bridge/runtime_root.cpp:
2714         * bridge/runtime_root.h:
2715         * crypto/SubtleCrypto.cpp:
2716         * crypto/SubtleCrypto.h:
2717         * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:
2718         * crypto/keys/CryptoRsaKeyAlgorithm.h:
2719         * crypto/mac/CryptoKeyRSAMac.cpp:
2720         * crypto/parameters/CryptoAlgorithmEcdsaParams.h:
2721         * crypto/parameters/CryptoAlgorithmHkdfParams.h:
2722         * crypto/parameters/CryptoAlgorithmHmacKeyParams.h:
2723         * crypto/parameters/CryptoAlgorithmPbkdf2Params.h:
2724         * crypto/parameters/CryptoAlgorithmRsaHashedImportParams.h:
2725         * crypto/parameters/CryptoAlgorithmRsaHashedKeyGenParams.h:
2726         * crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h:
2727         * css/CSSFontFaceSource.h:
2728         * css/DOMMatrixReadOnly.cpp:
2729         * css/DOMMatrixReadOnly.h:
2730         * css/FontFace.cpp:
2731         * dom/CustomElementReactionQueue.cpp:
2732         * dom/CustomElementRegistry.cpp:
2733         * dom/CustomEvent.cpp:
2734         * dom/CustomEvent.h:
2735         * dom/Document.cpp:
2736         * dom/Document.h:
2737         * dom/ErrorEvent.cpp:
2738         * dom/ErrorEvent.h:
2739         * dom/LoadableScript.h:
2740         * dom/MessageEvent.cpp:
2741         * dom/MessageEvent.h:
2742         * dom/ModuleFetchParameters.h:
2743         * dom/PopStateEvent.cpp:
2744         * dom/PopStateEvent.h:
2745         * dom/PromiseRejectionEvent.cpp:
2746         * dom/PromiseRejectionEvent.h:
2747         * dom/RejectedPromiseTracker.cpp:
2748         * dom/RejectedPromiseTracker.h:
2749         * dom/ScriptExecutionContext.cpp:
2750         * dom/ScriptExecutionContext.h:
2751         * dom/TextEncoder.cpp:
2752         * dom/TextEncoder.h:
2753         * domjit/DOMJITHelpers.h:
2754         * domjit/DOMJITIDLTypeFilter.h:
2755         * domjit/JSDocumentDOMJIT.cpp:
2756         * domjit/JSNodeDOMJIT.cpp:
2757         * fileapi/BlobBuilder.cpp:
2758         * fileapi/FileReader.cpp:
2759         * fileapi/FileReaderLoader.cpp:
2760         * fileapi/FileReaderSync.cpp:
2761         * html/BaseTextInputType.cpp:
2762         * html/EmailInputType.cpp:
2763         * html/HTMLAllCollection.cpp:
2764         * html/HTMLCanvasElement.cpp:
2765         * html/HTMLImageLoader.cpp:
2766         * html/HTMLMediaElement.cpp:
2767         * html/HTMLPlugInImageElement.cpp:
2768         * html/ImageData.cpp:
2769         * html/ImageData.h:
2770         * html/MediaEncryptedEventInit.h:
2771         * html/WebKitMediaKeyError.h:
2772         * html/canvas/WebGLAny.h:
2773         * html/canvas/WebGLRenderingContext.cpp:
2774         * html/canvas/WebGLRenderingContextBase.cpp:
2775         * html/canvas/WebGLRenderingContextBase.h:
2776         * html/canvas/WebGPUBuffer.cpp:
2777         * html/canvas/WebGPURenderingContext.cpp:
2778         * html/canvas/WebGPURenderingContext.h:
2779         * html/track/DataCue.cpp:
2780         * html/track/DataCue.h:
2781         * inspector/CommandLineAPIHost.cpp:
2782         * inspector/CommandLineAPIHost.h:
2783         * inspector/CommandLineAPIModule.cpp:
2784         * inspector/CommandLineAPIModule.h:
2785         * inspector/InspectorCanvas.cpp:
2786         * inspector/InspectorCanvas.h:
2787         * inspector/InspectorClient.cpp:
2788         * inspector/InspectorController.cpp:
2789         * inspector/InspectorController.h:
2790         * inspector/InspectorDatabaseResource.h:
2791         * inspector/InspectorFrontendClientLocal.cpp:
2792         * inspector/InspectorFrontendHost.cpp:
2793         * inspector/InspectorInstrumentation.cpp:
2794         * inspector/InspectorInstrumentation.h:
2795         * inspector/InspectorOverlay.cpp:
2796         * inspector/InspectorOverlay.h:
2797         * inspector/InspectorShaderProgram.cpp:
2798         * inspector/InspectorShaderProgram.h:
2799         * inspector/InspectorStyleSheet.cpp:
2800         * inspector/InspectorStyleSheet.h:
2801         * inspector/InspectorWebAgentBase.h:
2802         * inspector/InstrumentingAgents.h:
2803         * inspector/PageScriptDebugServer.cpp:
2804         * inspector/PageScriptDebugServer.h:
2805         * inspector/TimelineRecordFactory.cpp:
2806         * inspector/WebInjectedScriptHost.h:
2807         * inspector/WebInjectedScriptManager.h:
2808         * inspector/WorkerInspectorController.cpp:
2809         * inspector/WorkerInspectorController.h:
2810         * inspector/WorkerScriptDebugServer.cpp:
2811         * inspector/WorkerScriptDebugServer.h:
2812         * inspector/WorkerToPageFrontendChannel.h:
2813         * inspector/agents/InspectorApplicationCacheAgent.h:
2814         * inspector/agents/InspectorCSSAgent.cpp:
2815         * inspector/agents/InspectorCSSAgent.h:
2816         * inspector/agents/InspectorCanvasAgent.cpp:
2817         * inspector/agents/InspectorCanvasAgent.h:
2818         * inspector/agents/InspectorDOMAgent.cpp:
2819         * inspector/agents/InspectorDOMAgent.h:
2820         * inspector/agents/InspectorDOMDebuggerAgent.cpp:
2821         * inspector/agents/InspectorDOMDebuggerAgent.h:
2822         * inspector/agents/InspectorDOMStorageAgent.cpp:
2823         * inspector/agents/InspectorDOMStorageAgent.h:
2824         * inspector/agents/InspectorDatabaseAgent.cpp:
2825         * inspector/agents/InspectorDatabaseAgent.h:
2826         * inspector/agents/InspectorIndexedDBAgent.cpp:
2827         * inspector/agents/InspectorIndexedDBAgent.h:
2828         * inspector/agents/InspectorLayerTreeAgent.cpp:
2829         * inspector/agents/InspectorLayerTreeAgent.h:
2830         * inspector/agents/InspectorMemoryAgent.cpp:
2831         * inspector/agents/InspectorMemoryAgent.h:
2832         * inspector/agents/InspectorNetworkAgent.cpp:
2833         * inspector/agents/InspectorNetworkAgent.h:
2834         * inspector/agents/InspectorPageAgent.cpp:
2835         * inspector/agents/InspectorPageAgent.h:
2836         * inspector/agents/InspectorTimelineAgent.cpp:
2837         * inspector/agents/InspectorTimelineAgent.h:
2838         * inspector/agents/InspectorWorkerAgent.h:
2839         * inspector/agents/WebConsoleAgent.cpp:
2840         * inspector/agents/WebConsoleAgent.h:
2841         * inspector/agents/WebDebuggerAgent.h:
2842         * inspector/agents/WebHeapAgent.h:
2843         * inspector/agents/page/PageDebuggerAgent.cpp:
2844         * inspector/agents/page/PageRuntimeAgent.cpp:
2845         * inspector/agents/page/PageRuntimeAgent.h:
2846         * inspector/agents/worker/ServiceWorkerAgent.h:
2847         * inspector/agents/worker/WorkerDebuggerAgent.cpp:
2848         * inspector/agents/worker/WorkerRuntimeAgent.cpp:
2849         * inspector/agents/worker/WorkerRuntimeAgent.h:
2850         * loader/EmptyClients.cpp:
2851         * page/CaptionUserPreferences.cpp:
2852         * page/Chrome.cpp:
2853         * page/ChromeClient.h:
2854         * page/Crypto.cpp:
2855         * page/DOMWindow.cpp:
2856         * page/DOMWindow.h:
2857         * page/Frame.cpp:
2858         * page/OriginThreadLocalCache.h:
2859         * page/PageConsoleClient.cpp:
2860         * page/PageConsoleClient.h:
2861         * page/PageDebuggable.cpp:
2862         * page/PageGroup.cpp:
2863         * page/SettingsBase.h:
2864         * page/UserContentController.cpp:
2865         * page/cocoa/ResourceUsageThreadCocoa.mm:
2866         * page/csp/ContentSecurityPolicy.cpp:
2867         * page/ios/FrameIOS.mm:
2868         * page/linux/ResourceUsageOverlayLinux.cpp:
2869         * page/linux/ResourceUsageThreadLinux.cpp:
2870         * platform/MediaSample.h:
2871         * platform/SerializedPlatformRepresentation.h:
2872         * platform/SharedBuffer.h:
2873         * platform/audio/mac/CARingBuffer.h:
2874         * platform/cocoa/SharedBufferCocoa.mm:
2875         * platform/graphics/ImageBuffer.h:
2876         * platform/graphics/LegacyCDMSession.h:
2877         * platform/graphics/MediaPlayer.h:
2878         * platform/graphics/avfoundation/CDMFairPlayStreaming.cpp:
2879         * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm:
2880         * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
2881         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
2882         * platform/graphics/avfoundation/MediaSampleAVFObjC.h:
2883         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
2884         * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
2885         * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm:
2886         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
2887         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2888         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
2889         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2890         * platform/graphics/cairo/ImageBufferCairo.cpp:
2891         * platform/graphics/cg/ImageBufferDataCG.cpp:
2892         * platform/graphics/cg/ImageBufferDataCG.h:
2893         * platform/graphics/cocoa/GPUDeviceMetal.mm:
2894         * platform/graphics/filters/FEBlend.cpp:
2895         * platform/graphics/filters/FEColorMatrix.cpp:
2896         * platform/graphics/filters/FEComponentTransfer.cpp:
2897         * platform/graphics/filters/FEComposite.cpp:
2898         * platform/graphics/filters/FEConvolveMatrix.cpp:
2899         * platform/graphics/filters/FEDisplacementMap.cpp:
2900         * platform/graphics/filters/FEDropShadow.cpp:
2901         * platform/graphics/filters/FEGaussianBlur.cpp:
2902         * platform/graphics/filters/FELighting.h:
2903         * platform/graphics/filters/FEMorphology.cpp:
2904         * platform/graphics/filters/FETurbulence.cpp:
2905         * platform/graphics/filters/FilterEffect.cpp:
2906         * platform/graphics/filters/FilterEffect.h:
2907         * platform/graphics/gpu/GPUBuffer.h:
2908         * platform/graphics/gpu/GPUDevice.h:
2909         * platform/graphics/iso/ISOBox.cpp:
2910         * platform/graphics/iso/ISOOriginalFormatBox.cpp:
2911         * platform/graphics/iso/ISOProtectionSchemeInfoBox.cpp:
2912         * platform/graphics/iso/ISOSchemeInformationBox.cpp:
2913         * platform/graphics/iso/ISOSchemeTypeBox.cpp:
2914         * platform/graphics/iso/ISOTrackEncryptionBox.cpp:
2915         * platform/graphics/iso/ISOVTTCue.cpp:
2916         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
2917         * platform/graphics/win/ImageBufferDataDirect2D.cpp:
2918         * platform/graphics/win/ImageBufferDataDirect2D.h:
2919         * platform/ios/wak/WebCoreThread.mm:
2920         * platform/mac/SerializedPlatformRepresentationMac.mm:
2921         * platform/mac/StringUtilities.mm:
2922         * platform/mock/mediasource/MockBox.cpp:
2923         * platform/mock/mediasource/MockSourceBufferPrivate.cpp:
2924         * svg/graphics/SVGImage.cpp:
2925         * testing/GCObservation.cpp:
2926         * testing/GCObservation.h:
2927         * testing/Internals.cpp:
2928         * testing/Internals.h:
2929         * testing/LegacyMockCDM.cpp:
2930         * testing/MockCDMFactory.cpp:
2931         * testing/js/WebCoreTestSupport.cpp:
2932         * workers/Worker.cpp:
2933         * workers/Worker.h:
2934         * workers/WorkerConsoleClient.cpp:
2935         * workers/WorkerConsoleClient.h:
2936         * workers/WorkerGlobalScope.cpp:
2937         * workers/WorkerGlobalScope.h:
2938         * workers/WorkerGlobalScopeProxy.h:
2939         * workers/WorkerInspectorProxy.cpp:
2940         * workers/WorkerMessagingProxy.cpp:
2941         * workers/WorkerThread.h:
2942         * workers/service/ExtendableEvent.cpp:
2943         * workers/service/ServiceWorker.cpp:
2944         * workers/service/ServiceWorker.h:
2945         * workers/service/ServiceWorkerClient.h:
2946         * workers/service/context/ServiceWorkerInspectorProxy.cpp:
2947         * workers/service/context/ServiceWorkerThread.cpp:
2948         * xml/XMLHttpRequest.cpp:
2949
2950 2018-02-06  Said Abou-Hallawa  <sabouhallawa@apple.com>
2951
2952         Rendering SVG images with same size as WebGL texture doesn't work correctly
2953         https://bugs.webkit.org/show_bug.cgi?id=182367
2954
2955         Reviewed by Dean Jackson.
2956
2957         If am image buffer is created for a webgl texture and then it is reused 
2958         for another texture, it has to be cleared before drawing.
2959
2960         Test: webgl/webgl-texture-image-buffer-reuse.html
2961
2962         * html/canvas/WebGLRenderingContextBase.cpp:
2963         (WebCore::WebGLRenderingContextBase::LRUImageBufferCache::imageBuffer):
2964
2965 2018-02-06  Youenn Fablet  <youenn@apple.com>
2966
2967         Use downcast in createLinkPreloadResourceClient
2968         https://bugs.webkit.org/show_bug.cgi?id=182488
2969
2970         Reviewed by Antti Koivisto.
2971
2972         No observable change of behavior.
2973         Add a new link preloader client for text track.
2974
2975         * loader/LinkLoader.cpp:
2976         (WebCore::createLinkPreloadResourceClient):
2977         * loader/LinkPreloadResourceClients.h:
2978
2979 2018-02-06  Youenn Fablet  <youenn@apple.com>
2980
2981         imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-response-body-with-invalid-chunk.https.html is flaky
2982         https://bugs.webkit.org/show_bug.cgi?id=182541
2983
2984         Reviewed by Chris Dumez.
2985
2986         Covered by test being no longer flaky.
2987         In case of loading error when getting the response body, we were only reporting
2988         the error if there was a callback set or a ReadableStream already created.
2989         Otherwise, we were just stopping loading and if creating a ReadableStream, we were just returning an empty body.
2990
2991         FetchBodyOwner now stores a loading error.
2992         In case a readable stream is created, it will error it if there is a loading error.
2993         If there is not and the loading failed later on, the stream will be errored using the current code path.
2994
2995         * Modules/cache/DOMCache.cpp:
2996         (WebCore::DOMCache::put):
2997         * Modules/fetch/FetchResponse.cpp:
2998         (WebCore::FetchResponse::clone):
2999         (WebCore::FetchResponse::BodyLoader::didFail):
3000         * Modules/fetch/FetchResponse.h:
3001         * workers/service/context/ServiceWorkerFetch.cpp:
3002         (WebCore::ServiceWorkerFetch::processResponse):
3003
3004 2018-02-06  Andy Estes  <aestes@apple.com>
3005
3006         [Payment Request] show() should take an optional PaymentDetailsUpdate promise
3007         https://bugs.webkit.org/show_bug.cgi?id=182538
3008         <rdar://problem/36754552>
3009
3010         Reviewed by Tim Horton.
3011
3012         Taught show() to take an optional promise for a PaymentDetailsUpdate.
3013
3014         Added test cases to http/tests/paymentrequest/payment-request-show-method.https.html.
3015
3016         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
3017         (WebCore::ApplePayPaymentHandler::detailsUpdated):
3018
3019         Changed to take a PaymentRequest::UpdateReason instead of a eventType string.
3020
3021         (WebCore::ApplePayPaymentHandler::shippingAddressUpdated):
3022         (WebCore::ApplePayPaymentHandler::shippingOptionUpdated):
3023         (WebCore::ApplePayPaymentHandler::paymentMethodUpdated):
3024         (WebCore::ApplePayPaymentHandler::didAuthorizePayment):
3025         (WebCore::ApplePayPaymentHandler::didSelectShippingMethod):
3026         (WebCore::ApplePayPaymentHandler::didSelectShippingContact):
3027         (WebCore::ApplePayPaymentHandler::didSelectPaymentMethod):
3028
3029         Asserted that only one of the PaymentSession delegates is executing at a time.
3030
3031         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
3032         * Modules/paymentrequest/PaymentHandler.h:
3033
3034         Changed detailsUpdated to take a PaymentRequest::UpdateReason instead of a eventType string.
3035
3036         * Modules/paymentrequest/PaymentRequest.cpp:
3037         (WebCore::PaymentRequest::show):
3038
3039         If there is a details promise, call updateWith() with UpdateReason::ShowDetailsResolved.
3040
3041         (WebCore::PaymentRequest::shippingAddressChanged):
3042         (WebCore::PaymentRequest::shippingOptionChanged):
3043         (WebCore::PaymentRequest::paymentMethodChanged):
3044
3045         Used whenDetailsSettled() to ensure that update events do not start before the show()
3046         details promise settles.
3047
3048         (WebCore::PaymentRequest::updateWith):
3049         (WebCore::PaymentRequest::settleDetailsPromise):
3050
3051         Changed to use a PaymentRequest::UpdateReason instead of a eventType string.
3052
3053         (WebCore::PaymentRequest::whenDetailsSettled):
3054
3055         If there is a details promise, wait for it to settle before executing the callback.
3056
3057         * Modules/paymentrequest/PaymentRequest.h:
3058
3059         Defined enum class UpdateReason.
3060
3061         * Modules/paymentrequest/PaymentRequest.idl:
3062
3063         Updated show() to take an optional Promise<PaymentDetailsUpdate>.
3064
3065         * Modules/paymentrequest/PaymentRequestUpdateEvent.cpp:
3066         (WebCore::PaymentRequestUpdateEvent::updateWith):
3067
3068         Map the event type to a PaymentRequest::UpdateReason.
3069
3070 2018-02-06  Dean Jackson  <dino@apple.com>
3071
3072         REGRESSION: WebGL no longer producing a transparent canvas on iOS
3073         https://bugs.webkit.org/show_bug.cgi?id=182550
3074         <rdar://problem/37234491>
3075
3076         Reviewed by Eric Carlson.
3077
3078         Due to some weirdness GL_RGBA8 is sometimes different between iOS and
3079         other platforms. Only tell the WebGLLayer that it is opaque when it really
3080         is not transparent.
3081
3082         Covered by existing test: fast/canvas/webgl/context-attributes-alpha
3083
3084         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
3085         (WebCore::GraphicsContext3D::setRenderbufferStorageFromDrawable): Look at the context
3086         attributes to decide if we should use an opaque layer.
3087         * platform/graphics/cocoa/WebGLLayer.mm: Ditto.
3088         (-[WebGLLayer initWithGraphicsContext3D:]):
3089
3090 2018-02-06  Andy Estes  <aestes@apple.com>
3091
3092         [WebIDL] Support optional Promise arguments
3093         https://bugs.webkit.org/show_bug.cgi?id=182399
3094         <rdar://problem/36754552>
3095
3096         Reviewed by Sam Weinig and Chris Dumez.
3097
3098         Previously, declaring a Promise argument as optional would result in a native type of
3099         std::optional<RefPtr<DOMPromise>>. This is wasteful, since RefPtr can represent an optional
3100         argument by storing nullptr. Further, PassArgumentExpression() assumed Promises were never
3101         optional and tried to pass the argument as a Ref by calling RefPtr::releaseNonNull().
3102
3103         This patch removes the std::optional wrapper around optional Promises and simply passes the
3104         promise as a RefPtr to native code.
3105
3106         * bindings/scripts/CodeGeneratorJS.pm:
3107         (PassArgumentExpression):
3108         (GenerateParametersCheck):
3109         * bindings/scripts/test/JS/JSTestObj.cpp:
3110         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalPromiseBody):
3111         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalPromise):
3112         * bindings/scripts/test/TestObj.idl:
3113
3114 2018-02-06  Youenn Fablet  <youenn@apple.com>
3115
3116         HasServiceWorkerRegistration bit should be sent when creating a new page
3117         https://bugs.webkit.org/show_bug.cgi?id=182410
3118
3119         Reviewed by Chris Dumez.
3120
3121         Covered by new API test.
3122
3123         Changed the default value of service workers being registered to false.
3124         Every page created in the process will be responsible to change the value to true,
3125         at which time the value will be kept to true for the lifetime of the process.
3126
3127         * workers/service/ServiceWorkerProvider.h:
3128
3129 2018-02-06  Ross Kirsling  <ross.kirsling@sony.com>
3130
3131         Add missing #if ENABLE(VIDEO) after r228092.
3132         https://bugs.webkit.org/show_bug.cgi?id=182539
3133
3134         Reviewed by Michael Catanzaro.
3135
3136         * html/ImageBitmap.cpp:
3137
3138 2018-02-06  Antoine Quint  <graouts@apple.com>
3139
3140         [Modern Media Controls] Test at media/modern-media-controls/tracks-panel/tracks-panel-controls-bar-remains-visible-after-clicking-over-it.html fails
3141         https://bugs.webkit.org/show_bug.cgi?id=182425
3142
3143         Reviewed by Dean Jackson.
3144
3145         This test failed because the controls bar would not hit test at the moment we synthesized a mousemove over the controls bar as the first step towards
3146         synthesizing a click on the controls bar to dismiss the tracks panel. Indeed, it would have "pointer-events" set to "none" until the tracks panel was
3147         dismissed, which would only happen after the click event had been propagated. All we need to do is to ensure that none of the controls within the controls
3148         bar get activated as a result of clicking over them when the tracks panel is visible, so we instead set "pointer-events" to "none" on all children of a
3149         controls bar rather than the controls bar itself, which can thus still hit test.
3150
3151         * Modules/modern-media-controls/controls/media-controls.css:
3152         (.media-controls.shows-tracks-panel > .controls-bar > *,):
3153         (.media-controls.shows-tracks-panel > .controls-bar,): Deleted.
3154
3155 2018-02-06  Chris Dumez  <cdumez@apple.com>
3156
3157         Service workers registrations are saved to disk before the install / activation succeeds
3158         https://bugs.webkit.org/show_bug.cgi?id=182535
3159         <rdar://problem/36591485>
3160
3161         Reviewed by Youenn Fablet.
3162
3163         Service workers registrations are saved to disk before the install / activation succeeds.
3164         This means if the browser exits before the install / activation succeeds, we may restore
3165         from disk a registration with an “active” worker which may have never been installed /
3166         activated.
3167
3168         To address the issue, we now delay saving the registration to disk until after the service
3169         worker has been activated.
3170
3171         No new tests, restoration from disk is covered by API tests that still pass.
3172
3173         * workers/service/server/SWServer.cpp:
3174         (WebCore::SWServer::didFinishActivation):
3175         (WebCore::SWServer::installContextData):
3176
3177 2018-02-06  Ms2ger  <Ms2ger@igalia.com>
3178
3179         Initialize ImageBitmap::m_bitmapData in the constructor.
3180         https://bugs.webkit.org/show_bug.cgi?id=182487
3181
3182         Reviewed by Sam Weinig.
3183
3184         This removes the span of time where an ImageBitmap object would exist
3185         with a null m_bitmapData during its construction.
3186
3187         No new tests: no behavior changes.
3188
3189         * html/ImageBitmap.cpp:
3190         (WebCore::ImageBitmap::create): update signature
3191         (WebCore::ImageBitmap::createPromise): update callers
3192         (WebCore::ImageBitmap::ImageBitmap): update signature
3193         * html/ImageBitmap.h: update signatures
3194
3195 2018-02-05  Ryosuke Niwa  <rniwa@webkit.org>
3196
3197         Release assertion in inlineVideoFrame
3198         https://bugs.webkit.org/show_bug.cgi?id=182513
3199         <rdar://problem/37159363>
3200
3201         Reviewed by Zalan Bujtas.
3202
3203         The bug was caused by the fact it's not always safe to invoke updateLayout even when isSafeToUpdateStyleOrLayout
3204         on a document of a flattened frame on iOS. isSafeToUpdateStyleOrLayout returns true when the frame view is in
3205         the frame-flattening mode to avoid hitting a release asssertion in updateLayout of the frame. However, it's still
3206         not safe to invoke updateLayout on a parent frame in this case.
3207
3208         As a result, inlineVideoFrame (in Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.mm) invokes updateLayout
3209         even when the top-level document is not safe to update when the video element is in a frame-flattened document.
3210
3211         Fixed this bug by explicitly checking that we still have a live render tree and document hasn't been stopped.
3212         Also replaced other uses of isSafeToUpdateStyleOrLayout by more explicit checks.
3213
3214         * accessibility/AccessibilityObject.cpp:
3215         (WebCore::AccessibilityObject::updateBackingStore): Made the early exit condition added in r227006 more explicit.
3216         Namely, InspectorDOMAgent::pseudoElementCreated is invoked during style recalc.
3217         * dom/Document.cpp:
3218         (WebCore::isSafeToUpdateStyleOrLayout): Made this local to the file.
3219         (WebCore::Document::updateStyleIfNeeded):
3220         (WebCore::Document::updateLayout):
3221         * dom/Document.h:
3222         * html/MediaElementSession.cpp:
3223         (WebCore::isMainContentForPurposesOfAutoplay): Made the early exit condition added in r227529 more explicit. Don't
3224         update the layout when the render tree had been destroyed or the active DOM objects had been stopped.
3225
3226 2018-02-05  Youenn Fablet  <youenn@apple.com>
3227
3228         Crash in imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-origin.sub.html
3229         https://bugs.webkit.org/show_bug.cgi?id=182422
3230         <rdar://problem/37182665>
3231
3232         Reviewed by Alex Christensen.
3233
3234         Covered by test no longer crashing in Debug mode.
3235         Make sure completionHandler is called on the main thread.
3236
3237         * platform/network/cocoa/WebCoreNSURLSession.mm:
3238         (-[WebCoreNSURLSessionDataTask resource:receivedRedirect:request:completionHandler:]):
3239
3240 2018-02-05  Filip Pizlo  <fpizlo@apple.com>
3241
3242         Global objects should be able to use TLCs to allocate from different blocks from each other
3243         https://bugs.webkit.org/show_bug.cgi?id=182227
3244
3245         Reviewed by Daniel Bates and Chris Dumez.
3246
3247         No new tests because no change in behavior.
3248         
3249         Adopt JSC TLC API to put distance between objects from different security origins. WebCore has
3250         a subclass of ThreadLocalCache that supports hash-consing based on the relevant origin data
3251         using the existing SecurityOriginHash. It's Document's job to initiate this, but all of the
3252         logic is in WebCore::OriginThreadLocalCache.
3253         
3254         Workers don't opt into this. They just get the VM's default TLC all the time.
3255
3256         * ForwardingHeaders/heap/ThreadLocalCache.h: Added.
3257         * Sources.txt:
3258         * WebCore.xcodeproj/project.pbxproj:
3259         * bindings/js/JSDOMGlobalObject.cpp:
3260         (WebCore::JSDOMGlobalObject::JSDOMGlobalObject):
3261         * bindings/js/JSDOMGlobalObject.h:
3262         * bindings/js/JSDOMWindowBase.cpp:
3263         (WebCore::JSDOMWindowBase::JSDOMWindowBase):
3264         * dom/Document.cpp:
3265         (WebCore::Document::initSecurityContext):
3266         (WebCore::Document::threadLocalCache):
3267         * dom/Document.h:
3268         * page/OriginThreadLocalCache.cpp: Added.
3269         (WebCore::threadLocalCacheMap):
3270         (WebCore::OriginThreadLocalCache::create):
3271         (WebCore::OriginThreadLocalCache::~OriginThreadLocalCache):
3272         (WebCore::OriginThreadLocalCache::OriginThreadLocalCache):
3273         * page/OriginThreadLocalCache.h: Added.
3274         * page/SecurityOrigin.cpp:
3275         (WebCore::SecurityOrigin::passesFileCheck const):
3276         (WebCore::SecurityOrigin::setEnforcesFilePathSeparation):
3277         (WebCore::SecurityOrigin::toString const):
3278         (WebCore::SecurityOrigin::enforceFilePathSeparation): Deleted.
3279         * page/SecurityOrigin.h:
3280         (WebCore::SecurityOrigin::enforcesFilePathSeparation const):
3281
3282 2018-02-05  Per Arne Vollan  <pvollan@apple.com>
3283
3284         [Win] Release assert failed under NetworkStateNotifier::singleton.
3285         https://bugs.webkit.org/show_bug.cgi?id=182516
3286
3287         Reviewed by Brent Fulgham.
3288
3289         The callback NetworkStateNotifier::addressChangeCallback will always be called on a
3290         worker thread on Windows. Since the method NetworkStateNotifier::singleton() is
3291         called by NetworkStateNotifier::addressChangeCallback, but has to be called on the
3292         on the main thread, the call has to be moved there.
3293
3294         No new tests. I have not been able to reproduce the crash.
3295
3296         * platform/network/win/NetworkStateNotifierWin.cpp:
3297         (WebCore::NetworkStateNotifier::addressChangeCallback):
3298
3299 2018-02-05  Don Olmstead  <don.olmstead@sony.com>
3300
3301         Abstract heap generator should include JavaScriptCore headers directly
3302         https://bugs.webkit.org/show_bug.cgi?id=182501
3303
3304         Reviewed by Alex Christensen.
3305
3306         No new tests. No change in behavior.
3307
3308         * domjit/generate-abstract-heap.rb:
3309
3310 2018-02-05  Wenson Hsieh  <wenson_hsieh@apple.com>
3311
3312         [Extra zoom mode] Implement number pad UI when editing `tel` and `number` inputs
3313         https://bugs.webkit.org/show_bug.cgi?id=182472
3314         <rdar://problem/35143057>
3315
3316         Reviewed by Tim Horton.
3317
3318         Adds a localized string for the "Done" button text in extra zoomed form controls.
3319
3320         * English.lproj/Localizable.strings:
3321         * platform/LocalizedStrings.cpp:
3322         (WebCore::formControlDoneButtonTitle):
3323         * platform/LocalizedStrings.h:
3324
3325 2018-02-05  John Wilander  <wilander@apple.com>
3326
3327         Build fix for r228115, simple naming issue succeeded —> success.
3328         https://bugs.webkit.org/show_bug.cgi?id=182507
3329         <rdar://problem/37248566>
3330
3331         Reviewed by Eric Carlson.
3332
3333         No new tests. Build fix.
3334
3335         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
3336         (VideoFullscreenInterfaceAVKit::enterFullscreenHandler):
3337             succeeded —> success
3338
3339 2018-02-05  Matt Lewis  <jlewis3@apple.com>
3340
3341         Unreviewed, rolling out r228086.
3342
3343         This introduced a failure with API test
3344         URLTest.HostIsIPAddress.
3345
3346         Reverted changeset:
3347
3348         "Add a way to check if a host is an IP address"
3349         https://bugs.webkit.org/show_bug.cgi?id=182427
3350         https://trac.webkit.org/changeset/228086
3351
3352 2018-02-05  Matt Lewis  <jlewis3@apple.com>
3353
3354         Unreviewed, rolling out r228103.
3355
3356         This caused multiple tests to crash.
3357
3358         Reverted changeset: