Explain canvaskit crash and restart the tab before CanvasKit destroys the browser. (#2123)
* Update negative space images to use new assets that can be tiled.
diff --git a/packages/devtools_app/web/index.html b/packages/devtools_app/web/index.html
index 7877fb1..0b5fc3f 100644
--- a/packages/devtools_app/web/index.html
+++ b/packages/devtools_app/web/index.html
@@ -52,6 +52,26 @@
});
}
</script>
+
+ <!-- Script to fail gracefully when CanvasKit crashes. -->
+ <script>
+ var realWarn = window.console.warn.bind(console);
+ var tryingToClose = false;
+ window.console.warn = function(obj) {
+ if( typeof(obj) == "string" && obj.indexOf("CanvasKit") != -1 && obj.indexOf("font") != -1) {
+ if (!tryingToClose) {
+ tryingToClose = true;
+ window.alert(
+ "The Flutter web backend ('CanvasKit') has encountered a fatal error and needs to restart. \n" +
+ "Press OK to restart devtools. We are aware of this bug and working hard on a fix.\n" + obj
+ );
+ }
+ window.location.reload();
+ return;
+ }
+ realWarn(obj);
+ }
+ </script>
<script src="main.dart.js" type="application/javascript"></script>
</body>
</html>