content-script.js (1024B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 "use strict"; 5 6 const { 7 contentScriptTargetSpec, 8 } = require("resource://devtools/shared/specs/targets/content-script.js"); 9 const { 10 FrontClassWithSpec, 11 registerFront, 12 } = require("resource://devtools/shared/protocol.js"); 13 const { 14 TargetMixin, 15 } = require("resource://devtools/client/fronts/targets/target-mixin.js"); 16 17 class ContentScriptTargetFront extends TargetMixin( 18 FrontClassWithSpec(contentScriptTargetSpec) 19 ) { 20 form(json) { 21 this.actorID = json.actor; 22 23 // Save the full form for Target class usage. 24 // Do not use `form` name to avoid colliding with protocol.js's `form` method 25 this.targetForm = json; 26 27 this._title = json.title; 28 this.innerWindowId = json.innerWindowId; 29 } 30 } 31 32 exports.ContentScriptTargetFront = ContentScriptTargetFront; 33 registerFront(ContentScriptTargetFront);