Closed Bug 1470023 Opened 6 years ago Closed 6 years ago

Lazily load PluginContent.jsm

Categories

(Core Graveyard :: Plug-ins, enhancement)

enhancement
Not set
normal

Tracking

(firefox63 fixed)

RESOLVED FIXED
mozilla63
Tracking Status
firefox63 --- fixed

People

(Reporter: mccr8, Assigned: kmag)

References

(Depends on 1 open bug, Blocks 1 open bug)

Details

(Whiteboard: [overhead:30k][fxperf:p1])

Attachments

(1 file)

content.js contains this code: // TODO: Load this lazily so the JSM is run only if a relevant event/message fires. void new PluginContent(global); I haven't looked at the code, but hopefully we can avoid loading this JSM if there are no plugins in the content process. According to my analyzer, this is like 30kb of memory (almost entirely scripts).
Whiteboard: [overhead:30k]
Component: General → Plug-ins
Product: Firefox → Core
I think this should be pretty doable. I looked into this when I was doing bug 1464552, and initially backed away because of the pageshow and pagehide hooks. It looks like we only actually need to care about those once the module has been loaded, though, so we may be able to do this without too much trouble.
Whiteboard: [overhead:30k] → [overhead:30k][fxperf]
Pro-actively assigning this to kmag, since he's already got a patch up for it.
Assignee: nobody → kmaglione+bmo
Whiteboard: [overhead:30k][fxperf] → [overhead:30k][fxperf:p1]
Comment on attachment 8987397 [details] Bug 1470023: Lazily load PluginContent.jsm when it's first required. https://reviewboard.mozilla.org/r/252642/#review259386 In addition to this, I'd make the PluginContentStub object a weak observer, to avoid the unload listener and the uninit function. Probably follow-up fodder, but this decoder-doctor-notification might be even unnecessary. There's an existing meta-bug about getting rid of one-observer-per-tab observers (bug 1195386), which tracks bug 1348810 where this notification is discussed.
Attachment #8987397 - Flags: review?(felipc) → review+
Hrm. Apparently there's some code that depends on this frame script touching `content`, which doesn't happen after the lazification. I'm going to add a hack to keep touching it for now and file a follow-up to remove it.
Flags: needinfo?(kmaglione+bmo)
See Also: → 1471327
Backed out 3 changesets (bug 1470023, bug 1469719, bug 1470965) for | toolkit/components/perfmonitoring/tests/browser/browser_compartments.js on a CLOSED TREE Problematic push: https://treeherder.mozilla.org/#/jobs?repo=mozilla-inbound&revision=bab121b4dd84f9715e6a9efa652556a91ea60a3c&filter-resultStatus=testfailed&filter-resultStatus=busted&filter-resultStatus=exception&filter-classifiedState=unclassified Failure: https://treeherder.mozilla.org/#/jobs?repo=mozilla-inbound&filter-resultStatus=testfailed&filter-resultStatus=busted&filter-resultStatus=exception&fromchange=43040128202efc47d4249e623e6d3ffd1a5d9588&filter-classifiedState=unclassified&selectedJob=185004097 Backout: https://treeherder.mozilla.org/#/jobs?repo=mozilla-inbound&revision=24aeaadfae0df355fb2fac7ea25ea90fa9c56ddf&filter-resultStatus=testfailed&filter-resultStatus=busted&filter-resultStatus=exception&filter-classifiedState=unclassified Log: https://treeherder.mozilla.org/logviewer.html#?job_id=185004097&repo=mozilla-inbound&lineNumber=2513 12:29:59 INFO - TEST-UNEXPECTED-FAIL | browser/components/extensions/test/browser/test-oop-extensions/browser_ext_tabs_executeScript.js | Error: Error: No matching message handler :: Async*background@moz-extension://3ee86764-b762-5340-a5bf-c15c8f281ced/%7B62a81496-888d-f242-8ef8-442b57bff1c8%7D.js:3:11 12:29:59 INFO - async*@moz-extension://3ee86764-b762-5340-a5bf-c15c8f281ced/%7B62a81496-888d-f242-8ef8-442b57bff1c8%7D.js:1:17 12:29:59 INFO - - 12:29:59 INFO - Stack trace: 12:29:59 INFO - background@moz-extension://3ee86764-b762-5340-a5bf-c15c8f281ced/%7B62a81496-888d-f242-8ef8-442b57bff1c8%7D.js:187:7 12:29:59 INFO - async*@moz-extension://3ee86764-b762-5340-a5bf-c15c8f281ced/%7B62a81496-888d-f242-8ef8-442b57bff1c8%7D.js:1:17 12:29:59 INFO - 12:29:59 INFO - Not taking screenshot here: see the one that was previously logged 12:29:59 INFO - TEST-UNEXPECTED-FAIL | browser/components/extensions/test/browser/test-oop-extensions/browser_ext_tabs_executeScript.js | executeScript - 12:29:59 INFO - Stack trace: 12:29:59 INFO - background@moz-extension://3ee86764-b762-5340-a5bf-c15c8f281ced/%7B62a81496-888d-f242-8ef8-442b57bff1c8%7D.js:188:7 12:29:59 INFO - async*@moz-extension://3ee86764-b762-5340-a5bf-c15c8f281ced/%7B62a81496-888d-f242-8ef8-442b57bff1c8%7D.js:1:17 12:29:59 INFO - 12:29:59 INFO - TEST-PASS | browser/components/extensions/test/browser/test-oop-extensions/browser_ext_tabs_executeScript.js | test result correct - 12:29:59 INFO - Console message: [JavaScript Error: "Promise rejected after context unloaded: Message manager disconnected 12:29:59 INFO - " {file: "moz-extension://3ee86764-b762-5340-a5bf-c15c8f281ced/script.js" line: 2}] 12:29:59 INFO - @moz-extension://3ee86764-b762-5340-a5bf-c15c8f281ced/script.js:2:9 12:29:59 INFO - 12:29:59 INFO - Console message: Ignoring response to aborted listener for 1099511627780 12:29:59 INFO - Console message: Cannot send function call result: other side closed connection (call data: ({path:"tabs.executeScript", args:[409, {allFrames:null, code:"42", cssOrigin:null, file:null, frameId:null, matchAboutBlank:null, runAt:"document_idle"}]})) 12:29:59 INFO - TEST-PASS | browser/components/extensions/test/browser/test-oop-extensions/browser_ext_tabs_executeScript.js | Message manager count - 12:29:59 INFO - TEST-PASS | browser/components/extensions/test/browser/test-oop-extensions/browser_ext_tabs_executeScript.js | Pending response count - 12:29:59 INFO - Leaving test bound testExecuteScript 12:29:59 INFO - Console message: Ignoring response to aborted listener for 1668 12:29:59 INFO - Console message: Cannot send function call result: other side closed connection (call data: ({path:"tabs.executeScript", args:[410, {allFrames:null, code:"location.href", cssOrigin:null, file:null, frameId:null, matchAboutBlank:null, runAt:"document_idle"}]})) 12:29:59 INFO - GECKO(869) | MEMORY STAT | vsize 4724MB | residentFast 794MB | heapAllocated 190MB 12:29:59 INFO - TEST-OK | browser/components/extensions/test/browser/test-oop-extensions/browser_ext_tabs_executeScript.js | took 939ms 12:29:59 INFO - Not taking screenshot here: see the one that was previously logged 12:29:59 INFO - TEST-UNEXPECTED-FAIL | browser/components/extensions/test/browser/test-oop-extensions/browser_ext_tabs_executeScript.js | Found an unexpected tab at the end of test run: about:blank - 12:29:59 INFO - Not taking screenshot here: see the one that was previously logged 12:29:59 INFO - TEST-UNEXPECTED-FAIL | browser/components/extensions/test/browser/test-oop-extensions/browser_ext_tabs_executeScript.js | Found an unexpected tab at the end of test run: http://example.com/ - 12:29:59 INFO - Not taking screenshot here: see the one that was previously logged 12:29:59 INFO - TEST-UNEXPECTED-FAIL | browser/components/extensions/test/browser/test-oop-extensions/browser_ext_tabs_executeScript.js | Found an unexpected tab at the end of test run: http://example.net/ - 12:29:59 INFO - checking window state
Flags: needinfo?(kmaglione+bmo)
Kris, when you land it again, could you mention bug 1471327 in the comment above the `var content` hack?
(In reply to :Felipe Gomes (needinfo me!) from comment #11) > Kris, when you land it again, could you mention bug 1471327 in the comment > above the `var content` hack? Yup, sorry. I filed the bug before I landed so I could add it to the comment, and then forgot...
Flags: needinfo?(kmaglione+bmo)
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: