Opened 9 years ago

Closed 8 years ago

Last modified 8 years ago

#12695 closed defect (worksforme)

console.debug() broken on IE9 w/new AMD loader

Reported by: bill Owned by: Rawld Gill
Priority: high Milestone: 1.7
Component: Core Version: 1.6.0
Keywords: Cc:
Blocked By: Blocking:

Description

The console.debug() method doesn't work in IE9 anymore. To test, you could load dijit/tets/_base/test_FocusManager.html (or presumably any other test file), and just type console.debug("hi") in the console.

Apparently IE9 has no native console.debug method. So there's a fix for that in kernel.js:

while((tn=cn[i++])){
	if(!console[tn]){
		(function(){
			var tcn = tn+"";
			console[tcn] = ('log' in console) ? function(){
				var a = Array.apply({}, arguments);
				a.unshift(tcn+":");
				console["log"](a.join(" "));
			} : function(){};
			console[tcn]._fake = true;
		})();
	}
}

However, the problem is that the code below in firebug.js now runs first. It creates a new debug method but just points it to _debug, which is the old method, which doesn't exist:

var isNewIE = (/Trident/.test(window.navigator.userAgent));
if(isNewIE){
	// Fixing IE's console
	// IE doesn't insert space between arguments. How annoying.
	var calls = ["log", "info", "debug", "warn", "error"];
	for(var i=0;i<calls.length;i++){
		var m = calls[i];
		var n = "_"+calls[i];
		console[n] = console[m];
		console[m] = (function(){
			var type = n;
			return function(){
				console[type](Array.prototype.slice.call(arguments).join(" "));
			};
		})();
	}
	// clear the console on load. This is more than a convenience - too many logs crashes it.
	// If closed it throws an error
	try{ console.clear(); }catch(e){}
}

Before the AMD checkin the code in firebug.js ran last.

Change History (4)

comment:1 Changed 9 years ago by bill

(In [24364]) (Temporary?) fix to #12695, could be streamlined if the load order of kernel.js and firebug.js is guaranteed but not sure if it is. I'm not sure any of the space-adjusting code in firebug.js is needed if fake console.xyz() methods are later created in kernel.js, so this needs another look.

Refs #12695 !strict

comment:2 Changed 8 years ago by Rawld Gill

Status: newassigned

comment:3 Changed 8 years ago by Rawld Gill

Resolution: worksforme
Status: assignedclosed

Actually, dojo/_firebug/firebug is loaded after dojo/_base/kernel which includes defining the console as always since dojo/_firebug/firebug depends on dojo/_base/kernel. I checked that this is the actual load order in ie9, and it is.

Also, could not duplicate. Maybe this got fixed with the ie9 improvements.

comment:4 Changed 8 years ago by bill

Yes, this is working now, I remember some checkins from you a while ago about the firebug code; they probably fixed it.

Note: See TracTickets for help on using tickets.