зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 2 changesets (bug 1483663) for failing dt at devtools/client/inspector/markup/test/browser_markup_shadowdom_ua_widgets_with_nac.js on a CLOSED TREE
Backed out changeset 6e9f11aeac28 (bug 1483663) Backed out changeset 2ffa90b738a1 (bug 1483663)
This commit is contained in:
Родитель
b2099f351e
Коммит
35d9be3087
|
@ -196,7 +196,6 @@ subsuite = clipboard
|
|||
[browser_markup_shadowdom_slotted_keyboard_focus.js]
|
||||
[browser_markup_shadowdom_slotupdate.js]
|
||||
[browser_markup_shadowdom_ua_widgets.js]
|
||||
[browser_markup_shadowdom_ua_widgets_with_nac.js]
|
||||
[browser_markup_tag_delete_whitespace_node.js]
|
||||
[browser_markup_tag_edit_01.js]
|
||||
[browser_markup_tag_edit_02.js]
|
||||
|
|
|
@ -1,79 +0,0 @@
|
|||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
const TEST_URL = `data:text/html;charset=utf-8,` + encodeURIComponent(`
|
||||
<video id="video-with-subtitles" style="border: 4px solid red">
|
||||
<track label="en" kind="subtitles" srclang="en" src="data:text/vtt,WEBVTT" default>
|
||||
</video>`);
|
||||
|
||||
const TEST_ID = "#video-with-subtitles";
|
||||
|
||||
// Test that Inspector can show Native Anonymous Content (nac) in user agent widgets, as
|
||||
// siblings of the ua widget closed shadow-root.
|
||||
|
||||
add_task(async function testWithoutShowAllAnonymousContent() {
|
||||
info("Test a <video> element with subtitles, without showAllAnonymousContent");
|
||||
const { inspector } = await setup({ showAllAnonymousContent: false });
|
||||
|
||||
// We should only see the shadow root and the authored <track> element.
|
||||
const tree = `
|
||||
video
|
||||
#shadow-root!ignore-children
|
||||
track`;
|
||||
await assertMarkupViewAsTree(tree, TEST_ID, inspector);
|
||||
});
|
||||
|
||||
add_task(async function testWithShowAllAnonymousContent() {
|
||||
info("Test a <video> element with subtitles, expect to see native anonymous content");
|
||||
const { inspector } = await setup({ showAllAnonymousContent: true });
|
||||
|
||||
// We should only see the shadow root, the <track> and two NAC elements <img> and <div>.
|
||||
const tree = `
|
||||
video
|
||||
#shadow-root!ignore-children
|
||||
track
|
||||
img
|
||||
class="caption-box"`;
|
||||
await assertMarkupViewAsTree(tree, TEST_ID, inspector);
|
||||
});
|
||||
|
||||
add_task(async function testElementPicker() {
|
||||
const { inspector, markup, toolbox, testActor } =
|
||||
await setup({ showAllAnonymousContent: true });
|
||||
|
||||
info("Waiting for element picker to become active.");
|
||||
await startPicker(toolbox);
|
||||
|
||||
info("Move mouse over the video element and pick");
|
||||
await hoverElement(inspector, testActor, TEST_ID, 50, 50);
|
||||
await pickElement(inspector, testActor, TEST_ID, 50, 50);
|
||||
|
||||
info("Check that the markup view has the expected content after using the picker");
|
||||
const tree = `
|
||||
body
|
||||
video
|
||||
#shadow-root!ignore-children
|
||||
track
|
||||
img
|
||||
class="caption-box"
|
||||
script!ignore-children`;
|
||||
// We are checking body here, because initially the picker bug fixed here was replacing
|
||||
// all the children of the body.
|
||||
await assertMarkupViewAsTree(tree, "body", inspector);
|
||||
|
||||
const moreNodesLink = markup.doc.querySelector(".more-nodes");
|
||||
ok(!moreNodesLink, "There is no 'more nodes' button displayed in the markup view");
|
||||
});
|
||||
|
||||
async function setup({ showAllAnonymousContent }) {
|
||||
await pushPref("dom.ua_widget.enabled", true);
|
||||
await pushPref("devtools.inspector.showUserAgentShadowRoots", true);
|
||||
await pushPref("devtools.inspector.showAllAnonymousContent", showAllAnonymousContent);
|
||||
|
||||
const { inspector, testActor, toolbox } = await openInspectorForURL(TEST_URL);
|
||||
const { markup } = inspector;
|
||||
return { inspector, markup, testActor, toolbox };
|
||||
}
|
|
@ -589,12 +589,7 @@ function assertContainerHasText(container, expectedText) {
|
|||
* subchild2
|
||||
* child2
|
||||
* subchild3!slotted`
|
||||
* child3!ignore-children
|
||||
* Each sub level should be indented by 2 spaces.
|
||||
* Each line contains text expected to match with the text of the corresponding
|
||||
* node in the markup view. Some suffixes are supported:
|
||||
* - !slotted -> indicates that the line corresponds to the slotted version
|
||||
* - !ignore-children -> the node might have children but do not assert them
|
||||
* @param {String} selector
|
||||
* A CSS selector that will uniquely match the "root" element from the tree
|
||||
* @param {Inspector} inspector
|
||||
|
@ -617,21 +612,13 @@ async function _checkMarkupViewNode(treeNode, container, inspector) {
|
|||
info("Checking [" + path + "]");
|
||||
info("Checking node: " + node);
|
||||
|
||||
const ignoreChildren = node.includes("!ignore-children");
|
||||
const slotted = node.includes("!slotted");
|
||||
|
||||
// Remove optional suffixes.
|
||||
const nodeText = node.replace("!slotted", "")
|
||||
.replace("!ignore-children", "");
|
||||
|
||||
assertContainerHasText(container, nodeText);
|
||||
|
||||
if (slotted) {
|
||||
const nodeName = node.replace("!slotted", "");
|
||||
assertContainerHasText(container, nodeName);
|
||||
assertContainerSlotted(container);
|
||||
}
|
||||
|
||||
if (ignoreChildren) {
|
||||
return;
|
||||
} else {
|
||||
assertContainerHasText(container, node);
|
||||
}
|
||||
|
||||
if (!children.length) {
|
||||
|
|
|
@ -17,7 +17,6 @@ loader.lazyRequireGetter(this, "isAfterPseudoElement", "devtools/shared/layout/u
|
|||
loader.lazyRequireGetter(this, "isAnonymous", "devtools/shared/layout/utils", true);
|
||||
loader.lazyRequireGetter(this, "isBeforePseudoElement", "devtools/shared/layout/utils", true);
|
||||
loader.lazyRequireGetter(this, "isDirectShadowHostChild", "devtools/shared/layout/utils", true);
|
||||
loader.lazyRequireGetter(this, "isNativeAnonymous", "devtools/shared/layout/utils", true);
|
||||
loader.lazyRequireGetter(this, "isShadowHost", "devtools/shared/layout/utils", true);
|
||||
loader.lazyRequireGetter(this, "isShadowRoot", "devtools/shared/layout/utils", true);
|
||||
loader.lazyRequireGetter(this, "isTemplateElement", "devtools/shared/layout/utils", true);
|
||||
|
@ -736,7 +735,6 @@ var WalkerActor = protocol.ActorClassWithSpec(walkerSpec, {
|
|||
// developers.
|
||||
const isUAWidget = shadowHost && node.rawNode.openOrClosedShadowRoot.isUAWidget();
|
||||
const hideShadowRoot = isUAWidget && !this.showUserAgentShadowRoots;
|
||||
const showNativeAnonymousChildren = isUAWidget && this.showUserAgentShadowRoots;
|
||||
|
||||
const templateElement = isTemplateElement(node.rawNode);
|
||||
if (templateElement) {
|
||||
|
@ -758,8 +756,6 @@ var WalkerActor = protocol.ActorClassWithSpec(walkerSpec, {
|
|||
}
|
||||
}
|
||||
|
||||
const useNonAnonymousWalker = shadowRoot || shadowHost || isUnslottedHostChild;
|
||||
|
||||
// We're going to create a few document walkers with the same filter,
|
||||
// make it easier.
|
||||
const getFilteredWalker = documentWalkerNode => {
|
||||
|
@ -769,6 +765,7 @@ var WalkerActor = protocol.ActorClassWithSpec(walkerSpec, {
|
|||
// in case this one is incompatible with the walker's filter function.
|
||||
const skipTo = SKIP_TO_SIBLING;
|
||||
|
||||
const useNonAnonymousWalker = shadowRoot || shadowHost || isUnslottedHostChild;
|
||||
if (useNonAnonymousWalker) {
|
||||
// Do not use an anonymous walker for :
|
||||
// - shadow roots: if the host element has an ::after pseudo element, a walker on
|
||||
|
@ -807,13 +804,10 @@ var WalkerActor = protocol.ActorClassWithSpec(walkerSpec, {
|
|||
start = firstChild;
|
||||
}
|
||||
|
||||
// If we are using a non anonymous walker, we cannot start on:
|
||||
// - a shadow root
|
||||
// - a native anonymous node
|
||||
if (
|
||||
useNonAnonymousWalker &&
|
||||
(isShadowRoot(start) || isNativeAnonymous(start))
|
||||
) {
|
||||
// A shadow root is not included in the children returned by the walker, so we can
|
||||
// not use it as start node. However it will be displayed as the first node, so
|
||||
// we use firstChild as a fallback.
|
||||
if (isShadowRoot(start)) {
|
||||
start = firstChild;
|
||||
}
|
||||
|
||||
|
@ -871,9 +865,6 @@ var WalkerActor = protocol.ActorClassWithSpec(walkerSpec, {
|
|||
...(hasBefore ? [first] : []),
|
||||
// shadow host direct children
|
||||
...nodes,
|
||||
// native anonymous content for UA widgets
|
||||
...(showNativeAnonymousChildren ?
|
||||
this.getNativeAnonymousChildren(node.rawNode) : []),
|
||||
// ::after
|
||||
...(hasAfter ? [last] : []),
|
||||
];
|
||||
|
@ -882,22 +873,6 @@ var WalkerActor = protocol.ActorClassWithSpec(walkerSpec, {
|
|||
return { hasFirst, hasLast, nodes };
|
||||
},
|
||||
|
||||
getNativeAnonymousChildren: function(rawNode) {
|
||||
// Get an anonymous walker and start on the first child.
|
||||
const walker = this.getDocumentWalker(rawNode);
|
||||
let node = walker.firstChild();
|
||||
|
||||
const nodes = [];
|
||||
while (node) {
|
||||
// We only want native anonymous content here.
|
||||
if (isNativeAnonymous(node)) {
|
||||
nodes.push(node);
|
||||
}
|
||||
node = walker.nextSibling();
|
||||
}
|
||||
return nodes;
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the next sibling of a given node. Getting nodes one at a time
|
||||
* might be inefficient, be careful.
|
||||
|
|
|
@ -636,11 +636,8 @@ exports.isShadowHost = isShadowHost;
|
|||
* @return {Boolean}
|
||||
*/
|
||||
function isDirectShadowHostChild(node) {
|
||||
// Pseudo elements and native anonymous elements are always part of the anonymous tree.
|
||||
if (
|
||||
isBeforePseudoElement(node) ||
|
||||
isAfterPseudoElement(node) ||
|
||||
isNativeAnonymous(node)) {
|
||||
// Pseudo elements are always part of the anonymous tree.
|
||||
if (isBeforePseudoElement(node) || isAfterPseudoElement(node)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче