<style> @font-face { font-family: no-such-font; src: url(no-such-file.ttf); } </style> <canvas id="target"></canvas> <script> canvas = document.getElementById("target"); ctx = canvas.getContext('2d'); ctx.font = "100px no-such-font, ahem"; ctx.fillStyle = "red"; ctx.fillText("B", 0, 100); ctx.fillStyle = "green"; canvas.parentNode.removeChild(canvas); if (window.testRunner) testRunner.waitUntilDone(); setTimeout(function() { ctx.fillText("A", 0, 100); document.body.appendChild(canvas); if (window.testRunner) testRunner.notifyDone(); }, 50); </script>