author | Kaku Kuo <kaku@mozilla.com> |
Thu, 16 Mar 2017 19:28:13 +0800 | |
changeset 499898 | 5ad128cc8e9d831efd55909e630742b5033668f7 |
parent 499897 | 54616c39f41467ead90a64c47181f5d6b4806d7f |
child 549509 | 33b991f97ba2fb8e3953167fb21d2f70808e8f02 |
push id | 49581 |
push user | tkuo@mozilla.com |
push date | Thu, 16 Mar 2017 11:43:20 +0000 |
reviewers | jwwang |
bugs | 1347892 |
milestone | 55.0a1 |
--- a/dom/html/HTMLMediaElement.cpp +++ b/dom/html/HTMLMediaElement.cpp @@ -7398,21 +7398,29 @@ HTMLMediaElement::GetEMEInfo(nsString& a aEMEInfo.Append(keySystem); aEMEInfo.AppendLiteral(" SessionsInfo="); aEMEInfo.Append(sessionsInfo); } void HTMLMediaElement::NotifyDecoderActivityChanges() const { - if (mDecoder) { - mDecoder->NotifyOwnerActivityChanged(!IsHidden(), - mVisibilityState == Visibility::APPROXIMATELY_VISIBLE, - IsInUncomposedDoc()); - } + if (!mDecoder) { + return; + } + + // Don't bother to pass information to decoder if the element is in-tree but + // we don't know its visibility state yet. + if (!IsHidden() && IsInUncomposedDoc() && mVisibilityState == Visibility::UNTRACKED) { + return; + } + + mDecoder->NotifyOwnerActivityChanged(!IsHidden(), + mVisibilityState == Visibility::APPROXIMATELY_VISIBLE, + IsInUncomposedDoc()); } bool HasDebuggerPrivilege(JSContext* aCx, JSObject* aObj) { return nsContentUtils::CallerHasPermission(aCx, NS_LITERAL_STRING("debugger")); }