Patchwork downloads: initialize downloader from sources.js earlier

login
register
mail settings
Submitter Kevin Bullock
Date May 15, 2017, 2:48 a.m.
Message ID <4b88b3c4fc807a3d1e9a.1494816491@ingalls.lan>
Download mbox | patch
Permalink /patch/20622/
State Accepted
Headers show

Comments

Kevin Bullock - May 15, 2017, 2:48 a.m.
# HG changeset patch
# User Kevin Bullock <kbullock+mercurial@ringworld.org>
# Date 1494816447 18000
#      Sun May 14 21:47:27 2017 -0500
# Node ID 4b88b3c4fc807a3d1e9a98b670e2f710796e73c1
# Parent  c65b81353b8f9e370dc329e0a7ba1c2441d215a8
downloads: initialize downloader from sources.js earlier

c65b81353b8f inadvertently broke the /downloads page by moving the call
to Downloader.init(sources) later in the rendering process, after the
downloads list has already been written. As a stopgap, we introduce an
earlier call to initialize the versions before attempting to render the
list. Future changes will move this inline script into an onload
function.
Sean Farley - May 15, 2017, 3:06 a.m.
Kevin Bullock <kbullock+mercurial@ringworld.org> writes:

> # HG changeset patch
> # User Kevin Bullock <kbullock+mercurial@ringworld.org>
> # Date 1494816447 18000
> #      Sun May 14 21:47:27 2017 -0500
> # Node ID 4b88b3c4fc807a3d1e9a98b670e2f710796e73c1
> # Parent  c65b81353b8f9e370dc329e0a7ba1c2441d215a8
> downloads: initialize downloader from sources.js earlier
>
> c65b81353b8f inadvertently broke the /downloads page by moving the call
> to Downloader.init(sources) later in the rendering process, after the
> downloads list has already been written. As a stopgap, we introduce an
> earlier call to initialize the versions before attempting to render the
> list. Future changes will move this inline script into an onload
> function.

Ah, thanks, queued!

Patch

diff --git a/templates/downloads/index.html b/templates/downloads/index.html
--- a/templates/downloads/index.html
+++ b/templates/downloads/index.html
@@ -4,6 +4,7 @@ 
 
     <h1>Mercurial downloads</h1>
     <script language="javascript">
+        Downloader.init(sources);
         var versions = Downloader.versions();
         var more = Downloader.maxversions &&
                    versions.length > Downloader.maxversions;