@@ -206,8 +206,6 @@ impl CookieStoreMethods<crate::DomTypeHolder> for CookieStore {
206
206
// 4. Let url be settings’s creation URL.
207
207
let creation_url = global. creation_url ( ) ;
208
208
209
- self . in_flight . borrow_mut ( ) . push_back ( p. clone ( ) ) ;
210
-
211
209
// 6. Run the following steps in parallel:
212
210
let res = self
213
211
. global ( )
@@ -218,8 +216,9 @@ impl CookieStoreMethods<crate::DomTypeHolder> for CookieStore {
218
216
Some ( name. to_string ( ) ) ,
219
217
) ) ;
220
218
if res. is_err ( ) {
221
- self . in_flight . borrow_mut ( ) . pop_back ( ) ;
222
219
error ! ( "Failed to send cookiestore message to resource threads" ) ;
220
+ } else {
221
+ self . in_flight . borrow_mut ( ) . push_back ( p. clone ( ) ) ;
223
222
}
224
223
225
224
// 7. Return p.
@@ -291,8 +290,6 @@ impl CookieStoreMethods<crate::DomTypeHolder> for CookieStore {
291
290
}
292
291
}
293
292
294
- self . in_flight . borrow_mut ( ) . push_back ( p. clone ( ) ) ;
295
-
296
293
// 6. Run the following steps in parallel:
297
294
let res = self
298
295
. global ( )
@@ -303,8 +300,9 @@ impl CookieStoreMethods<crate::DomTypeHolder> for CookieStore {
303
300
options. name . clone ( ) . map ( |val| val. 0 ) ,
304
301
) ) ;
305
302
if res. is_err ( ) {
306
- self . in_flight . borrow_mut ( ) . pop_back ( ) ;
307
303
error ! ( "Failed to send cookiestore message to resource threads" ) ;
304
+ } else {
305
+ self . in_flight . borrow_mut ( ) . push_back ( p. clone ( ) ) ;
308
306
}
309
307
310
308
p
@@ -329,8 +327,6 @@ impl CookieStoreMethods<crate::DomTypeHolder> for CookieStore {
329
327
// 4. Let url be settings’s creation URL.
330
328
let creation_url = global. creation_url ( ) ;
331
329
332
- self . in_flight . borrow_mut ( ) . push_back ( p. clone ( ) ) ;
333
-
334
330
// 6. Run the following steps in parallel:
335
331
let res =
336
332
self . global ( )
@@ -341,8 +337,9 @@ impl CookieStoreMethods<crate::DomTypeHolder> for CookieStore {
341
337
Some ( name. to_string ( ) ) ,
342
338
) ) ;
343
339
if res. is_err ( ) {
344
- self . in_flight . borrow_mut ( ) . pop_back ( ) ;
345
340
error ! ( "Failed to send cookiestore message to resource threads" ) ;
341
+ } else {
342
+ self . in_flight . borrow_mut ( ) . push_back ( p. clone ( ) ) ;
346
343
}
347
344
348
345
// 7. Return p.
@@ -414,8 +411,6 @@ impl CookieStoreMethods<crate::DomTypeHolder> for CookieStore {
414
411
}
415
412
}
416
413
417
- self . in_flight . borrow_mut ( ) . push_back ( p. clone ( ) ) ;
418
-
419
414
// 6. Run the following steps in parallel:
420
415
let res =
421
416
self . global ( )
@@ -426,8 +421,9 @@ impl CookieStoreMethods<crate::DomTypeHolder> for CookieStore {
426
421
options. name . clone ( ) . map ( |val| val. 0 ) ,
427
422
) ) ;
428
423
if res. is_err ( ) {
429
- self . in_flight . borrow_mut ( ) . pop_back ( ) ;
430
424
error ! ( "Failed to send cookiestore message to resource threads" ) ;
425
+ } else {
426
+ self . in_flight . borrow_mut ( ) . push_back ( p. clone ( ) ) ;
431
427
}
432
428
433
429
// 8. Return p
@@ -464,8 +460,6 @@ impl CookieStoreMethods<crate::DomTypeHolder> for CookieStore {
464
460
// TODO: This currently doesn't implement all the "set a cookie" steps which involves
465
461
// additional processing of the name and value
466
462
467
- self . in_flight . borrow_mut ( ) . push_back ( p. clone ( ) ) ;
468
-
469
463
// 10. Run the following steps in parallel:
470
464
let res = self
471
465
. global ( )
@@ -477,8 +471,9 @@ impl CookieStoreMethods<crate::DomTypeHolder> for CookieStore {
477
471
NonHTTP ,
478
472
) ) ;
479
473
if res. is_err ( ) {
480
- self . in_flight . borrow_mut ( ) . pop_back ( ) ;
481
474
error ! ( "Failed to send cookiestore message to resource threads" ) ;
475
+ } else {
476
+ self . in_flight . borrow_mut ( ) . push_back ( p. clone ( ) ) ;
482
477
}
483
478
484
479
// 11. Return p.
@@ -514,8 +509,6 @@ impl CookieStoreMethods<crate::DomTypeHolder> for CookieStore {
514
509
// TODO: This currently doesn't implement all the "set a cookie" steps which involves
515
510
// additional processing of the name and value
516
511
517
- self . in_flight . borrow_mut ( ) . push_back ( p. clone ( ) ) ;
518
-
519
512
// 6. Run the following steps in parallel:
520
513
let res = self
521
514
. global ( )
@@ -527,8 +520,9 @@ impl CookieStoreMethods<crate::DomTypeHolder> for CookieStore {
527
520
NonHTTP ,
528
521
) ) ;
529
522
if res. is_err ( ) {
530
- self . in_flight . borrow_mut ( ) . pop_back ( ) ;
531
523
error ! ( "Failed to send cookiestore message to resource threads" ) ;
524
+ } else {
525
+ self . in_flight . borrow_mut ( ) . push_back ( p. clone ( ) ) ;
532
526
}
533
527
534
528
// 7. Return p
@@ -552,8 +546,6 @@ impl CookieStoreMethods<crate::DomTypeHolder> for CookieStore {
552
546
return p;
553
547
}
554
548
555
- self . in_flight . borrow_mut ( ) . push_back ( p. clone ( ) ) ;
556
-
557
549
// 6. Run the following steps in parallel:
558
550
// TODO: the spec passes additional parameters to _delete a cookie_ that we don't handle yet
559
551
let res = global
@@ -564,8 +556,9 @@ impl CookieStoreMethods<crate::DomTypeHolder> for CookieStore {
564
556
name. 0 ,
565
557
) ) ;
566
558
if res. is_err ( ) {
567
- self . in_flight . borrow_mut ( ) . pop_back ( ) ;
568
559
error ! ( "Failed to send cookiestore message to resource threads" ) ;
560
+ } else {
561
+ self . in_flight . borrow_mut ( ) . push_back ( p. clone ( ) ) ;
569
562
}
570
563
571
564
// 7. Return p.
@@ -589,8 +582,6 @@ impl CookieStoreMethods<crate::DomTypeHolder> for CookieStore {
589
582
return p;
590
583
}
591
584
592
- self . in_flight . borrow_mut ( ) . push_back ( p. clone ( ) ) ;
593
-
594
585
// 6. Run the following steps in parallel:
595
586
// TODO: the spec passes additional parameters to _delete a cookie_ that we don't handle yet
596
587
let res = global
@@ -601,8 +592,9 @@ impl CookieStoreMethods<crate::DomTypeHolder> for CookieStore {
601
592
options. name . to_string ( ) ,
602
593
) ) ;
603
594
if res. is_err ( ) {
604
- self . in_flight . borrow_mut ( ) . pop_back ( ) ;
605
595
error ! ( "Failed to send cookiestore message to resource threads" ) ;
596
+ } else {
597
+ self . i
4926
n_flight . borrow_mut ( ) . push_back ( p. clone ( ) ) ;
606
598
}
607
599
608
600
// 7. Return p.
0 commit comments