mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-06 08:10:02 +00:00
LibWeb+Tests: Add internal property for echo server port
This commit is contained in:
parent
4dd21d0b80
commit
cddbe7d10f
Notes:
github-actions[bot]
2024-12-06 00:09:41 +00:00
Author: https://github.com/rmg-x
Commit: cddbe7d10f
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2553
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/shannonbooth
4 changed files with 17 additions and 2 deletions
|
@ -21,6 +21,8 @@
|
||||||
|
|
||||||
namespace Web::Internals {
|
namespace Web::Internals {
|
||||||
|
|
||||||
|
static u16 s_echo_server_port { 0 };
|
||||||
|
|
||||||
GC_DEFINE_ALLOCATOR(Internals);
|
GC_DEFINE_ALLOCATOR(Internals);
|
||||||
|
|
||||||
Internals::Internals(JS::Realm& realm)
|
Internals::Internals(JS::Realm& realm)
|
||||||
|
@ -207,4 +209,14 @@ String Internals::get_computed_label(DOM::Element& element)
|
||||||
return MUST(element.accessible_name(active_document));
|
return MUST(element.accessible_name(active_document));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u16 Internals::get_echo_server_port()
|
||||||
|
{
|
||||||
|
return s_echo_server_port;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Internals::set_echo_server_port(u16 const port)
|
||||||
|
{
|
||||||
|
s_echo_server_port = port;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,9 @@ public:
|
||||||
|
|
||||||
String get_computed_label(DOM::Element& element);
|
String get_computed_label(DOM::Element& element);
|
||||||
|
|
||||||
|
static u16 get_echo_server_port();
|
||||||
|
static void set_echo_server_port(u16 port);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit Internals(JS::Realm&);
|
explicit Internals(JS::Realm&);
|
||||||
virtual void initialize(JS::Realm&) override;
|
virtual void initialize(JS::Realm&) override;
|
||||||
|
|
|
@ -39,4 +39,5 @@ interface Internals {
|
||||||
undefined expireCookiesWithTimeOffset(long long seconds);
|
undefined expireCookiesWithTimeOffset(long long seconds);
|
||||||
|
|
||||||
DOMString getComputedLabel(Element element);
|
DOMString getComputedLabel(Element element);
|
||||||
|
unsigned short getEchoServerPort();
|
||||||
};
|
};
|
||||||
|
|
|
@ -121,8 +121,7 @@ class HTTPTestServer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: Get the port from internals
|
const __httpTestServer = new HTTPTestServer(`http://localhost:${internals.getEchoServerPort()}`);
|
||||||
const __httpTestServer = new HTTPTestServer("http://localhost:8123");
|
|
||||||
function httpTestServer() {
|
function httpTestServer() {
|
||||||
return __httpTestServer;
|
return __httpTestServer;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue