Bug 910109 (part 1) - Make jsproxy.h not depend on jsapi.h. r=luke.

--HG--
extra : rebase_source : bc2fa911e3a7feaafb778b756994e126257585a7
This commit is contained in:
Nicholas Nethercote 2013-08-28 17:20:24 -07:00
parent 2ee4f1139d
commit f4ed58505f
4 changed files with 25 additions and 7 deletions

View File

@ -9,6 +9,7 @@
#include "mozilla/Attributes.h"
#include "mozilla/Likely.h"
#include "jsapi.h"
#include "jsproxy.h"
#include "nsStringGlue.h"

View File

@ -26,8 +26,11 @@ using namespace js::gc;
using mozilla::ArrayLength;
void
js::AutoEnterPolicy::reportError(JSContext *cx, jsid id)
js::AutoEnterPolicy::reportErrorIfExceptionIsNotPending(JSContext *cx, jsid id)
{
if (JS_IsExceptionPending(cx))
return;
if (JSID_IS_VOID(id)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
JSMSG_OBJECT_ACCESS_DENIED);

View File

@ -9,13 +9,26 @@
#include "mozilla/Maybe.h"
#include "jsapi.h"
#include "jsfriendapi.h"
#include "js/CallNonGenericMethod.h"
#include "js/Class.h"
namespace js {
using JS::AutoIdVector;
using JS::CallArgs;
using JS::HandleId;
using JS::HandleObject;
using JS::HandleValue;
using JS::IsAcceptableThis;
using JS::MutableHandle;
using JS::MutableHandleObject;
using JS::MutableHandleValue;
using JS::NativeImpl;
using JS::PrivateValue;
using JS::Value;
class RegExpGuard;
class JS_FRIEND_API(Wrapper);
@ -275,12 +288,12 @@ extern JS_FRIEND_DATA(js::Class* const) OuterWindowProxyClassPtr;
inline bool IsObjectProxyClass(const Class *clasp)
{
return clasp == js::ObjectProxyClassPtr || clasp == js::OuterWindowProxyClassPtr;
return clasp == ObjectProxyClassPtr || clasp == OuterWindowProxyClassPtr;
}
inline bool IsFunctionProxyClass(const Class *clasp)
{
return clasp == js::FunctionProxyClassPtr;
return clasp == FunctionProxyClassPtr;
}
inline bool IsProxyClass(const Class *clasp)
@ -388,8 +401,8 @@ class JS_FRIEND_API(AutoEnterPolicy)
// * The policy set rv to false, indicating that we should throw.
// * The caller did not instruct us to ignore exceptions.
// * The policy did not throw itself.
if (!allow && !rv && mayThrow && !JS_IsExceptionPending(cx))
reportError(cx, id);
if (!allow && !rv && mayThrow)
reportErrorIfExceptionIsNotPending(cx, id);
}
virtual ~AutoEnterPolicy() { recordLeave(); }
@ -403,7 +416,7 @@ class JS_FRIEND_API(AutoEnterPolicy)
: context(NULL)
#endif
{};
void reportError(JSContext *cx, jsid id);
void reportErrorIfExceptionIsNotPending(JSContext *cx, jsid id);
bool allow;
bool rv;

View File

@ -8,6 +8,7 @@
#ifndef xpcpublic_h
#define xpcpublic_h
#include "jsapi.h"
#include "jsproxy.h"
#include "js/HeapAPI.h"
#include "js/GCAPI.h"