зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1689348 - Remove unused JSExecutionContext::SetScopeChain code. r=smaug,nbp
The last use of this method was the NSPAPI plugin code which has now been removed. These non-syntactic exotic environments were used for non-standard situations and suffered numerous performance and correctness issues so are deprecated in general. Differential Revision: https://phabricator.services.mozilla.com/D111260
This commit is contained in:
Родитель
d1a47831a0
Коммит
9c32e8f115
|
@ -58,7 +58,6 @@ JSExecutionContext::JSExecutionContext(JSContext* aCx,
|
|||
mCx(aCx),
|
||||
mRealm(aCx, aGlobal),
|
||||
mRetValue(aCx),
|
||||
mScopeChain(aCx),
|
||||
mScript(aCx),
|
||||
mRv(NS_OK),
|
||||
mSkip(false),
|
||||
|
@ -67,7 +66,6 @@ JSExecutionContext::JSExecutionContext(JSContext* aCx,
|
|||
#ifdef DEBUG
|
||||
,
|
||||
mWantsReturnValue(false),
|
||||
mExpectScopeChain(false),
|
||||
mScriptUsed(false)
|
||||
#endif
|
||||
{
|
||||
|
@ -84,40 +82,12 @@ JSExecutionContext::JSExecutionContext(JSContext* aCx,
|
|||
}
|
||||
}
|
||||
|
||||
void JSExecutionContext::SetScopeChain(
|
||||
JS::HandleVector<JSObject*> aScopeChain) {
|
||||
if (mSkip) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
mExpectScopeChain = true;
|
||||
#endif
|
||||
// Now make sure to wrap the scope chain into the right compartment.
|
||||
if (!mScopeChain.reserve(aScopeChain.length())) {
|
||||
mSkip = true;
|
||||
mRv = NS_ERROR_OUT_OF_MEMORY;
|
||||
return;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < aScopeChain.length(); ++i) {
|
||||
JS::ExposeObjectToActiveJS(aScopeChain[i]);
|
||||
mScopeChain.infallibleAppend(aScopeChain[i]);
|
||||
if (!JS_WrapObject(mCx, mScopeChain[i])) {
|
||||
mSkip = true;
|
||||
mRv = NS_ERROR_OUT_OF_MEMORY;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsresult JSExecutionContext::JoinCompile(JS::OffThreadToken** aOffThreadToken) {
|
||||
if (mSkip) {
|
||||
return mRv;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(!mWantsReturnValue);
|
||||
MOZ_ASSERT(!mExpectScopeChain);
|
||||
MOZ_ASSERT(!mScript);
|
||||
|
||||
if (mEncodeBytecode) {
|
||||
|
@ -151,16 +121,6 @@ nsresult JSExecutionContext::InternalCompile(
|
|||
|
||||
MOZ_ASSERT(!mScript);
|
||||
|
||||
if (mScopeChain.length() != 0) {
|
||||
// Serialized bytecode should not be mixed with non-syntactic mode.
|
||||
// Currently, mScopeChain is only used by nsNPAPIPlugin which does not
|
||||
// support bytecode caching. This will all be removed in Bug 1689348.
|
||||
MOZ_ASSERT(!mEncodeBytecode);
|
||||
MOZ_ASSERT(mExpectScopeChain);
|
||||
|
||||
aCompileOptions.setNonSyntacticScope(true);
|
||||
}
|
||||
|
||||
if (mEncodeBytecode) {
|
||||
mScript =
|
||||
JS::CompileAndStartIncrementalEncoding(mCx, aCompileOptions, aSrcBuf);
|
||||
|
@ -235,7 +195,6 @@ nsresult JSExecutionContext::JoinDecode(JS::OffThreadToken** aOffThreadToken) {
|
|||
}
|
||||
|
||||
MOZ_ASSERT(!mWantsReturnValue);
|
||||
MOZ_ASSERT(!mExpectScopeChain);
|
||||
mScript.set(JS::FinishOffThreadScriptDecoder(mCx, *aOffThreadToken));
|
||||
*aOffThreadToken = nullptr; // Mark the token as having been finished.
|
||||
if (!mScript) {
|
||||
|
@ -266,8 +225,7 @@ nsresult JSExecutionContext::ExecScript() {
|
|||
|
||||
MOZ_ASSERT(mScript);
|
||||
|
||||
if (!(mScopeChain.empty() ? JS_ExecuteScript(mCx, mScript)
|
||||
: JS_ExecuteScript(mCx, mScopeChain, mScript))) {
|
||||
if (!JS_ExecuteScript(mCx, mScript)) {
|
||||
mSkip = true;
|
||||
mRv = EvaluationExceptionToNSResult(mCx);
|
||||
return mRv;
|
||||
|
@ -300,9 +258,7 @@ nsresult JSExecutionContext::ExecScript(
|
|||
MOZ_ASSERT(mScript);
|
||||
MOZ_ASSERT(mWantsReturnValue);
|
||||
|
||||
if (!(mScopeChain.empty()
|
||||
? JS_ExecuteScript(mCx, mScript, aRetValue)
|
||||
: JS_ExecuteScript(mCx, mScopeChain, mScript, aRetValue))) {
|
||||
if (!JS_ExecuteScript(mCx, mScript, aRetValue)) {
|
||||
mSkip = true;
|
||||
mRv = EvaluationExceptionToNSResult(mCx);
|
||||
return mRv;
|
||||
|
|
|
@ -41,9 +41,6 @@ class MOZ_STACK_CLASS JSExecutionContext final {
|
|||
// Set to a valid handle if a return value is expected.
|
||||
JS::Rooted<JS::Value> mRetValue;
|
||||
|
||||
// Scope chain in which the execution takes place.
|
||||
JS::RootedVector<JSObject*> mScopeChain;
|
||||
|
||||
// The compiled script.
|
||||
JS::Rooted<JSScript*> mScript;
|
||||
|
||||
|
@ -65,8 +62,6 @@ class MOZ_STACK_CLASS JSExecutionContext final {
|
|||
// Should we set the return value.
|
||||
bool mWantsReturnValue;
|
||||
|
||||
bool mExpectScopeChain;
|
||||
|
||||
bool mScriptUsed;
|
||||
#endif
|
||||
|
||||
|
@ -109,9 +104,6 @@ class MOZ_STACK_CLASS JSExecutionContext final {
|
|||
return *this;
|
||||
}
|
||||
|
||||
// Set the scope chain in which the code should be executed.
|
||||
void SetScopeChain(JS::HandleVector<JSObject*> aScopeChain);
|
||||
|
||||
// After getting a notification that an off-thread compilation terminated,
|
||||
// this function will take the result of the parser and move it to the main
|
||||
// thread.
|
||||
|
|
Загрузка…
Ссылка в новой задаче