GeckoViewPrintDelegateParent.sys.mjs (1034B)
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 5 import { GeckoViewActorParent } from "resource://gre/modules/GeckoViewActorParent.sys.mjs"; 6 7 export class GeckoViewPrintDelegateParent extends GeckoViewActorParent { 8 constructor() { 9 super(); 10 this._browserStaticClone = null; 11 } 12 13 set browserStaticClone(staticClone) { 14 this._browserStaticClone = staticClone; 15 } 16 17 get browserStaticClone() { 18 return this._browserStaticClone; 19 } 20 21 clearStaticClone() { 22 // Removes static browser element from DOM that was made for window.print 23 this.browserStaticClone?.remove(); 24 this.browserStaticClone = null; 25 } 26 27 printRequest() { 28 if (this.browserStaticClone != null) { 29 this.eventDispatcher.sendRequest({ 30 type: "GeckoView:DotPrintRequest", 31 canonicalBrowsingContextId: this.browserStaticClone.browsingContext.id, 32 }); 33 } 34 } 35 }