forked from mirrors/gecko-dev
Bug 1871391 - [devtools] Use document.baseURI to resolve relative links in the inspector r=devtools-reviewers,nchevobbe
Differential Revision: https://phabricator.services.mozilla.com/D202917
This commit is contained in:
parent
cca7ff4dbc
commit
faee0ce3a4
4 changed files with 40 additions and 1 deletions
|
|
@ -75,6 +75,7 @@ support-files = [
|
||||||
"lib_react_with_addons_15.3.1_min.js",
|
"lib_react_with_addons_15.3.1_min.js",
|
||||||
"lib_react_with_addons_15.4.1.js",
|
"lib_react_with_addons_15.4.1.js",
|
||||||
"react_external_listeners.js",
|
"react_external_listeners.js",
|
||||||
|
"resources/*",
|
||||||
"shadowdom_open_debugger.min.js",
|
"shadowdom_open_debugger.min.js",
|
||||||
"!/devtools/client/debugger/test/mochitest/shared-head.js",
|
"!/devtools/client/debugger/test/mochitest/shared-head.js",
|
||||||
"!/devtools/client/inspector/test/head.js",
|
"!/devtools/client/inspector/test/head.js",
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
// do follows the link.
|
// do follows the link.
|
||||||
|
|
||||||
const TEST_URL = URL_ROOT_SSL + "doc_markup_links.html";
|
const TEST_URL = URL_ROOT_SSL + "doc_markup_links.html";
|
||||||
|
const TEST_URL_BASE = URL_ROOT_SSL + "resources/doc_markup_links_base.html";
|
||||||
|
|
||||||
add_task(async function () {
|
add_task(async function () {
|
||||||
const { inspector } = await openInspectorForURL(TEST_URL);
|
const { inspector } = await openInspectorForURL(TEST_URL);
|
||||||
|
|
@ -70,6 +71,31 @@ add_task(async function () {
|
||||||
await followLinkNoNewNode(linkEl, true, inspector);
|
await followLinkNoNewNode(linkEl, true, inspector);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
add_task(async function testDocumentWithBaseAttribute() {
|
||||||
|
const { inspector } = await openInspectorForURL(TEST_URL_BASE);
|
||||||
|
|
||||||
|
info("Select a node with a URI attribute");
|
||||||
|
await selectNode("img", inspector);
|
||||||
|
|
||||||
|
info("Find the link element from the markup-view");
|
||||||
|
const { editor } = await getContainerForSelector("img", inspector);
|
||||||
|
const linkEl = editor.attrElements.get("src").querySelector(".link");
|
||||||
|
|
||||||
|
info("Follow the link with middle-click and wait for the new tab to open");
|
||||||
|
await followLinkWaitForTab(
|
||||||
|
linkEl,
|
||||||
|
false,
|
||||||
|
URL_ROOT_SSL + "doc_markup_tooltip.png"
|
||||||
|
);
|
||||||
|
|
||||||
|
info("Follow the link with meta/ctrl-click and wait for the new tab to open");
|
||||||
|
await followLinkWaitForTab(
|
||||||
|
linkEl,
|
||||||
|
true,
|
||||||
|
URL_ROOT_SSL + "doc_markup_tooltip.png"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
function performMouseDown(linkEl, metactrl) {
|
function performMouseDown(linkEl, metactrl) {
|
||||||
const evt = linkEl.ownerDocument.createEvent("MouseEvents");
|
const evt = linkEl.ownerDocument.createEvent("MouseEvents");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Markup-view links with base attribute</title>
|
||||||
|
<base href="../">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<img src="doc_markup_tooltip.png">
|
||||||
|
Test relative links with base attributes.
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -264,7 +264,7 @@ class InspectorActor extends Actor {
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
const baseURI = Services.io.newURI(document.location.href);
|
const baseURI = Services.io.newURI(document.baseURI);
|
||||||
return Services.io.newURI(url, null, baseURI).spec;
|
return Services.io.newURI(url, null, baseURI).spec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue