blob: cb84c421cb628a46bde46e676dd392c88b3a6cd6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<!--
XUL Widget Test for preferences window with beforeaccept
-->
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
class="prefwindow"
title="preferences window"
width="300" height="300"
windowtype="test:preferences"
type="child"
onload="onDialogLoad();">
<dialog id="beforeaccept_dialog"
buttons="accept,cancel">
<script type="application/javascript" src="chrome://global/content/preferencesBindings.js"/>
<script type="application/javascript">
<![CDATA[
/* import-globals-from ../../preferencesBindings.js */
function onDialogLoad() {
document.addEventListener("beforeaccept", beforeAccept);
var pref = Preferences.get("tests.beforeaccept.dialogShown");
pref.value = true;
// call the onload handler we were passed
window.arguments[0]();
}
function beforeAccept(event) {
var beforeAcceptPref = window.Preferences.get("tests.beforeaccept.called");
var oldValue = beforeAcceptPref.value;
beforeAcceptPref.value = true;
if (!oldValue) {
event.preventDefault();
}
}
Preferences.addAll([
{ id: "tests.beforeaccept.called", type: "bool" },
{ id: "tests.beforeaccept.dialogShown", type: "bool" },
]);
]]>
</script>
<vbox id="sample_pane" class="prefpane" label="Sample Prefpane">
</vbox>
<label>Test Prefpane</label>
</dialog>
</window>
|