Closed Bug 1450465 Opened 3 years ago Closed 3 years ago

Remove the devtools overlay


(Thunderbird :: General, enhancement)

Not set


(Not tracked)

Thunderbird 61.0


(Reporter: Paenglab, Assigned: aceman)




(1 file, 1 obsolete file)

We still have this two overlays for the devtools:
overlay chrome://devtools/content/framework/toolbox-process-window.xul chrome://messenger/content/devtools/toolbox-process-overlay.xul
overlay chrome://devtools/content/webconsole/webconsole.xul chrome://messenger/content/devtools/webconsole-overlay.xul

Philipp, is it possible to do this through JS? I see also, that the changed dialog title in webconsole-overlay.xul no more works. Maybe because of the change to the new-ui.
Flags: needinfo?(philipp)
Overlays are the only simple way I know to execute scripts in windows. I guess there could be a thing that watches windows being opened and injects the script tags accordingly, similar to how bootstrapped addons usually do it.
Flags: needinfo?(philipp)
We are developing such a watcher system in bug 1450288, to be used by addons but could maybe also be used here by base TB.
Depends on: 1450288
So now with bug 1450288 landed, this could be done.
E.g. webconsole-overlay.xul just loads chrome://global/content/viewSourceUtils.js and sets a title attribute (if it doesn't work, maybe the attribute has changed).

Can we use Services.scriptloader.loadSubScript(chrome://global/content/viewSourceUtils.js, targetWindow); to inject the script into the window?
The same for toolbox-process-overlay.xul .
Flags: needinfo?(acelists)
Attached patch 1450465.patch (obsolete) — Splinter Review
This theoretically works and inserts the scripts into the m-c windows. Does anybody know how to test it? I can see the window title of Error console is changed properly. But what function from the inserted script does the window JS call?

In the Developer Toolbox, how to invoke the openUILinkIn?
I only found that in the Console tab clicking the filenames calls openWebLinkIn() which we do not even have. That is why I added it to the patch. But then it fails with "JavaScript error: chrome://global/content/viewSourceUtils.js, line 73: TypeError: win.gBrowser is undefined" and opens the "open with" dialog with no apps in the list. This is on Linux. Does it behave better on other OSes or can anybody move it further? I think this at least indicates the script was inserted properly (as openWebLinkIn is found now in contentAreaClick.js).
Flags: needinfo?(acelists)
Attachment #8971046 - Flags: feedback?(richard.marti)
Attachment #8971046 - Flags: feedback?(philipp)
Attachment #8971046 - Flags: feedback?(jorgk)
Comment on attachment 8971046 [details] [diff] [review]

Review of attachment 8971046 [details] [diff] [review]:

Nice. The other errors "win.gBrowser is undefined" is pre-existing (bug 1439021 comment #33). It was hidden lately by "openWebLinkIn is not a function" (see bug 1454041 comment #2). All you could do it try it with an external viewer. Does that work?

The aim of course would be to fix bug 1454041 at some stage as well.

::: mail/components/mailGlue.js
@@ +61,5 @@
> +      Services.scriptloader.loadSubScript("chrome://global/content/viewSourceUtils.js", domWindow);
> +    }
> +
> +    ExtensionSupport.registerWindowListener(
> +      "Thunderbird-internal-1",

Maybe call that Thunderbird-internal-Webconsole.

@@ +73,5 @@
> +      Services.scriptloader.loadSubScript("chrome://communicator/content/contentAreaClick.js", domWindow);
> +    }
> +
> +    ExtensionSupport.registerWindowListener(
> +      "Thunderbird-internal-2",

And this one Thunderbird-internal-Toolbox.

::: mail/locales/en-US/chrome/messenger/
@@ +848,5 @@
>  # e.g.: "48.0.2 (32-bit)" or "51.0a1 (2016-09-05) (64-bit)".
>  aboutDialog.architecture.sixtyFourBit = 64-bit
>  aboutDialog.architecture.thirtyTwoBit = 32-bit
> +
> +errorConsoleTitle = Error Console

Now I finally see why the Browser Console is called Error Console in TB.
Attachment #8971046 - Flags: feedback?(jorgk) → feedback+
Comment on attachment 8971046 [details] [diff] [review]

f+ when you remove too. Without its removal the build fails.
Attachment #8971046 - Flags: feedback?(richard.marti) → feedback+
Thanks, fixed the naming and the build failures. Try run:
Attachment #8971046 - Attachment is obsolete: true
Attachment #8971046 - Flags: feedback?(philipp)
Attachment #8971068 - Flags: review?(jorgk)
(In reply to Richard Marti (:Paenglab) from comment #6)
> f+ when you remove
> 9 too. Without its removal the build fails.

Thanks, yes I forgot to remove the references to the removed files.

(In reply to Jorg K (GMT+1) from comment #5)
> Nice. The other errors "win.gBrowser is undefined" is pre-existing (bug
> 1439021 comment #33). It was hidden lately by "openWebLinkIn is not a
> function" (see bug 1454041 comment #2). All you could do it try it with an
> external viewer. Does that work?

I have external viewer set but it does not work from the Toolbox (it does from Error console).
Strangely, clicking some .jsm or .xml files does open them directly in the Toolbox, on the Debugger tab.
But .js files ask for the external app, while none is in the list.

> Maybe call that Thunderbird-internal-Webconsole.
> And this one Thunderbird-internal-Toolbox.

Good idea, I made it BrowserConsole and Toolbox.
Assignee: nobody → acelists
Version: unspecified → 61
Comment on attachment 8971068 [details] [diff] [review]
1450465.patch v1.1

Works for me. Viewing in external viewer still works, we'll fix the other cases in bug 1454041.

Extra points for fixing the window title, thanks!
Attachment #8971068 - Flags: review?(jorgk) → review+
Pushed by
replace devtools overlays with window listeners that insert the needed scripts into the proper m-c window. r=jorgk
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 61.0
You need to log in before you can comment on or make changes to this bug.