forked from mirrors/gecko-dev
Backed out changeset 8cc6f6f552a3 (bug 1772124) for causing failures at browser_103_preload.js. CLOSED TREE
This commit is contained in:
parent
b96601e6a0
commit
da2b7986d0
6 changed files with 6 additions and 57 deletions
|
|
@ -3,7 +3,7 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
console.log("hello");
|
|
||||||
/**
|
/**
|
||||||
* NetworkObserver is the main class in DevTools to observe network requests
|
* NetworkObserver is the main class in DevTools to observe network requests
|
||||||
* out of many events fired by the platform code.
|
* out of many events fired by the platform code.
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,6 @@
|
||||||
#include "mozilla/CORSMode.h"
|
#include "mozilla/CORSMode.h"
|
||||||
#include "mozilla/dom/Element.h"
|
#include "mozilla/dom/Element.h"
|
||||||
#include "mozilla/dom/ReferrerInfo.h"
|
#include "mozilla/dom/ReferrerInfo.h"
|
||||||
#include "mozilla/StaticPrefs_network.h"
|
|
||||||
#include "mozilla/glean/GleanMetrics.h"
|
|
||||||
#include "mozilla/Logging.h"
|
#include "mozilla/Logging.h"
|
||||||
#include "nsAttrValue.h"
|
#include "nsAttrValue.h"
|
||||||
#include "nsAttrValueInlines.h"
|
#include "nsAttrValueInlines.h"
|
||||||
|
|
@ -156,10 +154,6 @@ void EarlyHintPreloader::MaybeCreateAndInsertPreload(
|
||||||
|
|
||||||
nsAttrValue as;
|
nsAttrValue as;
|
||||||
ParseAsValue(aHeader.mAs, as);
|
ParseAsValue(aHeader.mAs, as);
|
||||||
|
|
||||||
ASDestination destination = static_cast<ASDestination>(as.GetEnumValue());
|
|
||||||
CollectResourcesTypeTelemetry(destination);
|
|
||||||
|
|
||||||
if (as.GetEnumValue() == ASDestination::DESTINATION_INVALID) {
|
if (as.GetEnumValue() == ASDestination::DESTINATION_INVALID) {
|
||||||
// return early when it's definitly not an asset type we preload
|
// return early when it's definitly not an asset type we preload
|
||||||
// would be caught later as well, e.g. when creating the PreloadHashKey
|
// would be caught later as well, e.g. when creating the PreloadHashKey
|
||||||
|
|
@ -384,20 +378,4 @@ EarlyHintPreloader::GetInterface(const nsIID& aIID, void** aResult) {
|
||||||
return NS_ERROR_NO_INTERFACE;
|
return NS_ERROR_NO_INTERFACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EarlyHintPreloader::CollectResourcesTypeTelemetry(
|
|
||||||
ASDestination aASDestination) {
|
|
||||||
if (aASDestination == ASDestination::DESTINATION_FONT) {
|
|
||||||
glean::netwerk::early_hints.Get("font"_ns).Add(1);
|
|
||||||
} else if (aASDestination == ASDestination::DESTINATION_SCRIPT) {
|
|
||||||
glean::netwerk::early_hints.Get("script"_ns).Add(1);
|
|
||||||
} else if (aASDestination == ASDestination::DESTINATION_STYLE) {
|
|
||||||
glean::netwerk::early_hints.Get("stylesheet"_ns).Add(1);
|
|
||||||
} else if (aASDestination == ASDestination::DESTINATION_IMAGE) {
|
|
||||||
glean::netwerk::early_hints.Get("image"_ns).Add(1);
|
|
||||||
} else if (aASDestination == ASDestination::DESTINATION_FETCH) {
|
|
||||||
glean::netwerk::early_hints.Get("fetch"_ns).Add(1);
|
|
||||||
} else {
|
|
||||||
glean::netwerk::early_hints.Get("other"_ns).Add(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // namespace mozilla::net
|
} // namespace mozilla::net
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,6 @@ class EarlyHintPreloader final : public nsIStreamListener,
|
||||||
nsIReferrerInfo* aReferrerInfo,
|
nsIReferrerInfo* aReferrerInfo,
|
||||||
nsICookieJarSettings* aCookieJarSettings);
|
nsICookieJarSettings* aCookieJarSettings);
|
||||||
|
|
||||||
static void CollectResourcesTypeTelemetry(ASDestination aASDestination);
|
|
||||||
// keep opening uri to not preload cross origins on redirects for now
|
// keep opening uri to not preload cross origins on redirects for now
|
||||||
nsCOMPtr<nsIURI> mURI;
|
nsCOMPtr<nsIURI> mURI;
|
||||||
nsCOMPtr<nsIChannel> mChannel;
|
nsCOMPtr<nsIChannel> mChannel;
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@
|
||||||
#include "nsICookieJarSettings.h"
|
#include "nsICookieJarSettings.h"
|
||||||
#include "nsNetUtil.h"
|
#include "nsNetUtil.h"
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
|
#include "mozilla/StaticPrefs_network.h"
|
||||||
#include "nsIPrincipal.h"
|
#include "nsIPrincipal.h"
|
||||||
#include "nsILoadInfo.h"
|
#include "nsILoadInfo.h"
|
||||||
|
|
||||||
|
|
@ -32,6 +33,10 @@ void EarlyHintsService::EarlyHint(const nsACString& aLinkHeader,
|
||||||
mFirstEarlyHint.emplace(TimeStamp::NowLoRes());
|
mFirstEarlyHint.emplace(TimeStamp::NowLoRes());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!StaticPrefs::network_early_hints_enabled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIPrincipal> triggeringPrincipal = aLoadInfo->TriggeringPrincipal();
|
nsCOMPtr<nsIPrincipal> triggeringPrincipal = aLoadInfo->TriggeringPrincipal();
|
||||||
|
|
||||||
nsCOMPtr<nsICookieJarSettings> cookieJarSettings;
|
nsCOMPtr<nsICookieJarSettings> cookieJarSettings;
|
||||||
|
|
|
||||||
|
|
@ -1,32 +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/.
|
|
||||||
|
|
||||||
# Adding a new metric? We have docs for that!
|
|
||||||
# https://firefox-source-docs.mozilla.org/toolkit/components/glean/user/new_definitions_file.html
|
|
||||||
|
|
||||||
---
|
|
||||||
$schema: moz://mozilla.org/schemas/glean/metrics/2-0-0
|
|
||||||
$tags:
|
|
||||||
- 'Core :: Networking: HTTP'
|
|
||||||
|
|
||||||
|
|
||||||
netwerk:
|
|
||||||
early_hints:
|
|
||||||
type: labeled_counter
|
|
||||||
labels:
|
|
||||||
- stylesheet
|
|
||||||
- fonts
|
|
||||||
- scripts
|
|
||||||
- fetch
|
|
||||||
- image
|
|
||||||
description: >
|
|
||||||
Counts the different type of resources that are sent for early hints.
|
|
||||||
bugs:
|
|
||||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1772124
|
|
||||||
data_reviews:
|
|
||||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1772124
|
|
||||||
notification_emails:
|
|
||||||
- necko@mozilla.com
|
|
||||||
- ddamjanovic@mozilla.com
|
|
||||||
expires: 109
|
|
||||||
|
|
@ -20,7 +20,6 @@ metrics_yamls = [
|
||||||
"dom/media/metrics.yaml",
|
"dom/media/metrics.yaml",
|
||||||
"dom/metrics.yaml",
|
"dom/metrics.yaml",
|
||||||
"gfx/metrics.yaml",
|
"gfx/metrics.yaml",
|
||||||
"netwerk/protocol/http/metrics.yaml",
|
|
||||||
"toolkit/components/extensions/metrics.yaml",
|
"toolkit/components/extensions/metrics.yaml",
|
||||||
"toolkit/components/glean/metrics.yaml",
|
"toolkit/components/glean/metrics.yaml",
|
||||||
"toolkit/components/glean/tests/test_metrics.yaml",
|
"toolkit/components/glean/tests/test_metrics.yaml",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue