Closed Bug 1195273 Opened 5 years ago Closed 5 years ago

MOZ_ASSERT(!mMightHaveUnreportedJSException) via IccContactToMozContact when importing contacts from SIM card


(Firefox OS Graveyard :: RIL, defect)

Gonk (Firefox OS)
Not set


(firefox43 fixed)

FxOS-S6 (04Sep)
Tracking Status
firefox43 --- fixed


(Reporter: gwagner, Assigned: bevis)




(1 file, 1 obsolete file)

On Aries device with debug gecko.

Program received signal SIGSEGV, Segmentation fault.
0xb3fb5146 in mozilla::ErrorResult::~ErrorResult (this=<optimized out>, 
    __in_chrg=<optimized out>) at ../../dist/include/mozilla/ErrorResult.h:58
58	    MOZ_ASSERT(!mMightHaveUnreportedJSException);
(gdb) bt
#0  0xb3fb5146 in mozilla::ErrorResult::~ErrorResult (this=<optimized out>, 
    __in_chrg=<optimized out>) at ../../dist/include/mozilla/ErrorResult.h:58
#1  0xb4a941f0 in mozilla::dom::icc::(anonymous namespace)::IccContactToMozContact (aCx=aCx@entry=0xb1fe53d0, aGlobal=..., aIccContact=<optimized out>, 
    at /Users/gregor/moz/ib2g/dom/icc/IccCallback.cpp:90
#2  0xb4a9441e in IccContactListToMozContactList (aContactList=..., aCount=15, 
    aContacts=0xaccf7088, aGlobal=..., aCx=0xb1fe53d0)
    at /Users/gregor/moz/ib2g/dom/icc/IccCallback.cpp:102
#3  mozilla::dom::icc::IccCallback::NotifyRetrievedIccContacts (
    this=0xacc9eda0, aContacts=0xaccf7088, aCount=15)
    at /Users/gregor/moz/ib2g/dom/icc/IccCallback.cpp:246
#4  0xb4a93158 in mozilla::dom::icc::IccRequestChild::Recv__delete__ (
    this=0xaccad160, aResponse=...)
    at /Users/gregor/moz/ib2g/dom/icc/ipc/IccChild.cpp:455
#5  0xb401dc12 in OnMessageReceived (msg__=..., this=0xaccad160)
    at PIccRequestChild.cpp:162
#6  mozilla::dom::icc::PIccRequestChild::OnMessageReceived (this=0xaccad160, 
    msg__=...) at PIccRequestChild.cpp:135
#7  0xb414b43a in mozilla::dom::PContentChild::OnMessageReceived (
    this=0xb1fbcc18, msg__=...) at PContentChild.cpp:5465
#8  0xb3fb5d40 in mozilla::ipc::MessageChannel::DispatchAsyncMessage (
    this=0xb1fbcc50, aMsg=...)
Flags: needinfo?(btseng)
Thanks for reporting this.

I'm taking this bug to follow up.
Assignee: nobody → btseng
Flags: needinfo?(btseng)
Root cause is found. It's all about how to use ErrorResult properly:
1. If the ErrorResult is the result of a method in JS implementation, ErrorResult will be set with MightThrowJSException() if there is any possibility to throw an exception in the context even though the exception is thrown at that call [1].
2. In IccCallback.cpp [2], we should always have "return er.StealNSResult()" at the end of this function instead of "return NS_OK" to implicitly suppress the exception which is not required in our implementation.

Comment on attachment 8649799 [details] [diff] [review]
Patch: Suppress assertion check in ~ErrorResult() if no exception to be thrown.

Review of attachment 8649799 [details] [diff] [review]:

Hi Edgar,

May I have your review for this quick fix?

Attachment #8649799 - Flags: review?(echen)
Per offline discussion,
we can have StealNSResult() always be invoked with NS_ENSURE_SUCCESS to suppress the assertion and we should also revise the use of ErrorResult in IccContact.cpp in the same way as well.
Attachment #8649799 - Attachment is obsolete: true
Attachment #8649799 - Flags: review?(echen)
Attachment #8650305 - Flags: review?(echen)
Comment on attachment 8650305 [details] [diff] [review]
(v2) Patch: Suppress assertion check in ~ErrorResult() if no exception to be thrown.

Review of attachment 8650305 [details] [diff] [review]:

Thank you.
Attachment #8650305 - Flags: review?(echen) → review+
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → FxOS-S6 (04Sep)
You need to log in before you can comment on or make changes to this bug.