tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

img-blobURI-1.html (1041B)


      1 <!DOCTYPE html>
      2 <!-- This test checks to be sure we can render SVG-as-an-image
      3     from a 'blob' URI. -->
      4 <html class="reftest-wait">
      5 <head>
      6  <script>
      7    function go() {
      8      // Generate a blob URL encoding of an SVG document
      9      var blobURL = generateBlobURL();
     10 
     11      // Tell our img element to render the URL
     12      var img = document.getElementsByTagName("img")[0]
     13      img.src = blobURL;
     14 
     15      // Once our img loads, take reftest snapshot.
     16      img.addEventListener("load", function() {
     17        document.documentElement.removeAttribute("class");
     18      });
     19    }
     20 
     21    // Helper function -- returns a blob URL representing a
     22    // 100x100 fully-lime SVG document.
     23    function generateBlobURL() {
     24      var svg =
     25        '<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100">' +
     26          '<rect height="100%" width="100%" fill="lime"/>' +
     27        '</svg>';
     28      return self.URL.createObjectURL(new Blob([svg], {type: "image/svg+xml"}));
     29    }
     30  </script>
     31 </head>
     32 <body onload="go()">
     33  <img src="">
     34 </body>
     35 </html>