<script>
var img = document.createElement('img');
img.crossOrigin = location.search.match(/crossOrigin=(anonymous|use-credentials)/)[1];
// After verifying that the image is loaded correctly, we
// must also check whether the renderer accepts the resource.
// The replies are delayed to allow tests to close the tabs in case
// the test failed at an early stage.
img.onerror = function() {
setTimeout(function() {
// Should not happen. Failure is signaled to allow the unit tests to continue
// with the next test, the exact value of the next string does not matter.
new Image().src = '/signal_that_image_failed_to_load';
}, 500);
};
img.onload = function() {
setTimeout(function() {
// Verified in test_blocking.js
new Image().src = '/signal_that_image_loaded_successfully';
}, 500);
};
img.src = decodeURIComponent(location.search.match(/src=([^&]+)/)[1]);
</script>