Bug 1308862 - Null check for the innerWindow. r=jwwang

MozReview-Commit-ID: DXrN3cnqV7U

--HG--
extra : rebase_source : a77e55182e9265ebec8a42d3770df7c41c69b286
This commit is contained in:
bechen 2016-10-12 17:26:20 +08:00
Родитель 3c1524e5e0
Коммит 2e9466d27e
1 изменённых файлов: 4 добавлений и 1 удалений

Просмотреть файл

@ -126,11 +126,14 @@ NS_IMPL_ISUPPORTS(WindowDestroyObserver, nsIObserver);
HTMLTrackElement::HTMLTrackElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo) HTMLTrackElement::HTMLTrackElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
: nsGenericHTMLElement(aNodeInfo) : nsGenericHTMLElement(aNodeInfo)
, mLoadResourceDispatched(false) , mLoadResourceDispatched(false)
, mWindowDestroyObserver(nullptr)
{ {
nsISupports* parentObject = OwnerDoc()->GetParentObject(); nsISupports* parentObject = OwnerDoc()->GetParentObject();
NS_ENSURE_TRUE_VOID(parentObject); NS_ENSURE_TRUE_VOID(parentObject);
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(parentObject); nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(parentObject);
mWindowDestroyObserver = new WindowDestroyObserver(this, window->WindowID()); if (window) {
mWindowDestroyObserver = new WindowDestroyObserver(this, window->WindowID());
}
} }
HTMLTrackElement::~HTMLTrackElement() HTMLTrackElement::~HTMLTrackElement()