Bug 547051: e10s: Support local use of Set/GetOwner for HttpChannelChild. r=jduell

--HG--
extra : rebase_source : f3f0865de440843825d7d4b4b865bee6b5a647c4
This commit is contained in:
Jae-Seong Lee-Russo 2010-04-21 02:02:05 -07:00
parent e9043320a2
commit d0d52aed33
8 changed files with 58 additions and 36 deletions

View File

@ -241,6 +241,22 @@ HttpBaseChannel::GetURI(nsIURI **aURI)
return NS_OK;
}
NS_IMETHODIMP
HttpBaseChannel::GetOwner(nsISupports **aOwner)
{
NS_ENSURE_ARG_POINTER(aOwner);
*aOwner = mOwner;
NS_IF_ADDREF(*aOwner);
return NS_OK;
}
NS_IMETHODIMP
HttpBaseChannel::SetOwner(nsISupports *aOwner)
{
mOwner = aOwner;
return NS_OK;
}
NS_IMETHODIMP
HttpBaseChannel::GetNotificationCallbacks(nsIInterfaceRequestor **aCallbacks)
{

View File

@ -108,6 +108,8 @@ public:
NS_IMETHOD GetOriginalURI(nsIURI **aOriginalURI);
NS_IMETHOD SetOriginalURI(nsIURI *aOriginalURI);
NS_IMETHOD GetURI(nsIURI **aURI);
NS_IMETHOD GetOwner(nsISupports **aOwner);
NS_IMETHOD SetOwner(nsISupports *aOwner);
NS_IMETHOD GetNotificationCallbacks(nsIInterfaceRequestor **aCallbacks);
NS_IMETHOD SetNotificationCallbacks(nsIInterfaceRequestor *aCallbacks);
NS_IMETHOD GetContentType(nsACString& aContentType);
@ -161,6 +163,7 @@ protected:
nsCOMPtr<nsIStreamListener> mListener;
nsCOMPtr<nsISupports> mListenerContext;
nsCOMPtr<nsILoadGroup> mLoadGroup;
nsCOMPtr<nsISupports> mOwner;
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
nsCOMPtr<nsIProgressEventSink> mProgressSink;
nsCOMPtr<nsIURI> mReferrer;

View File

@ -191,21 +191,6 @@ HttpChannelChild::Resume()
//-----------------------------------------------------------------------------
// HttpChannelChild::nsIChannel
//-----------------------------------------------------------------------------
NS_IMETHODIMP
HttpChannelChild::GetOwner(nsISupports **result)
{
// FIXME bug 547051
NS_ENSURE_ARG_POINTER(result);
*result = nsnull;
return NS_OK;
}
NS_IMETHODIMP
HttpChannelChild::SetOwner(nsISupports *aOwner)
{
// FIXME bug 547051
DROP_DEAD();
}
NS_IMETHODIMP
HttpChannelChild::GetSecurityInfo(nsISupports **aSecurityInfo)

View File

@ -108,8 +108,6 @@ public:
NS_IMETHOD Suspend();
NS_IMETHOD Resume();
// nsIChannel
NS_IMETHOD GetOwner(nsISupports **aOwner);
NS_IMETHOD SetOwner(nsISupports *aOwner);
NS_IMETHOD GetSecurityInfo(nsISupports **aSecurityInfo);
NS_IMETHOD AsyncOpen(nsIStreamListener *listener, nsISupports *aContext);
// HttpBaseChannel::nsIHttpChannel

View File

@ -4087,22 +4087,6 @@ nsHttpChannel::Resume()
// nsHttpChannel::nsIChannel
//-----------------------------------------------------------------------------
NS_IMETHODIMP
nsHttpChannel::GetOwner(nsISupports **owner)
{
NS_ENSURE_ARG_POINTER(owner);
*owner = mOwner;
NS_IF_ADDREF(*owner);
return NS_OK;
}
NS_IMETHODIMP
nsHttpChannel::SetOwner(nsISupports *owner)
{
mOwner = owner;
return NS_OK;
}
NS_IMETHODIMP
nsHttpChannel::GetSecurityInfo(nsISupports **securityInfo)
{

View File

@ -119,8 +119,6 @@ public:
NS_IMETHOD Suspend();
NS_IMETHOD Resume();
// nsIChannel
NS_IMETHOD GetOwner(nsISupports **aOwner);
NS_IMETHOD SetOwner(nsISupports *aOwner);
NS_IMETHOD GetSecurityInfo(nsISupports **aSecurityInfo);
NS_IMETHOD AsyncOpen(nsIStreamListener *listener, nsISupports *aContext);
// nsIHttpChannelInternal
@ -256,7 +254,6 @@ private:
nsresult ContinueOnAuthAvailable(const nsCSubstring& creds);
private:
nsCOMPtr<nsISupports> mOwner;
nsCOMPtr<nsIInputStream> mUploadStream;
nsCOMPtr<nsISupports> mSecurityInfo;
nsCOMPtr<nsICancelable> mProxyRequest;

View File

@ -0,0 +1,36 @@
do_load_httpd_js();
var httpserver = new nsHttpServer();
var testpath = "/simple";
var httpbody = "<?xml version='1.0' ?><root>0123456789</root>";
function run_test()
{
httpserver.registerPathHandler(testpath, serverHandler);
httpserver.start(4444);
var xhr = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]
.createInstance(Ci.nsIXMLHttpRequest);
xhr.open("GET", "http://localhost:4444" + testpath, true);
xhr.onreadystatechange = function(event) {
if (xhr.readyState == 4) {
do_check_eq(xhr.status, 200);
do_check_eq(xhr.responseText, httpbody);
var root_node = xhr.responseXML.getElementsByTagName('root').item(0);
do_check_eq(root_node.firstChild.data, "0123456789");
httpserver.stop(do_test_finished);
}
}
xhr.send(null);
do_test_pending();
}
function serverHandler(metadata, response)
{
response.setHeader("Content-Type", "text/xml", false);
response.bodyOutputStream.write(httpbody, httpbody.length);
}

View File

@ -0,0 +1,3 @@
function run_test() {
run_test_in_child("../unit/test_xmlhttprequest.js");
}