void WrapperPromiseCallback::Call(const Optional<JS::Handle<JS::Value> >& aValue) { AutoJSContext cx; // FIXME Bug 878849 Maybe<JSAutoCompartment> ac; if (aValue.WasPassed() && aValue.Value().isObject()) { JS::Rooted<JSObject*> rooted(cx, &aValue.Value().toObject()); ac.construct(cx, rooted); } ErrorResult rv; // If invoking callback threw an exception, run resolver's reject with the // thrown exception as argument and the synchronous flag set. Optional<JS::Handle<JS::Value> > value(cx, mCallback->Call(mNextResolver->GetParentObject(), aValue, rv, CallbackObject::eRethrowExceptions)); rv.WouldReportJSException(); if (rv.Failed() && rv.IsJSException()) { Optional<JS::Handle<JS::Value> > value(cx); rv.StealJSException(cx, &value.Value()); mNextResolver->RejectInternal(cx, value, PromiseResolver::SyncTask); return; } // Otherwise, run resolver's resolve with value and the synchronous flag // set. mNextResolver->ResolveInternal(cx, value, PromiseResolver::SyncTask); }
static void EnterCompartment(Maybe<JSAutoCompartment>& aAc, JSContext* aCx, const Optional<JS::Handle<JS::Value> >& aValue) { // FIXME Bug 878849 if (aValue.WasPassed() && aValue.Value().isObject()) { JS::Rooted<JSObject*> rooted(aCx, &aValue.Value().toObject()); aAc.construct(aCx, rooted); } }
void main(int argc, char **argv) { extern int newnsdebug; char *defargv[] = { "/bin/rc", "-i", nil }; char *nsfile, err[ERRMAX]; int add; rfork(RFNAMEG); add = 0; nsfile = "/lib/namespace"; ARGBEGIN{ case 'a': add = 1; break; case 'd': newnsdebug = 1; break; case 'n': nsfile = ARGF(); break; default: usage(); break; }ARGEND if(argc == 0) argv = defargv; if (add) addns(getuser(), nsfile); else newns(getuser(), nsfile); exec(argv[0], argv); if(!rooted(argv[0])){ rerrstr(err, sizeof err); exec(smprint("/bin/%s", argv[0]), argv); errstr(err, sizeof err); } sysfatal("exec: %s: %r", argv[0]); }