Bug 622227: Make it easier for Test Pilot to switch index files. r+a=dtownsend

This commit is contained in:
Jono S Xia 2011-01-03 12:27:29 -08:00
parent d99a96dda7
commit b3b811f3d8
2 changed files with 43 additions and 4 deletions

View File

@ -171,6 +171,34 @@
task.changeStatus(newStatus, false);
}
function showIndexFileDropdown() {
var prefService = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
var prefName = "extensions.testpilot.indexFileName";
var selector = document.getElementById("index-file-selector");
if (prefService.getCharPref(prefName) == "index.json") {
selector.selectedIndex = 0;
} else {
selector.selectedIndex = 1;
}
}
function setSelectedIndexFile() {
var prefService = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
var prefName = "extensions.testpilot.indexFileName";
var selector = document.getElementById("index-file-selector");
var i = selector.selectedIndex;
prefService.setCharPref( prefName, selector.options[i].value );
// DELETE CACHED INDEX FILE
var file = Components.classes["@mozilla.org/file/directory_service;1"].
getService(Components.interfaces.nsIProperties).
get("ProfD", Components.interfaces.nsIFile);
file.append("TestPilotExperimentFiles");
file.append("index.json");
if (file.exists()) {
file.remove(false);
}
}
</script>
@ -180,7 +208,7 @@
</head>
<body onload="populateFileDropdown();showSelectedTaskStatus();">
<body onload="populateFileDropdown();showSelectedTaskStatus();showIndexFileDropdown();">
<fieldset>
<p><select id="task-selector" onchange="showSelectedTaskStatus();"></select> Current Status = <span id="show-status-span"></span>.
@ -208,6 +236,11 @@ or set it to
<button onclick="reloadAllExperiments();">Reload All Experiments</button>
<button onclick="remindMe();">Notify Me</button>
<button onclick="testJarStore();">Test Jar Store</button>
Index file:
<select id="index-file-selector" onchange="setSelectedIndexFile();">
<option value="index.json">index.json</option>
<option value="index-dev.json">index-dev.json</option>
</select>
</p>
</fieldset>
<p><span id="debug"></span></p>

View File

@ -185,7 +185,7 @@ exports.RemoteExperimentLoader.prototype = {
} else {
this._fileGetter = downloadFile;
}
this._logger.trace("About to instantiate preferences store.");
this._logger.trace("About to instantiate jar store.");
this._jarStore = new JarStore();
this._experimentFileNames = [];
let self = this;
@ -324,11 +324,17 @@ exports.RemoteExperimentLoader.prototype = {
// TODO a bad thing that can go wrong: If we have a net connection but the index file
// has not changed, we currently don't try to download anything...
// The logic is bad because executeCachedIndexFile is called in two different
// cases: the one with no network, and the one with network but unchanged file.
// Another bad thing: If there's a jar download that's corrupt or unreadable or has
// the wrong permissions or something, we need to kill it and download a new one.
// the wrong permissions or something, we need to kill it and download a new one.
// Should also try to download a new jar if any required modules are missing
// (Which is currently the case!)
// WTF every jar file I'm downloading appears as 0 bytes with __x__x___ permissions!
// (module "about_firefox.js" is not found; there is no about_firefox.jar on disk,
// indicating it didn't download, and we're not trying again because index-dev is
// unmodified. Hmmm.)
_cachedIndexNsiFile: null,
get cachedIndexNsiFile() {