mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-01 13:57:32 +00:00
- not built -
intial add of a simple read-eval app, for testing the basics.
This commit is contained in:
parent
6a25bb3258
commit
0ea34eb8cc
63
extensions/venkman/resources/content/tests/eval.xul
Normal file
63
extensions/venkman/resources/content/tests/eval.xul
Normal file
@ -0,0 +1,63 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://chatzilla/locale/chatzilla.dtd">
|
||||
<?xul-overlay href="chrome://global/content/globalOverlay.xul"?>
|
||||
|
||||
<window
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
id="main-window" align="vertical" onclose="onClose();">
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
var scriptHook = {
|
||||
onScriptCreated: function scripthook (script) {
|
||||
dump ("script created\n");
|
||||
},
|
||||
onScriptDestroyed: function scripthook (script) {
|
||||
dump ("script destroyed\n");
|
||||
}
|
||||
};
|
||||
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
const JSD_CTRID = "@mozilla.org/js/jsd/debugger-service;1";
|
||||
const jsdIDebuggerService = Components.interfaces.jsdIDebuggerService;
|
||||
|
||||
var jsds = Components.classes[JSD_CTRID].getService(jsdIDebuggerService);
|
||||
jsds.scriptHook = scriptHook;
|
||||
jsds.on();
|
||||
|
||||
function onClose ()
|
||||
{
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
jsds.off();
|
||||
}
|
||||
|
||||
function onKeyPress (e)
|
||||
{
|
||||
if (e.keyCode == 13)
|
||||
doEval();
|
||||
}
|
||||
|
||||
function doEval()
|
||||
{
|
||||
var ex;
|
||||
try {
|
||||
var rv = eval(document.getElementById("input-box").value);
|
||||
document.getElementById("output-box").value = rv;
|
||||
} catch (ex) {
|
||||
document.getElementById("output-box").value =
|
||||
"Caught exception: " + String(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
document.getElementById("input-box").value = "";
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<textbox id="input-box" style="width:100%" onkeypress="onKeyPress(event);"/>
|
||||
<textbox id="output-box" style="width:100%" readonly="true"/>
|
||||
|
||||
</window>
|
||||
|
Loading…
x
Reference in New Issue
Block a user