Closed Bug 1644903 Opened 5 years ago Closed 5 years ago

Assertion failure: !mMightHaveUnreportedJSException, at /builds/worker/workspace/obj-build/dist/include/mozilla/ErrorResult.h:583

Categories

(Core :: DOM: Editor, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla80
Tracking Status
firefox-esr68 --- unaffected
firefox-esr78 --- wontfix
firefox77 --- wontfix
firefox78 --- wontfix
firefox79 --- wontfix
firefox80 --- fixed

People

(Reporter: tsmith, Assigned: masayuki)

References

(Blocks 1 open bug)

Details

(Keywords: assertion, testcase)

Attachments

(2 files)

Attached file testcase.html

Found with m-c 20200529-60a406d3b53a

Assertion failure: !mMightHaveUnreportedJSException, at /builds/worker/workspace/obj-build/dist/include/mozilla/ErrorResult.h:583

0|0|libxul.so|mozilla::binding_danger::TErrorResult<mozilla::binding_danger::AssertAndSuppressCleanupPolicy>::~TErrorResult()|hg:hg.mozilla.org/mozilla-central:dom/bindings/ErrorResult.h:60a406d3b53a224325ad20d733b1427de35fce14|0|0x62
0|1|libxul.so|mozilla::DeleteNodeTransaction::UndoTransaction()|hg:hg.mozilla.org/mozilla-central:editor/libeditor/DeleteNodeTransaction.cpp:60a406d3b53a224325ad20d733b1427de35fce14|112|0x5
0|2|libxul.so|mozilla::EditAggregateTransaction::UndoTransaction()|hg:hg.mozilla.org/mozilla-central:editor/libeditor/EditAggregateTransaction.cpp:60a406d3b53a224325ad20d733b1427de35fce14|43|0x9
0|3|libxul.so|mozilla::PlaceholderTransaction::UndoTransaction()|hg:hg.mozilla.org/mozilla-central:editor/libeditor/PlaceholderTransaction.cpp:60a406d3b53a224325ad20d733b1427de35fce14|61|0x5
0|4|libxul.so|mozilla::TransactionItem::UndoTransaction(mozilla::TransactionManager*)|hg:hg.mozilla.org/mozilla-central:editor/txmgr/TransactionItem.cpp:60a406d3b53a224325ad20d733b1427de35fce14|103|0x11
0|5|libxul.so|mozilla::TransactionManager::Undo()|hg:hg.mozilla.org/mozilla-central:editor/txmgr/TransactionManager.cpp:60a406d3b53a224325ad20d733b1427de35fce14|124|0x10
0|6|libxul.so|mozilla::TextEditor::UndoAsAction(unsigned int, nsIPrincipal*)|hg:hg.mozilla.org/mozilla-central:editor/libeditor/TextEditor.cpp:60a406d3b53a224325ad20d733b1427de35fce14|989|0x10
0|7|libxul.so|mozilla::UndoCommand::DoCommand(mozilla::Command, mozilla::TextEditor&, nsIPrincipal*) const|hg:hg.mozilla.org/mozilla-central:editor/libeditor/EditorCommands.cpp:60a406d3b53a224325ad20d733b1427de35fce14|277|0xd
0|8|libxul.so|mozilla::dom::Document::ExecCommand(nsTSubstring<char16_t> const&, bool, nsTSubstring<char16_t> const&, nsIPrincipal&, mozilla::ErrorResult&)|hg:hg.mozilla.org/mozilla-central:dom/base/Document.cpp:60a406d3b53a224325ad20d733b1427de35fce14|4838|0x33
0|9|libxul.so|mozilla::dom::Document_Binding::execCommand(JSContext*, JS::Handle<JSObject*>, void*, JSJitMethodCallArgs const&)|s3:gecko-generated-sources:c2e0d215f486a4895ba3d9d634c3d73aa590eb20d969d021b12496ae1280af706be68ed456e1852b227878ddfc4b6626cad9de31536869315bb5335fe1bc965c/dom/bindings/DocumentBinding.cpp:|3469|0x34
0|10|libxul.so|bool mozilla::dom::binding_detail::GenericMethod<mozilla::dom::binding_detail::NormalThisPolicy, mozilla::dom::binding_detail::ThrowExceptions>(JSContext*, unsigned int, JS::Value*)|hg:hg.mozilla.org/mozilla-central:dom/bindings/BindingUtils.cpp:60a406d3b53a224325ad20d733b1427de35fce14|3192|0x21
0|11|libxul.so|CallJSNative(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), js::CallReason, JS::CallArgs const&)|hg:hg.mozilla.org/mozilla-central:js/src/vm/Interpreter.cpp:60a406d3b53a224325ad20d733b1427de35fce14|493|0x12
0|12|libxul.so|js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason)|hg:hg.mozilla.org/mozilla-central:js/src/vm/Interpreter.cpp:60a406d3b53a224325ad20d733b1427de35fce14|585|0xe
0|13|libxul.so|Interpret(JSContext*, js::RunState&)|hg:hg.mozilla.org/mozilla-central:js/src/vm/Interpreter.cpp:60a406d3b53a224325ad20d733b1427de35fce14|652|0xa
0|14|libxul.so|js::RunScript(JSContext*, js::RunState&)|hg:hg.mozilla.org/mozilla-central:js/src/vm/Interpreter.cpp:60a406d3b53a224325ad20d733b1427de35fce14|465|0xb
0|15|libxul.so|js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason)|hg:hg.mozilla.org/mozilla-central:js/src/vm/Interpreter.cpp:60a406d3b53a224325ad20d733b1427de35fce14|620|0x8
0|16|libxul.so|<name omitted>|hg:hg.mozilla.org/mozilla-central:js/src/vm/Interpreter.cpp:60a406d3b53a224325ad20d733b1427de35fce14|665|0xb
0|17|libxul.so|JS::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, JS::HandleValueArray const&, JS::MutableHandle<JS::Value>)|hg:hg.mozilla.org/mozilla-central:js/src/jsapi.cpp:60a406d3b53a224325ad20d733b1427de35fce14|2840|0x23
0|18|libxul.so|mozilla::dom::EventHandlerNonNull::Call(mozilla::dom::BindingCallContext&, JS::Handle<JS::Value>, mozilla::dom::Event&, JS::MutableHandle<JS::Value>, mozilla::ErrorResult&)|s3:gecko-generated-sources:5ceb4fd1d8dc61bfa9cb634c1ccbea88477929f8e3cd832f14dbaaa72fb11378c7536241ae3f9b1a6d2506d829d115fe64e0fdcf3301157cfcf64f24a4f984df/dom/bindings/EventHandlerBinding.cpp:|276|0xb
0|19|libxul.so|void mozilla::dom::EventHandlerNonNull::Call<nsCOMPtr<mozilla::dom::EventTarget> >(nsCOMPtr<mozilla::dom::EventTarget> const&, mozilla::dom::Event&, JS::MutableHandle<JS::Value>, mozilla::ErrorResult&, char const*, mozilla::dom::CallbackObject::ExceptionHandling, JS::Realm*)|s3:gecko-generated-sources:5abc72777d30ad0ea7b8b3e1392cd7961bd73b8cd08e5ab209f3b42251def563ee9c9a7cea98a24d0fa9d867edfc0c0297c165b0d167458ac5a2af4b7a0caebe/dist/include/mozilla/dom/EventHandlerBinding.h:|367|0x28
0|20|libxul.so|mozilla::JSEventHandler::HandleEvent(mozilla::dom::Event*)|hg:hg.mozilla.org/mozilla-central:dom/events/JSEventHandler.cpp:60a406d3b53a224325ad20d733b1427de35fce14|201|0x2e
0|21|libxul.so|mozilla::EventListenerManager::HandleEventSubType(mozilla::EventListenerManager::Listener*, mozilla::dom::Event*, mozilla::dom::EventTarget*)|hg:hg.mozilla.org/mozilla-central:dom/events/EventListenerManager.cpp:60a406d3b53a224325ad20d733b1427de35fce14|1088|0xc
0|22|libxul.so|mozilla::EventListenerManager::HandleEventInternal(nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event**, mozilla::dom::EventTarget*, nsEventStatus*, bool)|hg:hg.mozilla.org/mozilla-central:dom/events/EventListenerManager.cpp:60a406d3b53a224325ad20d733b1427de35fce14|1280|0x16
0|23|libxul.so|mozilla::EventTargetChainItem::HandleEvent(mozilla::EventChainPostVisitor&, mozilla::ELMCreationDetector&)|hg:hg.mozilla.org/mozilla-central:dom/events/EventDispatcher.cpp:60a406d3b53a224325ad20d733b1427de35fce14|356|0xb
0|24|libxul.so|mozilla::EventTargetChainItem::HandleEventTargetChain(nsTArray<mozilla::EventTargetChainItem>&, mozilla::EventChainPostVisitor&, mozilla::EventDispatchingCallback*, mozilla::ELMCreationDetector&)|hg:hg.mozilla.org/mozilla-central:dom/events/EventDispatcher.cpp:60a406d3b53a224325ad20d733b1427de35fce14|558|0x19
0|25|libxul.so|mozilla::EventDispatcher::Dispatch(nsISupports*, nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsEventStatus*, mozilla::EventDispatchingCallback*, nsTArray<mozilla::dom::EventTarget*>*)|hg:hg.mozilla.org/mozilla-central:dom/events/EventDispatcher.cpp:60a406d3b53a224325ad20d733b1427de35fce14|1055|0x5
0|26|libxul.so|nsDocumentViewer::LoadComplete(nsresult)|hg:hg.mozilla.org/mozilla-central:layout/base/nsDocumentViewer.cpp:60a406d3b53a224325ad20d733b1427de35fce14|1147|0x1c
0|27|libxul.so|nsDocShell::EndPageLoad(nsIWebProgress*, nsIChannel*, nsresult)|hg:hg.mozilla.org/mozilla-central:docshell/base/nsDocShell.cpp:60a406d3b53a224325ad20d733b1427de35fce14|5805|0x18
0|28|libxul.so|nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, nsresult)|hg:hg.mozilla.org/mozilla-central:docshell/base/nsDocShell.cpp:60a406d3b53a224325ad20d733b1427de35fce14|5547|0xb
0|29|libxul.so|non-virtual thunk to nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, nsresult)|hg:hg.mozilla.org/mozilla-central:docshell/base/nsDocShell.cpp:60a406d3b53a224325ad20d733b1427de35fce14|0|0x10
0|30|libxul.so|nsDocLoader::DoFireOnStateChange(nsIWebProgress*, nsIRequest*, int&, nsresult)|hg:hg.mozilla.org/mozilla-central:uriloader/base/nsDocLoader.cpp:60a406d3b53a224325ad20d733b1427de35fce14|1367|0x2b
0|31|libxul.so|nsDocLoader::doStopDocumentLoad(nsIRequest*, nsresult)|hg:hg.mozilla.org/mozilla-central:uriloader/base/nsDocLoader.cpp:60a406d3b53a224325ad20d733b1427de35fce14|927|0x28
0|32|libxul.so|nsDocLoader::DocLoaderIsEmpty(bool)|hg:hg.mozilla.org/mozilla-central:uriloader/base/nsDocLoader.cpp:60a406d3b53a224325ad20d733b1427de35fce14|747|0xe
0|33|libxul.so|nsDocLoader::NotifyDoneWithOnload(nsDocLoader*)|hg:hg.mozilla.org/mozilla-central:uriloader/base/nsDocLoader.cpp:60a406d3b53a224325ad20d733b1427de35fce14|821|0x1c
0|34|libxul.so|nsDocLoader::DocLoaderIsEmpty(bool)|hg:hg.mozilla.org/mozilla-central:uriloader/base/nsDocLoader.cpp:60a406d3b53a224325ad20d733b1427de35fce14|749|0x8
0|35|libxul.so|nsDocLoader::OnStopRequest(nsIRequest*, nsresult)|hg:hg.mozilla.org/mozilla-central:uriloader/base/nsDocLoader.cpp:60a406d3b53a224325ad20d733b1427de35fce14|635|0xb
0|36|libxul.so|non-virtual thunk to nsDocLoader::OnStopRequest(nsIRequest*, nsresult)|hg:hg.mozilla.org/mozilla-central:uriloader/base/nsDocLoader.cpp:60a406d3b53a224325ad20d733b1427de35fce14|0|0xd
0|37|libxul.so|mozilla::net::nsLoadGroup::NotifyRemovalObservers(nsIRequest*, nsresult)|hg:hg.mozilla.org/mozilla-central:netwerk/base/nsLoadGroup.cpp:60a406d3b53a224325ad20d733b1427de35fce14|615|0x14
0|38|libxul.so|mozilla::net::nsLoadGroup::RemoveRequest(nsIRequest*, nsISupports*, nsresult)|hg:hg.mozilla.org/mozilla-central:netwerk/base/nsLoadGroup.cpp:60a406d3b53a224325ad20d733b1427de35fce14|522|0xe
0|39|libxul.so|mozilla::dom::Document::DoUnblockOnload()|hg:hg.mozilla.org/mozilla-central:dom/base/Document.cpp:60a406d3b53a224325ad20d733b1427de35fce14|10695|0x1c
0|40|libxul.so|mozilla::dom::Document::UnblockOnload(bool)|hg:hg.mozilla.org/mozilla-central:dom/base/Document.cpp:60a406d3b53a224325ad20d733b1427de35fce14|10627|0x8
0|41|libxul.so|mozilla::dom::Document::DispatchContentLoadedEvents()|hg:hg.mozilla.org/mozilla-central:dom/base/Document.cpp:60a406d3b53a224325ad20d733b1427de35fce14|7266|0xd
0|42|libxul.so|mozilla::detail::RunnableMethodImpl<mozilla::dom::Document*, void (mozilla::dom::Document::*)(), true, (mozilla::RunnableKind)0>::Run()|hg:hg.mozilla.org/mozilla-central:xpcom/threads/nsThreadUtils.h:60a406d3b53a224325ad20d733b1427de35fce14|1237|0x17
0|43|libxul.so|mozilla::SchedulerGroup::Runnable::Run()|hg:hg.mozilla.org/mozilla-central:xpcom/threads/SchedulerGroup.cpp:60a406d3b53a224325ad20d733b1427de35fce14|146|0x11
0|44|libxul.so|nsThread::ProcessNextEvent(bool, bool*)|hg:hg.mozilla.org/mozilla-central:xpcom/threads/nsThread.cpp:60a406d3b53a224325ad20d733b1427de35fce14|1211|0x11
0|45|libxul.so|NS_ProcessNextEvent(nsIThread*, bool)|hg:hg.mozilla.org/mozilla-central:xpcom/threads/nsThreadUtils.cpp:60a406d3b53a224325ad20d733b1427de35fce14|501|0xc
0|46|libxul.so|mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*)|hg:hg.mozilla.org/mozilla-central:ipc/glue/MessagePump.cpp:60a406d3b53a224325ad20d733b1427de35fce14|87|0x7
0|47|libxul.so|MessageLoop::RunInternal()|hg:hg.mozilla.org/mozilla-central:ipc/chromium/src/base/message_loop.cc:60a406d3b53a224325ad20d733b1427de35fce14|315|0x17
0|48|libxul.so|MessageLoop::Run()|hg:hg.mozilla.org/mozilla-central:ipc/chromium/src/base/message_loop.cc:60a406d3b53a224325ad20d733b1427de35fce14|290|0x8
0|49|libxul.so|nsBaseAppShell::Run()|hg:hg.mozilla.org/mozilla-central:widget/nsBaseAppShell.cpp:60a406d3b53a224325ad20d733b1427de35fce14|137|0xd
0|50|libxul.so|XRE_RunAppShell()|hg:hg.mozilla.org/mozilla-central:toolkit/xre/nsEmbedFunctions.cpp:60a406d3b53a224325ad20d733b1427de35fce14|913|0xe
0|51|libxul.so|mozilla::ipc::MessagePumpForChildProcess::Run(base::MessagePump::Delegate*)|hg:hg.mozilla.org/mozilla-central:ipc/glue/MessagePump.cpp:60a406d3b53a224325ad20d733b1427de35fce14|237|0x5
0|52|libxul.so|MessageLoop::RunInternal()|hg:hg.mozilla.org/mozilla-central:ipc/chromium/src/base/message_loop.cc:60a406d3b53a224325ad20d733b1427de35fce14|315|0x17
0|53|libxul.so|MessageLoop::Run()|hg:hg.mozilla.org/mozilla-central:ipc/chromium/src/base/message_loop.cc:60a406d3b53a224325ad20d733b1427de35fce14|290|0x8
0|54|libxul.so|XRE_InitChildProcess(int, char**, XREChildData const*)|hg:hg.mozilla.org/mozilla-central:toolkit/xre/nsEmbedFunctions.cpp:60a406d3b53a224325ad20d733b1427de35fce14|744|0x5
0|55|firefox-bin|content_process_main(mozilla::Bootstrap*, int, char**)|hg:hg.mozilla.org/mozilla-central:ipc/contentproc/plugin-container.cpp:60a406d3b53a224325ad20d733b1427de35fce14|56|0x11
0|56|firefox-bin|main|hg:hg.mozilla.org/mozilla-central:browser/app/nsBrowserApp.cpp:60a406d3b53a224325ad20d733b1427de35fce14|303|0x20
Flags: in-testsuite?

Hi Masayuki,
Could you please help to take a look? Thank you.

Severity: -- → S3
Flags: needinfo?(masayuki)
Priority: -- → P3

A Pernosco session is available here: https://pernos.co/debug/JVeBZNDzWxmJbn1-m1JzIw/index.html

Assignee: nobody → masayuki
Status: NEW → ASSIGNED
Flags: needinfo?(masayuki)

I'm not sure what we should do in this case.

The undo command takes deleted node back from iframe's document, then, it reaches UpdateReflectorGlobal in BindingUtils.cpp. In this method, ErrorResult::MightThrowJSException() is called, but in this testcase, it won't be set to an error. Therefore, DeleteNodeTransaction::UndoTransaction() does not do anything additionally. However, TErrorResult::mMightHaveUnreportedJSException is still be true because nobody calls TErrorResult::WouldReportJSException().

Peterv: It seems that UpdateReflectorGlobal should call TErrorResult::WouldReportJSException() when it does not set error, but I'm not sure the method's meaning well. Or, any methods which use ErrorResult should call SuppressException() even if the instance is not set to an error?

Flags: needinfo?(peterv)

DeleteNodeTransaction::UndoTransaction should probably call WouldReportJSException in this case before calling StealNSResult. StealNSResult drops the exception on the floor, it's probably fine in this case but you signal that with WouldReportJSException.

Flags: needinfo?(peterv)

(In reply to Peter Van der Beken [:peterv] from comment #4)

DeleteNodeTransaction::UndoTransaction should probably call WouldReportJSException in this case before calling StealNSResult. StealNSResult drops the exception on the floor, it's probably fine in this case but you signal that with WouldReportJSException.

Thanks.

nsINode::InsertBefore() removes inserting node from a document if it's in
a document including different document. In this case, UpdateReflectorGlobal
in BindingUtils.cpp calls ErrorResult::MightThrowJSException(), but editor
never throws exception with ErrorResult. Therefore, editor needs to call
ErrorResult::WouldReportJSException() explicitly if the inserting node may
be in another document.

As far as I checked, it can happen only when undoing or redoing a transaction.
Therefore, this patch touches only transaction classes.

Depends on D81683

Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/2ee0c8919f9b Make `nsINode::InsertBefore()` callers call `ErrorResult::WouldReportJSException()` when inserting node may be in another document r=m_kato
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla80

The patch landed in nightly and beta is affected.
:masayuki, is this bug important enough to require an uplift?
If not please set status_beta to wontfix.

For more information, please visit auto_nag documentation.

Flags: needinfo?(masayuki)

In my understanding, it's assertion only things so that we must not need to fix this on the branches.

Flags: needinfo?(masayuki)
Root Cause: --- → Coding: Unhandled Exceptions
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: