ASSERTION FAILED: NoEventDispatchAssertion::InMainThread::isEventAllowed() || (frameV...
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-11-03  Ryosuke Niwa  <rniwa@webkit.org>
2
3         ASSERTION FAILED: NoEventDispatchAssertion::InMainThread::isEventAllowed() || (frameView && frameView->isInChildFrameWithFrameFlattening())
4         https://bugs.webkit.org/show_bug.cgi?id=179259
5
6         Reviewed by Youenn Fablet.
7
8         Avoid updating the layout inside HTMLMediaElement::stop() and MediaElementSession::~MediaElementSession
9
10         No new tests since existing tests cover this.
11
12         * html/HTMLMediaElement.cpp:
13         (WebCore::HTMLMediaElement::userCancelledLoad): Don't update VTT cues when the active DOM objects are being stopped.
14         * platform/audio/mac/MediaSessionManagerMac.mm:
15         (WebCore::MediaSessionManagerMac::removeSession): Update the updateNowPlayingInfo asynchronously
16         since this function can be called inside HTMLMediaElement::~HTMLMediaElement.
17
18 2017-11-03  Alex Christensen  <achristensen@webkit.org>
19
20         Add WEBCORE_EXPORT to CachedResourceHandleBase
21         https://bugs.webkit.org/show_bug.cgi?id=179251
22
23         * loader/cache/CachedResourceHandle.h:
24         (WebCore::CachedResourceHandleBase::get const): Deleted.
25         (WebCore::CachedResourceHandleBase::operator! const): Deleted.
26         (WebCore::CachedResourceHandleBase::operator UnspecifiedBoolType const): Deleted.
27         (WebCore::CachedResourceHandleBase::operator=): Deleted.
28         I'll need this soon for bug 179251, and having to touch CachedResourceHandle.h causes me to rebuild everything.
29         Committing it separately greatly increases my debugging and comparison speed.
30
31 2017-11-03  Commit Queue  <commit-queue@webkit.org>
32
33         Unreviewed, rolling out r224428, r224435, and r224440.
34         https://bugs.webkit.org/show_bug.cgi?id=179274
35
36         Broke iOS and internal builds (Requested by ryanhaddad on
37         #webkit).
38
39         Reverted changesets:
40
41         "Use VCP H264 encoder for platforms supporting it"
42         https://bugs.webkit.org/show_bug.cgi?id=179076
43         https://trac.webkit.org/changeset/224428
44
45         "Use VCP H264 encoder for platforms supporting it"
46         https://bugs.webkit.org/show_bug.cgi?id=179076
47         https://trac.webkit.org/changeset/224435
48
49         "Use VCP H264 encoder for platforms supporting it"
50         https://bugs.webkit.org/show_bug.cgi?id=179076
51         https://trac.webkit.org/changeset/224440
52
53 2017-11-03  Youenn Fablet  <youenn@apple.com>
54
55         Requests handled by Service Worker should not go through preflighting
56         https://bugs.webkit.org/show_bug.cgi?id=179250
57
58         Reviewed by Alex Christensen.
59
60         Test: http/tests/workers/service/service-worker-crossorigin-fetch.html
61         In case of cross origin requests needed preflighting that may be served through SW, the following is done:
62         - Bypass preflight
63         - Put service workers mode as Only so that if SW is not handling the request, the load will fail
64         - If load fails, restart DocumentThreadableLoader load with preflight.
65
66         Additional testing should be added when we properly handle the case where no fetch event handler is registered in the service worker.
67
68         * loader/DocumentThreadableLoader.cpp:
69         (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest):
70         (WebCore::DocumentThreadableLoader::didFail):
71         * loader/DocumentThreadableLoader.h:
72         * loader/ResourceLoaderOptions.h:
73         * loader/cache/CachedResourceRequest.cpp:
74         (WebCore::CachedResourceRequest::setSelectedServiceWorkerIdentifierIfNeeded):
75         * platform/network/ResourceErrorBase.h:
76
77 2017-11-03  Zalan Bujtas  <zalan@apple.com>
78
79         Remove redundant LayoutStateMaintainer argument (RenderView&)
80         https://bugs.webkit.org/show_bug.cgi?id=179269
81         <rdar://problem/35344397>
82
83         Reviewed by Simon Fraser.
84
85         No change in functionality.
86
87         * rendering/RenderBlock.cpp:
88         (WebCore::RenderBlock::simplifiedLayout):
89         * rendering/RenderBlockFlow.cpp:
90         (WebCore::RenderBlockFlow::layoutBlock):
91         * rendering/RenderBox.cpp:
92         (WebCore::RenderBox::layout):
93         * rendering/RenderDeprecatedFlexibleBox.cpp:
94         (WebCore::RenderDeprecatedFlexibleBox::layoutBlock):
95         * rendering/RenderEmbeddedObject.cpp:
96         (WebCore::RenderEmbeddedObject::layout):
97         * rendering/RenderFlexibleBox.cpp:
98         (WebCore::RenderFlexibleBox::layoutBlock):
99         * rendering/RenderGrid.cpp:
100         (WebCore::RenderGrid::layoutBlock):
101         * rendering/RenderImage.cpp:
102         (WebCore::RenderImage::layoutShadowControls):
103         * rendering/RenderTable.cpp:
104         (WebCore::RenderTable::layout):
105         * rendering/RenderTableRow.cpp:
106         (WebCore::RenderTableRow::layout):
107         * rendering/RenderTableSection.cpp:
108         (WebCore::RenderTableSection::layout):
109         (WebCore::RenderTableSection::layoutRows):
110         * rendering/RenderVTTCue.cpp:
111         (WebCore::RenderVTTCue::layout):
112         * rendering/RenderView.h:
113         (WebCore::LayoutStateMaintainer::LayoutStateMaintainer):
114
115 2017-11-03  Youenn Fablet  <youenn@apple.com>
116
117         Use VCP H264 encoder for platforms supporting it
118         https://bugs.webkit.org/show_bug.cgi?id=179076
119         rdar://problem/35180773
120
121         Reviewed by Eric Carlson.
122
123         Covered by existing test coverage.
124
125         * platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.cpp:
126         (WebCore::VideoToolboxVideoEncoderFactory::setActive):
127         (WebCore::VideoToolboxVideoEncoderFactory::CreateSupportedVideoEncoder):
128         (WebCore::VideoToolboxVideoEncoderFactory::DestroyVideoEncoder):
129         * platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.h:
130
131 2017-11-03  Basuke Suzuki  <Basuke.Suzuki@sony.com>
132
133         [Curl] Fix build after r224373
134         https://bugs.webkit.org/show_bug.cgi?id=179265
135
136         Unreviewed build fix.
137
138         * platform/network/curl/ResourceHandleCurl.cpp:
139         (WebCore::ResourceHandle::continueWillSendRequest): Deleted.
140
141 2017-11-03  Brady Eidson  <beidson@apple.com>
142
143         Remove an invalid ASSERT that is seen intermittently.
144         https://bugs.webkit.org/show_bug.cgi?id=179186
145
146         Unreviewed.
147
148         * workers/service/server/SWServerRegistration.cpp:
149         (WebCore::SWServerRegistration::removeClientServiceWorkerRegistration): This is an invalid ASSERT,
150           it's definitely racey over IPC.
151
152 2017-11-03  Michael Catanzaro  <mcatanzaro@igalia.com>
153
154         [WPE] Remove unneeded USE(LIBEPOXY) guards
155         https://bugs.webkit.org/show_bug.cgi?id=179228
156
157         Reviewed by Carlos Garcia Campos.
158
159         USE(LIBEPOXY) is already mandatory for WPE.
160
161         * platform/graphics/egl/GLContextEGLWPE.cpp:
162         * platform/graphics/wpe/PlatformDisplayWPE.cpp:
163
164 2017-11-03  Ali Juma  <ajuma@chromium.org>
165
166         Layout viewport rect is too wide after window resize
167         https://bugs.webkit.org/show_bug.cgi?id=175235
168
169         Fix a formatting mistake that was introduced by r224241.
170
171         Reviewed by Simon Fraser.
172
173         No change in behavior.
174
175         * platform/ScrollView.cpp:
176         (WebCore::ScrollView::updateScrollbars):
177
178 2017-11-03  Youenn Fablet  <youenn@apple.com>
179
180         Implement Service Worker Matching Registration algorithm
181         https://bugs.webkit.org/show_bug.cgi?id=178882
182
183         Reviewed by Chris Dumez.
184
185         Test: http/tests/workers/service/service-worker-clear.html
186
187         Adding support for scope as part of the ServiceWorkerRegistrationKey to disambiguate several service workers registered with different scopes.
188         Adding the Service Worker Registration algorithm in SWServer and adding internals API to test it.
189         Making ServiceWorkerRegistrationKey a class to protect its internal field to be reused in wrong places.
190
191         Added preliminary support for clearing service workers for a given session ID as this is needed by WTR for stable testing.
192
193         * testing/Internals.cpp:
194         (WebCore::Internals::hasServiceWorkerRegistration):
195         * testing/Internals.h:
196         * testing/Internals.idl:
197         * workers/service/ServiceWorkerJobData.cpp:
198         (WebCore::ServiceWorkerJobData::registrationKey const):
199         * workers/service/ServiceWorkerRegistration.h:
200         * workers/service/ServiceWorkerRegistrationKey.cpp:
201         (WebCore::ServiceWorkerRegistrationKey::hash const):
202         (WebCore::ServiceWorkerRegistrationKey::operator== const):
203         (WebCore::ServiceWorkerRegistrationKey::isolatedCopy const):
204         * workers/service/ServiceWorkerRegistrationKey.h:
205         (WebCore::ServiceWorkerRegistrationKey::encode const):
206         (WebCore::ServiceWorkerRegistrationKey::decode):
207         * workers/service/server/SWClientConnection.h:
208         * workers/service/server/SWServer.cpp:
209         (WebCore::SWServer::clear):
210         (WebCore::SWServer::doRegistrationMatching const):
211         * workers/service/server/SWServer.h:
212         (WebCore::SWServer::Connection::doRegistrationMatching const):
213         * workers/service/server/SWServerJobQueue.cpp:
214         (WebCore::SWServerJobQueue::~SWServerJobQueue):
215         * workers/service/server/SWServerRegistration.h:
216
217 2017-11-02  Dean Jackson  <dino@apple.com>
218
219         Add basic OffscreenCanvas interface
220         https://bugs.webkit.org/show_bug.cgi?id=179213
221         <rdar://problem/35326778>
222
223         Reviewed by Sam Weinig.
224
225         Add the basic infrastructure for the OffscreenCanvas
226         object, so it can be created from script.
227
228         Test: http/wpt/offscreen-canvas/offscreencanvas.constructor.html
229
230         * DerivedSources.make:
231         * Sources.txt:
232         * WebCore.xcodeproj/project.pbxproj:
233         * bindings/js/JSEventTargetCustom.cpp:
234         * dom/EventTargetFactory.in:
235         * html/OffscreenCanvas.cpp: Added.
236         (WebCore::OffscreenCanvas::create):
237         (WebCore::OffscreenCanvas::OffscreenCanvas):
238         (WebCore::OffscreenCanvas::width const):
239         (WebCore::OffscreenCanvas::setWidth):
240         (WebCore::OffscreenCanvas::height const):
241         (WebCore::OffscreenCanvas::setHeight):
242         * html/OffscreenCanvas.h: Added.
243         * html/OffscreenCanvas.idl: Added.
244
245 2017-11-03  Ryosuke Niwa  <rniwa@webkit.org>
246
247         Crash inside ChildListMutationAccumulator::enqueueMutationRecord()
248         https://bugs.webkit.org/show_bug.cgi?id=179234
249         <rdar://problem/35287748>
250
251         Reviewed by Darin Adler.
252
253         Fixed the crash by keeping MutationObserver referenced by MutationObserverInterestGroup alive.
254
255         Also added hasCallback() virtual function on MutationObserver to check whether the callback is alive
256         to work around the bug that JS function referenced by MutationObserver isn't kept alive.
257         We'll address this bug separately in https://webkit.org/b/179224.
258
259         Test: fast/dom/MutationObserver/disconnect-observer-while-mutation-records-are-enqueued-crash.html
260
261         * bindings/scripts/CodeGeneratorJS.pm:
262         (GenerateCallbackHeaderContent): Added an override for the newly added virtual hasCallback().
263         * dom/MutationCallback.h:
264         * dom/MutationObserver.cpp:
265         (WebCore::MutationObserver::deliver): Added the aforementioned workaround.
266         * dom/MutationObserverInterestGroup.cpp:
267         (WebCore::MutationObserverInterestGroup::MutationObserverInterestGroup): Fixed the crash by using Ref.
268         (WebCore::MutationObserverInterestGroup::enqueueMutationRecord): Ditto.
269         * dom/MutationObserverInterestGroup.h:
270         * dom/NativeNodeFilter.cpp:
271         (WebCore::NativeNodeFilter::hasCallback const): Always return true here. This function is never called
272         but we still need to implement it since NodeFilter has a pure virtual hasCallback() now.
273         * dom/NativeNodeFilter.h:
274         * dom/Node.cpp:
275         (WebCore::collectMatchingObserversForMutation): Use Ref to fix the crash.
276         (WebCore::Node::registeredMutationObservers): Ditto.
277         * dom/Node.h:
278         * dom/NodeFilter.h:
279
280 2017-11-03  Zalan Bujtas  <zalan@apple.com>
281
282         RenderObject::*positioned() naming cleanup
283         https://bugs.webkit.org/show_bug.cgi?id=179206
284         <rdar://problem/35325254>
285
286         Reviewed by Darin Adler.
287
288         +isFixedPositioned()
289         +isAbsolutelyPositioned()
290         isRelPositioned() -> isRelativelyPositioned()
291
292         Covered by existing tests.
293
294         * css/CSSComputedStyleDeclaration.cpp:
295         (WebCore::positionOffsetValue):
296         * dom/Element.cpp:
297         (WebCore::layoutOverflowRectContainsAllDescendants):
298         * rendering/LayoutState.cpp:
299         (WebCore::LayoutState::LayoutState):
300         * rendering/LayoutState.h:
301         * rendering/RenderBlock.cpp:
302         (WebCore::RenderBlock::renderName const):
303         * rendering/RenderBox.cpp:
304         (WebCore::RenderBox::fixedElementLaysOutRelativeToFrame const):
305         (WebCore::RenderBox::foregroundIsKnownToBeOpaqueInRect const):
306         (WebCore::RenderBox::mapLocalToContainer const):
307         (WebCore::RenderBox::pushMappingToContainer const):
308         (WebCore::RenderBox::mapAbsoluteToLocalPoint const):
309         (WebCore::RenderBox::offsetFromContainer const):
310         (WebCore::RenderBox::containingBlockLogicalWidthForPositioned const):
311         (WebCore::RenderBox::containingBlockLogicalHeightForPositioned const):
312         * rendering/RenderBoxModelObject.cpp:
313         (WebCore::RenderBoxModelObject::adjustedPositionRelativeToOffsetParent const):
314         (WebCore::RenderBoxModelObject::offsetForInFlowPosition const):
315         * rendering/RenderDeprecatedFlexibleBox.cpp:
316         (WebCore::RenderDeprecatedFlexibleBox::renderName const):
317         * rendering/RenderFragmentedFlow.cpp:
318         (WebCore::RenderFragmentedFlow::adjustedPositionRelativeToOffsetParent const):
319         * rendering/RenderGeometryMap.cpp:
320         (WebCore::canMapBetweenRenderersViaLayers):
321         * rendering/RenderGrid.cpp:
322         (WebCore::RenderGrid::renderName const):
323         * rendering/RenderInline.cpp:
324         (WebCore::RenderInline::renderName const):
325         * rendering/RenderLayer.cpp:
326         (WebCore::RenderLayer::paintLayer):
327         (WebCore::RenderLayer::calculateClipRects const):
328         * rendering/RenderLayerBacking.cpp:
329         (WebCore::RenderLayerBacking::updateCompositedBounds):
330         * rendering/RenderLayerCompositor.cpp:
331         (WebCore::RenderLayerCompositor::updateBacking):
332         (WebCore::RenderLayerCompositor::computeExtent const):
333         (WebCore::RenderLayerCompositor::reasonsForCompositing const):
334         (WebCore::RenderLayerCompositor::isViewportConstrainedFixedOrStickyLayer const):
335         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
336         (WebCore::RenderLayerCompositor::registerAllViewportConstrainedLayers):
337         * rendering/RenderObject.cpp:
338         (WebCore::RenderObject::containingBlock const):
339         (WebCore::RenderObject::outputRenderObject const):
340         (WebCore::RenderObject::offsetParent const):
341         * rendering/RenderObject.h:
342         (WebCore::RenderObject::isPositioned const):
343         (WebCore::RenderObject::isInFlowPositioned const):
344         (WebCore::RenderObject::isFixedPositioned const):
345         (WebCore::RenderObject::isAbsolutePositioned const):
346         (WebCore::RenderObject::isRelativePositioned const):
347         (WebCore::RenderObject::isStickyPositioned const):
348         (WebCore::RenderObject::RenderObjectBitfields::RenderObjectBitfields):
349         (WebCore::RenderObject::RenderObjectBitfields::isRelativePositioned const):
350         (WebCore::RenderObject::RenderObjectBitfields::isPositioned const):
351         (WebCore::RenderObject::isRelPositioned const): Deleted.
352         (WebCore::RenderObject::RenderObjectBitfields::isRelPositioned const): Deleted.
353
354 2017-11-03  Chris Dumez  <cdumez@apple.com>
355
356         Use a single identifier type to identify Service Workers
357         https://bugs.webkit.org/show_bug.cgi?id=179192
358
359         Reviewed by Brady Eidson.
360
361         Use a single identifier type to identify Service Workers. We had both a String
362         identifier and a uint64_t identifier for each service worker. We now consistently
363         use a ServiceWorkerIdentifier which is a strongly typed identifier backed by a
364         uint64_t.
365
366         * WebCore.xcodeproj/project.pbxproj:
367         * loader/ResourceLoaderOptions.h:
368         * loader/cache/CachedResourceRequest.cpp:
369         (WebCore::CachedResourceRequest::setSelectedServiceWorkerIdentifierIfNeeded):
370         * loader/cache/CachedResourceRequest.h:
371         * workers/service/ServiceWorker.cpp:
372         (WebCore::ServiceWorker::ServiceWorker):
373         * workers/service/ServiceWorker.h:
374         * workers/service/ServiceWorkerClient.cpp:
375         (WebCore::ServiceWorkerClient::postMessage):
376         * workers/service/ServiceWorkerContainer.cpp:
377         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
378         * workers/service/ServiceWorkerContextData.cpp:
379         (WebCore::ServiceWorkerContextData::isolatedCopy const):
380         * workers/service/ServiceWorkerContextData.h:
381         (WebCore::ServiceWorkerContextData::encode const):
382         (WebCore::ServiceWorkerContextData::decode):
383         * workers/service/ServiceWorkerIdentifier.h: Copied from Source/WebCore/workers/service/ServiceWorkerContextData.cpp.
384         * workers/service/ServiceWorkerRegistrationData.h:
385         (WebCore::ServiceWorkerRegistrationData::decode):
386         * workers/service/context/SWContextManager.cpp:
387         (WebCore::SWContextManager::serviceWorkerThreadProxy const):
388         (WebCore::SWContextManager::postMessageToServiceWorkerGlobalScope):
389         * workers/service/context/SWContextManager.h:
390         * workers/service/context/ServiceWorkerThread.cpp:
391         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
392         * workers/service/context/ServiceWorkerThread.h:
393         (WebCore::ServiceWorkerThread::identifier const):
394         * workers/service/context/ServiceWorkerThreadProxy.h:
395         * workers/service/server/SWClientConnection.cpp:
396         (WebCore::SWClientConnection::postMessageToServiceWorkerClient):
397         * workers/service/server/SWClientConnection.h:
398         * workers/service/server/SWServer.cpp:
399         (WebCore::generateServiceWorkerIdentifier):
400         (WebCore::SWServer::Connection::scriptContextFailedToStart):
401         (WebCore::SWServer::Connection::scriptContextStarted):
402         (WebCore::SWServer::scriptContextFailedToStart):
403         (WebCore::SWServer::scriptContextStarted):
404         (WebCore::SWServer::updateWorker):
405         * workers/service/server/SWServer.h:
406         * workers/service/server/SWServerJobQueue.cpp:
407         (WebCore::SWServerJobQueue::scriptContextFailedToStart):
408         (WebCore::SWServerJobQueue::scriptContextStarted):
409         * workers/service/server/SWServerJobQueue.h:
410         * workers/service/server/SWServerRegistration.h:
411         (WebCore::SWServerRegistration::setActiveServiceWorkerIdentifier):
412         * workers/service/server/SWServerWorker.cpp:
413         (WebCore::SWServerWorker::SWServerWorker):
414         * workers/service/server/SWServerWorker.h:
415         (WebCore::SWServerWorker::create):
416         (WebCore::SWServerWorker::identifier const):
417
418 2017-11-02  Andy Estes  <aestes@apple.com>
419
420         [Payment Request] show() should only be called with user activation
421         https://bugs.webkit.org/show_bug.cgi?id=179056
422
423         Reviewed by Sam Weinig.
424
425         Updated existing tests to call PaymentRequest.show() with user activation.
426
427         * Modules/paymentrequest/PaymentRequest.cpp:
428         (WebCore::PaymentRequest::show):
429
430 2017-11-03  Daniel Bates  <dabates@apple.com>
431
432         Invalidate node list when associated form control element is removed
433         https://bugs.webkit.org/show_bug.cgi?id=179232
434         <rdar://problem/35308269>
435
436         Reviewed by Ryosuke Niwa.
437
438         A node list represents a live view of the DOM. Invalidate the node list
439         associated with a form element whenever one of its associated form control
440         elements is removed.
441
442         Test: fast/forms/node-list-remove-button-from-form.html
443
444         * html/HTMLFormElement.cpp:
445         (WebCore::HTMLFormElement::removeFormElement):
446
447 2017-11-03  Frederic Wang  <fwang@igalia.com>
448
449         Add USE(APPLE_INTERNAL_SDK)-guards around SPI in ResourceHandle code
450         https://bugs.webkit.org/show_bug.cgi?id=136107
451
452         Based on patch by Daniel Bates <dabates@apple.com>
453         Reviewed by Darin Adler.
454
455         No new tests, behavior unchanged.
456
457         * platform/network/ResourceHandleClient.h: Replace includes of private headers with CFNetworkSPI.h.
458         * platform/network/ResourceHandleInternal.h: Ditto.
459         * platform/network/ios/ResourceHandleIOS.mm: Add USE(APPLE_INTERNAL_SDK)-guard around SPI
460         headers and forward declare NSURLRequest SPI and constant _kCFStreamSSLTrustedLeafCertificates
461         for clients that build without the internal SDK. Add BSD license block to file.
462         (WebCore::ResourceHandle::createSSLPropertiesFromNSURLRequest): Fix code style issues; use
463         nullptr instead of 0, use reinterpret_cast instead of C-style cast, remove unnecessary
464         "using namespace WebCore"
465         and rename variables to improve readability.
466         * platform/network/mac/ResourceErrorMac.mm: Add USE(APPLE_INTERNAL_SDK)-guard around private
467         headers and add typedef for CFCachedURLResponseRef for clients that build without the
468         internal SDK.
469
470 2017-11-03  Antti Koivisto  <antti@apple.com>
471
472         Crash in WebCore::RenderStyle::overflowX with display:contents
473         https://bugs.webkit.org/show_bug.cgi?id=178857
474         <rdar://problem/35201120>
475
476         Reviewed by Zalan Bujtas.
477
478         Crash test by Renata Hodovan.
479
480         Tests: fast/css/display-contents-all.html
481                fast/css/display-contents-document-element.html
482
483         * css/StyleResolver.cpp:
484         (WebCore::adjustDisplayContentsStyle):
485
486         For document element 'display:contents' should adjust to 'display:block' like it does for other display types.
487
488 2017-11-03  Jiewen Tan  <jiewen_tan@apple.com>
489
490         Replace some auto* with RefPtr within WebCore/html
491         https://bugs.webkit.org/show_bug.cgi?id=179218
492         <rdar://problem/35102567>
493
494         Reviewed by Ryosuke Niwa.
495
496         No changes in behaviors.
497
498         In this patch, it replace some auto* pointers with RefPtrs. The way it achieves this goal is to wrap
499         the RHS with makeRefPtr(). Also, some methods have been modified to return RefPtrs directly. Those
500         include:
501             HTMLInputElement::list,
502             HTMLInputElement::dataList,
503             HTMLLabelElement::control,
504             HTMLLegendElement::associatedControl,
505             HTMLSummaryElement::detailsElement,
506             HTMLTableElement::tHead,
507             HTMLTableElement::tFoot,
508             HTMLTablePartElement::findParentTable,
509             HTMLTableRowElement.cpp::findTable, local function
510             RadioNodeList.cpp::toRadioButtonInputElement, local function
511             CanvasStyle::canvasGradient,
512             CanvasStyle::canvasPattern,
513             WebGLRenderingContextBase::validateTextureBinding,
514             GraphicsContext::strokeGradient,
515             GraphicsContext::fillGradient.
516
517         * accessibility/AXObjectCache.cpp:
518         (WebCore::AXObjectCache::labelChanged):
519         * accessibility/AccessibilityRenderObject.cpp:
520         (WebCore::AccessibilityRenderObject::correspondingControlForLabelElement const):
521         * accessibility/AccessibilityTable.cpp:
522         (WebCore::AccessibilityTable::addChildren):
523         (WebCore::AccessibilityTable::title const):
524         * accessibility/atk/WebKitAccessibleInterfaceTable.cpp:
525         (webkitAccessibleTableGetCaption):
526         * html/ColorInputType.cpp:
527         (WebCore::ColorInputType::suggestions const):
528         * html/FTPDirectoryDocument.cpp:
529         (WebCore::FTPDirectoryDocumentParser::loadDocumentTemplate):
530         * html/FileInputType.cpp:
531         (WebCore::FileInputType::appendFormData const):
532         (WebCore::FileInputType::disabledAttributeChanged):
533         (WebCore::FileInputType::multipleAttributeChanged):
534         * html/FormAssociatedElement.cpp:
535         (WebCore::FormAssociatedElement::formOwnerRemovedFromTree):
536         * html/HTMLBodyElement.cpp:
537         (WebCore::HTMLBodyElement::insertedIntoAncestor):
538         (WebCore::HTMLBodyElement::didFinishInsertingNode):
539         (WebCore::HTMLBodyElement::scrollTo):
540         * html/HTMLDetailsElement.cpp:
541         (WebCore::HTMLDetailsElement::isActiveSummary const):
542         (WebCore::HTMLDetailsElement::parseAttribute):
543         * html/HTMLDocument.cpp:
544         (WebCore::HTMLDocument::namedItem):
545         * html/HTMLElement.cpp:
546         (WebCore::HTMLElement::editabilityFromContentEditableAttr):
547         * html/HTMLFormControlElement.cpp:
548         (WebCore::HTMLFormControlElement::didAttachRenderers):
549         * html/HTMLFrameOwnerElement.cpp:
550         (WebCore:: const):
551         * html/HTMLFrameSetElement.cpp:
552         (WebCore::HTMLFrameSetElement::namedItem):
553         * html/HTMLHtmlElement.cpp:
554         (WebCore::HTMLHtmlElement::insertedByParser):
555         * html/HTMLImageElement.cpp:
556         (WebCore::HTMLImageElement::bestFitSourceFromPictureElement):
557         * html/HTMLInputElement.cpp:
558         (WebCore::HTMLInputElement::defaultEventHandler):
559         (WebCore::HTMLInputElement::list const):
560         (WebCore::HTMLInputElement::dataList const):
561         (WebCore::HTMLInputElement::setupDateTimeChooserParameters):
562         * html/HTMLInputElement.h:
563         * html/HTMLLabelElement.cpp:
564         (WebCore::firstElementWithIdIfLabelable):
565         (WebCore::HTMLLabelElement::control const):
566         (WebCore::HTMLLabelElement::form const):
567         (WebCore::HTMLLabelElement::setActive):
568         (WebCore::HTMLLabelElement::setHovered):
569         (WebCore::HTMLLabelElement::willRespondToMouseClickEvents):
570         (WebCore::HTMLLabelElement::focus):
571         (WebCore::HTMLLabelElement::accessKeyAction):
572         * html/HTMLLabelElement.h:
573         * html/HTMLLegendElement.cpp:
574         (WebCore::HTMLLegendElement::associatedControl):
575         (WebCore::HTMLLegendElement::focus):
576         (WebCore::HTMLLegendElement::accessKeyAction):
577         (WebCore::HTMLLegendElement::form const):
578         * html/HTMLLegendElement.h:
579         * html/HTMLLinkElement.cpp:
580         (WebCore::HTMLLinkElement::setCSSStyleSheet):
581         (WebCore::HTMLLinkElement::addSubresourceAttributeURLs const):
582         * html/HTMLMediaElement.cpp:
583         (WebCore::needsAutoplayPlayPauseEventsQuirk):
584         (WebCore::HTMLMediaElement::loadResource):
585         (WebCore::HTMLMediaElement::updateActiveTextTrackCues):
586         (WebCore::HTMLMediaElement::removeTextTrack):
587         (WebCore::HTMLMediaElement::layoutSizeChanged):
588         * html/HTMLObjectElement.cpp:
589         (WebCore::shouldBeExposed):
590         (WebCore::HTMLObjectElement::appendFormData):
591         * html/HTMLOptGroupElement.cpp:
592         (WebCore::HTMLOptGroupElement::recalcSelectOptions):
593         * html/HTMLPictureElement.cpp:
594         (WebCore::HTMLPictureElement::viewportChangeAffectedPicture const):
595         * html/HTMLPlugInElement.cpp:
596         (WebCore::HTMLPlugInElement::bindingsInstance):
597         * html/HTMLPlugInImageElement.cpp:
598         (WebCore::HTMLPlugInImageElement::isImageType):
599         (WebCore::HTMLPlugInImageElement::willDetachRenderers):
600         (WebCore::HTMLPlugInImageElement::partOfSnapshotOverlay const):
601         (WebCore::HTMLPlugInImageElement::checkSizeChangeForSnapshotting):
602         * html/HTMLSlotElement.cpp:
603         (WebCore::HTMLSlotElement::attributeChanged):
604         (WebCore:: const):
605         * html/HTMLSourceElement.cpp:
606         (WebCore::HTMLSourceElement::parseAttribute):
607         * html/HTMLStyleElement.cpp:
608         (WebCore::HTMLStyleElement::addSubresourceAttributeURLs const):
609         * html/HTMLSummaryElement.cpp:
610         (WebCore::HTMLSummaryElement::detailsElement const):
611         * html/HTMLSummaryElement.h:
612         * html/HTMLTableElement.cpp:
613         (WebCore::HTMLTableElement::caption const):
614         (WebCore::HTMLTableElement::tHead const):
615         (WebCore::HTMLTableElement::tFoot const):
616         (WebCore::HTMLTableElement::createTHead):
617         (WebCore::HTMLTableElement::deleteTHead):
618         (WebCore::HTMLTableElement::createTFoot):
619         (WebCore::HTMLTableElement::deleteTFoot):
620         (WebCore::HTMLTableElement::createCaption):
621         (WebCore::HTMLTableElement::deleteCaption):
622         * html/HTMLTableElement.h:
623         * html/HTMLTablePartElement.cpp:
624         (WebCore::HTMLTablePartElement::findParentTable const):
625         * html/HTMLTablePartElement.h:
626         * html/HTMLTableRowElement.cpp:
627         (WebCore::findTable):
628         (WebCore::HTMLTableRowElement::rowIndex const):
629         (WebCore::findRows):
630         * html/HTMLTableSectionElement.cpp:
631         (WebCore::HTMLTableSectionElement::additionalPresentationAttributeStyle const):
632         * html/HTMLTrackElement.cpp:
633         (WebCore::HTMLTrackElement::mediaElement const):
634         * html/LinkIconCollector.cpp:
635         (WebCore::LinkIconCollector::iconsOfTypes):
636         * html/MediaDocument.cpp:
637         (WebCore::MediaDocumentParser::createDocumentStructure):
638         (WebCore::MediaDocument::replaceMediaElementTimerFired):
639         * html/MediaElementSession.cpp:
640         (WebCore::needsArbitraryUserGestureAutoplayQuirk):
641         (WebCore::isElementRectMostlyInMainFrame):
642         (WebCore::isElementLargeRelativeToMainFrame):
643         * html/PluginDocument.cpp:
644         (WebCore::PluginDocumentParser::createDocumentStructure):
645         (WebCore::PluginDocumentParser::appendBytes):
646         * html/RadioNodeList.cpp:
647         (WebCore::toRadioButtonInputElement):
648         (WebCore::RadioNodeList::value const):
649         (WebCore::RadioNodeList::setValue):
650         * html/RangeInputType.cpp:
651         (WebCore::RangeInputType::updateTickMarkValues):
652         * html/canvas/CanvasRenderingContext.cpp:
653         (WebCore::CanvasRenderingContext::wouldTaintOrigin):
654         * html/canvas/CanvasRenderingContext2D.cpp:
655         (WebCore::CanvasRenderingContext2D::setStrokeStyle):
656         (WebCore::CanvasRenderingContext2D::setFillStyle):
657         (WebCore::CanvasRenderingContext2D::fillInternal):
658         (WebCore::CanvasRenderingContext2D::strokeInternal):
659         (WebCore::CanvasRenderingContext2D::fillRect):
660         (WebCore::CanvasRenderingContext2D::strokeRect):
661         (WebCore::toStyle):
662         (WebCore::CanvasRenderingContext2D::drawTextInternal):
663         * html/canvas/CanvasStyle.h:
664         (WebCore::CanvasStyle::canvasGradient const):
665         (WebCore::CanvasStyle::canvasPattern const):
666         * html/canvas/WebGL2RenderingContext.cpp:
667         (WebCore::WebGL2RenderingContext::texStorage2D):
668         (WebCore::WebGL2RenderingContext::getFramebufferAttachmentParameter):
669         (WebCore::WebGL2RenderingContext::validateIndexArrayConservative):
670         * html/canvas/WebGLBuffer.h:
671         * html/canvas/WebGLRenderingContext.cpp:
672         (WebCore::WebGLRenderingContext::getFramebufferAttachmentParameter):
673         (WebCore::WebGLRenderingContext::validateIndexArrayConservative):
674         * html/canvas/WebGLRenderingContextBase.cpp:
675         (WebCore::WebGLRenderingContextBase::compressedTexImage2D):
676         (WebCore::WebGLRenderingContextBase::compressedTexSubImage2D):
677         (WebCore::WebGLRenderingContextBase::copyTexSubImage2D):
678         (WebCore::WebGLRenderingContextBase::generateMipmap):
679         (WebCore::WebGLRenderingContextBase::getTexParameter):
680         (WebCore::WebGLRenderingContextBase::texImage2DBase):
681         (WebCore::WebGLRenderingContextBase::validateTexFunc):
682         (WebCore::WebGLRenderingContextBase::texSubImage2D):
683         (WebCore::WebGLRenderingContextBase::texSubImage2DBase):
684         (WebCore::WebGLRenderingContextBase::copyTexImage2D):
685         (WebCore::WebGLRenderingContextBase::texImage2D):
686         (WebCore::WebGLRenderingContextBase::texParameter):
687         (WebCore::WebGLRenderingContextBase::validateTextureBinding):
688         * html/canvas/WebGLRenderingContextBase.h:
689         * html/parser/HTMLConstructionSite.cpp:
690         (WebCore::executeReparentTask):
691         (WebCore::executeTakeAllChildrenAndReparentTask):
692         (WebCore::HTMLConstructionSite::dispatchDocumentElementAvailableIfNeeded):
693         (WebCore::HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface):
694         (WebCore::HTMLConstructionSite::findFosterSite):
695         * html/parser/HTMLPreloadScanner.cpp:
696         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
697         * html/parser/XSSAuditorDelegate.cpp:
698         (WebCore::XSSAuditorDelegate::generateViolationReport):
699         * html/shadow/TextControlInnerElements.cpp:
700         (WebCore::SearchFieldResultsButtonElement::defaultEventHandler):
701         * html/track/InbandGenericTextTrack.cpp:
702         (WebCore::InbandGenericTextTrack::updateGenericCue):
703         (WebCore::InbandGenericTextTrack::removeGenericCue):
704         * html/track/InbandTextTrack.cpp:
705         (WebCore::InbandTextTrack::willRemove):
706         * html/track/TextTrack.cpp:
707         (WebCore::TextTrack::addCue):
708         (WebCore::TextTrack::addRegion):
709         * html/track/VideoTrack.cpp:
710         (WebCore::VideoTrack::willRemove):
711         * inspector/InspectorCanvas.cpp:
712         (WebCore::InspectorCanvas::buildInitialState):
713         * platform/graphics/GraphicsContext.h:
714         (WebCore::GraphicsContext::strokeGradient const):
715         (WebCore::GraphicsContext::fillGradient const):
716         * rendering/svg/RenderSVGPath.cpp:
717         (WebCore::useStrokeStyleToFill):
718
719 2017-11-03  Devin Rousso  <webkit@devinrousso.com>
720
721         Web Inspector: Canvas2D Profiling: highlight expensive context commands in the captured command log
722         https://bugs.webkit.org/show_bug.cgi?id=178302
723         <rdar://problem/33158849>
724
725         Reviewed by Brian Burg.
726
727         No new tests, updated existing tests.
728
729         * inspector/InspectorCanvas.h:
730         * inspector/InspectorCanvas.cpp:
731         (WebCore::InspectorCanvas::recordAction):
732         (WebCore::InspectorCanvas::finalizeFrame):
733         (WebCore::InspectorCanvas::markNewFrame): Deleted.
734
735         * inspector/InspectorCanvasAgent.cpp:
736         (WebCore::InspectorCanvasAgent::didFinishRecordingCanvasFrame):
737
738 2017-11-02  Maciej Stachowiak  <mjs@apple.com>
739
740         Don't try to guess plugin MIME type from a file extension in a URL (no observable effect)
741         https://bugs.webkit.org/show_bug.cgi?id=178333
742
743         Reviewed by Darin Adler.
744
745         No test cases because I could not find an observable behavior difference,
746         even after trying many different plugin loading scenarios.
747         
748         * html/HTMLPlugInImageElement.cpp:
749         (WebCore::HTMLPlugInImageElement::didAddUserAgentShadowRoot): loadedMIMEType --> serviceType
750         (WebCore::HTMLPlugInImageElement::restartSimilarPlugIns): ditto
751         (WebCore::HTMLPlugInImageElement::userDidClickSnapshot): ditto
752         (WebCore::HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn): ditto
753         * html/HTMLPlugInImageElement.h:
754         (WebCore::HTMLPlugInImageElement::loadedMimeType const): Deleted. This was the one call site
755         for mimeTypeFromURL, and is otherwise just a wrapper for SerciceType()
756         * platform/URL.cpp:
757         (WebCore::mimeTypeFromURL): Deleted. This was the only use of MIMETypeDatabase in URL.
758         * platform/URL.h: Removed declaration for mimeTypeFromURL.
759         * WebCore.order: Removed mimeTypeFromURL.
760
761 2017-11-02  Basuke Suzuki  <Basuke.Suzuki@sony.com>
762
763         [Curl] Fix cancellation process implementation
764         https://bugs.webkit.org/show_bug.cgi?id=179199
765
766         Reviewed by Alex Christensen.
767
768         * platform/network/curl/CurlRequest.cpp:
769         (WebCore::CurlRequest::cancel):
770         (WebCore::CurlRequest::willSendData):
771         (WebCore::CurlRequest::didReceiveHeader):
772         (WebCore::CurlRequest::didReceiveData):
773         (WebCore::CurlRequest::completeDidReceiveResponse):
774         (WebCore::CurlRequest::pausedStatusChanged):
775         * platform/network/curl/CurlRequest.h:
776         (WebCore::CurlRequest::isSyncRequest const):
777         (WebCore::CurlRequest::isCompletedOrCancelled const):
778         (WebCore::CurlRequest::needToInvokeDidCancelTransfer const):
779         (WebCore::CurlRequest::isSyncRequest): Deleted.
780
781 2017-11-02  Brady Eidson  <beidson@apple.com>
782
783         SW: Implement "Update Registration State" algorithm (unused for now)
784         https://bugs.webkit.org/show_bug.cgi?id=179186
785
786         Reviewed by Chris Dumez.
787
788         No new tests (No behavior change yet).
789
790         This algorithm is very simple, and this patch plumbs it through.
791         But it's not useful to start using this algorithm without "Update Worker State" also.
792         So to keep this patch small, it's unused for now. Will be used in the next patch.
793
794         * WebCore.xcodeproj/project.pbxproj:
795
796         * workers/service/ServiceWorkerContainer.cpp:
797         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
798
799         * workers/service/ServiceWorkerRegistration.cpp:
800         (WebCore::ServiceWorkerRegistration::ServiceWorkerRegistration):
801         (WebCore::ServiceWorkerRegistration::~ServiceWorkerRegistration):
802         (WebCore::ServiceWorkerRegistration::updateStateFromServer):
803         * workers/service/ServiceWorkerRegistration.h:
804
805         * workers/service/ServiceWorkerTypes.h: Copied from Source/WebCore/workers/service/server/SWServerRegistration.cpp.
806
807         * workers/service/server/SWClientConnection.cpp:
808         (WebCore::SWClientConnection::addServiceWorkerRegistration):
809         (WebCore::SWClientConnection::removeServiceWorkerRegistration):
810         (WebCore::SWClientConnection::updateRegistrationState):
811         * workers/service/server/SWClientConnection.h:
812
813         * workers/service/server/SWServer.cpp:
814         (WebCore::SWServer::Connection::addServiceWorkerRegistrationInServer):
815         (WebCore::SWServer::Connection::removeServiceWorkerRegistrationInServer):
816         (WebCore::SWServer::addClientServiceWorkerRegistration):
817         (WebCore::SWServer::removeClientServiceWorkerRegistration):
818         * workers/service/server/SWServer.h:
819         (WebCore::SWServer::getConnection):
820
821         * workers/service/server/SWServerJobQueue.cpp:
822         (WebCore::SWServerJobQueue::runRegisterJob):
823
824         * workers/service/server/SWServerRegistration.cpp:
825         (WebCore::SWServerRegistration::SWServerRegistration):
826         (WebCore::SWServerRegistration::updateRegistrationState):
827         (WebCore::SWServerRegistration::addClientServiceWorkerRegistration):
828         (WebCore::SWServerRegistration::removeClientServiceWorkerRegistration):
829         * workers/service/server/SWServerRegistration.h:
830
831 2017-11-01  Ryosuke Niwa  <rniwa@webkit.org>
832
833         Assert that updateStyle and updateLayout are only called when it's safe to dispatch events
834         https://bugs.webkit.org/show_bug.cgi?id=179157
835         <rdar://problem/35144778>
836
837         Reviewed by Zalan Bujtas.
838
839         Added assertions to Document::updateStyleIfNeeded and Document::updateLayout that these functions are
840         only called when NoEventDispatchAssertion::isEventAllowedInMainThread() is true with two exceptions:
841         1. Inside SVGImage::draw which triggers a layout on a separate document.
842         2. While doing a nested layout for a frame flattening.
843
844         No new tests since there should be no behavioral changes.
845
846         * dom/ContainerNode.cpp:
847         (NoEventDispatchAssertion::DisableAssertionsInScope::s_existingCount): Deleted. This is now an instance
848         variable of DisableAssertionsInScope.
849         (ContainerNode::removeNodeWithScriptAssertion): Moved childrenChanged out of the scope since it could
850         invoke respondToChangedSelection via HTMLTextAreaElement::childrenChanged.
851         * dom/Document.cpp:
852         (WebCore::Document::updateStyleIfNeeded): Added the assertion. Allow updateWidgetPositions() to call
853         this function but exit early when checking needsStyleRecalc().
854         (WebCore::Document::updateLayout): Added the assertion.
855         * dom/NoEventDispatchAssertion.h:
856         (WebCore::NoEventDispatchAssertion::DisableAssertionsInScope::DisableAssertionsInScope): Made this class
857         store the original value of s_count as an instance variable to support re-entrancy.
858         (WebCore::NoEventDispatchAssertion::DisableAssertionsInScope::~DisableAssertionsInScope): Ditto.
859         * page/LayoutContext.cpp:
860         (WebCore::LayoutContext::runOrScheduleAsynchronousTasks): Temporarily disable the assertion. This is safe
861         since SVGImage has its own document.
862         * svg/SVGSVGElement.cpp:
863         (WebCore::checkIntersectionWithoutUpdatingLayout): Extracted out of SVGSVGElement::checkIntersection.
864         (WebCore::checkEnclosureWithoutUpdatingLayout): Extracted out of SVGSVGElement::checkEnclosure.
865         (WebCore::SVGSVGElement::getIntersectionList): Use checkIntersectionWithoutUpdatingLayout to avoid
866         calling updateLayoutIgnorePendingStylesheets while iterating over elements.
867         (WebCore::SVGSVGElement::getEnclosureList): Ditto.
868         (WebCore::SVGSVGElement::checkIntersection):
869         (WebCore::SVGSVGElement::checkEnclosure):
870         * svg/graphics/SVGImage.cpp:
871         (WebCore::SVGImage::draw): Temporarily disable the assertion. This is safe as SVGImage has its own page.
872
873 2017-11-02  Alex Christensen  <achristensen@webkit.org>
874
875         Fix Windows debug build after r224371
876
877         * platform/graphics/win/DIBPixelData.h:
878
879 2017-11-02  Alex Christensen  <achristensen@webkit.org>
880
881         Use CompletionHandlers for redirects
882         https://bugs.webkit.org/show_bug.cgi?id=179163
883
884         Reviewed by Tim Horton.
885
886         Having functions sometimes have to remember to call client->continueWillSendRequest is fragile.
887         CompletionHandler asserts if it's not called once before destruction, and that's what we need here.
888         This will prevent future bugs, and make ResourceHandle look more like NetworkDataTask.
889
890         No change in behavior.
891
892         * loader/NetscapePlugInStreamLoader.cpp:
893         (WebCore::NetscapePlugInStreamLoader::willSendRequest):
894         * loader/NetscapePlugInStreamLoader.h:
895         * loader/ResourceLoader.cpp:
896         (WebCore::ResourceLoader::willSendRequest):
897         (WebCore::ResourceLoader::willSendRequestAsync):
898         * loader/ResourceLoader.h:
899         * loader/appcache/ApplicationCacheGroup.cpp:
900         (WebCore::ApplicationCacheGroup::willSendRequestAsync):
901         * loader/appcache/ApplicationCacheGroup.h:
902         * platform/network/BlobResourceHandle.cpp:
903         * platform/network/PingHandle.h:
904         * platform/network/ResourceHandle.h:
905         * platform/network/ResourceHandleClient.h:
906         * platform/network/SynchronousLoaderClient.cpp:
907         (WebCore::SynchronousLoaderClient::willSendRequestAsync):
908         * platform/network/SynchronousLoaderClient.h:
909         * platform/network/cf/ResourceHandleCFNet.cpp:
910         (WebCore::ResourceHandle::willSendRequest):
911         (WebCore::ResourceHandle::continueWillSendRequest): Deleted.
912         * platform/network/cf/ResourceHandleCFURLConnectionDelegate.h:
913         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
914         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willSendRequest):
915         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueWillSendRequest): Deleted.
916         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h:
917         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
918         (WebCore::ResourceHandleCurlDelegate::willSendRequest):
919         * platform/network/mac/ResourceHandleMac.mm:
920         (WebCore::ResourceHandle::willSendRequest):
921         (WebCore::ResourceHandle::continueWillSendRequest): Deleted.
922         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h:
923         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
924         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]):
925         (-[WebCoreResourceHandleAsOperationQueueDelegate continueWillSendRequest:]): Deleted.
926         * platform/network/soup/ResourceHandleSoup.cpp:
927         (WebCore::doRedirect):
928         (WebCore::ResourceHandle::continueWillSendRequest): Deleted.
929
930 2017-11-02  Christopher Reid  <chris.reid@sony.com>
931
932         Add a FileSystem namespace to FileSystem.cpp
933         https://bugs.webkit.org/show_bug.cgi?id=179063
934
935         Reviewed by Darin Adler.
936
937         No new tests, no change in behavior.
938
939         Adding a FileSystem namespace so its functions aren't global in WebCore.
940
941         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
942         * Modules/entriesapi/DOMFileSystem.cpp:
943         * Modules/entriesapi/FileSystemEntry.cpp:
944         * Modules/indexeddb/IDBDatabaseIdentifier.cpp:
945         * Modules/indexeddb/server/IDBServer.cpp:
946         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
947         * Modules/indexeddb/server/SQLiteIDBTransaction.cpp:
948         * Modules/indexeddb/shared/InProcessIDBServer.cpp:
949         * Modules/webdatabase/DatabaseTracker.cpp:
950         * Modules/webdatabase/OriginLock.cpp:
951         * Modules/webdatabase/OriginLock.h:
952         * fileapi/File.cpp:
953         * fileapi/FileCocoa.mm:
954         * html/FileListCreator.cpp:
955         * html/HTMLMediaElement.cpp:
956         * loader/appcache/ApplicationCacheStorage.cpp:
957         * page/Page.cpp:
958         * page/SecurityOrigin.cpp:
959         * page/SecurityOriginData.cpp:
960         * platform/FileHandle.cpp:
961         * platform/FileHandle.h:
962         * platform/FileStream.cpp:
963         * platform/FileStream.h:
964         * platform/FileSystem.cpp: Added FileSystem namespace
965         * platform/FileSystem.h: Added FileSystem namespace
966         * platform/SharedBuffer.cpp:
967         * platform/SharedBuffer.h:
968         * platform/cf/FileSystemCF.cpp: Added FileSystem namespace
969         * platform/cocoa/FileMonitorCocoa.mm:
970         * platform/cocoa/FileSystemCocoa.mm: Added FileSystem namespace
971         * platform/glib/FileMonitorGLib.cpp:
972         * platform/glib/FileSystemGlib.cpp: Added FileSystem namespace
973         * platform/glib/SharedBufferGlib.cpp:
974         * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
975         * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm:
976         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
977         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
978         * platform/graphics/win/DIBPixelData.h:
979         * platform/ios/QuickLook.mm:
980         * platform/ios/WebItemProviderPasteboard.mm:
981         * platform/mac/FileSystemMac.mm: Added FileSystem namespace
982         * platform/network/BlobDataFileReference.cpp:
983         * platform/network/BlobRegistryImpl.cpp:
984         * platform/network/FormData.cpp:
985         * platform/network/cf/FormDataStreamCFNet.cpp:
986         * platform/network/cocoa/ResourceRequestCocoa.mm:
987         * platform/network/curl/CurlCacheEntry.cpp:
988         * platform/network/curl/CurlCacheEntry.h:
989         * platform/network/curl/CurlCacheManager.cpp:
990         * platform/network/curl/CurlDownload.cpp:
991         * platform/network/curl/CurlRequest.cpp:
992         * platform/network/curl/CurlRequest.h:
993         * platform/network/curl/ResourceHandleCurl.cpp:
994         * platform/network/mac/BlobDataFileReferenceMac.mm:
995         * platform/network/soup/ResourceRequestSoup.cpp:
996         * platform/network/soup/SoupNetworkSession.cpp:
997         * platform/posix/FileSystemPOSIX.cpp: Added FileSystem namespace
998         * platform/posix/SharedBufferPOSIX.cpp:
999         * platform/sql/SQLiteFileSystem.cpp:
1000         * platform/text/hyphen/HyphenationLibHyphen.cpp:
1001         * platform/win/FileSystemWin.cpp: Added FileSystem namespace
1002         * rendering/RenderThemeGtk.cpp:
1003         * rendering/RenderThemeWin.cpp:
1004
1005 2017-11-02  Devin Rousso  <webkit@devinrousso.com>
1006
1007         Web Inspector: Canvas Tab: show supported GL extensions for selected canvas
1008         https://bugs.webkit.org/show_bug.cgi?id=179070
1009         <rdar://problem/35278276>
1010
1011         Reviewed by Brian Burg.
1012
1013         Test: inspector/canvas/extensions.html
1014
1015         * html/canvas/WebGL2RenderingContext.cpp:
1016         (WebCore::WebGL2RenderingContext::getExtension):
1017         * html/canvas/WebGLRenderingContext.cpp:
1018         (WebCore::WebGLRenderingContext::getExtension):
1019         Rework common logic into a macro for readability and to simplify adding calls to
1020         InspectorInstrumentation functions.
1021
1022         * html/canvas/WebGLRenderingContextBase.h:
1023         * html/canvas/WebGLRenderingContextBase.cpp:
1024         (WebCore::WebGLRenderingContextBase::extensionIsEnabled):
1025
1026         * inspector/InspectorCanvasAgent.h:
1027         * inspector/InspectorCanvasAgent.cpp:
1028         (WebCore::InspectorCanvasAgent::enable):
1029         (WebCore::InspectorCanvasAgent::didEnableExtension):
1030
1031         * inspector/InspectorInstrumentation.h:
1032         (WebCore::InspectorInstrumentation::didEnableExtension):
1033         * inspector/InspectorInstrumentation.cpp:
1034         (WebCore::InspectorInstrumentation::didEnableExtensionImpl):
1035
1036 2017-11-02  Youenn Fablet  <youenn@apple.com>
1037
1038         Do not check for CORS in case response is coming from a service worker
1039         https://bugs.webkit.org/show_bug.cgi?id=179177
1040
1041         Reviewed by Chris Dumez.
1042
1043         Test: http/tests/workers/service/cors-image-fetch.html
1044
1045         As per fetch spec, CORS check (https://fetch.spec.whatwg.org/#cors-check) is done
1046         within HTTP fetch (https://fetch.spec.whatwg.org/#http-fetch).
1047         It does not apply to fetches handled by service workers.
1048
1049         * loader/SubresourceLoader.cpp:
1050         (WebCore::SubresourceLoader::checkResponseCrossOriginAccessControl):
1051
1052 2017-11-02  Joseph Pecoraro  <pecoraro@apple.com>
1053
1054         Make ServiceWorker a Remote Inspector debuggable target
1055         https://bugs.webkit.org/show_bug.cgi?id=179043
1056         <rdar://problem/34126008>
1057
1058         Reviewed by Brian Burg.
1059
1060         * Sources.txt:
1061         * WebCore.xcodeproj/project.pbxproj:
1062         New files.
1063
1064         * workers/service/context/ServiceWorkerDebuggable.h: Added.
1065         * workers/service/context/ServiceWorkerDebuggable.cpp: Added.
1066         (WebCore::ServiceWorkerDebuggable::ServiceWorkerDebuggable):
1067         (WebCore::ServiceWorkerDebuggable::connect):
1068         (WebCore::ServiceWorkerDebuggable::disconnect):
1069         (WebCore::ServiceWorkerDebuggable::dispatchMessageFromRemote):
1070         ServiceWorker remote inspector target, exposes the script url to debuggers.
1071         Pass the channel on to the inspector proxy to hook it up to the worker.
1072
1073         * workers/service/context/ServiceWorkerInspectorProxy.h:
1074         * workers/service/context/ServiceWorkerInspectorProxy.cpp: Added.
1075         (WebCore::ServiceWorkerInspectorProxy::ServiceWorkerInspectorProxy):
1076         (WebCore::ServiceWorkerInspectorProxy::~ServiceWorkerInspectorProxy):
1077         (WebCore::ServiceWorkerInspectorProxy::serviceWorkerTerminated):
1078         Handle interesting events throughout a Service Worker life cycle.
1079
1080         (WebCore::ServiceWorkerInspectorProxy::connectToWorker):
1081         (WebCore::ServiceWorkerInspectorProxy::disconnectFromWorker):
1082         (WebCore::ServiceWorkerInspectorProxy::sendMessageToWorker):
1083         (WebCore::ServiceWorkerInspectorProxy::sendMessageFromWorkerToFrontend):
1084         Implement existing worker debugger hooks for connection setup and sending messages.
1085         Inspector protocol messages come in on the MainThread and hop over to the
1086         WorkerThread to be handled on the expected context thread. Likewise outgoing
1087         messages hop back to be sent through the InspectorFrontend channel on MainThread.
1088
1089         * workers/service/context/ServiceWorkerThread.cpp:
1090         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
1091         * workers/service/context/ServiceWorkerThread.h:
1092         * workers/service/context/ServiceWorkerThreadProxy.h:
1093         * workers/service/context/ServiceWorkerThreadProxy.cpp:
1094         (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
1095         (WebCore::ServiceWorkerThreadProxy::postMessageToDebugger):
1096         Construct the new inspector proxy and debuggable registration.
1097         Call lifecycle events and debugger hooks when appropriate.
1098
1099 2017-11-02  Antti Koivisto  <antti@apple.com>
1100
1101         display:contents should work with dynamic table mutations
1102         https://bugs.webkit.org/show_bug.cgi?id=179179
1103
1104         Reviewed by Ryosuke Niwa.
1105
1106         * rendering/RenderBlock.cpp:
1107         (WebCore::RenderBlock::addChildIgnoringContinuation):
1108
1109             RenderText with inline text wrapper as beforeChild is now resolved in RenderTreePosition, covering all cases.
1110             Verify this with assert.
1111
1112         * rendering/RenderElement.cpp:
1113         (WebCore::RenderElement::insertChildInternal):
1114
1115             Add assertion.
1116
1117         * rendering/RenderTableSection.cpp:
1118         (WebCore::RenderTableSection::addChild):
1119
1120             Fix cases where we did unchecked downcasts for anonymous beforeChild.
1121
1122         * style/RenderTreePosition.cpp:
1123         (WebCore::RenderTreePosition::insert):
1124
1125             When inserting before a text rendeder with an display:contents inline wrapper, use the wrapper as beforeChild.
1126
1127         * style/RenderTreePosition.h:
1128         (WebCore::RenderTreePosition::insert): Deleted.
1129         * style/RenderTreeUpdater.cpp:
1130         (WebCore::RenderTreeUpdater::updateRenderTree):
1131         (WebCore::RenderTreeUpdater::renderingParent):
1132
1133             Add separate helper to get parent frame for the closest rendered (non display:contents) ancestor.
1134
1135         (WebCore::RenderTreeUpdater::renderTreePosition):
1136         (WebCore::RenderTreeUpdater::updateElementRenderer):
1137         (WebCore::RenderTreeUpdater::textRendererIsNeeded):
1138         (WebCore::RenderTreeUpdater::updateTextRenderer):
1139         (WebCore::RenderTreeUpdater::storePreviousRenderer):
1140
1141             Use it for tracking state related to render tree siblings. With this we compute whitespace nodes
1142             correctly for display:contents. The test cases end up depending on that.
1143
1144         * style/RenderTreeUpdater.h:
1145
1146 2017-11-02  Tim Horton  <timothy_horton@apple.com>
1147
1148         Bump the size of SameAsRenderElement after r224324
1149
1150         * rendering/RenderElement.cpp:
1151         RenderElement uses one more bit in the bitfield now.
1152
1153 2017-11-02  Ryan Haddad  <ryanhaddad@apple.com>
1154
1155         Unreviewed, rolling out r224353.
1156
1157         Breaks internal builds.
1158
1159         Reverted changeset:
1160
1161         "Ignore HSTS for partitioned, cross-origin subresource
1162         requests"
1163         https://bugs.webkit.org/show_bug.cgi?id=178993
1164         https://trac.webkit.org/changeset/224353
1165
1166 2017-11-02  Joseph Pecoraro  <pecoraro@apple.com>
1167
1168         Inspector should display service worker served responses properly
1169         https://bugs.webkit.org/show_bug.cgi?id=178597
1170         <rdar://problem/35186111>
1171
1172         Reviewed by Brian Burg.
1173
1174         Test: http/tests/inspector/network/resource-response-service-worker.html
1175
1176         * inspector/InspectorNetworkAgent.cpp:
1177         (WebCore::responseSource):
1178         Use the new protocol enum.
1179
1180 2017-11-02  Ryosuke Niwa  <rniwa@webkit.org>
1181
1182         Eliminate isMainThread() checks in most call sites of NoEventDispatchAssertion
1183         https://bugs.webkit.org/show_bug.cgi?id=179161
1184
1185         Reviewed by Zalan Bujtas.
1186
1187         Introduced NoEventDispatchAssertion::InMainThread which bypasses the expensive isMainThread() check
1188         in order to turn NoEventDispatchAssertion into a release assertion in a separate patch.
1189
1190         Also removed instances of NoEventDispatchAssertion in notifyChildNodeInserted and notifyChildNodeRemoved
1191         and asserted that the caller has instantiated NoEventDispatchAssertion instead.
1192
1193         No new tests since there should be no behavioral changes.
1194
1195         * bindings/js/ScriptController.cpp:
1196         (WebCore::ScriptController::canExecuteScripts):
1197         * dom/Attr.cpp:
1198         * dom/CharacterData.cpp:
1199         * dom/ContainerNode.cpp:
1200         (WebCore::ContainerNode::removeAllChildrenWithScriptAssertion):
1201         (WebCore::ContainerNode::removeNodeWithScriptAssertion):
1202         (WebCore::executeNodeInsertionWithScriptAssertion):
1203         (WebCore::ContainerNode::removeDetachedChildren): Instantiated NoEventDispatchAssertion::InMainThread
1204         so that notifyChildNodeRemoved would be called inside NoEventDispatchAssertion. 
1205         (WebCore::ContainerNode::insertBeforeCommon):
1206         (WebCore::ContainerNode::appendChildCommon):
1207         (WebCore::ContainerNode::removeBetween):
1208         (WebCore::dispatchChildInsertionEvents):
1209         (WebCore::dispatchChildRemovalEvents):
1210         * dom/ContainerNodeAlgorithms.cpp:
1211         (WebCore::notifyChildNodeInserted): Assert that the caller has instantiated NoEventDispatchAssertion.
1212         (WebCore::notifyChildNodeRemoved): Ditto.
1213         * dom/Document.cpp:
1214         (WebCore::Document::resolveStyle):
1215         (WebCore::Document::updateStyleIfNeeded):
1216         (WebCore::Document::nodeChildrenWillBeRemoved):
1217         (WebCore::Document::nodeWillBeRemoved):
1218         (WebCore::Document::dispatchWindowEvent): Replaced RELEASE_ASSERT with ASSERT_WITH_SECURITY_IMPLICATION
1219         for clarity since NoEventDispatchAssertion::isEventAllowedInMainThread() always returns true in release
1220         builds right now.
1221         (WebCore::Document::dispatchWindowLoadEvent): Ditto.
1222         (WebCore::Document::applyPendingXSLTransformsTimerFired): Use ASSERT_WITH_SECURITY_IMPLICATION instead
1223         of regular ASSERT.
1224         * dom/Element.cpp:
1225         (WebCore::Element::addShadowRoot): Instantiate NoEventDispatchAssertion::InMainThread to call
1226         notifyChildNodeInserted will it.
1227         (WebCore::Element::attachAttributeNodeIfNeeded):
1228         (WebCore::Element::setAttributeNode): Fixed the indentation.
1229         (WebCore::Element::setAttributeNodeNS): Ditto.
1230         (WebCore::Element::dispatchFocusInEvent):
1231         (WebCore::Element::dispatchFocusOutEvent):
1232         * dom/EventDispatcher.cpp:
1233         (WebCore::EventDispatcher::dispatchEvent):
1234         * dom/NoEventDispatchAssertion.h:
1235         (WebCore::NoEventDispatchAssertion::isEventDispatchAllowedInSubtree): Moved to InMainThread.
1236         (WebCore::NoEventDispatchAssertion::InMainThread): Added.
1237         (WebCore::NoEventDispatchAssertion::InMainThread::InMainThread): Assert that we're in the main thread
1238         instead of exiting early.
1239         (WebCore::NoEventDispatchAssertion::InMainThread::~InMainThread): Ditto.
1240         (WebCore::NoEventDispatchAssertion::InMainThread::isEventDispatchAllowedInSubtree): Moved here.
1241         (WebCore::NoEventDispatchAssertion::InMainThread::isEventAllowed):
1242         * dom/Node.cpp:
1243         (WebCore::Node::dispatchSubtreeModifiedEvent):
1244         (WebCore::Node::dispatchDOMActivateEvent):
1245         * dom/ScriptExecutionContext.cpp:
1246         (WebCore::ScriptExecutionContext::canSuspendActiveDOMObjectsForDocumentSuspension):
1247         (WebCore::ScriptExecutionContext::suspendActiveDOMObjects):
1248         (WebCore::ScriptExecutionContext::resumeActiveDOMObjects):
1249         * history/CachedPage.cpp:
1250         (WebCore::CachedPage::restore):
1251         * history/PageCache.cpp:
1252         (WebCore::PageCache::addIfCacheable):
1253         * page/LayoutContext.cpp:
1254         (WebCore::LayoutContext::layout):
1255         * rendering/RenderLayer.cpp:
1256         (WebCore::RenderLayer::scrollRectToVisible):
1257
1258 2017-11-02  John Wilander  <wilander@apple.com>
1259
1260         Ignore HSTS for partitioned, cross-origin subresource requests
1261         https://bugs.webkit.org/show_bug.cgi?id=178993
1262         <rdar://problem/34962462>
1263
1264         Reviewed by Brent Fulgham and Alex Christensen.
1265
1266         No new tests. HSTS is not supported in layout tests.
1267         Tested manually.
1268
1269         * platform/network/mac/WebCoreURLResponse.mm:
1270         (WebCore::synthesizeRedirectResponseIfNecessary):
1271             Now also synthesizes a response if
1272             _schemeWasUpgradedDueToDynamicHSTS is set on the
1273             request. Because in such cases the scheme might
1274             have been downgraded and there the two schemes
1275             match.
1276
1277 2017-11-02  Zalan Bujtas  <zalan@apple.com>
1278
1279         LayoutState::m_next is really the ancestor state.
1280         https://bugs.webkit.org/show_bug.cgi?id=179187
1281         <rdar://problem/35319525>
1282
1283         Reviewed by Simon Fraser.
1284
1285         No change in functionality.
1286
1287         * rendering/LayoutState.cpp:
1288         (WebCore::LayoutState::LayoutState):
1289         (WebCore::LayoutState::clearPaginationInformation):
1290         (WebCore::LayoutState::propagateLineGridInfo):
1291         (WebCore::LayoutState::establishLineGrid):
1292         * rendering/LayoutState.h:
1293         * rendering/RenderView.h:
1294
1295 2017-11-02  Alex Christensen  <achristensen@webkit.org>
1296
1297         Fix iOS WebKitLegacy after r224267
1298         https://bugs.webkit.org/show_bug.cgi?id=179189
1299
1300         Reviewed by Tim Horton.
1301
1302         Use callOnMainThread instead of dispatch_async to work correctly on the web thread.
1303
1304         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
1305         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]):
1306         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveAuthenticationChallenge:]):
1307         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]):
1308         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
1309         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveData:lengthReceived:]):
1310         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didSendBodyData:totalBytesWritten:totalBytesExpectedToWrite:]):
1311         (-[WebCoreResourceHandleAsOperationQueueDelegate connectionDidFinishLoading:]):
1312         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didFailWithError:]):
1313         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willCacheResponse:]):
1314
1315 2017-11-02  Adrian Perez de Castro  <aperez@igalia.com>
1316
1317         [WPE] Add some error reporting during EGL display/context creation
1318         https://bugs.webkit.org/show_bug.cgi?id=178937
1319
1320         Reviewed by Carlos Alberto Lopez Perez.
1321
1322         Unconditionally log errors using WTFLogAlways during EGL context creation. This
1323         provides a small degree of help for troubleshooting, and while eglGetError() only
1324         returns numeric error codes, it's better than nothing.
1325
1326         No new tests needed.
1327
1328         * platform/graphics/PlatformDisplay.cpp:
1329         (WebCore::PlatformDisplay::initializeEGLDisplay):
1330         * platform/graphics/egl/GLContextEGL.cpp:
1331         (WebCore::GLContextEGL::errorString):
1332         (WebCore::GLContextEGL::lastErrorString):
1333         (WebCore::GLContextEGL::createWindowContext):
1334         (WebCore::GLContextEGL::createPbufferContext):
1335         (WebCore::GLContextEGL::createSurfacelessContext):
1336         (WebCore::GLContextEGL::createContext):
1337         (WebCore::GLContextEGL::createSharingContext):
1338         (WebCore::GLContextEGL::GLContextEGL):
1339         * platform/graphics/egl/GLContextEGL.h:
1340         * platform/graphics/egl/GLContextEGLWPE.cpp:
1341         (WebCore::GLContextEGL::createWPEContext):
1342         * platform/graphics/wpe/PlatformDisplayWPE.cpp:
1343         (WebCore::PlatformDisplayWPE::initialize):
1344
1345 2017-11-02  Joseph Pecoraro  <pecoraro@apple.com>
1346
1347         Web Inspector: Move InspectorAgents into a folder
1348         https://bugs.webkit.org/show_bug.cgi?id=179132
1349
1350         Reviewed by Devin Rousso.
1351
1352         * CMakeLists.txt:
1353         * Sources.txt:
1354         * WebCore.xcodeproj/project.pbxproj:
1355         Move files around.
1356
1357         * inspector/agents/InspectorApplicationCacheAgent.cpp: Renamed from Source/WebCore/inspector/InspectorApplicationCacheAgent.cpp.
1358         * inspector/agents/InspectorApplicationCacheAgent.h: Renamed from Source/WebCore/inspector/InspectorApplicationCacheAgent.h.
1359         * inspector/agents/InspectorCSSAgent.cpp: Renamed from Source/WebCore/inspector/InspectorCSSAgent.cpp.
1360         * inspector/agents/InspectorCSSAgent.h: Renamed from Source/WebCore/inspector/InspectorCSSAgent.h.
1361         * inspector/agents/InspectorCanvasAgent.cpp: Renamed from Source/WebCore/inspector/InspectorCanvasAgent.cpp.
1362         * inspector/agents/InspectorCanvasAgent.h: Renamed from Source/WebCore/inspector/InspectorCanvasAgent.h.
1363         * inspector/agents/InspectorDOMAgent.cpp: Renamed from Source/WebCore/inspector/InspectorDOMAgent.cpp.
1364         * inspector/agents/InspectorDOMAgent.h: Renamed from Source/WebCore/inspector/InspectorDOMAgent.h.
1365         * inspector/agents/InspectorDOMDebuggerAgent.cpp: Renamed from Source/WebCore/inspector/InspectorDOMDebuggerAgent.cpp.
1366         * inspector/agents/InspectorDOMDebuggerAgent.h: Renamed from Source/WebCore/inspector/InspectorDOMDebuggerAgent.h.
1367         * inspector/agents/InspectorDOMStorageAgent.cpp: Renamed from Source/WebCore/inspector/InspectorDOMStorageAgent.cpp.
1368         * inspector/agents/InspectorDOMStorageAgent.h: Renamed from Source/WebCore/inspector/InspectorDOMStorageAgent.h.
1369         * inspector/agents/InspectorDatabaseAgent.cpp: Renamed from Source/WebCore/inspector/InspectorDatabaseAgent.cpp.
1370         * inspector/agents/InspectorDatabaseAgent.h: Renamed from Source/WebCore/inspector/InspectorDatabaseAgent.h.
1371         * inspector/agents/InspectorIndexedDBAgent.cpp: Renamed from Source/WebCore/inspector/InspectorIndexedDBAgent.cpp.
1372         * inspector/agents/InspectorIndexedDBAgent.h: Renamed from Source/WebCore/inspector/InspectorIndexedDBAgent.h.
1373         * inspector/agents/InspectorLayerTreeAgent.cpp: Renamed from Source/WebCore/inspector/InspectorLayerTreeAgent.cpp.
1374         * inspector/agents/InspectorLayerTreeAgent.h: Renamed from Source/WebCore/inspector/InspectorLayerTreeAgent.h.
1375         * inspector/agents/InspectorMemoryAgent.cpp: Renamed from Source/WebCore/inspector/InspectorMemoryAgent.cpp.
1376         * inspector/agents/InspectorMemoryAgent.h: Renamed from Source/WebCore/inspector/InspectorMemoryAgent.h.
1377         * inspector/agents/InspectorNetworkAgent.cpp: Renamed from Source/WebCore/inspector/InspectorNetworkAgent.cpp.
1378         * inspector/agents/InspectorNetworkAgent.h: Renamed from Source/WebCore/inspector/InspectorNetworkAgent.h.
1379         * inspector/agents/InspectorPageAgent.cpp: Renamed from Source/WebCore/inspector/InspectorPageAgent.cpp.
1380         * inspector/agents/InspectorPageAgent.h: Renamed from Source/WebCore/inspector/InspectorPageAgent.h.
1381         * inspector/agents/InspectorTimelineAgent.cpp: Renamed from Source/WebCore/inspector/InspectorTimelineAgent.cpp.
1382         * inspector/agents/InspectorTimelineAgent.h: Renamed from Source/WebCore/inspector/InspectorTimelineAgent.h.
1383         * inspector/agents/InspectorWorkerAgent.cpp: Renamed from Source/WebCore/inspector/InspectorWorkerAgent.cpp.
1384         * inspector/agents/InspectorWorkerAgent.h: Renamed from Source/WebCore/inspector/InspectorWorkerAgent.h.
1385         * inspector/agents/WebConsoleAgent.cpp: Renamed from Source/WebCore/inspector/WebConsoleAgent.cpp.
1386         * inspector/agents/WebConsoleAgent.h: Renamed from Source/WebCore/inspector/WebConsoleAgent.h.
1387         * inspector/agents/WebDebuggerAgent.cpp: Renamed from Source/WebCore/inspector/WebDebuggerAgent.cpp.
1388         * inspector/agents/WebDebuggerAgent.h: Renamed from Source/WebCore/inspector/WebDebuggerAgent.h.
1389         * inspector/agents/WebHeapAgent.cpp: Renamed from Source/WebCore/inspector/WebHeapAgent.cpp.
1390         * inspector/agents/WebHeapAgent.h: Renamed from Source/WebCore/inspector/WebHeapAgent.h.
1391         * inspector/agents/page/PageConsoleAgent.cpp: Renamed from Source/WebCore/inspector/PageConsoleAgent.cpp.
1392         * inspector/agents/page/PageConsoleAgent.h: Renamed from Source/WebCore/inspector/PageConsoleAgent.h.
1393         * inspector/agents/page/PageDebuggerAgent.cpp: Renamed from Source/WebCore/inspector/PageDebuggerAgent.cpp.
1394         * inspector/agents/page/PageDebuggerAgent.h: Renamed from Source/WebCore/inspector/PageDebuggerAgent.h.
1395         * inspector/agents/page/PageHeapAgent.cpp: Renamed from Source/WebCore/inspector/PageHeapAgent.cpp.
1396         * inspector/agents/page/PageHeapAgent.h: Renamed from Source/WebCore/inspector/PageHeapAgent.h.
1397         * inspector/agents/page/PageRuntimeAgent.cpp: Renamed from Source/WebCore/inspector/PageRuntimeAgent.cpp.
1398         * inspector/agents/page/PageRuntimeAgent.h: Renamed from Source/WebCore/inspector/PageRuntimeAgent.h.
1399         * inspector/agents/worker/WorkerConsoleAgent.cpp: Renamed from Source/WebCore/inspector/WorkerConsoleAgent.cpp.
1400         * inspector/agents/worker/WorkerConsoleAgent.h: Renamed from Source/WebCore/inspector/WorkerConsoleAgent.h.
1401         * inspector/agents/worker/WorkerDebuggerAgent.cpp: Renamed from Source/WebCore/inspector/WorkerDebuggerAgent.cpp.
1402         * inspector/agents/worker/WorkerDebuggerAgent.h: Renamed from Source/WebCore/inspector/WorkerDebuggerAgent.h.
1403         * inspector/agents/worker/WorkerRuntimeAgent.cpp: Renamed from Source/WebCore/inspector/WorkerRuntimeAgent.cpp.
1404         * inspector/agents/worker/WorkerRuntimeAgent.h: Renamed from Source/WebCore/inspector/WorkerRuntimeAgent.h.
1405         Move agents into folders.
1406
1407 2017-11-02  Youenn Fablet  <youenn@apple.com>
1408
1409         Service Worker fetch should transmit headers to its client
1410         https://bugs.webkit.org/show_bug.cgi?id=179156
1411
1412         Reviewed by Chris Dumez.
1413
1414         Covered by updated tests.
1415
1416         Making resourceResponse getter return a ResourceResponse with the headers of the FetchResponse Headers object.
1417
1418         * Modules/cache/DOMCache.cpp:
1419         (WebCore::DOMCache::toConnectionRecord):
1420         * Modules/fetch/FetchResponse.cpp:
1421         (WebCore::FetchResponse::resourceResponse const):
1422         * Modules/fetch/FetchResponse.h:
1423
1424 2017-11-02  Chris Dumez  <cdumez@apple.com>
1425
1426         Update SWServerJobQueue to follow the Service Worker specification more closely
1427         https://bugs.webkit.org/show_bug.cgi?id=179147
1428
1429         Reviewed by Youenn Fablet.
1430
1431         Align naming with the specification.
1432
1433         Get rid of unnecessary m_currentJob as the current job is always the first
1434         job in the queue.
1435
1436         Inline some of the tiny methods to simplify code. Those were leftovers from when
1437         we used to have a background thread.
1438
1439         * workers/service/server/SWServer.cpp:
1440         (WebCore::SWServer::scheduleJob):
1441         * workers/service/server/SWServerJobQueue.cpp:
1442         (WebCore::SWServerJobQueue::SWServerJobQueue):
1443         (WebCore::SWServerJobQueue::scriptFetchFinished):
1444         (WebCore::SWServerJobQueue::scriptContextStarted):
1445         (WebCore::SWServerJobQueue::runNextJob):
1446         (WebCore::SWServerJobQueue::runNextJobSynchronously):
1447         (WebCore::SWServerJobQueue::runRegisterJob):
1448         (WebCore::SWServerJobQueue::runUnregisterJob):
1449         (WebCore::SWServerJobQueue::runUpdateJob):
1450         (WebCore::SWServerJobQueue::rejectCurrentJob):
1451         (WebCore::SWServerJobQueue::finishCurrentJob):
1452         * workers/service/server/SWServerJobQueue.h:
1453         (WebCore::SWServerJobQueue::firstJob const):
1454         (WebCore::SWServerJobQueue::lastJob const):
1455         (WebCore::SWServerJobQueue::enqueueJob):
1456         (WebCore::SWServerJobQueue::size const):
1457
1458 2017-11-02  Konstantin Tokarev  <annulen@yandex.ru>
1459
1460         Unreviewed, removed useless semicolon at the end of namespace
1461
1462         * platform/graphics/texmap/BitmapTextureGL.cpp:
1463
1464 2017-11-02  Michael Catanzaro  <mcatanzaro@igalia.com>
1465
1466         WPE does not build with DragImage.cpp in unified sources.
1467         https://bugs.webkit.org/show_bug.cgi?id=178844
1468
1469         Reviewed by Keith Miller.
1470
1471         Add a stub implementation of DragImage for WPE so that we can drop the @no-unify.
1472
1473         * Sources.txt:
1474         * SourcesWPE.txt:
1475         * WebCore.xcodeproj/project.pbxproj:
1476         * platform/wpe/DragImageWPE.cpp: Added.
1477         (WebCore::dragImageSize):
1478         (WebCore::deleteDragImage):
1479         (WebCore::scaleDragImage):
1480         (WebCore::dissolveDragImageToFraction):
1481         (WebCore::createDragImageFromImage):
1482         (WebCore::createDragImageIconForCachedImageFilename):
1483         (WebCore::createDragImageForLink):
1484
1485 2017-11-02  Eric Carlson  <eric.carlson@apple.com>
1486
1487         [MediaStream] audioTrack.label is always empty on macOS
1488         https://bugs.webkit.org/show_bug.cgi?id=179175
1489         <rdar://problem/35315438>
1490
1491         Reviewed by Youenn Fablet.
1492
1493         * platform/mediastream/RealtimeMediaSourceSettings.h:
1494         (WebCore::RealtimeMediaSourceSettings::label const): New.
1495         (WebCore::RealtimeMediaSourceSettings::setLabel): Ditto.
1496         (WebCore::RealtimeMediaSourceSettings::encode const): Encode label.
1497         (WebCore::RealtimeMediaSourceSettings::decode): Decode label.
1498
1499         * platform/mediastream/mac/AVMediaCaptureSource.mm:
1500         (WebCore::AVMediaCaptureSource::initializeSettings): Set label.
1501
1502         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
1503         (WebCore::CoreAudioCaptureSource::settings const): Ditto.
1504
1505         * platform/mock/MockRealtimeMediaSource.cpp:
1506         (WebCore::MockRealtimeMediaSource::initializeSettings): Ditto.
1507
1508 2017-11-02  Chris Dumez  <cdumez@apple.com>
1509
1510         [Service Workers] Add initial implementation for try Clear Registration / Clear Registration algorithms
1511         https://bugs.webkit.org/show_bug.cgi?id=179151
1512
1513         Reviewed by Youenn Fablet.
1514
1515         [Service Workers] Add initial implementation for try Clear Registration / Clear Registration algorithms:
1516         - https://w3c.github.io/ServiceWorker/#try-clear-registration
1517         - https://w3c.github.io/ServiceWorker/#clear-registration
1518
1519         * workers/service/server/SWServerJobQueue.cpp:
1520         (WebCore::SWServerJobQueue::scriptFetchFinished):
1521         (WebCore::SWServerJobQueue::runUnregisterJob):
1522         (WebCore::SWServerJobQueue::tryClearRegistration):
1523         (WebCore::SWServerJobQueue::clearRegistration):
1524         * workers/service/server/SWServerJobQueue.h:
1525
1526 2017-11-02  Antti Koivisto  <antti@apple.com>
1527
1528         Clear Node renderer pointer when destroying RenderObject
1529         https://bugs.webkit.org/show_bug.cgi?id=179112
1530
1531         Reviewed by Zalan Bujtas.
1532
1533         Make sure we don't leave renderer pointers behind in Nodes.
1534         This could be done with WeakPtr but that would add extra indirection between DOM and render tree.
1535
1536         * rendering/RenderObject.cpp:
1537         (WebCore::RenderObject::willBeDestroyed):
1538
1539             Null the node renderer pointer.
1540             With continuations we have a case where renderer points to a node that has a different renderer.
1541             This is is ok as we know no node points to a continuation (they should really be anonymous renderers).
1542
1543 2017-11-02  Antti Koivisto  <antti@apple.com>
1544
1545         Remove empty continuations in RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers
1546         https://bugs.webkit.org/show_bug.cgi?id=179014
1547
1548         Remove overly optimistic non-critical assertion that is hit on WK1 debug.
1549
1550         * rendering/RenderBoxModelObject.cpp:
1551         (WebCore::RenderBoxModelObject::removeAndDestroyAllContinuations):
1552
1553 2017-11-02  Frederic Wang  <fwang@igalia.com>
1554
1555         Add references to bug 179167 in FIXME comments
1556         https://bugs.webkit.org/show_bug.cgi?id=179168
1557
1558         Reviewed by Daniel Bates.
1559
1560         * Configurations/FeatureDefines.xcconfig:
1561
1562 2017-11-02  Antti Koivisto  <antti@apple.com>
1563
1564         Remove empty continuations in RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers
1565         https://bugs.webkit.org/show_bug.cgi?id=179014
1566
1567         Reviewed by Geoff Garen.
1568
1569         Treat continuation similarly to other anonymous wrappers. This makes things more understandable
1570         and allows removal of some questionable code in RenderBlock::takeChild.
1571
1572         The patch also makes continuation chain a double linked so we can efficiently remove single
1573         continuations from the chain. It also gets rid of algorithms that recurse in continuation chain.
1574
1575         * accessibility/AccessibilityRenderObject.cpp:
1576         (WebCore::firstChildInContinuation):
1577         * rendering/RenderBlock.cpp:
1578         (WebCore::RenderBlock::styleDidChange):
1579
1580             Don't add and remove continuations from the chain when updating style. Prevent recursion by walking
1581             the chain only in the (non-continuation) head renderer.
1582
1583         (WebCore::RenderBlock::dropAnonymousBoxChild):
1584
1585             Make a member function.
1586
1587         (WebCore::RenderBlock::takeChild):
1588
1589             Remove code that destroyed empty continuations and caused the parent to destroy itself.
1590             Empty continuations are now removed by RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers.
1591
1592         * rendering/RenderBlock.h:
1593         * rendering/RenderBoxModelObject.cpp:
1594         (WebCore::RenderBoxModelObject::ContinuationChainNode::ContinuationChainNode):
1595         (WebCore::RenderBoxModelObject::ContinuationChainNode::~ContinuationChainNode):
1596         (WebCore::RenderBoxModelObject::ContinuationChainNode::insertAfter):
1597
1598             Track continuations with double linked lists.
1599
1600         (WebCore::continuationChainNodeMap):
1601         (WebCore::RenderBoxModelObject::willBeDestroyed):
1602
1603             Don't recurse to destroy continuation chain. 
1604             Destroy all continuations iteratively if this is the head of the chain.
1605             When destroying a continuation renderer simply remove it from the chain.
1606
1607         (WebCore::RenderBoxModelObject::continuation const):
1608         (WebCore::RenderBoxModelObject::insertIntoContinuationChainAfter):
1609         (WebCore::RenderBoxModelObject::removeFromContinuationChain):
1610         (WebCore::RenderBoxModelObject::ensureContinuationChainNode):
1611         (WebCore::continuationMap): Deleted.
1612         (WebCore::RenderBoxModelObject::setContinuation): Deleted.
1613         * rendering/RenderBoxModelObject.h:
1614         * rendering/RenderElement.cpp:
1615         (WebCore::RenderElement::RenderElement):
1616         (WebCore::RenderElement::removeAnonymousWrappersForInlinesIfNecessary):
1617
1618             Make this a function of the parent renderer itself instead of getting 'parent()' as first operation and
1619             then using it.
1620             Don't remove continuations (isAnonymousBlockContinuation() test gives wrong result for the last continuation of the chain).
1621
1622         (WebCore::RenderElement::styleDidChange):
1623
1624             removeAnonymousWrappersForInlinesIfNecessary is no function of the parent.
1625
1626         (WebCore::RenderElement::updateOutlineAutoAncestor):
1627         * rendering/RenderElement.h:
1628         (WebCore::RenderElement::hasContinuationChainNode const):
1629         (WebCore::RenderElement::setHasContinuationChainNode):
1630         (WebCore::RenderElement::hasContinuation const): Deleted.
1631         (WebCore::RenderElement::setHasContinuation): Deleted.
1632         * rendering/RenderInline.cpp:
1633         (WebCore::RenderInline::styleDidChange):
1634
1635             Don't add and remove continuations from the chain when updating style. Prevent recursion by walking
1636             the chain only in the (non-continuation) head renderer.
1637
1638         (WebCore::RenderInline::addChildIgnoringContinuation):
1639
1640             Remove the old continuation from the chain. splitFlow() will add it back into the right place.
1641
1642         (WebCore::RenderInline::splitInlines):
1643         (WebCore::RenderInline::addChildToContinuation):
1644         (WebCore::RenderInline::childBecameNonInline):
1645
1646             Remove the old continuation from the chain. splitFlow() will add it back into the right place.
1647
1648         * rendering/RenderInline.h:
1649         * rendering/RenderObject.cpp:
1650         (WebCore::RenderObject::propagateRepaintToParentWithOutlineAutoIfNeeded const):
1651         (WebCore::RenderObject::outputRenderObject const):
1652         (WebCore::findDestroyRootIncludingAnonymous):
1653
1654             Allow anonymous continuations as destroy roots.
1655
1656         (WebCore::RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers):
1657
1658             Removing a continuation may leave behind unnecessary anonymous sibling wrappers.
1659             Call removeAnonymousWrappersForInlinesIfNecessary() on parent after removal to get rid of them.
1660             If takeChild/removeAnonymousWrappersForInlinesIfNecessary leaves us with empty anonymous parent destroy that too.
1661
1662         * rendering/RenderRubyRun.cpp:
1663         (WebCore::RenderRubyRun::takeChild):
1664
1665             Similar to RenderBlock::takeChild, remove the code that would make the renderer destroy itself.
1666             Cleaning up RenderRubyRuns is now handled by removeFromParentAndDestroyCleaningUpAnonymousWrappers.
1667
1668 2017-11-02  Ryosuke Niwa  <rniwa@webkit.org>
1669
1670         REGRESSION(r224053): Crash in WebCore::Node::moveTreeToNewScope
1671         https://bugs.webkit.org/show_bug.cgi?id=179158
1672
1673         Reviewed by Antti Koivisto.
1674
1675         Call decrementReferencingNodeCount after checking the release assertion
1676         since that could delete oldDocument.
1677
1678         * dom/Node.cpp:
1679         (WebCore::Node::moveTreeToNewScope):
1680
1681 2017-11-02  Antti Koivisto  <antti@apple.com>
1682
1683         First letter text renderer should be anonymous
1684         https://bugs.webkit.org/show_bug.cgi?id=179114
1685
1686         Reviewed by Darin Adler.
1687
1688         Currently both RenderTextFragment and RenderText for first letter point to the same Text node.
1689         There should only be one non-anonymous renderer per node.
1690
1691         * accessibility/AccessibilityRenderObject.cpp:
1692         (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored const):
1693
1694             Skip the first letter text renderer instead of the fragment.
1695
1696         * rendering/RenderBoxModelObject.cpp:
1697         (WebCore::firstLetterRemainingTextMap):
1698
1699             Use WeakPtr.
1700             Modernize.
1701
1702         (WebCore::RenderBoxModelObject::willBeDestroyed):
1703         (WebCore::RenderBoxModelObject::firstLetterRemainingText const):
1704
1705             Avoid hash lookup with the new isFirstLetter bit.
1706
1707         (WebCore::RenderBoxModelObject::setFirstLetterRemainingText):
1708
1709         * rendering/RenderElement.cpp:
1710         (WebCore::RenderElement::RenderElement):
1711         * rendering/RenderElement.h:
1712         (WebCore::RenderElement::isFirstLetter const):
1713         (WebCore::RenderElement::setIsFirstLetter):
1714
1715             Add a bit for more explicit code.
1716
1717         * rendering/RenderTextFragment.cpp:
1718         (WebCore::RenderTextFragment::setText):
1719
1720             Assert that RenderTextFragment is always the non-anonymous renderer.
1721
1722         * style/RenderTreeUpdaterFirstLetter.cpp:
1723         (WebCore::updateFirstLetterStyle):
1724
1725             Set the isFirstLetter bit.
1726
1727         (WebCore::createFirstLetterRenderer):
1728
1729             Set the isFirstLetter bit.
1730             Remove the old text renderer before adding a new one.
1731
1732 2017-11-01  Frederic Wang  <fwang@igalia.com>
1733
1734         Remove ScrollableArea::isTouchScrollable and ScrollableArea::isOverflowScroll
1735         https://bugs.webkit.org/show_bug.cgi?id=179121
1736
1737         Reviewed by Alex Christensen.
1738
1739         These functions were introduced in r161589 and r160236 but it seems that they have never
1740         been used.
1741
1742         No new tests, behavior unchanged.
1743
1744         * platform/ScrollableArea.h:
1745         (WebCore::ScrollableArea::isTouchScrollable const): Deleted.
1746         (WebCore::ScrollableArea::isOverflowScroll const): Deleted.
1747         * rendering/RenderLayer.h:
1748
1749 2017-11-01  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1750
1751         [Curl] Make the order of scheduler job handling sequential 
1752         https://bugs.webkit.org/show_bug.cgi?id=179127
1753
1754         Reviewed by Alex Christensen.
1755
1756         * platform/network/curl/CurlRequestScheduler.cpp:
1757         (WebCore::CurlRequestScheduler::add):
1758         (WebCore::CurlRequestScheduler::cancel):
1759         (WebCore::CurlRequestScheduler::stopThreadIfNoMoreJobRunning):
1760         (WebCore::CurlRequestScheduler::executeTasks):
1761         (WebCore::CurlRequestScheduler::workerThread):
1762         (WebCore::CurlRequestScheduler::startTransfer):
1763         (WebCore::CurlRequestScheduler::completeTransfer):
1764         (WebCore::CurlRequestScheduler::cancelTransfer):
1765         (WebCore::CurlRequestScheduler::finalizeTransfer):
1766         (WebCore::CurlJobList::isEmpty const): Deleted.
1767         (WebCore::CurlJobList::startJobs): Deleted.
1768         (WebCore::CurlJobList::finishJobs): Deleted.
1769         (WebCore::CurlRequestScheduler::updateJobList): Deleted.
1770         * platform/network/curl/CurlRequestScheduler.h:
1771
1772 2017-11-01  Ryosuke Niwa  <rniwa@webkit.org>
1773
1774         NavigatorBase::onLine() accesses NetworkStateNotifier's singleton in a worker thread
1775         https://bugs.webkit.org/show_bug.cgi?id=179149
1776         <rdar://problem/35307552>
1777
1778         Reviewed by Jiewen Tan.
1779
1780         Fixed the bug making NavigatorBase::onLine a pure virtual function, and having two separate
1781         implementations for Navigator and WorkerNavigator. The former uses the singleton directly,
1782         and the latter returns the boolean stored in its instance. The boolean value is updated
1783         via WorkerMessagingProxy when the online status changes.
1784
1785         No new tests.
1786
1787         * page/Navigator.cpp:
1788         (WebCore::Navigator::onLine const):
1789         * page/Navigator.h:
1790         * page/NavigatorBase.cpp:
1791         (WebCore::NavigatorBase::onLine): Deleted.
1792         * page/NavigatorBase.h:
1793         * page/WorkerNavigator.cpp:
1794         (WebCore::WorkerNavigator::WorkerNavigator):
1795         (WebCore::WorkerNavigator::onLine const):
1796         * page/WorkerNavigator.h:
1797         * platform/network/NetworkStateNotifier.cpp:
1798         (WebCore::NetworkStateNotifier::singleton):
1799         * workers/DedicatedWorkerGlobalScope.cpp:
1800         (WebCore::DedicatedWorkerGlobalScope::create):
1801         (WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope):
1802         * workers/DedicatedWorkerGlobalScope.h:
1803         * workers/DedicatedWorkerThread.cpp:
1804         (WebCore::DedicatedWorkerThread::DedicatedWorkerThread):
1805         (WebCore::DedicatedWorkerThread::createWorkerGlobalScope):
1806         * workers/DedicatedWorkerThread.h:
1807         * workers/Worker.cpp:
1808         (WebCore::Worker::notifyFinished):
1809         * workers/WorkerGlobalScope.cpp:
1810         (WebCore::WorkerGlobalScope::WorkerGlobalScope):
1811         (WebCore::WorkerGlobalScope::navigator):
1812         (WebCore::WorkerGlobalScope::setIsOnline):
1813         * workers/WorkerGlobalScope.h:
1814         * workers/WorkerGlobalScopeProxy.h:
1815         * workers/WorkerMessagingProxy.cpp:
1816         (WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
1817         (WebCore::WorkerMessagingProxy::notifyNetworkStateChange):
1818         * workers/WorkerMessagingProxy.h:
1819         * workers/WorkerThread.cpp:
1820         (WebCore::WorkerThreadStartupData::WorkerThreadStartupData):
1821         (WebCore::WorkerThread::WorkerThread):
1822         (WebCore::WorkerThread::workerThread):
1823         * workers/WorkerThread.h:
1824         * workers/service/ServiceWorkerGlobalScope.cpp:
1825         (WebCore::ServiceWorkerGlobalScope::ServiceWorkerGlobalScope):
1826         * workers/service/ServiceWorkerGlobalScope.h:
1827         * workers/service/context/ServiceWorkerThread.cpp:
1828         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
1829         (WebCore::ServiceWorkerThread::createWorkerGlobalScope):
1830         * workers/service/context/ServiceWorkerThread.h:
1831
1832 2017-11-01  Jiewen Tan  <jiewen_tan@apple.com>
1833
1834         Let is<T>() accept RefPtrs
1835         https://bugs.webkit.org/show_bug.cgi?id=178612
1836         <rdar://problem/35102004>
1837
1838         Reviewed by Ryosuke Niwa.
1839
1840         Get rid of .get() for all is<T>() calls.
1841
1842         No changes in behaviors.
1843
1844         * bindings/js/JSElementCustom.cpp:
1845         (WebCore::createNewElementWrapper):
1846         * bindings/js/JSMediaStreamTrackCustom.cpp:
1847         (WebCore::toJSNewlyCreated):
1848         * bindings/js/JSNodeCustom.cpp:
1849         (WebCore::createWrapperInline):
1850         * bindings/js/JSTextCustom.cpp:
1851         (WebCore::toJSNewlyCreated):
1852         * css/CSSFilterImageValue.cpp:
1853         (WebCore::CSSFilterImageValue::loadSubimages):
1854         * css/CSSFontFaceSet.cpp:
1855         (WebCore::CSSFontFaceSet::matchingFaces):
1856         * css/CSSFontSelector.cpp:
1857         (WebCore::CSSFontSelector::addFontFaceRule):
1858         * css/CSSToStyleMap.cpp:
1859         (WebCore::CSSToStyleMap::mapNinePieceImage):
1860         * css/FontFace.cpp:
1861         (WebCore::FontFace::create):
1862         * css/StyleBuilderConverter.h:
1863         (WebCore::StyleBuilderConverter::createGridTrackList):
1864         * css/StyleBuilderCustom.h:
1865         (WebCore::StyleBuilderCustom::applyValueCursor):
1866         (WebCore::StyleBuilderCustom::applyValueContent):
1867         (WebCore::StyleBuilderCustom::applyValueWillChange):
1868         * css/StyleProperties.cpp:
1869         (WebCore::StyleProperties::propertyAsColor const):
1870         (WebCore::StyleProperties::propertyAsValueID const):
1871         * css/StyleResolver.cpp:
1872         (WebCore::StyleResolver::createFilterOperations):
1873         * css/TransformFunctions.cpp:
1874         (WebCore::transformsForValue):
1875         * css/ViewportStyleResolver.cpp:
1876         (WebCore::ViewportStyleResolver::getViewportArgumentValue const):
1877         * dom/Document.cpp:
1878         (WebCore::Document::setBodyOrFrameset):
1879         (WebCore::Document::setFocusedElement):
1880         (WebCore::Document::updateHoverActiveState):
1881         * dom/Element.cpp:
1882         (WebCore::Element::setOuterHTML):
1883         * dom/Range.cpp:
1884         (WebCore::Range::insertNode):
1885         * editing/ApplyStyleCommand.cpp:
1886         (WebCore::toIdentifier):
1887         (WebCore::ApplyStyleCommand::applyBlockStyle):
1888         (WebCore::ApplyStyleCommand::surroundNodeRangeWithElement):
1889         * editing/EditingStyle.cpp:
1890         (WebCore::identifierForStyleProperty):
1891         (WebCore::HTMLElementEquivalent::valueIsPresentInStyle const):
1892         (WebCore::EditingStyle::extractFontSizeDelta):
1893         (WebCore::EditingStyle::textDirection const):
1894         (WebCore::textDecorationValueList):
1895         (WebCore::EditingStyle::prepareToApplyAt):
1896         (WebCore::EditingStyle::legacyFontSize const):
1897         (WebCore::EditingStyle::textDirectionForSelection):
1898         (WebCore::StyleChange::StyleChange):
1899         (WebCore::StyleChange::extractTextStyles):
1900         (WebCore::diffTextDecorations):
1901         * html/BaseChooserOnlyDateAndTimeInputType.cpp:
1902         (WebCore::BaseChooserOnlyDateAndTimeInputType::updateAppearance):
1903         * html/FormAssociatedElement.cpp:
1904         (WebCore::FormAssociatedElement::findAssociatedForm):
1905         * html/HTMLAreaElement.cpp:
1906         (WebCore::HTMLAreaElement::imageElement const):
1907         * html/HTMLElement.cpp:
1908         (WebCore::HTMLElement::setOuterText):
1909         (WebCore::HTMLElement::dirAttributeChanged):
1910         * html/HTMLEmbedElement.cpp:
1911         (WebCore::HTMLEmbedElement::rendererIsNeeded):
1912         * html/HTMLFormControlElement.cpp:
1913         (WebCore::HTMLFormControlElement::computeIsDisabledByFieldsetAncestor const):
1914         * html/HTMLInputElement.cpp:
1915         (WebCore::HTMLInputElement::dataList const):
1916         * html/HTMLOptionElement.cpp:
1917         (WebCore::HTMLOptionElement::setText):
1918         (WebCore::HTMLOptionElement::textIndentedToRespectGroupLabel const):
1919         * html/HTMLPlugInElement.cpp:
1920         (WebCore::HTMLPlugInElement::isKeyboardFocusable const):
1921         (WebCore::HTMLPlugInElement::isUserObservable const):
1922         * html/HTMLSelectElement.cpp:
1923         (WebCore::HTMLSelectElement::selectOption):
1924         * html/HTMLSummaryElement.cpp:
1925         (WebCore::isClickableControl):
1926         * html/HTMLTextFormControlElement.cpp:
1927         (WebCore::HTMLTextFormControlElement::adjustInnerTextStyle const):
1928         * html/RadioInputType.cpp:
1929         (WebCore::RadioInputType::isKeyboardFocusable const):
1930         * html/parser/HTMLConstructionSite.cpp:
1931         (WebCore::HTMLConstructionSite::attachLater):
1932         (WebCore::HTMLConstructionSite::insertTextNode):
1933         * html/shadow/MediaControlElements.cpp:
1934         (WebCore::MediaControlClosedCaptionsTrackListElement::defaultEventHandler):
1935         * html/track/TextTrackList.cpp:
1936         (TextTrackList::append):
1937         * inspector/InspectorDOMAgent.cpp:
1938         (WebCore::InspectorDOMAgent::setNodeName):
1939         * inspector/PageScriptDebugServer.cpp:
1940         (WebCore::PageScriptDebugServer::setJavaScriptPaused):
1941         * page/FocusController.cpp:
1942         (WebCore::shouldClearSelectionWhenChangingFocusedElement):
1943         * page/FrameView.cpp:
1944         (WebCore::FrameView::hasCustomScrollbars const):
1945         * page/Page.cpp:
1946         (WebCore::Page::pluginViews):
1947         * page/mac/EventHandlerMac.mm:
1948         (WebCore::EventHandler::platformPrepareForWheelEvents):
1949         * rendering/RenderBoxModelObject.cpp:
1950         (WebCore::RenderBoxModelObject::paintFillLayerExtended):
1951         * testing/Internals.cpp:
1952         (WebCore::deferredStyleRulesCountForList):
1953         (WebCore::deferredGroupRulesCountForList):
1954         (WebCore::deferredKeyframesRulesCountForList):
1955
1956 2017-11-01  Fujii Hironori  <Hironori.Fujii@sony.com>
1957
1958         [curl] Fix build after r224299
1959         https://bugs.webkit.org/show_bug.cgi?id=179155
1960
1961         Unreviewed.
1962
1963         Bug 175597 added the 6th argument of ResourceHandle constructor.
1964         Apply the same change of ResourceHandleCFNet.cpp to
1965         platformLoadResourceSynchronously of ResourceHandleCurl.cpp.
1966
1967         No new tests since there should be no behavioral change other
1968
1969         * platform/network/curl/ResourceHandleCurl.cpp:
1970         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
1971         Added the 6th arguemnt shouldContentEncodingSniff.
1972
1973 2017-11-01  Simon Fraser  <simon.fraser@apple.com>
1974
1975         Fix iOS build after r224312.
1976
1977         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
1978         (WebCore::GraphicsContext::drawFocusRing):
1979
1980 2017-11-01  Daniel Bates  <dabates@apple.com>
1981
1982         Change Element::didAddUserAgentShadowRoot() to take a reference instead of a pointer
1983         https://bugs.webkit.org/show_bug.cgi?id=179153
1984
1985         Reviewed by Ryosuke Niwa.
1986
1987         Element::didAddUserAgentShadowRoot() is always passed a non-null pointer to the added
1988         ShadowRoot. Therefore we should have didAddUserAgentShadowRoot() take a lvalue reference
1989         to a ShadowRoot.
1990
1991         No functionality changed. So, no new tests.
1992
1993         * dom/Element.cpp:
1994         (WebCore::Element::addShadowRoot):
1995         * dom/Element.h:
1996         (WebCore::Element::didAddUserAgentShadowRoot):
1997         * html/HTMLDetailsElement.cpp:
1998         (WebCore::HTMLDetailsElement::didAddUserAgentShadowRoot):
1999         * html/HTMLDetailsElement.h:
2000         * html/HTMLInputElement.cpp:
2001         (WebCore::HTMLInputElement::didAddUserAgentShadowRoot):
2002         * html/HTMLInputElement.h:
2003         * html/HTMLMediaElement.cpp:
2004         (WebCore::HTMLMediaElement::didAddUserAgentShadowRoot):
2005         * html/HTMLMediaElement.h:
2006         * html/HTMLMeterElement.cpp:
2007         (WebCore::HTMLMeterElement::didAddUserAgentShadowRoot):
2008         * html/HTMLMeterElement.h:
2009         * html/HTMLPlugInElement.cpp:
2010         (WebCore::HTMLPlugInElement::didAddUserAgentShadowRoot):
2011         * html/HTMLPlugInElement.h:
2012         * html/HTMLPlugInImageElement.cpp:
2013         (WebCore::HTMLPlugInImageElement::didAddUserAgentShadowRoot):
2014         * html/HTMLPlugInImageElement.h:
2015         * html/HTMLProgressElement.cpp:
2016         (WebCore::HTMLProgressElement::didAddUserAgentShadowRoot):
2017         * html/HTMLProgressElement.h:
2018         * html/HTMLSummaryElement.cpp:
2019         (WebCore::HTMLSummaryElement::didAddUserAgentShadowRoot):
2020         * html/HTMLSummaryElement.h:
2021         * html/HTMLTextAreaElement.cpp:
2022         (WebCore::HTMLTextAreaElement::didAddUserAgentShadowRoot):
2023         * html/HTMLTextAreaElement.h:
2024
2025 2017-11-01  Jeremy Jones  <jeremyj@apple.com>
2026
2027         Implement WKFullscreenWindowController for iOS.
2028         https://bugs.webkit.org/show_bug.cgi?id=178924
2029         rdar://problem/34697120
2030
2031         Reviewed by Simon Fraser.
2032
2033         Enable ENABLE_FULLSCREEN_API for iOS.
2034
2035         * Configurations/FeatureDefines.xcconfig:
2036
2037 2017-11-01  Simon Fraser  <simon.fraser@apple.com>
2038
2039         Misc display list and other cleanup
2040         https://bugs.webkit.org/show_bug.cgi?id=179150
2041
2042         Reviewed by Tim Horton.
2043
2044         A few functions in GraphicsContext would assert when using display lists, because they
2045         had no recording clause. Fix them (ellipse drawing, and focus ring drawing).
2046         
2047         Use #pragma once in more places.
2048
2049         Add system trace points for display list recording.
2050
2051         No behavior change for non-display list code.
2052
2053         * platform/graphics/GraphicsContext.cpp:
2054         (WebCore::GraphicsContext::fillEllipse):
2055         (WebCore::GraphicsContext::strokeEllipse):
2056         * platform/graphics/PlatformLayer.h:
2057         * platform/graphics/ca/GraphicsLayerCA.cpp:
2058         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
2059         * platform/graphics/ca/cocoa/WebSystemBackdropLayer.h:
2060         * platform/graphics/ca/cocoa/WebTiledBackingLayer.h:
2061         * platform/graphics/cg/GraphicsContextCG.h:
2062         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
2063         (WebCore::GraphicsContext::drawFocusRing):
2064         * platform/graphics/displaylists/DisplayList.h:
2065         * platform/graphics/displaylists/DisplayListItems.h:
2066         (WebCore::DisplayList::DrawFocusRingPath::create):
2067         (WebCore::DisplayList::DrawFocusRingPath::width const):
2068         (WebCore::DisplayList::DrawFocusRingPath::offset const):
2069         (WebCore::DisplayList::DrawFocusRingPath::DrawFocusRingPath):
2070         (WebCore::DisplayList::DrawFocusRingRects::create):
2071         (WebCore::DisplayList::DrawFocusRingRects::width const):
2072         (WebCore::DisplayList::DrawFocusRingRects::offset const):
2073         (WebCore::DisplayList::DrawFocusRingRects::DrawFocusRingRects):
2074         * platform/graphics/displaylists/DisplayListRecorder.cpp:
2075         (WebCore::DisplayList::Recorder::restore):
2076         (WebCore::DisplayList::Recorder::drawFocusRing):
2077         * platform/graphics/displaylists/DisplayListRecorder.h:
2078         * platform/graphics/displaylists/DisplayListReplayer.h:
2079         * platform/graphics/mac/WebLayer.h:
2080
2081 2017-11-01  Per Arne Vollan  <pvollan@apple.com>
2082
2083         [Win] Fix compile errors in MediaPlayerPrivateAVFoundationCF.cpp
2084         https://bugs.webkit.org/show_bug.cgi?id=179148
2085
2086         Reviewed by Ryosuke Niwa.
2087
2088         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
2089         (WebCore::MediaPlayerPrivateAVFoundationCF::resolvedURLChanged):
2090
2091 2017-11-01  Tim Horton  <timothy_horton@apple.com>
2092
2093         Adjust RenderElement size assertion to be more accurate
2094         https://bugs.webkit.org/show_bug.cgi?id=179146
2095
2096         Reviewed by Simon Fraser.
2097
2098         * rendering/RenderElement.cpp:
2099         Alignment rules for bitfields differ on different platforms. If we're
2100         more truthful in our mimicing the layout of RenderElement, we can avoid
2101         the assertion firing on more configurations.
2102
2103 2017-11-01  Mark Lam  <mark.lam@apple.com>
2104
2105         Add support to throw OOM if MarkedArgumentBuffer may overflow.
2106         https://bugs.webkit.org/show_bug.cgi?id=179092
2107         <rdar://problem/35116160>
2108
2109         Reviewed by Saam Barati.
2110
2111         No new tests.  The test for overflowing a MarkedArgumentBuffer will run for a
2112         ridiculously long time, which renders it unsuitable for automated tests.
2113
2114         * Modules/plugins/QuickTimePluginReplacement.mm:
2115         (WebCore::QuickTimePluginReplacement::installReplacement):
2116         * bindings/js/JSCustomElementInterface.cpp:
2117         (WebCore::constructCustomElementSynchronously):
2118         (WebCore::JSCustomElementInterface::upgradeElement):
2119         (WebCore::JSCustomElementInterface::invokeCallback):
2120         * bindings/js/JSCustomXPathNSResolver.cpp:
2121         (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
2122         * bindings/js/JSDOMBuiltinConstructorBase.cpp:
2123         (WebCore::JSDOMBuiltinConstructorBase::callFunctionWithCurrentArguments):
2124         * bindings/js/JSDOMConvertSequences.h:
2125         (WebCore::JSConverter<IDLSequence<T>>::convert):
2126         (WebCore::JSConverter<IDLFrozenArray<T>>::convert):
2127         * bindings/js/JSDOMConvertWebGL.cpp:
2128         (WebCore::convertToJSValue):
2129         * bindings/js/JSDOMIterator.h:
2130         (WebCore::jsPair):
2131         (WebCore::iteratorForEach):
2132         * bindings/js/JSDOMMapLike.cpp:
2133         (WebCore::forwardFunctionCallToBackingMap):
2134         (WebCore::forwardForEachCallToBackingMap):
2135         * bindings/js/JSDOMPromiseDeferred.cpp:
2136         (WebCore::DeferredPromise::callFunction):
2137         (WebCore::createRejectedPromiseWithTypeError):
2138         * bindings/js/JSErrorHandler.cpp:
2139         (WebCore::JSErrorHandler::handleEvent):
2140         * bindings/js/JSEventListener.cpp:
2141         (WebCore::JSEventListener::handleEvent):
2142         * bindings/js/JSLazyEventListener.cpp:
2143         (WebCore::JSLazyEventListener::initializeJSFunction const):
2144         * bindings/js/JSPluginElementFunctions.cpp:
2145         (WebCore::callPlugin):
2146         * bindings/js/JSReadableStreamPrivateConstructors.cpp:
2147         (WebCore::constructJSReadableStreamReaderGeneric):
2148         * bindings/js/ReadableStream.cpp:
2149         (WebCore::ReadableStream::create):
2150         (WebCore::ReadableStream::pipeTo):
2151         (WebCore::ReadableStream::tee):
2152         (WebCore::ReadableStream::lock):
2153         (WebCore::checkReadableStream):
2154         * bindings/js/ReadableStreamDefaultController.cpp:
2155         (WebCore::ReadableStreamDefaultController::invoke):
2156         * bindings/js/ScheduledAction.cpp:
2157         (WebCore::ScheduledAction::executeFunctionInContext):
2158         * bindings/js/SerializedScriptValue.cpp:
2159         (WebCore::CloneSerializer::recordObject):
2160         (WebCore::CloneSerializer::serialize):
2161         (WebCore::CloneDeserializer::readTerminal):
2162         (WebCore::CloneDeserializer::deserialize):
2163         * bindings/scripts/CodeGeneratorJS.pm:
2164         (GenerateCallbackImplementationContent):
2165         * bindings/scripts/test/JS/JSTestCallbackFunction.cpp:
2166         (WebCore::JSTestCallbackFunction::handleEvent):
2167         * bindings/scripts/test/JS/JSTestCallbackFunctionRethrow.cpp:
2168         (WebCore::JSTestCallbackFunctionRethrow::handleEvent):
2169         * bindings/scripts/test/JS/JSTestCallbackFunctionWithThisObject.cpp:
2170         (WebCore::JSTestCallbackFunctionWithThisObject::handleEvent):
2171         * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp:
2172         (WebCore::JSTestCallbackFunctionWithTypedefs::handleEvent):
2173         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
2174         (WebCore::JSTestCallbackInterface::callbackWithNoParam):
2175         (WebCore::JSTestCallbackInterface::callbackWithArrayParam):
2176         (WebCore::JSTestCallbackInterface::callbackWithSerializedScriptValueParam):
2177         (WebCore::JSTestCallbackInterface::callbackWithStringList):
2178         (WebCore::JSTestCallbackInterface::callbackWithBoolean):
2179         (WebCore::JSTestCallbackInterface::callbackRequiresThisToPass):
2180         (WebCore::JSTestCallbackInterface::callbackWithAReturnValue):
2181         (WebCore::JSTestCallbackInterface::callbackThatRethrowsExceptions):
2182         (WebCore::JSTestCallbackInterface::callbackThatSkipsInvokeCheck):
2183         (WebCore::JSTestCallbackInterface::callbackWithThisObject):
2184         * bindings/scripts/test/JS/JSTestVoidCallbackFunction.cpp:
2185         (WebCore::JSTestVoidCallbackFunction::handleEvent):
2186         * bridge/NP_jsobject.cpp:
2187         * bridge/objc/WebScriptObject.mm:
2188         (-[WebScriptObject callWebScriptMethod:withArguments:]):
2189         * html/HTMLMediaElement.cpp:
2190         (WebCore::HTMLMediaElement::updateCaptionContainer):
2191         (WebCore::HTMLMediaElement::didAddUserAgentShadowRoot):
2192         (WebCore::HTMLMediaElement::updateMediaControlsAfterPresentationModeChange):
2193         (WebCore::HTMLMediaElement::getCurrentMediaControlsStatus):
2194         * html/HTMLPlugInImageElement.cpp:
2195         (WebCore::HTMLPlugInImageElement::didAddUserAgentShadowRoot):
2196         * testing/Internals.cpp:
2197         (WebCore::Internals::cloneArrayBuffer):
2198
2199 2017-11-01  Andy Estes  <aestes@apple.com>
2200
2201         [Apple Pay] Update the enum traits for PaymentError::ContactField
2202         https://bugs.webkit.org/show_bug.cgi?id=179145
2203         <rdar://problem/35303108>
2204
2205         Reviewed by Tim Horton.
2206
2207         Account for the values added to PaymentError::ContactField in r220718 and r223580.
2208
2209         * Modules/applepay/ApplePaySessionPaymentRequest.h:
2210
2211 2017-11-01  Daniel Bates  <dabates@apple.com>
2212
2213         Remove unused Element::alwaysCreateUserAgentShadowRoot()
2214         https://bugs.webkit.org/show_bug.cgi?id=179141
2215
2216         Reviewed by Ryosuke Niwa.
2217
2218         In changeset r208135 Element::createShadowRoot() was removed. And Element::createShadowRoot()
2219         was the only caller of Element::alwaysCreateUserAgentShadowRoot(). We should remove
2220         Element::alwaysCreateUserAgentShadowRoot() as it is unused.
2221
2222         * dom/Element.h:
2223         (WebCore::Element::didAddUserAgentShadowRoot):
2224         (WebCore::Element::alwaysCreateUserAgentShadowRoot const): Deleted.
2225         * html/HTMLButtonElement.h:
2226         * html/HTMLFormControlElement.h:
2227         * html/HTMLMediaElement.h:
2228
2229 2017-11-01  Chris Dumez  <cdumez@apple.com>
2230
2231         Drop running Service Worker Jobs on a background thread
2232         https://bugs.webkit.org/show_bug.cgi?id=179142
2233
2234         Reviewed by Youenn Fablet.
2235
2236         Drop running Service Worker Jobs on a background thread. We don't really need to
2237         and this simplifies the logic a lot.
2238
2239         * workers/service/server/SWServer.cpp:
2240         (WebCore::SWServer::getRegistration):
2241         (WebCore::SWServer::addRegistration):
2242         (WebCore::SWServer::removeRegistration):
2243         * workers/service/server/SWServerJobQueue.cpp:
2244         (WebCore::SWServerJobQueue::scriptContextStarted):
2245         (WebCore::SWServerJobQueue::startNextJob):
2246         (WebCore::SWServerJobQueue::runRegisterJob):
2247         (WebCore::SWServerJobQueue::runUnregisterJob):
2248         (WebCore::SWServerJobQueue::runUpdateJob):
2249         (WebCore::SWServerJobQueue::finishCurrentJob):
2250         * workers/service/server/SWServerJobQueue.h:
2251
2252 2017-11-01  Per Arne Vollan  <pvollan@apple.com>
2253
2254         Unreviewed, try to fix Windows build.
2255
2256         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
2257         (WebCore::MediaPlayerPrivateAVFoundationCF::createAVAssetForURL):
2258
2259 2017-11-01  Chris Dumez  <cdumez@apple.com>
2260
2261         Split JobQueue logic out of SWServerRegistration
2262         https://bugs.webkit.org/show_bug.cgi?id=179126
2263
2264         Reviewed by Brady Eidson.
2265
2266         Split JobQueue logic out of SWServerRegistration and into a SWServerJobQueue class to match the Service Workers
2267         specification more closely.
2268
2269         * Sources.txt:
2270         * WebCore.xcodeproj/project.pbxproj:
2271         * workers/service/ServiceWorkerContainer.cpp:
2272         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
2273         * workers/service/ServiceWorkerRegistrationData.cpp:
2274         (WebCore::ServiceWorkerRegistrationData::isolatedCopy const):
2275         * workers/service/ServiceWorkerRegistrationData.h:
2276         (WebCore::ServiceWorkerRegistrationData::encode const):
2277         (WebCore::ServiceWorkerRegistrationData::decode):
2278         * workers/service/server/SWServer.cpp:
2279         (WebCore::SWServer::~SWServer):
2280         (WebCore::SWServer::getRegistration):
2281         (WebCore::SWServer::addRegistration):
2282         (WebCore::SWServer::removeRegistration):
2283         (WebCore::SWServer::Connection::scriptContextStarted):
2284         (WebCore::SWServer::scheduleJob):
2285         (WebCore::SWServer::scriptFetchFinished):
2286         (WebCore::SWServer::scriptContextFailedToStart):
2287         (WebCore::SWServer::scriptContextStarted):
2288         * workers/service/server/SWServer.h:
2289         * workers/service/server/SWServerJobQueue.cpp: Added.
2290         (WebCore::SWServerJobQueue::SWServerJobQueue):
2291         (WebCore::SWServerJobQueue::~SWServerJobQueue):
2292         (WebCore::SWServerJobQueue::enqueueJob):
2293         (WebCore::SWServerJobQueue::scriptFetchFinished):
2294         (WebCore::SWServerJobQueue::scriptContextFailedToStart):
2295         (WebCore::SWServerJobQueue::scriptContextStarted):
2296         (WebCore::SWServerJobQueue::startNextJob):
2297         (WebCore::SWServerJobQueue::runRegisterJob):
2298         (WebCore::SWServerJobQueue::runUnregisterJob):
2299         (WebCore::SWServerJobQueue::runUpdateJob):
2300         (WebCore::SWServerJobQueue::rejectWithExceptionOnMainThread):
2301         (WebCore::SWServerJobQueue::resolveWithRegistrationOnMainThread):
2302         (WebCore::SWServerJobQueue::resolveCurrentRegistrationJobOnMainThead):
2303         (WebCore::SWServerJobQueue::resolveWithUnregistrationResultOnMainThread):
2304         (WebCore::SWServerJobQueue::startScriptFetchFromMainThread):
2305         (WebCore::SWServerJobQueue::rejectCurrentJob):
2306         (WebCore::SWServerJobQueue::resolveCurrentRegistrationJob):
2307         (WebCore::SWServerJobQueue::resolveCurrentUnregistrationJob):
2308         (WebCore::SWServerJobQueue::startScriptFetchForCurrentJob):
2309         (WebCore::SWServerJobQueue::finishCurrentJob):
2310         * workers/service/server/SWServerJobQueue.h: Added.
2311         * workers/service/server/SWServerRegistration.cpp:
2312         (WebCore::SWServerRegistration::SWServerRegistration):
2313         (WebCore::SWServerRegistration::~SWServerRegistration):
2314         (WebCore::SWServerRegistration::data const):
2315         * workers/service/server/SWServerRegistration.h:
2316         (WebCore::SWServerRegistration::key const):
2317         (WebCore::SWServerRegistration::isUninstalling const):
2318         (WebCore::SWServerRegistration::setIsUninstalling):
2319         (WebCore::SWServerRegistration::setLastUpdateTime):
2320         (WebCore::SWServerRegistration::updateViaCache const):
2321         (WebCore::SWServerRegistration::setActiveServiceWorkerIdentifier):
2322
2323 2017-11-01  Daniel Bates  <dabates@apple.com>
2324
2325         XMLHttpRequest should not sniff content encoding
2326         https://bugs.webkit.org/show_bug.cgi?id=175597
2327         <rdar://problem/34912624>
2328
2329         Reviewed by Alex Christensen.
2330
2331         Fixes an issue where the body of an HTTP response with headers "Content-Type: application/octet-stream" and
2332         "Content-Encoding: gzip" associated with an XHR request to a .gz file would not be automatically gzipped
2333         decompressed. Specifically, such a response would be treated analogous to a response with headers
2334         "Content-Type: application/gzip" and "Content-Encoding: identity". This behavior does not conform to the
2335         behavior of the Content-Encoding header as defined in the HTTP 1.1 and later specs. Moreover this behavior
2336         breaks the Epic Zen Garden demo: <https://s3.amazonaws.com/mozilla-games/ZenGarden/EpicZenGarden.html>.
2337
2338         On macOS 10.13.2 opt out of content encoding sniffing when making an XHR request. We likely can
2339         selectively opt out of content encoding sniffing for other network requests. This will be done
2340         in subsequent commits to make it straightforward to identify site breakage (if any).
2341
2342         * loader/ResourceLoader.cpp:
2343         (WebCore::ResourceLoader::start): Pass content encoding policy.
2344         * loader/ResourceLoader.h:
2345         (WebCore::ResourceLoader::shouldSniffContentEncoding const): Added.
2346         * loader/ResourceLoaderOptions.h:
2347         * loader/appcache/ApplicationCacheGroup.cpp:
2348         (WebCore::ApplicationCacheGroup::createResourceHandle): Enable content encoding sniff to match existing behavior.
2349         * platform/network/BlobResourceHandle.cpp:
2350         (WebCore::BlobResourceHandle::BlobResourceHandle): Ditto. We should look to disable content encoding sniffing in
2351         a subsequent change.
2352         * platform/network/PingHandle.h: Ditto.
2353         * platform/network/ResourceHandle.cpp:
2354         (WebCore::ResourceHandle::ResourceHandle): Modified to take a boolean as to whether to enable content encoding sniffing.
2355         (WebCore::ResourceHandle::create): Ditto.
2356         (WebCore::ResourceHandle::shouldContentEncodingSniff const): Added.
2357         * platform/network/ResourceHandle.h:
2358         * platform/network/ResourceHandleInternal.h:
2359         (WebCore::ResourceHandleInternal::ResourceHandleInternal): Modified to take a boolean as to whether to enable content
2360         encoding sniffing.
2361         * platform/network/cf/ResourceHandleCFNet.cpp:
2362         (WebCore::ResourceHandle::createCFURLConnection): Modified to take a boolean as to whether to enable content encoding
2363         sniffing and apply this policy to the CFMutableURLRequestRef object when building on macOS 10.13.2.
2364         (WebCore::ResourceHandle::start):
2365         (WebCore::ResourceHandle::platformLoadResourceSynchronously): Enable content encoding sniff to match existing behavior.
2366         * platform/network/mac/ResourceHandleMac.mm:
2367         (WebCore::ResourceHandle::applySniffingPoliciesAndStoragePartitionIfNeeded): Added helper function to apply sniffing policies
2368         and storage partition, if applicable. 
2369         (WebCore::ResourceHandle::createNSURLConnection): Modified to take a boolean as to whether to enable content encoding
2370         sniffing. Calls adjustNSRequestApplyingPolicies() to apply this policy.
2371         (WebCore::ResourceHandle::start):
2372         (WebCore::ResourceHandle::platformLoadResourceSynchronously): Enable content encoding sniff to match existing behavior.
2373         * platform/network/soup/ResourceHandleSoup.cpp:
2374         (WebCore::ResourceHandle::create): Modified to take a boolean as to whether to enable content encoding sniffing.
2375         (WebCore::ResourceHandle::ResourceHandle): Ditto.
2376         (WebCore::ResourceHandle::releaseForDownload): Pass content encoding policy.
2377         * xml/XMLHttpRequest.cpp:
2378         (WebCore::XMLHttpRequest::createRequest): Do not enable content encoding sniffing for the request.
2379
2380 2017-11-01  Jer Noble  <jer.noble@apple.com>
2381
2382         [Performance] Painting <video> to canvas spends a lot of time in URL getting and parsing
2383         https://bugs.webkit.org/show_bug.cgi?id=179131
2384
2385         Reviewed by Eric Carlson.
2386
2387         Every time a <video> backed by MediaPlayerPrivateAVFoundation is asked to paint, it is first
2388         queried whether it has a single security origin. To do this, the media player asks
2389         AVFoundation what the "resolvedURL" of the asset is. This answer never changes after
2390         metadata is first fetched, so the answer should be cached. To do so, add a m_resolvedURL
2391         ivar to MediaPlayerPrivateAVFoundation, and add a setResolvedURL() and resolvedURLChanged()
2392         method to re-query the value. Also create ivars for the security origin rather than re-
2393         parsing them every time.
2394
2395         Drive-by fix: clean up all the instances where we pass a String rather than a URL (and thus
2396         have to re-parse the URL at each point).
2397
2398         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
2399         (WebCore::MediaPlayerPrivateAVFoundation::load):
2400         (WebCore::MediaPlayerPrivateAVFoundation::hasSingleSecurityOrigin const):
2401         (WebCore::MediaPlayerPrivateAVFoundation::setResolvedURL):
2402         (WebCore::MediaPlayerPrivateAVFoundation::metadataLoaded):
2403         (WebCore::MediaPlayerPrivateAVFoundation::setPreload):
2404         (WebCore::MediaPlayerPrivateAVFoundation::resolvedURL const): Deleted.
2405         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
2406         (WebCore::MediaPlayerPrivateAVFoundation::resolvedURL const):
2407         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
2408         (WebCore::MediaPlayerPrivateAVFoundationCF::resolvedURLChanged):
2409         (WebCore::AVFWrapper::createAssetForURL):
2410         (WebCore::MediaPlayerPrivateAVFoundationCF::resolvedURL const): Deleted.
2411         (WebCore::MediaPlayerPrivateAVFoundationCF::hasSingleSecurityOrigin const): Deleted.
2412         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.h:
2413         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
2414         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2415         (WebCore::canonicalURL):
2416         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
2417         (WebCore::MediaPlayerPrivateAVFoundationObjC::sizeChanged):
2418         (WebCore::canonicalURL):
2419         (WebCore::MediaPlayerPrivateAVFoundationObjC::hasSingleSecurityOrigin const): Deleted.
2420
2421 2017-11-01  Ryosuke Niwa  <rniwa@webkit.org>
2422
2423         innerText->renderBox() can be null in HTMLTextFormControlElement::setSelectionRange
2424         https://bugs.webkit.org/show_bug.cgi?id=179103
2425
2426         Reviewed by Antti Koivisto.
2427
2428         Added a missing null check.
2429
2430         Unfortunately, no new tests since we don't have a working reproduction for trunk code.
2431
2432         * html/HTMLTextFormControlElement.cpp:
2433         (WebCore::HTMLTextFormControlElement::setSelectionRange): Added a null check.
2434
2435 2017-11-01  Brady Eidson  <beidson@apple.com>
2436
2437         Plumbing for handling SW scripts failing to evaluate
2438         https://bugs.webkit.org/show_bug.cgi?id=178926
2439
2440         Reviewed by Chris Dumez.
2441
2442         No new tests (Currently no observable behavior change).
2443
2444         In an upcoming patch we'll actually run the appropriate observable steps for when
2445         a ServiceWorker script fails to evaluate.
2446
2447         This is a standalone refactoring + plumbing patch that will make the observable changes
2448         easier to review.
2449
2450         * bindings/js/WorkerScriptController.cpp:
2451         (WebCore::WorkerScriptController::evaluate):
2452         * bindings/js/WorkerScriptController.h:
2453         (WebCore::WorkerScriptController::workerGlobalScopeWrapper):
2454         (WebCore::WorkerScriptController::vm):
2455         (WebCore::WorkerScriptController::initScriptIfNeeded):
2456
2457         * workers/WorkerMessagingProxy.cpp:
2458         (WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
2459
2460         * workers/WorkerThread.cpp:
2461         (WebCore::WorkerThread::start):
2462         (WebCore::WorkerThread::workerThread):
2463         * workers/WorkerThread.h:
2464
2465         * workers/service/context/SWContextManager.cpp:
2466         (WebCore::SWContextManager::registerServiceWorkerThreadForUpdate):
2467         (WebCore::SWContextManager::registerServiceWorkerThread): Deleted.
2468         * workers/service/context/SWContextManager.h:
2469
2470         * workers/service/context/ServiceWorkerThread.h:
2471         (WebCore::ServiceWorkerThread::serverConnectionIdentifier const):
2472         (WebCore::ServiceWorkerThread::contextData const):
2473
2474         * workers/service/context/ServiceWorkerThreadProxy.cpp:
2475         (WebCore::ServiceWorkerThreadProxy::create):
2476         (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
2477
2478         * workers/service/server/SWServer.cpp:
2479         (WebCore::SWServer::updateWorker):
2480         (WebCore::SWServer::createWorker): Deleted.
2481         * workers/service/server/SWServer.h:
2482
2483         * workers/service/server/SWServerRegistration.cpp:
2484         (WebCore::SWServerRegistration::scriptFetchFinished):
2485         (WebCore::SWServerRegistration::scriptContextFailedToStart):
2486
2487 2017-11-01  Ryosuke Niwa  <rniwa@webkit.org>
2488
2489         Assert that NoEventDispatchAssertion is not in the stack when executing a script
2490         https://bugs.webkit.org/show_bug.cgi?id=179107
2491
2492         Reviewed by Simon Fraser.
2493
2494         Assert that NoEventDispatchAssertion::isEventAllowedInMainThread() is true when we're about to execute a script
2495         by adding the assertion in ScriptController::canExecuteScripts which gets called with AboutToExecuteScript
2496         whenever we're about to run scripts in event handlers, etc...
2497
2498         We don't assert the construction of event handlers in JSLazyEventListener since this happens while copying
2499         the DOM tree inside a SVG use element and creating a event handler's JS function won't execute arbitrary scripts.
2500
2501         No new tests since there should be no behavioral change other 
2502
2503         * bindings/js/JSLazyEventListener.cpp:
2504         (WebCore::JSLazyEventListener::initializeJSFunction const): Use newly added AboutToCreateEventListener.
2505         (WebCore::JSLazyEventListener::create): Ditto.
2506         * bindings/js/ScriptController.cpp:
2507         (WebCore::ScriptController::canExecuteScripts): Added the assertion.
2508         * bindings/js/ScriptController.h:
2509
2510 2017-11-01  Chris Dumez  <cdumez@apple.com>
2511
2512         Regression(r219659): Can no longer log into ifttt.com using Google account
2513         https://bugs.webkit.org/show_bug.cgi?id=179117
2514
2515         Reviewed by Geoffrey Garen.
2516
2517         After r219659, it is no longer possible to log into ifttt.com using a Google
2518         account:
2519         - Signed into a Google account already
2520         - Visit https://ifttt.com/login
2521         - Click "Continue with Google"
2522         - Select the signed in account
2523
2524         It turns out that this change to the HTML specification was not Web-compatible:
2525         See https://bugzilla.mozilla.org/show_bug.cgi?id=1412741 & https://github.com/whatwg/html/issues/3183
2526
2527         This patch reverts r219659 for now until we agree on what behavior should get
2528         specified.
2529
2530         No new tests, rebaselined existing tests.
2531
2532         * bindings/js/JSDOMWindowCustom.cpp:
2533         (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
2534         (WebCore::JSDOMWindow::getOwnPropertySlotByIndex):
2535         (WebCore::JSDOMWindow::getOwnPropertyNames):
2536         * bindings/js/JSLocationCustom.cpp:
2537         (WebCore::getOwnPropertySlotCommon):
2538         (WebCore::JSLocation::getOwnPropertyNames):
2539
2540 2017-10-31  Dean Jackson  <dino@apple.com>
2541
2542         transferFromImageBitmap should update canvas dimensions
2543         https://bugs.webkit.org/show_bug.cgi?id=179096
2544         <rdar://problem/35285218>
2545
2546         Reviewed by Sam Weinig.
2547
2548         When transferFromImageBitmap is called, the dimensions of the HTMLCanvasElement
2549         should be updated to reflect the size of the passed ImageBitmap.
2550
2551         Update an existing WPT result.
2552
2553         * html/HTMLCanvasElement.cpp:
2554         (WebCore::HTMLCanvasElement::setImageBuffer const): Update the
2555         size of the element based on the incoming buffer.
2556         * html/HTMLCanvasElement.h: Mark m_size as mutable so we can
2557         call it from the const function setImageBuffer.
2558
2559 2017-11-01  Yusuke Suzuki  <utatane.tea@gmail.com>
2560
2561         [JSC] Introduce @toObject
2562         https://bugs.webkit.org/show_bug.cgi?id=178726
2563
2564         Reviewed by Saam Barati.
2565
2566         Use @isObject instead. It is more efficient.
2567
2568         * Modules/mediastream/NavigatorUserMedia.js:
2569         (getUserMedia):
2570
2571 2017-11-01  Commit Queue  <commit-queue@webkit.org>
2572
2573         Unreviewed, rolling out r224273 and r224278.
2574         https://bugs.webkit.org/show_bug.cgi?id=179120
2575
2576         Some crashes under guard malloc (Requested by anttik on
2577         #webkit).
2578
2579         Reverted changesets:
2580
2581         "Remove empty continuations in
2582         RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers"
2583         https://bugs.webkit.org/show_bug.cgi?id=179014
2584         https://trac.webkit.org/changeset/224273
2585
2586         "Fix ContinuationChainNode::insertAfter assertion."
2587         https://bugs.webkit.org/show_bug.cgi?id=179115
2588         https://trac.webkit.org/changeset/224278
2589
2590 2017-11-01  Emilio Cobos Ãlvarez  <emilio@crisal.io>
2591
2592         Fix ContinuationChainNode::insertAfter assertion.
2593         https://bugs.webkit.org/show_bug.cgi?id=179115
2594
2595         Reviewed by Antti Koivisto.
2596
2597         The assertion was writing instead of reading next->previous.
2598
2599         Hopefully it's harmless because it was clobbered on the same line, but
2600         it's worth asserting what it was intending to assert.
2601
2602         No new tests (no behaviour change).
2603
2604         * rendering/RenderBoxModelObject.cpp:
2605         (WebCore::RenderBoxModelObject::ContinuationChainNode::insertAfter):
2606
2607 2017-11-01  Fujii Hironori  <Hironori.Fujii@sony.com>
2608
2609         Use LazyNeverDestroyed instead of DEFINE_GLOBAL
2610         https://bugs.webkit.org/show_bug.cgi?id=174979
2611
2612         Reviewed by Yusuke Suzuki.
2613
2614         No new tests since there should be no behavioral change.
2615
2616         * DerivedSources.cpp: Remove the warning of StaticConstructors.h.
2617         * WebCore.order: Removed
2618         * config.h: Removed definitions of SKIP_STATIC_CONSTRUCTORS_ON_MSVC and SKIP_STATIC_CONSTRUCTORS_ON_GCC.
2619         * dom/QualifiedName.cpp:
2620         (WebCore::createQualifiedName): Deleted.
2621         * dom/QualifiedName.h: Removed createQualifiedName.
2622         * dom/make_names.pl:
2623         (printCppHead): Do not include StaticConstructors.h.
2624
2625 2017-11-01  Michael Catanzaro  <mcatanzaro@igalia.com>
2626
2627         [GTK] Always include TextureMapper.cmake
2628         https://bugs.webkit.org/show_bug.cgi?id=179060
2629
2630         Reviewed by Carlos Garcia Campos.
2631
2632         * PlatformGTK.cmake:
2633
2634 2017-11-01  Antti Koivisto  <antti@apple.com>
2635
2636         Remove empty continuations in RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers
2637         https://bugs.webkit.org/show_bug.cgi?id=179014
2638
2639         Reviewed by Geoff Garen.
2640
2641         Treat continuation similarly to other anonymous wrappers. This makes things more understandable
2642         and allows removal of some questionable code in RenderBlock::takeChild.
2643
2644         The patch also makes continuation chain a double linked so we can efficiently remove single
2645         continuations from the chain. It also gets rid of algorithms that recurse in continuation chain.
2646
2647         * accessibility/AccessibilityRenderObject.cpp:
2648         (WebCore::firstChildInContinuation):
2649         * rendering/RenderBlock.cpp:
2650         (WebCore::RenderBlock::styleDidChange):
2651
2652             Don't add and remove continuations from the chain when updating style. Prevent recursion by walking
2653             the chain only in the (non-continuation) head renderer.
2654
2655         (WebCore::RenderBlock::dropAnonymousBoxChild):
2656
2657             Make a member function.
2658
2659         (WebCore::RenderBlock::takeChild):
2660
2661             Remove code that destroyed empty continuations and caused the parent to destroy itself.
2662             Empty continuations are now removed by RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers.
2663
2664         * rendering/RenderBlock.h:
2665         * rendering/RenderBoxModelObject.cpp:
2666         (WebCore::RenderBoxModelObject::ContinuationChainNode::ContinuationChainNode):
2667         (WebCore::RenderBoxModelObject::ContinuationChainNode::~ContinuationChainNode):
2668         (WebCore::RenderBoxModelObject::ContinuationChainNode::insertAfter):
2669
2670             Track continuations with double linked lists.
2671
2672         (WebCore::continuationChainNodeMap):
2673         (WebCore::RenderBoxModelObject::willBeDestroyed):
2674
2675             Don't recurse to destroy continuation chain. 
2676             Destroy all continuations iteratively if this is the head of the chain.
2677             When destroying a continuation renderer simply remove it from the chain.
2678
2679         (WebCore::RenderBoxModelObject::continuation const):
2680         (WebCore::RenderBoxModelObject::insertIntoContinuationChainAfter):
2681         (WebCore::RenderBoxModelObject::removeFromContinuationChain):
2682         (WebCore::RenderBoxModelObject::ensureContinuationChainNode):
2683         (WebCore::continuationMap): Deleted.
2684         (WebCore::RenderBoxModelObject::setContinuation): Deleted.
2685         * rendering/RenderBoxModelObject.h:
2686         * rendering/RenderElement.cpp:
2687         (WebCore::RenderElement::RenderElement):
2688         (WebCore::RenderElement::removeAnonymousWrappersForInlinesIfNecessary):
2689
2690             Make this a function of the parent renderer itself instead of getting 'parent()' as first operation and
2691             then using it.
2692             Don't remove continuations (isAnonymousBlockContinuation() test gives wrong result for the last continuation of the chain).
2693
2694         (WebCore::RenderElement::styleDidChange):
2695
2696             removeAnonymousWrappersForInlinesIfNecessary is no function of the parent.
2697
2698         (WebCore::RenderElement::updateOutlineAutoAncestor):
2699         * rendering/RenderElement.h:
2700         (WebCore::RenderElement::hasContinuationChainNode const):
2701         (WebCore::RenderElement::setHasContinuationChainNode):
2702         (WebCore::RenderElement::hasContinuation const): Deleted.
2703         (WebCore::RenderElement::setHasContinuation): Deleted.
2704         * rendering/RenderInline.cpp:
2705         (WebCore::RenderInline::styleDidChange):
2706
2707             Don't add and remove continuations from the chain when updating style. Prevent recursion by walking
2708             the chain only in the (non-continuation) head renderer.
2709
2710         (WebCore::RenderInline::addChildIgnoringContinuation):
2711
2712             Remove the old continuation from the chain. splitFlow() will add it back into the right place.
2713
2714         (WebCore::RenderInline::splitInlines):
2715         (WebCore::RenderInline::addChildToContinuation):
2716         (WebCore::RenderInline::childBecameNonInline):
2717
2718             Remove the old continuation from the chain. splitFlow() will add it back into the right place.
2719
2720         * rendering/RenderInline.h:
2721         * rendering/RenderObject.cpp:
2722         (WebCore::RenderObject::propagateRepaintToParentWithOutlineAutoIfNeeded const):
2723         (WebCore::RenderObject::outputRenderObject const):
2724         (WebCore::findDestroyRootIncludingAnonymous):
2725
2726             Allow anonymous continuations as destroy roots.
2727
2728         (WebCore::RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers):
2729
2730             Removing a continuation may leave behind unnecessary anonymous sibling wrappers.
2731             Call removeAnonymousWrappersForInlinesIfNecessary() on parent after removal to get rid of them.
2732
2733 2017-10-31  Said Abou-Hallawa  <sabouhallawa@apple.com>
2734
2735         updateMaskedAncestorShouldIsolateBlending() should check the Nullability of the computedStyle() of the element's ancestors
2736         https://bugs.webkit.org/show_bug.cgi?id=179085
2737         <rdar://problem/30888101>
2738
2739         Reviewed by Ryosuke Niwa.
2740
2741         This is a defensive change. The Element::computedStyle() can be null only
2742         if the element is not a connected to the DOM tree. This may happen if
2743         while the DOM tree is being changed, a different event is handled such
2744         that it requires styleReclac()/layout() to happen. In this case, the render
2745         tree will be in an incorrect state.
2746
2747         * rendering/svg/SVGRenderSupport.cpp:
2748         (WebCore::SVGRenderSupport::updateMaskedAncestorShouldIsolateBlending):
2749
2750 2017-10-31  Alex Christensen  <achristensen@webkit.org>
2751
2752         Use asynchronous ResourceHandleClient calls for WebKit1
2753         https://bugs.webkit.org/show_bug.cgi?id=160677
2754
2755         Reviewed by Brady Eidson.
2756
2757         Covered by existing tests.
2758
2759         * PlatformAppleWin.cmake:
2760         * PlatformMac.cmake:
2761         * WebCore.xcodeproj/project.pbxproj:
2762         * loader/ResourceLoader.cpp:
2763         (WebCore::ResourceLoader::willSendRequestAsync):
2764         (WebCore::ResourceLoader::didReceiveResponseAsync):
2765         (WebCore::ResourceLoader::canAuthenticateAgainstProtectionSpaceAsync):
2766         * loader/ResourceLoader.h:
2767         * loader/appcache/ApplicationCacheGroup.cpp:
2768         (WebCore::ApplicationCacheGroup::didReceiveResponseAsync):
2769         (WebCore::ApplicationCacheGroup::willSendRequestAsync):
2770         (WebCore::ApplicationCacheGroup::canAuthenticateAgainstProtectionSpaceAsync):
2771         (WebCore::ApplicationCacheGroup::didReceiveResponse): Deleted.
2772         * loader/appcache/ApplicationCacheGroup.h:
2773         * platform/network/BlobResourceHandle.cpp:
2774         (WebCore::BlobResourceHandle::continueDidReceiveResponse):
2775         (WebCore::BlobResourceHandle::getSizeForNext):
2776         (WebCore::BlobResourceHandle::notifyResponseOnSuccess):
2777         (WebCore::BlobResourceHandle::notifyResponseOnError):
2778         * platform/network/PingHandle.h:
2779         * platform/network/ResourceHandle.cpp:
2780         (WebCore::ResourceHandle::didReceiveResponse):
2781         (WebCore::ResourceHandle::usesAsyncCallbacks): Deleted.
2782         * platform/network/ResourceHandle.h:
2783         * platform/network/ResourceHandleClient.cpp:
2784         (WebCore::ResourceHandleClient::~ResourceHandleClient):
2785         (WebCore::ResourceHandleClient::willSendRequest): Deleted.
2786         (WebCore::ResourceHandleClient::willSendRequestAsync): Deleted.
2787         (WebCore::ResourceHandleClient::didReceiveResponseAsync): Deleted.
2788         (WebCore::ResourceHandleClient::canAuthenticateAgainstProtectionSpaceAsync): Deleted.
2789         * platform/network/ResourceHandleClient.h:
2790         (WebCore::ResourceHandleClient::didReceiveAuthenticationChallenge):
2791         (WebCore::ResourceHandleClient::didReceiveResponse): Deleted.
2792         (WebCore::ResourceHandleClient::usesAsyncCallbacks): Deleted.
2793         (WebCore::ResourceHandleClient::canAuthenticateAgainstProtectionSpace): Deleted.
2794         * platform/network/ResourceHandleInternal.h:
2795         (WebCore::ResourceHandleInternal::ResourceHandleInternal):
2796         * platform/network/SynchronousLoaderClient.cpp:
2797         (WebCore::SynchronousLoaderClient::willSendRequestAsync):
2798         (WebCore::SynchronousLoaderClient::canAuthenticateAgainstProtectionSpaceAsync):
2799         (WebCore::SynchronousLoaderClient::didReceiveResponseAsync):
2800         (WebCore::SynchronousLoaderClient::didFinishLoading):
2801         (WebCore::SynchronousLoaderClient::didFail):
2802         (WebCore::SynchronousLoaderClient::willSendRequest): Deleted.
2803         (WebCore::SynchronousLoaderClient::canAuthenticateAgainstProtectionSpace): Deleted.
2804         (WebCore::SynchronousLoaderClient::didReceiveResponse): Deleted.
2805         * platform/network/SynchronousLoaderClient.h:
2806         * platform/network/cf/ResourceHandleCFNet.cpp:
2807         (WebCore::ResourceHandle::createCFURLConnection):
2808         (WebCore::ResourceHandle::start):
2809         (WebCore::ResourceHandle::willSendRequest):
2810         (WebCore::ResourceHandle::shouldUseCredentialStorage):
2811         (WebCore::ResourceHandle::canAuthenticateAgainstProtectionSpace):
2812         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
2813         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
2814         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::ResourceHandleCFURLConnectionDelegateWithOperationQueue):
2815         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::releaseHandle):
2816         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willSendRequest):
2817         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse):
2818         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveData):
2819         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFinishLoading):
2820         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFail):
2821         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willCacheResponse):
2822         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveChallenge):
2823         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didSendBodyData):
2824         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::shouldUseCredentialStorage):
2825         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace):
2826         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueCanAuthenticateAgainstProtectionSpace):
2827         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h:
2828         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp: Removed.
2829         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.h: Removed.
2830         * platform/network/mac/ResourceHandleMac.mm:
2831         (WebCore::ResourceHandle::start):
2832         (WebCore::ResourceHandle::schedule):
2833         (WebCore::ResourceHandle::makeDelegate):
2834         (WebCore::ResourceHandle::delegate):
2835         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
2836         (WebCore::ResourceHandle::willSendRequest):
2837         (WebCore::ResourceHandle::continueWillSendRequest):
2838         (WebCore::ResourceHandle::continueDidReceiveResponse):
2839         (WebCore::ResourceHandle::canAuthenticateAgainstProtectionSpace):
2840         (WebCore::ResourceHandle::continueCanAuthenticateAgainstProtectionSpace):
2841         (WebCore::ResourceHandle::continueWillCacheResponse):
2842         (WebCore::ResourceHandle::shouldUseCredentialStorage): Deleted.
2843         * platform/network/mac/WebCoreResourceHandleAsDelegate.h: Removed.
2844         * platform/network/mac/WebCoreResourceHandleAsDelegate.mm: Removed.
2845         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h:
2846         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
2847         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]):
2848         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveAuthenticationChallenge:]):
2849         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]):
2850         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
2851         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveData:lengthReceived:]):
2852         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didSendBodyData:totalBytesWritten:totalBytesExpectedToWrite:]):
2853         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didFailWithError:]):
2854         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willCacheResponse:]):
2855
2856 2017-10-31  Simon Fraser  <simon.fraser@apple.com>
2857
2858         Rubber-banding overflow-scrolling-touch shows black
2859         https://bugs.webkit.org/show_bug.cgi?id=179087
2860         rdar://problem/35260253
2861
2862         Reviewed by Sam Weinig.
2863
2864         The "backgroundIsKnownToBeObscured" optimization was kicking in for an overflow:scroll
2865         whose area was completely covered by its contents, which happens with overlay scrollbars.
2866
2867         However, this ignored the fact that you can rubber-band to reveal the background, and,
2868         on iOS, composited scrolling requires that the scroller background is painted since it goes
2869         into its own layer.
2870
2871         Fix by turning off the optimization for layers that scroll overflow, including those
2872         using composited scrolling.
2873
2874         Test: fast/scrolling/rubber-band-shows-background.html
2875
2876         * rendering/RenderBox.cpp:
2877         (WebCore::RenderBox::foregroundIsKnownToBeOpaqueInRect const):
2878         (WebCore::RenderBox::computeBackgroundIsKnownToBeObscured):
2879         * rendering/RenderLayer.cpp:
2880         (WebCore::RenderLayer::scrollTo):
2881         (WebCore::RenderLayer::calculateClipRects const):
2882         * rendering/RenderLayer.h:
2883
2884 2017-10-31  Tim Horton  <timothy_horton@apple.com>
2885
2886         Clean up some drag and drop feature flags
2887         https://bugs.webkit.org/show_bug.cgi?id=179082
2888
2889         Reviewed by Simon Fraser.
2890
2891         * Configurations/FeatureDefines.xcconfig:
2892
2893 2017-10-31  Simon Fraser  <simon.fraser@apple.com>
2894
2895         Make it possible to test rubber-banding in overflow scroll
2896         https://bugs.webkit.org/show_bug.cgi?id=179078
2897
2898         Reviewed by Sam Weinig.
2899
2900         Test: fast/scrolling/unconstrained-scrollto.html
2901         
2902         Add internals.unconstrainedScrollTo(element, x, y) and plumb through ScrollClamping
2903         (which replaces RenderLayer::ScrollOffsetClamping) to support it.
2904
2905         Flip the default from unclamped to clamped for various RenderLayer scrolling-related
2906         functions, since most callers want clamped.
2907
2908         * accessibility/AccessibilityRenderObject.cpp:
2909         (WebCore::AccessibilityRenderObject::scrollTo const):
2910         * dom/Element.cpp:
2911         (WebCore::Element::scrollTo):
2912         * dom/Element.h:
2913         * html/HTMLBodyElement.cpp:
2914         (WebCore::HTMLBodyElement::scrollTo):
2915         * html/HTMLBodyElement.h:
2916         * html/TextFieldInputType.cpp:
2917         (WebCore::TextFieldInputType::elementDidBlur):
2918         * page/DOMWindow.cpp:
2919         (WebCore::DOMWindow::scrollTo const):
2920         * page/DOMWindow.h:
2921         * page/Frame.cpp:
2922         (WebCore::Frame::scrollOverflowLayer):
2923         (WebCore::Frame::checkOverflowScroll):
2924         * platform/ScrollAnimator.cpp:
2925         (WebCore::ScrollAnimator::scrollToOffsetWithoutAnimation):
2926         * platform/ScrollAnimator.h:
2927         * platform/ScrollTypes.h:
2928         * platform/ScrollableArea.cpp:
2929         (WebCore::ScrollableArea::scrollToOffsetWithoutAnimation):
2930         * platform/ScrollableArea.h:
2931         * platform/cocoa/ScrollController.h:
2932         * platform/mac/ScrollAnimatorMac.h:
2933         * platform/mac/ScrollAnimatorMac.mm:
2934         (WebCore::ScrollAnimatorMac::scrollToOffsetWithoutAnimation):
2935         (WebCore::ScrollAnimatorMac::immediateScrollToPosition):
2936         * platform/mock/ScrollAnimatorMock.h:
2937         * rendering/RenderBox.cpp:
2938         (WebCore::RenderBox::setScrollLeft):
2939         (WebCore::RenderBox::setScrollTop):
2940         * rendering/RenderBox.h:
2941         * rendering/RenderLayer.cpp:
2942         (WebCore::RenderLayer::panScrollFromPoint):
2943         (WebCore::RenderLayer::scrollByRecursively):
2944         (WebCore::RenderLayer::applyPostLayoutScrollPositionIfNeeded):
2945         (WebCore::RenderLayer::scrollToXPosition):
2946         (WebCore::RenderLayer::scrollToYPosition):
2947         (WebCore::RenderLayer::scrollToOffset):
2948         * rendering/RenderLayer.h:
2949         * rendering/RenderListBox.cpp:
2950         (WebCore::RenderListBox::setScrollLeft):
2951         (WebCore::RenderListBox::setScrollTop):
2952         * rendering/RenderListBox.h:
2953         * rendering/RenderTextControlSingleLine.cpp:
2954         (WebCore::RenderTextControlSingleLine::setScrollLeft):
2955         (WebCore::RenderTextControlSingleLine::setScrollTop):
2956         * rendering/RenderTextControlSingleLine.h:
2957         * testing/Internals.cpp:
2958         (WebCore::Internals::unconstrainedScrollTo):
2959         * testing/Internals.h:
2960         * testing/Internals.idl:
2961
2962 2017-10-31  Dean Jackson  <dino@apple.com>
2963
2964         Accept Settings object in ImageBitmapRenderingContext constructor and getContext
2965         https://bugs.webkit.org/show_bug.cgi?id=179075
2966         <rdar://problem/35279965>
2967
2968         Reviewed by Sam Weinig.
2969
2970         Allow getContext("bitmaprenderer") to take a dictionary as another argument, and
2971         pass that on to the ImageBitmapRenderingContext constructor.
2972
2973         Unfortunately this meant having to move ImageBitmapRenderingContext::Settings out into
2974         a stand-alone struct, since it needs to be defined in HTMLCanvasElement, which itself
2975         needs to be defined for ImageBitmapRenderingContext.
2976
2977         * DerivedSources.make: Add new IDL.
2978         * WebCore.xcodeproj/project.pbxproj: New files.
2979
2980         * html/HTMLCanvasElement.cpp:
2981         (WebCore::HTMLCanvasElement::createContextBitmapRenderer):
2982         (WebCore::HTMLCanvasElement::getContextBitmapRenderer):
2983
2984             Accept the ImageBitmapRenderingContextSettings object, and pass it on.
2985
2986         * html/HTMLCanvasElement.h:
2987         * html/canvas/ImageBitmapRenderingContext.cpp:
2988         (WebCore::ImageBitmapRenderingContext::ImageBitmapRenderingContext):
2989         * html/canvas/ImageBitmapRenderingContext.h:
2990         * html/canvas/ImageBitmapRenderingContext.idl:
2991         * html/canvas/ImageBitmapRenderingContextSettings.h: Copied from Source/WebCore/html/canvas/ImageBitmapRenderingContext.idl.
2992         * html/canvas/ImageBitmapRenderingContextSettings.idl: Added.
2993
2994 2017-10-31  Tim Horton  <timothy_horton@apple.com>
2995
2996         Fix up some content filtering feature flags
2997         https://bugs.webkit.org/show_bug.cgi?id=179079
2998
2999         Reviewed by Simon Fraser.
3000
3001         * Configurations/FeatureDefines.xcconfig:
3002
3003 2017-10-31  Chris Dumez  <cdumez@apple.com>
3004
3005         navigator.serviceWorker should always return the same object
3006         https://bugs.webkit.org/show_bug.cgi?id=179067
3007
3008         Reviewed by Youenn Fablet.
3009
3010         navigator.serviceWorker should always return the same object:
3011         - https://www.w3.org/TR/service-workers-1/#navigator-service-worker
3012
3013         Add visitor to make sure we don't gc() the ServiceWorkerContainer wrapper too early.
3014
3015         Test: http/tests/workers/service/navigator-serviceWorker-same-object.html
3016
3017         * Sources.txt:
3018         * WebCore.xcodeproj/project.pbxproj:
3019         * bindings/js/JSNavigatorCustom.cpp: Copied from Source/WebCore/workers/service/ServiceWorkerContainer.idl.
3020         (WebCore::JSNavigator::visitAdditionalChildren):
3021         * page/Navigator.idl:
3022         * workers/service/ServiceWorkerContainer.idl:
3023
3024 2017-10-31  Antoine Quint  <graouts@apple.com>
3025
3026         [Web Animations] Support AnimationEffect parameter in Animation constructor and read-write timeline property
3027         https://bugs.webkit.org/show_bug.cgi?id=179066
3028
3029         Reviewed by Dean Jackson.
3030
3031         We update the Animation constructor signature and behavior to allow for an AnimationEffect as its first,
3032         null by default, parameter and implement the spec behavior where an omitted AnimationTimeline parameter
3033         should default to the document timeline. We also make the timeline property read-write.
3034
3035         Existing tests are rebaselined and amended for this new behavior.
3036
3037         * animation/WebAnimation.cpp:
3038         (WebCore::WebAnimation::create):
3039         (WebCore::WebAnimation::WebAnimation):
3040         (WebCore::WebAnimation::setEffect):
3041         (WebCore::WebAnimation::setTimeline):
3042         * animation/WebAnimation.h:
3043         * animation/WebAnimation.idl:
3044
3045 2017-10-31  Ali Juma  <ajuma@chromium.org>
3046
3047         Layout viewport rect is too wide after window resize
3048         https://bugs.webkit.org/show_bug.cgi?id=175235
3049
3050         Reviewed by Dave Hyatt.
3051
3052         After a window resize, ScrollView::updateScrollbars adds/removes scrollbars and triggers
3053         layout. Each addition or removal triggers another pass, but at most 2 additional passes
3054         are allowed. If a scrollbar is added or removed in the final allowed pass, layout is
3055         left in an inconsistent state wrt the presence of scrollbars.
3056
3057         To avoid unnecessary passes, don't remove both scrollbars when only one needs to be
3058         removed. This saves the extra pass needed to add the scrollbar back.
3059
3060         Test: fast/dom/Window/window-resize-update-scrollbars.html
3061
3062         * platform/ScrollView.cpp:
3063         (WebCore::ScrollView::updateScrollbars):
3064
3065 2017-10-31  Wenson Hsieh  <wenson_hsieh@apple.com>
3066
3067         [Attachment Support] Implement WKWebView SPI for inserting attachment elements
3068         https://bugs.webkit.org/show_bug.cgi?id=179013
3069         <rdar://problem/35249668>
3070
3071         Reviewed by Tim Horton.
3072
3073         Adds Editor helper methods to insert an attachment element at the current selection.
3074
3075         Test: WKAttachmentTests.AttachmentElementInsertion
3076
3077         * editing/Editor.cpp:
3078         (WebCore::Editor::insertAttachment):
3079         (WebCore::Editor::insertAttachmentFromFile):
3080         * editing/Editor.h:
3081
3082         Add two new helpers for inserting attachment elements, either from a filename or a data blob. This is a wrapper
3083         around Editor::replaceSelectionWithFragment.
3084
3085         * html/HTMLAttachmentElement.cpp:
3086         (WebCore::HTMLAttachmentElement::HTMLAttachmentElement):
3087         (WebCore::HTMLAttachmentElement::create):
3088         * html/HTMLAttachmentElement.h:
3089
3090         Add a unique identifier string to HTMLAttachmentElement. This unique identifier allows the UI process to
3091         reference and indirectly manipulate attachment elements.
3092
3093 2017-10-31  Alex Christensen  <achristensen@webkit.org>
3094
3095         Fix custom header field setting with reloads and asynchronous navigation action policy decisions
3096         https://bugs.webkit.org/show_bug.cgi?id=179064
3097
3098         Reviewed by Tim Horton.
3099
3100         r223909 had two problems:
3101         1. It called addHTTPHeaderField instead of setHTTPHeaderField, so when a page is reloaded the header field
3102         is added to the resource request to be reloaded, which already had the headers added.
3103         2. It only worked in the synchronous decidePolicyForNavigationAction code path, not for asynchronous completion handlers.
3104
3105         These are both fixed, and both cases are covered with new API tests.
3106
3107         * loader/cache/CachedResourceLoader.cpp:
3108         (WebCore::CachedResourceLoader::requestResource):
3109
3110 2017-10-31  Devin Rousso  <webkit@devinrousso.com>
3111
3112         Web Inspector: make ScriptCallStack::maxCallStackSizeToCapture the default value when capturing backtraces
3113         https://bugs.webkit.org/show_bug.cgi?id=179048
3114
3115         Reviewed by Mark Lam.
3116
3117         No change in functionality.
3118
3119         * bindings/js/JSDOMExceptionHandling.cpp:
3120         (WebCore::reportException):
3121         * dom/RejectedPromiseTracker.cpp:
3122         (WebCore::createScriptCallStackFromReason):
3123         * html/canvas/WebGLRenderingContextBase.cpp:
3124         (WebCore::WebGLRenderingContextBase::compileShader):
3125         (WebCore::WebGLRenderingContextBase::printToConsole):
3126         * inspector/InspectorNetworkAgent.cpp:
3127         (WebCore::InspectorNetworkAgent::buildInitiatorObject):
3128         * inspector/PageDebuggerAgent.cpp:
3129         (WebCore::PageDebuggerAgent::breakpointActionLog):
3130         * inspector/WorkerDebuggerAgent.cpp:
3131         (WebCore::WorkerDebuggerAgent::breakpointActionLog):
3132         * page/DOMWindow.cpp:
3133         (WebCore::DOMWindow::postMessage):
3134
3135 2017-10-31  Michael Catanzaro  <mcatanzaro@igalia.com>
3136
3137         [GTK] Build more files under WebCore as unified sources
3138         https://bugs.webkit.org/show_bug.cgi?id=178968
3139
3140         Reviewed by Keith Miller.
3141
3142         * PlatformGTK.cmake:
3143         * PlatformWPE.cmake:
3144         * SourcesGTK.txt: Added.
3145         * SourcesWPE.txt:
3146
3147 2017-10-30  Ryosuke Niwa  <rniwa@webkit.org>
3148
3149         Assert that no script is executed during LayoutPhase::InRenderTreeLayout
3150         https://bugs.webkit.org/show_bug.cgi?id=179046
3151
3152         Reviewed by Antti Koivisto.
3153
3154         Added NoEventDispatchAssertion to LayoutPhase::InRenderTreeLayout.
3155
3156         * page/LayoutContext.cpp:
3157         (WebCore::LayoutContext::layout):
3158
3159 2017-10-31  Devin Rousso  <webkit@devinrousso.com>
3160
3161         Web Inspector: replace Canvas stack iteration with createScriptCallStack
3162         https://bugs.webkit.org/show_bug.cgi?id=178980
3163
3164         Reviewed by Joseph Pecoraro.
3165
3166         No new tests, updated existing tests.
3167
3168         * inspector/InspectorCanvas.cpp:
3169         (WebCore::InspectorCanvas::buildObjectForCanvas):
3170         (WebCore::InspectorCanvas::buildAction):
3171         (WebCore::iterateCallFrames): Deleted.
3172
3173 2017-10-31  Carlos Garcia Campos  <cgarcia@igalia.com>
3174
3175         [FreeType] Simple and complex paths are not applied consistently
3176         https://bugs.webkit.org/show_bug.cgi?id=177601
3177
3178         Reviewed by Michael Catanzaro.
3179
3180         Due to bug #100050, when rendering text, the complex path is forced in case kerning or shaping is enabled and
3181         only part of the run is going to be rendered. This happens in the GTK+ port when selecting text (except when
3182         selecting the whole run, of course). The text is initially rendered using the simple path as returned by
3183         FontCascade::codePath() and then the selection is rendered using the complex path, overriding what
3184         FontCascade::codePath() returned in that case. This doesn't happen in mac, because the selection is rendered
3185         differently, so FontCascade::drawText always renders the full run (simple path) when selecting text. Selecting
3186         text is the most noticeable inconsistency, but it's not the only one. Similar exceptions are applied when
3187         calculating the text width, or getting the offset of a given position. The rendered text is the simple one, but
3188         the calculations are performed using the complex path, so depending on the kerning and ligatures we might end up
3189         with wrong results. If the text has been rendered using the simple path, the selections and all other
3190         calculations should be performed with the simple path too. This patch moves the condition to force complex text
3191         to FontCascade::codePath(), and only for non Freetype ports. This ensures that all callers to
3192         FontCascade::codePath() will get a consistent result.
3193
3194         * platform/graphics/FontCascade.cpp:
3195         (WebCore::FontCascade::drawText const): Use the mode returned by codePath().
3196         (WebCore::FontCascade::drawEmphasisMarks const): Ditto.
3197         (WebCore::FontCascade::adjustSelectionRectForText const): Use the mode returned by codePath().
3198         (WebCore::FontCascade::offsetForPosition const): Ditto.
3199         (WebCore::FontCascade::codePath const): Force complex text for partial runs for ports not enabling advance text
3200         rendering mode by default.
3201         * platform/graphics/FontCascade.h: Add to and from optional parameters to codePath().
3202
3203 2017-10-30  Chris Dumez  <cdumez@apple.com>
3204
3205         Fire updatefound event after resolving the registration promise
3206         https://bugs.webkit.org/show_bug.cgi?id=178985
3207
3208         Reviewed by Youenn Fablet.
3209
3210         Fake series of events that are supposed to happen after registering a service worker
3211         that notify the page of the service worker's installation and activation.
3212
3213         Also make sure that registration.installing / waiting / active return proper values.
3214         Make sure that serviceWorker.scriptURL returns a proper value.
3215
3216         This unblocks a lot of web-platform-tests since they were blocked shortly after
3217         registration due to missing events or registration.installing being null.
3218
3219         * dom/ScriptExecutionContext.cpp:
3220         (WebCore::ScriptExecutionContext::activeServiceWorker const):
3221         (WebCore::ScriptExecutionContext::setActiveServiceWorker):
3222         * dom/ScriptExecutionContext.h:
3223         * loader/WorkerThreadableLoader.cpp:
3224         (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
3225         * loader/cache/CachedResourceLoader.cpp:
3226         (WebCore::CachedResourceLoader::prepareFetch):
3227         * workers/WorkerScriptLoader.cpp:
3228         (WebCore::WorkerScriptLoader::loadSynchronously):
3229         (WebCore::WorkerScriptLoader::loadAsynchronously):
3230         * workers/service/ServiceWorker.cpp:
3231         (WebCore::ServiceWorker::ServiceWorker):
3232         (WebCore::ServiceWorker::setState):
3233         * workers/service/ServiceWorker.h:
3234         * workers/service/ServiceWorkerContainer.cpp:
3235         (WebCore::ServiceWorkerContainer::controller const):
3236         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
3237         (WebCore::ServiceWorkerContainer::jobResolvedWithUnregistrationResult):
3238         * workers/service/ServiceWorkerContainer.h:
3239         * workers/service/ServiceWorkerRegistration.cpp:
3240         (WebCore::ServiceWorkerRegistration::ServiceWorkerRegistration):
3241         (WebCore::ServiceWorkerRegistration::~ServiceWorkerRegistration):
3242         (WebCore::ServiceWorkerRegistration::installing):
3243         (WebCore::ServiceWorkerRegistration::waiting):
3244         (WebCore::ServiceWorkerRegistration::active):
3245         * workers/service/ServiceWorkerRegistration.h:
3246         * workers/service/ServiceWorkerRegistrationData.cpp:
3247         (WebCore::ServiceWorkerRegistrationData::isolatedCopy const):
3248         * workers/service/ServiceWorkerRegistrationData.h:
3249         (WebCore::ServiceWorkerRegistrationData::encode const):
3250         (WebCore::ServiceWorkerRegistrationData::decode):
3251         * workers/service/server/SWClientConnection.cpp:
3252         (WebCore::SWClientConnection::postMessageToServiceWorkerClient):
3253         * workers/service/server/SWServerRegistration.cpp:
3254         (WebCore::SWServerRegistration::scriptContextStarted):
3255         (WebCore::SWServerRegistration::runRegisterJob):
3256         (WebCore::SWServerRegistration::data const):
3257         * workers/service/server/SWServerRegistration.h:
3258
3259 2017-10-30  Fujii Hironori  <Hironori.Fujii@sony.com>
3260
3261         Use LazyNeverDestroyed instead of DEFINE_GLOBAL for XMLNames, HTMLNames, MathMLNames and SVGNames
3262         https://bugs.webkit.org/show_bug.cgi?id=175118
3263
3264         Reviewed by Alex Christensen.
3265
3266         Stop using DEFINE_GLOBAL hack in favor of LazyNeverDestroyed.
3267
3268         No new tests since there should be no behavioral change.
3269
3270         * dom/make_names.pl:
3271         (printConstructors):
3272         (printNamesHeaderFile):
3273         (printNamesCppFile):
3274         (printDefinitions):
3275         * accessibility/AccessibilityRenderObject.cpp:
3276         (WebCore::AccessibilityRenderObject::inheritsPresentationalRole const):
3277         * css/StyleResolver.cpp:
3278         (WebCore::hasEffectiveDisplayNoneForDisplayContents):
3279         * dom/CustomElementReactionQueue.cpp:
3280         (WebCore::CustomElementReactionQueue::observesStyleAttribute const):
3281         * dom/Document.cpp:
3282         (WebCore::Document::validateCustomElementName):
3283         * dom/Element.cpp:
3284         (WebCore::isStyleAttribute):
3285         (WebCore::canAttachAuthorShadowRoot):
3286         * dom/ElementData.cpp:
3287         (WebCore::ElementData::findLanguageAttribute const):
3288         * domjit/JSDocumentDOMJIT.cpp:
3289         (WebCore::compileDocumentBodyAttribute):
3290         * editing/Editor.cpp:
3291         (WebCore::Editor::applyEditingStyleToBodyElement const):
3292         * editing/EditorCommand.cpp:
3293         (WebCore::valueDefaultParagraphSeparator):
3294         * editing/MarkupAccumulator.cpp:
3295         (WebCore::MarkupAccumulator::serializeNodesWithNamespaces):
3296         (WebCore::MarkupAccumulator::appendNamespace):
3297         (WebCore::MarkupAccumulator::elementCannotHaveEndTag):
3298         * editing/ReplaceSelectionCommand.cpp:
3299         (WebCore::isProhibitedParagraphChild):
3300         * html/HTMLBodyElement.cpp:
3301         (WebCore::HTMLBodyElement::createWindowEventHandlerNameMap):
3302         * html/HTMLDocument.cpp:
3303         (WebCore::HTMLDocument::isCaseSensitiveAttribute):
3304         * html/HTMLElement.cpp:
3305         (WebCore::HTMLElement::createEventHandlerNameMap):
3306         * html/parser/HTMLConstructionSite.cpp:
3307         (WebCore::HTMLConstructionSite::findFosterSite):
3308         * html/parser/HTMLElementStack.cpp:
3309         (WebCore::HTMLElementStack::hasTemplateInHTMLScope const):
3310         * html/parser/HTMLPreloadScanner.cpp:
3311         (WebCore::TokenPreloadScanner::updatePredictedBaseURL):
3312         * html/parser/HTMLTreeBuilder.cpp:
3313         (WebCore::HTMLTreeBuilder::processFakePEndTagIfPInButtonScope):
3314         (WebCore::HTMLTreeBuilder::processStartTagForInBody):
3315         (WebCore::HTMLTreeBuilder::processTemplateEndTag):
3316         (WebCore::HTMLTreeBuilder::processEndOfFileForInTemplateContents):
3317         (WebCore::HTMLTreeBuilder::processStartTag):
3318         (WebCore::HTMLTreeBuilder::processBodyEndTagForInBody):
3319         (WebCore::HTMLTreeBuilder::processEndTagForInBody):
3320         (WebCore::HTMLTreeBuilder::processCaptionEndTagForInCaption):
3321         (WebCore::HTMLTreeBuilder::processTableEndTagForInTable):
3322         (WebCore::HTMLTreeBuilder::processEndTag):
3323         (WebCore::HTMLTreeBuilder::insertPhoneNumberLink):
3324         (WebCore::HTMLTreeBuilder::defaultForBeforeHTML):
3325         (WebCore::HTMLTreeBuilder::defaultForBeforeHead):
3326         (WebCore::HTMLTreeBuilder::defaultForInHead):
3327         (WebCore::HTMLTreeBuilder::defaultForInHeadNoscript):
3328         (WebCore::HTMLTreeBuilder::defaultForAfterHead):
3329         * html/parser/TextDocumentParser.cpp:
3330         (WebCore::TextDocumentParser::insertFakePreElement):
3331         * rendering/svg/SVGPathData.cpp:
3332         (WebCore::pathFromGraphicsElement):
3333         * rendering/svg/SVGResources.cpp:
3334         (WebCore::clipperFilterMaskerTags):
3335         (WebCore::markerTags):
3336         (WebCore::fillAndStrokeTags):
3337         (WebCore::chainableResourceTags):
3338         * svg/SVGAnimatedBoolean.h:
3339         * svg/SVGAnimatedEnumeration.h:
3340         * svg/SVGAnimatedInteger.h:
3341         * svg/SVGAnimatedLength.h:
3342         * svg/SVGAnimatedLengthList.h:
3343         * svg/SVGAnimatedNumber.h:
3344         * svg/SVGAnimatedNumberList.h:
3345         * svg/SVGAnimatedPreserveAspectRatio.h:
3346         * svg/SVGAnimatedRect.h:
3347         * svg/SVGAnimatedString.h:
3348         * svg/SVGAnimatedTransformList.h:
3349         * svg/SVGAnimationElement.cpp:
3350         (WebCore::SVGAnimationElement::isSupportedAttribute):
3351         * svg/SVGCursorElement.cpp:
3352         (WebCore::SVGCursorElement::isSupportedAttribute):
3353         * svg/SVGElement.cpp:
3354         (WebCore::createAttributeNameToCSSPropertyIDMap):
3355         (WebCore::SVGElement::childShouldCreateRenderer const):
3356         (WebCore::SVGElement::animatableAttributeForName):
3357         * svg/SVGFilterElement.cpp:
3358         (WebCore::SVGFilterElement::isSupportedAttribute):
3359         * svg/SVGFilterPrimitiveStandardAttributes.cpp:
3360         (WebCore::SVGFilterPrimitiveStandardAttributes::isSupportedAttribute):
3361         * svg/SVGForeignObjectElement.cpp:
3362         (WebCore::SVGForeignObjectElement::isSupportedAttribute):
3363         * svg/SVGGradientElement.cpp:
3364         (WebCore::SVGGradientElement::isSupportedAttribute):
3365         * svg/SVGImageElement.cpp:
3366         (WebCore::SVGImageElement::isSupportedAttribute):
3367         * svg/SVGLineElement.cpp:
3368         (WebCore::SVGLineElement::isSupportedAttribute):
3369         * svg/SVGMarkerElement.cpp:
3370         (WebCore::SVGMarkerElement::isSupportedAttribute):
3371         * svg/SVGMaskElement.cpp:
3372         (WebCore::SVGMaskElement::isSupportedAttribute):
3373         * svg/SVGPathElement.cpp:
3374         (WebCore::SVGPathElement::dPropertyInfo):
3375         (WebCore::SVGPathElement::isSupportedAttribute):
3376         * svg/SVGPatternElement.cpp:
3377         (WebCore::SVGPatternElement::isSupportedAttribute):
3378         * svg/SVGPolyElement.cpp:
3379         (WebCore::SVGPolyElement::pointsPropertyInfo):
3380         * svg/SVGRadialGradientElement.cpp:
3381         (WebCore::SVGRadialGradientElement::isSupportedAttribute):
3382         * svg/SVGTextContentElement.cpp:
3383         (WebCore::SVGTextContentElement::textLengthPropertyInfo):
3384         (WebCore::SVGTextContentElement::isSupportedAttribute):
3385         * svg/SVGTextPathElement.cpp:
3386         (WebCore::SVGTextPathElement::isSupportedAttribute):
3387         * svg/SVGUseElement.cpp:
3388         (WebCore::createAllowedElementSet):
3389         * xml/NativeXPathNSResolver.cpp:
3390         (WebCore::NativeXPathNSResolver::lookupNamespaceURI):
3391         * xml/parser/XMLDocumentParser.cpp:
3392         (WebCore::XMLDocumentParser::parseDocumentFragment):
3393
3394 2017-10-30  Jer Noble  <jer.noble@apple.com>
3395
3396         [WebGL] Optimization to skip painting if texture and source surface hasn't changed isn't working; re-optimize.
3397         https://bugs.webkit.org/show_bug.cgi?id=178953
3398
3399         Reviewed by Dean Jackson.
3400
3401         The "seed" value of the current bound texture never matches the last saved value in
3402         VideoTextureCopierCV::copyImageToPlatformTexture(). The value is modified by the function
3403         itself, so a fresh value needs to be re-queried after the image's surface is attached to the
3404         texture.
3405
3406         Once this fix is in, however, the <canvas> being painted will flash when no new image is
3407         available. This is because the wrong texture target is being restored by the GC3DStateSaver
3408         at the end of copyImageToPlatformTexture(). While we're fixing that, we may as well use the
3409         texture state saved by the GraphicsContext3D itself to restore the correct texture unit,
3410         texture target, and texture.
3411
3412         * platform/graphics/GraphicsContext3D.h:
3413         (WebCore::GraphicsContext3D::activeTextureUnit const):
3414         (WebCore::GraphicsContext3D::currentBoundTexture const):
3415         (WebCore::GraphicsContext3D::currentBoundTarget const):
3416         (WebCore::GraphicsContext3D::GraphicsContext3DState::currentBoundTexture const):
3417         (WebCore::GraphicsContext3D::GraphicsContext3DState::boundTexture const):
3418         (WebCore::GraphicsContext3D::GraphicsContext3DState::currentBoundTarget const):
3419         (WebCore::GraphicsContext3D::GraphicsContext3DState::boundTarget const):
3420         (WebCore::GraphicsContext3D::GraphicsContext3DState::currentBoundTexture): Deleted.
3421         (WebCore::GraphicsContext3D::GraphicsContext3DState::boundTexture): Deleted.
3422         (WebCore::GraphicsContext3D::GraphicsContext3DState::boundTarget): Deleted.
3423         * platform/graphics/cv/VideoTextureCopierCV.cpp:
3424         (WebCore::VideoTextureCopierCV::copyImageToPlatformTexture):
3425 &nbs