LibWeb: Make Document::url() return URL by value

Returning it by reference can lead to unpleasant situations if we use
this getter when the document may go away. Better to make the getter
return a copy than have to think about this everywhere.
This commit is contained in:
Andreas Kling 2020-06-06 13:35:58 +02:00
parent 5c0ee72b30
commit 52fcaae71c
Notes: sideshowbarker 2024-07-19 05:48:30 +09:00
2 changed files with 2 additions and 2 deletions

View file

@ -84,7 +84,7 @@ JS::Value LocationObject::hostname_getter(JS::Interpreter& interpreter)
JS::Value LocationObject::host_getter(JS::Interpreter& interpreter)
{
auto& window = static_cast<WindowObject&>(interpreter.global_object());
auto& url = window.impl().document().url();
auto url = window.impl().document().url();
StringBuilder builder;
builder.append(url.host());
builder.append(':');