зеркало из https://github.com/mozilla/pjs.git
Remove mURL from nsWebShell, and GetURL from nsIWebShell.
r=travis
This commit is contained in:
Родитель
8ba054b717
Коммит
772f1f0cad
|
@ -3761,7 +3761,10 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode)
|
|||
// XXX necko isn't going to process headers coming in from the parser
|
||||
//NS_WARNING("need to fix how necko adds mime headers (in HTMLContentSink::ProcessMETATag)");
|
||||
|
||||
// see if we have a refresh "header".
|
||||
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(mWebShell, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// see if we have a refresh "header".
|
||||
if (!header.Compare("refresh", PR_TRUE)) {
|
||||
// Refresh headers are parsed with the following format in mind
|
||||
// <META HTTP-EQUIV=REFRESH CONTENT="5; URL=http://uri">
|
||||
|
@ -3796,12 +3799,8 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode)
|
|||
// quotes.
|
||||
|
||||
// first get our baseURI
|
||||
const PRUnichar *loadedURI = nsnull;
|
||||
rv = mWebShell->GetURL(&loadedURI);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIURI> baseURI;
|
||||
rv = NS_NewURI(getter_AddRefs(baseURI), loadedURI, nsnull);
|
||||
rv = docShell->GetCurrentURI(getter_AddRefs(baseURI));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
PRInt32 millis = -1;
|
||||
|
@ -3890,13 +3889,8 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode)
|
|||
nsCOMPtr<nsICookieService> cookieServ = do_GetService(NS_COOKIESERVICE_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// first get our baseURI
|
||||
const PRUnichar *uriCStr = nsnull;
|
||||
rv = mWebShell->GetURL(&uriCStr);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIURI> baseURI;
|
||||
rv = NS_NewURI(getter_AddRefs(baseURI), uriCStr, nsnull);
|
||||
rv = docShell->GetCurrentURI(getter_AddRefs(baseURI));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = cookieServ->SetCookieString(baseURI, result);
|
||||
|
|
|
@ -337,7 +337,6 @@ public:
|
|||
|
||||
// nsIDocShell
|
||||
NS_IMETHOD SetDocument(nsIDOMDocument *aDOMDoc, nsIDOMElement *aRootNode);
|
||||
void SetCurrentURI(nsIURI* aURI);
|
||||
|
||||
// nsWebShell
|
||||
nsIEventQueue* GetEventQueue(void);
|
||||
|
@ -360,7 +359,6 @@ public:
|
|||
NS_IMETHOD GetSessionHistory(nsISessionHistory *& aResult);
|
||||
NS_IMETHOD SetIsInSHist(PRBool aIsFrame);
|
||||
NS_IMETHOD GetIsInSHist(PRBool& aIsFrame);
|
||||
NS_IMETHOD GetURL(const PRUnichar** aURL);
|
||||
NS_IMETHOD SetURL(const PRUnichar* aURL);
|
||||
|
||||
protected:
|
||||
|
@ -389,8 +387,6 @@ protected:
|
|||
nsISessionHistory * mSHist;
|
||||
|
||||
nsRect mBounds;
|
||||
nsString mURL;
|
||||
|
||||
nsString mOverURL;
|
||||
nsString mOverTarget;
|
||||
|
||||
|
@ -919,15 +915,6 @@ nsWebShell::SetReferrer(const PRUnichar* aReferrer)
|
|||
NS_NewURI(getter_AddRefs(mReferrerURI), aReferrer, nsnull);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebShell::GetURL(const PRUnichar** aURL)
|
||||
{
|
||||
// XXX This is wrong unless the parameter is marked "shared".
|
||||
// It should otherwise be copied and freed by the caller.
|
||||
*aURL = mURL.GetUnicode();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebShell::SetURL(const PRUnichar* aURL)
|
||||
{
|
||||
|
@ -938,17 +925,6 @@ nsWebShell::SetURL(const PRUnichar* aURL)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsWebShell::SetCurrentURI(nsIURI* aURI)
|
||||
{
|
||||
nsXPIDLCString spec;
|
||||
if (NS_SUCCEEDED(aURI->GetSpec(getter_Copies(spec)))) {
|
||||
mURL = spec;
|
||||
nsDocShell::SetCurrentURI(aURI);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebShell::GetIsInSHist(PRBool& aResult)
|
||||
{
|
||||
|
@ -1119,7 +1095,6 @@ nsWebShell::DoLoadURL(nsIURI * aUri,
|
|||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
SetCurrentURI(aUri);
|
||||
mURL = urlSpec;
|
||||
SetReferrer(aReferrer);
|
||||
}
|
||||
// Pass on status of scrolling/anchor visit to docloaderobserver
|
||||
|
@ -1146,7 +1121,6 @@ nsWebShell::DoLoadURL(nsIURI * aUri,
|
|||
if(NS_SUCCEEDED(rv))
|
||||
{
|
||||
SetCurrentURI(aUri);
|
||||
mURL = urlSpec;
|
||||
SetReferrer(aReferrer);
|
||||
}
|
||||
mProcessedEndDocumentLoad = PR_FALSE;
|
||||
|
@ -1279,7 +1253,6 @@ nsWebShell::DoLoadURL(nsIURI * aUri,
|
|||
// the document load succeeds.
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
SetCurrentURI(aUri);
|
||||
mURL = urlSpec;
|
||||
SetReferrer(aReferrer);
|
||||
}
|
||||
|
||||
|
@ -1732,15 +1705,14 @@ nsWebShell::LoadURL(const PRUnichar *aURLSpec,
|
|||
|
||||
nsCOMPtr<nsIWebShell> parent;
|
||||
nsresult res = GetParent(*getter_AddRefs(parent));
|
||||
nsAutoString urlstr;
|
||||
nsCOMPtr<nsIURI> newURI;
|
||||
|
||||
if ((isLoadingHistory)) {
|
||||
/* if LoadURL() got called from SH, AND If we are going "Back/Forward"
|
||||
* to a frame page,SH will change the mURL to the right value
|
||||
* for smoother redraw. So, create a new nsIURI based on mURL,
|
||||
* so that it will work right in such situations.
|
||||
* to a frame page,SH will change the current uri to the right value
|
||||
* for smoother redraw.
|
||||
*/
|
||||
urlstr = mURL;
|
||||
res = GetCurrentURI(getter_AddRefs(newURI));
|
||||
}
|
||||
else{
|
||||
/* If the call is not from SH, use the url passed by the caller
|
||||
|
@ -1748,11 +1720,10 @@ nsWebShell::LoadURL(const PRUnichar *aURLSpec,
|
|||
* May regress in other situations.
|
||||
* What a hack
|
||||
*/
|
||||
urlstr=spec;
|
||||
nsAutoString urlstr = spec;
|
||||
res = NS_NewURI(getter_AddRefs(newURI), urlstr, nsnull);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> newURI;
|
||||
res = NS_NewURI(getter_AddRefs(newURI), urlstr, nsnull);
|
||||
|
||||
if (NS_SUCCEEDED(res)) {
|
||||
// now that we have a uri, call the REAL LoadURI method which requires a nsIURI.
|
||||
|
@ -2185,9 +2156,12 @@ nsWebShell::HandleLinkClickEvent(nsIContent *aContent,
|
|||
// for now, just hack the verb to be view-link-clicked
|
||||
// and down in the load document code we'll detect this and
|
||||
// set the correct uri loader command
|
||||
nsXPIDLCString spec;
|
||||
mCurrentURI->GetSpec(getter_Copies(spec));
|
||||
nsAutoString specString(spec);
|
||||
LoadURL(aURLSpec, "view-link-click", aPostDataStream,
|
||||
PR_TRUE, nsIChannel::LOAD_NORMAL,
|
||||
0, nsnull, mURL.GetUnicode(), nsCAutoString(aTargetSpec));
|
||||
0, nsnull, specString.GetUnicode(), nsCAutoString(aTargetSpec));
|
||||
}
|
||||
break;
|
||||
case eLinkVerb_Embed:
|
||||
|
@ -2592,9 +2566,8 @@ nsWebShell::OnStartURLLoad(nsIDocumentLoader* loader,
|
|||
|
||||
// Stop loading of the earlier document completely when the document url
|
||||
// load starts. Now we know that this url is valid and available.
|
||||
nsXPIDLCString url;
|
||||
aURL->GetSpec(getter_Copies(url));
|
||||
if (0 == PL_strcmp(url, mURL.GetBuffer()))
|
||||
PRBool equals = PR_FALSE;
|
||||
if (NS_SUCCEEDED(aURL->Equals(mCurrentURI, &equals)) && equals)
|
||||
Stop();
|
||||
|
||||
/*
|
||||
|
@ -3115,6 +3088,7 @@ NS_IMETHODIMP nsWebShell::SetPositionAndSize(PRInt32 x, PRInt32 y, PRInt32 cx,
|
|||
mBounds.SetRect(x, y, cx, cy);
|
||||
return nsDocShell::SetPositionAndSize(x, y, cx, cy, fRepaint);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebShell::GetPositionAndSize(PRInt32* x, PRInt32* y,
|
||||
PRInt32* cx, PRInt32* cy)
|
||||
{
|
||||
|
|
|
@ -330,14 +330,17 @@ LocationImpl::SetHostname(const nsString& aHostname)
|
|||
NS_IMETHODIMP
|
||||
LocationImpl::GetHref(nsString& aHref)
|
||||
{
|
||||
// PRInt32 index;
|
||||
nsresult result = NS_OK;
|
||||
|
||||
if (mDocShell) {
|
||||
const PRUnichar *href;
|
||||
nsCOMPtr<nsIWebShell> webShell(do_QueryInterface(mDocShell));
|
||||
result = webShell->GetURL (&href);
|
||||
aHref = href;
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
result = mDocShell->GetCurrentURI(getter_AddRefs(uri));
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsXPIDLCString uriString;
|
||||
result = uri->GetSpec(getter_Copies(uriString));
|
||||
if (NS_SUCCEEDED(result))
|
||||
aHref = uriString;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include "nsIPrincipal.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsProxyObjectManager.h"
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsDOMError.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsIEvaluateStringProxy.h"
|
||||
|
@ -229,15 +229,11 @@ nsJSProtocolHandler::NewChannel(const char* verb,
|
|||
if (originalURI) {
|
||||
referringUri = originalURI;
|
||||
} else {
|
||||
nsCOMPtr<nsIWebShell> webShell;
|
||||
webShell = do_QueryInterface(globalOwner);
|
||||
if (!webShell)
|
||||
nsCOMPtr<nsIDocShell> docShell;
|
||||
docShell = do_QueryInterface(globalOwner);
|
||||
if (!docShell)
|
||||
return NS_ERROR_FAILURE;
|
||||
const PRUnichar* url;
|
||||
if (NS_FAILED(webShell->GetURL(&url)))
|
||||
return NS_ERROR_FAILURE;
|
||||
nsString urlStr(url);
|
||||
if (NS_FAILED(NS_NewURI(getter_AddRefs(referringUri), urlStr, nsnull)))
|
||||
if (NS_FAILED(docShell->GetCurrentURI(getter_AddRefs(referringUri))))
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
if (NS_FAILED(securityManager->GetCodebasePrincipal(referringUri,
|
||||
|
|
|
@ -3761,7 +3761,10 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode)
|
|||
// XXX necko isn't going to process headers coming in from the parser
|
||||
//NS_WARNING("need to fix how necko adds mime headers (in HTMLContentSink::ProcessMETATag)");
|
||||
|
||||
// see if we have a refresh "header".
|
||||
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(mWebShell, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// see if we have a refresh "header".
|
||||
if (!header.Compare("refresh", PR_TRUE)) {
|
||||
// Refresh headers are parsed with the following format in mind
|
||||
// <META HTTP-EQUIV=REFRESH CONTENT="5; URL=http://uri">
|
||||
|
@ -3796,12 +3799,8 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode)
|
|||
// quotes.
|
||||
|
||||
// first get our baseURI
|
||||
const PRUnichar *loadedURI = nsnull;
|
||||
rv = mWebShell->GetURL(&loadedURI);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIURI> baseURI;
|
||||
rv = NS_NewURI(getter_AddRefs(baseURI), loadedURI, nsnull);
|
||||
rv = docShell->GetCurrentURI(getter_AddRefs(baseURI));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
PRInt32 millis = -1;
|
||||
|
@ -3890,13 +3889,8 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode)
|
|||
nsCOMPtr<nsICookieService> cookieServ = do_GetService(NS_COOKIESERVICE_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// first get our baseURI
|
||||
const PRUnichar *uriCStr = nsnull;
|
||||
rv = mWebShell->GetURL(&uriCStr);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIURI> baseURI;
|
||||
rv = NS_NewURI(getter_AddRefs(baseURI), uriCStr, nsnull);
|
||||
rv = docShell->GetCurrentURI(getter_AddRefs(baseURI));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = cookieServ->SetCookieString(baseURI, result);
|
||||
|
|
|
@ -211,11 +211,6 @@ public:
|
|||
*/
|
||||
NS_IMETHOD FindNext(const PRUnichar * aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound) = 0;
|
||||
|
||||
/**
|
||||
* Return the URL of the current WebShell.
|
||||
*/
|
||||
NS_IMETHOD GetURL(const PRUnichar** aURL) = 0;
|
||||
|
||||
/**
|
||||
* Set the URL of the current WebShell.
|
||||
*/
|
||||
|
|
|
@ -337,7 +337,6 @@ public:
|
|||
|
||||
// nsIDocShell
|
||||
NS_IMETHOD SetDocument(nsIDOMDocument *aDOMDoc, nsIDOMElement *aRootNode);
|
||||
void SetCurrentURI(nsIURI* aURI);
|
||||
|
||||
// nsWebShell
|
||||
nsIEventQueue* GetEventQueue(void);
|
||||
|
@ -360,7 +359,6 @@ public:
|
|||
NS_IMETHOD GetSessionHistory(nsISessionHistory *& aResult);
|
||||
NS_IMETHOD SetIsInSHist(PRBool aIsFrame);
|
||||
NS_IMETHOD GetIsInSHist(PRBool& aIsFrame);
|
||||
NS_IMETHOD GetURL(const PRUnichar** aURL);
|
||||
NS_IMETHOD SetURL(const PRUnichar* aURL);
|
||||
|
||||
protected:
|
||||
|
@ -389,8 +387,6 @@ protected:
|
|||
nsISessionHistory * mSHist;
|
||||
|
||||
nsRect mBounds;
|
||||
nsString mURL;
|
||||
|
||||
nsString mOverURL;
|
||||
nsString mOverTarget;
|
||||
|
||||
|
@ -919,15 +915,6 @@ nsWebShell::SetReferrer(const PRUnichar* aReferrer)
|
|||
NS_NewURI(getter_AddRefs(mReferrerURI), aReferrer, nsnull);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebShell::GetURL(const PRUnichar** aURL)
|
||||
{
|
||||
// XXX This is wrong unless the parameter is marked "shared".
|
||||
// It should otherwise be copied and freed by the caller.
|
||||
*aURL = mURL.GetUnicode();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebShell::SetURL(const PRUnichar* aURL)
|
||||
{
|
||||
|
@ -938,17 +925,6 @@ nsWebShell::SetURL(const PRUnichar* aURL)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsWebShell::SetCurrentURI(nsIURI* aURI)
|
||||
{
|
||||
nsXPIDLCString spec;
|
||||
if (NS_SUCCEEDED(aURI->GetSpec(getter_Copies(spec)))) {
|
||||
mURL = spec;
|
||||
nsDocShell::SetCurrentURI(aURI);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebShell::GetIsInSHist(PRBool& aResult)
|
||||
{
|
||||
|
@ -1119,7 +1095,6 @@ nsWebShell::DoLoadURL(nsIURI * aUri,
|
|||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
SetCurrentURI(aUri);
|
||||
mURL = urlSpec;
|
||||
SetReferrer(aReferrer);
|
||||
}
|
||||
// Pass on status of scrolling/anchor visit to docloaderobserver
|
||||
|
@ -1146,7 +1121,6 @@ nsWebShell::DoLoadURL(nsIURI * aUri,
|
|||
if(NS_SUCCEEDED(rv))
|
||||
{
|
||||
SetCurrentURI(aUri);
|
||||
mURL = urlSpec;
|
||||
SetReferrer(aReferrer);
|
||||
}
|
||||
mProcessedEndDocumentLoad = PR_FALSE;
|
||||
|
@ -1279,7 +1253,6 @@ nsWebShell::DoLoadURL(nsIURI * aUri,
|
|||
// the document load succeeds.
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
SetCurrentURI(aUri);
|
||||
mURL = urlSpec;
|
||||
SetReferrer(aReferrer);
|
||||
}
|
||||
|
||||
|
@ -1732,15 +1705,14 @@ nsWebShell::LoadURL(const PRUnichar *aURLSpec,
|
|||
|
||||
nsCOMPtr<nsIWebShell> parent;
|
||||
nsresult res = GetParent(*getter_AddRefs(parent));
|
||||
nsAutoString urlstr;
|
||||
nsCOMPtr<nsIURI> newURI;
|
||||
|
||||
if ((isLoadingHistory)) {
|
||||
/* if LoadURL() got called from SH, AND If we are going "Back/Forward"
|
||||
* to a frame page,SH will change the mURL to the right value
|
||||
* for smoother redraw. So, create a new nsIURI based on mURL,
|
||||
* so that it will work right in such situations.
|
||||
* to a frame page,SH will change the current uri to the right value
|
||||
* for smoother redraw.
|
||||
*/
|
||||
urlstr = mURL;
|
||||
res = GetCurrentURI(getter_AddRefs(newURI));
|
||||
}
|
||||
else{
|
||||
/* If the call is not from SH, use the url passed by the caller
|
||||
|
@ -1748,11 +1720,10 @@ nsWebShell::LoadURL(const PRUnichar *aURLSpec,
|
|||
* May regress in other situations.
|
||||
* What a hack
|
||||
*/
|
||||
urlstr=spec;
|
||||
nsAutoString urlstr = spec;
|
||||
res = NS_NewURI(getter_AddRefs(newURI), urlstr, nsnull);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> newURI;
|
||||
res = NS_NewURI(getter_AddRefs(newURI), urlstr, nsnull);
|
||||
|
||||
if (NS_SUCCEEDED(res)) {
|
||||
// now that we have a uri, call the REAL LoadURI method which requires a nsIURI.
|
||||
|
@ -2185,9 +2156,12 @@ nsWebShell::HandleLinkClickEvent(nsIContent *aContent,
|
|||
// for now, just hack the verb to be view-link-clicked
|
||||
// and down in the load document code we'll detect this and
|
||||
// set the correct uri loader command
|
||||
nsXPIDLCString spec;
|
||||
mCurrentURI->GetSpec(getter_Copies(spec));
|
||||
nsAutoString specString(spec);
|
||||
LoadURL(aURLSpec, "view-link-click", aPostDataStream,
|
||||
PR_TRUE, nsIChannel::LOAD_NORMAL,
|
||||
0, nsnull, mURL.GetUnicode(), nsCAutoString(aTargetSpec));
|
||||
0, nsnull, specString.GetUnicode(), nsCAutoString(aTargetSpec));
|
||||
}
|
||||
break;
|
||||
case eLinkVerb_Embed:
|
||||
|
@ -2592,9 +2566,8 @@ nsWebShell::OnStartURLLoad(nsIDocumentLoader* loader,
|
|||
|
||||
// Stop loading of the earlier document completely when the document url
|
||||
// load starts. Now we know that this url is valid and available.
|
||||
nsXPIDLCString url;
|
||||
aURL->GetSpec(getter_Copies(url));
|
||||
if (0 == PL_strcmp(url, mURL.GetBuffer()))
|
||||
PRBool equals = PR_FALSE;
|
||||
if (NS_SUCCEEDED(aURL->Equals(mCurrentURI, &equals)) && equals)
|
||||
Stop();
|
||||
|
||||
/*
|
||||
|
@ -3115,6 +3088,7 @@ NS_IMETHODIMP nsWebShell::SetPositionAndSize(PRInt32 x, PRInt32 y, PRInt32 cx,
|
|||
mBounds.SetRect(x, y, cx, cy);
|
||||
return nsDocShell::SetPositionAndSize(x, y, cx, cy, fRepaint);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebShell::GetPositionAndSize(PRInt32* x, PRInt32* y,
|
||||
PRInt32* cx, PRInt32* cy)
|
||||
{
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "nsAppShellCIDs.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIDocShellTreeNode.h"
|
||||
#include "nsIWebNavigation.h"
|
||||
|
@ -34,6 +35,8 @@
|
|||
#include "nsCRT.h"
|
||||
#include "nscore.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
// Interface ID for nsIHistoryEntry
|
||||
#define NS_IHISTORY_ENTRY_IID \
|
||||
|
@ -451,11 +454,12 @@ GenerateTree(const char * aStickyUrl, nsIWebShell * aStickyContainer, nsIWebShel
|
|||
}
|
||||
else {
|
||||
// Get the webshell's url.
|
||||
aContainer->GetURL(&url);
|
||||
urlAStr = (url);
|
||||
aCStr = urlAStr.ToNewCString();
|
||||
hEntry->Create(aCStr, aContainer, aReferrer, aParent, aSHist);
|
||||
Recycle((char *) aCStr);
|
||||
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(aContainer);
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
docShell->GetCurrentURI(getter_AddRefs(uri));
|
||||
nsXPIDLCString spec;
|
||||
uri->GetSpec(getter_Copies(spec));
|
||||
hEntry->Create(spec, aContainer, aReferrer, aParent, aSHist);
|
||||
}
|
||||
|
||||
// If the webshell has children, go thro' the child list and create
|
||||
|
@ -534,9 +538,17 @@ nsHistoryEntry::Load(nsIWebShell * aPrevEntry, PRBool aIsReload) {
|
|||
if (!cur || !prev) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (prev) {
|
||||
prev->GetURL(&pURL);
|
||||
pSURL = pURL;
|
||||
|
||||
nsCOMPtr<nsIDocShell> prevShell;
|
||||
if (prev)
|
||||
prevShell = do_QueryInterface(prev);
|
||||
if (prevShell) {
|
||||
nsCOMPtr<nsIURI> pURI;
|
||||
if (NS_SUCCEEDED(prevShell->GetCurrentURI(getter_AddRefs(pURI)))) {
|
||||
nsXPIDLCString spec;
|
||||
if (NS_SUCCEEDED(pURI->GetSpec(getter_Copies(spec))))
|
||||
pSURL = spec;
|
||||
}
|
||||
}
|
||||
|
||||
if (cur) {
|
||||
|
@ -556,10 +568,12 @@ nsHistoryEntry::Load(nsIWebShell * aPrevEntry, PRBool aIsReload) {
|
|||
} // compareURLs
|
||||
|
||||
if (urlChanged || aIsReload) {
|
||||
if (prev) {
|
||||
if (prevShell) {
|
||||
PRBool isInSHist=PR_FALSE, isLoadingDoc=PR_FALSE;
|
||||
prev->GetIsInSHist(isInSHist);
|
||||
mHistoryList->GetLoadingFlag(&isLoadingDoc);
|
||||
nsCOMPtr<nsIURI> newURI;
|
||||
NS_ENSURE_SUCCESS(NS_NewURI(getter_AddRefs(newURI), cSURL), NS_ERROR_FAILURE);
|
||||
|
||||
if ((isInSHist && isLoadingDoc) || aIsReload) {
|
||||
if (APP_DEBUG) printf("SessionHistory::Load Loading URL %s in webshell %x\n", cSURL.ToNewCString(), (unsigned int) prev);
|
||||
|
@ -578,7 +592,7 @@ nsHistoryEntry::Load(nsIWebShell * aPrevEntry, PRBool aIsReload) {
|
|||
|
||||
|
||||
PRUnichar * uniURL = cSURL.ToNewUnicode();
|
||||
prev->SetURL(uniURL);
|
||||
prev->SetURL(uniURL);
|
||||
nsAutoString referrer(mReferrer);
|
||||
prev->LoadURL(uniURL, nsnull, PR_FALSE, loadType, 0, historyObject,
|
||||
mReferrer ? referrer.GetUnicode() : nsnull);
|
||||
|
@ -598,8 +612,8 @@ nsHistoryEntry::Load(nsIWebShell * aPrevEntry, PRBool aIsReload) {
|
|||
return PR_TRUE;
|
||||
}
|
||||
else if (!isInSHist && isLoadingDoc) {
|
||||
PRUnichar * uniURL = cSURL.ToNewUnicode();
|
||||
prev->SetURL(uniURL);
|
||||
PRUnichar * uniURL = cSURL.ToNewUnicode();
|
||||
prev->SetURL(uniURL);
|
||||
Recycle(uniURL);
|
||||
|
||||
|
||||
|
@ -676,8 +690,13 @@ nsHistoryEntry::Compare(nsIWebShell * aPrevEntry, PRBool aIsReload) {
|
|||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (prev) {
|
||||
prev->GetURL(&pURL);
|
||||
pSURL = (pURL);
|
||||
nsCOMPtr<nsIDocShell> prevShell = do_QueryInterface(prev);
|
||||
nsCOMPtr<nsIURI> pURI;
|
||||
if (NS_SUCCEEDED(prevShell->GetCurrentURI(getter_AddRefs(pURI)))) {
|
||||
nsXPIDLCString spec;
|
||||
if (NS_SUCCEEDED(pURI->GetSpec(getter_Copies(spec))))
|
||||
pSURL = spec;
|
||||
}
|
||||
}
|
||||
if (cur) {
|
||||
cur->GetURL(&cURL);
|
||||
|
|
|
@ -1170,18 +1170,20 @@ nsBrowserAppCore::LoadInitialPage(void)
|
|||
{
|
||||
// Examine content URL.
|
||||
if ( mContentAreaWebShell ) {
|
||||
const PRUnichar *url = 0;
|
||||
rv = mContentAreaWebShell->GetURL(&url );
|
||||
/* Check whether url is valid. Otherwise we compare 0x00 with
|
||||
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(mContentAreaWebShell);
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
rv = docShell->GetCurrentURI(getter_AddRefs(uri));
|
||||
nsXPIDLCString spec;
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = uri->GetSpec(getter_Copies(spec));
|
||||
/* Check whether url is valid. Otherwise we compare with
|
||||
* "about:blank" and there by return from here with out
|
||||
* loading the command line url or default home page.
|
||||
*/
|
||||
if ( NS_SUCCEEDED( rv ) && url ) {
|
||||
if ( nsString(url) != "about:blank" ) {
|
||||
if (NS_SUCCEEDED(rv) && nsCRT::strcasecmp(spec, "about:blank") == 0) {
|
||||
// Something has already been loaded (probably via window.open),
|
||||
// leave it be.
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче