summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector
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/client/inspector
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/client/inspector')
-rw-r--r--devtools/client/inspector/rules/models/rule.js11
-rw-r--r--devtools/client/inspector/rules/test/browser_rules_style-editor-link.js35
-rw-r--r--devtools/client/inspector/test/browser.ini1
-rw-r--r--devtools/client/inspector/test/browser_inspector_infobar_04.js38
4 files changed, 73 insertions, 12 deletions
diff --git a/devtools/client/inspector/rules/models/rule.js b/devtools/client/inspector/rules/models/rule.js
index 1a3fa057a..4c978cb58 100644
--- a/devtools/client/inspector/rules/models/rule.js
+++ b/devtools/client/inspector/rules/models/rule.js
@@ -140,11 +140,18 @@ Rule.prototype = {
line, mediaText}) => {
let mediaString = mediaText ? " @" + mediaText : "";
let linePart = line > 0 ? (":" + line) : "";
+ let decodedHref = href;
+
+ if (decodedHref) {
+ try {
+ decodedHref = decodeURIComponent(href);
+ } catch (e) {}
+ }
let sourceStrings = {
- full: (href || CssLogic.l10n("rule.sourceInline")) + linePart +
+ full: (decodedHref || CssLogic.l10n("rule.sourceInline")) + linePart +
mediaString,
- short: CssLogic.shortSource({href: href}) + linePart + mediaString
+ short: CssLogic.shortSource({href: decodedHref}) + linePart + mediaString
};
return sourceStrings;
diff --git a/devtools/client/inspector/rules/test/browser_rules_style-editor-link.js b/devtools/client/inspector/rules/test/browser_rules_style-editor-link.js
index 927deb8ce..6a4fd1d66 100644
--- a/devtools/client/inspector/rules/test/browser_rules_style-editor-link.js
+++ b/devtools/client/inspector/rules/test/browser_rules_style-editor-link.js
@@ -10,10 +10,12 @@ thisTestLeaksUncaughtRejectionsAndShouldBeFixed("Error: Unknown sheet source");
// Test the links from the rule-view to the styleeditor
-const STYLESHEET_URL = "data:text/css," + encodeURIComponent(
- ["#first {",
- "color: blue",
- "}"].join("\n"));
+const STYLESHEET_DATA_URL_CONTENTS = ["#first {",
+ "color: blue",
+ "}"].join("\n");
+const STYLESHEET_DATA_URL =
+ `data:text/css,${encodeURIComponent(STYLESHEET_DATA_URL_CONTENTS)}`;
+const STYLESHEET_DECODED_DATA_URL = `data:text/css,${STYLESHEET_DATA_URL_CONTENTS}`;
const EXTERNAL_STYLESHEET_FILE_NAME = "doc_style_editor_link.css";
const EXTERNAL_STYLESHEET_URL = URL_ROOT + EXTERNAL_STYLESHEET_FILE_NAME;
@@ -31,7 +33,7 @@ const DOCUMENT_URL = "data:text/html;charset=utf-8," + encodeURIComponent(`
<style>
div { font-weight: bold; }
</style>
- <link rel="stylesheet" type="text/css" href="${STYLESHEET_URL}">
+ <link rel="stylesheet" type="text/css" href="${STYLESHEET_DATA_URL}">
<link rel="stylesheet" type="text/css" href="${EXTERNAL_STYLESHEET_URL}">
</head>
<body>
@@ -178,15 +180,28 @@ function* testDisabledStyleEditor(view, toolbox) {
}
function testRuleViewLinkLabel(view) {
- let link = getRuleViewLinkByIndex(view, 2);
+ info("Checking the data URL link label");
+
+ let link = getRuleViewLinkByIndex(view, 1);
let labelElem = link.querySelector(".ruleview-rule-source-label");
let value = labelElem.textContent;
let tooltipText = labelElem.getAttribute("title");
- is(value, EXTERNAL_STYLESHEET_FILE_NAME + ":1",
- "rule view stylesheet display value matches filename and line number");
- is(tooltipText, EXTERNAL_STYLESHEET_URL + ":1",
- "rule view stylesheet tooltip text matches the full URI path");
+ is(value, `${STYLESHEET_DATA_URL_CONTENTS}:1`,
+ "Rule view data URL stylesheet display value matches contents");
+ is(tooltipText, `${STYLESHEET_DECODED_DATA_URL}:1`,
+ "Rule view data URL stylesheet tooltip text matches the full URI path");
+
+ info("Checking the external link label");
+ link = getRuleViewLinkByIndex(view, 2);
+ labelElem = link.querySelector(".ruleview-rule-source-label");
+ value = labelElem.textContent;
+ tooltipText = labelElem.getAttribute("title");
+
+ is(value, `${EXTERNAL_STYLESHEET_FILE_NAME}:1`,
+ "Rule view external stylesheet display value matches filename and line number");
+ is(tooltipText, `${EXTERNAL_STYLESHEET_URL}:1`,
+ "Rule view external stylesheet tooltip text matches the full URI path");
}
function testUnselectableRuleViewLink(view, index) {
diff --git a/devtools/client/inspector/test/browser.ini b/devtools/client/inspector/test/browser.ini
index 65ad71c0c..499df25f0 100644
--- a/devtools/client/inspector/test/browser.ini
+++ b/devtools/client/inspector/test/browser.ini
@@ -113,6 +113,7 @@ subsuite = clipboard
[browser_inspector_infobar_01.js]
[browser_inspector_infobar_02.js]
[browser_inspector_infobar_03.js]
+[browser_inspector_infobar_04.js]
[browser_inspector_infobar_textnode.js]
[browser_inspector_initialization.js]
skip-if = (e10s && debug) # Bug 1250058 - Docshell leak on debug e10s
diff --git a/devtools/client/inspector/test/browser_inspector_infobar_04.js b/devtools/client/inspector/test/browser_inspector_infobar_04.js
new file mode 100644
index 000000000..f1b9eca49
--- /dev/null
+++ b/devtools/client/inspector/test/browser_inspector_infobar_04.js
@@ -0,0 +1,38 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+"use strict";
+
+// Check the position and text content of the highlighter nodeinfo bar under page zoom.
+
+const TEST_URI = URL_ROOT + "doc_inspector_infobar_01.html";
+
+add_task(function* () {
+ let {inspector, testActor} = yield openInspectorForURL(TEST_URI);
+ let testData = {
+ selector: "#top",
+ dims: "500" + " \u00D7 " + "100"
+ };
+
+ yield testInfobar(testData, inspector, testActor);
+ info("Change zoom page to level 2.");
+ yield testActor.zoomPageTo(2);
+ info("Testing again the infobar after zoom.");
+ yield testInfobar(testData, inspector, testActor);
+});
+
+function* testInfobar(test, inspector, testActor) {
+ info(`Testing ${test.selector}`);
+
+ yield selectAndHighlightNode(test.selector, inspector);
+
+ // Ensure the node is the correct one.
+ let id = yield testActor.getHighlighterNodeTextContent(
+ "box-model-infobar-id");
+ is(id, test.selector, `Node ${test.selector} selected.`);
+
+ let dims = yield testActor.getHighlighterNodeTextContent(
+ "box-model-infobar-dimensions");
+ is(dims, test.dims, "Node's infobar displays the right dimensions.");
+}