Bug 882905 - Remove hasVersion from js::CompartmentOptions. r=luke

This commit is contained in:
Bobby Holley 2013-07-02 23:30:37 -06:00
parent ed24e324cd
commit 87f528fd90
2 changed files with 6 additions and 4 deletions

View File

@ -3162,16 +3162,18 @@ SameZoneAs(JSObject *obj)
struct JS_PUBLIC_API(CompartmentOptions) {
ZoneSpecifier zoneSpec;
bool hasVersion;
JSVersion version;
explicit CompartmentOptions() : zoneSpec(JS::FreshZone)
, hasVersion(false)
, version(JSVERSION_UNKNOWN)
{}
CompartmentOptions &setZone(ZoneSpecifier spec) { zoneSpec = spec; return *this; }
CompartmentOptions &setVersion(JSVersion version_) { hasVersion = true; version = version_; return *this; }
CompartmentOptions &setVersion(JSVersion version_) {
JS_ASSERT(version_ != JSVERSION_UNKNOWN);
version = version_;
return *this;
}
};
} /* namespace JS */

View File

@ -1529,7 +1529,7 @@ JSContext::findVersion() const
if (JSScript *script = currentScript(NULL, ALLOW_CROSS_COMPARTMENT))
return script->getVersion();
if (compartment() && compartment()->options().hasVersion)
if (compartment() && compartment()->options().version != JSVERSION_UNKNOWN)
return compartment()->options().version;
return runtime()->defaultVersion();