Bug 910220 part 1. Add friend API for determinining whether we're in a strict-mode script. r=waldo

This commit is contained in:
Boris Zbarsky 2013-08-31 00:21:22 -04:00
Родитель 254256eac3
Коммит 8a00f89c89
2 изменённых файлов: 17 добавлений и 0 удалений

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

@ -342,6 +342,14 @@ js::IsAtomsCompartment(JSCompartment *comp)
return comp->runtimeFromAnyThread()->isAtomsCompartment(comp);
}
JS_FRIEND_API(bool)
js::IsInNonStrictPropertySet(JSContext *cx)
{
jsbytecode *pc;
JSScript *script = cx->currentScript(&pc, JSContext::ALLOW_CROSS_COMPARTMENT);
return script && !script->strict && (js_CodeSpec[*pc].format & JOF_SET);
}
JS_FRIEND_API(bool)
js::IsFunctionObject(JSObject *obj)
{

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

@ -266,6 +266,15 @@ IsAtomsCompartment(JSCompartment *comp);
extern JS_FRIEND_API(bool)
ReportIfUndeclaredVarAssignment(JSContext *cx, JS::HandleString propname);
/*
* Returns whether we're in a non-strict property set (in that we're in a
* non-strict script and the bytecode we're on is a property set). The return
* value does NOT indicate any sort of exception was thrown: it's just a
* boolean.
*/
extern JS_FRIEND_API(bool)
IsInNonStrictPropertySet(JSContext *cx);
struct WeakMapTracer;
/*