Closed Bug 1540612 Opened 7 years ago Closed 4 years ago

Keyboard shortcuts to open devtools don't work

Categories

(DevTools :: Framework, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: nchevobbe, Unassigned)

Details

Steps to reproduce

  1. Hit Cmd + Alt + I to open DevTools

Expected results

DevTools open

Actual results

Nothing happens, and I see the following message in the browser console:

Exception while trigerring key [object Object]: Protocol error (noTab): Unable to find tab with tabId '1'
undefined 3 DevToolsStartup.jsm:609:15
    onKey resource:///modules/DevToolsStartup.jsm:609

Error originates from devtools/startup/DevToolsStartup.jsm#609

I'm running mozregression to check where the regression comes from

Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED

and now I can't reproduce anymore 🤔

Summary: Keyboard shortcut top open devtools don't work → Keyboard shortcuts to open devtools don't work

So this happened to me today again.
I don't have the root cause, but I spotted a possible issue.

In TargetFactory.forTab(devtools/client/framework/target.js#18-43), we have a cache of the targets:

  forTab: async function(tab) {
    let target = targets.get(tab);
    if (target) {
      return target;
    }
    const promise = this.createTargetForTab(tab);
    // Immediately set the target's promise in cache to prevent race
    targets.set(tab, promise);
    target = await promise;
    // Then replace the promise with the target object
    targets.set(tab, target);
    target.attachTab(tab);
    target.once("close", () => {
      targets.delete(tab);
    });
    return target;
  }

So here, if promise, created by createTargetForTab rejects (which seems to happen in devtools/client/framework/target.js#87, which calls BrowserTabList.prototype.getTab and can return a rejected promise if the tab isn't found devtools/server/actors/webbrowser.js#354-357), forTab will always return the rejected promise.

So, the broader fix would be to fix the race which makes us not find the tab first (but I agree it could be hard). A secondary fix would be to remove the promise from targets in forTab if the promise rejects. Because then we'll reach for BrowserTabList.prototype.getTab, and this time we might be ready (I tested this while paused in forTab, and I was then able to open the webconsole).

Alex, would you have an idea on the root cause (not finding the tab)?

Flags: needinfo?(poirot.alex)
Assignee: nchevobbe → nobody
Status: ASSIGNED → NEW

Downgrading to P2 since we haven't had other reports of this issue (to my knowledge) and no one is actively working on this issue.

Priority: P1 → P2

This code changed quite a bit and may have been fixed?

Flags: needinfo?(poirot.alex)

Ctrl + Shift + I works for me on Windows
Option + Cmd + I works for me on Mac

Nicolas, time to close this one?

Flags: needinfo?(nchevobbe)

yeah, let's close as INCOMPLETE as we couldn't reproduce easily and the code changed a lot anyway

Status: NEW → RESOLVED
Closed: 4 years ago
Flags: needinfo?(nchevobbe)
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.