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