Skip to content

Commit c52d193

Browse files
Jake ChampionJakeChampion
authored andcommitted
coerce the decompress gzip slot value to a boolean so as to avoid a panic if the slot does not contain a value
1 parent 890d577 commit c52d193

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

runtime/js-compute-runtime/builtins/request-response.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,9 +1147,10 @@ bool Request::set_cache_override(JSContext *cx, JS::HandleObject self,
11471147
bool Request::apply_auto_decompress_gzip(JSContext *cx, JS::HandleObject self) {
11481148
MOZ_ASSERT(cx);
11491149
MOZ_ASSERT(is_instance(self));
1150-
auto decompress =
1151-
JS::GetReservedSlot(self, static_cast<uint32_t>(Request::Slots::AutoDecompressGzip))
1152-
.toBoolean();
1150+
1151+
JS::RootedValue decompressGzipSlot(cx, JS::GetReservedSlot(self, static_cast<uint32_t>(Request::Slots::AutoDecompressGzip)));
1152+
1153+
auto decompress = JS::ToBoolean(decompressGzipSlot);
11531154
if (!decompress) {
11541155
return true;
11551156
}

0 commit comments

Comments
 (0)