Branch data Line data Source code
1 [ + ]: 1 : import assert from 'node:assert/strict';
2 : 1 : import { XMLHttpRequest } from '../../../lib/whatwg-xhr.js';
3 : 1 :
4 : 1 : import { prepare_xhr_for_event_order_test } from './xmlhttprequest-event-order.js?q2';
5 : 1 : import { assert_xhr_event_order_matches } from './xmlhttprequest-event-order.js?q2';
6 : 1 :
7 [ + ]: 1 : export default (activeURL) => {
8 : 1 :
9 : 1 : let xhr = new XMLHttpRequest();
10 : 1 :
11 : 1 : prepare_xhr_for_event_order_test(xhr);
12 : 1 :
13 [ + ]: 1 : xhr.addEventListener('loadend', () => {
14 : 1 : assert_xhr_event_order_matches([
15 : 1 : 1,
16 : 1 : `loadstart(0,0,false)`,
17 : 1 : `upload.loadstart(0,12,true)`,
18 : 1 : `upload.progress(12,12,true)`,
19 : 1 : `upload.load(12,12,true)`,
20 : 1 : `upload.loadend(12,12,true)`,
21 : 1 : 2,
22 : 1 : 3,
23 : 1 : `progress(12,12,true)`,
24 : 1 : 4,
25 : 1 : `load(12,12,true)`,
26 : 1 : `loadend(12,12,true)`
27 : 1 : ]);
28 : 1 : });
29 : 1 :
30 [ + ]: 1 : xhr.upload.onloadend = () => {};
31 : 1 :
32 : 1 : xhr.open('POST', `${activeURL}/content.py`);
33 : 1 : xhr.send('Test Message');
34 : 1 : }
35 : 1 :
36 : 1 : /*
37 : 1 : * send-response-event-order.htm
38 : 1 : *
39 : 1 :
40 : 1 : <!DOCTYPE html>
41 : 1 : <html>
42 : 1 : <head>
43 : 1 : <link rel='help' href='https://xhr.spec.whatwg.org/#handler-xhr-onloadstart' data-tested-assertations='../..' />
44 : 1 : <link rel='help' href='https://xhr.spec.whatwg.org/#handler-xhr-onloadend' data-tested-assertations='../..' />
45 : 1 : <link rel='help' href='https://xhr.spec.whatwg.org/#event-xhr-loadstart' data-tested-assertations='../..' />
46 : 1 : <link rel='help' href='https://xhr.spec.whatwg.org/#event-xhr-loadend' data-tested-assertations='../..' />
47 : 1 : <link rel='help' href='https://xhr.spec.whatwg.org/#the-send()-method' data-tested-assertations='following-sibling::ol/li[9]/ol/li[2] following-sibling::ol/li[9]/ol/li[3] following::a[contains(@href,'#make-upload-progress-notifications')]/.. following::a[contains(@href,'#make-progress-notifications')]/..' />
48 : 1 : <link rel='help' href='https://xhr.spec.whatwg.org/#make-upload-progress-notifications' data-tested-assertations='following::ul[1]/li[1] following::ul[1]/li[2]/ol[1]/li[2] following::ul[1]/li[2]/ol[1]/li[3] following::ul[1]/li[2]/ol[1]/li[4]' />
49 : 1 : <link rel='help' href='https://xhr.spec.whatwg.org/#make-progress-notifications' data-tested-assertations='..' />
50 : 1 : <link rel='help' href='https://xhr.spec.whatwg.org/#infrastructure-for-the-send()-method' data-tested-assertations='following::a[contains(@href,'#switch-done')]/..' />
51 : 1 : <link rel='help' href='https://xhr.spec.whatwg.org/#switch-done' data-tested-assertations='following::ol[1]/li[3] following::ol[1]/li[4] following::ol[1]/li[5] following::ol[1]/li[6] following::ol[1]/li[7]' />
52 : 1 : <script src='/resources/testharness.js'></script>
53 : 1 : <script src='/resources/testharnessreport.js'></script>
54 : 1 : <script src='resources/xmlhttprequest-event-order.js'></script>
55 : 1 : <title>XMLHttpRequest: The send() method: event order when synchronous flag is unset</title>
56 : 1 : </head>
57 : 1 :
58 : 1 : <body>
59 : 1 : <div id='log'></div>
60 : 1 :
61 : 1 : <script type='text/javascript'>
62 : 1 : var test = async_test();
63 : 1 :
64 : 1 : test.step(function()
65 : 1 : {
66 : 1 : var xhr = new XMLHttpRequest();
67 : 1 : prepare_xhr_for_event_order_test(xhr);
68 : 1 :
69 : 1 : xhr.addEventListener('loadend', test.step_func(function() {
70 : 1 : assert_xhr_event_order_matches([1, 'loadstart(0,0,false)', 'upload.loadstart(0,12,true)', 'upload.progress(12,12,true)', 'upload.load(12,12,true)', 'upload.loadend(12,12,true)', 2, 3, 'progress(12,12,true)', 4, 'load(12,12,true)', 'loadend(12,12,true)']);
71 : 1 : test.done();
72 : 1 : }));
73 : 1 :
74 : 1 : xhr.open('POST', './resources/content.py', true);
75 : 1 : xhr.send('Test Message');
76 : 1 : });
77 : 1 : </script>
78 : 1 : </body>
79 : 1 : </html>
80 : 1 :
81 : 1 : *
82 : 1 : * send-response-event-order.htm
83 : 1 : */
|