WebKit Bugzilla
Attachment 361329 Details for
Bug 194360
: HTMLMediaElement registers wrong ScriptExecutionContext with its ActiveDOMObject parent class
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-194360-20190206143026.patch (text/plain), 14.45 KB, created by
Jer Noble
on 2019-02-06 14:30:27 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Jer Noble
Created:
2019-02-06 14:30:27 PST
Size:
14.45 KB
patch
obsolete
>Subversion Revision: 240879 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 5723d7dd2be570f5eefcbfe31c3733600de74546..e33b4ba0dab357f9552d0b88e2cdb35416ea4121 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,47 @@ >+2019-02-06 Jer Noble <jer.noble@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 NOBODY (OOPS!). >+ >+ * 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-01 Antoine Quint <graouts@apple.com> > > Dispatch pointercancel events when content is panned or zoomed on iOS >diff --git a/Source/WebCore/Modules/applepay/ApplePaySession.cpp b/Source/WebCore/Modules/applepay/ApplePaySession.cpp >index 06c0fae67f30e6876608b1f73dabc94bc4e66a33..8e7ec8eef5491936c4d47233d2f42e5804fce5a6 100644 >--- a/Source/WebCore/Modules/applepay/ApplePaySession.cpp >+++ b/Source/WebCore/Modules/applepay/ApplePaySession.cpp >@@ -414,7 +414,7 @@ ExceptionOr<Ref<ApplePaySession>> ApplePaySession::create(Document& document, un > } > > ApplePaySession::ApplePaySession(Document& document, unsigned version, ApplePaySessionPaymentRequest&& paymentRequest) >- : ActiveDOMObject { &document } >+ : ActiveDOMObject { document } > , m_paymentRequest { WTFMove(paymentRequest) } > , m_version { version } > { >diff --git a/Source/WebCore/Modules/mediarecorder/MediaRecorder.cpp b/Source/WebCore/Modules/mediarecorder/MediaRecorder.cpp >index bdbe275c5746b5ec16242053cab2f2fd6f204c6f..220b6b7aba25e00733fb3b3cce17387c1d513d73 100644 >--- a/Source/WebCore/Modules/mediarecorder/MediaRecorder.cpp >+++ b/Source/WebCore/Modules/mediarecorder/MediaRecorder.cpp >@@ -73,7 +73,7 @@ std::unique_ptr<MediaRecorderPrivate> MediaRecorder::getPrivateImpl(const MediaS > } > > 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)) >diff --git a/Source/WebCore/Modules/mediastream/MediaDevices.cpp b/Source/WebCore/Modules/mediastream/MediaDevices.cpp >index 3aa43a99ae0981c8fc0df516cbcea6fb41876127..91dcc86b167b23e05dcce41ca905045c48aa35bc 100644 >--- a/Source/WebCore/Modules/mediastream/MediaDevices.cpp >+++ b/Source/WebCore/Modules/mediastream/MediaDevices.cpp >@@ -48,7 +48,7 @@ > namespace WebCore { > > inline MediaDevices::MediaDevices(Document& document) >- : ActiveDOMObject(&document) >+ : ActiveDOMObject(document) > , m_scheduledEventTimer(*this, &MediaDevices::scheduledEventTimerFired) > , m_eventNames(eventNames()) > { >diff --git a/Source/WebCore/Modules/mediastream/UserMediaRequest.cpp b/Source/WebCore/Modules/mediastream/UserMediaRequest.cpp >index a1cb74ba619bb724e4a6e057b9d9fdb9380709ad..ff5db7388f20cea8a66d3c77ca9193f5a5d9d567 100644 >--- a/Source/WebCore/Modules/mediastream/UserMediaRequest.cpp >+++ b/Source/WebCore/Modules/mediastream/UserMediaRequest.cpp >@@ -57,7 +57,7 @@ Ref<UserMediaRequest> UserMediaRequest::create(Document& document, MediaStreamRe > } > > UserMediaRequest::UserMediaRequest(Document& document, MediaStreamRequest&& request, DOMPromiseDeferred<IDLInterface<MediaStream>>&& promise) >- : ActiveDOMObject(&document) >+ : ActiveDOMObject(document) > , m_promise(WTFMove(promise)) > , m_request(WTFMove(request)) > { >diff --git a/Source/WebCore/Modules/notifications/Notification.cpp b/Source/WebCore/Modules/notifications/Notification.cpp >index cc6aae29e98c82d5c3d535ee5169b2578bda1892..ad6969a4bccf8ab682c17d683b51b38421d11c06 100644 >--- a/Source/WebCore/Modules/notifications/Notification.cpp >+++ b/Source/WebCore/Modules/notifications/Notification.cpp >@@ -53,7 +53,7 @@ Ref<Notification> Notification::create(Document& context, const String& title, c > } > > 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) >diff --git a/Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp b/Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp >index a122bb30395c5e051b1a91924903cc6d42f893fd..a47a95a69e4733763e159139151918f4e0d16907 100644 >--- a/Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp >+++ b/Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp >@@ -349,7 +349,7 @@ ExceptionOr<Ref<PaymentRequest>> PaymentRequest::create(Document& document, Vect > } > > 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) } >diff --git a/Source/WebCore/Modules/webaudio/AudioContext.cpp b/Source/WebCore/Modules/webaudio/AudioContext.cpp >index d8df3f50a9186548aea67ca0a7e83bd59d223833..41e25115a9c496dd3920ecc7b78af0ae3712f4d9 100644 >--- a/Source/WebCore/Modules/webaudio/AudioContext.cpp >+++ b/Source/WebCore/Modules/webaudio/AudioContext.cpp >@@ -130,7 +130,7 @@ RefPtr<AudioContext> AudioContext::create(Document& document) > > // 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 @@ AudioContext::AudioContext(Document& document) > > // 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)) >diff --git a/Source/WebCore/animation/WebAnimation.cpp b/Source/WebCore/animation/WebAnimation.cpp >index 32a37042b6c834291cf093edcbdc1505ad8c654a..af93d702a612a9911cddd9ae5d6d21eecdf765d5 100644 >--- a/Source/WebCore/animation/WebAnimation.cpp >+++ b/Source/WebCore/animation/WebAnimation.cpp >@@ -58,7 +58,7 @@ Ref<WebAnimation> WebAnimation::create(Document& document, AnimationEffect* effe > } > > WebAnimation::WebAnimation(Document& document) >- : ActiveDOMObject(&document) >+ : ActiveDOMObject(document) > , m_readyPromise(makeUniqueRef<ReadyPromise>(*this, &WebAnimation::readyPromiseResolve)) > , m_finishedPromise(makeUniqueRef<FinishedPromise>(*this, &WebAnimation::finishedPromiseResolve)) > { >diff --git a/Source/WebCore/css/FontFaceSet.cpp b/Source/WebCore/css/FontFaceSet.cpp >index 39486049c1a16e5d8e2ea243ff9963c0fc29687e..8c3aff1726fda0af086d0834a27794f9af0d2dc2 100644 >--- a/Source/WebCore/css/FontFaceSet.cpp >+++ b/Source/WebCore/css/FontFaceSet.cpp >@@ -49,7 +49,7 @@ Ref<FontFaceSet> FontFaceSet::create(Document& document, CSSFontFaceSet& backing > } > > 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, const Vector<RefPtr<FontFace>>& ini > } > > FontFaceSet::FontFaceSet(Document& document, CSSFontFaceSet& backing) >- : ActiveDOMObject(&document) >+ : ActiveDOMObject(document) > , m_backing(backing) > , m_readyPromise(*this, &FontFaceSet::readyPromiseResolve) > { >diff --git a/Source/WebCore/dom/ActiveDOMObject.cpp b/Source/WebCore/dom/ActiveDOMObject.cpp >index a4392f077da3f603006fe85836ba75b6a065dd60..b76886f5d3c351f4992b13b7252fd3b8f86e2c27 100644 >--- a/Source/WebCore/dom/ActiveDOMObject.cpp >+++ b/Source/WebCore/dom/ActiveDOMObject.cpp >@@ -27,6 +27,7 @@ > #include "config.h" > #include "ActiveDOMObject.h" > >+#include "Document.h" > #include "ScriptExecutionContext.h" > > namespace WebCore { >@@ -38,6 +39,7 @@ ActiveDOMObject::ActiveDOMObject(ScriptExecutionContext* scriptExecutionContext) > , m_suspendIfNeededWasCalled(false) > #endif > { >+ ASSERT(!is<Document>(m_scriptExecutionContext) || &downcast<Document>(m_scriptExecutionContext)->contextDocument() == downcast<Document>(m_scriptExecutionContext)); > if (!m_scriptExecutionContext) > return; > >diff --git a/Source/WebCore/dom/ActiveDOMObject.h b/Source/WebCore/dom/ActiveDOMObject.h >index ebdf586140d28e4a8678859ca9a0072c9db0e13a..39fa66757fe7492ae985e9d282f42375a9c44730 100644 >--- a/Source/WebCore/dom/ActiveDOMObject.h >+++ b/Source/WebCore/dom/ActiveDOMObject.h >@@ -34,6 +34,8 @@ > > namespace WebCore { > >+class Document; >+ > enum class ReasonForSuspension { > JavaScriptDebuggerPaused, > WillDeferLoading, >@@ -114,6 +116,8 @@ public: > > protected: > explicit ActiveDOMObject(ScriptExecutionContext*); >+ explicit ActiveDOMObject(Document*) = delete; >+ explicit ActiveDOMObject(Document&); // Implemented in Document.h > virtual ~ActiveDOMObject(); > > private: >diff --git a/Source/WebCore/dom/Document.h b/Source/WebCore/dom/Document.h >index 8e2878f4d15ab8515067a3aa5da3f25731102d03..3c5c44d08927e4064ce96175b19882b11fc5175b 100644 >--- a/Source/WebCore/dom/Document.h >+++ b/Source/WebCore/dom/Document.h >@@ -2140,6 +2140,11 @@ inline ScriptExecutionContext* Node::scriptExecutionContext() const > return &document().contextDocument(); > } > >+inline ActiveDOMObject::ActiveDOMObject(Document& document) >+ : ActiveDOMObject(static_cast<ScriptExecutionContext*>(&document.contextDocument())) >+{ >+} >+ > } // namespace WebCore > > SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::Document) >diff --git a/Source/WebCore/html/HTMLMarqueeElement.cpp b/Source/WebCore/html/HTMLMarqueeElement.cpp >index 21173adb215877a29c446705930d8fe9d3bc6e94..c443992c34d1677b3cb1f07ecb25532b162c1d83 100644 >--- a/Source/WebCore/html/HTMLMarqueeElement.cpp >+++ b/Source/WebCore/html/HTMLMarqueeElement.cpp >@@ -40,7 +40,7 @@ using namespace HTMLNames; > > inline HTMLMarqueeElement::HTMLMarqueeElement(const QualifiedName& tagName, Document& document) > : HTMLElement(tagName, document) >- , ActiveDOMObject(&document) >+ , ActiveDOMObject(document) > { > ASSERT(hasTagName(marqueeTag)); > } >diff --git a/Source/WebCore/html/HTMLMediaElement.cpp b/Source/WebCore/html/HTMLMediaElement.cpp >index 86c30fb8ac444d450f0683fd96542f10f8932f9a..af8a02be39694774d12565c363a14bd96568792d 100644 >--- a/Source/WebCore/html/HTMLMediaElement.cpp >+++ b/Source/WebCore/html/HTMLMediaElement.cpp >@@ -426,7 +426,7 @@ static uint64_t nextLogIdentifier() > > 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) >diff --git a/Source/WebCore/html/HTMLSourceElement.cpp b/Source/WebCore/html/HTMLSourceElement.cpp >index 2361422992466f5c4625de94c4f064a63e5fbd70..29117283fba8edb0b352cb1d7aed40215b24d624 100644 >--- a/Source/WebCore/html/HTMLSourceElement.cpp >+++ b/Source/WebCore/html/HTMLSourceElement.cpp >@@ -47,7 +47,7 @@ using namespace HTMLNames; > > 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); >diff --git a/Source/WebCore/page/IntersectionObserver.cpp b/Source/WebCore/page/IntersectionObserver.cpp >index e1b94baf395f5d6b57c443c36f19ef2334d042c6..eb8afe2c7f092851637b178a2eb0f1a255e3c72b 100644 >--- a/Source/WebCore/page/IntersectionObserver.cpp >+++ b/Source/WebCore/page/IntersectionObserver.cpp >@@ -106,7 +106,7 @@ ExceptionOr<Ref<IntersectionObserver>> IntersectionObserver::create(Document& do > } > > 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))
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 194360
:
361325
| 361329