This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse
Kyle Zhao ffc241eb25
FIX: multiple loadScript to the same url may resolve prematurely (#6474)
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
2018-10-11 08:55:36 +08:00
..
adapters DEV: introduces prettier for es6 files 2018-06-15 17:03:24 +02:00
components FEATURE: Show "Recently used devices" in user preferences (#6335) 2018-10-09 22:21:41 +08:00
controllers FEATURE: Option to disable user presence and profile 2018-10-10 17:34:33 -04:00
helpers UX: show full name on /latest page 2018-08-23 14:41:06 +05:30
initializers FIX: maintain theme preview when refreshing (#6356) 2018-09-02 17:23:46 +10:00
lib FIX: multiple loadScript to the same url may resolve prematurely (#6474) 2018-10-11 08:55:36 +08:00
mixins FEATURE: land on specified category page when creating topic via URL 2018-07-20 15:55:05 +05:30
models FEATURE: Option to disable user presence and profile 2018-10-10 17:34:33 -04:00
pre-initializers DEV: introduces prettier for es6 files 2018-06-15 17:03:24 +02:00
raw-views DEV: introduces prettier for es6 files 2018-06-15 17:03:24 +02:00
routes FEATURE: Option to disable user presence and profile 2018-10-10 17:34:33 -04:00
services DEV: introduces prettier for es6 files 2018-06-15 17:03:24 +02:00
templates FEATURE: Option to disable user presence and profile 2018-10-10 17:34:33 -04:00
widgets UX: Use 'trash' icon instead of 'times' for deleting small actions 2018-10-05 22:31:56 +01:00
mapping-router.js.es6 DEV: introduces prettier for es6 files 2018-06-15 17:03:24 +02:00