зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1803158 - convert session restore JSMs to sys.mjs ESMs, r=Standard8
Differential Revision: https://phabricator.services.mozilla.com/D163349
This commit is contained in:
Родитель
a132d5f6ab
Коммит
ad73d26a8a
|
@ -60,7 +60,7 @@ const known_scripts = {
|
|||
|
||||
if (!gFissionBrowser) {
|
||||
known_scripts.modules.add(
|
||||
"resource:///modules/sessionstore/ContentSessionStore.jsm"
|
||||
"resource:///modules/sessionstore/ContentSessionStore.sys.mjs"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,16 +2,13 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
var EXPORTED_SYMBOLS = ["ContentRestore"];
|
||||
|
||||
const lazy = {};
|
||||
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
SessionHistory: "resource://gre/modules/sessionstore/SessionHistory.sys.mjs",
|
||||
Utils: "resource://gre/modules/sessionstore/Utils.sys.mjs",
|
||||
});
|
||||
|
||||
/**
|
||||
* This module implements the content side of session restoration. The chrome
|
||||
* side is handled by SessionStore.jsm. The functions in this module are called
|
||||
|
@ -41,7 +38,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
|||
* reset message, which causes resetRestore to be called. At that point it's
|
||||
* legal to begin another restore.
|
||||
*/
|
||||
function ContentRestore(chromeGlobal) {
|
||||
export function ContentRestore(chromeGlobal) {
|
||||
let internal = new ContentRestoreInternal(chromeGlobal);
|
||||
let external = {};
|
||||
|
|
@ -2,16 +2,11 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
var EXPORTED_SYMBOLS = ["ContentSessionStore"];
|
||||
|
||||
const { XPCOMUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/XPCOMUtils.sys.mjs"
|
||||
);
|
||||
const { clearTimeout, setTimeoutWithTarget } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/Timer.sys.mjs"
|
||||
);
|
||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
||||
import {
|
||||
clearTimeout,
|
||||
setTimeoutWithTarget,
|
||||
} from "resource://gre/modules/Timer.sys.mjs";
|
||||
|
||||
function debug(msg) {
|
||||
Services.console.logStringMessage("SessionStoreContent: " + msg);
|
||||
|
@ -19,12 +14,8 @@ function debug(msg) {
|
|||
|
||||
const lazy = {};
|
||||
|
||||
ChromeUtils.defineModuleGetter(
|
||||
lazy,
|
||||
"ContentRestore",
|
||||
"resource:///modules/sessionstore/ContentRestore.jsm"
|
||||
);
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
ContentRestore: "resource:///modules/sessionstore/ContentRestore.sys.mjs",
|
||||
SessionHistory: "resource://gre/modules/sessionstore/SessionHistory.sys.mjs",
|
||||
});
|
||||
|
||||
|
@ -512,7 +503,7 @@ const MESSAGES = [
|
|||
"SessionStore:prepareForProcessChange",
|
||||
];
|
||||
|
||||
class ContentSessionStore {
|
||||
export class ContentSessionStore {
|
||||
constructor(mm) {
|
||||
if (Services.appinfo.sessionHistoryInParent) {
|
||||
throw new Error("This frame script should not be loaded for SHIP");
|
|
@ -2,10 +2,6 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
var EXPORTED_SYMBOLS = ["GlobalState"];
|
||||
|
||||
const EXPORTED_METHODS = [
|
||||
"getState",
|
||||
"clear",
|
||||
|
@ -14,10 +10,11 @@ const EXPORTED_METHODS = [
|
|||
"delete",
|
||||
"setFromState",
|
||||
];
|
||||
|
||||
/**
|
||||
* Module that contains global session data.
|
||||
*/
|
||||
function GlobalState() {
|
||||
export function GlobalState() {
|
||||
let internal = new GlobalStateInternal();
|
||||
let external = {};
|
||||
for (let method of EXPORTED_METHODS) {
|
|
@ -2,30 +2,19 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
var EXPORTED_SYMBOLS = ["RecentlyClosedTabsAndWindowsMenuUtils"];
|
||||
|
||||
const lazy = {};
|
||||
|
||||
ChromeUtils.defineModuleGetter(
|
||||
lazy,
|
||||
"PluralForm",
|
||||
"resource://gre/modules/PluralForm.jsm"
|
||||
);
|
||||
ChromeUtils.defineModuleGetter(
|
||||
lazy,
|
||||
"SessionStore",
|
||||
"resource:///modules/sessionstore/SessionStore.jsm"
|
||||
);
|
||||
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
PlacesUIUtils: "resource:///modules/PlacesUIUtils.sys.mjs",
|
||||
PluralForm: "resource://gre/modules/PluralForm.sys.mjs",
|
||||
SessionStore: "resource:///modules/sessionstore/SessionStore.sys.mjs",
|
||||
});
|
||||
|
||||
var navigatorBundle = Services.strings.createBundle(
|
||||
"chrome://browser/locale/browser.properties"
|
||||
);
|
||||
|
||||
var RecentlyClosedTabsAndWindowsMenuUtils = {
|
||||
export var RecentlyClosedTabsAndWindowsMenuUtils = {
|
||||
/**
|
||||
* Builds up a document fragment of UI items for the recently closed tabs.
|
||||
* @param aWindow
|
|
@ -2,10 +2,6 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
var EXPORTED_SYMBOLS = ["RunState"];
|
||||
|
||||
const STATE_STOPPED = 0;
|
||||
const STATE_RUNNING = 1;
|
||||
const STATE_QUITTING = 2;
|
||||
|
@ -21,7 +17,7 @@ var state = STATE_STOPPED;
|
|||
* the initial browser window has loaded we switch to STATE_RUNNING. On the
|
||||
* first notice that a browser shutdown was granted we switch to STATE_QUITTING.
|
||||
*/
|
||||
var RunState = Object.freeze({
|
||||
export var RunState = Object.freeze({
|
||||
// If we're stopped then SessionStore hasn't been initialized yet. As soon
|
||||
// as the session is read from disk and the initial browser window has loaded
|
||||
// the run state will change to STATE_RUNNING.
|
|
@ -2,10 +2,6 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
var EXPORTED_SYMBOLS = ["SessionCookies"];
|
||||
|
||||
const lazy = {};
|
||||
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
|
@ -17,7 +13,7 @@ const MAX_EXPIRY = Number.MAX_SAFE_INTEGER;
|
|||
/**
|
||||
* The external API implemented by the SessionCookies module.
|
||||
*/
|
||||
var SessionCookies = Object.freeze({
|
||||
export var SessionCookies = Object.freeze({
|
||||
collect() {
|
||||
return SessionCookiesInternal.collect();
|
||||
},
|
|
@ -2,10 +2,6 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
var EXPORTED_SYMBOLS = ["SessionFile"];
|
||||
|
||||
/**
|
||||
* Implementation of all the disk I/O required by the session store.
|
||||
* This is a private API, meant to be used only by the session store.
|
||||
|
@ -19,16 +15,12 @@ var EXPORTED_SYMBOLS = ["SessionFile"];
|
|||
* another attempts to copy that file.
|
||||
*/
|
||||
|
||||
const { XPCOMUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/XPCOMUtils.sys.mjs"
|
||||
);
|
||||
|
||||
const lazy = {};
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(lazy, {
|
||||
RunState: "resource:///modules/sessionstore/RunState.jsm",
|
||||
SessionStore: "resource:///modules/sessionstore/SessionStore.jsm",
|
||||
SessionWriter: "resource:///modules/sessionstore/SessionWriter.jsm",
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
RunState: "resource:///modules/sessionstore/RunState.sys.mjs",
|
||||
SessionStore: "resource:///modules/sessionstore/SessionStore.sys.mjs",
|
||||
SessionWriter: "resource:///modules/sessionstore/SessionWriter.sys.mjs",
|
||||
});
|
||||
|
||||
const PREF_UPGRADE_BACKUP = "browser.sessionstore.upgradeBackup.latestBuildID";
|
||||
|
@ -38,7 +30,7 @@ const PREF_MAX_UPGRADE_BACKUPS =
|
|||
const PREF_MAX_SERIALIZE_BACK = "browser.sessionstore.max_serialize_back";
|
||||
const PREF_MAX_SERIALIZE_FWD = "browser.sessionstore.max_serialize_forward";
|
||||
|
||||
var SessionFile = {
|
||||
export var SessionFile = {
|
||||
/**
|
||||
* Read the contents of the session file, asynchronously.
|
||||
*/
|
|
@ -2,10 +2,6 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
var EXPORTED_SYMBOLS = ["SessionMigration"];
|
||||
|
||||
const lazy = {};
|
||||
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
|
@ -78,7 +74,7 @@ var SessionMigrationInternal = {
|
|||
},
|
||||
};
|
||||
|
||||
var SessionMigration = {
|
||||
export var SessionMigration = {
|
||||
/**
|
||||
* Migrate a limited set of session data from one path to another.
|
||||
*/
|
|
@ -2,34 +2,23 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
var EXPORTED_SYMBOLS = ["SessionSaver"];
|
||||
|
||||
const {
|
||||
import {
|
||||
cancelIdleCallback,
|
||||
clearTimeout,
|
||||
requestIdleCallback,
|
||||
setTimeout,
|
||||
} = ChromeUtils.importESModule("resource://gre/modules/Timer.sys.mjs");
|
||||
const { XPCOMUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/XPCOMUtils.sys.mjs"
|
||||
);
|
||||
const { AppConstants } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/AppConstants.sys.mjs"
|
||||
);
|
||||
} from "resource://gre/modules/Timer.sys.mjs";
|
||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
||||
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
|
||||
|
||||
const lazy = {};
|
||||
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
PrivacyFilter: "resource://gre/modules/sessionstore/PrivacyFilter.sys.mjs",
|
||||
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(lazy, {
|
||||
RunState: "resource:///modules/sessionstore/RunState.jsm",
|
||||
SessionStore: "resource:///modules/sessionstore/SessionStore.jsm",
|
||||
SessionFile: "resource:///modules/sessionstore/SessionFile.jsm",
|
||||
RunState: "resource:///modules/sessionstore/RunState.sys.mjs",
|
||||
SessionFile: "resource:///modules/sessionstore/SessionFile.sys.mjs",
|
||||
SessionStore: "resource:///modules/sessionstore/SessionStore.sys.mjs",
|
||||
});
|
||||
|
||||
/*
|
||||
|
@ -74,7 +63,7 @@ var stopWatchFinish = stopWatch("finish");
|
|||
/**
|
||||
* The external API implemented by the SessionSaver module.
|
||||
*/
|
||||
var SessionSaver = Object.freeze({
|
||||
export var SessionSaver = Object.freeze({
|
||||
/**
|
||||
* Immediately saves the current session to disk.
|
||||
*/
|
|
@ -2,8 +2,6 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Session Storage and Restoration
|
||||
*
|
||||
|
@ -29,30 +27,21 @@
|
|||
* browser.startup.page is set to 3.
|
||||
*/
|
||||
|
||||
var EXPORTED_SYMBOLS = ["SessionStartup"];
|
||||
|
||||
/* :::::::: Constants and Helpers ::::::::::::::: */
|
||||
|
||||
const lazy = {};
|
||||
|
||||
ChromeUtils.defineModuleGetter(
|
||||
lazy,
|
||||
"SessionFile",
|
||||
"resource:///modules/sessionstore/SessionFile.jsm"
|
||||
);
|
||||
ChromeUtils.defineModuleGetter(
|
||||
lazy,
|
||||
"StartupPerformance",
|
||||
"resource:///modules/sessionstore/StartupPerformance.jsm"
|
||||
);
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs",
|
||||
SessionFile: "resource:///modules/sessionstore/SessionFile.sys.mjs",
|
||||
StartupPerformance:
|
||||
"resource:///modules/sessionstore/StartupPerformance.sys.mjs",
|
||||
});
|
||||
ChromeUtils.defineModuleGetter(
|
||||
lazy,
|
||||
"CrashMonitor",
|
||||
"resource://gre/modules/CrashMonitor.jsm"
|
||||
);
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs",
|
||||
});
|
||||
|
||||
const STATE_RUNNING_STR = "running";
|
||||
|
||||
|
@ -93,7 +82,7 @@ var gOnceInitializedDeferred = (function() {
|
|||
|
||||
/* :::::::: The Service ::::::::::::::: */
|
||||
|
||||
var SessionStartup = {
|
||||
export var SessionStartup = {
|
||||
NO_SESSION: TYPE_NO_SESSION,
|
||||
RECOVER_SESSION: TYPE_RECOVER_SESSION,
|
||||
RESUME_SESSION: TYPE_RESUME_SESSION,
|
|
@ -2,10 +2,6 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
var EXPORTED_SYMBOLS = ["SessionStore", "_LastSession"];
|
||||
|
||||
// Current version of the format used by Session Restore.
|
||||
const FORMAT_VERSION = 1;
|
||||
|
||||
|
@ -217,21 +213,14 @@ const BROWSER_STARTUP_RESUME_SESSION = 3;
|
|||
const kNoIndex = Number.MAX_SAFE_INTEGER;
|
||||
const kLastIndex = Number.MAX_SAFE_INTEGER - 1;
|
||||
|
||||
const { PrivateBrowsingUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/PrivateBrowsingUtils.sys.mjs"
|
||||
);
|
||||
import { PrivateBrowsingUtils } from "resource://gre/modules/PrivateBrowsingUtils.sys.mjs";
|
||||
|
||||
const { TelemetryTimestamps } = ChromeUtils.import(
|
||||
"resource://gre/modules/TelemetryTimestamps.jsm"
|
||||
);
|
||||
const { XPCOMUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/XPCOMUtils.sys.mjs"
|
||||
);
|
||||
const { AppConstants } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/AppConstants.sys.mjs"
|
||||
);
|
||||
const { GlobalState } = ChromeUtils.import(
|
||||
"resource:///modules/sessionstore/GlobalState.jsm"
|
||||
);
|
||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
||||
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
|
||||
import { GlobalState } from "resource:///modules/sessionstore/GlobalState.sys.mjs";
|
||||
|
||||
const lazy = {};
|
||||
|
||||
|
@ -244,7 +233,16 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
|||
E10SUtils: "resource://gre/modules/E10SUtils.sys.mjs",
|
||||
PrivacyFilter: "resource://gre/modules/sessionstore/PrivacyFilter.sys.mjs",
|
||||
PromiseUtils: "resource://gre/modules/PromiseUtils.sys.mjs",
|
||||
RunState: "resource:///modules/sessionstore/RunState.sys.mjs",
|
||||
SessionCookies: "resource:///modules/sessionstore/SessionCookies.sys.mjs",
|
||||
SessionFile: "resource:///modules/sessionstore/SessionFile.sys.mjs",
|
||||
SessionHistory: "resource://gre/modules/sessionstore/SessionHistory.sys.mjs",
|
||||
SessionSaver: "resource:///modules/sessionstore/SessionSaver.sys.mjs",
|
||||
SessionStartup: "resource:///modules/sessionstore/SessionStartup.sys.mjs",
|
||||
TabAttributes: "resource:///modules/sessionstore/TabAttributes.sys.mjs",
|
||||
TabState: "resource:///modules/sessionstore/TabState.sys.mjs",
|
||||
TabStateCache: "resource:///modules/sessionstore/TabStateCache.sys.mjs",
|
||||
TabStateFlusher: "resource:///modules/sessionstore/TabStateFlusher.sys.mjs",
|
||||
setTimeout: "resource://gre/modules/Timer.sys.mjs",
|
||||
});
|
||||
|
||||
|
@ -252,16 +250,7 @@ XPCOMUtils.defineLazyModuleGetters(lazy, {
|
|||
AsyncShutdown: "resource://gre/modules/AsyncShutdown.jsm",
|
||||
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
|
||||
HomePage: "resource:///modules/HomePage.jsm",
|
||||
RunState: "resource:///modules/sessionstore/RunState.jsm",
|
||||
SessionCookies: "resource:///modules/sessionstore/SessionCookies.jsm",
|
||||
SessionFile: "resource:///modules/sessionstore/SessionFile.jsm",
|
||||
SessionSaver: "resource:///modules/sessionstore/SessionSaver.jsm",
|
||||
SessionStartup: "resource:///modules/sessionstore/SessionStartup.jsm",
|
||||
TabAttributes: "resource:///modules/sessionstore/TabAttributes.jsm",
|
||||
TabCrashHandler: "resource:///modules/ContentCrashHandlers.jsm",
|
||||
TabState: "resource:///modules/sessionstore/TabState.jsm",
|
||||
TabStateCache: "resource:///modules/sessionstore/TabStateCache.jsm",
|
||||
TabStateFlusher: "resource:///modules/sessionstore/TabStateFlusher.jsm",
|
||||
});
|
||||
|
||||
/**
|
||||
|
@ -278,7 +267,7 @@ var gDebuggingEnabled = false;
|
|||
*/
|
||||
var gResistFingerprintingEnabled = false;
|
||||
|
||||
var SessionStore = {
|
||||
export var SessionStore = {
|
||||
get promiseInitialized() {
|
||||
return SessionStoreInternal.promiseInitialized;
|
||||
},
|
||||
|
@ -6865,4 +6854,4 @@ var LastSession = {
|
|||
};
|
||||
|
||||
// Exposed for tests
|
||||
const _LastSession = LastSession;
|
||||
export const _LastSession = LastSession;
|
|
@ -2,10 +2,6 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
var EXPORTED_SYMBOLS = ["SessionWriter"];
|
||||
|
||||
/**
|
||||
* We just started (we haven't written anything to disk yet) from
|
||||
* `Paths.clean`. The backup directory may not exist.
|
||||
|
@ -53,7 +49,7 @@ function lockIOWithMutex() {
|
|||
/**
|
||||
* Interface dedicated to handling I/O for Session Store.
|
||||
*/
|
||||
const SessionWriter = {
|
||||
export const SessionWriter = {
|
||||
init(origin, useOldExtension, paths, prefs = {}) {
|
||||
return SessionWriterInternal.init(origin, useOldExtension, paths, prefs);
|
||||
},
|
|
@ -2,10 +2,6 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
var EXPORTED_SYMBOLS = ["StartupPerformance"];
|
||||
|
||||
const lazy = {};
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
clearTimeout: "resource://gre/modules/Timer.sys.mjs",
|
||||
|
@ -19,7 +15,7 @@ const OBSERVED_TOPICS = [
|
|||
"sessionstore-initiating-manual-restore",
|
||||
];
|
||||
|
||||
var StartupPerformance = {
|
||||
export var StartupPerformance = {
|
||||
/**
|
||||
* Once we have finished restoring initial tabs, we broadcast on this topic.
|
||||
*/
|
|
@ -2,10 +2,6 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
var EXPORTED_SYMBOLS = ["TabAttributes"];
|
||||
|
||||
// We never want to directly read or write these attributes.
|
||||
// 'image' should not be accessed directly but handled by using the
|
||||
// gBrowser.getIcon()/setIcon() methods.
|
||||
|
@ -22,7 +18,7 @@ const ATTRIBUTES_TO_SKIP = new Set([
|
|||
// A set of tab attributes to persist. We will read a given list of tab
|
||||
// attributes when collecting tab data and will re-set those attributes when
|
||||
// the given tab data is restored to a new tab.
|
||||
var TabAttributes = Object.freeze({
|
||||
export var TabAttributes = Object.freeze({
|
||||
persist(name) {
|
||||
return TabAttributesInternal.persist(name);
|
||||
},
|
|
@ -2,30 +2,18 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
var EXPORTED_SYMBOLS = ["TabState"];
|
||||
|
||||
const lazy = {};
|
||||
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
PrivacyFilter: "resource://gre/modules/sessionstore/PrivacyFilter.sys.mjs",
|
||||
TabAttributes: "resource:///modules/sessionstore/TabAttributes.sys.mjs",
|
||||
TabStateCache: "resource:///modules/sessionstore/TabStateCache.sys.mjs",
|
||||
});
|
||||
ChromeUtils.defineModuleGetter(
|
||||
lazy,
|
||||
"TabStateCache",
|
||||
"resource:///modules/sessionstore/TabStateCache.jsm"
|
||||
);
|
||||
ChromeUtils.defineModuleGetter(
|
||||
lazy,
|
||||
"TabAttributes",
|
||||
"resource:///modules/sessionstore/TabAttributes.jsm"
|
||||
);
|
||||
|
||||
/**
|
||||
* Module that contains tab state collection methods.
|
||||
*/
|
||||
var TabState = Object.freeze({
|
||||
export var TabState = Object.freeze({
|
||||
update(permanentKey, data) {
|
||||
TabStateInternal.update(permanentKey, data);
|
||||
},
|
|
@ -2,10 +2,6 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
var EXPORTED_SYMBOLS = ["TabStateCache"];
|
||||
|
||||
/**
|
||||
* A cache for tabs data.
|
||||
*
|
||||
|
@ -16,7 +12,7 @@ var EXPORTED_SYMBOLS = ["TabStateCache"];
|
|||
* - that data is used very seldom by SessionStore;
|
||||
* - caching private data in addition to public data is memory consuming.
|
||||
*/
|
||||
var TabStateCache = Object.freeze({
|
||||
export var TabStateCache = Object.freeze({
|
||||
/**
|
||||
* Retrieves cached data for a given |tab| or associated |browser|.
|
||||
*
|
|
@ -2,16 +2,10 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
var EXPORTED_SYMBOLS = ["TabStateFlusher"];
|
||||
|
||||
const lazy = {};
|
||||
ChromeUtils.defineModuleGetter(
|
||||
lazy,
|
||||
"SessionStore",
|
||||
"resource:///modules/sessionstore/SessionStore.jsm"
|
||||
);
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
SessionStore: "resource:///modules/sessionstore/SessionStore.sys.mjs",
|
||||
});
|
||||
|
||||
/**
|
||||
* A module that enables async flushes. Updates from frame scripts are
|
||||
|
@ -20,7 +14,7 @@ ChromeUtils.defineModuleGetter(
|
|||
* wait until the frame scripts reported back. At this point the parent has the
|
||||
* latest data and the action can continue.
|
||||
*/
|
||||
var TabStateFlusher = Object.freeze({
|
||||
export var TabStateFlusher = Object.freeze({
|
||||
/**
|
||||
* Requests an async flush for the given browser. Returns a promise that will
|
||||
* resolve when we heard back from the content process and the parent has
|
|
@ -7,11 +7,9 @@
|
|||
const { AppConstants } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/AppConstants.sys.mjs"
|
||||
);
|
||||
ChromeUtils.defineModuleGetter(
|
||||
this,
|
||||
"SessionStore",
|
||||
"resource:///modules/sessionstore/SessionStore.jsm"
|
||||
);
|
||||
ChromeUtils.defineESModuleGetters(this, {
|
||||
SessionStore: "resource:///modules/sessionstore/SessionStore.sys.mjs",
|
||||
});
|
||||
|
||||
var gStateObject;
|
||||
var gTreeData;
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { ContentSessionStore } = ChromeUtils.import(
|
||||
"resource:///modules/sessionstore/ContentSessionStore.jsm"
|
||||
const { ContentSessionStore } = ChromeUtils.importESModule(
|
||||
"resource:///modules/sessionstore/ContentSessionStore.sys.mjs"
|
||||
);
|
||||
|
||||
void new ContentSessionStore(this);
|
||||
|
|
|
@ -10,23 +10,23 @@ BROWSER_CHROME_MANIFESTS += ["test/browser.ini"]
|
|||
JAR_MANIFESTS += ["jar.mn"]
|
||||
|
||||
EXTRA_JS_MODULES.sessionstore = [
|
||||
"ContentRestore.jsm",
|
||||
"ContentSessionStore.jsm",
|
||||
"GlobalState.jsm",
|
||||
"RecentlyClosedTabsAndWindowsMenuUtils.jsm",
|
||||
"RunState.jsm",
|
||||
"SessionCookies.jsm",
|
||||
"SessionFile.jsm",
|
||||
"SessionMigration.jsm",
|
||||
"SessionSaver.jsm",
|
||||
"SessionStartup.jsm",
|
||||
"SessionStore.jsm",
|
||||
"SessionWriter.jsm",
|
||||
"StartupPerformance.jsm",
|
||||
"TabAttributes.jsm",
|
||||
"TabState.jsm",
|
||||
"TabStateCache.jsm",
|
||||
"TabStateFlusher.jsm",
|
||||
"ContentRestore.sys.mjs",
|
||||
"ContentSessionStore.sys.mjs",
|
||||
"GlobalState.sys.mjs",
|
||||
"RecentlyClosedTabsAndWindowsMenuUtils.sys.mjs",
|
||||
"RunState.sys.mjs",
|
||||
"SessionCookies.sys.mjs",
|
||||
"SessionFile.sys.mjs",
|
||||
"SessionMigration.sys.mjs",
|
||||
"SessionSaver.sys.mjs",
|
||||
"SessionStartup.sys.mjs",
|
||||
"SessionStore.sys.mjs",
|
||||
"SessionWriter.sys.mjs",
|
||||
"StartupPerformance.sys.mjs",
|
||||
"TabAttributes.sys.mjs",
|
||||
"TabState.sys.mjs",
|
||||
"TabStateCache.sys.mjs",
|
||||
"TabStateFlusher.sys.mjs",
|
||||
]
|
||||
|
||||
with Files("**"):
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
* notifications. The latter won't.
|
||||
*/
|
||||
|
||||
const { SessionStartup } = ChromeUtils.import(
|
||||
"resource:///modules/sessionstore/SessionStartup.jsm"
|
||||
const { SessionStartup } = ChromeUtils.importESModule(
|
||||
"resource:///modules/sessionstore/SessionStartup.sys.mjs"
|
||||
);
|
||||
// The rejection "BrowserWindowTracker.getTopWindow(...) is null" is left
|
||||
// unhandled in some cases. This bug should be fixed, but for the moment this
|
||||
|
|
|
@ -8,8 +8,8 @@ const TEST_URL =
|
|||
"data:text/html;charset=utf-8,<input%20id=txt>" +
|
||||
"<input%20type=checkbox%20id=chk>";
|
||||
|
||||
const { SessionStore } = ChromeUtils.import(
|
||||
"resource:///modules/sessionstore/SessionStore.jsm"
|
||||
const { SessionStore } = ChromeUtils.importESModule(
|
||||
"resource:///modules/sessionstore/SessionStore.sys.mjs"
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
const { SessionStore } = ChromeUtils.import(
|
||||
"resource:///modules/sessionstore/SessionStore.jsm"
|
||||
const { SessionStore } = ChromeUtils.importESModule(
|
||||
"resource:///modules/sessionstore/SessionStore.sys.mjs"
|
||||
);
|
||||
|
||||
add_task(async function testClosedTabData() {
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { SessionStore } = ChromeUtils.import(
|
||||
"resource:///modules/sessionstore/SessionStore.jsm"
|
||||
const { SessionStore } = ChromeUtils.importESModule(
|
||||
"resource:///modules/sessionstore/SessionStore.sys.mjs"
|
||||
);
|
||||
const BACKUP_STATE = SessionStore.getBrowserState();
|
||||
|
||||
|
|
|
@ -1,18 +1,7 @@
|
|||
ChromeUtils.defineModuleGetter(
|
||||
this,
|
||||
"SessionStore",
|
||||
"resource:///modules/sessionstore/SessionStore.jsm"
|
||||
);
|
||||
ChromeUtils.defineModuleGetter(
|
||||
this,
|
||||
"TabStateCache",
|
||||
"resource:///modules/sessionstore/TabStateCache.jsm"
|
||||
);
|
||||
ChromeUtils.defineModuleGetter(
|
||||
this,
|
||||
"TabStateFlusher",
|
||||
"resource:///modules/sessionstore/TabStateFlusher.jsm"
|
||||
);
|
||||
ChromeUtils.defineESModuleGetters(this, {
|
||||
SessionStore: "resource:///modules/sessionstore/SessionStore.sys.mjs",
|
||||
TabStateCache: "resource:///modules/sessionstore/TabStateCache.sys.mjs",
|
||||
});
|
||||
|
||||
add_task(async function() {
|
||||
await BrowserTestUtils.withNewTab("http://example.com", async function(
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
ChromeUtils.defineModuleGetter(
|
||||
this,
|
||||
"SessionStore",
|
||||
"resource:///modules/sessionstore/SessionStore.jsm"
|
||||
);
|
||||
ChromeUtils.defineESModuleGetters(this, {
|
||||
SessionStore: "resource:///modules/sessionstore/SessionStore.sys.mjs",
|
||||
});
|
||||
|
||||
add_task(async function() {
|
||||
await BrowserTestUtils.withNewTab("https://example.com", async function(
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
const { _LastSession } = ChromeUtils.import(
|
||||
"resource:///modules/sessionstore/SessionStore.jsm"
|
||||
const { _LastSession } = ChromeUtils.importESModule(
|
||||
"resource:///modules/sessionstore/SessionStore.sys.mjs"
|
||||
);
|
||||
const { sinon } = ChromeUtils.import("resource://testing-common/Sinon.jsm");
|
||||
|
||||
|
|
|
@ -121,10 +121,6 @@ function waitForNewCookie() {
|
|||
add_task(async function test() {
|
||||
const USER_CONTEXTS = ["default", "personal", "work"];
|
||||
|
||||
const { TabStateFlusher } = ChromeUtils.import(
|
||||
"resource:///modules/sessionstore/TabStateFlusher.jsm"
|
||||
);
|
||||
|
||||
// Make sure userContext is enabled.
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["privacy.userContext.enabled", true]],
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* This test is for the undoCloseById function.
|
||||
*/
|
||||
|
||||
const { SessionStore } = ChromeUtils.import(
|
||||
"resource:///modules/sessionstore/SessionStore.jsm"
|
||||
const { SessionStore } = ChromeUtils.importESModule(
|
||||
"resource:///modules/sessionstore/SessionStore.sys.mjs"
|
||||
);
|
||||
|
||||
async function openWindow(url) {
|
||||
|
|
|
@ -20,17 +20,17 @@ const HTTPSROOT = ROOT.replace(
|
|||
"https://example.com/"
|
||||
);
|
||||
|
||||
const { SessionSaver } = ChromeUtils.import(
|
||||
"resource:///modules/sessionstore/SessionSaver.jsm"
|
||||
const { SessionSaver } = ChromeUtils.importESModule(
|
||||
"resource:///modules/sessionstore/SessionSaver.sys.mjs"
|
||||
);
|
||||
const { SessionFile } = ChromeUtils.import(
|
||||
"resource:///modules/sessionstore/SessionFile.jsm"
|
||||
const { SessionFile } = ChromeUtils.importESModule(
|
||||
"resource:///modules/sessionstore/SessionFile.sys.mjs"
|
||||
);
|
||||
const { TabState } = ChromeUtils.import(
|
||||
"resource:///modules/sessionstore/TabState.jsm"
|
||||
const { TabState } = ChromeUtils.importESModule(
|
||||
"resource:///modules/sessionstore/TabState.sys.mjs"
|
||||
);
|
||||
const { TabStateFlusher } = ChromeUtils.import(
|
||||
"resource:///modules/sessionstore/TabStateFlusher.jsm"
|
||||
const { TabStateFlusher } = ChromeUtils.importESModule(
|
||||
"resource:///modules/sessionstore/TabStateFlusher.sys.mjs"
|
||||
);
|
||||
const ss = SessionStore;
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
ChromeUtils.defineModuleGetter(
|
||||
this,
|
||||
"SessionStartup",
|
||||
"resource:///modules/sessionstore/SessionStartup.jsm"
|
||||
);
|
||||
ChromeUtils.defineESModuleGetters(this, {
|
||||
SessionStartup: "resource:///modules/sessionstore/SessionStartup.sys.mjs",
|
||||
});
|
||||
|
||||
// Call a function once initialization of SessionStartup is complete
|
||||
function afterSessionStartupInitialization(cb) {
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { SessionWriter } = ChromeUtils.import(
|
||||
"resource:///modules/sessionstore/SessionWriter.jsm"
|
||||
const { SessionWriter } = ChromeUtils.importESModule(
|
||||
"resource:///modules/sessionstore/SessionWriter.sys.mjs"
|
||||
);
|
||||
|
||||
// Make sure that we have a profile before initializing SessionFile.
|
||||
const profd = do_get_profile();
|
||||
const { SessionFile } = ChromeUtils.import(
|
||||
"resource:///modules/sessionstore/SessionFile.jsm"
|
||||
const { SessionFile } = ChromeUtils.importESModule(
|
||||
"resource:///modules/sessionstore/SessionFile.sys.mjs"
|
||||
);
|
||||
const Paths = SessionFile.Paths;
|
||||
|
||||
|
|
|
@ -7,15 +7,17 @@
|
|||
* entries.
|
||||
*/
|
||||
|
||||
const { SessionWriter } = ChromeUtils.import(
|
||||
"resource:///modules/sessionstore/SessionWriter.jsm"
|
||||
const { SessionWriter } = ChromeUtils.importESModule(
|
||||
"resource:///modules/sessionstore/SessionWriter.sys.mjs"
|
||||
);
|
||||
|
||||
// Make sure that we have a profile before initializing SessionFile.
|
||||
do_get_profile();
|
||||
const {
|
||||
SessionFile: { Paths },
|
||||
} = ChromeUtils.import("resource:///modules/sessionstore/SessionFile.jsm");
|
||||
} = ChromeUtils.importESModule(
|
||||
"resource:///modules/sessionstore/SessionFile.sys.mjs"
|
||||
);
|
||||
|
||||
const MAX_ENTRIES = 9;
|
||||
const URL = "http://example.com/#";
|
||||
|
|
|
@ -14,8 +14,8 @@ const HistogramId = "FX_SESSION_RESTORE_ALL_FILES_CORRUPT";
|
|||
|
||||
// Prepare the session file.
|
||||
do_get_profile();
|
||||
const { SessionFile } = ChromeUtils.import(
|
||||
"resource:///modules/sessionstore/SessionFile.jsm"
|
||||
const { SessionFile } = ChromeUtils.importESModule(
|
||||
"resource:///modules/sessionstore/SessionFile.sys.mjs"
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
"use strict";
|
||||
|
||||
const { SessionWriter } = ChromeUtils.import(
|
||||
"resource:///modules/sessionstore/SessionWriter.jsm"
|
||||
const { SessionWriter } = ChromeUtils.importESModule(
|
||||
"resource:///modules/sessionstore/SessionWriter.sys.mjs"
|
||||
);
|
||||
|
||||
// Make sure that we have a profile before initializing SessionFile.
|
||||
const profd = do_get_profile();
|
||||
const { SessionFile } = ChromeUtils.import(
|
||||
"resource:///modules/sessionstore/SessionFile.jsm"
|
||||
const { SessionFile } = ChromeUtils.importESModule(
|
||||
"resource:///modules/sessionstore/SessionFile.sys.mjs"
|
||||
);
|
||||
const Paths = SessionFile.Paths;
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
function run_test() {
|
||||
let profd = do_get_profile();
|
||||
var SessionFile = ChromeUtils.import(
|
||||
"resource:///modules/sessionstore/SessionFile.jsm"
|
||||
var SessionFile = ChromeUtils.importESModule(
|
||||
"resource:///modules/sessionstore/SessionFile.sys.mjs"
|
||||
).SessionFile;
|
||||
|
||||
let sourceSession = do_get_file("data/sessionstore_invalid.js");
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
function run_test() {
|
||||
let profd = do_get_profile();
|
||||
var SessionFile = ChromeUtils.import(
|
||||
"resource:///modules/sessionstore/SessionFile.jsm"
|
||||
var SessionFile = ChromeUtils.importESModule(
|
||||
"resource:///modules/sessionstore/SessionFile.sys.mjs"
|
||||
).SessionFile;
|
||||
|
||||
let sourceSession = do_get_file("data/sessionstore_valid.js");
|
||||
|
|
|
@ -62,7 +62,7 @@ avoid-blacklist-and-whitelist:
|
|||
- browser/components/preferences/privacy.js
|
||||
- browser/components/resistfingerprinting/test/mochitest/test_bug1354633_media_error.html
|
||||
- browser/components/safebrowsing/content/test/browser_whitelisted.js
|
||||
- browser/components/sessionstore/ContentSessionStore.jsm
|
||||
- browser/components/sessionstore/ContentSessionStore.sys.mjs
|
||||
- browser/components/sessionstore/test/browser_crashedTabs.js
|
||||
- browser/components/uitour/UITourChild.jsm
|
||||
- browser/components/urlbar/tests/browser/browser_searchSingleWordNotification.js
|
||||
|
|
Загрузка…
Ссылка в новой задаче