Commit graph

535 commits

Author SHA1 Message Date
Sean
680bd63580 Bug 1895232 - Convert do_GetService to using components::*::service in netwerk/ r=valentin,cookie-reviewers,places-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D209747
2024-05-30 21:18:43 +00:00
Cristian Tuns
fc392b89ab Backed out changeset 9b708a1dc402 (bug 1890748) for causing bc failures in browser_permission_delegate_geo.js CLOSED TREE 2024-05-27 12:25:10 -04:00
Malte Juergens
6a1787e9e9 Bug 1885893 - Only collect HTTPS-First telemetry on successful request r=freddyb
This patch addresses the problem that we currently collect HTTPS-First telemetry
for sites that are not reachable at all, be it through always causing a error or
through always timing out.

- On a downgrade, do not collect telemetry instantly, but instead save the
  telemetry data in the load state for the downgraded request
- That telemetry data will then be copied over into the document load listener
  of the new request
- On a successful request, if we have downgrade data in the load listener, we
  collect the downgrade telemetry, as the downgrade seems to have been
  successful
- Similar to the downgrade case, we only count the upgrade metric once we
  encounter a successful request annotated with the information that it was
  upgraded by HTTPS-First, instead of counting it instantly on the decision to
  upgrade. This also means the upgrade metric will not include loads that are
  downgraded again anymore
- Add a testcase for a site which is neither reachable via HTTP nor HTTPS, and
  ensure no telemetry is collected

Differential Revision: https://phabricator.services.mozilla.com/D210792
2024-05-27 14:20:11 +00:00
Andreas Farre
ec8d5be38a Bug 1890748 - Move responsibility of FeaturePolicy initialization to nsILoadInfo. r=freddyb,necko-reviewers,jesup,dom-core,sefeng
Differential Revision: https://phabricator.services.mozilla.com/D207140
2024-05-27 10:06:58 +00:00
Butkovits Atila
f967675ec8 Backed out changeset a710fd347db2 (bug 1890748) for causing bustages at Document.cpp. CLOSED TREE 2024-05-24 18:06:30 +03:00
Andreas Farre
031a90d97c Bug 1890748 - Move responsibility of FeaturePolicy initialization to nsILoadInfo. r=freddyb,necko-reviewers,jesup,dom-core,sefeng
Differential Revision: https://phabricator.services.mozilla.com/D207140
2024-05-24 14:28:47 +00:00
Iulian Moraru
3d5936348b Backed out changeset 9a295c851c2e (bug 1895232) for causing multiple failures. CLOSED TREE 2024-05-22 21:03:20 +03:00
Sean
3cbf13bd8f Bug 1895232 - Convert do_GetService to using components::*::service in netwerk/ r=valentin,cookie-reviewers,places-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D209747
2024-05-22 17:13:29 +00:00
Andrew Sutherland
6fa18c8313 Bug 1736488 - Ensure we update the channel cookie jar before deriving principals from it. r=valentin,bvandersloot,necko-reviewers
Without this patch we potentially create the reserved client principal
based on a stale cookie jar because we add the ClientChannelHelper
before the cookie jar's partition key is mutated in
nsHttpChannel::AsyncOpen.

Differential Revision: https://phabricator.services.mozilla.com/D211148
2024-05-22 16:41:44 +00:00
Mathew Hodson
9c35a1eb34 Bug 1887839 - Remove fission.remoteObjectEmbed pref r=farre
Differential Revision: https://phabricator.services.mozilla.com/D206574
2024-04-04 14:56:45 +00:00
Cristian Tuns
6169ac57de Backed out 8 changesets (bug 1081542) for causing Bug 1885050
Backed out changeset 38614c34e575 (bug 1081542)
Backed out changeset 7571e95ed78c (bug 1081542)
Backed out changeset 29f139450ccc (bug 1081542)
Backed out changeset 058d5712354b (bug 1081542)
Backed out changeset 7f46e8820023 (bug 1081542)
Backed out changeset d29d7e9c38bd (bug 1081542)
Backed out changeset 0a6b3d90e636 (bug 1081542)
Backed out changeset 27dae926668f (bug 1081542)
2024-03-13 06:15:27 -04:00
Nika Layzell
472a1946e6 Bug 1868001 - Part 2: Stop treating NS_ERROR_WONT_HANDLE_CONTENT as an error condition in ParentProcessDocumentOpenInfo, r=smaug,necko-reviewers,valentin
This was causing object loads which aren't handled by a document to not
enter the content process, meaning that repsonse timing tests would
fail.

NS_ERROR_WONT_HANDLE_CONTENT returned from this method is not a real
error condition, as it just indicates that we decided to not handle the
response in nsDocShell explicitly, much like returning `NS_OK` and not
specifying `m_targetStreamListener`.

Depends on D201645

Differential Revision: https://phabricator.services.mozilla.com/D204056
2024-03-11 20:17:41 +00:00
Nika Layzell
7fb185e583 Bug 1868001 - Part 1: Ignore Content-Disposition if DONT_RETARGET is set, r=smaug
This patch modifies the behaviour of loads when the DONT_RETARGET
nsIURILoader flag is set, making them ignore the Content-Disposition
header. This means that loads which cannot trigger downloads will
attempt to display handleable content which would otherwise be
downloaded.

This keeps overall behaviour of object/embed elements more similar to
their behaviour pre-Fission, while allowing them to load attachment PDFs
and Images as-if they were being displayed by a plugin.

This patch does not change the existing behaviour around
unknown/unhandleable resource types in object/embed elements.
In Gecko, object/embed elements are prevented from triggering downloads
or external protocol handlers during their initial load. Other browser
engines can trigger a download for an unknown resource type (or
sometimes an attachment resource).

The new pref dom.navigation.object_embed.allow_retargeting can be
enabled to instead trigger a download when loading these resources
within an object/embed element.

Differential Revision: https://phabricator.services.mozilla.com/D201645
2024-03-11 20:17:41 +00:00
Malte Juergens
aafba62d3d Bug 1868380 - Add glean telemetry for HTTPS-First r=freddyb,simonf
- Add new glean metrics.yaml for dom/security
- Add 8 new metrics for (schemeless) HTTPS-First, see metrics.yaml for
  explanation
- Add getter for timing on document load listener
- Provide `nsHTTPSOnlyUtils::PotentiallyDowngradeHttpsFirstRequest` with
  complete document load listener so that it is able to access the timing
- Adapt browser_httpsfirst.js and browser_schemeless.js tests to also check
  for correct telemetry values

Differential Revision: https://phabricator.services.mozilla.com/D196072
2024-03-06 17:19:35 +00:00
Natalia Csoregi
01a75161fa Backed out changeset 8c0e44e4d9ae (bug 1868380) for causing py3 failures on test_yaml_indices.py. CLOSED TREE 2024-03-06 12:32:10 +02:00
Malte Juergens
a5157b246f Bug 1868380 - Add glean telemetry for HTTPS-First r=freddyb,simonf
- Add new glean metrics.yaml for dom/security
- Add 5 new metrics for (schemeless) HTTPS-First, see metrics.yaml for
  explanation
- Add getter for timing on document load listener
- Provide `nsHTTPSOnlyUtils::PotentiallyDowngradeHttpsFirstRequest` with
  complete document load listener so that it is able to access the timing
- Adapt browser_httpsfirst.js and browser_schemeless.js tests to also check
  for correct telemetry values

Differential Revision: https://phabricator.services.mozilla.com/D196072
2024-03-06 08:46:11 +00:00
Tooru Fujisawa
86d5bc7bde Bug 1081542 - Part 1: Add nsIBrowserDOMWindow.OPEN_NEWTAB_FOREGROUND. r=smaug,geckoview-reviewers,Gijs,amejiamarmol
Given meta/ctrl key should use browser.tabs.loadInBackground pref instead of
browser.tabs.loadDivertedInBackground pref, the existing
nsIBrowserDOMWindow.OPEN_NEWTAB behavior doesn't match the requirement.

Add dedicate flag for "open in foreground tab" to make it controllable from
nsWindowWatcher::IsWindowOpenLocationModified.

Differential Revision: https://phabricator.services.mozilla.com/D201929
2024-02-27 14:12:09 +00:00
Cristian Tuns
4e97787e18 Backed out 8 changesets (bug 1081542) for causing bc failures in browser_cancel_starting_autoscrolling_requested_by_background_tab.js CLOSED TREE
Backed out changeset 3cc96704d17f (bug 1081542)
Backed out changeset 9f3fe37b77ca (bug 1081542)
Backed out changeset 8d495120e6d2 (bug 1081542)
Backed out changeset ade6db42285d (bug 1081542)
Backed out changeset 56fb245cd38e (bug 1081542)
Backed out changeset c4530ae2b9e3 (bug 1081542)
Backed out changeset 758ad04a330e (bug 1081542)
Backed out changeset deb46de7b01c (bug 1081542)
2024-02-27 04:05:22 -05:00
Tooru Fujisawa
e3f5d5c722 Bug 1081542 - Part 1: Add nsIBrowserDOMWindow.OPEN_NEWTAB_FOREGROUND. r=smaug,geckoview-reviewers,Gijs,amejiamarmol
Given meta/ctrl key should use browser.tabs.loadInBackground pref instead of
browser.tabs.loadDivertedInBackground pref, the existing
nsIBrowserDOMWindow.OPEN_NEWTAB behavior doesn't match the requirement.

Add dedicate flag for "open in foreground tab" to make it controllable from
nsWindowWatcher::IsWindowOpenLocationModified.

Differential Revision: https://phabricator.services.mozilla.com/D201929
2024-02-27 07:28:18 +00:00
Sandor Molnar
b1d213acb7 Backed out changeset 8e21fdfc60f0 (bug 1868001) for causing mochitest failures at dom/tests/mochitest/general/test_resource_timing_cross_origin.html CLOSED TREE 2024-02-20 20:36:30 +02:00
Nika Layzell
ec657d1c80 Bug 1868001 - Ignore Content-Disposition if DONT_RETARGET is set, r=smaug
This patch modifies the behaviour of loads when the DONT_RETARGET
nsIURILoader flag is set, making them ignore the Content-Disposition
header. This means that loads which cannot trigger downloads will
attempt to display handleable content which would otherwise be
downloaded.

This keeps overall behaviour of object/embed elements more similar to
their behaviour pre-Fission, while allowing them to load attachment PDFs
and Images as-if they were being displayed by a plugin.

This patch does not change the existing behaviour around
unknown/unhandleable resource types in object/embed elements.
In Gecko, object/embed elements are prevented from triggering downloads
or external protocol handlers during their initial load. Other browser
engines can trigger a download for an unknown resource type (or
sometimes an attachment resource).

The new pref dom.navigation.object_embed.allow_retargeting can be
enabled to instead trigger a download when loading these resources
within an object/embed element.

Differential Revision: https://phabricator.services.mozilla.com/D201645
2024-02-20 17:33:57 +00:00
Manuel Bucher
37f6febe1d Bug 1875268 - Fix Early Hints Preload channel sharing aCallbacks with main request r=necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D199640
2024-01-26 16:39:08 +00:00
Nika Layzell
aa6fe46883 Bug 1843752 - Explicitly transfer ownership of queued-up OnDataAvailableParams data buffers, r=necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D198189
2024-01-25 17:18:48 +00:00
Tooru Fujisawa
7eb60cfbdc Bug 1873330 - Part 1: Add nsIBrowserDOMWindow.OPEN_NEWTAB_BACKGROUND. r=smaug,geckoview-reviewers,amejiamarmol
In order to achieve "load in a new background tab" operation in `window.open`,
add OPEN_NEWTAB_BACKGROUND which is equivalent to OPEN_NEWTAB except for
not selecting the tab.

Differential Revision: https://phabricator.services.mozilla.com/D197859
2024-01-11 17:24:01 +00:00
Oliver Medhurst
465206f92c Bug 1793560 - Remove navigate-to CSP directive r=tschuster
It has never shipped after being implemented years ago,
and was removed from spec in September 2022:
https://github.com/w3c/webappsec-csp/pull/564

Now skipping navigate-to WPT tests. Filed issue upstream for their future removal:
https://github.com/w3c/webappsec-csp/issues/608
Consensus seems to agree to remove, will do in follow up bug once landed.

Also removed our own tests.

Added a hack in StartDocumentLoad as just removing the navigate-to check call
breaks some inhertiance, see comment for more info.

Differential Revision: https://phabricator.services.mozilla.com/D181630
2024-01-03 16:43:12 +00:00
Tom Schuster
061fc361e2 Bug 1867628 - Fire a load event when frame-ancestors blocks an iframe (similar to X-Frame-Options). r=nika,smaug
Differential Revision: https://phabricator.services.mozilla.com/D196036
2023-12-19 10:05:12 +00:00
Norisz Fay
1b80057444 Backed out changeset 1951291f3ee0 (bug 1868001) for causing bc failures on browser_save_filenames.js 2023-12-18 21:31:36 +02:00
Nika Layzell
06dfecd6f1 Bug 1868001 - Allow object and embed element loads to trigger Content-Disposition: attachment downloads, r=smaug,necko-reviewers,jesup
This will impact all resource types which are loaded as documents within
object/embed elements, which should roughly correspond to the behaviour
prior to Fission.

The major exception here which is a behaviour change is around image
loading. In bug 1595491, the way these were loaded to be using an image
document under the hood. At the time, this meant that image loads with
CD: attachment specified would fail to load, but this change will mean
that they will instead are downloaded.

Additional changes would need to be made to preserve the older behaviour
of ignoring Content-Disposition when loading images in object/embed
elements, if it turns out to be a web-compat issue.

Differential Revision: https://phabricator.services.mozilla.com/D196363
2023-12-18 18:16:04 +00:00
Malte Juergens
2bbd0c4d22 Bug 1858894 - Hide http history entries that were upgraded to https r=places-reviewers,freddyb,mak
Differential Revision: https://phabricator.services.mozilla.com/D192229
2023-11-20 09:27:57 +00:00
Tim Huang
414ea70e79 Bug 1824222 - Populate the OverriddenFingerprintingSettings to the loadInfo when opening channels. r=tjr,anti-tracking-reviewers,pbz,necko-reviewers,kershaw
We populate the OverriddenFingerprintingSettings to the loadInfo when updating
AntiTracking Info for the channel. This happens when we open the channel
in the parent process, so we have every info we need to get the
granular overrides for the channel.

Differential Revision: https://phabricator.services.mozilla.com/D185013
2023-10-17 22:02:28 +00:00
Frederik Braun
7291dac470 Bug 1812192 - Store schemeless address bar loads in loadinfo and upgrade to https with fallback r=necko-reviewers,webidl,smaug,freddyb,kershaw
Depends on D179794

Differential Revision: https://phabricator.services.mozilla.com/D179795
2023-10-11 17:49:42 +00:00
Cristian Tuns
5fabc0ee57 Backed out 6 changesets (bug 1812192) for causing browser_schemeless.js failures. CLOSED TREE
Backed out changeset 3d07a92324d0 (bug 1812192)
Backed out changeset 9c2a1ff6c90d (bug 1812192)
Backed out changeset fa6784f8b0f4 (bug 1812192)
Backed out changeset 0f39aba7e4d5 (bug 1812192)
Backed out changeset ef7219327a10 (bug 1812192)
Backed out changeset 9833b559342e (bug 1812192)
2023-10-10 10:02:25 -04:00
Frederik Braun
aed55ecb55 Bug 1812192 - Store schemeless address bar loads in loadinfo and upgrade to https with fallback r=necko-reviewers,webidl,smaug,freddyb,kershaw
Depends on D179794

Differential Revision: https://phabricator.services.mozilla.com/D179795
2023-10-10 08:43:00 +00:00
Malte Juergens
83723019a1 Bug 1847918 - Limit nsDocShellLoadState::IsExemptFromHTTPSOnlyMode to HTTPS-First r=freddyb
`nsDocShellLoadState::IsExemptFromHTTPSOnlyMode` is currently only used by HTTPS-First. It is used for fixing upgrade-downgrade loops and when loading history entries, as when we already know if HTTPS-First succeeded there or not, we have no need for trying to upgrade again and can disable HTTPS-First. With the changes introduced by Bug 1839612, `nsDocShellLoadState::IsExemptFromHTTPSOnlyMode` also applies to HTTPS-Only, which is a problem because disabling HTTPS-Only for history entries will result in them potentially being loaded insecurely without the user setting an exception. As a solution this patch just applies `nsILoadInfo::HTTPS_ONLY_EXEMPT_NEXT_LOAD`, the flag being set when `nsDocShellLoadState::IsExemptFromHTTPSOnlyMode` is set, when HTTPS-First is enabled, and renames both flags to reflect that behavior.

Differential Revision: https://phabricator.services.mozilla.com/D185829
2023-09-11 12:14:30 +00:00
Benjamin VanderSloot
58d36f75d6 Bug 1835907, part 1 - Add has storage access bit and triggering window id to the LoadInfo - r=smaug,necko-reviewers,kershaw,pbz
In the Storage Access API's latest draft, a few items were added to the user-agent state. Relevant here,
the source snapshot params gained two fields that are initialized from the sourceDocument during
snapshotting source params while navigating: "has storage access" and "environment id".

https://privacycg.github.io/storage-access/#ua-state

These are used to identify self-initiated navigations that come from documents that have obtained storage access.
Combined with a same-origin check, this determines if the destination document of the navigation should start
with storage access.

This is stricter than the current behavior, where if the permission is available, all documents start with storage access.
Instead, now a document will only have storage access if it requests it explicitly or if a same-origin document that has
storage access navigates itself to that document. This is seen as a security win.

Security discussion of this change was here: https://github.com/privacycg/storage-access/issues/113
Artur at Google wrote up a great summary here: https://docs.google.com/document/d/1AsrETl-7XvnZNbG81Zy9BcZfKbqACQYBSrjM3VsIpjY/edit#

Differential Revision: https://phabricator.services.mozilla.com/D184821
2023-08-15 13:04:04 +00:00
Cosmin Sabou
4f5ef3986b Backed out 6 changesets (bug 1835907) for causing multiple failures. CLOSED TREE
Backed out changeset 91ef29afec50 (bug 1835907)
Backed out changeset 989479621780 (bug 1835907)
Backed out changeset 86e3f98ceb31 (bug 1835907)
Backed out changeset 4790e44c234c (bug 1835907)
Backed out changeset bb9f48eec5bf (bug 1835907)
Backed out changeset 74f90708260a (bug 1835907)
2023-08-14 22:18:10 +03:00
Benjamin VanderSloot
06a4432ed1 Bug 1835907, part 1 - Add has storage access bit and triggering window id to the LoadInfo - r=smaug,necko-reviewers,kershaw,pbz
In the Storage Access API's latest draft, a few items were added to the user-agent state. Relevant here,
the source snapshot params gained two fields that are initialized from the sourceDocument during
snapshotting source params while navigating: "has storage access" and "environment id".

https://privacycg.github.io/storage-access/#ua-state

These are used to identify self-initiated navigations that come from documents that have obtained storage access.
Combined with a same-origin check, this determines if the destination document of the navigation should start
with storage access.

This is stricter than the current behavior, where if the permission is available, all documents start with storage access.
Instead, now a document will only have storage access if it requests it explicitly or if a same-origin document that has
storage access navigates itself to that document. This is seen as a security win.

Security discussion of this change was here: https://github.com/privacycg/storage-access/issues/113
Artur at Google wrote up a great summary here: https://docs.google.com/document/d/1AsrETl-7XvnZNbG81Zy9BcZfKbqACQYBSrjM3VsIpjY/edit#

Differential Revision: https://phabricator.services.mozilla.com/D184821
2023-08-14 18:02:46 +00:00
Manuel Bucher
43f8338f9c Bug 1842754 - Make LoadInfoArgs non-optional over IPC r=necko-reviewers,jesup
This makes all occurences of LoadInfoArgs non-optional also when
converting between nsILoadInfo in BackgroundUtils.h.

Differential Revision: https://phabricator.services.mozilla.com/D185299
2023-08-11 13:45:25 +00:00
Natalia Csoregi
d2ed1b1ca2 Backed out changeset 3c585e66b44b (bug 1842754) for causing Bug 1847904. CLOSED TREE 2023-08-09 19:35:08 +03:00
Manuel Bucher
f37405ff24 Bug 1842754 - Make LoadInfoArgs non-optional over IPC r=necko-reviewers,jesup
This makes all occurences of LoadInfoArgs non-optional also when
converting between nsILoadInfo in BackgroundUtils.h.

Differential Revision: https://phabricator.services.mozilla.com/D185299
2023-08-08 14:37:19 +00:00
Iulian Moraru
98f7137dd1 Backed out changeset 05857d2111ba (bug 1842754) for causing build bustages on BackgroundUtils.cpp. CLOSED TREE 2023-08-08 13:51:28 +03:00
Manuel Bucher
25a2f89619 Bug 1842754 - Make LoadInfoArgs non-optional over IPC r=necko-reviewers,jesup
This makes all occurences of LoadInfoArgs non-optional also when
converting between nsILoadInfo in BackgroundUtils.h.

Differential Revision: https://phabricator.services.mozilla.com/D185299
2023-08-08 10:25:04 +00:00
Peter Van der Beken
dfce7f40b3 Bug 1843968 - Hold some strong references. r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D184803
2023-08-01 12:09:36 +00:00
Paul Zuehlcke
1251873a4c Bug 1839916 - Add navigation callbacks for BounceTrackingState in DocumentLoadListener. r=bvandersloot,smaug
Differential Revision: https://phabricator.services.mozilla.com/D182343
2023-07-18 08:26:22 +00:00
Cristina Horotan
ebef1cfabb Backed out 5 changesets (bug 1839916) for causing build bustage at BounceTrackingState.cpp CLOSED TREE
Backed out changeset 97b7c9d34869 (bug 1839916)
Backed out changeset c4068176e8e1 (bug 1839916)
Backed out changeset 815021dbe6fe (bug 1839916)
Backed out changeset aeab1abeef2f (bug 1839916)
Backed out changeset 1c459fb2b051 (bug 1839916)
2023-07-17 21:58:40 +03:00
Paul Zuehlcke
b1a6751277 Bug 1839916 - Add navigation callbacks for BounceTrackingState in DocumentLoadListener. r=bvandersloot,smaug
Differential Revision: https://phabricator.services.mozilla.com/D182343
2023-07-17 17:54:51 +00:00
Cristian Tuns
3d5d7bda0c Backed out 5 changesets (bug 1839916) for causing build bustages in BounceTrackingRecord.cpp CLOSED TREE
Backed out changeset 062039e3c9ca (bug 1839916)
Backed out changeset 3713d0250e5e (bug 1839916)
Backed out changeset 39cbf84f51b7 (bug 1839916)
Backed out changeset 44f32df69c08 (bug 1839916)
Backed out changeset fce071d0f22b (bug 1839916)
2023-07-17 10:29:33 -04:00
Paul Zuehlcke
8dba0c1f98 Bug 1839916 - Add navigation callbacks for BounceTrackingState in DocumentLoadListener. r=bvandersloot,smaug
Differential Revision: https://phabricator.services.mozilla.com/D182343
2023-07-17 12:58:36 +00:00
Kagami Sascha Rosylight
2d650853a8 Bug 1842007 - Part 7: Remove MozPromise::FromDomPromise r=xpcom-reviewers,necko-reviewers,nika,jesup
Nobody uses it and currently not super useful as the possible return value is limited to primitives. It could be extended to support DOM objects, but I don't know there's actual use cases for that as in many cases the promise is resolved with non-DOM values.

Differential Revision: https://phabricator.services.mozilla.com/D183026
2023-07-13 12:43:41 +00:00
Malte Juergens
ad465aab06 Bug 1839612: HTTPS-First: Clear HTTPS_ONLY_EXEMPT on every load r=necko-reviewers,freddyb,kershaw
- Also clear HTTPS_ONLY_EXEMPT for HTTPS-First in TestSitePermissionAndPotentiallyAddExemption
- Remove PotentiallyClearExemptFlag as we are now clearing the exemption every time
- Introduce new flag HTTPS_ONLY_EXEMPT_NEXT_LOAD which will set the exemption again after it being (potentially) cleared
- Set that flag when nsDocShellLoadState::IsExemptFromHTTPSOnlyMode is set, since that happens before the exemption is cleared

Differential Revision: https://phabricator.services.mozilla.com/D182322
2023-07-11 11:07:24 +00:00