Bug 1825882 - Remove (now) unused ChannelWrapper::IsSystemLoad r=rpl

Differential Revision: https://phabricator.services.mozilla.com/D174509
This commit is contained in:
Rob Wu 2024-08-06 21:49:17 +00:00
Родитель bd5d0e5ff6
Коммит 8dd6308e21
4 изменённых файлов: 3 добавлений и 32 удалений

Просмотреть файл

@ -283,13 +283,6 @@ interface ChannelWrapper : EventTarget {
[Cached, Pure]
readonly attribute boolean isServiceWorkerScript;
/**
* True if this load was triggered by a system caller. This currently always
* false if the request has no LoadInfo or is a top-level document load.
*/
[Cached, Pure]
readonly attribute boolean isSystemLoad;
/**
* The URL of the principal that triggered this load. This is equivalent to
* the LoadInfo's triggeringPrincipal, and will only ever be null for
@ -322,8 +315,8 @@ interface ChannelWrapper : EventTarget {
/**
* True if extensions may modify this request. This is currently false only
* if the request belongs to a document which has access to the
* mozAddonManager API.
* if this load was triggered by a system caller, from a restricted domain
* and/or a document that has access to the mozAddonManager API.
*/
[Cached, GetterThrows, Pure]
readonly attribute boolean canModify;

Просмотреть файл

@ -45,7 +45,6 @@ const EXPECTATION_BASIC_FETCH = {
remoteAddress: null, // Not set at start of request
loadInfo: EXPECT_TRUTHY,
isServiceWorkerScript: false,
isSystemLoad: false, // To be removed in bug 1825882.
originURL: "http://origin.example.net/home",
documentURL: "http://origin.example.net/home",
originURI: EXPECT_TRUTHY,
@ -103,7 +102,6 @@ const EXPECTATION_INVALID_CHANNEL = {
remoteAddress: null,
loadInfo: null,
isServiceWorkerScript: false,
isSystemLoad: false, // To be removed in bug 1825882.
originURL: "",
documentURL: "",
originURI: null,

Просмотреть файл

@ -511,24 +511,6 @@ bool ChannelWrapper::IsServiceWorkerScript(const nsCOMPtr<nsIChannel>& chan) {
return false;
}
static inline bool IsSystemPrincipal(nsIPrincipal* aPrincipal) {
return BasePrincipal::Cast(aPrincipal)->Is<SystemPrincipal>();
}
bool ChannelWrapper::IsSystemLoad() const {
if (nsCOMPtr<nsILoadInfo> loadInfo = GetLoadInfo()) {
if (nsIPrincipal* prin = loadInfo->GetLoadingPrincipal()) {
return IsSystemPrincipal(prin);
}
// loadingPrincipal is only non-null for top-level loads.
// In practice we would never encounter a system principal for a top-level
// load that passes through ChannelWrapper, at least not for HTTP channels.
MOZ_ASSERT(Type() == MozContentPolicyType::Main_frame);
}
return false;
}
bool ChannelWrapper::CanModify() const {
if (!HaveChannel()) {
return false;
@ -539,7 +521,7 @@ bool ChannelWrapper::CanModify() const {
if (nsCOMPtr<nsILoadInfo> loadInfo = GetLoadInfo()) {
if (nsIPrincipal* prin = loadInfo->GetLoadingPrincipal()) {
if (IsSystemPrincipal(prin)) {
if (prin->IsSystemPrincipal()) {
return false;
}

Просмотреть файл

@ -206,8 +206,6 @@ class ChannelWrapper final : public DOMEventTargetHelper,
static bool IsServiceWorkerScript(const nsCOMPtr<nsIChannel>& aChannel);
bool IsSystemLoad() const;
void GetOriginURL(nsCString& aRetVal) const;
void GetDocumentURL(nsCString& aRetVal) const;