Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(318)

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/non-simple-cross-origin-progress-events.html

Issue 2427553002: Fix XHR's logic to determine whether or not to dispatch upload progress events
Patch Set: a Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!doctype html>
2 <script src="/resources/testharness.js"></script>
3 <script src="/resources/testharnessreport.js"></script>
4 <script>
5 // A simple cross-origin request means a cross-origin request with only
6 // CORS-safelisted method and request-headers.
7
8 async_test(test => {
9 const xhr = new XMLHttpRequest();
10 let onprogressCalled;
11 xhr.onprogress = test.step_func(() => {
12 onprogressCalled = true;
13 });
14 xhr.onload = test.step_func(() => {
15 assert_true(onprogressCalled, 'onprogress is called');
16
17 assert_true(uploadOnprogressCalled, 'upload.onprogress is called');
18 assert_true(uploadOnloadCalled, 'upload.onload is called');
19
20 test.done();
21 });
22
23 // Set handlers after send()
24 const upload = xhr.upload;
25 let uploadOnprogressCalled;
26 upload.onprogress = test.step_func(() => {
27 uploadOnprogressCalled = true;
28 });
29 let onloadCalled;
30 upload.onload = test.step_func(() => {
31 uploadOnloadCalled = true;
32 });
33
34 // Use the script which responds to OPTIONS requests.
35 const params = new URLSearchParams();
36 params.append('origin', 'http://127.0.0.1:8000');
37 params.append('headers', 'test');
38 xhr.open('POST', 'http://localhost:8000/xmlhttprequest/resources/access-contro l-allow-lists.php?' + params.toString(), true);
39 xhr.setRequestHeader("test", "test");
40 xhr.send('hello');
41 }, 'Upload progress events should be dispatched for a non-simple cross-origin re quest');
42 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698