diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2012-11-03 15:13:43 +0000 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2012-11-03 15:13:43 +0000 |
commit | 180f7ff42cc42862a39e9c18ba7556b3020bb647 (patch) | |
tree | 5ef0deef46801d4c1b47a86a2d373533d9c0bd74 /javascript/jsapi/console.bnd | |
parent | ef5c8c21a6dbf5db68743704a74066e01cc9a853 (diff) | |
parent | 45d508487af4a817fda3b536c2872f588291902b (diff) | |
download | netsurf-180f7ff42cc42862a39e9c18ba7556b3020bb647.tar.gz netsurf-180f7ff42cc42862a39e9c18ba7556b3020bb647.tar.bz2 |
Merge Vincent's Javascript work onto master
Diffstat (limited to 'javascript/jsapi/console.bnd')
-rw-r--r-- | javascript/jsapi/console.bnd | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/javascript/jsapi/console.bnd b/javascript/jsapi/console.bnd new file mode 100644 index 000000000..6aef9dcb8 --- /dev/null +++ b/javascript/jsapi/console.bnd @@ -0,0 +1,59 @@ +/* Binding to generate Console interface + * + * Copyright 2012 Vincent Sanders <vince@netsurf-browser.org> + * + * This file is part of NetSurf, http://www.netsurf-browser.org/ + * + * Released under the terms of the MIT License, + * http://www.opensource.org/licenses/mit-license + */ + +webidlfile "console.idl"; + +hdrcomment "Copyright 2012 Vincent Sanders <vince@netsurf-browser.org>"; +hdrcomment "This file is part of NetSurf, http://www.netsurf-browser.org/"; +hdrcomment "Released under the terms of the MIT License,"; +hdrcomment " http://www.opensource.org/licenses/mit-license"; + +preamble %{ + +#include "utils/config.h" +#include "utils/log.h" + +#include "javascript/jsapi.h" +#include "javascript/jsapi/binding.h" + +%} + +binding navigator { + type js_libdom; /* the binding type */ + + interface Console; /* Web IDL interface to generate */ + + /* private members: + * - stored in private context structure. + * - passed as parameters to constructor and stored automatically. + * - are *not* considered for property getters/setters. + * + * internal members: + * - value stored in private context structure + * - not passed to constructor + * - must be instantiated by constructor + * - are considered for property getters/setters. + */ + internal "void *" gui_console; +} + +operation log %{ + unsigned int argloop; + JSString *jsstr; + unsigned long jsstrlen; + char *txt; + + for (argloop = 0; argloop < argc; argloop++) { + jsstr = JS_ValueToString(cx, argv[argloop]); + + JSString_to_char(jsstr, txt, jsstrlen); + LOG(("%s", txt)); + } +%} |