@@ -118,7 +118,12 @@ pub const XMLHttpRequest = struct {
118118 // https://lightpanda.slack.com/archives/C05TRU6RBM1/p1707819010681019
119119 // upload: ?XMLHttpRequestUpload = null,
120120
121- timeout : u32 = 0 ,
121+ // TODO uncomment this field causes casting issue with
122+ // XMLHttpRequestEventTarget. I think it's dueto an alignement issue, but
123+ // not sure. see
124+ // https://lightpanda.slack.com/archives/C05TRU6RBM1/p1707819010681019
125+ // timeout: u32 = 0,
126+
122127 withCredentials : bool = false ,
123128 // TODO: response readonly attribute any response;
124129 response_bytes : ? []const u8 = null ,
@@ -195,7 +200,7 @@ pub const XMLHttpRequest = struct {
195200
196201 fn has (self : Headers , k : []const u8 ) bool {
197202 for (self .list .items ) | h | {
198- if (std .ascii .eqlIgnoreCase (k , h .value )) {
203+ if (std .ascii .eqlIgnoreCase (k , h .name )) {
199204 return true ;
200205 }
201206 }
@@ -205,7 +210,7 @@ pub const XMLHttpRequest = struct {
205210
206211 fn getFirstValue (self : Headers , k : []const u8 ) ? []const u8 {
207212 for (self .list .items ) | h | {
208- if (std .ascii .eqlIgnoreCase (k , h .value )) {
213+ if (std .ascii .eqlIgnoreCase (k , h .name )) {
209214 return h .value ;
210215 }
211216 }
@@ -216,7 +221,7 @@ pub const XMLHttpRequest = struct {
216221 // replace any existing header with the same key
217222 fn set (self : * Headers , k : []const u8 , v : []const u8 ) ! void {
218223 for (self .list .items , 0.. ) | h , i | {
219- if (std .ascii .eqlIgnoreCase (k , h .value )) {
224+ if (std .ascii .eqlIgnoreCase (k , h .name )) {
220225 const hh = self .list .swapRemove (i );
221226 self .alloc .free (hh .name );
222227 self .alloc .free (hh .value );
@@ -330,16 +335,16 @@ pub const XMLHttpRequest = struct {
330335 return self .state ;
331336 }
332337
333- pub fn get_timeout (self : * XMLHttpRequest ) u32 {
334- return self . timeout ;
338+ pub fn get_timeout (_ : * XMLHttpRequest ) u32 {
339+ return 0 ;
335340 }
336341
337- pub fn set_timeout (self : * XMLHttpRequest , timeout : u32 ) ! void {
342+ // TODO, the value is ignored for now.
343+ pub fn set_timeout (_ : * XMLHttpRequest , _ : u32 ) ! void {
338344 // TODO If the current global object is a Window object and this’s
339345 // synchronous flag is set, then throw an "InvalidAccessError"
340346 // DOMException.
341347 // https://xhr.spec.whatwg.org/#dom-xmlhttprequest-timeout
342- self .timeout = timeout ;
343348 }
344349
345350 pub fn get_withCredentials (self : * XMLHttpRequest ) bool {
0 commit comments