Open Bug 207610 Opened 21 years ago Updated 2 years ago

NS_ENSURE_TRUE(globalObject) failed, file i:/build/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp, line 1072

Categories

(Core :: DOM: Navigation, defect)

x86
Windows 2000
defect

Tracking

()

People

(Reporter: timeless, Unassigned)

Details

Attachments

(1 file)

debug build from around 1.4 freeze (with various modifications, but none near
webshell, and not many interesting near esm)

1. i run mozilla
1' i get the profile manager
1` i have to create a profile
2. i create profile 'debug' which mozilla binds to a preexisting profile directory.
3. i start the 'debug' profile
3' i get this warning

WARNING: NS_ENSURE_TRUE(globalObject) failed, file
i:/build/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp, line 1072

nsWebShellWindow::ConvertWebShellToDOMWindow(nsWebShellWindow * const
0x03b5c670, nsIWebShell * 0x03b58e68, nsIDOMWindowInternal * * 0x0012d4d0) line
1072 + 33 bytes
nsWebShellWindow::HandleEvent(nsGUIEvent * 0x0012d5ac) line 566 + 47 bytes
nsWindow::DispatchEvent(nsWindow * const 0x010aec74, nsGUIEvent * 0x0012d5ac,
nsEventStatus & nsEventStatus_eIgnore) line 1056 + 10 bytes
nsWindow::DispatchWindowEvent(nsGUIEvent * 0x0012d5ac) line 1077
nsWindow::DispatchFocus(unsigned int 105, int 1) line 5395 + 15 bytes
nsWindow::ProcessMessage(unsigned int 7, unsigned int 5572952, long 0, long *
0x0012d9cc) line 4138 + 23 bytes
nsWindow::WindowProc(HWND__ * 0x004009fc, unsigned int 7, unsigned int 5572952,
long 0) line 1350 + 27 bytes
USER32! SetTimer + 1077 bytes
USER32! GetMonitorInfoW + 156 bytes
USER32! GetMonitorInfoW + 222 bytes
NTDLL! KiUserCallbackDispatcher + 19 bytes
nsView::~nsView() line 170
nsView::`scalar deleting destructor'(unsigned int 1) + 15 bytes
nsView::Destroy(nsView * const 0x03c69670) line 262 + 34 bytes
nsFrame::Destroy(nsFrame * const 0x03d1c410, nsIPresContext * 0x03c05ab0) line 649
nsSplittableFrame::Destroy(nsSplittableFrame * const 0x03d1c410, nsIPresContext
* 0x03c05ab0) line 72
nsContainerFrame::Destroy(nsContainerFrame * const 0x03d1c410, nsIPresContext *
0x03c05ab0) line 144
ViewportFrame::Destroy(ViewportFrame * const 0x03d1c410, nsIPresContext *
0x03c05ab0) line 68
FrameManager::Destroy(FrameManager * const 0x03c6caa0) line 517
PresShell::Destroy(PresShell * const 0x03c93ca0) line 1843
DocumentViewerImpl::Destroy(DocumentViewerImpl * const 0x03c0df78) line 1135
nsDocShell::Destroy(nsDocShell * const 0x03b58d34) line 3038
nsWebShell::Destroy(nsWebShell * const 0x03b58d34) line 1354
nsXULWindow::Destroy(nsXULWindow * const 0x03b5c610) line 410
nsWebShellWindow::Destroy(nsWebShellWindow * const 0x03b5c610) line 1659 + 9 bytes
nsChromeTreeOwner::Destroy(nsChromeTreeOwner * const 0x03b9198c) line 292
GlobalWindowImpl::ReallyCloseWindow(GlobalWindowImpl * const 0x01092cf8) line 3374
GlobalWindowImpl::CloseWindow(nsISupports * 0x01092ce4) line 4605
nsJSContext::ScriptEvaluated(nsJSContext * const 0x03b7d028, int 1) line 1551 +
18 bytes
nsJSContext::CallEventHandler(nsJSContext * const 0x03b7d028, void * 0x0b3558b8,
void * 0x0b356cd0, unsigned int 1, void * 0x0012deec, int * 0x0012def0, int 0)
line 1119
nsJSEventListener::HandleEvent(nsJSEventListener * const 0x03d1bbc0, nsIDOMEvent
* 0x0b5223c8) line 181 + 77 bytes
nsEventListenerManager::HandleEventSubType(nsListenerStruct * 0x03d1bca0,
nsIDOMEvent * 0x0b5223c8, nsIDOMEventTarget * 0x0b522468, unsigned int 8,
unsigned int 7) line 1191 + 20 bytes
nsEventListenerManager::HandleEvent(nsEventListenerManager * const 0x03d1bb48,
nsIPresContext * 0x03c05ab0, nsEvent * 0x0012e9cc, nsIDOMEvent * * 0x0012e948,
nsIDOMEventTarget * 0x0b522468, unsigned int 7, nsEventStatus * 0x0012ea14) line
2190 + 36 bytes
nsXULElement::HandleDOMEvent(nsXULElement * const 0x03d1bad0, nsIPresContext *
0x03c05ab0, nsEvent * 0x0012e9cc, nsIDOMEvent * * 0x0012e948, unsigned int 7,
nsEventStatus * 0x0012ea14) line 3302
PresShell::HandleDOMEventWithTarget(PresShell * const 0x03c93ca0, nsIContent *
0x03d1bad0, nsEvent * 0x0012e9cc, nsEventStatus * 0x0012ea14) line 6458 + 39 bytes
nsButtonBoxFrame::MouseClicked(nsIPresContext * 0x03c05ab0, nsGUIEvent *
0x0012ee74) line 186
nsButtonBoxFrame::HandleEvent(nsButtonBoxFrame * const 0x0b3a4a70,
nsIPresContext * 0x03c05ab0, nsGUIEvent * 0x0012ee74, nsEventStatus *
0x0012eca0) line 138
PresShell::HandleEventInternal(nsEvent * 0x0012ee74, nsIView * 0x03c69670,
unsigned int 1, nsEventStatus * 0x0012eca0) line 6424 + 38 bytes
PresShell::HandleEvent(PresShell * const 0x03c93ca4, nsIView * 0x03c69670,
nsGUIEvent * 0x0012ee74, nsEventStatus * 0x0012eca0, int 1, int & 1) line 6288 +
25 bytes
nsViewManager::HandleEvent(nsView * 0x03c69670, nsGUIEvent * 0x0012ee74, int 0)
line 2270
nsView::HandleEvent(nsViewManager * 0x03c69128, nsGUIEvent * 0x0012ee74, int 0)
line 308
nsViewManager::DispatchEvent(nsViewManager * const 0x03c69128, nsGUIEvent *
0x0012ee74, nsEventStatus * 0x0012ede4) line 2046 + 23 bytes
HandleEvent(nsGUIEvent * 0x0012ee74) line 82
nsWindow::DispatchEvent(nsWindow * const 0x03c69774, nsGUIEvent * 0x0012ee74,
nsEventStatus & nsEventStatus_eIgnore) line 1056 + 10 bytes
nsWindow::DispatchWindowEvent(nsGUIEvent * 0x0012ee74) line 1077
nsWindow::DispatchKeyEvent(unsigned int 132, unsigned short 0, unsigned int 32,
long -1070006271) line 2928 + 15 bytes
nsWindow::OnKeyUp(unsigned int 32, unsigned int 49209, long -1070006271) line
3033 + 26 bytes
nsWindow::ProcessMessage(unsigned int 257, unsigned int 32, long -1070006271,
long * 0x0012f2dc) line 3866 + 38 bytes
nsWindow::WindowProc(HWND__ * 0x00550958, unsigned int 257, unsigned int 32,
long -1070006271) line 1350 + 27 bytes
USER32! SetTimer + 1077 bytes
USER32! DispatchMessageW + 278 bytes
USER32! DispatchMessageW + 11 bytes
nsXULWindow::ShowModal(nsXULWindow * const 0x03b5c618) line 298
nsWebShellWindow::ShowModal(nsWebShellWindow * const 0x03b5c618) line 1095
nsContentTreeOwner::ShowAsModal(nsContentTreeOwner * const 0x03bd63cc) line 447
nsWindowWatcher::OpenWindowJS(nsWindowWatcher * const 0x03b54afc, nsIDOMWindow *
0x00000000, const char * 0x01082288, const char * 0x0735ea0c, const char *
0x0735e614, int 1, unsigned int 1, long * 0x0107e2b0, nsIDOMWindow * *
0x0012fa20) line 796
nsWindowWatcher::OpenWindow(nsWindowWatcher * const 0x03b54af8, nsIDOMWindow *
0x00000000, const char * 0x01082288, const char * 0x0735ea0c, const char *
0x0735e614, nsISupports * 0x01082300, nsIDOMWindow * * 0x0012fa20) line 457 + 48
bytes
nsProfile::LoadDefaultProfileDir(nsCString &
{"chrome://communicator/content/profile/profileSelection.xul"}, int 1) line 540
+ 93 bytes
nsProfile::StartupWithArgs(nsProfile * const 0x0108e898, nsICmdLineService *
0x03b75660, int 1) line 356 + 16 bytes
nsAppShellService::DoProfileStartup(nsAppShellService * const 0x03b5c8a8,
nsICmdLineService * 0x03b75660, int 1) line 268 + 31 bytes
InitializeProfileService(nsICmdLineService * 0x03b75660) line 905 + 31 bytes
main1(int 1, char * * 0x004443d0, nsISupports * 0x0105a110) line 1180 + 14 bytes

see also bug 80207.

This looks pretty simple, it's also reproducable for me.

What's happening is the profile manager window is going away and as it goes away
windows passes a message to us and we pass the message to the dying window.
Profile related?
This happens (three times) to the Profile Manager window every time you close
it, regardless of whether you've created a new profile (so the 3rd and 4th
steps (ummmm, numbered 1` and 2) are unnecessary). It happens to other windows
as well: Preferences, for instance. But there are many windows it doesn't
happen to (Browser, for example). Which is curious; I'd expect it to be very
common.

The sequence is:
1) Begin tearing down the outermost window
1-1) Begin tearing down that window's docshell
1-1-1) Mark that nsDocShell as being torn down (mIsBeingDestroyed=PR_TRUE)
1-1-2) Destroy the OS Window corresponding to the main OS window's
       client area
1-1-2-1) The OS sends a WM_SETFOCUS message to the destroyed window's
	 containing window
1-1-2-1-1) During our processing of the WM_SETFOCUS message we want the
	   script global object from the corresponding docshell
2) The docshell still has a valid scripting environment but it refuses to
   hand it out; see step 1-1-1

Which seems fine to me. There's nothing in that sequence that wants fixing.

But in the interest of reducing pointless debugging spew, the attached patch
gets rid of the NS_ENSURE_TRUE warning in this case. It also initializes
ConvertWebShellToDOMWindow's return parameter to 0, a step missing from the
current code. This would have caused some nasty crashes had this method ever
returned a failure notification (as it is here) to a caller which hadn't
pre-initialized the return parameter. It happens that nsCOMPtr is rescuing us
in this case.
Assignee: adamlock → nobody
QA Contact: adamlock → docshell
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: