mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Bug 690825 - Fix nativeCall assert; HandleNonGenericMethodClassMismatch should not assume args.callee() is the native (r=waldo)
--HG-- extra : rebase_source : db9b9d249feca5a29cb8fc8581db86dda8b75453
This commit is contained in:
parent
75241f27fc
commit
b8eea36818
@ -2,16 +2,18 @@
|
||||
|
||||
var g1 = newGlobal('same-compartment');
|
||||
var g2 = newGlobal('new-compartment');
|
||||
var scriptedProxy = Proxy.create(
|
||||
{ getOwnPropertyDescriptor: function() assertEq(true,false),
|
||||
getPropertyDescriptor: function() assertEq(true,false),
|
||||
getOwnPropertyNames: function() assertEq(true,false),
|
||||
getPropertyNames: function() assertEq(true,false),
|
||||
defineProperty: function() assertEq(true,false),
|
||||
delete: function() assertEq(true,false),
|
||||
fix: function() assertEq(true,false), },
|
||||
Object.prototype
|
||||
);
|
||||
var proxyStr = "Proxy.create( "+
|
||||
" { getOwnPropertyDescriptor: function() assertEq(true,false), "+
|
||||
" getPropertyDescriptor: function() assertEq(true,false), "+
|
||||
" getOwnPropertyNames: function() assertEq(true,false), "+
|
||||
" getPropertyNames: function() assertEq(true,false), "+
|
||||
" defineProperty: function() assertEq(true,false), "+
|
||||
" delete: function() assertEq(true,false), "+
|
||||
" fix: function() assertEq(true,false), }, "+
|
||||
" Object.prototype "+
|
||||
"); ";
|
||||
var proxy1 = g1.eval(proxyStr);
|
||||
var proxy2 = g2.eval(proxyStr);
|
||||
|
||||
function test(str, f) {
|
||||
"use strict";
|
||||
@ -40,7 +42,16 @@ function test(str, f) {
|
||||
assertEq(threw, true);
|
||||
threw = false;
|
||||
try {
|
||||
f(scriptedProxy);
|
||||
f(proxy1);
|
||||
} catch (e) {
|
||||
assertEq(Object.prototype.toString.call(e), "[object Error]");
|
||||
assertEq(e.name, "TypeError");
|
||||
threw = true;
|
||||
}
|
||||
assertEq(threw, true);
|
||||
threw = false;
|
||||
try {
|
||||
f(proxy2);
|
||||
} catch (e) {
|
||||
assertEq(Object.prototype.toString.call(e), "[object Error]");
|
||||
assertEq(e.name, "TypeError");
|
||||
|
@ -1442,7 +1442,7 @@ array_toSource(JSContext *cx, uintN argc, Value *vp)
|
||||
if (!obj)
|
||||
return false;
|
||||
if (!obj->isArray())
|
||||
return HandleNonGenericMethodClassMismatch(cx, args, &ArrayClass);
|
||||
return HandleNonGenericMethodClassMismatch(cx, args, array_toSource, &ArrayClass);
|
||||
|
||||
ArraySharpDetector detector(cx);
|
||||
if (!detector.init(obj))
|
||||
|
@ -84,7 +84,7 @@ bool_toSource(JSContext *cx, uintN argc, Value *vp)
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
bool b, ok;
|
||||
if (!BoxedPrimitiveMethodGuard(cx, args, &b, &ok))
|
||||
if (!BoxedPrimitiveMethodGuard(cx, args, bool_toSource, &b, &ok))
|
||||
return ok;
|
||||
|
||||
char buf[32];
|
||||
@ -103,7 +103,7 @@ bool_toString(JSContext *cx, uintN argc, Value *vp)
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
bool b, ok;
|
||||
if (!BoxedPrimitiveMethodGuard<bool>(cx, args, &b, &ok))
|
||||
if (!BoxedPrimitiveMethodGuard<bool>(cx, args, bool_toString, &b, &ok))
|
||||
return ok;
|
||||
|
||||
args.rval().setString(cx->runtime->atomState.booleanAtoms[b ? 1 : 0]);
|
||||
@ -116,7 +116,7 @@ bool_valueOf(JSContext *cx, uintN argc, Value *vp)
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
bool b, ok;
|
||||
if (!BoxedPrimitiveMethodGuard(cx, args, &b, &ok))
|
||||
if (!BoxedPrimitiveMethodGuard(cx, args, bool_valueOf, &b, &ok))
|
||||
return ok;
|
||||
|
||||
args.rval().setBoolean(b);
|
||||
|
@ -1420,7 +1420,7 @@ date_getTime(JSContext *cx, uintN argc, Value *vp)
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
bool ok;
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, &DateClass, &ok);
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, date_getTime, &DateClass, &ok);
|
||||
if (!obj)
|
||||
return ok;
|
||||
|
||||
@ -1434,7 +1434,7 @@ date_getYear(JSContext *cx, uintN argc, Value *vp)
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
bool ok;
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, &DateClass, &ok);
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, date_getYear, &DateClass, &ok);
|
||||
if (!obj)
|
||||
return ok;
|
||||
|
||||
@ -1459,7 +1459,7 @@ date_getFullYear(JSContext *cx, uintN argc, Value *vp)
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
bool ok;
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, &DateClass, &ok);
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, date_getFullYear, &DateClass, &ok);
|
||||
if (!obj)
|
||||
return ok;
|
||||
|
||||
@ -1476,7 +1476,7 @@ date_getUTCFullYear(JSContext *cx, uintN argc, Value *vp)
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
bool ok;
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, &DateClass, &ok);
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, date_getUTCFullYear, &DateClass, &ok);
|
||||
if (!obj)
|
||||
return ok;
|
||||
|
||||
@ -1494,7 +1494,7 @@ date_getMonth(JSContext *cx, uintN argc, Value *vp)
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
bool ok;
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, &DateClass, &ok);
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, date_getMonth, &DateClass, &ok);
|
||||
if (!obj)
|
||||
return ok;
|
||||
|
||||
@ -1511,7 +1511,7 @@ date_getUTCMonth(JSContext *cx, uintN argc, Value *vp)
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
bool ok;
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, &DateClass, &ok);
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, date_getUTCMonth, &DateClass, &ok);
|
||||
if (!obj)
|
||||
return ok;
|
||||
|
||||
@ -1529,7 +1529,7 @@ date_getDate(JSContext *cx, uintN argc, Value *vp)
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
bool ok;
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, &DateClass, &ok);
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, date_getDate, &DateClass, &ok);
|
||||
if (!obj)
|
||||
return ok;
|
||||
|
||||
@ -1546,7 +1546,7 @@ date_getUTCDate(JSContext *cx, uintN argc, Value *vp)
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
bool ok;
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, &DateClass, &ok);
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, date_getUTCDate, &DateClass, &ok);
|
||||
if (!obj)
|
||||
return ok;
|
||||
|
||||
@ -1564,7 +1564,7 @@ date_getDay(JSContext *cx, uintN argc, Value *vp)
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
bool ok;
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, &DateClass, &ok);
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, date_getDay, &DateClass, &ok);
|
||||
if (!obj)
|
||||
return ok;
|
||||
|
||||
@ -1581,7 +1581,7 @@ date_getUTCDay(JSContext *cx, uintN argc, Value *vp)
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
bool ok;
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, &DateClass, &ok);
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, date_getUTCDay, &DateClass, &ok);
|
||||
if (!obj)
|
||||
return ok;
|
||||
|
||||
@ -1599,7 +1599,7 @@ date_getHours(JSContext *cx, uintN argc, Value *vp)
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
bool ok;
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, &DateClass, &ok);
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, date_getHours, &DateClass, &ok);
|
||||
if (!obj)
|
||||
return ok;
|
||||
|
||||
@ -1616,7 +1616,7 @@ date_getUTCHours(JSContext *cx, uintN argc, Value *vp)
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
bool ok;
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, &DateClass, &ok);
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, date_getUTCHours, &DateClass, &ok);
|
||||
if (!obj)
|
||||
return ok;
|
||||
|
||||
@ -1634,7 +1634,7 @@ date_getMinutes(JSContext *cx, uintN argc, Value *vp)
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
bool ok;
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, &DateClass, &ok);
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, date_getMinutes, &DateClass, &ok);
|
||||
if (!obj)
|
||||
return ok;
|
||||
|
||||
@ -1651,7 +1651,7 @@ date_getUTCMinutes(JSContext *cx, uintN argc, Value *vp)
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
bool ok;
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, &DateClass, &ok);
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, date_getUTCMinutes, &DateClass, &ok);
|
||||
if (!obj)
|
||||
return ok;
|
||||
|
||||
@ -1671,7 +1671,7 @@ date_getUTCSeconds(JSContext *cx, uintN argc, Value *vp)
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
bool ok;
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, &DateClass, &ok);
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, date_getUTCSeconds, &DateClass, &ok);
|
||||
if (!obj)
|
||||
return ok;
|
||||
|
||||
@ -1690,7 +1690,7 @@ date_getUTCMilliseconds(JSContext *cx, uintN argc, Value *vp)
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
bool ok;
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, &DateClass, &ok);
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, date_getUTCMilliseconds, &DateClass, &ok);
|
||||
if (!obj)
|
||||
return ok;
|
||||
|
||||
@ -1708,7 +1708,7 @@ date_getTimezoneOffset(JSContext *cx, uintN argc, Value *vp)
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
bool ok;
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, &DateClass, &ok);
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, date_getTimezoneOffset, &DateClass, &ok);
|
||||
if (!obj)
|
||||
return ok;
|
||||
|
||||
@ -1734,7 +1734,7 @@ date_setTime(JSContext *cx, uintN argc, Value *vp)
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
bool ok;
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, &DateClass, &ok);
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, date_setTime, &DateClass, &ok);
|
||||
if (!obj)
|
||||
return ok;
|
||||
|
||||
@ -1751,12 +1751,12 @@ date_setTime(JSContext *cx, uintN argc, Value *vp)
|
||||
}
|
||||
|
||||
static JSBool
|
||||
date_makeTime(JSContext *cx, uintN maxargs, JSBool local, uintN argc, Value *vp)
|
||||
date_makeTime(JSContext *cx, Native native, uintN maxargs, JSBool local, uintN argc, Value *vp)
|
||||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
bool ok;
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, &DateClass, &ok);
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, native, &DateClass, &ok);
|
||||
if (!obj)
|
||||
return ok;
|
||||
|
||||
@ -1839,58 +1839,58 @@ date_makeTime(JSContext *cx, uintN maxargs, JSBool local, uintN argc, Value *vp)
|
||||
static JSBool
|
||||
date_setMilliseconds(JSContext *cx, uintN argc, Value *vp)
|
||||
{
|
||||
return date_makeTime(cx, 1, JS_TRUE, argc, vp);
|
||||
return date_makeTime(cx, date_setMilliseconds, 1, JS_TRUE, argc, vp);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
date_setUTCMilliseconds(JSContext *cx, uintN argc, Value *vp)
|
||||
{
|
||||
return date_makeTime(cx, 1, JS_FALSE, argc, vp);
|
||||
return date_makeTime(cx, date_setUTCMilliseconds, 1, JS_FALSE, argc, vp);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
date_setSeconds(JSContext *cx, uintN argc, Value *vp)
|
||||
{
|
||||
return date_makeTime(cx, 2, JS_TRUE, argc, vp);
|
||||
return date_makeTime(cx, date_setSeconds, 2, JS_TRUE, argc, vp);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
date_setUTCSeconds(JSContext *cx, uintN argc, Value *vp)
|
||||
{
|
||||
return date_makeTime(cx, 2, JS_FALSE, argc, vp);
|
||||
return date_makeTime(cx, date_setUTCSeconds, 2, JS_FALSE, argc, vp);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
date_setMinutes(JSContext *cx, uintN argc, Value *vp)
|
||||
{
|
||||
return date_makeTime(cx, 3, JS_TRUE, argc, vp);
|
||||
return date_makeTime(cx, date_setMinutes, 3, JS_TRUE, argc, vp);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
date_setUTCMinutes(JSContext *cx, uintN argc, Value *vp)
|
||||
{
|
||||
return date_makeTime(cx, 3, JS_FALSE, argc, vp);
|
||||
return date_makeTime(cx, date_setUTCMinutes, 3, JS_FALSE, argc, vp);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
date_setHours(JSContext *cx, uintN argc, Value *vp)
|
||||
{
|
||||
return date_makeTime(cx, 4, JS_TRUE, argc, vp);
|
||||
return date_makeTime(cx, date_setHours, 4, JS_TRUE, argc, vp);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
date_setUTCHours(JSContext *cx, uintN argc, Value *vp)
|
||||
{
|
||||
return date_makeTime(cx, 4, JS_FALSE, argc, vp);
|
||||
return date_makeTime(cx, date_setUTCHours, 4, JS_FALSE, argc, vp);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
date_makeDate(JSContext *cx, uintN maxargs, JSBool local, uintN argc, Value *vp)
|
||||
date_makeDate(JSContext *cx, Native native, uintN maxargs, JSBool local, uintN argc, Value *vp)
|
||||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
bool ok;
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, &DateClass, &ok);
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, native, &DateClass, &ok);
|
||||
if (!obj)
|
||||
return ok;
|
||||
|
||||
@ -1962,37 +1962,37 @@ date_makeDate(JSContext *cx, uintN maxargs, JSBool local, uintN argc, Value *vp)
|
||||
static JSBool
|
||||
date_setDate(JSContext *cx, uintN argc, Value *vp)
|
||||
{
|
||||
return date_makeDate(cx, 1, JS_TRUE, argc, vp);
|
||||
return date_makeDate(cx, date_setDate, 1, JS_TRUE, argc, vp);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
date_setUTCDate(JSContext *cx, uintN argc, Value *vp)
|
||||
{
|
||||
return date_makeDate(cx, 1, JS_FALSE, argc, vp);
|
||||
return date_makeDate(cx, date_setUTCDate, 1, JS_FALSE, argc, vp);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
date_setMonth(JSContext *cx, uintN argc, Value *vp)
|
||||
{
|
||||
return date_makeDate(cx, 2, JS_TRUE, argc, vp);
|
||||
return date_makeDate(cx, date_setMonth, 2, JS_TRUE, argc, vp);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
date_setUTCMonth(JSContext *cx, uintN argc, Value *vp)
|
||||
{
|
||||
return date_makeDate(cx, 2, JS_FALSE, argc, vp);
|
||||
return date_makeDate(cx, date_setUTCMonth, 2, JS_FALSE, argc, vp);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
date_setFullYear(JSContext *cx, uintN argc, Value *vp)
|
||||
{
|
||||
return date_makeDate(cx, 3, JS_TRUE, argc, vp);
|
||||
return date_makeDate(cx, date_setFullYear, 3, JS_TRUE, argc, vp);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
date_setUTCFullYear(JSContext *cx, uintN argc, Value *vp)
|
||||
{
|
||||
return date_makeDate(cx, 3, JS_FALSE, argc, vp);
|
||||
return date_makeDate(cx, date_setUTCFullYear, 3, JS_FALSE, argc, vp);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
@ -2001,7 +2001,7 @@ date_setYear(JSContext *cx, uintN argc, Value *vp)
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
bool ok;
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, &DateClass, &ok);
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, date_setYear, &DateClass, &ok);
|
||||
if (!obj)
|
||||
return ok;
|
||||
|
||||
@ -2073,11 +2073,11 @@ print_iso_string(char* buf, size_t size, jsdouble utctime)
|
||||
}
|
||||
|
||||
static JSBool
|
||||
date_utc_format(JSContext *cx, CallArgs args,
|
||||
date_utc_format(JSContext *cx, Native native, CallArgs args,
|
||||
void (*printFunc)(char*, size_t, jsdouble))
|
||||
{
|
||||
bool ok;
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, &DateClass, &ok);
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, native, &DateClass, &ok);
|
||||
if (!obj)
|
||||
return ok;
|
||||
|
||||
@ -2105,13 +2105,13 @@ date_utc_format(JSContext *cx, CallArgs args,
|
||||
static JSBool
|
||||
date_toGMTString(JSContext *cx, uintN argc, Value *vp)
|
||||
{
|
||||
return date_utc_format(cx, CallArgsFromVp(argc, vp), print_gmt_string);
|
||||
return date_utc_format(cx, date_toGMTString, CallArgsFromVp(argc, vp), print_gmt_string);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
date_toISOString(JSContext *cx, uintN argc, Value *vp)
|
||||
{
|
||||
return date_utc_format(cx, CallArgsFromVp(argc, vp), print_iso_string);
|
||||
return date_utc_format(cx, date_toISOString, CallArgsFromVp(argc, vp), print_iso_string);
|
||||
}
|
||||
|
||||
/* ES5 15.9.5.44. */
|
||||
@ -2352,12 +2352,12 @@ ToLocaleHelper(JSContext *cx, CallReceiver call, JSObject *obj, const char *form
|
||||
* after calling date_toLocaleHelper, even if it returns 'true'.
|
||||
*/
|
||||
static JSBool
|
||||
date_toLocaleHelper(JSContext *cx, uintN argc, Value *vp, const char *format)
|
||||
date_toLocaleHelper(JSContext *cx, uintN argc, Value *vp, Native native, const char *format)
|
||||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
bool ok;
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, &DateClass, &ok);
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, native, &DateClass, &ok);
|
||||
if (!obj)
|
||||
return ok;
|
||||
|
||||
@ -2365,13 +2365,13 @@ date_toLocaleHelper(JSContext *cx, uintN argc, Value *vp, const char *format)
|
||||
}
|
||||
|
||||
static JSBool
|
||||
date_toLocaleString(JSContext *cx, uintN argc, Value *vp)
|
||||
date_toLocaleStringHelper(JSContext *cx, Native native, uintN argc, Value *vp)
|
||||
{
|
||||
/*
|
||||
* Use '%#c' for windows, because '%c' is backward-compatible and non-y2k
|
||||
* with msvc; '%#c' requests that a full year be used in the result string.
|
||||
*/
|
||||
return date_toLocaleHelper(cx, argc, vp,
|
||||
return date_toLocaleHelper(cx, argc, vp, native,
|
||||
#if defined(_WIN32) && !defined(__MWERKS__)
|
||||
"%#c"
|
||||
#else
|
||||
@ -2380,6 +2380,12 @@ date_toLocaleString(JSContext *cx, uintN argc, Value *vp)
|
||||
);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
date_toLocaleString(JSContext *cx, uintN argc, Value *vp)
|
||||
{
|
||||
return date_toLocaleStringHelper(cx, date_toLocaleString, argc, vp);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
date_toLocaleDateString(JSContext *cx, uintN argc, Value *vp)
|
||||
{
|
||||
@ -2387,7 +2393,7 @@ date_toLocaleDateString(JSContext *cx, uintN argc, Value *vp)
|
||||
* Use '%#x' for windows, because '%x' is backward-compatible and non-y2k
|
||||
* with msvc; '%#x' requests that a full year be used in the result string.
|
||||
*/
|
||||
return date_toLocaleHelper(cx, argc, vp,
|
||||
return date_toLocaleHelper(cx, argc, vp, date_toLocaleDateString,
|
||||
#if defined(_WIN32) && !defined(__MWERKS__)
|
||||
"%#x"
|
||||
#else
|
||||
@ -2399,19 +2405,19 @@ date_toLocaleDateString(JSContext *cx, uintN argc, Value *vp)
|
||||
static JSBool
|
||||
date_toLocaleTimeString(JSContext *cx, uintN argc, Value *vp)
|
||||
{
|
||||
return date_toLocaleHelper(cx, argc, vp, "%X");
|
||||
return date_toLocaleHelper(cx, argc, vp, date_toLocaleTimeString, "%X");
|
||||
}
|
||||
|
||||
static JSBool
|
||||
date_toLocaleFormat(JSContext *cx, uintN argc, Value *vp)
|
||||
{
|
||||
if (argc == 0)
|
||||
return date_toLocaleString(cx, argc, vp);
|
||||
return date_toLocaleStringHelper(cx, date_toLocaleFormat, argc, vp);
|
||||
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
bool ok;
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, &DateClass, &ok);
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, date_toLocaleFormat, &DateClass, &ok);
|
||||
if (!obj)
|
||||
return ok;
|
||||
|
||||
@ -2433,7 +2439,7 @@ date_toTimeString(JSContext *cx, uintN argc, Value *vp)
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
bool ok;
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, &DateClass, &ok);
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, date_toTimeString, &DateClass, &ok);
|
||||
if (!obj)
|
||||
return ok;
|
||||
|
||||
@ -2446,7 +2452,7 @@ date_toDateString(JSContext *cx, uintN argc, Value *vp)
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
bool ok;
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, &DateClass, &ok);
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, date_toDateString, &DateClass, &ok);
|
||||
if (!obj)
|
||||
return ok;
|
||||
|
||||
@ -2463,7 +2469,7 @@ date_toSource(JSContext *cx, uintN argc, Value *vp)
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
bool ok;
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, &DateClass, &ok);
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, date_toSource, &DateClass, &ok);
|
||||
if (!obj)
|
||||
return ok;
|
||||
|
||||
@ -2497,7 +2503,7 @@ date_toString(JSContext *cx, uintN argc, Value *vp)
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
bool ok;
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, &DateClass, &ok);
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, date_toString, &DateClass, &ok);
|
||||
if (!obj)
|
||||
return ok;
|
||||
|
||||
|
@ -713,7 +713,7 @@ iterator_next(JSContext *cx, uintN argc, Value *vp)
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
bool ok;
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, &IteratorClass, &ok);
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, iterator_next, &IteratorClass, &ok);
|
||||
if (!obj)
|
||||
return ok;
|
||||
|
||||
@ -1335,14 +1335,14 @@ CloseGenerator(JSContext *cx, JSObject *obj)
|
||||
* Common subroutine of generator_(next|send|throw|close) methods.
|
||||
*/
|
||||
static JSBool
|
||||
generator_op(JSContext *cx, JSGeneratorOp op, Value *vp, uintN argc)
|
||||
generator_op(JSContext *cx, Native native, JSGeneratorOp op, Value *vp, uintN argc)
|
||||
{
|
||||
LeaveTrace(cx);
|
||||
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
bool ok;
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, &GeneratorClass, &ok);
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, native, &GeneratorClass, &ok);
|
||||
if (!obj)
|
||||
return ok;
|
||||
|
||||
@ -1399,25 +1399,25 @@ generator_op(JSContext *cx, JSGeneratorOp op, Value *vp, uintN argc)
|
||||
static JSBool
|
||||
generator_send(JSContext *cx, uintN argc, Value *vp)
|
||||
{
|
||||
return generator_op(cx, JSGENOP_SEND, vp, argc);
|
||||
return generator_op(cx, generator_send, JSGENOP_SEND, vp, argc);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
generator_next(JSContext *cx, uintN argc, Value *vp)
|
||||
{
|
||||
return generator_op(cx, JSGENOP_NEXT, vp, argc);
|
||||
return generator_op(cx, generator_next, JSGENOP_NEXT, vp, argc);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
generator_throw(JSContext *cx, uintN argc, Value *vp)
|
||||
{
|
||||
return generator_op(cx, JSGENOP_THROW, vp, argc);
|
||||
return generator_op(cx, generator_throw, JSGENOP_THROW, vp, argc);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
generator_close(JSContext *cx, uintN argc, Value *vp)
|
||||
{
|
||||
return generator_op(cx, JSGENOP_CLOSE, vp, argc);
|
||||
return generator_op(cx, generator_close, JSGENOP_CLOSE, vp, argc);
|
||||
}
|
||||
|
||||
static JSFunctionSpec generator_methods[] = {
|
||||
|
@ -605,7 +605,7 @@ num_toSource(JSContext *cx, uintN argc, Value *vp)
|
||||
|
||||
double d;
|
||||
bool ok;
|
||||
if (!BoxedPrimitiveMethodGuard(cx, args, &d, &ok))
|
||||
if (!BoxedPrimitiveMethodGuard(cx, args, num_toSource, &d, &ok))
|
||||
return ok;
|
||||
|
||||
ToCStringBuf cbuf;
|
||||
@ -712,14 +712,14 @@ IntToCString(ToCStringBuf *cbuf, jsint i, jsint base = 10)
|
||||
static JSString * JS_FASTCALL
|
||||
js_NumberToStringWithBase(JSContext *cx, jsdouble d, jsint base);
|
||||
|
||||
static JSBool
|
||||
num_toString(JSContext *cx, uintN argc, Value *vp)
|
||||
static JS_ALWAYS_INLINE bool
|
||||
num_toStringHelper(JSContext *cx, Native native, uintN argc, Value *vp)
|
||||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
double d;
|
||||
bool ok;
|
||||
if (!BoxedPrimitiveMethodGuard(cx, args, &d, &ok))
|
||||
if (!BoxedPrimitiveMethodGuard(cx, args, native, &d, &ok))
|
||||
return ok;
|
||||
|
||||
int32 base = 10;
|
||||
@ -738,10 +738,16 @@ num_toString(JSContext *cx, uintN argc, Value *vp)
|
||||
JSString *str = js_NumberToStringWithBase(cx, d, base);
|
||||
if (!str) {
|
||||
JS_ReportOutOfMemory(cx);
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
}
|
||||
args.rval().setString(str);
|
||||
return JS_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
num_toString(JSContext *cx, uintN argc, Value *vp)
|
||||
{
|
||||
return num_toStringHelper(cx, num_toString, argc, vp);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
@ -760,7 +766,7 @@ num_toLocaleString(JSContext *cx, uintN argc, Value *vp)
|
||||
* Create the string, move back to bytes to make string twiddling
|
||||
* a bit easier and so we can insert platform charset seperators.
|
||||
*/
|
||||
if (!num_toString(cx, 0, vp))
|
||||
if (!num_toStringHelper(cx, num_toLocaleString, 0, vp))
|
||||
return JS_FALSE;
|
||||
JS_ASSERT(vp->isString());
|
||||
JSAutoByteString numBytes(cx, vp->toString());
|
||||
@ -870,7 +876,7 @@ js_num_valueOf(JSContext *cx, uintN argc, Value *vp)
|
||||
|
||||
double d;
|
||||
bool ok;
|
||||
if (!BoxedPrimitiveMethodGuard(cx, args, &d, &ok))
|
||||
if (!BoxedPrimitiveMethodGuard(cx, args, js_num_valueOf, &d, &ok))
|
||||
return ok;
|
||||
|
||||
args.rval().setNumber(d);
|
||||
@ -881,7 +887,7 @@ js_num_valueOf(JSContext *cx, uintN argc, Value *vp)
|
||||
#define MAX_PRECISION 100
|
||||
|
||||
static JSBool
|
||||
num_to(JSContext *cx, JSDToStrMode zeroArgMode, JSDToStrMode oneArgMode,
|
||||
num_to(JSContext *cx, Native native, JSDToStrMode zeroArgMode, JSDToStrMode oneArgMode,
|
||||
jsint precisionMin, jsint precisionMax, jsint precisionOffset,
|
||||
CallArgs args)
|
||||
{
|
||||
@ -891,7 +897,7 @@ num_to(JSContext *cx, JSDToStrMode zeroArgMode, JSDToStrMode oneArgMode,
|
||||
|
||||
double d;
|
||||
bool ok;
|
||||
if (!BoxedPrimitiveMethodGuard(cx, args, &d, &ok))
|
||||
if (!BoxedPrimitiveMethodGuard(cx, args, native, &d, &ok))
|
||||
return ok;
|
||||
|
||||
double precision;
|
||||
@ -930,23 +936,23 @@ num_to(JSContext *cx, JSDToStrMode zeroArgMode, JSDToStrMode oneArgMode,
|
||||
static JSBool
|
||||
num_toFixed(JSContext *cx, uintN argc, Value *vp)
|
||||
{
|
||||
return num_to(cx, DTOSTR_FIXED, DTOSTR_FIXED, -20, MAX_PRECISION, 0,
|
||||
return num_to(cx, num_toFixed, DTOSTR_FIXED, DTOSTR_FIXED, -20, MAX_PRECISION, 0,
|
||||
CallArgsFromVp(argc, vp));
|
||||
}
|
||||
|
||||
static JSBool
|
||||
num_toExponential(JSContext *cx, uintN argc, Value *vp)
|
||||
{
|
||||
return num_to(cx, DTOSTR_STANDARD_EXPONENTIAL, DTOSTR_EXPONENTIAL, 0, MAX_PRECISION, 1,
|
||||
CallArgsFromVp(argc, vp));
|
||||
return num_to(cx, num_toExponential, DTOSTR_STANDARD_EXPONENTIAL, DTOSTR_EXPONENTIAL, 0,
|
||||
MAX_PRECISION, 1, CallArgsFromVp(argc, vp));
|
||||
}
|
||||
|
||||
static JSBool
|
||||
num_toPrecision(JSContext *cx, uintN argc, Value *vp)
|
||||
{
|
||||
if (argc == 0 || vp[2].isUndefined())
|
||||
return num_toString(cx, 0, vp);
|
||||
return num_to(cx, DTOSTR_STANDARD, DTOSTR_PRECISION, 1, MAX_PRECISION, 0,
|
||||
return num_toStringHelper(cx, num_toPrecision, 0, vp);
|
||||
return num_to(cx, num_toPrecision, DTOSTR_STANDARD, DTOSTR_PRECISION, 1, MAX_PRECISION, 0,
|
||||
CallArgsFromVp(argc, vp));
|
||||
}
|
||||
|
||||
|
@ -7090,14 +7090,12 @@ js::ReportIncompatibleMethod(JSContext *cx, CallReceiver call, Class *clasp)
|
||||
}
|
||||
|
||||
bool
|
||||
js::HandleNonGenericMethodClassMismatch(JSContext *cx, CallArgs args, Class *clasp)
|
||||
js::HandleNonGenericMethodClassMismatch(JSContext *cx, CallArgs args, Native native, Class *clasp)
|
||||
{
|
||||
if (args.thisv().isObject()) {
|
||||
JSObject &thisObj = args.thisv().toObject();
|
||||
if (thisObj.isProxy()) {
|
||||
Native native = args.callee().getFunctionPrivate()->native();
|
||||
if (thisObj.isProxy())
|
||||
return Proxy::nativeCall(cx, &thisObj, clasp, native, args);
|
||||
}
|
||||
}
|
||||
|
||||
ReportIncompatibleMethod(cx, args, clasp);
|
||||
|
@ -2206,7 +2206,7 @@ ReportIncompatibleMethod(JSContext *cx, CallReceiver call, Class *clasp);
|
||||
* any effectful operations are performed.
|
||||
*/
|
||||
inline JSObject *
|
||||
NonGenericMethodGuard(JSContext *cx, CallArgs args, Class *clasp, bool *ok);
|
||||
NonGenericMethodGuard(JSContext *cx, CallArgs args, Native native, Class *clasp, bool *ok);
|
||||
|
||||
/*
|
||||
* NonGenericMethodGuard tests args.thisv's class using 'clasp'. If more than
|
||||
@ -2216,7 +2216,7 @@ NonGenericMethodGuard(JSContext *cx, CallArgs args, Class *clasp, bool *ok);
|
||||
* for error reporting (clasp->name).
|
||||
*/
|
||||
extern bool
|
||||
HandleNonGenericMethodClassMismatch(JSContext *cx, CallArgs args, Class *clasp);
|
||||
HandleNonGenericMethodClassMismatch(JSContext *cx, CallArgs args, Native native, Class *clasp);
|
||||
|
||||
/*
|
||||
* Implement the extraction of a primitive from a value as needed for the
|
||||
@ -2227,7 +2227,7 @@ HandleNonGenericMethodClassMismatch(JSContext *cx, CallArgs args, Class *clasp);
|
||||
*/
|
||||
template <typename T>
|
||||
inline bool
|
||||
BoxedPrimitiveMethodGuard(JSContext *cx, CallArgs args, T *v, bool *ok);
|
||||
BoxedPrimitiveMethodGuard(JSContext *cx, CallArgs args, Native native, T *v, bool *ok);
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
|
@ -1734,7 +1734,7 @@ class PrimitiveBehavior<double> {
|
||||
} /* namespace detail */
|
||||
|
||||
inline JSObject *
|
||||
NonGenericMethodGuard(JSContext *cx, CallArgs args, Class *clasp, bool *ok)
|
||||
NonGenericMethodGuard(JSContext *cx, CallArgs args, Native native, Class *clasp, bool *ok)
|
||||
{
|
||||
const Value &thisv = args.thisv();
|
||||
if (thisv.isObject()) {
|
||||
@ -1745,13 +1745,13 @@ NonGenericMethodGuard(JSContext *cx, CallArgs args, Class *clasp, bool *ok)
|
||||
}
|
||||
}
|
||||
|
||||
*ok = HandleNonGenericMethodClassMismatch(cx, args, clasp);
|
||||
*ok = HandleNonGenericMethodClassMismatch(cx, args, native, clasp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline bool
|
||||
BoxedPrimitiveMethodGuard(JSContext *cx, CallArgs args, T *v, bool *ok)
|
||||
BoxedPrimitiveMethodGuard(JSContext *cx, CallArgs args, Native native, T *v, bool *ok)
|
||||
{
|
||||
typedef detail::PrimitiveBehavior<T> Behavior;
|
||||
|
||||
@ -1761,7 +1761,7 @@ BoxedPrimitiveMethodGuard(JSContext *cx, CallArgs args, T *v, bool *ok)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!NonGenericMethodGuard(cx, args, Behavior::getClass(), ok))
|
||||
if (!NonGenericMethodGuard(cx, args, native, Behavior::getClass(), ok))
|
||||
return false;
|
||||
|
||||
*v = Behavior::extract(thisv.toObject().getPrimitiveThis());
|
||||
|
@ -562,7 +562,7 @@ regexp_toString(JSContext *cx, uintN argc, Value *vp)
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
bool ok;
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, &RegExpClass, &ok);
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, regexp_toString, &RegExpClass, &ok);
|
||||
if (!obj)
|
||||
return ok;
|
||||
|
||||
@ -625,8 +625,6 @@ SwapRegExpInternals(JSContext *cx, JSObject *obj, Value *rval, JSString *str, ui
|
||||
return true;
|
||||
}
|
||||
|
||||
enum ExecType { RegExpExec, RegExpTest };
|
||||
|
||||
/*
|
||||
* ES5 15.10.6.2 (and 15.10.6.3, which calls 15.10.6.2).
|
||||
*
|
||||
@ -634,13 +632,13 @@ enum ExecType { RegExpExec, RegExpTest };
|
||||
* |execType| to perform this optimization.
|
||||
*/
|
||||
static JSBool
|
||||
ExecuteRegExp(JSContext *cx, ExecType execType, uintN argc, Value *vp)
|
||||
ExecuteRegExp(JSContext *cx, Native native, uintN argc, Value *vp)
|
||||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
/* Step 1. */
|
||||
bool ok;
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, &RegExpClass, &ok);
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, native, &RegExpClass, &ok);
|
||||
if (!obj)
|
||||
return ok;
|
||||
|
||||
@ -684,7 +682,7 @@ ExecuteRegExp(JSContext *cx, ExecType execType, uintN argc, Value *vp)
|
||||
|
||||
/* Steps 8-21. */
|
||||
size_t lastIndexInt(i);
|
||||
if (!re->execute(cx, res, input, &lastIndexInt, execType == RegExpTest, &args.rval()))
|
||||
if (!re->execute(cx, res, input, &lastIndexInt, native == js_regexp_test, &args.rval()))
|
||||
return false;
|
||||
|
||||
/* Step 11 (with sticky extension). */
|
||||
@ -702,14 +700,14 @@ ExecuteRegExp(JSContext *cx, ExecType execType, uintN argc, Value *vp)
|
||||
JSBool
|
||||
js_regexp_exec(JSContext *cx, uintN argc, Value *vp)
|
||||
{
|
||||
return ExecuteRegExp(cx, RegExpExec, argc, vp);
|
||||
return ExecuteRegExp(cx, js_regexp_exec, argc, vp);
|
||||
}
|
||||
|
||||
/* ES5 15.10.6.3. */
|
||||
JSBool
|
||||
js_regexp_test(JSContext *cx, uintN argc, Value *vp)
|
||||
{
|
||||
if (!ExecuteRegExp(cx, RegExpTest, argc, vp))
|
||||
if (!ExecuteRegExp(cx, js_regexp_test, argc, vp))
|
||||
return false;
|
||||
if (!vp->isTrue())
|
||||
vp->setBoolean(false);
|
||||
@ -789,7 +787,7 @@ regexp_compile(JSContext *cx, uintN argc, Value *vp)
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
bool ok;
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, &RegExpClass, &ok);
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, regexp_compile, &RegExpClass, &ok);
|
||||
if (!obj)
|
||||
return ok;
|
||||
|
||||
|
@ -460,7 +460,7 @@ str_toSource(JSContext *cx, uintN argc, Value *vp)
|
||||
|
||||
JSString *str;
|
||||
bool ok;
|
||||
if (!BoxedPrimitiveMethodGuard(cx, args, &str, &ok))
|
||||
if (!BoxedPrimitiveMethodGuard(cx, args, str_toSource, &str, &ok))
|
||||
return ok;
|
||||
|
||||
str = js_QuoteString(cx, str, '"');
|
||||
@ -508,7 +508,7 @@ js_str_toString(JSContext *cx, uintN argc, Value *vp)
|
||||
|
||||
JSString *str;
|
||||
bool ok;
|
||||
if (!BoxedPrimitiveMethodGuard(cx, args, &str, &ok))
|
||||
if (!BoxedPrimitiveMethodGuard(cx, args, js_str_toString, &str, &ok))
|
||||
return ok;
|
||||
|
||||
args.rval().setString(str);
|
||||
|
@ -1386,7 +1386,7 @@ class TypedArrayTemplate
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
bool ok;
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, fastClass(), &ok);
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, fun_subarray, fastClass(), &ok);
|
||||
if (!obj)
|
||||
return ok;
|
||||
|
||||
@ -1439,7 +1439,7 @@ class TypedArrayTemplate
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
bool ok;
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, fastClass(), &ok);
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, fun_set, fastClass(), &ok);
|
||||
if (!obj)
|
||||
return ok;
|
||||
|
||||
|
@ -105,7 +105,7 @@ WeakMap_has(JSContext *cx, uintN argc, Value *vp)
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
bool ok;
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, &WeakMapClass, &ok);
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, WeakMap_has, &WeakMapClass, &ok);
|
||||
if (!obj)
|
||||
return ok;
|
||||
|
||||
@ -136,7 +136,7 @@ WeakMap_get(JSContext *cx, uintN argc, Value *vp)
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
bool ok;
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, &WeakMapClass, &ok);
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, WeakMap_get, &WeakMapClass, &ok);
|
||||
if (!obj)
|
||||
return ok;
|
||||
|
||||
@ -167,7 +167,7 @@ WeakMap_delete(JSContext *cx, uintN argc, Value *vp)
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
bool ok;
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, &WeakMapClass, &ok);
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, WeakMap_delete, &WeakMapClass, &ok);
|
||||
if (!obj)
|
||||
return ok;
|
||||
|
||||
@ -199,7 +199,7 @@ WeakMap_set(JSContext *cx, uintN argc, Value *vp)
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
bool ok;
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, &WeakMapClass, &ok);
|
||||
JSObject *obj = NonGenericMethodGuard(cx, args, WeakMap_set, &WeakMapClass, &ok);
|
||||
if (!obj)
|
||||
return ok;
|
||||
|
||||
|
@ -739,7 +739,7 @@ CrossCompartmentWrapper::nativeCall(JSContext *cx, JSObject *wrapper, Class *cla
|
||||
JS_ASSERT_IF(!srcArgs.calleev().isUndefined(),
|
||||
srcArgs.callee().getFunctionPrivate()->native() == native);
|
||||
JS_ASSERT(&srcArgs.thisv().toObject() == wrapper);
|
||||
JS_ASSERT(!UnwrapObject(wrapper)->isProxy());
|
||||
JS_ASSERT(!UnwrapObject(wrapper)->isCrossCompartmentWrapper());
|
||||
|
||||
JSObject *wrapped = wrappedObject(wrapper);
|
||||
AutoCompartment call(cx, wrapped);
|
||||
|
Loading…
Reference in New Issue
Block a user