2009-08-21 06:20:18 -07:00
|
|
|
<?xml version="1.0"?>
|
|
|
|
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
2010-02-01 07:48:51 -08:00
|
|
|
|
|
|
|
<!-- Firefox tabbrowser -->
|
|
|
|
<?xml-stylesheet href="chrome://browser/content/browser.css"
|
|
|
|
type="text/css"?>
|
|
|
|
<!-- Seamonkey tabbrowser -->
|
|
|
|
<?xml-stylesheet href="chrome://navigator/content/navigator.css"
|
|
|
|
type="text/css"?>
|
2009-08-21 06:20:18 -07:00
|
|
|
|
|
|
|
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
|
|
|
|
|
|
|
<script type="application/javascript">
|
|
|
|
<![CDATA[
|
|
|
|
var gOpenerWnd = window.opener.wrappedJSObject;
|
|
|
|
|
|
|
|
function ok(aCond, aMsg) {
|
|
|
|
gOpenerWnd.SimpleTest.ok(aCond, aMsg);
|
|
|
|
}
|
|
|
|
|
|
|
|
function is(aExpected, aActual, aMsg) {
|
|
|
|
gOpenerWnd.SimpleTest.is(aExpected, aActual, aMsg);
|
|
|
|
}
|
|
|
|
|
2010-04-18 11:27:18 -07:00
|
|
|
// Hacks to make xul:tabbrowser work.
|
|
|
|
var handleDroppedLink = null; // needed for tabbrowser usage
|
|
|
|
|
2010-03-16 23:36:13 -07:00
|
|
|
Components.utils.import("resource://gre/modules/Services.jsm");
|
2009-08-21 06:20:18 -07:00
|
|
|
var XULBrowserWindow = {
|
|
|
|
isBusy: false,
|
|
|
|
setOverLink: function (link, b) {
|
|
|
|
}
|
2009-10-30 17:04:07 -07:00
|
|
|
};
|
2010-05-19 09:57:16 -07:00
|
|
|
|
|
|
|
gFindBarInitialized = false;
|
2009-08-21 06:20:18 -07:00
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Invoker implementation.
|
|
|
|
|
|
|
|
function switchTabSelectChecker(aInvoker)
|
|
|
|
{
|
|
|
|
this.type = "select";
|
2010-04-15 07:52:25 -07:00
|
|
|
Object.defineProperty(this, "target", { get: function() { return aInvoker.getTabsElm(); }});
|
2009-08-21 06:20:18 -07:00
|
|
|
this.getID = function() { return "switch tab, select event"; }
|
|
|
|
}
|
|
|
|
|
|
|
|
function switchTabFocusChecker(aInvoker)
|
|
|
|
{
|
|
|
|
this.type = gOpenerWnd.EVENT_FOCUS;
|
2010-04-15 07:52:25 -07:00
|
|
|
Object.defineProperty(this, "target", { get: function() { return aInvoker.getContentDoc(); }});
|
2009-08-21 06:20:18 -07:00
|
|
|
this.check = function(aEvent)
|
|
|
|
{
|
|
|
|
is(gOpenerWnd.getAccessible(document).name, "about:mozilla" + aEvent.accessible.name,
|
|
|
|
"Oops almost :)");
|
|
|
|
}
|
|
|
|
this.getID = function() { return "switch tab, focus event"; }
|
|
|
|
}
|
|
|
|
|
2010-06-14 22:05:37 -07:00
|
|
|
function switchTabInvoker(aTabBrowser, aWindow)
|
2009-08-21 06:20:18 -07:00
|
|
|
{
|
|
|
|
this.invoke = function switchTabInvoker_invoke()
|
|
|
|
{
|
2010-06-14 22:05:37 -07:00
|
|
|
gOpenerWnd.synthesizeKey("VK_TAB", { ctrlKey: true }, aWindow);
|
2009-08-21 06:20:18 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
this.eventSeq = [
|
|
|
|
new switchTabSelectChecker(this),
|
|
|
|
new switchTabFocusChecker(this)
|
|
|
|
];
|
|
|
|
|
|
|
|
this.getContentDoc = function switchTabInvoker_getContentDoc()
|
|
|
|
{
|
|
|
|
return aTabBrowser.getBrowserAtIndex(1).contentDocument;
|
|
|
|
}
|
|
|
|
this.getTabsElm = function switchTabInvoker_getTabsElm()
|
|
|
|
{
|
|
|
|
return aTabBrowser.tabContainer;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Tests
|
|
|
|
|
|
|
|
var gQueue = null;
|
|
|
|
|
|
|
|
const Ci = Components.interfaces;
|
|
|
|
|
2009-10-30 18:55:40 -07:00
|
|
|
function doTest()
|
2009-08-21 06:20:18 -07:00
|
|
|
{
|
|
|
|
var tabBrowser = document.getElementById("content");
|
2010-02-12 06:57:44 -08:00
|
|
|
tabBrowser.loadURI("about:robots");
|
2009-08-21 06:20:18 -07:00
|
|
|
tabBrowser.addTab("about:mozilla");
|
|
|
|
|
|
|
|
gQueue = new gOpenerWnd.eventQueue();
|
2010-06-14 22:05:37 -07:00
|
|
|
gQueue.push(new switchTabInvoker(tabBrowser, window));
|
2009-08-21 06:20:18 -07:00
|
|
|
gQueue.onFinish = function() { window.close(); }
|
|
|
|
gQueue.invoke();
|
|
|
|
}
|
2009-10-30 18:55:40 -07:00
|
|
|
|
|
|
|
gOpenerWnd.addA11yLoadEvent(doTest);
|
2009-08-21 06:20:18 -07:00
|
|
|
]]>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<!-- Hack to make xul:tabbrowser work -->
|
|
|
|
<menubar>
|
|
|
|
<menu label="menu">
|
|
|
|
<menupopup>
|
|
|
|
<menuitem label="close window hook" id="menu_closeWindow"/>
|
|
|
|
<menuitem label="close hook" id="menu_close"/>
|
|
|
|
</menupopup>
|
|
|
|
</menu>
|
|
|
|
</menubar>
|
|
|
|
|
2010-03-16 23:36:13 -07:00
|
|
|
<tabs id="tabbrowser-tabs" class="tabbrowser-tabs"
|
|
|
|
tabbrowser="content"
|
|
|
|
flex="1"
|
|
|
|
setfocus="false">
|
|
|
|
<tab class="tabbrowser-tab" selected="true"/>
|
|
|
|
</tabs>
|
|
|
|
<tabbrowser id="content"
|
|
|
|
type="content-primary"
|
|
|
|
tabcontainer="tabbrowser-tabs"
|
|
|
|
flex="1"/>
|
2009-08-21 06:20:18 -07:00
|
|
|
|
|
|
|
</window>
|