mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1081241. Things that aren't exposed in Window shouldn't show up in RegisterBindings at all. r=smaug
This commit is contained in:
parent
974e903ab1
commit
fef53f4f8c
@ -3012,26 +3012,26 @@ class CGConstructorEnabled(CGAbstractMethod):
|
||||
if not iface.isExposedInWindow():
|
||||
exposedInWindowCheck = dedent(
|
||||
"""
|
||||
if (NS_IsMainThread()) {
|
||||
return false;
|
||||
}
|
||||
MOZ_ASSERT(!NS_IsMainThread(), "Why did we even get called?");
|
||||
""")
|
||||
body.append(CGGeneric(exposedInWindowCheck))
|
||||
|
||||
if iface.isExposedInAnyWorker() and iface.isExposedOnlyInSomeWorkers():
|
||||
if iface.isExposedInSomeButNotAllWorkers():
|
||||
workerGlobals = sorted(iface.getWorkerExposureSet())
|
||||
workerCondition = CGList((CGGeneric('strcmp(name, "%s")' % workerGlobal)
|
||||
for workerGlobal in workerGlobals), " && ")
|
||||
exposedInWorkerCheck = fill(
|
||||
"""
|
||||
if (!NS_IsMainThread()) {
|
||||
const char* name = js::GetObjectClass(aObj)->name;
|
||||
if (${workerCondition}) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
""", workerCondition=workerCondition.define())
|
||||
body.append(CGGeneric(exposedInWorkerCheck))
|
||||
exposedInWorkerCheck = CGGeneric(exposedInWorkerCheck)
|
||||
if iface.isExposedInWindow():
|
||||
exposedInWorkerCheck = CGIfWrapper(exposedInWorkerCheck,
|
||||
"!NS_IsMainThread()")
|
||||
body.append(exposedInWorkerCheck)
|
||||
|
||||
pref = iface.getExtendedAttribute("Pref")
|
||||
if pref:
|
||||
@ -11958,6 +11958,7 @@ class CGRegisterProtos(CGAbstractMethod):
|
||||
for desc in self.config.getDescriptors(hasInterfaceObject=True,
|
||||
isExternal=False,
|
||||
workers=False,
|
||||
isExposedInWindow=True,
|
||||
register=True):
|
||||
lines.append("REGISTER_PROTO(%s, %s);\n" % (desc.name, getCheck(desc)))
|
||||
lines.extend("REGISTER_CONSTRUCTOR(%s, %s, %s);\n" % (n.identifier.name, desc.name, getCheck(desc))
|
||||
@ -12226,10 +12227,6 @@ class CGBindingRoot(CGThing):
|
||||
workers=True)) != 0
|
||||
bindingHeaders["WorkerPrivate.h"] = hasWorkerStuff
|
||||
|
||||
def descriptorHasThreadChecks(desc):
|
||||
return ((not desc.workers and not desc.interface.isExposedInWindow()) or
|
||||
(desc.interface.isExposedInAnyWorker() and desc.interface.isExposedOnlyInSomeWorkers()))
|
||||
|
||||
hasThreadChecks = hasWorkerStuff or any(d.hasThreadChecks() for d in descriptors)
|
||||
bindingHeaders["nsThreadUtils.h"] = hasThreadChecks
|
||||
|
||||
@ -14400,6 +14397,7 @@ class GlobalGenRoots():
|
||||
defineIncludes = [CGHeaders.getDeclarationFilename(desc.interface)
|
||||
for desc in config.getDescriptors(hasInterfaceObject=True,
|
||||
workers=False,
|
||||
isExposedInWindow=True,
|
||||
register=True)]
|
||||
defineIncludes.append('nsScriptNameSpaceManager.h')
|
||||
defineIncludes.extend([CGHeaders.getDeclarationFilename(desc.interface)
|
||||
|
@ -210,6 +210,9 @@ class Configuration:
|
||||
elif key == 'isExposedInSystemGlobals':
|
||||
getter = lambda x: (not x.interface.isExternal() and
|
||||
x.interface.isExposedInSystemGlobals())
|
||||
elif key == 'isExposedInWindow':
|
||||
getter = lambda x: (not x.interface.isExternal() and
|
||||
x.interface.isExposedInWindow())
|
||||
else:
|
||||
# Have to watch out: just closing over "key" is not enough,
|
||||
# since we're about to mutate its value
|
||||
@ -654,12 +657,13 @@ class Descriptor(DescriptorProvider):
|
||||
in self.interface.members))
|
||||
|
||||
def hasThreadChecks(self):
|
||||
return ((not self.workers and not self.interface.isExposedInWindow()) or
|
||||
(self.interface.isExposedInAnyWorker() and
|
||||
self.interface.isExposedOnlyInSomeWorkers()))
|
||||
return ((self.isExposedConditionally() and
|
||||
not self.interface.isExposedInWindow()) or
|
||||
self.interface.isExposedInSomeButNotAllWorkers())
|
||||
|
||||
def isExposedConditionally(self):
|
||||
return self.interface.isExposedConditionally() or self.hasThreadChecks()
|
||||
return (self.interface.isExposedConditionally() or
|
||||
self.interface.isExposedInSomeButNotAllWorkers())
|
||||
|
||||
def needsXrayResolveHooks(self):
|
||||
"""
|
||||
|
@ -1072,8 +1072,15 @@ class IDLInterface(IDLObjectWithScope):
|
||||
def isExposedInSystemGlobals(self):
|
||||
return 'BackstagePass' in self.exposureSet
|
||||
|
||||
def isExposedOnlyInSomeWorkers(self):
|
||||
assert self.isExposedInAnyWorker()
|
||||
def isExposedInSomeButNotAllWorkers(self):
|
||||
"""
|
||||
Returns true if the Exposed extended attribute for this interface
|
||||
exposes it in some worker globals but not others. The return value does
|
||||
not depend on whether the interface is exposed in Window or System
|
||||
globals.
|
||||
"""
|
||||
if not self.isExposedInAnyWorker():
|
||||
return False
|
||||
workerScopes = self.parentScope.globalNameMapping["Worker"]
|
||||
return len(workerScopes.difference(self.exposureSet)) > 0
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user