зеркало из https://github.com/mozilla/gecko-dev.git
Added modifyHistory option to LoadURL.
This commit is contained in:
Родитель
c9ac421d98
Коммит
90f219c74e
|
@ -143,8 +143,10 @@ public:
|
||||||
nsIWebShell*& aResult);
|
nsIWebShell*& aResult);
|
||||||
NS_IMETHOD Back(void);
|
NS_IMETHOD Back(void);
|
||||||
NS_IMETHOD Forward(void);
|
NS_IMETHOD Forward(void);
|
||||||
|
NS_IMETHOD Reload();
|
||||||
NS_IMETHOD LoadURL(const nsString& aURLSpec,
|
NS_IMETHOD LoadURL(const nsString& aURLSpec,
|
||||||
nsIPostData* aPostData=nsnull);
|
nsIPostData* aPostData=nsnull,
|
||||||
|
PRBool aModifyHistory=PR_TRUE);
|
||||||
NS_IMETHOD GoTo(PRInt32 aHistoryIndex);
|
NS_IMETHOD GoTo(PRInt32 aHistoryIndex);
|
||||||
NS_IMETHOD GetHistoryIndex(PRInt32& aResult);
|
NS_IMETHOD GetHistoryIndex(PRInt32& aResult);
|
||||||
NS_IMETHOD GetURL(PRInt32 aHistoryIndex, nsString& aURLResult);
|
NS_IMETHOD GetURL(PRInt32 aHistoryIndex, nsString& aURLResult);
|
||||||
|
@ -867,7 +869,8 @@ nsWebShell::Forward(void)
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsWebShell::LoadURL(const nsString& aURLSpec,
|
nsWebShell::LoadURL(const nsString& aURLSpec,
|
||||||
nsIPostData* aPostData)
|
nsIPostData* aPostData,
|
||||||
|
PRBool aModifyHistory)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
PRInt32 colon, fSlash;
|
PRInt32 colon, fSlash;
|
||||||
|
@ -894,19 +897,29 @@ nsWebShell::LoadURL(const nsString& aURLSpec,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Discard part of history that is no longer reachable
|
|
||||||
PRInt32 i, n = mHistory.Count();
|
|
||||||
i = mHistoryIndex + 1;
|
|
||||||
while (--n >= i) {
|
|
||||||
nsString* u = (nsString*) mHistory.ElementAt(n);
|
|
||||||
delete u;
|
|
||||||
mHistory.RemoveElementAt(n);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tack on new url
|
|
||||||
nsString* url = new nsString(urlSpec);
|
nsString* url = new nsString(urlSpec);
|
||||||
mHistory.AppendElement(url);
|
if (aModifyHistory) {
|
||||||
mHistoryIndex++;
|
// Discard part of history that is no longer reachable
|
||||||
|
PRInt32 i, n = mHistory.Count();
|
||||||
|
i = mHistoryIndex + 1;
|
||||||
|
while (--n >= i) {
|
||||||
|
nsString* u = (nsString*) mHistory.ElementAt(n);
|
||||||
|
delete u;
|
||||||
|
mHistory.RemoveElementAt(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tack on new url
|
||||||
|
mHistory.AppendElement(url);
|
||||||
|
mHistoryIndex++;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Replace the current history index with this URL
|
||||||
|
nsString* u = (nsString*) mHistory.ElementAt(mHistoryIndex);
|
||||||
|
if (nsnull != u) {
|
||||||
|
delete u;
|
||||||
|
}
|
||||||
|
mHistory.ReplaceElementAt(url, mHistoryIndex);
|
||||||
|
}
|
||||||
ShowHistory();
|
ShowHistory();
|
||||||
|
|
||||||
// Tell web-shell-container we are loading a new url
|
// Tell web-shell-container we are loading a new url
|
||||||
|
@ -929,6 +942,12 @@ nsWebShell::LoadURL(const nsString& aURLSpec,
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsWebShell::Reload()
|
||||||
|
{
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsWebShell::GoTo(PRInt32 aHistoryIndex)
|
nsWebShell::GoTo(PRInt32 aHistoryIndex)
|
||||||
{
|
{
|
||||||
|
|
|
@ -134,8 +134,10 @@ public:
|
||||||
// History api's
|
// History api's
|
||||||
NS_IMETHOD Back() = 0;
|
NS_IMETHOD Back() = 0;
|
||||||
NS_IMETHOD Forward() = 0;
|
NS_IMETHOD Forward() = 0;
|
||||||
|
NS_IMETHOD Reload() = 0;
|
||||||
NS_IMETHOD LoadURL(const nsString& aURLSpec,
|
NS_IMETHOD LoadURL(const nsString& aURLSpec,
|
||||||
nsIPostData* aPostData=nsnull) = 0;
|
nsIPostData* aPostData=nsnull,
|
||||||
|
PRBool aModifyHistory=PR_TRUE) = 0;
|
||||||
NS_IMETHOD GoTo(PRInt32 aHistoryIndex) = 0;
|
NS_IMETHOD GoTo(PRInt32 aHistoryIndex) = 0;
|
||||||
NS_IMETHOD GetHistoryIndex(PRInt32& aResult) = 0;
|
NS_IMETHOD GetHistoryIndex(PRInt32& aResult) = 0;
|
||||||
NS_IMETHOD GetURL(PRInt32 aHistoryIndex, nsString& aURLResult) = 0;
|
NS_IMETHOD GetURL(PRInt32 aHistoryIndex, nsString& aURLResult) = 0;
|
||||||
|
|
|
@ -143,8 +143,10 @@ public:
|
||||||
nsIWebShell*& aResult);
|
nsIWebShell*& aResult);
|
||||||
NS_IMETHOD Back(void);
|
NS_IMETHOD Back(void);
|
||||||
NS_IMETHOD Forward(void);
|
NS_IMETHOD Forward(void);
|
||||||
|
NS_IMETHOD Reload();
|
||||||
NS_IMETHOD LoadURL(const nsString& aURLSpec,
|
NS_IMETHOD LoadURL(const nsString& aURLSpec,
|
||||||
nsIPostData* aPostData=nsnull);
|
nsIPostData* aPostData=nsnull,
|
||||||
|
PRBool aModifyHistory=PR_TRUE);
|
||||||
NS_IMETHOD GoTo(PRInt32 aHistoryIndex);
|
NS_IMETHOD GoTo(PRInt32 aHistoryIndex);
|
||||||
NS_IMETHOD GetHistoryIndex(PRInt32& aResult);
|
NS_IMETHOD GetHistoryIndex(PRInt32& aResult);
|
||||||
NS_IMETHOD GetURL(PRInt32 aHistoryIndex, nsString& aURLResult);
|
NS_IMETHOD GetURL(PRInt32 aHistoryIndex, nsString& aURLResult);
|
||||||
|
@ -867,7 +869,8 @@ nsWebShell::Forward(void)
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsWebShell::LoadURL(const nsString& aURLSpec,
|
nsWebShell::LoadURL(const nsString& aURLSpec,
|
||||||
nsIPostData* aPostData)
|
nsIPostData* aPostData,
|
||||||
|
PRBool aModifyHistory)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
PRInt32 colon, fSlash;
|
PRInt32 colon, fSlash;
|
||||||
|
@ -894,19 +897,29 @@ nsWebShell::LoadURL(const nsString& aURLSpec,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Discard part of history that is no longer reachable
|
|
||||||
PRInt32 i, n = mHistory.Count();
|
|
||||||
i = mHistoryIndex + 1;
|
|
||||||
while (--n >= i) {
|
|
||||||
nsString* u = (nsString*) mHistory.ElementAt(n);
|
|
||||||
delete u;
|
|
||||||
mHistory.RemoveElementAt(n);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tack on new url
|
|
||||||
nsString* url = new nsString(urlSpec);
|
nsString* url = new nsString(urlSpec);
|
||||||
mHistory.AppendElement(url);
|
if (aModifyHistory) {
|
||||||
mHistoryIndex++;
|
// Discard part of history that is no longer reachable
|
||||||
|
PRInt32 i, n = mHistory.Count();
|
||||||
|
i = mHistoryIndex + 1;
|
||||||
|
while (--n >= i) {
|
||||||
|
nsString* u = (nsString*) mHistory.ElementAt(n);
|
||||||
|
delete u;
|
||||||
|
mHistory.RemoveElementAt(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tack on new url
|
||||||
|
mHistory.AppendElement(url);
|
||||||
|
mHistoryIndex++;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Replace the current history index with this URL
|
||||||
|
nsString* u = (nsString*) mHistory.ElementAt(mHistoryIndex);
|
||||||
|
if (nsnull != u) {
|
||||||
|
delete u;
|
||||||
|
}
|
||||||
|
mHistory.ReplaceElementAt(url, mHistoryIndex);
|
||||||
|
}
|
||||||
ShowHistory();
|
ShowHistory();
|
||||||
|
|
||||||
// Tell web-shell-container we are loading a new url
|
// Tell web-shell-container we are loading a new url
|
||||||
|
@ -929,6 +942,12 @@ nsWebShell::LoadURL(const nsString& aURLSpec,
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsWebShell::Reload()
|
||||||
|
{
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsWebShell::GoTo(PRInt32 aHistoryIndex)
|
nsWebShell::GoTo(PRInt32 aHistoryIndex)
|
||||||
{
|
{
|
||||||
|
|
Загрузка…
Ссылка в новой задаче