Bug 1341901 - Make timesAccessed property JS shell only. r=jandem

MozReview-Commit-ID: Iq8vqsFCPwj

--HG--
extra : rebase_source : 1b347f0c63f37b056ae1c0a884eb66a4594d66bd
This commit is contained in:
Christian Holler (:decoder) 2017-03-03 18:11:07 +01:00
parent 17db44beab
commit b25bd63bb7
2 changed files with 16 additions and 17 deletions

View file

@ -2582,15 +2582,6 @@ HelperThreadCount(JSContext* cx, unsigned argc, Value* vp)
return true;
}
static bool
TimesAccessed(JSContext* cx, unsigned argc, Value* vp)
{
static int32_t accessed = 0;
CallArgs args = CallArgsFromVp(argc, vp);
args.rval().setInt32(++accessed);
return true;
}
#ifdef JS_TRACE_LOGGING
static bool
EnableTraceLogger(JSContext* cx, unsigned argc, Value* vp)
@ -4843,11 +4834,6 @@ static const JSFunctionSpecWithHelp FuzzingUnsafeTestingFunctions[] = {
JS_FS_HELP_END
};
static const JSPropertySpec TestingProperties[] = {
JS_PSG("timesAccessed", TimesAccessed, 0),
JS_PS_END
};
bool
js::DefineTestingFunctions(JSContext* cx, HandleObject obj, bool fuzzingSafe_,
bool disableOOMFunctions_)
@ -4858,9 +4844,6 @@ js::DefineTestingFunctions(JSContext* cx, HandleObject obj, bool fuzzingSafe_,
disableOOMFunctions = disableOOMFunctions_;
if (!JS_DefineProperties(cx, obj, TestingProperties))
return false;
if (!fuzzingSafe) {
if (!JS_DefineFunctionsWithHelp(cx, obj, FuzzingUnsafeTestingFunctions))
return false;

View file

@ -7462,6 +7462,20 @@ static const JS::AsmJSCacheOps asmJSCacheOps = {
ShellCloseAsmJSCacheEntryForWrite
};
static bool
TimesAccessed(JSContext* cx, unsigned argc, Value* vp)
{
static int32_t accessed = 0;
CallArgs args = CallArgsFromVp(argc, vp);
args.rval().setInt32(++accessed);
return true;
}
static const JSPropertySpec TestingProperties[] = {
JS_PSG("timesAccessed", TimesAccessed, 0),
JS_PS_END
};
static JSObject*
NewGlobalObject(JSContext* cx, JS::CompartmentOptions& options,
JSPrincipals* principals)
@ -7503,6 +7517,8 @@ NewGlobalObject(JSContext* cx, JS::CompartmentOptions& options,
}
if (!js::DefineTestingFunctions(cx, glob, fuzzingSafe, disableOOMFunctions))
return nullptr;
if (!JS_DefineProperties(cx, glob, TestingProperties))
return nullptr;
if (!fuzzingSafe) {
if (!JS_DefineFunctionsWithHelp(cx, glob, fuzzing_unsafe_functions))