public
Last active

bookmarklet to send a jsperf test to all webpagetest's IEs

  • Download Gist
jsperf-bookmarklet.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
(function(){
 
var key = localStorage.wpt_key;
if (!key) {
var prompt = window.__proto__.prompt;
key = prompt('Your WebPagetest API key, please?');
if (!key) {
return gameOver();
}
localStorage.wpt_key = key;
}
 
// base params
var wpt = 'http://www.webpagetest.org/runtest.php?';
var params = {
k: key,
time: 60,
runs: 1,
fvonly: 1,
url: 'http://jsperf.com' + location.pathname + '#run'
};
Object
.keys(params)
.forEach(function(key) {
wpt += key + '=' + encodeURIComponent(params[key]) + '&';
});
 
var locations = localStorage.wpt_locations;
if (!locations) {
locations = ['Dulles_IE6', 'Dulles_IE7', 'Dulles_IE8', 'Dulles_IE9', 'Dulles_IE10'];
}
// pop some windows up
var open = window.__proto__.open;
locations.forEach(function(loco){
open(wpt + 'location=' + encodeURIComponent(loco));
});
 
gameOver();
 
function gameOver() {
console.log('JSPerf bookmarklet help: http://phpied.com/jsperf-bookmarklet');
console.log('If broken, check your localStorage.wpt_key and wpt_locations');
}
 
}());

Line 28 should be:
var locations = localStorage.wpt_locations && localStorage.wpt_locations.split(',');

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.