Last Comment Bug 671635 - [Windows] "ASSERTION: This is unsafe! Fix the caller!" on startup
: [Windows] "ASSERTION: This is unsafe! Fix the caller!" on startup
Status: RESOLVED FIXED
: regression
Product: Core
Classification: Components
Component: General (show other bugs)
: Trunk
: All All
: P1 normal (vote)
: mozilla8
Assigned To: Boris Zbarsky [:bz]
:
Mentors:
: 626529 (view as bug list)
Depends on:
Blocks: 404077 648045
  Show dependency treegraph
 
Reported: 2011-07-14 13:03 PDT by Jesse Ruderman
Modified: 2011-09-30 11:18 PDT (History)
12 users (show)
bzbarsky: in‑testsuite?
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Set chrome margins off a scriptrunner. (2.30 KB, patch)
2011-08-02 13:17 PDT, Boris Zbarsky [:bz]
bugs: review+
Details | Diff | Review

Description Jesse Ruderman 2011-07-14 13:03:11 PDT
###!!! ASSERTION: This is unsafe! Fix the caller!: 'Error', file e:/builds/moz2_slave/m-cen-w32-dbg/build/content/events/src/nsEventDispatcher.cpp, line 549

I get this just starting up Firefox on Windows, with a fresh profile.

It also shows up on Tinderbox, at least for Mochitest:
http://tinderbox.mozilla.org/showlog.cgi?log=Firefox/1310671623.1310672885.22199.gz&fulltext=1
Comment 1 Kyle Huey [:khuey] (khuey@mozilla.com) (Away until 6/13) 2011-07-14 13:04:39 PDT
Ha, I was wondering if I was the only one seeing this locally!
Comment 2 Olli Pettay [:smaug] 2011-07-14 14:01:58 PDT
Does anyone have a stack trace for this?
Comment 3 Kyle Huey [:khuey] (khuey@mozilla.com) (Away until 6/13) 2011-07-14 14:04:52 PDT
>	xul.dll!RealBreak()  Line 422	C++
 	xul.dll!Break(const char * aMsg=0x00159274)  Line 521	C++
 	xul.dll!NS_DebugBreak_P(unsigned int aSeverity=0x00000001, const char * aStr=0x5ec0ad18, const char * aExpr=0x5ec0ad10, const char * aFile=0x5ec0acd0, int aLine=0x00000225)  Line 380 + 0xc bytes	C++
 	xul.dll!nsEventDispatcher::Dispatch(nsISupports * aTarget=0x05204128, nsPresContext * aPresContext=0x05f03fd8, nsEvent * aEvent=0x0921f9b0, nsIDOMEvent * aDOMEvent=0x0921f940, nsEventStatus * aEventStatus=0x0015984c, nsDispatchingCallback * aCallback=0x00000000, nsCOMArray<nsIDOMEventTarget> * aTargets=0x00000000)  Line 549 + 0x1b bytes	C++
 	xul.dll!nsEventDispatcher::DispatchDOMEvent(nsISupports * aTarget=0x05204128, nsEvent * aEvent=0x00000000, nsIDOMEvent * aDOMEvent=0x0921f940, nsPresContext * aPresContext=0x05f03fd8, nsEventStatus * aEventStatus=0x0015984c)  Line 735 + 0x1d bytes	C++
 	xul.dll!nsGlobalWindow::DispatchEvent(nsIDOMEvent * aEvent=0x0921f940, int * aRetVal=0x00159900)  Line 7275 + 0x24 bytes	C++
 	xul.dll!nsGlobalWindow::DispatchEvent(nsIDOMEvent * aEvent=0x0921f940, int * aRetVal=0x00159900)  Line 7258 + 0x61 bytes	C++
 	xul.dll!nsContentUtils::DispatchTrustedEvent(nsIDocument * aDoc=0x05ee7fb0, nsISupports * aTarget=0x05204178, const nsAString_internal & aEventName={...}, int aCanBubble=0x00000001, int aCancelable=0x00000001, int * aDefaultAction=0x00159900)  Line 3034 + 0x3a bytes	C++
 	xul.dll!nsGlobalWindow::DispatchCustomEvent(const char * aEventName=0x5f022eec)  Line 4309 + 0x57 bytes	C++
 	xul.dll!nsWebShellWindow::HandleEvent(nsGUIEvent * aEvent=0x00159b30)  Line 401	C++
 	xul.dll!nsWindow::DispatchEvent(nsGUIEvent * event=0x00159b30, nsEventStatus & aStatus=nsEventStatus_eIgnore)  Line 3542 + 0xc bytes	C++
 	xul.dll!nsWindow::DispatchWindowEvent(nsGUIEvent * event=0x00159b30)  Line 3573	C++
 	xul.dll!nsWindow::OnWindowPosChanged(tagWINDOWPOS * wp=0x0015a3f8, int & result=0x00000000)  Line 5989 + 0x1a bytes	C++
 	xul.dll!nsWindow::ProcessMessage(unsigned int msg=0x00000047, unsigned int & wParam=0x00000000, long & lParam=0x0015a3f8, long * aRetValue=0x0015a21c)  Line 5203	C++
 	xul.dll!nsWindow::WindowProcInternal(HWND__ * hWnd=0x00080580, unsigned int msg=0x00000047, unsigned int wParam=0x00000000, long lParam=0x0015a3f8)  Line 4403 + 0x20 bytes	C++
 	xul.dll!CallWindowProcCrashProtected(long (HWND__ *, unsigned int, unsigned int, long)* wndProc=0x5e1e9530, HWND__ * hWnd=0x00080580, unsigned int msg=0x00000047, unsigned int wParam=0x00000000, long lParam=0x0015a3f8)  Line 65 + 0x13 bytes	C++
 	xul.dll!nsWindow::WindowProc(HWND__ * hWnd=0x00080580, unsigned int msg=0x00000047, unsigned int wParam=0x00000000, long lParam=0x0015a3f8)  Line 4345 + 0x1a bytes	C++
 	user32.dll!_InternalCallWinProc@20()  + 0x23 bytes	
 	user32.dll!_UserCallWinProcCheckWow@32()  + 0x693 bytes	
 	user32.dll!_DispatchClientMessage@24()  + 0x51 bytes	
 	user32.dll!___fnINLPWINDOWPOS@4()  + 0x2c bytes	
 	ntdll.dll!_KiUserCallbackDispatcher@12()  + 0x2e bytes	
 	user32.dll!_NtUserSetWindowPos@28()  + 0x15 bytes	
 	xul.dll!nsWindow::ResetLayout()  Line 1997	C++
 	xul.dll!nsWindow::UpdateNonClientMargins(int aSizeMode=0x00000000, int aReflowWindow=0x00000001)  Line 2138	C++
 	xul.dll!nsWindow::SetNonClientMargins(nsIntMargin & margins={...})  Line 2167 + 0xc bytes	C++
 	xul.dll!nsXULElement::SetChromeMargins(const nsAString_internal * aValue=0x0015a9a0)  Line 2469	C++
 	xul.dll!nsXULElement::AfterSetAttr(int aNamespaceID=0x00000000, nsIAtom * aName=0x03b26ce0, const nsAString_internal * aValue=0x0015a9a0, int aNotify=0x00000001)  Line 1164	C++
 	xul.dll!nsGenericElement::SetAttrAndNotify(int aNamespaceID=0x00000000, nsIAtom * aName=0x03b26ce0, nsIAtom * aPrefix=0x00000000, const nsAString_internal & aOldValue={...}, nsAttrValue & aParsedValue={...}, unsigned char aModType='', int aFireMutation=0x00000000, int aNotify=0x00000001, const nsAString_internal * aValueForAfterSetAttr=0x0015a9a0)  Line 4537 + 0x26 bytes	C++
 	xul.dll!nsGenericElement::SetAttr(int aNamespaceID=0x00000000, nsIAtom * aName=0x03b26ce0, nsIAtom * aPrefix=0x00000000, const nsAString_internal & aValue={...}, int aNotify=0x00000001)  Line 4436 + 0x39 bytes	C++
 	xul.dll!nsGenericElement::SetAttr(int aNameSpaceID=0x00000000, nsIAtom * aName=0x03b26ce0, const nsAString_internal & aValue={...}, int aNotify=0x00000001)  Line 284	C++
 	xul.dll!nsGenericElement::SetAttribute(const nsAString_internal & aName={...}, const nsAString_internal & aValue={...})  Line 2418 + 0x19 bytes	C++
 	xul.dll!nsXULElement::SetAttribute(const nsAString_internal & name={...}, const nsAString_internal & value={...})  Line 563 + 0x14 bytes	C++
 	xul.dll!nsIDOMElement_SetAttribute(JSContext * cx=0x052043e8, unsigned int argc=0x00000002, jsval_layout * vp=0x04830128)  Line 5619 + 0x23 bytes	C++
 	mozjs.dll!js::CallJSNative(JSContext * cx=0x052043e8, int (JSContext *, unsigned int, js::Value *)* native=0x5deaeb30, const js::CallArgs & args={...})  Line 284 + 0x19 bytes	C++
 	mozjs.dll!js::Invoke(JSContext * cx=0x052043e8, const js::CallArgs & argsRef={...}, js::MaybeConstruct construct=NO_CONSTRUCT)  Line 656 + 0x14 bytes	C++
 	mozjs.dll!js::Interpret(JSContext * cx=0x052043e8, js::StackFrame * entryFrame=0x04830058, js::InterpMode interpMode=JSINTERP_NORMAL)  Line 4084 + 0x12 bytes	C++
 	mozjs.dll!js::RunScript(JSContext * cx=0x052043e8, JSScript * script=0x05f22e70, js::StackFrame * fp=0x04830058)  Line 613 + 0xf bytes	C++
 	mozjs.dll!js::Invoke(JSContext * cx=0x052043e8, const js::CallArgs & argsRef={...}, js::MaybeConstruct construct=NO_CONSTRUCT)  Line 686 + 0x11 bytes	C++
 	mozjs.dll!js::Invoke(JSContext * cx=0x052043e8, js::InvokeArgsGuard & args={...}, js::MaybeConstruct construct=NO_CONSTRUCT)  Line 169 + 0x1a bytes	C++
 	mozjs.dll!js::ExternalInvoke(JSContext * cx=0x052043e8, const js::Value & thisv={...}, const js::Value & fval={...}, unsigned int argc=0x00000001, js::Value * argv=0x08f626c0, js::Value * rval=0x0015bd94)  Line 805 + 0xf bytes	C++
 	mozjs.dll!JS_CallFunctionValue(JSContext * cx=0x052043e8, JSObject * obj=0x04dc5e98, jsval_layout fval={...}, unsigned int argc=0x00000001, jsval_layout * argv=0x08f626c0, jsval_layout * rval=0x0015bd94)  Line 5063 + 0x45 bytes	C++
 	xul.dll!nsJSContext::CallEventHandler(nsISupports * aTarget=0x05232f80, void * aScope=0x04dc5e98, void * aHandler=0x053489a8, nsIArray * aargv=0x0522e558, nsIVariant * * arv=0x0015bfd0)  Line 1907 + 0x2e bytes	C++
 	xul.dll!nsJSEventListener::HandleEvent(nsIDOMEvent * aEvent=0x06258da0)  Line 224 + 0x64 bytes	C++
 	xul.dll!nsEventListenerManager::HandleEventSubType(nsListenerStruct * aListenerStruct=0x06492ea0, nsIDOMEventListener * aListener=0x05f21228, nsIDOMEvent * aDOMEvent=0x06258da0, nsIDOMEventTarget * aCurrentTarget=0x05232f8c, unsigned int aPhaseFlags=0x00000006, nsCxPusher * aPusher=0x0015c36c)  Line 1080 + 0x12 bytes	C++
 	xul.dll!nsEventListenerManager::HandleEventInternal(nsPresContext * aPresContext=0x05f03fd8, nsEvent * aEvent=0x0015c474, nsIDOMEvent * * aDOMEvent=0x0015c35c, nsIDOMEventTarget * aCurrentTarget=0x05232f8c, unsigned int aFlags=0x00000006, nsEventStatus * aEventStatus=0x0015c360, nsCxPusher * aPusher=0x0015c36c)  Line 1179 + 0x27 bytes	C++
 	xul.dll!nsEventListenerManager::HandleEvent(nsPresContext * aPresContext=0x05f03fd8, nsEvent * aEvent=0x0015c474, nsIDOMEvent * * aDOMEvent=0x0015c35c, nsIDOMEventTarget * aCurrentTarget=0x05232f8c, unsigned int aFlags=0x00000006, nsEventStatus * aEventStatus=0x0015c360, nsCxPusher * aPusher=0x0015c36c)  Line 156	C++
 	xul.dll!nsEventTargetChainItem::HandleEvent(nsEventChainPostVisitor & aVisitor={...}, unsigned int aFlags=0x00000006, int aMayHaveNewListenerManagers=0x00000000, nsCxPusher * aPusher=0x0015c36c)  Line 216	C++
 	xul.dll!nsEventTargetChainItem::HandleEventTargetChain(nsEventChainPostVisitor & aVisitor={...}, unsigned int aFlags=0x00000006, nsDispatchingCallback * aCallback=0x00000000, int aMayHaveNewListenerManagers=0x00000000, nsCxPusher * aPusher=0x0015c36c)  Line 346	C++
 	xul.dll!nsEventDispatcher::Dispatch(nsISupports * aTarget=0x05204128, nsPresContext * aPresContext=0x05f03fd8, nsEvent * aEvent=0x0015c474, nsIDOMEvent * aDOMEvent=0x00000000, nsEventStatus * aEventStatus=0x0015c470, nsDispatchingCallback * aCallback=0x00000000, nsCOMArray<nsIDOMEventTarget> * aTargets=0x00000000)  Line 672 + 0x21 bytes	C++
 	xul.dll!DocumentViewerImpl::LoadComplete(unsigned int aStatus=0x00000000)  Line 1067 + 0x23 bytes	C++
 	xul.dll!nsDocShell::EndPageLoad(nsIWebProgress * aProgress=0x05202fdc, nsIChannel * aChannel=0x052e0d38, unsigned int aStatus=0x00000000)  Line 6162	C++
 	xul.dll!nsDocShell::OnStateChange(nsIWebProgress * aProgress=0x05202fdc, nsIRequest * aRequest=0x052e0d38, unsigned int aStateFlags=0x00020010, unsigned int aStatus=0x00000000)  Line 5998	C++
 	xul.dll!nsDocLoader::FireOnStateChange(nsIWebProgress * aProgress=0x05202fdc, nsIRequest * aRequest=0x052e0d38, int aStateFlags=0x00020010, unsigned int aStatus=0x00000000)  Line 1340	C++
 	xul.dll!nsDocLoader::doStopDocumentLoad(nsIRequest * request=0x052e0d38, unsigned int aStatus=0x00000000)  Line 958	C++
 	xul.dll!nsDocLoader::DocLoaderIsEmpty(int aFlushLayout=0x00000001)  Line 825	C++
 	xul.dll!nsDocLoader::ChildDoneWithOnload(nsIDocumentLoader * aChild=0x06629c00)  Line 205	C++
 	xul.dll!nsDocLoader::DocLoaderIsEmpty(int aFlushLayout=0x00000001)  Line 829	C++
 	xul.dll!nsDocLoader::OnStopRequest(nsIRequest * aRequest=0x091d1fd8, nsISupports * aCtxt=0x00000000, unsigned int aStatus=0x00000000)  Line 710	C++
 	xul.dll!nsLoadGroup::RemoveRequest(nsIRequest * request=0x091d1fd8, nsISupports * ctxt=0x00000000, unsigned int aStatus=0x00000000)  Line 734 + 0x31 bytes	C++
 	xul.dll!nsDocument::DoUnblockOnload()  Line 7218	C++
 	xul.dll!nsDocument::UnblockOnload(int aFireSync=0x00000001)  Line 7159	C++
 	xul.dll!nsDocument::DispatchContentLoadedEvents()  Line 4205	C++
 	xul.dll!nsRunnableMethodImpl<void (__thiscall nsDocument::*)(void),1>::Run()  Line 342	C++
 	xul.dll!nsThread::ProcessNextEvent(int mayWait=0x00000000, int * result=0x0015cec4)  Line 617 + 0x19 bytes	C++
 	xul.dll!NS_ProcessNextEvent_P(nsIThread * thread=0x00919188, int mayWait=0x00000000)  Line 245 + 0x16 bytes	C++
 	xul.dll!mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate * aDelegate=0x009149d0)  Line 110 + 0xe bytes	C++
 	xul.dll!MessageLoop::RunInternal()  Line 219	C++
 	xul.dll!MessageLoop::RunHandler()  Line 203	C++
 	xul.dll!MessageLoop::Run()  Line 177	C++
 	xul.dll!nsBaseAppShell::Run()  Line 191	C++
 	xul.dll!nsAppShell::Run()  Line 256 + 0x9 bytes	C++
 	xul.dll!nsAppStartup::Run()  Line 222 + 0x1c bytes	C++
 	xul.dll!XRE_main(int argc=0x00000004, char * * argv=0x00297578, const nsXREAppData * aAppData=0x0029e778)  Line 3577 + 0x25 bytes	C++
 	firefox.exe!do_main(const char * exePath=0x0015f834, int argc=0x00000004, char * * argv=0x00297578)  Line 198 + 0x12 bytes	C++
 	firefox.exe!NS_internal_main(int argc=0x00000004, char * * argv=0x00297578)  Line 281 + 0x14 bytes	C++
 	firefox.exe!wmain(int argc=0x00000004, wchar_t * * argv=0x00291cc0)  Line 107 + 0xd bytes	C++
 	firefox.exe!__tmainCRTStartup()  Line 552 + 0x19 bytes	C
 	firefox.exe!wmainCRTStartup()  Line 371	C
 	kernel32.dll!@BaseThreadInitThunk@12()  + 0x12 bytes	
 	ntdll.dll!___RtlUserThreadStart@8()  + 0x27 bytes	
 	ntdll.dll!__RtlUserThreadStart@8()  + 0x1b bytes
Comment 4 Olli Pettay [:smaug] 2011-07-14 14:18:25 PDT
The interesting part starts from nsXULElement::AfterSetAttr.
Somehow setting margins makes windows to process next message.
I think bz' changes to nsGlobalWindow::DispatchCustomEvent may have
somehow caused this to become visible, but I believe the bug has been
there for a long time.
The right fix for this could be to make nsXULElement::AfterSetAttr do things
in a script runner.
Comment 5 Boris Zbarsky [:bz] 2011-07-25 22:00:38 PDT
> I think bz' changes to nsGlobalWindow::DispatchCustomEvent may have
> somehow caused this to become visible

What caused this to become visible is that we now fire a DOM sizemodechange event when we get an NS_SIZEMODE event passed to nsWebShellWindow.  This was added in bug 648045.

I'm not sure whether it's safer to do that event dispatch off a script runner or to make the SetNonClientMargins call off a script runner.... The former would sort of restore the (unsafe, agreed) status quo ante, while the latter would have a slightly higher regression risk.

It doesn't help that I don't have an up to date Windows build right now; does someone who has one want to take this?
Comment 6 Boris Zbarsky [:bz] 2011-08-02 13:17:52 PDT
Created attachment 550178 [details] [diff] [review]
Set chrome margins off a scriptrunner.
Comment 7 Olli Pettay [:smaug] 2011-08-02 15:02:18 PDT
Comment on attachment 550178 [details] [diff] [review]
Set chrome margins off a scriptrunner.


>+class MarginSetter : public nsRunnable {
{ should be in the next line
Comment 8 Boris Zbarsky [:bz] 2011-08-02 20:46:22 PDT
Did that.
Comment 10 Marco Bonardo [::mak] 2011-08-04 03:06:08 PDT
http://hg.mozilla.org/mozilla-central/rev/bb97ea5737a4
Comment 11 Olli Pettay [:smaug] 2011-09-30 11:18:49 PDT
*** Bug 626529 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.