Bug 1900542

Summary: Under Wayland, screen sharing window selector dropdown is empty
Product: [Fedora] Fedora Reporter: Casey <casey.jao>
Component: firefoxAssignee: Martin Stransky <stransky>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 33CC: berend.de.schouwer, c.riess.dev, elxreno, erack, gecko-bugs-nobody, jan.public, jgrulich, jhorak, kai-engert-fedora, pjasicek, rhughes, rstrode, sandmann, stransky, victor
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: firefox-83.0-8.fc33 firefox-83.0-8.fc32 firefox-105.0.2-1.fc38 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-11-27 01:23:07 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Screen sharing under Fedora Workstation 33
none
Screen sharing under Fedora Silverblue 33 none

Description Casey 2020-11-23 10:44:29 UTC
Created attachment 1732433 [details]
Screen sharing under Fedora Workstation 33

Description of problem:

Since upgrading to Firefox 83 on a fully up-to-date Fedora Workstation 33, attempting to share my screen in a Wayland session brings up an empty window selection menu as shown in the first attachment. The problem persists in a fresh Firefox profile.

Mysteriously, one of my other machines running Silverblue (Version 33.20201119) can share its screen under Wayland just fine. As shown in the second screenshot, the screen sharing window selector contains the item "Use operating system settings", which activates a system dialog allowing me to share either the whole screen or a single window.

What could explain this difference in behaviour?


Version-Release number of selected component (if applicable):

firefox-83.0-3.fc33.x86_64
xdg-desktop-portal-1.8.0-1.fc33.x86_64
xdg-deskop-portal-gtk-1.8.0-1.fc33.x86_64

How reproducible: 
Every time.


Steps to Reproduce:
1. Start Firefox in a fresh profile using firefox -P
2. Initiate a video conferencing session on your favourite platform such as Google Meet or BlackBoard Collaborate
3. Attempt to share your screen.

Actual results:
Window selection drop-down should show "use operating system settings"

Expected results:
Drop-down is empty.

Additional info:

Comment 1 Casey 2020-11-23 10:45:07 UTC
Created attachment 1732434 [details]
Screen sharing under Fedora Silverblue 33

Comment 2 Victor Rehorst 2020-11-23 18:45:02 UTC
I am getting the exact same behaviour as well, with the exact same steps to reproduce. It started happening to me on Fedora 32 after upgrading:

firefox-[x11,wayland] from 82.0.3-1 to 83.0-3 
pipewire, pipewire-libs, pipewire-gstreamer from 0.3.13-2 to 0.3.15-2

Testing using Google Meet, or the Mozilla GUM test page here: https://mozilla.github.io/webrtc-landing/gum_test.html

I have a dual monitor setup, if that makes a difference.

I can collect additional info or perform testing if anyone would like me to.

Comment 3 Casey 2020-11-23 20:11:46 UTC
The problem seems related to the patch https://src.fedoraproject.org/rpms/firefox/c/d6756537dd8cf4d9816dc63ada66ea026e0fd128?branch=master, specifically pw6.patch. What is the easiest way to debug this problem? Is it possible to do so without compiling all of firefox?

Comment 4 Martin Stransky 2020-11-23 20:59:18 UTC
(In reply to Casey from comment #3)
> The problem seems related to the patch
> https://src.fedoraproject.org/rpms/firefox/c/
> d6756537dd8cf4d9816dc63ada66ea026e0fd128?branch=master, specifically
> pw6.patch. What is the easiest way to debug this problem? Is it possible to
> do so without compiling all of firefox?

Yes, you can use browser toolbox to debug Firefox.

1) Go to Tools -> WebDeveloper -> Toogle Tools
2) Pres F1 to view Settings, check "Enable remote debugging"
3) Go to Tools -> WebDeveloper -> Browser Toolbox, enable remote debugging. You'll get a new window ("Remote"), open it by the Firefox one.
4) Browse to https://mozilla.github.io/webrtc-landing/gum_test.html , click "screen capture", you'll get the permission popup.
5) Switch to "Remote" debugger window, click to left most tool, it looks like an arrow in rectangle and claims "Pick an element ....", select popup menu from the permission popup.
6) You'll get html code in inspector. Look for events attached to the popup, looks for the one which points to WebRTCParent.jsm, line ~700-800. You may be able to open that file inside inspector and put breakpoint at the "if (name == PIPEWIRE_PORTAL_NAME && device.id == PIPEWIRE_ID) {" line or around.
7) Switch back to Firefox and open the popup, Firefox should stop at the breakpoint and you can debug it.

Comment 5 Martin Stransky 2020-11-23 21:01:28 UTC
BTW. Do you have anything related at Browser Console (Tools -> WebDeveloper -> Browser Console) or Web Console?

Comment 6 Victor Rehorst 2020-11-23 22:15:08 UTC
Thanks, I traced through with the instructions and found where an exception is being thrown.  This is the backtrace:

16:56:55.206 [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIStringBundle.GetStringFromName]"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame :: chrome://browser/content/browser.js :: getString :: line 648"  data: no] browser.js:648:27
    getString chrome://browser/content/browser.js:648
    listScreenShareDevices resource:///actors/WebRTCParent.jsm:792
    eventCallback resource:///actors/WebRTCParent.jsm:983
    PopupNotifications_fireCallback resource://gre/modules/PopupNotifications.jsm:1678
    notificationsToShow resource://gre/modules/PopupNotifications.jsm:1198
    filter self-hosted:238
    PopupNotifications_showPanel resource://gre/modules/PopupNotifications.jsm:1193
    PopupNotifications_update resource://gre/modules/PopupNotifications.jsm:1407
    PopupNotifications_show resource://gre/modules/PopupNotifications.jsm:609
    prompt resource:///actors/WebRTCParent.jsm:1220
    receiveMessage resource:///actors/WebRTCParent.jsm:133

It looks like the stringBundle.getString(sawcStringId) is throwing the exception at line 792 trying to get the string for the  "getUserMedia.sharePipeWirePortal.label" key.

My default Firefox language is set to English (Canada) with English (United States) as an alternative, according to Firefox's preferences.  In case that's a clue.

(In reply to Martin Stransky from comment #4)
> (In reply to Casey from comment #3)
> > The problem seems related to the patch
> > https://src.fedoraproject.org/rpms/firefox/c/
> > d6756537dd8cf4d9816dc63ada66ea026e0fd128?branch=master, specifically
> > pw6.patch. What is the easiest way to debug this problem? Is it possible to
> > do so without compiling all of firefox?
> 
> Yes, you can use browser toolbox to debug Firefox.
> 
> 1) Go to Tools -> WebDeveloper -> Toogle Tools
> 2) Pres F1 to view Settings, check "Enable remote debugging"
> 3) Go to Tools -> WebDeveloper -> Browser Toolbox, enable remote debugging.
> You'll get a new window ("Remote"), open it by the Firefox one.
> 4) Browse to https://mozilla.github.io/webrtc-landing/gum_test.html , click
> "screen capture", you'll get the permission popup.
> 5) Switch to "Remote" debugger window, click to left most tool, it looks
> like an arrow in rectangle and claims "Pick an element ....", select popup
> menu from the permission popup.
> 6) You'll get html code in inspector. Look for events attached to the popup,
> looks for the one which points to WebRTCParent.jsm, line ~700-800. You may
> be able to open that file inside inspector and put breakpoint at the "if
> (name == PIPEWIRE_PORTAL_NAME && device.id == PIPEWIRE_ID) {" line or around.
> 7) Switch back to Firefox and open the popup, Firefox should stop at the
> breakpoint and you can debug it.

Comment 7 Victor Rehorst 2020-11-23 22:18:30 UTC
After noticing that the patch linked in comment #3 were in a file under the en-US language, I changed by default Firefox language to English (United States).

Amazingly, this change made the problem go away.  Now I see "Use operating system settings" in the screen sharing drop-down and everything works perfectly.

(In reply to Victor Rehorst from comment #6)
> 
> It looks like the stringBundle.getString(sawcStringId) is throwing the
> exception at line 792 trying to get the string for the 
> "getUserMedia.sharePipeWirePortal.label" key.
> 
> My default Firefox language is set to English (Canada) with English (United
> States) as an alternative, according to Firefox's preferences.  In case
> that's a clue.
>

Comment 8 Casey 2020-11-24 02:27:33 UTC
I confirm Victor's observations. My Workstation's Firefox was set to English (Canada) while my Silverblue's Firefox was set to English (United States), and indeed changing the language to English (United States) restores "Use operating system settings" to the screen sharing drop-down.

Comment 9 Martin Stransky 2020-11-24 05:59:36 UTC
Awesome, Thanks! I'll look at it ASAP.

Comment 10 c.riess.dev 2020-11-24 16:25:19 UTC
I can also confirm for a firefox browser in fedora 33 running on lang de_DE switched to en_US setting inside the firefox preferences is a work around.

Comment 11 Martin Stransky 2020-11-25 09:40:29 UTC
Fix added to firefox-83.0-8.*

Comment 12 Fedora Update System 2020-11-25 15:27:17 UTC
FEDORA-2020-4df0abb379 has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2020-4df0abb379

Comment 13 Fedora Update System 2020-11-27 01:23:07 UTC
FEDORA-2020-4df0abb379 has been pushed to the Fedora 33 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 14 Fedora Update System 2020-11-27 02:18:29 UTC
FEDORA-2020-51689d8ce4 has been pushed to the Fedora 32 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-51689d8ce4`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-51689d8ce4

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 15 Fedora Update System 2020-11-29 01:14:15 UTC
FEDORA-2020-51689d8ce4 has been pushed to the Fedora 32 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 16 Fedora Update System 2022-10-05 12:46:55 UTC
FEDORA-2022-f0988ea008 has been submitted as an update to Fedora 38. https://bodhi.fedoraproject.org/updates/FEDORA-2022-f0988ea008

Comment 17 Fedora Update System 2022-10-05 12:56:53 UTC
FEDORA-2022-f0988ea008 has been pushed to the Fedora 38 stable repository.
If problem still persists, please make note of it in this bug report.