Closed Bug 1404893 Opened 7 years ago Closed 2 years ago

Browser Toolbox Doesn't Work

Categories

(DevTools :: Framework, defect, P3)

56 Branch
defect

Tracking

(firefox57 fix-optional)

RESOLVED INACTIVE
Tracking Status
firefox57 --- fix-optional

People

(Reporter: kingofthe, Unassigned)

References

(Blocks 1 open bug)

Details

User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0
Build ID: 20170926190823

Steps to reproduce:

Trying to open the "Browser Toolbox" from the "Web Developer" menu on FF56. It has not worked on any version for me.

I have checked "Enable browser chrome and add-on debugging toolboxes" and "Enable remote debugging" in the Developer Tools Settings.

I have set "devtools.debugger.prompt-connection" to false in about:config to avoid the popup.

According to some users, removing the folder "chrome_debugger_profile" from the profile folder also helps with the issue. It doesn't, for me.

I have also tried to open the browser in "safe mode". This did not help, either.

Some discussion about the bug: https://www.reddit.com/r/FirefoxCSS/comments/6zgp9g/browser_toolbox_stopped_working/ and https://www.reddit.com/r/FirefoxCSS/comments/71huob/browser_toolbox_stops_working_windows_1064bit/


Actual results:

A blank Browser Toolbox screen appears.


Expected results:

Browser Toolbox starts.
Component: Untriaged → Developer Tools
Can you please check on a Nightly build with a clean profile and see if it still doesn't work? There have been a number of fixes that went out in the 57 cycle so just want to confirm that this is still an issue on m-c.
Component: Developer Tools → Developer Tools: Framework
Flags: needinfo?(kingofthe)
I was able to check this on a Nightly build (today's), and on a fresh profile now. Same situation, unfortunately: A blank box pops up and dialog asking for connection permission opens.

How come the "Browser Toolbox" is not currently visible in the menus of the newest Nightly builds? I had to use a convoluted key combo to trigger the box.
Flags: needinfo?(kingofthe)
When I tried to start the Browser Toolbox today, before it get stuck on the blank screen, it checked for installed add-ons much like Firefox does after an update. Maybe this has something to do with the issue?
I have updated to 57 on the release channel. Still getting a blank box after a profile refresh.
Not working on most recent Nightly 59.0a1 64-bit either. Could this be a platform-specific issue? I am on Windows 7 64-bit SP1.
(In reply to KotW from comment #5)
> Not working on most recent Nightly 59.0a1 64-bit either. Could this be a
> platform-specific issue? I am on Windows 7 64-bit SP1.

It could be, although it works for me on Win7 64. I landed a fix for Win 7 in Bug 1374837 but the symptom there was no window would open at all, not even a prompt or blank window.

If you load about:debugging and then click 'Debug' on something like Activity Stream, does the addon debugging toolbox load properly?
(In reply to Brian Grinstead [:bgrins] from comment #6)
> (In reply to KotW from comment #5)
> > Not working on most recent Nightly 59.0a1 64-bit either. Could this be a
> > platform-specific issue? I am on Windows 7 64-bit SP1.
> 
> It could be, although it works for me on Win7 64. I landed a fix for Win 7
> in Bug 1374837 but the symptom there was no window would open at all, not
> even a prompt or blank window.
> 
> If you load about:debugging and then click 'Debug' on something like
> Activity Stream, does the addon debugging toolbox load properly?

It doesn't, no, same result as selecting the Browser Toolbox feature, which is a blank popup of the same size. I tried this both on 59 (clean test profile) and 57 (on my just-refreshed, imported 56 profile).
OK, two more things to try:

1) Open chrome://devtools/content/framework/toolbox-process-window.xul in a tab. You should see "Error opening browser toolbox. Must pass a port in an env variable with MOZ_BROWSER_TOOLBOX_PORT"
2) Try manually doing what happens when the Browser Toolbox opens:
-- in your Nightly build open jsterm (shift+f2) then entering `listen 6080` (this opens the remote debugger port)
-- Not sure if this syntax is exactly right but the idea is to set the env variable and the `chrome` option: `SET MOZ_BROWSER_TOOLBOX_PORT=6080;firefox.exe -chrome chrome://devtools/content/framework/toolbox-process-window.xul`
Priority: -- → P2
If we figure out how to set the MOZ_BROWSER_TOOLBOX_PORT=6080 properly I think we are going to get somewhere. I used the following launch string to launch my Nightly: 

"firefox.exe -P --start-debugger-server 6080 -chrome chrome://devtools/content/framework/toolbox-process-window.xul --purgecaches --jsconsole"

It opens the toolbox, though with the error "Error opening browser toolbox. Must pass a port in an env variable with MOZ_BROWSER_TOOLBOX_PORT". I also get the jsconsole, which reports the following:

TypeError: can't redefine non-configurable property "Services"[Learn More]  XPCOMUtils.jsm:192:5
	ObjectOrReflectDefineProperty self-hosted:4139:16
	defineProperty self-hosted:4155:5
	XPCU_defineLazyGetter resource://gre/modules/XPCOMUtils.jsm:192:5
	XPCU_defineLazyModuleGetter resource://gre/modules/XPCOMUtils.jsm:330:5
	<anonymous> chrome://global/content/viewSourceUtils.js:22:1
Error: Must pass a port in an env variable with MOZ_BROWSER_TOOLBOX_PORT
Stack trace:
connect<@chrome://devtools/content/framework/toolbox-process-window.js:46:11
_run@resource://devtools/shared/base-loader.js -> resource://devtools/shared/task.js:310:39
TaskImpl@resource://devtools/shared/base-loader.js -> resource://devtools/shared/task.js:272:3
asyncFunction@resource://devtools/shared/base-loader.js -> resource://devtools/shared/task.js:246:14
@chrome://devtools/content/framework/toolbox-process-window.js:85:3
EventListener.handleEvent*@chrome://devtools/content/framework/toolbox-process-window.js:81:1
  toolbox-process-window.js:90:5
	<anonymous> chrome://devtools/content/framework/toolbox-process-window.js:90:5
	process resource://gre/modules/Promise-backend.js:925:21
	walkerLoop resource://gre/modules/Promise-backend.js:806:7
	scheduleWalkerLoop resource://gre/modules/Promise-backend.js:739:11
	schedulePromise resource://gre/modules/Promise-backend.js:770:7
	Promise.prototype.then resource://gre/modules/Promise-backend.js:455:5
	Promise.prototype.catch resource://gre/modules/Promise-backend.js:473:10
	<anonymous> chrome://devtools/content/framework/toolbox-process-window.js:85:3
	(Async: EventListener.handleEvent)
	<anonymous> chrome://devtools/content/framework/toolbox-process-window.js:81:1

The next question is how to "pass a port in an env variable with MOZ_BROWSER_TOOLBOX_PORT". Unfortunately, I do not know what the correct syntax is to use while launching firefox.exe, or if it's even possible. Doing SET MOZ_BROWSER_TOOLBOX_PORT=6080 in jsterm does not work.
(In reply to KotW from comment #9)
> If we figure out how to set the MOZ_BROWSER_TOOLBOX_PORT=6080 properly I
> think we are going to get somewhere. I used the following launch string to
> launch my Nightly: 
> 
> "firefox.exe -P --start-debugger-server 6080 -chrome
> chrome://devtools/content/framework/toolbox-process-window.xul --purgecaches
> --jsconsole"
> 
> It opens the toolbox, though with the error "Error opening browser toolbox.
> Must pass a port in an env variable with MOZ_BROWSER_TOOLBOX_PORT". I also
> get the jsconsole, which reports the following:

OK, so at least we know toolbox-process-window.xul is loading.

To be clear, for the browser toolbox you need two different Firefox instances (this is what happens behind the scenes when you use the keyboard shortcut to open the BT):

1) Server (a running version of firefox you want to debug). You need to open up the debugging port on this one, either from jsterm `listen` command or the `--start-debugger-server` command line arg.
2) Client (a separate firefox instance with the `--chrome` command line arg pointing to toolbox-process-window.xul)

> The next question is how to "pass a port in an env variable with
> MOZ_BROWSER_TOOLBOX_PORT". Unfortunately, I do not know what the correct
> syntax is to use while launching firefox.exe, or if it's even possible.
> Doing SET MOZ_BROWSER_TOOLBOX_PORT=6080 in jsterm does not work.

MOZ_BROWSER_TOOLBOX_PORT needs to be set for instance (2) above, not (1). So you don't use jsterm to set it, you need to instead set it as an environment variable in windows command line when starting firefox.exe. I believe the SET command does this in Windows. If that doesn't work, it might be easier to do debug if you have a local build so we can add some extra logging and track down what's happening.
(In reply to Brian Grinstead [:bgrins] from comment #10)
> (In reply to KotW from comment #9)
> > If we figure out how to set the MOZ_BROWSER_TOOLBOX_PORT=6080 properly I
> > think we are going to get somewhere. I used the following launch string to
> > launch my Nightly: 
> > 
> > "firefox.exe -P --start-debugger-server 6080 -chrome
> > chrome://devtools/content/framework/toolbox-process-window.xul --purgecaches
> > --jsconsole"
> > 
> > It opens the toolbox, though with the error "Error opening browser toolbox.
> > Must pass a port in an env variable with MOZ_BROWSER_TOOLBOX_PORT". I also
> > get the jsconsole, which reports the following:
> 
> OK, so at least we know toolbox-process-window.xul is loading.
> 
> To be clear, for the browser toolbox you need two different Firefox
> instances (this is what happens behind the scenes when you use the keyboard
> shortcut to open the BT):
> 
> 1) Server (a running version of firefox you want to debug). You need to open
> up the debugging port on this one, either from jsterm `listen` command or
> the `--start-debugger-server` command line arg.
> 2) Client (a separate firefox instance with the `--chrome` command line arg
> pointing to toolbox-process-window.xul)
> 
> > The next question is how to "pass a port in an env variable with
> > MOZ_BROWSER_TOOLBOX_PORT". Unfortunately, I do not know what the correct
> > syntax is to use while launching firefox.exe, or if it's even possible.
> > Doing SET MOZ_BROWSER_TOOLBOX_PORT=6080 in jsterm does not work.
> 
> MOZ_BROWSER_TOOLBOX_PORT needs to be set for instance (2) above, not (1). So
> you don't use jsterm to set it, you need to instead set it as an environment
> variable in windows command line when starting firefox.exe. I believe the
> SET command does this in Windows. If that doesn't work, it might be easier
> to do debug if you have a local build so we can add some extra logging and
> track down what's happening.

I would love to get down to the bottom of this to get it working. Customizing the browser is so awfully hard without being able to use Browser Toolbox for finding out elements to modify and change.

I'm a bit out of element here, though, trying various combinations of the launch string - "set" doesn't seem to be a command line flag Firefox recognizes, and I have no idea where to add it to my launch string so that it would set a port instead of trying to open a website (if I add them to the launch string, Nightly opens tabs for "set" and "MOZ_BROWSER_TOOLBOX_PORT=6080". 

So we need to string together a command line string that I can run that works.
(In reply to KotW from comment #11)
> I'm a bit out of element here, though, trying various combinations of the
> launch string - "set" doesn't seem to be a command line flag Firefox
> recognizes, and I have no idea where to add it to my launch string so that
> it would set a port instead of trying to open a website (if I add them to
> the launch string, Nightly opens tabs for "set" and
> "MOZ_BROWSER_TOOLBOX_PORT=6080". 
> 
> So we need to string together a command line string that I can run that
> works.

`SET` in this case is a command for the Windows command shell, not Firefox.

You can either open a command shell, and run something like:

```
$ SET MOZ_BROWSER_TOOLBOX_PORT=6080
$ firefox.exe -P <name-of-debugger-profile-here> -chrome chrome://devtools/content/framework/toolbox-process-window.xul -no-remote
```

or try some technique that glues them together in a shortcut, such as:

https://stackoverflow.com/questions/3036325/can-i-set-an-environment-variable-for-an-application-using-a-shortcut-in-windows
(In reply to J. Ryan Stinnett [:jryans] (use ni?) from comment #12)
> (In reply to KotW from comment #11)
> > I'm a bit out of element here, though, trying various combinations of the
> > launch string - "set" doesn't seem to be a command line flag Firefox
> > recognizes, and I have no idea where to add it to my launch string so that
> > it would set a port instead of trying to open a website (if I add them to
> > the launch string, Nightly opens tabs for "set" and
> > "MOZ_BROWSER_TOOLBOX_PORT=6080". 
> > 
> > So we need to string together a command line string that I can run that
> > works.
> 
> `SET` in this case is a command for the Windows command shell, not Firefox.
> 
> You can either open a command shell, and run something like:
> 
> ```
> $ SET MOZ_BROWSER_TOOLBOX_PORT=6080
> $ firefox.exe -P <name-of-debugger-profile-here> -chrome
> chrome://devtools/content/framework/toolbox-process-window.xul -no-remote
> ```
> 
> or try some technique that glues them together in a shortcut, such as:
> 
> https://stackoverflow.com/questions/3036325/can-i-set-an-environment-
> variable-for-an-application-using-a-shortcut-in-windows

Thanks! There are so many moving parts here - flags, environment variables, console commands etc. Now that I know what is what, I set the environment variable in Windows 7's environment variables settings panel :D

After that, I used "firefox.exe -P -chrome chrome://devtools/content/framework/toolbox-process-window.xul -no-remote --jsconsole" and there was no mention of the port error in the console now, but the toolbox remains blank.
Product: Firefox → DevTools
Priority: P2 → P3

Thank you, removing the folder "chrome_debugger_profile" from the profile folder worked for me. I had a similar issue with Firefox 96. After opening the browser and the browser toolbox and closing the browser many times to improve my userChrome.css fixes to that utterly broken tab bar since version 89 or so, at one point the browser toolbox wouldn't open anymore. Now it works again here.

Update: The browser toolbox fails regularly. Every few browser restarts, it won't open anymore. At least deleting that folder fixes it for a while, but the browser toolbox proves to be very unreliable.

Small info, might be interesting, yet unverified: I have enabled session restore in Firefox. So when I quit Firefox with the browser toolbox still open, it will reopen at the next browser start. This seems to be unreliable. I then tried to always close the browser toolbox before quitting Firefox and can't remember having seen the issue again.

Thanks Yves for the update.
I can confirm, I have the same experience (closing the Browser Toolbox before quitting Firefox also helped in my case)

This is likely fixed by work done in Bug 1120863 - Browser toolbox starts blank and doesn't function with pending updates
Feel free to reopen if you are still experiencing this issue.

Honza

Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Resolution: --- → INACTIVE
See Also: → 1120863
You need to log in before you can comment on or make changes to this bug.