diff --git a/Tests/LibWeb/Text/expected/HTML/image-bitmap-from-invalid-types-no-crash.txt b/Tests/LibWeb/Text/expected/HTML/image-bitmap-from-invalid-types-no-crash.txt new file mode 100644 index 00000000000000..43be68f8969799 --- /dev/null +++ b/Tests/LibWeb/Text/expected/HTML/image-bitmap-from-invalid-types-no-crash.txt @@ -0,0 +1,7 @@ +Blob [Success]: [object ImageBitmap] +ImageData [ Error ]: Error: Not Implemented: createImageBitmap() for non-blob types +HTMLImageElement [ Error ]: TypeError: No union types matched +SVGImageElement [ Error ]: TypeError: No union types matched +HTMLCanvasElement [ Error ]: TypeError: No union types matched +ImageBitmap [ Error ]: TypeError: No union types matched +HTMLVideoElement [ Error ]: TypeError: No union types matched diff --git a/Tests/LibWeb/Text/input/HTML/image-bitmap-from-invalid-types-no-crash.html b/Tests/LibWeb/Text/input/HTML/image-bitmap-from-invalid-types-no-crash.html new file mode 100644 index 00000000000000..4d9bb8a276dc38 --- /dev/null +++ b/Tests/LibWeb/Text/input/HTML/image-bitmap-from-invalid-types-no-crash.html @@ -0,0 +1,49 @@ + + diff --git a/Userland/Libraries/LibWeb/HTML/WindowOrWorkerGlobalScope.cpp b/Userland/Libraries/LibWeb/HTML/WindowOrWorkerGlobalScope.cpp index 3f6db5a1a8b594..3150bf1b61e3ca 100644 --- a/Userland/Libraries/LibWeb/HTML/WindowOrWorkerGlobalScope.cpp +++ b/Userland/Libraries/LibWeb/HTML/WindowOrWorkerGlobalScope.cpp @@ -248,6 +248,7 @@ JS::NonnullGCPtr WindowOrWorkerGlobalScopeMixin::create_image_bitma dbgln("(STUBBED) createImageBitmap() for non-blob types"); (void)sx; (void)sy; + p->reject(JS::Error::create(relevant_realm(*p), "Not Implemented: createImageBitmap() for non-blob types"sv)); }); // 7. Return p.