Closed Bug 1461248 Opened 2 years ago Closed 2 years ago

Only load ContextMenu.jsm when a contextmenu event occurs

Categories

(Firefox :: Menus, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
Firefox 62
Tracking Status
firefox62 --- fixed

People

(Reporter: Felipe, Assigned: Felipe)

References

(Blocks 1 open bug)

Details

(Whiteboard: [fxperf:p1])

Attachments

(1 file)

An instance of the ContextMenu object is created for every tab (in content.js) only to add its event listener for the "contextmenu" event.

We can add this observer in content.js and only load the .jsm when that happens.

This patch uses the helper being added in bug 1457988
Comment on attachment 8975391 [details]
Bug 1461248 - Only load ContextMenu.jsm when a contextmenu event occurs.

https://reviewboard.mozilla.org/r/243698/#review249640

defineLazyProxy looks awesome! Thanks, felipe!
Attachment #8975391 - Flags: review?(mconley) → review+
Priority: -- → P1
Depends on: 1462400
I did some small shuffling around in content.js to make the code look cleaner: moved the `var global = this` to the top of the file, to group the XPCOMUtils stuff together. I'll carry the r+ forward since there's no functionality change.

I also removed the `var contextMenu = ` which was useless, but now I need to wait for bug 1462400 before landing this, otherwise eslint will complain
Pushed by felipc@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/43757e7a227f
Only load ContextMenu.jsm when a contextmenu event occurs. r=mconley
https://hg.mozilla.org/mozilla-central/rev/43757e7a227f
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 62
You need to log in before you can comment on or make changes to this bug.