test_taskbarTabs_iconSaving.js writes real desktop entries to ~/.local/share/applications on Linux
Categories
(Firefox :: Web Apps, defect, P3)
Tracking
()
People
(Reporter: mferreiro, Assigned: mferreiro, Mentored)
References
Details
(Keywords: good-first-bug, Whiteboard: [FIDE-engagement])
Attachments
(1 external file)
On Linux, every run of browser/components/taskbartabs/test/xpcshell/test_taskbarTabs_iconSaving.js writes a real desktop entry (a file named like xpcshell.webapp-<uuid>.desktop, with Name=Test) to the developer's ~/.local/share/applications/, and never removes it.
This happens because the test calls the real TaskbarTabsPin.pinTaskbarTab, and only mocks the Windows shell methods (createShortcut, pinShortcutToTaskbar, ...) through kMockNativeShellService. On Linux, pinTaskbarTab reaches ShellService.createLinuxDesktopEntry, which writes the file to disk. The test only cares about the saved icon, not about the desktop entry.
The fix is to also stub the Linux desktop entry methods, the same way test_taskbarTabs_pinLinux.js already does:
sinon.stub(ShellService, "createLinuxDesktopEntry").resolves();
sinon.stub(ShellService, "deleteLinuxDesktopEntry").resolves();
(next to the existing sinon.stub(ShellService, "shellService") call; sinon.restore() in the existing cleanup function already undoes them).
Link to the code:
https://searchfox.org/firefox-main/rev/cf103b9362d64aa14c7adc0c0e4b9469ccbf6caa/browser/components/taskbartabs/test/xpcshell/test_taskbarTabs_iconSaving.js#35
How test_taskbarTabs_pinLinux.js stubs it:
https://searchfox.org/firefox-main/rev/cf103b9362d64aa14c7adc0c0e4b9469ccbf6caa/browser/components/taskbartabs/test/xpcshell/test_taskbarTabs_pinLinux.js#24
To verify the fix (on Linux):
ls ~/.local/share/applications | grep '^xpcshell'
./mach xpcshell-test browser/components/taskbartabs/test/xpcshell/test_taskbarTabs_iconSaving.js
ls ~/.local/share/applications | grep '^xpcshell'
Before the fix a new xpcshell.webapp-<uuid>.desktop appears after the test run; after the fix no new file appears and the test still passes. You can delete any leftover xpcshell.webapp-*.desktop files from previous runs.
See also bug 2058709, which has a similar symptom (a test writing to the real home directory) in test_linuxDesktopEntry.js, but a different cause.
Tutorial to contribute:
https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html
https://firefox-source-docs.mozilla.org/contributing/stack_quickref.html
| Assignee | ||
Updated•14 days ago
|
Updated•14 days ago
|
| Assignee | ||
Updated•14 days ago
|
| Assignee | ||
Updated•14 days ago
|
| Assignee | ||
Comment 1•14 days ago
|
||
The test called the real pinTaskbarTab, which on Linux wrote a desktop entry to ~/.local/share/applications and never removed it.
Description
•