1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 09:57:35 +00:00

LibWeb: Replace GlobalObject with VM in remaining AOs [Part 4/4]

This commit is contained in:
Linus Groh 2022-08-21 21:29:06 +01:00
parent 2d69a3b266
commit 7b990c27a1
9 changed files with 62 additions and 66 deletions

View file

@ -311,7 +311,7 @@ RefPtr<ImageData> CanvasRenderingContext2D::create_image_data(int width, int hei
dbgln("Hmm! Attempted to create ImageData for wrapper-less CRC2D.");
return {};
}
return ImageData::create_with_size(wrapper()->global_object(), width, height);
return ImageData::create_with_size(wrapper()->vm(), width, height);
}
// https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-getimagedata
@ -327,7 +327,7 @@ DOM::ExceptionOr<RefPtr<ImageData>> CanvasRenderingContext2D::get_image_data(int
// 3. Let imageData be a new ImageData object.
// 4. Initialize imageData given sw, sh, settings set to settings, and defaultColorSpace set to this's color space.
auto image_data = ImageData::create_with_size(wrapper()->global_object(), width, height);
auto image_data = ImageData::create_with_size(wrapper()->vm(), width, height);
// NOTE: We don't attempt to create the underlying bitmap here; if it doesn't exist, it's like copying only transparent black pixels (which is a no-op).
if (!canvas_element().bitmap())

View file

@ -10,9 +10,9 @@
namespace Web::HTML {
RefPtr<ImageData> ImageData::create_with_size(JS::GlobalObject& global_object, int width, int height)
RefPtr<ImageData> ImageData::create_with_size(JS::VM& vm, int width, int height)
{
auto& realm = *global_object.associated_realm();
auto& realm = *vm.current_realm();
if (width <= 0 || height <= 0)
return nullptr;

View file

@ -18,7 +18,7 @@ class ImageData
public:
using WrapperType = Bindings::ImageDataWrapper;
static RefPtr<ImageData> create_with_size(JS::GlobalObject&, int width, int height);
static RefPtr<ImageData> create_with_size(JS::VM&, int width, int height);
~ImageData();

View file

@ -120,7 +120,7 @@ JS::Completion ClassicScript::run(RethrowErrors rethrow_errors)
settings.clean_up_after_running_script();
// 2. Throw a "NetworkError" DOMException.
return Bindings::throw_dom_exception_if_needed(global_object, [] {
return Bindings::throw_dom_exception_if_needed(vm, [] {
return DOM::NetworkError::create("Script error.");
}).release_error();
}