зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1154923 - Add a version of assertSameCompartment that works in all versions. r=terrence
Use it in initFromOptions and finishParseTask.
This commit is contained in:
Родитель
5e9d303d47
Коммит
bb3afa86eb
|
@ -21,7 +21,6 @@
|
|||
|
||||
namespace js {
|
||||
|
||||
#ifdef JS_CRASH_DIAGNOSTICS
|
||||
class CompartmentChecker
|
||||
{
|
||||
JSCompartment* compartment;
|
||||
|
@ -135,7 +134,6 @@ class CompartmentChecker
|
|||
check(desc.value());
|
||||
}
|
||||
};
|
||||
#endif /* JS_CRASH_DIAGNOSTICS */
|
||||
|
||||
/*
|
||||
* Don't perform these checks when called from a finalizer. The checking
|
||||
|
@ -146,6 +144,13 @@ class CompartmentChecker
|
|||
return; \
|
||||
CompartmentChecker c(cx)
|
||||
|
||||
template <class T1> inline void
|
||||
releaseAssertSameCompartment(ExclusiveContext* cx, const T1& t1)
|
||||
{
|
||||
START_ASSERT_SAME_COMPARTMENT();
|
||||
c.check(t1);
|
||||
}
|
||||
|
||||
template <class T1> inline void
|
||||
assertSameCompartment(ExclusiveContext* cx, const T1& t1)
|
||||
{
|
||||
|
|
|
@ -1684,7 +1684,7 @@ ScriptSourceObject::create(ExclusiveContext* cx, ScriptSource* source)
|
|||
ScriptSourceObject::initFromOptions(JSContext* cx, HandleScriptSource source,
|
||||
const ReadOnlyCompileOptions& options)
|
||||
{
|
||||
assertSameCompartment(cx, source);
|
||||
releaseAssertSameCompartment(cx, source);
|
||||
MOZ_ASSERT(source->getReservedSlot(ELEMENT_SLOT).isMagic(JS_GENERIC_MAGIC));
|
||||
MOZ_ASSERT(source->getReservedSlot(ELEMENT_PROPERTY_SLOT).isMagic(JS_GENERIC_MAGIC));
|
||||
MOZ_ASSERT(source->getReservedSlot(INTRODUCTION_SCRIPT_SLOT).isMagic(JS_GENERIC_MAGIC));
|
||||
|
|
|
@ -1171,7 +1171,7 @@ GlobalHelperThreadState::finishParseTask(JSContext* maybecx, JSRuntime* rt, Pars
|
|||
return nullptr;
|
||||
|
||||
RootedScript script(rt, parseTask->script);
|
||||
assertSameCompartment(cx, script);
|
||||
releaseAssertSameCompartment(cx, script);
|
||||
|
||||
// Report out of memory errors eagerly, or errors could be malformed.
|
||||
if (parseTask->outOfMemory) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче