Commit Graph

355 Commits

Author SHA1 Message Date
Nika Layzell
a51fa32bd1 Bug 1826206 - Require nsISerialEventTarget for RetargetDeliveryTo, r=necko-reviewers,valentin
This avoids potential issues where multiple OnDataAvailable callbacks or
similar could theoretically be called concurrently on different
StreamTransportService threads when targeting the STS - these cases will
now target a TaskQueue on the STS instead, structurally ensuring serial
execution.

Differential Revision: https://phabricator.services.mozilla.com/D179984
2023-06-07 14:48:38 +00:00
Eden Chuang
1cad963a91 Bug 1819570 - P4 Propagte stack trace notification back to the content process for PFetch. r=asuth
After PFetch is enabled, fetch() call in workers will not create a channel in the content process anymore.
Although netmonitor watches channels and NetEvents, stack traces are only caught in the content process.
That means PFetch should notify the netmonitor about the stack trace of the fetch at the proper moment.

In original fetch steps, FetchDriver would notify the netmonitor the fetch stack trace at
https://searchfox.org/mozilla-central/rev/cdddec7fd690700efa4d6b48532cf70155e0386b/dom/fetch/FetchDriver.cpp#834

When PFetch is enabled, PFetch needs also to propagate this notification back to the content process.

Depends on D174442

Differential Revision: https://phabricator.services.mozilla.com/D174443
2023-05-05 15:24:10 +00:00
Eden Chuang
cb8c37dd2a Bug 1819570 - P2 Save worker's associated BrowsingContextID in channel's LoadInfo for the netmonitor. r=necko-reviewers,valentin
After PFetch is enabled, fetch() call in workers will not create a channel in the content process anymore.
Although netmonitor also watches the channels in the parent process, the created channel still loses the BrowsingContext information for netmonitor to connect the network event and the channel.

In P1, https://phabricator.services.mozilla.com/D174249, we propagate the BrowsingContext ID through PFetch.
In this patch, we need to save it in channel's LoadInfo for netmonitor.

In order not to confuse with nsILoadInfo's BrowsingContextID, we create a new attribute WorkerAssociatedBrowsingContextID in nsILoadInfo.

Depends on D174249

Differential Revision: https://phabricator.services.mozilla.com/D174441
2023-05-05 15:24:09 +00:00
Iulian Moraru
3c45645f59 Backed out 5 changesets (bug 1819570) for causing dt failures on browser_net_worker_stacks.js. CLOSED TREE
Backed out changeset e73379145f9a (bug 1819570)
Backed out changeset addc41903c2f (bug 1819570)
Backed out changeset c8534cf58f86 (bug 1819570)
Backed out changeset 81e926cf92dc (bug 1819570)
Backed out changeset 7d73ec5415a4 (bug 1819570)
2023-05-04 07:19:13 +03:00
Eden Chuang
fdbcb9980c Bug 1819570 - P4 Propagte stack trace notification back to the content process for PFetch. r=asuth
After PFetch is enabled, fetch() call in workers will not create a channel in the content process anymore.
Although netmonitor watches channels and NetEvents, stack traces are only caught in the content process.
That means PFetch should notify the netmonitor about the stack trace of the fetch at the proper moment.

In original fetch steps, FetchDriver would notify the netmonitor the fetch stack trace at
https://searchfox.org/mozilla-central/rev/cdddec7fd690700efa4d6b48532cf70155e0386b/dom/fetch/FetchDriver.cpp#834

When PFetch is enabled, PFetch needs also to propagate this notification back to the content process.

Depends on D174442

Differential Revision: https://phabricator.services.mozilla.com/D174443
2023-05-04 02:46:31 +00:00
Eden Chuang
d4acff34b0 Bug 1819570 - P2 Save worker's associated BrowsingContextID in channel's LoadInfo for the netmonitor. r=necko-reviewers,valentin
After PFetch is enabled, fetch() call in workers will not create a channel in the content process anymore.
Although netmonitor also watches the channels in the parent process, the created channel still loses the BrowsingContext information for netmonitor to connect the network event and the channel.

In P1, https://phabricator.services.mozilla.com/D174249, we propagate the BrowsingContext ID through PFetch.
In this patch, we need to save it in channel's LoadInfo for netmonitor.

In order not to confuse with nsILoadInfo's BrowsingContextID, we create a new attribute WorkerAssociatedBrowsingContextID in nsILoadInfo.

Depends on D174249

Differential Revision: https://phabricator.services.mozilla.com/D174441
2023-05-04 02:46:31 +00:00
Kershaw Chang
f446ba9e37 Bug 1808323 - Add telemetry for the page load time and the time to first paint for sites that supports Early Hints response, r=manuel,necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D165966
2023-05-02 08:08:44 +00:00
sunil mayya
231604e35b Bug 1823502 - do not drop auth header for HSTS and internal redirects. r=necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D173523
2023-03-28 00:56:23 +00:00
sunil mayya
6160bd9c95 Bug 1817980 - replace ReferrerInfo::IsCrossOriginRequest with nsScriptSecurityManager::CheckSameOriginURI for determining cross-origin redirects. r=necko-reviewers,valentin
Since Bug 1802086, we strip authentication headers when redirected to a cross-origin page. However, the api   ReferrerInfo::IsCrossOriginRequest  used for determining whether a request is cross-origin cannot be used as it compares the triggering principal's uri with the redirected channel's uri. This comparison might sometimes yield to false positives.
For e.g consider the following scenario:
1. Load `https://example.org/` and send the following fetch request from browser console
```
fetch("https://test.com/some_location", {
  "headers": {
    "Authorization": "Token foo"
  }
});
```
2. Server responds with  a redirect to https://test.com/another_location

In the above scenario, the api ReferrerInfo::IsCrossOriginRequest  will yield the above request as cross origin since the triggering principal uri here is example.com. Hence, this will be treated as cross-origin redirect resulting in removal of auth headers.

Thus ReferrerInfo::IsCrossOriginRequest  has been replaced with nsScriptSecurityManager::CheckSameOriginURI  where we directly compare the origins for the two requests.

Differential Revision: https://phabricator.services.mozilla.com/D170868
2023-02-28 12:06:36 +00:00
Eden Chuang
6c50593abe Bug 1810816 - P2 Add new interface OnReportPerformanceTiming on FetchDriverObserver. r=dom-worker-reviewers,asuth
Response Timing should be reported before the body stream completing.

In the original implementation, the response timing is recorded when OnResponseEnd is called, but it is too late. Response timing could not be ready when response.text() or response.blob() resolves the promise.

This is the second patch to add a new interface OnReportPerformanceTiming() on FetchDriverObserver, so FetchDriver could control when to report the response timing.
The patch gives an empty implementation in FetchDriverObserver for MainThreadFetchResolver and WorkerFetchResolver. And FetchInstace overrides the method for PFetch and ServiceWorker NavigationPreload.

Depends on D167936

Differential Revision: https://phabricator.services.mozilla.com/D167937
2023-02-23 02:52:54 +00:00
Csoregi Natalia
5386413ef4 Backed out 4 changesets (bug 1810816) for causing high rate failures on /service-workers/service-worker/navigation-headers.https.html. CLOSED TREE
Backed out changeset 2479dc798994 (bug 1810816)
Backed out changeset e5eacedc370d (bug 1810816)
Backed out changeset b52649243851 (bug 1810816)
Backed out changeset 0aea172f9dd3 (bug 1810816)
2023-02-22 22:39:38 +02:00
Eden Chuang
70f3fc8d5b Bug 1810816 - P2 Add new interface OnReportPerformanceTiming on FetchDriverObserver. r=dom-worker-reviewers,asuth
Response Timing should be reported before the body stream completing.

In the original implementation, the response timing is recorded when OnResponseEnd is called, but it is too late. Response timing could not be ready when response.text() or response.blob() resolves the promise.

This is the second patch to add a new interface OnReportPerformanceTiming() on FetchDriverObserver, so FetchDriver could control when to report the response timing.
The patch gives an empty implementation in FetchDriverObserver for MainThreadFetchResolver and WorkerFetchResolver. And FetchInstace overrides the method for PFetch and ServiceWorker NavigationPreload.

Depends on D167936

Differential Revision: https://phabricator.services.mozilla.com/D167937
2023-02-22 16:49:50 +00:00
Kershaw Chang
f15a8b54cc Bug 1685403 - Use NS_GetFinalChannelURI at some places, r=necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D164656
2023-02-13 16:01:41 +00:00
Eden Chuang
6f4cd78191 Bug 1351231 - FetchService integration for PFetch. r=dom-worker-reviewers,jesup
Depends on D142436

Differential Revision: https://phabricator.services.mozilla.com/D142437
2023-01-20 09:09:17 +00:00
Noemi Erli
64b4ccc119 Backed out 5 changesets (bug 1351231) for causing multiple wpt failures CLOSED TREE
Backed out changeset 257553919696 (bug 1351231)
Backed out changeset 4fd92351d64b (bug 1351231)
Backed out changeset 7a4e3f5f674a (bug 1351231)
Backed out changeset 9da00c1364a5 (bug 1351231)
Backed out changeset 19b78046ffef (bug 1351231)
2023-01-18 18:16:01 +02:00
Eden Chuang
5d56464868 Bug 1351231 - FetchService integration for PFetch. r=dom-worker-reviewers,jesup
Depends on D142436

Differential Revision: https://phabricator.services.mozilla.com/D142437
2023-01-18 00:50:20 +00:00
Marian-Vasile Laza
36626c8b7e Backed out 5 changesets (bug 1351231) for causing multiple wpt failures. CLOSED TREE
Backed out changeset a41252141399 (bug 1351231)
Backed out changeset 6cbb442f4772 (bug 1351231)
Backed out changeset dbdca4661a35 (bug 1351231)
Backed out changeset ea27cd66fefd (bug 1351231)
Backed out changeset 8c21c9468949 (bug 1351231)
2023-01-17 19:53:09 +02:00
sunil mayya
c188fc8ec6 Bug 1802086 - remove auth header from redirected cross-origin requests. r=necko-reviewers,smaug,valentin
The change also updates WPT based on the discussions here https://github.com/web-platform-tests/wpt/pull/37145/files#r1042166622

Differential Revision: https://phabricator.services.mozilla.com/D163904
2023-01-17 16:13:51 +00:00
Eden Chuang
32eac38347 Bug 1351231 - FetchService integration for PFetch. r=dom-worker-reviewers,jesup
Depends on D142436

Differential Revision: https://phabricator.services.mozilla.com/D142437
2023-01-17 15:13:46 +00:00
Rob Wu
9d7708a6d1 Bug 1802385 - Use NS_GetFinalChannelURI in FetchDriver r=rpl,valentin
Depends on D164656

Differential Revision: https://phabricator.services.mozilla.com/D166108
2023-01-16 16:58:06 +00:00
Butkovits Atila
24e4985a7a Backed out 5 changesets (bug 1351231) for causing fetch related failures. CLOSED TREE
Backed out changeset da5c4a821428 (bug 1351231)
Backed out changeset 66b279e5a513 (bug 1351231)
Backed out changeset 3eb8fdd0ba6d (bug 1351231)
Backed out changeset a1fcf22a2a0e (bug 1351231)
Backed out changeset fd2a843599d1 (bug 1351231)
2023-01-12 20:20:14 +02:00
Eden Chuang
2bafa9b267 Bug 1351231 - FetchService integration for PFetch. r=dom-worker-reviewers,jesup
Depends on D142436

Differential Revision: https://phabricator.services.mozilla.com/D142437
2023-01-12 17:24:28 +00:00
Stanca Serban
937d8d1fd4 Backed out 5 changesets (bug 1351231) for Fetch related failures. CLOSED TREE
Backed out changeset cc26eeeaf3dd (bug 1351231)
Backed out changeset c0cb3c17f246 (bug 1351231)
Backed out changeset 84162d09eef8 (bug 1351231)
Backed out changeset 5c3b5a384f2f (bug 1351231)
Backed out changeset d8fa8a006948 (bug 1351231)
2023-01-12 18:56:25 +02:00
Eden Chuang
b62bded106 Bug 1351231 - FetchService integration for PFetch. r=dom-worker-reviewers,jesup
Depends on D142436

Differential Revision: https://phabricator.services.mozilla.com/D142437
2023-01-12 15:09:45 +00:00
sunil mayya
cf78b0bbc0 Bug 1793736 - Include abort signal reason for fetch. r=necko-reviewers,valentin,tschuster
Differential Revision: https://phabricator.services.mozilla.com/D161669
2022-11-28 10:43:05 +00:00
Butkovits Atila
2a784984ea Backed out changeset 133c9084af25 (bug 1793736) for causing failures at browser_navigationPreload_read_after_respondWith.js. 2022-11-21 19:49:41 +02:00
sunil mayya
bd3511e8d0 Bug 1793736 - Include abort signal reason for fetch. r=necko-reviewers,valentin,tschuster
Differential Revision: https://phabricator.services.mozilla.com/D161669
2022-11-21 16:56:09 +00:00
Daniel Holbert
b9fb45ee7a Bug 1800342: Make NS_NewPipe2 and NS_NewPipe infallible, to reflect reality. r=xpcom-reviewers,necko-reviewers,nika,kershaw
This patch doesn't change behavior; these APIs were already effectively
infallible, in the sense that it was impossible for them to return anything
other than NS_OK.

The actual API changes here are in xpcom/io/nsIPipe.idl and
xpcom/io/nsPipe3.cpp, and the rest of this patch is just updates to callsites,
removing code that handled failure-flavored return values from these functions.
(All of this removed code was already dead code, effectively.)

Differential Revision: https://phabricator.services.mozilla.com/D161947
2022-11-14 23:22:16 +00:00
Dan Robertson
09dd7e4a03 Bug 1771423 - Set Content-Type to an empty string for an blob with no type. r=kershaw,smaug,Gijs
Set the Content-Type to an empty string for an blob when the type was not
given. Ensure that the channel Content-Type is not overriden in the case
that it was previously set and the blob type is not valid.

Differential Revision: https://phabricator.services.mozilla.com/D147481
2022-11-14 15:26:36 +00:00
Eden Chuang
1e77e37966 Bug 1658869 - Propagate the InterceptedHttpChannel information to fetch's channel casued by FetchEvent.request. r=dom-worker-reviewers,dragana,jesup
When a network load needs to be intercepted by ServiceWorker, we extract the Request from the InterceptedHttpChannel, and propagate the Request through FetchEvent.request.

However, some needed information is not extracted or is modified during the Request propagation, so getting the wrong result when using the Request to fetch resources in the ServiceWorker script.

Differential Revision: https://phabricator.services.mozilla.com/D145969
2022-09-30 22:39:23 +00:00
Norisz Fay
3a7109d26f Backed out 2 changesets (bug 1771423) for causing webcompat regressions CLOSED TREE
Backed out changeset c1d1be434427 (bug 1771423)
Backed out changeset 2b7d886f374f (bug 1771423)
2022-09-13 16:26:16 +03:00
Kershaw Chang
bd7389a309 Bug 1760580 - P2: Provide a reason when request is cancelled with NS_BINDING_ABORTED, r=necko-reviewers,media-playback-reviewers,valentin,chunmin
Differential Revision: https://phabricator.services.mozilla.com/D156071
2022-09-08 09:11:19 +00:00
Dan Robertson
cdd3c2a693 Bug 1771423 - Set Content-Type to an empty string for an empty blob with no type. r=kershaw,smaug,necko-reviewers
Set the Content-Type to an empty string for an blob when the type was not
given. Ensure that the channel Content-Type is not overriden in the case
that it was previously set and the blob type is not valid.

Depends on D147568

Differential Revision: https://phabricator.services.mozilla.com/D147481
2022-08-15 13:52:12 +00:00
Tom Schuster
8c312c62fb Bug 1776414 - Change nsIHttpChannelInternal corsMode to requestMode. r=kershaw,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D150243
2022-06-29 14:09:57 +00:00
Tom Schuster
5eb49ccd15 Bug 1605305 - Consistently provide an Origin header for normal requests. r=freddyb,necko-reviewers,kershaw,robwu
This patch is more conservative for requests initiated by add-on and prefers
to send no Origin header instead of Origin: null.

Differential Revision: https://phabricator.services.mozilla.com/D147091
2022-06-15 18:30:19 +00:00
Kershaw Chang
81269d53f1 Bug 1761026 - Add a null check for FetchDriver::mResponse, r=necko-reviewers,dragana
This patch adds a null check to avoid crashing when `mResponse` is null.

Differential Revision: https://phabricator.services.mozilla.com/D141911
2022-03-30 13:13:01 +00:00
Yury Delendik
cc226dc063 Bug 1757999 - Disable fetch HTTP wasm caching if wasm debug enabled. r=necko-reviewers,lth,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D140401
2022-03-09 21:49:52 +00:00
Eden Chuang
ef66506601 Bug 1754365 - Getting PerformanceTimingData from channel for FetchService. r=dom-worker-reviewers,jesup
Differential Revision: https://phabricator.services.mozilla.com/D138249
2022-02-27 00:26:21 +00:00
Marian-Vasile Laza
1a7aed1fab Backed out 4 changesets (bug 1754365) for causing wpt failures on service-worker/navigation-headers.https.html. CLOSED TREE
Backed out changeset 9ee546b9fd2b (bug 1754365)
Backed out changeset cf972fe0d961 (bug 1754365)
Backed out changeset f8afd25bf41e (bug 1754365)
Backed out changeset 34d4e99f8219 (bug 1754365)
2022-02-26 01:51:59 -08:00
Eden Chuang
f103db8116 Bug 1754365 - Getting PerformanceTimingData from channel for FetchService. r=dom-worker-reviewers,jesup
Differential Revision: https://phabricator.services.mozilla.com/D138249
2022-02-26 08:40:25 +00:00
Kagami Sascha Rosylight
e1716b5a55 Bug 1660555 - Let AbortSignal grab strong references to its followers r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D136447
2022-01-21 14:40:39 +00:00
Eden Chuang
d545418095 Bug 1577346 - P3 Make InternalResponse be SafeRefcounted. r=dom-worker-reviewers,ytausky
Depends on D126243

Differential Revision: https://phabricator.services.mozilla.com/D126244
2021-11-08 13:29:32 +00:00
Yury Delendik
becd4f42d5 Bug 1487113 - Add pref javascript.options.wasm_caching. r=necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D27101
2021-10-15 21:13:44 +00:00
Yury Delendik
2fdbeab619 Bug 1487113 - Use alt-data to cache stream-compiled WebAssembly modules. r=necko-reviewers,valentin,dragana
Depends on D117360

Differential Revision: https://phabricator.services.mozilla.com/D26731
2021-10-15 21:13:44 +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
Mike Hommey
19133d707d Bug 1733034 - Fix unreachable-code-return warnings in dom. r=smaug
dom/console/Console.cpp:2899:10: error: 'return' will never be executed [-Werror,-Wunreachable-code-return]
  return 0;
         ^
dom/console/Console.cpp:2955:10: error: 'return' will never be executed [-Werror,-Wunreachable-code-return]
  return 0;
         ^
dom/fetch/FetchDriver.cpp:252:10: error: 'return' will never be executed [-Werror,-Wunreachable-code-return]
  return NS_OK;
         ^~~~~

Differential Revision: https://phabricator.services.mozilla.com/D126870
2021-09-29 21:44:51 +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
62105cd587 Bug 1487113 - Add pref javascript.options.wasm_caching. r=necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D27101
2021-09-17 12:16:24 +00:00
Yury Delendik
b81b8b0b2e Bug 1487113 - Use alt-data to cache stream-compiled WebAssembly modules. r=necko-reviewers,valentin,dragana
Depends on D117360

Differential Revision: https://phabricator.services.mozilla.com/D26731
2021-09-17 12:16:24 +00: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