Closed Bug 336096 Opened 18 years ago Closed 18 years ago

"ASSERTION: transaction did not execute properly" involving designMode, execCommand('bold'), XUL

Categories

(Core :: DOM: Editor, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jruderman, Assigned: WeirdAl)

References

Details

(Keywords: assertion, testcase)

Attachments

(3 files, 1 obsolete file)

###!!! ASSERTION: transaction did not execute properly
: '(NS_SUCCEEDED(result))', file /Users/admin/trunk/mozilla/editor/libeditor/base/nsEditor.cpp, line 679

JavaScript error: , line 0: uncaught exception: [Exception... "Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER) [nsIDOMNSHTMLDocument.execCommand]"  nsresult: "0x80004003 (NS_ERROR_INVALID_POINTER)"  location: "JS frame :: transaction.xhtml :: init :: line 19"  data: no]
Attached file testcase
Blocks: 336383
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20060713 SeaMonkey/1.5a

Hardware, OS -> All

This is the stack of why we fail the assertion:

>	editor.dll!ChangeCSSInlineStyleTxn::DoTransaction()  Line 178	C++

Here, we've just QI'd mElement to inlineStyles, but the QI returned null.  Note this happens on the second transaction to go through the editor.

 	txmgr.dll!nsTransactionItem::DoTransaction()  Line 180 + 0x14 bytes	C++
 	txmgr.dll!nsTransactionManager::BeginTransaction(nsITransaction * aTransaction=0x03562ed8)  Line 1071 + 0xd bytes	C++
 	txmgr.dll!nsTransactionManager::DoTransaction(nsITransaction * aTransaction=0x03562ed8)  Line 132 + 0x14 bytes	C++
 	editor.dll!nsEditor::DoTransaction(nsITransaction * aTxn=0x03562ed8)  Line 659 + 0x20 bytes	C++
 	editor.dll!nsHTMLCSSUtils::SetCSSProperty(nsIDOMElement * aElement=0x0385697c, nsIAtom * aProperty=0x00934d28, const nsAString_internal & aValue={...}, int aSuppressTransaction=0x00000000)  Line 475 + 0x16 bytes	C++
 	editor.dll!nsHTMLCSSUtils::SetCSSEquivalentToHTMLStyle(nsIDOMNode * aNode=0x0385697c, nsIAtom * aHTMLProperty=0x00934668, const nsAString_internal * aAttribute=0x0012e72c, const nsAString_internal * aValue=0x0012e73c, int * aCount=0x0012e48c, int aSuppressTransaction=0x00000000)  Line 1015 + 0x2d bytes	C++
 	editor.dll!nsHTMLEditor::SetInlinePropertyOnNode(nsIDOMNode * aNode=0x0385697c, nsIAtom * aProperty=0x00934668, const nsAString_internal * aAttribute=0x0012e72c, const nsAString_internal * aValue=0x0012e73c)  Line 426 + 0x32 bytes	C++
 	editor.dll!nsHTMLEditor::SetInlineProperty(nsIAtom * aProperty=0x00934668, const nsAString_internal & aAttribute={...}, const nsAString_internal & aValue={...})  Line 262 + 0x26 bytes	C++
 	composer.dll!SetTextProperty(nsIEditor * aEditor=0x03855ea8, const unsigned short * prop=0x0012e860, const unsigned short * attr=0x00000000, const unsigned short * value=0x00000000)  Line 1719 + 0x66 bytes	C++
 	composer.dll!nsStyleUpdatingCommand::ToggleState(nsIEditor * aEditor=0x03855ea8, const char * aTagName=0x04376d2c)  Line 295 + 0x19 bytes	C++
 	composer.dll!nsBaseStateUpdatingCommand::DoCommand(const char * aCommandName=0x0012ea30, nsISupports * refCon=0x03855ea8)  Line 124 + 0x1d bytes	C++
 	embedcomponents.dll!nsControllerCommandTable::DoCommand(const char * aCommandName=0x0012ea30, nsISupports * aCommandRefCon=0x03855ea8)  Line 191 + 0x21 bytes	C++
 	embedcomponents.dll!nsBaseCommandController::DoCommand(const char * aCommand=0x0012ea30)  Line 169 + 0x24 bytes	C++
 	embedcomponents.dll!nsCommandManager::DoCommand(const char * aCommandName=0x0012ea30, nsICommandParams * aCommandParams=0x00000000, nsIDOMWindow * aTargetWindow=0x0387cbd8)  Line 256 + 0x1d bytes	C++
 	gklayout.dll!nsHTMLDocument::ExecCommand(const nsAString_internal & commandID={...}, int doShowUI=0x00000000, const nsAString_internal & value={...}, int * _retval=0x0012ec78)  Line 4094 + 0x3a bytes	C++
 	xpcom_core.dll!XPTC_InvokeByIndex(nsISupports * that=0x0012ebec, unsigned int methodIndex=0x0012edd0, unsigned int paramCount=0x00ca23d1, nsXPTCVariant * params=0x03569490)  Line 102	C++
 	xpc3250.dll!AutoJSSuspendRequest::SuspendRequest()  Line 3205 + 0xd bytes	C++
 	xpc3250.dll!XPCWrappedNative::CallMethod(XPCCallContext & ccx={...}, XPCWrappedNative::CallMode mode=CALL_METHOD)  Line 2154 + 0x1e bytes	C++
 	xpc3250.dll!XPC_WN_CallMethod(JSContext * cx=0x034a1300, JSObject * obj=0x038c4268, unsigned int argc=0x00000003, long * argv=0x038e4074, long * vp=0x0012ef18)  Line 1450 + 0xe bytes	C++
 	js3250.dll!js_Invoke(JSContext * cx=0x034a1300, unsigned int argc=0x00000003, unsigned int flags=0x00000000)  Line 1349 + 0x20 bytes	C
 	js3250.dll!js_Interpret(JSContext * cx=0x034a1300, unsigned char * pc=0x0387d96c, long * result=0x0012faa4)  Line 4083 + 0xf bytes	C
 	js3250.dll!js_Invoke(JSContext * cx=0x034a1300, unsigned int argc=0x00000001, unsigned int flags=0x00000002)  Line 1368 + 0x13 bytes	C
 	js3250.dll!js_InternalInvoke(JSContext * cx=0x034a1300, JSObject * obj=0x03492cd8, long fval=0x0353fcf8, unsigned int flags=0x00000000, unsigned int argc=0x00000001, long * argv=0x038ca878, long * rval=0x0012fbf8)  Line 1447 + 0x14 bytes	C
 	js3250.dll!JS_CallFunctionValue(JSContext * cx=0x034a1300, JSObject * obj=0x03492cd8, long fval=0x0353fcf8, unsigned int argc=0x00000001, long * argv=0x038ca878, long * rval=0x0012fbf8)  Line 4385 + 0x1f bytes	C
 	gklayout.dll!nsJSContext::CallEventHandler(nsISupports * aTarget=0x03891030, void * aScope=0x03492cd8, void * aHandler=0x0353fcf8, nsIArray * aargv=0x038c9d64, nsIVariant * * arv=0x0012fcb0)  Line 1731 + 0x21 bytes	C++
 	gklayout.dll!nsGlobalWindow::RunTimeout(nsTimeout * aTimeout=0x038c9e60)  Line 6547 + 0xab bytes	C++
 	gklayout.dll!nsGlobalWindow::TimerCallback(nsITimer * aTimer=0x038c9ec8, void * aClosure=0x038c9e60)  Line 6868	C++
 	xpcom_core.dll!nsTimerImpl::Fire()  Line 383 + 0x13 bytes	C++
 	xpcom_core.dll!nsTimerEvent::Run()  Line 458	C++
 	xpcom_core.dll!nsThread::ProcessNextEvent(int mayWait=0x00000001, int * result=0x0012fe04)  Line 483	C++
 	xpcom_core.dll!NS_ProcessNextEvent_P(nsIThread * thread=0x00398d88, int mayWait=0x00000001)  Line 225 + 0x16 bytes	C++
 	gkwidget.dll!nsBaseAppShell::Run()  Line 153 + 0xc bytes	C++
 	appcomps.dll!nsAppStartup::Run()  Line 219	C++
 	seamonkey.exe!main1(int argc=0x00000003, char * * argv=0x00394c30, nsISupports * nativeApp=0x0094dfc0)  Line 1238 + 0x22 bytes	C++
 	seamonkey.exe!main(int argc=0x00000003, char * * argv=0x00394c30)  Line 1740 + 0x25 bytes	C++
 	seamonkey.exe!__tmainCRTStartup()  Line 586 + 0x19 bytes	C
 	seamonkey.exe!mainCRTStartup()  Line 403	C
 	kernel32.dll!7c816d4f() 	
 	[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]	
 	kernel32.dll!7c8399f3() 	
OS: Mac OS X 10.4 → All
Hardware: Macintosh → All
nsCOMPtr<nsIDOMElementCSSInlineStyle> inlineStyles = do_QueryInterface(mElement);

mElement is a XUL hbox with no attributes, so it's probably the second hbox element.

I can't tell you why a <xul:hbox/> wouldn't QI to nsIDOMElementCSSInlineStyle, since the only thing the interface defines is a readonly style property, which nsXULElement does implement:

nsXULElement::GetStyle(nsIDOMCSSStyleDeclaration** aStyle)
Attached patch patch, v1 (obsolete) — Splinter Review
Smaug suggested I create a tearoff, similar to the one in nsGenericHTMLElement.  I did so, and that does fix the assertion.
Assignee: mozeditor → ajvincent
Status: NEW → ASSIGNED
Attachment #229179 - Flags: superreview?(bugmail)
Attachment #229179 - Flags: review?(bugmail)
Comment on attachment 229179 [details] [diff] [review]
patch, v1

>Index: content/xul/content/src/nsXULElement.cpp

>+class nsXULElementTearoff : public nsIDOMElementCSSInlineStyle
>+{
>+  NS_DECL_ISUPPORTS
>+
>+  nsXULElementTearoff(nsXULElement *aElement)
>+    : mElement(aElement)
>+  {
>+    NS_ADDREF(mElement);
>+  }
>+
>+  virtual ~nsXULElementTearoff()
>+  {
>+    NS_RELEASE(mElement);
>+  }
>+
>+  NS_FORWARD_NSIDOMELEMENTCSSINLINESTYLE(mElement->)
>+
>+private:
>+  nsXULElement *mElement;

Make mElement into an nsRefPtr instead (nsRefPtr<nsXULElement>), to avoid the manual refcounting above. That way you can remove the dtor entierly.

r/sr=sicking with that fixed (but please attach a new patch)
Attachment #229179 - Flags: superreview?(bugmail)
Attachment #229179 - Flags: superreview+
Attachment #229179 - Flags: review?(bugmail)
Attachment #229179 - Flags: review+
Comment on attachment 229179 [details] [diff] [review]
patch, v1

Actually, you should add the new interface to nsDOMClassInfo.cpp too. Search for "XULElement"
Attachment #229179 - Flags: superreview-
Attachment #229179 - Flags: superreview+
Attachment #229179 - Flags: review-
Attachment #229179 - Flags: review+
Attached patch patch, v2Splinter Review
Attachment #229179 - Attachment is obsolete: true
Attachment #239251 - Flags: superreview?(bugmail)
Attachment #239251 - Flags: review?(bugmail)
Attachment #239251 - Flags: superreview?(bugmail)
Attachment #239251 - Flags: superreview+
Attachment #239251 - Flags: review?(bugmail)
Attachment #239251 - Flags: review+
I assume you tested setting .style from script on a XUL element? Would be good if you attached a testcase
per request by sicking.  We pass this test too.
Blocks: 353601
checked in by bz, followup bug filed, thanks everyone.
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Tests checked in: my testcase as a crashtest, Alex's testcase as a reftest.
Flags: in-testsuite+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: