diff options
author | Stephan Bergmann <stephan.bergmann@allotropia.de> | 2024-04-18 16:05:48 +0200 |
---|---|---|
committer | Stephan Bergmann <stephan.bergmann@allotropia.de> | 2024-04-19 21:20:59 +0200 |
commit | 1c81f63e91d39187748ea070d064e996481dbd3d (patch) | |
tree | 5317699bd9716e27164c80d84a59a9d63baac510 /offapi/org | |
parent | 41706fcd962a38627d20f62488c6110967396ee7 (diff) |
Embind: Consistently represent empty interface references as JS null
The existing code had two issues: For one, e.g. calling a function that
returned a null interface reference mapped that to JS null, while querying an
object for a non-supported interface via `new css.uno.X...(y)` mapped that to
an "empty" JS object instead. (So checking for a non-null reference needed to
be done as either `x !=== null` or as `x.is()`, depending on context.) And for
another, while calling $is() on a non-"empty" object worked fine, it failed on
such an "empty" object (as the Embind internals of that object lacked the $$
property).
So change the querying mechanism from the `new css.uno.X...(y)` constructor to a
`css.uno.X....query(y)` function call syntax, which now returns JS null when
querying for a non-supported interface. (And drop the broken $is method.)
Change-Id: I8fa488ab2892423f2a461d9b72db47e1d4df3b8d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166255
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
Diffstat (limited to 'offapi/org')
-rw-r--r-- | offapi/org/libreoffice/embindtest/XTest.idl | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/offapi/org/libreoffice/embindtest/XTest.idl b/offapi/org/libreoffice/embindtest/XTest.idl index 8817e94669fc..3dc1773c120a 100644 --- a/offapi/org/libreoffice/embindtest/XTest.idl +++ b/offapi/org/libreoffice/embindtest/XTest.idl @@ -112,6 +112,8 @@ interface XTest { boolean isSequenceEnum([in] sequence<Enum> value); sequence<Struct> getSequenceStruct(); boolean isSequenceStruct([in] sequence<Struct> value); + XTest getNull(); + boolean isNull([in] XTest value); void throwRuntimeException(); void passJob([in] com::sun::star::task::XJob object); void passJobExecutor([in] com::sun::star::task::XJobExecutor object); |