Commit Graph

66 Commits

Author SHA1 Message Date
Greg Stoll
55cbe61557 Bug 1960715 - add type-checking to Content Analysis JS files r=zombie,dlp-reviewers,handyman
This will enable VS Code to do type-checking on these files. Most of
the problems it found were fairly trivial (or wrong type declarations),
but the extra call to _removeSlowCAMessage() seems like a real problem
(will flag in the review)

Differential Revision: https://phabricator.services.mozilla.com/D245625
2025-04-15 19:50:09 +00:00
Greg Stoll
26789907b9 Bug 1959966 - cancel WARN Content Analysis dialogs in an earlier event when quitting to avoid a shutdownhang r=dlp-reviewers,handyman
Per the comment, the quit-application event can be delayed if the user
quits via keyboard or the hamburger menu (as opposed to simply closing
the last window). I didn't dig too deep into this but this seems like
the kind of thing we can do in quit-application-granted anyway.

Differential Revision: https://phabricator.services.mozilla.com/D245594
2025-04-15 16:49:52 +00:00
Greg Stoll
3ce64c5a23 Bug 1959966 - cancel WARN Content Analysis dialogs when quitting to avoid a shutdownhang r=dlp-reviewers,handyman
Explicitly cancel pending WARNs when we quit so that the dialogs go away
and nothing gets stuck. I feel like this used to work by coincidence,
but now we do it explicitly.

Differential Revision: https://phabricator.services.mozilla.com/D245291
2025-04-11 19:55:59 +00:00
Greg Stoll
7e9943b81c Bug 1959810 - add JSDoc types and turn on JSDoc rule for ContentAnalysis.sys.mjs r=dlp-reviewers,frontend-codestyle-reviewers,handyman
There is one functional change where having types helped me notice that
we never use a property of an object we return.

Differential Revision: https://phabricator.services.mozilla.com/D245143
2025-04-11 12:30:00 +00:00
Greg Stoll
0f76fa2f28 Bug 1959115 - monitor pastes into GenAI custom prompt for Content Analysis r=dlp-reviewers,firefox-ai-ml-reviewers,handyman,Mardak
We handle this similarly to pasting into a prompt() dialog, so I
refactored that logic into a new ContentAnalysisUtils and call it from
both places.

Also drive-by cleanup of BUG_COMPONENT for a few Content Analysis
moz.build's

Differential Revision: https://phabricator.services.mozilla.com/D244818
2025-04-10 20:48:22 +00:00
Cristian Tuns
0346c15046 Backed out changeset 8517aa5a4d0d (bug 1959115) for causing bc failures in /browser_clipboard_paste_prompt_content_analysis.js CLOSED TREE 2025-04-10 11:46:56 -04:00
Greg Stoll
09c5ab87cb Bug 1959115 - monitor pastes into GenAI custom prompt for Content Analysis r=dlp-reviewers,firefox-ai-ml-reviewers,handyman,Mardak
We handle this similarly to pasting into a prompt() dialog, so I
refactored that logic into a new ContentAnalysisUtils and call it from
both places.

Also drive-by cleanup of BUG_COMPONENT for a few Content Analysis
moz.build's

Differential Revision: https://phabricator.services.mozilla.com/D244818
2025-04-10 14:42:19 +00:00
Greg Stoll
e179f747af Bug 1957902 - fix the Content Analysis quit confirmation dialog r=dlp-reviewers,handyman
Differential Revision: https://phabricator.services.mozilla.com/D244186
2025-04-02 20:02:39 +00:00
David P
77e415486e Bug 1957039: Show CA response dialog even if the user action was canceled r=dlp-reviewers,gstoll
The busy dialog had already been removed, so this was throwing an exception
as busyDialogInfo was null.

Differential Revision: https://phabricator.services.mozilla.com/D243563
2025-03-28 22:15:54 +00:00
David P
4aa7ab2db2 Bug 1952508: Part 3 - Show number of items in file content analysis busy dialog r=dlp-reviewers,fluent-reviewers,bolsson,gstoll
Differential Revision: https://phabricator.services.mozilla.com/D242224
2025-03-26 01:07:18 +00:00
David P
6e1e12d214 Bug 1952508: Part 2 - Never show more than one busy dialog per tab r=dlp-reviewers,gstoll
This prevents CA from showing many busy dialogs, each of which required a
layout reflow.  This does not prevent CA from showing many other dialogs
(e.g. block and warn dialogs).

Differential Revision: https://phabricator.services.mozilla.com/D242223
2025-03-26 01:07:18 +00:00
Sandor Molnar
ae46e424dd Backed out 5 changesets (bug 1952508) for causing build bustages. CLOSED TREE
Backed out changeset 828a657b93e4 (bug 1952508)
Backed out changeset 47c1df1f21b8 (bug 1952508)
Backed out changeset 878a81c456a4 (bug 1952508)
Backed out changeset 31521327899b (bug 1952508)
Backed out changeset f976f3915b88 (bug 1952508)
2025-03-25 23:30:56 +02:00
David P
6f9ad4538e Bug 1952508: Part 3 - Show number of items in file content analysis busy dialog r=dlp-reviewers,fluent-reviewers,bolsson,gstoll
Differential Revision: https://phabricator.services.mozilla.com/D242224
2025-03-25 18:25:20 +00:00
David P
762e06f051 Bug 1952508: Part 2 - Never show more than one busy dialog per tab r=dlp-reviewers,gstoll
This prevents CA from showing many busy dialogs, each of which required a
layout reflow.  This does not prevent CA from showing many other dialogs
(e.g. block and warn dialogs).

Differential Revision: https://phabricator.services.mozilla.com/D242223
2025-03-25 18:25:20 +00:00
Greg Stoll
187eb94796 Bug 1951414 - fix confirmation dialog when quitting while Content Analysis requests are active r=dlp-reviewers,handyman
I broke this in bug 1928064 when I refactored a bunch of the JS code.

Differential Revision: https://phabricator.services.mozilla.com/D240189
2025-03-03 17:43:46 +00:00
David P
ff715e46d1 Bug 1950501: Ignore browser.contentanalysis.show_blocked_dialog for non-agent messages r=dlp-reviewers,gstoll
Messages not from an agent can't have been shown by an agent, so ignore the pref for them.

Differential Revision: https://phabricator.services.mozilla.com/D239825
2025-02-27 00:31:50 +00:00
Greg Stoll
54ae391135 Bug 1950615 - show "unable to connect" Content Analysis dialog in all cases r=dlp-reviewers,handyman
I verified that this fixes the problem in this bug and does not regress
bug 1928064.

The problem was that if only one request was being made with the same
user action ID, the otherEntries would always be empty, and so we would
not show the dialog. Now we handle multiple requests by removing their
info from requestTokenToRequestInfo, and thus when we get the
"dlp-request-made" notification we will exit early and not show a dialog.

Differential Revision: https://phabricator.services.mozilla.com/D239755
2025-02-26 18:57:29 +00:00
Greg Stoll
be00c74732 Bug 1948884 - make Content Analysis icon show up with vertical tabs r=desktop-theme-reviewers,sfoster
Differential Revision: https://phabricator.services.mozilla.com/D238669
2025-02-25 20:21:52 +00:00
Greg Stoll
8d790dc2c5 Bug 1928064 part 3 - don't show multiple error dialogs for the same userActionId r=dlp-reviewers,handyman
Differential Revision: https://phabricator.services.mozilla.com/D239398
2025-02-25 01:33:01 +00:00
Greg Stoll
97c001a20c Bug 1928064 part 2 - simplify MapByTopBrowsingContext to RequestInfos r=dlp-reviewers,handyman
We are no longer using the grouping by BrowsingContext functionality,
so rename and greatly simplify this class. (not strictly needed for this
change, but simpler is better!)

Differential Revision: https://phabricator.services.mozilla.com/D239397
2025-02-25 01:33:00 +00:00
David P
b9cdd727a8 Bug 1894538: Part 2 - Cancel content analysis requests on timeout r=dlp-reviewers,fluent-reviewers,flod,gstoll
Differential Revision: https://phabricator.services.mozilla.com/D237661
2025-02-18 20:02:43 +00:00
David P
469f02dde1 Bug 1936020: Part 7 - Refactor ContentAnalysis C++ and IDL classes r=dlp-reviewers,gstoll
The changes include:
1. Making various IDL classes builtin.
2. Making nsIContentAnalysisResponse subclass nsIContentAnalysisResult.
3. Making requestToken and userAction fields internal to CA service.
4. Added sourceWindowGlobal (the source of the data to scan) to request and
   use it for content-source-is-same-tab determinations.
5. Made nsIContentAnalysisCallback expect a Result, not a Response.
6. Added cancelRequestsByUserAction and renamed cancelContentAnalysisRequest to cancelRequestsByRequestToken (deprecated).
7. Added ability for CancelAllRequests to forbid future requests (not needed but for peace of mind).
8. Added MakeResponseForTest since response is not builtin.
9. Made ContentAnalysis SupportsWeakPtr so that it can be weakly held by the MultipartRequestCallback,
   which can't just re-get the service since it doesn't want the mock one.
10. Move SafeContentAnalysisResultCallback functionality to ContentAnalysisCallback.
11. Make various routines use userActionId instead of requestToken.
12. Add MultipartRequestCallback to count that we get the right number of responses.
13. Remove unneeded thread sync behavior.  The only part that was kind-of
    neeed was to abort behavior on a background thread if the request were
    canceled first -- this is a race that we don't need to win so we now just
    ignore it and ignore the result (TODO: I'm not positive I send cancel to
    the agent in this case).
14. Send cancel to the agent (in all other cancel cases).
15. Simplify the request map, which is now the user action map mUserActionMap.
16. Makes the MultipartRequestCallback the nexus for filtering requests --
    this way filters are applied uniformly instead of sometimes-at-some-point-
    for-some-use-cases.
17. Adds showBlockedRequestDialog for showing a block dialog when requests
    are rejected before they are expanded into their final form.
18. Adds SafeGetStaticErrorName for logging nsresults.

Differential Revision: https://phabricator.services.mozilla.com/D236630
2025-02-13 19:19:17 +00:00
David P
2af003235e Bug 1936020: Part 4 - Fix contentanalysis.sys.mjs typo r=dlp-reviewers,gstoll
Rename "request" variable that is a response to "response".

Differential Revision: https://phabricator.services.mozilla.com/D236627
2025-02-13 19:19:16 +00:00
Greg Stoll
30b5ca4b60 Bug 1926362 - make cancelling a DLP request actually cancel with the DLP agent r=dlp-reviewers,handyman
Differential Revision: https://phabricator.services.mozilla.com/D231145
2024-12-06 14:41:37 +00:00
David P
acd7b80652 Bug 1929636: Improve content analysis paste-blocked and warn dialogs when agent is not connected r=dlp-reviewers,gstoll
When the DLP agent can't be reached, we enact default DLP behavior based on the
browser.contentanalysis.default_result pref.  That still shows result dialogs
for pastes, and when default-warn is enabled, and the messages used for those
when the agent *is* connected would confuse the user here.  This changes those
messages.

Differential Revision: https://phabricator.services.mozilla.com/D228233
2024-11-07 17:46:02 +00:00
Greg Stoll
c9025fc7e5 Bug 1915351 part 6 - make Content Analysis JS display multiple dialogs seamlessly r=dlp-reviewers,handyman
This uses the already-existing ability of the TabDialogManager to show
a dialog immediately after the previous one closes. So this code doesn't
need to keep track of what dialog to show next - it just displays them
all (and closes them appropriately), and the TabDialogManager will show
them one at a time.

Differential Revision: https://phabricator.services.mozilla.com/D223415
2024-10-28 22:37:58 +00:00
Alexandru Marc
0633abca1a Backed out 10 changesets (bug 1879401, bug 1915351) for causing multiple regressions. CLOSED TREE
Backed out changeset 574d567bbbf1 (bug 1915351)
Backed out changeset 4fcb7eea243f (bug 1915351)
Backed out changeset aa0e2ce8cf21 (bug 1915351)
Backed out changeset 1cf3847d73a7 (bug 1915351)
Backed out changeset fba6942240ea (bug 1915351)
Backed out changeset c5279472391f (bug 1915351)
Backed out changeset a20adf8d4516 (bug 1915351)
Backed out changeset 2b900eb520ce (bug 1915351)
Backed out changeset a8b2b1f62ae6 (bug 1915351)
Backed out changeset 989b843531f8 (bug 1879401)
2024-10-25 16:43:29 +03:00
Greg Stoll
e66bb15ca2 Bug 1915351 part 6 - make Content Analysis JS display multiple dialogs seamlessly r=dlp-reviewers,handyman
This uses the already-existing ability of the TabDialogManager to show
a dialog immediately after the previous one closes. So this code doesn't
need to keep track of what dialog to show next - it just displays them
all (and closes them appropriately), and the TabDialogManager will show
them one at a time.

Differential Revision: https://phabricator.services.mozilla.com/D223415
2024-10-24 02:15:14 +00:00
Greg Stoll
575789c7d8 Bug 1921079 - make DLP agent name bold in panel r=dlp-reviewers,fluent-reviewers,handyman
I tried this for the hover text as well but unsurprisingly bold text
isn't styled any differently there.

Differential Revision: https://phabricator.services.mozilla.com/D225856
2024-10-18 19:30:29 +00:00
Greg Stoll
8761987491 Bug 1912384 part 2 - don't show dialog for cached DLP results r=dlp-reviewers,handyman
For BLOCKED text, if we do two requests in quick succession, we will now
return a cached result for the second request. This patch avoids showing
the BLOCK dialog more than once. (also works for WARN)

Differential Revision: https://phabricator.services.mozilla.com/D219496
2024-08-22 13:15:36 +00:00
Gijs Kruitbosch
a6f6ff1c9a Bug 1896783 - start using the category manager for browser delayed startup, r=mossop,webcompat-reviewers,twisniewski
Differential Revision: https://phabricator.services.mozilla.com/D210433
2024-08-14 13:10:41 +00:00
Greg Stoll
6e33f54294 Bug 1902969 - cancel DLP request when warn dialog is moved to new window r=dlp-reviewers,handyman
Differential Revision: https://phabricator.services.mozilla.com/D213998
2024-06-28 19:01:05 +00:00
Greg Stoll
5d5b96fb12 Bug 1900798 - go back to async "DLP blocked" dialog for print preview r=dlp-reviewers,handyman
A new attempt to fix these problems - always use asynchronous dialogs, but in the print preview case show the "DLP blocked" dialog on the original browsingContext that displayed the print preview dialog (since the dialog itself is about to close)

Differential Revision: https://phabricator.services.mozilla.com/D212815
2024-06-12 19:39:15 +00:00
Greg Stoll
1981579755 Bug 1899703, 1899971 - don't shutdownhang when quitting while DLP request is active r=dlp-reviewers,handyman
Differential Revision: https://phabricator.services.mozilla.com/D212474
2024-06-05 14:05:56 +00:00
Greg Stoll
0ed79d0d07 Bug 1899714 - make DLP block dialog show up again for print preview window r=dlp-reviewers,handyman
I verified that quitting while the synchronous version of the dialog is active doesn't hang, so we're not re-regressing bug 1898718.

Differential Revision: https://phabricator.services.mozilla.com/D212189
2024-06-04 23:03:52 +00:00
Greg Stoll
6bdae479cd Bug 1898718 - show DLP response dialog asynchronously so it doesn't block shutdown r=dlp-reviewers,handyman
Differential Revision: https://phabricator.services.mozilla.com/D211870
2024-05-29 18:11:37 +00:00
Greg Stoll
4bcafcb40b Bug 1893536 - Use more natural wording for Content Analysis error messages r=dlp-reviewers,fluent-reviewers,bolsson,handyman
Differential Revision: https://phabricator.services.mozilla.com/D208678
2024-04-27 10:44:51 +00:00
Greg Stoll
230709d6c4 Bug 1893497 - Remove unneeded await on l10n.setAttributes in ContentAnalysis.sys.mjs r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D208658
2024-04-25 22:53:26 +00:00
Hanna Jones
21849b1def Bug 1803678 - enable lazy loading of ESModule based moz- custom elements r=reusable-components-reviewers,pip-reviewers,credential-management-reviewers,translations-reviewers,kpatenio,issammani,mstriemer
Differential Revision: https://phabricator.services.mozilla.com/D207445
2024-04-24 19:16:46 +00:00
Stanca Serban
29d6ee2faf Backed out changeset 58e1e96263b7 (bug 1803678) mochitests failures in test_confirm_delete_dialog.html. CLOSED TREE 2024-04-24 03:14:45 +03:00
Hanna Jones
9413513b0d Bug 1803678 - enable lazy loading of ESModule based moz- custom elements r=reusable-components-reviewers,pip-reviewers,credential-management-reviewers,translations-reviewers,kpatenio,issammani,mstriemer
Differential Revision: https://phabricator.services.mozilla.com/D207445
2024-04-23 19:28:47 +00:00
Aron Cseh
08943f7f60 Backed out changeset 421fd8a0360c (bug 1803678) for causing mochitest failures on browser_translations_select_panel_init_failure.js CLOSED TREE 2024-04-23 18:16:55 +03:00
Hanna Jones
cf0399a238 Bug 1803678 - enable lazy loading of ESModule based moz- custom elements r=reusable-components-reviewers,pip-reviewers,credential-management-reviewers,translations-reviewers,kpatenio,issammani,mstriemer
Differential Revision: https://phabricator.services.mozilla.com/D207445
2024-04-23 13:52:27 +00:00
Greg Stoll
001f5dd92d Bug 1879149 - UX improvements for DLP block dialog and warn dialog r=dlp-reviewers,fluent-reviewers,bolsson,handyman
- Make the block dialog modal (instead of an OS notification) and use UX strings
- Make the warn dialog not have a default choice on it

Differential Revision: https://phabricator.services.mozilla.com/D206813
2024-04-16 13:10:03 +00:00
Greg Stoll
8a34220acd Bug 1878700 part 2 - show DLP icon in toolbar when content analysis is active r=handyman,desktop-theme-reviewers,fluent-reviewers,emilio,bolsson,Gijs
This also opens SUMO when the icon is clicked on. (the real page will be made as a part of bug 1882595)

Differential Revision: https://phabricator.services.mozilla.com/D203686
2024-04-15 14:25:53 +00:00
Greg Stoll
1a4633232d Bug 1875481 - Part 3: Add content analysis support to printing operations r=handyman,spohl,fluent-reviewers,kpatenio,smaug,emilio
Differential Revision: https://phabricator.services.mozilla.com/D200979
2024-04-10 00:15:47 +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
77cb63d2a3 Bug 1875481 - Part 3: Add content analysis support to printing operations r=handyman,spohl,fluent-reviewers,kpatenio,smaug,emilio
Differential Revision: https://phabricator.services.mozilla.com/D200979
2024-04-08 23:53:58 +00:00
Greg Stoll
4b6721833e Bug 1888259 - Show a notification when a Content Analysis request is denied for lack of an agent connection r=dlp-reviewers,fluent-reviewers,handyman
Note that this also covers the case when the connection initially succeeds but then the agent goes away - we hope to handle this better in bug 1888293. This also shows a message if the signature verification fails.

Differential Revision: https://phabricator.services.mozilla.com/D206024
2024-04-02 11:53:40 +00:00
Greg Stoll
2a8fe926e0 Bug 1882603 - don't show Content Analysis Block result if pref is set r=dlp-reviewers,handyman
Differential Revision: https://phabricator.services.mozilla.com/D205153
2024-03-20 17:35:26 +00:00