This commit is contained in:
rpotts%netscape.com 2001-11-30 22:35:33 +00:00
Родитель f77f33c22e
Коммит a33a19e3d1
42 изменённых файлов: 280 добавлений и 168 удалений

Просмотреть файл

@ -410,6 +410,49 @@ ConvertDocShellLoadInfoToLoadType(nsDocShellInfoLoadType aDocShellLoadType)
}
nsDocShellInfoLoadType
nsDocShell::ConvertLoadTypeToDocShellLoadInfo(PRUint32 aLoadType)
{
nsDocShellInfoLoadType docShellLoadType = nsIDocShellLoadInfo::loadNormal;
switch (aLoadType) {
case LOAD_NORMAL:
docShellLoadType = nsIDocShellLoadInfo::loadNormal;
break;
case LOAD_NORMAL_REPLACE:
docShellLoadType = nsIDocShellLoadInfo::loadNormalReplace;
break;
case LOAD_HISTORY:
docShellLoadType = nsIDocShellLoadInfo::loadHistory;
break;
case LOAD_RELOAD_NORMAL:
docShellLoadType = nsIDocShellLoadInfo::loadReloadNormal;
break;
case LOAD_RELOAD_CHARSET_CHANGE:
docShellLoadType = nsIDocShellLoadInfo::loadReloadCharsetChange;
break;
case LOAD_RELOAD_BYPASS_CACHE:
docShellLoadType = nsIDocShellLoadInfo::loadReloadBypassCache;
break;
case LOAD_RELOAD_BYPASS_PROXY:
docShellLoadType = nsIDocShellLoadInfo::loadReloadBypassProxy;
break;
case LOAD_RELOAD_BYPASS_PROXY_AND_CACHE:
docShellLoadType = nsIDocShellLoadInfo::loadReloadBypassProxyAndCache;
break;
case LOAD_LINK:
docShellLoadType = nsIDocShellLoadInfo::loadLink;
break;
case LOAD_REFRESH:
docShellLoadType = nsIDocShellLoadInfo::loadRefresh;
break;
case LOAD_BYPASS_HISTORY:
docShellLoadType = nsIDocShellLoadInfo::loadBypassHistory;
break;
}
return docShellLoadType;
}
//*****************************************************************************
// nsDocShell::nsIDocShell
//*****************************************************************************
@ -424,7 +467,7 @@ nsDocShell::LoadURI(nsIURI * aURI,
nsCOMPtr<nsISupports> owner;
PRBool inheritOwner = PR_FALSE;
nsCOMPtr<nsISHEntry> shEntry;
nsXPIDLCString target;
nsXPIDLString target;
PRUint32 loadType = MAKE_LOAD_TYPE(LOAD_NORMAL, aLoadFlags);
NS_ENSURE_ARG(aURI);
@ -530,14 +573,11 @@ nsDocShell::LoadURI(nsIURI * aURI,
}
}
nsAutoString windowTarget;
windowTarget.AssignWithConversion(target);
rv = InternalLoad(aURI,
referrer,
owner,
inheritOwner,
windowTarget.get(),
target.get(),
postStream,
nsnull, // No headers stream
loadType,
@ -2140,7 +2180,11 @@ NS_IMETHODIMP nsDocShell::GotoIndex(PRInt32 aIndex)
NS_IMETHODIMP
nsDocShell::LoadURI(const PRUnichar * aURI, PRUint32 aLoadFlags)
nsDocShell::LoadURI(const PRUnichar * aURI,
PRUint32 aLoadFlags,
nsIURI * aReferingURI,
nsIInputStream * aPostStream,
nsIInputStream * aHeaderStream)
{
nsCOMPtr<nsIURI> uri;
@ -2192,15 +2236,24 @@ nsDocShell::LoadURI(const PRUnichar * aURI, PRUint32 aLoadFlags)
NS_LITERAL_STRING("malformedURI").get(),
getter_Copies(messageStr)),
NS_ERROR_FAILURE);
prompter->Alert(nsnull, messageStr.get());
}
if (NS_FAILED(rv) || !uri)
return NS_ERROR_FAILURE;
NS_ENSURE_SUCCESS(LoadURI(uri, nsnull, aLoadFlags), NS_ERROR_FAILURE);
return NS_OK;
nsCOMPtr<nsIDocShellLoadInfo> loadInfo;
rv = CreateLoadInfo(getter_AddRefs(loadInfo));
if (NS_FAILED(rv)) return rv;
loadInfo->SetLoadType(ConvertLoadTypeToDocShellLoadInfo(aLoadFlags));
loadInfo->SetPostDataStream(aPostStream);
// XXX: Need to pass in the extra headers stream too...
// XXX: Need to pass in referer...
rv = LoadURI(uri, loadInfo, 0);
return rv;
}
NS_IMETHODIMP
@ -2301,6 +2354,17 @@ nsDocShell::GetCurrentURI(nsIURI ** aURI)
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::GetReferingURI(nsIURI ** aURI)
{
NS_ENSURE_ARG_POINTER(aURI);
*aURI = mReferrerURI;
NS_IF_ADDREF(*aURI);
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::SetSessionHistory(nsISHistory * aSessionHistory)
{
@ -4142,7 +4206,7 @@ nsresult nsDocShell::DoURILoad(nsIURI * aURI,
nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(channel));
//
// If this is a HTTP channel, then set up the HTTP specific information
// (ie. POST data, referer, ...)
// (ie. POST data, referrer, ...)
//
if (httpChannel) {
nsCOMPtr<nsICachingChannel> cacheChannel(do_QueryInterface(httpChannel));

Просмотреть файл

@ -191,6 +191,7 @@ public:
nsresult SetLoadCookie(nsISupports * aCookie);
nsresult GetLoadCookie(nsISupports ** aResult);
nsDocShellInfoLoadType ConvertLoadTypeToDocShellLoadInfo(PRUint32 aLoadType);
PRUint32 ConvertDocShellLoadInfoToLoadType(nsDocShellInfoLoadType aDocShellLoadType);
protected:

Просмотреть файл

@ -34,7 +34,6 @@ nsDocShellLoadInfo::nsDocShellLoadInfo()
NS_INIT_REFCNT();
mLoadType = nsIDocShellLoadInfo::loadNormal;
mInheritOwner = PR_FALSE;
mTarget.Assign("");
}
nsDocShellLoadInfo::~nsDocShellLoadInfo()
@ -130,16 +129,16 @@ NS_IMETHODIMP nsDocShellLoadInfo::SetSHEntry(nsISHEntry* aSHEntry)
return NS_OK;
}
NS_IMETHODIMP nsDocShellLoadInfo::GetTarget(char** aTarget)
NS_IMETHODIMP nsDocShellLoadInfo::GetTarget(PRUnichar** aTarget)
{
NS_ENSURE_ARG_POINTER(aTarget);
*aTarget = ToNewCString(mTarget);
*aTarget = ToNewUnicode(mTarget);
return NS_OK;
}
NS_IMETHODIMP nsDocShellLoadInfo::SetTarget(const char* aTarget)
NS_IMETHODIMP nsDocShellLoadInfo::SetTarget(const PRUnichar* aTarget)
{
mTarget.Assign(aTarget);
return NS_OK;

Просмотреть файл

@ -51,7 +51,7 @@ protected:
PRBool mInheritOwner;
nsDocShellInfoLoadType mLoadType;
nsCOMPtr<nsISHEntry> mSHEntry;
nsCString mTarget;
nsString mTarget;
nsCOMPtr<nsIInputStream> mPostDataStream;
};

Просмотреть файл

@ -74,7 +74,7 @@ interface nsIDocShellLoadInfo : nsISupports
*/
attribute nsISHEntry SHEntry;
attribute string target; // like _content, _blank etc
attribute wstring target; // like _content, _blank etc
attribute nsIInputStream postDataStream;
};

Просмотреть файл

@ -135,9 +135,15 @@ interface nsIWebNavigation : nsISupports
* @param uri - The URI string to load.
* @param loadFlags - Flags modifying load behaviour. Generally you will pass
* LOAD_FLAGS_NONE for this parameter.
* @param referrer - The referring URI. If this argument is NULL, the
* referring URI will be inferred internally.
* @param postData - nsIInputStream containing POST data for the request.
*/
void loadURI(in wstring uri, in unsigned long loadFlags);
void loadURI(in wstring uri,
in unsigned long loadFlags,
in nsIURI referrer,
in nsIInputStream postData,
in nsIInputStream headers);
/**
* Tells the Object to reload the current page.
@ -185,6 +191,11 @@ interface nsIWebNavigation : nsISupports
*/
readonly attribute nsIURI currentURI;
/**
* The refering URI.
*/
readonly attribute nsIURI referingURI;
/**
* The session history object used to store the session history for the
* session.

Просмотреть файл

@ -569,7 +569,11 @@ nsWebShell::LoadDocument(const char* aURL,
if(eCharsetReloadRequested != mCharsetReloadState)
{
mCharsetReloadState = eCharsetReloadRequested;
LoadURI(NS_ConvertASCIItoUCS2(aURL).get(), LOAD_FLAGS_NONE);
LoadURI(NS_ConvertASCIItoUCS2(aURL).get(), // URI string
LOAD_FLAGS_NONE, // Load flags
nsnull, // Refering URI
nsnull, // Post data stream
nsnull); // Header stream
}
}
}
@ -991,7 +995,11 @@ nsresult nsWebShell::EndPageLoad(nsIWebProgress *aProgress,
nsAutoString keywordSpec; keywordSpec.AssignWithConversion("keyword:");
keywordSpec.Append(NS_ConvertUTF8toUCS2(host));
return LoadURI(keywordSpec.get(), LOAD_FLAGS_NONE);
return LoadURI(keywordSpec.get(), // URI string
LOAD_FLAGS_NONE, // Load flags
nsnull, // Refering URI
nsnull, // Post data stream
nsnull); // Headers stream
} // end keywordsEnabled
}
@ -1026,7 +1034,11 @@ nsresult nsWebShell::EndPageLoad(nsIWebProgress *aProgress,
if (NS_FAILED(rv)) return rv;
// reload the url
return LoadURI(NS_ConvertASCIItoUCS2(host).get(), LOAD_FLAGS_NONE);
return LoadURI(NS_ConvertASCIItoUCS2(host).get(), // URI string
LOAD_FLAGS_NONE, // Load flags
nsnull, // Refering URI
nsnull, // Post data stream
nsnull); // Header stream
} // retry
}

Просмотреть файл

@ -1941,9 +1941,16 @@ NS_IMETHODIMP GlobalWindowImpl::Home()
}
else
homeURL = url;
nsresult rv;
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mDocShell));
NS_ENSURE_TRUE(webNav, NS_ERROR_FAILURE);
NS_ENSURE_SUCCESS(webNav->LoadURI(homeURL.get(), nsIWebNavigation::LOAD_FLAGS_NONE), NS_ERROR_FAILURE);
rv = webNav->LoadURI(homeURL.get(),
nsIWebNavigation::LOAD_FLAGS_NONE,
nsnull,
nsnull,
nsnull);
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
return NS_OK;
}

Просмотреть файл

@ -1630,9 +1630,15 @@ nsEditorShell::LoadUrl(const PRUnichar *url)
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mContentAreaDocShell));
NS_ENSURE_SUCCESS(webNav->LoadURI(url, nsIWebNavigation::LOAD_FLAGS_NONE), NS_ERROR_FAILURE);
rv = webNav->LoadURI(url, // uri string
nsIWebNavigation::LOAD_FLAGS_NONE, // load flags
nsnull, // referrer
nsnull, // post-data stream
nsnull); // headers stream
return NS_OK;
NS_ASSERTION(NS_SUCCEEDED(rv), "LoadURI failed!");
return rv;
}

Просмотреть файл

@ -1868,7 +1868,11 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::Navigate(BSTR URL, VARIANT __RPC_FAR
nsCOMPtr<nsIWebNavigation> spIWebNavigation = do_QueryInterface(mWebBrowser);
if (spIWebNavigation)
{
res = spIWebNavigation->LoadURI(sUrl.get(), nsIWebNavigation::LOAD_FLAGS_NONE);
res = spIWebNavigation->LoadURI(sUrl.get(),
nsIWebNavigation::LOAD_FLAGS_NONE,
nsnull,
nsnull,
nsnull);
}
return res;

Просмотреть файл

@ -221,7 +221,7 @@ function SetMenuItemAttr( id, attr, val )
function loadURI(uri)
{
getWebNavigation().loadURI(uri, nsIWebNavigation.LOAD_FLAGS_NONE);
getWebNavigation().loadURI(uri, nsIWebNavigation.LOAD_FLAGS_NONE, null, null, null);
}
function BrowserLoadURL()

Просмотреть файл

@ -675,7 +675,7 @@ nsCocoaBrowserListener::SetContainer(id <NSBrowserContainer> aContainer)
nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY;
}
nsresult rv = nav->LoadURI(specStr, navFlags);
nsresult rv = nav->LoadURI(specStr, navFlags, nsnull, nsnull, nsnull);
if (NS_FAILED(rv)) {
// XXX need to throw
}

Просмотреть файл

@ -319,7 +319,11 @@ void
EmbedPrivate::LoadCurrentURI(void)
{
if (mURI.Length())
mNavigation->LoadURI(mURI.get(), nsIWebNavigation::LOAD_FLAGS_NONE);
mNavigation->LoadURI(mURI.get(), // URI string
nsIWebNavigation::LOAD_FLAGS_NONE, // Load flags
nsnull, // Refering URI
nsnull, // Post data
nsnull); // extra headers
}
/* static */

Просмотреть файл

@ -238,7 +238,11 @@ static void MozLoadURL(PtMozillaWidget_t *moz, char *url)
return;
if (moz->MyBrowser->WebNavigation)
moz->MyBrowser->WebNavigation->LoadURI(NS_ConvertASCIItoUCS2(url).get(), nsIWebNavigation::LOAD_FLAGS_NONE);
moz->MyBrowser->WebNavigation->LoadURI(NS_ConvertASCIItoUCS2(url).get(),
nsIWebNavigation::LOAD_FLAGS_NONE,
nsnull,
nsnull,
nsnull);
}
// defaults
@ -617,7 +621,7 @@ static void mozilla_modify( PtWidget_t *widget, PtArg_t const *argt ) {
case Pt_ARG_MOZ_DOWNLOAD: {
moz->MyBrowser->WebBrowserContainer->mSkipOnState = 1; /* ignore nsIWebProgressListener's CWebBrowserContainer::OnStateChange() for a while */
moz->MyBrowser->WebNavigation->LoadURI( NS_ConvertASCIItoUCS2( (char*) argt->value ).get(), nsIWebNavigation::LOAD_FLAGS_NONE);
moz->MyBrowser->WebNavigation->LoadURI( NS_ConvertASCIItoUCS2( (char*) argt->value ).get(), nsIWebNavigation::LOAD_FLAGS_NONE, nsnull, nsnull, nsnull);
if( moz->download_dest ) free( moz->download_dest );
moz->download_dest = strdup( (char*)argt->len );

Просмотреть файл

@ -633,9 +633,13 @@ NS_METHOD CBrowserShell::Reload()
NS_METHOD CBrowserShell::LoadURL(const nsACString& urlText)
{
nsAutoString unicodeURL;
CopyASCIItoUCS2(urlText, unicodeURL);
return mWebBrowserAsWebNav->LoadURI(unicodeURL.get(), nsIWebNavigation::LOAD_FLAGS_NONE);
nsAutoString unicodeURL;
CopyASCIItoUCS2(urlText, unicodeURL);
return mWebBrowserAsWebNav->LoadURI(unicodeURL.get(),
nsIWebNavigation::LOAD_FLAGS_NONE,
nsnull,
nsnull,
nsnull);
}
NS_METHOD CBrowserShell::GetCurrentURL(nsACString& urlText)

Просмотреть файл

@ -588,11 +588,19 @@ NS_IMETHODIMP nsWebBrowser::GoForward()
return mDocShellAsNav->GoForward();
}
NS_IMETHODIMP nsWebBrowser::LoadURI(const PRUnichar* aURI, PRUint32 aLoadFlags)
NS_IMETHODIMP nsWebBrowser::LoadURI(const PRUnichar* aURI,
PRUint32 aLoadFlags,
nsIURI* aReferingURI,
nsIInputStream* aPostDataStream,
nsIInputStream* aExtraHeaderStream)
{
NS_ENSURE_STATE(mDocShell);
return mDocShellAsNav->LoadURI(aURI, aLoadFlags);
return mDocShellAsNav->LoadURI(aURI,
aLoadFlags,
aReferingURI,
aPostDataStream,
aExtraHeaderStream);
}
NS_IMETHODIMP nsWebBrowser::Reload(PRUint32 aReloadFlags)
@ -623,6 +631,13 @@ NS_IMETHODIMP nsWebBrowser::GetCurrentURI(nsIURI** aURI)
return mDocShellAsNav->GetCurrentURI(aURI);
}
NS_IMETHODIMP nsWebBrowser::GetReferingURI(nsIURI** aURI)
{
NS_ENSURE_STATE(mDocShell);
return mDocShellAsNav->GetReferingURI(aURI);
}
NS_IMETHODIMP nsWebBrowser::SetSessionHistory(nsISHistory* aSessionHistory)
{
if(mDocShell)
@ -1738,6 +1753,7 @@ NS_IMETHODIMP nsWebBrowser::SetFocusedElement(nsIDOMElement * aFocusedElement)
return NS_OK;
}
/* helper function */
nsresult nsWebBrowser::DoPrintOrPrintPreview(nsIDOMWindow *aDOMWindow,
nsIPrintSettings *aThePrintSettings,

Просмотреть файл

@ -707,14 +707,17 @@ void CBrowserView::OnFileSaveAs()
void CBrowserView::OpenURL(const char* pUrl)
{
if(mWebNav)
mWebNav->LoadURI(NS_ConvertASCIItoUCS2(pUrl).get(), nsIWebNavigation::LOAD_FLAGS_NONE);
OpenURL(NS_ConvertASCIItoUCS2(pUrl).get());
}
void CBrowserView::OpenURL(const PRUnichar* pUrl)
{
if(mWebNav)
mWebNav->LoadURI(pUrl, nsIWebNavigation::LOAD_FLAGS_NONE);
mWebNav->LoadURI(pUrl, // URI string
nsIWebNavigation::LOAD_FLAGS_NONE, // Load flags
nsnull, // Refering URI
nsnull, // Post data
nsnull); // Headers stream
}
CBrowserFrame* CBrowserView::CreateNewBrowserFrame(PRUint32 chromeMask,

Просмотреть файл

@ -226,7 +226,10 @@ void CTests::OnTestsChangeUrl()
QAOutput("Begin Change URL test.", 1);
strcpy(theUrl, myDialog.m_urlfield);
rv = qaWebNav->LoadURI(NS_ConvertASCIItoUCS2(theUrl).get(),
nsIWebNavigation::LOAD_FLAGS_BYPASS_HISTORY);
nsIWebNavigation::LOAD_FLAGS_BYPASS_HISTORY,
nsnull,
nsnull,
nsnull);
RvTestResult(rv, "rv LoadURI() test", 1);
FormatAndPrintOutput("The url = ", theUrl, 2);

Просмотреть файл

@ -313,8 +313,11 @@ void CNsIWebNav::LoadUriTest(char *theUrl, const unsigned long theFlag)
break;
}
rv = qaWebNav->LoadURI(NS_ConvertASCIItoUCS2(theUrl).get(),
theFlag);
rv = qaWebNav->LoadURI(NS_ConvertASCIItoUCS2(theUrl).get(),
theFlag,
nsnull,
nsnull,
nsnull);
sprintf(theTotalString, "%s%s%s%s%s", "LoadURI(): ", theUrl, " w/ ", theFlagName, " test");
RvTestResult(rv, theTotalString, 2);
}
@ -369,9 +372,12 @@ void CNsIWebNav::StopUriTest(char *theUrl)
{
char theTotalString[200];
qaWebNav->LoadURI(NS_ConvertASCIItoUCS2(theUrl).get(),
nsIWebNavigation::LOAD_FLAGS_NONE);
rv = qaWebNav->Stop(nsIWebNavigation::STOP_ALL);
qaWebNav->LoadURI(NS_ConvertASCIItoUCS2(theUrl).get(),
nsIWebNavigation::LOAD_FLAGS_NONE,
nsnull,
nsnull,
nsnull);
rv = qaWebNav->Stop(nsIWebNavigation::STOP_ALL);
sprintf(theTotalString, "%s%s%s", "Stop(): ", theUrl, " test");
RvTestResult(rv, theTotalString, 2);
}

Просмотреть файл

@ -701,14 +701,17 @@ void CBrowserView::OnFileSaveAs()
void CBrowserView::OpenURL(const char* pUrl)
{
if(mWebNav)
mWebNav->LoadURI(NS_ConvertASCIItoUCS2(pUrl).get(), nsIWebNavigation::LOAD_FLAGS_NONE);
OpenURL(NS_ConvertASCIItoUCS2(pUrl).get());
}
void CBrowserView::OpenURL(const PRUnichar* pUrl)
{
if(mWebNav)
mWebNav->LoadURI(pUrl, nsIWebNavigation::LOAD_FLAGS_NONE);
mWebNav->LoadURI(pUrl, // URI string
nsIWebNavigation::LOAD_FLAGS_NONE, // Load flags
nsnull, // Refering URI
nsnull, // Post data
nsnull); // Extra headers
}
CBrowserFrame* CBrowserView::CreateNewBrowserFrame(PRUint32 chromeMask,

Просмотреть файл

@ -305,7 +305,10 @@ nsresult OpenWebPage(const char *url)
chrome->GetWebBrowser(getter_AddRefs(newBrowser));
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(newBrowser));
return webNav->LoadURI(NS_ConvertASCIItoUCS2(url).get(),
nsIWebNavigation::LOAD_FLAGS_NONE);
nsIWebNavigation::LOAD_FLAGS_NONE,
nsnull,
nsnull,
nsnull);
}
return rv;
@ -641,7 +644,10 @@ BOOL CALLBACK BrowserDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
sizeof(szURL) / sizeof(szURL[0]) - 1);
webNavigation->LoadURI(
NS_ConvertASCIItoUCS2(szURL).get(),
nsIWebNavigation::LOAD_FLAGS_NONE);
nsIWebNavigation::LOAD_FLAGS_NONE,
nsnull,
nsnull,
nsnull);
}
break;

Просмотреть файл

@ -200,7 +200,7 @@ function getWebNavigation()
function loadURI(aURI)
{
const nsIWebNavigation = Components.interfaces.nsIWebNavigation;
getWebNavigation().loadURI(aURI, nsIWebNavigation.LOAD_FLAGS_NONE);
getWebNavigation().loadURI(aURI, nsIWebNavigation.LOAD_FLAGS_NONE, null ,null, null);
}
function goBack()

Просмотреть файл

@ -300,7 +300,7 @@ InspectorApp.prototype =
browseToURL: function(aURL)
{
this.webNavigation.loadURI(aURL, nsIWebNavigation.LOAD_FLAGS_NONE);
this.webNavigation.loadURI(aURL, nsIWebNavigation.LOAD_FLAGS_NONE, null, null, null);
},
goToWindow: function(aMenuitem)

Просмотреть файл

@ -172,7 +172,7 @@ inSearchService.prototype =
loadModule: function(aURL)
{
this.mWebNav.loadURI(aURL, nsIWebNavigation.LOAD_FLAGS_NONE);
this.mWebNav.loadURI(aURL, nsIWebNavigation.LOAD_FLAGS_NONE, null, null, null);
this.mLoadingURL = aURL;
/*
// This method of loading the xml doesn't work, but it should. See bug 54237...

Просмотреть файл

@ -1,89 +0,0 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is TransforMiiX XSLT processor.
*
* The Initial Developer of the Original Code is The MITRE Corporation.
* Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation.
*
* Portions created by Peter Van der Beken are Copyright (C) 2000
* Peter Van der Beken. All Rights Reserved.
*
* Contributor(s):
* Peter Van der Beken, peter.vanderbeken@pandora.be
* -- original author.
*
*/
var xmlLoaded, xslLoaded;
var xmlDocument, xslDocument, resultDocument;
var theXMLURL = "chrome://transformiix/content/simple.xml";
var theXSLURL = "chrome://transformiix/content/simplexsl.xml";
function onLoadTransformiix()
{
onTransform();
}
function onTransform()
{
var docShellElement = document.getElementById("xml-source");
var docShell = docShellElement.docShell;
docShell.viewMode = Components.interfaces.nsIDocShell.viewSource;
var webNav = docShell.QueryInterface(Components.interfaces.nsIWebNavigation);
var loadFlags = Components.interfaces.nsIWebNavigation.LOAD_FLAGS_NONE;
webNav.loadURI(theXMLURL, loadFlags);
docShellElement = document.getElementById("xsl-source");
docShell = docShellElement.docShell;
docShell.viewMode = Components.interfaces.nsIDocShell.viewSource;
webNav = docShell.QueryInterface(Components.interfaces.nsIWebNavigation);
webNav.loadURI(theXSLURL, loadFlags);
docShellElement = document.getElementById("result-doc");
resultDocument = webNav.document;
xmlDocument = resultDocument.implementation.createDocument("", "", null);
xmlDocument.addEventListener("load", xmlDocumentLoaded, false);
xmlDocument.load(theXMLURL, "text/xml");
xslDocument = resultDocument.implementation.createDocument("", "", null);
xslDocument.addEventListener("load", xslDocumentLoaded, false);
xslDocument.load(theXSLURL, "text/xml");
}
function xmlDocumentLoaded(e) {
xmlLoaded = true;
tryToTransform();
}
function xslDocumentLoaded(e) {
xslLoaded = true;
tryToTransform();
}
function tryToTransform() {
if (xmlLoaded && xslLoaded) {
try {
var xsltProcessor = null;
var xmlDocumentNode = xmlDocument.documentElement;
var xslDocumentNode = xslDocument.documentElement;
xsltProcessor = Components.classes["@mozilla.org/document-transformer;1?type=text/xsl"].getService();
if (xsltProcessor) xsltProcessor = xsltProcessor.QueryInterface(Components.interfaces.nsIDocumentTransformer);
}
catch (ex) {
dump("failed to get transformiix service!\n");
xsltProcessor = null;
}
dump("Mal sehen, "+xsltProcessor+"\n");
var outDocument = resultDocument.implementation.createDocument("", "", null);
xsltProcessor.TransformDocument(xmlDocumentNode, xslDocumentNode, outDocument, null);
// DumpDOM(outDocument.documentElement);
// DumpDOM(xmlDocument.documentElement);
}
}

Просмотреть файл

@ -239,7 +239,8 @@ NS_IMETHODIMP mozXMLTerminal::Init(nsIDocShell* aDocShell,
if (NS_FAILED(result))
return NS_ERROR_FAILURE;
result = aDocShell->LoadURI(uri, nsnull, nsIWebNavigation::LOAD_FLAGS_NONE);
result = aDocShell->LoadURI(uri, nsnull, nsIWebNavigation::LOAD_FLAGS_NONE,
nsnull, nsnull, nsnull);
if (NS_FAILED(result))
return NS_ERROR_FAILURE;

Просмотреть файл

@ -339,7 +339,11 @@ extern "C" NS_EXPORT int DebugRobot(
nsAutoString theSpec; theSpec.AssignWithConversion(spec);
nsCRT::free(spec);
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(docShell));
webNav->LoadURI(theSpec.get(), nsIWebNavigation::LOAD_FLAGS_NONE);/* XXX hook up stream listener here! */
webNav->LoadURI(theSpec.get(),
nsIWebNavigation::LOAD_FLAGS_NONE,
nsnull,
nsnull,
nsnull);/* XXX hook up stream listener here! */
while (!g_bReadyForNextUrl) {
if (yieldProc != NULL) {
(void)url->GetSpec(&spec);

Просмотреть файл

@ -535,7 +535,11 @@ nsMessenger::OpenURL(const char * url)
nsAutoString urlStr; urlStr.AssignWithConversion(unescapedUrl);
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mDocShell));
if(webNav)
webNav->LoadURI(urlStr.get(), nsIWebNavigation::LOAD_FLAGS_NONE);
webNav->LoadURI(urlStr.get(), // URI string
nsIWebNavigation::LOAD_FLAGS_NONE, // Load flags
nsnull, // Refering URI
nsnull, // Post stream
nsnull); // Extra headers
}
PL_strfree(unescapedUrl);
}

Просмотреть файл

@ -317,7 +317,11 @@ nsMsgPrintEngine::FireThatLoadOperation(nsString *uri)
{
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mDocShell));
if (webNav)
rv = webNav->LoadURI(uri->get(), nsIWebNavigation::LOAD_FLAGS_NONE);
rv = webNav->LoadURI(uri->get(), // URI string
nsIWebNavigation::LOAD_FLAGS_NONE, // Load flags
nsnull, // Refering URI
nsnull, // Post data
nsnull); // Extra headers
}
if (tString) nsCRT::free(tString);

Просмотреть файл

@ -339,7 +339,11 @@ extern "C" NS_EXPORT int DebugRobot(
nsAutoString theSpec; theSpec.AssignWithConversion(spec);
nsCRT::free(spec);
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(docShell));
webNav->LoadURI(theSpec.get(), nsIWebNavigation::LOAD_FLAGS_NONE);/* XXX hook up stream listener here! */
webNav->LoadURI(theSpec.get(),
nsIWebNavigation::LOAD_FLAGS_NONE,
nsnull,
nsnull,
nsnull);/* XXX hook up stream listener here! */
while (!g_bReadyForNextUrl) {
if (yieldProc != NULL) {
(void)url->GetSpec(&spec);

Просмотреть файл

@ -855,7 +855,7 @@ nsBrowserWindow::DispatchMenuItem(PRInt32 aID)
url.AppendInt(ix, 10);
url.AppendWithConversion(".html");
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mWebBrowser));
webNav->LoadURI(url.get(), nsIWebNavigation::LOAD_FLAGS_NONE);
webNav->LoadURI(url.get(), nsIWebNavigation::LOAD_FLAGS_NONE, nsnull, nsnull, nsnull);
}
break;
@ -864,7 +864,7 @@ nsBrowserWindow::DispatchMenuItem(PRInt32 aID)
nsAutoString url; url.AssignWithConversion(SAMPLES_BASE_URL);
url.AppendWithConversion("/toolbarTest1.xul");
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mWebBrowser));
webNav->LoadURI(url.get(), nsIWebNavigation::LOAD_FLAGS_NONE);
webNav->LoadURI(url.get(), nsIWebNavigation::LOAD_FLAGS_NONE, nsnull, nsnull, nsnull);
break;
}
case VIEWER_XPTOOLKITTREE1:
@ -872,7 +872,7 @@ nsBrowserWindow::DispatchMenuItem(PRInt32 aID)
nsAutoString url; url.AssignWithConversion(SAMPLES_BASE_URL);
url.AppendWithConversion("/treeTest1.xul");
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mWebBrowser));
webNav->LoadURI(url.get(), nsIWebNavigation::LOAD_FLAGS_NONE);
webNav->LoadURI(url.get(), nsIWebNavigation::LOAD_FLAGS_NONE, nsnull, nsnull, nsnull);
break;
}
@ -1028,7 +1028,7 @@ nsBrowserWindow::DispatchMenuItem(PRInt32 aID)
/* invoke the javascript wallet editor */
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mWebBrowser));
webNav->LoadURI(urlString.get(), nsIWebNavigation::LOAD_FLAGS_NONE);
webNav->LoadURI(urlString.get(), nsIWebNavigation::LOAD_FLAGS_NONE, nsnull, nsnull, nsnull);
}
break;
#endif
@ -1078,7 +1078,7 @@ void
nsBrowserWindow::GoTo(const PRUnichar* aURL)
{
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mWebBrowser));
webNav->LoadURI(aURL, nsIWebNavigation::LOAD_FLAGS_NONE);
webNav->LoadURI(aURL, nsIWebNavigation::LOAD_FLAGS_NONE, nsnull, nsnull, nsnull);
}
@ -1140,7 +1140,10 @@ nsBrowserWindow::DoFileOpen()
// Ask the Web widget to load the file URL
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mWebBrowser));
webNav->LoadURI(NS_ConvertASCIItoUCS2(url.get()).get(),
nsIWebNavigation::LOAD_FLAGS_NONE);
nsIWebNavigation::LOAD_FLAGS_NONE,
nsnull,
nsnull,
nsnull);
SetVisibility(PR_TRUE);
}
}

Просмотреть файл

@ -877,7 +877,7 @@ nsWebCrawler::LoadNextURL(PRBool aQueueLoad)
mCurrentURL = *url;
mStartLoad = PR_Now();
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(webShell));
webNav->LoadURI(url->get(), nsIWebNavigation::LOAD_FLAGS_NONE);
webNav->LoadURI(url->get(), nsIWebNavigation::LOAD_FLAGS_NONE, nsnull, nsnull, nsnull);
}
NS_RELEASE(webShell);
@ -1121,7 +1121,7 @@ nsWebCrawler::GoToQueuedURL(const nsString& aURL)
if (webNav) {
mCurrentURL = aURL;
mStartLoad = PR_Now();
webNav->LoadURI(aURL.get(), nsIWebNavigation::LOAD_FLAGS_NONE);
webNav->LoadURI(aURL.get(), nsIWebNavigation::LOAD_FLAGS_NONE, nsnull, nsnull, nsnull);
NS_RELEASE(webShell);
}
mQueuedLoadURLs--;

Просмотреть файл

@ -392,7 +392,7 @@ NS_IMETHODIMP nsXPBaseWindow::GetTitle(const PRUnichar** aResult)
NS_IMETHODIMP nsXPBaseWindow::LoadURL(const nsString& aURL)
{
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mWebShell));
webNav->LoadURI(aURL.get(), nsIWebNavigation::LOAD_FLAGS_NONE);
webNav->LoadURI(aURL.get(), nsIWebNavigation::LOAD_FLAGS_NONE, nsnull, nsnull, nsnull);
return NS_OK;
}

Просмотреть файл

@ -337,7 +337,12 @@ nsresult nsWebShellWindow::Initialize(nsIXULWindow* aParent,
nsCRT::free(tmpStr);
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mDocShell));
NS_ENSURE_TRUE(webNav, NS_ERROR_FAILURE);
NS_ENSURE_SUCCESS(webNav->LoadURI(urlString.get(), nsIWebNavigation::LOAD_FLAGS_NONE), NS_ERROR_FAILURE);
rv = webNav->LoadURI(urlString.get(),
nsIWebNavigation::LOAD_FLAGS_NONE,
nsnull,
nsnull,
nsnull);
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
}
return rv;
@ -1459,7 +1464,11 @@ void nsWebShellWindow::LoadContentAreas() {
nsUnescape(urlChar);
contentURL.AssignWithConversion(urlChar);
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(contentShell));
webNav->LoadURI(contentURL.get(), nsIWebNavigation::LOAD_FLAGS_NONE);
webNav->LoadURI(contentURL.get(),
nsIWebNavigation::LOAD_FLAGS_NONE,
nsnull,
nsnull,
nsnull);
delete [] urlChar;
}
NS_RELEASE(contentShell);

Просмотреть файл

@ -494,7 +494,6 @@ void LoadURLInWindow(WindowPtr wind, const char* urlString)
}
}
void LoadURLInXULWindow(nsIXULWindow* inWindow, const char* urlString)
{
nsCOMPtr<nsIDocShellTreeItem> contentShell;
@ -505,7 +504,7 @@ void LoadURLInXULWindow(nsIXULWindow* inWindow, const char* urlString)
ThrowErrIfNil(webNav, paramErr);
nsAutoString urlWString; urlWString.AssignWithConversion(urlString);
webNav->LoadURI(urlWString.get(), nsIWebNavigation::LOAD_FLAGS_NONE);
webNav->LoadURI(urlWString.get(), nsIWebNavigation::LOAD_FLAGS_NONE, nsnull, nsnull, nsnull);
}

Просмотреть файл

@ -849,7 +849,7 @@ function BrowserCanFindAgain()
function loadURI(uri)
{
try {
getWebNavigation().loadURI(uri, nsIWebNavigation.LOAD_FLAGS_NONE);
getWebNavigation().loadURI(uri, nsIWebNavigation.LOAD_FLAGS_NONE, null, null, null);
} catch (e) {
}
}

Просмотреть файл

@ -984,7 +984,7 @@ function BrowserCanFindAgain()
function loadURI(uri)
{
try {
getWebNavigation().loadURI(uri, nsIWebNavigation.LOAD_FLAGS_NONE);
getWebNavigation().loadURI(uri, nsIWebNavigation.LOAD_FLAGS_NONE, null, null, null);
} catch (e) {
}
}

Просмотреть файл

@ -75,7 +75,7 @@ function viewSource(url)
var loadFlags = Components.interfaces.nsIWebNavigation.LOAD_FLAGS_NONE;
var viewSrcUrl = "view-source:" + url;
getBrowser().webNavigation.loadURI(viewSrcUrl, loadFlags);
getBrowser().webNavigation.loadURI(viewSrcUrl, loadFlags, null, null, null);
//check the view_source.wrap_long_lines pref and set the menuitem's checked attribute accordingly
if (gPrefs) {

Просмотреть файл

@ -70,7 +70,6 @@
#include "nsIContentViewer.h"
#include "nsIContentViewerEdit.h"
#include "nsIWebShell.h"
#include "nsIWebNavigation.h"
#include "nsIDocShell.h"
#include "nsIWebShellWindow.h"
#include "nsIWebBrowserChrome.h"
@ -618,7 +617,11 @@ nsBrowserInstance::LoadUrl(const PRUnichar * urlToLoad)
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(docShell));
// Normal browser.
rv = webNav->LoadURI( urlToLoad, nsIWebNavigation::LOAD_FLAGS_NONE );
rv = webNav->LoadURI( urlToLoad, // URI string
nsIWebNavigation::LOAD_FLAGS_NONE, // Load flags
nsnull, // Refering URI
nsnull, // Post data
nsnull ); // Extra headers
return rv;
}

Просмотреть файл

@ -587,6 +587,15 @@ nsSHistory::GetCurrentURI(nsIURI** aResultURI)
}
NS_IMETHODIMP
nsSHistory::GetReferingURI(nsIURI** aURI)
{
*aURI = nsnull;
// Not implemented
return NS_OK;
}
NS_IMETHODIMP
nsSHistory::SetSessionHistory(nsISHistory* aSessionHistory)
{
@ -604,7 +613,11 @@ nsSHistory::GetSessionHistory(nsISHistory** aSessionHistory)
NS_IMETHODIMP
nsSHistory::LoadURI(const PRUnichar* aURI, PRUint32 aLoadFlags)
nsSHistory::LoadURI(const PRUnichar* aURI,
PRUint32 aLoadFlags,
nsIURI* aReferingURI,
nsIInputStream* aPostStream,
nsIInputStream* aExtraHeaderStream)
{
return NS_OK;
}

Просмотреть файл

@ -736,10 +736,14 @@ XRemoteService::OpenURL(nsCString &aArgument,
return NS_ERROR_FAILURE;
}
rv = webNav->LoadURI(url.get(), nsIWebNavigation::LOAD_FLAGS_NONE);
rv = webNav->LoadURI(url.get(),
nsIWebNavigation::LOAD_FLAGS_NONE,
nsnull,
nsnull,
nsnull);
}
return rv;
}

Просмотреть файл

@ -127,7 +127,7 @@
if (!aURI)
aURI = "about:blank";
this.webNavigation.loadURI(aURI, aFlags);
this.webNavigation.loadURI(aURI, aFlags, null, null, null);
]]>
</body>
</method>