Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <html> | |
| 2 <head> | |
| 3 <script> | |
| 4 var logWin = window.parent.opener; | |
| 5 logWin.log('Iframe is being loaded.'); | |
| 6 | |
| 7 var xhr = new XMLHttpRequest(); | |
| 8 xhr.onreadystatechange = function() { | |
| 9 logWin.log('xhr onreadystatechange state:' + xhr.readyState); | |
| 10 if (xhr.readyState == 4) { | |
| 11 var text = xhr.responseText; | |
| 12 // Report that the test is finished. | |
| 13 logWin.finish(); | |
| 14 } | |
| 15 } | |
| 16 | |
| 17 xhr.onerror = function() { | |
| 18 logWin.log('xhr onerror:' + xhr.readyState); | |
| 19 } | |
| 20 | |
| 21 // Timeout explanation: | |
| 22 // To reproduce the issue, I need the XHR to start but not finish until the | |
| 23 // iframe transfer is complete. If I just navigate to some file, the load | |
| 24 // actually happens before the iframe is transferred and all the onreadystatecha nge | |
|
levin
2011/08/04 22:27:36
80 col. (several places)
| |
| 25 // notifications are already queued and just fire in the new page. | |
| 26 // The bug, however, deals with XHR being still in progress in the browser proce ss, | |
| 27 // so when it is done and comes back with the routing_id of the closed window, | |
| 28 // it has no way of finding the original iframe and firing onreadystatechange. | |
| 29 // Having this timeout theoretically can make the test occasionally produce fals e | |
| 30 // positive (if the reparenting takes longer then 1 second for example) however this | |
| 31 // is very unlikely, and it won't make test flakey (false negative). | |
| 32 xhr.open('GET', '/slow?1', true); | |
| 33 xhr.send(); | |
| 34 window.parent.transferIframeAndCloseWindow(); | |
| 35 </script> | |
| 36 </head> | |
| 37 <body> | |
| 38 </body> | |
| 39 </html> | |
| OLD | NEW |