mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-27 20:25:44 +00:00
Bug 1525924 - Part 2: Factor out WithScope::XDR r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D19006 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
b217fadccd
commit
54e18182d2
@ -724,12 +724,7 @@ XDRResult js::XDRScript(XDRState<mode>* xdr, HandleScope scriptEnclosingScope,
|
||||
MOZ_TRY(LexicalScope::XDR(xdr, scopeKind, enclosing, &scope));
|
||||
break;
|
||||
case ScopeKind::With:
|
||||
if (mode == XDR_DECODE) {
|
||||
scope = WithScope::create(cx, enclosing);
|
||||
if (!scope) {
|
||||
return xdr->fail(JS::TranscodeResult_Throw);
|
||||
}
|
||||
}
|
||||
MOZ_TRY(WithScope::XDR(xdr, enclosing, &scope));
|
||||
break;
|
||||
case ScopeKind::Eval:
|
||||
case ScopeKind::StrictEval:
|
||||
|
@ -1020,6 +1020,32 @@ template
|
||||
return static_cast<WithScope*>(scope);
|
||||
}
|
||||
|
||||
template <XDRMode mode>
|
||||
/* static */ XDRResult WithScope::XDR(XDRState<mode>* xdr,
|
||||
HandleScope enclosing,
|
||||
MutableHandleScope scope) {
|
||||
JSContext* cx = xdr->cx();
|
||||
|
||||
if (mode == XDR_DECODE) {
|
||||
scope.set(create(cx, enclosing));
|
||||
if (!scope) {
|
||||
return xdr->fail(JS::TranscodeResult_Throw);
|
||||
}
|
||||
}
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
template
|
||||
/* static */ XDRResult
|
||||
WithScope::XDR(XDRState<XDR_ENCODE>* xdr, HandleScope enclosing,
|
||||
MutableHandleScope scope);
|
||||
|
||||
template
|
||||
/* static */ XDRResult
|
||||
WithScope::XDR(XDRState<XDR_DECODE>* xdr, HandleScope enclosing,
|
||||
MutableHandleScope scope);
|
||||
|
||||
static const uint32_t EvalScopeEnvShapeFlags =
|
||||
BaseShape::QUALIFIED_VAROBJ | BaseShape::DELEGATE;
|
||||
|
||||
|
@ -773,6 +773,10 @@ class WithScope : public Scope {
|
||||
|
||||
public:
|
||||
static WithScope* create(JSContext* cx, HandleScope enclosing);
|
||||
|
||||
template <XDRMode mode>
|
||||
static XDRResult XDR(XDRState<mode>* xdr, HandleScope enclosing,
|
||||
MutableHandleScope scope);
|
||||
};
|
||||
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user