blob: 5e4a7cb7459451479d5af42554f4e197b910fd9c [file] [log] [blame]
<p>
This tests that when the user style sheet location is set to a data:
URL with base64-encoded UTF-8 data, the style sheet is processed
synchronously, instead of invoking the asynchronous loader.
</p>
<script>
var testObjects = [
{result:true, size:"100px", url:"data:text/css;charset=utf-8;base64,Ym9keSB7Zm9udC1zaXplOiAxMDBweH0="},
{result:true, size:"110px", url:encodeURI("data:text/css;charset=utf-8;base64, Ym9keSB7Zm9udC1zaXplOiAxMTBweH0= ")},
{result:true, size:"120px", url:encodeURI("data:text/css;charset=utf-8;base64,\n \r \t Ym9k \t eSB7 \r Zm9ud \n \n C1zaXp \r lOiAxM \t jBweH0= \t \r \n")},
{result:true, size:"130px", url:encodeURI("data:text/css;charset=utf-8;base64,\u0059 \u006D \u0039 \u006B eSB7Zm9ud C1zaXplOiAxMzBwe \u0048 \u0030 \u003D")},
{result:false, size:"140px", url:"data:text/css;charset=utf-8;base64,Ym9k$#eSB7Zm#9ud(C1zaXp)lOiAxNDBweH0="},
{result:false, size:"150px", url:"data:text/css;charset=utf-8;base64,Ym9ke%00SB7Z%20m9udC1z\n\taXplO#iAx%03NTBw%eH0="},
{result:false, size:"160px", url:"%50%30%10%00%20%40"}
];
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.setUserStyleSheetEnabled(true);
for (var i = 0; i < testObjects.length; i++) {
var obj = testObjects[i];
testRunner.setUserStyleSheetLocation(obj.url);
document.body.offsetTop;
var result = getComputedStyle(document.body).fontSize == obj.size;
document.write((result == obj.result ? "PASS" : "FAIL") + " " + obj.size + "<br>");
testRunner.setUserStyleSheetLocation("");
}
} else
document.write("This test can only be run in DumpRenderTree.");
</script>