Open Bug 1908858 Opened 1 year ago Updated 1 year ago

can't install any extension. Permission dialog fails on WSL Ubuntu (because browser window is never the focus manager's `activeWindow`)

Categories

(Core :: DOM: UI Events & Focus Handling, defect)

Firefox 128
defect

Tracking

()

People

(Reporter: parser75, Unassigned)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:74.0) Gecko/20100101 Firefox/74.0

Steps to reproduce:

Symptom: find any extension which is good to install, click "add to firefox". A pop up showing the permissions and cancel/add is displayed, but both buttons cannot be pressed, the dialog won't disappear unless the page is reloaded. The same happens after RMB on "add to firefox" and subsequent Addons|Install addon from file on the downloaded xpi file.
openSuse 15.1 with KDE3.5
I cleared my ~/.mozilla and ¨/.cache/mozilla, created a new profile.. no difference to my old profile. I think the issue is much older (anything in the Leap range of versions), but previously I didn't care for it.

Actual results:

In the browser console any click on the buttons returns this error:

Sending message that cannot be cloned. Are you trying to send an XPCOM object? addonManager.js:262:13
PopupNotifications._onButtonEvent: Button click happened before the window was focused
Sending message that cannot be cloned. Are you trying to send an XPCOM object? addonManager.js:262:13
PopupNotifications._onButtonEvent: Button click happened before the window was focused

Trying to click into the popup window to make it focused does not work. All attempts to use keyboard shortcuts (the underlined characters, tab, esc etc.) don't do anything.

Expected results:

Obviously, the buttons should react.
I found a workaround:
My KDE window settings were set to "Focus strictly under mouse". Changing it to "Click to Focus" solves this error (but is not an option to work with). Fortunately, "Focus under Mouse" still seems to do the job (but leaves me clueless which differences to expect outside FF)

This bug is back in version 128. Observed on: wsl ubuntu firefox

This looks like it could be a bug in our PopupNotifications security delay code. If the buttons don't work and this error is logged It's unlikely to be directly related to webextension code.
I don't think this is a sec bug. I'll try to reproduce it.

Group: firefox-core-security
Component: Frontend → PopupNotifications and Notification Bars
Product: WebExtensions → Toolkit
Summary: can't install any extension. Permission dialog fails → can't install any extension. Permission dialog fails on WSL Ubuntu

I had installed firefox on wsl using this guide:
https://support.mozilla.org/en-US/kb/install-firefox-linux#w_install-firefox-deb-package-for-debian-based-distributions

And there you can reproduce this problem immediately.

And when hovering the mouse over the cancel and add buttons, they change colors. Only clicking on them does not work.

I couldn't reproduce this on Ubuntu directly and WSL does not work in my Windows 11 VM. Gijs, do you happen to have a WSL installation already and could try to reproduce?

Flags: needinfo?(gijskruitbosch+bugs)

If you tell me where to look for the log and in the log what message to look for, I can help you.

(In reply to parser75 from comment #2)

I had installed firefox on wsl using this guide:
https://support.mozilla.org/en-US/kb/install-firefox-linux#w_install-firefox-deb-package-for-debian-based-distributions

And there you can reproduce this problem immediately.

I just tried this on WSL on a bare-metal Windows installation. I set it up with the instructions provided and I can interact with permission prompts including the addon installation one just fine.

I'm not sure if we support running Firefox in WSL. I'm curious why you don't run it natively?

Flags: needinfo?(gijskruitbosch+bugs) → needinfo?(parser75)
Severity: -- → S3

Because in the company Win11 laptop Firefox is blocked.

And the only way to have it is in WSL.

Flags: needinfo?(parser75)

What WSL do you have, i.e. what does wsl -l -v say? If it says version 1, you should try version 2 where compatibility is much better.

Flags: needinfo?(parser75)

wsl -l -v

NAME STATE VERSION

  • Ubuntu-24.04 Running 2
Flags: needinfo?(parser75)

Just to double check: it seems you created this bug by cloning bug 1625798, but does the original report exactly fit your case? i.e. you also see the same error messages on the browser console?

(And it seems bug 1625798 is duped to bug 1399937 which is still open.)

Flags: needinfo?(parser75)

I see following error message in the console when trying to click one of the buttons:
PopupNotifications._onButtonEvent: Button click happened before the window was focused / active

Yes, I cloned this ticket from 1625798, as the the described steps to reproduce do match exactly.

Flags: needinfo?(parser75)

Okay, I have WSL Ubuntu and I can repro this. Actually it seems the exact issue I had while debugging geolocation on WSL.

Can you try the below:

  1. Open https://mylocation.org/
  2. Click "Browser Geolocation"
  3. Click "Start Test"
  4. Try clicking either "Block"/"Allow" on the permission prompt
  5. See whether the same PopupNotifications._onButtonEvent: Button click happened before the window was focused / active happens

If yes I think I'll rename this to popup notification focus issue.

(This doesn't happen on Hyper-V Ubuntu)

Flags: needinfo?(parser75)

I did all 5 steps, and yes the same message came when clicking either Block/Allow:

PopupNotifications._onButtonEvent: Button click happened before the window was focused / active

And the click is not accepted.

Flags: needinfo?(parser75)

(In reply to Kagami Rosylight [:saschanaz] (they/them) from comment #12)

  1. Try clicking either "Block"/"Allow" on the permission prompt

At this point, in the browser console, if you log (from https://searchfox.org/mozilla-central/rev/de46cd99a7d1634058b511a3f546a970763e5048/toolkit/modules/PopupNotifications.sys.mjs#1939-1941 )

Services.focus.activeWindow == window

and

document.querySelector("panel[panelopen] popupnotification").matches(":-moz-window-inactive")

what do those print?

Flags: needinfo?(krosylight)

(note that you'd likely need to print them from a timeout/interval to make sure the window + panel are focused, not the browser console... but it's confusing that something thinks the window/panel doesn't have focus. That seems likely to be a widget problem of sorts.)

Content-Security-Policy: The page’s settings blocked an inline style (style-src-attr) from being applied because it violates the following directive: “default-src chrome: resource:” panel.js:62:23
Content-Security-Policy: The page’s settings blocked an inline style (style-src-attr) from being applied because it violates the following directive: “default-src chrome: resource:” 2 customElements.js:499:25
Content-Security-Policy: The page’s settings blocked an inline style (style-src-attr) from being applied because it violates the following directive: “default-src chrome: resource:” panel.js:62:23
Content-Security-Policy: The page’s settings blocked an inline style (style-src-attr) from being applied because it violates the following directive: “default-src chrome: resource:” 2 customElements.js:499:25
Content-Security-Policy: The page’s settings blocked an inline style (style-src-attr) from being applied because it violates the following directive: “default-src chrome: resource:” panel.js:62:23
PopupNotifications._onButtonEvent: Button click happened before the window was focused / active

Sorry for the triple message. I don't know how to delete one. Also I didn't find how to attach a little screenshot.

(In reply to parser75 from comment #19)

Sorry for the triple message. I don't know how to delete one. Also I didn't find how to attach a little screenshot.

I've hidden the duplicates. You can attach a screenshot by clicking "Attach New File" in the "Attachments" section at the top of the bug.

(In reply to :Gijs (he/him) from comment #14)

I'm so happy that devtools has logging feature nowadays so I don't have to worry about focus change 🙂

Services.focus.activeWindow is null, this.window is ChromeWindow of chrome://browser/content/browser.xhtml, document.querySelector("panel[panelopen] popupnotification").matches(":-moz-window-inactive") is false.

Flags: needinfo?(krosylight)

setTimeout also reports null when I repeatedly click the popup notification, so I think it just never becomes activeWindow at all?

WSL also shows a weird issue that if you maximize the Browser Toolbox while keeping the Firefox window non-maximized, the mouse cursor sees-through the Firefox window (i.e. any mouse activity goes to Browser Toolbox even if the Firefox window is the most foreground window).

Edit: it doesn't have to be Browser Toolbox, maximize any WSL window and it causes the same bug. It doesn't even have to be Firefox, it can be Chrome. But Chrome itself doesn't have this issue.

Could this be anything to do with bug 1869891 and bug 1894328?

Flags: needinfo?(emilio)

I was expecting that the

default-src chrome

was not matching the moz-window.

But just a guess.

Unlikely, popups are very different beasts from notification windows.

Flags: needinfo?(emilio)

This can't be fixed in the notifications code; if activeWindow is wrong other things will also not work well.

Status: UNCONFIRMED → NEW
Component: PopupNotifications and Notification Bars → DOM: UI Events & Focus Handling
Ever confirmed: true
Product: Toolkit → Core
Summary: can't install any extension. Permission dialog fails on WSL Ubuntu → can't install any extension. Permission dialog fails on WSL Ubuntu (because browser window is never the focus manager's `activeWindow`)

(this might need to live and be fixed in gtk widget instead, but I don't know enough about focus / Linux widget / WSL to determine if that's the case or not)

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

Attachment

General

Creator:
Created:
Updated:
Size: