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 : import { ProgressEvent } from '../../../lib/whatwg-xhr.js'; 4 : 1 : 5 [ + ]: 1 : export default (activeURL) => { 6 : 1 : 7 : 1 : let xhr = new XMLHttpRequest(); 8 : 1 : 9 [ + ]: 1 : xhr.upload.onprogress = (e) => { 10 : 1 : 11 : 1 : assert(e instanceof ProgressEvent); 12 : 1 : assert(e.type === 'progress'); 13 : 1 : assert(e.target === xhr.upload); 14 : 1 : }; 15 : 1 : 16 : 1 : xhr.open('POST', `${activeURL}/content.py`); 17 : 1 : xhr.send('Test Message'); 18 : 1 : } 19 : 1 : 20 : 1 : /* 21 : 1 : * send-response-upload-event-progress.mjs 22 : 1 : * 23 : 1 : 24 : 1 : <!DOCTYPE html> 25 : 1 : <html> 26 : 1 : <head> 27 : 1 : <link rel="help" href="https://xhr.spec.whatwg.org/#handler-xhr-onprogress" data-tested-assertations="../.." /> 28 : 1 : <link rel="help" href="https://xhr.spec.whatwg.org/#event-xhr-progress" data-tested-assertations="../.." /> 29 : 1 : <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::a[contains(@href,'#make-upload-progress-notifications')]/.. following::ol[1]/li[8]" /> 30 : 1 : <link rel="help" href="https://xhr.spec.whatwg.org/#make-upload-progress-notifications" data-tested-assertations="following::ul[1]/li[2]/ol[1]/li[2]" /> 31 : 1 : <script src="/resources/testharness.js"></script> 32 : 1 : <script src="/resources/testharnessreport.js"></script> 33 : 1 : <title>XMLHttpRequest: The send() method: Fire a progress event named progress on the XMLHttpRequestUpload (synchronous flag is unset)</title> 34 : 1 : </head> 35 : 1 : 36 : 1 : <body> 37 : 1 : <div id="log"></div> 38 : 1 : 39 : 1 : <script type="text/javascript"> 40 : 1 : var test = async_test(); 41 : 1 : 42 : 1 : test.step(function() 43 : 1 : { 44 : 1 : var xhr = new XMLHttpRequest(); 45 : 1 : 46 : 1 : xhr.upload.onprogress = function(e) 47 : 1 : { 48 : 1 : test.step(function() 49 : 1 : { 50 : 1 : assert_true(e instanceof ProgressEvent); 51 : 1 : assert_equals(e.type, "progress"); 52 : 1 : assert_equals(e.target, xhr.upload); 53 : 1 : test.done(); 54 : 1 : }); 55 : 1 : }; 56 : 1 : 57 : 1 : xhr.open("POST", "./resources/content.py", true); 58 : 1 : xhr.send("Test Message"); 59 : 1 : }); 60 : 1 : </script> 61 : 1 : </body> 62 : 1 : </html> 63 : 1 : 64 : 1 : * 65 : 1 : * send-response-upload-event-progress.mjs 66 : 1 : */