InteractionsParent.sys.mjs (1035B)
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 const lazy = {}; 6 7 ChromeUtils.defineESModuleGetters(lazy, { 8 Interactions: "moz-src:///browser/components/places/Interactions.sys.mjs", 9 }); 10 11 /** 12 * Receives messages from InteractionsChild and passes them to the appropriate 13 * interactions object. 14 */ 15 export class InteractionsParent extends JSWindowActorParent { 16 receiveMessage(msg) { 17 switch (msg.name) { 18 case "Interactions:PageLoaded": 19 lazy.Interactions.registerNewInteraction( 20 this.browsingContext.embedderElement, 21 msg.data 22 ); 23 break; 24 case "Interactions:PageHide": 25 lazy.Interactions.registerEndOfInteraction( 26 // This could be null if the browsing context has already gone away, 27 // e.g. on tab close. 28 this.browsingContext?.embedderElement 29 ); 30 break; 31 } 32 } 33 }