From cd421f7fa7c64715f88f155880fda3b4abd44789 Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Thu, 24 Jan 2008 18:09:49 +0000 Subject: [PATCH] Attempt to quit with an error code when an assertion fails. This only works in the standalone debug player, if the swf is a trusted local file. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4925 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- src/as/com/threerings/util/Assert.as | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/as/com/threerings/util/Assert.as b/src/as/com/threerings/util/Assert.as index b4cceb0f9..6c2c259b9 100644 --- a/src/as/com/threerings/util/Assert.as +++ b/src/as/com/threerings/util/Assert.as @@ -22,6 +22,7 @@ package com.threerings.util { import flash.system.Capabilities; +import flash.system.System; /** * Simple implementation of assertion checks for debug environments. @@ -81,6 +82,14 @@ public class Assert if (dumpStack) { _log.warning(new Error("dumpStack").getStackTrace()); } + + // try to exit, but don't booch if we're running in an older player + var o :Object = System; + try { + o["exit"](1); // call System.exit(1); + } catch (err :SecurityError) { + // probably not allowed + } } protected static var _log :Log = Log.getLog(Assert);