Bug Summary

File:build/Linux-monkey/duktape/node.c
Warning:line 1096, column 2
Value stored to 'exc' is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name node.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/var/lib/jenkins/workspace/scan-build-netsurf -resource-dir /usr/lib/llvm-14/lib/clang/14.0.6 -I . -I include -I build/Linux-monkey -I frontends -I content/handlers -D WITH_JPEG -U WITH_PDF_EXPORT -D LIBICONV_PLUG -I /var/lib/jenkins/artifacts-x86_64-linux-gnu/include -I /var/lib/jenkins/artifacts-x86_64-linux-gnu/include -I /var/lib/jenkins/artifacts-x86_64-linux-gnu/include -I /usr/include/x86_64-linux-gnu -D WITH_CURL -D WITH_OPENSSL -I /var/lib/jenkins/artifacts-x86_64-linux-gnu/include -D UTF8PROC_EXPORTS -D WITH_UTF8PROC -D WITH_WEBP -I /usr/include/libpng16 -D WITH_PNG -I /var/lib/jenkins/artifacts-x86_64-linux-gnu/include/ -D WITH_BMP -I /var/lib/jenkins/artifacts-x86_64-linux-gnu/include -D WITH_GIF -I /var/lib/jenkins/artifacts-x86_64-linux-gnu/include -D WITH_NSPSL -I /var/lib/jenkins/artifacts-x86_64-linux-gnu/include -D WITH_NSLOG -D NETSURF_UA_FORMAT_STRING="Mozilla/5.0 (%s) NetSurf/%d.%d" -D NETSURF_HOMEPAGE="about:welcome" -D NETSURF_LOG_LEVEL=VERBOSE -D NETSURF_BUILTIN_LOG_FILTER="(level:WARNING || cat:jserrors)" -D NETSURF_BUILTIN_VERBOSE_FILTER="(level:VERBOSE || cat:jserrors)" -D STMTEXPR=1 -D monkey -D nsmonkey -D MONKEY_RESPATH="/var/lib/jenkins/artifacts-x86_64-linux-gnu/share/netsurf/" -D _POSIX_C_SOURCE=200809L -D _XOPEN_SOURCE=700 -D _BSD_SOURCE -D _DEFAULT_SOURCE -D _NETBSD_SOURCE -D DUK_OPT_HAVE_CUSTOM_H -internal-isystem /usr/lib/llvm-14/lib/clang/14.0.6/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wwrite-strings -Wno-unused-parameter -Wno-unused-but-set-variable -std=c99 -fconst-strings -fdebug-compilation-dir=/var/lib/jenkins/workspace/scan-build-netsurf -ferror-limit 19 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-display-progress -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /var/lib/jenkins/workspace/scan-build-netsurf/clangScanBuildReports/2024-09-27-095240-3006188-1 -x c build/Linux-monkey/duktape/node.c
1/* Generated by nsgenbind
2 *
3 * nsgenbind is published under the MIT Licence.
4 * nsgenbind is similar to a compiler is a purely transformative tool which
5 * explicitly makes no copyright claim on this generated output
6 */
7
8/* DukTape JavaScript bindings for NetSurf browser
9 *
10 * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
11 * This file is part of NetSurf, http://www.netsurf-browser.org/
12 * Released under the terms of the MIT License,
13 * http://www.opensource.org/licenses/mit-license
14 */
15
16#include <dom/dom.h>
17
18#include "utils/log.h"
19#include "utils/nsurl.h"
20
21#include "javascript/duktape/duktape.h"
22
23struct browser_window;
24struct html_content;
25struct dom_node;
26struct dom_element;
27struct dom_document;
28struct dom_html_element;
29struct dom_node_character_data;
30struct dom_node_text;
31struct dom_node_list;
32struct dom_node_comment;
33struct dom_html_collection;
34struct dom_html_br_element;
35
36
37#include "build/Linux-monkey/duktape/binding.h"
38#include "build/Linux-monkey/duktape/private.h"
39#include "build/Linux-monkey/duktape/prototype.h"
40
41#include "javascript/duktape/dukky.h"
42
43
44
45void dukky_node___init(duk_context *ctx, node_private_t *priv, struct dom_node *node)
46{
47 dukky_event_target___init(ctx, &priv->parent);
48#line 19 "Node.bnd"
49
50 priv->node = node;
51 dom_node_ref(node)dom_node_ref((dom_node *) (node));
52 priv->parent.is_node = true1;
53#line 54 "node.c"
54}
55
56void dukky_node___fini(duk_context *ctx, node_private_t *priv)
57{
58
59 dom_node_unref(priv->node)dom_node_unref((dom_node *) (priv->node));
60 dukky_event_target___fini(ctx, &priv->parent);
61}
62
63static duk_ret_t dukky_node___constructor(duk_context *ctx)
64{
65 /* create private data and attach to instance */
66 node_private_t *priv = calloc(1, sizeof(*priv));
67 if (priv == NULL((void*)0)) return 0;
68 duk_push_pointer(ctx, priv);
69 duk_put_prop_string(ctx, 0, dukky_magic_string_private);
70
71 dukky_node___init(ctx, priv, duk_get_pointer(ctx, 1));
72 duk_set_top(ctx, 1);
73 return 1;
74}
75
76static duk_ret_t dukky_node___destructor(duk_context *ctx)
77{
78 node_private_t *priv;
79 duk_get_prop_string(ctx, 0, dukky_magic_string_private);
80 priv = duk_get_pointer(ctx, -1);
81 duk_pop(ctx);
82 if (priv == NULL((void*)0)) return 0;
83
84 dukky_node___fini(ctx, priv);
85 free(priv);
86 return 0;
87}
88
89static duk_ret_t dukky_node_hasChildNodes(duk_context *ctx)
90{
91 /* ensure the parameters are present */
92 duk_idx_t dukky_argc = duk_get_top(ctx);
93 if (dukky_argc > 0) {
94 /* remove extraneous parameters */
95 duk_set_top(ctx, 0);
96 }
97
98 /* check types of passed arguments are correct */
99 /* Get private data for method */
100 node_private_t *priv = NULL((void*)0);
101 duk_push_this(ctx);
102 duk_get_prop_string(ctx, -1, dukky_magic_string_private);
103 priv = duk_get_pointer(ctx, -1);
104 duk_pop_2(ctx);
105 if (priv == NULL((void*)0)) {
106 return 0; /* can do? No can do. */
107 }
108
109#line 103 "Node.bnd"
110
111 dom_exception exc;
112 bool_Bool res;
113 exc = dom_node_has_child_nodes(priv->node, &res)dom_node_has_child_nodes( (dom_node *) (priv->node), (_Bool
*) (&res))
;
114 if (exc != DOM_NO_ERR) return 0;
115 duk_push_boolean(ctx, res);
116 return 1;
117#line 118 "node.c"
118}
119
120static duk_ret_t dukky_node_normalize(duk_context *ctx)
121{
122 /* ensure the parameters are present */
123 duk_idx_t dukky_argc = duk_get_top(ctx);
124 if (dukky_argc > 0) {
125 /* remove extraneous parameters */
126 duk_set_top(ctx, 0);
127 }
128
129 /* check types of passed arguments are correct */
130 /* Get private data for method */
131 node_private_t *priv = NULL((void*)0);
132 duk_push_this(ctx);
133 duk_get_prop_string(ctx, -1, dukky_magic_string_private);
134 priv = duk_get_pointer(ctx, -1);
135 duk_pop_2(ctx);
136 if (priv == NULL((void*)0)) {
137 return 0; /* can do? No can do. */
138 }
139
140#line 260 "Node.bnd"
141
142 dom_exception exc;
143 exc = dom_node_normalize(priv->node)dom_node_normalize((dom_node *) (priv->node));
144 if (exc != DOM_NO_ERR) return 0;
145 return 0;
146#line 147 "node.c"
147}
148
149static duk_ret_t dukky_node_cloneNode(duk_context *ctx)
150{
151 /* ensure the parameters are present */
152 duk_idx_t dukky_argc = duk_get_top(ctx);
153 if (dukky_argc == 0) {
154 /* 1 optional arguments need adding */
155 duk_push_boolean(ctx, 0);
156 } else if (dukky_argc > 1) {
157 /* remove extraneous parameters */
158 duk_set_top(ctx, 1);
159 }
160
161 /* check types of passed arguments are correct */
162 if (dukky_argc > 0) {
163 if (!duk_is_boolean(ctx, 0)) {
164 if (duk_is_number(ctx, 0)) {
165 duk_to_boolean(ctx, 0);
166 } else {
167 return duk_error(ctx, DUK_ERR_ERROR, dukky_error_fmt_bool_type, 0, "deep")(duk_error_raw((ctx), (duk_errcode_t) (1), (const char *) ("node.c"
), (duk_int_t) (167), dukky_error_fmt_bool_type, 0, "deep"), (
duk_ret_t) 0)
;
168 }
169 }
170 }
171 /* Get private data for method */
172 node_private_t *priv = NULL((void*)0);
173 duk_push_this(ctx);
174 duk_get_prop_string(ctx, -1, dukky_magic_string_private);
175 priv = duk_get_pointer(ctx, -1);
176 duk_pop_2(ctx);
177 if (priv == NULL((void*)0)) {
178 return 0; /* can do? No can do. */
179 }
180
181#line 268 "Node.bnd"
182
183 dom_exception exc;
184 bool_Bool deep;
185 dom_node *clone;
186
187 deep = duk_to_boolean(ctx, 0);
188
189 exc = dom_node_clone_node(priv->node, deep, &clone)dom_node_clone_node((dom_node *) (priv->node), (_Bool) (deep
), (dom_node **) (&clone))
;
190 if (exc != DOM_NO_ERR) return 0;
191 duk_set_top(ctx, 0);
192 dukky_push_node(ctx, clone);
193 dom_node_unref(clone)dom_node_unref((dom_node *) (clone));
194 return 1;
195#line 196 "node.c"
196}
197
198static duk_ret_t dukky_node_isEqualNode(duk_context *ctx)
199{
200 /* ensure the parameters are present */
201 duk_idx_t dukky_argc = duk_get_top(ctx);
202 if (dukky_argc < 1) {
203 /* not enough arguments */
204 return duk_error(ctx, DUK_RET_TYPE_ERROR, dukky_error_fmt_argument, 1, dukky_argc)(duk_error_raw((ctx), (duk_errcode_t) ((-6)), (const char *) (
"node.c"), (duk_int_t) (204), dukky_error_fmt_argument, 1, dukky_argc
), (duk_ret_t) 0)
;
205 } else if (dukky_argc > 1) {
206 /* remove extraneous parameters */
207 duk_set_top(ctx, 1);
208 }
209
210 /* check types of passed arguments are correct */
211 if (dukky_argc > 0) {
212 /* unhandled type check */
213 }
214 /* Get private data for method */
215 node_private_t *priv = NULL((void*)0);
216 duk_push_this(ctx);
217 duk_get_prop_string(ctx, -1, dukky_magic_string_private);
218 priv = duk_get_pointer(ctx, -1);
219 duk_pop_2(ctx);
220 if (priv == NULL((void*)0)) {
221 return 0; /* can do? No can do. */
222 }
223
224#line 284 "Node.bnd"
225
226 dom_exception exc;
227 bool_Bool result;
228
229 if (!dukky_instanceof(ctx, 0, PROTO_NAME(NODE)("\xFF\xFFNETSURF_DUKTAPE_" "PROTOTYPE_" "NODE"))) return 0;
230
231 duk_get_prop_string(ctx, 0, PRIVATE_MAGIC("\xFF\xFFNETSURF_DUKTAPE_" "PRIVATE"));
232 node_private_t *other = duk_get_pointer(ctx, -1);
233 duk_pop(ctx);
234
235 exc = dom_node_is_equal(priv->node, other->node, &result)dom_node_is_equal((dom_node *) (priv->node), (dom_node *) (
other->node), (_Bool *) (&result))
;
236 if (exc != DOM_NO_ERR) return 0;
237 duk_push_boolean(ctx, result);
238 return 1;
239#line 240 "node.c"
240}
241
242static duk_ret_t dukky_node_compareDocumentPosition(duk_context *ctx)
243{
244 /* ensure the parameters are present */
245 duk_idx_t dukky_argc = duk_get_top(ctx);
246 if (dukky_argc < 1) {
247 /* not enough arguments */
248 return duk_error(ctx, DUK_RET_TYPE_ERROR, dukky_error_fmt_argument, 1, dukky_argc)(duk_error_raw((ctx), (duk_errcode_t) ((-6)), (const char *) (
"node.c"), (duk_int_t) (248), dukky_error_fmt_argument, 1, dukky_argc
), (duk_ret_t) 0)
;
249 } else if (dukky_argc > 1) {
250 /* remove extraneous parameters */
251 duk_set_top(ctx, 1);
252 }
253
254 /* check types of passed arguments are correct */
255 if (dukky_argc > 0) {
256 /* unhandled type check */
257 }
258 /* Get private data for method */
259 node_private_t *priv = NULL((void*)0);
260 duk_push_this(ctx);
261 duk_get_prop_string(ctx, -1, dukky_magic_string_private);
262 priv = duk_get_pointer(ctx, -1);
263 duk_pop_2(ctx);
264 if (priv == NULL((void*)0)) {
265 return 0; /* can do? No can do. */
266 }
267
268#line 301 "Node.bnd"
269
270 dom_exception exc;
271 uint16_t ret;
272
273 if (!dukky_instanceof(ctx, 0, PROTO_NAME(NODE)("\xFF\xFFNETSURF_DUKTAPE_" "PROTOTYPE_" "NODE"))) return 0;
274
275 duk_get_prop_string(ctx, 0, PRIVATE_MAGIC("\xFF\xFFNETSURF_DUKTAPE_" "PRIVATE"));
276 node_private_t *other = duk_get_pointer(ctx, -1);
277 duk_pop(ctx);
278
279 exc = dom_node_compare_document_position(priv->node, other->node,dom_node_compare_document_position((dom_node *) (priv->node
), (dom_node *) (other->node), (uint16_t *) (&ret))
280 &ret)dom_node_compare_document_position((dom_node *) (priv->node
), (dom_node *) (other->node), (uint16_t *) (&ret))
;
281
282 if (exc != DOM_NO_ERR) return 0;
283
284 duk_push_uint(ctx, ret);
285
286 return 1;
287#line 288 "node.c"
288}
289
290static duk_ret_t dukky_node_contains(duk_context *ctx)
291{
292 /* ensure the parameters are present */
293 duk_idx_t dukky_argc = duk_get_top(ctx);
294 if (dukky_argc < 1) {
295 /* not enough arguments */
296 return duk_error(ctx, DUK_RET_TYPE_ERROR, dukky_error_fmt_argument, 1, dukky_argc)(duk_error_raw((ctx), (duk_errcode_t) ((-6)), (const char *) (
"node.c"), (duk_int_t) (296), dukky_error_fmt_argument, 1, dukky_argc
), (duk_ret_t) 0)
;
297 } else if (dukky_argc > 1) {
298 /* remove extraneous parameters */
299 duk_set_top(ctx, 1);
300 }
301
302 /* check types of passed arguments are correct */
303 if (dukky_argc > 0) {
304 /* unhandled type check */
305 }
306 /* Get private data for method */
307 node_private_t *priv = NULL((void*)0);
308 duk_push_this(ctx);
309 duk_get_prop_string(ctx, -1, dukky_magic_string_private);
310 priv = duk_get_pointer(ctx, -1);
311 duk_pop_2(ctx);
312 if (priv == NULL((void*)0)) {
313 return 0; /* can do? No can do. */
314 }
315
316#line 322 "Node.bnd"
317
318 dom_exception exc;
319 uint16_t ret;
320
321 if (!dukky_instanceof(ctx, 0, PROTO_NAME(NODE)("\xFF\xFFNETSURF_DUKTAPE_" "PROTOTYPE_" "NODE"))) return 0;
322
323 duk_get_prop_string(ctx, 0, PRIVATE_MAGIC("\xFF\xFFNETSURF_DUKTAPE_" "PRIVATE"));
324 node_private_t *other = duk_get_pointer(ctx, -1);
325 duk_pop(ctx);
326
327 /* Note that inclusive descendant says *IS* or *CONTAINED_BY* */
328 if (priv->node == other->node) {
329 duk_push_boolean(ctx, true1);
330 return 1;
331 }
332
333 exc = dom_node_compare_document_position(priv->node, other->node,dom_node_compare_document_position((dom_node *) (priv->node
), (dom_node *) (other->node), (uint16_t *) (&ret))
334 &ret)dom_node_compare_document_position((dom_node *) (priv->node
), (dom_node *) (other->node), (uint16_t *) (&ret))
;
335
336 if (exc != DOM_NO_ERR) return 0;
337
338 duk_push_boolean(ctx, ret == DOM_DOCUMENT_POSITION_CONTAINED_BY);
339
340 return 1;
341#line 342 "node.c"
342}
343
344static duk_ret_t dukky_node_lookupPrefix(duk_context *ctx)
345{
346 /* ensure the parameters are present */
347 duk_idx_t dukky_argc = duk_get_top(ctx);
348 if (dukky_argc < 1) {
349 /* not enough arguments */
350 return duk_error(ctx, DUK_RET_TYPE_ERROR, dukky_error_fmt_argument, 1, dukky_argc)(duk_error_raw((ctx), (duk_errcode_t) ((-6)), (const char *) (
"node.c"), (duk_int_t) (350), dukky_error_fmt_argument, 1, dukky_argc
), (duk_ret_t) 0)
;
351 } else if (dukky_argc > 1) {
352 /* remove extraneous parameters */
353 duk_set_top(ctx, 1);
354 }
355
356 /* check types of passed arguments are correct */
357 if (dukky_argc > 0) {
358 if (!duk_is_string(ctx, 0)) {
359 duk_to_string(ctx, 0);
360 }
361 }
362 /* Get private data for method */
363 node_private_t *priv = NULL((void*)0);
364 duk_push_this(ctx);
365 duk_get_prop_string(ctx, -1, dukky_magic_string_private);
366 priv = duk_get_pointer(ctx, -1);
367 duk_pop_2(ctx);
368 if (priv == NULL((void*)0)) {
369 return 0; /* can do? No can do. */
370 }
371
372#line 349 "Node.bnd"
373
374 dom_exception exc;
375 dom_string *ns, *pfx;
376 duk_size_t size;
377 const char *s = duk_safe_to_lstring(ctx, 0, &size);
378 exc = dom_string_create((const uint8_t *)s, size, &ns);
379 if (exc != DOM_NO_ERR) return 0;
380 exc = dom_node_lookup_prefix(priv->node, ns, &pfx)dom_node_lookup_prefix( (dom_node *) (priv->node), (ns), (
&pfx))
;
381 dom_string_unref(ns);
382 if (exc != DOM_NO_ERR) return 0;
383 if (pfx == NULL((void*)0)) return 0;
384 duk_push_lstring(ctx, dom_string_data(pfx), dom_string_length(pfx));
385 dom_string_unref(pfx);
386 return 0;
387#line 388 "node.c"
388}
389
390static duk_ret_t dukky_node_lookupNamespaceURI(duk_context *ctx)
391{
392 /* ensure the parameters are present */
393 duk_idx_t dukky_argc = duk_get_top(ctx);
394 if (dukky_argc < 1) {
395 /* not enough arguments */
396 return duk_error(ctx, DUK_RET_TYPE_ERROR, dukky_error_fmt_argument, 1, dukky_argc)(duk_error_raw((ctx), (duk_errcode_t) ((-6)), (const char *) (
"node.c"), (duk_int_t) (396), dukky_error_fmt_argument, 1, dukky_argc
), (duk_ret_t) 0)
;
397 } else if (dukky_argc > 1) {
398 /* remove extraneous parameters */
399 duk_set_top(ctx, 1);
400 }
401
402 /* check types of passed arguments are correct */
403 if (dukky_argc > 0) {
404 if (!duk_is_string(ctx, 0)) {
405 duk_to_string(ctx, 0);
406 }
407 }
408 /* Get private data for method */
409 node_private_t *priv = NULL((void*)0);
410 duk_push_this(ctx);
411 duk_get_prop_string(ctx, -1, dukky_magic_string_private);
412 priv = duk_get_pointer(ctx, -1);
413 duk_pop_2(ctx);
414 if (priv == NULL((void*)0)) {
415 return 0; /* can do? No can do. */
416 }
417
418#line 366 "Node.bnd"
419
420 dom_exception exc;
421 dom_string *ns, *pfx;
422 duk_size_t size;
423 const char *s = duk_safe_to_lstring(ctx, 0, &size);
424 exc = dom_string_create((const uint8_t *)s, size, &pfx);
425 if (exc != DOM_NO_ERR) return 0;
426 exc = dom_node_lookup_namespace(priv->node, pfx, &ns)dom_node_lookup_namespace( (dom_node *) (priv->node), (pfx
), (&ns))
;
427 dom_string_unref(pfx);
428 if (exc != DOM_NO_ERR) return 0;
429 if (ns == NULL((void*)0)) return 0;
430 duk_push_lstring(ctx, dom_string_data(ns), dom_string_length(ns));
431 dom_string_unref(ns);
432 return 0;
433#line 434 "node.c"
434}
435
436static duk_ret_t dukky_node_isDefaultNamespace(duk_context *ctx)
437{
438 /* ensure the parameters are present */
439 duk_idx_t dukky_argc = duk_get_top(ctx);
440 if (dukky_argc < 1) {
441 /* not enough arguments */
442 return duk_error(ctx, DUK_RET_TYPE_ERROR, dukky_error_fmt_argument, 1, dukky_argc)(duk_error_raw((ctx), (duk_errcode_t) ((-6)), (const char *) (
"node.c"), (duk_int_t) (442), dukky_error_fmt_argument, 1, dukky_argc
), (duk_ret_t) 0)
;
443 } else if (dukky_argc > 1) {
444 /* remove extraneous parameters */
445 duk_set_top(ctx, 1);
446 }
447
448 /* check types of passed arguments are correct */
449 if (dukky_argc > 0) {
450 if (!duk_is_string(ctx, 0)) {
451 duk_to_string(ctx, 0);
452 }
453 }
454 /* Get private data for method */
455 node_private_t *priv = NULL((void*)0);
456 duk_push_this(ctx);
457 duk_get_prop_string(ctx, -1, dukky_magic_string_private);
458 priv = duk_get_pointer(ctx, -1);
459 duk_pop_2(ctx);
460 if (priv == NULL((void*)0)) {
461 return 0; /* can do? No can do. */
462 }
463
464#line 384 "Node.bnd"
465
466 dom_exception exc;
467 dom_string *ns;
468 duk_size_t size;
469 const char *s = duk_safe_to_lstring(ctx, 0, &size);
470 bool_Bool ret;
471 exc = dom_string_create((const uint8_t *)s, size, &ns);
472 if (exc != DOM_NO_ERR) return 0;
473 exc = dom_node_is_default_namespace(priv->node, ns, &ret)dom_node_is_default_namespace( (dom_node *) (priv->node), (
ns), (_Bool *) (&ret))
;
474 dom_string_unref(ns);
475 if (exc != DOM_NO_ERR) return 0;
476 duk_push_boolean(ctx, ret);
477 return 1;
478#line 479 "node.c"
479}
480
481static duk_ret_t dukky_node_insertBefore(duk_context *ctx)
482{
483 /* ensure the parameters are present */
484 duk_idx_t dukky_argc = duk_get_top(ctx);
485 if (dukky_argc < 2) {
486 /* not enough arguments */
487 return duk_error(ctx, DUK_RET_TYPE_ERROR, dukky_error_fmt_argument, 2, dukky_argc)(duk_error_raw((ctx), (duk_errcode_t) ((-6)), (const char *) (
"node.c"), (duk_int_t) (487), dukky_error_fmt_argument, 2, dukky_argc
), (duk_ret_t) 0)
;
488 } else if (dukky_argc > 2) {
489 /* remove extraneous parameters */
490 duk_set_top(ctx, 2);
491 }
492
493 /* check types of passed arguments are correct */
494 if (dukky_argc > 0) {
495 /* unhandled type check */
496 }
497 if (dukky_argc > 1) {
498 /* unhandled type check */
499 }
500 /* Get private data for method */
501 node_private_t *priv = NULL((void*)0);
502 duk_push_this(ctx);
503 duk_get_prop_string(ctx, -1, dukky_magic_string_private);
504 priv = duk_get_pointer(ctx, -1);
505 duk_pop_2(ctx);
506 if (priv == NULL((void*)0)) {
507 return 0; /* can do? No can do. */
508 }
509
510#line 400 "Node.bnd"
511
512 if (!dukky_instanceof(ctx, 0, PROTO_NAME(NODE)("\xFF\xFFNETSURF_DUKTAPE_" "PROTOTYPE_" "NODE"))) return 0;
513
514 duk_get_prop_string(ctx, 0, PRIVATE_MAGIC("\xFF\xFFNETSURF_DUKTAPE_" "PRIVATE"));
515 node_private_t *other = duk_get_pointer(ctx, -1);
516 duk_pop(ctx);
517
518 dom_node *before = NULL((void*)0);
519
520 if (duk_get_top(ctx) == 2) {
521 if (!dukky_instanceof(ctx, 1, PROTO_NAME(NODE)("\xFF\xFFNETSURF_DUKTAPE_" "PROTOTYPE_" "NODE"))) return 0;
522 duk_get_prop_string(ctx, 1, PRIVATE_MAGIC("\xFF\xFFNETSURF_DUKTAPE_" "PRIVATE"));
523 node_private_t *another = duk_get_pointer(ctx, -1);
524 before = another->node;
525 duk_pop(ctx);
526 }
527
528 dom_exception err;
529 dom_node *spare;
530
531 err = dom_node_insert_before(priv->node, other->node, before, &spare)dom_node_insert_before( (dom_node *) (priv->node), (dom_node
*) (other->node), (dom_node *) (before), (dom_node **) (&
spare))
;
532 if (err != DOM_NO_ERR) return 0;
533 dukky_push_node(ctx, spare);
534 dom_node_unref(spare)dom_node_unref((dom_node *) (spare));
535
536 return 1;
537#line 538 "node.c"
538}
539
540static duk_ret_t dukky_node_appendChild(duk_context *ctx)
541{
542 /* ensure the parameters are present */
543 duk_idx_t dukky_argc = duk_get_top(ctx);
544 if (dukky_argc < 1) {
545 /* not enough arguments */
546 return duk_error(ctx, DUK_RET_TYPE_ERROR, dukky_error_fmt_argument, 1, dukky_argc)(duk_error_raw((ctx), (duk_errcode_t) ((-6)), (const char *) (
"node.c"), (duk_int_t) (546), dukky_error_fmt_argument, 1, dukky_argc
), (duk_ret_t) 0)
;
547 } else if (dukky_argc > 1) {
548 /* remove extraneous parameters */
549 duk_set_top(ctx, 1);
550 }
551
552 /* check types of passed arguments are correct */
553 if (dukky_argc > 0) {
554 /* unhandled type check */
555 }
556 /* Get private data for method */
557 node_private_t *priv = NULL((void*)0);
558 duk_push_this(ctx);
559 duk_get_prop_string(ctx, -1, dukky_magic_string_private);
560 priv = duk_get_pointer(ctx, -1);
561 duk_pop_2(ctx);
562 if (priv == NULL((void*)0)) {
563 return 0; /* can do? No can do. */
564 }
565
566#line 429 "Node.bnd"
567
568 if (!dukky_instanceof(ctx, 0, PROTO_NAME(NODE)("\xFF\xFFNETSURF_DUKTAPE_" "PROTOTYPE_" "NODE"))) return 0;
569
570 duk_get_prop_string(ctx, 0, PRIVATE_MAGIC("\xFF\xFFNETSURF_DUKTAPE_" "PRIVATE"));
571 node_private_t *other = duk_get_pointer(ctx, -1);
572 duk_pop(ctx);
573
574 dom_exception err;
575 dom_node *spare;
576
577 NSLOG(dukky, DEEPDEBUG, "About to append %p to %p", other->node, priv->node)do { if (NSLOG_LEVEL_DEEPDEBUG >= NSLOG_LEVEL_VERBOSE) { static
nslog_entry_context_t _nslog_ctx = { &__nslog_category_dukky
, NSLOG_LEVEL_DEEPDEBUG, "Node.bnd", sizeof("Node.bnd") - 1, __PRETTY_FUNCTION__
, sizeof(__PRETTY_FUNCTION__) - 1, 439, }; nslog__log(&_nslog_ctx
, "About to append %p to %p", other->node, priv->node);
} } while(0)
;
578 err = dom_node_append_child(priv->node, other->node, &spare)dom_node_append_child( (dom_node *) (priv->node), (dom_node
*) (other->node), (dom_node **) (&spare))
;
579 if (err != DOM_NO_ERR) return 0;
580 dukky_push_node(ctx, spare);
581 dom_node_unref(spare)dom_node_unref((dom_node *) (spare));
582
583 return 1;
584#line 585 "node.c"
585}
586
587static duk_ret_t dukky_node_replaceChild(duk_context *ctx)
588{
589 /* ensure the parameters are present */
590 duk_idx_t dukky_argc = duk_get_top(ctx);
591 if (dukky_argc < 2) {
592 /* not enough arguments */
593 return duk_error(ctx, DUK_RET_TYPE_ERROR, dukky_error_fmt_argument, 2, dukky_argc)(duk_error_raw((ctx), (duk_errcode_t) ((-6)), (const char *) (
"node.c"), (duk_int_t) (593), dukky_error_fmt_argument, 2, dukky_argc
), (duk_ret_t) 0)
;
594 } else if (dukky_argc > 2) {
595 /* remove extraneous parameters */
596 duk_set_top(ctx, 2);
597 }
598
599 /* check types of passed arguments are correct */
600 if (dukky_argc > 0) {
601 /* unhandled type check */
602 }
603 if (dukky_argc > 1) {
604 /* unhandled type check */
605 }
606 /* Get private data for method */
607 node_private_t *priv = NULL((void*)0);
608 duk_push_this(ctx);
609 duk_get_prop_string(ctx, -1, dukky_magic_string_private);
610 priv = duk_get_pointer(ctx, -1);
611 duk_pop_2(ctx);
612 if (priv == NULL((void*)0)) {
613 return 0; /* can do? No can do. */
614 }
615
616#line 449 "Node.bnd"
617
618 if (!dukky_instanceof(ctx, 0, PROTO_NAME(NODE)("\xFF\xFFNETSURF_DUKTAPE_" "PROTOTYPE_" "NODE"))) return 0;
619
620 duk_get_prop_string(ctx, 0, PRIVATE_MAGIC("\xFF\xFFNETSURF_DUKTAPE_" "PRIVATE"));
621 node_private_t *other = duk_get_pointer(ctx, -1);
622 duk_pop(ctx);
623
624 if (!dukky_instanceof(ctx, 1, PROTO_NAME(NODE)("\xFF\xFFNETSURF_DUKTAPE_" "PROTOTYPE_" "NODE"))) return 0;
625
626 duk_get_prop_string(ctx, 1, PRIVATE_MAGIC("\xFF\xFFNETSURF_DUKTAPE_" "PRIVATE"));
627 node_private_t *old = duk_get_pointer(ctx, -1);
628 duk_pop(ctx);
629
630 dom_exception err;
631 dom_node *spare;
632
633 err = dom_node_replace_child(priv->node, other->node, old->node, &spare)dom_node_replace_child( (dom_node *) (priv->node), (dom_node
*) (other->node), (dom_node *) (old->node), (dom_node *
*) (&spare))
;
634 if (err != DOM_NO_ERR) return 0;
635 dukky_push_node(ctx, spare);
636 dom_node_unref(spare)dom_node_unref((dom_node *) (spare));
637
638 return 1;
639#line 640 "node.c"
640}
641
642static duk_ret_t dukky_node_removeChild(duk_context *ctx)
643{
644 /* ensure the parameters are present */
645 duk_idx_t dukky_argc = duk_get_top(ctx);
646 if (dukky_argc < 1) {
647 /* not enough arguments */
648 return duk_error(ctx, DUK_RET_TYPE_ERROR, dukky_error_fmt_argument, 1, dukky_argc)(duk_error_raw((ctx), (duk_errcode_t) ((-6)), (const char *) (
"node.c"), (duk_int_t) (648), dukky_error_fmt_argument, 1, dukky_argc
), (duk_ret_t) 0)
;
649 } else if (dukky_argc > 1) {
650 /* remove extraneous parameters */
651 duk_set_top(ctx, 1);
652 }
653
654 /* check types of passed arguments are correct */
655 if (dukky_argc > 0) {
656 /* unhandled type check */
657 }
658 /* Get private data for method */
659 node_private_t *priv = NULL((void*)0);
660 duk_push_this(ctx);
661 duk_get_prop_string(ctx, -1, dukky_magic_string_private);
662 priv = duk_get_pointer(ctx, -1);
663 duk_pop_2(ctx);
664 if (priv == NULL((void*)0)) {
665 return 0; /* can do? No can do. */
666 }
667
668#line 474 "Node.bnd"
669
670 if (!dukky_instanceof(ctx, 0, PROTO_NAME(NODE)("\xFF\xFFNETSURF_DUKTAPE_" "PROTOTYPE_" "NODE"))) return 0;
671
672 duk_get_prop_string(ctx, 0, PRIVATE_MAGIC("\xFF\xFFNETSURF_DUKTAPE_" "PRIVATE"));
673 node_private_t *other = duk_get_pointer(ctx, -1);
674 duk_pop(ctx);
675
676 dom_exception err;
677 dom_node *spare;
678
679 err = dom_node_remove_child(priv->node, other->node, &spare)dom_node_remove_child( (dom_node *) (priv->node), (dom_node
*) (other->node), (dom_node **) (&spare))
;
680 if (err != DOM_NO_ERR) return 0;
681 dukky_push_node(ctx, spare);
682 dom_node_unref(spare)dom_node_unref((dom_node *) (spare));
683
684 return 1;
685#line 686 "node.c"
686}
687
688static duk_ret_t dukky_node_nodeType_getter(duk_context *ctx)
689{
690 /* Get private data for method */
691 node_private_t *priv = NULL((void*)0);
692 duk_push_this(ctx);
693 duk_get_prop_string(ctx, -1, dukky_magic_string_private);
694 priv = duk_get_pointer(ctx, -1);
695 duk_pop_2(ctx);
696 if (priv == NULL((void*)0)) {
697 return 0; /* can do? No can do. */
698 }
699
700#line 31 "Node.bnd"
701
702 dom_exception exc;
703 dom_node_type ntype;
704 exc = dom_node_get_node_type(priv->node, &ntype)dom_node_get_node_type( (dom_node *) (priv->node), (dom_node_type
*) (&ntype))
;
705 if (exc != DOM_NO_ERR) return 0;
706 duk_push_uint(ctx, (duk_uint_t)ntype);
707 return 1;
708#line 709 "node.c"
709}
710
711static duk_ret_t dukky_node_nodeName_getter(duk_context *ctx)
712{
713 /* Get private data for method */
714 node_private_t *priv = NULL((void*)0);
715 duk_push_this(ctx);
716 duk_get_prop_string(ctx, -1, dukky_magic_string_private);
717 priv = duk_get_pointer(ctx, -1);
718 duk_pop_2(ctx);
719 if (priv == NULL((void*)0)) {
720 return 0; /* can do? No can do. */
721 }
722
723#line 41 "Node.bnd"
724
725 dom_exception exc;
726 dom_string *str = NULL((void*)0);
727 exc = dom_node_get_node_name(priv->node, &str)dom_node_get_node_name((dom_node *) (priv->node), (&str
))
;
728 if (exc != DOM_NO_ERR) return 0;
729 duk_push_lstring(ctx, dom_string_data(str), dom_string_length(str));
730 dom_string_unref(str);
731 return 1;
732#line 733 "node.c"
733}
734
735static duk_ret_t dukky_node_baseURI_getter(duk_context *ctx)
736{
737 /* Get private data for method */
738 node_private_t *priv = NULL((void*)0);
739 duk_push_this(ctx);
740 duk_get_prop_string(ctx, -1, dukky_magic_string_private);
741 priv = duk_get_pointer(ctx, -1);
742 duk_pop_2(ctx);
743 if (priv == NULL((void*)0)) {
744 return 0; /* can do? No can do. */
745 }
746
747#line 52 "Node.bnd"
748
749 dom_exception exc;
750 dom_string *base = NULL((void*)0);
751 exc = dom_node_get_base(priv->node, &base)dom_node_get_base((dom_node *) (priv->node), (&base));
752 if (exc != DOM_NO_ERR) return 0;
753 assert(base != NULL)((base != ((void*)0)) ? (void) (0) : __assert_fail ("base != NULL"
, "Node.bnd", 57, __extension__ __PRETTY_FUNCTION__))
;
754 duk_push_lstring(ctx, dom_string_data(base), dom_string_length(base));
755 dom_string_unref(base);
756 return 1;
757#line 758 "node.c"
758}
759
760static duk_ret_t dukky_node_ownerDocument_getter(duk_context *ctx)
761{
762 /* Get private data for method */
763 node_private_t *priv = NULL((void*)0);
764 duk_push_this(ctx);
765 duk_get_prop_string(ctx, -1, dukky_magic_string_private);
766 priv = duk_get_pointer(ctx, -1);
767 duk_pop_2(ctx);
768 if (priv == NULL((void*)0)) {
769 return 0; /* can do? No can do. */
770 }
771
772#line 64 "Node.bnd"
773
774 dom_exception exc;
775 dom_node *doc;
776 exc = dom_node_get_owner_document(priv->node, &doc)dom_node_get_owner_document( (dom_node *) (priv->node), (struct
dom_document **) (&doc))
;
777 if (exc != DOM_NO_ERR) return 0;
778 if (doc == NULL((void*)0)) return 0;
779 dukky_push_node(ctx, doc);
780 dom_node_unref(doc)dom_node_unref((dom_node *) (doc));
781 return 1;
782#line 783 "node.c"
783}
784
785static duk_ret_t dukky_node_parentNode_getter(duk_context *ctx)
786{
787 /* Get private data for method */
788 node_private_t *priv = NULL((void*)0);
789 duk_push_this(ctx);
790 duk_get_prop_string(ctx, -1, dukky_magic_string_private);
791 priv = duk_get_pointer(ctx, -1);
792 duk_pop_2(ctx);
793 if (priv == NULL((void*)0)) {
794 return 0; /* can do? No can do. */
795 }
796
797#line 76 "Node.bnd"
798
799 dom_exception exc;
800 dom_node *pnode = NULL((void*)0);
801 exc = dom_node_get_parent_node(priv->node, &pnode)dom_node_get_parent_node( (dom_node *) (priv->node), (dom_node
**) (&pnode))
;
802 if (exc != DOM_NO_ERR) return 0;
803 dukky_push_node(ctx, pnode);
804 dom_node_unref(pnode)dom_node_unref((dom_node *) (pnode));
805 return 1;
806#line 807 "node.c"
807}
808
809static duk_ret_t dukky_node_parentElement_getter(duk_context *ctx)
810{
811 /* Get private data for method */
812 node_private_t *priv = NULL((void*)0);
813 duk_push_this(ctx);
814 duk_get_prop_string(ctx, -1, dukky_magic_string_private);
815 priv = duk_get_pointer(ctx, -1);
816 duk_pop_2(ctx);
817 if (priv == NULL((void*)0)) {
818 return 0; /* can do? No can do. */
819 }
820
821#line 87 "Node.bnd"
822
823 dom_exception exc;
824 dom_node *pnode = NULL((void*)0);
825 dom_node_type ntype = DOM_NODE_TYPE_COUNT + 1;
826 exc = dom_node_get_parent_node(priv->node, &pnode)dom_node_get_parent_node( (dom_node *) (priv->node), (dom_node
**) (&pnode))
;
827 if (exc != DOM_NO_ERR) return 0;
828 if (pnode != NULL((void*)0)) {
829 exc = dom_node_get_node_type(pnode, &ntype)dom_node_get_node_type( (dom_node *) (pnode), (dom_node_type *
) (&ntype))
;
830 if (exc != DOM_NO_ERR) { dom_node_unref(pnode)dom_node_unref((dom_node *) (pnode)); return 0; }
831 }
832 dukky_push_node(ctx, (ntype == DOM_ELEMENT_NODE) ? pnode : NULL((void*)0));
833 dom_node_unref(pnode)dom_node_unref((dom_node *) (pnode));
834 return 1;
835#line 836 "node.c"
836}
837
838static duk_ret_t dukky_node_childNodes_getter(duk_context *ctx)
839{
840 /* Get private data for method */
841 node_private_t *priv = NULL((void*)0);
842 duk_push_this(ctx);
843 duk_get_prop_string(ctx, -1, dukky_magic_string_private);
844 priv = duk_get_pointer(ctx, -1);
845 duk_pop_2(ctx);
846 if (priv == NULL((void*)0)) {
847 return 0; /* can do? No can do. */
848 }
849
850#line 113 "Node.bnd"
851
852 dom_exception exc;
853 dom_nodelist *nlist = NULL((void*)0);
854 duk_set_top(ctx, 0);
855 duk_push_this(ctx);
856 duk_get_prop_string(ctx, 0, MAGIC(childNodes)("\xFF\xFFNETSURF_DUKTAPE_" "childNodes"));
857 if (duk_is_undefined(ctx, -1)) {
858 duk_pop(ctx);
859 exc = dom_node_get_child_nodes(priv->node, &nlist)dom_node_get_child_nodes( (dom_node *) (priv->node), (struct
dom_nodelist **) (&nlist))
;
860 if (exc != DOM_NO_ERR) return 0;
861 dukky_push_generics(ctx, "makeListProxy");
862 duk_push_pointer(ctx, nlist);
863 if (dukky_create_object(ctx, PROTO_NAME(NODELIST)("\xFF\xFFNETSURF_DUKTAPE_" "PROTOTYPE_" "NODELIST"), 1) != DUK_EXEC_SUCCESS0) {
864 dom_nodelist_unref(nlist);
865 return 0;
866 }
867 dom_nodelist_unref(nlist);
868 if (dukky_pcall(ctx, 1, false0) != 0) {
869 NSLOG(dukky, DEBUG, "Unable to construct nodelist?")do { if (NSLOG_LEVEL_DEBUG >= NSLOG_LEVEL_VERBOSE) { static
nslog_entry_context_t _nslog_ctx = { &__nslog_category_dukky
, NSLOG_LEVEL_DEBUG, "Node.bnd", sizeof("Node.bnd") - 1, __PRETTY_FUNCTION__
, sizeof(__PRETTY_FUNCTION__) - 1, 131, }; nslog__log(&_nslog_ctx
, "Unable to construct nodelist?"); } } while(0)
;
870 return 0; /* coerced to undefined */
871 }
872 duk_dup(ctx, -1);
873 duk_put_prop_string(ctx, 0, MAGIC(childNodes)("\xFF\xFFNETSURF_DUKTAPE_" "childNodes"));
874 }
875 return 1;
876#line 877 "node.c"
877}
878
879static duk_ret_t dukky_node_firstChild_getter(duk_context *ctx)
880{
881 /* Get private data for method */
882 node_private_t *priv = NULL((void*)0);
883 duk_push_this(ctx);
884 duk_get_prop_string(ctx, -1, dukky_magic_string_private);
885 priv = duk_get_pointer(ctx, -1);
886 duk_pop_2(ctx);
887 if (priv == NULL((void*)0)) {
888 return 0; /* can do? No can do. */
889 }
890
891#line 141 "Node.bnd"
892
893 dom_exception exc;
894 dom_node *n;
895 exc = dom_node_get_first_child(priv->node, &n)dom_node_get_first_child( (dom_node *) (priv->node), (dom_node
**) (&n))
;
896 if (exc != DOM_NO_ERR) return 0;
897 if (dukky_push_node(ctx, n) == false0) {
898 dom_node_unref(n)dom_node_unref((dom_node *) (n));
899 return 0;
900 }
901 dom_node_unref(n)dom_node_unref((dom_node *) (n));
902 return 1;
903#line 904 "node.c"
904}
905
906static duk_ret_t dukky_node_lastChild_getter(duk_context *ctx)
907{
908 /* Get private data for method */
909 node_private_t *priv = NULL((void*)0);
910 duk_push_this(ctx);
911 duk_get_prop_string(ctx, -1, dukky_magic_string_private);
912 priv = duk_get_pointer(ctx, -1);
913 duk_pop_2(ctx);
914 if (priv == NULL((void*)0)) {
915 return 0; /* can do? No can do. */
916 }
917
918#line 155 "Node.bnd"
919
920 dom_exception exc;
921 dom_node *n;
922 exc = dom_node_get_last_child(priv->node, &n)dom_node_get_last_child( (dom_node *) (priv->node), (dom_node
**) (&n))
;
923 if (exc != DOM_NO_ERR) return 0;
924 if (dukky_push_node(ctx, n) == false0) {
925 dom_node_unref(n)dom_node_unref((dom_node *) (n));
926 return 0;
927 }
928 dom_node_unref(n)dom_node_unref((dom_node *) (n));
929 return 1;
930#line 931 "node.c"
931}
932
933static duk_ret_t dukky_node_previousSibling_getter(duk_context *ctx)
934{
935 /* Get private data for method */
936 node_private_t *priv = NULL((void*)0);
937 duk_push_this(ctx);
938 duk_get_prop_string(ctx, -1, dukky_magic_string_private);
939 priv = duk_get_pointer(ctx, -1);
940 duk_pop_2(ctx);
941 if (priv == NULL((void*)0)) {
942 return 0; /* can do? No can do. */
943 }
944
945#line 169 "Node.bnd"
946
947 dom_exception exc;
948 dom_node *n;
949 exc = dom_node_get_previous_sibling(priv->node, &n)dom_node_get_previous_sibling( (dom_node *) (priv->node), (
dom_node **) (&n))
;
950 if (exc != DOM_NO_ERR) return 0;
951 if (dukky_push_node(ctx, n) == false0) {
952 dom_node_unref(n)dom_node_unref((dom_node *) (n));
953 return 0;
954 }
955 dom_node_unref(n)dom_node_unref((dom_node *) (n));
956 return 1;
957#line 958 "node.c"
958}
959
960static duk_ret_t dukky_node_nextSibling_getter(duk_context *ctx)
961{
962 /* Get private data for method */
963 node_private_t *priv = NULL((void*)0);
964 duk_push_this(ctx);
965 duk_get_prop_string(ctx, -1, dukky_magic_string_private);
966 priv = duk_get_pointer(ctx, -1);
967 duk_pop_2(ctx);
968 if (priv == NULL((void*)0)) {
969 return 0; /* can do? No can do. */
970 }
971
972#line 183 "Node.bnd"
973
974 dom_exception exc;
975 dom_node *n;
976 exc = dom_node_get_next_sibling(priv->node, &n)dom_node_get_next_sibling( (dom_node *) (priv->node), (dom_node
**) (&n))
;
977 if (exc != DOM_NO_ERR) return 0;
978 if (dukky_push_node(ctx, n) == false0) {
979 dom_node_unref(n)dom_node_unref((dom_node *) (n));
980 return 0;
981 }
982 dom_node_unref(n)dom_node_unref((dom_node *) (n));
983 return 1;
984#line 985 "node.c"
985}
986
987static duk_ret_t dukky_node_nodeValue_getter(duk_context *ctx)
988{
989 /* Get private data for method */
990 node_private_t *priv = NULL((void*)0);
991 duk_push_this(ctx);
992 duk_get_prop_string(ctx, -1, dukky_magic_string_private);
993 priv = duk_get_pointer(ctx, -1);
994 duk_pop_2(ctx);
995 if (priv == NULL((void*)0)) {
996 return 0; /* can do? No can do. */
997 }
998
999#line 197 "Node.bnd"
1000
1001 dom_exception exc;
1002 dom_string *content;
1003
1004 exc = dom_node_get_node_value(priv->node, &content)dom_node_get_node_value( (dom_node *) (priv->node), (&
content))
;
1005 if (exc != DOM_NO_ERR) {
1006 return 0;
1007 }
1008
1009 if (content != NULL((void*)0)) {
1010 duk_push_lstring(ctx, dom_string_data(content), dom_string_length(content));
1011 dom_string_unref(content);
1012 return 1;
1013 }
1014 return 0;
1015#line 1016 "node.c"
1016}
1017
1018static duk_ret_t dukky_node_nodeValue_setter(duk_context *ctx)
1019{
1020 /* Get private data for method */
1021 node_private_t *priv = NULL((void*)0);
1022 duk_push_this(ctx);
1023 duk_get_prop_string(ctx, -1, dukky_magic_string_private);
1024 priv = duk_get_pointer(ctx, -1);
1025 duk_pop_2(ctx);
1026 if (priv == NULL((void*)0)) {
1027 return 0; /* can do? No can do. */
1028 }
1029
1030#line 215 "Node.bnd"
1031
1032 dom_exception exc;
1033 dom_string *content;
1034 duk_size_t slen;
1035 const char *s = duk_safe_to_lstring(ctx, 0, &slen);
1036 exc = dom_string_create((const uint8_t *)s, slen, &content);
1037 if (exc != DOM_NO_ERR) return 0;
1038 exc = dom_node_set_node_value(priv->node, content)dom_node_set_node_value( (dom_node *) (priv->node), (content
))
;
1039 dom_string_unref(content);
1040 if (exc != DOM_NO_ERR) return 0;
1041 return 1;
1042#line 1043 "node.c"
1043}
1044
1045static duk_ret_t dukky_node_textContent_getter(duk_context *ctx)
1046{
1047 /* Get private data for method */
1048 node_private_t *priv = NULL((void*)0);
1049 duk_push_this(ctx);
1050 duk_get_prop_string(ctx, -1, dukky_magic_string_private);
1051 priv = duk_get_pointer(ctx, -1);
1052 duk_pop_2(ctx);
1053 if (priv == NULL((void*)0)) {
1054 return 0; /* can do? No can do. */
1055 }
1056
1057#line 229 "Node.bnd"
1058
1059 dom_exception exc;
1060 dom_string *content;
1061
1062 exc = dom_node_get_text_content(priv->node, &content)dom_node_get_text_content( (dom_node *) (priv->node), (&
content))
;
1063 if (exc != DOM_NO_ERR) {
1064 return 0;
1065 }
1066
1067 if (content != NULL((void*)0)) {
1068 duk_push_lstring(ctx, dom_string_data(content), dom_string_length(content));
1069 dom_string_unref(content);
1070 return 1;
1071 }
1072 return 0;
1073#line 1074 "node.c"
1074}
1075
1076static duk_ret_t dukky_node_textContent_setter(duk_context *ctx)
1077{
1078 /* Get private data for method */
1079 node_private_t *priv = NULL((void*)0);
1080 duk_push_this(ctx);
1081 duk_get_prop_string(ctx, -1, dukky_magic_string_private);
1082 priv = duk_get_pointer(ctx, -1);
1083 duk_pop_2(ctx);
1084 if (priv == NULL((void*)0)) {
1085 return 0; /* can do? No can do. */
1086 }
1087
1088#line 247 "Node.bnd"
1089
1090 dom_exception exc;
1091 dom_string *content;
1092 duk_size_t slen;
1093 const char *s = duk_safe_to_lstring(ctx, 0, &slen);
1094 exc = dom_string_create((const uint8_t *)s, slen, &content);
1095 if (exc != DOM_NO_ERR) return 0;
1096 exc = dom_node_set_text_content(priv->node, content)dom_node_set_text_content( (dom_node *) (priv->node), (content
))
;
Value stored to 'exc' is never read
1097 dom_string_unref(content);
1098 return 0;
1099#line 1100 "node.c"
1100}
1101
1102duk_ret_t dukky_node___proto(duk_context *ctx, void *udata)
1103{
1104 /* Set this prototype's prototype (left-parent) */
1105 /* get prototype */
1106 duk_get_global_string(ctx, dukky_magic_string_prototypes);
1107 duk_get_prop_string(ctx, -1, "\xFF\xFFNETSURF_DUKTAPE_PROTOTYPE_EVENTTARGET");
1108 duk_replace(ctx, -2);
1109 duk_set_prototype(ctx, 0);
1110
1111 /* Add a method */
1112 duk_dup(ctx, 0);
1113 duk_push_string(ctx, "hasChildNodes");
1114 duk_push_c_function(ctx, dukky_node_hasChildNodes, DUK_VARARGS((duk_int_t) (-1)));
1115 duk_def_prop(ctx, -3,
1116 DUK_DEFPROP_HAVE_VALUE(1U << 6) |
1117 DUK_DEFPROP_HAVE_WRITABLE(1U << 3) |
1118 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) |
1119 DUK_DEFPROP_ENUMERABLE(1U << 1) |
1120 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1121 duk_pop(ctx);
1122
1123 /* Add a method */
1124 duk_dup(ctx, 0);
1125 duk_push_string(ctx, "normalize");
1126 duk_push_c_function(ctx, dukky_node_normalize, DUK_VARARGS((duk_int_t) (-1)));
1127 duk_def_prop(ctx, -3,
1128 DUK_DEFPROP_HAVE_VALUE(1U << 6) |
1129 DUK_DEFPROP_HAVE_WRITABLE(1U << 3) |
1130 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) |
1131 DUK_DEFPROP_ENUMERABLE(1U << 1) |
1132 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1133 duk_pop(ctx);
1134
1135 /* Add a method */
1136 duk_dup(ctx, 0);
1137 duk_push_string(ctx, "cloneNode");
1138 duk_push_c_function(ctx, dukky_node_cloneNode, DUK_VARARGS((duk_int_t) (-1)));
1139 duk_def_prop(ctx, -3,
1140 DUK_DEFPROP_HAVE_VALUE(1U << 6) |
1141 DUK_DEFPROP_HAVE_WRITABLE(1U << 3) |
1142 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) |
1143 DUK_DEFPROP_ENUMERABLE(1U << 1) |
1144 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1145 duk_pop(ctx);
1146
1147 /* Add a method */
1148 duk_dup(ctx, 0);
1149 duk_push_string(ctx, "isEqualNode");
1150 duk_push_c_function(ctx, dukky_node_isEqualNode, DUK_VARARGS((duk_int_t) (-1)));
1151 duk_def_prop(ctx, -3,
1152 DUK_DEFPROP_HAVE_VALUE(1U << 6) |
1153 DUK_DEFPROP_HAVE_WRITABLE(1U << 3) |
1154 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) |
1155 DUK_DEFPROP_ENUMERABLE(1U << 1) |
1156 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1157 duk_pop(ctx);
1158
1159 /* Add a method */
1160 duk_dup(ctx, 0);
1161 duk_push_string(ctx, "compareDocumentPosition");
1162 duk_push_c_function(ctx, dukky_node_compareDocumentPosition, DUK_VARARGS((duk_int_t) (-1)));
1163 duk_def_prop(ctx, -3,
1164 DUK_DEFPROP_HAVE_VALUE(1U << 6) |
1165 DUK_DEFPROP_HAVE_WRITABLE(1U << 3) |
1166 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) |
1167 DUK_DEFPROP_ENUMERABLE(1U << 1) |
1168 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1169 duk_pop(ctx);
1170
1171 /* Add a method */
1172 duk_dup(ctx, 0);
1173 duk_push_string(ctx, "contains");
1174 duk_push_c_function(ctx, dukky_node_contains, DUK_VARARGS((duk_int_t) (-1)));
1175 duk_def_prop(ctx, -3,
1176 DUK_DEFPROP_HAVE_VALUE(1U << 6) |
1177 DUK_DEFPROP_HAVE_WRITABLE(1U << 3) |
1178 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) |
1179 DUK_DEFPROP_ENUMERABLE(1U << 1) |
1180 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1181 duk_pop(ctx);
1182
1183 /* Add a method */
1184 duk_dup(ctx, 0);
1185 duk_push_string(ctx, "lookupPrefix");
1186 duk_push_c_function(ctx, dukky_node_lookupPrefix, DUK_VARARGS((duk_int_t) (-1)));
1187 duk_def_prop(ctx, -3,
1188 DUK_DEFPROP_HAVE_VALUE(1U << 6) |
1189 DUK_DEFPROP_HAVE_WRITABLE(1U << 3) |
1190 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) |
1191 DUK_DEFPROP_ENUMERABLE(1U << 1) |
1192 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1193 duk_pop(ctx);
1194
1195 /* Add a method */
1196 duk_dup(ctx, 0);
1197 duk_push_string(ctx, "lookupNamespaceURI");
1198 duk_push_c_function(ctx, dukky_node_lookupNamespaceURI, DUK_VARARGS((duk_int_t) (-1)));
1199 duk_def_prop(ctx, -3,
1200 DUK_DEFPROP_HAVE_VALUE(1U << 6) |
1201 DUK_DEFPROP_HAVE_WRITABLE(1U << 3) |
1202 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) |
1203 DUK_DEFPROP_ENUMERABLE(1U << 1) |
1204 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1205 duk_pop(ctx);
1206
1207 /* Add a method */
1208 duk_dup(ctx, 0);
1209 duk_push_string(ctx, "isDefaultNamespace");
1210 duk_push_c_function(ctx, dukky_node_isDefaultNamespace, DUK_VARARGS((duk_int_t) (-1)));
1211 duk_def_prop(ctx, -3,
1212 DUK_DEFPROP_HAVE_VALUE(1U << 6) |
1213 DUK_DEFPROP_HAVE_WRITABLE(1U << 3) |
1214 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) |
1215 DUK_DEFPROP_ENUMERABLE(1U << 1) |
1216 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1217 duk_pop(ctx);
1218
1219 /* Add a method */
1220 duk_dup(ctx, 0);
1221 duk_push_string(ctx, "insertBefore");
1222 duk_push_c_function(ctx, dukky_node_insertBefore, DUK_VARARGS((duk_int_t) (-1)));
1223 duk_def_prop(ctx, -3,
1224 DUK_DEFPROP_HAVE_VALUE(1U << 6) |
1225 DUK_DEFPROP_HAVE_WRITABLE(1U << 3) |
1226 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) |
1227 DUK_DEFPROP_ENUMERABLE(1U << 1) |
1228 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1229 duk_pop(ctx);
1230
1231 /* Add a method */
1232 duk_dup(ctx, 0);
1233 duk_push_string(ctx, "appendChild");
1234 duk_push_c_function(ctx, dukky_node_appendChild, DUK_VARARGS((duk_int_t) (-1)));
1235 duk_def_prop(ctx, -3,
1236 DUK_DEFPROP_HAVE_VALUE(1U << 6) |
1237 DUK_DEFPROP_HAVE_WRITABLE(1U << 3) |
1238 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) |
1239 DUK_DEFPROP_ENUMERABLE(1U << 1) |
1240 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1241 duk_pop(ctx);
1242
1243 /* Add a method */
1244 duk_dup(ctx, 0);
1245 duk_push_string(ctx, "replaceChild");
1246 duk_push_c_function(ctx, dukky_node_replaceChild, DUK_VARARGS((duk_int_t) (-1)));
1247 duk_def_prop(ctx, -3,
1248 DUK_DEFPROP_HAVE_VALUE(1U << 6) |
1249 DUK_DEFPROP_HAVE_WRITABLE(1U << 3) |
1250 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) |
1251 DUK_DEFPROP_ENUMERABLE(1U << 1) |
1252 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1253 duk_pop(ctx);
1254
1255 /* Add a method */
1256 duk_dup(ctx, 0);
1257 duk_push_string(ctx, "removeChild");
1258 duk_push_c_function(ctx, dukky_node_removeChild, DUK_VARARGS((duk_int_t) (-1)));
1259 duk_def_prop(ctx, -3,
1260 DUK_DEFPROP_HAVE_VALUE(1U << 6) |
1261 DUK_DEFPROP_HAVE_WRITABLE(1U << 3) |
1262 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) |
1263 DUK_DEFPROP_ENUMERABLE(1U << 1) |
1264 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1265 duk_pop(ctx);
1266
1267 /* Add readonly property */
1268 duk_dup(ctx, 0);
1269 duk_push_string(ctx, "nodeType");
1270 duk_push_c_function(ctx, dukky_node_nodeType_getter, 0);
1271 duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_GETTER(1U << 7) |
1272 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) | DUK_DEFPROP_ENUMERABLE(1U << 1) |
1273 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1274 duk_pop(ctx);
1275
1276 /* Add readonly property */
1277 duk_dup(ctx, 0);
1278 duk_push_string(ctx, "nodeName");
1279 duk_push_c_function(ctx, dukky_node_nodeName_getter, 0);
1280 duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_GETTER(1U << 7) |
1281 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) | DUK_DEFPROP_ENUMERABLE(1U << 1) |
1282 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1283 duk_pop(ctx);
1284
1285 /* Add readonly property */
1286 duk_dup(ctx, 0);
1287 duk_push_string(ctx, "baseURI");
1288 duk_push_c_function(ctx, dukky_node_baseURI_getter, 0);
1289 duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_GETTER(1U << 7) |
1290 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) | DUK_DEFPROP_ENUMERABLE(1U << 1) |
1291 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1292 duk_pop(ctx);
1293
1294 /* Add readonly property */
1295 duk_dup(ctx, 0);
1296 duk_push_string(ctx, "ownerDocument");
1297 duk_push_c_function(ctx, dukky_node_ownerDocument_getter, 0);
1298 duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_GETTER(1U << 7) |
1299 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) | DUK_DEFPROP_ENUMERABLE(1U << 1) |
1300 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1301 duk_pop(ctx);
1302
1303 /* Add readonly property */
1304 duk_dup(ctx, 0);
1305 duk_push_string(ctx, "parentNode");
1306 duk_push_c_function(ctx, dukky_node_parentNode_getter, 0);
1307 duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_GETTER(1U << 7) |
1308 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) | DUK_DEFPROP_ENUMERABLE(1U << 1) |
1309 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1310 duk_pop(ctx);
1311
1312 /* Add readonly property */
1313 duk_dup(ctx, 0);
1314 duk_push_string(ctx, "parentElement");
1315 duk_push_c_function(ctx, dukky_node_parentElement_getter, 0);
1316 duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_GETTER(1U << 7) |
1317 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) | DUK_DEFPROP_ENUMERABLE(1U << 1) |
1318 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1319 duk_pop(ctx);
1320
1321 /* Add readonly property */
1322 duk_dup(ctx, 0);
1323 duk_push_string(ctx, "childNodes");
1324 duk_push_c_function(ctx, dukky_node_childNodes_getter, 0);
1325 duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_GETTER(1U << 7) |
1326 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) | DUK_DEFPROP_ENUMERABLE(1U << 1) |
1327 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1328 duk_pop(ctx);
1329
1330 /* Add readonly property */
1331 duk_dup(ctx, 0);
1332 duk_push_string(ctx, "firstChild");
1333 duk_push_c_function(ctx, dukky_node_firstChild_getter, 0);
1334 duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_GETTER(1U << 7) |
1335 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) | DUK_DEFPROP_ENUMERABLE(1U << 1) |
1336 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1337 duk_pop(ctx);
1338
1339 /* Add readonly property */
1340 duk_dup(ctx, 0);
1341 duk_push_string(ctx, "lastChild");
1342 duk_push_c_function(ctx, dukky_node_lastChild_getter, 0);
1343 duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_GETTER(1U << 7) |
1344 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) | DUK_DEFPROP_ENUMERABLE(1U << 1) |
1345 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1346 duk_pop(ctx);
1347
1348 /* Add readonly property */
1349 duk_dup(ctx, 0);
1350 duk_push_string(ctx, "previousSibling");
1351 duk_push_c_function(ctx, dukky_node_previousSibling_getter, 0);
1352 duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_GETTER(1U << 7) |
1353 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) | DUK_DEFPROP_ENUMERABLE(1U << 1) |
1354 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1355 duk_pop(ctx);
1356
1357 /* Add readonly property */
1358 duk_dup(ctx, 0);
1359 duk_push_string(ctx, "nextSibling");
1360 duk_push_c_function(ctx, dukky_node_nextSibling_getter, 0);
1361 duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_GETTER(1U << 7) |
1362 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) | DUK_DEFPROP_ENUMERABLE(1U << 1) |
1363 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1364 duk_pop(ctx);
1365
1366 /* Add read/write property */
1367 duk_dup(ctx, 0);
1368 duk_push_string(ctx, "nodeValue");
1369 duk_push_c_function(ctx, dukky_node_nodeValue_getter, 0);
1370 duk_push_c_function(ctx, dukky_node_nodeValue_setter, 1);
1371 duk_def_prop(ctx, -4, DUK_DEFPROP_HAVE_GETTER(1U << 7) |
1372 DUK_DEFPROP_HAVE_SETTER(1U << 8) |
1373 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) | DUK_DEFPROP_ENUMERABLE(1U << 1) |
1374 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1375 duk_pop(ctx);
1376
1377 /* Add read/write property */
1378 duk_dup(ctx, 0);
1379 duk_push_string(ctx, "textContent");
1380 duk_push_c_function(ctx, dukky_node_textContent_getter, 0);
1381 duk_push_c_function(ctx, dukky_node_textContent_setter, 1);
1382 duk_def_prop(ctx, -4, DUK_DEFPROP_HAVE_GETTER(1U << 7) |
1383 DUK_DEFPROP_HAVE_SETTER(1U << 8) |
1384 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) | DUK_DEFPROP_ENUMERABLE(1U << 1) |
1385 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1386 duk_pop(ctx);
1387
1388 duk_dup(ctx, 0);
1389 duk_push_string(ctx, "ELEMENT_NODE");
1390 duk_push_int(ctx, 1);
1391 duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_VALUE(1U << 6) |
1392 DUK_DEFPROP_HAVE_WRITABLE(1U << 3) |
1393 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) |
1394 DUK_DEFPROP_ENUMERABLE(1U << 1) |
1395 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1396 duk_pop(ctx);
1397
1398 duk_dup(ctx, 0);
1399 duk_push_string(ctx, "ATTRIBUTE_NODE");
1400 duk_push_int(ctx, 2);
1401 duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_VALUE(1U << 6) |
1402 DUK_DEFPROP_HAVE_WRITABLE(1U << 3) |
1403 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) |
1404 DUK_DEFPROP_ENUMERABLE(1U << 1) |
1405 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1406 duk_pop(ctx);
1407
1408 duk_dup(ctx, 0);
1409 duk_push_string(ctx, "TEXT_NODE");
1410 duk_push_int(ctx, 3);
1411 duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_VALUE(1U << 6) |
1412 DUK_DEFPROP_HAVE_WRITABLE(1U << 3) |
1413 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) |
1414 DUK_DEFPROP_ENUMERABLE(1U << 1) |
1415 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1416 duk_pop(ctx);
1417
1418 duk_dup(ctx, 0);
1419 duk_push_string(ctx, "CDATA_SECTION_NODE");
1420 duk_push_int(ctx, 4);
1421 duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_VALUE(1U << 6) |
1422 DUK_DEFPROP_HAVE_WRITABLE(1U << 3) |
1423 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) |
1424 DUK_DEFPROP_ENUMERABLE(1U << 1) |
1425 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1426 duk_pop(ctx);
1427
1428 duk_dup(ctx, 0);
1429 duk_push_string(ctx, "ENTITY_REFERENCE_NODE");
1430 duk_push_int(ctx, 5);
1431 duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_VALUE(1U << 6) |
1432 DUK_DEFPROP_HAVE_WRITABLE(1U << 3) |
1433 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) |
1434 DUK_DEFPROP_ENUMERABLE(1U << 1) |
1435 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1436 duk_pop(ctx);
1437
1438 duk_dup(ctx, 0);
1439 duk_push_string(ctx, "ENTITY_NODE");
1440 duk_push_int(ctx, 6);
1441 duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_VALUE(1U << 6) |
1442 DUK_DEFPROP_HAVE_WRITABLE(1U << 3) |
1443 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) |
1444 DUK_DEFPROP_ENUMERABLE(1U << 1) |
1445 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1446 duk_pop(ctx);
1447
1448 duk_dup(ctx, 0);
1449 duk_push_string(ctx, "PROCESSING_INSTRUCTION_NODE");
1450 duk_push_int(ctx, 7);
1451 duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_VALUE(1U << 6) |
1452 DUK_DEFPROP_HAVE_WRITABLE(1U << 3) |
1453 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) |
1454 DUK_DEFPROP_ENUMERABLE(1U << 1) |
1455 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1456 duk_pop(ctx);
1457
1458 duk_dup(ctx, 0);
1459 duk_push_string(ctx, "COMMENT_NODE");
1460 duk_push_int(ctx, 8);
1461 duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_VALUE(1U << 6) |
1462 DUK_DEFPROP_HAVE_WRITABLE(1U << 3) |
1463 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) |
1464 DUK_DEFPROP_ENUMERABLE(1U << 1) |
1465 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1466 duk_pop(ctx);
1467
1468 duk_dup(ctx, 0);
1469 duk_push_string(ctx, "DOCUMENT_NODE");
1470 duk_push_int(ctx, 9);
1471 duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_VALUE(1U << 6) |
1472 DUK_DEFPROP_HAVE_WRITABLE(1U << 3) |
1473 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) |
1474 DUK_DEFPROP_ENUMERABLE(1U << 1) |
1475 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1476 duk_pop(ctx);
1477
1478 duk_dup(ctx, 0);
1479 duk_push_string(ctx, "DOCUMENT_TYPE_NODE");
1480 duk_push_int(ctx, 10);
1481 duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_VALUE(1U << 6) |
1482 DUK_DEFPROP_HAVE_WRITABLE(1U << 3) |
1483 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) |
1484 DUK_DEFPROP_ENUMERABLE(1U << 1) |
1485 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1486 duk_pop(ctx);
1487
1488 duk_dup(ctx, 0);
1489 duk_push_string(ctx, "DOCUMENT_FRAGMENT_NODE");
1490 duk_push_int(ctx, 11);
1491 duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_VALUE(1U << 6) |
1492 DUK_DEFPROP_HAVE_WRITABLE(1U << 3) |
1493 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) |
1494 DUK_DEFPROP_ENUMERABLE(1U << 1) |
1495 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1496 duk_pop(ctx);
1497
1498 duk_dup(ctx, 0);
1499 duk_push_string(ctx, "NOTATION_NODE");
1500 duk_push_int(ctx, 12);
1501 duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_VALUE(1U << 6) |
1502 DUK_DEFPROP_HAVE_WRITABLE(1U << 3) |
1503 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) |
1504 DUK_DEFPROP_ENUMERABLE(1U << 1) |
1505 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1506 duk_pop(ctx);
1507
1508 duk_dup(ctx, 0);
1509 duk_push_string(ctx, "DOCUMENT_POSITION_DISCONNECTED");
1510 duk_push_int(ctx, 1);
1511 duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_VALUE(1U << 6) |
1512 DUK_DEFPROP_HAVE_WRITABLE(1U << 3) |
1513 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) |
1514 DUK_DEFPROP_ENUMERABLE(1U << 1) |
1515 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1516 duk_pop(ctx);
1517
1518 duk_dup(ctx, 0);
1519 duk_push_string(ctx, "DOCUMENT_POSITION_PRECEDING");
1520 duk_push_int(ctx, 2);
1521 duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_VALUE(1U << 6) |
1522 DUK_DEFPROP_HAVE_WRITABLE(1U << 3) |
1523 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) |
1524 DUK_DEFPROP_ENUMERABLE(1U << 1) |
1525 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1526 duk_pop(ctx);
1527
1528 duk_dup(ctx, 0);
1529 duk_push_string(ctx, "DOCUMENT_POSITION_FOLLOWING");
1530 duk_push_int(ctx, 4);
1531 duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_VALUE(1U << 6) |
1532 DUK_DEFPROP_HAVE_WRITABLE(1U << 3) |
1533 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) |
1534 DUK_DEFPROP_ENUMERABLE(1U << 1) |
1535 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1536 duk_pop(ctx);
1537
1538 duk_dup(ctx, 0);
1539 duk_push_string(ctx, "DOCUMENT_POSITION_CONTAINS");
1540 duk_push_int(ctx, 8);
1541 duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_VALUE(1U << 6) |
1542 DUK_DEFPROP_HAVE_WRITABLE(1U << 3) |
1543 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) |
1544 DUK_DEFPROP_ENUMERABLE(1U << 1) |
1545 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1546 duk_pop(ctx);
1547
1548 duk_dup(ctx, 0);
1549 duk_push_string(ctx, "DOCUMENT_POSITION_CONTAINED_BY");
1550 duk_push_int(ctx, 16);
1551 duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_VALUE(1U << 6) |
1552 DUK_DEFPROP_HAVE_WRITABLE(1U << 3) |
1553 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) |
1554 DUK_DEFPROP_ENUMERABLE(1U << 1) |
1555 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1556 duk_pop(ctx);
1557
1558 duk_dup(ctx, 0);
1559 duk_push_string(ctx, "DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC");
1560 duk_push_int(ctx, 32);
1561 duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_VALUE(1U << 6) |
1562 DUK_DEFPROP_HAVE_WRITABLE(1U << 3) |
1563 DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) |
1564 DUK_DEFPROP_ENUMERABLE(1U << 1) |
1565 DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5));
1566 duk_pop(ctx);
1567
1568 /* Set the destructor */
1569 duk_dup(ctx, 0);
1570 duk_push_c_function(ctx, dukky_node___destructor, 1);
1571 duk_set_finalizer(ctx, -2);
1572 duk_pop(ctx);
1573
1574 /* Set the constructor */
1575 duk_dup(ctx, 0);
1576 duk_push_c_function(ctx, dukky_node___constructor, 2);
1577 duk_put_prop_string(ctx, -2, "\xFF\xFFNETSURF_DUKTAPE_INIT");
1578 duk_pop(ctx);
1579
1580 return 1; /* The prototype object */
1581}
1582
1583