mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-18 14:56:07 +00:00
Bug 964875 part 1. Add a WebIDL ChromeWindow interface for use in instanceof once Window is on WebIDL bindings. r=peterv
This commit is contained in:
parent
6a25a13986
commit
b58f2006a2
@ -213,6 +213,11 @@ DOMInterfaces = {
|
||||
'concrete': False
|
||||
},
|
||||
|
||||
'ChromeWindow': {
|
||||
'concrete': False,
|
||||
'register': False,
|
||||
},
|
||||
|
||||
'ChromeWorker': {
|
||||
'headerFile': 'mozilla/dom/WorkerPrivate.h',
|
||||
'nativeType': 'mozilla::dom::workers::ChromeWorkerPrivate',
|
||||
@ -1494,6 +1499,8 @@ DOMInterfaces = {
|
||||
|
||||
'Window': {
|
||||
'nativeType': 'nsGlobalWindow',
|
||||
# When turning on Window, remember to drop the "'register': False"
|
||||
# from ChromeWindow.
|
||||
'hasXPConnectImpls': True,
|
||||
'register': False,
|
||||
'implicitJSContext': [ 'setInterval', 'setTimeout' ],
|
||||
|
@ -1286,15 +1286,19 @@ class CGClassHasInstanceHook(CGAbstractStaticMethod):
|
||||
return true;
|
||||
}
|
||||
"""
|
||||
if self.descriptor.interface.identifier.name == "ChromeWindow":
|
||||
setBp = "*bp = UnwrapDOMObject<nsGlobalWindow>(js::UncheckedUnwrap(instance))->IsChromeWindow()"
|
||||
else:
|
||||
setBp = "*bp = true"
|
||||
# Sort interaces implementing self by name so we get stable output.
|
||||
for iface in sorted(self.descriptor.interface.interfacesImplementingSelf,
|
||||
key=lambda iface: iface.identifier.name):
|
||||
hasInstanceCode += """
|
||||
if (domClass->mInterfaceChain[PrototypeTraits<prototypes::id::%s>::Depth] == prototypes::id::%s) {
|
||||
*bp = true;
|
||||
%s;
|
||||
return true;
|
||||
}
|
||||
""" % (iface.identifier.name, iface.identifier.name)
|
||||
""" % (iface.identifier.name, iface.identifier.name, setBp)
|
||||
hasInstanceCode += " return true;"
|
||||
return header + hasInstanceCode;
|
||||
|
||||
|
@ -339,3 +339,7 @@ partial interface Window {
|
||||
Window implements TouchEventHandlers;
|
||||
|
||||
Window implements OnErrorEventHandlerForWindow;
|
||||
|
||||
[ChromeOnly] interface ChromeWindow {};
|
||||
|
||||
Window implements ChromeWindow;
|
||||
|
Loading…
x
Reference in New Issue
Block a user