Bug 993985 - Fix broken tooltip in Developer Toolbar; r=mratcliffe

This commit is contained in:
Joe Walker 2014-04-18 09:21:12 +01:00
parent 53651fd4b0
commit 79281c4be7
2 changed files with 19 additions and 3 deletions

View File

@ -60,7 +60,7 @@ function Menu(options) {
if (menuCss != null) {
util.importCss(menuCss, this.document, 'gcli-menu');
}
}.bind(this));
}.bind(this), console.error);
this.templateOptions = { blankNullUndefined: true, stack: 'menu.html' };
if (menuHtmlPromise == null) {
@ -68,7 +68,7 @@ function Menu(options) {
}
menuHtmlPromise.then(function(menuHtml) {
this.template = util.toDom(this.document, menuHtml);
}.bind(this));
}.bind(this), console.error);
// Contains the items that should be displayed
this.items = [];

View File

@ -65,6 +65,22 @@ exports.exec = function(execSpec) {
throw new Error('Not supported');
};
/**
* When dealing with module paths on windows we want to use the unix
* directory separator rather than the windows one, so we avoid using
* OS.Path.dirname, and use unix version on all platforms.
*/
let resourceDirName = function(path) {
let index = path.lastIndexOf("/");
if (index == -1) {
return ".";
}
while (index >= 0 && path[index] == "/") {
--index;
}
return path.slice(0, index + 1);
};
/**
* Asynchronously load a text resource
* @see lib/gcli/util/host.js
@ -76,7 +92,7 @@ exports.staticRequire = function(requistingModule, name) {
deferred.resolve('');
}
else {
var filename = OS.Path.dirname(requistingModule.id) + '/' + name;
var filename = resourceDirName(requistingModule.id) + '/' + name;
filename = filename.replace(/\/\.\//g, '/');
filename = 'resource://gre/modules/devtools/' + filename;