Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Debug now maps to console

  • Loading branch information...
commit b2889b6ac4d7b2a812aa7889a65cad435581c671 1 parent 771881a
@nikhilk authored
View
2  docs/History.txt
@@ -11,6 +11,8 @@ v0.7.6
Window in Script.Web
- Moved SetTimeout, SetInterval and ClearTimeout, ClearInterval from
Window object to Script object in mscorlib.
+ - Removed window dependency in mscorlib.js
+ - Debug class now maps directly to console
v0.7.5.0
- DOM metadata update (readyState property on Document,
View
5 src/Core/CoreLib/Diagnostics/Debug.cs
@@ -8,8 +8,9 @@
namespace System.Diagnostics {
- [ScriptNamespace("ss")]
[Imported]
+ [IgnoreNamespace]
+ [ScriptName("console")]
public static class Debug {
[Conditional("DEBUG")]
@@ -25,7 +26,7 @@ public static class Debug {
}
[Conditional("DEBUG")]
- [ScriptName("writeln")]
+ [ScriptName("log")]
public static void WriteLine(string message) {
}
}
View
45 src/Core/CoreScript/BCL/Debug.js
@@ -1,43 +1,18 @@
///////////////////////////////////////////////////////////////////////////////
// Debug Extensions
-ss.Debug = window.Debug || function() {};
-ss.Debug.__typeName = 'Debug';
-
-if (!ss.Debug.writeln) {
- ss.Debug.writeln = function#? DEBUG Debug$writeln##(text) {
- if (window.console) {
- if (window.console.debug) {
- window.console.debug(text);
- return;
- }
- else if (window.console.log) {
- window.console.log(text);
- return;
- }
- }
- else if (window.opera &&
- window.opera.postError) {
- window.opera.postError(text);
- return;
- }
+if (!console) {
+ global.console = {
+ log: function() {
+ },
+ assert: function() {
}
+ }
}
-ss.Debug._fail = function#? DEBUG Debug$_fail##(message) {
- ss.Debug.writeln(message);
+global.console.fail = function(message) {
+ console.assert(false, message);
+ if (global.navigator && (global.navigator.userAgent.indexOf('MSIE') > 0)) {
eval('debugger;');
-}
-
-ss.Debug.assert = function#? DEBUG Debug$assert##(condition, message) {
- if (!condition) {
- message = 'Assert failed: ' + message;
- if (confirm(message + '\r\n\r\nBreak into debugger?')) {
- ss.Debug._fail(message);
- }
- }
-}
-
-ss.Debug.fail = function#? DEBUG Debug$fail##(message) {
- ss.Debug._fail(message);
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.