Commit Graph

3144 Commits

Author SHA1 Message Date
Razvan Maries
c1dc47efa6 Backed out changeset dbea74f0edd3 (bug 1682031) for perma faimures on test_pathutils.html. CLOSED TREE 2020-12-17 08:07:08 +02:00
Barret Rennie
502eea4257 Bug 1682031 - Add PathUtils.appendRelative r=emalysz
Differential Revision: https://phabricator.services.mozilla.com/D99505
2020-12-11 22:01:38 +00:00
Barret Rennie
9ff7f42366 Bug 1677000 - Address unpublished clang-tidy lints r=Gijs
There are two new lints introduced since IOUtils was written that we're hitting
now:

* IOUtils::InternalFileInfo's constructor does not initialize `mType`, `mSize`,
  `mLastModified`, and `mPermissions`; and
* We should be using a nested namespace statement.

We haven't hit them since these lines haven't been touched, but I noticed them
on the code review frontend.

Differential Revision: https://phabricator.services.mozilla.com/D99163
2020-12-09 05:48:51 +00:00
Barret Rennie
3d4c77c1f2 Bug 1677000 - Remove unused IOUtils::WriteSync(PRFileDesc* ...) declaration r=Gijs
The implementation was removed in a previous change (bug 1665172) but the
declaration stuck around.

Differential Revision: https://phabricator.services.mozilla.com/D99152
2020-12-09 05:48:48 +00:00
Barret Rennie
e2fce2bed4 Bug 1677000 - Rename IOUtils.writeAtomic{,UTF8} to IOUtils.write{,UTF8} r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D99001
2020-12-09 05:48:46 +00:00
Barret Rennie
72492145e6 Bug 1677000 - Add a type alias for MozPromise<T, IOError, true> r=Gijs
To use this type alias, IOUtils::InvokeToIOPromise had to become either a
member fn or a friend.

Differential Revision: https://phabricator.services.mozilla.com/D99000
2020-12-09 05:48:44 +00:00
Barret Rennie
45f4571694 Bug 1677000 - Refactor ResolveJSPromise out of RunOnBackgroundThread r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D98999
2020-12-09 05:48:41 +00:00
Barret Rennie
9046e56316 Bug 1677000 - Pass Promise* to RejectJSPromise instead of RefPtr<Promise>& r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D98998
2020-12-09 05:47:31 +00:00
Barret Rennie
d2531c0b18 Bug 1677000 - Remove IsAbsolutePath() from IOUtils.h r=Gijs
The implementation was removed in bug 1676942.

Differential Revision: https://phabricator.services.mozilla.com/D98997
2020-12-09 05:47:24 +00:00
Razvan Maries
9614a08d73 Backed out 7 changesets (bug 1677000) for perma failures on test_ioutils_read_write.html. CLOSED TREE
Backed out changeset 3521334cfc38 (bug 1677000)
Backed out changeset 737f380c2cf2 (bug 1677000)
Backed out changeset 9dba15fdfe1f (bug 1677000)
Backed out changeset b2fa1a061b15 (bug 1677000)
Backed out changeset a5d7845d3c0c (bug 1677000)
Backed out changeset 8e6081b0c07d (bug 1677000)
Backed out changeset 6592577cf0fa (bug 1677000)
2020-12-09 07:34:21 +02:00
Barret Rennie
10834d52a9 Bug 1677000 - Address unpublished clang-tidy lints r=Gijs
There are two new lints introduced since IOUtils was written that we're hitting
now:

* IOUtils::InternalFileInfo's constructor does not initialize `mType`, `mSize`,
  `mLastModified`, and `mPermissions`; and
* We should be using a nested namespace statement.

We haven't hit them since these lines haven't been touched, but I noticed them
on the code review frontend.

Differential Revision: https://phabricator.services.mozilla.com/D99163
2020-12-09 04:31:55 +00:00
Barret Rennie
8b5f75f647 Bug 1677000 - Remove unused IOUtils::WriteSync(PRFileDesc* ...) declaration r=Gijs
The implementation was removed in a previous change (bug 1665172) but the
declaration stuck around.

Differential Revision: https://phabricator.services.mozilla.com/D99152
2020-12-09 04:31:47 +00:00
Barret Rennie
0dc367a38f Bug 1677000 - Rename IOUtils.writeAtomic{,UTF8} to IOUtils.write{,UTF8} r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D99001
2020-12-09 04:31:40 +00:00
Barret Rennie
c50f24f067 Bug 1677000 - Add a type alias for MozPromise<T, IOError, true> r=Gijs
To use this type alias, IOUtils::InvokeToIOPromise had to become either a
member fn or a friend.

Differential Revision: https://phabricator.services.mozilla.com/D99000
2020-12-09 04:31:01 +00:00
Barret Rennie
3aa75d55bb Bug 1677000 - Refactor ResolveJSPromise out of RunOnBackgroundThread r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D98999
2020-12-09 04:30:54 +00:00
Barret Rennie
5f9b9ebb3e Bug 1677000 - Pass Promise* to RejectJSPromise instead of RefPtr<Promise>& r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D98998
2020-12-09 04:30:46 +00:00
Barret Rennie
052ed397fa Bug 1677000 - Remove IsAbsolutePath() from IOUtils.h r=Gijs
The implementation was removed in bug 1676942.

Differential Revision: https://phabricator.services.mozilla.com/D98997
2020-12-09 04:30:39 +00:00
Dale Harvey
bea62c168a Bug 1663501 - Use geolocation monitor for region updates r=Standard8
Differential Revision: https://phabricator.services.mozilla.com/D91214
2020-12-04 17:46:03 +00:00
Barret Rennie
72dbca0048 Bug 1680449 - Clean up after test_setPermissions on Windows r=emalysz
Differential Revision: https://phabricator.services.mozilla.com/D98672
2020-12-03 23:58:39 +00:00
Barret Rennie
1cf888ecaf Bug 1678415 - Support setting file mode in IOUtils.createDirectory on non-Windows platforms r=emalysz
Differential Revision: https://phabricator.services.mozilla.com/D97691
2020-12-03 05:38:11 +00:00
Barret Rennie
ae7c7ad4a2 Bug 1678471 - Implement IOUtils::Exists r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D97690
2020-12-03 05:38:03 +00:00
Barret Rennie
47793f361c Bug 1673019 - Get and set file permissions in IOUtils r=emalysz
Differential Revision: https://phabricator.services.mozilla.com/D97689
2020-12-03 05:37:45 +00:00
Barret Rennie
69d3035e96 Bug 1660843 - Return creation time from IOUtils.stat() on supported platforms r=emalysz
Differential Revision: https://phabricator.services.mozilla.com/D96890
2020-12-03 05:37:33 +00:00
Barret Rennie
3ab2f47c1c Bug 1679873 - Pass closures to IOUtils::RunOnBackgroundThread r=nika
Passing in a callable and its arguments to RunOnBackgroundThread was fine
before we started passing in already_AddRefed<nsIFile>. However, if we fail to
get an event target, then we drop all our arguments and in debug builds
already_AddRefed<T> asserts that it was moved out of.

Now we require callers of RunOnBackgroundThread to pass in a closure that
contains all the bindings they require, which has the added bonus of making
lifetimes more explicit. As part of this refactor, all the `ReadSync` etc
methods now take raw nsIFile* pointers since they are called in a scope that
has them refcounted.

Differential Revision: https://phabricator.services.mozilla.com/D98273
2020-12-03 04:10:30 +00:00
Simon Giesecke
dd80614fa0 Bug 1678062 - Remove unnecessary includes. r=andi
Differential Revision: https://phabricator.services.mozilla.com/D97467

Depends on D96561
2020-11-23 16:12:02 +00:00
Simon Giesecke
6fac745ea4 Bug 1673931 - Remove dependency of BindingUtils.h on Document.h.
Differential Revision: https://phabricator.services.mozilla.com/D95048

Depends on D95047
2020-11-23 16:08:03 +00:00
Simon Giesecke
971b645fe3 Bug 1660470 - Add missing include directives/forward declarations. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D87865
2020-11-23 16:21:38 +00:00
Steven MacLeod
6cd960cfb3 Bug 1585070 - move nsPIDOMWindowOuter::mIsActive to BrowsingContext. r=kmag
A new `BrowsingContext` field has been added to track the active
browser window for the `:-moz-window-inactive` pseudoclass. This
field takes the place of `nsPIDOMWindowOuter::mIsActive`.

With this change `:-moz-window-inactive` is now fission compatible.

Differential Revision: https://phabricator.services.mozilla.com/D86422
2020-11-20 15:16:58 +00:00
Noemi Erli
60669a2ed8 Backed out changeset 18448a7ebf82 (bug 1585070) for causing failures in test_cocoa_window_focus.html CLOSED TREE 2020-11-17 06:09:50 +02:00
Steven MacLeod
2c4c433439 Bug 1585070 - move nsPIDOMWindowOuter::mIsActive to BrowsingContext. r=kmag
A new `BrowsingContext` field has been added to track the active
browser window for the `:-moz-window-inactive` pseudoclass. This
field takes the place of `nsPIDOMWindowOuter::mIsActive`.

With this change `:-moz-window-inactive` is now fission compatible.

Differential Revision: https://phabricator.services.mozilla.com/D86422
2020-11-16 22:37:51 +00:00
Karl Tomlinson
43dbe6d29b Bug 1213512 use a DOMException for MaybeRejectWithNotReadableError() r=baku
This is consistent with
https://w3c.github.io/FileAPI/#dfn-error-codes

Depends on D95968

Differential Revision: https://phabricator.services.mozilla.com/D95969
2020-11-15 22:02:05 +00:00
Bogdan Tara
1b8a2c18be Backed out changeset b66d6544ad5a (bug 1663501) for payment-reporting.https.html failures CLOSED TREE 2020-11-13 01:04:38 +02:00
Dale Harvey
2432edac16 Bug 1663501 - Use geolocation monitor for region updates r=Standard8
Differential Revision: https://phabricator.services.mozilla.com/D91214
2020-11-12 17:35:22 +00:00
Barret Rennie
1c0f5446e2 Bug 1665172 - IOError::WithMessage should accept nsCString argument as const ref r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D96290
2020-11-10 02:00:01 +00:00
Barret Rennie
62855b0e8a Bug 1665172 - Use nsFileOutputStream for writing in IOUtils r=emalysz
The nsFileOutputStream does all the error checking we were doing in WriteSync,
which we can now remove. PR_CloseDelete and all usages of raw PR file
descriptors can be also now be removed.

Additionally, the mode we were using for writing included `PR_WRONLY |
PR_TRUNCATE | PR_APPEND`, which makes the `PR_APPEND` redundant.

Differential Revision: https://phabricator.services.mozilla.com/D96146
2020-11-10 01:59:53 +00:00
Barret Rennie
43b15fc417 Bug 1665172 - Use nsCOMPtr for nsI* interface pointers r=emalysz
Differential Revision: https://phabricator.services.mozilla.com/D96145
2020-11-10 01:59:45 +00:00
Barret Rennie
10b1daf81a Bug 1665172 - Use nsFileInputStream for IOUtils::ReadSync r=Gijs
`nsFileInputStream` does most of the same work we were doing manually to read
files and determine their size in `ReadSync`.

Differential Revision: https://phabricator.services.mozilla.com/D96144
2020-11-10 01:59:38 +00:00
Barret Rennie
acfb1ff12b Bug 1665172 - Pass nsIFile through IOUtils::GetChildrenSync for paths instead of strings r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D96143
2020-11-10 01:59:30 +00:00
Barret Rennie
95f2d2fff8 Bug 1665172 - Pass nsIFile through IOUtils::TouchSync for paths instead of strings r=emalysz
Differential Revision: https://phabricator.services.mozilla.com/D96142
2020-11-10 01:59:17 +00:00
Barret Rennie
f6ca7965e3 Bug 1665172 - Pass nsIFile through IOUtils::StatSync for paths instead of strings r=emalysz
Differential Revision: https://phabricator.services.mozilla.com/D96141
2020-11-10 01:59:10 +00:00
Barret Rennie
f5eac1ef5c Bug 1665172 - Pass nsIFile through IOUtils::MakeDirectorySync for paths instead of strings r=Gijs
`CreateDirectorySync` has also been renamed to `MakeDirectorySync` to mirror
all other `Fn` vs `FnSync` methods in IOUtils.

Differential Revision: https://phabricator.services.mozilla.com/D96140
2020-11-10 01:59:02 +00:00
Barret Rennie
ee0b7e9a38 Bug 1665172 - Pass nsIFile through IOUtils::RemoveSync for paths instead of strings r=emalysz
Differential Revision: https://phabricator.services.mozilla.com/D96139
2020-11-10 01:58:55 +00:00
Barret Rennie
cfd92b658c Bug 1665172 - Pass nsIFile through IOUtils::{Copy,Move}Sync for paths instead of strings r=Gijs
We no longer normalize the paths in CopyOrMoveSync and instead rely on
nsIFile::{Copy,Move}ToFollowingLinks to provide path normalization.

Differential Revision: https://phabricator.services.mozilla.com/D96138
2020-11-10 01:58:47 +00:00
Barret Rennie
4e79c1f3e1 Bug 1665172 - Pass nsIFile through IOUtils::WriteAtomic{,UT8}Sync for paths instead of strings r=emalysz
Some other clean ups have been made, like using nsIFile::Exists() instead of
opening a file to see if it exists.

Differential Revision: https://phabricator.services.mozilla.com/D96136
2020-11-10 16:04:49 +00:00
Barret Rennie
6a23c12a15 Bug 1665172 - Pass nsIFile through IOUtils::Read{,UT8}Sync for paths instead of strings r=emalysz
As part of cleaning up IOUtils, we can construct nsLocalFiles in
IOUtils::Read{,UTF8}, which has the benefit of doing more checks up front,
instead of waiting until we have passed work off to the background thread.

Once all methods pass nsIFile instances through to the background thread,
we can remove our own absolute path checking code.

Differential Revision: https://phabricator.services.mozilla.com/D96135
2020-11-10 16:04:28 +00:00
Barret Rennie
7a5c0cb2c6 Bug 1665172 - Remove ToMozPromise from IOUtils r=emalysz
This utility is not used and can be removed.

Differential Revision: https://phabricator.services.mozilla.com/D96134
2020-11-10 00:56:19 +00:00
Barret Rennie
5831b3e790 Bug 1674311 - Add profile, local profile, and temp dir paths to PathUtils r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D95254
2020-11-10 12:08:53 +00:00
Barret Rennie
ac6be32a0a Bug 1671035 - Add a WebIDL backed path manipulation utility r=Gijs,nika
PathUtils is a path manipulation component to IOUtils, which is based on
simplified file I/O. This work is part of the larger goal of removing
osfile.jsm et al., ospath.jsm et al., and the entire OS.* namespace, especially
from the startup path.

No equivalent was provided for OS.Path.fromFileURI because it is unused.

Differential Revision: https://phabricator.services.mozilla.com/D95105
2020-11-05 18:08:38 +00:00
Jeff Walden
c7bc4f2846 Bug 1663365 - Don't include "js/friend/ErrorMessages.h" in jsfriendapi.h. r=arai
Differential Revision: https://phabricator.services.mozilla.com/D95208
2020-10-30 06:33:56 +00:00
Ricky Stewart
02a7b4ebdf Bug 1654103: Standardize on Black for Python code in mozilla-central.
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.

To produce this patch I did all of the following:

1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.

2. Run ./mach lint --linter black --fix

3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.

4. Make some ad-hoc manual updates to `testing/marionette/client/setup.py`, `testing/marionette/harness/setup.py`, and `testing/firefox-ui/harness/setup.py`, which have hard-coded regexes that break after the reformat.

5. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-26 18:34:53 +00:00