Closed
Bug 803190
Opened 13 years ago
Closed 13 years ago
OS.File is null in mochitest-chrome, running in tbpl
Categories
(Toolkit Graveyard :: OS.File, defect)
Toolkit Graveyard
OS.File
Tracking
(Not tracked)
RESOLVED
FIXED
mozilla19
People
(Reporter: msucan, Assigned: Yoric)
Details
Attachments
(1 file)
|
2.32 KB,
patch
|
froydnj
:
review+
|
Details | Diff | Splinter Review |
Today I tried to use OS.File for my mochitest-chrome test, for the Web Console (in toolkit/devtools). It worked on my system really nicely.
However TBPL doesn't agree:
https://tbpl.mozilla.org/?tree=Try&rev=5c81ef93d407
TypeError: OS.File is null.
| Assignee | ||
Updated•13 years ago
|
Assignee: nobody → dteller
| Assignee | ||
Comment 1•13 years ago
|
||
As it turns out, the problem was due to the code of test_osfile_comms.xul. I had introduce some scaffolding in old versions to be able to test components of OS.File individually. Scaffolding cleanup was a little too aggressive.
Now that we have OS.File, replacing the scaffolding with a simple import of osfile.jsm.
Attachment #673974 -
Flags: review?(nfroyd)
Comment 2•13 years ago
|
||
Comment on attachment 673974 [details] [diff] [review]
Removing test_osfile_comms.xul scaffolding
Review of attachment 673974 [details] [diff] [review]:
-----------------------------------------------------------------
I think this makes sense, but questions below.
::: toolkit/components/osfile/tests/mochi/test_osfile_comms.xul
@@ -29,5 @@
> - } else {
> - // We are under Unix
> - Components.utils.import("resource://gre/modules/osfile/osfile_unix_allthreads.jsm");
> - OS.File = { Error: OS.Shared.Unix.Error}; // Hack to be able to (de)serialize exceptions
> - }
Just to double-check my own understanding here: this code wasn't importing everything that was needed to create OS.File, whereas //gre/modules/osfile.jsm does import all the necessary functionality? Why weren't we seeing problems with this before?
@@ -52,5 @@
> SimpleTest.ok(msg.data.condition, msg.data.description);
> return;
> case "finish":
> - delete OS.File.Error; // Avoid leak
> - OS.File = null;
Why does this need to go away?
Attachment #673974 -
Flags: review?(nfroyd) → review+
| Assignee | ||
Comment 3•13 years ago
|
||
(In reply to Nathan Froyd (:froydnj) from comment #2)
> Just to double-check my own understanding here: this code wasn't importing
> everything that was needed to create OS.File, whereas
> //gre/modules/osfile.jsm does import all the necessary functionality?
Indeed.
> Why
> weren't we seeing problems with this before?
This was causing a side-effect visible only by mochitests. The side-effect was noticed with a new test was executed after this one.
> @@ -52,5 @@
> > SimpleTest.ok(msg.data.condition, msg.data.description);
> > return;
> > case "finish":
> > - delete OS.File.Error; // Avoid leak
> > - OS.File = null;
>
> Why does this need to go away?
Well, this was the side-effect. Changing the contents of a module seems bad policy.
Comment 4•13 years ago
|
||
(In reply to David Rajchenbach Teller [:Yoric] from comment #3)
> (In reply to Nathan Froyd (:froydnj) from comment #2)
> > Just to double-check my own understanding here: this code wasn't importing
> > everything that was needed to create OS.File, whereas
> > //gre/modules/osfile.jsm does import all the necessary functionality?
>
> Indeed.
>
> > Why
> > weren't we seeing problems with this before?
>
> This was causing a side-effect visible only by mochitests. The side-effect
> was noticed with a new test was executed after this one.
"This" being the not-quite-complete import, or "this" being the effective deletion of OS.File below? If the former, then the question stands: why was the not-quite-complete import not noticed before, since presumably we were testing all of OS.File? If the latter, why is that necessarily a problem, as the tests should be importing OS.File anew each time, correct?
I guess I can see one hunk or the other addressing a problem, but I do not understand why both of them are needed; I'm not clear on why either one needs to be deleted at all.
> > @@ -52,5 @@
> > > SimpleTest.ok(msg.data.condition, msg.data.description);
> > > return;
> > > case "finish":
> > > - delete OS.File.Error; // Avoid leak
> > > - OS.File = null;
> >
> > Why does this need to go away?
>
> Well, this was the side-effect. Changing the contents of a module seems bad
> policy.
It's not the greatest policy, but when I see things marked for "Avoid leak" getting deleted, I'd like to understand why that comment is no longer true.
| Assignee | ||
Comment 5•13 years ago
|
||
(In reply to Nathan Froyd (:froydnj) from comment #4)
> "This" being the not-quite-complete import, or "this" being the effective
> deletion of OS.File below? If the former, then the question stands: why was
> the not-quite-complete import not noticed before, since presumably we were
> testing all of OS.File? If the latter, why is that necessarily a problem,
> as the tests should be importing OS.File anew each time, correct?
The problem was due to the deletion below. The deletion itself was necessary to avoid a leak due to the not-quite-complete import. And the not-quite-complete import was required because the module was not written yet. Now that the module is written, we can remove the hack and all its complications.
Finally, the problem was contagious to other instances of mochitest but not to other clients of OS.File running in their own modules, for reasons I can only imagine, but that might be related to compartment stuff. The problem would certainly have been noticed earlier if test_osfile_comms.xul had been executed before test_osfile_async.xul.
> I guess I can see one hunk or the other addressing a problem, but I do not
> understand why both of them are needed; I'm not clear on why either one
> needs to be deleted at all.
> > Well, this was the side-effect. Changing the contents of a module seems bad
> > policy.
>
> It's not the greatest policy, but when I see things marked for "Avoid leak"
> getting deleted, I'd like to understand why that comment is no longer true.
Well, with a proper module instead of an object hacked together from several compartments, things are "a little" tidier. So the default module cleanup works nicely.
Comment 6•13 years ago
|
||
(In reply to David Rajchenbach Teller [:Yoric] from comment #5)
> Now that the module is written, we can remove the hack and all its
> complications.
>
> Finally, the problem was contagious to other instances of mochitest but not
> to other clients of OS.File running in their own modules, for reasons I can
> only imagine, but that might be related to compartment stuff. The problem
> would certainly have been noticed earlier if test_osfile_comms.xul had been
> executed before test_osfile_async.xul.
OK, I can buy some weirdness because we run all the tests in one browser instance. r=me, let's get this in so other people won't get bitten by the same problem.
| Assignee | ||
Updated•13 years ago
|
Keywords: checkin-needed
Comment 7•13 years ago
|
||
Flags: in-testsuite-
Keywords: checkin-needed
Comment 8•13 years ago
|
||
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla19
Updated•2 years ago
|
Product: Toolkit → Toolkit Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•