mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 776797 - Lock down POfflineCacheUpdate, r=jduell
This commit is contained in:
parent
94e7239133
commit
f5af1bf338
@ -55,6 +55,7 @@ namespace docshell {
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
NS_INTERFACE_MAP_BEGIN(OfflineCacheUpdateChild)
|
NS_INTERFACE_MAP_BEGIN(OfflineCacheUpdateChild)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIOfflineCacheUpdate)
|
NS_INTERFACE_MAP_ENTRY(nsIOfflineCacheUpdate)
|
||||||
NS_INTERFACE_MAP_END
|
NS_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include "mozilla/ipc/URIUtils.h"
|
#include "mozilla/ipc/URIUtils.h"
|
||||||
#include "nsOfflineCacheUpdate.h"
|
#include "nsOfflineCacheUpdate.h"
|
||||||
#include "nsIApplicationCache.h"
|
#include "nsIApplicationCache.h"
|
||||||
|
#include "nsNetUtil.h"
|
||||||
|
|
||||||
using namespace mozilla::ipc;
|
using namespace mozilla::ipc;
|
||||||
|
|
||||||
@ -83,20 +84,30 @@ OfflineCacheUpdateParent::Schedule(const URIParams& aManifestURI,
|
|||||||
if (!manifestURI)
|
if (!manifestURI)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
nsCOMPtr<nsIURI> documentURI = DeserializeURI(aDocumentURI);
|
|
||||||
if (!documentURI)
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
|
|
||||||
nsOfflineCacheUpdateService* service =
|
nsOfflineCacheUpdateService* service =
|
||||||
nsOfflineCacheUpdateService::EnsureService();
|
nsOfflineCacheUpdateService::EnsureService();
|
||||||
if (!service)
|
if (!service)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
bool offlinePermissionAllowed = false;
|
||||||
|
nsresult rv = service->OfflineAppAllowedForURI(
|
||||||
|
manifestURI, nullptr, &offlinePermissionAllowed);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
if (!offlinePermissionAllowed)
|
||||||
|
return NS_ERROR_DOM_SECURITY_ERR;
|
||||||
|
|
||||||
|
nsCOMPtr<nsIURI> documentURI = DeserializeURI(aDocumentURI);
|
||||||
|
if (!documentURI)
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
if (!NS_SecurityCompareURIs(manifestURI, documentURI, false))
|
||||||
|
return NS_ERROR_DOM_SECURITY_ERR;
|
||||||
|
|
||||||
service->FindUpdate(manifestURI, this, getter_AddRefs(update));
|
service->FindUpdate(manifestURI, this, getter_AddRefs(update));
|
||||||
if (!update) {
|
if (!update) {
|
||||||
update = new nsOfflineCacheUpdate();
|
update = new nsOfflineCacheUpdate();
|
||||||
|
|
||||||
nsresult 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, this);
|
rv = update->Init(manifestURI, documentURI, nullptr, nullptr, this);
|
||||||
|
Loading…
Reference in New Issue
Block a user