layout/generic/test/file_bug514732_window.xul

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 <?xml version="1.0"?>
michael@0 2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
michael@0 3
michael@0 4 <window id="514732Test"
michael@0 5 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
michael@0 6 width="600"
michael@0 7 height="600"
michael@0 8 onload="setTimeout(nextTest,0);"
michael@0 9 title="bug 514732 test">
michael@0 10
michael@0 11 <script type="text/javascript"
michael@0 12 src="chrome://mochikit/content/tests/SimpleTest/specialpowersAPI.js"/>
michael@0 13 <script type="text/javascript"
michael@0 14 src="chrome://mochikit/content/tests/SimpleTest/SpecialPowersObserverAPI.js"/>
michael@0 15 <script type="text/javascript"
michael@0 16 src="chrome://mochikit/content/tests/SimpleTest/ChromePowers.js"/>
michael@0 17 <script type="application/javascript"
michael@0 18 src="chrome://mochikit/content/tests/SimpleTest/docshell_helpers.js">
michael@0 19 </script>
michael@0 20
michael@0 21 <script type="application/javascript"><![CDATA[
michael@0 22
michael@0 23 // Define the generator-iterator for the tests.
michael@0 24 var tests = testIterator();
michael@0 25
michael@0 26 ////
michael@0 27 // Execute the next test in the generator function.
michael@0 28 //
michael@0 29 function nextTest() {
michael@0 30 tests.next();
michael@0 31 }
michael@0 32
michael@0 33 ////
michael@0 34 // Generator function for test steps for bug 514732. The MozScrolledAreaChanged
michael@0 35 // should be fired when a page is restored from the bfcache as though it had
michael@0 36 // reloaded.
michael@0 37 //
michael@0 38 function testIterator() {
michael@0 39 // Make sure bfcache is on.
michael@0 40 enableBFCache(true);
michael@0 41
michael@0 42
michael@0 43 // Load a wide and tall page, and then another.
michael@0 44 for (var i = 0; i < 2; ++i) {
michael@0 45 doPageNavigation( {
michael@0 46 uri: "data:text/html,<!DOCTYPE html><html>" +
michael@0 47 "<head><title>bug 514732 bfcache test page " + i + "</title></head>" +
michael@0 48 "<body>" +
michael@0 49 '<div style="position: absolute; left: 10000px; top: 10000px; width: 500px; height: 500px;">' +
michael@0 50 "</body></html>",
michael@0 51 eventsToListenFor: ["MozScrolledAreaChanged"],
michael@0 52 expectedEvents: [ { type: "MozScrolledAreaChanged" } ],
michael@0 53 onNavComplete: nextTest
michael@0 54 } );
michael@0 55 yield;
michael@0 56 }
michael@0 57
michael@0 58 // Navigate back to the first page. Don't test for width and height
michael@0 59 // yet, just make sure we get an event.
michael@0 60 doPageNavigation( {
michael@0 61 back: true,
michael@0 62 eventsToListenFor: ["MozScrolledAreaChanged"],
michael@0 63 expectedEvents: [ { type: "MozScrolledAreaChanged" } ],
michael@0 64 onNavComplete: nextTest
michael@0 65 } );
michael@0 66 yield;
michael@0 67
michael@0 68 // Navigate forth to our wide and tall page, this time testing for
michael@0 69 // width and height on the event.
michael@0 70 doPageNavigation( {
michael@0 71 forward: true,
michael@0 72 eventsToListenFor: ["MozScrolledAreaChanged"],
michael@0 73 expectedEvents: [ { type: "MozScrolledAreaChanged" } ],
michael@0 74 onNavComplete: nextTest
michael@0 75 } );
michael@0 76 yield;
michael@0 77
michael@0 78 // Tell the framework the test is finished. Include the final 'yield'
michael@0 79 // statement to prevent a StopIteration exception from being thrown.
michael@0 80 finish();
michael@0 81 yield;
michael@0 82 }
michael@0 83
michael@0 84 ]]></script>
michael@0 85
michael@0 86 <browser type="content-primary" flex="1" id="content" src="about:blank"/>
michael@0 87 </window>

mercurial