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

506 Коммитов

Автор SHA1 Сообщение Дата
serge-sans-paille e54774d573 Bug 1922838 - Replace ArrayLength, ArrayEnd and MOZ_ARRAY_LENGTH by standard alternative r=glandium,necko-reviewers,jgilbert,application-update-reviewers,media-playback-reviewers,credential-management-reviewers,anti-tracking-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,bytesized,janv,dimi,daisuke,karlt,gstoll,canaltinova,timhuang
Namely std::size, std::end and std::size. This drops C support for
MOZ_ARRAY_LENGTH but it wasn't used anyway.

Differential Revision: https://phabricator.services.mozilla.com/D224611
2024-10-28 08:21:19 +00:00
Alexandru Marc 191ccbe7fe Backed out changeset d92f391b3b0c (bug 1922838) for backing out bug 1915351 2024-10-25 16:42:33 +03:00
serge-sans-paille 53068cdf31 Bug 1922838 - Replace ArrayLength, ArrayEnd and MOZ_ARRAY_LENGTH by standard alternative r=glandium,necko-reviewers,jgilbert,application-update-reviewers,media-playback-reviewers,credential-management-reviewers,anti-tracking-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,bytesized,janv,dimi,daisuke,karlt,gstoll,canaltinova,timhuang
Namely std::size, std::end and std::size. This drops C support for
MOZ_ARRAY_LENGTH but it wasn't used anyway.

Differential Revision: https://phabricator.services.mozilla.com/D224611
2024-10-24 09:06:01 +00:00
Alexandru Marc 83543f20f2 Backed out changeset 448597bce69d (bug 1922838) for causing build bustages. CLOSED TREE 2024-10-24 11:37:49 +03:00
serge-sans-paille c7a369b29a Bug 1922838 - Replace ArrayLength, ArrayEnd and MOZ_ARRAY_LENGTH by standard alternative r=glandium,necko-reviewers,jgilbert,application-update-reviewers,media-playback-reviewers,credential-management-reviewers,anti-tracking-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,bytesized,janv,dimi,daisuke,karlt,gstoll,canaltinova,timhuang
Namely std::size, std::end and std::size. This drops C support for
MOZ_ARRAY_LENGTH but it wasn't used anyway.

Differential Revision: https://phabricator.services.mozilla.com/D224611
2024-10-24 07:38:30 +00:00
Emilio Cobos Álvarez b5d2263c26 Bug 1925866 - NS_NewLocalFile's aFollowSymlinks arg is unused. r=xpcom-reviewers,necko-reviewers,valentin,media-playback-reviewers,win-reviewers,karlt,nika,rkraesig
Remove it and related functions, and update the callers.

Differential Revision: https://phabricator.services.mozilla.com/D226261
2024-10-22 09:38:16 +00:00
Jens Stutte 9864e8e2bc Bug 1913357 - Make GetDiskSpaceAvailable return the right error in case of GetParent failing. r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D219277
2024-08-17 11:30:59 +00:00
Masatoshi Kimura 78db7aad66 Bug 1906405 - Fix nsLocalFile::GetLast(Accessed|Modified)Time. r=xpcom-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D215835
2024-07-05 18:59:43 +00:00
Cosmin Sabou 8fbb81f010 Backed out changeset d40105caed00 (bug 1906405) for causing xpcshell failures on test_localfile. CLOSED TREE 2024-07-05 21:05:34 +03:00
Masatoshi Kimura facbb5ca48 Bug 1906405 - Fix nsLocalFile::GetLast(Accessed|Modified)Time. r=xpcom-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D215835
2024-07-05 16:58:55 +00:00
Jan Grulich d2084644e7 Bug 1882079 - Display real path when choosing download directory over portal r=settings-reviewers,Gijs,emilio
Use the new API addition to Document portal allowing clients to get real
path to the exported document. This allows to still use the same path as
provided by the document portal, but display the path as exists on the
host side.

Differential Revision: https://phabricator.services.mozilla.com/D202717
2024-06-28 19:31:13 +00:00
Norisz Fay b512538f35 Backed out changeset 032d22e94bd3 (bug 1882079) for causing bustages on nsLocalFileUnix.cpp CLOSED TREE 2024-06-28 18:10:16 +03:00
Jan Grulich cd78916e7e Bug 1882079 - Display real path when choosing download directory over portal r=settings-reviewers,Gijs,emilio
Use the new API addition to Document portal allowing clients to get real
path to the exported document. This allows to still use the same path as
provided by the document portal, but display the path as exists on the
host side.

Differential Revision: https://phabricator.services.mozilla.com/D202717
2024-06-28 14:33:04 +00:00
Magnus Melin 67a2c5c9c7 Bug 1898709 - Use GetMostRecentBrowserWindow() instead of GetMostRecentWindow(u"navigator:browser") to cater for Thunderbird's main window. r=nalexander
Based on https://github.com/Betterbird/thunderbird-patches/blob/main/115/bugs/1863798-toast-notification-foreground-mail-client-m-c.patch

Fixed cases where general code assume main window is Firefox.
GetMostRecentBrowserWindow is getting "navigator:browser" for Firefox, so there is no change in behavior,
but it means more things will work for Thunderbird.

Differential Revision: https://phabricator.services.mozilla.com/D211520
2024-05-24 17:43:52 +00:00
Yannis Juglaret 484214561b Bug 1875036 - Speed up directory enumeration on Windows. r=win-reviewers,gstoll
We replace the use of FindFirstFileW by FindFirstFileExW with the most
optimized combination of flags on the code path reached from
nsIDirectoryEnumerator on Windows. This should make enumeration faster,
in particular when enumerating directories with thousands of files like
it can happen in QuotaManager code.

Differential Revision: https://phabricator.services.mozilla.com/D207151
2024-04-11 06:52:03 +00:00
Michael van Straten 6e3ee549c9 Bug 1870617 - Map Windows error 0x1 ERROR_INVALID_FUNCTION to NS_ERROR_FILE_DEVICE_FAILURE r=jstutte,xpcom-reviewers
`ERROR_INVALID_FUNCTION` appears to be a very generic "this device does not support this function".
Given that we deal only with file operations and errors here, this pretty much translates to "this device is not really a working file IO device for us" which makes it appear to be entirely broken for us.

Differential Revision: https://phabricator.services.mozilla.com/D196723
2024-03-22 14:35:14 +00:00
Neil Deakin 1cc5883b43 Bug 1815062, move filename and extension validity checks into SanitizeFileName so that they get called after sanitization is complete, r=Gijs,necko-reviewers
For now, this leaves existing callers of DownloadPaths.sanitize as is using a flag.

Differential Revision: https://phabricator.services.mozilla.com/D169124
2023-02-28 18:57:24 +00:00
Bob Owen 4635db9578 Bug 1816694: Don't call SetNamedSecurityInfoW if permissions are already inherited. r=mhowell
This avoids a syscall and also prevents a lot of unnecessary SeTcbPrivilege
requests which may be audited by security software.

Differential Revision: https://phabricator.services.mozilla.com/D170855
2023-02-28 08:34:06 +00:00
Tom Ritter f19e74be0b Bug 1758681: Remove unneeded defines for MinGW r=firefox-build-system-reviewers,ahochheiden
Differential Revision: https://phabricator.services.mozilla.com/D169378
2023-02-15 19:01:58 +00:00
Kagami Sascha Rosylight 0b2130674e Bug 1788986 - Part 4: Add a counter for nsIFile r=xpcom-reviewers,nika,barret,janv
This adds `count` out parameter for recursive file remove calls to report the number of the removed entries.

  Having a lot of files removed by `::Remove(recursive=true)` has been a problem, as a slow disk can cause a hang with such call. A counter feature will help us knowing the situation better via telemetry.

  The use of out parameter here is to mark it optional and prevent unwanted changes in existing callers (because a return value can't be optional).

Differential Revision: https://phabricator.services.mozilla.com/D156940
2023-02-06 11:32:48 +00:00
Iulian Moraru 0caa2f1940 Backed out 3 changesets (bug 1788986) for causing xpcshell failures on test_backgroundtask_removeDirectory.js. CLOSED TREE
Backed out changeset d288a5d5cc3d (bug 1788986)
Backed out changeset 7f30102942bc (bug 1788986)
Backed out changeset 8c8026379e91 (bug 1788986)
2023-02-02 20:58:26 +02:00
Kagami Sascha Rosylight 8fb81ed249 Bug 1788986 - Part 4: Add a counter for nsIFile r=xpcom-reviewers,nika,barret,janv
This adds `count` out parameter for recursive file remove calls to report the number of the removed entries.

  Having a lot of files removed by `::Remove(recursive=true)` has been a problem, as a slow disk can cause a hang with such call. A counter feature will help us knowing the situation better via telemetry.

  The use of out parameter here is to mark it optional and prevent unwanted changes in existing callers (because a return value can't be optional).

Differential Revision: https://phabricator.services.mozilla.com/D156940
2023-02-02 15:23:47 +00:00
Barret Rennie 1677597025 Bug 1786608 - Add nsIFile::accessTime{,OfLink} r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D155926
2022-11-20 22:37:17 +00:00
Barret Rennie 673df4196d Bug 1786608 - Do not set atime on Windows in nsLocalFile::SetModifiedTime r=xpcom-reviewers,kmag
Differential Revision: https://phabricator.services.mozilla.com/D155925
2022-11-20 22:37:17 +00:00
Cristian Tuns 2f47e3dacf Backed out 3 changesets (bug 1786608) for causing mochitest failures in test_ioutils_stat_set_modification_time.html CLOSED TREE
Backed out changeset ac137b0db467 (bug 1786608)
Backed out changeset e593e8e2696b (bug 1786608)
Backed out changeset a3fd1df20b66 (bug 1786608)
2022-11-17 00:50:54 -05:00
Barret Rennie cc7b18ee66 Bug 1786608 - Add nsIFile::accessTime{,OfLink} r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D155926
2022-11-17 05:09:18 +00:00
Barret Rennie 2e32887a16 Bug 1786608 - Do not set atime on Windows in nsLocalFile::SetModifiedTime r=xpcom-reviewers,kmag
Differential Revision: https://phabricator.services.mozilla.com/D155925
2022-11-17 05:09:18 +00:00
Cristian Tuns c93d8c6464 Backed out 3 changesets (bug 1786608) for causing build bustages CLOSED TREE
Backed out changeset 8eb603c625f4 (bug 1786608)
Backed out changeset 0df0cf8f67b4 (bug 1786608)
Backed out changeset 2b3815684692 (bug 1786608)
2022-11-16 13:58:36 -05:00
Barret Rennie 4c707ccfc8 Bug 1786608 - Add nsIFile::accessTime{,OfLink} r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D155926
2022-11-16 18:31:57 +00:00
Barret Rennie 370e4a098e Bug 1786608 - Do not set atime on Windows in nsLocalFile::SetModifiedTime r=xpcom-reviewers,kmag
Differential Revision: https://phabricator.services.mozilla.com/D155925
2022-11-16 18:31:56 +00:00
Cristian Tuns 2565d10b35 Backed out 3 changesets (bug 1786608) for causing build bustages CLOSED TREE
Backed out changeset dd0426463627 (bug 1786608)
Backed out changeset f2dcf20b5b44 (bug 1786608)
Backed out changeset 5b7d6807075a (bug 1786608)
2022-11-06 14:04:05 -05:00
Barret Rennie 6d359be1d0 Bug 1786608 - Add nsIFile::accessTime{,OfLink} r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D155926
2022-11-06 18:33:22 +00:00
Barret Rennie 6d99f6fc5c Bug 1786608 - Do not set atime on Windows in nsLocalFile::SetModifiedTime r=xpcom-reviewers,kmag
Differential Revision: https://phabricator.services.mozilla.com/D155925
2022-11-06 18:33:22 +00:00
Jari Jalkanen cc27d88b5d Bug 1746894 - Handle GetTemporaryStorageLimit failures with upper limit. r=dom-storage-reviewers,jesup
Differential Revision: https://phabricator.services.mozilla.com/D140990
2022-10-24 15:15:33 +00:00
Cristian Tuns 165dbe266b Backed out changeset 02f4220a827c (bug 1746894) for causing mochitest failures on antitracking_head.js CLOSED TREE 2022-10-20 12:43:25 -04:00
Jari Jalkanen e99f516901 Bug 1746894 - Handle GetTemporaryStorageLimit failures with upper limit. r=dom-storage-reviewers,jesup
Differential Revision: https://phabricator.services.mozilla.com/D140990
2022-10-20 15:35:50 +00:00
Cristian Tuns b81c0c9725 Backed out changeset 47a5cc9cd2f6 (bug 1746894) for causing build bustages on ActorsParent.cpp CLOSED TREE 2022-10-20 06:59:31 -04:00
Jari Jalkanen 5731f46ef8 Bug 1746894 - Handle GetTemporaryStorageLimit failures with upper limit. r=dom-storage-reviewers,jesup
Differential Revision: https://phabricator.services.mozilla.com/D140990
2022-10-20 10:42:16 +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
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
Nika Layzell 997047e2a4 Bug 1772006 - Part 4: Simplify and move the string comparison APIs from ns[T]StringObsolete, r=xpcom-reviewers,necko-reviewers,dragana,barret
This patch moves EqualsIgnoreCase to ns[T]StringObsolete, and removes
the aCount argument, instead migrating callers to use `StringBeginsWith`
with a case-insensitive comparator.

In addition, nsTStringRepr::Compare was removed and replaced with either
calls to methods like `StringBeginsWith` or the global `Compare` method.

These changes required some modifications at call-sites but should make
the behaviour less surprising and more consistent.

Differential Revision: https://phabricator.services.mozilla.com/D148299
2022-07-30 00:12:48 +00:00
Jan Rio Krause b2f117c4d5 Bug 1690326 - Map Windows error `ERROR_NO_SYSTEM_RESOURCES` (0x5AA) to `NS_ERROR_OUT_OF_MEMORY`. r=xpcom-reviewers,kmag
Differential Revision: https://phabricator.services.mozilla.com/D151736
2022-07-14 18:52:33 +00:00
Jan Rio Krause ceb9221d80 Bug 1690326 - Map Windows error `ERROR_DEV_NOT_EXIST` (0x37) to `NS_ERROR_FILE_DEVICE_FAILURE`. r=xpcom-reviewers,barret
Differential Revision: https://phabricator.services.mozilla.com/D149904
2022-06-22 16:44:36 +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 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
Gijs Kruitbosch a3f9a3f4e2 Bug 1707462 - expose Windows' localized file display names through XPCOM, r=mhowell
Differential Revision: https://phabricator.services.mozilla.com/D143480
2022-05-23 21:57:02 +00:00
Andrew McCreight fa8bfd1245 Bug 1514936, part 2 - Drop the outer arguments from static components. r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D146457
2022-05-17 20:24:19 +00:00
Emilio Cobos Álvarez 87ff5a5d8d Bug 1768418 - Move various methods from nsTString to nsTSubstring/nsTStringRepr. r=xpcom-reviewers,nika
No reason these don't work on substrings.

Remove StripChars since it has an existing nsTSubstring version. Make
callers use rightly-typed characters for those.

Differential Revision: https://phabricator.services.mozilla.com/D145864
2022-05-13 15:39:19 +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
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