Closed Bug 1618219 Opened 4 years ago Closed 4 years ago

Use BrowsingContext for activeness check in nsFrameSelection.cpp

Categories

(Core :: DOM: Selection, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla76
Fission Milestone M6
Tracking Status
firefox76 --- fixed

People

(Reporter: hsivonen, Assigned: hsivonen)

References

Details

Attachments

(1 file)

https://searchfox.org/mozilla-central/rev/96f1457323cc598a36f5701f8e67aedaf97acfcf/layout/generic/nsFrameSelection.cpp#2910
https://searchfox.org/mozilla-central/rev/96f1457323cc598a36f5701f8e67aedaf97acfcf/layout/generic/nsFrameSelection.cpp#1460

These use GetActiveWindow just to null-check it. Maybe they should instead check something BrowsingContext-related. It's unclear what exactly these want to check in the out-of-process iframe case.

Do these just want to check that Firefox is the frontmost app or do these want to check that the selection is in the active Firefox window?

Flags: needinfo?(mats)

It's a bug in searchfox that it displays me as the author of those lines. AFAICT, they were added in bug 1261299:
https://searchfox.org/mozilla-central/diff/6d8584507fc5baa35562fe3a8542420740032b5f/layout/generic/nsSelection.cpp#1983

Flags: needinfo?(mats) → needinfo?(jimmyw22)

M5 because Henri has patches for related bugs

Fission Milestone: --- → M5
Priority: -- → P2

The patch author hasn't been active for a while. Needinfoing the reviewer.

Flags: needinfo?(mstange)

https://hg.mozilla.org/mozilla-central/rev/0ea81a4d9c2f2ece2c339e60c0f4ccbaabb4b3d4 was reviewed by masayuki and smaug. There's some explanation of it in bug 1261299 comment 116 but I currently don't understand it very well.

Flags: needinfo?(mstange)

masayuki, is it clearer to you what the active window null-check is supposed to be checking?

Flags: needinfo?(masayuki)

That code updates the system selection buffer; if you select text on macos, you can then use commands on the services menu to perform actions on the selected text, such as 'look up in dictionary'. It should only update when for the selection changes in the topmost active window, and not update it for other windows.

The code though looks to just check whether there is an active window, but as long as the child process focus manager knows whether it is in the active window or not, it should suffice to look at that.

Tracking for Fission Nightly (M6)

Fission Milestone: M5 → M6

Sorry for the delay to reply.

As enn said, the former checks whether Firefox is active application on the environment to avoid overwriting the selection buffer with selection changes by JS or something.

I'm not familiar with the latter, but looks like that it does same thing only on macOS. So, it also checks whether Firefox is active for avoiding to overwrite selection buffer which another application may have written.

Flags: needinfo?(masayuki)
Assignee: nobody → hsivonen
Status: NEW → ASSIGNED
Flags: needinfo?(jimmyw22)
Pushed by hsivonen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/8318b018c859
Use BrowsingContext for activeness check in nsFrameSelection.cpp. r=NeilDeakin
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla76
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: