Gitweb links:
...log
http://git.netsurf-browser.org/nsgenbind.git/shortlog/c7f58c742de14f20b48ad32b023d478283995521
...commit
http://git.netsurf-browser.org/nsgenbind.git/commit/c7f58c742de14f20b48ad32b023d478283995521
...tree
http://git.netsurf-browser.org/nsgenbind.git/tree/c7f58c742de14f20b48ad32b023d478283995521
The branch, master has been updated
via c7f58c742de14f20b48ad32b023d478283995521 (commit)
from 9656f1ff87136263d44a54a4e3081ac92ad3b699 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/nsgenbind.git/commit/?id=c7f58c742de14f20b48ad32b023d478283995521
commit c7f58c742de14f20b48ad32b023d478283995521
Author: Daniel Silverstone <[email protected]>
Commit: Daniel Silverstone <[email protected]>
duk-libdom: Use PrimaryGlobal for Window to change method private
In order to support methods on `Window` being called via the global
object (which does not set `this`) we notice that the interface
we are generating the private data fetcher for as being the
global one, and use `duk_push_global_object` rather than `duk_push_this`.
Signed-off-by: Daniel Silverstone <[email protected]>
diff --git a/src/duk-libdom-interface.c b/src/duk-libdom-interface.c
index b3c9f19..0e6697a 100644
--- a/src/duk-libdom-interface.c
+++ b/src/duk-libdom-interface.c
@@ -244,11 +244,15 @@ output_prototype_constant_int(FILE *outf, const char
*constant_name, int value)
* generate code that gets a private pointer for a method
*/
static int
-output_get_method_private(FILE* outf, char *class_name)
+output_get_method_private(FILE* outf, char *class_name, bool is_global)
{
fprintf(outf, "\t/* Get private data for method */\n");
fprintf(outf, "\t%s_private_t *priv = NULL;\n", class_name);
- fprintf(outf, "\tduk_push_this(ctx);\n");
+ if (is_global) {
+ fprintf(outf, "\tduk_push_global_object(ctx);\n");
+ } else {
+ fprintf(outf, "\tduk_push_this(ctx);\n");
+ }
fprintf(outf, "\tduk_get_prop_string(ctx, -1,
%s_magic_string_private);\n",
DLPFX);
fprintf(outf, "\tpriv = duk_get_pointer(ctx, -1);\n");
@@ -820,7 +824,8 @@ output_interface_elipsis_operation(FILE* outf,
"Elipsis parameters not checked: method %s::%s();",
interfacee->name, operatione->name);
- output_get_method_private(outf, interfacee->class_name);
+ output_get_method_private(outf, interfacee->class_name,
+ interfacee->u.interface.primary_global);
cdatac = output_ccode(outf, operatione->method);
if (cdatac == 0) {
@@ -856,7 +861,8 @@ output_interface_overloaded_operation(FILE* outf,
* overloaded operation should go
*/
- output_get_method_private(outf, interfacee->class_name);
+ output_get_method_private(outf, interfacee->class_name,
+ interfacee->u.interface.primary_global);
cdatac = output_cdata(outf,
operatione->method,
@@ -1153,7 +1159,8 @@ output_interface_operation(FILE* outf,
argidx);
}
- output_get_method_private(outf, interfacee->class_name);
+ output_get_method_private(outf, interfacee->class_name,
+ interfacee->u.interface.primary_global);
cdatac = output_ccode(outf, operatione->method);
if (cdatac == 0) {
@@ -1212,7 +1219,8 @@ output_attribute_getter(FILE* outf,
DLPFX, interfacee->class_name, atributee->name);
fprintf(outf,"{\n");
- output_get_method_private(outf, interfacee->class_name);
+ output_get_method_private(outf, interfacee->class_name,
+ interfacee->u.interface.primary_global);
/* if binding available for this attribute getter process it */
if (atributee->getter != NULL) {
@@ -1310,7 +1318,8 @@ output_attribute_setter(FILE* outf,
DLPFX, interfacee->class_name, atributee->name);
fprintf(outf,"{\n");
- output_get_method_private(outf, interfacee->class_name);
+ output_get_method_private(outf, interfacee->class_name,
+ interfacee->u.interface.primary_global);
/* if binding available for this attribute getter process it */
if (atributee->setter != NULL) {
-----------------------------------------------------------------------
Summary of changes:
src/duk-libdom-interface.c | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/src/duk-libdom-interface.c b/src/duk-libdom-interface.c
index b3c9f19..0e6697a 100644
--- a/src/duk-libdom-interface.c
+++ b/src/duk-libdom-interface.c
@@ -244,11 +244,15 @@ output_prototype_constant_int(FILE *outf, const char
*constant_name, int value)
* generate code that gets a private pointer for a method
*/
static int
-output_get_method_private(FILE* outf, char *class_name)
+output_get_method_private(FILE* outf, char *class_name, bool is_global)
{
fprintf(outf, "\t/* Get private data for method */\n");
fprintf(outf, "\t%s_private_t *priv = NULL;\n", class_name);
- fprintf(outf, "\tduk_push_this(ctx);\n");
+ if (is_global) {
+ fprintf(outf, "\tduk_push_global_object(ctx);\n");
+ } else {
+ fprintf(outf, "\tduk_push_this(ctx);\n");
+ }
fprintf(outf, "\tduk_get_prop_string(ctx, -1,
%s_magic_string_private);\n",
DLPFX);
fprintf(outf, "\tpriv = duk_get_pointer(ctx, -1);\n");
@@ -820,7 +824,8 @@ output_interface_elipsis_operation(FILE* outf,
"Elipsis parameters not checked: method %s::%s();",
interfacee->name, operatione->name);
- output_get_method_private(outf, interfacee->class_name);
+ output_get_method_private(outf, interfacee->class_name,
+ interfacee->u.interface.primary_global);
cdatac = output_ccode(outf, operatione->method);
if (cdatac == 0) {
@@ -856,7 +861,8 @@ output_interface_overloaded_operation(FILE* outf,
* overloaded operation should go
*/
- output_get_method_private(outf, interfacee->class_name);
+ output_get_method_private(outf, interfacee->class_name,
+ interfacee->u.interface.primary_global);
cdatac = output_cdata(outf,
operatione->method,
@@ -1153,7 +1159,8 @@ output_interface_operation(FILE* outf,
argidx);
}
- output_get_method_private(outf, interfacee->class_name);
+ output_get_method_private(outf, interfacee->class_name,
+ interfacee->u.interface.primary_global);
cdatac = output_ccode(outf, operatione->method);
if (cdatac == 0) {
@@ -1212,7 +1219,8 @@ output_attribute_getter(FILE* outf,
DLPFX, interfacee->class_name, atributee->name);
fprintf(outf,"{\n");
- output_get_method_private(outf, interfacee->class_name);
+ output_get_method_private(outf, interfacee->class_name,
+ interfacee->u.interface.primary_global);
/* if binding available for this attribute getter process it */
if (atributee->getter != NULL) {
@@ -1310,7 +1318,8 @@ output_attribute_setter(FILE* outf,
DLPFX, interfacee->class_name, atributee->name);
fprintf(outf,"{\n");
- output_get_method_private(outf, interfacee->class_name);
+ output_get_method_private(outf, interfacee->class_name,
+ interfacee->u.interface.primary_global);
/* if binding available for this attribute getter process it */
if (atributee->setter != NULL) {
--
NetSurf Generator for JavaScript bindings
_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org