Fix browser bustage from merge

This commit is contained in:
Luke Wagner 2010-07-04 19:48:36 -07:00
Родитель 126fe01c4e
Коммит 4ed212c4de
13 изменённых файлов: 69 добавлений и 57 удалений

Просмотреть файл

@ -1861,7 +1861,7 @@ nsDOMClassInfo::ObjectIsNativeWrapper(JSContext* cx, JSObject* obj)
}
#endif
JSPropertyOp op = obj->getClass()->getProperty;
JSPropertyOp op = obj->getJSClass()->getProperty;
return !!op && (op == sXPCNativeWrapperGetPropertyOp ||
op == sXrayWrapperPropertyHolderGetPropertyOp);
}

Просмотреть файл

@ -116,7 +116,7 @@ TestShellCommandParent::SetCallback(JSContext* aCx,
JSBool
TestShellCommandParent::RunCallback(const nsString& aResponse)
{
NS_ENSURE_TRUE(mCallback && mCx, JS_FALSE);
NS_ENSURE_TRUE(mCallback != JSVAL_NULL && mCx, JS_FALSE);
JSAutoRequest ar(mCx);

Просмотреть файл

@ -737,7 +737,7 @@ FullTrustSecMan::CanAccess(PRUint32 aAction,
JSObject * aJSObject,
nsISupports *aObj,
nsIClassInfo *aClassInfo,
jsval aName,
jsid aName,
void * *aPolicy)
{
return NS_OK;
@ -747,7 +747,7 @@ NS_IMETHODIMP
FullTrustSecMan::CheckPropertyAccess(JSContext * aJSContext,
JSObject * aJSObject,
const char *aClassName,
jsval aProperty,
jsid aProperty,
PRUint32 aAction)
{
return NS_OK;

Просмотреть файл

@ -195,7 +195,7 @@ ObjectWrapperChild::jsval_to_JSVariant(JSContext* cx, jsval from, JSVariant* to)
if (JSVAL_IS_INT(from))
*to = JSVAL_TO_INT(from);
else if (JSVAL_IS_DOUBLE(from))
*to = *JSVAL_TO_DOUBLE(from);
*to = JSVAL_TO_DOUBLE(from);
else return false;
return true;
case JSTYPE_BOOLEAN:
@ -216,7 +216,7 @@ JSObject_from_PObjectWrapperChild(JSContext*,
{
const ObjectWrapperChild* owc =
static_cast<const ObjectWrapperChild*>(from);
*to = owc ? owc->mObj : JSVAL_NULL;
*to = owc ? owc->mObj : NULL;
return true;
}
@ -263,7 +263,7 @@ ObjectWrapperChild::jsval_from_JSVariant(JSContext* cx, const JSVariant& from,
*to = INT_TO_JSVAL(from.get_int());
return true;
case JSVariant::Tdouble:
return !!JS_NewDoubleValue(cx, from.get_double(), to);
return !!JS_NewNumberValue(cx, from.get_double(), to);
case JSVariant::Tbool:
*to = BOOLEAN_TO_JSVAL(from.get_bool());
return true;
@ -444,7 +444,7 @@ ObjectWrapperChild::AnswerNewEnumerateInit(/* no in-parameters */
JSObject* state = JS_NewObjectWithGivenProto(cx, clasp, NULL, NULL);
if (!state)
return false;
AutoValueRooter tvr(cx, state);
AutoObjectRooter tvr(cx, state);
for (JSObject* proto = mObj;
proto;

Просмотреть файл

@ -230,7 +230,7 @@ ObjectWrapperParent::GetJSObject(JSContext* cx) const
static ObjectWrapperParent*
Unwrap(JSContext* cx, JSObject* obj)
{
while (obj->getClass() != &ObjectWrapperParent::sCPOW_JSClass.base)
while (obj->getJSClass() != &ObjectWrapperParent::sCPOW_JSClass.base)
if (!(obj = obj->getProto()))
return NULL;
@ -275,7 +275,7 @@ ObjectWrapperParent::jsval_to_JSVariant(JSContext* cx, jsval from,
if (JSVAL_IS_INT(from))
*to = JSVAL_TO_INT(from);
else if (JSVAL_IS_DOUBLE(from))
*to = *JSVAL_TO_DOUBLE(from);
*to = JSVAL_TO_DOUBLE(from);
else return false;
return true;
case JSTYPE_BOOLEAN:
@ -310,7 +310,7 @@ ObjectWrapperParent::jsval_from_JSVariant(JSContext* cx, const JSVariant& from,
*to = INT_TO_JSVAL(from.get_int());
return true;
case JSVariant::Tdouble:
return !!JS_NewDoubleValue(cx, from.get_double(), to);
return !!JS_NewNumberValue(cx, from.get_double(), to);
case JSVariant::Tbool:
*to = BOOLEAN_TO_JSVAL(from.get_bool());
return true;
@ -379,10 +379,12 @@ jsid_from_nsString(JSContext* cx, const nsString& from, jsid* to)
}
static bool
jsval_to_nsString(JSContext* cx, jsval from, nsString* to)
jsval_to_nsString(JSContext* cx, jsid from, nsString* to)
{
JSString* str;
if ((str = JS_ValueToString(cx, from))) {
jsval idval;
if (JS_IdToValue(cx, from, &idval) &&
(str = JS_ValueToString(cx, idval))) {
*to = JS_GetStringChars(str);
return true;
}
@ -390,7 +392,7 @@ jsval_to_nsString(JSContext* cx, jsval from, nsString* to)
}
/*static*/ JSBool
ObjectWrapperParent::CPOW_AddProperty(JSContext *cx, JSObject *obj, jsval id,
ObjectWrapperParent::CPOW_AddProperty(JSContext *cx, JSObject *obj, jsid id,
jsval *vp)
{
CPOW_LOG(("Calling CPOW_AddProperty (%s)...",
@ -417,7 +419,7 @@ ObjectWrapperParent::CPOW_AddProperty(JSContext *cx, JSObject *obj, jsval id,
}
/*static*/ JSBool
ObjectWrapperParent::CPOW_GetProperty(JSContext *cx, JSObject *obj, jsval id,
ObjectWrapperParent::CPOW_GetProperty(JSContext *cx, JSObject *obj, jsid id,
jsval *vp)
{
CPOW_LOG(("Calling CPOW_GetProperty (%s)...",
@ -444,7 +446,7 @@ ObjectWrapperParent::CPOW_GetProperty(JSContext *cx, JSObject *obj, jsval id,
}
/*static*/ JSBool
ObjectWrapperParent::CPOW_SetProperty(JSContext *cx, JSObject *obj, jsval id,
ObjectWrapperParent::CPOW_SetProperty(JSContext *cx, JSObject *obj, jsid id,
jsval *vp)
{
CPOW_LOG(("Calling CPOW_SetProperty (%s)...",
@ -473,7 +475,7 @@ ObjectWrapperParent::CPOW_SetProperty(JSContext *cx, JSObject *obj, jsval id,
}
/*static*/ JSBool
ObjectWrapperParent::CPOW_DelProperty(JSContext *cx, JSObject *obj, jsval id,
ObjectWrapperParent::CPOW_DelProperty(JSContext *cx, JSObject *obj, jsid id,
jsval *vp)
{
CPOW_LOG(("Calling CPOW_DelProperty (%s)...",
@ -579,7 +581,7 @@ ObjectWrapperParent::CPOW_NewEnumerate(JSContext *cx, JSObject *obj,
}
/*static*/ JSBool
ObjectWrapperParent::CPOW_NewResolve(JSContext *cx, JSObject *obj, jsval id,
ObjectWrapperParent::CPOW_NewResolve(JSContext *cx, JSObject *obj, jsid id,
uintN flags, JSObject **objp)
{
CPOW_LOG(("Calling CPOW_NewResolve (%s)...",
@ -605,11 +607,9 @@ ObjectWrapperParent::CPOW_NewResolve(JSContext *cx, JSObject *obj, jsval id,
!JSObject_from_PObjectWrapperParent(cx, out_pobj, objp))
return JS_FALSE;
jsid interned_id;
if (*objp &&
JS_ValueToId(cx, id, &interned_id)) {
if (*objp) {
AutoResolveFlag arf(cx, *objp);
JS_DefinePropertyById(cx, *objp, interned_id, JSVAL_VOID, NULL, NULL,
JS_DefinePropertyById(cx, *objp, id, JSVAL_VOID, NULL, NULL,
JSPROP_ENUMERATE);
}
return JS_TRUE;
@ -707,7 +707,7 @@ ObjectWrapperParent::CPOW_Construct(JSContext *cx, JSObject *obj, uintN argc,
}
/*static*/ JSBool
ObjectWrapperParent::CPOW_HasInstance(JSContext *cx, JSObject *obj, jsval v,
ObjectWrapperParent::CPOW_HasInstance(JSContext *cx, JSObject *obj, const jsval *v,
JSBool *bp)
{
CPOW_LOG(("Calling CPOW_HasInstance..."));
@ -722,7 +722,7 @@ ObjectWrapperParent::CPOW_HasInstance(JSContext *cx, JSObject *obj, jsval v,
JSVariant in_v;
if (!jsval_to_JSVariant(cx, v, &in_v))
if (!jsval_to_JSVariant(cx, *v, &in_v))
return JS_FALSE;
return (self->Manager()->RequestRunToCompletion() &&
@ -732,7 +732,7 @@ ObjectWrapperParent::CPOW_HasInstance(JSContext *cx, JSObject *obj, jsval v,
}
/*static*/ JSBool
ObjectWrapperParent::CPOW_Equality(JSContext *cx, JSObject *obj, jsval v,
ObjectWrapperParent::CPOW_Equality(JSContext *cx, JSObject *obj, const jsval *v,
JSBool *bp)
{
CPOW_LOG(("Calling CPOW_Equality..."));
@ -743,10 +743,10 @@ ObjectWrapperParent::CPOW_Equality(JSContext *cx, JSObject *obj, jsval v,
if (!self)
return with_error(cx, JS_FALSE, "Unwrapping failed in CPOW_Equality");
if (JSVAL_IS_PRIMITIVE(v))
if (JSVAL_IS_PRIMITIVE(*v))
return JS_TRUE;
ObjectWrapperParent* other = Unwrap(cx, JSVAL_TO_OBJECT(v));
ObjectWrapperParent* other = Unwrap(cx, JSVAL_TO_OBJECT(*v));
if (!other)
return JS_TRUE;

Просмотреть файл

@ -88,16 +88,16 @@ private:
mutable JSObject* mObj;
static JSBool
CPOW_AddProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
CPOW_AddProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp);
static JSBool
CPOW_DelProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
CPOW_DelProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp);
static JSBool
CPOW_GetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
CPOW_GetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp);
static JSBool
CPOW_SetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
CPOW_SetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp);
JSBool NewEnumerateInit(JSContext* cx, jsval* statep, jsid* idp);
JSBool NewEnumerateNext(JSContext* cx, jsval* statep, jsid* idp);
@ -107,7 +107,7 @@ private:
jsval *statep, jsid *idp);
static JSBool
CPOW_NewResolve(JSContext *cx, JSObject *obj, jsval id, uintN flags,
CPOW_NewResolve(JSContext *cx, JSObject *obj, jsid id, uintN flags,
JSObject **objp);
static JSBool
@ -125,10 +125,10 @@ private:
jsval *rval);
static JSBool
CPOW_HasInstance(JSContext *cx, JSObject *obj, jsval v, JSBool *bp);
CPOW_HasInstance(JSContext *cx, JSObject *obj, const jsval *v, JSBool *bp);
static JSBool
CPOW_Equality(JSContext *cx, JSObject *obj, jsval v, JSBool *bp);
CPOW_Equality(JSContext *cx, JSObject *obj, const jsval *v, JSBool *bp);
static bool jsval_to_JSVariant(JSContext* cx, jsval from, JSVariant* to);
static bool jsval_from_JSVariant(JSContext* cx, const JSVariant& from,

Просмотреть файл

@ -2573,6 +2573,10 @@ obj_getOwnPropertyNames(JSContext *cx, uintN argc, Value *vp)
if (!str)
return false;
vals[i].setString(str);
} else if (JSID_IS_ATOM(id)) {
vals[i].setString(JSID_TO_STRING(id));
} else {
vals[i].setObject(*JSID_TO_OBJECT(id));
}
}

Просмотреть файл

@ -66,6 +66,12 @@ CastAsPropertyOp(JSObject *object)
return JS_DATA_TO_FUNC_PTR(PropertyOp, object);
}
static inline JSPropertyOp
CastAsJSPropertyOp(JSObject *object)
{
return JS_DATA_TO_FUNC_PTR(JSPropertyOp, object);
}
inline JSObject *
CastAsObject(PropertyOp op)
{

Просмотреть файл

@ -241,7 +241,7 @@ AccessCheck::needsSystemOnlyWrapper(JSObject *obj)
void
AccessCheck::deny(JSContext *cx, jsid id)
{
if (id == JSVID_VOID) {
if (id == JSID_VOID) {
JS_ReportError(cx, "Permission denied to access object");
} else {
jsval idval;
@ -273,7 +273,7 @@ ExposedPropertiesOnly::check(JSContext *cx, JSObject *wrapper, jsid id, bool set
return true; // Allow
}
if (id == JSVAL_VOID) {
if (id == JSID_VOID) {
// This will force the caller to call us back for individual property accesses.
perm = PermitPropertyAccess;
return true;

Просмотреть файл

@ -66,7 +66,7 @@ static const Permission DenyAccess = JSWrapper::DenyAccess;
template <typename Policy>
static bool
Filter(JSContext *cx, JSObject *wrapper, AutoValueVector &props)
Filter(JSContext *cx, JSObject *wrapper, AutoIdVector &props)
{
size_t w = 0;
for (size_t n = 0; n < props.length(); ++n) {
@ -98,7 +98,7 @@ CheckAndReport(JSContext *cx, JSObject *wrapper, jsid id, bool set, Permission &
template <typename Base, typename Policy>
bool
FilteringWrapper<Base, Policy>::getOwnPropertyNames(JSContext *cx, JSObject *wrapper, AutoValueVector &props)
FilteringWrapper<Base, Policy>::getOwnPropertyNames(JSContext *cx, JSObject *wrapper, AutoIdVector &props)
{
return Base::getOwnPropertyNames(cx, wrapper, props) &&
Filter<Policy>(cx, wrapper, props);
@ -106,7 +106,7 @@ FilteringWrapper<Base, Policy>::getOwnPropertyNames(JSContext *cx, JSObject *wra
template <typename Base, typename Policy>
bool
FilteringWrapper<Base, Policy>::enumerate(JSContext *cx, JSObject *wrapper, AutoValueVector &props)
FilteringWrapper<Base, Policy>::enumerate(JSContext *cx, JSObject *wrapper, AutoIdVector &props)
{
return Base::enumerate(cx, wrapper, props) &&
Filter<Policy>(cx, wrapper, props);
@ -114,7 +114,7 @@ FilteringWrapper<Base, Policy>::enumerate(JSContext *cx, JSObject *wrapper, Auto
template <typename Base, typename Policy>
bool
FilteringWrapper<Base, Policy>::enumerateOwn(JSContext *cx, JSObject *wrapper, AutoValueVector &props)
FilteringWrapper<Base, Policy>::enumerateOwn(JSContext *cx, JSObject *wrapper, AutoIdVector &props)
{
return Base::enumerateOwn(cx, wrapper, props) &&
Filter<Policy>(cx, wrapper, props);
@ -122,7 +122,7 @@ FilteringWrapper<Base, Policy>::enumerateOwn(JSContext *cx, JSObject *wrapper, A
template <typename Base, typename Policy>
bool
FilteringWrapper<Base, Policy>::iterate(JSContext *cx, JSObject *wrapper, uintN flags, jsval *vp)
FilteringWrapper<Base, Policy>::iterate(JSContext *cx, JSObject *wrapper, uintN flags, Value *vp)
{
// We refuse to trigger the iterator hook across chrome wrappers because
// we don't know how to censor custom iterator objects. Instead we trigger
@ -136,7 +136,7 @@ bool
FilteringWrapper<Base, Policy>::enter(JSContext *cx, JSObject *wrapper, jsid id, bool set)
{
Permission perm;
return CheckAndReport<Policy>(cx, wrapper, JSVAL_VOID, set, perm) &&
return CheckAndReport<Policy>(cx, wrapper, JSID_VOID, set, perm) &&
Base::enter(cx, wrapper, id, set);
}

Просмотреть файл

@ -48,10 +48,10 @@ class FilteringWrapper : public Base {
FilteringWrapper(uintN flags);
virtual ~FilteringWrapper();
virtual bool getOwnPropertyNames(JSContext *cx, JSObject *wrapper, js::AutoValueVector &props);
virtual bool enumerate(JSContext *cx, JSObject *wrapper, js::AutoValueVector &props);
virtual bool enumerateOwn(JSContext *cx, JSObject *wrapper, js::AutoValueVector &props);
virtual bool iterate(JSContext *cx, JSObject *proxy, uintN flags, jsval *vp);
virtual bool getOwnPropertyNames(JSContext *cx, JSObject *wrapper, js::AutoIdVector &props);
virtual bool enumerate(JSContext *cx, JSObject *wrapper, js::AutoIdVector &props);
virtual bool enumerateOwn(JSContext *cx, JSObject *wrapper, js::AutoIdVector &props);
virtual bool iterate(JSContext *cx, JSObject *proxy, uintN flags, js::Value *vp);
virtual bool enter(JSContext *cx, JSObject *wrapper, jsid id, bool set);

Просмотреть файл

@ -92,8 +92,8 @@ GetWrappedNative(JSObject *obj)
static JSObject *
GetWrappedNativeObjectFromHolder(JSObject *holder)
{
NS_ASSERTION(holder->getClass() == &HolderClass, "expected a native property holder object");
return JSVAL_TO_OBJECT(holder->getSlot(JSSLOT_WN_OBJ));
NS_ASSERTION(holder->getJSClass() == &HolderClass, "expected a native property holder object");
return holder->getSlot(JSSLOT_WN_OBJ).asObjectOrNull();
}
// Some DOM objects have shared properties that don't have an explicit
@ -136,11 +136,11 @@ holder_set(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
}
static bool
ResolveNativeProperty(JSContext *cx, JSObject *holder, jsval id, bool set, JSPropertyDescriptor *desc)
ResolveNativeProperty(JSContext *cx, JSObject *holder, jsid id, bool set, JSPropertyDescriptor *desc)
{
desc->obj = NULL;
NS_ASSERTION(holder->getClass() == &HolderClass, "expected a native property holder object");
NS_ASSERTION(holder->getJSClass() == &HolderClass, "expected a native property holder object");
JSObject *wnObject = GetWrappedNativeObjectFromHolder(holder);
XPCWrappedNative *wn = GetWrappedNative(wnObject);
@ -200,7 +200,7 @@ ResolveNativeProperty(JSContext *cx, JSObject *holder, jsval id, bool set, JSPro
JS_ReportError(cx, "Failed to clone function object for native getter/setter");
return false;
}
desc->getter = CastAsPropertyOp(JSVAL_TO_OBJECT(fval));
desc->getter = CastAsJSPropertyOp(JSVAL_TO_OBJECT(fval));
desc->attrs |= JSPROP_GETTER;
if (member->IsWritableAttribute()) {
desc->setter = desc->getter;;
@ -269,9 +269,11 @@ wrappedJSObject_getter(JSContext *cx, JSObject *holder, jsid id, jsval *vp)
template <typename Base>
bool
XrayWrapper<Base>::getPropertyDescriptor(JSContext *cx, JSObject *wrapper, jsid id, JSPropertyDescriptor *desc)
XrayWrapper<Base>::getPropertyDescriptor(JSContext *cx, JSObject *wrapper, jsid id, PropertyDescriptor *desc_in)
{
if (id == XPCJSRuntime::IDX_WRAPPED_JSOBJECT) {
JSPropertyDescriptor *desc = Jsvalify(desc_in);
if (id == nsXPConnect::GetRuntimeInstance()->GetStringID(XPCJSRuntime::IDX_WRAPPED_JSOBJECT)) {
desc->obj = wrapper;
desc->attrs = JSPROP_ENUMERATE|JSPROP_SHARED;
desc->getter = wrappedJSObject_getter;
@ -280,7 +282,7 @@ XrayWrapper<Base>::getPropertyDescriptor(JSContext *cx, JSObject *wrapper, jsid
desc->value = JSVAL_VOID;
return true;
}
if (!Base::getPropertyDescriptor(cx, wrapper, id, desc)) {
if (!Base::getPropertyDescriptor(cx, wrapper, id, desc_in)) {
return false;
}
if (desc->obj)
@ -290,7 +292,7 @@ XrayWrapper<Base>::getPropertyDescriptor(JSContext *cx, JSObject *wrapper, jsid
template <typename Base>
bool
XrayWrapper<Base>::getOwnPropertyDescriptor(JSContext *cx, JSObject *wrapper, jsid id, JSPropertyDescriptor *desc)
XrayWrapper<Base>::getOwnPropertyDescriptor(JSContext *cx, JSObject *wrapper, jsid id, PropertyDescriptor *desc)
{
return getPropertyDescriptor(cx, wrapper, id, desc);
}

Просмотреть файл

@ -54,9 +54,9 @@ class XrayWrapper : public Base {
virtual ~XrayWrapper();
virtual bool getPropertyDescriptor(JSContext *cx, JSObject *wrapper, jsid id,
JSPropertyDescriptor *desc);
js::PropertyDescriptor *desc);
virtual bool getOwnPropertyDescriptor(JSContext *cx, JSObject *wrapper, jsid id,
JSPropertyDescriptor *desc);
js::PropertyDescriptor *desc);
virtual bool has(JSContext *cx, JSObject *wrapper, jsid id, bool *bp);
virtual bool hasOwn(JSContext *cx, JSObject *wrapper, jsid id, bool *bp);