]> git.gir.st - VimFx.git/commit
Fix frame scripts being loaded more than once sometimes
authorSimon Lydell <simon.lydell@gmail.com>
Fri, 13 May 2016 06:05:03 +0000 (08:05 +0200)
committerSimon Lydell <simon.lydell@gmail.com>
Fri, 13 May 2016 16:18:06 +0000 (18:18 +0200)
commitc631966bc0019614cdd6a2bcf08761cdf0e5ab3b
treef82564a5070adfed4156d5875100a8563d721c16
parent393da1e0331016d0513666d2f9a3e3f9d2bf9244
Fix frame scripts being loaded more than once sometimes

1. Open several tabs.
2. Set Firefox to remember your tabs between sessions.
3. Restart Firefox. All but the current tab will now be in a "pending"
   (unloaded) state.
4. Update/re-install VimFx.
5. Visit one of the pending tabs.

Now, the frame script will be loaded _twice_ in that tab, which for
example causes `f` to produce double-clicks. This is especially
noticeable during development, when you update/re-install VimFx all the
time.

The reason is that Firefox does not seem to load frame scripts in
pending tabs immediately. Instead, the URI to the frame script we asked
to load is remembered and then loaded when you actually visit the
pending tab in question. If you update VimFx before doing so, yet one
frame script URI will be pushed to that stack, causing _two_ instances
of it to be loaded when visiting the tab. Both of those will be from the
new VimFx version; the URIs are the same, and the file at that URI has
now been updated.

This commit attempts to solve this problem by generating a
`bootstrap-frame-$BUILD_TIME.js` file (which simply runs
`bootstrap.coffee`) and loading that as a frame script. This means that
old saved frame script URIs will point to non-existing files and thus
be harmless.
extension/bootstrap-frame.js.tmpl [new file with mode: 0644]
extension/bootstrap.coffee
extension/lib/main.coffee
gulpfile.coffee
Imprint / Impressum