Bug 867109 - tools reload not working correctly on windows. r=jwalker

This commit is contained in:
Dave Camp 2013-05-29 10:48:06 -07:00
parent f2c815193b
commit aa8a843d64
3 changed files with 23 additions and 12 deletions

View File

@ -1499,7 +1499,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "AppCacheUtils",
],
returnType: "string",
exec: function(args, context) {
return OS.File.exists(args.srcdir + "/CLOBBER").then(function(exists) {
let clobber = OS.Path.join(args.srcdir, "CLOBBER");
return OS.File.exists(clobber).then(function(exists) {
if (exists) {
let str = Cc["@mozilla.org/supports-string;1"]
.createInstance(Ci.nsISupportsString);

View File

@ -745,4 +745,4 @@ gDevTools.on("toolbox-destroyed", gDevToolsBrowser._updateMenuCheckbox);
Services.obs.addObserver(gDevToolsBrowser.destroy, "quit-application", false);
// Load the browser devtools main module as the loader's main module.
devtools.main("devtools/main");
devtools.main("main");

View File

@ -58,20 +58,26 @@ var BuiltinProvider = {
// to different paths, it needs to write chrome.manifest files to override chrome urls
// from the builtin tools.
var SrcdirProvider = {
fileURI: function(path) {
let file = new FileUtils.File(path);
return Services.io.newFileURI(file).spec;
},
load: function(done) {
let srcdir = Services.prefs.getComplexValue("devtools.loader.srcdir",
Ci.nsISupportsString);
srcdir = OS.Path.normalize(srcdir.data.trim());
let devtoolsDir = OS.Path.join(srcdir, "browser/devtools");
let toolkitDir = OS.Path.join(srcdir, "toolkit/devtools");
let serverDir = OS.Path.join(toolkitDir, "server")
let devtoolsDir = OS.Path.join(srcdir, "browser", "devtools");
let devtoolsURI = this.fileURI(devtoolsDir);
let toolkitURI = this.fileURI(OS.Path.join(srcdir, "toolkit", "devtools"));
let serverURI = this.fileURI(OS.Path.join(srcdir, "toolkit", "devtools", "server"));
let mainURI = this.fileURI(OS.Path.join(srcdir, "browser", "devtools", "main.js"));
this.loader = new loader.Loader({
paths: {
"": "resource://gre/modules/commonjs/",
"devtools/server": "file://" + serverDir,
"devtools": "file://" + devtoolsDir,
"main": "file://" + devtoolsDir + "/main.js"
"devtools/server": serverURI,
"devtools": devtoolsURI,
"main": mainURI
},
globals: loaderGlobals
});
@ -120,7 +126,7 @@ var SrcdirProvider = {
},
_writeManifest: function(dir) {
return this._readFile(dir + "/jar.mn").then((data) => {
return this._readFile(OS.Path.join(dir, "jar.mn")).then((data) => {
// The file data is contained within inputStream.
// You can read it into a string with
let entries = [];
@ -134,11 +140,15 @@ var SrcdirProvider = {
}
let match = contentEntry.exec(line);
if (match) {
let entry = "override chrome://" + match[1] + "/content/" + match[2] + "\tfile://" + dir + "/" + match[3];
let pathComponents = match[3].split("/");
pathComponents.unshift(dir);
let path = OS.Path.join.apply(OS.Path, pathComponents);
let uri = this.fileURI(path);
let entry = "override chrome://" + match[1] + "/content/" + match[2] + "\t" + uri;
entries.push(entry);
}
}
return this._writeFile(dir + "/chrome.manifest", entries.join("\n"));
return this._writeFile(OS.Path.join(dir, "chrome.manifest"), entries.join("\n"));
}).then(() => {
Components.manager.addBootstrappedManifestLocation(new FileUtils.File(dir));
});