mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1156847 - Part 2: Store the security info for a service worker on its WorkerPrivate; r=bent,khuey
This commit is contained in:
parent
6fce504a7a
commit
0b4ac3bba8
@ -32,6 +32,7 @@
|
||||
#include "nsIXPConnect.h"
|
||||
#include "nsPerformance.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsSerializationHelper.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include "jsfriendapi.h"
|
||||
@ -4081,6 +4082,17 @@ WorkerPrivateParent<Derived>::SetPrincipal(nsIPrincipal* aPrincipal,
|
||||
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>
|
||||
JSContext*
|
||||
WorkerPrivateParent<Derived>::ParentJSContext() const
|
||||
|
@ -37,6 +37,7 @@ class nsIDocument;
|
||||
class nsIEventTarget;
|
||||
class nsIPrincipal;
|
||||
class nsIScriptContext;
|
||||
class nsISerializable;
|
||||
class nsIThread;
|
||||
class nsIThreadInternal;
|
||||
class nsITimer;
|
||||
@ -491,6 +492,25 @@ public:
|
||||
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
|
||||
// and executed, it happens in a sync loop. At this point it sets
|
||||
// mLoadingWorkerScript to true. importScripts() calls that occur during the
|
||||
|
@ -243,6 +243,8 @@ struct WorkerLoadInfo
|
||||
|
||||
nsString mServiceWorkerCacheName;
|
||||
|
||||
nsCString mSecurityInfo;
|
||||
|
||||
uint64_t mWindowID;
|
||||
|
||||
bool mFromWindow;
|
||||
|
Loading…
Reference in New Issue
Block a user