Bug 1680218 - [devtools] Remove supportsIsTopLevelDocument trait. r=rcaliman.

The trait was introduced in Firefox 81, so it's
safe to remove it now.

Differential Revision: https://phabricator.services.mozilla.com/D98489
This commit is contained in:
Nicolas Chevobbe 2020-12-09 06:23:46 +00:00
Родитель ba390c5097
Коммит 63a91e4bfb
6 изменённых файлов: 3 добавлений и 45 удалений

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

@ -321,12 +321,6 @@ class NodeFront extends FrontClassWithSpec(nodeSpec) {
return this._form.isTopLevelDocument;
}
// @backward-compat { version 81 } On newer server, this is never called; `isTopLevelDocument`
// is returned from the server.
set isTopLevelDocument(isTopLevelDocument) {
this._form.isTopLevelDocument = isTopLevelDocument;
}
get isShadowRoot() {
return this._form.isShadowRoot;
}

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

@ -549,14 +549,14 @@ class WalkerFront extends FrontClassWithSpec(walkerSpec) {
}
_onRootNodeAvailable(rootNode) {
if (this._isTopLevelRootNode(rootNode)) {
if (rootNode.isTopLevelDocument) {
this.rootNode = rootNode;
this._rootNodePromiseResolve(this.rootNode);
}
}
_onRootNodeDestroyed(rootNode) {
if (this._isTopLevelRootNode(rootNode)) {
if (rootNode.isTopLevelDocument) {
this._rootNodePromise = new Promise(
r => (this._rootNodePromiseResolve = r)
);
@ -564,16 +564,6 @@ class WalkerFront extends FrontClassWithSpec(walkerSpec) {
}
}
_isTopLevelRootNode(rootNode) {
if (!rootNode.traits.supportsIsTopLevelDocument) {
// When `supportsIsTopLevelDocument` is false, a root-node resource is
// necessarily top level, so we can fallback to true.
return true;
}
return rootNode.isTopLevelDocument;
}
/**
* Start the element picker on the debuggee target.
* @param {Boolean} doFocus - Optionally focus the content area once the picker is

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

@ -205,9 +205,7 @@ const NodeActor = protocol.ActorClassWithSpec(nodeSpec, {
this.rawNode.ownerDocument &&
this.rawNode.ownerDocument.contentType === "text/html",
hasEventListeners: this._hasEventListeners,
traits: {
supportsIsTopLevelDocument: true,
},
traits: {},
};
if (this.isDocumentElement()) {

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

@ -898,8 +898,6 @@ const ResourceTransformers = {
.ERROR_MESSAGE]: require("devtools/shared/resources/transformers/error-messages"),
[ResourceWatcher.TYPES
.LOCAL_STORAGE]: require("devtools/shared/resources/transformers/storage-local-storage.js"),
[ResourceWatcher.TYPES
.ROOT_NODE]: require("devtools/shared/resources/transformers/root-node"),
[ResourceWatcher.TYPES
.SESSION_STORAGE]: require("devtools/shared/resources/transformers/storage-session-storage.js"),
[ResourceWatcher.TYPES

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

@ -6,7 +6,6 @@ DevToolsModules(
"console-messages.js",
"error-messages.js",
"network-events.js",
"root-node.js",
"storage-local-storage.js",
"storage-session-storage.js",
)

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

@ -1,21 +0,0 @@
/* 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";
/**
* Transformer for the root node resource.
*
* @param {NodeFront} resource
* @param {TargetFront} targetFront
* @return {NodeFront} the updated resource
*/
module.exports = function({ resource, targetFront }) {
if (!resource.traits.supportsIsTopLevelDocument) {
// When `supportsIsTopLevelDocument` is false, a root-node resource is
// necessarily top level, se we can fallback to true.
resource.isTopLevelDocument = true;
}
return resource;
};