Bug 1286281 - Part 1: Make the nsITransportProvider interface scriptable r=sicking

MozReview-Commit-ID: LCNmwWKTiJt
This commit is contained in:
Jarda Snajdr 2016-07-27 08:46:00 -07:00
parent d97941f0fb
commit b49ae6fec7
4 changed files with 19 additions and 12 deletions

View File

@ -257,11 +257,12 @@ HttpServer::TransportProvider::SetListener(nsIHttpUpgradeListener* aListener)
return NS_OK;
}
NS_IMETHODIMP_(PTransportProviderChild*)
HttpServer::TransportProvider::GetIPCChild()
NS_IMETHODIMP
HttpServer::TransportProvider::GetIPCChild(PTransportProviderChild** aChild)
{
MOZ_CRASH("Don't call this in parent process");
return nullptr;
*aChild = nullptr;
return NS_OK;
}
void

View File

@ -38,11 +38,12 @@ TransportProviderParent::SetListener(nsIHttpUpgradeListener* aListener)
return NS_OK;
}
NS_IMETHODIMP_(mozilla::net::PTransportProviderChild*)
TransportProviderParent::GetIPCChild()
NS_IMETHODIMP
TransportProviderParent::GetIPCChild(mozilla::net::PTransportProviderChild** aChild)
{
MOZ_CRASH("Don't call this in parent process");
return nullptr;
*aChild = nullptr;
return NS_OK;
}
NS_IMETHODIMP
@ -92,10 +93,11 @@ TransportProviderChild::SetListener(nsIHttpUpgradeListener* aListener)
return NS_OK;
}
NS_IMETHODIMP_(mozilla::net::PTransportProviderChild*)
TransportProviderChild::GetIPCChild()
NS_IMETHODIMP
TransportProviderChild::GetIPCChild(mozilla::net::PTransportProviderChild** aChild)
{
return this;
*aChild = this;
return NS_OK;
}
} // net

View File

@ -472,7 +472,11 @@ WebSocketChannelChild::AsyncOpen(nsIURI *aURI,
loadInfoArgs = void_t();
MOZ_ASSERT(mServerTransportProvider);
transportProvider = mServerTransportProvider->GetIPCChild();
PTransportProviderChild *ipcChild;
nsresult rv = mServerTransportProvider->GetIPCChild(&ipcChild);
NS_ENSURE_SUCCESS(rv, rv);
transportProvider = ipcChild;
}
gNeckoChild->SendPWebSocketConstructor(this, tabChild,

View File

@ -22,7 +22,7 @@ class PTransportProviderChild;
* An interface which can be used to asynchronously request a nsITransport
* together with the input and output streams that go together with it.
*/
[uuid(6fcec704-cfd2-46ef-a394-a64d5cb1475c)]
[scriptable, uuid(6fcec704-cfd2-46ef-a394-a64d5cb1475c)]
interface nsITransportProvider : nsISupports
{
// This must not be called in a child process since transport
@ -32,5 +32,5 @@ interface nsITransportProvider : nsISupports
// This must be implemented by nsITransportProvider objects running
// in the child process. It must return null when called in the parent
// process.
[noscript, notxpcom] PTransportProviderChild getIPCChild();
[noscript] PTransportProviderChild getIPCChild();
};