Bug 1431674 - Backed out changeset 9d197f1860e6. r=backout
authorChris Pearce <cpearce@mozilla.com>
Wed, 07 Feb 2018 15:28:48 +1300
changeset 402686 aab04cb5b8151abfb04b5c4bba0d05b587c187b5
parent 402685 c900339ffe3d6242f7c516d68d12e42634ce4134
child 402687 6f8bd3a6369d71200fec3041aab53eb9791d8583
push id33397
push userdluca@mozilla.com
push dateWed, 07 Feb 2018 09:58:42 +0000
treeherdermozilla-central@4fe6f6560083 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1431674
milestone60.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1431674 - Backed out changeset 9d197f1860e6. r=backout MozReview-Commit-ID: wP0aucXgzA
dom/base/nsDocument.cpp
dom/html/HTMLMediaElement.cpp
dom/html/HTMLMediaElement.h
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -8811,16 +8811,17 @@ nsDocument::OnPageHide(bool aPersisted,
       PageUnloadingEventTimeStamp timeStamp(this);
       DispatchPageTransition(target, NS_LITERAL_STRING("pagehide"), aPersisted);
     }
   }
 
   mVisible = false;
 
   UpdateVisibilityState();
+
   EnumerateExternalResources(NotifyPageHide, &aPersisted);
   EnumerateActivityObservers(NotifyActivityChanged, nullptr);
 
   ClearPendingFullscreenRequests(this);
   if (GetFullscreenElement()) {
     // If this document was fullscreen, we should exit fullscreen in this
     // doctree branch. This ensures that if the user navigates while in
     // fullscreen mode we don't leave its still visible ancestor documents
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -19,17 +19,16 @@
 #include "mozilla/Sprintf.h"
 
 #include "AutoplayPolicy.h"
 #include "base/basictypes.h"
 #include "nsIDOMHTMLMediaElement.h"
 #include "TimeRanges.h"
 #include "nsGenericHTMLElement.h"
 #include "nsAttrValueInlines.h"
-#include "nsDocShellLoadTypes.h"
 #include "nsPresContext.h"
 #include "nsIClassOfService.h"
 #include "nsIPresShell.h"
 #include "nsGkAtoms.h"
 #include "nsSize.h"
 #include "nsIFrame.h"
 #include "nsIDocument.h"
 #include "nsIDOMDocument.h"
@@ -3945,115 +3944,16 @@ private:
   }
   // Guaranteed to be valid by HTMLMediaElement.
   HTMLMediaElement* mWeak = nullptr;
   Phase mPhase = Phase::Init;
 };
 
 NS_IMPL_ISUPPORTS(HTMLMediaElement::ShutdownObserver, nsIObserver)
 
-class HTMLMediaElement::ForceReloadListener : public nsIWebProgressListener
-                                            , public nsSupportsWeakReference
-{
-public:
-  NS_DECL_ISUPPORTS
-
-  void Subscribe(HTMLMediaElement* aPtr, nsIWebProgress* aWebProgress)
-  {
-    MOZ_DIAGNOSTIC_ASSERT(!mWeak);
-    MOZ_DIAGNOSTIC_ASSERT(aWebProgress);
-    mWeak = aPtr;
-    aWebProgress->AddProgressListener(this,
-                                      nsIWebProgress::NOTIFY_STATE_NETWORK);
-  }
-  void Unsubscribe(nsIWebProgress* aWebProgress)
-  {
-    MOZ_DIAGNOSTIC_ASSERT(mWeak);
-    mWeak = nullptr;
-    if (aWebProgress) {
-      aWebProgress->RemoveProgressListener(this);
-    }
-  }
-
-  NS_IMETHODIMP OnStateChange(nsIWebProgress* aWebProgress,
-                              nsIRequest* aRequest,
-                              uint32_t aProgressStateFlags,
-                              nsresult aStatus) override
-  {
-    MOZ_DIAGNOSTIC_ASSERT(mWeak);
-    if ((aProgressStateFlags & STATE_IS_NETWORK) &&
-        (aProgressStateFlags & STATE_START)) {
-      // Query the LoadType to see if it's a ctrl+F5.
-      nsCOMPtr<nsIDocShell> shell(do_QueryInterface(aWebProgress));
-      if (shell) {
-        uint32_t loadType;
-        shell->GetLoadType(&loadType);
-        if (LOAD_RELOAD_BYPASS_PROXY_AND_CACHE == loadType && mWeak->mDecoder) {
-          mWeak->ShutdownDecoder();
-        }
-      }
-    }
-    return NS_OK;
-  }
-
-  NS_IMETHODIMP
-  OnProgressChange(nsIWebProgress* aProgress,
-                   nsIRequest* aRequest,
-                   int32_t aCurSelfProgress,
-                   int32_t aMaxSelfProgress,
-                   int32_t aCurTotalProgress,
-                   int32_t aMaxTotalProgress) override
-  {
-    NS_NOTREACHED("notification excluded in AddProgressListener(...)");
-    return NS_OK;
-  }
-
-  NS_IMETHODIMP
-  OnLocationChange(nsIWebProgress* aWebProgress,
-                   nsIRequest* aRequest,
-                   nsIURI* aLocation,
-                   uint32_t aFlags) override
-  {
-    NS_NOTREACHED("notification excluded in AddProgressListener(...)");
-    return NS_OK;
-  }
-
-  NS_IMETHODIMP
-  OnStatusChange(nsIWebProgress* aWebProgress,
-                 nsIRequest* aRequest,
-                 nsresult aStatus,
-                 const char16_t* aMessage) override
-  {
-    NS_NOTREACHED("notification excluded in AddProgressListener(...)");
-    return NS_OK;
-  }
-
-  NS_IMETHODIMP
-  OnSecurityChange(nsIWebProgress* aWebProgress,
-                   nsIRequest* aRequest,
-                   uint32_t aState) override
-  {
-    NS_NOTREACHED("notification excluded in AddProgressListener(...)");
-    return NS_OK;
-  }
-
-protected:
-  virtual ~ForceReloadListener()
-  {
-    MOZ_DIAGNOSTIC_ASSERT(!mWeak);
-  }
-
-private:
-  HTMLMediaElement* mWeak = nullptr;
-};
-
-NS_IMPL_ISUPPORTS(HTMLMediaElement::ForceReloadListener,
-                  nsIWebProgressListener,
-                  nsISupportsWeakReference)
-
 HTMLMediaElement::HTMLMediaElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
   : nsGenericHTMLElement(aNodeInfo),
     mMainThreadEventTarget(OwnerDoc()->EventTargetFor(TaskCategory::Other)),
     mAbstractMainThread(OwnerDoc()->AbstractMainThreadFor(TaskCategory::Other)),
     mSrcStreamTracksAvailable(false),
     mSrcStreamPausedCurrentTime(-1),
     mShutdownObserver(new ShutdownObserver),
     mSourcePointer(nullptr),
@@ -4118,43 +4018,24 @@ HTMLMediaElement::HTMLMediaElement(alrea
 
   double defaultVolume = Preferences::GetFloat("media.default_volume", 1.0);
   SetVolume(defaultVolume, rv);
 
   RegisterActivityObserver();
   NotifyOwnerDocumentActivityChanged();
 
   mShutdownObserver->Subscribe(this);
-  nsIDocShell* docShell = OwnerDoc()->GetDocShell();
-  if (docShell) {
-    nsCOMPtr<nsIDocShellTreeItem> root;
-    docShell->GetSameTypeRootTreeItem(getter_AddRefs(root));
-    nsCOMPtr<nsIWebProgress> webProgress = do_GetInterface(root);
-    if (webProgress) {
-      mForceReloadListener = new ForceReloadListener();
-      mForceReloadListener->Subscribe(this, webProgress);
-    }
-  }
 }
 
 HTMLMediaElement::~HTMLMediaElement()
 {
   NS_ASSERTION(!mHasSelfReference,
                "How can we be destroyed if we're still holding a self reference?");
+
   mShutdownObserver->Unsubscribe();
-  nsIDocShell* docShell = OwnerDoc()->GetDocShell();
-  nsCOMPtr<nsIWebProgress> webProgress;
-  if (docShell) {
-    nsCOMPtr<nsIDocShellTreeItem> root;
-    docShell->GetSameTypeRootTreeItem(getter_AddRefs(root));
-    webProgress = do_GetInterface(root);
-  }
-  if (mForceReloadListener) {
-    mForceReloadListener->Unsubscribe(webProgress);
-  }
 
   if (mVideoFrameContainer) {
     mVideoFrameContainer->ForgetElement();
   }
   UnregisterActivityObserver();
 
   mSetCDMRequest.DisconnectIfExists();
   if (mDecoder) {
--- a/dom/html/HTMLMediaElement.h
+++ b/dom/html/HTMLMediaElement.h
@@ -808,17 +808,16 @@ protected:
   class ChannelLoader;
   class ErrorSink;
   class MediaLoadListener;
   class MediaStreamTracksAvailableCallback;
   class MediaStreamTrackListener;
   class StreamListener;
   class StreamSizeListener;
   class ShutdownObserver;
-  class ForceReloadListener;
 
   MediaDecoderOwner::NextFrameStatus NextFrameStatus();
 
   void SetDecoder(MediaDecoder* aDecoder);
 
   class WakeLockBoolWrapper {
   public:
     WakeLockBoolWrapper(bool aVal, HTMLMediaElement& aOuter)
@@ -1398,17 +1397,16 @@ protected:
   RefPtr<StreamListener> mMediaStreamListener;
   // Holds a reference to the size-getting MediaStreamListener attached to
   // mSrcStream.
   RefPtr<StreamSizeListener> mMediaStreamSizeListener;
   // The selected video stream track which contained mMediaStreamSizeListener.
   RefPtr<VideoStreamTrack> mSelectedVideoStreamTrack;
 
   const RefPtr<ShutdownObserver> mShutdownObserver;
-  RefPtr<ForceReloadListener> mForceReloadListener;
 
   // Holds a reference to the MediaSource, if any, referenced by the src
   // attribute on the media element.
   RefPtr<MediaSource> mSrcMediaSource;
 
   // Holds a reference to the MediaSource supplying data for playback.  This
   // may either match mSrcMediaSource or come from Source element children.
   // This is set when and only when mLoadingSrc corresponds to an object url