Openui5: String content as fragment definition: invalid binding syntax throws no exceptions

Created on 29 Jul 2020  路  4Comments  路  Source: SAP/openui5

URL (minimal example if possible)

https://jsbin.com/zotecap/edit?html,js,output

Fragment.load({
 definition: `<MyControl propertyOrAggregation="{ Invalid binding syntax "/>`,
});

What is the expected result?

An exception is thrown that the binding definition couldn't be parsed or evaluated due to an invalid syntax.

What happens instead?

No error is reported.

Any other information?

This happens only if a string literal was assigned to the definition setting in Fragment.load. With definition in XMLView.create, a syntax error is reported expectedly.

bug fixed

Most helpful comment

Good catch aind interesting issue, @boghyon !

I debugged this a bit and it seems to be a combination of two problems:

  1. in sync mode, the XMLTemplateProcessor stifles errors that occur for XML attributes (like the binding error), but only when the XML node that carries the attributes has no children (more concrete: the result of method syncStrategy does not consider the result of the incoming pRequireContext when there are no children)
  2. while the new Fragment.load API is async by design, the implementation isn't yet (this is on our roadmap). There's a gap between the place where the XMLTemplateProcessor's return promise (a SyncPromise in the sync case) is converted into a sync result and the place where the Fragment.load converts the result into a standard promise. Even if issue one above is fixed, the error is thrown synchronously instead of reporting is as a promise rejection.

I proposed a change internally, but colleagues might prefer to solve this together with the async implementation of the Fragment.load.

All 4 comments

Hello @boghyon ,
Thank you for sharing this finding. I've created an internal incident 2080321485. The status of the issue will be updated here in GitHub.
Regards,
Florian

Good catch aind interesting issue, @boghyon !

I debugged this a bit and it seems to be a combination of two problems:

  1. in sync mode, the XMLTemplateProcessor stifles errors that occur for XML attributes (like the binding error), but only when the XML node that carries the attributes has no children (more concrete: the result of method syncStrategy does not consider the result of the incoming pRequireContext when there are no children)
  2. while the new Fragment.load API is async by design, the implementation isn't yet (this is on our roadmap). There's a gap between the place where the XMLTemplateProcessor's return promise (a SyncPromise in the sync case) is converted into a sync result and the place where the Fragment.load converts the result into a standard promise. Even if issue one above is fixed, the error is thrown synchronously instead of reporting is as a promise rejection.

I proposed a change internally, but colleagues might prefer to solve this together with the async implementation of the Fragment.load.

Hi @boghyon,
thanks for mentioning the revert here.
As soon as the fix is in again, we'll update the issue.
All the best,
Florian

Was this page helpful?
0 / 5 - 0 ratings