Closed Bug 1476097 Opened 6 years ago Closed 6 years ago

Use the Menu API's edit menu for all context menu textboxes within the toolbox

Categories

(DevTools :: Framework, enhancement, P2)

enhancement

Tracking

(firefox65 fixed)

RESOLVED FIXED
Firefox 65
Tracking Status
firefox65 --- fixed

People

(Reporter: bgrins, Assigned: Honza)

References

Details

Attachments

(1 file)

Right now, we use editMenuCommands and editMenuKeys, along with some XUL markup for the devtools "Edit" menu: https://searchfox.org/mozilla-central/rev/b0275bc977ad7fda615ef34b822bba938f2b16fd/devtools/client/framework/toolbox.xul#30-50.

This gets wired up through the toolbox here with associated functions https://searchfox.org/mozilla-central/rev/b0275bc977ad7fda615ef34b822bba938f2b16fd/devtools/client/framework/toolbox.js#481-494.

We're changing this for the Browser Console in Bug 1456852. In addition to moving the edit menu handling out of the webconsole and up to the toolbox, we should check to make sure we create and update the necessary command elements so that the "Edit" menu for the application menu in the browser gets set properly when showing.
Severity: normal → enhancement
Priority: -- → P2
Assignee: nobody → odvarko
Status: NEW → ASSIGNED
Comment on attachment 9010950 [details]
Bug 1476097 - Use the Menu API's edit menu for all context menu textboxes within the toolbox; r=bgrins

Francesco Lodolo [:flod] has approved the revision.
Attachment #9010950 - Flags: review+
The following PR for devtools-html/devtools-core is also needed
https://github.com/devtools-html/devtools-core/pull/1094

This package is duping menu API impl:
https://github.com/devtools-html/devtools-core/blob/4a6a6decb7a866c5d0a1b3ff66b57edd66827c3f/packages/devtools-modules/src/menu/index.js

Two debugger tests will also need some changes I guess.

devtools/client/debugger/new/test/mochitest/browser_dbg-breakpoints-actions.js
devtools/client/debugger/new/test/mochitest/browser_dbg-breakpoints-cond.js

Honza
Comment on attachment 9010950 [details]
Bug 1476097 - Use the Menu API's edit menu for all context menu textboxes within the toolbox; r=bgrins

Brian Grinstead [:bgrins] has approved the revision.
Attachment #9010950 - Flags: review+
So, I am indeed seeing perf regression:
https://treeherder.mozilla.org/perf.html#/comparesubtest?originalProject=try&originalRevision=18915d8a2376985a1e3b031f08b9b436fe53ffee&newProject=try&newRevision=a7376a24f883d7414b9de14b92e7cf98a27d0a9e&originalSignature=f79b6a4f1f8f53326d3056f6c8008c0ff4de0a94&newSignature=f79b6a4f1f8f53326d3056f6c8008c0ff4de0a94&framework=12

console.autocomplete 5.51%

(not sure why console.autocompletion)

I tried to use MozXULElement, but putting the following statement into Toolbox constructor:
(somewhere here: https://searchfox.org/mozilla-central/rev/65f9687eb192f8317b4e02b0b791932eff6237cc/devtools/client/framework/toolbox.js#102)

... produces an error:
ReferenceError: MozXULElement is not defined

How should I use it?

Honza
Flags: needinfo?(bgrinstead)
(In reply to Jan Honza Odvarko [:Honza] from comment #8)
> So, I am indeed seeing perf regression:
> https://treeherder.mozilla.org/perf.html#/
> comparesubtest?originalProject=try&originalRevision=18915d8a2376985a1e3b031f0
> 8b9b436fe53ffee&newProject=try&newRevision=a7376a24f883d7414b9de14b92e7cf98a2
> 7d0a9e&originalSignature=f79b6a4f1f8f53326d3056f6c8008c0ff4de0a94&newSignatur
> e=f79b6a4f1f8f53326d3056f6c8008c0ff4de0a94&framework=12
> 
> console.autocomplete 5.51%
> 
> (not sure why console.autocompletion)

Huh, I'd like to know why this is happening. I would have expected maybe some toolbox open regressions based on eager Fluent loading (i.e. Bug 1441035). If this is truly linux only and only on autocompletion then I'm not super concerned about it, but we should check with Nicolas before landing anything there.

> I tried to use MozXULElement, but putting the following statement into
> Toolbox constructor:
> (somewhere here:
> https://searchfox.org/mozilla-central/rev/
> 65f9687eb192f8317b4e02b0b791932eff6237cc/devtools/client/framework/toolbox.
> js#102)
> 
> ... produces an error:
> ReferenceError: MozXULElement is not defined
> 
> How should I use it?

Is this for using MozXULElement.insertFTLIfNeeded? MozXULElement is attached to the window itself (https://searchfox.org/mozilla-central/source/toolkit/components/processsingleton/CustomElementsListener.jsm#19) so it should work if you do `contentWindow.MozXULElement`. Let me know if it doesn't.
Flags: needinfo?(bgrinstead)
Flags: needinfo?(nchevobbe)
(In reply to Brian Grinstead [:bgrins] from comment #9)
> Is this for using MozXULElement.insertFTLIfNeeded? MozXULElement is attached
> to the window itself
> (https://searchfox.org/mozilla-central/source/toolkit/components/
> processsingleton/CustomElementsListener.jsm#19) so it should work if you do
> `contentWindow.MozXULElement`. Let me know if it doesn't.

So, inserting:
`contentWindow.MozXULElement.insertFTLIfNeeded("toolkit/main-window/editmenu.ftl");`

into the Toolbox constructor generates:

TypeError: contentWindow.MozXULElement is undefined; can't access its "insertFTLIfNeeded" property

Honza
Flags: needinfo?(bgrinstead)
I'm not sure why this is happening as well. 
The autocomplete test only measure time spent showing and closing the autocomplete popup (e.g. no toolbox opening), so I'm curious what's going on here.
The autocomplete popup does not seem modified here, so the only way of knowing why the patch regresses the autocomplete test is to record a profile and compare it to another profile without the patch.
Flags: needinfo?(nchevobbe)
(In reply to Jan Honza Odvarko [:Honza] from comment #10)
> (In reply to Brian Grinstead [:bgrins] from comment #9)
> > Is this for using MozXULElement.insertFTLIfNeeded? MozXULElement is attached
> > to the window itself
> > (https://searchfox.org/mozilla-central/source/toolkit/components/
> > processsingleton/CustomElementsListener.jsm#19) so it should work if you do
> > `contentWindow.MozXULElement`. Let me know if it doesn't.
> 
> So, inserting:
> `contentWindow.MozXULElement.insertFTLIfNeeded("toolkit/main-window/editmenu.
> ftl");`
> 
> into the Toolbox constructor generates:
> 
> TypeError: contentWindow.MozXULElement is undefined; can't access its
> "insertFTLIfNeeded" property

I checked, and the contentWindow's location has set yet at this point (so the CE listener hasn't loaded the script, and even if it had it would be the wrong document at this point).

We'll want to put it after toolbox.xul has been loaded. I'm not sure exactly where would be best, but `this.win.MozXULElement` is accessible inside onceDOMReady, for instance: https://searchfox.org/mozilla-central/rev/c9272ef398954288525e37196eada1e5a93d93bf/devtools/client/framework/toolbox.js#443
Flags: needinfo?(bgrinstead)
(In reply to Brian Grinstead [:bgrins] from comment #12)
> We'll want to put it after toolbox.xul has been loaded. I'm not sure exactly
> where would be best, but `this.win.MozXULElement` is accessible inside
> onceDOMReady, for instance:
> https://searchfox.org/mozilla-central/rev/
> c9272ef398954288525e37196eada1e5a93d93bf/devtools/client/framework/toolbox.
> js#443

@Brian, the patch is updated. Strings (*.ftl file) is now loaded lazily
when the menu is opened for the first time. Please have a look at it

There is no perf regression now:
https://treeherder.mozilla.org/perf.html#/comparesubtest?originalProject=try&originalRevision=9a181702ac16f5e0899a795c525e4e05cc675ade&newProject=try&newRevision=5060a71aec85d95b429e7856776517dd453a2c93&originalSignature=f79b6a4f1f8f53326d3056f6c8008c0ff4de0a94&newSignature=f79b6a4f1f8f53326d3056f6c8008c0ff4de0a94&framework=12

Honza
Flags: needinfo?(bgrinstead)
Pushed by jodvarko@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/796f3bfbaa2d
Use the Menu API's edit menu for all context menu textboxes within the toolbox; r=bgrins,flod
Pushed by jodvarko@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/2812f44f383e
Use the Menu API's edit menu for all context menu textboxes within the toolbox; r=bgrins,flod
https://hg.mozilla.org/mozilla-central/rev/2812f44f383e
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 65
Flags: needinfo?(bgrinstead)
Depends on: 1510182
See Also: → 1513343
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: