diff options
author | Vincent Sanders <vince@kyllikki.org> | 2012-11-01 23:30:28 +0000 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2012-11-01 23:30:28 +0000 |
commit | 2b6bd44ef0aec9c99617e7125bda918545be7316 (patch) | |
tree | 183e4f03e7913060e71f46e378e502b1eca3e379 /javascript/jsapi/bindings/window.bnd | |
parent | b34cbc5e8303fba36712d48af65d8eefb1097890 (diff) | |
download | netsurf-2b6bd44ef0aec9c99617e7125bda918545be7316.tar.gz netsurf-2b6bd44ef0aec9c99617e7125bda918545be7316.tar.bz2 |
add location binding
Diffstat (limited to 'javascript/jsapi/bindings/window.bnd')
-rw-r--r-- | javascript/jsapi/bindings/window.bnd | 84 |
1 files changed, 48 insertions, 36 deletions
diff --git a/javascript/jsapi/bindings/window.bnd b/javascript/jsapi/bindings/window.bnd index beb2b128e..956932c77 100644 --- a/javascript/jsapi/bindings/window.bnd +++ b/javascript/jsapi/bindings/window.bnd @@ -18,25 +18,26 @@ preamble %{ %} -operation confirm %{ - warn_user(message, NULL); -%} - -operation alert %{ - warn_user(message, NULL); -%} - -operation prompt %{ - warn_user(message, NULL); -%} - -getter window %{ - jsret = obj; -%} +binding window { + type js_libdom; /* the binding type */ + + interface Window; /* Web IDL interface to generate */ + + /* private are parameters to constructor stored in private + * context structure. + * + * internal are value stored in private context structure but not + * passed to constructor but are considered for property + * getters/setters. + */ + private "struct browser_window *" bw; + private "struct html_content *" htmlc; + internal "JSObject *" document; + internal "JSObject *" navigator; + internal "JSObject *" console; + internal "JSObject *" location; +} -getter self %{ - jsret = obj; -%} api init %{ JSObject *user_proto; @@ -85,6 +86,11 @@ api init %{ return NULL; } + user_proto = jsapi_InitClass_Location(cx, prototype); + if (user_proto == NULL) { + return NULL; + } + user_proto = jsapi_InitClass_Console(cx, prototype); if (user_proto == NULL) { return NULL; @@ -121,7 +127,11 @@ api new %{ return NULL; } - /** @todo forms, history, location */ + private->location = jsapi_new_Location(cx, NULL, newobject, bw); + if (private->location == NULL) { + free(private); + return NULL; + } private->console = jsapi_new_Console(cx, NULL, newobject); if (private->console == NULL) { @@ -129,25 +139,27 @@ api new %{ return NULL; } + /** @todo forms, history */ + LOG(("Created new window object %p", newobject)); %} +operation confirm %{ + warn_user(message, NULL); +%} -binding window { - type js_libdom; /* the binding type */ - - interface Window; /* Web IDL interface to generate */ - - /* private are parameters to constructor stored in private - * context structure. - * - * internal are value stored in private context structure but not - * passed to constructor but are considered for property getters/setters. - */ - private "struct browser_window *" bw; - private "struct html_content *" htmlc; - internal "JSObject *" document; - internal "JSObject *" navigator; - internal "JSObject *" console; +operation alert %{ + warn_user(message, NULL); +%} -} +operation prompt %{ + warn_user(message, NULL); +%} + +getter window %{ + jsret = obj; +%} + +getter self %{ + jsret = obj; +%} |