1226400-1.html 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <title>FontFaceSet::Load crasher</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <style type="text/css">
  7. body {
  8. margin: 50px;
  9. }
  10. p {
  11. margin: 0;
  12. font-size: 300%;
  13. }
  14. </style>
  15. </head>
  16. <body>
  17. <p>This may crash on load...</p>
  18. <script>
  19. var scriptText = `
  20. var fontFaceSet = document.fonts;
  21. var link = document.createElement("link");
  22. link.onerror = link.onload = function() {
  23. fontFaceSet.load("12px foo");
  24. }
  25. link.rel = "stylesheet";
  26. link.href = "data:text/css,";
  27. document.body.appendChild(link);
  28. `;
  29. var styleText = `
  30. @font-face {
  31. font-family: foo;
  32. src: url("data:text/ttf,");
  33. }
  34. `;
  35. var ifr = document.createElement("iframe");
  36. document.body.appendChild(ifr);
  37. var style = ifr.contentDocument.createElement("style");
  38. style.textContent = styleText;
  39. ifr.contentDocument.body.appendChild(style);
  40. var script = ifr.contentDocument.createElement("script");
  41. script.textContent = scriptText;
  42. ifr.contentDocument.body.appendChild(script);
  43. ifr.remove();
  44. </script>
  45. </body>
  46. </html>