Changeset 130669 in webkit


Ignore:
Timestamp:
Oct 8, 2012 12:02:06 PM (11 years ago)
Author:
rniwa@webkit.org
Message:

Perf test pesults page takes forever to load on a machine with a slow Internet connection
https://bugs.webkit.org/show_bug.cgi?id=98561

Reviewed by Ojan Vafai.

Try loading jquery both locally and remotely, and use the same method to load the remaining
jquery plugins when either one succeeds.

  • resources/results-template.html:
Location:
trunk/PerformanceTests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/PerformanceTests/ChangeLog

    r130459 r130669  
     12012-10-08  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Perf test pesults page takes forever to load on a machine with a slow Internet connection
     4        https://bugs.webkit.org/show_bug.cgi?id=98561
     5
     6        Reviewed by Ojan Vafai.
     7
     8        Try loading jquery both locally and remotely, and use the same method to load the remaining
     9        jquery plugins when either one succeeds.
     10
     11        * resources/results-template.html:
     12
    1132012-10-04  Hayato Ito  <hayato@chromium.org>
    214
  • trunk/PerformanceTests/resources/results-template.html

    r129816 r130669  
    33<head>
    44<title>WebKit Performance Test Results</title>
    5 <script src="%AbsolutePathToWebKitTrunk%/PerformanceTests/Dromaeo/resources/dromaeo/web/lib/jquery-1.6.4.js"></script>
    6 <script src="https://trac.webkit.org/browser/trunk/PerformanceTests/Dromaeo/resources/dromaeo/web/lib/jquery-1.6.4.js?format=txt"></script>
    7 <script src="%AbsolutePathToWebKitTrunk%/PerformanceTests/resources/jquery.flot.min.js"></script>
    8 <script src="https://trac.webkit.org/browser/trunk/PerformanceTests/resources/jquery.flot.min.js?format=txt"></script>
    9 <script src="%AbsolutePathToWebKitTrunk%/PerformanceTests/resources/jquery.tablesorter.min.js"></script>
    10 <script src="https://trac.webkit.org/browser/trunk/PerformanceTests/resources/jquery.tablesorter.min.js?format=txt"></script>
    11 <script id="json" type="application/json">%PeformanceTestsResultsJSON%</script>
    125<style type="text/css">
    136
     
    137130Reference <span id="reference" class="checkbox"></span>
    138131</div>
    139 <script>
    140 
    141 $(document).ready(function () {
    142     $('.checkbox').each(function (index, checkbox) {
    143         $(checkbox).children('span').click(function (event) {
    144             if ($(this).hasClass('checked'))
    145                 return;
    146             $(checkbox).children('span').removeClass('checked');
    147             $(this).addClass('checked');
    148             $(checkbox).trigger('change', $(this));
    149         });
    150     });
    151 })
    152 
    153 </script>
    154132<table id="container"></table>
    155133<script>
     134
     135(function () {
     136    var jQuery = ['PerformanceTests/Dromaeo/resources/dromaeo/web/lib/jquery-1.6.4.js'];
     137    var plugins = ['PerformanceTests/resources/jquery.flot.min.js', 'PerformanceTests/resources/jquery.tablesorter.min.js'];
     138    var localPath = '%AbsolutePathToWebKitTrunk%';
     139    var remotePath = 'https://svn.webkit.org/repository/webkit/trunk';
     140    var numberOfFailures = 0;
     141    var startedLoadingPlugins = false;
     142    var numberOfLoadedPlugins = 0;
     143
     144    function loadScript(src, loaded, failed) {
     145        var script = document.createElement('script');
     146        script.async = true;
     147        script.src = src;
     148        script.onload = loaded;
     149        if (failed)
     150            script.onerror = failed;
     151        document.body.appendChild(script);
     152    }
     153
     154    function loadPlugins(trunkPath) {
     155        for (var i = 0; i < plugins.length; i++)
     156            loadScript(trunkPath + '/' + plugins[i], loadedPlugin, createFailedToLoadPlugin(plugins[i]));
     157    }
     158
     159    function loadedPlugin() {
     160        numberOfLoadedPlugins++;
     161        if (numberOfLoadedPlugins == plugins.length)
     162            setTimeout(init, 0);           
     163    }
     164
     165    function createFailedToLoadPlugin(plugin) {
     166        return function () { alert("Failed to load " + plugin); }
     167    }
     168
     169    function createLoadedJQuery(trunkPath) {
     170        return function () { loadPlugins(trunkPath); }
     171    }
     172
     173    loadScript(localPath + '/' + jQuery,
     174        createLoadedJQuery(localPath),
     175        function () {
     176            loadScript(remotePath + '/' + jQuery,
     177                createLoadedJQuery(localPath),
     178                function () { alert("Failed to load jQuery."); });
     179        });
     180})();
    156181
    157182function TestResult(associatedTest, result, associatedRun) {
     
    481506
    482507function init() {
     508    $('.checkbox').each(function (index, checkbox) {
     509        $(checkbox).children('span').click(function (event) {
     510            if ($(this).hasClass('checked'))
     511                return;
     512            $(checkbox).children('span').removeClass('checked');
     513            $(this).addClass('checked');
     514            $(checkbox).trigger('change', $(this));
     515        });
     516    });
     517
    483518    $.tablesorter.addParser({
    484519        id: 'comparison',
     
    524559}
    525560
    526 init();
    527 
    528561</script>
     562<script id="json" type="application/json">%PeformanceTestsResultsJSON%</script>
    529563</body>
    530564</html>
Note: See TracChangeset for help on using the changeset viewer.