mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 00:25:12 +00:00
LibWeb: Set correct prototype for WorkerLocation
This commit is contained in:
committed by
Andreas Kling
parent
7f40a19c71
commit
354e5a6624
1
Tests/LibWeb/Text/expected/Worker/Worker-location.txt
Normal file
1
Tests/LibWeb/Text/expected/Worker/Worker-location.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
location global object URL final segment: Worker-location.js
|
||||||
11
Tests/LibWeb/Text/input/Worker/Worker-location.html
Normal file
11
Tests/LibWeb/Text/input/Worker/Worker-location.html
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<script src="../include.js"></script>
|
||||||
|
<script>
|
||||||
|
asyncTest(done => {
|
||||||
|
let work = new Worker("Worker-location.js");
|
||||||
|
work.onmessage = (evt) => {
|
||||||
|
const locationURL = new URL(evt.data);
|
||||||
|
println(`location global object URL final segment: ${locationURL.pathname.split('/').pop()}`);
|
||||||
|
done();
|
||||||
|
};
|
||||||
|
});
|
||||||
|
</script>
|
||||||
1
Tests/LibWeb/Text/input/Worker/Worker-location.js
Normal file
1
Tests/LibWeb/Text/input/Worker/Worker-location.js
Normal file
@@ -0,0 +1 @@
|
|||||||
|
postMessage(location.toString());
|
||||||
@@ -142,6 +142,12 @@ WorkerLocation::WorkerLocation(WorkerGlobalScope& global_scope)
|
|||||||
|
|
||||||
WorkerLocation::~WorkerLocation() = default;
|
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)
|
void WorkerLocation::visit_edges(Cell::Visitor& visitor)
|
||||||
{
|
{
|
||||||
Base::visit_edges(visitor);
|
Base::visit_edges(visitor);
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
explicit WorkerLocation(WorkerGlobalScope&);
|
explicit WorkerLocation(WorkerGlobalScope&);
|
||||||
|
|
||||||
|
virtual void initialize(JS::Realm&) override;
|
||||||
virtual void visit_edges(Cell::Visitor&) override;
|
virtual void visit_edges(Cell::Visitor&) override;
|
||||||
|
|
||||||
JS::NonnullGCPtr<WorkerGlobalScope> m_global_scope;
|
JS::NonnullGCPtr<WorkerGlobalScope> m_global_scope;
|
||||||
|
|||||||
Reference in New Issue
Block a user