Closed Bug 1832168 Opened 1 year ago Closed 1 year ago

Cleanup: remove NS_NATIVE_TMP_WINDOW

Categories

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

Desktop
Windows
task

Tracking

()

RESOLVED FIXED
115 Branch
Tracking Status
firefox115 --- fixed

People

(Reporter: rkraesig, Assigned: rkraesig)

Details

Attachments

(3 files)

GetNativeData(NS_NATIVE_TMP_WINDOW), unlike any other argument to GetNativeData, creates a resource (which it returns as a void *) and expects its callers to know that they need to destroy it, and how. At present, they do, but this is still something of a footgun.

We should couple and encapsulate the creation and destruction of this resource, and also take the opportunity to clean up some of the code adjacent thereto.

Simplify GetHWNDForDOMWindow significantly:

  1. Remove a 21-year-old code path [*] apparently intended to handle the
    case of an embedded Gecko window.

    We can safely infer that this code path has been unused for at least
    the last 13 years, when the patchset for bug 588735 introduced an
    unconditional ::DestroyWindow of this function's return value.
    (This would have been the embedded window in question, if this code
    path had ever been taken.)

  2. Reduce remaining code to convert an mozIDOMWindowProxy to an
    nsIWidget via the presumably-better-tested mechanism used by the
    color picker and file picker.

[*] Note that this code was moved in 2017 in a way that prevents
Searchfox from following it back. For archaeological purposes, a link to
its position at that time follows:

https://searchfox.org/mozilla-central/rev/bcd8f8c970f88a51744e70d19987d76309eb2b02/toolkit/components/printingui/win/nsPrintingPromptService.cpp

Rather than having nsWindow::GetNativeData() sometimes (argument-
dependently) create a new resource and requiring its various callers to
destroy that resource, consolidate its creation and destruction into a
single external class.

No functional changes.

Depends on D177566

Remove nsIWidget::SetNativeData() and all implementations thereof, as
none of them have had any functionality or use since bug 1338172.

No functional changes.

Depends on D177567

Pushed by rkraesig@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/230b1c5897a9 [1/3] Remove print dialog's handling of embedded Gecko windows r=emilio https://hg.mozilla.org/integration/autoland/rev/56533b2afae5 [2/3] Consolidate temporary-window responsibilities r=emilio https://hg.mozilla.org/integration/autoland/rev/23902d3b49d4 [3/3] Remove nsIWidget::SetNativeData() r=emilio,geckoview-reviewers,m_kato
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 115 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: