mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-23 10:15:41 +00:00
Bug 1446719
- Rename getTabValue / setTabValue / deleteTabValue to getCustomTabValue / setCustomTabValue / deleteCustomTabValue. r=dao
--HG-- extra : rebase_source : 4d1ee61af6b01c58c07aa8e09d125959b62dcc75
This commit is contained in:
parent
9a52b692d2
commit
ca80552b9f
@ -3288,7 +3288,7 @@ window._gBrowser = {
|
||||
let event = document.createEvent("Events");
|
||||
event.initEvent("TabShow", true, false);
|
||||
aTab.dispatchEvent(event);
|
||||
SessionStore.deleteTabValue(aTab, "hiddenBy");
|
||||
SessionStore.deleteCustomTabValue(aTab, "hiddenBy");
|
||||
}
|
||||
},
|
||||
|
||||
@ -3306,7 +3306,7 @@ window._gBrowser = {
|
||||
event.initEvent("TabHide", true, false);
|
||||
aTab.dispatchEvent(event);
|
||||
if (aSource) {
|
||||
SessionStore.setTabValue(aTab, "hiddenBy", aSource);
|
||||
SessionStore.setCustomTabValue(aTab, "hiddenBy", aSource);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -156,14 +156,14 @@ this.sessions = class extends ExtensionAPI {
|
||||
let {tab, encodedKey} =
|
||||
getTabParams(extension.id, key, tabId);
|
||||
|
||||
SessionStore.setTabValue(tab, encodedKey, JSON.stringify(value));
|
||||
SessionStore.setCustomTabValue(tab, encodedKey, JSON.stringify(value));
|
||||
},
|
||||
|
||||
async getTabValue(tabId, key) {
|
||||
let {tab, encodedKey} =
|
||||
getTabParams(extension.id, key, tabId);
|
||||
|
||||
let value = SessionStore.getTabValue(tab, encodedKey);
|
||||
let value = SessionStore.getCustomTabValue(tab, encodedKey);
|
||||
if (value) {
|
||||
return JSON.parse(value);
|
||||
}
|
||||
@ -175,7 +175,7 @@ this.sessions = class extends ExtensionAPI {
|
||||
let {tab, encodedKey} =
|
||||
getTabParams(extension.id, key, tabId);
|
||||
|
||||
SessionStore.deleteTabValue(tab, encodedKey);
|
||||
SessionStore.deleteCustomTabValue(tab, encodedKey);
|
||||
},
|
||||
|
||||
setWindowValue(windowId, key, value) {
|
||||
|
@ -31,7 +31,7 @@ function showHiddenTabs(id) {
|
||||
|
||||
for (let tab of win.gBrowser.tabs) {
|
||||
if (tab.hidden && tab.ownerGlobal &&
|
||||
SessionStore.getTabValue(tab, "hiddenBy") === id) {
|
||||
SessionStore.getCustomTabValue(tab, "hiddenBy") === id) {
|
||||
win.gBrowser.showTab(tab);
|
||||
}
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ add_task(async function test_tabs_showhide() {
|
||||
ok(!tabs[0].hidden, "first tab not hidden");
|
||||
for (let i = 1; i < tabs.length; i++) {
|
||||
ok(tabs[i].hidden, "tab hidden value is correct");
|
||||
let id = SessionStore.getTabValue(tabs[i], "hiddenBy");
|
||||
let id = SessionStore.getCustomTabValue(tabs[i], "hiddenBy");
|
||||
is(id, extension.id, "tab hiddenBy value is correct");
|
||||
await TabStateFlusher.flush(tabs[i].linkedBrowser);
|
||||
}
|
||||
@ -136,7 +136,7 @@ add_task(async function test_tabs_showhide() {
|
||||
ok(!tabs[0].hidden, "first tab not hidden");
|
||||
for (let i = 1; i < tabs.length; i++) {
|
||||
ok(tabs[i].hidden, "tab hidden value is correct");
|
||||
let id = SessionStore.getTabValue(tabs[i], "hiddenBy");
|
||||
let id = SessionStore.getCustomTabValue(tabs[i], "hiddenBy");
|
||||
is(id, extension.id, "tab hiddenBy value is correct");
|
||||
}
|
||||
|
||||
|
@ -301,16 +301,16 @@ var SessionStore = {
|
||||
SessionStoreInternal.deleteWindowValue(aWindow, aKey);
|
||||
},
|
||||
|
||||
getTabValue: function ss_getTabValue(aTab, aKey) {
|
||||
return SessionStoreInternal.getTabValue(aTab, aKey);
|
||||
getCustomTabValue(aTab, aKey) {
|
||||
return SessionStoreInternal.getCustomTabValue(aTab, aKey);
|
||||
},
|
||||
|
||||
setTabValue: function ss_setTabValue(aTab, aKey, aStringValue) {
|
||||
SessionStoreInternal.setTabValue(aTab, aKey, aStringValue);
|
||||
setCustomTabValue(aTab, aKey, aStringValue) {
|
||||
SessionStoreInternal.setCustomTabValue(aTab, aKey, aStringValue);
|
||||
},
|
||||
|
||||
deleteTabValue: function ss_deleteTabValue(aTab, aKey) {
|
||||
SessionStoreInternal.deleteTabValue(aTab, aKey);
|
||||
deleteCustomTabValue(aTab, aKey) {
|
||||
SessionStoreInternal.deleteCustomTabValue(aTab, aKey);
|
||||
},
|
||||
|
||||
getLazyTabValue(aTab, aKey) {
|
||||
@ -2589,13 +2589,13 @@ var SessionStoreInternal = {
|
||||
this.saveStateDelayed(aWindow);
|
||||
},
|
||||
|
||||
getTabValue: function ssi_getTabValue(aTab, aKey) {
|
||||
getCustomTabValue(aTab, aKey) {
|
||||
return (aTab.__SS_extdata || {})[aKey] || "";
|
||||
},
|
||||
|
||||
setTabValue: function ssi_setTabValue(aTab, aKey, aStringValue) {
|
||||
setCustomTabValue(aTab, aKey, aStringValue) {
|
||||
if (typeof aStringValue != "string") {
|
||||
throw new TypeError("setTabValue only accepts string values");
|
||||
throw new TypeError("setCustomTabValue only accepts string values");
|
||||
}
|
||||
|
||||
// If the tab hasn't been restored, then set the data there, otherwise we
|
||||
@ -2608,7 +2608,7 @@ var SessionStoreInternal = {
|
||||
this.saveStateDelayed(aTab.ownerGlobal);
|
||||
},
|
||||
|
||||
deleteTabValue: function ssi_deleteTabValue(aTab, aKey) {
|
||||
deleteCustomTabValue(aTab, aKey) {
|
||||
if (aTab.__SS_extdata && aKey in aTab.__SS_extdata) {
|
||||
delete aTab.__SS_extdata[aKey];
|
||||
this.saveStateDelayed(aTab.ownerGlobal);
|
||||
|
@ -179,20 +179,20 @@ interface nsISessionStore : nsISupports
|
||||
*
|
||||
* @returns A string value or an empty string if none is set.
|
||||
*/
|
||||
AString getTabValue(in nsIDOMNode aTab, in AString aKey);
|
||||
AString getCustomTabValue(in nsIDOMNode aTab, in AString aKey);
|
||||
|
||||
/**
|
||||
* @param aTab is the tabbrowser tab to set the value for.
|
||||
* @param aKey is the value's name.
|
||||
* @param aStringValue is the value itself (use JSON.stringify/parse before setting JS objects).
|
||||
*/
|
||||
void setTabValue(in nsIDOMNode aTab, in AString aKey, in jsval aStringValue);
|
||||
void setCustomTabValue(in nsIDOMNode aTab, in AString aKey, in jsval aStringValue);
|
||||
|
||||
/**
|
||||
* @param aTab is the tabbrowser tab to get the value for.
|
||||
* @param aKey is the value's name.
|
||||
*/
|
||||
void deleteTabValue(in nsIDOMNode aTab, in AString aKey);
|
||||
void deleteCustomTabValue(in nsIDOMNode aTab, in AString aKey);
|
||||
|
||||
/**
|
||||
* @param aKey is the value's name.
|
||||
|
@ -144,7 +144,7 @@ function test() {
|
||||
let tab_C = win.gBrowser.duplicateTab(tab_B);
|
||||
promiseTabRestored(tab_C).then(() => {
|
||||
// verify the correctness of the duplicated tab
|
||||
is(ss.getTabValue(tab_C, key1), value1,
|
||||
is(ss.getCustomTabValue(tab_C, key1), value1,
|
||||
"tab successfully duplicated - correct state");
|
||||
|
||||
for (let item in fieldList)
|
||||
|
@ -38,7 +38,7 @@ add_task(async function() {
|
||||
ok(test(() => ss.deleteWindowValue(window, key)), "delete non-existent window value");
|
||||
|
||||
/**
|
||||
* setTabValue, et al.
|
||||
* setCustomTabValue, et al.
|
||||
*/
|
||||
key = "Unique name: " + Math.random();
|
||||
value = "Unique value: " + Date.now();
|
||||
@ -46,19 +46,19 @@ add_task(async function() {
|
||||
tab.linkedBrowser.stop();
|
||||
|
||||
// test adding
|
||||
ok(test(() => ss.setTabValue(tab, key, value)), "store a tab value");
|
||||
ok(test(() => ss.setCustomTabValue(tab, key, value)), "store a tab value");
|
||||
|
||||
// test retrieving
|
||||
is(ss.getTabValue(tab, key), value, "stored tab value match original");
|
||||
is(ss.getCustomTabValue(tab, key), value, "stored tab value match original");
|
||||
|
||||
// test deleting
|
||||
ok(test(() => ss.deleteTabValue(tab, key)), "delete the tab value");
|
||||
ok(test(() => ss.deleteCustomTabValue(tab, key)), "delete the tab value");
|
||||
|
||||
// value should not exist post-delete
|
||||
is(ss.getTabValue(tab, key), "", "tab value was deleted");
|
||||
is(ss.getCustomTabValue(tab, key), "", "tab value was deleted");
|
||||
|
||||
// test deleting a non-existent value
|
||||
ok(test(() => ss.deleteTabValue(tab, key)), "delete non-existent tab value");
|
||||
ok(test(() => ss.deleteCustomTabValue(tab, key)), "delete non-existent tab value");
|
||||
|
||||
// clean up
|
||||
await promiseRemoveTabAndSessionState(tab);
|
||||
|
@ -14,7 +14,7 @@ add_task(async function test_set_tabstate() {
|
||||
|
||||
// create a new tab
|
||||
let tab = BrowserTestUtils.addTab(gBrowser, URL);
|
||||
ss.setTabValue(tab, key, value);
|
||||
ss.setCustomTabValue(tab, key, value);
|
||||
await promiseBrowserLoaded(tab.linkedBrowser);
|
||||
|
||||
// get the tab's state
|
||||
@ -48,7 +48,7 @@ add_task(async function test_set_tabstate_and_duplicate() {
|
||||
await promiseBrowserLoaded(tab.linkedBrowser);
|
||||
|
||||
// verify the correctness of the restored tab
|
||||
ok(ss.getTabValue(tab, key2) == value2 && tab.linkedBrowser.currentURI.spec == URL,
|
||||
ok(ss.getCustomTabValue(tab, key2) == value2 && tab.linkedBrowser.currentURI.spec == URL,
|
||||
"the tab's state was correctly restored");
|
||||
|
||||
// add text data
|
||||
@ -59,7 +59,7 @@ add_task(async function test_set_tabstate_and_duplicate() {
|
||||
await promiseTabRestored(tab2);
|
||||
|
||||
// verify the correctness of the duplicated tab
|
||||
ok(ss.getTabValue(tab2, key2) == value2 &&
|
||||
ok(ss.getCustomTabValue(tab2, key2) == value2 &&
|
||||
tab2.linkedBrowser.currentURI.spec == URL,
|
||||
"correctly duplicated the tab's state");
|
||||
let textbox = await getInputValue(tab2.linkedBrowser, {id: "textbox"});
|
||||
|
@ -43,7 +43,7 @@ add_task(async function() {
|
||||
formdata: { id: { "url": "http://www.example.net/" } }
|
||||
}] }, title: REMEMBER },
|
||||
{ state: { entries: [{ url: "http://www.example.org/form" }],
|
||||
extData: { "setTabValue": "http://example.net:80" } }, title: REMEMBER }
|
||||
extData: { "setCustomTabValue": "http://example.net:80" } }, title: REMEMBER }
|
||||
] }] };
|
||||
let remember_count = 5;
|
||||
|
||||
|
@ -8,19 +8,19 @@ add_task(async function() {
|
||||
// set a unique value on a new, blank tab
|
||||
let tab1 = BrowserTestUtils.addTab(gBrowser, "about:blank");
|
||||
await promiseBrowserLoaded(tab1.linkedBrowser);
|
||||
ss.setTabValue(tab1, uniqueName, uniqueValue1);
|
||||
ss.setCustomTabValue(tab1, uniqueName, uniqueValue1);
|
||||
|
||||
// duplicate the tab with that value
|
||||
let tab2 = ss.duplicateTab(window, tab1);
|
||||
await promiseTabRestored(tab2);
|
||||
is(ss.getTabValue(tab2, uniqueName), uniqueValue1, "tab value was duplicated");
|
||||
is(ss.getCustomTabValue(tab2, uniqueName), uniqueValue1, "tab value was duplicated");
|
||||
|
||||
ss.setTabValue(tab2, uniqueName, uniqueValue2);
|
||||
isnot(ss.getTabValue(tab1, uniqueName), uniqueValue2, "tab values aren't sync'd");
|
||||
ss.setCustomTabValue(tab2, uniqueName, uniqueValue2);
|
||||
isnot(ss.getCustomTabValue(tab1, uniqueName), uniqueValue2, "tab values aren't sync'd");
|
||||
|
||||
// overwrite the tab with the value which should remove it
|
||||
await promiseTabState(tab1, {entries: []});
|
||||
is(ss.getTabValue(tab1, uniqueName), "", "tab value was cleared");
|
||||
is(ss.getCustomTabValue(tab1, uniqueName), "", "tab value was cleared");
|
||||
|
||||
// clean up
|
||||
gBrowser.removeTab(tab2);
|
||||
|
@ -11,13 +11,13 @@ function test() {
|
||||
|
||||
let tab = BrowserTestUtils.addTab(gBrowser);
|
||||
promiseBrowserLoaded(tab.linkedBrowser).then(() => {
|
||||
ss.setTabValue(tab, "bug485563", uniqueValue);
|
||||
ss.setCustomTabValue(tab, "bug485563", uniqueValue);
|
||||
let tabState = JSON.parse(ss.getTabState(tab));
|
||||
is(tabState.extData.bug485563, uniqueValue,
|
||||
"unicode line separator wasn't over-encoded");
|
||||
ss.deleteTabValue(tab, "bug485563");
|
||||
ss.deleteCustomTabValue(tab, "bug485563");
|
||||
ss.setTabState(tab, JSON.stringify(tabState));
|
||||
is(ss.getTabValue(tab, "bug485563"), uniqueValue,
|
||||
is(ss.getCustomTabValue(tab, "bug485563"), uniqueValue,
|
||||
"unicode line separator was correctly preserved");
|
||||
|
||||
gBrowser.removeTab(tab);
|
||||
|
@ -11,7 +11,7 @@ add_task(async function() {
|
||||
"we will be removing an about:blank tab");
|
||||
|
||||
let r = `rand-${Math.random()}`;
|
||||
ss.setTabValue(tab, "foobar", r);
|
||||
ss.setCustomTabValue(tab, "foobar", r);
|
||||
|
||||
await promiseRemoveTabAndSessionState(tab);
|
||||
let closedTabData = ss.getClosedTabData(window);
|
||||
|
@ -32,7 +32,7 @@ add_task(async function test() {
|
||||
// double check that this tab was the right one
|
||||
is(browser.currentURI.spec, tabData.entries[0].url,
|
||||
"load " + loadCount + " - browser loaded correct url");
|
||||
is(ss.getTabValue(tab, "uniq"), tabData.extData.uniq,
|
||||
is(ss.getCustomTabValue(tab, "uniq"), tabData.extData.uniq,
|
||||
"load " + loadCount + " - correct tab was restored");
|
||||
|
||||
if (loadCount == state.windows[0].tabs.length) {
|
||||
|
@ -48,7 +48,7 @@ add_task(async function test() {
|
||||
tab = window.gBrowser.tabs[i];
|
||||
}
|
||||
|
||||
is(ss.getTabValue(tab, "uniq"), expectedData,
|
||||
is(ss.getCustomTabValue(tab, "uniq"), expectedData,
|
||||
"load " + loadCount + " - correct tab was restored");
|
||||
|
||||
// select the next tab
|
||||
|
@ -33,10 +33,10 @@ function test() {
|
||||
|
||||
function onSSTabRestoring(aEvent) {
|
||||
restoringTabsCount++;
|
||||
let uniq = ss.getTabValue(aEvent.originalTarget, "uniq");
|
||||
let uniq = ss.getCustomTabValue(aEvent.originalTarget, "uniq");
|
||||
wasLoaded[uniq] = true;
|
||||
|
||||
is(ss.getTabValue(aEvent.originalTarget, "foo"), "",
|
||||
is(ss.getCustomTabValue(aEvent.originalTarget, "foo"), "",
|
||||
"There is no value for 'foo'");
|
||||
|
||||
// On the first SSTabRestoring we're going to run the the real test.
|
||||
@ -57,7 +57,7 @@ function test() {
|
||||
// To test bug 614708, we'll just set a value on the tab here. This value
|
||||
// would previously cause us to not recognize the values in extData until
|
||||
// much later. So testing "uniq" failed.
|
||||
ss.setTabValue(aEvent.originalTarget, "foo", "bar");
|
||||
ss.setCustomTabValue(aEvent.originalTarget, "foo", "bar");
|
||||
}
|
||||
|
||||
// This does the actual testing. SSTabRestoring should be firing on tabs from
|
||||
@ -66,7 +66,7 @@ function test() {
|
||||
info("onFirstSSTabRestoring...");
|
||||
for (let i = gBrowser.tabs.length - 1; i >= 0; i--) {
|
||||
let tab = gBrowser.tabs[i];
|
||||
let actualUniq = ss.getTabValue(tab, "uniq");
|
||||
let actualUniq = ss.getCustomTabValue(tab, "uniq");
|
||||
let expectedUniq = state.windows[0].tabs[i].extData.uniq;
|
||||
|
||||
if (wasLoaded[actualUniq]) {
|
||||
@ -78,15 +78,15 @@ function test() {
|
||||
// Now we're going to set a piece of data back on the tab so it can be read
|
||||
// to test setting a value "early".
|
||||
uniq2[actualUniq] = r();
|
||||
ss.setTabValue(tab, "uniq2", uniq2[actualUniq]);
|
||||
ss.setCustomTabValue(tab, "uniq2", uniq2[actualUniq]);
|
||||
|
||||
// Delete the value we have for "baz". This tests that deleteTabValue
|
||||
// Delete the value we have for "baz". This tests that deleteCustomTabValue
|
||||
// will delete "early access" values (c.f. bug 617175). If this doesn't throw
|
||||
// then the test is successful.
|
||||
try {
|
||||
ss.deleteTabValue(tab, "baz");
|
||||
ss.deleteCustomTabValue(tab, "baz");
|
||||
} catch (e) {
|
||||
ok(false, "no error calling deleteTabValue - " + e);
|
||||
ok(false, "no error calling deleteCustomTabValue - " + e);
|
||||
}
|
||||
|
||||
// This will be used in the final comparison to make sure we checked the
|
||||
@ -99,11 +99,11 @@ function test() {
|
||||
let checked = 0;
|
||||
for (let i = 0; i < gBrowser.tabs.length; i++) {
|
||||
let tab = gBrowser.tabs[i];
|
||||
let uniq = ss.getTabValue(tab, "uniq");
|
||||
let uniq = ss.getCustomTabValue(tab, "uniq");
|
||||
|
||||
// Look to see if we set a uniq2 value for this uniq value
|
||||
if (uniq in uniq2) {
|
||||
is(ss.getTabValue(tab, "uniq2"), uniq2[uniq], "tab " + i + " has correct uniq2 value");
|
||||
is(ss.getCustomTabValue(tab, "uniq2"), uniq2[uniq], "tab " + i + " has correct uniq2 value");
|
||||
checked++;
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ add_task(async function() {
|
||||
|
||||
// Now we'll set a new unique value on 1 of the tabs
|
||||
let newUniq = r();
|
||||
ss.setTabValue(gBrowser.tabs[1], "uniq", newUniq);
|
||||
ss.setCustomTabValue(gBrowser.tabs[1], "uniq", newUniq);
|
||||
let tabState = JSON.parse(ss.getTabState(gBrowser.tabs[1]));
|
||||
is(tabState.extData.uniq, newUniq,
|
||||
"(overwriting) new data is stored in extData");
|
||||
@ -52,13 +52,13 @@ add_task(async function() {
|
||||
|
||||
// set data that's not in a conflicting key
|
||||
let stillUniq = r();
|
||||
ss.setTabValue(gBrowser.tabs[3], "stillUniq", stillUniq);
|
||||
ss.setCustomTabValue(gBrowser.tabs[3], "stillUniq", stillUniq);
|
||||
tabState = JSON.parse(ss.getTabState(gBrowser.tabs[3]));
|
||||
is(tabState.extData.stillUniq, stillUniq,
|
||||
"(adding) new data is stored in extData");
|
||||
|
||||
// remove the uniq value and make sure it's not there in the closed data
|
||||
ss.deleteTabValue(gBrowser.tabs[4], "uniq");
|
||||
ss.deleteCustomTabValue(gBrowser.tabs[4], "uniq");
|
||||
tabState = JSON.parse(ss.getTabState(gBrowser.tabs[4]));
|
||||
// Since Panorama might have put data in, first check if there is extData.
|
||||
// If there is explicitly check that "uniq" isn't in it. Otherwise, we're ok
|
||||
@ -71,7 +71,7 @@ add_task(async function() {
|
||||
|
||||
// set unique data on the tab that never had any set, make sure that's saved
|
||||
let newUniq2 = r();
|
||||
ss.setTabValue(gBrowser.tabs[5], "uniq", newUniq2);
|
||||
ss.setCustomTabValue(gBrowser.tabs[5], "uniq", newUniq2);
|
||||
tabState = JSON.parse(ss.getTabState(gBrowser.tabs[5]));
|
||||
is(tabState.extData.uniq, newUniq2,
|
||||
"(creating) new data is stored in extData where there was none");
|
||||
|
@ -25,7 +25,7 @@ function test_duplicateTab() {
|
||||
let newTab;
|
||||
|
||||
// We'll look to make sure this value is on the duplicated tab
|
||||
ss.setTabValue(tab, "foo", "bar");
|
||||
ss.setCustomTabValue(tab, "foo", "bar");
|
||||
|
||||
function onSSWindowStateBusy(aEvent) {
|
||||
busyEventCount++;
|
||||
@ -34,15 +34,15 @@ function test_duplicateTab() {
|
||||
function onSSWindowStateReady(aEvent) {
|
||||
newTab = gBrowser.tabs[2];
|
||||
readyEventCount++;
|
||||
is(ss.getTabValue(newTab, "foo"), "bar");
|
||||
ss.setTabValue(newTab, "baz", "qux");
|
||||
is(ss.getCustomTabValue(newTab, "foo"), "bar");
|
||||
ss.setCustomTabValue(newTab, "baz", "qux");
|
||||
}
|
||||
|
||||
function onSSTabRestoring(aEvent) {
|
||||
if (aEvent.target == newTab) {
|
||||
is(busyEventCount, 1);
|
||||
is(readyEventCount, 1);
|
||||
is(ss.getTabValue(newTab, "baz"), "qux");
|
||||
is(ss.getCustomTabValue(newTab, "baz"), "qux");
|
||||
is(newTab.linkedBrowser.currentURI.spec, "about:rights");
|
||||
|
||||
window.removeEventListener("SSWindowStateBusy", onSSWindowStateBusy);
|
||||
|
@ -30,14 +30,14 @@ function test_setTabState() {
|
||||
|
||||
function onSSWindowStateReady(aEvent) {
|
||||
readyEventCount++;
|
||||
is(ss.getTabValue(tab, "foo"), "bar");
|
||||
ss.setTabValue(tab, "baz", "qux");
|
||||
is(ss.getCustomTabValue(tab, "foo"), "bar");
|
||||
ss.setCustomTabValue(tab, "baz", "qux");
|
||||
}
|
||||
|
||||
function onSSTabRestoring(aEvent) {
|
||||
is(busyEventCount, 1);
|
||||
is(readyEventCount, 1);
|
||||
is(ss.getTabValue(tab, "baz"), "qux");
|
||||
is(ss.getCustomTabValue(tab, "baz"), "qux");
|
||||
is(tab.linkedBrowser.currentURI.spec, "http://example.org/");
|
||||
|
||||
window.removeEventListener("SSWindowStateBusy", onSSWindowStateBusy);
|
||||
|
@ -25,8 +25,8 @@ function test() {
|
||||
|
||||
function onSSWindowStateReady(aEvent) {
|
||||
readyEventCount++;
|
||||
is(ss.getTabValue(gBrowser.tabs[0], "foo"), "bar");
|
||||
is(ss.getTabValue(gBrowser.tabs[1], "baz"), "qux");
|
||||
is(ss.getCustomTabValue(gBrowser.tabs[0], "foo"), "bar");
|
||||
is(ss.getCustomTabValue(gBrowser.tabs[1], "baz"), "qux");
|
||||
}
|
||||
|
||||
function onSSTabRestored(aEvent) {
|
||||
|
@ -20,7 +20,7 @@ add_task(async function test_undoCloseTab() {
|
||||
// This will be set inside the `onSSWindowStateReady` method.
|
||||
let lastTab;
|
||||
|
||||
ss.setTabValue(tab, "foo", "bar");
|
||||
ss.setCustomTabValue(tab, "foo", "bar");
|
||||
|
||||
function onSSWindowStateBusy(aEvent) {
|
||||
busyEventCount++;
|
||||
@ -30,8 +30,8 @@ add_task(async function test_undoCloseTab() {
|
||||
Assert.equal(gBrowser.tabs.length, 2, "Should only have 2 tabs");
|
||||
lastTab = gBrowser.tabs[1];
|
||||
readyEventCount++;
|
||||
Assert.equal(ss.getTabValue(lastTab, "foo"), "bar");
|
||||
ss.setTabValue(lastTab, "baz", "qux");
|
||||
Assert.equal(ss.getCustomTabValue(lastTab, "foo"), "bar");
|
||||
ss.setCustomTabValue(lastTab, "baz", "qux");
|
||||
}
|
||||
|
||||
window.addEventListener("SSWindowStateBusy", onSSWindowStateBusy);
|
||||
@ -47,7 +47,7 @@ add_task(async function test_undoCloseTab() {
|
||||
Assert.equal(reopenedTab, lastTab, "Tabs should be the same one.");
|
||||
Assert.equal(busyEventCount, 1);
|
||||
Assert.equal(readyEventCount, 1);
|
||||
Assert.equal(ss.getTabValue(reopenedTab, "baz"), "qux");
|
||||
Assert.equal(ss.getCustomTabValue(reopenedTab, "baz"), "qux");
|
||||
Assert.equal(reopenedTab.linkedBrowser.currentURI.spec, "about:rights");
|
||||
|
||||
window.removeEventListener("SSWindowStateBusy", onSSWindowStateBusy);
|
||||
|
@ -13,7 +13,7 @@ add_task(async function() {
|
||||
"we will be removing an about:privatebrowsing tab");
|
||||
|
||||
let r = `rand-${Math.random()}`;
|
||||
ss.setTabValue(tab, "foobar", r);
|
||||
ss.setCustomTabValue(tab, "foobar", r);
|
||||
|
||||
await promiseRemoveTabAndSessionState(tab);
|
||||
let closedTabData = ss.getClosedTabData(window);
|
||||
|
@ -7,7 +7,7 @@ async function createTabWithRandomValue(url) {
|
||||
|
||||
// Set a random value.
|
||||
let r = `rand-${Math.random()}`;
|
||||
ss.setTabValue(tab, "foobar", r);
|
||||
ss.setCustomTabValue(tab, "foobar", r);
|
||||
|
||||
// Flush to ensure there are no scheduled messages.
|
||||
await TabStateFlusher.flush(browser);
|
||||
|
Loading…
Reference in New Issue
Block a user