Bug 1890144 - Don't emit ts typedefs for TSNoncompat types r=xpcom-reviewers,mccr8

Differential Revision: https://phabricator.services.mozilla.com/D207061
This commit is contained in:
Tomislav Jovanovic 2024-04-15 15:53:32 +00:00
parent 7b9c6effa0
commit 06e01aae30
3 changed files with 18 additions and 12 deletions

View file

@ -18,25 +18,29 @@ interface nsIXPCTestUtils : nsISupports {
nsIXPCTestFunctionInterface doubleWrapFunction(in nsIXPCTestFunctionInterface f);
};
/*
* Test that non-[scriptable] interfaces and [noscript] members are not
* generated for TypeScript bindings.
/**
* TypeScript bindings specific tests.
*/
// Typedefs with a TSNoncompat underlying type are not defined.
typedef voidPtr Noncompat;
// Not [scriptable] interfaces are not generated.
[uuid(ddf64cfb-668a-4571-a900-0fe2babb6249)]
interface nsIXPCTestNotScriptable : nsISupports {
// Empty.
};
[scriptable, uuid(1bbfe703-c67d-4995-b061-564c8a1c39d7)]
interface nsIXPCTestNoScriptMembers : nsISupports {
[noscript]
attribute long noscriptProp;
interface nsIXPCTestTypeScript : nsISupports {
attribute long exposedProp;
[noscript]
void noscriptMethod(in long arg);
void exposedMethod(in long arg);
// Members referencing TSNoncompat typedefs are not exposed.
attribute Noncompat noncompatProp;
void noncompatMethod(in Noncompat arg);
// [noscript] attributes and methods are not exposed.
[noscript] attribute long noscriptProp;
[noscript] void noscriptMethod(in long arg);
};

View file

@ -1313,7 +1313,7 @@
"callable": false,
"consts": [],
"enums": [],
"id": "nsIXPCTestNoScriptMembers",
"id": "nsIXPCTestTypeScript",
"members": [
{
"name": "exposedProp",

View file

@ -524,6 +524,8 @@ class Typedef(object):
return "%s%s" % ("*mut " if "out" in calltype else "", self.name)
def tsType(self):
# Make sure that underlying type is supported: doesn't throw TSNoncompat.
self.realtype.tsType()
return self.name
def __str__(self):