Bug 1266844 - use URL, not nsIURL, in css-logic.js; r?pbro
MozReview-Commit-ID: F8eBQEJZkv7
--- a/devtools/shared/inspector/css-logic.js
+++ b/devtools/shared/inspector/css-logic.js
@@ -107,28 +107,27 @@ exports.shortSource = function (sheet) {
// Use a string like "inline" if there is no source href
if (!sheet || !sheet.href) {
return exports.l10n("rule.sourceInline");
}
// We try, in turn, the filename, filePath, query string, whole thing
let url = {};
try {
- url = Services.io.newURI(sheet.href, null, null);
- url = url.QueryInterface(Ci.nsIURL);
+ url = new URL(sheet.href);
} catch (ex) {
// Some UA-provided stylesheets are not valid URLs.
}
- if (url.fileName) {
- return url.fileName;
- }
-
- if (url.filePath) {
- return url.filePath;
+ if (url.pathname) {
+ let index = url.pathname.lastIndexOf("/");
+ if (index !== -1 && index < url.pathname.length) {
+ return url.pathname.slice(index + 1);
+ }
+ return url.pathname;
}
if (url.query) {
return url.query;
}
let dataUrl = sheet.href.match(/^(data:[^,]*),/);
return dataUrl ? dataUrl[1] : sheet.href;