Я внес некоторые коррективы и дополнения в ваш код, и все работы в моих тестах выполняются в FF, Chrome, Opera: HTML:
<canvas id="map_console" width="300px" height="500px"></canvas>
СКРИПТ:
function randColor() {
var str=Math.round(16777215*Math.random()).toString(16);
return "#000000".substr(0,7-str.length)+str;
}
var xSize=6,ySize=8;
var world=[];
for(var x=0;x<xSize;x++) {
world[x]=[];
for(var y=0;y<ySize;y++)
world[x][y]={bgCol:randColor()};
}
function rect(x,y,w,h,col) {
ctx.beginPath();
ctx.rect(x,y,w,h);
ctx.lineWidth = '1px';
ctx.fillStyle = col;
ctx.stroke();
ctx.closePath();
ctx.fill();
}
function showMap() {
canvas = document.getElementById('map_console');
ctx = canvas.getContext('2d');
for (var x = 0; x < world.length; x++) {
for (var y = 0; y < world[x].length; y++) {
rect(40*x,40*y,40,40,world[x][y].bgCol);
}
}
}
showMap();
этообразец в jsfiddle.net: http://jsfiddle.net/dMSE5/