Commit 36dfc9fb authored by Arthur Edelstein's avatar Arthur Edelstein Committed by Georg Koppen
Browse files

Bug 13670.2: Isolate OCSP requests by first party domain

parent 988247dd
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -171,7 +171,16 @@ ThirdPartyUtil::GetOriginatingURI(nsIChannel *aChannel, nsIURI **aURI)

  // case 3)
  if (!topWin)
  {
    if (httpChannelInternal)
    {
      httpChannelInternal->GetDocumentURI(aURI);
      if (*aURI) {
        return NS_OK;
      }
    }
    return NS_ERROR_INVALID_ARG;
  }

  // case 4)
  if (ourWin == topWin) {
+7 −1
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ native NetAddr(mozilla::net::NetAddr);
 * NOTE: This is a free-threaded interface, meaning that the methods on
 * this interface may be called from any thread.
 */
[scriptable, uuid(a0b3b547-d6f0-4b65-a3de-a99ffa368840)]
[scriptable, uuid(4e2dc9d0-125e-4f8e-8c93-845f3de5cd8a)]
interface nsISocketTransport : nsITransport 
{
    /**
@@ -44,6 +44,12 @@ interface nsISocketTransport : nsITransport
     */
    readonly attribute long port;

    /**
     * Get the port for the underlying socket connection.
     * For Unix domain sockets, this is zero.
     */
    attribute AUTF8String isolationKey;

    /**
     * Returns the IP address of the socket connection peer. This
     * attribute is defined only once a connection has been established.
+17 −2
Original line number Diff line number Diff line
@@ -1087,6 +1087,7 @@ nsSocketTransport::BuildSocket(PRFileDesc *&fd, bool &proxyTransparent, bool &us
        int32_t     port       = (int32_t) mPort;
        uint32_t    proxyFlags = 0;
        nsCOMPtr<nsIProxyInfo> proxyInfo = mProxyInfo;
        const char *isolationKey = mIsolationKey.IsEmpty() ? nullptr : mIsolationKey.get();

        uint32_t i;
        for (i=0; i<mTypeCount; ++i) {
@@ -1119,7 +1120,7 @@ nsSocketTransport::BuildSocket(PRFileDesc *&fd, bool &proxyTransparent, bool &us
                                         mHttpsProxy ? mProxyHost.get() : host,
                                         mHttpsProxy ? mProxyPort : port,
                                         proxyInfo,
                                         proxyFlags, &fd,
                                         isolationKey, proxyFlags, &fd,
                                         getter_AddRefs(secinfo));

                if (NS_SUCCEEDED(rv) && !fd) {
@@ -1133,7 +1134,7 @@ nsSocketTransport::BuildSocket(PRFileDesc *&fd, bool &proxyTransparent, bool &us
                // to the stack (such as pushing an io layer)
                rv = provider->AddToSocket(mNetAddr.raw.family,
                                           host, port, proxyInfo,
                                           proxyFlags, fd,
                                           isolationKey, proxyFlags, fd,
                                           getter_AddRefs(secinfo));
            }
            // proxyFlags = 0; not used below this point...
@@ -2211,6 +2212,20 @@ nsSocketTransport::GetPort(int32_t *port)
    return NS_OK;
}

NS_IMETHODIMP
nsSocketTransport::GetIsolationKey(nsACString &value)
{
    value = mIsolationKey;
    return NS_OK;
}

NS_IMETHODIMP
nsSocketTransport::SetIsolationKey(const nsACString &value)
{
    mIsolationKey = value;
    return NS_OK;
}

NS_IMETHODIMP
nsSocketTransport::GetPeerAddr(NetAddr *addr)
{
+2 −0
Original line number Diff line number Diff line
@@ -285,6 +285,8 @@ private:
    bool mHttpsProxy;
    uint32_t     mConnectionFlags;

    nsCString    mIsolationKey;
    
    uint16_t         SocketPort() { return (!mProxyHost.IsEmpty() && !mProxyTransparent) ? mProxyPort : mPort; }
    const nsCString &SocketHost() { return (!mProxyHost.IsEmpty() && !mProxyTransparent) ? mProxyHost : mHost; }

+3 −1
Original line number Diff line number Diff line
@@ -79,7 +79,7 @@ TLSFilterTransaction::TLSFilterTransaction(nsAHttpTransaction *aWrapped,

  if (provider && mFD) {
    mFD->secret = reinterpret_cast<PRFilePrivate *>(this);
    provider->AddToSocket(PR_AF_INET, aTLSHost, aTLSPort, nullptr,
    provider->AddToSocket(PR_AF_INET, aTLSHost, aTLSPort, nullptr, nullptr,
                          0, mFD, getter_AddRefs(mSecInfo));
  }

@@ -1593,6 +1593,8 @@ FWD_TS_PTR(GetConnectionFlags, uint32_t);
FWD_TS(SetConnectionFlags, uint32_t);
FWD_TS_PTR(GetRecvBufferSize, uint32_t);
FWD_TS(SetRecvBufferSize, uint32_t);
FWD_TS(SetIsolationKey, const nsACString&);
FWD_TS(GetIsolationKey, nsACString&);

NS_IMETHODIMP
SocketTransportShim::GetHost(nsACString & aHost)
Loading