test_bug1242019.html (1476B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=1242019 5 --> 6 <head> 7 <meta charset="utf-8"> 8 <title>Test for Bug 1242019</title> 9 <script src="/tests/SimpleTest/SimpleTest.js"></script> 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 11 </head> 12 <body> 13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1242019">Mozilla Bug 1242019</a> 14 <p id="display"></p> 15 16 <iframe id="cspframe"></iframe> 17 18 <pre id="test"> 19 20 <script class="testbody" type="text/javascript"> 21 function cleanup() { 22 SpecialPowers.postConsoleSentinel(); 23 SimpleTest.finish(); 24 }; 25 26 var expectedURI = "data:image/png;base64,iVBORw0KGgoAAAANSU" 27 28 SpecialPowers.registerConsoleListener(function ConsoleMsgListener(aMsg) { 29 // look for the message with data uri and see the data uri is truncated to 40 chars 30 data_start = aMsg.message.indexOf(expectedURI) 31 if (data_start > -1) { 32 data_uri = ""; 33 data_uri = aMsg.message.substr(data_start); 34 // this will either match the elipsis after the URI or the . at the end of the message 35 data_uri = data_uri.substr(0, data_uri.indexOf("…")); 36 if (data_uri == "") { 37 return; 38 } 39 40 ok(data_uri.length == 40, "Data URI only shows 40 characters in the console"); 41 SimpleTest.executeSoon(cleanup); 42 } 43 }); 44 45 // set up and start testing 46 SimpleTest.waitForExplicitFinish(); 47 document.getElementById('cspframe').src = 'file_data-uri_blocked.html'; 48 </script> 49 </pre> 50 </body> 51 </html>