diff --git a/dom/ipc/BrowserChild.cpp b/dom/ipc/BrowserChild.cpp index 704cc10dc082..e1455b6a9914 100644 --- a/dom/ipc/BrowserChild.cpp +++ b/dom/ipc/BrowserChild.cpp @@ -3518,29 +3518,6 @@ NS_IMETHODIMP BrowserChild::OnStateChange(nsIWebProgress* aWebProgress, MOZ_TRY(PrepareProgressListenerData(aWebProgress, aRequest, webProgressData, requestData)); - /* - * If - * 1) this is a document, - * 2) the document is top-level, - * 3) the document is completely loaded (STATE_STOP), and - * 4) this is the end of activity for the document - * (STATE_IS_WINDOW, STATE_IS_NETWORK), - * then record the elapsed time that it took to load. - */ - if (document && webProgressData->isTopLevel() && - (aStateFlags & nsIWebProgressListener::STATE_STOP) && - (aStateFlags & nsIWebProgressListener::STATE_IS_WINDOW) && - (aStateFlags & nsIWebProgressListener::STATE_IS_NETWORK)) { - RefPtr navigationTiming = - document->GetNavigationTiming(); - if (navigationTiming) { - TimeDuration elapsedLoadTimeMS = - TimeStamp::Now() - navigationTiming->GetNavigationStartTimeStamp(); - requestData.elapsedLoadTimeMS() = - Some(elapsedLoadTimeMS.ToMilliseconds()); - } - } - if (webProgressData->isTopLevel()) { stateChangeData.emplace(); diff --git a/dom/ipc/BrowserParent.cpp b/dom/ipc/BrowserParent.cpp index 28503618d8fd..2c922ff0551e 100644 --- a/dom/ipc/BrowserParent.cpp +++ b/dom/ipc/BrowserParent.cpp @@ -2771,8 +2771,6 @@ mozilla::ipc::IPCResult BrowserParent::RecvNotifyContentBlockingEvent( const Maybe< mozilla::ContentBlockingNotifier::StorageAccessPermissionGrantedReason>& aReason) { - MOZ_ASSERT(aRequestData.elapsedLoadTimeMS().isNothing()); - RefPtr bc = GetBrowsingContext(); if (!bc || bc->IsDiscarded()) { @@ -2793,7 +2791,7 @@ mozilla::ipc::IPCResult BrowserParent::RecvNotifyContentBlockingEvent( nsCOMPtr request = MakeAndAddRef( aRequestData.requestURI(), aRequestData.originalRequestURI(), - aRequestData.matchedList(), aRequestData.elapsedLoadTimeMS()); + aRequestData.matchedList()); wgp->NotifyContentBlockingEvent(aEvent, request, aBlocked, aTrackingOrigin, aTrackingFullHashes, aReason); @@ -2882,7 +2880,7 @@ void BrowserParent::ReconstructWebProgressAndRequest( if (aRequestData.requestURI()) { nsCOMPtr request = MakeAndAddRef( aRequestData.requestURI(), aRequestData.originalRequestURI(), - aRequestData.matchedList(), aRequestData.elapsedLoadTimeMS()); + aRequestData.matchedList()); request.forget(aOutRequest); } else { *aOutRequest = nullptr; diff --git a/dom/ipc/PBrowser.ipdl b/dom/ipc/PBrowser.ipdl index 949fc2963245..edede4fe533a 100644 --- a/dom/ipc/PBrowser.ipdl +++ b/dom/ipc/PBrowser.ipdl @@ -115,12 +115,6 @@ struct RequestData nsIURI requestURI; nsIURI originalRequestURI; nsCString matchedList; - // The elapsedLoadTimeMS is only set when the request has finished loading. - // In other words, this field is set only during and |OnStateChange| event - // where |aStateFlags| contains |nsIWebProgressListener::STATE_STOP| and - // |nsIWebProgressListener::STATE_IS_NETWORK| and - // |nsIWebProgressListener::STATE_IS_WINDOW|, and the document is top level. - uint64_t? elapsedLoadTimeMS; }; struct WebProgressStateChangeData diff --git a/dom/ipc/RemoteWebProgressRequest.cpp b/dom/ipc/RemoteWebProgressRequest.cpp index e295b735ae83..1f76f435a853 100644 --- a/dom/ipc/RemoteWebProgressRequest.cpp +++ b/dom/ipc/RemoteWebProgressRequest.cpp @@ -10,26 +10,7 @@ namespace mozilla { namespace dom { NS_IMPL_ISUPPORTS(RemoteWebProgressRequest, nsIRequest, nsIChannel, - nsIClassifiedChannel, nsIRemoteWebProgressRequest) - -NS_IMETHODIMP RemoteWebProgressRequest::Init(nsIURI* aURI, - nsIURI* aOriginalURI) { - mURI = aURI; - mOriginalURI = aOriginalURI; - - return NS_OK; -} - -NS_IMETHODIMP RemoteWebProgressRequest::GetElapsedLoadTimeMS( - uint64_t* aElapsedLoadTimeMS) { - NS_ENSURE_ARG_POINTER(aElapsedLoadTimeMS); - if (mMaybeElapsedLoadTimeMS) { - *aElapsedLoadTimeMS = *mMaybeElapsedLoadTimeMS; - return NS_OK; - } - *aElapsedLoadTimeMS = 0; - return NS_ERROR_NOT_AVAILABLE; -} + nsIClassifiedChannel) // nsIChannel methods diff --git a/dom/ipc/RemoteWebProgressRequest.h b/dom/ipc/RemoteWebProgressRequest.h index d0e192d60025..f583b71ec53f 100644 --- a/dom/ipc/RemoteWebProgressRequest.h +++ b/dom/ipc/RemoteWebProgressRequest.h @@ -7,31 +7,21 @@ #include "nsIChannel.h" #include "nsIClassifiedChannel.h" -#include "nsIRemoteWebProgressRequest.h" namespace mozilla { namespace dom { -class RemoteWebProgressRequest final : public nsIRemoteWebProgressRequest, - public nsIChannel, +class RemoteWebProgressRequest final : public nsIChannel, public nsIClassifiedChannel { public: NS_DECL_ISUPPORTS - NS_DECL_NSIREMOTEWEBPROGRESSREQUEST NS_DECL_NSICHANNEL NS_DECL_NSICLASSIFIEDCHANNEL NS_DECL_NSIREQUEST - RemoteWebProgressRequest() - : mURI(nullptr), mOriginalURI(nullptr), mMatchedList(VoidCString()) {} - RemoteWebProgressRequest(nsIURI* aURI, nsIURI* aOriginalURI, - const nsACString& aMatchedList, - const Maybe& aMaybeElapsedLoadTimeMS) - : mURI(aURI), - mOriginalURI(aOriginalURI), - mMatchedList(aMatchedList), - mMaybeElapsedLoadTimeMS(aMaybeElapsedLoadTimeMS) {} + const nsACString& aMatchedList) + : mURI(aURI), mOriginalURI(aOriginalURI), mMatchedList(aMatchedList) {} protected: ~RemoteWebProgressRequest() = default; @@ -40,13 +30,6 @@ class RemoteWebProgressRequest final : public nsIRemoteWebProgressRequest, nsCOMPtr mURI; nsCOMPtr mOriginalURI; nsCString mMatchedList; - - // This field is only Some(...) when the RemoteWebProgressRequest - // is created at a time that the document whose progress is being - // described by this request is top level and its status changes - // from loading to completely loaded. - // See BrowserChild::OnStateChange. - Maybe mMaybeElapsedLoadTimeMS; }; } // namespace dom diff --git a/dom/ipc/components.conf b/dom/ipc/components.conf index c1761dd97a0b..51a07ba081a0 100644 --- a/dom/ipc/components.conf +++ b/dom/ipc/components.conf @@ -10,11 +10,4 @@ Classes = [ 'type': 'mozilla::dom::RemoteWebProgress', 'headers': ['mozilla/dom/RemoteWebProgress.h'], }, - { - 'name': 'RemoteWebProgressRequest', - 'cid': 'eec2e27d-dc1d-4ab3-bed4-63536bd2a21e', - 'contract_ids': ['@mozilla.org/dom/remote-web-progress-request;1'], - 'type': 'mozilla::dom::RemoteWebProgressRequest', - 'headers': ['mozilla/dom/RemoteWebProgressRequest.h'], - }, ] diff --git a/dom/ipc/moz.build b/dom/ipc/moz.build index 21a2f68352fb..2022614bc280 100644 --- a/dom/ipc/moz.build +++ b/dom/ipc/moz.build @@ -12,7 +12,6 @@ XPIDL_SOURCES += [ 'nsIContentParent.idl', 'nsIHangReport.idl', 'nsIRemoteWebProgress.idl', - 'nsIRemoteWebProgressRequest.idl', ] XPIDL_MODULE = 'dom' diff --git a/dom/ipc/nsIRemoteWebProgressRequest.idl b/dom/ipc/nsIRemoteWebProgressRequest.idl deleted file mode 100644 index a5e5c98f3db8..000000000000 --- a/dom/ipc/nsIRemoteWebProgressRequest.idl +++ /dev/null @@ -1,20 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "nsISupports.idl" - -interface nsIURI; - -[scriptable, uuid(e14ff4c2-7e26-4748-8755-dfd074b9c746)] -interface nsIRemoteWebProgressRequest : nsISupports -{ - void init(in nsIURI aURI, in nsIURI aOriginalURI); - - // This field is available to users in |OnStateChange| methods only - // when the document whose progress is being described by this progress - // request is top level and its status has just changed from loading to - // completely loaded; for invocations of |OnStateChange| before or after - // that transition, this field will throw |NS_ERROR_UNAVAILABLE|. - readonly attribute uint64_t elapsedLoadTimeMS; -}; diff --git a/dom/ipc/tests/browser.ini b/dom/ipc/tests/browser.ini index aba377c4d095..aa602267641a 100644 --- a/dom/ipc/tests/browser.ini +++ b/dom/ipc/tests/browser.ini @@ -17,9 +17,6 @@ skip-if = !fission || !crashreporter || verify skip-if = true || !e10s # This is an e10s only probe, but the test is currently broken. See Bug 1449991 [browser_cancel_content_js.js] skip-if = !e10s -[browser_ElapsedTime.js] -support-files = elapsed_time.sjs -skip-if = (debug && os == "linux" && os_version == "18.04") || (!debug && os == "win") #Bug 1591344 [browser_bug1646088.js] support-files = file_dummy.html skip-if = !e10s diff --git a/dom/ipc/tests/browser_ElapsedTime.js b/dom/ipc/tests/browser_ElapsedTime.js deleted file mode 100644 index c4a1fbc9bfcf..000000000000 --- a/dom/ipc/tests/browser_ElapsedTime.js +++ /dev/null @@ -1,68 +0,0 @@ -"use strict"; - -/* - * Synchronize DELAY_MS with DELAY_MS from elapsed_time.sjs - */ -const DELAY_MS = 200; -const SLOW_PAGE = - getRootDirectory(gTestPath).replace( - "chrome://mochitests/content", - "https://example.com" - ) + "elapsed_time.sjs"; - -add_task(async function testLongElapsedTime() { - await BrowserTestUtils.withNewTab( - { gBrowser, url: "about:blank" }, - async function(tabBrowser) { - const flags = Ci.nsIWebProgress.NOTIFY_STATE_NETWORK; - let listener; - - let stateChangeWaiter = new Promise(resolve => { - listener = { - QueryInterface: ChromeUtils.generateQI([ - Ci.nsIWebProgressListener, - Ci.nsISupportsWeakReference, - ]), - - onStateChange(aWebProgress, aRequest, aStateFlags, aStatus) { - if (!aWebProgress.isTopLevel) { - return; - } - const isTopLevel = aWebProgress.isTopLevel; - const isStop = aStateFlags & Ci.nsIWebProgressListener.STATE_STOP; - const isNetwork = - aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK; - const isWindow = - aStateFlags & Ci.nsIWebProgressListener.STATE_IS_WINDOW; - const isLoadingDocument = aWebProgress.isLoadingDocument; - - if ( - isTopLevel && - isStop && - isWindow && - isNetwork && - !isLoadingDocument - ) { - aRequest.QueryInterface(Ci.nsIRemoteWebProgressRequest); - if (aRequest.elapsedLoadTimeMS >= DELAY_MS) { - resolve(true); - } - } - }, - }; - }); - tabBrowser.addProgressListener(listener, flags); - - BrowserTestUtils.loadURI(tabBrowser, SLOW_PAGE); - await BrowserTestUtils.browserLoaded(tabBrowser); - let pass = await stateChangeWaiter; - - tabBrowser.removeProgressListener(listener); - - ok( - pass, - "Bug 1559657: Check that the elapsedLoadTimeMS in RemoteWebProgress meets expectations." - ); - } - ); -}); diff --git a/dom/ipc/tests/elapsed_time.sjs b/dom/ipc/tests/elapsed_time.sjs deleted file mode 100644 index e5262af7b69f..000000000000 --- a/dom/ipc/tests/elapsed_time.sjs +++ /dev/null @@ -1,31 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -const DELAY_MS = 200; - -const HTML = ` - - - - - - -`; - -/* - * Keep timer as a global so that it is not GC'd - * between the time that handleRequest() completes - * and it expires. - */ -var timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); -function handleRequest(req, resp) { - resp.processAsync(); - resp.setHeader("Cache-Control", "no-cache", false); - resp.setHeader("Content-Type", "text/html;charset=utf-8", false); - - resp.write(HTML); - timer.init(() => { - resp.write(""); - resp.finish(); - }, DELAY_MS, Ci.nsITimer.TYPE_ONE_SHOT); -}