Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sourceMapping path resolution breaks data url sourcemaps #1915

Closed
abstraktor opened this issue Feb 25, 2018 · 1 comment
Closed

sourceMapping path resolution breaks data url sourcemaps #1915

abstraktor opened this issue Feb 25, 2018 · 1 comment

Comments

@abstraktor
Copy link

abstraktor commented Feb 25, 2018

Summary

In UI5 prior to 1.54, dataurl sourcemaps lead to a minute-long loading time. This can be fixed by backporting an updated regexp from the ui5loader, as visible here.

Furthermore it could be handled more safe by early-on failing data urls like suggested in #1914 (1.54) and #1916 (1.52 backport).

Since it is rather counter-intuitive behavior, it took me a while to spot dataurl sourcemaps and ui5 as culprits, so I decided to contribute this in order to save the time for others. I hope these PRs fit to your contribution model, please guide me if not.

Have a great week,
Bastian

Details

OpenUI5 version: Prior to 1.54

Browser/version (+device/version): Chrome 64

Any other tested browsers/devices(OK/FAIL):

URL (minimal example if possible):

User/password (if required and possible - do not post any confidential information here):

Steps to reproduce the problem:

  1. Add a thirdparty library (266bytes for my compiled file) with a dataurl sourcemap //# sourceMappingURL=data:application/json;charset=utf-8;base64,....
  2. Load UI5 in browser
  3. For long, the network shows the thirdparty.js as pending

What is the expected result?

The library should load and the browser interprets the dataurl sourcemap so that the source files of that library are visible.

What happens instead?

For 40seconds, the network shows the thirdparty.js as pending. Then the file is loaded and behaves as expected. The chrome devtools performance profiler points to the regexp /[^\/]+\.js\.map$/ being tested during that time.

Any other information? (attach screenshot if possible)

  • this regexp was part of jquery.sap.global.js until it was moved to the ui5loader.
  • In ui5loader, the regexp was changed from /[^\/]+\.js\.map$/ to /^[^\/]+\.js\.map$/ (Now testing from the beginning). This solves the problem for most data-urls since they usually contain an early slash in the mediatype (application/json),
    so that the regexp parser kicks out fast. Since empty mediatypes or those without slash may theoretically occur, it may be useful to explicitly not parse data-urls at all.
@gerym
Copy link
Contributor

gerym commented Mar 28, 2018

Hello @abstraktor ,

Since there was already created an internal record 1870087779 for your pull request which are connected to this issue, I will close this one. Please follow the status of the issue in your pull requests in GitHub.

Thanks & Kind Regards,
Gery

@gerym gerym closed this as completed Mar 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants