Bug 862380 - Pass the entered id in addition to the wrapper action to Policy::deny. r=mrbkap

This commit is contained in:
Bobby Holley 2013-05-22 22:27:15 -06:00
Родитель 5db61d9da6
Коммит a76f725f9c
2 изменённых файлов: 6 добавлений и 6 удалений

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

@ -39,7 +39,7 @@ struct Opaque : public Policy {
static bool check(JSContext *cx, JSObject *wrapper, jsid id, js::Wrapper::Action act) { static bool check(JSContext *cx, JSObject *wrapper, jsid id, js::Wrapper::Action act) {
return act == js::Wrapper::CALL; return act == js::Wrapper::CALL;
} }
static bool deny(js::Wrapper::Action act) { static bool deny(js::Wrapper::Action act, JSHandleId id) {
return false; return false;
} }
static bool allowNativeCall(JSContext *cx, JS::IsAcceptableThis test, JS::NativeImpl impl) static bool allowNativeCall(JSContext *cx, JS::IsAcceptableThis test, JS::NativeImpl impl)
@ -54,7 +54,7 @@ struct GentlyOpaque : public Policy {
static bool check(JSContext *cx, JSObject *wrapper, jsid id, js::Wrapper::Action act) { static bool check(JSContext *cx, JSObject *wrapper, jsid id, js::Wrapper::Action act) {
return false; return false;
} }
static bool deny(js::Wrapper::Action act) { static bool deny(js::Wrapper::Action act, JSHandleId id) {
return true; return true;
} }
static bool allowNativeCall(JSContext *cx, JS::IsAcceptableThis test, JS::NativeImpl impl) static bool allowNativeCall(JSContext *cx, JS::IsAcceptableThis test, JS::NativeImpl impl)
@ -74,7 +74,7 @@ struct CrossOriginAccessiblePropertiesOnly : public Policy {
static bool check(JSContext *cx, JSObject *wrapper, jsid id, js::Wrapper::Action act) { static bool check(JSContext *cx, JSObject *wrapper, jsid id, js::Wrapper::Action act) {
return AccessCheck::isCrossOriginAccessPermitted(cx, wrapper, id, act); return AccessCheck::isCrossOriginAccessPermitted(cx, wrapper, id, act);
} }
static bool deny(js::Wrapper::Action act) { static bool deny(js::Wrapper::Action act, JSHandleId id) {
return false; return false;
} }
static bool allowNativeCall(JSContext *cx, JS::IsAcceptableThis test, JS::NativeImpl impl) static bool allowNativeCall(JSContext *cx, JS::IsAcceptableThis test, JS::NativeImpl impl)
@ -88,7 +88,7 @@ struct CrossOriginAccessiblePropertiesOnly : public Policy {
struct ExposedPropertiesOnly : public Policy { struct ExposedPropertiesOnly : public Policy {
static bool check(JSContext *cx, JSObject *wrapper, jsid id, js::Wrapper::Action act); static bool check(JSContext *cx, JSObject *wrapper, jsid id, js::Wrapper::Action act);
static bool deny(js::Wrapper::Action act) { static bool deny(js::Wrapper::Action act, JSHandleId id) {
// Fail silently for GETs. // Fail silently for GETs.
return act == js::Wrapper::GET; return act == js::Wrapper::GET;
} }
@ -99,7 +99,7 @@ struct ExposedPropertiesOnly : public Policy {
struct ComponentsObjectPolicy : public Policy { struct ComponentsObjectPolicy : public Policy {
static bool check(JSContext *cx, JSObject *wrapper, jsid id, js::Wrapper::Action act); static bool check(JSContext *cx, JSObject *wrapper, jsid id, js::Wrapper::Action act);
static bool deny(js::Wrapper::Action act) { static bool deny(js::Wrapper::Action act, JSHandleId id) {
return false; return false;
} }
static bool allowNativeCall(JSContext *cx, JS::IsAcceptableThis test, JS::NativeImpl impl) { static bool allowNativeCall(JSContext *cx, JS::IsAcceptableThis test, JS::NativeImpl impl) {

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

@ -183,7 +183,7 @@ FilteringWrapper<Base, Policy>::enter(JSContext *cx, HandleObject wrapper,
return true; return true;
} }
if (!Policy::check(cx, wrapper, id, act)) { if (!Policy::check(cx, wrapper, id, act)) {
*bp = JS_IsExceptionPending(cx) ? false : Policy::deny(act); *bp = JS_IsExceptionPending(cx) ? false : Policy::deny(act, id);
return false; return false;
} }
*bp = true; *bp = true;