Bug 1319596 - Wait for first historychange when starting RDM. r=ochameau

In bug 1310771, the session store process for gathering data from content was
changed so that the key "historychange" is used instead of "history".  Kept the
check for "history" as well, since other places in session store still test for
it.

In addition, an RDM test is added to verify that a closed RDM tab is restored to
the content page with RDM closed.

MozReview-Commit-ID: 4wCjINTDUH8

--HG--
extra : rebase_source : 392996c30e0f5ccab049521b20200adce1192236
This commit is contained in:
J. Ryan Stinnett 2016-11-23 16:35:17 -06:00
Родитель 12fc4c9f3d
Коммит 29f54d4c41
3 изменённых файлов: 33 добавлений и 1 удалений

Просмотреть файл

@ -312,7 +312,8 @@ function copyPermanentKey(outer, inner) {
// what SessionStore uses to identify each browser.
let outerMM = outer[FRAME_LOADER].messageManager;
let onHistoryEntry = message => {
let history = message.data.data.history;
let data = message.data.data;
let history = data.history || data.historychange;
if (!history || !history.entries) {
// Wait for a message that contains history data
return;

Просмотреть файл

@ -34,6 +34,7 @@ support-files =
[browser_resize_cmd.js]
[browser_screenshot_button.js]
[browser_tab_close.js]
[browser_tab_restore.js]
[browser_tab_remoteness_change.js]
[browser_toolbox_computed_view.js]
[browser_toolbox_rule_view.js]

Просмотреть файл

@ -0,0 +1,30 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Verify RDM tab reopens to content (with RDM closed) when restoring the tab.
const TEST_URL = "http://example.com/";
const ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
const { TabStateFlusher } = Cu.import("resource:///modules/sessionstore/TabStateFlusher.jsm", {});
add_task(function* () {
// Open tab, start RDM, close tab
let tab = yield addTab(TEST_URL);
// Ensure tab state is flushed to session store before closing (so it can be restored)
yield TabStateFlusher.flush(tab.linkedBrowser);
let { ui } = yield openRDM(tab);
yield removeTab(tab);
is(ui.destroyed, true, "RDM closed");
// Restore tab
tab = ss.undoCloseTab(window, 0);
yield once(tab, "SSTabRestored");
// Check location
is(tab.linkedBrowser.documentURI.spec, TEST_URL, "Restored tab location to test page");
yield removeTab(tab);
});