blob: 4f56181ed94e30c4fdf96d94087597eceda5d4a0 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="img-src *">
</head>
<script>
if (window.testRunner)
testRunner.waitUntilDone();
if (window.internals && window.internals.settings)
internals.settings.setAllowContentSecurityPolicySourceStarToMatchAnyProtocol(true);
var fileInput;
function testFinished()
{
if (window.testRunner)
testRunner.notifyDone();
}
function loadImage(event)
{
var image = document.createElement("img");
image.height = "128";
image.width = "128";
image.alt = "FAIL";
image.onload = testFinished;
image.onerror = testFinished;
image.src = window.URL.createObjectURL(event.target.files[0]);
document.body.removeChild(fileInput);
document.body.appendChild(image);
}
function runTest()
{
if (!window.eventSender)
return;
var x = fileInput.offsetLeft + fileInput.offsetWidth / 2;
var y = fileInput.offsetTop + fileInput.offsetHeight / 2;
eventSender.beginDragWithFiles(["../../fast/dom/resources/abe.png"]);
eventSender.mouseMoveTo(x, y);
eventSender.mouseUp();
}
window.onload = function ()
{
fileInput = document.getElementById("file");
fileInput.onchange = loadImage;
runTest();
}
</script>
<body>
<p>This tests that loading image with a blob URL is allowed when the page has Content Security Policy &quot;image-src *&quot; and the WebKit setting AllowContentSecurityPolicySourceStarToMatchAnyProtocol is enabled. To run this test by hand, select an image file. This test PASSED if the image loads. Otherwise, it FAILED.</p>
<input type="file" id="file" accept="image/*">
</body>
</html>