Bug 1239788 - Don't include non-main-thread assertions in the constructor enabled check for [Exposed=System] WebIDL interfaces; r=bzbarsky

This commit is contained in:
Ehsan Akhgari 2016-01-14 14:18:50 -05:00
parent 50027e1417
commit 086b12d574
2 changed files with 6 additions and 2 deletions

View File

@ -3240,7 +3240,7 @@ class CGConstructorEnabled(CGAbstractMethod):
conditions = []
iface = self.descriptor.interface
if not iface.isExposedInWindow():
if not iface.isExposedOnMainThread():
exposedInWindowCheck = dedent(
"""
MOZ_ASSERT(!NS_IsMainThread(), "Why did we even get called?");
@ -3259,7 +3259,7 @@ class CGConstructorEnabled(CGAbstractMethod):
}
""", workerCondition=workerCondition.define())
exposedInWorkerCheck = CGGeneric(exposedInWorkerCheck)
if iface.isExposedInWindow():
if iface.isExposedOnMainThread():
exposedInWorkerCheck = CGIfWrapper(exposedInWorkerCheck,
"!NS_IsMainThread()")
body.append(exposedInWorkerCheck)

View File

@ -501,6 +501,10 @@ class IDLExposureMixins():
def isExposedInWindow(self):
return 'Window' in self.exposureSet
def isExposedOnMainThread(self):
return (self.isExposedInWindow() or
self.isExposedInSystemGlobals())
def isExposedInAnyWorker(self):
return len(self.getWorkerExposureSet()) > 0