Bug 464222 - Allow URI loads with a base URI argument. r=bz
This commit is contained in:
@@ -4278,6 +4278,18 @@ nsDocShell::LoadURI(const char16_t * aURI,
|
|||||||
nsIURI * aReferringURI,
|
nsIURI * aReferringURI,
|
||||||
nsIInputStream * aPostStream,
|
nsIInputStream * aPostStream,
|
||||||
nsIInputStream * aHeaderStream)
|
nsIInputStream * aHeaderStream)
|
||||||
|
{
|
||||||
|
return LoadURIWithBase(aURI, aLoadFlags, aReferringURI, aPostStream,
|
||||||
|
aHeaderStream, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsDocShell::LoadURIWithBase(const char16_t * aURI,
|
||||||
|
uint32_t aLoadFlags,
|
||||||
|
nsIURI * aReferringURI,
|
||||||
|
nsIInputStream * aPostStream,
|
||||||
|
nsIInputStream * aHeaderStream,
|
||||||
|
nsIURI * aBaseURI)
|
||||||
{
|
{
|
||||||
NS_ASSERTION((aLoadFlags & 0xf) == 0, "Unexpected flags");
|
NS_ASSERTION((aLoadFlags & 0xf) == 0, "Unexpected flags");
|
||||||
|
|
||||||
@@ -4371,6 +4383,7 @@ nsDocShell::LoadURI(const char16_t * aURI,
|
|||||||
loadInfo->SetPostDataStream(postStream);
|
loadInfo->SetPostDataStream(postStream);
|
||||||
loadInfo->SetReferrer(aReferringURI);
|
loadInfo->SetReferrer(aReferringURI);
|
||||||
loadInfo->SetHeadersStream(aHeaderStream);
|
loadInfo->SetHeadersStream(aHeaderStream);
|
||||||
|
loadInfo->SetBaseURI(aBaseURI);
|
||||||
|
|
||||||
rv = LoadURI(uri, loadInfo, extraFlags, true);
|
rv = LoadURI(uri, loadInfo, extraFlags, true);
|
||||||
|
|
||||||
@@ -9767,6 +9780,12 @@ nsDocShell::DoURILoad(nsIURI * aURI,
|
|||||||
}
|
}
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
if (aBaseURI) {
|
||||||
|
nsCOMPtr<nsIViewSourceChannel> vsc = do_QueryInterface(channel);
|
||||||
|
if (vsc) {
|
||||||
|
vsc->SetBaseURI(aBaseURI);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
nsAutoCString scheme;
|
nsAutoCString scheme;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ interface nsIURI;
|
|||||||
* location, stop or restart an in process load, or determine where the object
|
* location, stop or restart an in process load, or determine where the object
|
||||||
* has previously gone.
|
* has previously gone.
|
||||||
*/
|
*/
|
||||||
[scriptable, uuid(dbd6241d-c76e-42c0-9410-930589d803a2)]
|
[scriptable, uuid(b7568a50-4c50-442c-a6be-3a340a48d89a)]
|
||||||
interface nsIWebNavigation : nsISupports
|
interface nsIWebNavigation : nsISupports
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@@ -235,6 +235,54 @@ interface nsIWebNavigation : nsISupports
|
|||||||
in nsIInputStream aPostData,
|
in nsIInputStream aPostData,
|
||||||
in nsIInputStream aHeaders);
|
in nsIInputStream aHeaders);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads a given URI. This will give priority to loading the requested URI
|
||||||
|
* in the object implementing this interface. If it can't be loaded here
|
||||||
|
* however, the URI dispatcher will go through its normal process of content
|
||||||
|
* loading.
|
||||||
|
* Behaves like loadURI, except an additional parameter is provided to supply
|
||||||
|
* a base URI to be used in specific situations where one cannot be inferred
|
||||||
|
* by other means, for example when this is called to view selection source.
|
||||||
|
* Outside of these situations, the behaviour of this function is no
|
||||||
|
* different to loadURI.
|
||||||
|
*
|
||||||
|
* @param aURI
|
||||||
|
* The URI string to load. For HTTP and FTP URLs and possibly others,
|
||||||
|
* characters above U+007F will be converted to UTF-8 and then URL-
|
||||||
|
* escaped per the rules of RFC 2396.
|
||||||
|
* @param aLoadFlags
|
||||||
|
* Flags modifying load behaviour. This parameter is a bitwise
|
||||||
|
* combination of the load flags defined above. (Undefined bits are
|
||||||
|
* reserved for future use.) Generally you will pass LOAD_FLAGS_NONE
|
||||||
|
* for this parameter.
|
||||||
|
* @param aReferrer
|
||||||
|
* The referring URI. If this argument is null, then the referring
|
||||||
|
* URI will be inferred internally.
|
||||||
|
* @param aPostData
|
||||||
|
* If the URI corresponds to a HTTP request, then this stream is
|
||||||
|
* appended directly to the HTTP request headers. It may be prefixed
|
||||||
|
* with additional HTTP headers. This stream must contain a "\r\n"
|
||||||
|
* sequence separating any HTTP headers from the HTTP request body.
|
||||||
|
* This parameter is optional and may be null.
|
||||||
|
* @param aHeaders
|
||||||
|
* If the URI corresponds to a HTTP request, then any HTTP headers
|
||||||
|
* contained in this stream are set on the HTTP request. The HTTP
|
||||||
|
* header stream is formatted as:
|
||||||
|
* ( HEADER "\r\n" )*
|
||||||
|
* This parameter is optional and may be null.
|
||||||
|
* @param aBaseURI
|
||||||
|
* Set to indicate a base URI to be associated with the load. Note
|
||||||
|
* that at present this argument is only used with view-source aURIs
|
||||||
|
* and cannot be used to resolve aURI.
|
||||||
|
* This parameter is optional and may be null.
|
||||||
|
*/
|
||||||
|
void loadURIWithBase(in wstring aURI,
|
||||||
|
in unsigned long aLoadFlags,
|
||||||
|
in nsIURI aReferrer,
|
||||||
|
in nsIInputStream aPostData,
|
||||||
|
in nsIInputStream aHeaders,
|
||||||
|
in nsIURI aBaseURI);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tells the Object to reload the current page. There may be cases where the
|
* Tells the Object to reload the current page. There may be cases where the
|
||||||
* user will be asked to confirm the reload (for example, when it is
|
* user will be asked to confirm the reload (for example, when it is
|
||||||
|
|||||||
@@ -1464,6 +1464,16 @@ nsSHistory::GetSessionHistory(nsISHistory** aSessionHistory)
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsSHistory::LoadURIWithBase(const char16_t* aURI,
|
||||||
|
uint32_t aLoadFlags,
|
||||||
|
nsIURI* aReferringURI,
|
||||||
|
nsIInputStream* aPostStream,
|
||||||
|
nsIInputStream* aExtraHeaderStream,
|
||||||
|
nsIURI* aBaseURI)
|
||||||
|
{
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsSHistory::LoadURI(const char16_t* aURI,
|
nsSHistory::LoadURI(const char16_t* aURI,
|
||||||
|
|||||||
@@ -609,6 +609,23 @@ NS_IMETHODIMP nsWebBrowser::GoForward()
|
|||||||
return mDocShellAsNav->GoForward();
|
return mDocShellAsNav->GoForward();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP nsWebBrowser::LoadURIWithBase(const char16_t* aURI,
|
||||||
|
uint32_t aLoadFlags,
|
||||||
|
nsIURI* aReferringURI,
|
||||||
|
nsIInputStream* aPostDataStream,
|
||||||
|
nsIInputStream* aExtraHeaderStream,
|
||||||
|
nsIURI* aBaseURI)
|
||||||
|
{
|
||||||
|
NS_ENSURE_STATE(mDocShell);
|
||||||
|
|
||||||
|
return mDocShellAsNav->LoadURIWithBase(aURI,
|
||||||
|
aLoadFlags,
|
||||||
|
aReferringURI,
|
||||||
|
aPostDataStream,
|
||||||
|
aExtraHeaderStream,
|
||||||
|
aBaseURI);
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsWebBrowser::LoadURI(const char16_t* aURI,
|
NS_IMETHODIMP nsWebBrowser::LoadURI(const char16_t* aURI,
|
||||||
uint32_t aLoadFlags,
|
uint32_t aLoadFlags,
|
||||||
nsIURI* aReferringURI,
|
nsIURI* aReferringURI,
|
||||||
|
|||||||
Reference in New Issue
Block a user