Bug 1488698 - Always use braces for if/for/while statements in js/src/vm, part 4. r=luke
authorJan de Mooij <jdemooij@mozilla.com>
Thu, 06 Sep 2018 11:13:06 +0200
changeset 435729 78d8957d12e298347c2cebe535ae565763ba361f
parent 435728 236cf9e1bd84919f1f7603d579c667a14a1ffd92
child 435730 f24489d307bedccd634b994043138d14bfc90d04
push id34618
push userbtara@mozilla.com
push dateTue, 11 Sep 2018 22:13:11 +0000
treeherdermozilla-central@1169e8a4ca2b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs1488698
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1488698 - Always use braces for if/for/while statements in js/src/vm, part 4. r=luke
js/src/vm/EnvironmentObject-inl.h
js/src/vm/EnvironmentObject.cpp
js/src/vm/EnvironmentObject.h
js/src/vm/ErrorObject.cpp
js/src/vm/ErrorObject.h
js/src/vm/ErrorReporting.cpp
js/src/vm/ForOfIterator.cpp
--- a/js/src/vm/EnvironmentObject-inl.h
+++ b/js/src/vm/EnvironmentObject-inl.h
@@ -57,31 +57,35 @@ EnvironmentObject::setAliasedBinding(JSC
     setAliasedBinding(cx, bi.location().slot(), bi.name()->asPropertyName(), v);
 }
 
 inline void
 CallObject::setAliasedFormalFromArguments(JSContext* cx, const Value& argsValue, jsid id,
                                           const Value& v)
 {
     setSlot(ArgumentsObject::SlotFromMagicScopeSlotValue(argsValue), v);
-    if (isSingleton())
+    if (isSingleton()) {
         AddTypePropertyId(cx, this, id, v);
+    }
 }
 
 }  /* namespace js */
 
 inline JSObject*
 JSObject::enclosingEnvironment() const
 {
-    if (is<js::EnvironmentObject>())
+    if (is<js::EnvironmentObject>()) {
         return &as<js::EnvironmentObject>().enclosingEnvironment();
+    }
 
-    if (is<js::DebugEnvironmentProxy>())
+    if (is<js::DebugEnvironmentProxy>()) {
         return &as<js::DebugEnvironmentProxy>().enclosingEnvironment();
+    }
 
-    if (is<js::GlobalObject>())
+    if (is<js::GlobalObject>()) {
         return nullptr;
+    }
 
     MOZ_ASSERT_IF(is<JSFunction>(), as<JSFunction>().isInterpreted());
     return &nonCCWGlobal();
 }
 
 #endif /* vm_EnvironmentObject_inl_h */
--- a/js/src/vm/EnvironmentObject.cpp
+++ b/js/src/vm/EnvironmentObject.cpp
@@ -37,18 +37,19 @@ Shape*
 js::EnvironmentCoordinateToEnvironmentShape(JSScript* script, jsbytecode* pc)
 {
     MOZ_ASSERT(JOF_OPTYPE(JSOp(*pc)) == JOF_ENVCOORD);
     ScopeIter si(script->innermostScope(pc));
     uint32_t hops = EnvironmentCoordinate(pc).hops();
     while (true) {
         MOZ_ASSERT(!si.done());
         if (si.hasSyntacticEnvironment()) {
-            if (!hops)
+            if (!hops) {
                 break;
+            }
             hops--;
         }
         si++;
     }
     return si.environmentShape();
 }
 
 static const uint32_t ENV_COORDINATE_NAME_THRESHOLD = 20;
@@ -79,43 +80,47 @@ js::EnvironmentCoordinateName(Environmen
 
     jsid id;
     EnvironmentCoordinate ec(pc);
     if (shape == cache.shape) {
         EnvironmentCoordinateNameCache::Map::Ptr p = cache.map.lookup(ec.slot());
         id = p->value();
     } else {
         Shape::Range<NoGC> r(shape);
-        while (r.front().slot() != ec.slot())
+        while (r.front().slot() != ec.slot()) {
             r.popFront();
+        }
         id = r.front().propidRaw();
     }
 
     /* Beware nameless destructuring formal. */
-    if (!JSID_IS_ATOM(id))
+    if (!JSID_IS_ATOM(id)) {
         return script->runtimeFromAnyThread()->commonNames->empty;
+    }
     return JSID_TO_ATOM(id)->asPropertyName();
 }
 
 JSScript*
 js::EnvironmentCoordinateFunctionScript(JSScript* script, jsbytecode* pc)
 {
     MOZ_ASSERT(JOF_OPTYPE(JSOp(*pc)) == JOF_ENVCOORD);
     ScopeIter si(script->innermostScope(pc));
     uint32_t hops = EnvironmentCoordinate(pc).hops();
     while (true) {
         if (si.hasSyntacticEnvironment()) {
-            if (!hops)
+            if (!hops) {
                 break;
+            }
             hops--;
         }
         si++;
     }
-    if (si.kind() != ScopeKind::Function)
+    if (si.kind() != ScopeKind::Function) {
         return nullptr;
+    }
     return si.scope()->as<FunctionScope>().script();
 }
 
 /*****************************************************************************/
 
 CallObject*
 CallObject::create(JSContext* cx, HandleShape shape, HandleObjectGroup group)
 {
@@ -137,18 +142,19 @@ CallObject*
 CallObject::createSingleton(JSContext* cx, HandleShape shape)
 {
     gc::AllocKind kind = gc::GetGCObjectKind(shape->numFixedSlots());
     MOZ_ASSERT(CanBeFinalizedInBackground(kind, &CallObject::class_));
     kind = gc::GetBackgroundAllocKind(kind);
 
     RootedObjectGroup group(cx, ObjectGroup::lazySingletonGroup(cx, /* oldGroup = */ nullptr,
                                                                 &class_, TaggedProto(nullptr)));
-    if (!group)
+    if (!group) {
         return nullptr;
+    }
 
     JSObject* obj;
     JS_TRY_VAR_OR_RETURN_NULL(cx, obj, NativeObject::create(cx, kind, gc::TenuredHeap, shape, group));
 
     MOZ_ASSERT(obj->isSingleton(),
                "group created inline above must be a singleton");
 
     return &obj->as<CallObject>();
@@ -163,36 +169,38 @@ CallObject*
 CallObject::createTemplateObject(JSContext* cx, HandleScript script, HandleObject enclosing,
                                  gc::InitialHeap heap)
 {
     Rooted<FunctionScope*> scope(cx, &script->bodyScope()->as<FunctionScope>());
     RootedShape shape(cx, scope->environmentShape());
     MOZ_ASSERT(shape->getObjectClass() == &class_);
 
     RootedObjectGroup group(cx, ObjectGroup::defaultNewGroup(cx, &class_, TaggedProto(nullptr)));
-    if (!group)
+    if (!group) {
         return nullptr;
+    }
 
     gc::AllocKind kind = gc::GetGCObjectKind(shape->numFixedSlots());
     MOZ_ASSERT(CanBeFinalizedInBackground(kind, &class_));
     kind = gc::GetBackgroundAllocKind(kind);
 
     JSObject* obj;
     JS_TRY_VAR_OR_RETURN_NULL(cx, obj, NativeObject::create(cx, kind, heap, shape, group));
 
     CallObject* callObj = &obj->as<CallObject>();
     callObj->initEnclosingEnvironment(enclosing);
 
     if (scope->hasParameterExprs()) {
         // If there are parameter expressions, all parameters are lexical and
         // have TDZ.
         for (BindingIter bi(script->bodyScope()); bi; bi++) {
             BindingLocation loc = bi.location();
-            if (loc.kind() == BindingLocation::Kind::Environment && BindingKindIsLexical(bi.kind()))
+            if (loc.kind() == BindingLocation::Kind::Environment && BindingKindIsLexical(bi.kind())) {
                 callObj->initSlot(loc.slot(), MagicValue(JS_UNINITIALIZED_LEXICAL));
+            }
         }
     }
 
     return callObj;
 }
 
 /*
  * Construct a call object for the given bindings.  If this is a call object
@@ -201,90 +209,98 @@ CallObject::createTemplateObject(JSConte
  * must be null.
  */
 CallObject*
 CallObject::create(JSContext* cx, HandleFunction callee, HandleObject enclosing)
 {
     RootedScript script(cx, callee->nonLazyScript());
     gc::InitialHeap heap = script->treatAsRunOnce() ? gc::TenuredHeap : gc::DefaultHeap;
     CallObject* callobj = CallObject::createTemplateObject(cx, script, enclosing, heap);
-    if (!callobj)
+    if (!callobj) {
         return nullptr;
+    }
 
     callobj->initFixedSlot(CALLEE_SLOT, ObjectValue(*callee));
 
     if (script->treatAsRunOnce()) {
         Rooted<CallObject*> ncallobj(cx, callobj);
-        if (!JSObject::setSingleton(cx, ncallobj))
+        if (!JSObject::setSingleton(cx, ncallobj)) {
             return nullptr;
+        }
         return ncallobj;
     }
 
     return callobj;
 }
 
 CallObject*
 CallObject::create(JSContext* cx, AbstractFramePtr frame)
 {
     MOZ_ASSERT(frame.isFunctionFrame());
     cx->check(frame);
 
     RootedObject envChain(cx, frame.environmentChain());
     RootedFunction callee(cx, frame.callee());
 
     CallObject* callobj = create(cx, callee, envChain);
-    if (!callobj)
+    if (!callobj) {
         return nullptr;
+    }
 
     if (!frame.script()->bodyScope()->as<FunctionScope>().hasParameterExprs()) {
         // If there are no defaults, copy the aliased arguments into the call
         // object manually. If there are defaults, bytecode is generated to do
         // the copying.
 
         for (PositionalFormalParameterIter fi(frame.script()); fi; fi++) {
-            if (!fi.closedOver())
+            if (!fi.closedOver()) {
                 continue;
+            }
             callobj->setAliasedBinding(cx, fi, frame.unaliasedFormal(fi.argumentSlot(),
                                                                      DONT_CHECK_ALIASING));
         }
     }
 
     return callobj;
 }
 
 CallObject*
 CallObject::createHollowForDebug(JSContext* cx, HandleFunction callee)
 {
     MOZ_ASSERT(!callee->needsCallObject());
 
     RootedScript script(cx, callee->nonLazyScript());
     Rooted<FunctionScope*> scope(cx, &script->bodyScope()->as<FunctionScope>());
     RootedShape shape(cx, FunctionScope::getEmptyEnvironmentShape(cx, scope->hasParameterExprs()));
-    if (!shape)
+    if (!shape) {
         return nullptr;
+    }
     RootedObjectGroup group(cx, ObjectGroup::defaultNewGroup(cx, &class_, TaggedProto(nullptr)));
-    if (!group)
+    if (!group) {
         return nullptr;
+    }
     Rooted<CallObject*> callobj(cx, create(cx, shape, group));
-    if (!callobj)
+    if (!callobj) {
         return nullptr;
+    }
 
     // This environment's enclosing link is never used: the
     // DebugEnvironmentProxy that refers to this scope carries its own
     // enclosing link, which is what Debugger uses to construct the tree of
     // Debugger.Environment objects.
     callobj->initEnclosingEnvironment(&cx->global()->lexicalEnvironment());
     callobj->initFixedSlot(CALLEE_SLOT, ObjectValue(*callee));
 
     RootedValue optimizedOut(cx, MagicValue(JS_OPTIMIZED_OUT));
     RootedId id(cx);
     for (Rooted<BindingIter> bi(cx, BindingIter(script)); bi; bi++) {
         id = NameToId(bi.name()->asPropertyName());
-        if (!SetProperty(cx, callobj, id, optimizedOut))
+        if (!SetProperty(cx, callobj, id, optimizedOut)) {
             return nullptr;
+        }
     }
 
     return callobj;
 }
 
 const Class CallObject::class_ = {
     "Call",
     JSCLASS_IS_ANONYMOUS | JSCLASS_HAS_RESERVED_SLOTS(CallObject::RESERVED_SLOTS)
@@ -294,18 +310,19 @@ const Class CallObject::class_ = {
 
 /* static */ VarEnvironmentObject*
 VarEnvironmentObject::create(JSContext* cx, HandleShape shape, HandleObject enclosing,
                              gc::InitialHeap heap)
 {
     MOZ_ASSERT(shape->getObjectClass() == &class_);
 
     RootedObjectGroup group(cx, ObjectGroup::defaultNewGroup(cx, &class_, TaggedProto(nullptr)));
-    if (!group)
+    if (!group) {
         return nullptr;
+    }
 
     gc::AllocKind kind = gc::GetGCObjectKind(shape->numFixedSlots());
     MOZ_ASSERT(CanBeFinalizedInBackground(kind, &class_));
     kind = gc::GetBackgroundAllocKind(kind);
 
     JSObject* obj;
     JS_TRY_VAR_OR_RETURN_NULL(cx, obj, NativeObject::create(cx, kind, heap, shape, group));
 
@@ -335,46 +352,50 @@ VarEnvironmentObject::create(JSContext* 
     }
 #endif
 
     RootedScript script(cx, frame.script());
     RootedObject envChain(cx, frame.environmentChain());
     gc::InitialHeap heap = script->treatAsRunOnce() ? gc::TenuredHeap : gc::DefaultHeap;
     RootedShape shape(cx, scope->environmentShape());
     VarEnvironmentObject* env = create(cx, shape, envChain, heap);
-    if (!env)
+    if (!env) {
         return nullptr;
+    }
     env->initScope(scope);
     return env;
 }
 
 /* static */ VarEnvironmentObject*
 VarEnvironmentObject::createHollowForDebug(JSContext* cx, Handle<VarScope*> scope)
 {
     MOZ_ASSERT(!scope->hasEnvironment());
 
     RootedShape shape(cx, VarScope::getEmptyEnvironmentShape(cx));
-    if (!shape)
+    if (!shape) {
         return nullptr;
+    }
 
     // This environment's enclosing link is never used: the
     // DebugEnvironmentProxy that refers to this scope carries its own
     // enclosing link, which is what Debugger uses to construct the tree of
     // Debugger.Environment objects.
     RootedObject enclosingEnv(cx, &cx->global()->lexicalEnvironment());
     Rooted<VarEnvironmentObject*> env(cx, create(cx, shape, enclosingEnv, gc::TenuredHeap));
-    if (!env)
+    if (!env) {
         return nullptr;
+    }
 
     RootedValue optimizedOut(cx, MagicValue(JS_OPTIMIZED_OUT));
     RootedId id(cx);
     for (Rooted<BindingIter> bi(cx, BindingIter(scope)); bi; bi++) {
         id = NameToId(bi.name()->asPropertyName());
-        if (!SetProperty(cx, env, id, optimizedOut))
+        if (!SetProperty(cx, env, id, optimizedOut)) {
             return nullptr;
+        }
     }
 
     env->initScope(scope);
     return env;
 }
 
 const Class VarEnvironmentObject::class_ = {
     "Var",
@@ -415,49 +436,53 @@ const Class ModuleEnvironmentObject::cla
 /* static */ ModuleEnvironmentObject*
 ModuleEnvironmentObject::create(JSContext* cx, HandleModuleObject module)
 {
     RootedScript script(cx, module->script());
     RootedShape shape(cx, script->bodyScope()->as<ModuleScope>().environmentShape());
     MOZ_ASSERT(shape->getObjectClass() == &class_);
 
     RootedObjectGroup group(cx, ObjectGroup::defaultNewGroup(cx, &class_, TaggedProto(nullptr)));
-    if (!group)
+    if (!group) {
         return nullptr;
+    }
 
     gc::AllocKind kind = gc::GetGCObjectKind(shape->numFixedSlots());
     MOZ_ASSERT(CanBeFinalizedInBackground(kind, &class_));
     kind = gc::GetBackgroundAllocKind(kind);
 
     JSObject* obj;
     JS_TRY_VAR_OR_RETURN_NULL(cx, obj, NativeObject::create(cx, kind, gc::TenuredHeap, shape, group));
 
     RootedModuleEnvironmentObject env(cx, &obj->as<ModuleEnvironmentObject>());
 
     env->initReservedSlot(MODULE_SLOT, ObjectValue(*module));
-    if (!JSObject::setSingleton(cx, env))
+    if (!JSObject::setSingleton(cx, env)) {
         return nullptr;
+    }
 
     // Initialize this early so that we can manipulate the env object without
     // causing assertions.
     env->initEnclosingEnvironment(&cx->global()->lexicalEnvironment());
 
     // Initialize all lexical bindings and imports as uninitialized. Imports
     // get uninitialized because they have a special TDZ for cyclic imports.
     for (BindingIter bi(script); bi; bi++) {
         BindingLocation loc = bi.location();
-        if (loc.kind() == BindingLocation::Kind::Environment && BindingKindIsLexical(bi.kind()))
+        if (loc.kind() == BindingLocation::Kind::Environment && BindingKindIsLexical(bi.kind())) {
             env->initSlot(loc.slot(), MagicValue(JS_UNINITIALIZED_LEXICAL));
+        }
     }
 
     // It is not be possible to add or remove bindings from a module environment
     // after this point as module code is always strict.
 #ifdef DEBUG
-    for (Shape::Range<NoGC> r(env->lastProperty()); !r.empty(); r.popFront())
+    for (Shape::Range<NoGC> r(env->lastProperty()); !r.empty(); r.popFront()) {
         MOZ_ASSERT(!r.front().configurable());
+    }
     MOZ_ASSERT(env->lastProperty()->getObjectFlags() & BaseShape::NOT_EXTENSIBLE);
     MOZ_ASSERT(!env->inDictionaryMode());
 #endif
 
     return env;
 }
 
 ModuleObject&
@@ -474,18 +499,19 @@ ModuleEnvironmentObject::importBindings(
 
 bool
 ModuleEnvironmentObject::createImportBinding(JSContext* cx, HandleAtom importName,
                                              HandleModuleObject module, HandleAtom localName)
 {
     RootedId importNameId(cx, AtomToId(importName));
     RootedId localNameId(cx, AtomToId(localName));
     RootedModuleEnvironmentObject env(cx, &module->initialEnvironment());
-    if (!importBindings().put(cx, importNameId, env, localNameId))
+    if (!importBindings().put(cx, importNameId, env, localNameId)) {
         return false;
+    }
 
     return true;
 }
 
 bool
 ModuleEnvironmentObject::hasImportBinding(HandlePropertyName name)
 {
     return importBindings().has(NameToId(name));
@@ -512,18 +538,19 @@ ModuleEnvironmentObject::lookupProperty(
     ModuleEnvironmentObject* env;
     if (bindings.lookup(id, &env, &shape)) {
         objp.set(env);
         propp.setNativeProperty(shape);
         return true;
     }
 
     RootedNativeObject target(cx, &obj->as<NativeObject>());
-    if (!NativeLookupOwnProperty<CanGC>(cx, target, id, propp))
+    if (!NativeLookupOwnProperty<CanGC>(cx, target, id, propp)) {
         return false;
+    }
 
     objp.set(obj);
     return true;
 }
 
 /* static */ bool
 ModuleEnvironmentObject::hasProperty(JSContext* cx, HandleObject obj, HandleId id, bool* foundp)
 {
@@ -552,18 +579,19 @@ ModuleEnvironmentObject::getProperty(JSC
     return NativeGetProperty(cx, self, receiver, id, vp);
 }
 
 /* static */ bool
 ModuleEnvironmentObject::setProperty(JSContext* cx, HandleObject obj, HandleId id, HandleValue v,
                                      HandleValue receiver, JS::ObjectOpResult& result)
 {
     RootedModuleEnvironmentObject self(cx, &obj->as<ModuleEnvironmentObject>());
-    if (self->importBindings().has(id))
+    if (self->importBindings().has(id)) {
         return result.failReadOnly();
+    }
 
     return NativeSetProperty<Qualified>(cx, self, id, v, receiver, result);
 }
 
 /* static */ bool
 ModuleEnvironmentObject::getOwnPropertyDescriptor(JSContext* cx, HandleObject obj, HandleId id,
                                                   MutableHandle<PropertyDescriptor> desc)
 {
@@ -603,40 +631,43 @@ ModuleEnvironmentObject::newEnumerate(JS
         ReportOutOfMemory(cx);
         return false;
     }
 
     bs.forEachExportedName([&] (jsid name) {
         properties.infallibleAppend(name);
     });
 
-    for (Shape::Range<NoGC> r(self->lastProperty()); !r.empty(); r.popFront())
+    for (Shape::Range<NoGC> r(self->lastProperty()); !r.empty(); r.popFront()) {
         properties.infallibleAppend(r.front().propid());
+    }
 
     MOZ_ASSERT(properties.length() == count);
     return true;
 }
 
 /*****************************************************************************/
 
 const Class WasmInstanceEnvironmentObject::class_ = {
     "WasmInstance",
     JSCLASS_IS_ANONYMOUS | JSCLASS_HAS_RESERVED_SLOTS(WasmInstanceEnvironmentObject::RESERVED_SLOTS)
 };
 
 /* static */ WasmInstanceEnvironmentObject*
 WasmInstanceEnvironmentObject::createHollowForDebug(JSContext* cx, Handle<WasmInstanceScope*> scope)
 {
     RootedObjectGroup group(cx, ObjectGroup::defaultNewGroup(cx, &class_, TaggedProto(nullptr)));
-    if (!group)
+    if (!group) {
         return nullptr;
+    }
 
     RootedShape shape(cx, scope->getEmptyEnvironmentShape(cx));
-    if (!shape)
+    if (!shape) {
         return nullptr;
+    }
 
     gc::AllocKind kind = gc::GetGCObjectKind(shape->numFixedSlots());
     MOZ_ASSERT(CanBeFinalizedInBackground(kind, &class_));
     kind = gc::GetBackgroundAllocKind(kind);
 
     JSObject* obj;
     JS_TRY_VAR_OR_RETURN_NULL(cx, obj, NativeObject::create(cx, kind, gc::DefaultHeap, shape, group));
 
@@ -654,22 +685,24 @@ const Class WasmFunctionCallObject::clas
     JSCLASS_IS_ANONYMOUS | JSCLASS_HAS_RESERVED_SLOTS(WasmFunctionCallObject::RESERVED_SLOTS)
 };
 
 /* static */ WasmFunctionCallObject*
 WasmFunctionCallObject::createHollowForDebug(JSContext* cx, HandleObject enclosing,
                                              Handle<WasmFunctionScope*> scope)
 {
     RootedObjectGroup group(cx, ObjectGroup::defaultNewGroup(cx, &class_, TaggedProto(nullptr)));
-    if (!group)
+    if (!group) {
         return nullptr;
+    }
 
     RootedShape shape(cx, scope->getEmptyEnvironmentShape(cx));
-    if (!shape)
+    if (!shape) {
         return nullptr;
+    }
 
     gc::AllocKind kind = gc::GetGCObjectKind(shape->numFixedSlots());
     MOZ_ASSERT(CanBeFinalizedInBackground(kind, &class_));
     kind = gc::GetBackgroundAllocKind(kind);
 
     JSObject* obj;
     JS_TRY_VAR_OR_RETURN_NULL(cx, obj, NativeObject::create(cx, kind, gc::DefaultHeap, shape, group));
 
@@ -684,28 +717,30 @@ WasmFunctionCallObject::createHollowForD
 
 WithEnvironmentObject*
 WithEnvironmentObject::create(JSContext* cx, HandleObject object, HandleObject enclosing,
                               Handle<WithScope*> scope)
 {
     Rooted<WithEnvironmentObject*> obj(cx);
     obj = NewObjectWithNullTaggedProto<WithEnvironmentObject>(cx, GenericObject,
                                                               BaseShape::DELEGATE);
-    if (!obj)
+    if (!obj) {
         return nullptr;
+    }
 
     Value thisv = GetThisValue(object);
 
     obj->initEnclosingEnvironment(enclosing);
     obj->initReservedSlot(OBJECT_SLOT, ObjectValue(*object));
     obj->initReservedSlot(THIS_SLOT, thisv);
-    if (scope)
+    if (scope) {
         obj->initReservedSlot(SCOPE_SLOT, PrivateGCThingValue(scope));
-    else
+    } else {
         obj->initReservedSlot(SCOPE_SLOT, NullValue());
+    }
 
     return obj;
 }
 
 WithEnvironmentObject*
 WithEnvironmentObject::createNonSyntactic(JSContext* cx, HandleObject object,
                                           HandleObject enclosing)
 {
@@ -720,22 +755,24 @@ IsUnscopableDotName(JSContext* cx, Handl
 
 /* Implements ES6 8.1.1.2.1 HasBinding steps 7-9. */
 static bool
 CheckUnscopables(JSContext *cx, HandleObject obj, HandleId id, bool *scopable)
 {
     RootedId unscopablesId(cx, SYMBOL_TO_JSID(cx->wellKnownSymbols()
                                                 .get(JS::SymbolCode::unscopables)));
     RootedValue v(cx);
-    if (!GetProperty(cx, obj, obj, unscopablesId, &v))
+    if (!GetProperty(cx, obj, obj, unscopablesId, &v)) {
         return false;
+    }
     if (v.isObject()) {
         RootedObject unscopablesObj(cx, &v.toObject());
-        if (!GetProperty(cx, unscopablesObj, unscopablesObj, id, &v))
+        if (!GetProperty(cx, unscopablesObj, unscopablesObj, id, &v)) {
             return false;
+        }
         *scopable = !ToBoolean(v);
     } else {
         *scopable = true;
     }
     return true;
 }
 
 static bool
@@ -746,23 +783,25 @@ with_LookupProperty(JSContext* cx, Handl
     // to be unscopable.
     if (IsUnscopableDotName(cx, id)) {
         objp.set(nullptr);
         propp.setNotFound();
         return true;
     }
 
     RootedObject actual(cx, &obj->as<WithEnvironmentObject>().object());
-    if (!LookupProperty(cx, actual, id, objp, propp))
+    if (!LookupProperty(cx, actual, id, objp, propp)) {
         return false;
+    }
 
     if (propp) {
         bool scopable;
-        if (!CheckUnscopables(cx, actual, id, &scopable))
+        if (!CheckUnscopables(cx, actual, id, &scopable)) {
             return false;
+        }
         if (!scopable) {
             objp.set(nullptr);
             propp.setNotFound();
         }
     }
     return true;
 }
 
@@ -777,46 +816,50 @@ with_DefineProperty(JSContext* cx, Handl
 
 static bool
 with_HasProperty(JSContext* cx, HandleObject obj, HandleId id, bool* foundp)
 {
     MOZ_ASSERT(!IsUnscopableDotName(cx, id));
     RootedObject actual(cx, &obj->as<WithEnvironmentObject>().object());
 
     // ES 8.1.1.2.1 step 3-5.
-    if (!HasProperty(cx, actual, id, foundp))
+    if (!HasProperty(cx, actual, id, foundp)) {
         return false;
-    if (!*foundp)
+    }
+    if (!*foundp) {
         return true;
+    }
 
     // Steps 7-10. (Step 6 is a no-op.)
     return CheckUnscopables(cx, actual, id, foundp);
 }
 
 static bool
 with_GetProperty(JSContext* cx, HandleObject obj, HandleValue receiver, HandleId id,
                  MutableHandleValue vp)
 {
     MOZ_ASSERT(!IsUnscopableDotName(cx, id));
     RootedObject actual(cx, &obj->as<WithEnvironmentObject>().object());
     RootedValue actualReceiver(cx, receiver);
-    if (receiver.isObject() && &receiver.toObject() == obj)
+    if (receiver.isObject() && &receiver.toObject() == obj) {
         actualReceiver.setObject(*actual);
+    }
     return GetProperty(cx, actual, actualReceiver, id, vp);
 }
 
 static bool
 with_SetProperty(JSContext* cx, HandleObject obj, HandleId id, HandleValue v,
                  HandleValue receiver, ObjectOpResult& result)
 {
     MOZ_ASSERT(!IsUnscopableDotName(cx, id));
     RootedObject actual(cx, &obj->as<WithEnvironmentObject>().object());
     RootedValue actualReceiver(cx, receiver);
-    if (receiver.isObject() && &receiver.toObject() == obj)
+    if (receiver.isObject() && &receiver.toObject() == obj) {
         actualReceiver.setObject(*actual);
+    }
     return SetProperty(cx, actual, id, v, actualReceiver, result);
 }
 
 static bool
 with_GetOwnPropertyDescriptor(JSContext* cx, HandleObject obj, HandleId id,
                               MutableHandle<PropertyDescriptor> desc)
 {
     MOZ_ASSERT(!IsUnscopableDotName(cx, id));
@@ -855,22 +898,24 @@ const Class WithEnvironmentObject::class
 };
 
 /* static */ NonSyntacticVariablesObject*
 NonSyntacticVariablesObject::create(JSContext* cx)
 {
     Rooted<NonSyntacticVariablesObject*> obj(cx,
         NewObjectWithNullTaggedProto<NonSyntacticVariablesObject>(cx, TenuredObject,
                                                                   BaseShape::DELEGATE));
-    if (!obj)
+    if (!obj) {
         return nullptr;
+    }
 
     MOZ_ASSERT(obj->isUnqualifiedVarObj());
-    if (!JSObject::setQualifiedVarObj(cx, obj))
+    if (!JSObject::setQualifiedVarObj(cx, obj)) {
         return nullptr;
+    }
 
     obj->initEnclosingEnvironment(&cx->global()->lexicalEnvironment());
     return obj;
 }
 
 const Class NonSyntacticVariablesObject::class_ = {
     "NonSyntacticVariablesObject",
     JSCLASS_HAS_RESERVED_SLOTS(NonSyntacticVariablesObject::RESERVED_SLOTS) |
@@ -882,53 +927,57 @@ const Class NonSyntacticVariablesObject:
 /* static */ LexicalEnvironmentObject*
 LexicalEnvironmentObject::createTemplateObject(JSContext* cx, HandleShape shape,
                                                HandleObject enclosing, gc::InitialHeap heap)
 {
     MOZ_ASSERT(shape->getObjectClass() == &LexicalEnvironmentObject::class_);
 
     RootedObjectGroup group(cx,
         ObjectGroup::defaultNewGroup(cx, &LexicalEnvironmentObject::class_, TaggedProto(nullptr)));
-    if (!group)
+    if (!group) {
         return nullptr;
+    }
 
     gc::AllocKind allocKind = gc::GetGCObjectKind(shape->numFixedSlots());
     MOZ_ASSERT(CanBeFinalizedInBackground(allocKind, &LexicalEnvironmentObject::class_));
     allocKind = GetBackgroundAllocKind(allocKind);
 
     JSObject* obj;
     JS_TRY_VAR_OR_RETURN_NULL(cx, obj, NativeObject::create(cx, allocKind, heap, shape, group));
 
     LexicalEnvironmentObject* env = &obj->as<LexicalEnvironmentObject>();
     MOZ_ASSERT(!env->inDictionaryMode());
     MOZ_ASSERT(env->isDelegate());
 
-    if (enclosing)
+    if (enclosing) {
         env->initEnclosingEnvironment(enclosing);
+    }
 
     return env;
 }
 
 /* static */ LexicalEnvironmentObject*
 LexicalEnvironmentObject::create(JSContext* cx, Handle<LexicalScope*> scope,
                                  HandleObject enclosing, gc::InitialHeap heap)
 {
     cx->check(enclosing);
     MOZ_ASSERT(scope->hasEnvironment());
 
     RootedShape shape(cx, scope->environmentShape());
     LexicalEnvironmentObject* env = createTemplateObject(cx, shape, enclosing, heap);
-    if (!env)
+    if (!env) {
         return nullptr;
+    }
 
     // All lexical bindings start off uninitialized for TDZ.
     uint32_t lastSlot = shape->slot();
     MOZ_ASSERT(lastSlot == env->lastProperty()->slot());
-    for (uint32_t slot = JSSLOT_FREE(&class_); slot <= lastSlot; slot++)
+    for (uint32_t slot = JSSLOT_FREE(&class_); slot <= lastSlot; slot++) {
         env->initSlot(slot, MagicValue(JS_UNINITIALIZED_LEXICAL));
+    }
 
     env->initScopeUnchecked(scope);
     return env;
 }
 
 /* static */ LexicalEnvironmentObject*
 LexicalEnvironmentObject::create(JSContext* cx, Handle<LexicalScope*> scope,
                                  AbstractFramePtr frame)
@@ -938,100 +987,111 @@ LexicalEnvironmentObject::create(JSConte
 }
 
 /* static */ LexicalEnvironmentObject*
 LexicalEnvironmentObject::createGlobal(JSContext* cx, Handle<GlobalObject*> global)
 {
     MOZ_ASSERT(global);
 
     RootedShape shape(cx, LexicalScope::getEmptyExtensibleEnvironmentShape(cx));
-    if (!shape)
+    if (!shape) {
         return nullptr;
+    }
 
     Rooted<LexicalEnvironmentObject*> env(cx,
         LexicalEnvironmentObject::createTemplateObject(cx, shape, global, gc::TenuredHeap));
-    if (!env)
+    if (!env) {
         return nullptr;
-
-    if (!JSObject::setSingleton(cx, env))
+    }
+
+    if (!JSObject::setSingleton(cx, env)) {
         return nullptr;
+    }
 
     env->initThisValue(global);
     return env;
 }
 
 /* static */ LexicalEnvironmentObject*
 LexicalEnvironmentObject::createNonSyntactic(JSContext* cx, HandleObject enclosing,
                                              HandleObject thisv)
 {
     MOZ_ASSERT(enclosing);
     MOZ_ASSERT(!IsSyntacticEnvironment(enclosing));
 
     RootedShape shape(cx, LexicalScope::getEmptyExtensibleEnvironmentShape(cx));
-    if (!shape)
+    if (!shape) {
         return nullptr;
+    }
 
     LexicalEnvironmentObject* env =
         LexicalEnvironmentObject::createTemplateObject(cx, shape, enclosing, gc::TenuredHeap);
-    if (!env)
+    if (!env) {
         return nullptr;
+    }
 
     env->initThisValue(thisv);
 
     return env;
 }
 
 /* static */ LexicalEnvironmentObject*
 LexicalEnvironmentObject::createHollowForDebug(JSContext* cx, Handle<LexicalScope*> scope)
 {
     MOZ_ASSERT(!scope->hasEnvironment());
 
     RootedShape shape(cx, LexicalScope::getEmptyExtensibleEnvironmentShape(cx));
-    if (!shape)
+    if (!shape) {
         return nullptr;
+    }
 
     // This environment's enclosing link is never used: the
     // DebugEnvironmentProxy that refers to this scope carries its own
     // enclosing link, which is what Debugger uses to construct the tree of
     // Debugger.Environment objects.
     RootedObject enclosingEnv(cx, &cx->global()->lexicalEnvironment());
     Rooted<LexicalEnvironmentObject*> env(cx, createTemplateObject(cx, shape, enclosingEnv,
                                                                    gc::TenuredHeap));
-    if (!env)
+    if (!env) {
         return nullptr;
+    }
 
     RootedValue optimizedOut(cx, MagicValue(JS_OPTIMIZED_OUT));
     RootedId id(cx);
     for (Rooted<BindingIter> bi(cx, BindingIter(scope)); bi; bi++) {
         id = NameToId(bi.name()->asPropertyName());
-        if (!SetProperty(cx, env, id, optimizedOut))
+        if (!SetProperty(cx, env, id, optimizedOut)) {
             return nullptr;
+        }
     }
 
-    if (!JSObject::setFlags(cx, env, BaseShape::NOT_EXTENSIBLE, JSObject::GENERATE_SHAPE))
+    if (!JSObject::setFlags(cx, env, BaseShape::NOT_EXTENSIBLE, JSObject::GENERATE_SHAPE)) {
         return nullptr;
+    }
 
     env->initScopeUnchecked(scope);
     return env;
 }
 
 /* static */ LexicalEnvironmentObject*
 LexicalEnvironmentObject::clone(JSContext* cx, Handle<LexicalEnvironmentObject*> env)
 {
     Rooted<LexicalScope*> scope(cx, &env->scope());
     RootedObject enclosing(cx, &env->enclosingEnvironment());
     Rooted<LexicalEnvironmentObject*> copy(cx, create(cx, scope, enclosing, gc::DefaultHeap));
-    if (!copy)
+    if (!copy) {
         return nullptr;
+    }
 
     // We can't assert that the clone has the same shape, because it could
     // have been reshaped by ReshapeForShadowedProp.
     MOZ_ASSERT(env->slotSpan() == copy->slotSpan());
-    for (uint32_t i = JSSLOT_FREE(&class_); i < copy->slotSpan(); i++)
+    for (uint32_t i = JSSLOT_FREE(&class_); i < copy->slotSpan(); i++) {
         copy->setSlot(i, env->getSlot(i));
+    }
 
     return copy;
 }
 
 /* static */ LexicalEnvironmentObject*
 LexicalEnvironmentObject::recreate(JSContext* cx, Handle<LexicalEnvironmentObject*> env)
 {
     Rooted<LexicalScope*> scope(cx, &env->scope());
@@ -1087,18 +1147,19 @@ NamedLambdaObject::create(JSContext* cx,
     // There should be exactly one binding in the named lambda scope.
     BindingIter bi(scope);
     bi++;
     MOZ_ASSERT(bi.done());
 #endif
 
     LexicalEnvironmentObject* obj =
         LexicalEnvironmentObject::create(cx, scope.as<LexicalScope>(), enclosing, heap);
-    if (!obj)
+    if (!obj) {
         return nullptr;
+    }
 
     obj->initFixedSlot(lambdaSlot(), ObjectValue(*func));
     return static_cast<NamedLambdaObject*>(obj);
 }
 
 /* static */ NamedLambdaObject*
 NamedLambdaObject::createTemplateObject(JSContext* cx, HandleFunction callee, gc::InitialHeap heap)
 {
@@ -1129,18 +1190,19 @@ NamedLambdaObject::lambdaSlot()
 }
 
 /* static */ RuntimeLexicalErrorObject*
 RuntimeLexicalErrorObject::create(JSContext* cx, HandleObject enclosing, unsigned errorNumber)
 {
     RuntimeLexicalErrorObject* obj =
         NewObjectWithNullTaggedProto<RuntimeLexicalErrorObject>(cx, GenericObject,
                                                                 BaseShape::DELEGATE);
-    if (!obj)
+    if (!obj) {
         return nullptr;
+    }
     obj->initEnclosingEnvironment(enclosing);
     obj->initReservedSlot(ERROR_SLOT, Int32Value(int32_t(errorNumber)));
     return obj;
 }
 
 static void
 ReportRuntimeLexicalErrorId(JSContext* cx, unsigned errorNumber, HandleId id)
 {
@@ -1266,18 +1328,19 @@ EnvironmentIter::EnvironmentIter(JSConte
 void
 EnvironmentIter::incrementScopeIter()
 {
     if (si_.scope()->is<GlobalScope>()) {
         // GlobalScopes may be syntactic or non-syntactic. Non-syntactic
         // GlobalScopes correspond to zero or more non-syntactic
         // EnvironmentsObjects followed by the global lexical scope, then the
         // GlobalObject or another non-EnvironmentObject object.
-        if (!env_->is<EnvironmentObject>())
+        if (!env_->is<EnvironmentObject>()) {
             si_++;
+        }
     } else {
         si_++;
     }
 }
 
 void
 EnvironmentIter::settle()
 {
@@ -1382,18 +1445,19 @@ MissingEnvironmentKey::hash(MissingEnvir
 MissingEnvironmentKey::match(MissingEnvironmentKey ek1, MissingEnvironmentKey ek2)
 {
     return ek1.frame_ == ek2.frame_ && ek1.scope_ == ek2.scope_;
 }
 
 bool
 LiveEnvironmentVal::needsSweep()
 {
-    if (scope_)
+    if (scope_) {
         MOZ_ALWAYS_FALSE(IsAboutToBeFinalized(&scope_));
+    }
     return false;
 }
 
 // Live EnvironmentIter values may be added to DebugEnvironments::liveEnvs, as
 // LiveEnvironmentVal instances.  They need to have write barriers when they are added
 // to the hash table, but no barriers when rehashing inside GC.  It's a nasty
 // hack, but the important thing is that LiveEnvironmentVal and MissingEnvironmentKey need to
 // alias each other.
@@ -1485,91 +1549,103 @@ class DebugEnvironmentProxyHandler : pub
         }
 
         /* Handle unaliased formals, vars, lets, and consts at function scope. */
         if (env->is<CallObject>()) {
             CallObject& callobj = env->as<CallObject>();
             RootedFunction fun(cx, &callobj.callee());
             RootedScript script(cx, JSFunction::getOrCreateScript(cx, fun));
             AutoKeepTypeScripts keepTypes(cx);
-            if (!script->ensureHasTypes(cx, keepTypes) || !script->ensureHasAnalyzedArgsUsage(cx))
+            if (!script->ensureHasTypes(cx, keepTypes) || !script->ensureHasAnalyzedArgsUsage(cx)) {
                 return false;
+            }
 
             BindingIter bi(script);
-            while (bi && NameToId(bi.name()->asPropertyName()) != id)
+            while (bi && NameToId(bi.name()->asPropertyName()) != id) {
                 bi++;
-            if (!bi)
+            }
+            if (!bi) {
                 return true;
+            }
 
             if (!bi.hasArgumentSlot()) {
-                if (bi.closedOver())
+                if (bi.closedOver()) {
                     return true;
+                }
 
                 uint32_t i = bi.location().slot();
                 if (maybeLiveEnv) {
                     AbstractFramePtr frame = maybeLiveEnv->frame();
-                    if (action == GET)
+                    if (action == GET) {
                         vp.set(frame.unaliasedLocal(i));
-                    else
+                    } else {
                         frame.unaliasedLocal(i) = vp;
+                    }
                 } else if (NativeObject* snapshot = debugEnv->maybeSnapshot()) {
-                    if (action == GET)
+                    if (action == GET) {
                         vp.set(snapshot->getDenseElement(script->numArgs() + i));
-                    else
+                    } else {
                         snapshot->setDenseElement(script->numArgs() + i, vp);
+                    }
                 } else {
                     /* The unaliased value has been lost to the debugger. */
                     if (action == GET) {
                         *accessResult = ACCESS_LOST;
                         return true;
                     }
                 }
             } else {
                 unsigned i = bi.argumentSlot();
-                if (bi.closedOver())
+                if (bi.closedOver()) {
                     return true;
+                }
 
                 if (maybeLiveEnv) {
                     AbstractFramePtr frame = maybeLiveEnv->frame();
                     if (script->argsObjAliasesFormals() && frame.hasArgsObj()) {
-                        if (action == GET)
+                        if (action == GET) {
                             vp.set(frame.argsObj().arg(i));
-                        else
+                        } else {
                             frame.argsObj().setArg(i, vp);
+                        }
                     } else {
-                        if (action == GET)
+                        if (action == GET) {
                             vp.set(frame.unaliasedFormal(i, DONT_CHECK_ALIASING));
-                        else
+                        } else {
                             frame.unaliasedFormal(i, DONT_CHECK_ALIASING) = vp;
+                        }
                     }
                 } else if (NativeObject* snapshot = debugEnv->maybeSnapshot()) {
-                    if (action == GET)
+                    if (action == GET) {
                         vp.set(snapshot->getDenseElement(i));
-                    else
+                    } else {
                         snapshot->setDenseElement(i, vp);
+                    }
                 } else {
                     /* The unaliased value has been lost to the debugger. */
                     if (action == GET) {
                         *accessResult = ACCESS_LOST;
                         return true;
                     }
                 }
 
-                if (action == SET)
+                if (action == SET) {
                     TypeScript::SetArgument(cx, script, i, vp);
+                }
             }
 
             // It is possible that an optimized out value flows to this
             // location due to Debugger.Frame.prototype.eval operating on a
             // live bailed-out Baseline frame. In that case, treat the access
             // as lost.
-            if (vp.isMagic() && vp.whyMagic() == JS_OPTIMIZED_OUT)
+            if (vp.isMagic() && vp.whyMagic() == JS_OPTIMIZED_OUT) {
                 *accessResult = ACCESS_LOST;
-            else
+            } else {
                 *accessResult = ACCESS_UNALIASED;
+            }
 
             return true;
         }
 
         /*
          * Handle unaliased vars in functions with parameter expressions and
          * lexical bindings at block scope.
          */
@@ -1579,97 +1655,109 @@ class DebugEnvironmentProxyHandler : pub
             if (env->is<LexicalEnvironmentObject>() &&
                 env->as<LexicalEnvironmentObject>().isExtensible())
             {
                 MOZ_ASSERT(IsGlobalLexicalEnvironment(env) || !IsSyntacticEnvironment(env));
                 return true;
             }
 
             // Currently all vars inside eval var environments are aliased.
-            if (env->is<VarEnvironmentObject>() && env->as<VarEnvironmentObject>().isForEval())
+            if (env->is<VarEnvironmentObject>() && env->as<VarEnvironmentObject>().isForEval()) {
                 return true;
+            }
 
             RootedScope scope(cx, getEnvironmentScope(*env));
             uint32_t firstFrameSlot;
-            if (env->is<LexicalEnvironmentObject>())
+            if (env->is<LexicalEnvironmentObject>()) {
                 firstFrameSlot = scope->as<LexicalScope>().firstFrameSlot();
-            else
+            } else {
                 firstFrameSlot = scope->as<VarScope>().firstFrameSlot();
+            }
 
             BindingIter bi(scope);
-            while (bi && NameToId(bi.name()->asPropertyName()) != id)
+            while (bi && NameToId(bi.name()->asPropertyName()) != id) {
                 bi++;
-            if (!bi)
+            }
+            if (!bi) {
                 return true;
+            }
 
             BindingLocation loc = bi.location();
-            if (loc.kind() == BindingLocation::Kind::Environment)
+            if (loc.kind() == BindingLocation::Kind::Environment) {
                 return true;
+            }
 
             // Named lambdas that are not closed over are lost.
             if (loc.kind() == BindingLocation::Kind::NamedLambdaCallee) {
-                if (action == GET)
+                if (action == GET) {
                     *accessResult = ACCESS_LOST;
+                }
                 return true;
             }
 
             MOZ_ASSERT(loc.kind() == BindingLocation::Kind::Frame);
 
             if (maybeLiveEnv) {
                 AbstractFramePtr frame = maybeLiveEnv->frame();
                 uint32_t local = loc.slot();
                 MOZ_ASSERT(local < frame.script()->nfixed());
-                if (action == GET)
+                if (action == GET) {
                     vp.set(frame.unaliasedLocal(local));
-                else
+                } else {
                     frame.unaliasedLocal(local) = vp;
+                }
             } else if (NativeObject* snapshot = debugEnv->maybeSnapshot()) {
                 // Indices in the frame snapshot are offset by the first frame
                 // slot. See DebugEnvironments::takeFrameSnapshot.
                 MOZ_ASSERT(loc.slot() >= firstFrameSlot);
                 uint32_t snapshotIndex = loc.slot() - firstFrameSlot;
-                if (action == GET)
+                if (action == GET) {
                     vp.set(snapshot->getDenseElement(snapshotIndex));
-                else
+                } else {
                     snapshot->setDenseElement(snapshotIndex, vp);
+                }
             } else {
                 if (action == GET) {
                     // A {Lexical,Var}EnvironmentObject whose static scope
                     // does not have an environment shape at all is a "hollow"
                     // block object reflected for missing block scopes. Their
                     // slot values are lost.
                     if (!scope->hasEnvironment()) {
                         *accessResult = ACCESS_LOST;
                         return true;
                     }
 
-                    if (!GetProperty(cx, env, env, id, vp))
+                    if (!GetProperty(cx, env, env, id, vp)) {
                         return false;
+                    }
                 } else {
-                    if (!SetProperty(cx, env, id, vp))
+                    if (!SetProperty(cx, env, id, vp)) {
                         return false;
+                    }
                 }
             }
 
             // See comment above in analogous CallObject case.
-            if (vp.isMagic() && vp.whyMagic() == JS_OPTIMIZED_OUT)
+            if (vp.isMagic() && vp.whyMagic() == JS_OPTIMIZED_OUT) {
                 *accessResult = ACCESS_LOST;
-            else
+            } else {
                 *accessResult = ACCESS_UNALIASED;
+            }
 
             return true;
         }
 
         if (env->is<WasmFunctionCallObject>()) {
             if (maybeLiveEnv) {
                 RootedScope scope(cx, getEnvironmentScope(*env));
                 uint32_t index = 0;
                 for (BindingIter bi(scope); bi; bi++) {
-                    if (JSID_IS_ATOM(id, bi.name()))
+                    if (JSID_IS_ATOM(id, bi.name())) {
                         break;
+                    }
                     MOZ_ASSERT(!bi.isLast());
                     index++;
                 }
 
                 AbstractFramePtr frame = maybeLiveEnv->frame();
                 MOZ_ASSERT(frame.isWasmDebugFrame());
                 wasm::DebugFrame* wasmFrame = frame.asWasmDebugFrame();
                 if (action == GET) {
@@ -1687,18 +1775,19 @@ class DebugEnvironmentProxyHandler : pub
             return true;
         }
 
         if (env->is<WasmInstanceEnvironmentObject>()) {
             RootedScope scope(cx, getEnvironmentScope(*env));
             MOZ_ASSERT(scope->is<WasmInstanceScope>());
             uint32_t index = 0;
             for (BindingIter bi(scope); bi; bi++) {
-                if (JSID_IS_ATOM(id, bi.name()))
+                if (JSID_IS_ATOM(id, bi.name())) {
                     break;
+                }
                 MOZ_ASSERT(!bi.isLast());
                 index++;
             }
             Rooted<WasmInstanceScope*> instanceScope(cx, &scope->as<WasmInstanceScope>());
             wasm::Instance& instance = instanceScope->instance()->instance();
 
             if (action == GET) {
                 if (instanceScope->memoriesStart() <= index && index < instanceScope->globalsStart()) {
@@ -1742,26 +1831,31 @@ class DebugEnvironmentProxyHandler : pub
     static bool isNonExtensibleLexicalEnvironment(const JSObject& env)
     {
         return env.is<LexicalEnvironmentObject>() &&
                !env.as<LexicalEnvironmentObject>().isExtensible();
     }
 
     static Scope* getEnvironmentScope(const JSObject& env)
     {
-        if (isFunctionEnvironment(env))
+        if (isFunctionEnvironment(env)) {
             return env.as<CallObject>().callee().nonLazyScript()->bodyScope();
-        if (isNonExtensibleLexicalEnvironment(env))
+        }
+        if (isNonExtensibleLexicalEnvironment(env)) {
             return &env.as<LexicalEnvironmentObject>().scope();
-        if (env.is<VarEnvironmentObject>())
+        }
+        if (env.is<VarEnvironmentObject>()) {
             return &env.as<VarEnvironmentObject>().scope();
-        if (env.is<WasmInstanceEnvironmentObject>())
+        }
+        if (env.is<WasmInstanceEnvironmentObject>()) {
             return &env.as<WasmInstanceEnvironmentObject>().scope();
-        if (env.is<WasmFunctionCallObject>())
+        }
+        if (env.is<WasmFunctionCallObject>()) {
             return &env.as<WasmFunctionCallObject>().scope();
+        }
         return nullptr;
     }
 
     /*
      * In theory, every non-arrow function scope contains an 'arguments'
      * bindings.  However, the engine only adds a binding if 'arguments' is
      * used in the function body. Thus, from the debugger's perspective,
      * 'arguments' may be missing from the list of bindings.
@@ -1866,38 +1960,41 @@ class DebugEnvironmentProxyHandler : pub
      * argsObj is null, it means the env is dead.
      */
     static bool createMissingArguments(JSContext* cx, EnvironmentObject& env,
                                        MutableHandleArgumentsObject argsObj)
     {
         argsObj.set(nullptr);
 
         LiveEnvironmentVal* maybeEnv = DebugEnvironments::hasLiveEnvironment(env);
-        if (!maybeEnv)
+        if (!maybeEnv) {
             return true;
+        }
 
         argsObj.set(ArgumentsObject::createUnexpected(cx, maybeEnv->frame()));
         return !!argsObj;
     }
 
     /*
      * Create a missing this Value. If the function returns true but
      * *success is false, it means the scope is dead.
      */
     static bool createMissingThis(JSContext* cx, EnvironmentObject& env,
                                   MutableHandleValue thisv, bool* success)
     {
         *success = false;
 
         LiveEnvironmentVal* maybeEnv = DebugEnvironments::hasLiveEnvironment(env);
-        if (!maybeEnv)
+        if (!maybeEnv) {
             return true;
-
-        if (!GetFunctionThis(cx, maybeEnv->frame(), thisv))
+        }
+
+        if (!GetFunctionThis(cx, maybeEnv->frame(), thisv)) {
             return false;
+        }
 
         // Update the this-argument to avoid boxing primitive |this| more
         // than once.
         maybeEnv->frame().thisArgument() = thisv;
         *success = true;
         return true;
     }
 
@@ -1941,18 +2038,19 @@ class DebugEnvironmentProxyHandler : pub
     }
 
     bool getMissingArgumentsPropertyDescriptor(JSContext* cx,
                                                Handle<DebugEnvironmentProxy*> debugEnv,
                                                EnvironmentObject& env,
                                                MutableHandle<PropertyDescriptor> desc) const
     {
         RootedArgumentsObject argsObj(cx);
-        if (!createMissingArguments(cx, env, &argsObj))
+        if (!createMissingArguments(cx, env, &argsObj)) {
             return false;
+        }
 
         if (!argsObj) {
             JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_DEBUG_NOT_LIVE,
                                       "Debugger scope");
             return false;
         }
 
         desc.object().set(debugEnv);
@@ -1964,18 +2062,19 @@ class DebugEnvironmentProxyHandler : pub
     }
     bool getMissingThisPropertyDescriptor(JSContext* cx,
                                           Handle<DebugEnvironmentProxy*> debugEnv,
                                           EnvironmentObject& env,
                                           MutableHandle<PropertyDescriptor> desc) const
     {
         RootedValue thisv(cx);
         bool success;
-        if (!createMissingThis(cx, env, &thisv, &success))
+        if (!createMissingThis(cx, env, &thisv, &success)) {
             return false;
+        }
 
         if (!success) {
             JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_DEBUG_NOT_LIVE,
                                       "Debugger scope");
             return false;
         }
 
         desc.object().set(debugEnv);
@@ -1987,31 +2086,35 @@ class DebugEnvironmentProxyHandler : pub
     }
 
     bool getOwnPropertyDescriptor(JSContext* cx, HandleObject proxy, HandleId id,
                                   MutableHandle<PropertyDescriptor> desc) const override
     {
         Rooted<DebugEnvironmentProxy*> debugEnv(cx, &proxy->as<DebugEnvironmentProxy>());
         Rooted<EnvironmentObject*> env(cx, &debugEnv->environment());
 
-        if (isMissingArguments(cx, id, *env))
+        if (isMissingArguments(cx, id, *env)) {
             return getMissingArgumentsPropertyDescriptor(cx, debugEnv, *env, desc);
-
-        if (isMissingThis(cx, id, *env))
+        }
+
+        if (isMissingThis(cx, id, *env)) {
             return getMissingThisPropertyDescriptor(cx, debugEnv, *env, desc);
+        }
 
         RootedValue v(cx);
         AccessResult access;
-        if (!handleUnaliasedAccess(cx, debugEnv, env, id, GET, &v, &access))
+        if (!handleUnaliasedAccess(cx, debugEnv, env, id, GET, &v, &access)) {
             return false;
+        }
 
         switch (access) {
           case ACCESS_UNALIASED:
-            if (isMagicMissingArgumentsValue(*env, v))
+            if (isMagicMissingArgumentsValue(*env, v)) {
                 return getMissingArgumentsPropertyDescriptor(cx, debugEnv, *env, desc);
+            }
             desc.object().set(debugEnv);
             desc.setAttributes(JSPROP_READONLY | JSPROP_ENUMERATE | JSPROP_PERMANENT);
             desc.value().set(v);
             desc.setGetter(nullptr);
             desc.setSetter(nullptr);
             return true;
           case ACCESS_GENERIC:
             return JS_GetOwnPropertyDescriptorById(cx, env, id, desc);
@@ -2021,35 +2124,37 @@ class DebugEnvironmentProxyHandler : pub
           default:
             MOZ_CRASH("bad AccessResult");
         }
     }
 
     bool getMissingArguments(JSContext* cx, EnvironmentObject& env, MutableHandleValue vp) const
     {
         RootedArgumentsObject argsObj(cx);
-        if (!createMissingArguments(cx, env, &argsObj))
+        if (!createMissingArguments(cx, env, &argsObj)) {
             return false;
+        }
 
         if (!argsObj) {
             JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_DEBUG_NOT_LIVE,
                                       "Debugger env");
             return false;
         }
 
         vp.setObject(*argsObj);
         return true;
     }
 
     bool getMissingThis(JSContext* cx, EnvironmentObject& env, MutableHandleValue vp) const
     {
         RootedValue thisv(cx);
         bool success;
-        if (!createMissingThis(cx, env, &thisv, &success))
+        if (!createMissingThis(cx, env, &thisv, &success)) {
             return false;
+        }
 
         if (!success) {
             JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_DEBUG_NOT_LIVE,
                                       "Debugger env");
             return false;
         }
 
         vp.set(thisv);
@@ -2057,120 +2162,138 @@ class DebugEnvironmentProxyHandler : pub
     }
 
     bool get(JSContext* cx, HandleObject proxy, HandleValue receiver, HandleId id,
              MutableHandleValue vp) const override
     {
         Rooted<DebugEnvironmentProxy*> debugEnv(cx, &proxy->as<DebugEnvironmentProxy>());
         Rooted<EnvironmentObject*> env(cx, &proxy->as<DebugEnvironmentProxy>().environment());
 
-        if (isMissingArguments(cx, id, *env))
+        if (isMissingArguments(cx, id, *env)) {
             return getMissingArguments(cx, *env, vp);
-
-        if (isMissingThis(cx, id, *env))
+        }
+
+        if (isMissingThis(cx, id, *env)) {
             return getMissingThis(cx, *env, vp);
+        }
 
         AccessResult access;
-        if (!handleUnaliasedAccess(cx, debugEnv, env, id, GET, vp, &access))
+        if (!handleUnaliasedAccess(cx, debugEnv, env, id, GET, vp, &access)) {
             return false;
+        }
 
         switch (access) {
           case ACCESS_UNALIASED:
-            if (isMagicMissingArgumentsValue(*env, vp))
+            if (isMagicMissingArgumentsValue(*env, vp)) {
                 return getMissingArguments(cx, *env, vp);
-            if (isMaybeUninitializedThisValue(cx, id, vp))
+            }
+            if (isMaybeUninitializedThisValue(cx, id, vp)) {
                 return getMissingThis(cx, *env, vp);
+            }
             return true;
           case ACCESS_GENERIC:
-            if (!GetProperty(cx, env, env, id, vp))
+            if (!GetProperty(cx, env, env, id, vp)) {
                 return false;
-            if (isMaybeUninitializedThisValue(cx, id, vp))
+            }
+            if (isMaybeUninitializedThisValue(cx, id, vp)) {
                 return getMissingThis(cx, *env, vp);
+            }
             return true;
           case ACCESS_LOST:
             ReportOptimizedOut(cx, id);
             return false;
           default:
             MOZ_CRASH("bad AccessResult");
         }
     }
 
     bool getMissingArgumentsMaybeSentinelValue(JSContext* cx, EnvironmentObject& env,
                                                MutableHandleValue vp) const
     {
         RootedArgumentsObject argsObj(cx);
-        if (!createMissingArguments(cx, env, &argsObj))
+        if (!createMissingArguments(cx, env, &argsObj)) {
             return false;
+        }
         vp.set(argsObj ? ObjectValue(*argsObj) : MagicValue(JS_OPTIMIZED_ARGUMENTS));
         return true;
     }
 
     bool getMissingThisMaybeSentinelValue(JSContext* cx, EnvironmentObject& env,
                                           MutableHandleValue vp) const
     {
         RootedValue thisv(cx);
         bool success;
-        if (!createMissingThis(cx, env, &thisv, &success))
+        if (!createMissingThis(cx, env, &thisv, &success)) {
             return false;
+        }
         vp.set(success ? thisv : MagicValue(JS_OPTIMIZED_OUT));
         return true;
     }
 
     /*
      * Like 'get', but returns sentinel values instead of throwing on
      * exceptional cases.
      */
     bool getMaybeSentinelValue(JSContext* cx, Handle<DebugEnvironmentProxy*> debugEnv,
                                HandleId id, MutableHandleValue vp) const
     {
         Rooted<EnvironmentObject*> env(cx, &debugEnv->environment());
 
-        if (isMissingArguments(cx, id, *env))
+        if (isMissingArguments(cx, id, *env)) {
             return getMissingArgumentsMaybeSentinelValue(cx, *env, vp);
-        if (isMissingThis(cx, id, *env))
+        }
+        if (isMissingThis(cx, id, *env)) {
             return getMissingThisMaybeSentinelValue(cx, *env, vp);
+        }
 
         AccessResult access;
-        if (!handleUnaliasedAccess(cx, debugEnv, env, id, GET, vp, &access))
+        if (!handleUnaliasedAccess(cx, debugEnv, env, id, GET, vp, &access)) {
             return false;
+        }
 
         switch (access) {
           case ACCESS_UNALIASED:
-            if (isMagicMissingArgumentsValue(*env, vp))
+            if (isMagicMissingArgumentsValue(*env, vp)) {
                 return getMissingArgumentsMaybeSentinelValue(cx, *env, vp);
-            if (isMaybeUninitializedThisValue(cx, id, vp))
+            }
+            if (isMaybeUninitializedThisValue(cx, id, vp)) {
                 return getMissingThisMaybeSentinelValue(cx, *env, vp);
+            }
             return true;
           case ACCESS_GENERIC:
-            if (!GetProperty(cx, env, env, id, vp))
+            if (!GetProperty(cx, env, env, id, vp)) {
                 return false;
-            if (isMaybeUninitializedThisValue(cx, id, vp))
+            }
+            if (isMaybeUninitializedThisValue(cx, id, vp)) {
                 return getMissingThisMaybeSentinelValue(cx, *env, vp);
+            }
             return true;
           case ACCESS_LOST:
             vp.setMagic(JS_OPTIMIZED_OUT);
             return true;
           default:
             MOZ_CRASH("bad AccessResult");
         }
     }
 
     bool set(JSContext* cx, HandleObject proxy, HandleId id, HandleValue v, HandleValue receiver,
              ObjectOpResult& result) const override
     {
         Rooted<DebugEnvironmentProxy*> debugEnv(cx, &proxy->as<DebugEnvironmentProxy>());
         Rooted<EnvironmentObject*> env(cx, &proxy->as<DebugEnvironmentProxy>().environment());
 
-        if (debugEnv->isOptimizedOut())
+        if (debugEnv->isOptimizedOut()) {
             return Throw(cx, id, JSMSG_DEBUG_CANT_SET_OPT_ENV);
+        }
 
         AccessResult access;
         RootedValue valCopy(cx, v);
-        if (!handleUnaliasedAccess(cx, debugEnv, env, id, SET, &valCopy, &access))
+        if (!handleUnaliasedAccess(cx, debugEnv, env, id, SET, &valCopy, &access)) {
             return false;
+        }
 
         switch (access) {
           case ACCESS_UNALIASED:
             return result.succeed();
           case ACCESS_GENERIC: {
             RootedValue envVal(cx, ObjectValue(*env));
             return SetProperty(cx, env, id, v, envVal, result);
           }
@@ -2181,74 +2304,84 @@ class DebugEnvironmentProxyHandler : pub
 
     bool defineProperty(JSContext* cx, HandleObject proxy, HandleId id,
                         Handle<PropertyDescriptor> desc,
                         ObjectOpResult& result) const override
     {
         Rooted<EnvironmentObject*> env(cx, &proxy->as<DebugEnvironmentProxy>().environment());
 
         bool found;
-        if (!has(cx, proxy, id, &found))
+        if (!has(cx, proxy, id, &found)) {
             return false;
-        if (found)
+        }
+        if (found) {
             return Throw(cx, id, JSMSG_CANT_REDEFINE_PROP);
+        }
 
         return JS_DefinePropertyById(cx, env, id, desc, result);
     }
 
     bool ownPropertyKeys(JSContext* cx, HandleObject proxy, AutoIdVector& props) const override
     {
         Rooted<EnvironmentObject*> env(cx, &proxy->as<DebugEnvironmentProxy>().environment());
 
         if (isMissingArgumentsBinding(*env)) {
-            if (!props.append(NameToId(cx->names().arguments)))
+            if (!props.append(NameToId(cx->names().arguments))) {
                 return false;
+            }
         }
         if (isMissingThisBinding(*env)) {
-            if (!props.append(NameToId(cx->names().dotThis)))
+            if (!props.append(NameToId(cx->names().dotThis))) {
                 return false;
+            }
         }
 
         // WithEnvironmentObject isn't a very good proxy.  It doesn't have a
         // JSNewEnumerateOp implementation, because if it just delegated to the
         // target object, the object would indicate that native enumeration is
         // the thing to do, but native enumeration over the WithEnvironmentObject
         // wrapper yields no properties.  So instead here we hack around the
         // issue: punch a hole through to the with object target, then manually
         // examine @@unscopables.
         RootedObject target(cx);
         bool isWith = env->is<WithEnvironmentObject>();
-        if (isWith)
+        if (isWith) {
             target = &env->as<WithEnvironmentObject>().object();
-        else
+        } else {
             target = env;
-        if (!GetPropertyKeys(cx, target, JSITER_OWNONLY, &props))
+        }
+        if (!GetPropertyKeys(cx, target, JSITER_OWNONLY, &props)) {
             return false;
+        }
 
         if (isWith) {
             size_t j = 0;
             for (size_t i = 0; i < props.length(); i++) {
                 bool inScope;
-                if (!CheckUnscopables(cx, env, props[i], &inScope))
+                if (!CheckUnscopables(cx, env, props[i], &inScope)) {
                     return false;
-                if (inScope)
+                }
+                if (inScope) {
                     props[j++].set(props[i]);
+                }
             }
-            if (!props.resize(j))
+            if (!props.resize(j)) {
                 return false;
+            }
         }
 
         /*
          * Environments with Scopes are optimized to not contain unaliased
          * variables so they must be manually appended here.
          */
         if (Scope* scope = getEnvironmentScope(*env)) {
             for (Rooted<BindingIter> bi(cx, BindingIter(scope)); bi; bi++) {
-                if (!bi.closedOver() && !props.append(NameToId(bi.name()->asPropertyName())))
+                if (!bi.closedOver() && !props.append(NameToId(bi.name()->asPropertyName()))) {
                     return false;
+                }
             }
         }
 
         return true;
     }
 
     bool has(JSContext* cx, HandleObject proxy, HandleId id_, bool* bp) const override
     {
@@ -2264,18 +2397,19 @@ class DebugEnvironmentProxyHandler : pub
         // assert in with_HasProperty.
         if (isThis(cx, id)) {
             *bp = isFunctionEnvironmentWithThis(envObj);
             return true;
         }
 
         bool found;
         RootedObject env(cx, &envObj);
-        if (!JS_HasPropertyById(cx, env, id, &found))
+        if (!JS_HasPropertyById(cx, env, id, &found)) {
             return false;
+        }
 
         if (!found) {
             if (Scope* scope = getEnvironmentScope(*env)) {
                 for (BindingIter bi(scope); bi; bi++) {
                     if (!bi.closedOver() && NameToId(bi.name()->asPropertyName()) == id) {
                         found = true;
                         break;
                     }
@@ -2310,18 +2444,19 @@ const DebugEnvironmentProxyHandler Debug
 DebugEnvironmentProxy::create(JSContext* cx, EnvironmentObject& env, HandleObject enclosing)
 {
     MOZ_ASSERT(env.realm() == cx->realm());
     MOZ_ASSERT(!enclosing->is<EnvironmentObject>());
 
     RootedValue priv(cx, ObjectValue(env));
     JSObject* obj = NewProxyObject(cx, &DebugEnvironmentProxyHandler::singleton, priv,
                                    nullptr /* proto */);
-    if (!obj)
+    if (!obj) {
         return nullptr;
+    }
 
     DebugEnvironmentProxy* debugEnv = &obj->as<DebugEnvironmentProxy>();
     debugEnv->setReservedSlot(ENCLOSING_SLOT, ObjectValue(*enclosing));
     debugEnv->setReservedSlot(SNAPSHOT_SLOT, NullValue());
 
     return debugEnv;
 }
 
@@ -2376,18 +2511,19 @@ DebugEnvironmentProxy::isFunctionEnviron
     return DebugEnvironmentProxyHandler::isFunctionEnvironmentWithThis(environment());
 }
 
 bool
 DebugEnvironmentProxy::isOptimizedOut() const
 {
     EnvironmentObject& e = environment();
 
-    if (DebugEnvironments::hasLiveEnvironment(e))
+    if (DebugEnvironments::hasLiveEnvironment(e)) {
         return false;
+    }
 
     if (e.is<LexicalEnvironmentObject>()) {
         return !e.as<LexicalEnvironmentObject>().isExtensible() &&
                !e.as<LexicalEnvironmentObject>().scope().hasEnvironment();
     }
 
     if (e.is<CallObject>()) {
         return !e.as<CallObject>().callee().needsCallObject() &&
@@ -2501,67 +2637,73 @@ CanUseDebugEnvironmentMaps(JSContext* cx
 {
     return cx->realm()->isDebuggee();
 }
 
 DebugEnvironments*
 DebugEnvironments::ensureRealmData(JSContext* cx)
 {
     Realm* realm = cx->realm();
-    if (auto* debugEnvs = realm->debugEnvs())
+    if (auto* debugEnvs = realm->debugEnvs()) {
         return debugEnvs;
+    }
 
     auto debugEnvs = cx->make_unique<DebugEnvironments>(cx, cx->zone());
-    if (!debugEnvs)
+    if (!debugEnvs) {
         return nullptr;
+    }
 
     realm->debugEnvsRef() = std::move(debugEnvs);
     return realm->debugEnvs();
 }
 
 /* static */ DebugEnvironmentProxy*
 DebugEnvironments::hasDebugEnvironment(JSContext* cx, EnvironmentObject& env)
 {
     DebugEnvironments* envs = env.realm()->debugEnvs();
-    if (!envs)
+    if (!envs) {
         return nullptr;
+    }
 
     if (JSObject* obj = envs->proxiedEnvs.lookup(&env)) {
         MOZ_ASSERT(CanUseDebugEnvironmentMaps(cx));
         return &obj->as<DebugEnvironmentProxy>();
     }
 
     return nullptr;
 }
 
 /* static */ bool
 DebugEnvironments::addDebugEnvironment(JSContext* cx, Handle<EnvironmentObject*> env,
                                        Handle<DebugEnvironmentProxy*> debugEnv)
 {
     MOZ_ASSERT(cx->realm() == env->realm());
     MOZ_ASSERT(cx->realm() == debugEnv->nonCCWRealm());
 
-    if (!CanUseDebugEnvironmentMaps(cx))
+    if (!CanUseDebugEnvironmentMaps(cx)) {
         return true;
+    }
 
     DebugEnvironments* envs = ensureRealmData(cx);
-    if (!envs)
+    if (!envs) {
         return false;
+    }
 
     return envs->proxiedEnvs.add(cx, env, debugEnv);
 }
 
 /* static */ DebugEnvironmentProxy*
 DebugEnvironments::hasDebugEnvironment(JSContext* cx, const EnvironmentIter& ei)
 {
     MOZ_ASSERT(!ei.hasSyntacticEnvironment());
 
     DebugEnvironments* envs = cx->realm()->debugEnvs();
-    if (!envs)
+    if (!envs) {
         return nullptr;
+    }
 
     if (MissingEnvironmentMap::Ptr p = envs->missingEnvs.lookup(MissingEnvironmentKey(ei))) {
         MOZ_ASSERT(CanUseDebugEnvironmentMaps(cx));
         return p->value();
     }
     return nullptr;
 }
 
@@ -2571,22 +2713,24 @@ DebugEnvironments::addDebugEnvironment(J
 {
     MOZ_ASSERT(!ei.hasSyntacticEnvironment());
     MOZ_ASSERT(cx->realm() == debugEnv->nonCCWRealm());
     // Generators should always have environments.
     MOZ_ASSERT_IF(ei.scope().is<FunctionScope>(),
                   !ei.scope().as<FunctionScope>().canonicalFunction()->isGenerator() &&
                   !ei.scope().as<FunctionScope>().canonicalFunction()->isAsync());
 
-    if (!CanUseDebugEnvironmentMaps(cx))
+    if (!CanUseDebugEnvironmentMaps(cx)) {
         return true;
+    }
 
     DebugEnvironments* envs = ensureRealmData(cx);
-    if (!envs)
+    if (!envs) {
         return false;
+    }
 
     MissingEnvironmentKey key(ei);
     MOZ_ASSERT(!envs->missingEnvs.has(key));
     if (!envs->missingEnvs.put(key, ReadBarriered<DebugEnvironmentProxy*>(debugEnv))) {
         ReportOutOfMemory(cx);
         return false;
     }
 
@@ -2631,27 +2775,29 @@ DebugEnvironments::takeFrameSnapshot(JSC
         // even if we don't need all of them (like in the case of a defaults
         // parameter scope having frame slots).
         uint32_t numFormals = frame.numFormalArgs();
         if (!vec.resize(numFormals + frameSlotCount)) {
             cx->recoverFromOutOfMemory();
             return;
         }
         mozilla::PodCopy(vec.begin(), frame.argv(), numFormals);
-        for (uint32_t slot = 0; slot < frameSlotCount; slot++)
+        for (uint32_t slot = 0; slot < frameSlotCount; slot++) {
             vec[slot + frame.numFormalArgs()].set(frame.unaliasedLocal(slot));
+        }
 
         /*
          * Copy in formals that are not aliased via the scope chain
          * but are aliased via the arguments object.
          */
         if (script->analyzedArgsUsage() && script->needsArgsObj() && frame.hasArgsObj()) {
             for (unsigned i = 0; i < frame.numFormalArgs(); ++i) {
-                if (script->formalLivesInArgumentsObject(i))
+                if (script->formalLivesInArgumentsObject(i)) {
                     vec[i].set(frame.argsObj().arg(i));
+                }
             }
         }
     } else {
         uint32_t frameSlotStart;
         uint32_t frameSlotEnd;
 
         if (debugEnv->environment().is<LexicalEnvironmentObject>()) {
             LexicalScope* scope = &debugEnv->environment().as<LexicalEnvironmentObject>().scope();
@@ -2673,22 +2819,24 @@ DebugEnvironments::takeFrameSnapshot(JSC
 
         uint32_t frameSlotCount = frameSlotEnd - frameSlotStart;
         MOZ_ASSERT(frameSlotCount <= frame.script()->nfixed());
 
         if (!vec.resize(frameSlotCount)) {
             cx->recoverFromOutOfMemory();
             return;
         }
-        for (uint32_t slot = frameSlotStart; slot < frameSlotCount; slot++)
+        for (uint32_t slot = frameSlotStart; slot < frameSlotCount; slot++) {
             vec[slot - frameSlotStart].set(frame.unaliasedLocal(slot));
+        }
     }
 
-    if (vec.length() == 0)
+    if (vec.length() == 0) {
         return;
+    }
 
     /*
      * Use a dense array as storage (since proxies do not have trace
      * hooks). This array must not escape into the wild.
      */
     RootedArrayObject snapshot(cx, NewDenseCopiedArray(cx, vec.length(), vec.begin()));
     if (!snapshot) {
         MOZ_ASSERT(cx->isThrowingOutOfMemory() || cx->isThrowingOverRecursed());
@@ -2700,72 +2848,79 @@ DebugEnvironments::takeFrameSnapshot(JSC
 }
 
 /* static */ void
 DebugEnvironments::onPopCall(JSContext* cx, AbstractFramePtr frame)
 {
     cx->check(frame);
 
     DebugEnvironments* envs = cx->realm()->debugEnvs();
-    if (!envs)
+    if (!envs) {
         return;
+    }
 
     Rooted<DebugEnvironmentProxy*> debugEnv(cx, nullptr);
 
     FunctionScope* funScope = &frame.script()->bodyScope()->as<FunctionScope>();
     if (funScope->hasEnvironment()) {
         MOZ_ASSERT(frame.callee()->needsCallObject());
 
         /*
          * The frame may be observed before the prologue has created the
          * CallObject. See EnvironmentIter::settle.
          */
-        if (!frame.environmentChain()->is<CallObject>())
+        if (!frame.environmentChain()->is<CallObject>()) {
             return;
-
-        if (frame.callee()->isGenerator() || frame.callee()->isAsync())
+        }
+
+        if (frame.callee()->isGenerator() || frame.callee()->isAsync()) {
             return;
+        }
 
         CallObject& callobj = frame.environmentChain()->as<CallObject>();
         envs->liveEnvs.remove(&callobj);
-        if (JSObject* obj = envs->proxiedEnvs.lookup(&callobj))
+        if (JSObject* obj = envs->proxiedEnvs.lookup(&callobj)) {
             debugEnv = &obj->as<DebugEnvironmentProxy>();
+        }
     } else {
         MissingEnvironmentKey key(frame, funScope);
         if (MissingEnvironmentMap::Ptr p = envs->missingEnvs.lookup(key)) {
             debugEnv = p->value();
             envs->liveEnvs.remove(&debugEnv->environment().as<CallObject>());
             envs->missingEnvs.remove(p);
         }
     }
 
-    if (debugEnv)
+    if (debugEnv) {
         DebugEnvironments::takeFrameSnapshot(cx, debugEnv, frame);
+    }
 }
 
 void
 DebugEnvironments::onPopLexical(JSContext* cx, AbstractFramePtr frame, jsbytecode* pc)
 {
     cx->check(frame);
 
     DebugEnvironments* envs = cx->realm()->debugEnvs();
-    if (!envs)
+    if (!envs) {
         return;
+    }
 
     EnvironmentIter ei(cx, frame, pc);
     onPopLexical(cx, ei);
 }
 
 template <typename Environment, typename Scope>
 void
 DebugEnvironments::onPopGeneric(JSContext* cx, const EnvironmentIter& ei)
 {
     DebugEnvironments* envs = cx->realm()->debugEnvs();
-    if (!envs)
+    if (!envs) {
         return;
+    }
 
     MOZ_ASSERT(ei.withinInitialFrame());
     MOZ_ASSERT(ei.scope().is<Scope>());
 
     Rooted<Environment*> env(cx);
     if (MissingEnvironmentMap::Ptr p = envs->missingEnvs.lookup(MissingEnvironmentKey(ei))) {
         env = &p->value()->environment().as<Environment>();
         envs->missingEnvs.remove(p);
@@ -2790,224 +2945,250 @@ DebugEnvironments::onPopLexical(JSContex
 }
 
 void
 DebugEnvironments::onPopVar(JSContext* cx, AbstractFramePtr frame, jsbytecode* pc)
 {
     cx->check(frame);
 
     DebugEnvironments* envs = cx->realm()->debugEnvs();
-    if (!envs)
+    if (!envs) {
         return;
+    }
 
     EnvironmentIter ei(cx, frame, pc);
     onPopVar(cx, ei);
 }
 
 void
 DebugEnvironments::onPopVar(JSContext* cx, const EnvironmentIter& ei)
 {
-    if (ei.scope().is<EvalScope>())
+    if (ei.scope().is<EvalScope>()) {
         onPopGeneric<VarEnvironmentObject, EvalScope>(cx, ei);
-    else
+    } else {
         onPopGeneric<VarEnvironmentObject, VarScope>(cx, ei);
+    }
 }
 
 void
 DebugEnvironments::onPopWith(AbstractFramePtr frame)
 {
     Realm* realm = frame.realm();
-    if (DebugEnvironments* envs = realm->debugEnvs())
+    if (DebugEnvironments* envs = realm->debugEnvs()) {
         envs->liveEnvs.remove(&frame.environmentChain()->as<WithEnvironmentObject>());
+    }
 }
 
 void
 DebugEnvironments::onRealmUnsetIsDebuggee(Realm* realm)
 {
     if (DebugEnvironments* envs = realm->debugEnvs()) {
         envs->proxiedEnvs.clear();
         envs->missingEnvs.clear();
         envs->liveEnvs.clear();
     }
 }
 
 bool
 DebugEnvironments::updateLiveEnvironments(JSContext* cx)
 {
-    if (!CheckRecursionLimit(cx))
+    if (!CheckRecursionLimit(cx)) {
         return false;
+    }
 
     /*
      * Note that we must always update the top frame's environment objects'
      * entries in liveEnvs because we can't be sure code hasn't run in that
      * frame to change the environment chain since we were last called. The
      * fp->prevUpToDate() flag indicates whether the environments of frames
      * older than fp are already included in liveEnvs. It might seem simpler
      * to have fp instead carry a flag indicating whether fp itself is
      * accurately described, but then we would need to clear that flag
      * whenever fp ran code. By storing the 'up to date' bit for fp->prev() in
      * fp, simply popping fp effectively clears the flag for us, at exactly
      * the time when execution resumes fp->prev().
      */
     for (AllFramesIter i(cx); !i.done(); ++i) {
-        if (!i.hasUsableAbstractFramePtr())
+        if (!i.hasUsableAbstractFramePtr()) {
             continue;
+        }
 
         AbstractFramePtr frame = i.abstractFramePtr();
-        if (frame.realm() != cx->realm())
+        if (frame.realm() != cx->realm()) {
             continue;
+        }
 
         if (frame.isFunctionFrame()) {
-            if (frame.callee()->isGenerator() || frame.callee()->isAsync())
+            if (frame.callee()->isGenerator() || frame.callee()->isAsync()) {
                 continue;
+            }
         }
 
-        if (!frame.isDebuggee())
+        if (!frame.isDebuggee()) {
             continue;
+        }
 
         RootedObject env(cx);
         RootedScope scope(cx);
-        if (!GetFrameEnvironmentAndScope(cx, frame, i.pc(), &env, &scope))
+        if (!GetFrameEnvironmentAndScope(cx, frame, i.pc(), &env, &scope)) {
             return false;
+        }
 
         for (EnvironmentIter ei(cx, env, scope, frame); ei.withinInitialFrame(); ei++) {
             if (ei.hasSyntacticEnvironment() && !ei.scope().is<GlobalScope>()) {
                 MOZ_ASSERT(ei.environment().realm() == cx->realm());
                 DebugEnvironments* envs = ensureRealmData(cx);
-                if (!envs)
+                if (!envs) {
                     return false;
-                if (!envs->liveEnvs.put(&ei.environment(), LiveEnvironmentVal(ei)))
+                }
+                if (!envs->liveEnvs.put(&ei.environment(), LiveEnvironmentVal(ei))) {
                     return false;
+                }
             }
         }
 
-        if (frame.prevUpToDate())
+        if (frame.prevUpToDate()) {
             return true;
+        }
         MOZ_ASSERT(frame.realm()->isDebuggee());
         frame.setPrevUpToDate();
     }
 
     return true;
 }
 
 LiveEnvironmentVal*
 DebugEnvironments::hasLiveEnvironment(EnvironmentObject& env)
 {
     DebugEnvironments* envs = env.realm()->debugEnvs();
-    if (!envs)
+    if (!envs) {
         return nullptr;
-
-    if (LiveEnvironmentMap::Ptr p = envs->liveEnvs.lookup(&env))
+    }
+
+    if (LiveEnvironmentMap::Ptr p = envs->liveEnvs.lookup(&env)) {
         return &p->value();
+    }
 
     return nullptr;
 }
 
 /* static */ void
 DebugEnvironments::unsetPrevUpToDateUntil(JSContext* cx, AbstractFramePtr until)
 {
     // This are two exceptions where fp->prevUpToDate() is cleared without
     // popping the frame. When a frame is rematerialized or has its
     // debuggeeness toggled off->on, all frames younger than the frame must
     // have their prevUpToDate set to false. This is because unrematerialized
     // Ion frames and non-debuggee frames are skipped by updateLiveEnvironments. If
     // in the future a frame suddenly gains a usable AbstractFramePtr via
     // rematerialization or becomes a debuggee, the prevUpToDate invariant
     // will no longer hold for older frames on its stack.
     for (AllFramesIter i(cx); !i.done(); ++i) {
-        if (!i.hasUsableAbstractFramePtr())
+        if (!i.hasUsableAbstractFramePtr()) {
             continue;
+        }
 
         AbstractFramePtr frame = i.abstractFramePtr();
-        if (frame == until)
+        if (frame == until) {
             return;
-
-        if (frame.realm() != cx->realm())
+        }
+
+        if (frame.realm() != cx->realm()) {
             continue;
+        }
 
         frame.unsetPrevUpToDate();
     }
 }
 
 /* static */ void
 DebugEnvironments::forwardLiveFrame(JSContext* cx, AbstractFramePtr from, AbstractFramePtr to)
 {
     DebugEnvironments* envs = cx->realm()->debugEnvs();
-    if (!envs)
+    if (!envs) {
         return;
+    }
 
     for (MissingEnvironmentMap::Enum e(envs->missingEnvs); !e.empty(); e.popFront()) {
         MissingEnvironmentKey key = e.front().key();
         if (key.frame() == from) {
             key.updateFrame(to);
             e.rekeyFront(key);
         }
     }
 
     for (LiveEnvironmentMap::Enum e(envs->liveEnvs); !e.empty(); e.popFront()) {
         LiveEnvironmentVal& val = e.front().value();
-        if (val.frame() == from)
+        if (val.frame() == from) {
             val.updateFrame(to);
+        }
     }
 }
 
 /* static */ void
 DebugEnvironments::traceLiveFrame(JSTracer* trc, AbstractFramePtr frame)
 {
     for (MissingEnvironmentMap::Enum e(missingEnvs); !e.empty(); e.popFront()) {
-        if (e.front().key().frame() == frame)
+        if (e.front().key().frame() == frame) {
             TraceEdge(trc, &e.front().value(), "debug-env-live-frame-missing-env");
+        }
     }
 }
 
 /*****************************************************************************/
 
 static JSObject*
 GetDebugEnvironment(JSContext* cx, const EnvironmentIter& ei);
 
 static DebugEnvironmentProxy*
 GetDebugEnvironmentForEnvironmentObject(JSContext* cx, const EnvironmentIter& ei)
 {
     Rooted<EnvironmentObject*> env(cx, &ei.environment());
-    if (DebugEnvironmentProxy* debugEnv = DebugEnvironments::hasDebugEnvironment(cx, *env))
+    if (DebugEnvironmentProxy* debugEnv = DebugEnvironments::hasDebugEnvironment(cx, *env)) {
         return debugEnv;
+    }
 
     EnvironmentIter copy(cx, ei);
     RootedObject enclosingDebug(cx, GetDebugEnvironment(cx, ++copy));
-    if (!enclosingDebug)
+    if (!enclosingDebug) {
         return nullptr;
+    }
 
     Rooted<DebugEnvironmentProxy*> debugEnv(cx,
         DebugEnvironmentProxy::create(cx, *env, enclosingDebug));
-    if (!debugEnv)
+    if (!debugEnv) {
         return nullptr;
-
-    if (!DebugEnvironments::addDebugEnvironment(cx, env, debugEnv))
+    }
+
+    if (!DebugEnvironments::addDebugEnvironment(cx, env, debugEnv)) {
         return nullptr;
+    }
 
     return debugEnv;
 }
 
 static DebugEnvironmentProxy*
 GetDebugEnvironmentForMissing(JSContext* cx, const EnvironmentIter& ei)
 {
     MOZ_ASSERT(!ei.hasSyntacticEnvironment() &&
                (ei.scope().is<FunctionScope>() ||
                 ei.scope().is<LexicalScope>() ||
                 ei.scope().is<WasmInstanceScope>() ||
                 ei.scope().is<WasmFunctionScope>() ||
                 ei.scope().is<VarScope>()));
 
-    if (DebugEnvironmentProxy* debugEnv = DebugEnvironments::hasDebugEnvironment(cx, ei))
+    if (DebugEnvironmentProxy* debugEnv = DebugEnvironments::hasDebugEnvironment(cx, ei)) {
         return debugEnv;
+    }
 
     EnvironmentIter copy(cx, ei);
     RootedObject enclosingDebug(cx, GetDebugEnvironment(cx, ++copy));
-    if (!enclosingDebug)
+    if (!enclosingDebug) {
         return nullptr;
+    }
 
     /*
      * Create the missing environment object. For lexical environment objects,
      * this takes care of storing variable values after the stack frame has
      * been popped. For call objects, we only use the pretend call object to
      * access callee, bindings and to receive dynamically added
      * properties. Together, this provides the nice invariant that every
      * DebugEnvironmentProxy has a EnvironmentObject.
@@ -3019,87 +3200,98 @@ GetDebugEnvironmentForMissing(JSContext*
     Rooted<DebugEnvironmentProxy*> debugEnv(cx);
     if (ei.scope().is<FunctionScope>()) {
         RootedFunction callee(cx, ei.scope().as<FunctionScope>().canonicalFunction());
         // Generators should always reify their scopes.
         MOZ_ASSERT(!callee->isGenerator() && !callee->isAsync());
 
         JS::ExposeObjectToActiveJS(callee);
         Rooted<CallObject*> callobj(cx, CallObject::createHollowForDebug(cx, callee));
-        if (!callobj)
+        if (!callobj) {
             return nullptr;
+        }
 
         debugEnv = DebugEnvironmentProxy::create(cx, *callobj, enclosingDebug);
     } else if (ei.scope().is<LexicalScope>()) {
         Rooted<LexicalScope*> lexicalScope(cx, &ei.scope().as<LexicalScope>());
         Rooted<LexicalEnvironmentObject*> env(cx,
             LexicalEnvironmentObject::createHollowForDebug(cx, lexicalScope));
-        if (!env)
+        if (!env) {
             return nullptr;
+        }
 
         debugEnv = DebugEnvironmentProxy::create(cx, *env, enclosingDebug);
     } else if (ei.scope().is<WasmInstanceScope>()) {
         Rooted<WasmInstanceScope*> wasmInstanceScope(cx, &ei.scope().as<WasmInstanceScope>());
         Rooted<WasmInstanceEnvironmentObject*> env(cx,
             WasmInstanceEnvironmentObject::createHollowForDebug(cx, wasmInstanceScope));
-        if (!env)
+        if (!env) {
             return nullptr;
+        }
 
         debugEnv = DebugEnvironmentProxy::create(cx, *env, enclosingDebug);
     } else if (ei.scope().is<WasmFunctionScope>()) {
         Rooted<WasmFunctionScope*> wasmFunctionScope(cx, &ei.scope().as<WasmFunctionScope>());
         RootedObject enclosing(cx, &enclosingDebug->as<DebugEnvironmentProxy>().environment());
         Rooted<WasmFunctionCallObject*> callobj(cx,
             WasmFunctionCallObject::createHollowForDebug(cx, enclosing, wasmFunctionScope));
-        if (!callobj)
+        if (!callobj) {
             return nullptr;
+        }
 
         debugEnv = DebugEnvironmentProxy::create(cx, *callobj, enclosingDebug);
     } else {
         Rooted<VarScope*> varScope(cx, &ei.scope().as<VarScope>());
         Rooted<VarEnvironmentObject*> env(cx,
             VarEnvironmentObject::createHollowForDebug(cx, varScope));
-        if (!env)
+        if (!env) {
             return nullptr;
+        }
 
         debugEnv = DebugEnvironmentProxy::create(cx, *env, enclosingDebug);
     }
 
-    if (!debugEnv)
+    if (!debugEnv) {
         return nullptr;
-
-    if (!DebugEnvironments::addDebugEnvironment(cx, ei, debugEnv))
+    }
+
+    if (!DebugEnvironments::addDebugEnvironment(cx, ei, debugEnv)) {
         return nullptr;
+    }
 
     return debugEnv;
 }
 
 static JSObject*
 GetDebugEnvironmentForNonEnvironmentObject(const EnvironmentIter& ei)
 {
     JSObject& enclosing = ei.enclosingEnvironment();
 #ifdef DEBUG
     JSObject* o = &enclosing;
-    while ((o = o->enclosingEnvironment()))
+    while ((o = o->enclosingEnvironment())) {
         MOZ_ASSERT(!o->is<EnvironmentObject>());
+    }
 #endif
     return &enclosing;
 }
 
 static JSObject*
 GetDebugEnvironment(JSContext* cx, const EnvironmentIter& ei)
 {
-    if (!CheckRecursionLimit(cx))
+    if (!CheckRecursionLimit(cx)) {
         return nullptr;
-
-    if (ei.done())
+    }
+
+    if (ei.done()) {
         return GetDebugEnvironmentForNonEnvironmentObject(ei);
-
-    if (ei.hasAnyEnvironmentObject())
+    }
+
+    if (ei.hasAnyEnvironmentObject()) {
         return GetDebugEnvironmentForEnvironmentObject(cx, ei);
+    }
 
     if (ei.scope().is<FunctionScope>() ||
         ei.scope().is<LexicalScope>() ||
         ei.scope().is<WasmInstanceScope>() ||
         ei.scope().is<WasmFunctionScope>() ||
         ei.scope().is<VarScope>())
     {
         return GetDebugEnvironmentForMissing(cx, ei);
@@ -3109,36 +3301,40 @@ GetDebugEnvironment(JSContext* cx, const
     return GetDebugEnvironment(cx, ++copy);
 }
 
 JSObject*
 js::GetDebugEnvironmentForFunction(JSContext* cx, HandleFunction fun)
 {
     cx->check(fun);
     MOZ_ASSERT(CanUseDebugEnvironmentMaps(cx));
-    if (!DebugEnvironments::updateLiveEnvironments(cx))
+    if (!DebugEnvironments::updateLiveEnvironments(cx)) {
         return nullptr;
+    }
     JSScript* script = JSFunction::getOrCreateScript(cx, fun);
-    if (!script)
+    if (!script) {
         return nullptr;
+    }
     EnvironmentIter ei(cx, fun->environment(), script->enclosingScope());
     return GetDebugEnvironment(cx, ei);
 }
 
 JSObject*
 js::GetDebugEnvironmentForFrame(JSContext* cx, AbstractFramePtr frame, jsbytecode* pc)
 {
     cx->check(frame);
-    if (CanUseDebugEnvironmentMaps(cx) && !DebugEnvironments::updateLiveEnvironments(cx))
+    if (CanUseDebugEnvironmentMaps(cx) && !DebugEnvironments::updateLiveEnvironments(cx)) {
         return nullptr;
+    }
 
     RootedObject env(cx);
     RootedScope scope(cx);
-    if (!GetFrameEnvironmentAndScope(cx, frame, pc, &env, &scope))
+    if (!GetFrameEnvironmentAndScope(cx, frame, pc, &env, &scope)) {
         return nullptr;
+    }
 
     EnvironmentIter ei(cx, env, scope, frame);
     return GetDebugEnvironment(cx, ei);
 }
 
 JSObject*
 js::GetDebugEnvironmentForGlobalLexicalEnvironment(JSContext* cx)
 {
@@ -3159,18 +3355,19 @@ js::CreateObjectsForEnvironmentChain(JSC
 #endif
 
     // Construct With object wrappers for the things on this environment chain
     // and use the result as the thing to scope the function to.
     Rooted<WithEnvironmentObject*> withEnv(cx);
     RootedObject enclosingEnv(cx, terminatingEnv);
     for (size_t i = chain.length(); i > 0; ) {
         withEnv = WithEnvironmentObject::createNonSyntactic(cx, chain[--i], enclosingEnv);
-        if (!withEnv)
+        if (!withEnv) {
             return false;
+        }
         enclosingEnv = withEnv;
     }
 
     envObj.set(enclosingEnv);
     return true;
 }
 
 JSObject&
@@ -3199,40 +3396,43 @@ WithEnvironmentObject::scope() const
     MOZ_ASSERT(isSyntactic());
     return *static_cast<WithScope*>(getReservedSlot(SCOPE_SLOT).toGCThing());
 }
 
 ModuleEnvironmentObject*
 js::GetModuleEnvironmentForScript(JSScript* script)
 {
     ModuleObject* module = GetModuleObjectForScript(script);
-    if (!module)
+    if (!module) {
         return nullptr;
+    }
 
     return module->environment();
 }
 
 ModuleObject*
 js::GetModuleObjectForScript(JSScript* script)
 {
     for (ScopeIter si(script); si; si++) {
-        if (si.kind() == ScopeKind::Module)
+        if (si.kind() == ScopeKind::Module) {
             return si.scope()->as<ModuleScope>().module();
+        }
     }
     return nullptr;
 }
 
 bool
 js::GetThisValueForDebuggerMaybeOptimizedOut(JSContext* cx, AbstractFramePtr frame, jsbytecode* pc,
                                              MutableHandleValue res)
 {
     RootedObject scopeChain(cx);
     RootedScope scope(cx);
-    if (!GetFrameEnvironmentAndScope(cx, frame, pc, &scopeChain, &scope))
+    if (!GetFrameEnvironmentAndScope(cx, frame, pc, &scopeChain, &scope)) {
         return false;
+    }
 
     for (EnvironmentIter ei(cx, scopeChain, scope, frame); ei; ei++) {
         if (ei.scope().kind() == ScopeKind::Module) {
             res.setUndefined();
             return true;
         }
 
         if (!ei.scope().is<FunctionScope>() ||
@@ -3266,41 +3466,44 @@ js::GetThisValueForDebuggerMaybeOptimize
                 res.set(frame.thisArgument());
                 return true;
             }
 
             // We didn't initialize the this-binding yet. Determine the
             // correct |this| value for this frame (box primitives if not
             // in strict mode), and assign it to the this-argument slot so
             // JSOP_FUNCTIONTHIS will use it and not box a second time.
-            if (!GetFunctionThis(cx, frame, res))
+            if (!GetFunctionThis(cx, frame, res)) {
                 return false;
+            }
             frame.thisArgument() = res;
             return true;
         }
 
         if (!script->functionHasThisBinding()) {
             res.setMagic(JS_OPTIMIZED_OUT);
             return true;
         }
 
         for (Rooted<BindingIter> bi(cx, BindingIter(script)); bi; bi++) {
-            if (bi.name() != cx->names().dotThis)
+            if (bi.name() != cx->names().dotThis) {
                 continue;
+            }
 
             BindingLocation loc = bi.location();
             if (loc.kind() == BindingLocation::Kind::Environment) {
                 RootedObject callObj(cx, &ei.environment().as<CallObject>());
                 return GetProperty(cx, callObj, callObj, bi.name()->asPropertyName(), res);
             }
 
-            if (loc.kind() == BindingLocation::Kind::Frame && ei.withinInitialFrame())
+            if (loc.kind() == BindingLocation::Kind::Frame && ei.withinInitialFrame()) {
                 res.set(frame.unaliasedLocal(loc.slot()));
-            else
+            } else {
                 res.setMagic(JS_OPTIMIZED_OUT);
+            }
 
             return true;
         }
 
         MOZ_CRASH("'this' binding must be found");
     }
 
     GetNonSyntacticGlobalThis(cx, scopeChain, res);
@@ -3318,25 +3521,28 @@ js::CheckLexicalNameConflict(JSContext* 
         // ES 15.1.11 step 5.a
         redeclKind = "var";
     } else if ((shape = lexicalEnv->lookup(cx, name))) {
         // ES 15.1.11 step 5.b
         redeclKind = shape->writable() ? "let" : "const";
     } else if (varObj->isNative() && (shape = varObj->as<NativeObject>().lookup(cx, name))) {
         // Faster path for ES 15.1.11 step 5.c-d when the shape can be found
         // without going through a resolve hook.
-        if (!shape->configurable())
+        if (!shape->configurable()) {
             redeclKind = "non-configurable global property";
+        }
     } else {
         // ES 15.1.11 step 5.c-d
         Rooted<PropertyDescriptor> desc(cx);
-        if (!GetOwnPropertyDescriptor(cx, varObj, id, &desc))
+        if (!GetOwnPropertyDescriptor(cx, varObj, id, &desc)) {
             return false;
-        if (desc.object() && desc.hasConfigurable() && !desc.configurable())
+        }
+        if (desc.object() && desc.hasConfigurable() && !desc.configurable()) {
             redeclKind = "non-configurable global property";
+        }
     }
 
     if (redeclKind) {
         ReportRuntimeRedeclaration(cx, name, redeclKind);
         return false;
     }
 
     return true;
@@ -3363,42 +3569,46 @@ ReportCannotDeclareGlobalBinding(JSConte
 }
 
 bool
 js::CheckCanDeclareGlobalBinding(JSContext* cx, Handle<GlobalObject*> global,
                                  HandlePropertyName name, bool isFunction)
 {
     RootedId id(cx, NameToId(name));
     Rooted<PropertyDescriptor> desc(cx);
-    if (!GetOwnPropertyDescriptor(cx, global, id, &desc))
+    if (!GetOwnPropertyDescriptor(cx, global, id, &desc)) {
         return false;
+    }
 
     // ES 8.1.1.4.15 CanDeclareGlobalVar
     // ES 8.1.1.4.16 CanDeclareGlobalFunction
 
     // Step 4.
     if (!desc.object()) {
         // 8.1.14.15 step 6.
         // 8.1.14.16 step 5.
-        if (global->isExtensible())
+        if (global->isExtensible()) {
             return true;
+        }
 
         ReportCannotDeclareGlobalBinding(cx, name, "global is non-extensible");
         return false;
     }
 
     // Global functions have additional restrictions.
     if (isFunction) {
         // 8.1.14.16 step 6.
-        if (desc.configurable())
+        if (desc.configurable()) {
             return true;
+        }
 
         // 8.1.14.16 step 7.
-        if (desc.isDataDescriptor() && desc.writable() && desc.enumerable())
+        if (desc.isDataDescriptor() && desc.writable() && desc.enumerable()) {
             return true;
+        }
 
         ReportCannotDeclareGlobalBinding(cx, name,
                                          "property must be configurable or "
                                          "both writable and enumerable");
         return false;
     }
 
     return true;
@@ -3420,39 +3630,43 @@ js::CheckGlobalDeclarationConflicts(JSCo
 
     // ES 15.1.11 GlobalDeclarationInstantiation
 
     // Step 6.
     //
     // Check 'var' declarations do not conflict with existing bindings in the
     // global lexical environment.
     for (; bi; bi++) {
-        if (bi.kind() != BindingKind::Var)
+        if (bi.kind() != BindingKind::Var) {
             break;
+        }
         name = bi.name()->asPropertyName();
-        if (!CheckVarNameConflict(cx, lexicalEnv, name))
+        if (!CheckVarNameConflict(cx, lexicalEnv, name)) {
             return false;
+        }
 
         // Step 10 and 12.
         //
         // Check that global functions and vars may be declared.
         if (varObj->is<GlobalObject>()) {
             Handle<GlobalObject*> global = varObj.as<GlobalObject>();
-            if (!CheckCanDeclareGlobalBinding(cx, global, name, bi.isTopLevelFunction()))
+            if (!CheckCanDeclareGlobalBinding(cx, global, name, bi.isTopLevelFunction())) {
                 return false;
+            }
         }
     }
 
     // Step 5.
     //
     // Check that lexical bindings do not conflict.
     for (; bi; bi++) {
         name = bi.name()->asPropertyName();
-        if (!CheckLexicalNameConflict(cx, lexicalEnv, varObj, name))
+        if (!CheckLexicalNameConflict(cx, lexicalEnv, varObj, name)) {
             return false;
+        }
     }
 
     return true;
 }
 
 static bool
 CheckVarNameConflictsInEnv(JSContext* cx, HandleScript script, HandleObject obj)
 {
@@ -3475,54 +3689,58 @@ CheckVarNameConflictsInEnv(JSContext* cx
         // for-of. The for-of allowance is computed in
         // Parser::isVarRedeclaredInEval.
         return true;
     }
 
     RootedPropertyName name(cx);
     for (BindingIter bi(script); bi; bi++) {
         name = bi.name()->asPropertyName();
-        if (!CheckVarNameConflict(cx, env, name))
+        if (!CheckVarNameConflict(cx, env, name)) {
             return false;
+        }
     }
 
     return true;
 }
 
 bool
 js::CheckEvalDeclarationConflicts(JSContext* cx, HandleScript script,
                                   HandleObject scopeChain, HandleObject varObj)
 {
-    if (!script->bodyScope()->as<EvalScope>().hasBindings())
+    if (!script->bodyScope()->as<EvalScope>().hasBindings()) {
         return true;
+    }
 
     RootedObject obj(cx, scopeChain);
 
     // ES 18.2.1.3.
 
     // Step 5.
     //
     // Check that a direct eval will not hoist 'var' bindings over lexical
     // bindings with the same name.
     while (obj != varObj) {
-        if (!CheckVarNameConflictsInEnv(cx, script, obj))
+        if (!CheckVarNameConflictsInEnv(cx, script, obj)) {
             return false;
+        }
         obj = obj->enclosingEnvironment();
     }
 
     // Step 8.
     //
     // Check that global functions may be declared.
     if (varObj->is<GlobalObject>()) {
         Handle<GlobalObject*> global = varObj.as<GlobalObject>();
         RootedPropertyName name(cx);
         for (Rooted<BindingIter> bi(cx, BindingIter(script)); bi; bi++) {
             name = bi.name()->asPropertyName();
-            if (!CheckCanDeclareGlobalBinding(cx, global, name, bi.isTopLevelFunction()))
+            if (!CheckCanDeclareGlobalBinding(cx, global, name, bi.isTopLevelFunction())) {
                 return false;
+            }
         }
     }
 
     return true;
 }
 
 bool
 js::InitFunctionEnvironmentObjects(JSContext* cx, AbstractFramePtr frame)
@@ -3538,55 +3756,59 @@ js::InitFunctionEnvironmentObjects(JSCon
         if (callee->isAsync()) {
             // Named async function needs special environment to return
             // wrapped function for the binding.
             RootedFunction fun(cx, GetWrappedAsyncFunction(callee));
             declEnv = NamedLambdaObject::create(cx, frame, fun);
         } else {
             declEnv = NamedLambdaObject::create(cx, frame);
         }
-        if (!declEnv)
+        if (!declEnv) {
             return false;
+        }
         frame.pushOnEnvironmentChain(*declEnv);
     }
 
     // If the function has parameter default expressions, there may be an
     // extra environment to hold the parameters.
     if (callee->needsCallObject()) {
         CallObject* callObj = CallObject::create(cx, frame);
-        if (!callObj)
+        if (!callObj) {
             return false;
+        }
         frame.pushOnEnvironmentChain(*callObj);
     }
 
     return true;
 }
 
 bool
 js::PushVarEnvironmentObject(JSContext* cx, HandleScope scope, AbstractFramePtr frame)
 {
     VarEnvironmentObject* env = VarEnvironmentObject::create(cx, scope, frame);
-    if (!env)
+    if (!env) {
         return false;
+    }
     frame.pushOnEnvironmentChain(*env);
     return true;
 }
 
 bool
 js::GetFrameEnvironmentAndScope(JSContext* cx, AbstractFramePtr frame, jsbytecode* pc,
                                 MutableHandleObject env, MutableHandleScope scope)
 {
     env.set(frame.environmentChain());
 
     if (frame.isWasmDebugFrame()) {
         RootedWasmInstanceObject instance(cx, frame.wasmInstance()->object());
         uint32_t funcIndex = frame.asWasmDebugFrame()->funcIndex();
         scope.set(WasmInstanceObject::getFunctionScope(cx, instance, funcIndex));
-        if (!scope)
+        if (!scope) {
             return false;
+        }
     } else {
         scope.set(frame.script()->innermostScope(pc));
     }
     return true;
 }
 
 
 #ifdef DEBUG
@@ -3618,78 +3840,85 @@ RemoveReferencedNames(JSContext* cx, Han
           case JSOP_SETNAME:
           case JSOP_STRICTSETNAME:
             name = script->getName(pc);
             break;
 
           case JSOP_GETGNAME:
           case JSOP_SETGNAME:
           case JSOP_STRICTSETGNAME:
-            if (script->hasNonSyntacticScope())
+            if (script->hasNonSyntacticScope()) {
                 name = script->getName(pc);
-            else
+            } else {
                 name = nullptr;
+            }
             break;
 
           case JSOP_GETALIASEDVAR:
           case JSOP_SETALIASEDVAR:
             name = EnvironmentCoordinateName(cx->caches().envCoordinateNameCache, script, pc);
             break;
 
           default:
             name = nullptr;
             break;
         }
 
-        if (name)
+        if (name) {
             remainingNames.remove(name);
+        }
     }
 
     if (script->hasObjects()) {
         ObjectArray* objects = script->objects();
         RootedFunction fun(cx);
         RootedScript innerScript(cx);
         for (size_t i = 0; i < objects->length; i++) {
             JSObject* obj = objects->vector[i];
             if (obj->is<JSFunction>() && obj->as<JSFunction>().isInterpreted()) {
                 fun = &obj->as<JSFunction>();
                 innerScript = JSFunction::getOrCreateScript(cx, fun);
-                if (!innerScript)
+                if (!innerScript) {
                     return false;
-
-                if (!RemoveReferencedNames(cx, innerScript, remainingNames))
+                }
+
+                if (!RemoveReferencedNames(cx, innerScript, remainingNames)) {
                     return false;
+                }
             }
         }
     }
 
     return true;
 }
 
 static bool
 AnalyzeEntrainedVariablesInScript(JSContext* cx, HandleScript script, HandleScript innerScript)
 {
     PropertyNameSet remainingNames(cx);
 
     for (BindingIter bi(script); bi; bi++) {
         if (bi.closedOver()) {
             PropertyName* name = bi.name()->asPropertyName();
             PropertyNameSet::AddPtr p = remainingNames.lookupForAdd(name);
-            if (!p && !remainingNames.add(p, name))
+            if (!p && !remainingNames.add(p, name)) {
                 return false;
+            }
         }
     }
 
-    if (!RemoveReferencedNames(cx, innerScript, remainingNames))
+    if (!RemoveReferencedNames(cx, innerScript, remainingNames)) {
         return false;
+    }
 
     if (!remainingNames.empty()) {
         Sprinter buf(cx);
-        if (!buf.init())
+        if (!buf.init()) {
             return false;
+        }
 
         buf.printf("Script ");
 
         if (JSAtom* name = script->functionNonDelazifying()->displayAtom()) {
             buf.putString(name);
             buf.printf(" ");
         }
 
@@ -3740,36 +3969,40 @@ AnalyzeEntrainedVariablesInScript(JSCont
 //   function bar() { return a; }
 //   function baz() { return b; }
 // }
 //
 // |bar| unnecessarily entrains |b|, and |baz| unnecessarily entrains |a|.
 bool
 js::AnalyzeEntrainedVariables(JSContext* cx, HandleScript script)
 {
-    if (!script->hasObjects())
+    if (!script->hasObjects()) {
         return true;
+    }
 
     ObjectArray* objects = script->objects();
     RootedFunction fun(cx);
     RootedScript innerScript(cx);
     for (size_t i = 0; i < objects->length; i++) {
         JSObject* obj = objects->vector[i];
         if (obj->is<JSFunction>() && obj->as<JSFunction>().isInterpreted()) {
             fun = &obj->as<JSFunction>();
             innerScript = JSFunction::getOrCreateScript(cx, fun);
-            if (!innerScript)
+            if (!innerScript) {
                 return false;
+            }
 
             if (script->functionDelazifying() && script->functionDelazifying()->needsCallObject()) {
-                if (!AnalyzeEntrainedVariablesInScript(cx, script, innerScript))
+                if (!AnalyzeEntrainedVariablesInScript(cx, script, innerScript)) {
                     return false;
+                }
             }
 
-            if (!AnalyzeEntrainedVariables(cx, innerScript))
+            if (!AnalyzeEntrainedVariables(cx, innerScript)) {
                 return false;
+            }
         }
     }
 
     return true;
 }
 
 #endif
--- a/js/src/vm/EnvironmentObject.h
+++ b/js/src/vm/EnvironmentObject.h
@@ -735,18 +735,19 @@ class MOZ_RAII EnvironmentIter
         return si_.done();
     }
 
     explicit operator bool() const {
         return !done();
     }
 
     void operator++(int) {
-        if (hasAnyEnvironmentObject())
+        if (hasAnyEnvironmentObject()) {
             env_ = &env_->as<EnvironmentObject>().enclosingEnvironment();
+        }
         incrementScopeIter();
         settle();
     }
 
     EnvironmentIter& operator++() {
         operator++(1);
         return *this;
     }
@@ -770,18 +771,19 @@ class MOZ_RAII EnvironmentIter
         return env_->as<EnvironmentObject>();
     }
 
     Scope& scope() const {
         return *si_.scope();
     }
 
     Scope* maybeScope() const {
-        if (si_)
+        if (si_) {
             return si_.scope();
+        }
         return nullptr;
     }
 
     JSFunction& callee() const {
         return env_->as<CallObject>().callee();
     }
 
     bool withinInitialFrame() const {
@@ -1072,27 +1074,31 @@ template<>
 bool
 JSObject::is<js::DebugEnvironmentProxy>() const;
 
 namespace js {
 
 inline bool
 IsSyntacticEnvironment(JSObject* env)
 {
-    if (!env->is<EnvironmentObject>())
+    if (!env->is<EnvironmentObject>()) {
         return false;
+    }
 
-    if (env->is<WithEnvironmentObject>())
+    if (env->is<WithEnvironmentObject>()) {
         return env->as<WithEnvironmentObject>().isSyntactic();
+    }
 
-    if (env->is<LexicalEnvironmentObject>())
+    if (env->is<LexicalEnvironmentObject>()) {
         return env->as<LexicalEnvironmentObject>().isSyntactic();
+    }
 
-    if (env->is<NonSyntacticVariablesObject>())
+    if (env->is<NonSyntacticVariablesObject>()) {
         return false;
+    }
 
     return true;
 }
 
 inline bool
 IsExtensibleLexicalEnvironment(JSObject* env)
 {
     return env->is<LexicalEnvironmentObject>() &&
@@ -1112,18 +1118,19 @@ IsNSVOLexicalEnvironment(JSObject* env)
     return env->is<LexicalEnvironmentObject>() &&
            env->as<LexicalEnvironmentObject>().enclosingEnvironment()
                                               .is<NonSyntacticVariablesObject>();
 }
 
 inline JSObject*
 MaybeUnwrapWithEnvironment(JSObject* env)
 {
-    if (env->is<WithEnvironmentObject>())
+    if (env->is<WithEnvironmentObject>()) {
         return &env->as<WithEnvironmentObject>().object();
+    }
     return env;
 }
 
 template <typename SpecificEnvironment>
 inline bool
 IsFrameInitialEnvironment(AbstractFramePtr frame, SpecificEnvironment& env)
 {
     // A frame's initial environment is the innermost environment
@@ -1133,18 +1140,19 @@ IsFrameInitialEnvironment(AbstractFrameP
     // chain for the environment chain to fully match the scope chain at the
     // start of execution in the frame.
     //
     // This logic must be in sync with the HAS_INITIAL_ENV logic in
     // InitFromBailout.
 
     // A function frame's CallObject, if present, is always the initial
     // environment.
-    if (mozilla::IsSame<SpecificEnvironment, CallObject>::value)
+    if (mozilla::IsSame<SpecificEnvironment, CallObject>::value) {
         return true;
+    }
 
     // For an eval frame, the VarEnvironmentObject, if present, is always the
     // initial environment.
     if (mozilla::IsSame<SpecificEnvironment, VarEnvironmentObject>::value &&
         frame.isEvalFrame())
     {
         return true;
     }
--- a/js/src/vm/ErrorObject.cpp
+++ b/js/src/vm/ErrorObject.cpp
@@ -26,47 +26,51 @@
 
 using namespace js;
 
 /* static */ Shape*
 js::ErrorObject::assignInitialShape(JSContext* cx, Handle<ErrorObject*> obj)
 {
     MOZ_ASSERT(obj->empty());
 
-    if (!NativeObject::addDataProperty(cx, obj, cx->names().fileName, FILENAME_SLOT, 0))
+    if (!NativeObject::addDataProperty(cx, obj, cx->names().fileName, FILENAME_SLOT, 0)) {
         return nullptr;
-    if (!NativeObject::addDataProperty(cx, obj, cx->names().lineNumber, LINENUMBER_SLOT, 0))
+    }
+    if (!NativeObject::addDataProperty(cx, obj, cx->names().lineNumber, LINENUMBER_SLOT, 0)) {
         return nullptr;
+    }
     return NativeObject::addDataProperty(cx, obj, cx->names().columnNumber, COLUMNNUMBER_SLOT, 0);
 }
 
 /* static */ bool
 js::ErrorObject::init(JSContext* cx, Handle<ErrorObject*> obj, JSExnType type,
                       UniquePtr<JSErrorReport> errorReport, HandleString fileName,
                       HandleObject stack, uint32_t lineNumber, uint32_t columnNumber,
                       HandleString message)
 {
     AssertObjectIsSavedFrameOrWrapper(cx, stack);
     cx->check(obj, stack);
 
     // Null out early in case of error, for exn_finalize's sake.
     obj->initReservedSlot(ERROR_REPORT_SLOT, PrivateValue(nullptr));
 
-    if (!EmptyShape::ensureInitialCustomShape<ErrorObject>(cx, obj))
+    if (!EmptyShape::ensureInitialCustomShape<ErrorObject>(cx, obj)) {
         return false;
+    }
 
     // The .message property isn't part of the initial shape because it's
     // present in some error objects -- |Error.prototype|, |new Error("f")|,
     // |new Error("")| -- but not in others -- |new Error(undefined)|,
     // |new Error()|.
     RootedShape messageShape(cx);
     if (message) {
         messageShape = NativeObject::addDataProperty(cx, obj, cx->names().message, MESSAGE_SLOT, 0);
-        if (!messageShape)
+        if (!messageShape) {
             return false;
+        }
         MOZ_ASSERT(messageShape->slot() == MESSAGE_SLOT);
     }
 
     MOZ_ASSERT(obj->lookupPure(NameToId(cx->names().fileName))->slot() == FILENAME_SLOT);
     MOZ_ASSERT(obj->lookupPure(NameToId(cx->names().lineNumber))->slot() == LINENUMBER_SLOT);
     MOZ_ASSERT(obj->lookupPure(NameToId(cx->names().columnNumber))->slot() ==
                COLUMNNUMBER_SLOT);
     MOZ_ASSERT_IF(message,
@@ -76,18 +80,19 @@ js::ErrorObject::init(JSContext* cx, Han
 
     JSErrorReport* report = errorReport.release();
     obj->initReservedSlot(EXNTYPE_SLOT, Int32Value(type));
     obj->initReservedSlot(STACK_SLOT, ObjectOrNullValue(stack));
     obj->setReservedSlot(ERROR_REPORT_SLOT, PrivateValue(report));
     obj->initReservedSlot(FILENAME_SLOT, StringValue(fileName));
     obj->initReservedSlot(LINENUMBER_SLOT, Int32Value(lineNumber));
     obj->initReservedSlot(COLUMNNUMBER_SLOT, Int32Value(columnNumber));
-    if (message)
+    if (message) {
         obj->setSlotWithType(cx, messageShape, StringValue(message));
+    }
 
     // When recording/replaying and running on the main thread, get a counter
     // which the devtools can use to warp to this point in the future.
     if (mozilla::recordreplay::IsRecordingOrReplaying() && !cx->runtime()->parentRuntime) {
         uint64_t timeWarpTarget = mozilla::recordreplay::NewTimeWarpTarget();
 
         // Make sure we don't truncate the time warp target by storing it as a double.
         MOZ_RELEASE_ASSERT(timeWarpTarget < uint64_t(DOUBLE_INTEGRAL_PRECISION_LIMIT));
@@ -103,79 +108,87 @@ js::ErrorObject::create(JSContext* cx, J
                         UniquePtr<JSErrorReport> report, HandleString message,
                         HandleObject protoArg /* = nullptr */)
 {
     AssertObjectIsSavedFrameOrWrapper(cx, stack);
 
     RootedObject proto(cx, protoArg);
     if (!proto) {
         proto = GlobalObject::getOrCreateCustomErrorPrototype(cx, cx->global(), errorType);
-        if (!proto)
+        if (!proto) {
             return nullptr;
+        }
     }
 
     Rooted<ErrorObject*> errObject(cx);
     {
         const Class* clasp = ErrorObject::classForType(errorType);
         JSObject* obj = NewObjectWithGivenProto(cx, clasp, proto);
-        if (!obj)
+        if (!obj) {
             return nullptr;
+        }
         errObject = &obj->as<ErrorObject>();
     }
 
     if (!ErrorObject::init(cx, errObject, errorType, std::move(report), fileName, stack,
                            lineNumber, columnNumber, message))
     {
         return nullptr;
     }
 
     return errObject;
 }
 
 JSErrorReport*
 js::ErrorObject::getOrCreateErrorReport(JSContext* cx)
 {
-    if (JSErrorReport* r = getErrorReport())
+    if (JSErrorReport* r = getErrorReport()) {
         return r;
+    }
 
     // We build an error report on the stack and then use CopyErrorReport to do
     // the nitty-gritty malloc stuff.
     JSErrorReport report;
 
     // Type.
     JSExnType type_ = type();
     report.exnType = type_;
 
     // Filename.
     UniqueChars filenameStr = JS_EncodeStringToLatin1(cx, fileName(cx));
-    if (!filenameStr)
+    if (!filenameStr) {
         return nullptr;
+    }
     report.filename = filenameStr.get();
 
     // Coordinates.
     report.lineno = lineNumber();
     report.column = columnNumber();
 
     // Message. Note that |new Error()| will result in an undefined |message|
     // slot, so we need to explicitly substitute the empty string in that case.
     RootedString message(cx, getMessage());
-    if (!message)
+    if (!message) {
         message = cx->runtime()->emptyString;
-    if (!message->ensureFlat(cx))
+    }
+    if (!message->ensureFlat(cx)) {
         return nullptr;
+    }
 
     UniqueChars utf8 = StringToNewUTF8CharsZ(cx, *message);
-    if (!utf8)
+    if (!utf8) {
         return nullptr;
+    }
     report.initOwnedMessage(utf8.release());
 
     // Cache and return.
     UniquePtr<JSErrorReport> copy = CopyErrorReport(cx, &report);
-    if (!copy)
+    if (!copy) {
         return nullptr;
+    }
     setReservedSlot(ERROR_REPORT_SLOT, PrivateValue(copy.get()));
     return copy.release();
 }
 
 static bool
 FindErrorInstanceOrPrototype(JSContext* cx, HandleObject obj, MutableHandleObject result)
 {
     // Walk up the prototype chain until we find an error object instance or
@@ -190,18 +203,19 @@ FindErrorInstanceOrPrototype(JSContext* 
     RootedObject target(cx, CheckedUnwrap(obj));
     if (!target) {
         ReportAccessDenied(cx);
         return false;
     }
 
     RootedObject proto(cx);
     while (!IsErrorProtoKey(StandardProtoKeyOrNull(target))) {
-        if (!GetPrototype(cx, target, &proto))
+        if (!GetPrototype(cx, target, &proto)) {
             return false;
+        }
 
         if (!proto) {
             // We walked the whole prototype chain and did not find an Error
             // object.
             JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_PROTO,
                                       js_Error_str, "(get stack)", obj->getClass()->name);
             return false;
         }
@@ -233,41 +247,44 @@ js::ErrorObject::getStack(JSContext* cx,
 }
 
 /* static */ bool
 js::ErrorObject::getStack_impl(JSContext* cx, const CallArgs& args)
 {
     RootedObject thisObj(cx, &args.thisv().toObject());
 
     RootedObject obj(cx);
-    if (!FindErrorInstanceOrPrototype(cx, thisObj, &obj))
+    if (!FindErrorInstanceOrPrototype(cx, thisObj, &obj)) {
         return false;
+    }
 
     if (!obj->is<ErrorObject>()) {
         args.rval().setString(cx->runtime()->emptyString);
         return true;
     }
 
     // Do frame filtering based on the ErrorObject's principals. This ensures we
     // don't see chrome frames when chrome code accesses .stack over Xrays.
     JSPrincipals* principals = obj->as<ErrorObject>().realm()->principals();
 
     RootedObject savedFrameObj(cx, obj->as<ErrorObject>().stack());
     RootedString stackString(cx);
-    if (!BuildStackString(cx, principals, savedFrameObj, &stackString))
+    if (!BuildStackString(cx, principals, savedFrameObj, &stackString)) {
         return false;
+    }
 
     if (cx->runtime()->stackFormat() == js::StackFormat::V8) {
         // When emulating V8 stack frames, we also need to prepend the
         // stringified Error to the stack string.
         HandlePropertyName name = cx->names().ErrorToStringWithTrailingNewline;
         FixedInvokeArgs<0> args2(cx);
         RootedValue rval(cx);
-        if (!CallSelfHostedFunction(cx, name, args.thisv(), args2, &rval))
+        if (!CallSelfHostedFunction(cx, name, args.thisv(), args2, &rval)) {
             return false;
+        }
 
         if (!rval.isString()) {
             args.rval().setString(cx->runtime()->emptyString);
             return true;
         }
 
         RootedString stringified(cx, rval.toString());
         stackString = ConcatStrings<CanGC>(cx, stringified, stackString);
@@ -285,14 +302,15 @@ js::ErrorObject::setStack(JSContext* cx,
     return CallNonGenericMethod<IsObject, setStack_impl>(cx, args);
 }
 
 /* static */ bool
 js::ErrorObject::setStack_impl(JSContext* cx, const CallArgs& args)
 {
     RootedObject thisObj(cx, &args.thisv().toObject());
 
-    if (!args.requireAtLeast(cx, "(set stack)", 1))
+    if (!args.requireAtLeast(cx, "(set stack)", 1)) {
         return false;
+    }
     RootedValue val(cx, args[0]);
 
     return DefineDataProperty(cx, thisObj, cx->names().stack, val);
 }
--- a/js/src/vm/ErrorObject.h
+++ b/js/src/vm/ErrorObject.h
@@ -84,18 +84,19 @@ class ErrorObject : public NativeObject
     assignInitialShape(JSContext* cx, Handle<ErrorObject*> obj);
 
     JSExnType type() const {
         return JSExnType(getReservedSlot(EXNTYPE_SLOT).toInt32());
     }
 
     JSErrorReport * getErrorReport() const {
         const Value& slot = getReservedSlot(ERROR_REPORT_SLOT);
-        if (slot.isUndefined())
+        if (slot.isUndefined()) {
             return nullptr;
+        }
         return static_cast<JSErrorReport*>(slot.toPrivate());
     }
 
     JSErrorReport * getOrCreateErrorReport(JSContext* cx);
 
     inline JSString * fileName(JSContext* cx) const;
     inline uint32_t lineNumber() const;
     inline uint32_t columnNumber() const;
--- a/js/src/vm/ErrorReporting.cpp
+++ b/js/src/vm/ErrorReporting.cpp
@@ -23,18 +23,19 @@ using JS::HandleValue;
 using JS::UniqueTwoByteChars;
 
 void
 js::CallWarningReporter(JSContext* cx, JSErrorReport* reportp)
 {
     MOZ_ASSERT(reportp);
     MOZ_ASSERT(JSREPORT_IS_WARNING(reportp->flags));
 
-    if (JS::WarningReporter warningReporter = cx->runtime()->warningReporter)
+    if (JS::WarningReporter warningReporter = cx->runtime()->warningReporter) {
         warningReporter(cx, reportp);
+    }
 }
 
 void
 js::CompileError::throwError(JSContext* cx)
 {
     if (JSREPORT_IS_WARNING(flags)) {
         CallWarningReporter(cx, this);
         return;
@@ -65,75 +66,81 @@ bool
 js::ReportCompileWarning(JSContext* cx, ErrorMetadata&& metadata, UniquePtr<JSErrorNotes> notes,
                          unsigned flags, unsigned errorNumber, va_list args)
 {
     // On the main thread, report the error immediately. When compiling off
     // thread, save the error so that the thread finishing the parse can report
     // it later.
     CompileError tempErr;
     CompileError* err = &tempErr;
-    if (cx->helperThread() && !cx->addPendingCompileError(&err))
+    if (cx->helperThread() && !cx->addPendingCompileError(&err)) {
         return false;
+    }
 
     err->notes = std::move(notes);
     err->flags = flags;
     err->errorNumber = errorNumber;
 
     err->filename = metadata.filename;
     err->lineno = metadata.lineNumber;
     err->column = metadata.columnNumber;
     err->isMuted = metadata.isMuted;
 
-    if (UniqueTwoByteChars lineOfContext = std::move(metadata.lineOfContext))
+    if (UniqueTwoByteChars lineOfContext = std::move(metadata.lineOfContext)) {
         err->initOwnedLinebuf(lineOfContext.release(), metadata.lineLength, metadata.tokenOffset);
+    }
 
     if (!ExpandErrorArgumentsVA(cx, GetErrorMessage, nullptr, errorNumber,
                                 nullptr, ArgumentsAreLatin1, err, args))
     {
         return false;
     }
 
-    if (!cx->helperThread())
+    if (!cx->helperThread()) {
         err->throwError(cx);
+    }
 
     return true;
 }
 
 void
 js::ReportCompileError(JSContext* cx, ErrorMetadata&& metadata, UniquePtr<JSErrorNotes> notes,
                        unsigned flags, unsigned errorNumber, va_list args)
 {
     // On the main thread, report the error immediately. When compiling off
     // thread, save the error so that the thread finishing the parse can report
     // it later.
     CompileError tempErr;
     CompileError* err = &tempErr;
-    if (cx->helperThread() && !cx->addPendingCompileError(&err))
+    if (cx->helperThread() && !cx->addPendingCompileError(&err)) {
         return;
+    }
 
     err->notes = std::move(notes);
     err->flags = flags;
     err->errorNumber = errorNumber;
 
     err->filename = metadata.filename;
     err->lineno = metadata.lineNumber;
     err->column = metadata.columnNumber;
     err->isMuted = metadata.isMuted;
 
-    if (UniqueTwoByteChars lineOfContext = std::move(metadata.lineOfContext))
+    if (UniqueTwoByteChars lineOfContext = std::move(metadata.lineOfContext)) {
         err->initOwnedLinebuf(lineOfContext.release(), metadata.lineLength, metadata.tokenOffset);
+    }
 
     if (!ExpandErrorArgumentsVA(cx, GetErrorMessage, nullptr, errorNumber,
                                 nullptr, ArgumentsAreLatin1, err, args))
     {
         return;
     }
 
-    if (!cx->helperThread())
+    if (!cx->helperThread()) {
         err->throwError(cx);
+    }
 }
 
 void
 js::ReportErrorToGlobal(JSContext* cx, Handle<GlobalObject*> global, HandleValue error)
 {
     MOZ_ASSERT(!cx->isExceptionPending());
 #ifdef DEBUG
     // No assertSameCompartment version that doesn't take JSContext...
--- a/js/src/vm/ForOfIterator.cpp
+++ b/js/src/vm/ForOfIterator.cpp
@@ -17,88 +17,98 @@
 using namespace js;
 using JS::ForOfIterator;
 
 bool
 ForOfIterator::init(HandleValue iterable, NonIterableBehavior nonIterableBehavior)
 {
     JSContext* cx = cx_;
     RootedObject iterableObj(cx, ToObject(cx, iterable));
-    if (!iterableObj)
+    if (!iterableObj) {
         return false;
+    }
 
     MOZ_ASSERT(index == NOT_ARRAY);
 
     // Check the PIC first for a match.
     if (iterableObj->is<ArrayObject>()) {
         ForOfPIC::Chain* stubChain = ForOfPIC::getOrCreate(cx);
-        if (!stubChain)
+        if (!stubChain) {
             return false;
+        }
 
         bool optimized;
-        if (!stubChain->tryOptimizeArray(cx, iterableObj.as<ArrayObject>(), &optimized))
+        if (!stubChain->tryOptimizeArray(cx, iterableObj.as<ArrayObject>(), &optimized)) {
             return false;
+        }
 
         if (optimized) {
             // Got optimized stub.  Array is optimizable.
             index = 0;
             iterator = iterableObj;
             nextMethod.setUndefined();
             return true;
         }
     }
 
     MOZ_ASSERT(index == NOT_ARRAY);
 
     RootedValue callee(cx);
     RootedId iteratorId(cx, SYMBOL_TO_JSID(cx->wellKnownSymbols().iterator));
-    if (!GetProperty(cx, iterableObj, iterableObj, iteratorId, &callee))
+    if (!GetProperty(cx, iterableObj, iterableObj, iteratorId, &callee)) {
         return false;
+    }
 
     // If obj[@@iterator] is undefined and we were asked to allow non-iterables,
     // bail out now without setting iterator.  This will make valueIsIterable(),
     // which our caller should check, return false.
-    if (nonIterableBehavior == AllowNonIterable && callee.isUndefined())
+    if (nonIterableBehavior == AllowNonIterable && callee.isUndefined()) {
         return true;
+    }
 
     // Throw if obj[@@iterator] isn't callable.
     // js::Invoke is about to check for this kind of error anyway, but it would
     // throw an inscrutable error message about |method| rather than this nice
     // one about |obj|.
     if (!callee.isObject() || !callee.toObject().isCallable()) {
         UniqueChars bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, iterable, nullptr);
-        if (!bytes)
+        if (!bytes) {
             return false;
+        }
         JS_ReportErrorNumberUTF8(cx, GetErrorMessage, nullptr, JSMSG_NOT_ITERABLE, bytes.get());
         return false;
     }
 
     RootedValue res(cx);
-    if (!js::Call(cx, callee, iterable, &res))
+    if (!js::Call(cx, callee, iterable, &res)) {
         return false;
+    }
 
-    if (!res.isObject())
+    if (!res.isObject()) {
         return ThrowCheckIsObject(cx, CheckIsObjectKind::GetIterator);
+    }
 
     RootedObject iteratorObj(cx, &res.toObject());
-    if (!GetProperty(cx, iteratorObj, iteratorObj, cx->names().next, &res))
+    if (!GetProperty(cx, iteratorObj, iteratorObj, cx->names().next, &res)) {
         return false;
+    }
 
     iterator = iteratorObj;
     nextMethod = res;
     return true;
 }
 
 inline bool
 ForOfIterator::nextFromOptimizedArray(MutableHandleValue vp, bool* done)
 {
     MOZ_ASSERT(index != NOT_ARRAY);
 
-    if (!CheckForInterrupt(cx_))
+    if (!CheckForInterrupt(cx_)) {
         return false;
+    }
 
     ArrayObject* arr = &iterator->as<ArrayObject>();
 
     if (index >= arr->length()) {
         vp.setUndefined();
         *done = true;
         return true;
     }
@@ -115,29 +125,33 @@ ForOfIterator::nextFromOptimizedArray(Mu
 
     return GetElement(cx_, iterator, iterator, index++, vp);
 }
 
 bool
 ForOfIterator::next(MutableHandleValue vp, bool* done)
 {
     MOZ_ASSERT(iterator);
-    if (index != NOT_ARRAY)
+    if (index != NOT_ARRAY) {
         return nextFromOptimizedArray(vp, done);
+    }
 
     RootedValue v(cx_);
-    if (!js::Call(cx_, nextMethod, iterator, &v))
+    if (!js::Call(cx_, nextMethod, iterator, &v)) {
         return false;
+    }
 
-    if (!v.isObject())
+    if (!v.isObject()) {
         return ThrowCheckIsObject(cx_, CheckIsObjectKind::IteratorNext);
+    }
 
     RootedObject resultObj(cx_, &v.toObject());
-    if (!GetProperty(cx_, resultObj, resultObj, cx_->names().done, &v))
+    if (!GetProperty(cx_, resultObj, resultObj, cx_->names().done, &v)) {
         return false;
+    }
 
     *done = ToBoolean(v);
     if (*done) {
         vp.setUndefined();
         return true;
     }
 
     return GetProperty(cx_, resultObj, resultObj, cx_->names().value, vp);
@@ -147,26 +161,28 @@ ForOfIterator::next(MutableHandleValue v
 // When completion.[[Type]] is throw.
 void
 ForOfIterator::closeThrow()
 {
     MOZ_ASSERT(iterator);
 
     RootedValue completionException(cx_);
     if (cx_->isExceptionPending()) {
-        if (!GetAndClearException(cx_, &completionException))
+        if (!GetAndClearException(cx_, &completionException)) {
             completionException.setUndefined();
+        }
     }
 
     // Steps 1-2 (implicit)
 
     // Step 3 (partial).
     RootedValue returnVal(cx_);
-    if (!GetProperty(cx_, iterator, iterator, cx_->names().return_, &returnVal))
+    if (!GetProperty(cx_, iterator, iterator, cx_->names().return_, &returnVal)) {
         return;
+    }
 
     // Step 4.
     if (returnVal.isUndefined()) {
         cx_->setPendingException(completionException);
         return;
     }
 
     // Step 3 (remaining part)
@@ -178,15 +194,16 @@ ForOfIterator::closeThrow()
     if (!returnObj->isCallable()) {
         JS_ReportErrorNumberASCII(cx_, GetErrorMessage, nullptr, JSMSG_RETURN_NOT_CALLABLE);
         return;
     }
 
     // Step 5.
     RootedValue innerResultValue(cx_);
     if (!js::Call(cx_, returnVal, iterator, &innerResultValue)) {
-        if (cx_->isExceptionPending())
+        if (cx_->isExceptionPending()) {
             cx_->clearPendingException();
+        }
     }
 
     // Step 6.
     cx_->setPendingException(completionException);
 }