Bug 1320697 - Remove wrong assertion in jsscript.cpp. r=till

This commit is contained in:
Tooru Fujisawa 2016-11-29 09:08:44 +09:00
parent 1b94319fed
commit a4999f2bd1
2 changed files with 16 additions and 3 deletions

View File

@ -3126,8 +3126,6 @@ Rebase(JSScript* dst, JSScript* src, T* srcp)
static JSObject*
CloneInnerInterpretedFunction(JSContext* cx, HandleScope enclosingScope, HandleFunction srcFun)
{
/* async function should not appear as inner function. */
MOZ_ASSERT(!srcFun->isAsync());
/* NB: Keep this in sync with XDRInterpretedFunction. */
RootedObject cloneProto(cx);
if (srcFun->isStarGenerator()) {

View File

@ -1,7 +1,22 @@
// |reftest| skip-if(!xulRuntime.shell) -- needs clone
// |reftest| skip-if(!xulRuntime.shell) -- needs clone, cloneAndExecuteScript, drainJobQueue
// Async function cannot be cloned.
assertThrowsInstanceOf(() => clone(async function f() {}), TypeError);
// unwrapped async function can be cloned.
let g = newGlobal();
cloneAndExecuteScript(`
async function f() {
var a = await 1;
var b = await 2;
var c = await 3;
return a + b + c;
}
var V;
f().then(v => V = v);
drainJobQueue();
`, g);
assertEq(g.V, 6);
if (typeof reportCompare === "function")
reportCompare(true, true);