mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 880917 - Introduce an API for callers to set the version for a compartment. r=luke
This has lower precedence than 'overrides' and running script, and higher precedence than the cx's version. We can migrate the API consumers who clearly want something like this, which will eventually let us remove the override mechanism.
This commit is contained in:
parent
f5f7bf3be5
commit
4f5d414a60
@ -3153,11 +3153,16 @@ SameZoneAs(JSObject *obj)
|
|||||||
|
|
||||||
struct JS_PUBLIC_API(CompartmentOptions) {
|
struct JS_PUBLIC_API(CompartmentOptions) {
|
||||||
ZoneSpecifier zoneSpec;
|
ZoneSpecifier zoneSpec;
|
||||||
|
bool hasVersion;
|
||||||
|
JSVersion version;
|
||||||
|
|
||||||
explicit CompartmentOptions() : zoneSpec(JS::FreshZone)
|
explicit CompartmentOptions() : zoneSpec(JS::FreshZone)
|
||||||
|
, hasVersion(false)
|
||||||
|
, version(JSVERSION_UNKNOWN)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
CompartmentOptions &setZone(ZoneSpecifier spec) { zoneSpec = spec; return *this; }
|
CompartmentOptions &setZone(ZoneSpecifier spec) { zoneSpec = spec; return *this; }
|
||||||
|
CompartmentOptions &setVersion(JSVersion version_) { hasVersion = true; version = version_; return *this; }
|
||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace JS */
|
} /* namespace JS */
|
||||||
|
@ -1536,6 +1536,9 @@ JSContext::findVersion() const
|
|||||||
if (JSScript *script = currentScript(NULL, ALLOW_CROSS_COMPARTMENT))
|
if (JSScript *script = currentScript(NULL, ALLOW_CROSS_COMPARTMENT))
|
||||||
return script->getVersion();
|
return script->getVersion();
|
||||||
|
|
||||||
|
if (compartment() && compartment()->options().hasVersion)
|
||||||
|
return compartment()->options().version;
|
||||||
|
|
||||||
return defaultVersion;
|
return defaultVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1802,6 +1802,7 @@ struct JSContext : js::ThreadSafeContext,
|
|||||||
* Return:
|
* Return:
|
||||||
* - The override version, if there is an override version.
|
* - The override version, if there is an override version.
|
||||||
* - The newest scripted frame's version, if there is such a frame.
|
* - The newest scripted frame's version, if there is such a frame.
|
||||||
|
* - The version from the compartment.
|
||||||
* - The default version.
|
* - The default version.
|
||||||
*
|
*
|
||||||
* Note: if this ever shows up in a profile, just add caching!
|
* Note: if this ever shows up in a profile, just add caching!
|
||||||
|
Loading…
Reference in New Issue
Block a user