Diff
Modified: trunk/Source/WebCore/ChangeLog (241129 => 241130)
--- trunk/Source/WebCore/ChangeLog 2019-02-07 18:57:41 UTC (rev 241129)
+++ trunk/Source/WebCore/ChangeLog 2019-02-07 18:59:50 UTC (rev 241130)
@@ -1,3 +1,47 @@
+2019-02-07 Jer Noble <jer.no...@apple.com>
+
+ HTMLMediaElement registers wrong ScriptExecutionContext with its ActiveDOMObject parent class
+ https://bugs.webkit.org/show_bug.cgi?id=194360
+
+ HTMLMediaElement registers the Document used to create it with ActiveDOMObject, when it should
+ really use that Document's contextDocument(). Rather than just fix this in HTMLMediaElement,
+ make sure that the correct document is used everywhere by adding a new ActiveDOMObject constructor
+ taking a Document&, and making an explicitly deleted Document* constructor to catch any new cases.
+
+ Reviewed by Geoffrey Garen.
+
+ * Modules/applepay/ApplePaySession.cpp:
+ (WebCore::ApplePaySession::ApplePaySession):
+ * Modules/mediarecorder/MediaRecorder.cpp:
+ (WebCore::MediaRecorder::MediaRecorder):
+ * Modules/mediastream/MediaDevices.cpp:
+ (WebCore::MediaDevices::MediaDevices):
+ * Modules/mediastream/UserMediaRequest.cpp:
+ (WebCore::UserMediaRequest::UserMediaRequest):
+ * Modules/notifications/Notification.cpp:
+ (WebCore::Notification::Notification):
+ * Modules/paymentrequest/PaymentRequest.cpp:
+ (WebCore::PaymentRequest::PaymentRequest):
+ * Modules/webaudio/AudioContext.cpp:
+ (WebCore::AudioContext::AudioContext):
+ * animation/WebAnimation.cpp:
+ (WebCore::WebAnimation::WebAnimation):
+ * css/FontFaceSet.cpp:
+ (WebCore::FontFaceSet::FontFaceSet):
+ * dom/ActiveDOMObject.cpp:
+ (WebCore::ActiveDOMObject::ActiveDOMObject):
+ * dom/ActiveDOMObject.h:
+ * dom/Document.h:
+ (WebCore::ActiveDOMObject::ActiveDOMObject):
+ * html/HTMLMarqueeElement.cpp:
+ (WebCore::HTMLMarqueeElement::HTMLMarqueeElement):
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::HTMLMediaElement):
+ * html/HTMLSourceElement.cpp:
+ (WebCore::HTMLSourceElement::HTMLSourceElement):
+ * page/IntersectionObserver.cpp:
+ (WebCore::IntersectionObserver::IntersectionObserver):
+
2019-02-07 Zalan Bujtas <za...@apple.com>
[LFC][Out-of-flow] Use the containing block's padding width when computing min/max width.
Modified: trunk/Source/WebCore/Modules/applepay/ApplePaySession.cpp (241129 => 241130)
--- trunk/Source/WebCore/Modules/applepay/ApplePaySession.cpp 2019-02-07 18:57:41 UTC (rev 241129)
+++ trunk/Source/WebCore/Modules/applepay/ApplePaySession.cpp 2019-02-07 18:59:50 UTC (rev 241130)
@@ -407,7 +407,7 @@
}
ApplePaySession::ApplePaySession(Document& document, unsigned version, ApplePaySessionPaymentRequest&& paymentRequest)
- : ActiveDOMObject { &document }
+ : ActiveDOMObject { document }
, m_paymentRequest { WTFMove(paymentRequest) }
, m_version { version }
{
Modified: trunk/Source/WebCore/Modules/mediarecorder/MediaRecorder.cpp (241129 => 241130)
--- trunk/Source/WebCore/Modules/mediarecorder/MediaRecorder.cpp 2019-02-07 18:57:41 UTC (rev 241129)
+++ trunk/Source/WebCore/Modules/mediarecorder/MediaRecorder.cpp 2019-02-07 18:59:50 UTC (rev 241130)
@@ -73,7 +73,7 @@
}
MediaRecorder::MediaRecorder(Document& document, Ref<MediaStream>&& stream, std::unique_ptr<MediaRecorderPrivate>&& privateImpl, Options&& option)
- : ActiveDOMObject(&document)
+ : ActiveDOMObject(document)
, m_options(WTFMove(option))
, m_stream(WTFMove(stream))
, m_private(WTFMove(privateImpl))
Modified: trunk/Source/WebCore/Modules/mediastream/MediaDevices.cpp (241129 => 241130)
--- trunk/Source/WebCore/Modules/mediastream/MediaDevices.cpp 2019-02-07 18:57:41 UTC (rev 241129)
+++ trunk/Source/WebCore/Modules/mediastream/MediaDevices.cpp 2019-02-07 18:59:50 UTC (rev 241130)
@@ -48,7 +48,7 @@
namespace WebCore {
inline MediaDevices::MediaDevices(Document& document)
- : ActiveDOMObject(&document)
+ : ActiveDOMObject(document)
, m_scheduledEventTimer(*this, &MediaDevices::scheduledEventTimerFired)
, m_eventNames(eventNames())
{
Modified: trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.cpp (241129 => 241130)
--- trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.cpp 2019-02-07 18:57:41 UTC (rev 241129)
+++ trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.cpp 2019-02-07 18:59:50 UTC (rev 241130)
@@ -57,7 +57,7 @@
}
UserMediaRequest::UserMediaRequest(Document& document, MediaStreamRequest&& request, DOMPromiseDeferred<IDLInterface<MediaStream>>&& promise)
- : ActiveDOMObject(&document)
+ : ActiveDOMObject(document)
, m_promise(WTFMove(promise))
, m_request(WTFMove(request))
{
Modified: trunk/Source/WebCore/Modules/notifications/Notification.cpp (241129 => 241130)
--- trunk/Source/WebCore/Modules/notifications/Notification.cpp 2019-02-07 18:57:41 UTC (rev 241129)
+++ trunk/Source/WebCore/Modules/notifications/Notification.cpp 2019-02-07 18:59:50 UTC (rev 241130)
@@ -53,7 +53,7 @@
}
Notification::Notification(Document& document, const String& title, const Options& options)
- : ActiveDOMObject(&document)
+ : ActiveDOMObject(document)
, m_title(title)
, m_direction(options.dir)
, m_lang(options.lang)
Modified: trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp (241129 => 241130)
--- trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp 2019-02-07 18:57:41 UTC (rev 241129)
+++ trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp 2019-02-07 18:59:50 UTC (rev 241130)
@@ -349,7 +349,7 @@
}
PaymentRequest::PaymentRequest(Document& document, PaymentOptions&& options, PaymentDetailsInit&& details, Vector<String>&& serializedModifierData, Vector<Method>&& serializedMethodData, String&& selectedShippingOption)
- : ActiveDOMObject { &document }
+ : ActiveDOMObject { document }
, m_options { WTFMove(options) }
, m_details { WTFMove(details) }
, m_serializedModifierData { WTFMove(serializedModifierData) }
Modified: trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp (241129 => 241130)
--- trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp 2019-02-07 18:57:41 UTC (rev 241129)
+++ trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp 2019-02-07 18:59:50 UTC (rev 241130)
@@ -130,7 +130,7 @@
// Constructor for rendering to the audio hardware.
AudioContext::AudioContext(Document& document)
- : ActiveDOMObject(&document)
+ : ActiveDOMObject(document)
, m_mediaSession(PlatformMediaSession::create(*this))
, m_eventQueue(std::make_unique<GenericEventQueue>(*this))
{
@@ -144,7 +144,7 @@
// Constructor for offline (non-realtime) rendering.
AudioContext::AudioContext(Document& document, unsigned numberOfChannels, size_t numberOfFrames, float sampleRate)
- : ActiveDOMObject(&document)
+ : ActiveDOMObject(document)
, m_isOfflineContext(true)
, m_mediaSession(PlatformMediaSession::create(*this))
, m_eventQueue(std::make_unique<GenericEventQueue>(*this))
Modified: trunk/Source/WebCore/animation/WebAnimation.cpp (241129 => 241130)
--- trunk/Source/WebCore/animation/WebAnimation.cpp 2019-02-07 18:57:41 UTC (rev 241129)
+++ trunk/Source/WebCore/animation/WebAnimation.cpp 2019-02-07 18:59:50 UTC (rev 241130)
@@ -58,7 +58,7 @@
}
WebAnimation::WebAnimation(Document& document)
- : ActiveDOMObject(&document)
+ : ActiveDOMObject(document)
, m_readyPromise(makeUniqueRef<ReadyPromise>(*this, &WebAnimation::readyPromiseResolve))
, m_finishedPromise(makeUniqueRef<FinishedPromise>(*this, &WebAnimation::finishedPromiseResolve))
{
Modified: trunk/Source/WebCore/css/FontFaceSet.cpp (241129 => 241130)
--- trunk/Source/WebCore/css/FontFaceSet.cpp 2019-02-07 18:57:41 UTC (rev 241129)
+++ trunk/Source/WebCore/css/FontFaceSet.cpp 2019-02-07 18:59:50 UTC (rev 241130)
@@ -49,7 +49,7 @@
}
FontFaceSet::FontFaceSet(Document& document, const Vector<RefPtr<FontFace>>& initialFaces)
- : ActiveDOMObject(&document)
+ : ActiveDOMObject(document)
, m_backing(CSSFontFaceSet::create())
, m_readyPromise(*this, &FontFaceSet::readyPromiseResolve)
{
@@ -59,7 +59,7 @@
}
FontFaceSet::FontFaceSet(Document& document, CSSFontFaceSet& backing)
- : ActiveDOMObject(&document)
+ : ActiveDOMObject(document)
, m_backing(backing)
, m_readyPromise(*this, &FontFaceSet::readyPromiseResolve)
{
Modified: trunk/Source/WebCore/dom/ActiveDOMObject.cpp (241129 => 241130)
--- trunk/Source/WebCore/dom/ActiveDOMObject.cpp 2019-02-07 18:57:41 UTC (rev 241129)
+++ trunk/Source/WebCore/dom/ActiveDOMObject.cpp 2019-02-07 18:59:50 UTC (rev 241130)
@@ -27,6 +27,7 @@
#include "config.h"
#include "ActiveDOMObject.h"
+#include "Document.h"
#include "ScriptExecutionContext.h"
namespace WebCore {
@@ -38,6 +39,7 @@
, m_suspendIfNeededWasCalled(false)
#endif
{
+ ASSERT(!is<Document>(m_scriptExecutionContext) || &downcast<Document>(m_scriptExecutionContext)->contextDocument() == downcast<Document>(m_scriptExecutionContext));
if (!m_scriptExecutionContext)
return;
Modified: trunk/Source/WebCore/dom/ActiveDOMObject.h (241129 => 241130)
--- trunk/Source/WebCore/dom/ActiveDOMObject.h 2019-02-07 18:57:41 UTC (rev 241129)
+++ trunk/Source/WebCore/dom/ActiveDOMObject.h 2019-02-07 18:59:50 UTC (rev 241130)
@@ -34,6 +34,8 @@
namespace WebCore {
+class Document;
+
enum class ReasonForSuspension {
_javascript_DebuggerPaused,
WillDeferLoading,
@@ -114,6 +116,8 @@
protected:
explicit ActiveDOMObject(ScriptExecutionContext*);
+ explicit ActiveDOMObject(Document*) = delete;
+ explicit ActiveDOMObject(Document&); // Implemented in Document.h
virtual ~ActiveDOMObject();
private:
Modified: trunk/Source/WebCore/dom/Document.h (241129 => 241130)
--- trunk/Source/WebCore/dom/Document.h 2019-02-07 18:57:41 UTC (rev 241129)
+++ trunk/Source/WebCore/dom/Document.h 2019-02-07 18:59:50 UTC (rev 241130)
@@ -2140,6 +2140,11 @@
return &document().contextDocument();
}
+inline ActiveDOMObject::ActiveDOMObject(Document& document)
+ : ActiveDOMObject(static_cast<ScriptExecutionContext*>(&document.contextDocument()))
+{
+}
+
} // namespace WebCore
SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::Document)
Modified: trunk/Source/WebCore/html/HTMLMarqueeElement.cpp (241129 => 241130)
--- trunk/Source/WebCore/html/HTMLMarqueeElement.cpp 2019-02-07 18:57:41 UTC (rev 241129)
+++ trunk/Source/WebCore/html/HTMLMarqueeElement.cpp 2019-02-07 18:59:50 UTC (rev 241130)
@@ -40,7 +40,7 @@
inline HTMLMarqueeElement::HTMLMarqueeElement(const QualifiedName& tagName, Document& document)
: HTMLElement(tagName, document)
- , ActiveDOMObject(&document)
+ , ActiveDOMObject(document)
{
ASSERT(hasTagName(marqueeTag));
}
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (241129 => 241130)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2019-02-07 18:57:41 UTC (rev 241129)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2019-02-07 18:59:50 UTC (rev 241130)
@@ -426,7 +426,7 @@
HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document& document, bool createdByParser)
: HTMLElement(tagName, document)
- , ActiveDOMObject(&document)
+ , ActiveDOMObject(document)
, m_progressEventTimer(*this, &HTMLMediaElement::progressEventTimerFired)
, m_playbackProgressTimer(*this, &HTMLMediaElement::playbackProgressTimerFired)
, m_scanTimer(*this, &HTMLMediaElement::scanTimerFired)
Modified: trunk/Source/WebCore/html/HTMLSourceElement.cpp (241129 => 241130)
--- trunk/Source/WebCore/html/HTMLSourceElement.cpp 2019-02-07 18:57:41 UTC (rev 241129)
+++ trunk/Source/WebCore/html/HTMLSourceElement.cpp 2019-02-07 18:59:50 UTC (rev 241130)
@@ -47,7 +47,7 @@
inline HTMLSourceElement::HTMLSourceElement(const QualifiedName& tagName, Document& document)
: HTMLElement(tagName, document)
- , ActiveDOMObject(&document)
+ , ActiveDOMObject(document)
, m_errorEventTimer(*this, &HTMLSourceElement::errorEventTimerFired)
{
LOG(Media, "HTMLSourceElement::HTMLSourceElement - %p", this);
Modified: trunk/Source/WebCore/page/IntersectionObserver.cpp (241129 => 241130)
--- trunk/Source/WebCore/page/IntersectionObserver.cpp 2019-02-07 18:57:41 UTC (rev 241129)
+++ trunk/Source/WebCore/page/IntersectionObserver.cpp 2019-02-07 18:59:50 UTC (rev 241130)
@@ -106,7 +106,7 @@
}
IntersectionObserver::IntersectionObserver(Document& document, Ref<IntersectionObserverCallback>&& callback, Element* root, LengthBox&& parsedRootMargin, Vector<double>&& thresholds)
- : ActiveDOMObject(downcast<Document>(callback->scriptExecutionContext()))
+ : ActiveDOMObject(callback->scriptExecutionContext())
, m_root(root)
, m_rootMargin(WTFMove(parsedRootMargin))
, m_thresholds(WTFMove(thresholds))