mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-05 07:18:39 +09:00
Issue #2736 - Part 14: Make CSP-enabled available to workers.
This commit is contained in:
parent
727acf7b3f
commit
53a6f6349d
5 changed files with 79 additions and 39 deletions
|
|
@ -8980,6 +8980,25 @@ nsContentUtils::StreamsEnabled(JSContext* aCx, JSObject* aObj)
|
|||
return workerPrivate->StreamsEnabled();
|
||||
}
|
||||
|
||||
// static
|
||||
bool
|
||||
nsContentUtils::CSPEnabled(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
if (NS_IsMainThread()) {
|
||||
return Preferences::GetBool("security.csp.enabled", true);
|
||||
}
|
||||
|
||||
using namespace workers;
|
||||
|
||||
// Otherwise, check the pref via the WorkerPrivate
|
||||
WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
|
||||
if (!workerPrivate) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return workerPrivate->CSPEnabled();
|
||||
}
|
||||
|
||||
// static
|
||||
bool
|
||||
nsContentUtils::IsNonSubresourceRequest(nsIChannel* aChannel)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue