Bug 856819 part 2. Sort js-implemented interfaces in a given file so that the declarations in C++ come in the right order. r=mccr8

This commit is contained in:
Boris Zbarsky 2013-04-03 22:22:16 -04:00
parent 7879480d35
commit 33622efb8b
3 changed files with 28 additions and 1 deletions

View File

@ -1228,6 +1228,16 @@ DOMInterfaces = {
'register': False
},
'TestJSImplInterface5' : {
'headerFile': 'TestJSImplGenBinding.h',
'register': False
},
'TestJSImplInterface6' : {
'headerFile': 'TestJSImplGenBinding.h',
'register': False
},
'TestExternalInterface' : {
'nativeType': 'mozilla::dom::TestExternalInterface',
'headerFile': 'TestBindingHeader.h',

View File

@ -7325,7 +7325,12 @@ class CGBindingRoot(CGThing):
cgthings.extend([CGCallbackInterface(x) for x in callbackDescriptors])
# Do codegen for JS implemented classes
for x in jsImplemented:
def getParentDescriptor(desc):
if not desc.interface.parent:
return set()
return { desc.getDescriptor(desc.interface.parent.identifier.name) }
for x in dependencySortObjects(jsImplemented, getParentDescriptor,
lambda d: d.interface.identifier.name):
cgthings.append(CGCallbackInterface(x))
cgthings.append(CGJSImplClass(x))

View File

@ -12,6 +12,18 @@ interface TestJSImplInterface2 : TestCImplementedInterface {
interface TestJSImplInterface3 : TestCImplementedInterface2 {
};
// Important: TestJSImplInterface5 needs to come before TestJSImplInterface6 in
// this file to test what it's trying to test.
[Constructor, JSImplementation="@mozilla.org/test-js-impl-interface5;1"]
interface TestJSImplInterface5 : TestJSImplInterface6 {
};
// Important: TestJSImplInterface6 needs to come after TestJSImplInterface3 in
// this file to test what it's trying to test.
[Constructor, JSImplementation="@mozilla.org/test-js-impl-interface6;1"]
interface TestJSImplInterface6 : TestJSImplInterface3 {
};
[Constructor, JSImplementation="@mozilla.org/test-js-impl-interface4;1"]
interface TestJSImplInterface4 : EventTarget {
};