Bug 1017988 part 9. Don't codegen window-only things on worker descriptors. r=khuey

This commit is contained in:
Boris Zbarsky 2014-08-04 22:20:34 -04:00
Родитель 12b78b9612
Коммит 26b26e1121
4 изменённых файлов: 18 добавлений и 22 удалений

Просмотреть файл

@ -353,6 +353,8 @@ DOMInterfaces = {
'URL': 'documentURIFromJS'
}
},
# Note: we still need the worker descriptor here because
# XMLHttpRequest.send() uses it.
{
'nativeType': 'JSObject',
'workers': True,
@ -822,14 +824,10 @@ DOMInterfaces = {
'nativeType': 'mozilla::dom::HTMLCanvasPrintState',
},
'MozChannel': [
{
'MozChannel': {
'nativeType': 'nsIChannel',
'notflattened': True
},
{
'workers': True,
}],
'MozCellBroadcast': {
'nativeType': 'mozilla::dom::CellBroadcast',

Просмотреть файл

@ -2032,6 +2032,11 @@ def methodLength(method):
return min(overloadLength(arguments) for retType, arguments in signatures)
def isMaybeExposedIn(member, descriptor):
# All we can say for sure is that if this is a worker descriptor
# and member is only exposed in windows, then it's not exposed.
return not descriptor.workers or member.exposureSet != set(["Window"])
class MethodDefiner(PropertyDefiner):
"""
A class for defining methods on a prototype object.
@ -2049,7 +2054,8 @@ class MethodDefiner(PropertyDefiner):
methods = [m for m in descriptor.interface.members if
m.isMethod() and m.isStatic() == static and
MemberIsUnforgeable(m, descriptor) == unforgeable and
not m.isIdentifierLess()]
not m.isIdentifierLess() and
isMaybeExposedIn(m, descriptor)]
else:
methods = []
self.chrome = []
@ -2263,7 +2269,8 @@ class AttrDefiner(PropertyDefiner):
if descriptor.interface.hasInterfacePrototypeObject() or static:
attributes = [m for m in descriptor.interface.members if
m.isAttr() and m.isStatic() == static and
MemberIsUnforgeable(m, descriptor) == unforgeable]
MemberIsUnforgeable(m, descriptor) == unforgeable and
isMaybeExposedIn(m, descriptor)]
else:
attributes = []
self.chrome = [m for m in attributes if isChromeOnly(m)]
@ -2346,7 +2353,8 @@ class ConstDefiner(PropertyDefiner):
def __init__(self, descriptor, name):
PropertyDefiner.__init__(self, descriptor, name)
self.name = name
constants = [m for m in descriptor.interface.members if m.isConst()]
constants = [m for m in descriptor.interface.members if m.isConst() and
isMaybeExposedIn(m, descriptor)]
self.chrome = [m for m in constants if isChromeOnly(m)]
self.regular = [m for m in constants if not isChromeOnly(m)]
@ -10469,6 +10477,8 @@ class CGDescriptor(CGThing):
for m in descriptor.interface.members:
if m.isMethod() and m.identifier.name == 'queryInterface':
continue
if not isMaybeExposedIn(m, descriptor):
continue
if m.isMethod() and m == descriptor.operations['Jsonifier']:
hasJsonifier = True
hasMethod = descriptor.needsSpecialGenericOps()

Просмотреть файл

@ -130,7 +130,7 @@ interface XMLHttpRequest : XMLHttpRequestEventTarget {
[Throws]
readonly attribute DOMString? responseText;
[Throws=MainThread, Exposed=Window]
[Throws, Exposed=Window]
readonly attribute Document? responseXML;
// Mozilla-specific stuff
@ -138,7 +138,7 @@ interface XMLHttpRequest : XMLHttpRequestEventTarget {
[ChromeOnly, SetterThrows=Workers]
attribute boolean mozBackgroundRequest;
[ChromeOnly]
[ChromeOnly, Exposed=Window]
readonly attribute MozChannel? channel;
[Throws]

Просмотреть файл

@ -220,18 +220,6 @@ public:
void
GetResponseText(nsAString& aResponseText, ErrorResult& aRv);
JSObject*
GetResponseXML() const
{
return nullptr;
}
JSObject*
GetChannel() const
{
return nullptr;
}
void
GetInterface(JSContext* cx, JS::Handle<JSObject*> aIID,
JS::MutableHandle<JS::Value> aRetval, ErrorResult& aRv)