Граф коммитов

3924 Коммитов

Автор SHA1 Сообщение Дата
Gijs Kruitbosch b0e84f1da8 Bug 1800954 - update mots and moz.build metadata for uriloader folder, r=nika,mak,valentin,zeid
Differential Revision: https://phabricator.services.mozilla.com/D163114
2022-11-30 01:22:01 +00:00
Nika Layzell 399a2f946d Bug 1538028 - Part 3: Validate loads by TriggeringRemoteType, r=smaug,ckerschb
The previous part introduced a new mechanism to track the triggering remote
type for a specific load in a reliable way. This adds some basic checks based
on the triggering remote type to the nsContentSecurityManager, while also
providing the potential infrastructure to expand these checks in the future.

As these checks are performed before some other content security checks (to
ensure that they are performed before InitialSecurityCheckDone() is checked),
they may reject a load which would otherwise have been rejected by a later
check. For this reason, the diagnostic assertions added in this part are only
fired if the check appears as though it would otherwise have succeeded. This
check is not fully accurate, however, so may miss some cases.

This is important, as we have some tests, such as service worker navigation
tests, which will try to load file:/// URIs in content processes, and only fail
in the later content security checks.

For now, no checks are performed for non-document loads, though that may change
in the future.

Differential Revision: https://phabricator.services.mozilla.com/D161199
2022-11-29 20:41:45 +00:00
Nika Layzell 34e62a0d9c Bug 1538028 - Part 2: Track TriggeringRemoteType through nsDocShellLoadState and LoadInfo, r=smaug,ckerschb,necko-reviewers,valentin
This is done using slightly different mechanisms for each of LoadInfo and
nsDocShellLoadState, and will be used in the next part to validate document
loads based on the RemoteType responsible for the load.

For subresource loads, the TriggeringRemoteType is fairly straightforward - it
is the process which created the channel. We can handle this by getting the
current remote type when creating the channel, and then using the remote type
of the sending process when receiving the LoadInfo over IPC to either replace
the triggering remote type, or validate it.

For document loads, the situation is a bit more complex, as there are at least
3 (potentially-)different processes responsible for different parts of the
navigation:

 1. The "Triggering Process" is the process which provided the URI to load.
    This is also the process which provides the Triggering Principal. This is
    the process being tracked in this patch.

 2. The "Loading Process" is the process which actually creates the channel and
    starts the load. This may be the same as the triggering process, or may be
    a different process starting the navigation on behalf of the triggering
    process. In general this is the process hosting the current docshell,
    though it may be the parent process in the case of parent-initiated loads.

 3. The "Final Process" is the process which receives the response and renders
    the final document. This isn't known at channel creation time, and is
    determined by the result principal and process isolation policy.

This change uses a serializer and special field on nsDocShellLoadState to track
the "Triggering Process" for the load, even as the load state is serialized
between processes by tracking which loads were sent into which content
processes, and matching them up when the parent process sees them again. The
information is then copied into the LoadInfo before configuring the real
channel, so it can be used for security checks.

The "Triggering Process" is overridden to be the parent process for history
loads, as history loads are often started in processes which wouldn't normally
be able to navigate to those pages. This is OK thanks to the changes in part 1
which validate history loads against the real session history when SHIP is
enabled.

Differential Revision: https://phabricator.services.mozilla.com/D161198
2022-11-29 20:41:45 +00:00
Butkovits Atila 80588bf3b3 Backed out changeset 8742903f6f19 (bug 1800954) for causing linting failures. CLOSED TREE 2022-11-28 22:17:16 +02:00
Gijs Kruitbosch a8725d77c0 Bug 1800954 - update mots and moz.build metadata for uriloader folder, r=nika,mak,valentin,zeid
Differential Revision: https://phabricator.services.mozilla.com/D163114
2022-11-28 19:48:17 +00:00
Sandor Molnar 77a39e7595 Backed out changeset 28484915dc1b (bug 1795894) for causing mochitest failures. CLOSED TREE 2022-11-28 04:33:07 +02:00
Meg Viar 84f96f4bc4 Bug 1795894 - Enable triggering Feature Callouts in chrome by content location r=jprickett
Differential Revision: https://phabricator.services.mozilla.com/D160503
2022-11-28 00:54:14 +00:00
Barret Rennie 88d50de4b9 Bug 1541508 - Use Services.env in uriloader/ r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D160151
2022-11-25 19:09:12 +00:00
Calixte 705175683e Bug 1754499 - Add pdf.js in GeckoView r=geckoview-reviewers,pdfjs-reviewers,marco,m_kato
Just add the minimal stuff in order to be able to view a pdf in using pdf.js
(whatever the content disposition is).
There are still some things to plug (e.g. find stuff), we must change the UI
and add support for pinch-to-zoom, hence we set the pref pdfjs.disabled to true.

Differential Revision: https://phabricator.services.mozilla.com/D162122
2022-11-24 13:36:17 +00:00
Stanca Serban 3811bf75f5 Backed out changeset 02a9e51358f1 (bug 1792138) for causing mochitests failures on browser_ext_windows_create_url.js. CLOSED TREE 2022-11-17 18:38:00 +02:00
Dave Townsend 1573156d9c Bug 1792138: Show the extension's name in permission prompts for opening external links. r=ckerschb,robwu,fluent-reviewers,pbz,flod
In order to handle the content script case correctly we must expose the
contentScriptAddonPolicy to JavaScript. With that we can always see what
extension is trying to perform an action and use its name rather than internal
ID in the dialog.

Differential Revision: https://phabricator.services.mozilla.com/D161282
2022-11-17 14:44:57 +00:00
Mark Banner a9ec0b8434 Bug 1799314 - Convert consumers of testing modules to import ES modules direct (uriloader/ dom/ docshell/). r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D161909
2022-11-17 12:00:28 +00:00
Valentin Gosu c05781f028 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
Dan Robertson d349734f89 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
Neil Deakin 5586066f10 Bug 1796395, remove now unneeded downloads.helpertype telemetry probe, r=mconley
Differential Revision: https://phabricator.services.mozilla.com/D161825
2022-11-10 20:44:31 +00:00
Dave Townsend 7239bae84b Bug 1799632: Refactor `testOpenProto` to accept a callback to trigger protocol loads. r=Gijs
Currently this function uses six different booleans to decide which code to run
to trigger the load (many of which are used in just one test) and elsewhere I
need to add more cases. This changes the function to instead take a callback
function so individual tests can just pass their one-off functions. For the
few that are shared global functions are used to share those.

Differential Revision: https://phabricator.services.mozilla.com/D161588
2022-11-08 15:29:49 +00:00
alwu 5704ca1fd2 Bug 1782366 - part2 : mapping audio extension to 'video/mp4' as well. r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D157685
2022-11-07 22:43:26 +00:00
Mark Banner a24dca9645 Bug 1798212 - Replace defineModuleGetter in Integration.sys.mjs with a ES version. r=settings-reviewers,mossop
Differential Revision: https://phabricator.services.mozilla.com/D161014
2022-11-07 17:56:10 +00:00
Mark Banner 18753bfe42 Bug 1798212 - Convert consumers of downloads code to ES modules. r=mak,geckoview-reviewers,extension-reviewers,settings-reviewers,credential-management-reviewers,sgalich,mconley,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D161013
2022-11-07 17:56:10 +00:00
Mark Banner a9d47c7a8c Bug 1798212 - Convert downloads code to ES modules. r=mak
Differential Revision: https://phabricator.services.mozilla.com/D161012
2022-11-07 17:56:09 +00:00
Shane Caraveo d3e7b16fa3 Bug 1705044 r=freddyb,Gijs,mixedpuppy
Differential Revision: https://phabricator.services.mozilla.com/D154919
2022-11-03 17:00:40 +00:00
Cristian Tuns 4d37cf70f1 Backed out 19 changesets (bug 1541508) for causing xpcshell failures on test_notHeadlessByDefault.js CLOSED TREE
Backed out changeset 08476fa2bc27 (bug 1541508)
Backed out changeset 0bf7514845db (bug 1541508)
Backed out changeset aa612a5e9ef7 (bug 1541508)
Backed out changeset 6bb9360473f7 (bug 1541508)
Backed out changeset b3d8e92f50c2 (bug 1541508)
Backed out changeset fa40dded133e (bug 1541508)
Backed out changeset 2e7db4aa8d4f (bug 1541508)
Backed out changeset 6098e2eb62ea (bug 1541508)
Backed out changeset 2c599ee639c4 (bug 1541508)
Backed out changeset 7d44f6e2644c (bug 1541508)
Backed out changeset c1279c3d674c (bug 1541508)
Backed out changeset 8bd08a62a590 (bug 1541508)
Backed out changeset 740010cb005c (bug 1541508)
Backed out changeset 0bfc7dd85c62 (bug 1541508)
Backed out changeset c4374a351356 (bug 1541508)
Backed out changeset 44ccfeca7364 (bug 1541508)
Backed out changeset e944e706a523 (bug 1541508)
Backed out changeset 2c59d66f43e4 (bug 1541508)
Backed out changeset a1896eacb6f1 (bug 1541508)
2022-11-01 22:38:52 -04:00
Barret Rennie 3250d6ee4d Bug 1541508 - Use Services.env in uriloader/ r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D160151
2022-11-02 02:08:59 +00:00
Daniel Holbert 16170f25a6 Bug 1797840: Replace stray tab characters with spaces in IDL files throughout the tree. r=mccr8,necko-reviewers,credential-management-reviewers,smaug,sgalich,valentin
DONTBUILD because this is just whitespace cleanup.

I found the files to fix up here using this command:
    grep -r '   ' * 2>/dev/null | grep -v "other-licenses" | grep "idl:"

I replaced the tab characters with however many spaces seemed consistent with
the indentation in the surrounding code (and did some minor space-indentation
cleanup in contextual lines to preserve alignment, in a few cases).

Differential Revision: https://phabricator.services.mozilla.com/D160577
2022-10-28 18:08:17 +00:00
Neil Deakin 7c2ed8357f Bug 1791033, avoid crash by computing the extension's byte length correctly and truncate the filename's extension when it is too long, r=gsvelto,jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D159703
2022-10-21 09:11:27 +00:00
Cristian Tuns b27c341fe1 Backed out changeset 05f17b2551cb (bug 1791033) for causing xpcshell failures on test_filename_sanitize.js CLOSED TREE 2022-10-20 12:15:38 -04:00
Neil Deakin d174679a36 Bug 1791033, avoid crash by computing the extension's byte length correctly and truncate the filename's extension when it is too long, r=gsvelto,jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D159703
2022-10-20 15:37:58 +00:00
Mike Conley 2ce45dc9bd Bug 1795188 - Migrate all uriloader/exthandler JSMs to ESMs. r=kpatenio
Differential Revision: https://phabricator.services.mozilla.com/D159345
2022-10-19 18:34:02 +00:00
Neil Deakin 747ddabbcd Bug 1778597, append valid extensions only when saving a page, r=Gijs,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D159478
2022-10-19 12:50:16 +00:00
Mark Banner 2ffde1e92f Bug 1792341 - Migrate more toolkit/modules consumers to use direct ES module import. r=Gijs,webdriver-reviewers,perftest-reviewers,necko-reviewers,geckoview-reviewers,preferences-reviewers,application-update-reviewers,pip-reviewers,credential-management-reviewers,sgalich,owlish,bytesized,AlexandruIonescu,whimboo,mconley,mixedpuppy
Mainly automated changes. Some manual ESLint fixes and whitespace cleanup.

Differential Revision: https://phabricator.services.mozilla.com/D158452
2022-10-18 11:21:26 +00:00
Eemeli Aro f5267a48fb Bug 1791178 - Use correct identifier for localized downloads forder. r=Gijs
This appears to have been a typo introduced in bug 1737926.

Differential Revision: https://phabricator.services.mozilla.com/D158465
2022-10-12 11:48:19 +00:00
Shane Hughes ad03151040 Bug 1742999 - Make DownloadSpamProtection per-window. r=Gijs,mak
This patch modifies DownloadSpamProtection and DownloadIntegration so
that each window will track blocked spam downloads separately. (Which
shouldn't affect permissions.) When a download is blocked, the helper
app service dispatches a notification, passing the relevant browsing
context and URL to DownloadIntegration. Then it passes the window and
URL to the singleton DownloadSpamProtection. That maps all the windows
to objects that carry the spam download objects. This allows us to only
show blocked spam downloads in the downloads panel of the window from
which they were triggered.

Differential Revision: https://phabricator.services.mozilla.com/D148092
2022-10-04 22:38:18 +00:00
Mark Banner 8d1ebcb9d6 Bug 1792365 - Convert toolkit/modules consumers to use ES module imports directly. r=webdriver-reviewers,perftest-reviewers,geckoview-reviewers,extension-reviewers,preferences-reviewers,desktop-theme-reviewers,application-update-reviewers,pip-reviewers,credential-management-reviewers,robwu,Gijs,sgalich,bytesized,AlexandruIonescu,dao,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D158094
2022-09-29 06:52:34 +00:00
Andrew McCreight 2da84b8ac4 Bug 1792574, part 3 - Don't include nsMemory where it isn't needed. r=xpcom-reviewers,necko-reviewers,valentin,nika
There are only 3 places where nsMemory.h is still needed (image/RasterImage.cpp,
gfx/thebes/gfxFT2FontList.cpp, and nsMemory.cpp). Remove the rest.

Differential Revision: https://phabricator.services.mozilla.com/D158213
2022-09-28 15:17:46 +00:00
Mathew Hodson a72c385753 Bug 1776578 - Replace init tasks with add_setup in mochitests. r=application-update-reviewers,Standard8
Differential Revision: https://phabricator.services.mozilla.com/D149486
2022-09-26 13:58:49 +00:00
Dana Keeler 923d7b2029 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
Marco Bonardo 107460db8e Bug 1789500 - filename sanitization may cut surrogate pairs when truncating. r=NeilDeakin
Differential Revision: https://phabricator.services.mozilla.com/D157516
2022-09-16 09:47:05 +00:00
Nika Layzell 0316dc51b9 Bug 1790614 - Part 2: Use {ASSERT,ENSURE}_NS_{SUCCEEEDED,FAILED} in gtests, r=ahal,necko-reviewers
These macros will produce better outputs when they fail than these existing
patterns using `ENSURE_TRUE(NS_SUCCEEDED(...))` or similar, so this is a bulk
rewrite of existing tests to use them.

It should also help with discoverability when people base their tests off of
other existing tests.

Differential Revision: https://phabricator.services.mozilla.com/D157214
2022-09-15 14:51:50 +00:00
Neil Deakin 2fb144622c Bug 1777207, don't replace extensions of executables when saving on Windows any more; the filename has already been validated and it can cause the filename a user chose to be incorrect, r=mhowell
Differential Revision: https://phabricator.services.mozilla.com/D156729
2022-09-15 01:26:04 +00:00
Norisz Fay dff4f6d15e 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 d164608d66 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
Kershaw Chang cc6c147f88 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
Masatoshi Kimura e7b3d513d4 Bug 1787633 - Make nsTextToSubURI::UnEscapeNonAsciiURI static. r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D156007
2022-09-06 15:59:06 +00:00
Neil Deakin 895b11972d Bug 1772988, add some additional extensions for some media types as Windows doesn't provide some of them, causing valid extensions to be replaced when saving files, r=mhowell
Differential Revision: https://phabricator.services.mozilla.com/D155972
2022-09-02 15:33:35 +00:00
Paul Zuehlcke cc5eea6b97 Bug 1736688 - Remove telemetry probe: EXTERNAL_PROTOCOL_HANDLER_DIALOG_CONTEXT_SCHEME. r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D156213
2022-09-02 10:35:44 +00:00
Butkovits Atila ca18bee08c Backed out changeset 517b6c2b1d57 (bug 1772988) for causing failures at test_filename_sanitize.js . CLOSED TREE 2022-08-30 22:56:49 +03:00
Neil Deakin acdb08b9f4 Bug 1772988, add some additional extensions for some media types as Windows doesn't provide some of them, causing valid extensions to be replaced when saving files, r=mhowell
Differential Revision: https://phabricator.services.mozilla.com/D155972
2022-08-30 19:23:34 +00:00
Andi-Bogdan Postelnicu eeac3728d2 Bug 1519636 - Reformat recent changes to the Google coding style. r=glandium
Updated with clang-format version 14.0.5 (taskcluster-DydCt-ryTuKvBYw1HQOugw)
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D154661
2022-08-16 07:08:27 +00:00
Dan Robertson 27907e8f9a 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
Mark Banner 7428be4a86 Bug 1782008 - Remove now unnecessary .eslintrc.js files. r=webcompat-reviewers,extension-reviewers,media-playback-reviewers,pip-reviewers,denschub,rpl,alwu,mossop
Differential Revision: https://phabricator.services.mozilla.com/D152736
2022-08-03 11:16:20 +00:00
Nika Layzell effe5537b9 Bug 1772006 - Part 6: Simplify and move the find+replace methods from ns[T]StringObsolete, r=xpcom-reviewers,barret
The remaining methods in ns[T]StringObsolete are all find+replace methods for
nsTSubstring. These were migrated in a similar way to the find methods, and
partially updated to avoid using methods from nsStringObsolete.cpp.

This change removes the ns[T]StringObsolete.cpp files completely, as they are
no longer necessary.

Differential Revision: https://phabricator.services.mozilla.com/D148301
2022-07-30 00:12:49 +00:00
Nika Layzell c15823d075 Bug 1772006 - Part 5: Simplify and move the string searching APIs from ns[T]StringObsolete, r=xpcom-reviewers,necko-reviewers,eeejay,dragana,barret
The biggest set of APIs from ns[T]StringObsolete which are still heavily used
are the string searching APIs. It appears the intention was for these to be
replaced by the `FindInReadable` APIs, however that doesn't appear to have
happened.

In addition, the APIs have some quirks around their handling of mixed character
widths. These APIs generally supported both narrow strings and the native
string type, probably because char16_t string literals weren't available until
c++11. Finally they also used easy-to-confuse unlabeled boolean and integer
optional arguments to control behaviour.

These patches do the following major changes to the searching APIs:

1. The ASCII case-insensitive search method was split out as
   LowerCaseFindASCII, rather than using a boolean. This should be less
   error-prone and more explicit, and allows the method to continue to use
   narrow string literals for all string types (as only ASCII is supported).
2. The other [R]Find methods were restricted to only support arguments with
   matching character types. I considered adding a FindASCII method which would
   use narrow string literals for both wide and narrow strings but it would've
   been the same amount of work as changing all of the literals to unicode
   literals.
   This ends up being the bulk of the changes in the patch.
3. All find methods were re-implemented using std::basic_string_view's find
   algorithm or stl algorithms to reduce code complexity, and avoid the need to
   carry around the logic from nsStringObsolete.cpp.
4. The implementations were moved to nsTStringRepr.cpp.
5. An overload of Find was added to try to catch callers which previously
   called `Find(..., false)` or `Find(..., true)` to set case-sensitivity, due
   to booleans normally implicitly coercing to `index_type`. This should
   probably be removed at some point, but may be useful during the transition.

Differential Revision: https://phabricator.services.mozilla.com/D148300
2022-07-30 00:12:48 +00:00
Christian Holler caf94dc5d4 Bug 1780741 - Add init checks to ExternalHelperAppParent. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D152633
2022-07-29 13:47:22 +00:00
Tim Huang daef272528 Bug 1773702 - Adding Content Blocking Event flags for email tracking protection. r=dimi
This patch adds a new Content Blocking Eveent flag and modifies the
current email tracking event flag. This would allow us to log the
loading of email tracker in two levels. The level 1 email tracker
contains the base list of the email trackers, The level 2 email tracker
contains both base and content email trackers.

Differential Revision: https://phabricator.services.mozilla.com/D152679
2022-07-27 20:07:53 +00:00
Neil Deakin 5c6bb2989e Bug 1778429, use utf-16 character literals when calling ReplaceChar in SanitizeFileName, r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D152669
2022-07-27 09:34:14 +00:00
Neil Deakin fca5ac1f23 Bug 1779128, rework filename sanitization to ensure that the extension is properly validated, r=Gijs
The existing code doesn't use the sanitized extension part of the filename, when it replaces the filename when it is too long but instead used a version passed to SanitizeFileName. This newer version always gets the extension from the filename after it has been validated.

Some tests have slightly different results, because the file is now cropped slightly differently when the character count and byte count of long filenames don't match, resulting in some filenames being cropped a few extra characters more than needed.

Differential Revision: https://phabricator.services.mozilla.com/D151826
2022-07-26 20:36:04 +00:00
Tooru Fujisawa a032f53a63 Bug 1780543 - Part 5: Add mozilla/chrome-script environment. r=Standard8
Differential Revision: https://phabricator.services.mozilla.com/D152430
2022-07-26 02:46:30 +00:00
Emilio Cobos Álvarez 42b7f1a58c Bug 1780788 - Use abstract strings as in-arguments for ipdl. r=nika,necko-reviewers,media-playback-reviewers,alwu,dragana
This prevents copies and avoids the hack we have to avoid this, which
right now is using nsDependent{C,}String.

Non-virtual actors can still use `nsString` if they need to on the
receiving end.

Differential Revision: https://phabricator.services.mozilla.com/D152519
2022-07-25 20:19:48 +00:00
Tim Huang 86d982dc94 Bug 1773695 - Part 2: Add flags for the email tracking protections. r=dimi
Differential Revision: https://phabricator.services.mozilla.com/D151049
2022-07-18 21:48:15 +00:00
Shane Hughes d5fb4566c2 Bug 1739348 - Don't open downloads panel after download dialogs. r=NeilDeakin
This is a medium sized patch to legacy download construction. It takes
advantage of the new property added in Bug 1762033 to prevent the
downloads panel from being automatically shown when a download is added
after an interaction with the unknown content type dialog or the file
picker dialog. I chose to not do the same for failed transfers since I
thought it might serve some use, but that might be wrong. I don't know
if there's a way to test the dialog that appears when you download an
executable without going through the same path I adjusted with the
patch. It seems like it's covered but I could be wrong. Also add a test
to cover these changes from the bottom up. Thanks and apologies for my
sloppy C++, though I'm sure I'll learn a lot more from the review 😅

Differential Revision: https://phabricator.services.mozilla.com/D145312
2022-07-18 20:45:41 +00:00
smolnar 1888800945 Bug 1767358 - Fix lint failure in uriloader/exthandler/tests/unit/test_handlerService.js r=emilio 2022-07-18 15:52:22 +03:00
Emilio Cobos Álvarez 780d0666b4 Bug 1767358 - Change pref rather than environment in test_handlerService.
MANUAL PUSH: Trivial test fix CLOSED TREE
2022-07-18 14:20:18 +02:00
Emilio Cobos Álvarez 7c1ba7092c Bug 1767358 - Cache mime/mailcap file location. r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D151919
2022-07-18 11:35:34 +00:00
Emilio Cobos Álvarez b3e37c1628 Bug 1767358 - Clean-up logging in uriloader/exthandler. r=Gijs
This allows logging in static functions. Also add missing includes.

Differential Revision: https://phabricator.services.mozilla.com/D151920
2022-07-18 10:07:02 +00:00
criss b77dc7a479 Backed out 6 changesets (bug 1773691, bug 1773695) for causing Bp-hybrid bustages on UrlClassifierFeatureEmailTrackingProtection
Backed out changeset f402f1bd4caa (bug 1773695)
Backed out changeset 001c38822c53 (bug 1773695)
Backed out changeset 8ef4d3597d92 (bug 1773695)
Backed out changeset f4770b2fe53d (bug 1773695)
Backed out changeset fb625ae08f73 (bug 1773695)
Backed out changeset 6c23adf9184f (bug 1773691)
2022-07-14 23:41:50 +03:00
Tim Huang 1ab8b37cce Bug 1773695 - Part 2: Add flags for the email tracking protections. r=dimi
Differential Revision: https://phabricator.services.mozilla.com/D151049
2022-07-14 19:39:32 +00:00
Tooru Fujisawa 54623364da Bug 1777486 - Part 2: Migrate XPCOMUtils.jsm consumers with automatic migration. r=webdriver-reviewers,geckoview-reviewers,preferences-reviewers,application-update-reviewers,pip-reviewers,kmag,owlish,whimboo
Differential Revision: https://phabricator.services.mozilla.com/D151214
2022-07-12 04:21:34 +00:00
Neil Deakin e8fd25621c Bug 1773907, don't clear the extension on the possible filename if we don't have one to replace it with, r=mhowell
The issue here is that ShouldModifyExtension returns Replace because the content type isn't known.

Differential Revision: https://phabricator.services.mozilla.com/D151427
2022-07-11 19:16:16 +00:00
Andreea Pavel 7738a75fdd Backed out 11 changesets (Bug 1777486) for failing bc at browser_startup.js on a CLOSED TREE
Backed out changeset b6c4c386f1a6 (Bug 1777486)
Backed out changeset 195cc2de8433 (Bug 1777486)
Backed out changeset 20c746fb1648 (Bug 1777486)
Backed out changeset d5fd8173d62d (Bug 1777486)
Backed out changeset 6d758fab5a3e (Bug 1777486)
Backed out changeset e938b601ba15 (Bug 1777486)
Backed out changeset 0c4ea0b9416b (Bug 1777486)
Backed out changeset 0559c53cc668 (Bug 1777486)
Backed out changeset eea573d3a9f9 (Bug 1777486)
Backed out changeset 9ce3a6496a49 (bug 1777486)
Backed out changeset b0867652fc48 (bug 1777486)
2022-07-11 22:24:40 +03:00
Tooru Fujisawa 8cd6ed7409 Bug 1777486 - Part 2: Migrate XPCOMUtils.jsm consumers with automatic migration. r=webdriver-reviewers,geckoview-reviewers,preferences-reviewers,application-update-reviewers,pip-reviewers,kmag,owlish,whimboo
Differential Revision: https://phabricator.services.mozilla.com/D151214
2022-07-11 15:09:13 +00:00
Tooru Fujisawa bf93d07148 Bug 1667455 - Part 5: Stop importing Services.jsm from chrome-priv JS code, top-level single-line cases. r=kmag,webdriver-reviewers,perftest-reviewers,webcompat-reviewers,geckoview-reviewers,extension-reviewers,application-update-reviewers,pip-reviewers,twisniewski,m_kato,jdescottes,mconley,AlexandruIonescu,mossop
Differential Revision: https://phabricator.services.mozilla.com/D150894
2022-07-11 12:41:50 +00:00
Tooru Fujisawa f3a8c52c53 Bug 1667455 - Part 4: Stop importing Services.jsm from JSM. r=kmag,webdriver-reviewers,perftest-reviewers,webcompat-reviewers,geckoview-reviewers,application-update-reviewers,pip-reviewers,twisniewski,devtools-reviewers,m_kato,jdescottes,ochameau,mconley,sfoster,AlexandruIonescu
Differential Revision: https://phabricator.services.mozilla.com/D150893
2022-07-11 12:41:50 +00:00
Neil Deakin 307cdb4029 Bug 1773894, special-case some extensions when downloading them, r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D150386
2022-07-07 18:51:09 +00:00
Barret Rennie 47beac2e67 Bug 1772742 - Port osfile.jsm usage to IOUtils in uriloader/ r=nika
Differential Revision: https://phabricator.services.mozilla.com/D148445
2022-06-30 04:33:05 +00:00
smolnar 3a496831ac Backed out 2 changesets (bug 1773186, bug 1772742) for causing mochitest failures in dom/system/tests/ioutils/test_ioutils_hashfile.html
Backed out changeset ef49b1ddf9f1 (bug 1772742)
Backed out changeset 8ec51be873d4 (bug 1773186)
2022-06-28 18:50:16 +03:00
Barret Rennie 5f02c4c24c Bug 1772742 - Port osfile.jsm usage to IOUtils in uriloader/ r=nika
Differential Revision: https://phabricator.services.mozilla.com/D148445
2022-06-28 15:03:46 +00:00
Neil Deakin 467752474e Bug 1772569, add a preference so that pdf files sent as attachments can be opened either inline or download, and default to downloaded, r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D150198
2022-06-27 21:25:37 +00:00
Kris Maglione 289588883e Bug 1776207: Part 1 - Remove obsolete _xpcom_factory definitions. r=mccr8
They only work with `generateNSGetFactory` definitions, which don't exist
anymore.

Differential Revision: https://phabricator.services.mozilla.com/D150191
2022-06-27 21:19:51 +00:00
Andrew McCreight d9fb12e295 Bug 1776080 - Fix browser_save_filenames.js to work with parent controlled navigation. r=NeilDeakin
Differential Revision: https://phabricator.services.mozilla.com/D150051
2022-06-27 02:20:09 +00:00
Kris Maglione 23d4c575c6 Bug 1770237: Part 14 - Update URILoader parent handler service to use static component registration. r=mconley
Differential Revision: https://phabricator.services.mozilla.com/D148194
2022-06-22 20:31:36 +00:00
Mark Banner 47835addcf Bug 1774768 - Fix accesses of undefined constants on Services.perms in tests. r=Gijs
Depends on D149604

Differential Revision: https://phabricator.services.mozilla.com/D149605
2022-06-20 09:44:14 +00:00
Tom Schuster 059cd7d495 Bug 1773947 - Correctly set returned MIME type in GetMIMEInfoFromOS. r=haik,nika
Differential Revision: https://phabricator.services.mozilla.com/D149043
2022-06-20 08:20:17 +00:00
Dimi 9e6c641b2c Bug 1773043 - Remove flashblock from necko r=kershaw,necko-reviewers
Depends on D149130

Differential Revision: https://phabricator.services.mozilla.com/D149131
2022-06-15 12:55:26 +00:00
Manuel Bucher 14dd2f26fc Bug 1761242 - Expose computing security flags for early hint preloader r=ckerschb,smaug
Differential Revision: https://phabricator.services.mozilla.com/D144798
2022-06-15 09:59:44 +00:00
criss c6b2c5db61 Backed out 9 changesets (bug 1772006) causing build bustages on nsTString.cpp. CLOSED TREE
Backed out changeset f17c7565707b (bug 1772006)
Backed out changeset c725fe1f5882 (bug 1772006)
Backed out changeset d19663161261 (bug 1772006)
Backed out changeset b6611ab002d9 (bug 1772006)
Backed out changeset 790f42b64af9 (bug 1772006)
Backed out changeset 79a734b4e4d9 (bug 1772006)
Backed out changeset 42730aae16ea (bug 1772006)
Backed out changeset b2542aef3054 (bug 1772006)
Backed out changeset 962bfea4a309 (bug 1772006)
2022-06-11 01:13:42 +03:00
Nika Layzell fbec8096a9 Bug 1772006 - Part 7: Simplify and move the find+replace methods from ns[T]StringObsolete, r=xpcom-reviewers,barret
The remaining methods in ns[T]StringObsolete are all find+replace methods for
nsTSubstring. These were migrated in a similar way to the find methods, and
partially updated to avoid using methods from nsStringObsolete.cpp.

This change removes the ns[T]StringObsolete.cpp files completely, as they are
no longer necessary.

Differential Revision: https://phabricator.services.mozilla.com/D148301
2022-06-10 21:12:08 +00:00
Nika Layzell b3c13bf114 Bug 1772006 - Part 6: Simplify and move the string searching APIs from ns[T]StringObsolete, r=xpcom-reviewers,necko-reviewers,eeejay,dragana,barret
The biggest set of APIs from ns[T]StringObsolete which are still heavily used
are the string searching APIs. It appears the intention was for these to be
replaced by the `FindInReadable` APIs, however that doesn't appear to have
happened.

In addition, the APIs have some quirks around their handling of mixed character
widths. These APIs generally supported both narrow strings and the native
string type, probably because char16_t string literals weren't available until
c++11. Finally they also used easy-to-confuse unlabeled boolean and integer
optional arguments to control behaviour.

These patches do the following major changes to the searching APIs:

1. The ASCII case-insensitive search method was split out as
   LowerCaseFindASCII, rather than using a boolean. This should be less
   error-prone and more explicit, and allows the method to continue to use
   narrow string literals for all string types (as only ASCII is supported).
2. The other [R]Find methods were restricted to only support arguments with
   matching character types. I considered adding a FindASCII method which would
   use narrow string literals for both wide and narrow strings but it would've
   been the same amount of work as changing all of the literals to unicode
   literals.
   This ends up being the bulk of the changes in the patch.
3. All find methods were re-implemented using std::basic_string_view's find
   algorithm or stl algorithms to reduce code complexity, and avoid the need to
   carry around the logic from nsStringObsolete.cpp.
4. The implementations were moved to nsTStringRepr.cpp.
5. An overload of Find was added to try to catch callers which previously
   called `Find(..., false)` or `Find(..., true)` to set case-sensitivity, due
   to booleans normally implicitly coercing to `index_type`. This should
   probably be removed at some point, but may be useful during the transition.

Differential Revision: https://phabricator.services.mozilla.com/D148300
2022-06-10 21:12:08 +00:00
Cosmin Sabou 6f043ebd93 Backed out changeset b7ac1dc2e29e (bug 1739348) for causing frequent failures on browser_downloads_panel_opens.js. 2022-06-10 23:49:24 +03:00
Shane Hughes 755d60c20a Bug 1739348 - Don't open downloads panel after download dialogs. r=NeilDeakin
This is a medium sized patch to legacy download construction. It takes
advantage of the new property added in Bug 1762033 to prevent the
downloads panel from being automatically shown when a download is added
after an interaction with the unknown content type dialog or the file
picker dialog. I chose to not do the same for failed transfers since I
thought it might serve some use, but that might be wrong. I don't know
if there's a way to test the dialog that appears when you download an
executable without going through the same path I adjusted with the
patch. It seems like it's covered but I could be wrong. Also add a test
to cover these changes from the bottom up. Thanks and apologies for my
sloppy C++, though I'm sure I'll learn a lot more from the review 😅

Differential Revision: https://phabricator.services.mozilla.com/D145312
2022-06-10 17:31:27 +00:00
Mark Banner 8d5da1fba0 Bug 1771144 - Add mjs to the list of default mime entries. r=Gijs
Depends on D148755

Differential Revision: https://phabricator.services.mozilla.com/D148771
2022-06-09 13:02:15 +00:00
Molnar Sandor 1fc858a96d Backed out 5 changesets (bug 1761242, bug 1744822, bug 1761252) for causing browser-chrome failures in netwerk/test/browser/browser_103_assets.js CLOSED TREE
Backed out changeset 33cc08eb51b3 (bug 1744822)
Backed out changeset b70697d24e75 (bug 1761252)
Backed out changeset 4a5e10110c6a (bug 1761242)
Backed out changeset 7cda175b833d (bug 1761242)
Backed out changeset 4f5ed111093b (bug 1761242)
2022-06-08 18:56:35 +03:00
Manuel Bucher 35abf46688 Bug 1761242 - Expose computing security flags for early hint preloader r=ckerschb,smaug
Differential Revision: https://phabricator.services.mozilla.com/D144798
2022-06-08 14:33:10 +00:00
Neil Deakin 1874a3841a Bug 1762868, handle pdfs inline that use the content type octet-stream when they have a pdf extension, r=mhowell
To do this we look at the extension on the content disposition filename, if present, or the extension
of the url, and, if it is .pdf, we assume that the file will be a pdf.

Differential Revision: https://phabricator.services.mozilla.com/D147409
2022-06-06 18:58:19 +00:00
Norisz Fay 17c58b1a9c Backed out changeset 5e08d0841b10 (bug 1739348) for causing browser-chrome failures on browser_pdfjs_download_button.js, browser_tempfilename.js 2022-06-03 00:09:47 +03:00
Shane Hughes f51ee80012 Bug 1739348 - Don't open downloads panel after download dialogs. r=NeilDeakin
This is a medium sized patch to legacy download construction. It takes
advantage of the new property added in Bug 1762033 to prevent the
downloads panel from being automatically shown when a download is added
after an interaction with the unknown content type dialog or the file
picker dialog. I chose to not do the same for failed transfers since I
thought it might serve some use, but that might be wrong. I don't know
if there's a way to test the dialog that appears when you download an
executable without going through the same path I adjusted with the
patch. It seems like it's covered but I could be wrong. Also add a test
to cover these changes from the bottom up. Thanks and apologies for my
sloppy C++, though I'm sure I'll learn a lot more from the review 😅

Differential Revision: https://phabricator.services.mozilla.com/D145312
2022-06-02 19:33:10 +00:00
Tooru Fujisawa 95dea67f22 Bug 1772107 - Use plain object for lazy getter in uriloader/exthandler/. r=smaug
Depends on D147893

Differential Revision: https://phabricator.services.mozilla.com/D147894
2022-06-01 21:29:36 +00:00
Calixte 93528759ed Bug 1766030 - Add an optional source URL when saving an URL. r=Gijs
In pdf.js, files are saved thanks to a blob but the original URL is lost.
Consequently, the download panel doesn't contain any information about the
origins of a saved pdf.
The saveURL, internalSave and nsITransfer.init functions has now a parameter for this originalURL.

Differential Revision: https://phabricator.services.mozilla.com/D147651
2022-05-31 17:25:29 +00:00
Tooru Fujisawa 69b1c85ff5 Bug 1610653 - Part 12: Do not use global this property assignment to define global variable in uriloader/. r=Standard8
Differential Revision: https://phabricator.services.mozilla.com/D144119
2022-05-30 15:19:39 +00:00
Neil Deakin 59e7375898 Bug 1770683, only replace or append the correct extension for media types, and some selected content types, or if the extension is not present, r=Gijs
This is closer to the behaviour before bug 1746052. Also adds some tests for compressed types.

Differential Revision: https://phabricator.services.mozilla.com/D147537
2022-05-28 09:42:32 +00:00
Neil Deakin 294581a987 Bug 1768351, add a special case for the one case that intermittently fails on windows, r=mhowell
Depends on D146727

Differential Revision: https://phabricator.services.mozilla.com/D146728
2022-05-25 00:14:20 +00:00
Neil Deakin c7de800148 Bug 1768898, special case zip, json, and xml to allow these files to be saved with any extension, r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D146727
2022-05-25 00:14:19 +00:00
Gijs Kruitbosch 3113290039 Bug 1738574 - add an option to put downloads in tmp to start with, r=mak,mkaply,fluent-reviewers,flod
Differential Revision: https://phabricator.services.mozilla.com/D146719
2022-05-24 12:54:42 +00:00
Jed Davis a051b1b2bc Bug 1763848 - Use IPC remoting for MIME type information on all platforms. r=haik
The component that handles MIME type information will consult whatever
the OS uses as a registry of file types / applications; in the past
this caused problems for sandboxing on macOS and then Windows, so IPC was
used to remote those queries to the parent process.

We've also been having similar problems on Linux, and none of the
infrastructure here seems to be OS-specific; therefore I've removed the
`#ifdef` so that we always use IPC.

Differential Revision: https://phabricator.services.mozilla.com/D145823
2022-05-20 00:02:45 +00:00
Andrew McCreight c8c5c819df Bug 1514936, part 1 - Remove the outer argument to nsIFactory::createInstance. r=xpcom-reviewers,preferences-reviewers,nika,Gijs
This patch won't actually build, because a few bits of code are used
for both nsIFactory::createInstance and static components, and static
components are not fixed until the next patch.

The first place is nsLoadGroupConstructor, which uses an nsIFactory
macro to create a static component constructor. (This could be worked
around by expanding the macro to the state before this patch.)

The other issue is that nsAppShellConstructor is used in an nsIFactory
on OSX, but as a static component on all other platforms. This could
be worked around by wrapping nsAppShellConstructor in an adaptor that
passes in the extra null argument to nsAppShellConstructor.

Differential Revision: https://phabricator.services.mozilla.com/D146456
2022-05-17 20:24:19 +00:00
Neil Deakin 2d6e577801 Bug 1757771, always launch the save dialog when pressing the PDF Viewer download button, and remove test code that expected the unknown type dialog to appear, r=marco
Differential Revision: https://phabricator.services.mozilla.com/D145814
2022-05-16 14:34:14 +00:00
Kagami Sascha Rosylight 2774c39fc7 Bug 1768189 - Part 47: Apply modernize-concat-nested-namespaces to layout/style/MediaQueryList.h ... r=andi
Depends on D145782

Differential Revision: https://phabricator.services.mozilla.com/D145783
2022-05-09 20:41:21 +00:00
lyavor 9a4a1d18f2 Bug 1749525 - Download fails because it doesn't contain an auth header. r=Gijs,freddyb
Differential Revision: https://phabricator.services.mozilla.com/D137997
2022-05-06 11:56:52 +00:00
Neil Deakin 20f4aa5607 Bug 1746052, on Mac, set the always ask flag for the macbinary type as well, r=Gijs
This test involves clicking on a link to a .bin file. In the Mac test environment, this is given the macbinary content type. This test assumes that it will be octet-stream (another valid content type for the bin extension) and sets the alwaysAskBeforeHandling flag for that, so the dialog never shows up. However, another subtest needs octet-stream to prompt as well, so set the always ask for both.

Differential Revision: https://phabricator.services.mozilla.com/D145547
2022-05-06 10:00:57 +00:00
Neil Deakin 457b4db102 Bug 1746052, add tests for filename validation when dragging images, copy/paste of images, saving a document or image, and when content disposition: attachment is used, and add a unit test that verifies nsIMIMEService.validateFileNameForSaving, r=mhowell
Differential Revision: https://phabricator.services.mozilla.com/D135959
2022-05-06 10:00:56 +00:00
Neil Deakin ff6532ba51 Bug 1746052, use validateFileNameForSaving to get and validate the default filename when a document or image is chosen to be saved, r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D135958
2022-05-06 10:00:55 +00:00
Neil Deakin d8b26cb066 Bug 1746052, don't allow Windows reserved filenames when sanitizing filenames. Move MangleTextToValidFileName to nsLocalFileWin and rename it to CheckForReservedFileName, r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D138737
2022-05-06 10:00:55 +00:00
Neil Deakin fd86ee2ff6 Bug 1746052, select a default filename for saving if the filename ends up being empty, r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D135957
2022-05-06 10:00:55 +00:00
Neil Deakin ea69612638 Bug 1746052, don't modify the extension for text and binary types, as this is the behaviour that save as had, r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D135955
2022-05-06 10:00:54 +00:00
Neil Deakin 3dd82cbf48 Bug 1746052, improve file sanitization by filtering and collpasing more whitespace characters and truncating files to 255 bytes, r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D138736
2022-05-06 10:00:52 +00:00
Neil Deakin 45e161641c Bug 1746052, add methods to the mime service that compute and validate a filename for a given content type, r=Gijs
The code in SanitizeFilename will be expanded upon in the following patch.

Differential Revision: https://phabricator.services.mozilla.com/D135951
2022-05-06 10:00:52 +00:00
Csoregi Natalia 27daffd9fc Backed out changeset 076c2a81804a (bug 1739348) for xpcshell failures on test_DownloadBlockedTelemetry.js. CLOSED TREE 2022-05-06 12:07:31 +03:00
Shane Hughes 0c6f58f214 Bug 1739348 - Don't open downloads panel after download dialogs. r=NeilDeakin
This is a medium sized patch to legacy download construction. It takes
advantage of the new property added in Bug 1762033 to prevent the
downloads panel from being automatically shown when a download is added
after an interaction with the unknown content type dialog or the file
picker dialog. I chose to not do the same for failed transfers since I
thought it might serve some use, but that might be wrong. I don't know
if there's a way to test the dialog that appears when you download an
executable without going through the same path I adjusted with the
patch. It seems like it's covered but I could be wrong. Also add a test
to cover these changes from the bottom up. Thanks and apologies for my
sloppy C++, though I'm sure I'll learn a lot more from the review 😅

Differential Revision: https://phabricator.services.mozilla.com/D145312
2022-05-06 08:20:39 +00:00
Noemi Erli 295eab376a Backed out 14 changesets (bug 1746052) for causing build bustages in nsExternalHelperAppService.cpp CLOSED TREE
Backed out changeset bf46b0add531 (bug 1746052)
Backed out changeset 684b2aca10bb (bug 1746052)
Backed out changeset d4796eeeaf64 (bug 1746052)
Backed out changeset 5cf2378f6eb4 (bug 1746052)
Backed out changeset 2055ec1e9a57 (bug 1746052)
Backed out changeset 1398fc0669d2 (bug 1746052)
Backed out changeset 1f979899c843 (bug 1746052)
Backed out changeset 561a24801d4d (bug 1746052)
Backed out changeset 73e4689120f0 (bug 1746052)
Backed out changeset 9891f3b0229b (bug 1746052)
Backed out changeset 4c1ab30de0bd (bug 1746052)
Backed out changeset 108e14122e53 (bug 1746052)
Backed out changeset 1ee59c52578a (bug 1746052)
Backed out changeset 41fe77c5f4b2 (bug 1746052)
2022-05-05 23:13:33 +03:00
Neil Deakin 45169441ca Bug 1746052, on Mac, set the always ask flag for the macbinary type as well, r=Gijs
This test involves clicking on a link to a .bin file. In the Mac test environment, this is given the macbinary content type. This test assumes that it will be octet-stream (another valid content type for the bin extension) and sets the alwaysAskBeforeHandling flag for that, so the dialog never shows up. However, another subtest needs octet-stream to prompt as well, so set the always ask for both.

Differential Revision: https://phabricator.services.mozilla.com/D145547
2022-05-05 19:46:49 +00:00
Neil Deakin af5ca09057 Bug 1746052, add tests for filename validation when dragging images, copy/paste of images, saving a document or image, and when content disposition: attachment is used, and add a unit test that verifies nsIMIMEService.validateFileNameForSaving, r=mhowell
Differential Revision: https://phabricator.services.mozilla.com/D135959
2022-05-05 19:46:49 +00:00
Neil Deakin 91d7b0f640 Bug 1746052, use validateFileNameForSaving to get and validate the default filename when a document or image is chosen to be saved, r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D135958
2022-05-05 19:46:48 +00:00
Neil Deakin c1e573cd3c Bug 1746052, don't allow Windows reserved filenames when sanitizing filenames. Move MangleTextToValidFileName to nsLocalFileWin and rename it to CheckForReservedFileName, r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D138737
2022-05-05 19:46:48 +00:00
Neil Deakin 679f61ea4c Bug 1746052, select a default filename for saving if the filename ends up being empty, r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D135957
2022-05-05 19:46:48 +00:00
Neil Deakin 86c85f8ec9 Bug 1746052, don't modify the extension for text and binary types, as this is the behaviour that save as had, r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D135955
2022-05-05 19:46:47 +00:00
Neil Deakin 7fdbbc3e3c Bug 1746052, improve file sanitization by filtering and collpasing more whitespace characters and truncating files to 255 bytes, r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D138736
2022-05-05 19:46:45 +00:00
Neil Deakin d0aaa88f44 Bug 1746052, add methods to the mime service that compute and validate a filename for a given content type, r=Gijs
The code in SanitizeFilename will be expanded upon in the following patch.

Differential Revision: https://phabricator.services.mozilla.com/D135951
2022-05-05 19:46:45 +00:00
Jens Stutte 16283839ad Bug 1767214: Make ContentHandlerService::Init return an error on failed initialization. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D145573
2022-05-05 12:35:41 +00:00
Csoregi Natalia 7896e7e124 Backed out 13 changesets (bug 1746052) for causing failures on uriloader/exthandler/tests/. CLOSED TREE
Backed out changeset d19cc58e3cab (bug 1746052)
Backed out changeset 229edc158a2b (bug 1746052)
Backed out changeset b0ef7c68abcf (bug 1746052)
Backed out changeset 30de4b77f242 (bug 1746052)
Backed out changeset ebc6720fdab3 (bug 1746052)
Backed out changeset daccb796a093 (bug 1746052)
Backed out changeset 5b76d8d76b2b (bug 1746052)
Backed out changeset a698068d078f (bug 1746052)
Backed out changeset 73d17535d8d1 (bug 1746052)
Backed out changeset 94c95f004221 (bug 1746052)
Backed out changeset 1a389759585a (bug 1746052)
Backed out changeset c91230a8ea90 (bug 1746052)
Backed out changeset 7665f02c114e (bug 1746052)
2022-05-04 01:15:12 +03:00
Mike Hommey 2d6c8fdbc6 Bug 1766561 - Adjust UTF-16 string formatting. r=nika
With MOZ_FORMAT_PRINTF annotations, the compiler expects a wchar_t*, and
it won't automatically consider char16ptr_t to be compatible with that.

While handling strings, there's one case of formatting that doesn't need
to use %S at all.

Differential Revision: https://phabricator.services.mozilla.com/D144919
2022-05-03 20:49:09 +00:00
Neil Deakin 2be09b9192 Bug 1746052, add tests for filename validation when dragging images, copy/paste of images, saving a document or image, and when content disposition: attachment is used, and add a unit test that verifies nsIMIMEService.validateFileNameForSaving, r=mhowell
Differential Revision: https://phabricator.services.mozilla.com/D135959
2022-05-03 19:44:28 +00:00
Neil Deakin 435f7665b7 Bug 1746052, use validateFileNameForSaving to get and validate the default filename when a document or image is chosen to be saved, r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D135958
2022-05-03 19:44:28 +00:00
Neil Deakin c203e5ec80 Bug 1746052, don't allow Windows reserved filenames when sanitizing filenames. Move MangleTextToValidFileName to nsLocalFileWin and rename it to CheckForReservedFileName, r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D138737
2022-05-03 19:44:27 +00:00
Neil Deakin f560834464 Bug 1746052, select a default filename for saving if the filename ends up being empty, r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D135957
2022-05-03 19:44:27 +00:00
Neil Deakin 22cf453e67 Bug 1746052, don't modify the extension for text and binary types, as this is the behaviour that save as had, r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D135955
2022-05-03 19:44:26 +00:00
Neil Deakin daa3b8b384 Bug 1746052, improve file sanitization by filtering and collpasing more whitespace characters and truncating files to 255 bytes, r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D138736
2022-05-03 19:44:25 +00:00
Neil Deakin 2596b808fa Bug 1746052, add methods to the mime service that compute and validate a filename for a given content type, r=Gijs
The code in SanitizeFilename will be expanded upon in the following patch.

Differential Revision: https://phabricator.services.mozilla.com/D135951
2022-05-03 19:44:24 +00:00
Neil Deakin 18f85bb221 Bug 1742648, remove special case for downloading pdfs in subframes, r=mtigley
Differential Revision: https://phabricator.services.mozilla.com/D145233
2022-05-03 18:13:52 +00:00
Nika Layzell 2cef287b86 Bug 1766682 - Request longer timeout for browser_download_open_with_internal_handler.js, r=Gijs DONTBUILD
The patch appears to have caused an increase in timeouts, but based on a
quick scan of the log, it appears it's due to the test running right
against the time limit, rather than due to the test deadlocking or
similar.

Differential Revision: https://phabricator.services.mozilla.com/D145235
2022-05-03 12:02:31 +00:00
Gijs Kruitbosch e6b256b16b Bug 1755308 - tests, r=mhowell
Differential Revision: https://phabricator.services.mozilla.com/D138322
2022-04-28 11:08:57 +00:00
Nika Layzell 7664313328 Bug 1756980 - Part 2: Update tests for new download behaviour, r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D143676
2022-04-27 15:22:00 +00:00
Sarah Clements 096901dbf5 Bug 1731898 - Change protocol handling logic for non-standard cases r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D141859
2022-04-26 10:01:31 +00:00
Paul Zuehlcke 59a9b4bb03 Bug 1735746 - External protocol navigation sandbox tests. r=nika
Depends on D141133

Differential Revision: https://phabricator.services.mozilla.com/D141134
2022-04-20 11:06:51 +00:00
Paul Zuehlcke 68b4cc3fce Bug 1735746 - Log an error message to the web console for blocked external protocol navigation from sandbox. r=ckerschb
Depends on D141132

Differential Revision: https://phabricator.services.mozilla.com/D141133
2022-04-20 11:06:50 +00:00
Paul Zuehlcke 6f039abdf3 Bug 1735746 - Add a pref and limit external protocol sandbox blocking to Nightly. r=ckerschb,farre
Depends on D141131

Differential Revision: https://phabricator.services.mozilla.com/D141132
2022-04-20 11:06:50 +00:00
Paul Zuehlcke 1e4838aeeb Bug 1735746 - Block external protocol navigation from sandboxed contexts. r=nika,ckerschb,Gijs,smaug
Differential Revision: https://phabricator.services.mozilla.com/D141131
2022-04-20 11:06:50 +00:00
Shane Hughes 7810a6da05 Bug 1747343 - Add pref to set default action for new mimetypes. r=Gijs,fluent-reviewers,preferences-reviewers
When downloading a file, we check for existing mime types and construct
a new one if it's unrecognized. Mime types have a flag,
alwaysAskBeforeHandling, that determines whether the unknown content
type dialog should be opened before handling the file. Before bug
1733492, the default value for that flag was simply true. Since the new
downloads flow is intended to avoid unnecessary steps, the default value
was changed to the inverted value of the new downloads panel
improvements pref. This patch adds a new pref that the mime info
constructor will read in configuring the flag's value. If the
improvements pref is not enabled, then the flag will be true, so the UCT
dialog will open. If the improvements pref is enabled, then it'll use
the value of the new pref. Also add a an interface for the pref to the
about:preferences UI, and automatically migrate a false value for
browser.download.improvements_to_download_panel to a true value for this
pref. I'm updating some tangentially related test files since they
happen to be touched slightly by this change. Strictly speaking they
would still work, but if the pref value was somehow changed from the
default they would fail.

Differential Revision: https://phabricator.services.mozilla.com/D143002
2022-04-15 18:13:11 +00:00
Iulian Moraru 6c1743090b Backed out changeset 661c496ff0bd (bug 1731898) for causing bc failures on browser_first_prompt_not_blocked_without_user_interaction.js. CLOSED TREE 2022-04-13 21:54:28 +03:00
Sarah Clements a63dfc84ab Bug 1731898 - Change protocol handling logic for non-standard cases r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D141859
2022-04-13 17:13:50 +00:00
Butkovits Atila f90c8918d4 Backed out changeset 543a78ca4fa9 (bug 1747343) for causing mochitest failures at browser_bug676619.js. CLOSED TREE 2022-04-13 03:31:53 +03:00
Shane Hughes 9a0bc90754 Bug 1747343 - Add pref to set default action for new mimetypes. r=Gijs,fluent-reviewers,preferences-reviewers
When downloading a file, we check for existing mime types and construct
a new one if it's unrecognized. Mime types have a flag,
alwaysAskBeforeHandling, that determines whether the unknown content
type dialog should be opened before handling the file. Before bug
1733492, the default value for that flag was simply true. Since the new
downloads flow is intended to avoid unnecessary steps, the default value
was changed to the inverted value of the new downloads panel
improvements pref. This patch adds a new pref that the mime info
constructor will read in configuring the flag's value. If the
improvements pref is not enabled, then the flag will be true, so the UCT
dialog will open. If the improvements pref is enabled, then it'll use
the value of the new pref. Also add a an interface for the pref to the
about:preferences UI, and automatically migrate a false value for
browser.download.improvements_to_download_panel to a true value for this
pref. I'm updating some tangentially related test files since they
happen to be touched slightly by this change. Strictly speaking they
would still work, but if the pref value was somehow changed from the
default they would fail.

Differential Revision: https://phabricator.services.mozilla.com/D143002
2022-04-12 22:32:45 +00:00