зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1156847 - Part 2: Store the security info for a service worker on its WorkerPrivate; r=bent,khuey
This commit is contained in:
Родитель
03b15b61fd
Коммит
9d614e4dc8
|
@ -32,6 +32,7 @@
|
||||||
#include "nsIXPConnect.h"
|
#include "nsIXPConnect.h"
|
||||||
#include "nsPerformance.h"
|
#include "nsPerformance.h"
|
||||||
#include "nsPIDOMWindow.h"
|
#include "nsPIDOMWindow.h"
|
||||||
|
#include "nsSerializationHelper.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "jsfriendapi.h"
|
#include "jsfriendapi.h"
|
||||||
|
@ -4081,6 +4082,17 @@ WorkerPrivateParent<Derived>::SetPrincipal(nsIPrincipal* aPrincipal,
|
||||||
PrincipalToPrincipalInfo(aPrincipal, mLoadInfo.mPrincipalInfo)));
|
PrincipalToPrincipalInfo(aPrincipal, mLoadInfo.mPrincipalInfo)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class Derived>
|
||||||
|
void
|
||||||
|
WorkerPrivateParent<Derived>::SetSecurityInfo(nsISerializable* aSerializable)
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(IsServiceWorker());
|
||||||
|
AssertIsOnMainThread();
|
||||||
|
nsAutoCString securityInfo;
|
||||||
|
NS_SerializeToString(aSerializable, securityInfo);
|
||||||
|
SetSecurityInfo(securityInfo);
|
||||||
|
}
|
||||||
|
|
||||||
template <class Derived>
|
template <class Derived>
|
||||||
JSContext*
|
JSContext*
|
||||||
WorkerPrivateParent<Derived>::ParentJSContext() const
|
WorkerPrivateParent<Derived>::ParentJSContext() const
|
||||||
|
|
|
@ -37,6 +37,7 @@ class nsIDocument;
|
||||||
class nsIEventTarget;
|
class nsIEventTarget;
|
||||||
class nsIPrincipal;
|
class nsIPrincipal;
|
||||||
class nsIScriptContext;
|
class nsIScriptContext;
|
||||||
|
class nsISerializable;
|
||||||
class nsIThread;
|
class nsIThread;
|
||||||
class nsIThreadInternal;
|
class nsIThreadInternal;
|
||||||
class nsITimer;
|
class nsITimer;
|
||||||
|
@ -491,6 +492,25 @@ public:
|
||||||
return mLoadInfo.mServiceWorkerCacheName;
|
return mLoadInfo.mServiceWorkerCacheName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const nsCString&
|
||||||
|
GetSecurityInfo() const
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(IsServiceWorker());
|
||||||
|
return mLoadInfo.mSecurityInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SetSecurityInfo(const nsCString& aSecurityInfo)
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(IsServiceWorker());
|
||||||
|
AssertIsOnMainThread();
|
||||||
|
MOZ_ASSERT(mLoadInfo.mSecurityInfo.IsEmpty());
|
||||||
|
mLoadInfo.mSecurityInfo = aSecurityInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SetSecurityInfo(nsISerializable* aSerializable);
|
||||||
|
|
||||||
// This is used to handle importScripts(). When the worker is first loaded
|
// This is used to handle importScripts(). When the worker is first loaded
|
||||||
// and executed, it happens in a sync loop. At this point it sets
|
// and executed, it happens in a sync loop. At this point it sets
|
||||||
// mLoadingWorkerScript to true. importScripts() calls that occur during the
|
// mLoadingWorkerScript to true. importScripts() calls that occur during the
|
||||||
|
|
|
@ -243,6 +243,8 @@ struct WorkerLoadInfo
|
||||||
|
|
||||||
nsString mServiceWorkerCacheName;
|
nsString mServiceWorkerCacheName;
|
||||||
|
|
||||||
|
nsCString mSecurityInfo;
|
||||||
|
|
||||||
uint64_t mWindowID;
|
uint64_t mWindowID;
|
||||||
|
|
||||||
bool mFromWindow;
|
bool mFromWindow;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче