mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:47:35 +00:00
LibWeb: Stub out the PerformanceTiming object from Navigation Timing
Just have all the timing functions return 0 for now. We can now run the Shynet JS on https://linus.dev/ although the XHR is rejected by our same-origin policy.
This commit is contained in:
parent
c99e35485a
commit
9e45594dc8
10 changed files with 176 additions and 2 deletions
|
@ -36,6 +36,7 @@ namespace Web::HighResolutionTime {
|
|||
Performance::Performance(DOM::Window& window)
|
||||
: DOM::EventTarget(static_cast<Bindings::ScriptExecutionContext&>(window.document()))
|
||||
, m_window(window)
|
||||
, m_timing(make<NavigationTiming::PerformanceTiming>(window))
|
||||
{
|
||||
m_timer.start();
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <LibCore/ElapsedTimer.h>
|
||||
#include <LibWeb/Bindings/Wrappable.h>
|
||||
#include <LibWeb/DOM/EventTarget.h>
|
||||
#include <LibWeb/NavigationTiming/PerformanceTiming.h>
|
||||
|
||||
namespace Web::HighResolutionTime {
|
||||
|
||||
|
@ -46,6 +47,8 @@ public:
|
|||
double now() const { return m_timer.elapsed(); }
|
||||
double time_origin() const;
|
||||
|
||||
RefPtr<NavigationTiming::PerformanceTiming> timing() { return *m_timing; }
|
||||
|
||||
virtual void ref_event_target() override;
|
||||
virtual void unref_event_target() override;
|
||||
|
||||
|
@ -55,6 +58,8 @@ public:
|
|||
private:
|
||||
DOM::Window& m_window;
|
||||
Core::ElapsedTimer m_timer;
|
||||
|
||||
OwnPtr<NavigationTiming::PerformanceTiming> m_timing;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
interface Performance : EventTarget {
|
||||
double now();
|
||||
readonly attribute double timeOrigin;
|
||||
|
||||
readonly attribute PerformanceTiming timing;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue