[wp-trac] [WordPress Trac] #36584: Possible race condition with zxcvbn loader

WordPress Trac noreply at wordpress.org
Mon Apr 18 23:03:04 UTC 2016


#36584: Possible race condition with zxcvbn loader
--------------------------+-----------------------------
 Reporter:  dominicp      |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:  javascript    |
--------------------------+-----------------------------
 The `zxcvbn-async.js` file is used to load the main `zxcvbn.min.js`
 library (presumably because the library is huge and takes a while to
 load). However, under certain circumstances, the `zxcvbn-async.js` file
 may not finish loading before the `window.onLoad` event fires. If this
 happens, the main library is never loaded and scripts that depend on it
 break.

 I ran into this when using a script loader that isn't triggered until just
 before the `</body>` tag. By that time, there isn't much gap between the
 time when the loader is requested and the `onLoad` event fires.

 I'm not sure what a good solution would be. The simplest would involve
 checking the `document.readyState`, but I know that doesn't have the
 widest browser support.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36584>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list