LibWeb: Use double type in ProgressEvent

loaded and total should be double as per spec
https://xhr.spec.whatwg.org/#progressevent
This commit is contained in:
Vishal Biswas 2025-04-17 11:37:30 +05:30 committed by Tim Flynn
commit eb165554e1
Notes: github-actions[bot] 2025-04-17 12:29:50 +00:00
4 changed files with 102 additions and 10 deletions

View file

@ -14,8 +14,8 @@ namespace Web::XHR {
struct ProgressEventInit : public DOM::EventInit {
bool length_computable { false };
WebIDL::UnsignedLongLong loaded { 0 };
WebIDL::UnsignedLongLong total { 0 };
WebIDL::Double loaded { 0 };
WebIDL::Double total { 0 };
};
class ProgressEvent final : public DOM::Event {
@ -29,8 +29,8 @@ public:
virtual ~ProgressEvent() override;
bool length_computable() const { return m_length_computable; }
WebIDL::UnsignedLongLong loaded() const { return m_loaded; }
WebIDL::UnsignedLongLong total() const { return m_total; }
WebIDL::Double loaded() const { return m_loaded; }
WebIDL::Double total() const { return m_total; }
private:
ProgressEvent(JS::Realm&, FlyString const& event_name, ProgressEventInit const& event_init);
@ -38,8 +38,8 @@ private:
virtual void initialize(JS::Realm&) override;
bool m_length_computable { false };
WebIDL::UnsignedLongLong m_loaded { 0 };
WebIDL::UnsignedLongLong m_total { 0 };
WebIDL::Double m_loaded { 0 };
WebIDL::Double m_total { 0 };
};
}

View file

@ -6,12 +6,12 @@ interface ProgressEvent : Event {
constructor(DOMString type, optional ProgressEventInit eventInitDict = {});
readonly attribute boolean lengthComputable;
readonly attribute unsigned long long loaded;
readonly attribute unsigned long long total;
readonly attribute double loaded;
readonly attribute double total;
};
dictionary ProgressEventInit : EventInit {
boolean lengthComputable = false;
unsigned long long loaded = 0;
unsigned long long total = 0;
double loaded = 0;
double total = 0;
};