mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1199295 - Pass right loadingPrincipal to uriloader/prefetch (r=mayhemer)
* * * Bug 1199295 - Investigate loadingPrincipal for loadInfo in uriloader/prefetch (sicking,smaug)
This commit is contained in:
parent
9db34a3597
commit
4e2abd9439
@ -60,6 +60,7 @@ include PTabContext;
|
|||||||
include URIParams;
|
include URIParams;
|
||||||
include PluginTypes;
|
include PluginTypes;
|
||||||
include ProtocolTypes;
|
include ProtocolTypes;
|
||||||
|
include PBackgroundSharedTypes;
|
||||||
include PContentPermission;
|
include PContentPermission;
|
||||||
include BrowserConfiguration;
|
include BrowserConfiguration;
|
||||||
include GraphicsMessages;
|
include GraphicsMessages;
|
||||||
@ -1021,6 +1022,8 @@ parent:
|
|||||||
* URI of the manifest to fetch, the application cache group ID
|
* URI of the manifest to fetch, the application cache group ID
|
||||||
* @param documentURI
|
* @param documentURI
|
||||||
* URI of the document that referred the manifest
|
* URI of the document that referred the manifest
|
||||||
|
* @param loadingPrincipal
|
||||||
|
* Principal of the document that referred the manifest
|
||||||
* @param stickDocument
|
* @param stickDocument
|
||||||
* True if the update was initiated by a document load that referred
|
* True if the update was initiated by a document load that referred
|
||||||
* a manifest.
|
* a manifest.
|
||||||
@ -1040,7 +1043,8 @@ parent:
|
|||||||
* To identify which tab owns the app.
|
* To identify which tab owns the app.
|
||||||
*/
|
*/
|
||||||
POfflineCacheUpdate(URIParams manifestURI, URIParams documentURI,
|
POfflineCacheUpdate(URIParams manifestURI, URIParams documentURI,
|
||||||
bool stickDocument, TabId tabId);
|
PrincipalInfo loadingPrincipal, bool stickDocument,
|
||||||
|
TabId tabId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets "offline-app" permission for the principal. Called when we hit
|
* Sets "offline-app" permission for the principal. Called when we hit
|
||||||
|
@ -361,7 +361,8 @@ nsDOMOfflineResourceList::MozAdd(const nsAString& aURI)
|
|||||||
rv = appCache->GetClientID(clientID);
|
rv = appCache->GetClientID(clientID);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
rv = update->InitPartial(mManifestURI, clientID, mDocumentURI);
|
rv = update->InitPartial(mManifestURI, clientID,
|
||||||
|
mDocumentURI, mLoadingPrincipal);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
rv = update->AddDynamicURI(requestedURI);
|
rv = update->AddDynamicURI(requestedURI);
|
||||||
|
@ -3,6 +3,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 "BackgroundUtils.h"
|
||||||
#include "OfflineCacheUpdateChild.h"
|
#include "OfflineCacheUpdateChild.h"
|
||||||
#include "nsOfflineCacheUpdate.h"
|
#include "nsOfflineCacheUpdate.h"
|
||||||
#include "mozilla/dom/ContentChild.h"
|
#include "mozilla/dom/ContentChild.h"
|
||||||
@ -174,6 +175,7 @@ OfflineCacheUpdateChild::AssociateDocument(nsIDOMDocument *aDocument,
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
OfflineCacheUpdateChild::Init(nsIURI *aManifestURI,
|
OfflineCacheUpdateChild::Init(nsIURI *aManifestURI,
|
||||||
nsIURI *aDocumentURI,
|
nsIURI *aDocumentURI,
|
||||||
|
nsIPrincipal *aLoadingPrincipal,
|
||||||
nsIDOMDocument *aDocument,
|
nsIDOMDocument *aDocument,
|
||||||
nsIFile *aCustomProfileDir,
|
nsIFile *aCustomProfileDir,
|
||||||
uint32_t aAppID,
|
uint32_t aAppID,
|
||||||
@ -212,6 +214,7 @@ OfflineCacheUpdateChild::Init(nsIURI *aManifestURI,
|
|||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
mDocumentURI = aDocumentURI;
|
mDocumentURI = aDocumentURI;
|
||||||
|
mLoadingPrincipal = aLoadingPrincipal;
|
||||||
|
|
||||||
mState = STATE_INITIALIZED;
|
mState = STATE_INITIALIZED;
|
||||||
|
|
||||||
@ -227,7 +230,8 @@ OfflineCacheUpdateChild::Init(nsIURI *aManifestURI,
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
OfflineCacheUpdateChild::InitPartial(nsIURI *aManifestURI,
|
OfflineCacheUpdateChild::InitPartial(nsIURI *aManifestURI,
|
||||||
const nsACString& clientID,
|
const nsACString& clientID,
|
||||||
nsIURI *aDocumentURI)
|
nsIURI *aDocumentURI,
|
||||||
|
nsIPrincipal *aLoadingPrincipal)
|
||||||
{
|
{
|
||||||
NS_NOTREACHED("Not expected to do partial offline cache updates"
|
NS_NOTREACHED("Not expected to do partial offline cache updates"
|
||||||
" on the child process");
|
" on the child process");
|
||||||
@ -237,6 +241,7 @@ OfflineCacheUpdateChild::InitPartial(nsIURI *aManifestURI,
|
|||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
OfflineCacheUpdateChild::InitForUpdateCheck(nsIURI *aManifestURI,
|
OfflineCacheUpdateChild::InitForUpdateCheck(nsIURI *aManifestURI,
|
||||||
|
nsIPrincipal* aLoadingPrincipal,
|
||||||
uint32_t aAppID,
|
uint32_t aAppID,
|
||||||
bool aInBrowser,
|
bool aInBrowser,
|
||||||
nsIObserver *aObserver)
|
nsIObserver *aObserver)
|
||||||
@ -409,6 +414,12 @@ OfflineCacheUpdateChild::Schedule()
|
|||||||
SerializeURI(mManifestURI, manifestURI);
|
SerializeURI(mManifestURI, manifestURI);
|
||||||
SerializeURI(mDocumentURI, documentURI);
|
SerializeURI(mDocumentURI, documentURI);
|
||||||
|
|
||||||
|
nsresult rv = NS_OK;
|
||||||
|
PrincipalInfo loadingPrincipalInfo;
|
||||||
|
rv = PrincipalToPrincipalInfo(mLoadingPrincipal,
|
||||||
|
&loadingPrincipalInfo);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
nsCOMPtr<nsIObserverService> observerService =
|
nsCOMPtr<nsIObserverService> observerService =
|
||||||
mozilla::services::GetObserverService();
|
mozilla::services::GetObserverService();
|
||||||
if (observerService) {
|
if (observerService) {
|
||||||
@ -431,7 +442,7 @@ OfflineCacheUpdateChild::Schedule()
|
|||||||
// a reference to us. Will be released in RecvFinish() that identifies
|
// a reference to us. Will be released in RecvFinish() that identifies
|
||||||
// the work has been done.
|
// the work has been done.
|
||||||
ContentChild::GetSingleton()->SendPOfflineCacheUpdateConstructor(
|
ContentChild::GetSingleton()->SendPOfflineCacheUpdateConstructor(
|
||||||
this, manifestURI, documentURI,
|
this, manifestURI, documentURI, loadingPrincipalInfo,
|
||||||
stickDocument, child->GetTabId());
|
stickDocument, child->GetTabId());
|
||||||
|
|
||||||
// ContentChild::DeallocPOfflineCacheUpdate will release this.
|
// ContentChild::DeallocPOfflineCacheUpdate will release this.
|
||||||
|
@ -68,6 +68,7 @@ private:
|
|||||||
nsCString mUpdateDomain;
|
nsCString mUpdateDomain;
|
||||||
nsCOMPtr<nsIURI> mManifestURI;
|
nsCOMPtr<nsIURI> mManifestURI;
|
||||||
nsCOMPtr<nsIURI> mDocumentURI;
|
nsCOMPtr<nsIURI> mDocumentURI;
|
||||||
|
nsCOMPtr<nsIPrincipal> mLoadingPrincipal;
|
||||||
|
|
||||||
nsCOMPtr<nsIObserverService> mObserverService;
|
nsCOMPtr<nsIObserverService> mObserverService;
|
||||||
|
|
||||||
|
@ -95,8 +95,9 @@ OfflineCacheUpdateGlue::Schedule()
|
|||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
OfflineCacheUpdateGlue::Init(nsIURI *aManifestURI,
|
OfflineCacheUpdateGlue::Init(nsIURI *aManifestURI,
|
||||||
nsIURI *aDocumentURI,
|
nsIURI *aDocumentURI,
|
||||||
|
nsIPrincipal* aLoadingPrincipal,
|
||||||
nsIDOMDocument *aDocument,
|
nsIDOMDocument *aDocument,
|
||||||
nsIFile *aCustomProfileDir,
|
nsIFile *aCustomProfileDir,
|
||||||
uint32_t aAppID,
|
uint32_t aAppID,
|
||||||
@ -114,6 +115,7 @@ OfflineCacheUpdateGlue::Init(nsIURI *aManifestURI,
|
|||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
|
|
||||||
mDocumentURI = aDocumentURI;
|
mDocumentURI = aDocumentURI;
|
||||||
|
mLoadingPrincipal = aLoadingPrincipal;
|
||||||
|
|
||||||
if (aDocument)
|
if (aDocument)
|
||||||
SetDocument(aDocument);
|
SetDocument(aDocument);
|
||||||
@ -123,7 +125,8 @@ OfflineCacheUpdateGlue::Init(nsIURI *aManifestURI,
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
return mUpdate->Init(aManifestURI, aDocumentURI, nullptr, aCustomProfileDir, aAppID, aInBrowser);
|
return mUpdate->Init(aManifestURI, aDocumentURI, aLoadingPrincipal, nullptr,
|
||||||
|
aCustomProfileDir, aAppID, aInBrowser);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -29,8 +29,8 @@ namespace docshell {
|
|||||||
NS_IMETHOD GetUpdateDomain(nsACString & aUpdateDomain) override { return !_to ? NS_ERROR_NULL_POINTER : _to->GetUpdateDomain(aUpdateDomain); } \
|
NS_IMETHOD GetUpdateDomain(nsACString & aUpdateDomain) override { return !_to ? NS_ERROR_NULL_POINTER : _to->GetUpdateDomain(aUpdateDomain); } \
|
||||||
NS_IMETHOD GetManifestURI(nsIURI **aManifestURI) override { return !_to ? NS_ERROR_NULL_POINTER : _to->GetManifestURI(aManifestURI); } \
|
NS_IMETHOD GetManifestURI(nsIURI **aManifestURI) override { return !_to ? NS_ERROR_NULL_POINTER : _to->GetManifestURI(aManifestURI); } \
|
||||||
NS_IMETHOD GetSucceeded(bool *aSucceeded) override { return !_to ? NS_ERROR_NULL_POINTER : _to->GetSucceeded(aSucceeded); } \
|
NS_IMETHOD GetSucceeded(bool *aSucceeded) override { return !_to ? NS_ERROR_NULL_POINTER : _to->GetSucceeded(aSucceeded); } \
|
||||||
NS_IMETHOD InitPartial(nsIURI *aManifestURI, const nsACString & aClientID, nsIURI *aDocumentURI) override { return !_to ? NS_ERROR_NULL_POINTER : _to->InitPartial(aManifestURI, aClientID, aDocumentURI); } \
|
NS_IMETHOD InitPartial(nsIURI *aManifestURI, const nsACString & aClientID, nsIURI *aDocumentURI, nsIPrincipal *aLoadingPrincipal) override { return !_to ? NS_ERROR_NULL_POINTER : _to->InitPartial(aManifestURI, aClientID, aDocumentURI, aLoadingPrincipal); } \
|
||||||
NS_IMETHOD InitForUpdateCheck(nsIURI *aManifestURI, uint32_t aAppID, bool aInBrowser, nsIObserver *aObserver) override { return !_to ? NS_ERROR_NULL_POINTER : _to->InitForUpdateCheck(aManifestURI, aAppID, aInBrowser, aObserver); } \
|
NS_IMETHOD InitForUpdateCheck(nsIURI *aManifestURI, nsIPrincipal* aLoadingPrincipal, uint32_t aAppID, bool aInBrowser, nsIObserver *aObserver) override { return !_to ? NS_ERROR_NULL_POINTER : _to->InitForUpdateCheck(aManifestURI, aLoadingPrincipal, aAppID, aInBrowser, aObserver); } \
|
||||||
NS_IMETHOD AddDynamicURI(nsIURI *aURI) override { return !_to ? NS_ERROR_NULL_POINTER : _to->AddDynamicURI(aURI); } \
|
NS_IMETHOD AddDynamicURI(nsIURI *aURI) override { return !_to ? NS_ERROR_NULL_POINTER : _to->AddDynamicURI(aURI); } \
|
||||||
NS_IMETHOD AddObserver(nsIOfflineCacheUpdateObserver *aObserver, bool aHoldWeak) override { return !_to ? NS_ERROR_NULL_POINTER : _to->AddObserver(aObserver, aHoldWeak); } \
|
NS_IMETHOD AddObserver(nsIOfflineCacheUpdateObserver *aObserver, bool aHoldWeak) override { return !_to ? NS_ERROR_NULL_POINTER : _to->AddObserver(aObserver, aHoldWeak); } \
|
||||||
NS_IMETHOD RemoveObserver(nsIOfflineCacheUpdateObserver *aObserver) override { return !_to ? NS_ERROR_NULL_POINTER : _to->RemoveObserver(aObserver); } \
|
NS_IMETHOD RemoveObserver(nsIOfflineCacheUpdateObserver *aObserver) override { return !_to ? NS_ERROR_NULL_POINTER : _to->RemoveObserver(aObserver); } \
|
||||||
@ -50,8 +50,9 @@ private:
|
|||||||
public:
|
public:
|
||||||
NS_ADJUSTED_FORWARD_NSIOFFLINECACHEUPDATE(EnsureUpdate())
|
NS_ADJUSTED_FORWARD_NSIOFFLINECACHEUPDATE(EnsureUpdate())
|
||||||
NS_IMETHOD Schedule(void) override;
|
NS_IMETHOD Schedule(void) override;
|
||||||
NS_IMETHOD Init(nsIURI *aManifestURI,
|
NS_IMETHOD Init(nsIURI *aManifestURI,
|
||||||
nsIURI *aDocumentURI,
|
nsIURI *aDocumentURI,
|
||||||
|
nsIPrincipal* aLoadingPrincipal,
|
||||||
nsIDOMDocument *aDocument,
|
nsIDOMDocument *aDocument,
|
||||||
nsIFile *aCustomProfileDir,
|
nsIFile *aCustomProfileDir,
|
||||||
uint32_t aAppID,
|
uint32_t aAppID,
|
||||||
@ -72,6 +73,7 @@ private:
|
|||||||
/* Document that requested this update */
|
/* Document that requested this update */
|
||||||
nsCOMPtr<nsIDOMDocument> mDocument;
|
nsCOMPtr<nsIDOMDocument> mDocument;
|
||||||
nsCOMPtr<nsIURI> mDocumentURI;
|
nsCOMPtr<nsIURI> mDocumentURI;
|
||||||
|
nsCOMPtr<nsIPrincipal> mLoadingPrincipal;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace docshell
|
} // namespace docshell
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include "OfflineCacheUpdateParent.h"
|
#include "OfflineCacheUpdateParent.h"
|
||||||
|
|
||||||
|
#include "BackgroundUtils.h"
|
||||||
#include "mozilla/BasePrincipal.h"
|
#include "mozilla/BasePrincipal.h"
|
||||||
#include "mozilla/dom/TabParent.h"
|
#include "mozilla/dom/TabParent.h"
|
||||||
#include "mozilla/ipc/URIUtils.h"
|
#include "mozilla/ipc/URIUtils.h"
|
||||||
@ -77,6 +78,7 @@ OfflineCacheUpdateParent::ActorDestroy(ActorDestroyReason why)
|
|||||||
nsresult
|
nsresult
|
||||||
OfflineCacheUpdateParent::Schedule(const URIParams& aManifestURI,
|
OfflineCacheUpdateParent::Schedule(const URIParams& aManifestURI,
|
||||||
const URIParams& aDocumentURI,
|
const URIParams& aDocumentURI,
|
||||||
|
const PrincipalInfo& aLoadingPrincipalInfo,
|
||||||
const bool& stickDocument)
|
const bool& stickDocument)
|
||||||
{
|
{
|
||||||
LOG(("OfflineCacheUpdateParent::RecvSchedule [%p]", this));
|
LOG(("OfflineCacheUpdateParent::RecvSchedule [%p]", this));
|
||||||
@ -119,9 +121,13 @@ OfflineCacheUpdateParent::Schedule(const URIParams& aManifestURI,
|
|||||||
if (!update) {
|
if (!update) {
|
||||||
update = new nsOfflineCacheUpdate();
|
update = new nsOfflineCacheUpdate();
|
||||||
|
|
||||||
|
nsCOMPtr<nsIPrincipal> loadingPrincipal =
|
||||||
|
PrincipalInfoToPrincipal(aLoadingPrincipalInfo, &rv);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
// Leave aDocument argument null. Only glues and children keep
|
// Leave aDocument argument null. Only glues and children keep
|
||||||
// document instances.
|
// document instances.
|
||||||
rv = update->Init(manifestURI, documentURI, nullptr, nullptr,
|
rv = update->Init(manifestURI, documentURI, loadingPrincipal, nullptr, nullptr,
|
||||||
mOriginAttributes.mAppId, mOriginAttributes.mInBrowser);
|
mOriginAttributes.mAppId, mOriginAttributes.mInBrowser);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ class OfflineCacheUpdateParent : public POfflineCacheUpdateParent
|
|||||||
, public nsILoadContext
|
, public nsILoadContext
|
||||||
{
|
{
|
||||||
typedef mozilla::ipc::URIParams URIParams;
|
typedef mozilla::ipc::URIParams URIParams;
|
||||||
|
typedef mozilla::ipc::PrincipalInfo PrincipalInfo;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
@ -35,6 +36,7 @@ public:
|
|||||||
nsresult
|
nsresult
|
||||||
Schedule(const URIParams& manifestURI,
|
Schedule(const URIParams& manifestURI,
|
||||||
const URIParams& documentURI,
|
const URIParams& documentURI,
|
||||||
|
const PrincipalInfo& loadingPrincipalInfo,
|
||||||
const bool& stickDocument);
|
const bool& stickDocument);
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -58,7 +58,7 @@ interface nsIOfflineCacheUpdateObserver : nsISupports {
|
|||||||
* load its items one by one, sending itemCompleted() to any registered
|
* load its items one by one, sending itemCompleted() to any registered
|
||||||
* observers.
|
* observers.
|
||||||
*/
|
*/
|
||||||
[scriptable, uuid(a4503a53-6ab8-4b50-b01e-1c4f393fc980)]
|
[scriptable, uuid(e9029838-3553-4192-a00b-f0f11073a6eb)]
|
||||||
interface nsIOfflineCacheUpdate : nsISupports {
|
interface nsIOfflineCacheUpdate : nsISupports {
|
||||||
/**
|
/**
|
||||||
* Fetch the status of the running update. This will return a value
|
* Fetch the status of the running update. This will return a value
|
||||||
@ -101,8 +101,13 @@ interface nsIOfflineCacheUpdate : nsISupports {
|
|||||||
* The manifest URI to be checked.
|
* The manifest URI to be checked.
|
||||||
* @param aDocumentURI
|
* @param aDocumentURI
|
||||||
* The page that is requesting the update.
|
* The page that is requesting the update.
|
||||||
|
* @param aLoadingPrincipal
|
||||||
|
* The principal of the page that is requesting the update.
|
||||||
*/
|
*/
|
||||||
void init(in nsIURI aManifestURI, in nsIURI aDocumentURI, in nsIDOMDocument aDocument,
|
void init(in nsIURI aManifestURI,
|
||||||
|
in nsIURI aDocumentURI,
|
||||||
|
in nsIPrincipal aLoadingPrincipal,
|
||||||
|
in nsIDOMDocument aDocument,
|
||||||
[optional] in nsIFile aCustomProfileDir,
|
[optional] in nsIFile aCustomProfileDir,
|
||||||
[optional] in unsigned long aAppId,
|
[optional] in unsigned long aAppId,
|
||||||
[optional] in boolean aInBrowser);
|
[optional] in boolean aInBrowser);
|
||||||
@ -120,7 +125,8 @@ interface nsIOfflineCacheUpdate : nsISupports {
|
|||||||
* The page that is requesting the update. May be null
|
* The page that is requesting the update. May be null
|
||||||
* when this information is unknown.
|
* when this information is unknown.
|
||||||
*/
|
*/
|
||||||
void initPartial(in nsIURI aManifestURI, in ACString aClientID, in nsIURI aDocumentURI);
|
void initPartial(in nsIURI aManifestURI, in ACString aClientID,
|
||||||
|
in nsIURI aDocumentURI, in nsIPrincipal aPrincipal);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the update to only check whether there is an update
|
* Initialize the update to only check whether there is an update
|
||||||
@ -141,6 +147,7 @@ interface nsIOfflineCacheUpdate : nsISupports {
|
|||||||
* update available (the manifest has not changed on the server).
|
* update available (the manifest has not changed on the server).
|
||||||
*/
|
*/
|
||||||
void initForUpdateCheck(in nsIURI aManifestURI,
|
void initForUpdateCheck(in nsIURI aManifestURI,
|
||||||
|
in nsIPrincipal aLoadingPrincipal,
|
||||||
in unsigned long aAppID,
|
in unsigned long aAppID,
|
||||||
in boolean aInBrowser,
|
in boolean aInBrowser,
|
||||||
in nsIObserver aObserver);
|
in nsIObserver aObserver);
|
||||||
@ -192,7 +199,7 @@ interface nsIOfflineCacheUpdate : nsISupports {
|
|||||||
readonly attribute uint64_t byteProgress;
|
readonly attribute uint64_t byteProgress;
|
||||||
};
|
};
|
||||||
|
|
||||||
[scriptable, uuid(0668910d-d14f-4cee-8db5-25faebc360ab)]
|
[scriptable, uuid(a297a334-bcae-4779-a564-555593edc96b)]
|
||||||
interface nsIOfflineCacheUpdateService : nsISupports {
|
interface nsIOfflineCacheUpdateService : nsISupports {
|
||||||
/**
|
/**
|
||||||
* Constants for the offline-app permission.
|
* Constants for the offline-app permission.
|
||||||
@ -220,6 +227,7 @@ interface nsIOfflineCacheUpdateService : nsISupports {
|
|||||||
*/
|
*/
|
||||||
nsIOfflineCacheUpdate scheduleUpdate(in nsIURI aManifestURI,
|
nsIOfflineCacheUpdate scheduleUpdate(in nsIURI aManifestURI,
|
||||||
in nsIURI aDocumentURI,
|
in nsIURI aDocumentURI,
|
||||||
|
in nsIPrincipal aLoadingPrincipal,
|
||||||
in nsIDOMWindow aWindow);
|
in nsIDOMWindow aWindow);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -230,6 +238,7 @@ interface nsIOfflineCacheUpdateService : nsISupports {
|
|||||||
*/
|
*/
|
||||||
nsIOfflineCacheUpdate scheduleAppUpdate(in nsIURI aManifestURI,
|
nsIOfflineCacheUpdate scheduleAppUpdate(in nsIURI aManifestURI,
|
||||||
in nsIURI aDocumentURI,
|
in nsIURI aDocumentURI,
|
||||||
|
in nsIPrincipal aLoadingPrincipal,
|
||||||
in unsigned long aAppID,
|
in unsigned long aAppID,
|
||||||
in boolean aInBrowser,
|
in boolean aInBrowser,
|
||||||
in nsIFile aProfileDir);
|
in nsIFile aProfileDir);
|
||||||
@ -240,6 +249,7 @@ interface nsIOfflineCacheUpdateService : nsISupports {
|
|||||||
*/
|
*/
|
||||||
void scheduleOnDocumentStop(in nsIURI aManifestURI,
|
void scheduleOnDocumentStop(in nsIURI aManifestURI,
|
||||||
in nsIURI aDocumentURI,
|
in nsIURI aDocumentURI,
|
||||||
|
in nsIPrincipal aLoadingPrincipal,
|
||||||
in nsIDOMDocument aDocument);
|
in nsIDOMDocument aDocument);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -254,6 +264,7 @@ interface nsIOfflineCacheUpdateService : nsISupports {
|
|||||||
* description.
|
* description.
|
||||||
*/
|
*/
|
||||||
void checkForUpdate(in nsIURI aManifestURI,
|
void checkForUpdate(in nsIURI aManifestURI,
|
||||||
|
in nsIPrincipal aLoadingPrincipal,
|
||||||
in unsigned long aAppID,
|
in unsigned long aAppID,
|
||||||
in boolean aInBrowser,
|
in boolean aInBrowser,
|
||||||
in nsIObserver aObserver);
|
in nsIObserver aObserver);
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
#include "mozilla/Attributes.h"
|
#include "mozilla/Attributes.h"
|
||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
|
#include "nsIPrincipal.h"
|
||||||
|
|
||||||
#include "nsXULAppAPI.h"
|
#include "nsXULAppAPI.h"
|
||||||
|
|
||||||
@ -120,10 +121,12 @@ class nsManifestCheck final : public nsIStreamListener
|
|||||||
public:
|
public:
|
||||||
nsManifestCheck(nsOfflineCacheUpdate *aUpdate,
|
nsManifestCheck(nsOfflineCacheUpdate *aUpdate,
|
||||||
nsIURI *aURI,
|
nsIURI *aURI,
|
||||||
nsIURI *aReferrerURI)
|
nsIURI *aReferrerURI,
|
||||||
|
nsIPrincipal* aLoadingPrincipal)
|
||||||
: mUpdate(aUpdate)
|
: mUpdate(aUpdate)
|
||||||
, mURI(aURI)
|
, mURI(aURI)
|
||||||
, mReferrerURI(aReferrerURI)
|
, mReferrerURI(aReferrerURI)
|
||||||
|
, mLoadingPrincipal(aLoadingPrincipal)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
@ -148,6 +151,7 @@ private:
|
|||||||
nsRefPtr<nsOfflineCacheUpdate> mUpdate;
|
nsRefPtr<nsOfflineCacheUpdate> mUpdate;
|
||||||
nsCOMPtr<nsIURI> mURI;
|
nsCOMPtr<nsIURI> mURI;
|
||||||
nsCOMPtr<nsIURI> mReferrerURI;
|
nsCOMPtr<nsIURI> mReferrerURI;
|
||||||
|
nsCOMPtr<nsIPrincipal> mLoadingPrincipal;
|
||||||
nsCOMPtr<nsICryptoHash> mManifestHash;
|
nsCOMPtr<nsICryptoHash> mManifestHash;
|
||||||
nsCOMPtr<nsIChannel> mChannel;
|
nsCOMPtr<nsIChannel> mChannel;
|
||||||
};
|
};
|
||||||
@ -176,8 +180,8 @@ nsManifestCheck::Begin()
|
|||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = NS_NewChannel(getter_AddRefs(mChannel),
|
rv = NS_NewChannel(getter_AddRefs(mChannel),
|
||||||
mURI,
|
mURI,
|
||||||
nsContentUtils::GetSystemPrincipal(),
|
mLoadingPrincipal,
|
||||||
nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
|
nsILoadInfo::SEC_REQUIRE_SAME_ORIGIN_DATA_IS_BLOCKED,
|
||||||
nsIContentPolicy::TYPE_OTHER,
|
nsIContentPolicy::TYPE_OTHER,
|
||||||
nullptr, // loadGroup
|
nullptr, // loadGroup
|
||||||
nullptr, // aCallbacks
|
nullptr, // aCallbacks
|
||||||
@ -317,11 +321,13 @@ NS_IMPL_ISUPPORTS(nsOfflineCacheUpdateItem,
|
|||||||
|
|
||||||
nsOfflineCacheUpdateItem::nsOfflineCacheUpdateItem(nsIURI *aURI,
|
nsOfflineCacheUpdateItem::nsOfflineCacheUpdateItem(nsIURI *aURI,
|
||||||
nsIURI *aReferrerURI,
|
nsIURI *aReferrerURI,
|
||||||
|
nsIPrincipal* aLoadingPrincipal,
|
||||||
nsIApplicationCache *aApplicationCache,
|
nsIApplicationCache *aApplicationCache,
|
||||||
nsIApplicationCache *aPreviousApplicationCache,
|
nsIApplicationCache *aPreviousApplicationCache,
|
||||||
uint32_t type)
|
uint32_t type)
|
||||||
: mURI(aURI)
|
: mURI(aURI)
|
||||||
, mReferrerURI(aReferrerURI)
|
, mReferrerURI(aReferrerURI)
|
||||||
|
, mLoadingPrincipal(aLoadingPrincipal)
|
||||||
, mApplicationCache(aApplicationCache)
|
, mApplicationCache(aApplicationCache)
|
||||||
, mPreviousApplicationCache(aPreviousApplicationCache)
|
, mPreviousApplicationCache(aPreviousApplicationCache)
|
||||||
, mItemType(type)
|
, mItemType(type)
|
||||||
@ -367,7 +373,7 @@ nsOfflineCacheUpdateItem::OpenChannel(nsOfflineCacheUpdate *aUpdate)
|
|||||||
|
|
||||||
rv = NS_NewChannel(getter_AddRefs(mChannel),
|
rv = NS_NewChannel(getter_AddRefs(mChannel),
|
||||||
mURI,
|
mURI,
|
||||||
nsContentUtils::GetSystemPrincipal(),
|
mLoadingPrincipal,
|
||||||
nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
|
nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
|
||||||
nsIContentPolicy::TYPE_OTHER,
|
nsIContentPolicy::TYPE_OTHER,
|
||||||
nullptr, // aLoadGroup
|
nullptr, // aLoadGroup
|
||||||
@ -674,9 +680,10 @@ nsOfflineCacheUpdateItem::GetStatus(uint16_t *aStatus)
|
|||||||
|
|
||||||
nsOfflineManifestItem::nsOfflineManifestItem(nsIURI *aURI,
|
nsOfflineManifestItem::nsOfflineManifestItem(nsIURI *aURI,
|
||||||
nsIURI *aReferrerURI,
|
nsIURI *aReferrerURI,
|
||||||
|
nsIPrincipal* aLoadingPrincipal,
|
||||||
nsIApplicationCache *aApplicationCache,
|
nsIApplicationCache *aApplicationCache,
|
||||||
nsIApplicationCache *aPreviousApplicationCache)
|
nsIApplicationCache *aPreviousApplicationCache)
|
||||||
: nsOfflineCacheUpdateItem(aURI, aReferrerURI,
|
: nsOfflineCacheUpdateItem(aURI, aReferrerURI, aLoadingPrincipal,
|
||||||
aApplicationCache, aPreviousApplicationCache,
|
aApplicationCache, aPreviousApplicationCache,
|
||||||
nsIApplicationCache::ITEM_MANIFEST)
|
nsIApplicationCache::ITEM_MANIFEST)
|
||||||
, mParserState(PARSE_INIT)
|
, mParserState(PARSE_INIT)
|
||||||
@ -1188,7 +1195,8 @@ nsOfflineCacheUpdate::GetCacheKey(nsIURI *aURI, nsACString &aKey)
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsOfflineCacheUpdate::InitInternal(nsIURI *aManifestURI)
|
nsOfflineCacheUpdate::InitInternal(nsIURI *aManifestURI,
|
||||||
|
nsIPrincipal* aLoadingPrincipal)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
@ -1205,6 +1213,7 @@ nsOfflineCacheUpdate::InitInternal(nsIURI *aManifestURI)
|
|||||||
}
|
}
|
||||||
|
|
||||||
mManifestURI = aManifestURI;
|
mManifestURI = aManifestURI;
|
||||||
|
mLoadingPrincipal = aLoadingPrincipal;
|
||||||
|
|
||||||
rv = mManifestURI->GetAsciiHost(mUpdateDomain);
|
rv = mManifestURI->GetAsciiHost(mUpdateDomain);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
@ -1217,6 +1226,7 @@ nsOfflineCacheUpdate::InitInternal(nsIURI *aManifestURI)
|
|||||||
nsresult
|
nsresult
|
||||||
nsOfflineCacheUpdate::Init(nsIURI *aManifestURI,
|
nsOfflineCacheUpdate::Init(nsIURI *aManifestURI,
|
||||||
nsIURI *aDocumentURI,
|
nsIURI *aDocumentURI,
|
||||||
|
nsIPrincipal* aLoadingPrincipal,
|
||||||
nsIDOMDocument *aDocument,
|
nsIDOMDocument *aDocument,
|
||||||
nsIFile *aCustomProfileDir,
|
nsIFile *aCustomProfileDir,
|
||||||
uint32_t aAppID,
|
uint32_t aAppID,
|
||||||
@ -1232,7 +1242,7 @@ nsOfflineCacheUpdate::Init(nsIURI *aManifestURI,
|
|||||||
|
|
||||||
LOG(("nsOfflineCacheUpdate::Init [%p]", this));
|
LOG(("nsOfflineCacheUpdate::Init [%p]", this));
|
||||||
|
|
||||||
rv = InitInternal(aManifestURI);
|
rv = InitInternal(aManifestURI, aLoadingPrincipal);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
nsCOMPtr<nsIApplicationCacheService> cacheService =
|
nsCOMPtr<nsIApplicationCacheService> cacheService =
|
||||||
@ -1292,6 +1302,7 @@ nsOfflineCacheUpdate::Init(nsIURI *aManifestURI,
|
|||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsOfflineCacheUpdate::InitForUpdateCheck(nsIURI *aManifestURI,
|
nsOfflineCacheUpdate::InitForUpdateCheck(nsIURI *aManifestURI,
|
||||||
|
nsIPrincipal* aLoadingPrincipal,
|
||||||
uint32_t aAppID,
|
uint32_t aAppID,
|
||||||
bool aInBrowser,
|
bool aInBrowser,
|
||||||
nsIObserver *aObserver)
|
nsIObserver *aObserver)
|
||||||
@ -1306,7 +1317,7 @@ nsOfflineCacheUpdate::InitForUpdateCheck(nsIURI *aManifestURI,
|
|||||||
|
|
||||||
LOG(("nsOfflineCacheUpdate::InitForUpdateCheck [%p]", this));
|
LOG(("nsOfflineCacheUpdate::InitForUpdateCheck [%p]", this));
|
||||||
|
|
||||||
rv = InitInternal(aManifestURI);
|
rv = InitInternal(aManifestURI, aLoadingPrincipal);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
nsCOMPtr<nsIApplicationCacheService> cacheService =
|
nsCOMPtr<nsIApplicationCacheService> cacheService =
|
||||||
@ -1345,7 +1356,8 @@ nsOfflineCacheUpdate::InitForUpdateCheck(nsIURI *aManifestURI,
|
|||||||
nsresult
|
nsresult
|
||||||
nsOfflineCacheUpdate::InitPartial(nsIURI *aManifestURI,
|
nsOfflineCacheUpdate::InitPartial(nsIURI *aManifestURI,
|
||||||
const nsACString& clientID,
|
const nsACString& clientID,
|
||||||
nsIURI *aDocumentURI)
|
nsIURI *aDocumentURI,
|
||||||
|
nsIPrincipal *aLoadingPrincipal)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
@ -1359,6 +1371,7 @@ nsOfflineCacheUpdate::InitPartial(nsIURI *aManifestURI,
|
|||||||
|
|
||||||
mPartialUpdate = true;
|
mPartialUpdate = true;
|
||||||
mDocumentURI = aDocumentURI;
|
mDocumentURI = aDocumentURI;
|
||||||
|
mLoadingPrincipal = aLoadingPrincipal;
|
||||||
|
|
||||||
mManifestURI = aManifestURI;
|
mManifestURI = aManifestURI;
|
||||||
rv = mManifestURI->GetAsciiHost(mUpdateDomain);
|
rv = mManifestURI->GetAsciiHost(mUpdateDomain);
|
||||||
@ -1696,7 +1709,7 @@ nsOfflineCacheUpdate::ManifestCheckCompleted(nsresult aStatus,
|
|||||||
new nsOfflineCacheUpdate();
|
new nsOfflineCacheUpdate();
|
||||||
// Leave aDocument argument null. Only glues and children keep
|
// Leave aDocument argument null. Only glues and children keep
|
||||||
// document instances.
|
// document instances.
|
||||||
newUpdate->Init(mManifestURI, mDocumentURI, nullptr,
|
newUpdate->Init(mManifestURI, mDocumentURI, mLoadingPrincipal, nullptr,
|
||||||
mCustomProfileDir, mAppID, mInBrowser);
|
mCustomProfileDir, mAppID, mInBrowser);
|
||||||
|
|
||||||
// In a rare case the manifest will not be modified on the next refetch
|
// In a rare case the manifest will not be modified on the next refetch
|
||||||
@ -1748,6 +1761,7 @@ nsOfflineCacheUpdate::Begin()
|
|||||||
|
|
||||||
mManifestItem = new nsOfflineManifestItem(mManifestURI,
|
mManifestItem = new nsOfflineManifestItem(mManifestURI,
|
||||||
mDocumentURI,
|
mDocumentURI,
|
||||||
|
mLoadingPrincipal,
|
||||||
mApplicationCache,
|
mApplicationCache,
|
||||||
mPreviousApplicationCache);
|
mPreviousApplicationCache);
|
||||||
if (!mManifestItem) {
|
if (!mManifestItem) {
|
||||||
@ -1853,7 +1867,7 @@ nsOfflineCacheUpdate::ProcessNextURI()
|
|||||||
// is being updated. The check will call
|
// is being updated. The check will call
|
||||||
// ManifestCheckCompleted() when it's done.
|
// ManifestCheckCompleted() when it's done.
|
||||||
nsRefPtr<nsManifestCheck> manifestCheck =
|
nsRefPtr<nsManifestCheck> manifestCheck =
|
||||||
new nsManifestCheck(this, mManifestURI, mDocumentURI);
|
new nsManifestCheck(this, mManifestURI, mDocumentURI, mLoadingPrincipal);
|
||||||
if (NS_FAILED(manifestCheck->Begin())) {
|
if (NS_FAILED(manifestCheck->Begin())) {
|
||||||
mSucceeded = false;
|
mSucceeded = false;
|
||||||
NotifyState(nsIOfflineCacheUpdateObserver::STATE_ERROR);
|
NotifyState(nsIOfflineCacheUpdateObserver::STATE_ERROR);
|
||||||
@ -2046,7 +2060,7 @@ nsOfflineCacheUpdate::ScheduleImplicit()
|
|||||||
NS_ERROR("Offline cache update not having set mApplicationCache?");
|
NS_ERROR("Offline cache update not having set mApplicationCache?");
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = update->InitPartial(mManifestURI, clientID, mDocumentURI);
|
rv = update->InitPartial(mManifestURI, clientID, mDocumentURI, mLoadingPrincipal);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
for (int32_t i = 0; i < mDocumentURIs.Count(); i++) {
|
for (int32_t i = 0; i < mDocumentURIs.Count(); i++) {
|
||||||
@ -2288,6 +2302,7 @@ nsOfflineCacheUpdate::AddURI(nsIURI *aURI, uint32_t aType)
|
|||||||
nsRefPtr<nsOfflineCacheUpdateItem> item =
|
nsRefPtr<nsOfflineCacheUpdateItem> item =
|
||||||
new nsOfflineCacheUpdateItem(aURI,
|
new nsOfflineCacheUpdateItem(aURI,
|
||||||
mDocumentURI,
|
mDocumentURI,
|
||||||
|
mLoadingPrincipal,
|
||||||
mApplicationCache,
|
mApplicationCache,
|
||||||
mPreviousApplicationCache,
|
mPreviousApplicationCache,
|
||||||
aType);
|
aType);
|
||||||
|
@ -51,16 +51,18 @@ public:
|
|||||||
|
|
||||||
nsOfflineCacheUpdateItem(nsIURI *aURI,
|
nsOfflineCacheUpdateItem(nsIURI *aURI,
|
||||||
nsIURI *aReferrerURI,
|
nsIURI *aReferrerURI,
|
||||||
|
nsIPrincipal* aLoadingPrincipal,
|
||||||
nsIApplicationCache *aApplicationCache,
|
nsIApplicationCache *aApplicationCache,
|
||||||
nsIApplicationCache *aPreviousApplicationCache,
|
nsIApplicationCache *aPreviousApplicationCache,
|
||||||
uint32_t aType);
|
uint32_t aType);
|
||||||
|
|
||||||
nsCOMPtr<nsIURI> mURI;
|
nsCOMPtr<nsIURI> mURI;
|
||||||
nsCOMPtr<nsIURI> mReferrerURI;
|
nsCOMPtr<nsIURI> mReferrerURI;
|
||||||
|
nsCOMPtr<nsIPrincipal> mLoadingPrincipal;
|
||||||
nsCOMPtr<nsIApplicationCache> mApplicationCache;
|
nsCOMPtr<nsIApplicationCache> mApplicationCache;
|
||||||
nsCOMPtr<nsIApplicationCache> mPreviousApplicationCache;
|
nsCOMPtr<nsIApplicationCache> mPreviousApplicationCache;
|
||||||
nsCString mCacheKey;
|
nsCString mCacheKey;
|
||||||
uint32_t mItemType;
|
uint32_t mItemType;
|
||||||
|
|
||||||
nsresult OpenChannel(nsOfflineCacheUpdate *aUpdate);
|
nsresult OpenChannel(nsOfflineCacheUpdate *aUpdate);
|
||||||
nsresult Cancel();
|
nsresult Cancel();
|
||||||
@ -99,6 +101,7 @@ public:
|
|||||||
|
|
||||||
nsOfflineManifestItem(nsIURI *aURI,
|
nsOfflineManifestItem(nsIURI *aURI,
|
||||||
nsIURI *aReferrerURI,
|
nsIURI *aReferrerURI,
|
||||||
|
nsIPrincipal* aLoadingPrincipal,
|
||||||
nsIApplicationCache *aApplicationCache,
|
nsIApplicationCache *aApplicationCache,
|
||||||
nsIApplicationCache *aPreviousApplicationCache);
|
nsIApplicationCache *aPreviousApplicationCache);
|
||||||
virtual ~nsOfflineManifestItem();
|
virtual ~nsOfflineManifestItem();
|
||||||
@ -228,7 +231,7 @@ protected:
|
|||||||
void OnByteProgress(uint64_t byteIncrement);
|
void OnByteProgress(uint64_t byteIncrement);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
nsresult InitInternal(nsIURI *aManifestURI);
|
nsresult InitInternal(nsIURI *aManifestURI, nsIPrincipal* aPrincipal);
|
||||||
nsresult HandleManifest(bool *aDoUpdate);
|
nsresult HandleManifest(bool *aDoUpdate);
|
||||||
nsresult AddURI(nsIURI *aURI, uint32_t aItemType);
|
nsresult AddURI(nsIURI *aURI, uint32_t aItemType);
|
||||||
|
|
||||||
@ -275,6 +278,7 @@ private:
|
|||||||
nsCString mGroupID;
|
nsCString mGroupID;
|
||||||
nsCOMPtr<nsIURI> mManifestURI;
|
nsCOMPtr<nsIURI> mManifestURI;
|
||||||
nsCOMPtr<nsIURI> mDocumentURI;
|
nsCOMPtr<nsIURI> mDocumentURI;
|
||||||
|
nsCOMPtr<nsIPrincipal> mLoadingPrincipal;
|
||||||
nsCOMPtr<nsIFile> mCustomProfileDir;
|
nsCOMPtr<nsIFile> mCustomProfileDir;
|
||||||
|
|
||||||
uint32_t mAppID;
|
uint32_t mAppID;
|
||||||
@ -338,6 +342,7 @@ public:
|
|||||||
|
|
||||||
nsresult Schedule(nsIURI *aManifestURI,
|
nsresult Schedule(nsIURI *aManifestURI,
|
||||||
nsIURI *aDocumentURI,
|
nsIURI *aDocumentURI,
|
||||||
|
nsIPrincipal* aLoadingPrincipal,
|
||||||
nsIDOMDocument *aDocument,
|
nsIDOMDocument *aDocument,
|
||||||
nsIDOMWindow* aWindow,
|
nsIDOMWindow* aWindow,
|
||||||
nsIFile* aCustomProfileDir,
|
nsIFile* aCustomProfileDir,
|
||||||
|
@ -131,10 +131,12 @@ public:
|
|||||||
nsOfflineCachePendingUpdate(nsOfflineCacheUpdateService *aService,
|
nsOfflineCachePendingUpdate(nsOfflineCacheUpdateService *aService,
|
||||||
nsIURI *aManifestURI,
|
nsIURI *aManifestURI,
|
||||||
nsIURI *aDocumentURI,
|
nsIURI *aDocumentURI,
|
||||||
|
nsIPrincipal* aLoadingPrincipal,
|
||||||
nsIDOMDocument *aDocument)
|
nsIDOMDocument *aDocument)
|
||||||
: mService(aService)
|
: mService(aService)
|
||||||
, mManifestURI(aManifestURI)
|
, mManifestURI(aManifestURI)
|
||||||
, mDocumentURI(aDocumentURI)
|
, mDocumentURI(aDocumentURI)
|
||||||
|
, mLoadingPrincipal(aLoadingPrincipal)
|
||||||
, mDidReleaseThis(false)
|
, mDidReleaseThis(false)
|
||||||
{
|
{
|
||||||
mDocument = do_GetWeakReference(aDocument);
|
mDocument = do_GetWeakReference(aDocument);
|
||||||
@ -146,6 +148,7 @@ private:
|
|||||||
nsRefPtr<nsOfflineCacheUpdateService> mService;
|
nsRefPtr<nsOfflineCacheUpdateService> mService;
|
||||||
nsCOMPtr<nsIURI> mManifestURI;
|
nsCOMPtr<nsIURI> mManifestURI;
|
||||||
nsCOMPtr<nsIURI> mDocumentURI;
|
nsCOMPtr<nsIURI> mDocumentURI;
|
||||||
|
nsCOMPtr<nsIPrincipal> mLoadingPrincipal;
|
||||||
nsCOMPtr<nsIWeakReference> mDocument;
|
nsCOMPtr<nsIWeakReference> mDocument;
|
||||||
bool mDidReleaseThis;
|
bool mDidReleaseThis;
|
||||||
};
|
};
|
||||||
@ -218,9 +221,8 @@ nsOfflineCachePendingUpdate::OnStateChange(nsIWebProgress* aWebProgress,
|
|||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
nsCOMPtr<nsIOfflineCacheUpdate> update;
|
nsCOMPtr<nsIOfflineCacheUpdate> update;
|
||||||
mService->Schedule(mManifestURI, mDocumentURI,
|
mService->Schedule(mManifestURI, mDocumentURI, mLoadingPrincipal, updateDoc, window,
|
||||||
updateDoc, window, nullptr,
|
nullptr, appId, isInBrowserElement, getter_AddRefs(update));
|
||||||
appId, isInBrowserElement, getter_AddRefs(update));
|
|
||||||
if (mDidReleaseThis) {
|
if (mDidReleaseThis) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
@ -375,6 +377,7 @@ nsOfflineCacheUpdateService::ScheduleUpdate(nsOfflineCacheUpdate *aUpdate)
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsOfflineCacheUpdateService::ScheduleOnDocumentStop(nsIURI *aManifestURI,
|
nsOfflineCacheUpdateService::ScheduleOnDocumentStop(nsIURI *aManifestURI,
|
||||||
nsIURI *aDocumentURI,
|
nsIURI *aDocumentURI,
|
||||||
|
nsIPrincipal* aLoadingPrincipal,
|
||||||
nsIDOMDocument *aDocument)
|
nsIDOMDocument *aDocument)
|
||||||
{
|
{
|
||||||
LOG(("nsOfflineCacheUpdateService::ScheduleOnDocumentStop [%p, manifestURI=%p, documentURI=%p doc=%p]",
|
LOG(("nsOfflineCacheUpdateService::ScheduleOnDocumentStop [%p, manifestURI=%p, documentURI=%p doc=%p]",
|
||||||
@ -386,8 +389,8 @@ nsOfflineCacheUpdateService::ScheduleOnDocumentStop(nsIURI *aManifestURI,
|
|||||||
|
|
||||||
// Proceed with cache update
|
// Proceed with cache update
|
||||||
nsRefPtr<nsOfflineCachePendingUpdate> update =
|
nsRefPtr<nsOfflineCachePendingUpdate> update =
|
||||||
new nsOfflineCachePendingUpdate(this, aManifestURI,
|
new nsOfflineCachePendingUpdate(this, aManifestURI, aDocumentURI,
|
||||||
aDocumentURI, aDocument);
|
aLoadingPrincipal, aDocument);
|
||||||
NS_ENSURE_TRUE(update, NS_ERROR_OUT_OF_MEMORY);
|
NS_ENSURE_TRUE(update, NS_ERROR_OUT_OF_MEMORY);
|
||||||
|
|
||||||
nsresult rv = progress->AddProgressListener
|
nsresult rv = progress->AddProgressListener
|
||||||
@ -520,6 +523,7 @@ nsOfflineCacheUpdateService::FindUpdate(nsIURI *aManifestURI,
|
|||||||
nsresult
|
nsresult
|
||||||
nsOfflineCacheUpdateService::Schedule(nsIURI *aManifestURI,
|
nsOfflineCacheUpdateService::Schedule(nsIURI *aManifestURI,
|
||||||
nsIURI *aDocumentURI,
|
nsIURI *aDocumentURI,
|
||||||
|
nsIPrincipal* aLoadingPrincipal,
|
||||||
nsIDOMDocument *aDocument,
|
nsIDOMDocument *aDocument,
|
||||||
nsIDOMWindow* aWindow,
|
nsIDOMWindow* aWindow,
|
||||||
nsIFile* aCustomProfileDir,
|
nsIFile* aCustomProfileDir,
|
||||||
@ -545,7 +549,7 @@ nsOfflineCacheUpdateService::Schedule(nsIURI *aManifestURI,
|
|||||||
aWindow->GetApplicationCache(getter_AddRefs(appCacheWindowObject));
|
aWindow->GetApplicationCache(getter_AddRefs(appCacheWindowObject));
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = update->Init(aManifestURI, aDocumentURI, aDocument,
|
rv = update->Init(aManifestURI, aDocumentURI, aLoadingPrincipal, aDocument,
|
||||||
aCustomProfileDir, aAppID, aInBrowser);
|
aCustomProfileDir, aAppID, aInBrowser);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
@ -560,6 +564,7 @@ nsOfflineCacheUpdateService::Schedule(nsIURI *aManifestURI,
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsOfflineCacheUpdateService::ScheduleUpdate(nsIURI *aManifestURI,
|
nsOfflineCacheUpdateService::ScheduleUpdate(nsIURI *aManifestURI,
|
||||||
nsIURI *aDocumentURI,
|
nsIURI *aDocumentURI,
|
||||||
|
nsIPrincipal* aLoadingPrincipal,
|
||||||
nsIDOMWindow *aWindow,
|
nsIDOMWindow *aWindow,
|
||||||
nsIOfflineCacheUpdate **aUpdate)
|
nsIOfflineCacheUpdate **aUpdate)
|
||||||
{
|
{
|
||||||
@ -569,22 +574,24 @@ nsOfflineCacheUpdateService::ScheduleUpdate(nsIURI *aManifestURI,
|
|||||||
nsresult rv = GetAppIDAndInBrowserFromWindow(aWindow, &appId, &isInBrowser);
|
nsresult rv = GetAppIDAndInBrowserFromWindow(aWindow, &appId, &isInBrowser);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
return Schedule(aManifestURI, aDocumentURI, nullptr, aWindow, nullptr,
|
return Schedule(aManifestURI, aDocumentURI, aLoadingPrincipal, nullptr, aWindow,
|
||||||
appId, isInBrowser, aUpdate);
|
nullptr, appId, isInBrowser, aUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsOfflineCacheUpdateService::ScheduleAppUpdate(nsIURI *aManifestURI,
|
nsOfflineCacheUpdateService::ScheduleAppUpdate(nsIURI *aManifestURI,
|
||||||
nsIURI *aDocumentURI,
|
nsIURI *aDocumentURI,
|
||||||
|
nsIPrincipal* aLoadingPrincipal,
|
||||||
uint32_t aAppID, bool aInBrowser,
|
uint32_t aAppID, bool aInBrowser,
|
||||||
nsIFile *aProfileDir,
|
nsIFile *aProfileDir,
|
||||||
nsIOfflineCacheUpdate **aUpdate)
|
nsIOfflineCacheUpdate **aUpdate)
|
||||||
{
|
{
|
||||||
return Schedule(aManifestURI, aDocumentURI, nullptr, nullptr, aProfileDir,
|
return Schedule(aManifestURI, aDocumentURI, aLoadingPrincipal, nullptr, nullptr,
|
||||||
aAppID, aInBrowser, aUpdate);
|
aProfileDir, aAppID, aInBrowser, aUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsOfflineCacheUpdateService::CheckForUpdate(nsIURI *aManifestURI,
|
NS_IMETHODIMP nsOfflineCacheUpdateService::CheckForUpdate(nsIURI *aManifestURI,
|
||||||
|
nsIPrincipal* aLoadingPrincipal,
|
||||||
uint32_t aAppID,
|
uint32_t aAppID,
|
||||||
bool aInBrowser,
|
bool aInBrowser,
|
||||||
nsIObserver *aObserver)
|
nsIObserver *aObserver)
|
||||||
@ -598,7 +605,7 @@ NS_IMETHODIMP nsOfflineCacheUpdateService::CheckForUpdate(nsIURI *aManifestURI,
|
|||||||
|
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
rv = update->InitForUpdateCheck(aManifestURI, aAppID, aInBrowser, aObserver);
|
rv = update->InitForUpdateCheck(aManifestURI, aLoadingPrincipal, aAppID, aInBrowser, aObserver);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
rv = update->Schedule();
|
rv = update->Schedule();
|
||||||
|
Loading…
Reference in New Issue
Block a user