Commit Graph

169 Commits

Author SHA1 Message Date
Andrew Sutherland
4b8889da6a Bug 1416879 - Part 4: FetchDriver needs to propagate write failures. r=baku
In the scenario where a ServiceWorker returns a pass-through fetch via
`evt.respondWith(fetch("underlying"))`, in order for the "underlying"
HTTP channel to be canceled when the outer HTTP channel is canceled,
FetchDriver's OnDataAvailable method needs to return an error when
the output pipe experiences an error.

Unfortunately, the contract for ReadSegments is effectively that it
returns NS_OK regardless of what the rv of the write handler returned,
so relying on the returned rv is insufficient.  And because various
Write*() methods will all fast-path to returning NS_OK if a count of 0
is passed, it's necessary to infer a closed/broken pipe by noticing
that we tried to write more than 0 bytes of data but 0 bytes were
written.  (This is safe because the pipe we write into was created
by FetchDriver::OnStartRequest which explicitly creates an infinite
pipe, so it's not possible for the write to fail due to lack of space
in the pipe.)
2018-01-04 18:04:55 -05:00
Eden Chuang
733896aa1d Bug 1350359 - Part 6: Make sure releasing nsICacheInfoChannel of InternalResponse on the main thread. r=bkelly
Using nsMainThreadPtrHandle to hold the nsICacheInfoChannel in the
    InternalResponse.
2017-12-06 01:13:54 +08:00
Eden Chuang
e8b16d774c Bug 1350359 - Part 4: Fix a crash caused by off-main-thread destruction of a HttpChannelChild. r=bkelly
Setting the InternalResponse's mCacheInfoChannel while needed, to avoid
    keeping unnecessary nsICacheInfoChannel alive.
2017-12-04 14:39:26 +08:00
Eden Chuang
a1f7a72068 Bug 1350359 - Part 2: Fetch and save alterntative data to InternalResponse. r=bkelly
Create a new class AlternativeDataStreamListener for alternative data and
    main data overlap loading.
    AlternativeDataStreamListener coorperates with FetchDriver to handle
    following situations
      1. There is no preferred alternative data type in InternalRequest
         Directly using FetchDriver to listen on the opened channel

      2. If preferred alternative data type exists in InternalRequest, but no
         saved data in cache.
         AlternativeDataStreamListener is constructed to listen on the channel,
         but its status would be set as FALLBACK and redirect callbacks to
         FetchDriver.

      3. If preferred alternative data type exists in InternalRequest, and the
         data also exists in the cache.
         AlternativeDataStreamListener is constructed to listen on the channel
         for loading the alternative data. And also open a channel listened by
         FetchDriver for loading the main data when AlternativeDataStreamListener::
         OnStartRequest is called.
         If the cacheEntryId is different between main data channel and
         alternative data channel, we will cancel the alternative data loading.
2017-12-04 14:39:15 +08:00
Edouard Oger
1775282ce1 Bug 1416842 - Allow fetch to reject with nsresult in chrome code. r=bkelly
MozReview-Commit-ID: FD2NUJZtAhT
2017-11-15 14:53:42 -05:00
Ben Kelly
3c6b83985d Bug 1380255 P2 Don't fire FetchDriverObserver::OnDataAvailable() for every FetchDriver ODA callback. r=baku 2017-10-12 19:23:16 -07:00
Catalin Badea
7c017ea3bc Bug 1380255 - FetchDriver should have threadsafe refcounting. r=baku 2017-09-26 11:53:00 +01:00
Ben Kelly
c4b5fd7625 Bug 1391693 P4 Don't count internal redirects towards Response.redirected r=tt 2017-10-09 10:03:40 -07:00
Andrea Marchesini
26b14d70a4 Bug 1397627 - Fetch API and other components should pass the length of the stream to necko when known, r=smaug 2017-09-08 16:06:26 +02:00
Tom Tung
388e584d55 Bug 1290481 - P5: Implement a function to generate padding size. r=bkelly
MozReview-Commit-ID: 6poDeyErBjc
2017-07-10 17:03:24 +08:00
Sebastian Hengst
20c89a3fed merge mozilla-central to autoland. r=merge a=merge 2017-09-01 10:43:32 +02:00
Honza Bambas
a90d5297b3 Bug 1395525 - Make all changes landed as part of tracker request tailing preferrable. r=dragana 2017-08-31 06:07:00 -04:00
Tom Tung
321e378223 Bug 1393439 - P2: Correct the variable naming. r=bkelly
MozReview-Commit-ID: 1DblOV82nEd
2017-08-29 16:00:35 +08:00
Tom Tung
437bf42c3c Bug 1393439 - P1: Don't return TypeError for no-cors mode and don't check SRI for the hidden opaque body. r=bkelly
MozReview-Commit-ID: 1IspF2IlqqP
2017-08-25 16:36:59 +08:00
Honza Bambas
559460ce73 Bug 1358060 - Allow postponing of unimportant resources opening during page load, class-of-service Tail flag. r=dragana 2017-08-30 09:32:00 -04:00
Andrea Marchesini
f7eb755da0 Bug 1378342 - AbortSignal/AbortController - part 9 - Request.signal should not be a reference of RequestInit.signal, r=bkelly 2017-08-29 11:31:07 +02:00
Andrea Marchesini
5e4e426a93 Bug 1378342 - AbortSignal/AbortController - part 2 - Renaming FetchController/FetchSignal, r=bkelly 2017-08-29 11:31:06 +02:00
Sebastian Hengst
db08812374 Backed out changeset e5c6f95530f2 (bug 1378342) 2017-08-29 09:17:21 +02:00
Sebastian Hengst
efd6a4702c Backed out changeset 4c41e61d6763 (bug 1378342) 2017-08-29 09:16:43 +02:00
Andrea Marchesini
967d5dee18 Bug 1378342 - AbortSignal/AbortController - part 9 - Request.signal should not be a reference of RequestInit.signal, r=bkelly 2017-08-29 07:30:21 +02:00
Andrea Marchesini
dcb5d92cfd Bug 1378342 - AbortSignal/AbortController - part 2 - Renaming FetchController/FetchSignal, r=bkelly 2017-08-29 07:30:19 +02:00
Dragana Damjanovic
c9b903c9ff Bug 1379631 - Turn off OMT delivery for FetchDriver until bug 1380255 lands. The fix for this bug makes some test fail because of FetchDriver. r=mayhemer 2017-08-01 15:05:51 -04:00
Andrew Sutherland
fc594eda07 Bug 1374943 - Fetch needs to handle redirect=error not resulting in NS_FAILED. r=bkelly
The included test crashes without the included fix if run with --disable-e10s.
e10s doesn't crash because HttpChannelChild examines the return value of the
call to the listener's OnStartRequest method and invokes Cancel() if it
NS_FAILED.  This is a divergence between e10s and non-e10s.  See the bug for
more details and discussion.
2017-06-21 08:28:34 -04:00
Bill McCloskey
ce42826bdf Bug 1372405 - Provide names for all runnables in the tree (r=froydnj)
MozReview-Commit-ID: DKR6ROiHRS7
2017-06-26 14:19:58 -07:00
Carsten "Tomcat" Book
238bf154d5 Backed out changeset 4f6302a98ae4 (bug 1372405) 2017-06-21 13:59:26 +02:00
Bill McCloskey
67e8af4720 Bug 1372405 - Provide names for all runnables in the tree (r=froydnj)
MozReview-Commit-ID: DKR6ROiHRS7
2017-06-20 21:44:11 -07:00
Carsten "Tomcat" Book
bbe9441993 Backed out changeset 9846de3bd954 (bug 1372405) 2017-06-20 08:27:02 +02:00
Bill McCloskey
f69608368b Bug 1372405 - Provide names for all runnables in the tree (r=froydnj)
MozReview-Commit-ID: DKR6ROiHRS7
2017-06-19 22:25:47 -07:00
Boris Zbarsky
58210bc113 Bug 1369619. Use ReadSegments in the SRI case in FetchDriver::OnDataAvailable. r=bkelly
This avoids some buffer copies and is arguably more readble.
2017-06-06 00:49:32 -04:00
Bevis Tseng
e682a0b46c Bug 1363318 - Part 3: Label FetchDriver. r=baku 2017-05-16 18:27:01 +08:00
Kershaw Chang
9e8681a25a Bug 1312515 - Part 2: Lower the channel's priority if this Fetch is created from tracking script. r=baku
If the Fetch request is created by a tracking script, we want to lower the priority of the http channel.
2017-05-19 01:29:00 -04:00
Tom Tung
5f68476eea Bug 1348050 - Part 1: Mark channel as urgent-start when the Fetch and XHR are triggered by user input events. r=baku,mayhemer
Raise the urgent-start flag in the ClassOfService when the Fetch and XHR are
triggered by user input events. The urgent-start classification will tell the
network requests scheduler to perform it with the highest priority and also
ignoring any parallelism or overall connection limits.

MozReview-Commit-ID: 2YavWbuFaln
2017-04-21 13:29:31 +08:00
Andrea Marchesini
ee3d9e351a Bug 1341738 - Implement FetchController and FetObserver - part 5 - Dispatching observer events, r=bkelly 2017-03-22 11:07:27 +01:00
Andrea Marchesini
2f5c3f1a4f Bug 1341738 - Implement FetchController and FetObserver - part 3 - FetchSignal in Fetch API, r=bkelly 2017-03-22 11:06:08 +01:00
Wei-Cheng Pan
7a678cdad2 Bug 1310127 - Part 17: Use MOZ_MUST_USE in netwerk/protocol/http r=smaug
MozReview-Commit-ID: 5gvVZtsa3yS
2016-12-20 11:49:32 +08:00
Ben Kelly
9d3459173b Bug 1337543 P5 Move code to fill InternalHeaders from an nsIChannel response into utility method. r=baku 2017-02-14 10:06:39 -05:00
Sebastian Hengst
e2b86d618f Backed out changeset a8b7ae2ed577 (bug 1337543) 2017-02-13 18:59:48 +01:00
Ben Kelly
b6bd045f7c Bug 1337543 P5 Move code to fill InternalHeaders from an nsIChannel response into utility method. r=baku 2017-02-13 12:15:59 -05:00
Tim Huang
b3fb2c8458 Bug 1336802 - Part 2: Updating the whole code base to make sure nsILoadInfo get null check. r=smaug 2017-02-07 11:49:34 +08:00
Boris Zbarsky
fe94c358ec Bug 1328761 part 2. Update some FetchDriver comments to more clearly reflect reality. r=bkelly 2017-01-14 22:43:17 -05:00
Thomas Nguyen
f0e327dc9d Bug 1304623 - Create a pref to control the default referrer policy - part 1. r=bkelly
MozReview-Commit-ID: 6R7kLB6jvhP
2017-01-05 11:30:07 +08:00
Thomas Nguyen
5e424350fb Bug 1264792 - Update request'referrer policy when redirect.r=bkelly,dragana.
MozReview-Commit-ID: 3V6W0fuRomZ
2016-11-14 15:15:32 +08:00
Tom Tung
8224b73089 Bug 1264178 - Part 1: Expose URL fragment to request but not response. r=bkelly 2016-11-07 10:16:34 +08:00
Andrea Marchesini
0ce4aeb4a5 Bug 1312410 - Fetch API should use MutableBlobStorage to store big Blobs on disk, r=qdot 2016-10-26 09:07:25 +02:00
Saurabh Singhal
b2f399d7ae Bug 1278275 - Update Headers::GetAll and Headers::Get to match the specification. r=jdm, r=bkelly 2016-10-10 22:50:14 +05:30
Tom Tung
aedb197f83 Bug 1187335 - P4 - Integrate fetch and cache with SRI & add nsIConsoleReportCollector to show console report. r=bkelly. 2016-09-07 10:20:23 +08:00
Nicholas Nethercote
b5810a1eb4 Bug 1299384 - Use MOZ_MUST_USE with NS_warn_if_impl(). r=erahm.
This change avoids lots of false positives for Coverity's CHECKED_RETURN
warning, caused by NS_WARN_IF's current use in both statement-style and
expression-style.

In the case where the code within the NS_WARN_IF has side-effects, I made the
following change.

> NS_WARN_IF(NS_FAILED(FunctionWithSideEffects()));
> -->
> Unused << NS_WARN_IF(NS_FAILED(FunctionWithSideEffects()));

In the case where the code within the NS_WARN_IF lacks side-effects, I made the
following change.

> NS_WARN_IF(!condWithoutSideEffects);
> -->
> NS_WARNING_ASSERTION(condWithoutSideEffects, "msg");

This has two improvements.
- The condition is not evaluated in non-debug builds.
- The sense of the condition is inverted to the familiar "this condition should
  be true" sense used in assertions.

A common variation on the side-effect-free case is the following.

> nsresult rv = Fn();
> NS_WARN_IF_(NS_FAILED(rv));
> -->
> DebugOnly<nsresult rv> = Fn();
> NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "Fn failed");
2016-09-02 17:12:24 +10:00
Kan-Ru Chen
a9b19d0584 Bug 1297276 - Rename mfbt/unused.h to mfbt/Unused.h for consistency. r=froydnj
The patch is generated from following command:

  rgrep -l unused.h|xargs sed -i -e s,mozilla/unused.h,mozilla/Unused.h,

MozReview-Commit-ID: AtLcWApZfES
2016-08-24 14:47:04 +08:00
Thomas Nguyen
80249f809a Bug 1264164 - Support Referrer Policy HTTP header. r=jdm
MozReview-Commit-ID: GANRqgAZQ5C
2016-07-19 15:38:26 +08:00
Thomas Nguyen
c7530225f3 Bug 1251378 - Use referrer policy of worker instead of default. r=ehsan
MozReview-Commit-ID: I8X8nMkaS9V
2016-04-01 11:52:28 +08:00