Closed Bug 1699866 Opened 3 years ago Closed 3 years ago

Assertion failure: splitNodeResult.Handled(), at src/editor/libeditor/HTMLStyleEditor.cpp:927

Categories

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

defect

Tracking

()

VERIFIED FIXED
89 Branch
Tracking Status
firefox-esr78 --- wontfix
firefox87 --- wontfix
firefox88 --- wontfix
firefox89 --- verified

People

(Reporter: tsmith, Assigned: masayuki)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: assertion, regression, testcase, Whiteboard: [bugmon:bisected,confirmed], [wptsync upstream])

Attachments

(2 files)

Attached file testcase.html

Found while fuzzing m-c 20210318-0438c8585f5f (--enable-debug --enable-fuzzing)

Assertion failure: splitNodeResult.Handled(), at src/editor/libeditor/HTMLStyleEditor.cpp:927

#0 0x7fc1fe1bf90c in mozilla::HTMLEditor::SplitAncestorStyledInlineElementsAt(mozilla::EditorDOMPointBase<nsCOMPtr<nsINode>, nsCOMPtr<nsIContent> > const&, nsAtom*, nsAtom*) src/editor/libeditor/HTMLStyleEditor.cpp:927:5
#1 0x7fc1fe1beacf in mozilla::HTMLEditor::SplitAncestorStyledInlineElementsAtRangeEdges(mozilla::EditorDOMPointBase<nsCOMPtr<nsINode>, nsCOMPtr<nsIContent> > const&, mozilla::EditorDOMPointBase<nsCOMPtr<nsINode>, nsCOMPtr<nsIContent> > const&, nsAtom*, nsAtom*) src/editor/libeditor/HTMLStyleEditor.cpp:826:9
#2 0x7fc1fe1b9978 in mozilla::HTMLEditor::RemoveInlinePropertyInternal(nsStaticAtom*, nsStaticAtom*, mozilla::HTMLEditor::RemoveRelatedElements) src/editor/libeditor/HTMLStyleEditor.cpp:1938:13
#3 0x7fc1fe1783dd in mozilla::HTMLEditor::RemoveInlinePropertyAsAction(nsStaticAtom&, nsStaticAtom*, nsIPrincipal*) src/editor/libeditor/HTMLStyleEditor.cpp:1765:8
#4 0x7fc1fe17810a in mozilla::StyleUpdatingCommand::ToggleState(nsStaticAtom&, mozilla::HTMLEditor&, nsIPrincipal*) const src/editor/libeditor/HTMLEditorCommands.cpp:206:21
#5 0x7fc1fe176f75 in mozilla::StateUpdatingCommandBase::DoCommand(mozilla::Command, mozilla::TextEditor&, nsIPrincipal*) const src/editor/libeditor/HTMLEditorCommands.cpp:78:17
#6 0x7fc1fb56b9d6 in mozilla::dom::Document::ExecCommand(nsTSubstring<char16_t> const&, bool, nsTSubstring<char16_t> const&, nsIPrincipal&, mozilla::ErrorResult&) src/dom/base/Document.cpp:5146:34
#7 0x7fc1fc5b98cd in mozilla::dom::Document_Binding::execCommand(JSContext*, JS::Handle<JSObject*>, void*, JSJitMethodCallArgs const&) /builds/worker/workspace/obj-build/dom/bindings/DocumentBinding.cpp:3477:36
#8 0x7fc1fc92e01d in bool mozilla::dom::binding_detail::GenericMethod<mozilla::dom::binding_detail::NormalThisPolicy, mozilla::dom::binding_detail::ThrowExceptions>(JSContext*, unsigned int, JS::Value*) src/dom/bindings/BindingUtils.cpp:3238:13
#9 0x7fc1ff9b6620 in CallJSNative(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), js::CallReason, JS::CallArgs const&) src/js/src/vm/Interpreter.cpp:435:13
#10 0x7fc1ff9b5d8c in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) src/js/src/vm/Interpreter.cpp:520:12
#11 0x7fc1ff9b7589 in InternalCall(JSContext*, js::AnyInvokeArgs const&, js::CallReason) src/js/src/vm/Interpreter.cpp:580:10
#12 0x7fc1ff9ac0df in CallFromStack src/js/src/vm/Interpreter.cpp:584:10
#13 0x7fc1ff9ac0df in Interpret(JSContext*, js::RunState&) src/js/src/vm/Interpreter.cpp:3244:16
#14 0x7fc1ff9a35a1 in js::RunScript(JSContext*, js::RunState&) src/js/src/vm/Interpreter.cpp:405:13
#15 0x7fc1ff9b5da9 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) src/js/src/vm/Interpreter.cpp:552:13
#16 0x7fc1ff9b7589 in InternalCall(JSContext*, js::AnyInvokeArgs const&, js::CallReason) src/js/src/vm/Interpreter.cpp:580:10
#17 0x7fc1ff9b77af in js::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, js::AnyInvokeArgs const&, JS::MutableHandle<JS::Value>, js::CallReason) src/js/src/vm/Interpreter.cpp:597:8
#18 0x7fc1fff2c5fb in JS::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, JS::HandleValueArray const&, JS::MutableHandle<JS::Value>) src/js/src/jsapi.cpp:2856:10
#19 0x7fc1fc64e1d3 in mozilla::dom::EventHandlerNonNull::Call(mozilla::dom::BindingCallContext&, JS::Handle<JS::Value>, mozilla::dom::Event&, JS::MutableHandle<JS::Value>, mozilla::ErrorResult&) /builds/worker/workspace/obj-build/dom/bindings/EventHandlerBinding.cpp:279:37
#20 0x7fc1fccf2ec1 in 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*) /builds/worker/workspace/obj-build/dist/include/mozilla/dom/EventHandlerBinding.h:365:12
#21 0x7fc1fccf1f83 in mozilla::JSEventHandler::HandleEvent(mozilla::dom::Event*) src/dom/events/JSEventHandler.cpp:201:12
#22 0x7fc1fccd496f in mozilla::EventListenerManager::HandleEventSubType(mozilla::EventListenerManager::Listener*, mozilla::dom::Event*, mozilla::dom::EventTarget*) src/dom/events/EventListenerManager.cpp:1114:22
#23 0x7fc1fccd55b0 in mozilla::EventListenerManager::HandleEventInternal(nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event**, mozilla::dom::EventTarget*, nsEventStatus*, bool) src/dom/events/EventListenerManager.cpp:1305:17
#24 0x7fc1fccca905 in HandleEvent /builds/worker/workspace/obj-build/dist/include/mozilla/EventListenerManager.h:390:5
#25 0x7fc1fccca905 in mozilla::EventTargetChainItem::HandleEvent(mozilla::EventChainPostVisitor&, mozilla::ELMCreationDetector&) src/dom/events/EventDispatcher.cpp:354:17
#26 0x7fc1fccc9eb3 in mozilla::EventTargetChainItem::HandleEventTargetChain(nsTArray<mozilla::EventTargetChainItem>&, mozilla::EventChainPostVisitor&, mozilla::EventDispatchingCallback*, mozilla::ELMCreationDetector&) src/dom/events/EventDispatcher.cpp:556:16
#27 0x7fc1fcccca85 in mozilla::EventDispatcher::Dispatch(nsISupports*, nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsEventStatus*, mozilla::EventDispatchingCallback*, nsTArray<mozilla::dom::EventTarget*>*) src/dom/events/EventDispatcher.cpp:1099:11
#28 0x7fc1fe37ebe3 in nsDocumentViewer::LoadComplete(nsresult) src/layout/base/nsDocumentViewer.cpp:1103:7
#29 0x7fc1ff348fdf in nsDocShell::EndPageLoad(nsIWebProgress*, nsIChannel*, nsresult) src/docshell/base/nsDocShell.cpp:6556:20
#30 0x7fc1ff3489b2 in nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, nsresult) src/docshell/base/nsDocShell.cpp:5911:7
#31 0x7fc1ff3498ff in non-virtual thunk to nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, nsresult) src/docshell/base/nsDocShell.cpp
#32 0x7fc1fabb9dfc in nsDocLoader::DoFireOnStateChange(nsIWebProgress*, nsIRequest*, int&, nsresult) src/uriloader/base/nsDocLoader.cpp:1332:3
#33 0x7fc1fabb93aa in nsDocLoader::doStopDocumentLoad(nsIRequest*, nsresult) src/uriloader/base/nsDocLoader.cpp:938:14
#34 0x7fc1fabb78f7 in nsDocLoader::DocLoaderIsEmpty(bool, mozilla::Maybe<nsresult> const&) src/uriloader/base/nsDocLoader.cpp:757:9
#35 0x7fc1fabb882d in nsDocLoader::OnStopRequest(nsIRequest*, nsresult) src/uriloader/base/nsDocLoader.cpp:640:5
#36 0x7fc1fabb8fcc in non-virtual thunk to nsDocLoader::OnStopRequest(nsIRequest*, nsresult) src/uriloader/base/nsDocLoader.cpp
#37 0x7fc1f9afca16 in mozilla::net::nsLoadGroup::NotifyRemovalObservers(nsIRequest*, nsresult) src/netwerk/base/nsLoadGroup.cpp:616:22
#38 0x7fc1f9afdf23 in mozilla::net::nsLoadGroup::RemoveRequest(nsIRequest*, nsISupports*, nsresult) src/netwerk/base/nsLoadGroup.cpp:523:10
#39 0x7fc1fb587d41 in mozilla::dom::Document::DoUnblockOnload() src/dom/base/Document.cpp:11095:18
#40 0x7fc1fb566820 in mozilla::dom::Document::UnblockOnload(bool) src/dom/base/Document.cpp:11025:9
#41 0x7fc1fb577196 in mozilla::dom::Document::DispatchContentLoadedEvents() src/dom/base/Document.cpp:7576:3
#42 0x7fc1fb5e92b6 in applyImpl<mozilla::dom::Document, void (mozilla::dom::Document::*)()> /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1148:12
#43 0x7fc1fb5e92b6 in apply<mozilla::dom::Document, void (mozilla::dom::Document::*)()> /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1154:12
#44 0x7fc1fb5e92b6 in mozilla::detail::RunnableMethodImpl<mozilla::dom::Document*, void (mozilla::dom::Document::*)(), true, (mozilla::RunnableKind)0>::Run() /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1201:13
#45 0x7fc1f9951c32 in mozilla::SchedulerGroup::Runnable::Run() src/xpcom/threads/SchedulerGroup.cpp:146:20
#46 0x7fc1f995804f in mozilla::RunnableTask::Run() src/xpcom/threads/TaskController.cpp:472:16
#47 0x7fc1f99565d0 in mozilla::TaskController::DoExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) src/xpcom/threads/TaskController.cpp:760:26
#48 0x7fc1f9955534 in mozilla::TaskController::ExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) src/xpcom/threads/TaskController.cpp:611:15
#49 0x7fc1f99556e7 in mozilla::TaskController::ProcessPendingMTTask(bool) src/xpcom/threads/TaskController.cpp:395:36
#50 0x7fc1f995bc86 in operator() src/xpcom/threads/TaskController.cpp:133:37
#51 0x7fc1f995bc86 in mozilla::detail::RunnableFunction<mozilla::TaskController::InitializeInternal()::$_3>::Run() /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:534:5
#52 0x7fc1f996d177 in nsThread::ProcessNextEvent(bool, bool*) src/xpcom/threads/nsThread.cpp:1158:16
#53 0x7fc1f99736ea in NS_ProcessNextEvent(nsIThread*, bool) src/xpcom/threads/nsThreadUtils.cpp:548:10
#54 0x7fc1fa29d346 in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) src/ipc/glue/MessagePump.cpp:87:21
#55 0x7fc1fa2081a3 in MessageLoop::RunInternal() src/ipc/chromium/src/base/message_loop.cc:335:10
#56 0x7fc1fa2080bd in RunHandler src/ipc/chromium/src/base/message_loop.cc:328:3
#57 0x7fc1fa2080bd in MessageLoop::Run() src/ipc/chromium/src/base/message_loop.cc:310:3
#58 0x7fc1fe021878 in nsBaseAppShell::Run() src/widget/nsBaseAppShell.cpp:137:27
#59 0x7fc1ff881303 in XRE_RunAppShell() src/toolkit/xre/nsEmbedFunctions.cpp:901:20
#60 0x7fc1fa29e22c in mozilla::ipc::MessagePumpForChildProcess::Run(base::MessagePump::Delegate*) src/ipc/glue/MessagePump.cpp:237:9
#61 0x7fc1fa2081a3 in MessageLoop::RunInternal() src/ipc/chromium/src/base/message_loop.cc:335:10
#62 0x7fc1fa2080bd in RunHandler src/ipc/chromium/src/base/message_loop.cc:328:3
#63 0x7fc1fa2080bd in MessageLoop::Run() src/ipc/chromium/src/base/message_loop.cc:310:3
#64 0x7fc1ff880ed8 in XRE_InitChildProcess(int, char**, XREChildData const*) src/toolkit/xre/nsEmbedFunctions.cpp:733:34
#65 0x55e83d431fb6 in content_process_main src/browser/app/../../ipc/contentproc/plugin-container.cpp:57:28
#66 0x55e83d431fb6 in main src/browser/app/nsBrowserApp.cpp:309:18
#67 0x7fc2102dc0b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16
#68 0x55e83d40fd5c in _start (/home/worker/builds/m-c-20210318160736-fuzzing-debug/firefox-bin+0x14d5c)
Flags: in-testsuite?

A Pernosco session is available here: https://pernos.co/debug/may5weZwIjzFhQ47oJdOcg/index.html

Bugmon Analysis:
Verified bug as reproducible on mozilla-central 20210319215733-e8ee87ef82c3.
The bug appears to have been introduced in the following build range:

Start: 920fe1cdc13ce2582f55e4c68b7e8a3c1325973f (20210302003402)
End: 82523522be8c5001d896b905fe9b1a5221acc1f5 (20210302020918)
Pushlog: https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=920fe1cdc13ce2582f55e4c68b7e8a3c1325973f&tochange=82523522be8c5001d896b905fe9b1a5221acc1f5

Whiteboard: [bugmon:bisected,confirmed]

This is a similar issue of other assertion hits in HTMLEditor or related classes. We don't support editing outside <body> element, but some assertions detects specific parts which don't check editable state.

Severity: -- → S3
Priority: -- → P4
Assignee: nobody → masayuki
Status: NEW → ASSIGNED
OS: Unspecified → All
Priority: P4 → P3
Hardware: Unspecified → All

When given point is in a void element, e.g., this can be when JS inserts
nodes into a void element like <meta>,
HTMLEditor::SplitNodeDeepWithTransaction may return "not handled" state.
So, it's possible case, we shouldn't assert the case.

This patch adds both WPT and crashtests because I couldn't reproduce it
with WPT's simpler API use.

Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/30f718088497
Make `HTMLEditor::SplitAncestorStyledInlineElementsAt` return "not handled" if there is no splitable element at given point r=m_kato
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/28423 for changes under testing/web-platform/tests
Whiteboard: [bugmon:bisected,confirmed] → [bugmon:bisected,confirmed], [wptsync upstream]
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 89 Branch
Upstream PR merged by moz-wptsync-bot

Bugmon Analysis:
Verified bug as fixed on rev mozilla-central 20210409092020-7bc2dd06085f.
Removing bugmon keyword as no further action possible.
Please review the bug and re-add the keyword for further analysis.

Status: RESOLVED → VERIFIED
Keywords: bugmon
Flags: in-testsuite? → in-testsuite+

:masayuki, since this bug contains a bisection range, could you fill (if possible) the regressed_by field?
For more information, please visit auto_nag documentation.

Flags: needinfo?(masayuki)
Flags: needinfo?(masayuki)
Regressed by: 1517028
Has Regression Range: --- → yes
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: