SessionStoreFunctions.sys.mjs (1430B)
1 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- 2 * This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 import { GeckoViewSessionStore } from "resource://gre/modules/GeckoViewSessionStore.sys.mjs"; 6 7 export class SessionStoreFunctions { 8 UpdateSessionStore( 9 aBrowser, 10 aBrowsingContext, 11 aPermanentKey, 12 aEpoch, 13 aCollectSHistory, 14 aData 15 ) { 16 return GeckoViewSessionStoreFuncInternal.updateSessionStore( 17 aBrowser, 18 aBrowsingContext, 19 aPermanentKey, 20 aEpoch, 21 aCollectSHistory, 22 aData 23 ); 24 } 25 } 26 27 var GeckoViewSessionStoreFuncInternal = { 28 updateSessionStore: function SSF_updateSessionStore( 29 aBrowser, 30 aBrowsingContext, 31 aPermanentKey, 32 aEpoch, 33 aCollectSHistory, 34 aData 35 ) { 36 const { formdata, scroll } = aData; 37 38 if (formdata) { 39 aData.formdata = formdata.toJSON(); 40 } 41 42 if (scroll) { 43 aData.scroll = scroll.toJSON(); 44 } 45 46 GeckoViewSessionStore.updateSessionStoreFromTabListener( 47 aBrowser, 48 aBrowsingContext, 49 aPermanentKey, 50 { 51 data: aData, 52 epoch: aEpoch, 53 sHistoryNeeded: aCollectSHistory, 54 } 55 ); 56 }, 57 }; 58 59 SessionStoreFunctions.prototype.QueryInterface = ChromeUtils.generateQI([ 60 "nsISessionStoreFunctions", 61 ]);