Lines 68-76
Link Here
|
68 |
* an int. |
68 |
* an int. |
69 |
*/ |
69 |
*/ |
70 |
XPUSHs(sv_2mortal(newSViv((int)obj))); |
70 |
XPUSHs(sv_2mortal(newSViv((int)obj))); |
71 |
XPUSHs(sv_2mortal(newSVpv(JS_GetStringBytes(JSVAL_TO_STRING(id)), 0))); |
71 |
XPUSHs(sv_2mortal(newSVpv(JS_EncodeString(cx, JSVAL_TO_STRING(id)), 0))); |
72 |
XPUSHs(sv_2mortal(newSVpv(what, 0))); |
72 |
XPUSHs(sv_2mortal(newSVpv(what, 0))); |
73 |
XPUSHs(sv_2mortal(newSVpv(JS_GetStringBytes(JSVAL_TO_STRING(*vp)), 0))); |
73 |
XPUSHs(sv_2mortal(newSVpv(JS_EncodeString(cx, JSVAL_TO_STRING(*vp)), 0))); |
74 |
PUTBACK; |
74 |
PUTBACK; |
75 |
call_pv("JavaScript::SpiderMonkey::getsetter_dispatcher", G_DISCARD); |
75 |
call_pv("JavaScript::SpiderMonkey::getsetter_dispatcher", G_DISCARD); |
76 |
FREETMPS; |
76 |
FREETMPS; |
Lines 151-160
Link Here
|
151 |
PUSHMARK(SP); |
151 |
PUSHMARK(SP); |
152 |
XPUSHs(sv_2mortal(newSViv((int)obj))); |
152 |
XPUSHs(sv_2mortal(newSViv((int)obj))); |
153 |
XPUSHs(sv_2mortal(newSVpv( |
153 |
XPUSHs(sv_2mortal(newSVpv( |
154 |
JS_GetFunctionName(fun), 0))); |
154 |
JS_EncodeString(cx, JS_GetFunctionId(fun)), 0))); |
155 |
for(i=0; i<argc; i++) { |
155 |
for(i=0; i<argc; i++) { |
156 |
XPUSHs(sv_2mortal(newSVpv( |
156 |
XPUSHs(sv_2mortal(newSVpv( |
157 |
JS_GetStringBytes(JS_ValueToString(cx, argv[i])), 0))); |
157 |
JS_EncodeString(cx, JS_ValueToString(cx, argv[i])), 0))); |
158 |
} |
158 |
} |
159 |
PUTBACK; |
159 |
PUTBACK; |
160 |
count = call_pv("JavaScript::SpiderMonkey::function_dispatcher", G_SCALAR); |
160 |
count = call_pv("JavaScript::SpiderMonkey::function_dispatcher", G_SCALAR); |
Lines 192-198
Link Here
|
192 |
|
192 |
|
193 |
if(Debug) |
193 |
if(Debug) |
194 |
fprintf(stderr, "DEBUG: %lx is a double(%f)\n", (long) sv,n_jdbl); |
194 |
fprintf(stderr, "DEBUG: %lx is a double(%f)\n", (long) sv,n_jdbl); |
195 |
*rval = DOUBLE_TO_JSVAL(JS_NewDouble(cx, n_jdbl)); |
195 |
JS_NewNumberValue(cx, n_jdbl, rval); |
196 |
} else if(SvPOK(sv)) { |
196 |
} else if(SvPOK(sv)) { |
197 |
n_jstr = SvPV(sv, PL_na); |
197 |
n_jstr = SvPV(sv, PL_na); |
198 |
//warn("DEBUG: %s (%d)\n", n_jstr); |
198 |
//warn("DEBUG: %s (%d)\n", n_jstr); |
Lines 241-247
Link Here
|
241 |
|
241 |
|
242 |
/* --------------------------------------------------------------------- */ |
242 |
/* --------------------------------------------------------------------- */ |
243 |
static JSBool |
243 |
static JSBool |
244 |
BranchHandler(JSContext *cx, JSScript *script) { |
244 |
BranchHandler(JSContext *cx, ...) { |
245 |
/* --------------------------------------------------------------------- */ |
245 |
/* --------------------------------------------------------------------- */ |
246 |
PJS_Context* pcx = (PJS_Context*) JS_GetContextPrivate(cx); |
246 |
PJS_Context* pcx = (PJS_Context*) JS_GetContextPrivate(cx); |
247 |
|
247 |
|
Lines 582-591
Link Here
|
582 |
rc = JS_GetProperty(cx, obj, name, &vp); |
582 |
rc = JS_GetProperty(cx, obj, name, &vp); |
583 |
if(rc) { |
583 |
if(rc) { |
584 |
str = JS_ValueToString(cx, vp); |
584 |
str = JS_ValueToString(cx, vp); |
585 |
if(strcmp(JS_GetStringBytes(str), "undefined") == 0) { |
585 |
if(strcmp(JS_EncodeString(cx, str), "undefined") == 0) { |
586 |
sv = &PL_sv_undef; |
586 |
sv = &PL_sv_undef; |
587 |
} else { |
587 |
} else { |
588 |
sv_setpv(sv, JS_GetStringBytes(str)); |
588 |
sv_setpv(sv, JS_EncodeString(cx, str)); |
589 |
} |
589 |
} |
590 |
} else { |
590 |
} else { |
591 |
sv = &PL_sv_undef; |
591 |
sv = &PL_sv_undef; |
Lines 675-684
Link Here
|
675 |
rc = JS_GetElement(cx, obj, idx, &vp); |
675 |
rc = JS_GetElement(cx, obj, idx, &vp); |
676 |
if(rc) { |
676 |
if(rc) { |
677 |
str = JS_ValueToString(cx, vp); |
677 |
str = JS_ValueToString(cx, vp); |
678 |
if(strcmp(JS_GetStringBytes(str), "undefined") == 0) { |
678 |
if(strcmp(JS_EncodeString(cx, str), "undefined") == 0) { |
679 |
sv = &PL_sv_undef; |
679 |
sv = &PL_sv_undef; |
680 |
} else { |
680 |
} else { |
681 |
sv_setpv(sv, JS_GetStringBytes(str)); |
681 |
sv_setpv(sv, JS_EncodeString(cx, str)); |
682 |
} |
682 |
} |
683 |
} else { |
683 |
} else { |
684 |
sv = &PL_sv_undef; |
684 |
sv = &PL_sv_undef; |