Closed Bug 1529205 Opened 5 years ago Closed 5 years ago

DateTimePickerParent shouldn't rely on gBrowser and gBrowser.popupAnchor

Categories

(Core :: DOM: Core & HTML, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla69
Tracking Status
thunderbird_esr68 --- fixed
firefox-esr68 --- wontfix
firefox68 --- wontfix
firefox69 --- fixed

People

(Reporter: mkmelin, Assigned: darktrojan)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

This is part of bug 1527615.

showPicker(aBrowser, aData) {
let rect = aData.rect;
let type = aData.type;
let detail = aData.detail;

this._anchor = aBrowser.ownerGlobal.gBrowser.popupAnchor;

...

While it may be possible to work around this for Thunderbird somehow(?), it still looks like a bug. The pickers should just work in any document.
Code for the pickers is correctly in toolkit/ and should not rely on internal features from browser/base/content/tabbrowser.js

:hsinyi is making triage decisions on this component so I'm unsetting priority on this (see https://mozilla.github.io/bug-handling/triage-bugzilla).

If this is related to the XUL removal work, you may want to ask :bgrimsted about it.

Priority: P3 → --

Thanks Emma.
Yes, I think it'd be great to have Brian chime in on de-xul part for this feature.

Flags: needinfo?(bgrinstead)

(In reply to Magnus Melin [:mkmelin] from comment #0)

While it may be possible to work around this for Thunderbird somehow(?)

Worst case, I could imagine TB stubbing out a gBrowser object with popupAnchor onto whichever window needs the popup. but I agree it wouldn't be ideal.

The pickers should just work in any document.
Code for the pickers is correctly in toolkit/ and should not rely on internal features from browser/base/content/tabbrowser.js

Sure, making this work without directly accessing gBrowser seems reasonable if it's not too much work, and would also allow access for non-browser-window top level windows in Firefox (although I'm not aware of any needs for that). I'm not sure if there's a typical way to handle this - perhaps just check for gBrowser existence and if it's not there then provide some default popup anchor node? Here are some other references to gBrowser in toolkit: https://searchfox.org/mozilla-central/search?q=gBrowser&path=toolkit

Anyway, this line goes back to Bug 1283384 so I'll forward this to Mike to get an opinion on if this is a change we'd want to take. If so, then perhaps you could make the patch, Magnus?

Flags: needinfo?(bgrinstead) → needinfo?(mconley)

(In reply to Brian Grinstead [:bgrins] from comment #3)

Here are some other references to gBrowser
in toolkit: https://searchfox.org/mozilla-central/search?q=gBrowser&path=toolkit

There are some, but they are usually protected by a check for existence. (+ a few other cases likely broken)

Anyway, this line goes back to Bug 1283384 so I'll forward this to Mike to
get an opinion on if this is a change we'd want to take. If so, then perhaps
you could make the patch, Magnus?

Sure, I'd appreciate if someone has ideas on how to fix it best though. It looks fairly involved, but then again, perhaps there's a simple fix.

I think I've seen a variety of different techniques for solving problems like this, including:

  1. Window-global functions like getBrowser() that XUL applications can implement to expose gBrowser-like things
  2. Fallbacks after attempting to access gBrowser, as described in comment 3 and comment 4.

Another thing we might try is to expose a function on nsBrowserAccess - an nsBrowserAccess instance is something that we set on the window global for both Firefox and Thunderbird... we could have nsBrowserAccess expose a popupAnchor getter.

That'd involve adding some XPIDL though. I can't say I feel too strongly either way, to be honest.

Flags: needinfo?(mconley)
Priority: -- → P3
Assignee: nobody → geoff
Status: NEW → ASSIGNED
Attachment #9072940 - Attachment description: Bug 1529205 - Remove DateTimePickerParent's dependency on gBrowser → Bug 1529205 - Remove DateTimePickerParent's dependency on gBrowser; r=mconley
Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/integration/autoland/rev/f1949f8e9204
Remove DateTimePickerParent's dependency on gBrowser; r=mconley
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla69

Comment on attachment 9072940 [details]
Bug 1529205 - Remove DateTimePickerParent's dependency on gBrowser; r=mconley

Beta/Release Uplift Approval Request

  • User impact if declined: <input type="date"> will continue to be unusable in Thunderbird 68.
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Very little depends on this (date picker pop-ups and form validation pop-ups), and I've checked that it all still works.
  • String changes made/needed:
Attachment #9072940 - Flags: approval-mozilla-beta?

I think it's too late for this in 68, sorry.

Attachment #9072940 - Flags: approval-mozilla-beta? → approval-mozilla-beta-

I'll take it on a Thunderbird branch then.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: