rem: var pref = Components.classes['component:   var startpage = "about:"; if (pref) { pref = pref.getService(); 
add: if ( !explicitURL ) { var pref = Components.classes['component:   var startpage = "about:"; if (pref) { pref = pref.getService(); } if (pref) { pref = pref.QueryInterface(Components.interfaces.nsIPref); } if (pref) {      choice = pref.GetIntPref("browser.startup.page"); switch (choice) { case 0: startpage = "about:blank"; break; case 1: startpage = pref.CopyCharPref("browser.startup.homepage"); break; case 2: var history = Components.classes['component: if (history) { history = history.getService(); } if (history) { history = history.QueryInterface(Components.interfaces.nsIGlobalHistory); } if (history) { startpage = history.GetLastPageVisted(); } break; case 3: startpage = pref.CopyCharPref("browser.startup.splash"); break; default: startpage = "about:"; } } document.getElementById("args").setAttribute("value", startpage); 
context:   function tryToSetContentWindow() {    if ( window.frames[0].frames[1] ) {        dump("Setting content window\n");        appCore.setContentWindow( window.frames[0].frames[1] );        // Have browser app core load appropriate initial page.        var pref = Components.classes['component://netscape/preferences'];        // if all else fails, use trusty "about:" as the start page        var startpage = "about:";          if (pref) {          pref = pref.getService();        }        if (pref) {          pref = pref.QueryInterface(Components.interfaces.nsIPref);        }        if (pref) {          // from mozilla/modules/libpref/src/init/all.js          // 0 = blank           // 1 = home (browser.startup.homepage)          // 2 = last           // 3 = splash (browser.startup.splash)          choice = pref.GetIntPref("browser.startup.page");	  switch (choice) {		case 0:            		startpage = "about:blank";      			break;		case 1:            		startpage = pref.CopyCharPref("browser.startup.homepage");      			break;		case 2:            		var history = Components.classes['component://netscape/browser/global-history'];			if (history) {               			history = history.getService();	    		}	    		if (history) {              			history = history.QueryInterface(Components.interfaces.nsIGlobalHistory);	    		}	    		if (history) {				startpage = history.GetLastPageVisted();	    		}      			break;		case 3:            		startpage = pref.CopyCharPref("browser.startup.splash");      			break;   		default:            		startpage = "about:";	  }        }        document.getElementById("args").setAttribute("value", startpage);        appCore.loadInitialPage();    } else {        // Try again.        dump("Scheduling later attempt to set content window\n");        window.setTimeout( "tryToSetContentWindow()", 100 );    }  }
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/053e01be6a28a71aa675f702b907d1e2f2058ace/navigator.js/buggy/xpfe/browser/src/navigator.js