Closed Bug 1293019 Opened 4 years ago Closed 4 years ago

resource://devtools/ is not registered via Firefox -app (breaks remote debugging)

Categories

(DevTools :: General, defect, major)

50 Branch
defect
Not set
major

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1244163

People

(Reporter: WeirdAl, Unassigned)

Details

[Tracking Requested - why for this release]:
Remote Debugging Server, and thus the developer tools suite, is broken for XULRunner apps and probably Thunderbird, when run via Firefox -app.

https://dxr.mozilla.org/comm-aurora/source/mail/components/devtools/modules/RemoteDebuggerServer.jsm says (lines 14-21)

var DebuggerServer = (function() {
  try {
    var { require } = Components.utils.import("resource://devtools/shared/Loader.jsm", {});
    return require("devtools/server/main").DebuggerServer;
  } catch (e) {}

  return null;
})();

But resource://devtools/ isn't registered in Firefox when running a XULRunner application.  It's completely inaccessible, and that lovely empty catch block with no comments doesn't help.  Later, in the same file, the Remote Debugging Server breaks on the last line of the file:

DebuggerServer.RemoteDebuggerServer = RemoteDebuggerServer;

We have a similar problem on the ESR-45 branches for Firefox and Thunderbird:
1470556617380	addons.xpi	WARN	Exception running bootstrap method startup on remote-debugger@mozilla.org: ReferenceError: DebuggerServer is not defined (resource://dbgserver/modules/RemoteDebuggerServer.jsm:209:1)
JS Stack trace: 
@RemoteDebuggerServer.jsm:209:1 < startup@resource://gre/modules/addons/XPIProvider.jsm
jar:file:///home/ajvincent/verbosio/templates-clean/dist/app/extensions/remote-debugger@bootstrap.js:17:3
this.XPIProvider.callBootstrapMethod@XPIProvider.jsm:4655:9
this.XPIProvider.startup@XPIProvider.jsm:2726:13
callProvider@AddonManager.jsm:227:12
_startProvider@AddonManager.jsm:833:5
AddonManagerInternal.startup@AddonManager.jsm:1016:9 < this.AddonManagerPrivate.startup@AddonManager.jsm:2782:5 < amManager.prototype.observe@addonManager.js:58:7

This bug is to request Firefox to expose devtools to -app runners.  I depend on this capability for both my personal project, and it blocks our use of the devtools at work.
For what it's worth, I spent my whole Saturday trying to get Remote Debugging working.  I started by trying to repackage the Thunderbird code in my XULRunner app directly, instead of as an addon because of the requirement that Firefox addons be signed.  I'm not sure if that's required for XULRunner apps or not, but I figured I wouldn't take chances on that.  Then I hit this bug, and eventually traced it to resource://devtools/ being unavailable.  I tried a few different approaches to force loading it in the XULRunner app (*.manifest files, Components.manager.autoRegister, resProtocolHandler.setSubstitution(...)), but none of those work.  It has to be done in the Firefox code.
Yes, this is unfortunately a known issue at the moment.  I am not sure that there is clear way to fix it at this time.

Anyway, let's make this a dupe of the earlier bug.
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1244163
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.