Open Bug 2098063 Opened 1 hour ago Updated 37 minutes ago

Clicking a Local Mode folder that no longer exists throws NS_ERROR_FAILURE in the settings panel

Categories

(DevTools :: General, defect)

defect

Tracking

(Not tracked)

People

(Reporter: leo, Unassigned)

References

Details

Steps to reproduce:

  1. In the DevTools settings panel, add a Local Mode mapping for a folder.
  2. Click the folder path to reveal it in the file manager.
  3. Rename or delete the folder in the file manager.
  4. Click the folder path in the settings panel again.

Expected: nothing is revealed, without an error, since the folder is gone.

Actual: the Browser Toolbox shows Uncaught NS_ERROR_FAILURE: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIFile.reveal].

This happens in both the old settings panel (toolbox-options.js) and the new one (#revealFolder in devtools-settings-local-mode.mjs, from bug 2081851). Both call reveal() without checking that the folder still exists.

The folder link handler in toolbox-options.js calls reveal() unguarded, while pathExists is only computed at render (#935-938), and since preventDefault() runs after reveal() the throw also lets the file:// href through. reveal() can fail on an existing folder too (no GIO, unsupported platform), which DownloadsCommon.sys.mjs already catches.

Fix: Call preventDefault() first and wrap reveal() in try/catch here and in #revealFolder from bug 2081851, adding a click to checkBuggyPath in browser_toolbox_options_local_mode.js; this touches the same lines as bug 2098064.

Suggested severity: S4. Clicking a stale folder path only logs an uncaught error visible in the Browser Toolbox, and re-picking the folder works around it.


If you'd like to provide feedback on this comment, please use the 👍 or 👎 reaction.
If you want to categorize your feedback you can add one of the following tags: ai-triage-{wrong-file, wrong-cause, hallucination, out-of-scope, not-a-bug, wrong-fix, shallow-fix, wrong-severity}.

Needinfo hackbot@mozilla.tld to have a patch generated for this bug, include any questions or directions as needed in your comment.

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