Bug 1757846 - Treat BackstagePass as Window when checking for unexposed globals r=nika
Differential Revision: https://phabricator.services.mozilla.com/D140124
This commit is contained in:
@@ -2825,25 +2825,20 @@ bool EnumerateGlobal(JSContext* aCx, JS::HandleObject aObj,
|
||||
bool IsNonExposedGlobal(JSContext* aCx, JSObject* aGlobal,
|
||||
uint32_t aNonExposedGlobals) {
|
||||
MOZ_ASSERT(aNonExposedGlobals, "Why did we get called?");
|
||||
MOZ_ASSERT(
|
||||
(aNonExposedGlobals & ~(GlobalNames::Window | GlobalNames::BackstagePass |
|
||||
GlobalNames::DedicatedWorkerGlobalScope |
|
||||
GlobalNames::SharedWorkerGlobalScope |
|
||||
GlobalNames::ServiceWorkerGlobalScope |
|
||||
GlobalNames::WorkerDebuggerGlobalScope |
|
||||
GlobalNames::WorkletGlobalScope |
|
||||
GlobalNames::AudioWorkletGlobalScope |
|
||||
GlobalNames::PaintWorkletGlobalScope)) == 0,
|
||||
"Unknown non-exposed global type");
|
||||
MOZ_ASSERT((aNonExposedGlobals &
|
||||
~(GlobalNames::Window | GlobalNames::DedicatedWorkerGlobalScope |
|
||||
GlobalNames::SharedWorkerGlobalScope |
|
||||
GlobalNames::ServiceWorkerGlobalScope |
|
||||
GlobalNames::WorkerDebuggerGlobalScope |
|
||||
GlobalNames::WorkletGlobalScope |
|
||||
GlobalNames::AudioWorkletGlobalScope |
|
||||
GlobalNames::PaintWorkletGlobalScope)) == 0,
|
||||
"Unknown non-exposed global type");
|
||||
|
||||
const char* name = JS::GetClass(aGlobal)->name;
|
||||
|
||||
if ((aNonExposedGlobals & GlobalNames::Window) && !strcmp(name, "Window")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((aNonExposedGlobals & GlobalNames::BackstagePass) &&
|
||||
!strcmp(name, "BackstagePass")) {
|
||||
if ((aNonExposedGlobals & GlobalNames::Window) &&
|
||||
(!strcmp(name, "Window") || !strcmp(name, "BackstagePass"))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -106,14 +106,13 @@ namespace GlobalNames {
|
||||
// interfaces, not of the global names used to refer to them in IDL [Exposed]
|
||||
// annotations.
|
||||
static const uint32_t Window = 1u << 0;
|
||||
static const uint32_t BackstagePass = 1u << 1;
|
||||
static const uint32_t DedicatedWorkerGlobalScope = 1u << 2;
|
||||
static const uint32_t SharedWorkerGlobalScope = 1u << 3;
|
||||
static const uint32_t ServiceWorkerGlobalScope = 1u << 4;
|
||||
static const uint32_t WorkerDebuggerGlobalScope = 1u << 5;
|
||||
static const uint32_t WorkletGlobalScope = 1u << 6;
|
||||
static const uint32_t AudioWorkletGlobalScope = 1u << 7;
|
||||
static const uint32_t PaintWorkletGlobalScope = 1u << 8;
|
||||
static const uint32_t DedicatedWorkerGlobalScope = 1u << 1;
|
||||
static const uint32_t SharedWorkerGlobalScope = 1u << 2;
|
||||
static const uint32_t ServiceWorkerGlobalScope = 1u << 3;
|
||||
static const uint32_t WorkerDebuggerGlobalScope = 1u << 4;
|
||||
static const uint32_t WorkletGlobalScope = 1u << 5;
|
||||
static const uint32_t AudioWorkletGlobalScope = 1u << 6;
|
||||
static const uint32_t PaintWorkletGlobalScope = 1u << 7;
|
||||
} // namespace GlobalNames
|
||||
|
||||
struct PrefableDisablers {
|
||||
|
||||
@@ -612,7 +612,7 @@ bool IndexedDatabaseManager::ExperimentalFeaturesEnabled(JSContext* aCx,
|
||||
// actually going through IndexedDatabaseManager.
|
||||
// See Bug 1198093 comment 14 for detailed explanation.
|
||||
MOZ_DIAGNOSTIC_ASSERT(JS_IsGlobalObject(aGlobal));
|
||||
if (IsNonExposedGlobal(aCx, aGlobal, GlobalNames::BackstagePass)) {
|
||||
if (!strcmp(JS::GetClass(aGlobal)->name, "BackstagePass")) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
static bool featureRetrieved = false;
|
||||
if (!featureRetrieved) {
|
||||
|
||||
Reference in New Issue
Block a user