2009-09-02 07:15:22 -07:00
|
|
|
<?xml version="1.0"?>
|
|
|
|
<bindings
|
|
|
|
xmlns="http://www.mozilla.org/xbl"
|
|
|
|
xmlns:xbl="http://www.mozilla.org/xbl"
|
|
|
|
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
|
|
|
|
|
|
|
<binding id="dialog">
|
|
|
|
<content>
|
|
|
|
<xul:stack>
|
|
|
|
<xul:box xbl:inherits="orient" class="dialog-dark" align="center">
|
|
|
|
<children/>
|
|
|
|
</xul:box>
|
2009-09-18 07:05:53 -07:00
|
|
|
<xul:image collapsed="true" top="-10" left="0" anonid="close" class="close-button"
|
2009-09-02 07:15:22 -07:00
|
|
|
onclick="document.getBindingParent(this).close()"/>
|
|
|
|
</xul:stack>
|
|
|
|
</content>
|
|
|
|
|
2009-09-22 19:28:18 -07:00
|
|
|
<implementation implements="nsIDOMEventListener">
|
2009-09-02 07:15:22 -07:00
|
|
|
<field name="arguments"/>
|
2009-10-12 12:05:46 -07:00
|
|
|
<field name="parent"/>
|
2009-09-02 07:15:22 -07:00
|
|
|
|
|
|
|
<constructor><![CDATA[
|
|
|
|
if (!this.hasAttribute("orient"))
|
|
|
|
this.setAttribute("orient", "vertical");
|
|
|
|
if (this.hasAttribute("closebutton") && (this.getAttribute("closebutton") == "true"))
|
|
|
|
document.getAnonymousElementByAttribute(this, "anonid", "close").removeAttribute("collapsed");
|
|
|
|
this._closed = false;
|
|
|
|
if (this.hasAttribute("script")) {
|
|
|
|
try {
|
|
|
|
let loader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
|
|
|
|
.getService(Components.interfaces.mozIJSSubScriptLoader);
|
|
|
|
loader.loadSubScript(this.getAttribute("script"), this);
|
|
|
|
} catch(e) {
|
|
|
|
throw("Dialog : Unable to load script : " + this.getAttribute("script") + "\n");
|
|
|
|
}
|
|
|
|
}
|
2009-09-22 19:28:18 -07:00
|
|
|
window.addEventListener("unload", this, true);
|
2009-09-02 07:15:22 -07:00
|
|
|
]]>
|
|
|
|
</constructor>
|
2009-09-22 19:28:18 -07:00
|
|
|
|
|
|
|
<method name="handleEvent">
|
|
|
|
<parameter name="aEvent"/>
|
|
|
|
<body>
|
|
|
|
if (aEvent.type == "unload")
|
|
|
|
this._closed = true;
|
|
|
|
</body>
|
|
|
|
</method>
|
2009-09-02 07:15:22 -07:00
|
|
|
|
|
|
|
<method name="close">
|
|
|
|
<body>
|
|
|
|
if (this.hasAttribute("onclose")) {
|
|
|
|
var f = new Function(this.getAttribute("onclose"));
|
|
|
|
f.call(this);
|
|
|
|
}
|
|
|
|
this.parentNode.parentNode.removeChild(this.parentNode);
|
|
|
|
this._closed = true;
|
2009-10-12 12:05:46 -07:00
|
|
|
|
|
|
|
// emit DOMModalDialogClosed event
|
|
|
|
let event = document.createEvent("Events");
|
|
|
|
event.initEvent("DOMModalDialogClosed", true, false);
|
|
|
|
let dispatcher = this.parent || getBrowser();
|
|
|
|
dispatcher.dispatchEvent(event);
|
2009-09-02 07:15:22 -07:00
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="waitForClose">
|
|
|
|
<body>
|
2009-09-22 19:28:18 -07:00
|
|
|
let thread = Components.classes["@mozilla.org/thread-manager;1"]
|
|
|
|
.getService(Components.interfaces.nsIThreadManager)
|
|
|
|
.currentThread;
|
|
|
|
while (!this._closed)
|
|
|
|
thread.processNextEvent(true);
|
2009-09-02 07:15:22 -07:00
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
</implementation>
|
|
|
|
</binding>
|
|
|
|
|
|
|
|
</bindings>
|