mirror of
https://github.com/discourse/discourse.git
synced 2025-02-18 02:02:44 +08:00
![]() This is how `loadScript(url)` currently deals with multiple concurrent requests 1. Check existing `<script>` tags, and mark existing scripts (other than the input `url`) as loaded 2. Find "true" `url` of the requested resource (CDN, subfolder path, etc) 3. Check if we have loaded the resource with that "true" `url`, and resolve immediately if we have 4. Otherwise insert a `<script>` tag with the "true" `url` to load it For example, in a subfolder install: - Input `url` = `/javascripts/script.js` - "True" `url` = `/subfolder/javascript/script.js` And the _very_ subtle bug here is that we should use also use the true `url` for step (1), because: - Since the input and true `url` are different, we mistakenly mark the true `url` as loaded in step one - After finding the true `url`, and setting `loaded[trueUrl] = true` in (1), we resolve the promise prematurely, when the resource could still be loading |
||
---|---|---|
.. | ||
fonts | ||
images | ||
javascripts | ||
stylesheets |