зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1730477 - Change SessionStore.getWindowState to return an object instead of a string. r=kashav
Differential Revision: https://phabricator.services.mozilla.com/D125382
This commit is contained in:
Родитель
f1425a24ac
Коммит
ad1d27699f
|
@ -2934,12 +2934,12 @@ var SessionStoreInternal = {
|
|||
|
||||
getWindowState: function ssi_getWindowState(aWindow) {
|
||||
if ("__SSi" in aWindow) {
|
||||
return JSON.stringify(this._getWindowState(aWindow));
|
||||
return Cu.cloneInto(this._getWindowState(aWindow), {});
|
||||
}
|
||||
|
||||
if (DyingWindowCache.has(aWindow)) {
|
||||
let data = DyingWindowCache.get(aWindow);
|
||||
return JSON.stringify({ windows: [data] });
|
||||
return Cu.cloneInto({ windows: [data] }, {});
|
||||
}
|
||||
|
||||
throw Components.Exception(
|
||||
|
|
|
@ -12,7 +12,7 @@ add_task(async function test() {
|
|||
|
||||
const { outerWidth, outerHeight, screenX, screenY } = win;
|
||||
function checkCurrentState(sizemode) {
|
||||
let state = JSON.parse(ss.getWindowState(win));
|
||||
let state = ss.getWindowState(win);
|
||||
let winState = state.windows[0];
|
||||
let msgSuffix = ` should match on ${sizemode} mode`;
|
||||
is(winState.width, outerWidth, "width" + msgSuffix);
|
||||
|
|
|
@ -7,13 +7,13 @@ function test() {
|
|||
window.addEventListener(
|
||||
"SSWindowStateBusy",
|
||||
function() {
|
||||
let state = JSON.parse(ss.getWindowState(window));
|
||||
let state = ss.getWindowState(window);
|
||||
ok(state.windows[0].busy, "window is busy");
|
||||
|
||||
window.addEventListener(
|
||||
"SSWindowStateReady",
|
||||
function() {
|
||||
let state2 = JSON.parse(ss.getWindowState(window));
|
||||
let state2 = ss.getWindowState(window);
|
||||
ok(!state2.windows[0].busy, "window is not busy");
|
||||
|
||||
executeSoon(() => {
|
||||
|
|
|
@ -53,7 +53,7 @@ add_task(async function test() {
|
|||
function checkWindowState(window) {
|
||||
let {
|
||||
windows: [{ tabs }],
|
||||
} = JSON.parse(ss.getWindowState(window));
|
||||
} = ss.getWindowState(window);
|
||||
is(tabs.length, 1, "the window has a single tab");
|
||||
is(tabs[0].entries[0].url, "about:mozilla", "the tab is about:mozilla");
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ add_task(async function test() {
|
|||
}
|
||||
|
||||
function checkCurrentState(sizemodeBeforeMinimized) {
|
||||
let state = JSON.parse(ss.getWindowState(win));
|
||||
let state = ss.getWindowState(win);
|
||||
let winState = state.windows[0];
|
||||
is(
|
||||
winState.sizemodeBeforeMinimized,
|
||||
|
|
|
@ -43,7 +43,7 @@ add_task(async function() {
|
|||
// userContextId.
|
||||
win.gBrowser.moveTabTo(win.gBrowser.tabs[0], win.gBrowser.tabs.length - 1);
|
||||
|
||||
let winState = JSON.parse(ss.getWindowState(win));
|
||||
let winState = ss.getWindowState(win);
|
||||
|
||||
for (let i = 0; i < 4; i++) {
|
||||
Assert.equal(
|
||||
|
@ -121,7 +121,7 @@ add_task(async function() {
|
|||
// win should have 1 default tab, and 1 container tab.
|
||||
Assert.equal(win.gBrowser.tabs.length, 2, "win should have 2 tabs");
|
||||
|
||||
let winState = JSON.parse(ss.getWindowState(win));
|
||||
let winState = ss.getWindowState(win);
|
||||
|
||||
for (let i = 0; i < 2; i++) {
|
||||
Assert.equal(
|
||||
|
|
Загрузка…
Ссылка в новой задаче