Open mauriciolauffer opened 3 years ago
Hi @mauriciolauffer ,
Thank you for sharing this finding. I've created an internal incident 2070425614. The status of the issue will be updated here in GitHub.
Best Regards, Florian
Note:
Don't forget to switch the branch with git checkout doc-write-issue
to start the app with the adjustments.
This is not a final answer, but rather a comment:
The development version of sap-ui-core.js
can only be used within the head of a document. It is not intended for other scenarios. The problem is with the long-established sync contract of the bootstrap script. To make it work within the body, we could have used sync XHR and eval
, but that felt even worse.
There are plans to establish an async alternative, but the feature set of it has not been agreed upon (should it guarantee the same APIs as sap-ui-core.js
to make migration easy - an sap-ui-core-async.js
so to say - or should it be much smaller, following the direction of UI5 evolution thinking? A prototype of the latter can be found under the name sap-ui-boot.js, but it's not a public offering.
@flovogt Thanks 👍
@codeworrior I've notice this sap-ui-boot.js a while ago, when I first got the reported error. I was wondering why it isn't being used... Thanks for the comments
This issue will be covered in backlog item CPOUI5FOUNDATION-382.
OpenUI5 version: All NPM versions
Browser/version (+device/version): Chrome, Edge, Firefox, IE
Any other tested browsers/devices(OK/FAIL): FAIL
URL (minimal example if possible): https://github.com/mauriciolauffer/openui5-sample-app/blob/doc-write-issue/webapp/index.html
Steps to reproduce the problem:
What is the expected result? UI5 bootstrap loaded successfully.
What happens instead? It does not load, there is an error. Failed to execute 'write' on 'Document': It isn't possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened. The error only happens when using async defer: script async defer id="sap-ui-bootstrap"
Any other information? (attach screenshot if possible) The error happens in sap-ui-core.js file due to statement document.write in lines 44, 48 and 52.