зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1204581 - Add a deprecation warning for the usage of AppCache when service worker fetch interception is enabled; r=mcmanus,baku
This commit is contained in:
Родитель
b7ab4c0916
Коммит
0bc360edc4
|
@ -942,6 +942,7 @@ NS_INTERFACE_MAP_BEGIN(nsDocShell)
|
|||
NS_INTERFACE_MAP_ENTRY(nsIClipboardCommands)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMStorageManager)
|
||||
NS_INTERFACE_MAP_ENTRY(nsINetworkInterceptController)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDeprecationWarner)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDocLoader)
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -14060,3 +14061,13 @@ nsDocShell::InFrameSwap()
|
|||
} while (shell);
|
||||
return false;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::IssueWarning(uint32_t aWarning, bool aAsError)
|
||||
{
|
||||
nsCOMPtr<nsIDocument> doc = mContentViewer->GetDocument();
|
||||
if (doc) {
|
||||
doc->WarnOnceAbout(nsIDocument::DeprecatedOperations(aWarning), aAsError);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
#include "prtime.h"
|
||||
#include "nsRect.h"
|
||||
#include "Units.h"
|
||||
#include "nsIDeprecationWarner.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -145,6 +146,7 @@ class nsDocShell final
|
|||
, public nsIClipboardCommands
|
||||
, public nsIDOMStorageManager
|
||||
, public nsINetworkInterceptController
|
||||
, public nsIDeprecationWarner
|
||||
, public mozilla::SupportsWeakPtr<nsDocShell>
|
||||
{
|
||||
friend class nsDSURIContentListener;
|
||||
|
@ -176,6 +178,7 @@ public:
|
|||
NS_DECL_NSICLIPBOARDCOMMANDS
|
||||
NS_DECL_NSIWEBSHELLSERVICES
|
||||
NS_DECL_NSINETWORKINTERCEPTCONTROLLER
|
||||
NS_DECL_NSIDEPRECATIONWARNER
|
||||
NS_FORWARD_SAFE_NSIDOMSTORAGEMANAGER(TopSessionStorageManager())
|
||||
|
||||
NS_IMETHOD Stop() override
|
||||
|
|
|
@ -41,3 +41,4 @@ DEPRECATED_OPERATION(DataContainerEvent)
|
|||
DEPRECATED_OPERATION(Window_Controllers)
|
||||
DEPRECATED_OPERATION(ImportXULIntoContent)
|
||||
DEPRECATED_OPERATION(PannerNodeDoppler)
|
||||
DEPRECATED_OPERATION(AppCache)
|
||||
|
|
|
@ -158,8 +158,10 @@ IndexedDBTransactionAbortNavigation=An IndexedDB transaction that was not yet co
|
|||
IgnoringWillChangeOverBudgetWarning=Will-change memory consumption is too high. Budget limit is the document surface area multiplied by %1$S (%2$S px). Occurrences of will-change over the budget will be ignored.
|
||||
# LOCALIZATION NOTE: Do not translate "ServiceWorker".
|
||||
HittingMaxWorkersPerDomain=A ServiceWorker could not be started immediately because other documents in the same origin are already using the maximum number of workers. The ServiceWorker is now queued and will be started after some of the other workers have completed.
|
||||
# LOCALIZATION NOTE: Do no translate "setVelocity", "PannerNode", "AudioListener", "speedOfSound" and "dopplerFactor"
|
||||
# LOCALIZATION NOTE: Do not translate "setVelocity", "PannerNode", "AudioListener", "speedOfSound" and "dopplerFactor"
|
||||
PannerNodeDopplerWarning=Use of setVelocity on the PannerNode and AudioListener, and speedOfSound and dopplerFactor on the AudioListener are deprecated and those members will be removed. For more help https://developer.mozilla.org/en-US/docs/Web/API/AudioListener#Deprecated_features
|
||||
# LOCALIZATION NOTE: Do not translate "Application Cache API", "AppCache" and "ServiceWorker".
|
||||
AppCacheWarning=The Application Cache API (AppCache) is deprecated and will be removed at a future date. Please consider using ServiceWorker for offline support.
|
||||
# LOCALIZATION NOTE: Do not translate "Worker".
|
||||
EmptyWorkerSourceWarning=Attempting to create a Worker from an empty source. This is probably unintentional.
|
||||
# LOCALIZATION NOTE: Do not translate "ServiceWorker".
|
||||
|
|
|
@ -38,6 +38,7 @@ XPIDL_SOURCES += [
|
|||
'nsICryptoHMAC.idl',
|
||||
'nsIDashboard.idl',
|
||||
'nsIDashboardEventNotifier.idl',
|
||||
'nsIDeprecationWarner.idl',
|
||||
'nsIDivertableChannel.idl',
|
||||
'nsIDownloader.idl',
|
||||
'nsIEncodedChannel.idl',
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* 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 for warning about deprecated operations. Consumers should
|
||||
* attach this interface to the channel's notification callbacks/loadgroup.
|
||||
*/
|
||||
[uuid(665c5124-2c52-41ba-ae72-2393f8e76c25)]
|
||||
interface nsIDeprecationWarner : nsISupports
|
||||
{
|
||||
/**
|
||||
* Issue a deprecation warning.
|
||||
*
|
||||
* @param aWarning a warning code as declared in nsDeprecatedOperationList.h.
|
||||
* @param aAsError optional boolean flag indicating whether the warning
|
||||
* should be treated as an error.
|
||||
*/
|
||||
void issueWarning(in uint32_t aWarning, [optional] in bool aAsError);
|
||||
};
|
|
@ -34,6 +34,7 @@
|
|||
#include "nsPerformance.h"
|
||||
#include "mozIThirdPartyUtil.h"
|
||||
#include "nsContentSecurityManager.h"
|
||||
#include "nsIDeprecationWarner.h"
|
||||
|
||||
#ifdef OS_POSIX
|
||||
#include "chrome/common/file_descriptor_set_posix.h"
|
||||
|
@ -2319,5 +2320,17 @@ HttpChannelChild::ForceIntercepted()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
HttpChannelChild::RecvIssueDeprecationWarning(const uint32_t& warning,
|
||||
const bool& asError)
|
||||
{
|
||||
nsCOMPtr<nsIDeprecationWarner> warner;
|
||||
GetCallback(warner);
|
||||
if (warner) {
|
||||
warner->IssueWarning(warning, asError);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -148,6 +148,9 @@ protected:
|
|||
bool RecvReportSecurityMessage(const nsString& messageTag,
|
||||
const nsString& messageCategory) override;
|
||||
|
||||
bool RecvIssueDeprecationWarning(const uint32_t& warning,
|
||||
const bool& asError) override;
|
||||
|
||||
bool GetAssociatedContentSecurity(nsIAssociatedContentSecurity** res = nullptr);
|
||||
virtual void DoNotifyListenerCleanup() override;
|
||||
|
||||
|
|
|
@ -153,7 +153,8 @@ NS_IMPL_ISUPPORTS(HttpChannelParent,
|
|||
nsIParentChannel,
|
||||
nsIAuthPromptProvider,
|
||||
nsIParentRedirectingChannel,
|
||||
nsINetworkInterceptController)
|
||||
nsINetworkInterceptController,
|
||||
nsIDeprecationWarner)
|
||||
|
||||
NS_IMETHODIMP
|
||||
HttpChannelParent::ShouldPrepareForIntercept(nsIURI* aURI, bool aIsNavigate,
|
||||
|
@ -1579,5 +1580,12 @@ HttpChannelParent::ReportSecurityMessage(const nsAString& aMessageTag,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HttpChannelParent::IssueWarning(uint32_t aWarning, bool aAsError)
|
||||
{
|
||||
unused << SendIssueDeprecationWarning(aWarning, aAsError);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "nsIAuthPromptProvider.h"
|
||||
#include "mozilla/dom/ipc/IdType.h"
|
||||
#include "nsINetworkInterceptController.h"
|
||||
#include "nsIDeprecationWarner.h"
|
||||
|
||||
class nsICacheEntry;
|
||||
class nsIAssociatedContentSecurity;
|
||||
|
@ -43,6 +44,7 @@ class HttpChannelParent final : public PHttpChannelParent
|
|||
, public ADivertableParentChannel
|
||||
, public nsIAuthPromptProvider
|
||||
, public nsINetworkInterceptController
|
||||
, public nsIDeprecationWarner
|
||||
, public DisconnectableParent
|
||||
, public HttpChannelSecurityWarningReporter
|
||||
{
|
||||
|
@ -58,6 +60,7 @@ public:
|
|||
NS_DECL_NSIINTERFACEREQUESTOR
|
||||
NS_DECL_NSIAUTHPROMPTPROVIDER
|
||||
NS_DECL_NSINETWORKINTERCEPTCONTROLLER
|
||||
NS_DECL_NSIDEPRECATIONWARNER
|
||||
|
||||
HttpChannelParent(const dom::PBrowserOrId& iframeEmbedding,
|
||||
nsILoadContext* aLoadContext,
|
||||
|
|
|
@ -154,6 +154,9 @@ child:
|
|||
// Tell child to delete channel (all IPDL deletes must be done from child to
|
||||
// avoid races: see bug 591708).
|
||||
DeleteSelf();
|
||||
|
||||
// Tell the child to issue a deprecation warning.
|
||||
IssueDeprecationWarning(uint32_t warning, bool asError);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -87,6 +87,8 @@
|
|||
#include "ScopedNSSTypes.h"
|
||||
#include "nsNullPrincipal.h"
|
||||
#include "nsIPackagedAppService.h"
|
||||
#include "nsIDeprecationWarner.h"
|
||||
#include "nsIDocument.h"
|
||||
|
||||
namespace mozilla { namespace net {
|
||||
|
||||
|
@ -2822,8 +2824,7 @@ nsHttpChannel::ContinueProcessFallback(nsresult rv)
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (mLoadFlags & LOAD_INITIAL_DOCUMENT_URI) {
|
||||
Telemetry::Accumulate(Telemetry::HTTP_OFFLINE_CACHE_DOCUMENT_LOAD,
|
||||
true);
|
||||
MaybeWarnAboutAppCache();
|
||||
}
|
||||
|
||||
// close down this channel
|
||||
|
@ -3623,8 +3624,7 @@ nsHttpChannel::OnOfflineCacheEntryAvailable(nsICacheEntry *aEntry,
|
|||
mCacheEntryIsWriteOnly = false;
|
||||
|
||||
if (mLoadFlags & LOAD_INITIAL_DOCUMENT_URI && !mApplicationCacheForWrite) {
|
||||
Telemetry::Accumulate(Telemetry::HTTP_OFFLINE_CACHE_DOCUMENT_LOAD,
|
||||
true);
|
||||
MaybeWarnAboutAppCache();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -7026,5 +7026,23 @@ nsHttpChannel::OnPreflightFailed(nsresult aError)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsHttpChannel::MaybeWarnAboutAppCache()
|
||||
{
|
||||
// First, accumulate a telemetry ping about appcache usage.
|
||||
Telemetry::Accumulate(Telemetry::HTTP_OFFLINE_CACHE_DOCUMENT_LOAD,
|
||||
true);
|
||||
|
||||
// Then, issue a deprecation warning if service worker interception is
|
||||
// enabled.
|
||||
if (nsContentUtils::ServiceWorkerInterceptionEnabled()) {
|
||||
nsCOMPtr<nsIDeprecationWarner> warner;
|
||||
GetCallback(warner);
|
||||
if (warner) {
|
||||
warner->IssueWarning(nsIDocument::eAppCache, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -398,6 +398,8 @@ private:
|
|||
|
||||
void SetPushedStream(Http2PushedStream *stream);
|
||||
|
||||
void MaybeWarnAboutAppCache();
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsICancelable> mProxyRequest;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче