зеркало из https://github.com/mozilla/pjs.git
Move documentURI to a new interface. b=157133. r=rpotts@netscape.com, sr=darin@netscape.com
This commit is contained in:
Родитель
b7b0b9b16e
Коммит
577de718b3
|
@ -58,6 +58,12 @@
|
|||
#include "nsIPluginViewer.h"
|
||||
#include "nsContentPolicyUtils.h" // NS_CheckContentLoadPolicy(...)
|
||||
|
||||
// we want to explore making the document own the load group
|
||||
// so we can associate the document URI with the load group.
|
||||
// until this point, we have an evil hack:
|
||||
#include "nsIHttpChannelInternal.h"
|
||||
|
||||
|
||||
// Local Includes
|
||||
#include "nsDocShell.h"
|
||||
#include "nsDocShellLoadInfo.h"
|
||||
|
@ -5099,12 +5105,14 @@ nsDocShell::DoURILoad(nsIURI * aURI,
|
|||
|
||||
channel->SetOriginalURI(aURI);
|
||||
|
||||
//hack
|
||||
nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(channel));
|
||||
if (httpChannel) {
|
||||
nsCOMPtr<nsIHttpChannelInternal> httpChannelInternal(do_QueryInterface(channel));
|
||||
if (httpChannelInternal) {
|
||||
if (firstParty) {
|
||||
httpChannel->SetDocumentURI(aURI);
|
||||
httpChannelInternal->SetDocumentURI(aURI);
|
||||
} else {
|
||||
httpChannel->SetDocumentURI(aReferrerURI);
|
||||
httpChannelInternal->SetDocumentURI(aReferrerURI);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -58,6 +58,11 @@
|
|||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIPrompt.h"
|
||||
|
||||
// we want to explore making the document own the load group
|
||||
// so we can associate the document URI with the load group.
|
||||
// until this point, we have an evil hack:
|
||||
#include "nsIHttpChannelInternal.h"
|
||||
|
||||
static NS_DEFINE_CID(kINetModuleMgrCID, NS_NETMODULEMGR_CID);
|
||||
|
||||
///////////////////////////////////
|
||||
|
@ -165,9 +170,12 @@ nsCookieHTTPNotify::OnModifyRequest(nsIHttpChannel *aHttpChannel)
|
|||
rv = aHttpChannel->GetURI(getter_AddRefs(pURL));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIHttpChannelInternal> httpInternal = do_QueryInterface(aHttpChannel);
|
||||
NS_ENSURE_TRUE(httpInternal, NS_ERROR_UNEXPECTED);
|
||||
|
||||
// Get the original url that the user either typed in or clicked on
|
||||
nsCOMPtr<nsIURI> pFirstURL;
|
||||
rv = aHttpChannel->GetDocumentURI(getter_AddRefs(pFirstURL));
|
||||
rv = httpInternal->GetDocumentURI(getter_AddRefs(pFirstURL));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!pFirstURL) {
|
||||
rv = aHttpChannel->GetOriginalURI(getter_AddRefs(pFirstURL));
|
||||
|
@ -213,9 +221,12 @@ nsCookieHTTPNotify::OnExamineResponse(nsIHttpChannel *aHttpChannel)
|
|||
rv = aHttpChannel->GetURI(getter_AddRefs(pURL));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIHttpChannelInternal> httpInternal = do_QueryInterface(aHttpChannel);
|
||||
NS_ENSURE_TRUE(httpInternal, NS_ERROR_UNEXPECTED);
|
||||
|
||||
// Get the original url that the user either typed in or clicked on
|
||||
nsCOMPtr<nsIURI> pFirstURL;
|
||||
rv = aHttpChannel->GetDocumentURI(getter_AddRefs(pFirstURL));
|
||||
rv = httpInternal->GetDocumentURI(getter_AddRefs(pFirstURL));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Get the prompter
|
||||
|
|
|
@ -56,6 +56,11 @@
|
|||
#include "nsComObsolete.h"
|
||||
#include <time.h>
|
||||
|
||||
// we want to explore making the document own the load group
|
||||
// so we can associate the document URI with the load group.
|
||||
// until this point, we have an evil hack:
|
||||
#include "nsIHttpChannelInternal.h"
|
||||
|
||||
#define MAX_NUMBER_OF_COOKIES 300
|
||||
#define MAX_COOKIES_PER_SERVER 20
|
||||
#define MAX_BYTES_PER_COOKIE 4096 /* must be at least 1 */
|
||||
|
@ -1459,7 +1464,10 @@ COOKIE_SetCookieString(nsIURI * aURL, nsIPrompt *aPrompter, const char * setCook
|
|||
nsresult rv;
|
||||
|
||||
if (aHttpChannel) {
|
||||
rv = aHttpChannel->GetDocumentURI(getter_AddRefs(pFirstURL));
|
||||
nsCOMPtr<nsIHttpChannelInternal> httpInternal = do_QueryInterface(aHttpChannel);
|
||||
if (!httpInternal) return;
|
||||
|
||||
rv = httpInternal->GetDocumentURI(getter_AddRefs(pFirstURL));
|
||||
if (NS_FAILED(rv)) return;
|
||||
}
|
||||
COOKIE_SetCookieStringFromHttp(aURL, pFirstURL, aPrompter, setCookieHeader, 0, aHttpChannel);
|
||||
|
|
|
@ -43,6 +43,11 @@
|
|||
|
||||
#include "nsIComponentRegistrar.h"
|
||||
|
||||
// we want to explore making the document own the load group
|
||||
// so we can associate the document URI with the load group.
|
||||
// until this point, we have an evil hack:
|
||||
#include "nsIHttpChannelInternal.h"
|
||||
|
||||
#ifdef DEBUG_pavlov
|
||||
#include "nsIEnumerator.h"
|
||||
#include "nsXPCOM.h"
|
||||
|
@ -194,7 +199,10 @@ static nsresult NewImageChannel(nsIChannel **aResult,
|
|||
NS_LITERAL_CSTRING(""));
|
||||
newHttpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Accept"),
|
||||
NS_LITERAL_CSTRING("video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1"));
|
||||
newHttpChannel->SetDocumentURI(aInitialDocumentURI);
|
||||
|
||||
nsCOMPtr<nsIHttpChannelInternal> httpChannelInternal = do_QueryInterface(newHttpChannel);
|
||||
NS_ENSURE_TRUE(httpChannelInternal, NS_ERROR_UNEXPECTED);
|
||||
httpChannelInternal->SetDocumentURI(aInitialDocumentURI);
|
||||
newHttpChannel->SetReferrer(aReferringURI);
|
||||
}
|
||||
|
||||
|
|
|
@ -1085,6 +1085,13 @@
|
|||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIHTTPChannelInternal.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIHttpHeaderVisitor.idl</PATH>
|
||||
|
@ -1689,6 +1696,11 @@
|
|||
<PATH>nsIHTTPChannel.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIHTTPChannelInternal.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIHttpHeaderVisitor.idl</PATH>
|
||||
|
@ -3035,6 +3047,13 @@
|
|||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIHTTPChannelInternal.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIHttpHeaderVisitor.idl</PATH>
|
||||
|
@ -3630,6 +3649,11 @@
|
|||
<PATH>nsIHTTPChannel.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIHTTPChannelInternal.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIHttpHeaderVisitor.idl</PATH>
|
||||
|
@ -4469,6 +4493,12 @@
|
|||
<PATH>nsIHTTPChannel.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<TARGETNAME>headers</TARGETNAME>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIHTTPChannelInternal.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<TARGETNAME>headers</TARGETNAME>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
nsIHttpChannel.idl
|
||||
nsIHttpHeaderVisitor.idl
|
||||
nsIHttpProtocolHandler.idl
|
||||
nsIHttpAuthenticator.idl
|
||||
nsIHttpNotify.idl
|
||||
nsIHttpEventSink.idl
|
|
@ -31,6 +31,7 @@ XPIDL_MODULE = necko_http
|
|||
|
||||
XPIDLSRCS = \
|
||||
nsIHttpChannel.idl \
|
||||
nsIHttpChannelInternal.idl \
|
||||
nsIHttpHeaderVisitor.idl \
|
||||
nsIHttpNotify.idl \
|
||||
nsIHttpProtocolHandler.idl \
|
||||
|
|
|
@ -46,11 +46,6 @@ interface nsIHttpChannel : nsIChannel
|
|||
*/
|
||||
attribute nsIURI referrer;
|
||||
|
||||
/**
|
||||
* An http channel can own a reference to the document URI
|
||||
*/
|
||||
attribute nsIURI documentURI;
|
||||
|
||||
/**
|
||||
* Header strings are case insensitive. Setting a header is additive; to
|
||||
* clear a header, assign an empty string.
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* 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 Mozilla.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications. Portions created by Netscape Communications are
|
||||
* Copyright (C) 2001 by Netscape Communications. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIURI;
|
||||
/**
|
||||
* Dumping ground for http. This interface will never be frozen. If you are
|
||||
* using any feature exposed by this interface, be aware that this interface
|
||||
* will change and you will be broken. You have been warned.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(7552588e-d018-48a2-b67c-432414d0b64c)]
|
||||
interface nsIHttpChannelInternal : nsISupports
|
||||
{
|
||||
/**
|
||||
* An http channel can own a reference to the document URI
|
||||
*/
|
||||
attribute nsIURI documentURI;
|
||||
|
||||
};
|
|
@ -1536,14 +1536,17 @@ nsHttpChannel::ProcessRedirection(PRUint32 redirectType)
|
|||
|
||||
nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(newChannel);
|
||||
if (httpChannel) {
|
||||
nsCOMPtr<nsIHttpChannelInternal> httpInternal = do_QueryInterface(newChannel);
|
||||
NS_ENSURE_TRUE(httpInternal, NS_ERROR_UNEXPECTED);
|
||||
|
||||
// update the DocumentURI indicator since we are being redirected.
|
||||
// if this was a top-level document channel, then the new channel
|
||||
// should have its mDocumentURI point to newURI; otherwise, we
|
||||
// just need to pass along our mDocumentURI to the new channel.
|
||||
if (newURI && (mURI == mDocumentURI))
|
||||
httpChannel->SetDocumentURI(newURI);
|
||||
httpInternal->SetDocumentURI(newURI);
|
||||
else
|
||||
httpChannel->SetDocumentURI(mDocumentURI);
|
||||
httpInternal->SetDocumentURI(mDocumentURI);
|
||||
// convey the referrer if one was used for this channel to the next one
|
||||
if (mReferrer)
|
||||
httpChannel->SetReferrer(mReferrer);
|
||||
|
@ -2075,18 +2078,24 @@ nsHttpChannel::GetCurrentPath(nsACString &path)
|
|||
// nsHttpChannel::nsISupports
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS11(nsHttpChannel,
|
||||
nsIRequest,
|
||||
nsIChannel,
|
||||
nsIRequestObserver,
|
||||
nsIStreamListener,
|
||||
nsIHttpChannel,
|
||||
nsIInterfaceRequestor,
|
||||
nsIProgressEventSink,
|
||||
nsICachingChannel,
|
||||
nsIUploadChannel,
|
||||
nsICacheListener,
|
||||
nsIEncodedChannel)
|
||||
NS_IMPL_THREADSAFE_ADDREF(nsHttpChannel)
|
||||
NS_IMPL_THREADSAFE_RELEASE(nsHttpChannel)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsHttpChannel)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIRequest)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIChannel)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIRequestObserver)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIStreamListener)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIHttpChannel)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIProgressEventSink)
|
||||
NS_INTERFACE_MAP_ENTRY(nsICachingChannel)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIUploadChannel)
|
||||
NS_INTERFACE_MAP_ENTRY(nsICacheListener)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIEncodedChannel)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIHttpChannelInternal)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIChannel)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// nsHttpChannel::nsIRequest
|
||||
|
|
|
@ -49,6 +49,8 @@
|
|||
#include "nsXPIDLString.h"
|
||||
#include "nsHttpConnection.h"
|
||||
|
||||
#include "nsIHttpChannelInternal.h"
|
||||
|
||||
class nsHttpTransaction;
|
||||
class nsHttpResponseHead;
|
||||
class nsHttpAuthCache;
|
||||
|
@ -67,6 +69,7 @@ class nsHttpChannel : public nsIHttpChannel
|
|||
, public nsIUploadChannel
|
||||
, public nsICacheListener
|
||||
, public nsIEncodedChannel
|
||||
, public nsIHttpChannelInternal
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
@ -81,6 +84,7 @@ public:
|
|||
NS_DECL_NSIUPLOADCHANNEL
|
||||
NS_DECL_NSICACHELISTENER
|
||||
NS_DECL_NSIENCODEDCHANNEL
|
||||
NS_DECL_NSIHTTPCHANNELINTERNAL
|
||||
|
||||
nsHttpChannel();
|
||||
virtual ~nsHttpChannel();
|
||||
|
|
Загрузка…
Ссылка в новой задаче