зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1688925 - Move nsHTMLDNSPrefetch to the mozilla::dom namespace. r=smaug,edgar
Differential Revision: https://phabricator.services.mozilla.com/D103060
This commit is contained in:
Родитель
a77cdd404d
Коммит
20752f9efd
|
@ -9,6 +9,7 @@
|
||||||
#include "mozilla/EventStates.h"
|
#include "mozilla/EventStates.h"
|
||||||
#include "mozilla/MemoryReporting.h"
|
#include "mozilla/MemoryReporting.h"
|
||||||
#include "mozilla/dom/Element.h"
|
#include "mozilla/dom/Element.h"
|
||||||
|
#include "mozilla/dom/HTMLDNSPrefetch.h"
|
||||||
#include "mozilla/IHistory.h"
|
#include "mozilla/IHistory.h"
|
||||||
#include "mozilla/StaticPrefs_layout.h"
|
#include "mozilla/StaticPrefs_layout.h"
|
||||||
#include "nsLayoutUtils.h"
|
#include "nsLayoutUtils.h"
|
||||||
|
@ -18,7 +19,6 @@
|
||||||
|
|
||||||
#include "nsEscape.h"
|
#include "nsEscape.h"
|
||||||
#include "nsGkAtoms.h"
|
#include "nsGkAtoms.h"
|
||||||
#include "nsHTMLDNSPrefetch.h"
|
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "mozAutoDocUpdate.h"
|
#include "mozAutoDocUpdate.h"
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ Link::~Link() {
|
||||||
// !mElement is for mock_Link.
|
// !mElement is for mock_Link.
|
||||||
MOZ_ASSERT(!mElement || !mElement->IsInComposedDoc());
|
MOZ_ASSERT(!mElement || !mElement->IsInComposedDoc());
|
||||||
if (IsInDNSPrefetch()) {
|
if (IsInDNSPrefetch()) {
|
||||||
nsHTMLDNSPrefetch::LinkDestroyed(this);
|
HTMLDNSPrefetch::LinkDestroyed(this);
|
||||||
}
|
}
|
||||||
UnregisterFromHistory();
|
UnregisterFromHistory();
|
||||||
}
|
}
|
||||||
|
@ -65,8 +65,8 @@ bool Link::ElementHasHref() const {
|
||||||
|
|
||||||
void Link::TryDNSPrefetch() {
|
void Link::TryDNSPrefetch() {
|
||||||
MOZ_ASSERT(mElement->IsInComposedDoc());
|
MOZ_ASSERT(mElement->IsInComposedDoc());
|
||||||
if (ElementHasHref() && nsHTMLDNSPrefetch::IsAllowed(mElement->OwnerDoc())) {
|
if (ElementHasHref() && HTMLDNSPrefetch::IsAllowed(mElement->OwnerDoc())) {
|
||||||
nsHTMLDNSPrefetch::Prefetch(this, nsHTMLDNSPrefetch::Priority::Low);
|
HTMLDNSPrefetch::Prefetch(this, HTMLDNSPrefetch::Priority::Low);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ void Link::CancelDNSPrefetch(nsWrapperCache::FlagsType aDeferredFlag,
|
||||||
mElement->UnsetFlags(aRequestedFlag);
|
mElement->UnsetFlags(aRequestedFlag);
|
||||||
// Possible that hostname could have changed since binding, but since this
|
// Possible that hostname could have changed since binding, but since this
|
||||||
// covers common cases, most DNS prefetch requests will be canceled
|
// covers common cases, most DNS prefetch requests will be canceled
|
||||||
nsHTMLDNSPrefetch::CancelPrefetch(this, nsHTMLDNSPrefetch::Priority::Low,
|
HTMLDNSPrefetch::CancelPrefetch(this, HTMLDNSPrefetch::Priority::Low,
|
||||||
NS_ERROR_ABORT);
|
NS_ERROR_ABORT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,9 +47,9 @@
|
||||||
#include "mozAutoDocUpdate.h"
|
#include "mozAutoDocUpdate.h"
|
||||||
#include "nsIWebNavigation.h"
|
#include "nsIWebNavigation.h"
|
||||||
#include "nsGenericHTMLElement.h"
|
#include "nsGenericHTMLElement.h"
|
||||||
#include "nsHTMLDNSPrefetch.h"
|
|
||||||
#include "nsIObserverService.h"
|
#include "nsIObserverService.h"
|
||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
|
#include "mozilla/dom/HTMLDNSPrefetch.h"
|
||||||
#include "mozilla/dom/ServiceWorkerDescriptor.h"
|
#include "mozilla/dom/ServiceWorkerDescriptor.h"
|
||||||
#include "mozilla/dom/ScriptLoader.h"
|
#include "mozilla/dom/ScriptLoader.h"
|
||||||
#include "nsParserConstants.h"
|
#include "nsParserConstants.h"
|
||||||
|
@ -799,13 +799,13 @@ void nsContentSink::PrefetchDNS(const nsAString& aHref) {
|
||||||
isHttps = uri->SchemeIs("https");
|
isHttps = uri->SchemeIs("https");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hostname.IsEmpty() && nsHTMLDNSPrefetch::IsAllowed(mDocument)) {
|
if (!hostname.IsEmpty() && HTMLDNSPrefetch::IsAllowed(mDocument)) {
|
||||||
OriginAttributes oa;
|
OriginAttributes oa;
|
||||||
StoragePrincipalHelper::GetOriginAttributesForNetworkState(mDocument, oa);
|
StoragePrincipalHelper::GetOriginAttributesForNetworkState(mDocument, oa);
|
||||||
|
|
||||||
nsHTMLDNSPrefetch::Prefetch(hostname, isHttps, oa,
|
HTMLDNSPrefetch::Prefetch(hostname, isHttps, oa,
|
||||||
mDocument->GetChannel()->GetTRRMode(),
|
mDocument->GetChannel()->GetTRRMode(),
|
||||||
nsHTMLDNSPrefetch::Priority::Low);
|
HTMLDNSPrefetch::Priority::Low);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,13 +8,13 @@
|
||||||
|
|
||||||
#include "mozilla/dom/BindContext.h"
|
#include "mozilla/dom/BindContext.h"
|
||||||
#include "mozilla/dom/HTMLAnchorElementBinding.h"
|
#include "mozilla/dom/HTMLAnchorElementBinding.h"
|
||||||
|
#include "mozilla/dom/HTMLDNSPrefetch.h"
|
||||||
#include "mozilla/EventDispatcher.h"
|
#include "mozilla/EventDispatcher.h"
|
||||||
#include "mozilla/EventStates.h"
|
#include "mozilla/EventStates.h"
|
||||||
#include "mozilla/MemoryReporting.h"
|
#include "mozilla/MemoryReporting.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
#include "nsGkAtoms.h"
|
#include "nsGkAtoms.h"
|
||||||
#include "nsHTMLDNSPrefetch.h"
|
|
||||||
#include "nsAttrValueOrString.h"
|
#include "nsAttrValueOrString.h"
|
||||||
#include "mozilla/dom/Document.h"
|
#include "mozilla/dom/Document.h"
|
||||||
#include "nsPresContext.h"
|
#include "nsPresContext.h"
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "nsHTMLDNSPrefetch.h"
|
#include "HTMLDNSPrefetch.h"
|
||||||
|
|
||||||
#include "base/basictypes.h"
|
#include "base/basictypes.h"
|
||||||
#include "mozilla/dom/Element.h"
|
#include "mozilla/dom/Element.h"
|
||||||
|
@ -38,10 +38,11 @@
|
||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
#include "mozilla/StaticPrefs_network.h"
|
#include "mozilla/StaticPrefs_network.h"
|
||||||
|
|
||||||
using namespace mozilla;
|
|
||||||
using namespace mozilla::dom;
|
|
||||||
using namespace mozilla::net;
|
using namespace mozilla::net;
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
namespace dom {
|
||||||
|
|
||||||
class NoOpDNSListener final : public nsIDNSListener {
|
class NoOpDNSListener final : public nsIDNSListener {
|
||||||
// This class exists to give a safe callback no-op DNSListener
|
// This class exists to give a safe callback no-op DNSListener
|
||||||
public:
|
public:
|
||||||
|
@ -107,7 +108,7 @@ static nsIDNSService* sDNSService = nullptr;
|
||||||
static DeferredDNSPrefetches* sPrefetches = nullptr;
|
static DeferredDNSPrefetches* sPrefetches = nullptr;
|
||||||
static NoOpDNSListener* sDNSListener = nullptr;
|
static NoOpDNSListener* sDNSListener = nullptr;
|
||||||
|
|
||||||
nsresult nsHTMLDNSPrefetch::Initialize() {
|
nsresult HTMLDNSPrefetch::Initialize() {
|
||||||
if (sInitialized) {
|
if (sInitialized) {
|
||||||
NS_WARNING("Initialize() called twice");
|
NS_WARNING("Initialize() called twice");
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -127,7 +128,7 @@ nsresult nsHTMLDNSPrefetch::Initialize() {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsHTMLDNSPrefetch::Shutdown() {
|
nsresult HTMLDNSPrefetch::Shutdown() {
|
||||||
if (!sInitialized) {
|
if (!sInitialized) {
|
||||||
NS_WARNING("Not Initialized");
|
NS_WARNING("Not Initialized");
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -155,7 +156,7 @@ static bool EnsureDNSService() {
|
||||||
return !!sDNSService;
|
return !!sDNSService;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nsHTMLDNSPrefetch::IsAllowed(Document* aDocument) {
|
bool HTMLDNSPrefetch::IsAllowed(Document* aDocument) {
|
||||||
// There is no need to do prefetch on non UI scenarios such as XMLHttpRequest.
|
// There is no need to do prefetch on non UI scenarios such as XMLHttpRequest.
|
||||||
return aDocument->IsDNSPrefetchAllowed() && aDocument->GetWindow();
|
return aDocument->IsDNSPrefetchAllowed() && aDocument->GetWindow();
|
||||||
}
|
}
|
||||||
|
@ -170,7 +171,7 @@ static uint32_t GetDNSFlagsFromLink(Link* aElement) {
|
||||||
return nsIDNSService::GetFlagsFromTRRMode(mode);
|
return nsIDNSService::GetFlagsFromTRRMode(mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nsHTMLDNSPrefetch::PriorityToDNSServiceFlags(Priority aPriority) {
|
uint32_t HTMLDNSPrefetch::PriorityToDNSServiceFlags(Priority aPriority) {
|
||||||
switch (aPriority) {
|
switch (aPriority) {
|
||||||
case Priority::Low:
|
case Priority::Low:
|
||||||
return uint32_t(nsIDNSService::RESOLVE_PRIORITY_LOW);
|
return uint32_t(nsIDNSService::RESOLVE_PRIORITY_LOW);
|
||||||
|
@ -183,7 +184,7 @@ uint32_t nsHTMLDNSPrefetch::PriorityToDNSServiceFlags(Priority aPriority) {
|
||||||
return 0u;
|
return 0u;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsHTMLDNSPrefetch::Prefetch(Link* aElement, Priority aPriority) {
|
nsresult HTMLDNSPrefetch::Prefetch(Link* aElement, Priority aPriority) {
|
||||||
if (!(sInitialized && sPrefetches && sDNSListener) || !EnsureDNSService()) {
|
if (!(sInitialized && sPrefetches && sDNSListener) || !EnsureDNSService()) {
|
||||||
return NS_ERROR_NOT_AVAILABLE;
|
return NS_ERROR_NOT_AVAILABLE;
|
||||||
}
|
}
|
||||||
|
@ -192,7 +193,7 @@ nsresult nsHTMLDNSPrefetch::Prefetch(Link* aElement, Priority aPriority) {
|
||||||
aElement);
|
aElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsHTMLDNSPrefetch::Prefetch(
|
nsresult HTMLDNSPrefetch::Prefetch(
|
||||||
const nsAString& hostname, bool isHttps,
|
const nsAString& hostname, bool isHttps,
|
||||||
const OriginAttributes& aPartitionedPrincipalOriginAttributes,
|
const OriginAttributes& aPartitionedPrincipalOriginAttributes,
|
||||||
uint32_t flags) {
|
uint32_t flags) {
|
||||||
|
@ -235,7 +236,7 @@ nsresult nsHTMLDNSPrefetch::Prefetch(
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsHTMLDNSPrefetch::Prefetch(
|
nsresult HTMLDNSPrefetch::Prefetch(
|
||||||
const nsAString& hostname, bool isHttps,
|
const nsAString& hostname, bool isHttps,
|
||||||
const OriginAttributes& aPartitionedPrincipalOriginAttributes,
|
const OriginAttributes& aPartitionedPrincipalOriginAttributes,
|
||||||
nsIRequest::TRRMode aMode, Priority aPriority) {
|
nsIRequest::TRRMode aMode, Priority aPriority) {
|
||||||
|
@ -244,7 +245,7 @@ nsresult nsHTMLDNSPrefetch::Prefetch(
|
||||||
PriorityToDNSServiceFlags(aPriority));
|
PriorityToDNSServiceFlags(aPriority));
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsHTMLDNSPrefetch::CancelPrefetch(Link* aElement, Priority aPriority,
|
nsresult HTMLDNSPrefetch::CancelPrefetch(Link* aElement, Priority aPriority,
|
||||||
nsresult aReason) {
|
nsresult aReason) {
|
||||||
if (!(sInitialized && sPrefetches && sDNSListener) || !EnsureDNSService()) {
|
if (!(sInitialized && sPrefetches && sDNSListener) || !EnsureDNSService()) {
|
||||||
return NS_ERROR_NOT_AVAILABLE;
|
return NS_ERROR_NOT_AVAILABLE;
|
||||||
|
@ -273,7 +274,7 @@ nsresult nsHTMLDNSPrefetch::CancelPrefetch(Link* aElement, Priority aPriority,
|
||||||
return CancelPrefetch(hostname, isHttps, oa, flags, aReason);
|
return CancelPrefetch(hostname, isHttps, oa, flags, aReason);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsHTMLDNSPrefetch::CancelPrefetch(
|
nsresult HTMLDNSPrefetch::CancelPrefetch(
|
||||||
const nsAString& hostname, bool isHttps,
|
const nsAString& hostname, bool isHttps,
|
||||||
const OriginAttributes& aPartitionedPrincipalOriginAttributes,
|
const OriginAttributes& aPartitionedPrincipalOriginAttributes,
|
||||||
uint32_t flags, nsresult aReason) {
|
uint32_t flags, nsresult aReason) {
|
||||||
|
@ -314,7 +315,7 @@ nsresult nsHTMLDNSPrefetch::CancelPrefetch(
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsHTMLDNSPrefetch::CancelPrefetch(
|
nsresult HTMLDNSPrefetch::CancelPrefetch(
|
||||||
const nsAString& hostname, bool isHttps,
|
const nsAString& hostname, bool isHttps,
|
||||||
const OriginAttributes& aPartitionedPrincipalOriginAttributes,
|
const OriginAttributes& aPartitionedPrincipalOriginAttributes,
|
||||||
nsIRequest::TRRMode aTRRMode, Priority aPriority, nsresult aReason) {
|
nsIRequest::TRRMode aTRRMode, Priority aPriority, nsresult aReason) {
|
||||||
|
@ -325,7 +326,7 @@ nsresult nsHTMLDNSPrefetch::CancelPrefetch(
|
||||||
aReason);
|
aReason);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsHTMLDNSPrefetch::LinkDestroyed(Link* aLink) {
|
void HTMLDNSPrefetch::LinkDestroyed(Link* aLink) {
|
||||||
MOZ_ASSERT(aLink->IsInDNSPrefetch());
|
MOZ_ASSERT(aLink->IsInDNSPrefetch());
|
||||||
if (sPrefetches) {
|
if (sPrefetches) {
|
||||||
// Clean up all the possible links at once.
|
// Clean up all the possible links at once.
|
||||||
|
@ -379,7 +380,7 @@ nsresult DeferredDNSPrefetches::Add(uint32_t flags, Link* aElement) {
|
||||||
mTimerArmed = true;
|
mTimerArmed = true;
|
||||||
mTimer->InitWithNamedFuncCallback(
|
mTimer->InitWithNamedFuncCallback(
|
||||||
Tick, this, 2000, nsITimer::TYPE_ONE_SHOT,
|
Tick, this, 2000, nsITimer::TYPE_ONE_SHOT,
|
||||||
"nsHTMLDNSPrefetch::DeferredDNSPrefetches::Tick");
|
"HTMLDNSPrefetch::DeferredDNSPrefetches::Tick");
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -577,3 +578,6 @@ DeferredDNSPrefetches::Observe(nsISupports* subject, const char* topic,
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace dom
|
||||||
|
} // namespace mozilla
|
|
@ -4,35 +4,32 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#ifndef nsHTMLDNSPrefetch_h___
|
#ifndef mozilla_dom_HTMLDNSPrefetch_h___
|
||||||
#define nsHTMLDNSPrefetch_h___
|
#define mozilla_dom_HTMLDNSPrefetch_h___
|
||||||
|
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsIRequest.h"
|
#include "nsIRequest.h"
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "nsWeakReference.h"
|
|
||||||
|
|
||||||
class nsITimer;
|
class nsITimer;
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
class OriginAttributes;
|
class OriginAttributes;
|
||||||
|
|
||||||
namespace dom {
|
|
||||||
class Document;
|
|
||||||
class Link;
|
|
||||||
} // namespace dom
|
|
||||||
|
|
||||||
namespace net {
|
namespace net {
|
||||||
class NeckoParent;
|
class NeckoParent;
|
||||||
} // namespace net
|
} // namespace net
|
||||||
} // namespace mozilla
|
|
||||||
|
|
||||||
class nsHTMLDNSPrefetch {
|
namespace dom {
|
||||||
|
class Document;
|
||||||
|
class Link;
|
||||||
|
|
||||||
|
class HTMLDNSPrefetch {
|
||||||
public:
|
public:
|
||||||
// The required aDocument parameter is the context requesting the prefetch -
|
// The required aDocument parameter is the context requesting the prefetch -
|
||||||
// under certain circumstances (e.g. headers, or security context) associated
|
// under certain circumstances (e.g. headers, or security context) associated
|
||||||
// with the context the prefetch will not be performed.
|
// with the context the prefetch will not be performed.
|
||||||
static bool IsAllowed(mozilla::dom::Document* aDocument);
|
static bool IsAllowed(Document* aDocument);
|
||||||
|
|
||||||
static nsresult Initialize();
|
static nsresult Initialize();
|
||||||
static nsresult Shutdown();
|
static nsresult Shutdown();
|
||||||
|
@ -54,33 +51,35 @@ class nsHTMLDNSPrefetch {
|
||||||
Medium,
|
Medium,
|
||||||
High,
|
High,
|
||||||
};
|
};
|
||||||
static nsresult Prefetch(mozilla::dom::Link* aElement, Priority);
|
static nsresult Prefetch(Link* aElement, Priority);
|
||||||
static nsresult Prefetch(
|
static nsresult Prefetch(
|
||||||
const nsAString& host, bool isHttps,
|
const nsAString& host, bool isHttps,
|
||||||
const mozilla::OriginAttributes& aPartitionedPrincipalOriginAttributes,
|
const OriginAttributes& aPartitionedPrincipalOriginAttributes,
|
||||||
nsIRequest::TRRMode aTRRMode, Priority);
|
nsIRequest::TRRMode aTRRMode, Priority);
|
||||||
static nsresult CancelPrefetch(
|
static nsresult CancelPrefetch(
|
||||||
const nsAString& host, bool isHttps,
|
const nsAString& host, bool isHttps,
|
||||||
const mozilla::OriginAttributes& aPartitionedPrincipalOriginAttributes,
|
const OriginAttributes& aPartitionedPrincipalOriginAttributes,
|
||||||
nsIRequest::TRRMode aTRRMode, Priority, nsresult aReason);
|
nsIRequest::TRRMode aTRRMode, Priority, nsresult aReason);
|
||||||
static nsresult CancelPrefetch(mozilla::dom::Link* aElement,
|
static nsresult CancelPrefetch(Link* aElement, Priority, nsresult aReason);
|
||||||
Priority, nsresult aReason);
|
|
||||||
|
|
||||||
static void LinkDestroyed(mozilla::dom::Link* aLink);
|
static void LinkDestroyed(Link* aLink);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static uint32_t PriorityToDNSServiceFlags(Priority);
|
static uint32_t PriorityToDNSServiceFlags(Priority);
|
||||||
|
|
||||||
static nsresult Prefetch(
|
static nsresult Prefetch(
|
||||||
const nsAString& host, bool isHttps,
|
const nsAString& host, bool isHttps,
|
||||||
const mozilla::OriginAttributes& aPartitionedPrincipalOriginAttributes,
|
const OriginAttributes& aPartitionedPrincipalOriginAttributes,
|
||||||
uint32_t flags);
|
uint32_t flags);
|
||||||
static nsresult CancelPrefetch(
|
static nsresult CancelPrefetch(
|
||||||
const nsAString& hostname, bool isHttps,
|
const nsAString& hostname, bool isHttps,
|
||||||
const mozilla::OriginAttributes& aPartitionedPrincipalOriginAttributes,
|
const OriginAttributes& aPartitionedPrincipalOriginAttributes,
|
||||||
uint32_t flags, nsresult aReason);
|
uint32_t flags, nsresult aReason);
|
||||||
|
|
||||||
friend class mozilla::net::NeckoParent;
|
friend class net::NeckoParent;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace dom
|
||||||
|
} // namespace mozilla
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -13,15 +13,16 @@
|
||||||
#include "mozilla/EventStates.h"
|
#include "mozilla/EventStates.h"
|
||||||
#include "mozilla/MemoryReporting.h"
|
#include "mozilla/MemoryReporting.h"
|
||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
|
#include "mozilla/StaticPrefs_dom.h"
|
||||||
#include "mozilla/StaticPrefs_network.h"
|
#include "mozilla/StaticPrefs_network.h"
|
||||||
#include "mozilla/dom/BindContext.h"
|
#include "mozilla/dom/BindContext.h"
|
||||||
#include "mozilla/dom/DocumentInlines.h"
|
#include "mozilla/dom/DocumentInlines.h"
|
||||||
#include "mozilla/dom/HTMLLinkElementBinding.h"
|
#include "mozilla/dom/HTMLLinkElementBinding.h"
|
||||||
|
#include "mozilla/dom/HTMLDNSPrefetch.h"
|
||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
#include "nsDOMTokenList.h"
|
#include "nsDOMTokenList.h"
|
||||||
#include "nsGenericHTMLElement.h"
|
#include "nsGenericHTMLElement.h"
|
||||||
#include "nsGkAtoms.h"
|
#include "nsGkAtoms.h"
|
||||||
#include "nsHTMLDNSPrefetch.h"
|
|
||||||
#include "nsIContentInlines.h"
|
#include "nsIContentInlines.h"
|
||||||
#include "mozilla/dom/Document.h"
|
#include "mozilla/dom/Document.h"
|
||||||
#include "nsINode.h"
|
#include "nsINode.h"
|
||||||
|
@ -637,8 +638,8 @@ void HTMLLinkElement::
|
||||||
}
|
}
|
||||||
|
|
||||||
if (linkTypes & eDNS_PREFETCH) {
|
if (linkTypes & eDNS_PREFETCH) {
|
||||||
if (nsHTMLDNSPrefetch::IsAllowed(OwnerDoc())) {
|
if (HTMLDNSPrefetch::IsAllowed(OwnerDoc())) {
|
||||||
nsHTMLDNSPrefetch::Prefetch(this, nsHTMLDNSPrefetch::Priority::Low);
|
HTMLDNSPrefetch::Prefetch(this, HTMLDNSPrefetch::Priority::Low);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,6 @@ XPIDL_MODULE = "content_html"
|
||||||
EXPORTS += [
|
EXPORTS += [
|
||||||
"nsGenericHTMLElement.h",
|
"nsGenericHTMLElement.h",
|
||||||
"nsGenericHTMLFrameElement.h",
|
"nsGenericHTMLFrameElement.h",
|
||||||
"nsHTMLDNSPrefetch.h",
|
|
||||||
"nsHTMLDocument.h",
|
"nsHTMLDocument.h",
|
||||||
"nsIConstraintValidation.h",
|
"nsIConstraintValidation.h",
|
||||||
"nsIForm.h",
|
"nsIForm.h",
|
||||||
|
@ -63,6 +62,7 @@ EXPORTS.mozilla.dom += [
|
||||||
"HTMLDetailsElement.h",
|
"HTMLDetailsElement.h",
|
||||||
"HTMLDialogElement.h",
|
"HTMLDialogElement.h",
|
||||||
"HTMLDivElement.h",
|
"HTMLDivElement.h",
|
||||||
|
"HTMLDNSPrefetch.h",
|
||||||
"HTMLEmbedElement.h",
|
"HTMLEmbedElement.h",
|
||||||
"HTMLFieldSetElement.h",
|
"HTMLFieldSetElement.h",
|
||||||
"HTMLFontElement.h",
|
"HTMLFontElement.h",
|
||||||
|
@ -144,6 +144,7 @@ UNIFIED_SOURCES += [
|
||||||
"HTMLDetailsElement.cpp",
|
"HTMLDetailsElement.cpp",
|
||||||
"HTMLDialogElement.cpp",
|
"HTMLDialogElement.cpp",
|
||||||
"HTMLDivElement.cpp",
|
"HTMLDivElement.cpp",
|
||||||
|
"HTMLDNSPrefetch.cpp",
|
||||||
"HTMLElement.cpp",
|
"HTMLElement.cpp",
|
||||||
"HTMLEmbedElement.cpp",
|
"HTMLEmbedElement.cpp",
|
||||||
"HTMLFieldSetElement.cpp",
|
"HTMLFieldSetElement.cpp",
|
||||||
|
@ -209,7 +210,6 @@ UNIFIED_SOURCES += [
|
||||||
"nsGenericHTMLElement.cpp",
|
"nsGenericHTMLElement.cpp",
|
||||||
"nsGenericHTMLFrameElement.cpp",
|
"nsGenericHTMLFrameElement.cpp",
|
||||||
"nsHTMLContentSink.cpp",
|
"nsHTMLContentSink.cpp",
|
||||||
"nsHTMLDNSPrefetch.cpp",
|
|
||||||
"nsHTMLDocument.cpp",
|
"nsHTMLDocument.cpp",
|
||||||
"nsIConstraintValidation.cpp",
|
"nsIConstraintValidation.cpp",
|
||||||
"nsRadioVisitor.cpp",
|
"nsRadioVisitor.cpp",
|
||||||
|
|
|
@ -45,11 +45,11 @@
|
||||||
#include "nsTextFragment.h"
|
#include "nsTextFragment.h"
|
||||||
#include "nsMediaFeatures.h"
|
#include "nsMediaFeatures.h"
|
||||||
#include "nsCORSListenerProxy.h"
|
#include "nsCORSListenerProxy.h"
|
||||||
#include "nsHTMLDNSPrefetch.h"
|
|
||||||
#include "nsHtml5Module.h"
|
#include "nsHtml5Module.h"
|
||||||
#include "nsHTMLTags.h"
|
#include "nsHTMLTags.h"
|
||||||
#include "nsFocusManager.h"
|
#include "nsFocusManager.h"
|
||||||
#include "nsListControlFrame.h"
|
#include "nsListControlFrame.h"
|
||||||
|
#include "mozilla/dom/HTMLDNSPrefetch.h"
|
||||||
#include "mozilla/dom/HTMLInputElement.h"
|
#include "mozilla/dom/HTMLInputElement.h"
|
||||||
#include "mozilla/dom/SVGElementFactory.h"
|
#include "mozilla/dom/SVGElementFactory.h"
|
||||||
#include "nsMathMLAtoms.h"
|
#include "nsMathMLAtoms.h"
|
||||||
|
@ -181,7 +181,7 @@ nsresult nsLayoutStatics::Initialize() {
|
||||||
nsCSSRendering::Init();
|
nsCSSRendering::Init();
|
||||||
css::ImageLoader::Init();
|
css::ImageLoader::Init();
|
||||||
|
|
||||||
rv = nsHTMLDNSPrefetch::Initialize();
|
rv = HTMLDNSPrefetch::Initialize();
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
NS_ERROR("Could not initialize HTML DNS prefetch");
|
NS_ERROR("Could not initialize HTML DNS prefetch");
|
||||||
return rv;
|
return rv;
|
||||||
|
@ -319,7 +319,7 @@ void nsLayoutStatics::Shutdown() {
|
||||||
EditorController::Shutdown();
|
EditorController::Shutdown();
|
||||||
HTMLEditorController::Shutdown();
|
HTMLEditorController::Shutdown();
|
||||||
nsMediaFeatures::Shutdown();
|
nsMediaFeatures::Shutdown();
|
||||||
nsHTMLDNSPrefetch::Shutdown();
|
HTMLDNSPrefetch::Shutdown();
|
||||||
nsCSSRendering::Shutdown();
|
nsCSSRendering::Shutdown();
|
||||||
StaticPresData::Shutdown();
|
StaticPresData::Shutdown();
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
#include "mozilla/LoadContext.h"
|
#include "mozilla/LoadContext.h"
|
||||||
#include "mozilla/MozPromise.h"
|
#include "mozilla/MozPromise.h"
|
||||||
#include "nsPrintfCString.h"
|
#include "nsPrintfCString.h"
|
||||||
#include "nsHTMLDNSPrefetch.h"
|
#include "mozilla/dom/HTMLDNSPrefetch.h"
|
||||||
#include "nsEscape.h"
|
#include "nsEscape.h"
|
||||||
#include "SerializedLoadContext.h"
|
#include "SerializedLoadContext.h"
|
||||||
#include "nsAuthInformationHolder.h"
|
#include "nsAuthInformationHolder.h"
|
||||||
|
@ -540,7 +540,7 @@ mozilla::ipc::IPCResult NeckoParent::RecvSpeculativeConnect(
|
||||||
mozilla::ipc::IPCResult NeckoParent::RecvHTMLDNSPrefetch(
|
mozilla::ipc::IPCResult NeckoParent::RecvHTMLDNSPrefetch(
|
||||||
const nsString& hostname, const bool& isHttps,
|
const nsString& hostname, const bool& isHttps,
|
||||||
const OriginAttributes& aOriginAttributes, const uint32_t& flags) {
|
const OriginAttributes& aOriginAttributes, const uint32_t& flags) {
|
||||||
nsHTMLDNSPrefetch::Prefetch(hostname, isHttps, aOriginAttributes, flags);
|
HTMLDNSPrefetch::Prefetch(hostname, isHttps, aOriginAttributes, flags);
|
||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -548,7 +548,7 @@ mozilla::ipc::IPCResult NeckoParent::RecvCancelHTMLDNSPrefetch(
|
||||||
const nsString& hostname, const bool& isHttps,
|
const nsString& hostname, const bool& isHttps,
|
||||||
const OriginAttributes& aOriginAttributes, const uint32_t& flags,
|
const OriginAttributes& aOriginAttributes, const uint32_t& flags,
|
||||||
const nsresult& reason) {
|
const nsresult& reason) {
|
||||||
nsHTMLDNSPrefetch::CancelPrefetch(hostname, isHttps, aOriginAttributes, flags,
|
HTMLDNSPrefetch::CancelPrefetch(hostname, isHttps, aOriginAttributes, flags,
|
||||||
reason);
|
reason);
|
||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче