Bug 1891710: part 2) Enable <Element-outerHTML.html> WPT for Trusted Types. r=smaug
[gecko.git] / mobile / android / actors / GeckoViewPrintDelegateParent.sys.mjs
blobdb2edf652b3290b92a0d60e63653c11bc80a62a6
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/. */
5 import { GeckoViewActorParent } from "resource://gre/modules/GeckoViewActorParent.sys.mjs";
7 export class GeckoViewPrintDelegateParent extends GeckoViewActorParent {
8   constructor() {
9     super();
10     this._browserStaticClone = null;
11   }
13   set browserStaticClone(staticClone) {
14     this._browserStaticClone = staticClone;
15   }
17   get browserStaticClone() {
18     return this._browserStaticClone;
19   }
21   clearStaticClone() {
22     // Removes static browser element from DOM that was made for window.print
23     this.browserStaticClone?.remove();
24     this.browserStaticClone = null;
25   }
27   printRequest() {
28     if (this.browserStaticClone != null) {
29       this.eventDispatcher.sendRequest({
30         type: "GeckoView:DotPrintRequest",
31         canonicalBrowsingContextId: this.browserStaticClone.browsingContext.id,
32       });
33     }
34   }