Closed Bug 1461444 Opened 3 years ago Closed 3 years ago

Only load the PageInfoListener content code when needed

Categories

(Firefox :: Page Info Window, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 62
Tracking Status
firefox62 --- fixed

People

(Reporter: Felipe, Assigned: Felipe)

References

(Blocks 1 open bug)

Details

(Whiteboard: [fxperf:p1])

Attachments

(2 files)

An instance of the PageInfoListener object is created for every tab (in content.js) only to add the message listener for PageInfo:getData

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

This patch uses the helper being added in bug 1457988
Comment on attachment 8975605 [details]
Bug 1461444 - Part 0. Cut and paste PageInfoListener code from content.js to a new file.

https://reviewboard.mozilla.org/r/243856/#review249946

I'm not really sure about the name, but the patch looks fine otherwise :)

::: browser/modules/PageInfoListener-content.jsm:1
(Diff revision 1)
> +var PageInfoListener = {

Aren't we usually calling these scripts something like ContentPageInfoListener? I haven't seen the CamelCaseName-content pattern before...
Attachment #8975605 - Flags: review?(jhofmann) → review+
Comment on attachment 8975606 [details]
Bug 1461444 - Only load the PageInfoListener content code when needed.

https://reviewboard.mozilla.org/r/243858/#review249968

This seems good, thanks!

::: browser/modules/PageInfoListener-content.jsm:26
(Diff revision 1)
>      if (frameOuterWindowID != undefined) {
>        window = Services.wm.getOuterWindowWithId(frameOuterWindowID);
>        document = window.document;
>      } else {
> -      window = content.window;
> -      document = content.document;
> +      window = message.target.content;
> +      document = window.document;

nit: having this in an if-else block is a bit redundant now
Attachment #8975606 - Flags: review?(jhofmann) → review+
Pushed by felipc@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/6fba5430ad51
Part 0. Copy PageInfoListener code from content.js to a new file. r=johannh
https://hg.mozilla.org/integration/mozilla-inbound/rev/b7733393d2e3
Only load the PageInfoListener content code when needed. r=johannh
https://hg.mozilla.org/mozilla-central/rev/6fba5430ad51
https://hg.mozilla.org/mozilla-central/rev/b7733393d2e3
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 62
You need to log in before you can comment on or make changes to this bug.