add:  window.tryToClose = WindowIsClosing; 
context: function Startup(){  gBrowser = document.getElementById("content");  var uriToLoad = null;  // Check for window.arguments[0]. If present, use that for uriToLoad.  if ("arguments" in window && window.arguments.length >= 1 && window.arguments[0])    uriToLoad = window.arguments[0];  gIsLoadingBlank = uriToLoad == "about:blank";  if (!gIsLoadingBlank)    prepareForStartup();#ifdef ENABLE_PAGE_CYCLER  appCore.startPageCycler();#else  // only load url passed in when we're not page cycling   if (uriToLoad && !gIsLoadingBlank) {    if ("arguments" in window && window.arguments.length >= 3)      loadURI(uriToLoad, window.arguments[2], null);    else      loadOneOrMoreURIs(uriToLoad);  }#ifdef MOZ_ENABLE_XREMOTE  // hook up remote support  var remoteService;  remoteService = Components.classes["@mozilla.org/browser/xremoteservice;1"]                            .getService(Components.interfaces.nsIXRemoteService);  remoteService.addBrowserInstance(window);  var observerService = Components.classes["@mozilla.org/observer-service;1"]    .getService(Components.interfaces.nsIObserverService);  observerService.addObserver(gTabOpenObserver, "open-new-tab-request", false);#endif#endif  var sidebarSplitter;  if (window.opener && !window.opener.closed) {    var openerSidebarBox = window.opener.document.getElementById("sidebar-box");    // The opener can be the hidden window too, if we're coming from the state    // where no windows are open, and the hidden window has no sidebar box.     if (openerSidebarBox && !openerSidebarBox.hidden) {      var sidebarBox = document.getElementById("sidebar-box");      var sidebarTitle = document.getElementById("sidebar-title");      sidebarTitle.setAttribute("value", window.opener.document.getElementById("sidebar-title").getAttribute("value"));      sidebarBox.setAttribute("width", openerSidebarBox.boxObject.width);      var sidebarCmd = openerSidebarBox.getAttribute("sidebarcommand");      sidebarBox.setAttribute("sidebarcommand", sidebarCmd);      sidebarBox.setAttribute("src", window.opener.document.getElementById("sidebar").getAttribute("src"));      gMustLoadSidebar = true;      sidebarBox.hidden = false;      sidebarSplitter = document.getElementById("sidebar-splitter");      sidebarSplitter.hidden = false;      document.getElementById(sidebarCmd).setAttribute("checked", "true");    }  }  else {    var box = document.getElementById("sidebar-box");    if (box.hasAttribute("sidebarcommand")) {       var cmd = box.getAttribute("sidebarcommand");      if (cmd != "") {        gMustLoadSidebar = true;        box.hidden = false;        sidebarSplitter = document.getElementById("sidebar-splitter");        sidebarSplitter.hidden = false;        document.getElementById(cmd).setAttribute("checked", "true");      }    }  }  // Certain kinds of automigration rely on this notification to complete their  // tasks BEFORE the browser window is shown.     var obs = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);  obs.notifyObservers(null, "browser-window-before-show", "");  // Set a sane starting width/height for all resolutions on new profiles.  if (!document.documentElement.hasAttribute("width")) {    var defaultWidth = 994, defaultHeight;    if (screen.availHeight <= 600) {      dump("*** screen res < 600px high\n");      document.documentElement.setAttribute("sizemode", "maximized");      defaultWidth = 610;      defaultHeight = 450;    }    else {      dump("*** screen res > 600px high\n");      // Create a narrower window for large or wide-aspect displays, to suggest      // side-by-side page view.       if ((screen.availWidth / 2) >= 800)        defaultWidth = (screen.availWidth / 2) - 20;      defaultHeight = screen.availHeight - 10;#ifdef MOZ_WIDGET_GTK#define USE_HEIGHT_ADJUST#endif#ifdef MOZ_WIDGET_GTK2#define USE_HEIGHT_ADJUST#endif#ifdef USE_HEIGHT_ADJUST      // On X, we're not currently able to account for the size of the window      // border.  Use 28px as a guess (titlebar + bottom window border)      defaultHeight -= 28;#endif    }    document.documentElement.setAttribute("width", defaultWidth);    document.documentElement.setAttribute("height", defaultHeight);  }    setTimeout(delayedStartup, 0);}
meta: 10234	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/10234/8915e852a3de8131293c2f44f9adabbee667d98f/browser.js/clean/browser/base/content/browser.js