Closed
Bug 1184115
Opened 10 years ago
Closed 2 months ago
Services.ppmm is defined for child processes
Categories
(Core :: DOM: Content Processes, defect, P5)
Core
DOM: Content Processes
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: Yoric, Unassigned)
References
Details
(Keywords: good-first-bug)
Attachments
(1 file)
|
40 bytes,
text/x-review-board-request
|
Details |
Looking at my logs, I see code loaded with `loadProcessScript()` loaded twice in the content process, in distinct scopes. Weird behaviors ensues.
Can you post a testcase or something?
Flags: needinfo?(dteller)
| Reporter | ||
Comment 2•10 years ago
|
||
I'll try to minimize.
| Reporter | ||
Comment 3•10 years ago
|
||
Ok, found the issue, false alert.
The script was double-loaded, but for other reasons. I was using `Services.ppmm == null` to find out whether we were in a child process, and apparently, `Services.ppmm` is never `null`.
Is it normal that each child has a Global Parent Process Message Manager?
Flags: needinfo?(dteller)
| Reporter | ||
Updated•10 years ago
|
Flags: needinfo?(wmccloskey)
| Reporter | ||
Updated•10 years ago
|
Summary: loadProcessScript() loads code twice in the content process → Services.ppmm is defined for child processes
| Reporter | ||
Comment 4•10 years ago
|
||
Bug 1184115 - Fixing double-loading of PerformanceStats content script;r?mconley
Attachment #8635673 -
Flags: review?(mconley)
| Reporter | ||
Comment 5•10 years ago
|
||
Comment on attachment 8635673 [details]
MozReview Request: Bug 1184115 - Services.ppmm should not be defined for child services;r=mconley
Bug 1184115 - Fixing double-loading of PerformanceStats content script;r?mconley
> Is it normal that each child has a Global Parent Process Message Manager?
That's a bug. We should fix it. It looks like this bug is for something else, so can you file something? Thanks for finding it!
Flags: needinfo?(wmccloskey)
| Reporter | ||
Comment 7•10 years ago
|
||
(bug has been repurposed already)
Comment 8•10 years ago
|
||
Comment on attachment 8635673 [details]
MozReview Request: Bug 1184115 - Services.ppmm should not be defined for child services;r=mconley
https://reviewboard.mozilla.org/r/13585/#review12305
I feel like we should also be patching the underlying issue - can you also supply a patch that returns undefined for ppmm if we're in the content process? We might also want to do something similar for the cpmm in the parent process.
::: toolkit/components/perfmonitoring/PerformanceStats.jsm:696
(Diff revision 2)
> - if (this._initialized) {
> - return this._loader;
> + if (isContent) {
> + return null;
> }
> - this._initialized = true;
> + if (this._loader) {
if (isContent || this.\_loader)?
Attachment #8635673 -
Flags: review?(mconley) → review+
| Reporter | ||
Updated•10 years ago
|
Attachment #8635673 -
Attachment description: MozReview Request: Bug 1184115 - Fixing double-loading of PerformanceStats content script;r?mconley → MozReview Request: Bug 1184115 - Services.ppmm should not be defined for child services;r=mconley
Attachment #8635673 -
Flags: review+ → review?(mconley)
| Reporter | ||
Comment 9•10 years ago
|
||
Comment on attachment 8635673 [details]
MozReview Request: Bug 1184115 - Services.ppmm should not be defined for child services;r=mconley
Bug 1184115 - Services.ppmm should not be defined for child services;r=mconley
Comment 10•10 years ago
|
||
Comment on attachment 8635673 [details]
MozReview Request: Bug 1184115 - Services.ppmm should not be defined for child services;r=mconley
https://reviewboard.mozilla.org/r/13585/#review12415
The fix looks fine - but I have some suggestions for the test. See below. Thanks!
::: toolkit/modules/tests/browser/browser_Services.js:54
(Diff revision 3)
> + yield ContentTask.spawn(newTab.linkedBrowser, null, frameScript);
I think we're missing out on some of the nice readability of ContentTask here. Instead of splitting it out into the frameScript and promiseContentResponse functions, we can probably just do:
```
info("Checking parent process");
Assert.ok(Services.ppmm, "Services.ppmm is defined in the parent process");
if (!gMultiProcessBrowser) {
return;
}
info("Checking content");
let hasPPMM = yield ContentTask.spawn(browser, null, function*() {
const Cu = Components.utils;
let Services = Cu.import("resource://gre/modules/Services.jsm", {}).Services;
return !!Services.ppmm;
});
Assert.ok(!hasPPMM, "Should not have Services.ppmm defined in content processes");
::: toolkit/modules/tests/browser/browser_Services.js:52
(Diff revision 3)
> + let newTab = gBrowser.addTab();
Use BrowserTestUtils.withNewTab here - it'll take care of closing the tab for you when the test finishes.
Example:
```
yield BrowserTestUtils.withNewTab({
gBrowser,
url: "about:blank",
}, function*(browser) {
// .. now do things with your new browser
});
```
Attachment #8635673 -
Flags: review?(mconley)
| Reporter | ||
Comment 11•10 years ago
|
||
Comment on attachment 8635673 [details]
MozReview Request: Bug 1184115 - Services.ppmm should not be defined for child services;r=mconley
Bug 1184115 - Services.ppmm should not be defined for child services;r=mconley
Attachment #8635673 -
Flags: review?(mconley)
Updated•10 years ago
|
Attachment #8635673 -
Flags: review?(mconley) → review+
Comment 12•10 years ago
|
||
Comment on attachment 8635673 [details]
MozReview Request: Bug 1184115 - Services.ppmm should not be defined for child services;r=mconley
https://reviewboard.mozilla.org/r/13585/#review12429
Looks good! Just one minor suggestion below to combine your two ContentTasks.
Also, in the future, when you fix issues in a previous revision, I suggest clicking "Fixed" for each issue in the associated review - that way, I as a reviewer, know that you have addressed my comment.
Cheers!
::: toolkit/modules/tests/browser/browser_Services.js:17
(Diff revision 4)
> + let hasPPMM = yield ContentTask.spawn(browser, null, function*() {
> + const Cu = Components.utils;
> + let Services = Cu.import("resource://gre/modules/Services.jsm", {}).Services;
> + return !!Services.ppmm;
> + });
> +
> + let isContentProcess = yield ContentTask.spawn(browser, null, function*() {
> + const Cu = Components.utils;
> + let Services = Cu.import("resource://gre/modules/Services.jsm", {}).Services;
> + return Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_CONTENT;
> + });
We can probably just do a single ContentTask for this, like:
```
let {hasPPMM, isContentProcess} = yield ContentTask.spawn(browser, null, function*() {
const Cu = Components.utils;
let Services = Cu.import("resource://gre/modules/Services.jsm", {}).Services;
return {
hasPPMM: !!Services.ppmm,
isContentProcess: Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_CONTENT,
};
});
// ...
```
| Reporter | ||
Updated•10 years ago
|
Attachment #8635673 -
Flags: review+
| Reporter | ||
Comment 13•10 years ago
|
||
Comment on attachment 8635673 [details]
MozReview Request: Bug 1184115 - Services.ppmm should not be defined for child services;r=mconley
Bug 1184115 - Services.ppmm should not be defined for child services;r=mconley
| Reporter | ||
Comment 14•10 years ago
|
||
Keywords: checkin-needed
Comment 15•10 years ago
|
||
Keywords: checkin-needed
Comment 16•10 years ago
|
||
Backed out for test_experiment.js xpcshell failures.
https://treeherder.mozilla.org/logviewer.html#?job_id=3895207&repo=fx-team
https://hg.mozilla.org/integration/fx-team/rev/4207226366e9
| Reporter | ||
Comment 17•10 years ago
|
||
Apparently, test_experiments.js doesn't like when we call `Services.appinfo` too early. I assume that's because of the `createAppInfo` in the code. I don't have good ideas on how to work around this.
Any idea?
Flags: needinfo?(gps)
Updated•4 years ago
|
Severity: normal → S4
Priority: -- → P3
Comment 19•2 years ago
•
|
||
(In reply to Pulsebot from comment #15)
Someone could take this original patch and resubmit it to phabricator and then we could check if there are still problems with this.
Keywords: good-first-bug
Priority: P3 → P5
Comment 20•2 months ago
|
||
I guess this could still be an issue but people shouldn't be writing new message manager code. We can revisit this if somebody wants to fix it.
Status: NEW → RESOLVED
Closed: 2 months ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•