Commit graph

380 commits

Author SHA1 Message Date
Sean
73204d6728 Bug 1894288 - Remove network.fetch.redirect.stripAuthHeader and network.http.redirect.stripAuthHeader prefs r=sunil,edgul,necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D209393
2024-05-22 15:10:48 +00:00
Tim Huang
d7c54fb41e Bug 1873631 - Part 2: Set the isInThirdPartyContext bit to the loadInfo of the channel for the fetch reqeust in workers. r=bvandersloot,asuth
We propergate the isInThirdPartyContext bit from the workerPrivate to
the fetchDrvier. So, we can set the bit for the channel that loads the
fetch request for workers.

Differential Revision: https://phabricator.services.mozilla.com/D207139
2024-04-22 16:02:51 +00:00
Emilio Cobos Álvarez
e4ddf24147 Bug 1887719 - More consistently use UTF8String/nsCString for URLs. r=necko-reviewers,webidl,anti-tracking-reviewers,places-reviewers,jari,kershaw,janv,smaug,hsivonen
Sorry for the massive patch but I found it hard to split without
introducing a bunch of copies around...

This mostly makes necko and DOM agree on which strings to use, which
should result on less copies and conversions.

Differential Revision: https://phabricator.services.mozilla.com/D205601
2024-04-04 11:49:57 +00:00
Thomas Wisniewski
64e64191cb Bug 1847358 part 3: add a fullMimeType attribute to nsIBaseChannel and use it to make our Data URI content-type header parsing standards-compliant for XHR and Fetch; r=dlrobertson,necko-reviewers,jesup
Differential Revision: https://phabricator.services.mozilla.com/D203380
2024-03-04 21:34:27 +00:00
Thomas Wisniewski
7c31f0e0ae Bug 1847358 part 2: create and use nsIBaseChannel to reduce code debt and better-encapsulate logic for range-requests on nsBaseChannel classes; r=dlrobertson,necko-reviewers,jesup
Differential Revision: https://phabricator.services.mozilla.com/D203379
2024-03-04 21:34:27 +00:00
Thomas Wisniewski
820f1c6cb8 Bug 1847358 part 1: move nsBaseChannel::ContentRange content out into its own class as mozilla::net::ContentRange; r=dlrobertson,necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D203378
2024-03-04 21:34:27 +00:00
Ziran Sun
aa6bf5aefc Bug 1839319 - Add fetchpriority support for fetch() API. r=valentin,necko-reviewers,webidl,saschanaz,fredw
This is to add basic fetch priority support. It introduces preference of
fetch priority adjustment as per to recent discussions. We need to refine the
fetchpriority mapping taking into account of destination, which will be
addressed in Bug 1881040.

In addition, this changes the relervant prefs type to atomic type to accommodate
the access of the prefs off the main thread in the worker case.

Differential Revision: https://phabricator.services.mozilla.com/D200778
2024-02-23 15:14:17 +00:00
Eden Chuang
305928a56a Bug 1871498 - Let FetchDriver::RunAbortAlogrithm() resolving FetchInstance::mPromises by calling FetchObserver::OnResponseEnd(). r=dom-worker-reviewers,smaug
Differential Revision: https://phabricator.services.mozilla.com/D198685
2024-01-29 11:02:14 +00:00
Norisz Fay
b1727d155e Backed out changeset 07a3a86e82ee (bug 1871498) for causing multiple leakcheck failures CLOSED TREE 2024-01-25 18:35:45 +02:00
Eden Chuang
f8c7b06b4b Bug 1871498 - Let FetchDriver::RunAbortAlogrithm() resolving FetchInstance::mPromises by calling FetchObserver::OnResponseEnd(). r=dom-worker-reviewers,smaug
Differential Revision: https://phabricator.services.mozilla.com/D198685
2024-01-25 13:32:48 +00:00
sunil mayya
e2ff65bf66 Bug 1810805 - update mObserver modifications in FetchDriver. r=necko-reviewers,edenchuang
Differential Revision: https://phabricator.services.mozilla.com/D194220
2023-11-27 10:31:54 +00:00
sunil mayya
8ce40ef93d Bug 1851992 - implement nsIThreadRetargetableStreamListener::OnDataFinished to multiple listeners. r=necko-reviewers,extension-reviewers,jesup,rpl
Differential Revision: https://phabricator.services.mozilla.com/D187833
2023-10-27 13:30:11 +00:00
Narcis Beleuzu
722f6a1679 Backed out 6 changesets (bug 1851992) for DT failure on browser_net_image_cache.js . CLOSED TREE
Backed out changeset 3ceaf46f8f55 (bug 1851992)
Backed out changeset c9d322362e22 (bug 1851992)
Backed out changeset 673df3f83249 (bug 1851992)
Backed out changeset 46e18c56dd39 (bug 1851992)
Backed out changeset f9f9143ac713 (bug 1851992)
Backed out changeset 38c40d735ab7 (bug 1851992)
2023-10-24 13:16:40 +03:00
sunil mayya
1acfb3f11f Bug 1851992 - implement nsIThreadRetargetableStreamListener::OnDataFinished to multiple listeners. r=necko-reviewers,extension-reviewers,jesup,rpl
Differential Revision: https://phabricator.services.mozilla.com/D187833
2023-10-24 01:48:09 +00:00
Cristina Horotan
ea9336a2ca Backed out 5 changesets (bug 1851992) for causing multiple failures
Backed out changeset d28399b3d947 (bug 1851992)
Backed out changeset 95e4df69007a (bug 1851992)
Backed out changeset fa61d4e76827 (bug 1851992)
Backed out changeset 79969d9eb5cd (bug 1851992)
Backed out changeset 03c17255f1af (bug 1851992)
2023-10-17 14:48:23 +03:00
sunil mayya
f350089afd Bug 1851992 - implement nsIThreadRetargetableStreamListener::OnDataFinished to multiple listeners. r=necko-reviewers,extension-reviewers,jesup,rpl
Differential Revision: https://phabricator.services.mozilla.com/D187833
2023-10-17 08:27:49 +00:00
Thomas Wisniewski
ef25919692 Bug 1845006 - store the fully-serialized MimeType on data url channels so XHR and fetch may use it for content-type response headers, and clean up the data url parsing code to better match the spec. r=kershaw,sunil,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D184713
2023-08-02 23:41:24 +00:00
Narcis Beleuzu
bb51890b79 Backed out changeset f96e24bbd71c (bug 1845006) for bustages on nsDataHandler.cpp 2023-08-02 22:39:40 +03:00
Thomas Wisniewski
07889f5cff Bug 1845006 - store the fully-serialized MimeType on data url channels so XHR and fetch may use it for content-type response headers, and clean up the data url parsing code to better match the spec. r=kershaw,sunil,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D184713
2023-08-02 16:33:41 +00:00
Cristina Horotan
b3b6dfdc84 Backed out changeset 8d98996f824c (bug 1845006) for causing build bustage at FetchDriver.cpp CLOSED TREE 2023-08-02 17:22:58 +03:00
Thomas Wisniewski
6948e36567 Bug 1845006 - store the fully-serialized MimeType on data url channels so XHR and fetch may use it for content-type response headers, and clean up the data url parsing code to better match the spec. r=kershaw,sunil,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D184713
2023-08-02 13:39:48 +00:00
Thomas Wisniewski
8cad5e6e32 Bug 1784880 - Support range requests on blob URLs in fetch/XMLHttpRequest; r=dlrobertson,necko-reviewers,jesup
Differential Revision: https://phabricator.services.mozilla.com/D184281
2023-08-01 18:50:37 +00:00
Cristian Tuns
79aa088ed0 Backed out changeset 384e4f88f047 (bug 1784880) for causing wpt failures in parsedepth.html CLOSED TREE 2023-08-01 05:41:04 -04:00
Thomas Wisniewski
44b6f2153c Bug 1784880 - Support range requests on blob URLs in fetch/XMLHttpRequest; r=dlrobertson,necko-reviewers,jesup
Differential Revision: https://phabricator.services.mozilla.com/D184281
2023-08-01 02:48:47 +00:00
Thomas Wisniewski
ff08d02a43 Bug 1576602 - fetch response body should be empty for HEAD/CONNECT requests, per spec; r=kershaw,sunil
Differential Revision: https://phabricator.services.mozilla.com/D183434
2023-07-19 02:44:01 +00:00
Nika Layzell
9f4d22f4e0 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
bf3fa5100a 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
da9145b668 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
021d7987c7 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
c871ac466f 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
8e679fa457 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
8f95e3fca6 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
ddaba9c7bb 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
3ae22e6d6f 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
5648b756d7 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
0b5aa4e516 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
8e786e56ce 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
f8bc1640a9 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
2ca58b8fde 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
2a016fbd8d 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
159a61e1f2 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
1037940f5b 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
cb305f0962 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
3d02a65194 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
df4d1e4a94 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
7855df7caf 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
d71967bf2f 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
0d5b1d231b 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
56ecd30a22 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
05dc2710d3 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