Bug 1596800 - Remove document.getBindingParent. r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D53342

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2019-11-18 19:06:51 +00:00
Родитель ada190f78b
Коммит 06d4249d44
7 изменённых файлов: 5 добавлений и 79 удалений

Просмотреть файл

@ -7801,15 +7801,6 @@ already_AddRefed<nsINode> Document::ImportNode(nsINode& aNode, bool aDeep,
return nullptr;
}
// FIXME(bug 1596800): This should be removed, only has a couple of callers.
Element* Document::GetBindingParent(nsINode& aNode) {
if (aNode.IsInNativeAnonymousSubtree()) {
return Element::FromNodeOrNull(
aNode.GetClosestNativeAnonymousSubtreeRootParent());
}
return Element::FromNodeOrNull(aNode.GetContainingShadowHost());
}
nsINodeList* Document::GetAnonymousNodes(Element& aElement) { return nullptr; }
already_AddRefed<nsRange> Document::CreateRange(ErrorResult& rv) {

Просмотреть файл

@ -3705,7 +3705,6 @@ class Document : public nsINode,
// QuerySelector and QuerySelectorAll already defined on nsINode
nsINodeList* GetAnonymousNodes(Element& aElement);
Element* GetBindingParent(nsINode& aNode);
XPathExpression* CreateExpression(const nsAString& aExpression,
XPathNSResolver* aResolver,

Просмотреть файл

@ -311,7 +311,6 @@ skip-if = headless # headless != clipboard
[test_bug320799.html]
[test_bug322317.html]
[test_bug326337.html]
[test_bug330925.html]
[test_bug331959.html]
[test_bug333064.html]
skip-if = headless # Headless: Bug 1405868

Просмотреть файл

@ -1,58 +0,0 @@
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=330925
-->
<head>
<title>Test for Bug 330925</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=330925">Mozilla Bug 330925</a>
<p id="display">
<el-custom id="t"></el-custom>
</p>
<pre id="test">
<script class="testbody" type="text/javascript">
customElements.define("el-custom", class extends HTMLElement {
constructor() {
super();
this.attachShadow({ mode: "open" });
this.shadowRoot.innerHTML = `
xbl textnode1
<div>
xbl textnode2
<slot></slot>
</div>
`;
}
});
let t = document.getElementById("t");
let d = SpecialPowers.wrap(document);
let tn1 = t.shadowRoot.firstChild;
let tn2 = t.shadowRoot.firstChild.nextSibling.firstChild;
is(SpecialPowers.unwrap(d.getBindingParent(tn1)),
t,
"Wrong binding parent for shadow DOM node");
is(SpecialPowers.unwrap(d.getBindingParent(tn2)),
t,
"Wrong binding parent for child of shadow DOM node");
is(d.getBindingParent(t),
null,
"Non shadow DOM node should not have a binding parent");
is(d.getBindingParent(document.documentElement),
null,
"Document element should not have a binding parent");
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -377,12 +377,9 @@ partial interface Document {
// Mozilla extensions of various sorts
partial interface Document {
// XBL support. Wish we could make these [ChromeOnly], but
// that would likely break bindings running with the page principal.
// XBL support.
[Func="IsChromeOrXBL"]
NodeList? getAnonymousNodes(Element elt);
[Func="IsChromeOrXBL"]
Element? getBindingParent(Node node);
// Creates a new XUL element regardless of the document's default type.
[CEReactions, NewObject, Throws, Func="IsChromeOrXBL"]
Element createXULElement(DOMString localName, optional (ElementCreationOptions or DOMString) options = {});

Просмотреть файл

@ -11,7 +11,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=912322
<script type="application/javascript">
/** Test that XBL functions aren't exposed to the web. **/
funs = ['getAnonymousNodes', 'getBindingParent'];
funs = ['getAnonymousNodes'];
for (var f of funs) {
ok(!(f in document), f + " should not be available to content");
ok(f in SpecialPowers.wrap(document), f + " should be available to chrome via Xray");

Просмотреть файл

@ -195,11 +195,9 @@ function runBasicTest(aIsEditable, aInDesignMode, aDescription) {
onIMEFocusBlurHandler = null;
var focusedElement = gFM.focusedElement;
if (focusedElement) {
var bindingParent = document.getBindingParent(focusedElement);
if (bindingParent) {
focusedElement = bindingParent;
}
// FIXME(emilio, bug 981248): This is needed just for <input type=number>
while (focusedElement && focusedElement.isNativeAnonymous) {
focusedElement = focusedElement.parentNode;
}
if (aTest.focusable) {
is(focusedElement, element,