Closed Bug 1342708 Opened 7 years ago Closed 7 years ago

webextension browser frames missing autocompletepopup (datalist, etc)

Categories

(WebExtensions :: Frontend, defect, P2)

defect

Tracking

(firefox54 wontfix, firefox55 fixed)

RESOLVED FIXED
mozilla55
Tracking Status
firefox54 --- wontfix
firefox55 --- fixed
webextensions +

People

(Reporter: callahad, Assigned: mixedpuppy)

References

(Blocks 2 open bugs)

Details

(Keywords: DevAdvocacy, Whiteboard: [parity-chrome], triaged)

Attachments

(2 files)

In browser_action popups, input elements with associated datalists do not provide automatic completion. See screenshot.

STR:

1. Clone and check out revision 6031ac56f7a462f3a35fe412e49e45dcfa88b329 of https://github.com/callahad/quick-accept-language-switcher
2. Load it as a temporary / unpacked add-on
3. Click the add-on's icon and type "en"

What should happen:

- Completions of "en", "en-au", "en-ca", etc. should appear

What actually happens:

- No completions are shown

The exact same code, run in web content, works as expected: https://jsfiddle.net/5f0rq05r/
Priority: -- → P2
Whiteboard: [parity-chrome] → [parity-chrome], triaged
I looked into this, to see if it might be similar to bug 1269421, just a matter of wiring the right attribute on the browser ("autocompletepopup" I believe), but that doesn't seem enough.

This might be either a platform limitation (nested popups), or some other part of wiring missing on our end, but I'm not familiar enough to know where to look next. Still, I'd be happy to if someone can point me in a direction.
webextensions: --- → ?
Assignee: nobody → mixedpuppy
webextensions: ? → +
This should be fixed by setting the context attribute on the browser to contentAreaContextMenu.

https://dxr.mozilla.org/mozilla-central/source/browser/components/extensions/ExtensionPopups.jsm#227

We may also have to make sure content.js is loaded.
BTW, we had this issue in socialapi, bug 805227, which was fixed in bug 782850, the basics of which is setting the context attribute.
eh, I was wrong.  context does fix of course the context menu, which fixes using other things (spell check), but not the datalist which as zombie pointed out is autocompletepopup.
AutoCompletePopup.jsm purposely ignores any non-tabbrowser browser.

https://dxr.mozilla.org/mozilla-central/source/toolkit/components/satchel/AutoCompletePopup.jsm#148

Removing that code makes this work in the sidebar, however it still is not working in popups (e.g. browserAction).  This also requires loading the content.js frame script, which is happening for the popups in bug 1299371.  content.js initializes AutoCompletePopup.jsm.
Depends on: 1299371
Comment on attachment 8853579 [details]
Bug 1342708 fix datalist failure in webext popups,

The changes in browser-content.js are necessary only for browserAction and seem necessary due to the preload mechanism.  formfill is connected during preload, but then disconnected prior to popup opening.  We do not receive DOMContentLoaded during the browserAction popup opening.
Attachment #8853579 - Attachment description: Bug 1342708 WIP exploring datalist failure in webext popups → Bug 1342708 fix autocompletepopup in sidebar and browseraction
Attachment #8853579 - Flags: feedback?(kmaglione+bmo)
Comment on attachment 8853579 [details]
Bug 1342708 fix datalist failure in webext popups,

https://reviewboard.mozilla.org/r/125640/#review133518

::: toolkit/components/satchel/AutoCompletePopup.jsm:149
(Diff revision 2)
>        return;
>      }
>  
>      let window = browser.ownerGlobal;
> -    let tabbrowser = window.gBrowser;
> -    if (Services.focus.activeWindow != window ||
> +    // Also check parent in case this is a sidebar.
> +    if (![window, window.parent].includes(Services.focus.activeWindow)) {

Just check `window.top`.

::: toolkit/content/browser-content.js:1459
(Diff revision 2)
>      "FormAutoComplete:RequestFocus",
>    ],
>  
>    init() {
>      addEventListener("unload", this);
> +    if (!content.document.readyState == "complete") {

`readyState != "complete"`. `false` will never equal "complete".
Attachment #8853579 - Flags: feedback?(kmaglione+bmo) → feedback+
Summary: Datalist completions do not display in WebExtension popups → webextension browser frames missing autocompletepopup (datalist, etc)
Depends on: 1353060
Comment on attachment 8853579 [details]
Bug 1342708 fix datalist failure in webext popups,

https://reviewboard.mozilla.org/r/125640/#review147154
Attachment #8853579 - Flags: review?(kmaglione+bmo) → review+
Pushed by mixedpuppy@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/937da0dba852
fix datalist failure in webext popups, r=kmag
Blocks: 1369559
https://hg.mozilla.org/mozilla-central/rev/937da0dba852
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
54 RC build is released. Mark 54 won't fix.
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: