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

Side by Side Diff: content/test/data/loader/async_resource_handler.html

Issue 2598353002: The second argument of add/removeEventListener should be an object, null, or undefined
Patch Set: Fix test Created 3 years, 11 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/events/event-target-add-remove-listeners.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <script> 3 <script>
4 var ranProgressHandler = false; 4 var ranProgressHandler = false;
5 var completedUpload = false; 5 var completedUpload = false;
6 6
7 var asyncXHR; 7 var asyncXHR;
8 var lastSeenProgress = 0; 8 var lastSeenProgress = 0;
9 var data; 9 var data;
10 10
(...skipping 17 matching lines...) Expand all
28 if (progress > e.total) 28 if (progress > e.total)
29 failureList.push('Upload progress exceeds payload size.'); 29 failureList.push('Upload progress exceeds payload size.');
30 30
31 if (failureList.length) 31 if (failureList.length)
32 sendResults(failureList); 32 sendResults(failureList);
33 33
34 lastSeenProgress = progress; 34 lastSeenProgress = progress;
35 ranProgressHandler = true; 35 ranProgressHandler = true;
36 } 36 }
37 37
38 function completedUpload(e) { 38 function onCompletedUpload(e) {
bashi 2016/12/27 08:37:17 |completedUpload| is already defined in line 5 :(
39 completedUpload = true; 39 completedUpload = true;
40 } 40 }
41 41
42 function onFinished(e) { 42 function onFinished(e) {
43 var failureList = []; 43 var failureList = [];
44 if (!ranProgressHandler) 44 if (!ranProgressHandler)
45 failureList.push('Finished upload without firing a progress event.'); 45 failureList.push('Finished upload without firing a progress event.');
46 if (lastSeenProgress != data.length) 46 if (lastSeenProgress != data.length)
47 failureList.push('Final progress event before data transfer completed.'); 47 failureList.push('Final progress event before data transfer completed.');
48 if (this.responseText != 'hello') { 48 if (this.responseText != 'hello') {
(...skipping 12 matching lines...) Expand all
61 // Note: payloadSize will be of the form 2*3^x. 61 // Note: payloadSize will be of the form 2*3^x.
62 data = 'yo'; 62 data = 'yo';
63 while(data.length !== payloadSize) { 63 while(data.length !== payloadSize) {
64 data = data + data + data; 64 data = data + data + data;
65 } 65 }
66 asyncXHR = new XMLHttpRequest(); 66 asyncXHR = new XMLHttpRequest();
67 asyncXHR.addEventListener('load', onFinished); 67 asyncXHR.addEventListener('load', onFinished);
68 asyncXHR.addEventListener('error', onError); 68 asyncXHR.addEventListener('error', onError);
69 69
70 asyncXHR.upload.addEventListener('progress', progressListener); 70 asyncXHR.upload.addEventListener('progress', progressListener);
71 asyncXHR.upload.addEventListener('load', completedUpload); 71 asyncXHR.upload.addEventListener('load', onCompletedUpload);
72 72
73 asyncXHR.open('POST', url, true); 73 asyncXHR.open('POST', url, true);
74 74
75 asyncXHR.setRequestHeader('Content-Type', 'text/plain'); 75 asyncXHR.setRequestHeader('Content-Type', 'text/plain');
76 asyncXHR.send(data); 76 asyncXHR.send(data);
77 } 77 }
78 </script> 78 </script>
79 </head> 79 </head>
80 <body> 80 <body>
81 This page sends an asynchronous XMLHttpRequest on calling WaitForAsyncXHR(url). 81 This page sends an asynchronous XMLHttpRequest on calling WaitForAsyncXHR(url).
82 </body> 82 </body>
83 </html> 83 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/events/event-target-add-remove-listeners.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698