diff options
author | Linus Groh <mail@linusgroh.de> | 2021-07-04 17:36:10 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-07-04 22:07:36 +0100 |
commit | c9d8aa613920cfc659477ac8f519059a79df9a9b (patch) | |
tree | 4307cc763b7f24a72158809088eafa69a20ec83e | |
parent | bb1a98d809e3180ec224d1657433a761dee6e564 (diff) | |
download | serenity-c9d8aa613920cfc659477ac8f519059a79df9a9b.zip |
js: Handle detached ArrayBuffer in print_typed_array()
Co-authored-by: Idan Horowitz <idan.horowitz@gmail.com>
-rw-r--r-- | Userland/Utilities/js.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Userland/Utilities/js.cpp b/Userland/Utilities/js.cpp index c0a94b73f7..603550da79 100644 --- a/Userland/Utilities/js.cpp +++ b/Userland/Utilities/js.cpp @@ -378,6 +378,7 @@ static void print_number(T number) requires IsArithmetic<T> static void print_typed_array(const JS::Object& object, HashTable<JS::Object*>& seen_objects) { auto& typed_array_base = static_cast<const JS::TypedArrayBase&>(object); + auto& array_buffer = *typed_array_base.viewed_array_buffer(); auto length = typed_array_base.array_length(); print_type(object.class_name()); out("\n length: "); @@ -386,8 +387,10 @@ static void print_typed_array(const JS::Object& object, HashTable<JS::Object*>& print_value(JS::Value(typed_array_base.byte_length()), seen_objects); out("\n buffer: "); print_type("ArrayBuffer"); - out(" @ {:p}", typed_array_base.viewed_array_buffer()); - if (!length) + if (array_buffer.is_detached()) + out(" (detached)"); + out(" @ {:p}", &array_buffer); + if (!length || array_buffer.is_detached()) return; outln(); // FIXME: This kinda sucks. |