Bug 1295097 - Ensure HTMLTrackElement create only one WindowDestroyedObserver. r=rillian

MozReview-Commit-ID: FdfpjO58BWw
This commit is contained in:
bechen
2016-08-17 09:11:42 +08:00
parent ef338bef55
commit a70f5892e8

View File

@@ -130,8 +130,11 @@ NS_IMPL_ISUPPORTS(WindowDestroyObserver, nsIObserver);
HTMLTrackElement::HTMLTrackElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
: nsGenericHTMLElement(aNodeInfo)
, mLoadResourceDispatched(false)
, mWindowDestroyObserver(nullptr)
{
nsISupports* parentObject = OwnerDoc()->GetParentObject();
NS_ENSURE_TRUE_VOID(parentObject);
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(parentObject);
mWindowDestroyObserver = new WindowDestroyObserver(this, window->WindowID());
}
HTMLTrackElement::~HTMLTrackElement()
@@ -321,10 +324,6 @@ HTMLTrackElement::LoadResource()
NS_ENSURE_TRUE_VOID(NS_SUCCEEDED(rv));
mChannel = channel;
nsISupports* parentObject = OwnerDoc()->GetParentObject();
NS_ENSURE_TRUE_VOID(parentObject);
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(parentObject);
mWindowDestroyObserver = new WindowDestroyObserver(this, window->WindowID());
}
nsresult