зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1646582 - Remove nsIRemoteWebProgressRequest since it's not being used anywhere. r=barret
Differential Revision: https://phabricator.services.mozilla.com/D80127
This commit is contained in:
Родитель
69d6f854ee
Коммит
6924cb49df
|
@ -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<nsDOMNavigationTiming> navigationTiming =
|
||||
document->GetNavigationTiming();
|
||||
if (navigationTiming) {
|
||||
TimeDuration elapsedLoadTimeMS =
|
||||
TimeStamp::Now() - navigationTiming->GetNavigationStartTimeStamp();
|
||||
requestData.elapsedLoadTimeMS() =
|
||||
Some(elapsedLoadTimeMS.ToMilliseconds());
|
||||
}
|
||||
}
|
||||
|
||||
if (webProgressData->isTopLevel()) {
|
||||
stateChangeData.emplace();
|
||||
|
||||
|
|
|
@ -2771,8 +2771,6 @@ mozilla::ipc::IPCResult BrowserParent::RecvNotifyContentBlockingEvent(
|
|||
const Maybe<
|
||||
mozilla::ContentBlockingNotifier::StorageAccessPermissionGrantedReason>&
|
||||
aReason) {
|
||||
MOZ_ASSERT(aRequestData.elapsedLoadTimeMS().isNothing());
|
||||
|
||||
RefPtr<BrowsingContext> bc = GetBrowsingContext();
|
||||
|
||||
if (!bc || bc->IsDiscarded()) {
|
||||
|
@ -2793,7 +2791,7 @@ mozilla::ipc::IPCResult BrowserParent::RecvNotifyContentBlockingEvent(
|
|||
|
||||
nsCOMPtr<nsIRequest> request = MakeAndAddRef<RemoteWebProgressRequest>(
|
||||
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<nsIRequest> request = MakeAndAddRef<RemoteWebProgressRequest>(
|
||||
aRequestData.requestURI(), aRequestData.originalRequestURI(),
|
||||
aRequestData.matchedList(), aRequestData.elapsedLoadTimeMS());
|
||||
aRequestData.matchedList());
|
||||
request.forget(aOutRequest);
|
||||
} else {
|
||||
*aOutRequest = nullptr;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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<uint64_t>& 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<nsIURI> mURI;
|
||||
nsCOMPtr<nsIURI> 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<uint64_t> mMaybeElapsedLoadTimeMS;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -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'],
|
||||
},
|
||||
]
|
||||
|
|
|
@ -12,7 +12,6 @@ XPIDL_SOURCES += [
|
|||
'nsIContentParent.idl',
|
||||
'nsIHangReport.idl',
|
||||
'nsIRemoteWebProgress.idl',
|
||||
'nsIRemoteWebProgressRequest.idl',
|
||||
]
|
||||
|
||||
XPIDL_MODULE = 'dom'
|
||||
|
|
|
@ -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;
|
||||
};
|
|
@ -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
|
||||
|
|
|
@ -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."
|
||||
);
|
||||
}
|
||||
);
|
||||
});
|
|
@ -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 = `<!DOCTYPE HTML>
|
||||
<html dir="ltr" xml:lang="en-US" lang="en-US">
|
||||
<head>
|
||||
<meta charset="utf8">
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</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);
|
||||
}
|
Загрузка…
Ссылка в новой задаче