Closed Bug 1924247 Opened 2 years ago Closed 2 years ago

Disable old scrollwheel-message-laundering hack via pref

Categories

(Core :: Widget: Win32, task, P3)

task

Tracking

()

RESOLVED FIXED
134 Branch
Tracking Status
firefox134 --- fixed

People

(Reporter: rkraesig, Assigned: rkraesig)

References

Details

Attachments

(5 external files, 1 obsolete file)

Bug 658194 introduced a hack wherein scroll messages would be extracted from the thread's message queue early, posted back to the queue under a different message-ID, and then immediately reextracted for processing by the target nsWindow.

This was intended to avoid deadlock induced by some NPAPI plugins running in the plugin-container process. However, we don't support those at all anymore — plugin-container is now only used for media-decoding plugins, which shouldn't need to process scroll messages. Additionally, there are some indications that this is impacting Firefox performance in long-running browser sessions. (See analysis in bug 1819286.)

As this is in a deep and thoroughly-aged part of our message-handling code, just unconditionally removing it is probably a bad idea. However, we can add a controlling pref, and then test the pref in certain populations (like "Nightly" or "users for whom this is believed to be an issue").

The semantics of the old technically-third-party MSH_MOUSEWHEEL message
were different from that of the modern WM_MOUSEWHEEL. [1] Unfortunately,
when we updated the scroll-wheel code back in Firefox 1.8/2.0, we copied
the MSH_MOUSEWHEEL semantics over into the WM_MOUSEWHEEL code. (See bug
347875.)

This has probably never caused issues, but we might as well fix it.

[1] https://devblogs.microsoft.com/oldnewthing/20080806-00/?p=21353

Assignee: nobody → rkraesig
Status: NEW → ASSIGNED

Clean up MouseScrollHandler::SynthesizedEvent:

  • Since this is a private local class, move it into the .cpp file, to
    minimize the number of compilation units that need to parse it.
  • Explicitly check mSynthesizingEvent for validity BEFORE calling
    nonstatic member functions. (Previously this code would call through
    nullptr as part of normal operation!)
  • Use UniquePtr in preference to explicit new and delete.

Additionally, at the end of the file, undo the #define-poisoning of
GetMessagePos to allow WinMouseScrollHandler.cpp to be used in unified
builds. Adjust moz.build accordingly.

No functional changes.

fixup for unified

Bug 658194 introduced a hack wherein scroll messages would be extracted
from the thread's message queue early, posted back to the queue under a
different message-ID, and then immediately reextracted for processing by
the target nsWindow.

This was intended to avoid deadlocks induced by some NPAPI plugins
running in the plugin-container process. However, we don't support
NPAPI plugins at all anymore, so this should no longer be necessary.

The key word in that sentence is, of course, "should". Instead of
outright removing the hack, for now we just make its use dependent on a
pref (defaulted to off).

Attachment #9432125 - Attachment description: Bug 1924247 - [1/3] Fix WM_MOUSEHWHEEL return code r?masayuki → Bug 1924247 - [1/4] Fix WM_MOUSEHWHEEL return code r?masayuki
Attachment #9432126 - Attachment description: Bug 1924247 - [2/3] Tidy up SynthesizedEvent r?masayuki → Bug 1924247 - [2/4] Tidy up SynthesizedEvent r?masayuki

Extract the component of ProcessNativeMouseWheelMessage which identifies
the adjusted target window, for use in the alternative event flow in the
next commit.

Attachment #9432127 - Attachment description: Bug 1924247 - [3/3] Disable scrollwheel-message hack via new pref r?masayuki → Bug 1924247 - [4/4] Disable scrollwheel-message hack via new pref r?masayuki
Attachment #9432125 - Attachment description: Bug 1924247 - [1/4] Fix WM_MOUSEHWHEEL return code r?masayuki → Bug 1924247 - [1/5] Fix WM_MOUSEHWHEEL return code r?masayuki
Attachment #9432126 - Attachment description: Bug 1924247 - [2/4] Tidy up SynthesizedEvent r?masayuki → Bug 1924247 - [2/5] Tidy up SynthesizedEvent, &c. r?masayuki

We no longer have any plugins that accept mouse inputs. Remove the
plugin-handling case from ProcessNativeMouseWheelMessage, in preparation
for a refactor.

Attachment #9432997 - Attachment description: Bug 1924247 - [3/4] Factor window-identification out of ProcessNativeMouseWheelMessage r?masayuki → Bug 1924247 - [4/5] Factor window-identification out of ProcessNativeMouseWheelMessage r?masayuki
Attachment #9432127 - Attachment description: Bug 1924247 - [4/4] Disable scrollwheel-message hack via new pref r?masayuki → Bug 1924247 - [5/5] Disable scrollwheel-message hack via new pref r?masayuki

Check that the new code paths don't accidentally recurse.

(This commit should be squashed into the preceding commit before
landing.)

Attachment #9433410 - Attachment is obsolete: true
Pushed by rkraesig@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/50fd2e921a94 [1/5] Fix WM_MOUSEHWHEEL return code r=masayuki https://hg.mozilla.org/integration/autoland/rev/2734ab6d67f7 [2/5] Tidy up SynthesizedEvent, &c. r=masayuki https://hg.mozilla.org/integration/autoland/rev/9725b80b10fe [3/5] Remove plugin-window case from mousewheel handler r=masayuki https://hg.mozilla.org/integration/autoland/rev/391ca08dfb0c [4/5] Factor window-identification out of ProcessNativeMouseWheelMessage r=masayuki https://hg.mozilla.org/integration/autoland/rev/15bc99dbb8fe [5/5] Disable scrollwheel-message hack via new pref r=masayuki

Backed out for causing mochitests failures in test_mouse_scroll.xhtml.

  • Backout link
  • Push with failures
  • Failure Log
  • Failure line: TEST-UNEXPECTED-FAIL | widget/tests/test_mouse_scroll.xhtml | WM_VSCROLL, SB_LINEDOWN, lParam is NULL, emulation disabled:(DOMMouseScroll), event shouldn't be fired - didn't expect +0, but got it
Flags: needinfo?(rkraesig)

Locally reproduced and

(EDIT: This partial post was accidentally submitted; there is no "and" yet.)

Flags: needinfo?(rkraesig)
Summary: Add pref to disable old scrollwheel-message-laundering hack → Disable old scrollwheel-message-laundering hack via pref
Pushed by rkraesig@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/42d6b08aed11 [1/5] Fix WM_MOUSEHWHEEL return code r=masayuki https://hg.mozilla.org/integration/autoland/rev/20e5ecefe7bc [2/5] Tidy up SynthesizedEvent, &c. r=masayuki https://hg.mozilla.org/integration/autoland/rev/e8dc7437a627 [3/5] Remove plugin-window case from mousewheel handler r=masayuki https://hg.mozilla.org/integration/autoland/rev/bd03cf6754bb [4/5] Factor window-identification out of ProcessNativeMouseWheelMessage r=masayuki https://hg.mozilla.org/integration/autoland/rev/c2a74411687b [5/5] Disable scrollwheel-message hack via new pref r=masayuki
Blocks: 1945257
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: