mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-15 08:53:07 +09:00
Issue #2158 - Part 5: Guard preload links support with a preference
This is enabled by default.
This commit is contained in:
parent
95490b25eb
commit
6c53117699
4 changed files with 24 additions and 1 deletions
|
|
@ -295,6 +295,7 @@ bool nsContentUtils::sGettersDecodeURLHash = false;
|
|||
bool nsContentUtils::sPrivacyResistFingerprinting = false;
|
||||
bool nsContentUtils::sSendPerformanceTimingNotifications = false;
|
||||
bool nsContentUtils::sUseActivityCursor = false;
|
||||
bool nsContentUtils::sPreloadEnabled = true;
|
||||
|
||||
uint32_t nsContentUtils::sHandlingInputTimeout = 1000;
|
||||
|
||||
|
|
@ -633,6 +634,9 @@ nsContentUtils::Init()
|
|||
Preferences::AddBoolVarCache(&sUseActivityCursor,
|
||||
"ui.use_activity_cursor", false);
|
||||
|
||||
Preferences::AddBoolVarCache(&sPreloadEnabled,
|
||||
"network.preload", true);
|
||||
|
||||
Element::InitCCCallbacks();
|
||||
|
||||
nsCOMPtr<nsIUUIDGenerator> uuidGenerator =
|
||||
|
|
@ -4125,6 +4129,10 @@ void
|
|||
nsContentUtils::DispatchEventForPreloadURI(nsIDOMNode* aNode,
|
||||
nsContentPolicyType& aPolicyType)
|
||||
{
|
||||
if (!IsPreloadEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsINode> domNode = do_QueryInterface(aNode);
|
||||
if (domNode && domNode->IsInComposedDoc()) {
|
||||
bool success = aPolicyType != nsIContentPolicy::TYPE_INVALID;
|
||||
|
|
@ -7396,6 +7404,12 @@ nsContentUtils::GPCEnabled()
|
|||
return nsContentUtils::sGPCEnabled;
|
||||
}
|
||||
|
||||
bool
|
||||
nsContentUtils::IsPreloadEnabled()
|
||||
{
|
||||
return nsContentUtils::sPreloadEnabled;
|
||||
}
|
||||
|
||||
mozilla::LogModule*
|
||||
nsContentUtils::DOMDumpLog()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2149,6 +2149,11 @@ public:
|
|||
return sUseActivityCursor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the preload service is enabled.
|
||||
*/
|
||||
static bool IsPreloadEnabled();
|
||||
|
||||
/**
|
||||
* Return true if this doc is controlled by a ServiceWorker.
|
||||
*/
|
||||
|
|
@ -2969,6 +2974,7 @@ private:
|
|||
static bool sPrivacyResistFingerprinting;
|
||||
static bool sSendPerformanceTimingNotifications;
|
||||
static bool sUseActivityCursor;
|
||||
static bool sPreloadEnabled;
|
||||
static uint32_t sCookiesLifetimePolicy;
|
||||
static uint32_t sCookiesBehavior;
|
||||
|
||||
|
|
|
|||
|
|
@ -1906,6 +1906,9 @@ pref("network.ftp.idleConnectionTimeout", 300);
|
|||
// all other values are treated like 2
|
||||
pref("network.dir.format", 2);
|
||||
|
||||
// enables the preload service (i.e., preloading of <link rel="preload"> URLs).
|
||||
pref("network.preload", true);
|
||||
|
||||
// enables the prefetch service (i.e., prefetching of <link rel="next"> URLs).
|
||||
pref("network.prefetch-next", true);
|
||||
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ nsHtml5TreeBuilder::createElement(int32_t aNamespace,
|
|||
mSpeculativeLoadQueue.AppendElement()->InitPreconnect(
|
||||
url, crossOrigin);
|
||||
}
|
||||
} else if (rel.LowerCaseEqualsASCII("preload")) {
|
||||
} else if (rel.LowerCaseEqualsASCII("preload") && nsContentUtils::IsPreloadEnabled()) {
|
||||
nsHtml5String url =
|
||||
aAttributes->getValue(nsHtml5AttributeName::ATTR_HREF);
|
||||
if (url) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue