michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: "use strict"; michael@0: michael@0: /** michael@0: * Ensure that static frames of framesets are serialized but dynamically michael@0: * inserted iframes are ignored. michael@0: */ michael@0: add_task(function () { michael@0: // This URL has the following frames: michael@0: // + about:mozilla (static) michael@0: // + about:robots (static) michael@0: // + about:rights (dynamic iframe) michael@0: const URL = "data:text/html;charset=utf-8," + michael@0: "
" + michael@0: ""; michael@0: michael@0: // Add a new tab with two "static" and one "dynamic" frame. michael@0: let tab = gBrowser.addTab(URL); michael@0: let browser = tab.linkedBrowser; michael@0: yield promiseBrowserLoaded(browser); michael@0: michael@0: SyncHandlers.get(browser).flush(); michael@0: let {entries} = JSON.parse(ss.getTabState(tab)); michael@0: michael@0: // Check URLs. michael@0: ok(entries[0].url.startsWith("data:text/html"), "correct root url"); michael@0: is(entries[0].children[0].url, "about:mozilla", "correct url for 1st frame"); michael@0: is(entries[0].children[1].url, "about:robots", "correct url for 2nd frame"); michael@0: michael@0: // Check the number of children. michael@0: is(entries.length, 1, "there is one root entry ..."); michael@0: is(entries[0].children.length, 2, "... with two child entries"); michael@0: michael@0: // Cleanup. michael@0: gBrowser.removeTab(tab); michael@0: }); michael@0: michael@0: /** michael@0: * Ensure that iframes created by the network parser are serialized but michael@0: * dynamically inserted iframes are ignored. Navigating a subframe should michael@0: * create a second root entry that doesn't contain any dynamic children either. michael@0: */ michael@0: add_task(function () { michael@0: // This URL has the following frames: michael@0: // + about:mozilla (static iframe) michael@0: // + about:rights (dynamic iframe) michael@0: const URL = "data:text/html;charset=utf-8," + michael@0: "" + michael@0: "clickme" + michael@0: ""; michael@0: michael@0: // Add a new tab with one "static" and one "dynamic" frame. michael@0: let tab = gBrowser.addTab(URL); michael@0: let browser = tab.linkedBrowser; michael@0: yield promiseBrowserLoaded(browser); michael@0: michael@0: SyncHandlers.get(browser).flush(); michael@0: let {entries} = JSON.parse(ss.getTabState(tab)); michael@0: michael@0: // Check URLs. michael@0: ok(entries[0].url.startsWith("data:text/html"), "correct root url"); michael@0: is(entries[0].children[0].url, "about:mozilla", "correct url for static frame"); michael@0: michael@0: // Check the number of children. michael@0: is(entries.length, 1, "there is one root entry ..."); michael@0: is(entries[0].children.length, 1, "... with a single child entry"); michael@0: michael@0: // Navigate the subframe. michael@0: browser.messageManager.sendAsyncMessage("ss-test:click", {id: "lnk"}); michael@0: yield promiseBrowserLoaded(browser, false /* don't ignore subframes */); michael@0: michael@0: SyncHandlers.get(browser).flush(); michael@0: let {entries} = JSON.parse(ss.getTabState(tab)); michael@0: michael@0: // Check URLs. michael@0: ok(entries[0].url.startsWith("data:text/html"), "correct 1st root url"); michael@0: ok(entries[1].url.startsWith("data:text/html"), "correct 2nd root url"); michael@0: is(entries[0].children[0].url, "about:mozilla", "correct url for 1st static frame"); michael@0: is(entries[1].children[0].url, "about:robots", "correct url for 2ns static frame"); michael@0: michael@0: // Check the number of children. michael@0: is(entries.length, 2, "there are two root entries ..."); michael@0: is(entries[0].children.length, 1, "... with a single child entry ..."); michael@0: is(entries[1].children.length, 1, "... each"); michael@0: michael@0: // Cleanup. michael@0: gBrowser.removeTab(tab); michael@0: });