summaryrefslogtreecommitdiffstats
path: root/devtools/shared/inspector/css-logic.js
diff options
context:
space:
mode:
authorMoonchild <mcwerewolf@gmail.com>2018-03-02 10:32:45 +0100
committerGitHub <noreply@github.com>2018-03-02 10:32:45 +0100
commite272829137195b46612b7664c9416364089f7baa (patch)
tree20b543048260952a2c4ac8bb4cb22aaaa684bd84 /devtools/shared/inspector/css-logic.js
parentba2c2e5301bb2d993984c62cdf2fd07b361e6bca (diff)
parentc8355b22c047c9737e32f096b816edbb8b0fa181 (diff)
downloadUXP-e272829137195b46612b7664c9416364089f7baa.tar
UXP-e272829137195b46612b7664c9416364089f7baa.tar.gz
UXP-e272829137195b46612b7664c9416364089f7baa.tar.lz
UXP-e272829137195b46612b7664c9416364089f7baa.tar.xz
UXP-e272829137195b46612b7664c9416364089f7baa.zip
Merge pull request #34 from janekptacijarabaci/devtools_import-from-moebius_1
Port across devtools enhancements
Diffstat (limited to 'devtools/shared/inspector/css-logic.js')
-rw-r--r--devtools/shared/inspector/css-logic.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/devtools/shared/inspector/css-logic.js b/devtools/shared/inspector/css-logic.js
index c8cdd2fdb..901b7a189 100644
--- a/devtools/shared/inspector/css-logic.js
+++ b/devtools/shared/inspector/css-logic.js
@@ -30,6 +30,8 @@
"use strict";
+const MAX_DATA_URL_LENGTH = 40;
+
/**
* Provide access to the style information in a page.
* CssLogic uses the standard DOM API, and the Gecko inIDOMUtils API to access
@@ -103,6 +105,13 @@ exports.shortSource = function (sheet) {
return exports.l10n("rule.sourceInline");
}
+ // If the sheet is a data URL, return a trimmed version of it.
+ let dataUrl = sheet.href.trim().match(/^data:.*?,((?:.|\r|\n)*)$/);
+ if (dataUrl) {
+ return dataUrl[1].length > MAX_DATA_URL_LENGTH ?
+ `${dataUrl[1].substr(0, MAX_DATA_URL_LENGTH - 1)}…` : dataUrl[1];
+ }
+
// We try, in turn, the filename, filePath, query string, whole thing
let url = {};
try {
@@ -123,8 +132,7 @@ exports.shortSource = function (sheet) {
return url.query;
}
- let dataUrl = sheet.href.match(/^(data:[^,]*),/);
- return dataUrl ? dataUrl[1] : sheet.href;
+ return sheet.href;
};
const TAB_CHARS = "\t";