Local clipboard copy that gets more than one content analysis warning (plain_text_only=false) can't be released and stays stuck
Categories
(Enterprise Products :: Firefox, defect)
Tracking
(Not tracked)
People
(Reporter: gstoll, Unassigned)
References
(Depends on 1 open bug)
Details
When ContentAnalysis.ClipboardCopy.KeepBlockedDataForSameSite is on and browser.contentanalysis.interception_point.clipboard_copy.plain_text_only is false (set through the PlainTextOnly policy), a copy with both text/plain and text/html sends two content analysis requests under one user action. If the agent warns on both, MultipartRequestCallback::WarnPending passes each warning on, and nsBaseClipboard::OnCopyContentAnalysisWarn runs twice. Each call overwrites PendingCopy::mWarnRequestToken, so only the last token is remembered.
Steps:
- Enable content analysis with KeepBlockedDataForSameSite and PlainTextOnly: false.
- Have the agent return WARN for both text/plain and text/html.
- Copy rich text from a page.
- Click Release in the Data protection panel.
Actual:
- Release answers only the last warning. The multipart callback keeps waiting for the other one, so the copy never reaches the system clipboard and the warn placeholder stays.
- The panel still shows the WARN state, and clicking Release again does nothing because that token is already answered.
- When the copy is later superseded, OnKeptCopyDropped cancels only the remembered token. The other entry stays in ContentAnalysis::mWarnResponseDataMap until quit.
- The warn placeholder is also rewritten and clipboard-local-copy-changed fires once per warning.
Expected: Release answers every outstanding warning for the copy, dropping the copy cancels all of them, and the placeholder is written only once.
Suggested fix: Keep the tokens in an array on PendingCopy. On a second warning for a copy already in the warn state, just add the token. Answer or cancel all of them on release or drop. Consider replacing nsIContentAnalysisLocalCopyInfo.warnRequestToken with a C++ "release kept copy" method so the front end doesn't handle tokens. Add a test where both formats are warned, adapting the panel test that already sets plain_text_only to false.
Description
•