--jsdebugger with xpcshell is broken for some tests

RESOLVED FIXED in Firefox 46

Status

Testing
XPCShell Harness
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: Gijs, Assigned: jryans)

Tracking

Trunk
mozilla46
Points:
---

Firefox Tracking Flags

(firefox45 affected, firefox46 fixed)

Details

MozReview Requests

Submitter Diff Changes Open Issues Last Updated
Loading...
Error loading review requests:

Attachments

(1 attachment)

(Reporter)

Description

2 years ago
STR (on OSX):

1. ./mach xpcshell-test --jsdebugger toolkit/modules/tests/xpcshell/test_PermissionsUtils.js

ER:

get debugger

AR:

no debugger, following error in the console:

 0:00.56 LOG: Thread-1 INFO "Failed to initialize debugging: [Exception... "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIXPCComponents_Utils.import]"  nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)"  location: "JS frame :: /Users/gkruitbosch/dev/fx-team/testing/xpcshell/head.js :: _setupDebuggerServer :: line 386"  data: no]
_setupDebuggerServer@/Users/gkruitbosch/dev/fx-team/testing/xpcshell/head.js:386:21
_initDebugging@/Users/gkruitbosch/dev/fx-team/testing/xpcshell/head.js:436:24
_execute_test@/Users/gkruitbosch/dev/fx-team/testing/xpcshell/head.js:475:7
@-e:1:1

That line is:

  let { require } = Components.utils.import("resource://devtools/shared/Loader.jsm", {});


so I'm assuming this is what busted it... Ryan, any chance you can look into this?
Flags: needinfo?(jryans)
For xpcshell to access the resource://devtools files, it needs to have the "-a" argument (for app dir) to be set to the browser subdir of the install path.

It's possible to make this happen by setting:

  firefox-appdir = browser

in the xpcshell.ini file.  

This can also change the functionality of the test directory by altering what modules are loaded by the test environments in other ways as well, so it can't very easily be enabled everywhere unfortunately.

I investigated changing this globally, so that it would not need to be set in each xpcshell.ini in bug 1215378, but I ended up with too many test failures to sort through.

Editing the xpcshell.ini for the directory you mentioned appears to resolve the issue.
Flags: needinfo?(jryans)
(Reporter)

Comment 2

2 years ago
(In reply to J. Ryan Stinnett [:jryans] (use ni?) (at work week until Dec. 14) from comment #1)
> For xpcshell to access the resource://devtools files, it needs to have the
> "-a" argument (for app dir) to be set to the browser subdir of the install
> path.
> 
> It's possible to make this happen by setting:
> 
>   firefox-appdir = browser
> 
> in the xpcshell.ini file.  
> 
> This can also change the functionality of the test directory by altering
> what modules are loaded by the test environments in other ways as well, so
> it can't very easily be enabled everywhere unfortunately.
> 
> I investigated changing this globally, so that it would not need to be set
> in each xpcshell.ini in bug 1215378, but I ended up with too many test
> failures to sort through.
> 
> Editing the xpcshell.ini for the directory you mentioned appears to resolve
> the issue.

Can we guard for this and print a nicer (and more visible) message? Right now we just continue running the test(s) without showing the debugger, which is unfortunate.
Flags: needinfo?(jryans)
(In reply to :Gijs Kruitbosch from comment #2)
> Can we guard for this and print a nicer (and more visible) message? Right
> now we just continue running the test(s) without showing the debugger, which
> is unfortunate.

Sure, I'll take a look.
Assignee: nobody → jryans
Status: NEW → ASSIGNED
Component: Developer Tools: Debugger → XPCShell Harness
Flags: needinfo?(jryans)
Product: Firefox → Testing
Created attachment 8698470 [details]
MozReview Request: Bug 1231759 - Explain DevTools appdir issue when debugging xpcshell. r=Gijs

Bug 1231759 - Explain DevTools appdir issue when debugging xpcshell. r=Gijs
Attachment #8698470 - Flags: review?(gijskruitbosch+bugs)
(Reporter)

Comment 5

2 years ago
Comment on attachment 8698470 [details]
MozReview Request: Bug 1231759 - Explain DevTools appdir issue when debugging xpcshell. r=Gijs

https://reviewboard.mozilla.org/r/28013/#review25073

Untested, but this looks great from code inspection, thanks!

::: testing/xpcshell/head.js:388
(Diff revision 1)
> +    ({ require } = Components.utils.import("resource://devtools/shared/Loader.jsm", {}));

Interesting syntax. I presume you need the extra () because JS doesn't like `try {{` for some reason?
Attachment #8698470 - Flags: review?(gijskruitbosch+bugs) → review+
https://reviewboard.mozilla.org/r/28013/#review25073

> Interesting syntax. I presume you need the extra () because JS doesn't like `try {{` for some reason?

It's destructuring when not prefixed by `let` on the same line.  The braces alone can't be distinguished from a new block.

Took me a while to learn that one. :)

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#Syntax

Comment 7

2 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/71c45c3742f4

Comment 8

2 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/71c45c3742f4
Status: ASSIGNED → RESOLVED
Last Resolved: 2 years ago
status-firefox46: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
You need to log in before you can comment on or make changes to this bug.