mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
fix for bug #3812
home button now goes to where ever the "browser.startup.homepage" pref is set. (if it isn't set, we go to http://www.mozilla.org) throbber goes to http://www.mozilla.org. this value is set in navigator.xul. previously, the throbber was hard wired to do what home did. r=alecf a=cyeh
This commit is contained in:
parent
3d89ac411d
commit
ce5400e2b7
@ -76,7 +76,7 @@ CPP_OBJS= \
|
||||
|
||||
LINCS=-I$(XPDIST)\public\xpcom -I$(XPDIST)\public\raptor \
|
||||
-I$(XPDIST)\public\dom -I$(XPDIST)\public\js -I$(PUBLIC)\netlib -I$(PUBLIC)\plugin -I$(PUBLIC)\oji \
|
||||
-I$(PUBLIC)\java -I$(PUBLIC)\xpconnect -I$(PUBLIC)\libxpt -I$(PUBLIC)\xptinfo
|
||||
-I$(PUBLIC)\java -I$(PUBLIC)\xpconnect -I$(PUBLIC)\libxpt -I$(PUBLIC)\xptinfo -I$(PUBLIC)\pref
|
||||
|
||||
LCFLAGS = \
|
||||
$(LCFLAGS) \
|
||||
|
@ -48,6 +48,7 @@
|
||||
#include "nsIScriptContextOwner.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsIPref.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsRect.h"
|
||||
#include "nsINetSupport.h"
|
||||
@ -87,6 +88,9 @@ static NS_DEFINE_IID(kINetServiceIID, NS_INETSERVICE_IID);
|
||||
static NS_DEFINE_IID(kNetServiceCID, NS_NETSERVICE_CID);
|
||||
static NS_DEFINE_IID(kINetSupportIID, NS_INETSUPPORT_IID);
|
||||
|
||||
static NS_DEFINE_IID(kIPrefIID, NS_IPREF_IID);
|
||||
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
|
||||
|
||||
GlobalWindowImpl::GlobalWindowImpl()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
@ -829,9 +833,25 @@ GlobalWindowImpl::Back()
|
||||
NS_IMETHODIMP
|
||||
GlobalWindowImpl::Home()
|
||||
{
|
||||
// XXX: This should look in the preferences to find the home URL.
|
||||
// Temporary hardcoded to www.netscape.com
|
||||
nsString homeURL("http://www.netscape.com");
|
||||
char *url = nsnull;
|
||||
nsresult rv = NS_OK;
|
||||
nsString homeURL;
|
||||
|
||||
NS_WITH_SERVICE(nsIPref, prefs, kPrefServiceCID, &rv);
|
||||
if (NS_FAILED(rv) || (prefs == nsnull)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
// if we get here, we know prefs is not null
|
||||
rv = prefs->CopyCharPref(PREF_BROWSER_STARTUP_HOMEPAGE, &url);
|
||||
if (NS_FAILED(rv) || url == nsnull) {
|
||||
// if all else fails, use this
|
||||
homeURL = DEFAULT_HOME_PAGE;
|
||||
}
|
||||
else {
|
||||
homeURL = url;
|
||||
}
|
||||
PR_FREEIF(url);
|
||||
PRUnichar* urlToLoad = homeURL.ToNewUnicode();
|
||||
mWebShell->LoadURL(urlToLoad);
|
||||
delete[] urlToLoad;
|
||||
|
@ -35,6 +35,9 @@
|
||||
#include "nsDOMWindowList.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
|
||||
#define DEFAULT_HOME_PAGE "www.mozilla.org"
|
||||
#define PREF_BROWSER_STARTUP_HOMEPAGE "browser.startup.homepage"
|
||||
|
||||
class nsIEventListenerManager;
|
||||
class nsIDOMDocument;
|
||||
class nsIPresContext;
|
||||
|
Loading…
Reference in New Issue
Block a user