Commit Graph

164 Commits

Author SHA1 Message Date
Valentin Gosu
00029d1245 Bug 1667316 - Pass nsresult status to OnRedirectResult r=necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D140569
2022-11-16 08:49:45 +00:00
Sean Feng
bb16ca6496 Bug 1797983 - Remove ORB checks in InterceptedHttpChannel::OnStartRequest r=farre,smaug
It seems that these stuff aren't really needed because whatever
reaches to here either successfully synthesized requests or requests
with system principal (ie: the requests we manually created in
test_synthesized_response.js).

If those conditions are true, then these ORB checks will have no
effect, so we can remove them.

Differential Revision: https://phabricator.services.mozilla.com/D161358
2022-11-14 16:11:46 +00:00
Eden Chuang
6cf8b2c13d Bug 1793940 - Disconnect StreamFilters on HttpChannelChild before relink ServiceWorker fallback channel. r=necko-reviewers,valentin
Since in D159582, the original HttpChannelChild/HttpChannelParent is reused instead of creating a new one. We need to clean up the StreamFilters which are already attached.

In original logic, this would be handled when StreamFilterParent::OnStartRequest is called(). By comparing the stored StreamFilterParent::mChannel and nsIRequest passed into StreamFilterParent::OnStartRequest, StreamFilterParent can know if the redirection happens or not, such that StreamFilterParent can decide should disconnect or not in OnStartRequest(). However, after D159582, since HttpChannelChild is reused, the logic would not work for ServiceWorker fallback redirection.

Opening the new nsHttpChannel in the parent process makes StreamFilters be attached to the original HttpChannelChild again, and it would send duplicate messages (OnStartRequest, OnDataAvailable, OnStopRequest) to the extension. So we need to remove the previous attached StreamFilters before opening the new channel.

In this patch, we introduce a new IPC method PHttpBackgroundChannel::DetachStreamFilters to inform the corresponding HttpChannelChild to disconnect StreamFilters. Unfortunately this introduces that HttpChannelChild needs to keep weak references of StreamFilters since we have no way to traverse the HttpChannelChild's listener chain and do special handling in StreamFilterParent only.

Depends on D159582

Differential Revision: https://phabricator.services.mozilla.com/D160203
2022-10-28 00:33:47 +00:00
Eden Chuang
152199d9d7 Bug 1793940 - Stop channel redirection propagation to child for ServiceWorker fallback requests. r=necko-reviewers,valentin
ServiceWorker fallback(Reset interception) is a trivial redirection, it only changes the load flag  nsIChannel::LOAD_BYPASS_SERVICE_WORKER. For this kind of redirection, we have a chance to avoid complicated redirection propagation by reusing the existing HttpChannelChild/HttpChannelParent directly to improve the performance of ServiceWorker fallback.

In this patch, we add
1. bool value InterceptedHttpChannel::IsReset to indicate if this is a fallback from ServiceWorker.
2. Instead of sending redirection to the content process, relinking the new nsHttpChannel directly in HttpChannelParent, such that HttpChannelParent/HttpChannelChild(and HttpBackgroundChannel IPCs) can be reused.

Differential Revision: https://phabricator.services.mozilla.com/D159582
2022-10-28 00:33:46 +00:00
Sean Feng
babb9bb67d Bug 1785331 - Allow Synthesized Request Bypass ORB checks r=smaug,valentin,necko-reviewers
If ORB doesn't block the request from service worker, then the
synthesized request should also not be blocked by ORB.

Differential Revision: https://phabricator.services.mozilla.com/D160382
2022-10-27 19:18:14 +00:00
Sean Feng
f7ec02cd64 Bug 1785331 - Ensure ORB clears out the headers r=valentin,necko-reviewers
Depends on D157844

Differential Revision: https://phabricator.services.mozilla.com/D158856
2022-10-27 19:18:13 +00:00
Sean Feng
fab18c713d Bug 1785331 - Allow partially implemented ORB to be used in Nightly r=emilio,smaug,necko-reviewers,valentin
This patch starts to actually blocking opaque responses
for most type of the resources that are defined in the spec.
There are still pieces missing such as blocking JSON responses,
and this is why it's called partially implemented.

This patch was originally written by farre, and I made some
modifications based on it.

Depends on D155128

Differential Revision: https://phabricator.services.mozilla.com/D155129
2022-10-27 19:18:11 +00:00
Dana Keeler
2b664bb490 Bug 1790451 - make nsIChannel.securityInfo concrete as nsITransportSecurityInfo r=kershaw,necko-reviewers,valentin,geckoview-reviewers,owlish
Differential Revision: https://phabricator.services.mozilla.com/D157136
2022-09-20 03:58:49 +00:00
Kershaw Chang
867883a547 Bug 1760580 - P1: Make nsIRequest support to store canceled reason, r=necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D156070
2022-09-08 09:11:18 +00:00
Bryan Thrall
e14eb038c7 Bug 1768679 - Expose cache fetch count as uint32_t r=dragana,necko-reviewers
The value is stored as uint32_t, and there doesn't seem to be a need to convert
it to int.

Differential Revision: https://phabricator.services.mozilla.com/D147888
2022-08-04 16:20:17 +00:00
Tom Ritter
4c158ab09f Bug 1737829: Add loadInfo to nsHttpChannel::Init() r=necko-reviewers,kershaw
Everywhere except one loadInfo is supplied to an HTTPChannel
right after it is Init()-ed.  Inside of Init we would like to
use the loadInfo so we'll put it in there.

Differential Revision: https://phabricator.services.mozilla.com/D144580
2022-07-15 20:39:22 +00:00
edguloien
51696324d9 Bug 1758524 (WIP) - Implement the http priority incremental flag: added lint fixes and test coverage. Differential Revision: https://phabricator.services.mozilla.com/D142694 r=necko-reviewers,dragana
Differential Revision: https://phabricator.services.mozilla.com/D142965
2022-04-29 18:36:16 +00:00
edguloien
1a58ed45a2 Bug 1758524 (WIP) - Implement http priority flag r=necko-reviewers,dragana
Differential Revision: https://phabricator.services.mozilla.com/D142694
2022-04-29 18:36:16 +00:00
Cristian Tuns
d1d3601e94 Backed out 2 changesets (bug 1758524) for causing xpcshell failures in test_http3_prio_disabled_wrap.js CLOSED TREE
Backed out changeset b0abbd5936af (bug 1758524)
Backed out changeset e65d3214649e (bug 1758524)
2022-04-28 12:42:11 -04:00
edguloien
8e53b4fc78 Bug 1758524 (WIP) - Implement the http priority incremental flag: added lint fixes and test coverage. Differential Revision: https://phabricator.services.mozilla.com/D142694 r=necko-reviewers,dragana
Differential Revision: https://phabricator.services.mozilla.com/D142965
2022-04-28 15:40:33 +00:00
edguloien
950f23c89e Bug 1758524 (WIP) - Implement http priority flag r=necko-reviewers,dragana
Differential Revision: https://phabricator.services.mozilla.com/D142694
2022-04-28 15:40:33 +00:00
Manuel Bucher
7df0354bfa Bug 1730852 - Fix classOfService information being lost when redirecting to InterceptedHttpChannel r=necko-reviewers,valentin
`nsCOMPtr<nsIClassOfService> cos(do_QueryInterface(newChannel));`[1] was
previously returning a nullptr for objects of the class InterceptedHttpChannel.
Therefore the classOfService flags weren't set after the redirect to the
InterceptedChannel[2].

[1]: https://searchfox.org/mozilla-central/rev/66e59131c1c76fe486424dc37f0a8a399ca874d4/netwerk/protocol/http/HttpBaseChannel.cpp#4186
[2]: https://searchfox.org/mozilla-central/rev/66e59131c1c76fe486424dc37f0a8a399ca874d4/netwerk/protocol/http/nsHttpChannel.cpp#714

Differential Revision: https://phabricator.services.mozilla.com/D137175
2022-02-02 09:06:47 +00:00
Julien Wajsberg
30d30a533e Bug 1639716 - [profiler, network markers] Add information about private browsing in network markers r=valentin,gerald,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D129819
2022-01-26 17:26:24 +00:00
Eden Chuang
cb755eb094 Bug 1747445 - Do not record time stamps for InterceptedHttpChannel if AsyncOpen() is never called. r=dom-worker-reviewers,smaug
It  is an edge case that InterceptedHttpChannel::Cancel() could be called before calling AsyncOpenInternal().
In the case, mTimeStamp status would be Created and we should not record any time stamp for InterceptedHttpChannel.

Differential Revision: https://phabricator.services.mozilla.com/D134775
2021-12-30 05:54:39 +00:00
Gerald Squelart
8c94ff82ed Bug 1738627 - profiler_thread_is_being_profiled_for_markers - r=canaltinova
`profiler_thread_is_being_profiled` is used a lot for markers, so it makes sense to have a specialized version, which is a bit shorter, and lives in ProfilerMarkers.h.

Differential Revision: https://phabricator.services.mozilla.com/D130009
2021-11-08 23:59:35 +00:00
Cristian Tuns
839b72e1d3 Backed out 5 changesets (bug 1738627) for causing xpcshell failures on test_ext_geckoProfiler_schema.js CLOSED TREE
Backed out changeset 42d385d7da97 (bug 1738627)
Backed out changeset edeb3a338954 (bug 1738627)
Backed out changeset 98f02e35134d (bug 1738627)
Backed out changeset 711daa6dd24b (bug 1738627)
Backed out changeset 49e12753a40c (bug 1738627)
2021-11-05 05:12:28 -04:00
Gerald Squelart
019bfd575e Bug 1738627 - profiler_thread_is_being_profiled_for_markers - r=canaltinova
`profiler_thread_is_being_profiled` is used a lot for markers, so it makes sense to have a specialized version, which is a bit shorter, and lives in ProfilerMarkers.h.

Differential Revision: https://phabricator.services.mozilla.com/D130009
2021-11-05 05:52:28 +00:00
Sean Feng
61bb9f9e58 Bug 1468476 - Make soft reload only force validates top level document r=necko-reviewers,nika,dragana,asuth
Currently, soft reload uses the `VALIDATE_ALWAYS` flag to not only
force revalidate the top level document, but also subresources.
This causes content to be refetched from the web even if there
are caches that are still valid and can be used.

Chrome already has such behaviour to not revalidate all resources.

Differential Revision: https://phabricator.services.mozilla.com/D122270
2021-10-28 16:11:56 +00:00
Gerald Squelart
e52556d921 Bug 1735697 - Remove profiler_can_accept_markers(), use profiler_thread_is_being_profiled() instead - r=florian
Differential Revision: https://phabricator.services.mozilla.com/D128577
2021-10-18 23:11:30 +00:00
Yury Delendik
8abe488102 Bug 1487113 - nsICacheInfoChannel.alternativeDataInputStream as attribute. r=necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D117360
2021-10-15 21:13:43 +00:00
Valentin Gosu
8e70d333e1 Bug 1733356 - Fix non-unified build errors in netwerk/protocol/http/ r=necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D127407
2021-10-14 12:58:01 +00:00
Cosmin Sabou
8b22b9a67c Backed out 10 changesets (bug 1733356, bug 1733922) for causing windows hybrid bustages. CLOSED TREE
Backed out changeset 85b747a60e73 (bug 1733922)
Backed out changeset 4af7a3a697ad (bug 1733356)
Backed out changeset 3b2e02c99090 (bug 1733356)
Backed out changeset b481b801250e (bug 1733356)
Backed out changeset 88c33cdcb8aa (bug 1733356)
Backed out changeset 3d31e8c8e194 (bug 1733356)
Backed out changeset 616f676e8f94 (bug 1733356)
Backed out changeset 3f8e9b14879d (bug 1733356)
Backed out changeset 241c7cdb3f6b (bug 1733356)
Backed out changeset 7f9e266070c6 (bug 1733356)
2021-10-14 01:54:30 +03:00
Valentin Gosu
c7039bca17 Bug 1733356 - Fix non-unified build errors in netwerk/protocol/http/ r=necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D127407
2021-10-13 19:39:08 +00:00
Cristian Tuns
b97fa80548 Backed out 10 changesets (bug 1733922, bug 1733356) for causing hybrid build bustages on nsAboutProtocolHandler.cpp. CLOSED TREE
Backed out changeset 293ff1a22c98 (bug 1733922)
Backed out changeset b640749ee844 (bug 1733356)
Backed out changeset d2e3dc1b492a (bug 1733356)
Backed out changeset cd6c19829601 (bug 1733356)
Backed out changeset ef8145f88447 (bug 1733356)
Backed out changeset 366e2d375980 (bug 1733356)
Backed out changeset 14563275a25b (bug 1733356)
Backed out changeset 7700cd82bdf2 (bug 1733356)
Backed out changeset 4e198c3d5ef3 (bug 1733356)
Backed out changeset c26481d0f689 (bug 1733356)
2021-10-11 10:02:20 -04:00
Valentin Gosu
640a20152b Bug 1733356 - Fix non-unified build errors in netwerk/protocol/http/ r=necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D127407
2021-10-11 10:40:08 +00:00
Marian-Vasile Laza
5226ca352c Backed out 3 changesets (bug 1487113) for causing hazard bustages. CLOSED TREE
Backed out changeset 13bf04fc644f (bug 1487113)
Backed out changeset 5b7fe5d564aa (bug 1487113)
Backed out changeset 02236ccd64b4 (bug 1487113)
2021-09-17 22:58:33 +03:00
Yury Delendik
b049c9741a Bug 1487113 - nsICacheInfoChannel.alternativeDataInputStream as attribute. r=necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D117360
2021-09-17 12:16:23 +00:00
Cristian Tuns
7430f772bb Backed out 3 changesets (bug 1487113) for causing mochitest failures. CLOSED TREE
Backed out changeset b20e5d76c77e (bug 1487113)
Backed out changeset b0b2b27dcb68 (bug 1487113)
Backed out changeset 9214b396eb84 (bug 1487113)
2021-09-14 17:38:32 -04:00
Yury Delendik
c65323a56c Bug 1487113 - nsICacheInfoChannel.alternativeDataInputStream as attribute. r=necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D117360
2021-09-14 20:12:51 +00:00
Julien Wajsberg
dd3a2aa8ee Bug 1697901 - [network markers] Move the START marker slightly later so that we don't add it for canceled requests r=necko-reviewers,dragana
Requests may be canceled before AsyncOpen is even called. In that case
we don't want to add START markers, and we don't want to add CANCEL
markers for these requests that didn't even start yet.

Depends on D123255

Differential Revision: https://phabricator.services.mozilla.com/D123256
2021-08-23 08:56:54 +00:00
Julien Wajsberg
901c98cfa7 Bug 1697901 - [network markers] Support channel cancelation in service workers too r=necko-reviewers,kershaw
Intercepted requests can also be canceled.

Depends on D122111

Differential Revision: https://phabricator.services.mozilla.com/D123254
2021-08-23 08:56:53 +00:00
Eden Chuang
017d28a634 Bug 1693074 - Adding telemetry for evaluating the duration of fetch event dispatching and response synthesizing. r=dom-worker-reviewers,asuth
This patch tries to record the fetch event dispatching time, the response's synthesizing time, and interception resetting time.

Fetch event dispatching time is the time duration between interception starts, which is the time point of InterceptedHttpChannel::AsyncOpenInternal(), and the fetch handler starts. It includes the InterceptedHttpChannel setup time, ServiceWorker launch time, FetchEventOp propagation through IPC, a FetchEvent creation, initialization, and dispatching/scheduling on worker scope.

Response synthesizing time is the time duration between the fetch handler finishes, which is the resolving/rejecting promise of respondWith(), to the finish of pumping the synthesized response to InterceptedHttpChannel, which is the time point of calling InterceptedHttpChannel::OnStopRequest(). It includes the response propagation through IPC, response header and body synthesis, and pumping synthesized response to the channel.

Interception resetting time is the time duration between the fetch handler finishes and redirecting InterceptedHttpChannel to a normal HTTP channel.

Since the fetch handler is executed on the process where the service worker spawned, the timestamps related to the fetch handler need to be get on that process. So this patch adds the FetchHandlerStart and FetchHandlerFinish on IPCFetchEventRespondWithResult related types to propagate the timestamps to the parent process.

Depends on D118398

Differential Revision: https://phabricator.services.mozilla.com/D118399
2021-08-22 11:02:18 +00:00
Eden Chuang
802ab4811b Bug 1693074 - Adding telemetry for evaluating whole fetch interception duration. r=dom-worker-reviewers,asuth
Class InterceptionTimeStamps is introduced to help to record fetch-related timing. It is a private class of InterceptedHttpChannel since should use it in InterceptedHttpChannel only.

We are probably not only interested in the resource type, navigation or subresource, but also the final status of fetching, Synthesized, Reset, Canceled, or Redirected. So the fetch's final status also be appended on the sub-key of telemetry.

Depends on D118397

Differential Revision: https://phabricator.services.mozilla.com/D118398
2021-08-22 11:02:18 +00:00
Eden Chuang
260ec773bc Bug 1693074 - Remove child interception telemetries related codes. r=dom-worker-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D118396
2021-08-22 11:02:17 +00:00
Julien Wajsberg
471a33d8b4 Bug 1717047 - [profiler, netwerk] Support all redirections in the parent process r=canaltinova,necko-reviewers,dragana
This moves the adding of the end marker for redirects in nsHttpChannel
to SetupReplacementChannel, so that all redirects are properly caught.
Without that, some requests will show as unfinished in the profiler
frontend.

Some of the redirects are internal and we may be able to flag and ignore
them in the frontend, but that's work for the future.

Because all redirections get a "REDIRECT" end marker, including the
internal redirection to the service worker's intercepted channel, we now
need an additional "START" marker there as well.

All existing profiler tests related to service workers needed to be
updated because there's an extra redirect marker in all these requests,
as well as several pairs of markers that all have the same id.

This also adds a new profiler test for handling the http->https case
that we wouldn't catch before this patch.

Differential Revision: https://phabricator.services.mozilla.com/D118836
2021-07-27 15:12:53 +00:00
Florian Quèze
05b9342bc4 Bug 1720289 - remove MOZ_GECKO_PROFILER ifdefs around network markers, r=necko-reviewers,gerald,kershaw.
Differential Revision: https://phabricator.services.mozilla.com/D119740
2021-07-15 22:04:21 +00:00
Andrew Sutherland
1f78847517 Bug 1503072 - Add mitigation to bypass SW on navigation fault. r=dom-worker-reviewers,necko-reviewers,valentin,edenchuang
We enable this mitigation by default because:
- The alternate UX is about:blank or corrupted content.  That's never good.
- We want to make sure that our test coverage handles this mitigation because
  it's want we want to ship.

However, we do explicitly disable it for all ServiceWorker WPT's via
`__dir__.ini` directive at the root of the service-workers test tree.

This is motivated by the
`/service-workers/service-worker/update-recovery.https.html` test which
intentionally tests a broken ServiceWorker being able to be updated.  It
explicitly tests that the intercepted broken iframe shouldn't successfully
load, but our mitigation makes it load, which breaks the test.

Depends on D111845

Differential Revision: https://phabricator.services.mozilla.com/D111993
2021-07-12 21:10:26 +00:00
Iulian Moraru
16abff8a1d Backed out 3 changesets (bug 1503072) for causing bc failures on browser_navigation_fetch_fault_handling.js. CLOSED TREE
Backed out changeset f8c6503512f5 (bug 1503072)
Backed out changeset c04927c15fd8 (bug 1503072)
Backed out changeset b7550232d4f1 (bug 1503072)
2021-07-12 15:19:09 +03:00
Andrew Sutherland
533fe76595 Bug 1503072 - Add mitigation to bypass SW on navigation fault. r=dom-worker-reviewers,necko-reviewers,valentin,edenchuang
We enable this mitigation by default because:
- The alternate UX is about:blank or corrupted content.  That's never good.
- We want to make sure that our test coverage handles this mitigation because
  it's want we want to ship.

However, we do explicitly disable it for all ServiceWorker WPT's via
`__dir__.ini` directive at the root of the service-workers test tree.

This is motivated by the
`/service-workers/service-worker/update-recovery.https.html` test which
intentionally tests a broken ServiceWorker being able to be updated.  It
explicitly tests that the intercepted broken iframe shouldn't successfully
load, but our mitigation makes it load, which breaks the test.

Depends on D111845

Differential Revision: https://phabricator.services.mozilla.com/D111993
2021-07-12 11:13:35 +00:00
Sandor Molnar
e0b0a9163d Backed out changeset 932f7478dc2a (bug 1717047) for causing bug 1719684. CLOSED TREE 2021-07-08 19:41:24 +03:00
Julien Wajsberg
6acfd734de Bug 1717047 - [profiler, netwerk] Support all redirections in the parent process r=canaltinova,necko-reviewers,dragana
This moves the adding of the end marker for redirects in nsHttpChannel
to SetupReplacementChannel, so that all redirects are properly caught.
Without that, some requests will show as unfinished in the profiler
frontend.

Some of the redirects are internal and we may be able to flag and ignore
them in the frontend, but that's work for the future.

Because all redirections get a "REDIRECT" end marker, including the
internal redirection to the service worker's intercepted channel, we now
need an additional "START" marker there as well.

All existing profiler tests related to service workers needed to be
updated because there's an extra redirect marker in all these requests,
as well as several pairs of markers that all have the same id.

This also adds a new profiler test for handling the http->https case
that we wouldn't catch before this patch.

Differential Revision: https://phabricator.services.mozilla.com/D118836
2021-07-07 14:09:47 +00:00
Julien Wajsberg
43e69e86b4 Bug 1717414 - [profiler, netwerk] Report the new channel id in redirect network markers r=necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D118468
2021-06-23 16:03:50 +00:00
Julien Wajsberg
4f6122d937 Bug 1715321 - [profiler, netwerk] Report the type of redirection in network markers r=necko-reviewers,gerald,valentin
The profiler UI part has been landed in
https://github.com/firefox-devtools/profiler/pull/3350 and
https://github.com/firefox-devtools/profiler/pull/3392.

Differential Revision: https://phabricator.services.mozilla.com/D117682
2021-06-21 07:37:56 +00:00
Julien Wajsberg
a4bea8a9cc Bug 1715321 - [profiler, netwerk] Reorder some parameters of profiler_add_network_marker r=necko-reviewers,gerald,valentin
This moves optional redirect-related parameters to the end, so that it's
easier to use in non-redirect cases.

Differential Revision: https://phabricator.services.mozilla.com/D117680
2021-06-21 07:37:55 +00:00
Julien Wajsberg
b3e16b9eb2 Bug 1567222 - [profiler] Add redirect markers when respondWith isn't called in the service worker's fetch handler r=canaltinova,asuth,necko-reviewers
When `respondWith` isn't called, then we run the "reset interception"
steps, which sets up a new channel and does an internal redirect. We
need a profiler network marker with the "REDIRECT" status to properly
track this.

Differential Revision: https://phabricator.services.mozilla.com/D112216
2021-05-21 09:40:30 +00:00