Closed Bug 515595 Opened 15 years ago Closed 13 years ago

Resolve how to initialise layout correctly in xpcshell tests from within gfx especially for non-libxul builds

Categories

(Core :: Graphics, defect)

defect
Not set
major

Tracking

()

RESOLVED INVALID

People

(Reporter: standard8, Unassigned)

References

()

Details

(Keywords: crash, regression)

Attachments

(1 file, 1 obsolete file)

After bug 504034 Thunderbird is seeing test failures in test_nsIScriptableRegion.js due to xpcshell crashing.

I've so far had a quick look in the debugger and it is due to this:

 void* nsRegion::RgnRect::operator new (size_t) CPP_THROW_NEW
 {
-  return gRectPool.Alloc ();
+  return gRectPool->Alloc ();
 }

gRectPool is null. Firefox unit tests don't seem affected by it, but all platforms of Thunderbird do.

This could be a libxul versus non-libxul issue, though I'm not quite sure yet.
I've just reproduced this on my trunk Firefox build with mozconfig:

ac_add_options --enable-application=browser
ac_add_options --enable-debug
ac_add_options --disable-optimize
ac_add_options --enable-extensions=default,inspector
ac_add_options --disable-crashreporter
ac_add_options --enable-tests
Assignee: bugzilla → nobody
Component: General → Graphics
Product: Thunderbird → Core
QA Contact: general → thebes
Summary: test_nsIScriptableRegion.js failures on trunk after bug 504034 (crash, null-dereference) → test_nsIScriptableRegion.js fails on non-libxul builds(?) after bug 504034 (crash, null-dereference)
Further analysis in the debugger shows that:

- nsLayoutStatics::Initialize isn't being called
- nsLayoutModule::Initialize isn't being called

Hence this leads to the nsRegion::InitStatic not being called and hence the crash.
Severity: normal → major
Ok, this is libxul versus non-libxul. If I add the line:

  Components.classes["@mozilla.org/layout/xul-boxobject-tree;1"].createInstance(Components.interfaces.nsIBoxObject);

at the very start of the test, then it passes. That component is registered within nsLayoutModule, whereas the nsRegion ones aren't.
Attached patch Possible fix (obsolete) — Splinter Review
Possible fix by moving the initialisation from nsLayoutStatics to nsThebesGfxFactory - as nsThebesGfxFactory is what nsRegion is obtained from, it seems the better place to do it.

The possible downside to this is that it moves the destruction until after xpcom-shutdown, until the module is destructed - I've no idea if that is a problem or not.

I've pushed the patch to the try server anyway.
Er... we have gfx xpcshell tests?  How does that work with other parts of gfx that are the responsibility of layout to initialize (like textrun stuff)?  That's what we modeled the region change on.

Which thread(s) are the module ctor/dtor called on?
(In reply to comment #5)
> Er... we have gfx xpcshell tests?  How does that work with other parts of gfx
> that are the responsibility of layout to initialize (like textrun stuff)? 
> That's what we modeled the region change on.

Well it is fine if you're doing a libxul build - because everything is in the one library (afaict) which means if you load region, you get layout as well. That just doesn't happen for debug builds.

There is only this one xpcshell test in gfx at the moment which is the failing one - test_nsIScriptableRegion.js

> Which thread(s) are the module ctor/dtor called on?

Well afaik in xpcshell there is only one thread.
I meant in the case that actually necessitated this change: multi-process Gecko-based apps.
So what's the way forward on this. I guess the patch isn't what we want to do, so how about (for now at least) we do what I suggested in comment 3 and add:

> Components.classes["@mozilla.org/layout/xul-boxobject-tree;1"].createInstance(Components.interfaces.nsIBoxObject);

at the start of the test with an appropriate comment?

Then we can determine what to do with xpcshell-tests in gfx in slow time.
I would be fine with the comment 8 workaround while we sort this out, but I'm not a gfx peer.
Flags: blocking1.9.2?
As discussed, this patch works around the test failures that we're seeing on the Thunderbird tinderboxes by making sure layout is loaded before gfx otherwise running this test will fail on all non-libxul builds.

If we take this patch, then I'll change this bug into a "fix initialisation of gfx & layout on non-libxul builds" bug.
Attachment #399706 - Attachment is obsolete: true
Attachment #400561 - Flags: review?
Attachment #400561 - Flags: review? → review?(vladimir)
vlad: ping for review, I'd really like to be able to get the Thunderbird tinderboxes green again.
Comment on attachment 400561 [details] [diff] [review]
[checked in] Workaround for test failure.

Checked in:
http://hg.mozilla.org/mozilla-central/rev/3c3c2efab7e8
Attachment #400561 - Attachment description: Workaround for test failure. → [checked in] Workaround for test failure.
Changing summary to what I think we now want this bug to cover.
Summary: test_nsIScriptableRegion.js fails on non-libxul builds(?) after bug 504034 (crash, null-dereference) → Resolve how to initialise layout correctly in xpcshell tests from within gfx especially for non-libxul builds
Flags: wanted1.9.2+
Flags: blocking1.9.2?
Flags: blocking1.9.2-
I presume the workaround could be removed now that bug 638429 has landed. 

Is this worth me doing; or does it not hugely matter, given it's only for in a test?

Either way, presume this bug is now WONTFIX, if it only affects non-libxul builds?
(In reply to Mark Banner (:standard8) from comment #3)
> Ok, this is libxul versus non-libxul.

As we don't support non-libxul any more, we should close it, then. Please REOPEN if you think this is not correct.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → INVALID
Hum, R.Invalid doesn't seem right with comment 12 workaround still in the tree.
I assume it should be backed out if not needed anymore or its comment should be updated.
Status: RESOLVED → REOPENED
Resolution: INVALID → ---
No it is invalid. Please file another bug for removing the now apparently dead code checked in as a workaround here.
Status: REOPENED → RESOLVED
Closed: 13 years ago13 years ago
Resolution: --- → INVALID
(In reply to Robert Kaiser (:kairo@mozilla.com) from comment #17)
> No it is invalid. Please file another bug for removing the now apparently
> dead code checked in as a workaround here.

I'm not convinced, but I filed bug 707721...
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: