2009-11-02 01:02:09 +00:00
|
|
|
<?xml version="1.0"?>
|
|
|
|
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
2010-02-01 15:48:51 +00:00
|
|
|
|
2009-11-02 01:02:09 +00:00
|
|
|
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
|
|
|
|
type="text/css"?>
|
|
|
|
|
|
|
|
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
|
|
|
|
|
|
|
<script type="application/javascript"
|
|
|
|
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
|
2012-01-25 22:43:27 +00:00
|
|
|
<script type="application/javascript"
|
2012-02-01 05:17:42 +00:00
|
|
|
src="chrome://mochikit/content/chrome-harness.js"/>
|
2009-11-02 01:02:09 +00:00
|
|
|
|
|
|
|
<script type="application/javascript"
|
2010-09-01 22:09:56 +00:00
|
|
|
src="../common.js" />
|
2011-10-08 05:16:37 +00:00
|
|
|
<script type="application/javascript"
|
|
|
|
src="../role.js" />
|
|
|
|
<script type="application/javascript"
|
|
|
|
src="../states.js" />
|
2009-11-02 01:02:09 +00:00
|
|
|
<script type="application/javascript"
|
2010-09-01 22:09:56 +00:00
|
|
|
src="../events.js" />
|
|
|
|
<script type="application/javascript"
|
2012-02-01 05:17:42 +00:00
|
|
|
src="../browser.js"></script>
|
2009-11-02 01:02:09 +00:00
|
|
|
|
|
|
|
<script type="application/javascript">
|
|
|
|
<![CDATA[
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Tests
|
|
|
|
|
2012-02-01 05:17:42 +00:00
|
|
|
function getAnchorJumpInTabDocument(aTabIdx)
|
2011-10-08 05:16:37 +00:00
|
|
|
{
|
2012-02-01 05:17:42 +00:00
|
|
|
var tabDoc = aTabIdx ? tabDocumentAt(aTabIdx) : currentTabDocument();
|
|
|
|
return tabDoc.querySelector("a[name='link1']");
|
2011-10-08 05:16:37 +00:00
|
|
|
}
|
|
|
|
|
2012-02-01 05:17:42 +00:00
|
|
|
function loadTab(aURL)
|
2011-10-08 05:16:37 +00:00
|
|
|
{
|
2012-02-01 05:17:42 +00:00
|
|
|
this.eventSeq = [
|
|
|
|
new invokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, currentTabDocument),
|
|
|
|
new invokerChecker(EVENT_SCROLLING_START, getAnchorJumpInTabDocument)
|
|
|
|
];
|
2011-10-08 05:16:37 +00:00
|
|
|
|
2012-02-01 05:17:42 +00:00
|
|
|
this.invoke = function loadTab_invoke()
|
2011-10-08 05:16:37 +00:00
|
|
|
{
|
2012-02-01 05:17:42 +00:00
|
|
|
tabBrowser().loadURI(aURL);
|
2009-11-02 01:02:09 +00:00
|
|
|
}
|
|
|
|
|
2012-02-01 05:17:42 +00:00
|
|
|
this.getID = function loadTab_getID()
|
|
|
|
{
|
|
|
|
return "load tab: " + aURL;
|
|
|
|
}
|
|
|
|
}
|
2011-10-08 05:16:37 +00:00
|
|
|
|
2012-02-01 05:17:42 +00:00
|
|
|
function loadTabInBackground(aURL)
|
|
|
|
{
|
|
|
|
this.eventSeq = [
|
|
|
|
new invokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, tabDocumentAt, 1)
|
|
|
|
];
|
|
|
|
|
|
|
|
this.unexpectedEventSeq = [
|
|
|
|
new invokerChecker(EVENT_SCROLLING_START, getAnchorJumpInTabDocument, 1)
|
|
|
|
];
|
|
|
|
|
|
|
|
this.invoke = function loadTabInBackground_invoke()
|
2011-10-08 05:16:37 +00:00
|
|
|
{
|
2012-02-01 05:17:42 +00:00
|
|
|
tabBrowser().loadOneTab(aURL, null, "", null, true);
|
2011-10-08 05:16:37 +00:00
|
|
|
}
|
|
|
|
|
2012-02-01 05:17:42 +00:00
|
|
|
this.getID = function loadTabInBackground_getID()
|
2011-10-08 05:16:37 +00:00
|
|
|
{
|
2012-02-01 05:17:42 +00:00
|
|
|
return "load tab in background: " + aURL;
|
2011-10-08 05:16:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-02-01 05:17:42 +00:00
|
|
|
function switchToBackgroundTab()
|
2009-11-02 01:02:09 +00:00
|
|
|
{
|
2011-10-08 05:16:37 +00:00
|
|
|
this.eventSeq = [
|
|
|
|
new invokerChecker(EVENT_SCROLLING_START, getAnchorJumpInTabDocument)
|
|
|
|
];
|
|
|
|
|
2012-02-01 05:17:42 +00:00
|
|
|
this.invoke = function switchToBackgroundTab_invoke()
|
2011-10-08 05:16:37 +00:00
|
|
|
{
|
2012-02-01 05:17:42 +00:00
|
|
|
tabBrowser().selectTabAtIndex(1);
|
2011-10-08 05:16:37 +00:00
|
|
|
}
|
|
|
|
|
2012-02-01 05:17:42 +00:00
|
|
|
this.getID = function switchToBackgroundTab_getID()
|
2011-10-08 05:16:37 +00:00
|
|
|
{
|
2012-02-01 05:17:42 +00:00
|
|
|
return "switch to background tab";
|
2011-10-08 05:16:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//gA11yEventDumpToConsole = true; // debug stuff
|
2009-11-02 01:02:09 +00:00
|
|
|
|
2011-10-08 05:16:37 +00:00
|
|
|
var gQueue = null;
|
|
|
|
function doTest()
|
|
|
|
{
|
2010-09-01 22:09:56 +00:00
|
|
|
var rootDir = getRootDirectory(window.location.href);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* When tests are packed in a .jar, we need to extract them so we
|
|
|
|
* can access the specific url with a file:// protocol which appears
|
|
|
|
* to be required by loadURI() (at least a file without an embedded .jar)
|
|
|
|
*/
|
|
|
|
var jar = getJar(rootDir);
|
|
|
|
if (jar) {
|
|
|
|
var tmpdir = extractJarToTmp(jar);
|
2010-10-01 00:10:19 +00:00
|
|
|
rootDir = "file://" + tmpdir.path + '/';
|
2010-09-01 22:09:56 +00:00
|
|
|
}
|
2010-10-01 00:10:19 +00:00
|
|
|
var url = rootDir + "scroll.html#link1";
|
2011-10-08 05:16:37 +00:00
|
|
|
|
|
|
|
gQueue = new eventQueue();
|
2012-02-01 05:17:42 +00:00
|
|
|
|
|
|
|
gQueue.push(new loadTab(url));
|
|
|
|
gQueue.push(new loadTabInBackground(url));
|
|
|
|
gQueue.push(new switchToBackgroundTab());
|
|
|
|
gQueue.onFinish = function() { closeBrowserWindow(); }
|
|
|
|
|
2011-10-08 05:16:37 +00:00
|
|
|
gQueue.invoke(); // Will call SimpleTest.finish();
|
2009-11-02 01:02:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
2012-02-01 05:17:42 +00:00
|
|
|
openBrowserWindow(doTest);
|
2009-11-02 01:02:09 +00:00
|
|
|
]]>
|
|
|
|
</script>
|
|
|
|
|
2012-02-01 05:17:42 +00:00
|
|
|
<vbox flex="1" style="overflow: auto;">
|
2009-11-02 01:02:09 +00:00
|
|
|
<body xmlns="http://www.w3.org/1999/xhtml">
|
2011-10-08 05:16:37 +00:00
|
|
|
<a target="_blank"
|
|
|
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=691734"
|
|
|
|
title="Make sure scrolling start event is fired when document receive focus">
|
|
|
|
Mozilla Bug 691734
|
|
|
|
</a>
|
2009-11-02 01:02:09 +00:00
|
|
|
|
|
|
|
<p id="display"></p>
|
|
|
|
<div id="content" style="display: none">
|
|
|
|
</div>
|
|
|
|
<pre id="test">
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
|
2012-02-01 05:17:42 +00:00
|
|
|
<vbox id="eventdump"></vbox>
|
|
|
|
</vbox>
|
2009-11-02 01:02:09 +00:00
|
|
|
</window>
|