mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Bug 957688 - Remove checkAccess nsIXPCScriptable hook. r=mrbkap
This commit is contained in:
parent
af7880d72a
commit
63ace2357b
@ -1585,38 +1585,6 @@ nsDOMClassInfo::Finalize(nsIXPConnectWrappedNative *wrapper, JSFreeOp *fop,
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMClassInfo::CheckAccess(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, jsid aId, uint32_t mode,
|
||||
jsval *vp, bool *_retval)
|
||||
{
|
||||
JS::Rooted<jsid> id(cx, aId);
|
||||
uint32_t mode_type = mode & JSACC_TYPEMASK;
|
||||
|
||||
if ((mode_type == JSACC_WATCH || mode_type == JSACC_PROTO) && sSecMan) {
|
||||
nsresult rv;
|
||||
JS::Rooted<JSObject*> real_obj(cx);
|
||||
if (wrapper) {
|
||||
real_obj = wrapper->GetJSObject();
|
||||
NS_ENSURE_STATE(real_obj);
|
||||
}
|
||||
else {
|
||||
real_obj = obj;
|
||||
}
|
||||
|
||||
rv =
|
||||
sSecMan->CheckPropertyAccess(cx, real_obj, mData->mName, id,
|
||||
nsIXPCSecurityManager::ACCESS_GET_PROPERTY);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
// Let XPConnect know that the access was not granted.
|
||||
*_retval = false;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMClassInfo::Call(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, const JS::CallArgs &args, bool *_retval)
|
||||
@ -3508,25 +3476,6 @@ nsWindowSH::OuterObject(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// DOM Location helper
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLocationSH::CheckAccess(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, jsid id, uint32_t mode,
|
||||
jsval *vp, bool *_retval)
|
||||
{
|
||||
if ((mode & JSACC_TYPEMASK) == JSACC_PROTO && (mode & JSACC_WRITE)) {
|
||||
// No setting location.__proto__, ever!
|
||||
|
||||
// Let XPConnect know that the access was not granted.
|
||||
*_retval = false;
|
||||
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
|
||||
return nsDOMGenericSH::CheckAccess(wrapper, cx, obj, id, mode, vp, _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLocationSH::PreCreate(nsISupports *nativeObj, JSContext *cx,
|
||||
JSObject *globalObj, JSObject **parentObj)
|
||||
|
@ -303,10 +303,6 @@ protected:
|
||||
}
|
||||
|
||||
public:
|
||||
NS_IMETHOD CheckAccess(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, jsid id, uint32_t mode,
|
||||
JS::Value *vp, bool *_retval) MOZ_OVERRIDE;
|
||||
|
||||
NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
|
||||
JSObject *globalObj, JSObject **parentObj) MOZ_OVERRIDE;
|
||||
NS_IMETHODIMP AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
|
@ -25,7 +25,6 @@
|
||||
#define DEFAULT_SCRIPTABLE_FLAGS \
|
||||
(DOM_BASE_SCRIPTABLE_FLAGS | \
|
||||
nsIXPCScriptable::WANT_NEWRESOLVE | \
|
||||
nsIXPCScriptable::WANT_CHECKACCESS | \
|
||||
nsIXPCScriptable::WANT_PRECREATE)
|
||||
|
||||
#define DOM_DEFAULT_SCRIPTABLE_FLAGS \
|
||||
|
@ -31,7 +31,7 @@ interface nsIXPConnectWrappedNative;
|
||||
* boolean to PR_TRUE before making the call. Implementations may skip writing
|
||||
* to *_retval unless they want to return PR_FALSE.
|
||||
*/
|
||||
[uuid(155d1863-2b0b-4f5e-b800-05184944156b)]
|
||||
[uuid(187b7295-255d-469c-b7b3-ce91373df24b)]
|
||||
interface nsIXPCScriptable : nsISupports
|
||||
{
|
||||
/* bitflags used for 'flags' (only 32 bits available!) */
|
||||
@ -48,7 +48,7 @@ interface nsIXPCScriptable : nsISupports
|
||||
const uint32_t WANT_NEWRESOLVE = 1 << 9;
|
||||
const uint32_t WANT_CONVERT = 1 << 10;
|
||||
const uint32_t WANT_FINALIZE = 1 << 11;
|
||||
const uint32_t WANT_CHECKACCESS = 1 << 12;
|
||||
// unused bit here!
|
||||
const uint32_t WANT_CALL = 1 << 13;
|
||||
const uint32_t WANT_CONSTRUCT = 1 << 14;
|
||||
const uint32_t WANT_HASINSTANCE = 1 << 15;
|
||||
@ -128,10 +128,6 @@ interface nsIXPCScriptable : nsISupports
|
||||
void finalize(in nsIXPConnectWrappedNative wrapper,
|
||||
in JSFreeOpPtr fop, in JSObjectPtr obj);
|
||||
|
||||
boolean checkAccess(in nsIXPConnectWrappedNative wrapper,
|
||||
in JSContextPtr cx, in JSObjectPtr obj, in jsid id,
|
||||
in uint32_t mode, in JSValPtr vp);
|
||||
|
||||
boolean call(in nsIXPConnectWrappedNative wrapper,
|
||||
in JSContextPtr cx, in JSObjectPtr obj,
|
||||
in JSCallArgsRef args);
|
||||
|
@ -67,9 +67,6 @@ XPC_MAP_CLASSNAME::GetScriptableFlags()
|
||||
#ifdef XPC_MAP_WANT_FINALIZE
|
||||
nsIXPCScriptable::WANT_FINALIZE |
|
||||
#endif
|
||||
#ifdef XPC_MAP_WANT_CHECKACCESS
|
||||
nsIXPCScriptable::WANT_CHECKACCESS |
|
||||
#endif
|
||||
#ifdef XPC_MAP_WANT_CALL
|
||||
nsIXPCScriptable::WANT_CALL |
|
||||
#endif
|
||||
@ -154,11 +151,6 @@ NS_IMETHODIMP XPC_MAP_CLASSNAME::Finalize(nsIXPConnectWrappedNative *wrapper, JS
|
||||
{NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;}
|
||||
#endif
|
||||
|
||||
#ifndef XPC_MAP_WANT_CHECKACCESS
|
||||
NS_IMETHODIMP XPC_MAP_CLASSNAME::CheckAccess(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, jsid id, uint32_t mode, JS::Value * vp, bool *_retval)
|
||||
{NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;}
|
||||
#endif
|
||||
|
||||
#ifndef XPC_MAP_WANT_CALL
|
||||
NS_IMETHODIMP XPC_MAP_CLASSNAME::Call(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, const JS::CallArgs &args, bool *_retval)
|
||||
{NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;}
|
||||
@ -237,10 +229,6 @@ NS_IMETHODIMP XPC_MAP_CLASSNAME::PostCreatePrototype(JSContext *cx, JSObject *pr
|
||||
#undef XPC_MAP_WANT_FINALIZE
|
||||
#endif
|
||||
|
||||
#ifdef XPC_MAP_WANT_CHECKACCESS
|
||||
#undef XPC_MAP_WANT_CHECKACCESS
|
||||
#endif
|
||||
|
||||
#ifdef XPC_MAP_WANT_CALL
|
||||
#undef XPC_MAP_WANT_CALL
|
||||
#endif
|
||||
|
@ -839,15 +839,6 @@ XPC_WN_Helper_Convert(JSContext *cx, HandleObject obj, JSType type, MutableHandl
|
||||
POST_HELPER_STUB
|
||||
}
|
||||
|
||||
static bool
|
||||
XPC_WN_Helper_CheckAccess(JSContext *cx, HandleObject obj, HandleId id,
|
||||
JSAccessMode mode, MutableHandleValue vp)
|
||||
{
|
||||
PRE_HELPER_STUB
|
||||
CheckAccess(wrapper, cx, obj, id, mode, vp.address(), &retval);
|
||||
POST_HELPER_STUB
|
||||
}
|
||||
|
||||
static bool
|
||||
XPC_WN_Helper_Call(JSContext *cx, unsigned argc, jsval *vp)
|
||||
{
|
||||
@ -1210,10 +1201,6 @@ XPCNativeScriptableShared::PopulateJSClass()
|
||||
else
|
||||
mJSClass.base.finalize = XPC_WN_NoHelper_Finalize;
|
||||
|
||||
// We let the rest default to nullptr unless the helper wants them...
|
||||
if (mFlags.WantCheckAccess())
|
||||
mJSClass.base.checkAccess = XPC_WN_Helper_CheckAccess;
|
||||
|
||||
js::ObjectOps *ops = &mJSClass.base.ops;
|
||||
ops->enumerate = XPC_WN_JSOp_Enumerate;
|
||||
ops->thisObject = XPC_WN_JSOp_ThisObject;
|
||||
|
@ -1601,7 +1601,6 @@ public:
|
||||
bool WantNewResolve() GET_IT(WANT_NEWRESOLVE)
|
||||
bool WantConvert() GET_IT(WANT_CONVERT)
|
||||
bool WantFinalize() GET_IT(WANT_FINALIZE)
|
||||
bool WantCheckAccess() GET_IT(WANT_CHECKACCESS)
|
||||
bool WantCall() GET_IT(WANT_CALL)
|
||||
bool WantConstruct() GET_IT(WANT_CONSTRUCT)
|
||||
bool WantHasInstance() GET_IT(WANT_HASINSTANCE)
|
||||
|
Loading…
Reference in New Issue
Block a user