michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: function test() { michael@0: /** Test for Bug 465215 **/ michael@0: michael@0: waitForExplicitFinish(); michael@0: michael@0: let uniqueName = "bug 465215"; michael@0: let uniqueValue1 = "as good as unique: " + Date.now(); michael@0: let uniqueValue2 = "as good as unique: " + Math.random(); michael@0: michael@0: // set a unique value on a new, blank tab michael@0: let tab1 = gBrowser.addTab(); michael@0: whenBrowserLoaded(tab1.linkedBrowser, function() { michael@0: ss.setTabValue(tab1, uniqueName, uniqueValue1); michael@0: michael@0: // duplicate the tab with that value michael@0: let tab2 = ss.duplicateTab(window, tab1); michael@0: is(ss.getTabValue(tab2, uniqueName), uniqueValue1, "tab value was duplicated"); michael@0: michael@0: ss.setTabValue(tab2, uniqueName, uniqueValue2); michael@0: isnot(ss.getTabValue(tab1, uniqueName), uniqueValue2, "tab values aren't sync'd"); michael@0: michael@0: // overwrite the tab with the value which should remove it michael@0: ss.setTabState(tab1, JSON.stringify({ entries: [] })); michael@0: whenTabRestored(tab1, function() { michael@0: is(ss.getTabValue(tab1, uniqueName), "", "tab value was cleared"); michael@0: michael@0: // clean up michael@0: gBrowser.removeTab(tab2); michael@0: gBrowser.removeTab(tab1); michael@0: finish(); michael@0: }); michael@0: }); michael@0: }