Ticket #3455: 0001-Ticket-3455-Part-1-3.-Allow-proxy-settings-to-be-set.patch

File 0001-Ticket-3455-Part-1-3.-Allow-proxy-settings-to-be-set.patch, 40.8 KB (added by arthuredelstein, 5 years ago)
  • dom/plugins/base/nsPluginHost.cpp

    From b412fb6743d40b3e090bca914c0b99501a6f4772 Mon Sep 17 00:00:00 2001
    From: Arthur Edelstein <arthuredelstein@gmail.com>
    Date: Tue, 8 Jul 2014 14:27:00 -0700
    Subject: [PATCH] Ticket #3455, Part 1/3. Allow proxy settings to be set per
     URL bar domain.
    
    This patch adds an alternative to the nsIProtocolProxyFilter
    mechanism, called nsIProtocolProxyChannelFilter, in which
    a protocol proxy filter receives a channel object rather than
    a URI. Access to the channel object allows the proxy filter to
    provide proxy settings according to the URL bar domain.
    ---
     dom/plugins/base/nsPluginHost.cpp                  |   8 +-
     mobile/android/chrome/content/browser.js           |   2 +-
     netwerk/base/public/moz.build                      |   1 +
     netwerk/base/public/nsIProtocolProxyCallback.idl   |  10 +-
     .../base/public/nsIProtocolProxyChannelFilter.idl  |  42 +++++++
     netwerk/base/public/nsIProtocolProxyService.idl    |  32 ++++-
     netwerk/base/public/nsIProtocolProxyService2.idl   |   4 +-
     netwerk/base/public/nsISpeculativeConnect.idl      |   8 +-
     netwerk/base/src/nsIOService.cpp                   |  13 +-
     netwerk/base/src/nsPACMan.cpp                      |   7 +-
     netwerk/base/src/nsPACMan.h                        |  10 +-
     netwerk/base/src/nsProtocolProxyService.cpp        | 140 ++++++++++++++-------
     netwerk/base/src/nsProtocolProxyService.h          |  32 +++--
     netwerk/protocol/ftp/nsFtpConnectionThread.cpp     |  11 +-
     netwerk/protocol/http/nsHttpChannel.cpp            |   4 +-
     netwerk/protocol/http/nsHttpHandler.cpp            |  19 +--
     netwerk/test/unit/test_speculative_connect.js      |   4 +-
     17 files changed, 239 insertions(+), 108 deletions(-)
     create mode 100644 netwerk/base/public/nsIProtocolProxyChannelFilter.idl
    
    diff --git a/dom/plugins/base/nsPluginHost.cpp b/dom/plugins/base/nsPluginHost.cpp
    index c3c37ac..f295fce 100644
    a b nsresult nsPluginHost::FindProxyForURL(const char* url, char* *result) 
    653653  }
    654654  nsresult res;
    655655
    656   nsCOMPtr<nsIURI> uriIn;
    657656  nsCOMPtr<nsIProtocolProxyService> proxyService;
    658657  nsCOMPtr<nsIProtocolProxyService2> proxyService2;
    659658  nsCOMPtr<nsIIOService> ioService;
    nsresult nsPluginHost::FindProxyForURL(const char* url, char* *result) 
    670669  if (NS_FAILED(res) || !ioService)
    671670    return res;
    672671
    673   // make an nsURI from the argument url
    674   res = ioService->NewURI(nsDependentCString(url), nullptr, nullptr, getter_AddRefs(uriIn));
     672  // make a temporary channel from the argument url
     673  nsCOMPtr<nsIChannel> tempChannel;
     674  res = ioService->NewChannel(nsDependentCString(url), nullptr, nullptr, getter_AddRefs(tempChannel));
    675675  if (NS_FAILED(res))
    676676    return res;
    677677
    678678  nsCOMPtr<nsIProxyInfo> pi;
    679679
    680680  // Remove this with bug 778201
    681   res = proxyService2->DeprecatedBlockingResolve(uriIn, 0, getter_AddRefs(pi));
     681  res = proxyService2->DeprecatedBlockingResolve(tempChannel, 0, getter_AddRefs(pi));
    682682  if (NS_FAILED(res))
    683683    return res;
    684684
  • mobile/android/chrome/content/browser.js

    diff --git a/mobile/android/chrome/content/browser.js b/mobile/android/chrome/content/browser.js
    index b237121..a93f730 100644
    a b var BrowserEventHandler = { 
    40004000    if (closest) {
    40014001      let uri = this._getLinkURI(closest);
    40024002      if (uri) {
    4003         Services.io.QueryInterface(Ci.nsISpeculativeConnect).speculativeConnect(uri, null);
     4003        Services.io.QueryInterface(Ci.nsISpeculativeConnect).speculativeConnect(Services.io.newChannel(uri, null, null), null);
    40044004      }
    40054005      this._doTapHighlight(closest);
    40064006    }
  • netwerk/base/public/moz.build

    diff --git a/netwerk/base/public/moz.build b/netwerk/base/public/moz.build
    index 7676709..49eccea 100644
    a b XPIDL_SOURCES += [ 
    6464    'nsIPrompt.idl',
    6565    'nsIProtocolHandler.idl',
    6666    'nsIProtocolProxyCallback.idl',
     67    'nsIProtocolProxyChannelFilter.idl',
    6768    'nsIProtocolProxyFilter.idl',
    6869    'nsIProtocolProxyService.idl',
    6970    'nsIProtocolProxyService2.idl',
  • netwerk/base/public/nsIProtocolProxyCallback.idl

    diff --git a/netwerk/base/public/nsIProtocolProxyCallback.idl b/netwerk/base/public/nsIProtocolProxyCallback.idl
    index ca1ab51..96c2181 100644
    a b  
    66
    77#include "nsISupports.idl"
    88
    9 interface nsIURI;
     9interface nsIChannel;
    1010interface nsIProxyInfo;
    1111interface nsICancelable;
    1212
    interface nsICancelable; 
    1414 * This interface serves as a closure for nsIProtocolProxyService's
    1515 * asyncResolve method.
    1616 */
    17 [scriptable, uuid(a9967200-f95e-45c2-beb3-9b060d874bfd)]
     17[scriptable, uuid(fbb6eff6-0cc2-4d99-8d6f-0a12b462bdeb)]
    1818interface nsIProtocolProxyCallback : nsISupports
    1919{
    2020  /**
    interface nsIProtocolProxyCallback : nsISupports 
    2323   *
    2424   * @param aRequest
    2525   *        The value returned from asyncResolve.
    26    * @param aURI
    27    *        The URI passed to asyncResolve.
     26   * @param aChannel
     27   *        The channel passed to asyncResolve.
    2828   * @param aProxyInfo
    2929   *        The resulting proxy info or null if there is no associated proxy
    3030   *        info for aURI.  As with the result of nsIProtocolProxyService's
    interface nsIProtocolProxyCallback : nsISupports 
    3636   *        indicates the reason for the failure and aProxyInfo will be null.
    3737   */
    3838  void onProxyAvailable(in nsICancelable aRequest,
    39                         in nsIURI aURI,
     39                        in nsIChannel aChannel,
    4040                        in nsIProxyInfo aProxyInfo,
    4141                        in nsresult aStatus);
    4242};
  • new file netwerk/base/public/nsIProtocolProxyChannelFilter.idl

    diff --git a/netwerk/base/public/nsIProtocolProxyChannelFilter.idl b/netwerk/base/public/nsIProtocolProxyChannelFilter.idl
    new file mode 100644
    index 0000000..178750a
    - +  
     1/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2/* vim:set ts=2 sw=2 sts=2 et cindent: */
     3/* This Source Code Form is subject to the terms of the Mozilla Public
     4 * License, v. 2.0. If a copy of the MPL was not distributed with this
     5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6
     7#include "nsISupports.idl"
     8
     9interface nsIChannel;
     10interface nsIProtocolProxyService;
     11interface nsIProxyInfo;
     12
     13/**
     14 * This interface is used to apply filters to the proxies selected for a given
     15 * channel.  Use nsIProtocolProxyService::registerChannelFilter to hook up instances of
     16 * this interface.
     17 */
     18[scriptable, uuid(245b0880-82c5-4e6e-be6d-bc586aa55a90)]
     19interface nsIProtocolProxyChannelFilter : nsISupports
     20{
     21  /**
     22   * This method is called to apply proxy filter rules for the given channel
     23   * and proxy object (or list of proxy objects).
     24   *
     25   * @param aProxyService
     26   *        A reference to the Protocol Proxy Service.  This is passed so that
     27   *        implementations may easily access methods such as newProxyInfo.
     28   * @param aChannel
     29   *        The channel for which these proxy settings apply.
     30   * @param aProxy
     31   *        The proxy (or list of proxies) that would be used by default for
     32   *        the given channel. This may be null.
     33   *
     34   * @return The proxy (or list of proxies) that should be used in place of
     35   *         aProxy. This can be just be aProxy if the filter chooses not to
     36   *         modify the proxy. It can also be null to indicate that a direct
     37   *         connection should be used.  Use aProxyService.newProxyInfo to
     38   *         construct nsIProxyInfo objects.
     39   */
     40  nsIProxyInfo applyFilter(in nsIProtocolProxyService aProxyService,
     41                           in nsIChannel aChannel, in nsIProxyInfo aProxy);
     42};
  • netwerk/base/public/nsIProtocolProxyService.idl

    diff --git a/netwerk/base/public/nsIProtocolProxyService.idl b/netwerk/base/public/nsIProtocolProxyService.idl
    index 3506dde..ccc2cdf 100644
    a b  
    99interface nsICancelable;
    1010interface nsIProtocolProxyCallback;
    1111interface nsIProtocolProxyFilter;
     12interface nsIProtocolProxyChannelFilter;
    1213interface nsIProxyInfo;
    1314interface nsIChannel;
    1415interface nsIURI;
    interface nsIURI; 
    1718 * nsIProtocolProxyService provides methods to access information about
    1819 * various network proxies.
    1920 */
    20 [scriptable, uuid(e77c642b-026f-41ce-9b23-f829a6e3f300)]
     21[scriptable, uuid(ab363090-c331-489f-aabb-7fe4481795b8)]
    2122interface nsIProtocolProxyService : nsISupports
    2223{
    2324    /** Flag 1 << 0 is unused **/
    interface nsIProtocolProxyService : nsISupports 
    6465
    6566    /**
    6667     * This method returns via callback a nsIProxyInfo instance that identifies
    67      * a proxy to be used for loading the given URI.  Otherwise, this method returns
     68     * a proxy to be used for the given channel.  Otherwise, this method returns
    6869     * null indicating that a direct connection should be used.
    6970     *
    70      * @param aURI
    71      *        The URI to test.
     71     * @param aChannel
     72     *        The channel for which a proxy is to be found.
    7273     * @param aFlags
    7374     *        A bit-wise combination of the RESOLVE_ flags defined above.  Pass
    7475     *        0 to specify the default behavior.  Any additional bits that do
    interface nsIProtocolProxyService : nsISupports 
    9495     *
    9596     * @see nsIProxiedProtocolHandler::newProxiedChannel
    9697     */
    97     nsICancelable asyncResolve(in nsIURI aURI, in unsigned long aFlags,
     98    nsICancelable asyncResolve(in nsIChannel aChannel, in unsigned long aFlags,
    9899                               in nsIProtocolProxyCallback aCallback);
    99100
    100101    /**
    interface nsIProtocolProxyService : nsISupports 
    220221                        in unsigned long aPosition);
    221222
    222223    /**
     224     * Similar to registerFilter, but accepts an nsIProtocolProxyChannelFilter,
     225     * which selects proxies according to channel rather than URI.
     226     *
     227     * @param aFilter
     228     *        The nsIProtocolProxyChannelFilter instance to be registered.
     229     * @param aPosition
     230     *        The position of the filter.
     231     */
     232    void registerChannelFilter(in nsIProtocolProxyChannelFilter aFilter,
     233                               in unsigned long aPosition);
     234
     235    /**
    223236     * This method may be used to unregister a proxy filter instance.  All
    224237     * filters will be automatically unregistered at XPCOM shutdown.
    225238     *
    interface nsIProtocolProxyService : nsISupports 
    227240     *        The nsIProtocolProxyFilter instance to be unregistered.
    228241     */
    229242    void unregisterFilter(in nsIProtocolProxyFilter aFilter);
     243   
     244    /**
     245     * This method may be used to unregister a proxy channel filter instance.  All
     246     * filters will be automatically unregistered at XPCOM shutdown.
     247     *
     248     * @param aFilter
     249     *        The nsIProtocolProxyChannelFilter instance to be unregistered.
     250     */
     251    void unregisterChannelFilter(in nsIProtocolProxyChannelFilter aFilter);
    230252
    231253     /**
    232254      * These values correspond to the possible integer values for the
  • netwerk/base/public/nsIProtocolProxyService2.idl

    diff --git a/netwerk/base/public/nsIProtocolProxyService2.idl b/netwerk/base/public/nsIProtocolProxyService2.idl
    index 22b1a0a..af9e05a 100644
    a b  
    99/**
    1010 * An extension of nsIProtocolProxyService
    1111 */
    12 [scriptable, uuid(bed3702d-9374-4804-a20f-32baed8e2954)]
     12[scriptable, uuid(c4b1cbe3-9c01-4b50-8139-62068267f171)]
    1313interface nsIProtocolProxyService2 : nsIProtocolProxyService
    1414{
    1515  /**
    interface nsIProtocolProxyService2 : nsIProtocolProxyService 
    2525   *
    2626   * No documentation - it is deprecated!
    2727   **/
    28   nsIProxyInfo deprecatedBlockingResolve(in nsIURI aURI, in unsigned long aFlags);
     28  nsIProxyInfo deprecatedBlockingResolve(in nsIChannel aChannel, in unsigned long aFlags);
    2929};
  • netwerk/base/public/nsISpeculativeConnect.idl

    diff --git a/netwerk/base/public/nsISpeculativeConnect.idl b/netwerk/base/public/nsISpeculativeConnect.idl
    index f77628f..c741aa6 100644
    a b  
    55
    66#include "nsISupports.idl"
    77
    8 interface nsIURI;
     8interface nsIChannel;
    99interface nsIInterfaceRequestor;
    1010
    11 [scriptable, uuid(fa580a8d-f4a4-47c5-8ade-4f9786e8d1de)]
     11[scriptable, uuid(e52f0171-7287-49a7-8b44-bfa585eafd1d)]
    1212interface nsISpeculativeConnect : nsISupports
    1313{
    1414    /**
    interface nsISpeculativeConnect : nsISupports 
    2020     * No obligation is taken on by the implementer, nor is the submitter obligated
    2121     * to actually open the new channel.
    2222     *
    23      * @param aURI the URI of the hinted transaction
     23     * @param aChannel the channel of the hinted transaction
    2424     * @param aCallbacks any security callbacks for use with SSL for interfaces
    2525     *        such as nsIBadCertListener. May be null.
    2626     *
    2727     */
    28     void speculativeConnect(in nsIURI aURI,
     28    void speculativeConnect(in nsIChannel aChannel,
    2929                            in nsIInterfaceRequestor aCallbacks);
    3030
    3131};
  • netwerk/base/src/nsIOService.cpp

    diff --git a/netwerk/base/src/nsIOService.cpp b/netwerk/base/src/nsIOService.cpp
    index 9652c12..22e02da 100644
    a b private: 
    11981198NS_IMPL_ISUPPORTS1(IOServiceProxyCallback, nsIProtocolProxyCallback)
    11991199
    12001200NS_IMETHODIMP
    1201 IOServiceProxyCallback::OnProxyAvailable(nsICancelable *request, nsIURI *aURI,
     1201IOServiceProxyCallback::OnProxyAvailable(nsICancelable *request, nsIChannel *channel,
    12021202                                         nsIProxyInfo *pi, nsresult status)
    12031203{
    12041204    // Checking proxy status for speculative connect
    IOServiceProxyCallback::OnProxyAvailable(nsICancelable *request, nsIURI *aURI, 
    12101210        return NS_OK;
    12111211    }
    12121212
     1213    nsCOMPtr<nsIURI> uri;
     1214    channel->GetURI(getter_AddRefs(uri));
     1215
    12131216    nsAutoCString scheme;
    1214     nsresult rv = aURI->GetScheme(scheme);
     1217    nsresult rv = uri->GetScheme(scheme);
    12151218    if (NS_FAILED(rv))
    12161219        return NS_OK;
    12171220
    IOServiceProxyCallback::OnProxyAvailable(nsICancelable *request, nsIURI *aURI, 
    12261229    if (!speculativeHandler)
    12271230        return NS_OK;
    12281231
    1229     speculativeHandler->SpeculativeConnect(aURI,
     1232    speculativeHandler->SpeculativeConnect(channel,
    12301233                                           mCallbacks);
    12311234    return NS_OK;
    12321235}
    12331236
    12341237NS_IMETHODIMP
    1235 nsIOService::SpeculativeConnect(nsIURI *aURI,
     1238nsIOService::SpeculativeConnect(nsIChannel *aChannel,
    12361239                                nsIInterfaceRequestor *aCallbacks)
    12371240{
    12381241    // Check for proxy information. If there is a proxy configured then a
    nsIOService::SpeculativeConnect(nsIURI *aURI, 
    12471250    nsCOMPtr<nsICancelable> cancelable;
    12481251    nsRefPtr<IOServiceProxyCallback> callback =
    12491252        new IOServiceProxyCallback(aCallbacks, this);
    1250     return pps->AsyncResolve(aURI, 0, callback, getter_AddRefs(cancelable));
     1253    return pps->AsyncResolve(aChannel, 0, callback, getter_AddRefs(cancelable));
    12511254}
  • netwerk/base/src/nsPACMan.cpp

    diff --git a/netwerk/base/src/nsPACMan.cpp b/netwerk/base/src/nsPACMan.cpp
    index f3313d0..be401d0 100644
    a b nsPACMan::Shutdown() 
    297297}
    298298
    299299nsresult
    300 nsPACMan::AsyncGetProxyForURI(nsIURI *uri, nsPACManCallback *callback,
    301                               bool mainThreadResponse)
     300nsPACMan::AsyncGetProxyForChannel(nsIChannel *channel, nsPACManCallback *callback,
     301                                  bool mainThreadResponse)
    302302{
    303303  NS_ABORT_IF_FALSE(NS_IsMainThread(), "wrong thread");
    304304  if (mShutdown)
    nsPACMan::AsyncGetProxyForURI(nsIURI *uri, nsPACManCallback *callback, 
    309309      TimeStamp::Now() > mScheduledReload)
    310310    LoadPACFromURI(EmptyCString());
    311311
     312  nsCOMPtr<nsIURI> uri;
     313  channel->GetURI(getter_AddRefs(uri));
     314
    312315  nsRefPtr<PendingPACQuery> query =
    313316    new PendingPACQuery(this, uri, callback, mainThreadResponse);
    314317
  • netwerk/base/src/nsPACMan.h

    diff --git a/netwerk/base/src/nsPACMan.h b/netwerk/base/src/nsPACMan.h
    index 7d09282..12d845f 100644
    a b  
    2626class nsPACMan;
    2727
    2828/**
    29  * This class defines a callback interface used by AsyncGetProxyForURI.
     29 * This class defines a callback interface used by AsyncGetProxyForChannel.
    3030 */
    3131class NS_NO_VTABLE nsPACManCallback : public nsISupports
    3232{
    3333public:
    3434  /**
    35    * This method is invoked on the same thread that called AsyncGetProxyForURI.
     35   * This method is invoked on the same thread that called AsyncGetProxyForChannel.
    3636   *
    3737   * @param status
    3838   *        This parameter indicates whether or not the PAC query succeeded.
    public: 
    100100   * will queue up the request, and complete it once the PAC file has been
    101101   * loaded.
    102102   *
    103    * @param uri
    104    *        The URI to query.
     103   * @param channel
     104   *        The channel to query.
    105105   * @param callback
    106106   *        The callback to run once the PAC result is available.
    107107   * @param mustCallbackOnMainThread
    108108   *        If set to false the callback can be made from the PAC thread
    109109   */
    110   nsresult AsyncGetProxyForURI(nsIURI *uri, nsPACManCallback *callback,
     110  nsresult AsyncGetProxyForChannel(nsIChannel *channel, nsPACManCallback *callback,
    111111                               bool mustCallbackOnMainThread);
    112112
    113113  /**
  • netwerk/base/src/nsProtocolProxyService.cpp

    diff --git a/netwerk/base/src/nsProtocolProxyService.cpp b/netwerk/base/src/nsProtocolProxyService.cpp
    index 36e2f7d..2a925b1 100644
    a b  
    1616#include "nsIObserverService.h"
    1717#include "nsIProtocolHandler.h"
    1818#include "nsIProtocolProxyCallback.h"
     19#include "nsIChannel.h"
    1920#include "nsICancelable.h"
    2021#include "nsIDNSService.h"
    2122#include "nsPIDNSService.h"
    struct nsProtocolInfo { 
    6970//----------------------------------------------------------------------------
    7071
    7172// The nsPACManCallback portion of this implementation should be run
    72 // on the main thread - so call nsPACMan::AsyncGetProxyForURI() with
     73// on the main thread - so call nsPACMan::AsyncGetProxyForChannel() with
    7374// a true mainThreadResponse parameter.
    7475class nsAsyncResolveRequest MOZ_FINAL : public nsIRunnable
    7576                                      , public nsPACManCallback
    class nsAsyncResolveRequest MOZ_FINAL : public nsIRunnable 
    7879public:
    7980    NS_DECL_ISUPPORTS
    8081
    81     nsAsyncResolveRequest(nsProtocolProxyService *pps, nsIURI *uri,
     82    nsAsyncResolveRequest(nsProtocolProxyService *pps, nsIChannel *channel,
    8283                          uint32_t aResolveFlags,
    8384                          nsIProtocolProxyCallback *callback)
    8485        : mStatus(NS_OK)
    public: 
    8687        , mResolveFlags(aResolveFlags)
    8788        , mPPS(pps)
    8889        , mXPComPPS(pps)
    89         , mURI(uri)
     90        , mChannel(channel)
    9091        , mCallback(callback)
    9192    {
    9293        NS_ASSERTION(mCallback, "null callback");
    public: 
    102103            nsCOMPtr<nsIThread> mainThread;
    103104            NS_GetMainThread(getter_AddRefs(mainThread));
    104105
    105             if (mURI) {
    106                 nsIURI *forgettable;
    107                 mURI.forget(&forgettable);
     106            if (mChannel) {
     107                nsIChannel *forgettable;
     108                mChannel.forget(&forgettable);
    108109                NS_ProxyRelease(mainThread, forgettable, false);
    109110            }
    110111
    private: 
    209210        if (NS_SUCCEEDED(mStatus) && !mProxyInfo && !mPACString.IsEmpty()) {
    210211            mPPS->ProcessPACString(mPACString, mResolveFlags,
    211212                                   getter_AddRefs(mProxyInfo));
     213            nsCOMPtr<nsIURI> uri;
     214            mChannel->GetURI(getter_AddRefs(uri));
    212215
    213216            // Now apply proxy filters
    214217            nsProtocolInfo info;
    215             mStatus = mPPS->GetProtocolInfo(mURI, &info);
     218            mStatus = mPPS->GetProtocolInfo(uri, &info);
    216219            if (NS_SUCCEEDED(mStatus))
    217                 mPPS->ApplyFilters(mURI, info, mProxyInfo);
     220                mPPS->ApplyFilters(mChannel, info, mProxyInfo);
    218221            else
    219222                mProxyInfo = nullptr;
    220223
    221224            LOG(("pac thread callback %s\n", mPACString.get()));
    222225            if (NS_SUCCEEDED(mStatus))
    223226                mPPS->MaybeDisableDNSPrefetch(mProxyInfo);
    224             mCallback->OnProxyAvailable(this, mURI, mProxyInfo, mStatus);
     227            mCallback->OnProxyAvailable(this, mChannel, mProxyInfo, mStatus);
    225228        }
    226229        else if (NS_SUCCEEDED(mStatus) && !mPACURL.IsEmpty()) {
    227230            LOG(("pac thread callback indicates new pac file load\n"));
    private: 
    231234            if (NS_SUCCEEDED(rv)) {
    232235                // now that the load is triggered, we can resubmit the query
    233236                nsRefPtr<nsAsyncResolveRequest> newRequest =
    234                     new nsAsyncResolveRequest(mPPS, mURI, mResolveFlags, mCallback);
    235                 rv = mPPS->mPACMan->AsyncGetProxyForURI(mURI, newRequest, true);
     237                    new nsAsyncResolveRequest(mPPS, mChannel, mResolveFlags, mCallback);
     238                rv = mPPS->mPACMan->AsyncGetProxyForChannel(mChannel, newRequest, true);
    236239            }
    237240
    238241            if (NS_FAILED(rv))
    239                 mCallback->OnProxyAvailable(this, mURI, nullptr, rv);
     242                mCallback->OnProxyAvailable(this, mChannel, nullptr, rv);
    240243
    241244            // do not call onproxyavailable() in SUCCESS case - the newRequest will
    242245            // take care of that
    private: 
    245248            LOG(("pac thread callback did not provide information %X\n", mStatus));
    246249            if (NS_SUCCEEDED(mStatus))
    247250                mPPS->MaybeDisableDNSPrefetch(mProxyInfo);
    248             mCallback->OnProxyAvailable(this, mURI, mProxyInfo, mStatus);
     251            mCallback->OnProxyAvailable(this, mChannel, mProxyInfo, mStatus);
    249252        }
    250253
    251254        // We are on the main thread now and don't need these any more so
    private: 
    254257        mCallback = nullptr;  // in case the callback holds an owning ref to us
    255258        mPPS = nullptr;
    256259        mXPComPPS = nullptr;
    257         mURI = nullptr;
     260        mChannel = nullptr;
    258261        mProxyInfo = nullptr;
    259262    }
    260263
    private: 
    268271
    269272    nsProtocolProxyService            *mPPS;
    270273    nsCOMPtr<nsIProtocolProxyService>  mXPComPPS;
    271     nsCOMPtr<nsIURI>                   mURI;
     274    nsCOMPtr<nsIChannel>               mChannel;
    272275    nsCOMPtr<nsIProtocolProxyCallback> mCallback;
    273276    nsCOMPtr<nsIProxyInfo>             mProxyInfo;
    274277};
    nsProtocolProxyService::ReloadPAC() 
    974977// The nsPACManCallback portion of this implementation should be run
    975978// off the main thread, because it uses a condvar for signaling and
    976979// the main thread is blocking on that condvar -
    977 //  so call nsPACMan::AsyncGetProxyForURI() with
     980//  so call nsPACMan::AsyncGetProxyForChannel() with
    978981// a false mainThreadResponse parameter.
    979982class nsAsyncBridgeRequest MOZ_FINAL  : public nsPACManCallback
    980983{
    NS_IMPL_THREADSAFE_ISUPPORTS1(nsAsyncBridgeRequest, nsPACManCallback) 
    10221025
    10231026// nsIProtocolProxyService2
    10241027NS_IMETHODIMP
    1025 nsProtocolProxyService::DeprecatedBlockingResolve(nsIURI *aURI,
     1028nsProtocolProxyService::DeprecatedBlockingResolve(nsIChannel *aChannel,
    10261029                                                  uint32_t aFlags,
    10271030                                                  nsIProxyInfo **retval)
    10281031{
    1029     NS_ENSURE_ARG_POINTER(aURI);
     1032    NS_ENSURE_ARG_POINTER(aChannel);
     1033
     1034    nsCOMPtr<nsIURI> uri;
     1035    aChannel->GetURI(getter_AddRefs(uri));
    10301036
    10311037    nsProtocolInfo info;
    1032     nsresult rv = GetProtocolInfo(aURI, &info);
     1038    nsresult rv = GetProtocolInfo(uri, &info);
    10331039    if (NS_FAILED(rv))
    10341040        return rv;
    10351041
    nsProtocolProxyService::DeprecatedBlockingResolve(nsIURI *aURI, 
    10401046    // but if neither of them are in use, we can just do the work
    10411047    // right here and directly invoke the callback
    10421048
    1043     rv = Resolve_Internal(aURI, info, aFlags, &usePACThread, getter_AddRefs(pi));
     1049    rv = Resolve_Internal(aChannel, info, aFlags, &usePACThread, getter_AddRefs(pi));
    10441050    if (NS_FAILED(rv))
    10451051        return rv;
    10461052
    10471053    if (!usePACThread || !mPACMan) {
    1048         ApplyFilters(aURI, info, pi);
     1054        ApplyFilters(aChannel, info, pi);
    10491055        pi.forget(retval);
    10501056        return NS_OK;
    10511057    }
    nsProtocolProxyService::DeprecatedBlockingResolve(nsIURI *aURI, 
    10541060    // code, but block this thread on that completion.
    10551061    nsRefPtr<nsAsyncBridgeRequest> ctx = new nsAsyncBridgeRequest();
    10561062    ctx->Lock();
    1057     if (NS_SUCCEEDED(mPACMan->AsyncGetProxyForURI(aURI, ctx, false))) {
     1063    if (NS_SUCCEEDED(mPACMan->AsyncGetProxyForChannel(aChannel, ctx, false))) {
    10581064        // this can really block the main thread, so cap it at 3 seconds
    10591065       ctx->Wait();
    10601066    }
    nsProtocolProxyService::DeprecatedBlockingResolve(nsIURI *aURI, 
    10701076    if (!ctx->mPACString.IsEmpty()) {
    10711077        LOG(("sync pac thread callback %s\n", ctx->mPACString.get()));
    10721078        ProcessPACString(ctx->mPACString, 0, getter_AddRefs(pi));
    1073         ApplyFilters(aURI, info, pi);
     1079        ApplyFilters(aChannel, info, pi);
    10741080        pi.forget(retval);
    10751081        return NS_OK;
    10761082    }
    nsProtocolProxyService::DeprecatedBlockingResolve(nsIURI *aURI, 
    10951101
    10961102// nsIProtocolProxyService
    10971103NS_IMETHODIMP
    1098 nsProtocolProxyService::AsyncResolve(nsIURI *uri, uint32_t flags,
     1104nsProtocolProxyService::AsyncResolve(nsIChannel *channel, uint32_t flags,
    10991105                                     nsIProtocolProxyCallback *callback,
    11001106                                     nsICancelable **result)
    11011107{
    1102     NS_ENSURE_ARG_POINTER(uri);
     1108    NS_ENSURE_ARG_POINTER(channel);
    11031109    NS_ENSURE_ARG_POINTER(callback);
     1110   
     1111    nsCOMPtr<nsIURI> uri;
     1112    channel->GetURI(getter_AddRefs(uri));
    11041113
    11051114    nsRefPtr<nsAsyncResolveRequest> ctx =
    1106         new nsAsyncResolveRequest(this, uri, flags, callback);
     1115        new nsAsyncResolveRequest(this, channel, flags, callback);
    11071116
    11081117    nsProtocolInfo info;
    11091118    nsresult rv = GetProtocolInfo(uri, &info);
    nsProtocolProxyService::AsyncResolve(nsIURI *uri, uint32_t flags, 
    11171126    // but if neither of them are in use, we can just do the work
    11181127    // right here and directly invoke the callback
    11191128
    1120     rv = Resolve_Internal(uri, info, flags, &usePACThread, getter_AddRefs(pi));
     1129    rv = Resolve_Internal(channel, info, flags, &usePACThread, getter_AddRefs(pi));
    11211130    if (NS_FAILED(rv))
    11221131        return rv;
    11231132
    11241133    if (!usePACThread || !mPACMan) {
    11251134        // we can do it locally
    1126         ApplyFilters(uri, info, pi);
     1135        ApplyFilters(channel, info, pi);
    11271136        ctx->SetResult(NS_OK, pi);
    11281137        return ctx->DispatchCallback();
    11291138    }
    11301139
    11311140    // else kick off a PAC thread query
    11321141
    1133     rv = mPACMan->AsyncGetProxyForURI(uri, ctx, true);
     1142    rv = mPACMan->AsyncGetProxyForChannel(channel, ctx, true);
    11341143    if (NS_SUCCEEDED(rv)) {
    11351144        *result = ctx;
    11361145        NS_ADDREF(*result);
    nsProtocolProxyService::GetFailoverForProxy(nsIProxyInfo *aProxy, 
    12221231    return NS_OK;
    12231232}
    12241233
    1225 NS_IMETHODIMP
    1226 nsProtocolProxyService::RegisterFilter(nsIProtocolProxyFilter *filter,
    1227                                        uint32_t position)
     1234nsresult
     1235nsProtocolProxyService::InsertFilterLink(FilterLink *link, uint32_t position)
    12281236{
    1229     UnregisterFilter(filter);  // remove this filter if we already have it
    1230 
    1231     FilterLink *link = new FilterLink(position, filter);
    1232     if (!link)
    1233         return NS_ERROR_OUT_OF_MEMORY;
    1234 
    12351237    if (!mFilters) {
    12361238        mFilters = link;
    12371239        return NS_OK;
    nsProtocolProxyService::RegisterFilter(nsIProtocolProxyFilter *filter, 
    12591261}
    12601262
    12611263NS_IMETHODIMP
    1262 nsProtocolProxyService::UnregisterFilter(nsIProtocolProxyFilter *filter)
     1264nsProtocolProxyService::RegisterFilter(nsIProtocolProxyFilter *filter,
     1265                                       uint32_t position)
    12631266{
    1264     // QI to nsISupports so we can safely test object identity.
    1265     nsCOMPtr<nsISupports> givenObject = do_QueryInterface(filter);
     1267    UnregisterFilter(filter); // remove this filter if we already have it
     1268   
     1269    FilterLink *link = new FilterLink(position, filter);
     1270    if (!link)
     1271        return NS_ERROR_OUT_OF_MEMORY;
     1272    return InsertFilterLink(link, position);
     1273}
    12661274
     1275NS_IMETHODIMP
     1276nsProtocolProxyService::RegisterChannelFilter(nsIProtocolProxyChannelFilter *channelFilter,
     1277                                              uint32_t position)
     1278{
     1279    UnregisterChannelFilter(channelFilter);  // remove this filter if we already have it
     1280
     1281    FilterLink *link = new FilterLink(position, channelFilter);
     1282    if (!link)
     1283        return NS_ERROR_OUT_OF_MEMORY;
     1284    return InsertFilterLink(link, position);
     1285}
     1286
     1287nsresult
     1288nsProtocolProxyService::RemoveFilterLink(nsISupports* givenObject)
     1289{
    12671290    FilterLink *last = nullptr;
    12681291    for (FilterLink *iter = mFilters; iter; iter = iter->next) {
    12691292        nsCOMPtr<nsISupports> object = do_QueryInterface(iter->filter);
    nsProtocolProxyService::UnregisterFilter(nsIProtocolProxyFilter *filter) 
    12841307}
    12851308
    12861309NS_IMETHODIMP
     1310nsProtocolProxyService::UnregisterFilter(nsIProtocolProxyFilter *filter) {
     1311    // QI to nsISupports so we can safely test object identity.
     1312    nsCOMPtr<nsISupports> givenObject = do_QueryInterface(filter);
     1313    return RemoveFilterLink(givenObject);
     1314}
     1315
     1316NS_IMETHODIMP
     1317nsProtocolProxyService::UnregisterChannelFilter(nsIProtocolProxyChannelFilter *channelFilter) {
     1318    // QI to nsISupports so we can safely test object identity.
     1319    nsCOMPtr<nsISupports> givenObject = do_QueryInterface(channelFilter);
     1320    return RemoveFilterLink(givenObject);
     1321}
     1322
     1323NS_IMETHODIMP
    12871324nsProtocolProxyService::GetProxyConfigType(uint32_t* aProxyConfigType)
    12881325{
    12891326  *aProxyConfigType = mProxyConfig;
    nsProtocolProxyService::NewProxyInfo_Internal(const char *aType, 
    14971534}
    14981535
    14991536nsresult
    1500 nsProtocolProxyService::Resolve_Internal(nsIURI *uri,
     1537nsProtocolProxyService::Resolve_Internal(nsIChannel *channel,
    15011538                                         const nsProtocolInfo &info,
    15021539                                         uint32_t flags,
    15031540                                         bool *usePACThread,
    15041541                                         nsIProxyInfo **result)
    15051542{
    1506     NS_ENSURE_ARG_POINTER(uri);
     1543    NS_ENSURE_ARG_POINTER(channel);
    15071544    nsresult rv = SetupPACThread();
    15081545    if (NS_FAILED(rv))
    15091546        return rv;
    nsProtocolProxyService::Resolve_Internal(nsIURI *uri, 
    15141551    if (!(info.flags & nsIProtocolHandler::ALLOWS_PROXY))
    15151552        return NS_OK;  // Can't proxy this (filters may not override)
    15161553
     1554    nsCOMPtr<nsIURI> uri;
     1555    channel->GetURI(getter_AddRefs(uri));
     1556
    15171557    // See bug #586908.
    15181558    // Avoid endless loop if |uri| is the current PAC-URI. Returning OK
    15191559    // here means that we will not use a proxy for this connection.
    nsProtocolProxyService::MaybeDisableDNSPrefetch(nsIProxyInfo *aProxy) 
    16841724}
    16851725
    16861726void
    1687 nsProtocolProxyService::ApplyFilters(nsIURI *uri, const nsProtocolInfo &info,
     1727nsProtocolProxyService::ApplyFilters(nsIChannel *channel, const nsProtocolInfo &info,
    16881728                                     nsIProxyInfo **list)
    16891729{
    16901730    if (!(info.flags & nsIProtocolHandler::ALLOWS_PROXY))
    nsProtocolProxyService::ApplyFilters(nsIURI *uri, const nsProtocolInfo &info, 
    16991739
    17001740    for (FilterLink *iter = mFilters; iter; iter = iter->next) {
    17011741        PruneProxyInfo(info, list);
    1702 
    1703         rv = iter->filter->ApplyFilter(this, uri, *list,
    1704                                        getter_AddRefs(result));
     1742        if (!!iter->filter) {
     1743          nsCOMPtr<nsIURI> uri;
     1744          channel->GetURI(getter_AddRefs(uri));
     1745          rv = iter->filter->ApplyFilter(this, uri, *list,
     1746                                         getter_AddRefs(result));
     1747        } else if (!!iter->channelFilter) {
     1748          rv = iter->channelFilter->ApplyFilter(this, channel, *list,
     1749                                                getter_AddRefs(result));
     1750        }
    17051751        if (NS_FAILED(rv))
    17061752            continue;
    17071753        result.swap(*list);
  • netwerk/base/src/nsProtocolProxyService.h

    diff --git a/netwerk/base/src/nsProtocolProxyService.h b/netwerk/base/src/nsProtocolProxyService.h
    index f9afde0..e810e03 100644
    a b  
    1313#include "nsIPrefBranch.h"
    1414#include "nsIProtocolProxyService2.h"
    1515#include "nsIProtocolProxyFilter.h"
     16#include "nsIProtocolProxyChannelFilter.h"
    1617#include "nsISystemProxySettings.h"
    1718#include "nsIProxyInfo.h"
    1819#include "nsIObserver.h"
    protected: 
    199200     * caller with either the proxy info result or a flag to instruct the
    200201     * caller to use PAC instead.
    201202     *
    202      * @param uri
    203      *        The URI to test.
     203     * @param channel
     204     *        The channel to test.
    204205     * @param info
    205206     *        Information about the URI's protocol.
    206207     * @param flags
    protected: 
    211212     * @param result
    212213     *        The resulting proxy info or null.
    213214     */
    214     NS_HIDDEN_(nsresult) Resolve_Internal(nsIURI *uri,
     215    NS_HIDDEN_(nsresult) Resolve_Internal(nsIChannel *channel,
    215216                                          const nsProtocolInfo &info,
    216217                                          uint32_t flags,
    217218                                          bool *usePAC,
    protected: 
    228229     * @param proxyInfo
    229230     *        The proxy info list to be modified.  This is an inout param.
    230231     */
    231     NS_HIDDEN_(void) ApplyFilters(nsIURI *uri, const nsProtocolInfo &info,
     232    NS_HIDDEN_(void) ApplyFilters(nsIChannel *channel, const nsProtocolInfo &info,
    232233                                  nsIProxyInfo **proxyInfo);
    233234
    234235    /**
    235236     * This method is a simple wrapper around ApplyFilters that takes the
    236237     * proxy info list inout param as a nsCOMPtr.
    237238     */
    238     inline void ApplyFilters(nsIURI *uri, const nsProtocolInfo &info,
     239    inline void ApplyFilters(nsIChannel *channel, const nsProtocolInfo &info,
    239240                             nsCOMPtr<nsIProxyInfo> &proxyInfo)
    240241    {
    241242      nsIProxyInfo *pi = nullptr;
    242243      proxyInfo.swap(pi);
    243       ApplyFilters(uri, info, &pi);
     244      ApplyFilters(channel, info, &pi);
    244245      proxyInfo.swap(pi);
    245246    }
    246247
    protected: 
    287288private:
    288289    nsresult SetupPACThread();
    289290    nsresult ResetPACThread();
    290 
     291 
    291292public:
    292293    // The Sun Forte compiler and others implement older versions of the
    293294    // C++ standard's rules on access and nested classes.  These structs
    protected: 
    324325        }
    325326    };
    326327
    327     // This structure is allocated for each registered nsIProtocolProxyFilter.
     328    // This structure is allocated for each registered nsIProtocolProxyChannelFilter.
    328329    struct FilterLink {
    329330      struct FilterLink                *next;
    330331      uint32_t                          position;
    331       nsCOMPtr<nsIProtocolProxyFilter>  filter;
    332 
     332      nsCOMPtr<nsIProtocolProxyFilter> filter;
     333      nsCOMPtr<nsIProtocolProxyChannelFilter> channelFilter;
    333334      FilterLink(uint32_t p, nsIProtocolProxyFilter *f)
    334         : next(nullptr), position(p), filter(f) {}
    335 
     335        : next(nullptr), position(p), filter(f), channelFilter(nullptr) {}
     336      FilterLink(uint32_t p, nsIProtocolProxyChannelFilter *cf)
     337        : next(nullptr), position(p), filter(nullptr), channelFilter(cf) {}
    336338      // Chain deletion to simplify cleaning up the filter links
    337339      ~FilterLink() { if (next) delete next; }
    338340    };
    339341
     342private:
     343    // Private methods to insert and remove FilterLinks from the FilterLink chain.
     344    nsresult InsertFilterLink(FilterLink *link, uint32_t position);
     345    nsresult RemoveFilterLink(nsISupports *givenObject);
     346
     347protected:
    340348    // Indicates if local hosts (plain hostnames, no dots) should use the proxy
    341349    bool mFilterLocalHosts;
    342350
  • netwerk/protocol/ftp/nsFtpConnectionThread.cpp

    diff --git a/netwerk/protocol/ftp/nsFtpConnectionThread.cpp b/netwerk/protocol/ftp/nsFtpConnectionThread.cpp
    index 1e5021c..8ada9e3 100644
    a b nsFtpState::Init(nsFtpChannel *channel) 
    17791779        do_GetService(NS_PROTOCOLPROXYSERVICE_CONTRACTID);
    17801780
    17811781    if (pps && !mChannel->ProxyInfo()) {
    1782         pps->AsyncResolve(mChannel->URI(), 0, this,
     1782        pps->AsyncResolve(mChannel, 0, this,
    17831783                          getter_AddRefs(mProxyRequest));
    17841784    }
    17851785
    nsFtpState::CloseWithStatus(nsresult status) 
    22092209}
    22102210
    22112211static nsresult
    2212 CreateHTTPProxiedChannel(nsIURI *uri, nsIProxyInfo *pi, nsIChannel **newChannel)
     2212CreateHTTPProxiedChannel(nsIChannel *channel, nsIProxyInfo *pi, nsIChannel **newChannel)
    22132213{
    22142214    nsresult rv;
    22152215    nsCOMPtr<nsIIOService> ioService = do_GetIOService(&rv);
    CreateHTTPProxiedChannel(nsIURI *uri, nsIProxyInfo *pi, nsIChannel **newChannel) 
    22252225    if (NS_FAILED(rv))
    22262226        return rv;
    22272227
     2228    nsCOMPtr<nsIURI> uri;
     2229    channel->GetURI(getter_AddRefs(uri));
     2230
    22282231    return pph->NewProxiedChannel(uri, pi, 0, nullptr, newChannel);
    22292232}
    22302233
    22312234NS_IMETHODIMP
    2232 nsFtpState::OnProxyAvailable(nsICancelable *request, nsIURI *uri,
     2235nsFtpState::OnProxyAvailable(nsICancelable *request, nsIChannel *channel,
    22332236                             nsIProxyInfo *pi, nsresult status)
    22342237{
    22352238  mProxyRequest = nullptr;
    nsFtpState::OnProxyAvailable(nsICancelable *request, nsIURI *uri, 
    22462249        LOG(("FTP:(%p) Configured to use a HTTP proxy channel\n", this));
    22472250
    22482251        nsCOMPtr<nsIChannel> newChannel;
    2249         if (NS_SUCCEEDED(CreateHTTPProxiedChannel(uri, pi,
     2252        if (NS_SUCCEEDED(CreateHTTPProxiedChannel(channel, pi,
    22502253                                                  getter_AddRefs(newChannel))) &&
    22512254            NS_SUCCEEDED(mChannel->Redirect(newChannel,
    22522255                                            nsIChannelEventSink::REDIRECT_INTERNAL,
  • netwerk/protocol/http/nsHttpChannel.cpp

    diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp
    index 89f14a8..3653356 100644
    a b nsHttpChannel::ResolveProxy() 
    17751775    if (NS_FAILED(rv))
    17761776        return rv;
    17771777
    1778     return pps->AsyncResolve(mProxyURI ? mProxyURI : mURI, mProxyResolveFlags,
     1778    return pps->AsyncResolve(this, mProxyResolveFlags,
    17791779                             this, getter_AddRefs(mProxyRequest));
    17801780}
    17811781
    nsHttpChannel::SetPriority(int32_t value) 
    45854585//-----------------------------------------------------------------------------
    45864586
    45874587NS_IMETHODIMP
    4588 nsHttpChannel::OnProxyAvailable(nsICancelable *request, nsIURI *uri,
     4588nsHttpChannel::OnProxyAvailable(nsICancelable *request, nsIChannel *channel,
    45894589                                nsIProxyInfo *pi, nsresult status)
    45904590{
    45914591    LOG(("nsHttpChannel::OnProxyAvailable [this=%p pi=%p status=%x mStatus=%x]\n",
  • netwerk/protocol/http/nsHttpHandler.cpp

    diff --git a/netwerk/protocol/http/nsHttpHandler.cpp b/netwerk/protocol/http/nsHttpHandler.cpp
    index 1b27116..93aebc5 100644
    a b nsHttpHandler::Observe(nsISupports *subject, 
    18261826// nsISpeculativeConnect
    18271827
    18281828NS_IMETHODIMP
    1829 nsHttpHandler::SpeculativeConnect(nsIURI *aURI,
     1829nsHttpHandler::SpeculativeConnect(nsIChannel *aChannel,
    18301830                                  nsIInterfaceRequestor *aCallbacks)
    18311831{
    18321832    nsIStrictTransportSecurityService* stss = gHttpHandler->GetSTSService();
    nsHttpHandler::SpeculativeConnect(nsIURI *aURI, 
    18341834    if (!stss)
    18351835        return NS_OK;
    18361836
     1837    nsCOMPtr<nsIURI> uri;
     1838    aChannel->GetURI(getter_AddRefs(uri));
     1839
    18371840    nsCOMPtr<nsILoadContext> loadContext = do_GetInterface(aCallbacks);
    18381841    uint32_t flags = 0;
    18391842    if (loadContext && loadContext->UsePrivateBrowsing())
    18401843        flags |= nsISocketProvider::NO_PERMANENT_STORAGE;
    18411844    nsCOMPtr<nsIURI> clone;
    1842     if (NS_SUCCEEDED(stss->IsStsURI(aURI, flags, &isStsHost)) && isStsHost) {
    1843         if (NS_SUCCEEDED(aURI->Clone(getter_AddRefs(clone)))) {
     1845    if (NS_SUCCEEDED(stss->IsStsURI(uri, flags, &isStsHost)) && isStsHost) {
     1846        if (NS_SUCCEEDED(uri->Clone(getter_AddRefs(clone)))) {
    18441847            clone->SetScheme(NS_LITERAL_CSTRING("https"));
    1845             aURI = clone.get();
     1848            uri = clone.get();
    18461849        }
    18471850    }
    18481851
    18491852    nsAutoCString scheme;
    1850     nsresult rv = aURI->GetScheme(scheme);
     1853    nsresult rv = uri->GetScheme(scheme);
    18511854    if (NS_FAILED(rv))
    18521855        return rv;
    18531856
    nsHttpHandler::SpeculativeConnect(nsIURI *aURI, 
    18651868
    18661869    // Construct connection info object
    18671870    bool usingSSL = false;
    1868     rv = aURI->SchemeIs("https", &usingSSL);
     1871    rv = uri->SchemeIs("https", &usingSSL);
    18691872    if (NS_FAILED(rv))
    18701873        return rv;
    18711874
    18721875    nsAutoCString host;
    1873     rv = aURI->GetAsciiHost(host);
     1876    rv = uri->GetAsciiHost(host);
    18741877    if (NS_FAILED(rv))
    18751878        return rv;
    18761879
    18771880    int32_t port = -1;
    1878     rv = aURI->GetPort(&port);
     1881    rv = uri->GetPort(&port);
    18791882    if (NS_FAILED(rv))
    18801883        return rv;
    18811884
  • netwerk/test/unit/test_speculative_connect.js

    diff --git a/netwerk/test/unit/test_speculative_connect.js b/netwerk/test/unit/test_speculative_connect.js
    index 364333f..6137099 100644
    a b function run_test() { 
    3434        .getService(Ci.nsIIOService);   
    3535
    3636    serv = new TestServer();
    37     URI = ios.newURI("http://localhost:4444/just/a/test", null, null);
     37    channel = ios.newChannel("http://localhost:4444/just/a/test", null, null);
    3838    ios.QueryInterface(Components.interfaces.nsISpeculativeConnect)
    39         .speculativeConnect(URI, null);
     39        .speculativeConnect(channel, null);
    4040    do_test_pending();
    4141}
    4242