diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /devtools/server/actors/targets/frame.js | |
parent | Initial commit. (diff) | |
download | firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/server/actors/targets/frame.js')
-rw-r--r-- | devtools/server/actors/targets/frame.js | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/devtools/server/actors/targets/frame.js b/devtools/server/actors/targets/frame.js new file mode 100644 index 0000000000..cd9d97f026 --- /dev/null +++ b/devtools/server/actors/targets/frame.js @@ -0,0 +1,66 @@ +/* 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"; + +/* + * Target actor for a frame / docShell in the content process (where the actual + * content lives). + * + * This actor extends BrowsingContextTargetActor. + * + * See devtools/docs/backend/actor-hierarchy.md for more details. + */ + +var { + BrowsingContextTargetActor, + browsingContextTargetPrototype, +} = require("devtools/server/actors/targets/browsing-context"); + +const { extend } = require("devtools/shared/extend"); +const { frameTargetSpec } = require("devtools/shared/specs/targets/frame"); +const Targets = require("devtools/server/actors/targets/index"); +const TargetActorMixin = require("devtools/server/actors/targets/target-actor-mixin"); + +/** + * Protocol.js expects only the prototype object, and does not maintain the prototype + * chain when it constructs the ActorClass. For this reason we are using `extend` to + * maintain the properties of BrowsingContextTargetActor.prototype + */ +const frameTargetPrototype = extend({}, browsingContextTargetPrototype); + +/** + * Target actor for a frame / docShell in the content process. + * + * @param connection DevToolsServerConnection + * The conection to the client. + * @param docShell nsIDocShell + * The |docShell| for the debugged frame. + * @param options Object + * See BrowsingContextTargetActor.initialize doc. + */ +frameTargetPrototype.initialize = function(connection, docShell, options) { + BrowsingContextTargetActor.prototype.initialize.call( + this, + connection, + docShell, + options + ); + + this.traits.reconfigure = false; +}; + +Object.defineProperty(frameTargetPrototype, "title", { + get: function() { + return this.window.document.title; + }, + enumerable: true, + configurable: true, +}); + +exports.FrameTargetActor = TargetActorMixin( + Targets.TYPES.FRAME, + frameTargetSpec, + frameTargetPrototype +); |