LCOV - code coverage report
Current view: top level - netwerk/protocol/http - NullHttpChannel.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 338 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 143 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* This Source Code Form is subject to the terms of the Mozilla Public
       2             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       3             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       4             : 
       5             : #include "NullHttpChannel.h"
       6             : #include "nsContentUtils.h"
       7             : #include "nsContentSecurityManager.h"
       8             : #include "nsIScriptSecurityManager.h"
       9             : #include "nsIStreamListener.h"
      10             : 
      11             : namespace mozilla {
      12             : namespace net {
      13             : 
      14           0 : NS_IMPL_ISUPPORTS(NullHttpChannel, nsINullChannel,
      15             :                   nsIHttpChannel, nsITimedChannel)
      16             : 
      17           0 : NullHttpChannel::NullHttpChannel()
      18             : {
      19           0 :   mChannelCreationTime = PR_Now();
      20           0 :   mChannelCreationTimestamp = TimeStamp::Now();
      21           0 :   mAsyncOpenTime = TimeStamp::Now();
      22           0 : }
      23             : 
      24           0 : NullHttpChannel::NullHttpChannel(nsIHttpChannel * chan)
      25             : {
      26           0 :   nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
      27           0 :   ssm->GetChannelURIPrincipal(chan, getter_AddRefs(mResourcePrincipal));
      28             : 
      29           0 :   Unused << chan->GetResponseHeader(NS_LITERAL_CSTRING("Timing-Allow-Origin"),
      30           0 :                                     mTimingAllowOriginHeader);
      31           0 :   chan->GetURI(getter_AddRefs(mURI));
      32           0 :   chan->GetOriginalURI(getter_AddRefs(mOriginalURI));
      33             : 
      34           0 :   mChannelCreationTime = PR_Now();
      35           0 :   mChannelCreationTimestamp = TimeStamp::Now();
      36           0 :   mAsyncOpenTime = TimeStamp::Now();
      37             : 
      38           0 :   nsCOMPtr<nsITimedChannel> timedChanel(do_QueryInterface(chan));
      39           0 :   if (timedChanel) {
      40           0 :     timedChanel->GetInitiatorType(mInitiatorType);
      41             :   }
      42           0 : }
      43             : 
      44             : nsresult
      45           0 : NullHttpChannel::Init(nsIURI *aURI,
      46             :                       uint32_t aCaps,
      47             :                       nsProxyInfo *aProxyInfo,
      48             :                       uint32_t aProxyResolveFlags,
      49             :                       nsIURI *aProxyURI)
      50             : {
      51           0 :   mURI = aURI;
      52           0 :   mOriginalURI = aURI;
      53           0 :   return NS_OK;
      54             : }
      55             : 
      56             : //-----------------------------------------------------------------------------
      57             : // NullHttpChannel::nsIHttpChannel
      58             : //-----------------------------------------------------------------------------
      59             : 
      60             : NS_IMETHODIMP
      61           0 : NullHttpChannel::GetChannelId(uint64_t *aChannelId)
      62             : {
      63           0 :     return NS_ERROR_NOT_IMPLEMENTED;
      64             : }
      65             : 
      66             : NS_IMETHODIMP
      67           0 : NullHttpChannel::SetChannelId(uint64_t aChannelId)
      68             : {
      69           0 :     return NS_ERROR_NOT_IMPLEMENTED;
      70             : }
      71             : 
      72             : NS_IMETHODIMP
      73           0 : NullHttpChannel::GetTopLevelContentWindowId(uint64_t *aWindowId)
      74             : {
      75           0 :     return NS_ERROR_NOT_IMPLEMENTED;
      76             : }
      77             : 
      78             : NS_IMETHODIMP
      79           0 : NullHttpChannel::SetTopLevelContentWindowId(uint64_t aWindowId)
      80             : {
      81           0 :     return NS_ERROR_NOT_IMPLEMENTED;
      82             : }
      83             : 
      84             : NS_IMETHODIMP
      85           0 : NullHttpChannel::GetTopLevelOuterContentWindowId(uint64_t *aWindowId)
      86             : {
      87           0 :     return NS_ERROR_NOT_IMPLEMENTED;
      88             : }
      89             : 
      90             : NS_IMETHODIMP
      91           0 : NullHttpChannel::SetTopLevelOuterContentWindowId(uint64_t aWindowId)
      92             : {
      93           0 :     return NS_ERROR_NOT_IMPLEMENTED;
      94             : }
      95             : 
      96             : NS_IMETHODIMP
      97           0 : NullHttpChannel::GetIsTrackingResource(bool* aIsTrackingResource)
      98             : {
      99           0 :     return NS_ERROR_NOT_IMPLEMENTED;
     100             : }
     101             : 
     102             : NS_IMETHODIMP
     103           0 : NullHttpChannel::GetTransferSize(uint64_t *aTransferSize)
     104             : {
     105           0 :     return NS_ERROR_NOT_IMPLEMENTED;
     106             : }
     107             : 
     108             : NS_IMETHODIMP
     109           0 : NullHttpChannel::GetDecodedBodySize(uint64_t *aDecodedBodySize)
     110             : {
     111           0 :     return NS_ERROR_NOT_IMPLEMENTED;
     112             : }
     113             : 
     114             : NS_IMETHODIMP
     115           0 : NullHttpChannel::GetRequestMethod(nsACString & aRequestMethod)
     116             : {
     117           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     118             : }
     119             : 
     120             : NS_IMETHODIMP
     121           0 : NullHttpChannel::SetRequestMethod(const nsACString & aRequestMethod)
     122             : {
     123           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     124             : }
     125             : 
     126             : NS_IMETHODIMP
     127           0 : NullHttpChannel::GetReferrer(nsIURI * *aReferrer)
     128             : {
     129           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     130             : }
     131             : 
     132             : NS_IMETHODIMP
     133           0 : NullHttpChannel::SetReferrer(nsIURI *aReferrer)
     134             : {
     135           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     136             : }
     137             : 
     138             : NS_IMETHODIMP
     139           0 : NullHttpChannel::GetReferrerPolicy(uint32_t *aReferrerPolicy)
     140             : {
     141           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     142             : }
     143             : 
     144             : NS_IMETHODIMP
     145           0 : NullHttpChannel::SetReferrerWithPolicy(nsIURI *referrer, uint32_t referrerPolicy)
     146             : {
     147           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     148             : }
     149             : 
     150             : NS_IMETHODIMP
     151           0 : NullHttpChannel::GetRequestHeader(const nsACString & aHeader, nsACString & _retval)
     152             : {
     153           0 :   _retval.Truncate();
     154           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     155             : }
     156             : 
     157             : NS_IMETHODIMP
     158           0 : NullHttpChannel::SetRequestHeader(const nsACString & aHeader, const nsACString & aValue, bool aMerge)
     159             : {
     160           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     161             : }
     162             : 
     163             : NS_IMETHODIMP
     164           0 : NullHttpChannel::SetEmptyRequestHeader(const nsACString & aHeader)
     165             : {
     166           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     167             : }
     168             : 
     169             : NS_IMETHODIMP
     170           0 : NullHttpChannel::VisitRequestHeaders(nsIHttpHeaderVisitor *aVisitor)
     171             : {
     172           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     173             : }
     174             : 
     175             : NS_IMETHODIMP
     176           0 : NullHttpChannel::VisitNonDefaultRequestHeaders(nsIHttpHeaderVisitor *aVisitor)
     177             : {
     178           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     179             : }
     180             : 
     181             : NS_IMETHODIMP
     182           0 : NullHttpChannel::GetAllowPipelining(bool *aAllowPipelining)
     183             : {
     184           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     185             : }
     186             : 
     187             : NS_IMETHODIMP
     188           0 : NullHttpChannel::SetAllowPipelining(bool aAllowPipelining)
     189             : {
     190           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     191             : }
     192             : 
     193             : NS_IMETHODIMP
     194           0 : NullHttpChannel::GetAllowSTS(bool *aAllowSTS)
     195             : {
     196           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     197             : }
     198             : 
     199             : NS_IMETHODIMP
     200           0 : NullHttpChannel::SetAllowSTS(bool aAllowSTS)
     201             : {
     202           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     203             : }
     204             : 
     205             : NS_IMETHODIMP
     206           0 : NullHttpChannel::GetRedirectionLimit(uint32_t *aRedirectionLimit)
     207             : {
     208           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     209             : }
     210             : 
     211             : NS_IMETHODIMP
     212           0 : NullHttpChannel::SetRedirectionLimit(uint32_t aRedirectionLimit)
     213             : {
     214           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     215             : }
     216             : 
     217             : NS_IMETHODIMP
     218           0 : NullHttpChannel::GetResponseStatus(uint32_t *aResponseStatus)
     219             : {
     220           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     221             : }
     222             : 
     223             : NS_IMETHODIMP
     224           0 : NullHttpChannel::GetResponseStatusText(nsACString & aResponseStatusText)
     225             : {
     226           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     227             : }
     228             : 
     229             : NS_IMETHODIMP
     230           0 : NullHttpChannel::GetRequestSucceeded(bool *aRequestSucceeded)
     231             : {
     232           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     233             : }
     234             : 
     235             : NS_IMETHODIMP
     236           0 : NullHttpChannel::GetResponseHeader(const nsACString & header, nsACString & _retval)
     237             : {
     238           0 :   _retval.Truncate();
     239           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     240             : }
     241             : 
     242             : NS_IMETHODIMP
     243           0 : NullHttpChannel::SetResponseHeader(const nsACString & header, const nsACString & value, bool merge)
     244             : {
     245           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     246             : }
     247             : 
     248             : NS_IMETHODIMP
     249           0 : NullHttpChannel::VisitResponseHeaders(nsIHttpHeaderVisitor *aVisitor)
     250             : {
     251           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     252             : }
     253             : 
     254             : NS_IMETHODIMP
     255           0 : NullHttpChannel::GetOriginalResponseHeader(const nsACString & header,
     256             :                                             nsIHttpHeaderVisitor *aVisitor)
     257             : {
     258           0 :     return NS_ERROR_NOT_IMPLEMENTED;
     259             : }
     260             : 
     261             : NS_IMETHODIMP
     262           0 : NullHttpChannel::VisitOriginalResponseHeaders(nsIHttpHeaderVisitor *aVisitor)
     263             : {
     264           0 :     return NS_ERROR_NOT_IMPLEMENTED;
     265             : }
     266             : 
     267             : NS_IMETHODIMP
     268           0 : NullHttpChannel::IsNoStoreResponse(bool *_retval)
     269             : {
     270           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     271             : }
     272             : 
     273             : NS_IMETHODIMP
     274           0 : NullHttpChannel::IsNoCacheResponse(bool *_retval)
     275             : {
     276           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     277             : }
     278             : 
     279             : NS_IMETHODIMP
     280           0 : NullHttpChannel::IsPrivateResponse(bool *_retval)
     281             : {
     282           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     283             : }
     284             : 
     285             : NS_IMETHODIMP
     286           0 : NullHttpChannel::RedirectTo(nsIURI *aNewURI)
     287             : {
     288           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     289             : }
     290             : 
     291             : NS_IMETHODIMP
     292           0 : NullHttpChannel::GetRequestContextID(uint64_t *_retval)
     293             : {
     294           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     295             : }
     296             : 
     297             : NS_IMETHODIMP
     298           0 : NullHttpChannel::SetRequestContextID(uint64_t rcID)
     299             : {
     300           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     301             : }
     302             : 
     303             : NS_IMETHODIMP
     304           0 : NullHttpChannel::GetProtocolVersion(nsACString& aProtocolVersion)
     305             : {
     306           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     307             : }
     308             : 
     309             : NS_IMETHODIMP
     310           0 : NullHttpChannel::GetEncodedBodySize(uint64_t *aEncodedBodySize)
     311             : {
     312           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     313             : }
     314             : 
     315             : //-----------------------------------------------------------------------------
     316             : // NullHttpChannel::nsIChannel
     317             : //-----------------------------------------------------------------------------
     318             : 
     319             : NS_IMETHODIMP
     320           0 : NullHttpChannel::GetOriginalURI(nsIURI * *aOriginalURI)
     321             : {
     322           0 :   NS_IF_ADDREF(*aOriginalURI = mOriginalURI);
     323           0 :   return NS_OK;
     324             : }
     325             : 
     326             : NS_IMETHODIMP
     327           0 : NullHttpChannel::SetOriginalURI(nsIURI *aOriginalURI)
     328             : {
     329           0 :   mOriginalURI = aOriginalURI;
     330           0 :   return NS_OK;
     331             : }
     332             : 
     333             : NS_IMETHODIMP
     334           0 : NullHttpChannel::GetURI(nsIURI * *aURI)
     335             : {
     336           0 :   NS_IF_ADDREF(*aURI = mURI);
     337           0 :   return NS_OK;
     338             : }
     339             : 
     340             : NS_IMETHODIMP
     341           0 : NullHttpChannel::GetOwner(nsISupports * *aOwner)
     342             : {
     343           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     344             : }
     345             : 
     346             : NS_IMETHODIMP
     347           0 : NullHttpChannel::SetOwner(nsISupports *aOwner)
     348             : {
     349           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     350             : }
     351             : 
     352             : NS_IMETHODIMP
     353           0 : NullHttpChannel::GetNotificationCallbacks(nsIInterfaceRequestor * *aNotificationCallbacks)
     354             : {
     355           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     356             : }
     357             : 
     358             : NS_IMETHODIMP
     359           0 : NullHttpChannel::SetNotificationCallbacks(nsIInterfaceRequestor *aNotificationCallbacks)
     360             : {
     361           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     362             : }
     363             : 
     364             : NS_IMETHODIMP
     365           0 : NullHttpChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
     366             : {
     367           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     368             : }
     369             : 
     370             : NS_IMETHODIMP
     371           0 : NullHttpChannel::GetContentType(nsACString & aContentType)
     372             : {
     373           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     374             : }
     375             : 
     376             : NS_IMETHODIMP
     377           0 : NullHttpChannel::SetContentType(const nsACString & aContentType)
     378             : {
     379           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     380             : }
     381             : 
     382             : NS_IMETHODIMP
     383           0 : NullHttpChannel::GetContentCharset(nsACString & aContentCharset)
     384             : {
     385           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     386             : }
     387             : 
     388             : NS_IMETHODIMP
     389           0 : NullHttpChannel::SetContentCharset(const nsACString & aContentCharset)
     390             : {
     391           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     392             : }
     393             : 
     394             : NS_IMETHODIMP
     395           0 : NullHttpChannel::GetContentLength(int64_t *aContentLength)
     396             : {
     397           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     398             : }
     399             : 
     400             : NS_IMETHODIMP
     401           0 : NullHttpChannel::SetContentLength(int64_t aContentLength)
     402             : {
     403           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     404             : }
     405             : 
     406             : NS_IMETHODIMP
     407           0 : NullHttpChannel::Open(nsIInputStream * *_retval)
     408             : {
     409           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     410             : }
     411             : 
     412             : NS_IMETHODIMP
     413           0 : NullHttpChannel::Open2(nsIInputStream** aStream)
     414             : {
     415           0 :   nsCOMPtr<nsIStreamListener> listener;
     416           0 :   nsresult rv = nsContentSecurityManager::doContentSecurityCheck(this, listener);
     417           0 :   NS_ENSURE_SUCCESS(rv, rv);
     418           0 :   return Open(aStream);
     419             : }
     420             : 
     421             : NS_IMETHODIMP
     422           0 : NullHttpChannel::AsyncOpen(nsIStreamListener *aListener, nsISupports *aContext)
     423             : {
     424           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     425             : }
     426             : 
     427             : NS_IMETHODIMP
     428           0 : NullHttpChannel::AsyncOpen2(nsIStreamListener *aListener)
     429             : {
     430           0 :   nsCOMPtr<nsIStreamListener> listener = aListener;
     431           0 :   nsresult rv = nsContentSecurityManager::doContentSecurityCheck(this, listener);
     432           0 :   NS_ENSURE_SUCCESS(rv, rv);
     433           0 :   return AsyncOpen(listener, nullptr);
     434             : }
     435             : 
     436             : NS_IMETHODIMP
     437           0 : NullHttpChannel::GetContentDisposition(uint32_t *aContentDisposition)
     438             : {
     439           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     440             : }
     441             : 
     442             : NS_IMETHODIMP
     443           0 : NullHttpChannel::SetContentDisposition(uint32_t aContentDisposition)
     444             : {
     445           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     446             : }
     447             : 
     448             : NS_IMETHODIMP
     449           0 : NullHttpChannel::GetContentDispositionFilename(nsAString & aContentDispositionFilename)
     450             : {
     451           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     452             : }
     453             : 
     454             : NS_IMETHODIMP
     455           0 : NullHttpChannel::SetContentDispositionFilename(const nsAString & aContentDispositionFilename)
     456             : {
     457           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     458             : }
     459             : 
     460             : NS_IMETHODIMP
     461           0 : NullHttpChannel::GetContentDispositionHeader(nsACString & aContentDispositionHeader)
     462             : {
     463           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     464             : }
     465             : 
     466             : NS_IMETHODIMP
     467           0 : NullHttpChannel::GetLoadInfo(nsILoadInfo * *aLoadInfo)
     468             : {
     469           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     470             : }
     471             : 
     472             : NS_IMETHODIMP
     473           0 : NullHttpChannel::SetLoadInfo(nsILoadInfo *aLoadInfo)
     474             : {
     475           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     476             : }
     477             : 
     478             : //-----------------------------------------------------------------------------
     479             : // NullHttpChannel::nsIRequest
     480             : //-----------------------------------------------------------------------------
     481             : 
     482             : NS_IMETHODIMP
     483           0 : NullHttpChannel::GetName(nsACString & aName)
     484             : {
     485           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     486             : }
     487             : 
     488             : NS_IMETHODIMP
     489           0 : NullHttpChannel::IsPending(bool *_retval)
     490             : {
     491           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     492             : }
     493             : 
     494             : NS_IMETHODIMP
     495           0 : NullHttpChannel::GetStatus(nsresult *aStatus)
     496             : {
     497           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     498             : }
     499             : 
     500             : NS_IMETHODIMP
     501           0 : NullHttpChannel::Cancel(nsresult aStatus)
     502             : {
     503           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     504             : }
     505             : 
     506             : NS_IMETHODIMP
     507           0 : NullHttpChannel::Suspend()
     508             : {
     509           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     510             : }
     511             : 
     512             : NS_IMETHODIMP
     513           0 : NullHttpChannel::Resume()
     514             : {
     515           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     516             : }
     517             : 
     518             : NS_IMETHODIMP
     519           0 : NullHttpChannel::GetLoadGroup(nsILoadGroup * *aLoadGroup)
     520             : {
     521           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     522             : }
     523             : 
     524             : NS_IMETHODIMP
     525           0 : NullHttpChannel::SetLoadGroup(nsILoadGroup *aLoadGroup)
     526             : {
     527           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     528             : }
     529             : 
     530             : NS_IMETHODIMP
     531           0 : NullHttpChannel::GetLoadFlags(nsLoadFlags *aLoadFlags)
     532             : {
     533           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     534             : }
     535             : 
     536             : NS_IMETHODIMP
     537           0 : NullHttpChannel::SetLoadFlags(nsLoadFlags aLoadFlags)
     538             : {
     539           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     540             : }
     541             : 
     542             : NS_IMETHODIMP
     543           0 : NullHttpChannel::GetIsDocument(bool *aIsDocument)
     544             : {
     545           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     546             : }
     547             : 
     548             : //-----------------------------------------------------------------------------
     549             : // NullHttpChannel::nsITimedChannel
     550             : //-----------------------------------------------------------------------------
     551             : 
     552             : NS_IMETHODIMP
     553           0 : NullHttpChannel::GetTimingEnabled(bool *aTimingEnabled)
     554             : {
     555             :   // We don't want to report timing for null channels.
     556           0 :   *aTimingEnabled = false;
     557           0 :   return NS_OK;
     558             : }
     559             : 
     560             : NS_IMETHODIMP
     561           0 : NullHttpChannel::SetTimingEnabled(bool aTimingEnabled)
     562             : {
     563           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     564             : }
     565             : 
     566             : NS_IMETHODIMP
     567           0 : NullHttpChannel::GetRedirectCount(uint16_t *aRedirectCount)
     568             : {
     569           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     570             : }
     571             : 
     572             : NS_IMETHODIMP
     573           0 : NullHttpChannel::SetRedirectCount(uint16_t aRedirectCount)
     574             : {
     575           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     576             : }
     577             : 
     578             : NS_IMETHODIMP
     579           0 : NullHttpChannel::GetChannelCreation(mozilla::TimeStamp *aChannelCreation)
     580             : {
     581           0 :   *aChannelCreation = mChannelCreationTimestamp;
     582           0 :   return NS_OK;
     583             : }
     584             : 
     585             : NS_IMETHODIMP
     586           0 : NullHttpChannel::GetAsyncOpen(mozilla::TimeStamp *aAsyncOpen)
     587             : {
     588           0 :   *aAsyncOpen = mAsyncOpenTime;
     589           0 :   return NS_OK;
     590             : }
     591             : 
     592             : NS_IMETHODIMP
     593           0 : NullHttpChannel::GetLaunchServiceWorkerStart(mozilla::TimeStamp *_retval)
     594             : {
     595           0 :   MOZ_ASSERT(_retval);
     596           0 :   *_retval = mAsyncOpenTime;
     597           0 :   return NS_OK;
     598             : }
     599             : 
     600             : NS_IMETHODIMP
     601           0 : NullHttpChannel::SetLaunchServiceWorkerStart(mozilla::TimeStamp aTimeStamp)
     602             : {
     603           0 :   return NS_OK;
     604             : }
     605             : 
     606             : NS_IMETHODIMP
     607           0 : NullHttpChannel::GetLaunchServiceWorkerEnd(mozilla::TimeStamp *_retval)
     608             : {
     609           0 :   MOZ_ASSERT(_retval);
     610           0 :   *_retval = mAsyncOpenTime;
     611           0 :   return NS_OK;
     612             : }
     613             : 
     614             : NS_IMETHODIMP
     615           0 : NullHttpChannel::SetLaunchServiceWorkerEnd(mozilla::TimeStamp aTimeStamp)
     616             : {
     617           0 :   return NS_OK;
     618             : }
     619             : 
     620             : NS_IMETHODIMP
     621           0 : NullHttpChannel::GetDispatchFetchEventStart(mozilla::TimeStamp *_retval)
     622             : {
     623           0 :   MOZ_ASSERT(_retval);
     624           0 :   *_retval = mAsyncOpenTime;
     625           0 :   return NS_OK;
     626             : }
     627             : 
     628             : NS_IMETHODIMP
     629           0 : NullHttpChannel::SetDispatchFetchEventStart(mozilla::TimeStamp aTimeStamp)
     630             : {
     631           0 :   return NS_OK;
     632             : }
     633             : 
     634             : NS_IMETHODIMP
     635           0 : NullHttpChannel::GetDispatchFetchEventEnd(mozilla::TimeStamp *_retval)
     636             : {
     637           0 :   MOZ_ASSERT(_retval);
     638           0 :   *_retval = mAsyncOpenTime;
     639           0 :   return NS_OK;
     640             : }
     641             : 
     642             : NS_IMETHODIMP
     643           0 : NullHttpChannel::SetDispatchFetchEventEnd(mozilla::TimeStamp aTimeStamp)
     644             : {
     645           0 :   return NS_OK;
     646             : }
     647             : 
     648             : NS_IMETHODIMP
     649           0 : NullHttpChannel::GetHandleFetchEventStart(mozilla::TimeStamp *_retval)
     650             : {
     651           0 :   MOZ_ASSERT(_retval);
     652           0 :   *_retval = mAsyncOpenTime;
     653           0 :   return NS_OK;
     654             : }
     655             : 
     656             : NS_IMETHODIMP
     657           0 : NullHttpChannel::SetHandleFetchEventStart(mozilla::TimeStamp aTimeStamp)
     658             : {
     659           0 :   return NS_OK;
     660             : }
     661             : 
     662             : NS_IMETHODIMP
     663           0 : NullHttpChannel::GetHandleFetchEventEnd(mozilla::TimeStamp *_retval)
     664             : {
     665           0 :   MOZ_ASSERT(_retval);
     666           0 :   *_retval = mAsyncOpenTime;
     667           0 :   return NS_OK;
     668             : }
     669             : 
     670             : NS_IMETHODIMP
     671           0 : NullHttpChannel::SetHandleFetchEventEnd(mozilla::TimeStamp aTimeStamp)
     672             : {
     673           0 :   return NS_OK;
     674             : }
     675             : 
     676             : NS_IMETHODIMP
     677           0 : NullHttpChannel::GetDomainLookupStart(mozilla::TimeStamp *aDomainLookupStart)
     678             : {
     679           0 :   *aDomainLookupStart = mAsyncOpenTime;
     680           0 :   return NS_OK;
     681             : }
     682             : 
     683             : NS_IMETHODIMP
     684           0 : NullHttpChannel::GetDomainLookupEnd(mozilla::TimeStamp *aDomainLookupEnd)
     685             : {
     686           0 :   *aDomainLookupEnd = mAsyncOpenTime;
     687           0 :   return NS_OK;
     688             : }
     689             : 
     690             : NS_IMETHODIMP
     691           0 : NullHttpChannel::GetConnectStart(mozilla::TimeStamp *aConnectStart)
     692             : {
     693           0 :   *aConnectStart = mAsyncOpenTime;
     694           0 :   return NS_OK;
     695             : }
     696             : 
     697             : NS_IMETHODIMP
     698           0 : NullHttpChannel::GetConnectEnd(mozilla::TimeStamp *aConnectEnd)
     699             : {
     700           0 :   *aConnectEnd = mAsyncOpenTime;
     701           0 :   return NS_OK;
     702             : }
     703             : 
     704             : NS_IMETHODIMP
     705           0 : NullHttpChannel::GetRequestStart(mozilla::TimeStamp *aRequestStart)
     706             : {
     707           0 :   *aRequestStart = mAsyncOpenTime;
     708           0 :   return NS_OK;
     709             : }
     710             : 
     711             : NS_IMETHODIMP
     712           0 : NullHttpChannel::GetResponseStart(mozilla::TimeStamp *aResponseStart)
     713             : {
     714           0 :   *aResponseStart = mAsyncOpenTime;
     715           0 :   return NS_OK;
     716             : }
     717             : 
     718             : NS_IMETHODIMP
     719           0 : NullHttpChannel::GetResponseEnd(mozilla::TimeStamp *aResponseEnd)
     720             : {
     721           0 :   *aResponseEnd = mAsyncOpenTime;
     722           0 :   return NS_OK;
     723             : }
     724             : 
     725             : NS_IMETHODIMP
     726           0 : NullHttpChannel::GetRedirectStart(mozilla::TimeStamp *aRedirectStart)
     727             : {
     728           0 :   *aRedirectStart = mAsyncOpenTime;
     729           0 :   return NS_OK;
     730             : }
     731             : 
     732             : NS_IMETHODIMP
     733           0 : NullHttpChannel::SetRedirectStart(mozilla::TimeStamp aRedirectStart)
     734             : {
     735           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     736             : }
     737             : 
     738             : NS_IMETHODIMP
     739           0 : NullHttpChannel::GetRedirectEnd(mozilla::TimeStamp *aRedirectEnd)
     740             : {
     741           0 :   *aRedirectEnd = mAsyncOpenTime;
     742           0 :   return NS_OK;
     743             : }
     744             : 
     745             : NS_IMETHODIMP
     746           0 : NullHttpChannel::SetRedirectEnd(mozilla::TimeStamp aRedirectEnd)
     747             : {
     748           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     749             : }
     750             : 
     751             : NS_IMETHODIMP
     752           0 : NullHttpChannel::GetInitiatorType(nsAString & aInitiatorType)
     753             : {
     754           0 :   aInitiatorType = mInitiatorType;
     755           0 :   return NS_OK;
     756             : }
     757             : 
     758             : NS_IMETHODIMP
     759           0 : NullHttpChannel::SetInitiatorType(const nsAString & aInitiatorType)
     760             : {
     761           0 :   mInitiatorType = aInitiatorType;
     762           0 :   return NS_OK;
     763             : }
     764             : 
     765             : NS_IMETHODIMP
     766           0 : NullHttpChannel::GetAllRedirectsSameOrigin(bool *aAllRedirectsSameOrigin)
     767             : {
     768           0 :   *aAllRedirectsSameOrigin = mAllRedirectsSameOrigin;
     769           0 :   return NS_OK;
     770             : }
     771             : 
     772             : NS_IMETHODIMP
     773           0 : NullHttpChannel::SetAllRedirectsSameOrigin(bool aAllRedirectsSameOrigin)
     774             : {
     775           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     776             : }
     777             : 
     778             : NS_IMETHODIMP
     779           0 : NullHttpChannel::GetAllRedirectsPassTimingAllowCheck(bool *aAllRedirectsPassTimingAllowCheck)
     780             : {
     781           0 :   *aAllRedirectsPassTimingAllowCheck = mAllRedirectsPassTimingAllowCheck;
     782           0 :   return NS_OK;
     783             : }
     784             : 
     785             : NS_IMETHODIMP
     786           0 : NullHttpChannel::SetAllRedirectsPassTimingAllowCheck(bool aAllRedirectsPassTimingAllowCheck)
     787             : {
     788           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     789             : }
     790             : 
     791             : NS_IMETHODIMP
     792           0 : NullHttpChannel::TimingAllowCheck(nsIPrincipal *aOrigin, bool *_retval)
     793             : {
     794           0 :   if (!mResourcePrincipal || !aOrigin) {
     795           0 :     *_retval = false;
     796           0 :     return NS_OK;
     797             :   }
     798             : 
     799           0 :   bool sameOrigin = false;
     800           0 :   nsresult rv = mResourcePrincipal->Equals(aOrigin, &sameOrigin);
     801           0 :   if (NS_SUCCEEDED(rv) && sameOrigin) {
     802           0 :     *_retval = true;
     803           0 :     return NS_OK;
     804             :   }
     805             : 
     806           0 :   if (mTimingAllowOriginHeader == "*") {
     807           0 :     *_retval = true;
     808           0 :     return NS_OK;
     809             :   }
     810             : 
     811           0 :   nsAutoCString origin;
     812           0 :   nsContentUtils::GetASCIIOrigin(aOrigin, origin);
     813             : 
     814           0 :   if (mTimingAllowOriginHeader == origin) {
     815           0 :     *_retval = true;
     816           0 :     return NS_OK;
     817             :   }
     818             : 
     819           0 :   *_retval = false;
     820           0 :   return NS_OK;
     821             : }
     822             : 
     823             : NS_IMETHODIMP
     824           0 : NullHttpChannel::GetCacheReadStart(mozilla::TimeStamp *aCacheReadStart)
     825             : {
     826           0 :   *aCacheReadStart = mAsyncOpenTime;
     827           0 :   return NS_OK;
     828             : }
     829             : 
     830             : NS_IMETHODIMP
     831           0 : NullHttpChannel::GetCacheReadEnd(mozilla::TimeStamp *aCacheReadEnd)
     832             : {
     833           0 :   *aCacheReadEnd = mAsyncOpenTime;
     834           0 :   return NS_OK;
     835             : }
     836             : 
     837             : NS_IMETHODIMP
     838           0 : NullHttpChannel::GetIsMainDocumentChannel(bool* aValue)
     839             : {
     840           0 :   *aValue = false;
     841           0 :   return NS_OK;
     842             : }
     843             : 
     844             : NS_IMETHODIMP
     845           0 : NullHttpChannel::SetIsMainDocumentChannel(bool aValue)
     846             : {
     847           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     848             : }
     849             : 
     850             : #define IMPL_TIMING_ATTR(name)                                 \
     851             : NS_IMETHODIMP                                                  \
     852             : NullHttpChannel::Get##name##Time(PRTime* _retval) {            \
     853             :     TimeStamp stamp;                                           \
     854             :     Get##name(&stamp);                                         \
     855             :     if (stamp.IsNull()) {                                      \
     856             :         *_retval = 0;                                          \
     857             :         return NS_OK;                                          \
     858             :     }                                                          \
     859             :     *_retval = mChannelCreationTime +                          \
     860             :         (PRTime) ((stamp - mChannelCreationTimestamp).ToSeconds() * 1e6); \
     861             :     return NS_OK;                                              \
     862             : }
     863             : 
     864           0 : IMPL_TIMING_ATTR(ChannelCreation)
     865           0 : IMPL_TIMING_ATTR(AsyncOpen)
     866           0 : IMPL_TIMING_ATTR(LaunchServiceWorkerStart)
     867           0 : IMPL_TIMING_ATTR(LaunchServiceWorkerEnd)
     868           0 : IMPL_TIMING_ATTR(DispatchFetchEventStart)
     869           0 : IMPL_TIMING_ATTR(DispatchFetchEventEnd)
     870           0 : IMPL_TIMING_ATTR(HandleFetchEventStart)
     871           0 : IMPL_TIMING_ATTR(HandleFetchEventEnd)
     872           0 : IMPL_TIMING_ATTR(DomainLookupStart)
     873           0 : IMPL_TIMING_ATTR(DomainLookupEnd)
     874           0 : IMPL_TIMING_ATTR(ConnectStart)
     875           0 : IMPL_TIMING_ATTR(ConnectEnd)
     876           0 : IMPL_TIMING_ATTR(RequestStart)
     877           0 : IMPL_TIMING_ATTR(ResponseStart)
     878           0 : IMPL_TIMING_ATTR(ResponseEnd)
     879           0 : IMPL_TIMING_ATTR(CacheReadStart)
     880           0 : IMPL_TIMING_ATTR(CacheReadEnd)
     881           0 : IMPL_TIMING_ATTR(RedirectStart)
     882           0 : IMPL_TIMING_ATTR(RedirectEnd)
     883             : 
     884             : #undef IMPL_TIMING_ATTR
     885             : 
     886             : } // namespace net
     887             : } // namespace mozilla

Generated by: LCOV version 1.13