rem: const things = ["gCmdNewGame","gCmdRestartGame","gCmdUndo","gCmdRedo","gCmdHint", "gCmdRedeal","gMessageBox","gMessageLine1","gMessageLine2","gOptionsMenu", "gGameSelector","gScorePanel","gScoreDisplay","gGameStack","gGameMenuPopup"]; 
add: const things = ["gCmdNewGame", "gCmdRestartGame", "gCmdUndo", "gCmdRedo", "gCmdHint", "gCmdRedeal", "gMessageBox", "gMessageLine1", "gMessageLine2", "gOptionsMenu", "gGameSelector", "gScorePanel", "gScoreDisplay", "gGameStack", "gGameMenuPopup", "gCardsImg", "gPileImg"]; 
context: function init() {  const things = ["gCmdNewGame","gCmdRestartGame","gCmdUndo","gCmdRedo","gCmdHint",      "gCmdRedeal","gMessageBox","gMessageLine1","gMessageLine2","gOptionsMenu",      "gGameSelector","gScorePanel","gScoreDisplay","gGameStack","gGameMenuPopup"];  for(var i = 0; i != things.length; ++i) {    var thing = things[i];    window[thing] = document.getElementById(window[thing]);  }  gGameStackTop = gGameStack.boxObject.y;  gGameStackLeft = gGameStack.boxObject.x;  createFloatingPile();  // init the pref branch  gPrefs = CC["@mozilla.org/preferences-service;1"]      .getService(CI.nsIPrefService).getBranch("games.cards.");  // load stringbundle  var svc = CC["@mozilla.org/intl/stringbundle;1"].getService(CI.nsIStringBundleService);  var bundle = svc.createBundle("chrome://cards/locale/cards.properties").getSimpleEnumeration();  while(bundle.hasMoreElements()) {    var property = bundle.getNext().QueryInterface(CI.nsIPropertyElement);    gStrings[property.key] = property.value;  }  // restore choice of cardset  var cardset = loadPref("cardset") || "normal";  useCardSet(cardset);  document.getElementById("cardset-"+cardset).setAttribute("checked","true");  createHintHighlighter();  // make controllers for each game type  for(var game in Games) Games[game] = new GameControllerObj(game, Games[game]);  // work out which game was played last  var game = loadPref("current-game");  if(!(game in Games)) game = "klondike1"; // if pref corrupted or missing  // build the games menu  var gamesInMenu = loadPref("gamesInMenu")      || "freecell,fan,divorce,gypsy4,klondike1,mod3,penguin,pileon,russiansol"          + ",simon4,spider2,spider4,unionsquare,wasp,whitehead,yukon";  gamesInMenu = gamesInMenu.split(",");  buildGamesMenu(gamesInMenu, game);  // without the setTimeout the game often ends up with one pile incorrectly laid out  // (typically a fan down that ends up fanning upwards)  setTimeout(playGame, 0, game);}
meta: 3385	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/3385/5094de279a1c171f7a2df901cc061af2fe4558c5/main.js/buggy/code/main.js