static bool HandleDynamicLinkFailure(JSContext *cx, CallArgs args, AsmJSModule &module, HandlePropertyName name) { if (cx->isExceptionPending()) return false; uint32_t begin = module.offsetToEndOfUseAsm(); uint32_t end = module.funcEndBeforeCurly(); Rooted<JSFlatString*> src(cx, module.scriptSource()->substring(cx, begin, end)); if (!src) return false; RootedFunction fun(cx, NewFunction(cx, NullPtr(), nullptr, 0, JSFunction::INTERPRETED, cx->global(), name, JSFunction::FinalizeKind, TenuredObject)); if (!fun) return false; AutoNameVector formals(cx); formals.reserve(3); if (module.globalArgumentName()) formals.infallibleAppend(module.globalArgumentName()); if (module.importArgumentName()) formals.infallibleAppend(module.importArgumentName()); if (module.bufferArgumentName()) formals.infallibleAppend(module.bufferArgumentName()); CompileOptions options(cx); options.setOriginPrincipals(module.scriptSource()->originPrincipals()) .setFile(module.scriptSource()->filename()) .setCompileAndGo(false) .setNoScriptRval(false); // The exported function inherits an implicit strict context if the module // also inherited it somehow. if (module.strict()) options.strictOption = true; SourceBufferHolder srcBuf(src->chars(), end - begin, SourceBufferHolder::NoOwnership); if (!frontend::CompileFunctionBody(cx, &fun, options, formals, srcBuf)) return false; // Call the function we just recompiled. args.setCallee(ObjectValue(*fun)); return Invoke(cx, args, args.isConstructing() ? CONSTRUCT : NO_CONSTRUCT); }