diff --git a/Tests/LibWeb/Text/expected/Worker/Worker-location.txt b/Tests/LibWeb/Text/expected/Worker/Worker-location.txt new file mode 100644 index 00000000000..a755bb81df2 --- /dev/null +++ b/Tests/LibWeb/Text/expected/Worker/Worker-location.txt @@ -0,0 +1 @@ +location global object URL final segment: Worker-location.js diff --git a/Tests/LibWeb/Text/input/Worker/Worker-location.html b/Tests/LibWeb/Text/input/Worker/Worker-location.html new file mode 100644 index 00000000000..197493de833 --- /dev/null +++ b/Tests/LibWeb/Text/input/Worker/Worker-location.html @@ -0,0 +1,11 @@ + + diff --git a/Tests/LibWeb/Text/input/Worker/Worker-location.js b/Tests/LibWeb/Text/input/Worker/Worker-location.js new file mode 100644 index 00000000000..7e7005adfa4 --- /dev/null +++ b/Tests/LibWeb/Text/input/Worker/Worker-location.js @@ -0,0 +1 @@ +postMessage(location.toString()); diff --git a/Userland/Libraries/LibWeb/HTML/WorkerLocation.cpp b/Userland/Libraries/LibWeb/HTML/WorkerLocation.cpp index 272292f2c8f..418a20f1310 100644 --- a/Userland/Libraries/LibWeb/HTML/WorkerLocation.cpp +++ b/Userland/Libraries/LibWeb/HTML/WorkerLocation.cpp @@ -142,6 +142,12 @@ WorkerLocation::WorkerLocation(WorkerGlobalScope& global_scope) WorkerLocation::~WorkerLocation() = default; +void WorkerLocation::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + WEB_SET_PROTOTYPE_FOR_INTERFACE(WorkerLocation); +} + void WorkerLocation::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/HTML/WorkerLocation.h b/Userland/Libraries/LibWeb/HTML/WorkerLocation.h index 372f1ba7d97..1d7bf75f7d0 100644 --- a/Userland/Libraries/LibWeb/HTML/WorkerLocation.h +++ b/Userland/Libraries/LibWeb/HTML/WorkerLocation.h @@ -31,6 +31,7 @@ public: private: explicit WorkerLocation(WorkerGlobalScope&); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; JS::NonnullGCPtr m_global_scope;