mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 04:15:43 +00:00
Bug 741041 - Implement isProxy testing command for JS shell
--HG-- extra : rebase_source : 0beb5a22050916b5100d03314c257a48b19378ae
This commit is contained in:
parent
85f10272fb
commit
5c44072f7d
@ -10,6 +10,7 @@
|
||||
#include "jsfriendapi.h"
|
||||
#include "jsgc.h"
|
||||
#include "jsobj.h"
|
||||
#include "jsobjinlines.h"
|
||||
#include "jsprf.h"
|
||||
#include "jswrapper.h"
|
||||
|
||||
@ -142,6 +143,22 @@ GCParameter(JSContext *cx, unsigned argc, jsval *vp)
|
||||
return true;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
IsProxy(JSContext *cx, unsigned argc, jsval *vp)
|
||||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
if (argc != 1) {
|
||||
JS_ReportError(cx, "the function takes exactly one argument");
|
||||
return false;
|
||||
}
|
||||
if (!args[0].isObject()) {
|
||||
args.rval().setBoolean(false);
|
||||
return true;
|
||||
}
|
||||
args.rval().setBoolean(args[0].toObject().isProxy());
|
||||
return true;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
InternalConst(JSContext *cx, unsigned argc, jsval *vp)
|
||||
{
|
||||
@ -583,6 +600,10 @@ static JSFunctionSpecWithHelp TestingFunctions[] = {
|
||||
" Query an internal constant for the engine. See InternalConst source for\n"
|
||||
" the list of constant names."),
|
||||
|
||||
JS_FN_HELP("isProxy", IsProxy, 1, 0,
|
||||
"isProxy(obj)",
|
||||
" If true, obj is a proxy of some sort"),
|
||||
|
||||
JS_FN_HELP("mjitChunkLimit", MJitChunkLimit, 1, 0,
|
||||
"mjitChunkLimit(N)",
|
||||
" Specify limit on compiled chunk size during mjit compilation."),
|
||||
|
Loading…
Reference in New Issue
Block a user