Skip to content

Instantly share code, notes, and snippets.

@ehsan
Created January 16, 2019 23:35
Show Gist options
  • Save ehsan/79e7092640bfd619b6c35f684dd8af04 to your computer and use it in GitHub Desktop.
Save ehsan/79e7092640bfd619b6c35f684dd8af04 to your computer and use it in GitHub Desktop.
diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp
index 4064be7abc286..0f6e766afc4f9 100644
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -534,6 +534,11 @@ nsresult TabChild::Init(mozIDOMWindowProxy* aParent) {
nsCOMPtr<nsIDocShell> docShell = do_GetInterface(WebNavigation());
MOZ_ASSERT(docShell);
+ nsCOMPtr<nsIWebProgress> webProgress = do_QueryInterface(docShell);
+ webProgress->AddProgressListener(this,
+ nsIWebProgress::NOTIFY_CONTENT_BLOCKING);
+ mProgressListenerRegistered = true;
+
docShell->SetAffectPrivateSessionLifetime(
mChromeFlags & nsIWebBrowserChrome::CHROME_PRIVATE_LIFETIME);
nsCOMPtr<nsILoadContext> loadContext = do_GetInterface(WebNavigation());
@@ -949,6 +954,14 @@ void TabChild::DestroyWindow() {
}
mLayersId = layers::LayersId{0};
}
+
+ if (mProgressListenerRegistered) {
+ nsCOMPtr<nsIWebProgress> webProgress = do_QueryInterface(WebNavigation());
+ if (webProgress) {
+ webProgress->RemoveProgressListener(this);
+ mProgressListenerRegistered = false;
+ }
+ }
}
void TabChild::ActorDestroy(ActorDestroyReason why) {
@@ -3220,6 +3233,42 @@ nsresult TabChild::SetHasSiblings(bool aHasSiblings) {
return NS_OK;
}
+NS_IMETHODIMP TabChild::StateChange(nsIWebProgress* aWebProgress,
+ nsIRequest* aRequest, uint32_t aStateFlags,
+ nsresult aStatus) {
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP TabChild::ProgressChange(nsIWebProgress* aWebProgress,
+ nsIRequest* aRequest,
+ int32_t aCurSelfProgress,
+ int32_t aMaxSelfProgress,
+ int32_t aCurTotalProgress,
+ int32_t aMaxTotalProgress) {
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP TabChild::LocationChange(nsIWebProgress* aWebProgress,
+ nsIRequest* aRequest, nsIURI* aLocation,
+ uint32_t aFlags) {
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP TabChild::StatusChange(nsIWebProgress* aWebProgress,
+ nsIRequest* aRequest, nsresult aStatus,
+ const char16_t* aMessage) {
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP TabChild::SecurityChange(nsIWebProgress* aWebProgress,
+ nsIRequest* aRequest, uint32_t aState) {
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+NS_IMETHODIMP TabChild::ContentBlockingEvent(nsIWebProgress* aWebProgress,
+ nsIRequest* aRequest,
+ uint32_t aEvent) {
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
TabChildMessageManager::TabChildMessageManager(TabChild* aTabChild)
: ContentFrameMessageManager(new nsFrameMessageManager(aTabChild)),
mTabChild(aTabChild) {}
diff --git a/dom/ipc/TabChild.h b/dom/ipc/TabChild.h
index 762e2243bac26..226027cf1d9a9 100644
--- a/dom/ipc/TabChild.h
+++ b/dom/ipc/TabChild.h
@@ -26,6 +26,7 @@
#include "nsWeakReference.h"
#include "nsITabChild.h"
#include "nsITooltipListener.h"
+#include "nsIWebProgressListener.h"
#include "mozilla/Attributes.h"
#include "mozilla/dom/TabContext.h"
#include "mozilla/dom/CoalescedMouseData.h"
@@ -198,6 +199,7 @@ class TabChild final : public TabChildBase,
public nsSupportsWeakReference,
public nsITabChild,
public nsIObserver,
+ public nsIWebProgressListener,
public TabContext,
public nsITooltipListener,
public mozilla::ipc::IShmemAllocator {
@@ -252,6 +254,7 @@ class TabChild final : public TabChildBase,
NS_DECL_NSIWINDOWPROVIDER
NS_DECL_NSITABCHILD
NS_DECL_NSIOBSERVER
+ NS_DECL_NSIWEBPROGRESSLISTENER
NS_DECL_NSITOOLTIPLISTENER
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(TabChild, TabChildBase)
@@ -801,6 +804,7 @@ class TabChild final : public TabChildBase,
SetAllowedTouchBehaviorCallback mSetAllowedTouchBehaviorCallback;
bool mHasValidInnerSize;
bool mDestroyed;
+ bool mProgressListenerRegistered;
// Position of client area relative to the outer window
LayoutDeviceIntPoint mClientOffset;
// Position of tab, relative to parent widget (typically the window)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment