browser_bug409481.js
Go to the documentation of this file.
1 function test() {
3 
4  // XXX This looks a bit odd, but is needed to avoid throwing when removing the
5  // event listeners below. See bug 310955.
6  document.getElementById("sidebar").addEventListener("load", delayedOpenUrl, true);
7  toggleSidebar("viewWebPanelsSidebar", true);
8 }
9 
10 function delayedOpenUrl() {
11  ok(true, "Ran delayedOpenUrl");
13 }
14 
15 function openPanelUrl(event) {
16  ok(!document.getElementById("sidebar-box").hidden, "Sidebar showing");
17 
18  var sidebar = document.getElementById("sidebar");
19  var root = sidebar.contentDocument.documentElement;
20  ok(root.nodeName != "parsererror", "Sidebar is well formed");
21 
22  sidebar.removeEventListener("load", delayedOpenUrl, true);
23  // XXX See comment above
24  sidebar.contentDocument.addEventListener("load", delayedRunTest, true);
25  var url = 'data:text/html,<div%20id="test_bug409481">Content!</div>';
26  sidebar.contentWindow.loadWebPanel(url);
27 }
28 
29 function delayedRunTest() {
30  ok(true, "Ran delayedRunTest");
31  setTimeout(runTest, 100);
32 }
33 
34 function runTest(event) {
35  var sidebar = document.getElementById("sidebar");
36  sidebar.contentDocument.removeEventListener("load", delayedRunTest, true);
37 
38  var browser = sidebar.contentDocument.getElementById("web-panels-browser");
39  var div = browser && browser.contentDocument.getElementById("test_bug409481");
40  ok(div && div.textContent == "Content!", "Sidebar content loaded");
41 
42  toggleSidebar("viewWebPanelsSidebar");
43 
44  ok(document.getElementById("sidebar-box").hidden, "Sidebar successfully hidden");
45 
46  finish();
47 }
function delayedOpenUrl()
var event
function test()
waitForExplicitFinish()
aWindow setTimeout(function(){_this.restoreHistory(aWindow, aTabs, aTabData, aIdMap);}, 0)
function runTest(event)
function url(spec)
function openPanelUrl(event)
var browser
Definition: openLocation.js:42
function delayedRunTest()