Commit Graph
154 Commits
Author SHA1 Message Date
Ray Kraesig 51287023de Bug 1883943 - Let the out-of-process file-picker ride the trains r=win-reviewers,gstoll
Differential Revision: https://phabricator.services.mozilla.com/D217849
2024-07-26 17:45:30 +00:00
Ray Kraesig a824aad459 Bug 1884426 - [6/6] Add AsyncExecute strategy: retry locally except on crashes r=win-reviewers,gstoll
... and set this as the new default strategy on Nightly.

Note that the file-picker failure UI will still be displayed if, e.g.,
the file-dialog encounters a nonfatal local failure after a nonfatal
remote failure.

Differential Revision: https://phabricator.services.mozilla.com/D215559
2024-07-09 22:16:57 +00:00
Ray Kraesig 789ef0b363 Bug 1884426 - [5/6] Refactor AsyncExecute strategy-implementation code r=win-reviewers,gstoll
DRY up code slightly in preparation for adding a new strategy.

No functional changes.

Differential Revision: https://phabricator.services.mozilla.com/D215558
2024-07-09 22:16:56 +00:00
Ray Kraesig 7a0df6b4c8 Bug 1884426 - [3/6] Implement file-picker-crashed UI message r=Gijs,win-reviewers,fluent-reviewers,firefox-desktop-core-reviewers ,flod,gstoll
Fire a signal (via the observer service) when the file-dialog crashes or
otherwise fails.

Set up a listener for that signal which reports the failure to the
end-user via the NotificationBox.

Differential Revision: https://phabricator.services.mozilla.com/D214192
2024-07-09 22:16:55 +00:00
Ray Kraesig 3c376f16dd Bug 1884426 - [2/6] Write saved file to fallback location if possible r=win-reviewers,gstoll
If the user is trying to save a file, don't discard that file on
failure; instead, write it to some default location on the filesystem.

Differential Revision: https://phabricator.services.mozilla.com/D214190
2024-07-09 22:16:55 +00:00
Ray Kraesig 2a65db2ba6 Bug 1884426 - [1/6] Extend error propagation slightly r=win-reviewers,gstoll
Propagate error signal up into nsFilePicker::Open(), to unify error
handling between files and folders.

No functional changes (yet).

Differential Revision: https://phabricator.services.mozilla.com/D214188
2024-07-09 22:16:55 +00:00
Ray Kraesig 34f7841f44 Bug 1902737 - [1/1] Add "in shutdown" boolean to file-picker telemetry r=gstoll,win-reviewers,data-stewards
Additionally, fix a schema error: `data-sensitivity` was under
`metadata`, and also should have been spelled with an underscore.

Differential Revision: https://phabricator.services.mozilla.com/D213834
2024-06-20 00:33:37 +00:00
Greg Stoll bd48c526cb Bug 1899764 - make DLP handle nested folders r=rkraesig,dlp-reviewers,win-reviewers,handyman
Differential Revision: https://phabricator.services.mozilla.com/D212214
2024-06-05 20:03:04 +00:00
Ray Kraesig ef11307dde Bug 1884221 - [1/1] Add fallback_v2 telemetry r=win-reviewers,gstoll
Add new telemetry for the file-dialog picker which should more precisely
pinpoint the initial cause of failures.

Data-review approval: https://bugzilla.mozilla.org/show_bug.cgi?id=1884221#c2

Differential Revision: https://phabricator.services.mozilla.com/D211120
2024-05-30 17:52:09 +00:00
Ray Kraesig 0d6d84297d Bug 1895375 - [4/4] Propagate ipc::LaunchErrors to callers r=ipc-reviewers,nika
* Adjust UtilityProcess{Host,Manager} to propagate ipc::LaunchErrors for
  their clients, or to create new ones where none previously existed.

* Adjust the various clients of the above to to handle the additional
  information -- mostly by adding the additional failure-location data
  to log messages.

* Fix an unrelated bug wherein the return type of `LaunchProcess` was
  declared as exclusive, despite being cached and reused.

In particular, filedialog::Error objects should now contain -- and report
to telemetry without further adjustment -- the actual error code from
`ipc::LaunchError`s.

(Reporting the original failure location as well will occur in bug
1884221.)

Differential Revision: https://phabricator.services.mozilla.com/D209715
2024-05-30 17:52:09 +00:00
Greg Stoll dcf7eb4ece Bug 1894260 - get folder contents for DLP in a simpler way r=win-reviewers,dlp-reviewers,handyman
We used to use GetDomFileOrDirectory(), but that creates a mozilla::dom::Directory which needs to be able to get a DOMWindow. Getting that DOMWindow is now failing, perhaps because of the out-of-process file picker?

Anyway, all we care about is getting the contents of the directory, so we can just use GetDirectoryEntries() to sidestep this, and it also makes the code a bit simpler.

Unfortunately there isn't a good way to test code that's in nsFilePicker.cpp right now, as MockFilePicker mocks all of this out.

Differential Revision: https://phabricator.services.mozilla.com/D209056
2024-05-06 00:25:41 +00:00
Ray Kraesig 078903e2e0 Bug 1886327 - [5/5] serialize error locations as constant numeric values r=win-reviewers,gstoll
Instead of passing potentially-dynamic strings over the IPDL interface,
pass an integer which corresponds to one of a fixed set of static
strings. (This is basically an enum with more steps -- or with fewer
steps, depending on which side of it you're standing on.)

This ensures that the set of possible location-strings is fixed, which
in turn both ensures that aggregation of telemetry stays relatively
simple and guards against accidental leakage of PII thereinto. (Or,
alternatively and equivalently, this minimizes the code region that
data-review needs to consider once the location string is reported to
telemetry.)

Note that we do not yet actually report the location-string via
telemetry; that's planned to occur in bug 1884221.

Differential Revision: https://phabricator.services.mozilla.com/D205169
2024-04-25 20:42:50 +00:00
Ray Kraesig 79b15dcecb Bug 1886327 - [4/5] propagate ordinary filepicker errors through IPDL r=win-reviewers,gstoll
Don't crash the file-picker host process just because a nonfatal failure
occurred. Instead, report the failure location and code over the IPDL
interface.

Differential Revision: https://phabricator.services.mozilla.com/D205168
2024-04-25 20:42:49 +00:00
Ray Kraesig ca857997cc Bug 1886327 - [3/5] rework promise type to carry metadata r=win-reviewers,gstoll
Replace most promise-types in widget/windows/filedialog with something
capable of carrying the initial cause and location of a failure.

This does not properly convey that metadata across the IPDL connection
where possible; that will be done in an upcoming commit.

Differential Revision: https://phabricator.services.mozilla.com/D205167
2024-04-25 20:42:49 +00:00
Ray Kraesig 3e671bd045 Bug 1886327 - [2/5] hide ShowFilePickerRemote _et al._ r=win-reviewers,gstoll
The `Show{File,Folder}Picker{Local,Remote}` functions don't depend on
anything in `nsFilePicker` itself except the mostly-vestigial promise
type. Pull all of them into nsFilePicker.cpp as static functions in an
anonymous namespace.

No functional changes.

Differential Revision: https://phabricator.services.mozilla.com/D205166
2024-04-25 20:42:49 +00:00
Ray Kraesig 99bd6bd3fc Bug 1886327 - [1/5] wrap Send* calls in FilePickerParent r=win-reviewers,gstoll
... in preparation for more interesting changes surrounding the error type.

No functional changes.

Differential Revision: https://phabricator.services.mozilla.com/D205165
2024-04-25 20:42:48 +00:00
Greg Stoll 8a7617b316 Bug 1875481 - Part 2: Remove [infallible] from a few nsIContentAnalysis* IDL classes to allow mocking in tests r=handyman,win-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D200978
2024-04-10 00:15:46 +00:00
Stanca Serban 4c0f6b30c1 Backed out 3 changesets (bug 1875481) for basicWindowDotPrintTest related junit failures.
Backed out changeset cd024cb2768e (bug 1875481)
Backed out changeset 6b7be15cd017 (bug 1875481)
Backed out changeset d1da53c0673b (bug 1875481)
2024-04-09 05:56:47 +03:00
Greg Stoll c16e80113c Bug 1875481 - Part 2: Remove [infallible] from a few nsIContentAnalysis* IDL classes to allow mocking in tests r=handyman,win-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D200978
2024-04-08 23:53:58 +00:00
Ray Kraesig d18159c4bb Bug 1877522 - [3/3] Enforce linearity (exclusivity) of ThenCommand r=xpcom-reviewers,barret
ThenCommands are effectively linear: they can only be used once. Make
this restriction more difficult to accidentally violate by applying
MOZ_TEMPORARY_CLASS.

Fix the one line of code that this breaks. Castigate its author (who is
also the author of this commit) accordingly.

No functional changes.

Differential Revision: https://phabricator.services.mozilla.com/D200061
2024-03-20 01:30:14 +00:00
David P e1b995429b Bug 1879181: Allow skipping content analysis for requests that match url list r=gstoll,win-reviewers
Check the URLs in the request against the prefs
browser.contentanalysis.allow_url_regex_list and
browser.contentanalysis.deny_url_regex_list, which are space-separated
lists of ECMAscript regexs that match against ASCII-encoded URLs.

Differential Revision: https://phabricator.services.mozilla.com/D203508
2024-03-11 23:55:47 +00:00
Cosmin Sabou 29de9fa78b Backed out 3 changesets (bug 1879181) for causing gtest failures on ContentAnalysisTest.
Backed out changeset b2407a14159f (bug 1879181)
Backed out changeset 78303b2900e9 (bug 1879181)
Backed out changeset 25521d09c1de (bug 1879181)
2024-03-09 01:59:45 +02:00
David P e357268905 Bug 1879181: Allow skipping content analysis for requests that match url list r=gstoll,win-reviewers
Check the URLs in the request against the prefs
browser.contentanalysis.allow_url_regex_list and
browser.contentanalysis.deny_url_regex_list, which are space-separated
lists of ECMAscript regexs that match against ASCII-encoded URLs.

Differential Revision: https://phabricator.services.mozilla.com/D203508
2024-03-08 20:28:09 +00:00
Gregory Pappas 3a68660a11 Bug 1878401 - part 1 - Pass BrowsingContext to nsIFilePicker::Init instead of mozIDOMWindow r=geckoview-reviewers,win-reviewers,emilio,nika,m_kato,rkraesig
This will improve the situation in bug 1878336

Differential Revision: https://phabricator.services.mozilla.com/D200546
2024-02-28 21:29:37 +00:00
Sandor Molnar c853f2f3e9 Backed out 8 changesets (bug 1878401, bug 1879041) for causing build bustages on widget/nsBaseFilePicker.cpp CLOSED TREE
Backed out changeset 2e2b8df3bdd6 (bug 1879041)
Backed out changeset 6d6952f9df2c (bug 1878401)
Backed out changeset 30b5bb590d3e (bug 1878401)
Backed out changeset 9a4b830334b9 (bug 1878401)
Backed out changeset 3c3d67f1fcb7 (bug 1878401)
Backed out changeset c83ba4026822 (bug 1878401)
Backed out changeset 6bcb670ce475 (bug 1878401)
Backed out changeset f263b196df96 (bug 1878401)
2024-02-28 17:56:48 +02:00
Gregory Pappas 44b053ba1a Bug 1878401 - part 1 - Pass BrowsingContext to nsIFilePicker::Init instead of mozIDOMWindow r=geckoview-reviewers,win-reviewers,emilio,nika,m_kato,rkraesig
This will improve the situation in bug 1878336

Differential Revision: https://phabricator.services.mozilla.com/D200546
2024-02-28 15:07:44 +00:00
Greg Stoll b2839267e7 Bug 1871135 - Add content analysis support to clipboard operations r=edgar,nika,masayuki,devtools-reviewers
When content analysis is on, pastes will be checked by the CA
agent while tab input is blocked. The synchronous nsIClipboard.getData()
method must block until the analysis result is received, so this
requires doing a SpinEventLoopUntil.

Differential Revision: https://phabricator.services.mozilla.com/D196997
2024-02-13 11:26:48 +00:00
Cristian Tuns 35a4843e35 Backed out changeset 9dfe3fe4ccc5 (bug 1871135) for causing mochitest failures in nsClipboardProxy.cpp CLOSED TREE 2024-02-12 12:04:41 -05:00
Greg Stoll 215d43e99f Bug 1871135 - Add content analysis support to clipboard operations r=edgar,nika,masayuki,devtools-reviewers
When content analysis is on, pastes will be checked by the CA
agent while tab input is blocked. The synchronous nsIClipboard.getData()
method must block until the analysis result is received, so this
requires doing a SpinEventLoopUntil.

Differential Revision: https://phabricator.services.mozilla.com/D196997
2024-02-12 16:05:06 +00:00
Cristian Tuns 907b8f6b06 Backed out changeset 3caca1d10dcc (bug 1871135) for causing build bustages in nsBaseClipboard.cpp CLOSED TREE 2024-02-12 09:59:09 -05:00
Greg Stoll 1d234e67c7 Bug 1871135 - Add content analysis support to clipboard operations r=edgar,nika,masayuki,devtools-reviewers
When content analysis is on, pastes will be checked by the CA
agent while tab input is blocked. The synchronous nsIClipboard.getData()
method must block until the analysis result is received, so this
requires doing a SpinEventLoopUntil.

Differential Revision: https://phabricator.services.mozilla.com/D196997
2024-02-12 00:49:39 +00:00
Ray Kraesig 4a93979dbf Bug 1878568 - [2/2] Eliminate WindowEnabler r=win-reviewers,yjuglaret
Eliminate `WindowEnabler` by folding it into `nsWindow::PickerOpen()`
and `nsWindow::PickerClosed()`. This avoids the implicit assumption that
multiple instances are created and destroyed in LIFO order.

Differential Revision: https://phabricator.services.mozilla.com/D200742
2024-02-08 17:34:47 +00:00
Ray Kraesig 6692550dfb Bug 1878568 - [1/2] Drive-by cleanup: simplify AutoWidgetPickerState r=win-reviewers,yjuglaret
Remove an unnecessary member function from AutoWidgetPickerState.

Additionally, use a safer method of getting the underlying nsWindow than
`static_cast`, and add some thread-safety assertions in
nsWindow::Picker{Open,Closed}().

No functional changes on the happy path.

Differential Revision: https://phabricator.services.mozilla.com/D200741
2024-02-08 17:34:47 +00:00
Gregory Pappas b8a57ea6f0 Bug 1708289 - Implement AllowFileSelectionDialogs policy r=fluent-reviewers,mkaply,emilio,Gijs,bolsson,win-reviewers,rkraesig
Differential Revision: https://phabricator.services.mozilla.com/D199328
2024-02-01 00:48:24 +00:00
Greg Stoll a1881d1c53 Bug 1872179 - Part 4: File picker selecting a folder consults content analysis r=rkraesig,win-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D198457
2024-01-22 13:56:08 +00:00
Greg Stoll df896d7e12 Bug 1872179 - Part 3: File picker file uploads consult content analysis r=rkraesig,win-reviewers
File picker upload operations check with any connected content analysis
tool before giving access to the web page.

Differential Revision: https://phabricator.services.mozilla.com/D198456
2024-01-22 13:56:07 +00:00
Greg Stoll b0ad584e56 Bug 1872179 - Part 2: Add ClearFiles() method to nsIFilePicker r=rkraesig,win-reviewers
This will be useful in future changes, as this is what gets called when Content Analysis blocks a selected file.

Differential Revision: https://phabricator.services.mozilla.com/D198454
2024-01-22 13:56:07 +00:00
Ray Kraesig 3324fc999b Bug 1872397 - [2/2] Refactor to eliminate nested pseudonamespace struct r=win-reviewers,mhowell
As much as I like the "all-static uninstantiable struct" projection of
Rust-style modules, they're an unnecessary weirdness in C++.

Shuffle the code around to just use a collection of nested namespaces.

No functional changes.

Differential Revision: https://phabricator.services.mozilla.com/D197627
2024-01-09 22:36:18 +00:00
Ray Kraesig 3464a0a4bc Bug 1872397 - [1/2] Add telemetry for in-process file-picker fallback r=win-reviewers,mhowell
Add a new Glean event for the out-of-process file-dialog, marking when
it breaks and forces us to fall back to the existing in-process
behavior.

This creates a new nested pseudo-namespace struct, which is just weird
enough that it probably needs to be replaced with a true namespace. That
will be done in the next commit.

Differential Revision: https://phabricator.services.mozilla.com/D197626
2024-01-09 22:36:17 +00:00
Stanca Serban 6a27bbefde Backed out 2 changesets (bug 1872397) for causing build bustages in nsFilePicker.cpp. CLOSED TREE
Backed out changeset 199101385cfb (bug 1872397)
Backed out changeset 393815a4d499 (bug 1872397)
2024-01-09 23:24:14 +02:00
Ray Kraesig 35e58f1df9 Bug 1872397 - [2/2] Refactor to eliminate nested pseudonamespace struct r=win-reviewers,mhowell
As much as I like the "all-static uninstantiable struct" projection of
Rust-style modules, they're an unnecessary weirdness in C++.

Shuffle the code around to just use a collection of nested namespaces.

No functional changes.

Differential Revision: https://phabricator.services.mozilla.com/D197627
2024-01-09 20:36:33 +00:00
Ray Kraesig 0021650688 Bug 1872397 - [1/2] Add telemetry for in-process file-picker fallback r=win-reviewers,mhowell
Add a new Glean event for the out-of-process file-dialog, marking when
it breaks and forces us to fall back to the existing in-process
behavior.

This creates a new nested pseudo-namespace struct, which is just weird
enough that it probably needs to be replaced with a true namespace. That
will be done in the next commit.

Differential Revision: https://phabricator.services.mozilla.com/D197626
2024-01-09 20:36:33 +00:00
Ray Kraesig 3a17709890 Bug 1867630 - Unify "FileDialog" loggers r=win-reviewers,mhowell
Clean up the various uses of LazyLogModule with FileDialog.

Differential Revision: https://phabricator.services.mozilla.com/D195937
2023-12-13 00:36:25 +00:00
Ray Kraesig 489ac49922 Bug 1858225 - [8/9] cancel out sync/async transitions r=win-reviewers,handyman
Pull the async-to-sync transition down one (or two) class-layers, while
pulling the sync-to-async transition up one more function layer. This
allows them to meet in a single function -- where they cleanly annihilate.

This is a _significant_ functional change, as it leaves the file-dialog
implementation fully asynchronous on Windows! \o/

Differential Revision: https://phabricator.services.mozilla.com/D193740
2023-12-01 05:03:20 +00:00
Ray Kraesig fc89322e38 Bug 1858225 - [7/9] hoist syncification one more layer r=win-reviewers,handyman
Pull the sync-to-async boundary up another function-call layer. This
unifies the file- and folder-picker sync-to-async boundaries.

Again, no functional changes except for the migration of a tiny bit of
glue code.

Differential Revision: https://phabricator.services.mozilla.com/D193739
2023-12-01 05:03:20 +00:00
Ray Kraesig dd0242574f Bug 1858225 - [6/9] hoist syncification one layer up r=win-reviewers,handyman
Pull the sync-to-async boundary up one function-call layer, from
`ShowXxxPicker{Local,Remote}` to `ShowXxxPicker`. This coalesces the
remote and local sync-to-async boundaries.

Additionally, standardize on exclusive MozPromises, since none of them
happen to need multiple listeners.

This is arguably, but not practically, a functional change, as a tiny
bit of glue code is now executed on a different thread.

(N.B.: While this reduces the total number of sync-to-async boundaries
back down to two, this is not the removal promised in the previous
commit summary.)

Differential Revision: https://phabricator.services.mozilla.com/D193738
2023-12-01 05:03:20 +00:00
Ray Kraesig 082e99b399 Bug 1858225 - [5/9] use local-async functions for local calls r=win-reviewers,mhowell
When opening a file dialog locally (that is, in the parent process), do
so asynchronously on a separate thread.

Since the calling code is still synchronous, this necessitates adding
new calls to `ImmorallyDrivePromiseToCompletion` at the sync-to-async
boundary. These are _very_ temporary -- they'll be removed before this
patchset is done.

Differential Revision: https://phabricator.services.mozilla.com/D193737
2023-12-01 05:03:19 +00:00
Ray Kraesig 40fdf752a4 Bug 1858225 - [2/9] inline nsFilePicker::...Impl() functions r=win-reviewers,mhowell
These functions are essentially sprues, left over from earlier
development. Trim them away.

No functional changes.

Differential Revision: https://phabricator.services.mozilla.com/D193734
2023-12-01 05:03:18 +00:00
Ray Kraesig 8aa5e415da Bug 1858225 - [1/9] rename CreateWinFileDialogAsync to CreateWinFileDialogActor r=win-reviewers,mhowell,gerard-majax
We're about to add some code that will actually create a file dialog,
rather than just the actor, asynchronously. Rename this function to make
it clear which of those it does.

(That it does so asynchronously is probably sufficiently communicated by
the return type.)

Differential Revision: https://phabricator.services.mozilla.com/D193733
2023-12-01 05:03:18 +00:00
Cosmin Sabou 3c7a65e66b Backed out 11 changesets (bug 1858225) for causing build bustages on nsFilePicker.cpp. CLOSED TREE
Backed out changeset 808f68da4438 (bug 1858225)
Backed out changeset e6f456e40dda (bug 1858225)
Backed out changeset d1efbf517c7e (bug 1858225)
Backed out changeset 61c8a62b47c5 (bug 1858225)
Backed out changeset 9b1f0d37b74b (bug 1858225)
Backed out changeset f57ac4a387f2 (bug 1858225)
Backed out changeset 9b2c6eaf137e (bug 1858225)
Backed out changeset 6aacb8fde7e1 (bug 1858225)
Backed out changeset 2eb38cba55d6 (bug 1858225)
Backed out changeset c31dfa5f9be5 (bug 1858225)
Backed out changeset 82b7b851c429 (bug 1858225)
2023-12-01 00:18:29 +02:00