Skip to content

Instantly share code, notes, and snippets.

@balazs
Created June 15, 2015 20:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save balazs/0d9984bb22f5cc7f5279 to your computer and use it in GitHub Desktop.
Save balazs/0d9984bb22f5cc7f5279 to your computer and use it in GitHub Desktop.
layoutish/0000775000175000017500000000000012536662674012434 5ustar balazsbalazslayoutish/xhr-during-transition.html0000664000175000017500000000237612536665343017605 0ustar balazsbalazs<html>
<head>
<!-- <script src="/js-test-resources/js-test.js"></script> -->
<script>
// Shim.
function description(text) {
document.title = text;
}
function finishJSTest() {
}
function testPassed(text) {
log('PASS: ' + text);
}
function testFailed(text) {
log('FAIL: ' + text);
}
// end shim.
description('Test behavior of sync XHR during page transition');
//window.jsTestIsAsync = true;
function finish(message, didPass)
{
// Detach the frame so we don't need to wait for it to finish loading.
//var frame = document.getElementById('frame');
//frame.parentNode.removeChild(frame);
if (didPass)
testPassed(message)
else
testFailed(message);
finishJSTest();
}
function fail(message) {
finish(message, false);
}
function pass(message) {
finish(message, true)
}
function reloadFrame() {
var frame = document.getElementById('frame');
}
</script>
</head>
<body>
<!-- <br/>+MAIN PAGE+<br/>
<br/>+FRAME+<br/> -->
<iframe id='frame' src="xhr-during-transition-frame.html">
</iframe>
<!-- <br/>+FRAME+<br/>
<br/>+CONSOLE+<br/> -->
<div id="console"></div>
<!-- <br/>+CONSOLE+<br/> -->
</body>
<script>
function log(text) {
document.getElementById('console').textContent += text + "<br />";
}
</script>
</html>
layoutish/slow-doc.php0000664000175000017500000000050112537620711014653 0ustar balazsbalazs<?php
$sleepTime = 1;
if (isset($_GET['sleep']))
$sleepTime = $_GET['sleep'];
usleep($sleepTime * 1000);
header('Cache-control: max-age=0');
header('Cache-control: no-store, no-cache, must-revalidate');
header('Pragma: no-cache');
?>
<html>
<body>
<p>
I'm a notoriously slow stupid page :(
</p>
</body>
</html>
layoutish/index.html0000777000175000017500000000000012536662674021571 2xhr-during-transition.htmlustar balazsbalazslayoutish/xhr-during-transition-frame.html0000664000175000017500000000126412537620646020666 0ustar balazsbalazs<script>
function loadResource() {
var xhr = new XMLHttpRequest();
xhr.open('GET', 'dummy.html', false);
var exception = null;
try {
xhr.send(null);
} catch (e) {
exception = e;
}
if (xhr.responseText) {
var msg = 'sync XHR should be blocked during page transition' +
', got response: ' + xhr.responseText;
window.parent.fail(msg);
console.log(msg);
return;
}
window.parent.pass("sync XHR was blocked during page transition");
}
window.onload = function() {
setTimeout(loadResource, 10);
window.location.assign('slow-doc.php?sleep=5');
}
</script>
<body>
I am da frame
</body>
layoutish/dummy.html0000644000175000017500000000005612536662540014444 0ustar balazsbalazs<!DOCTYPE html>
<html>
<body>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment