diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /docshell/test/chrome/bug582176_window.xhtml | |
parent | Initial commit. (diff) | |
download | firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'docshell/test/chrome/bug582176_window.xhtml')
-rw-r--r-- | docshell/test/chrome/bug582176_window.xhtml | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/docshell/test/chrome/bug582176_window.xhtml b/docshell/test/chrome/bug582176_window.xhtml new file mode 100644 index 0000000000..b31708104b --- /dev/null +++ b/docshell/test/chrome/bug582176_window.xhtml @@ -0,0 +1,85 @@ +<?xml version="1.0"?> +<?xml-stylesheet href="chrome://global/skin" type="text/css"?> + +<window id="303267Test" + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + width="600" + height="600" + onload="nextTestAsync();" + title="bug 582176 test"> + + <script type="application/javascript" src= "chrome://mochikit/content/chrome-harness.js" /> + <script type="application/javascript" src="docshell_helpers.js" /> + <script type="application/javascript"><![CDATA[ + // Define the generator-iterator for the tests. + var tests = testIterator(); + + //// + // Execute the next test in the generator function. + // + function nextTestAsync() { + SimpleTest.executeSoon(tests.next.bind(tests)); + } + + //// + // Generator function for test steps for bug 582176: + // Description goes here. + // + function* testIterator() + { + var browser = document.getElementById('content'); + browser.addEventListener("pageshow", nextTestAsync, true); + + enableBFCache(true); + + var notificationCount = 0; + var observer = { + observe: function(aSubject, aTopic, aData) { + is(aSubject, browser.contentWindow, + "correct subject"); + is(aTopic, "content-document-global-created", + "correct topic"); + is(aData, "http://mochi.test:8888", + "correct data"); + notificationCount++; + } + }; + + os = Cc["@mozilla.org/observer-service;1"]. + getService(Ci.nsIObserverService); + os.addObserver(observer, "content-document-global-created"); + + BrowserTestUtils.loadURI(browser, "http://mochi.test:8888/tests/docshell/test/chrome/582176_dummy.html"); + yield undefined; + is(browser.contentWindow.testVar, undefined, + "variable unexpectedly there already"); + browser.contentWindow.wrappedJSObject.testVar = 1; + is(notificationCount, 1, "Should notify on first navigation"); + + BrowserTestUtils.loadURI(browser, "http://mochi.test:8888/tests/docshell/test/chrome/582176_dummy.html?2"); + yield undefined; + is(browser.contentWindow.wrappedJSObject.testVar, undefined, + "variable should no longer be there"); + is(notificationCount, 2, "Should notify on second navigation"); + + browser.goBack(); + yield undefined; + is(browser.contentWindow.wrappedJSObject.testVar, 1, + "variable should still be there"); + is(notificationCount, 2, "Should not notify on back navigation"); + + BrowserTestUtils.loadURI(browser, "http://mochi.test:8888/tests/docshell/test/chrome/582176_xml.xml"); + yield undefined; + is(browser.contentDocument.body.textContent, "xslt result", + "Transform performed successfully"); + is(notificationCount, 3, "Should notify only once on XSLT navigation"); + + os.removeObserver(observer, "content-document-global-created") + + // Tell the framework the test is finished. + finish(); + } + + ]]></script> + <browser type="content" primary="true" flex="1" id="content" src="about:blank"/> +</window> |