Closed Bug 1458016 Opened Last year Closed Last year

Assertion failure: IsText(), at /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/dom/Text.h:58

Categories

(Core :: Selection, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla61
Tracking Status
firefox-esr52 --- unaffected
firefox-esr60 --- unaffected
firefox59 --- unaffected
firefox60 --- unaffected
firefox61 --- fixed

People

(Reporter: tsmith, Assigned: emilio)

References

(Blocks 1 open bug)

Details

(Keywords: assertion, testcase)

Attachments

(2 files)

Attached file testcase.html
Assertion failure: IsText(), at /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/dom/Text.h:58

#0 nsINode::AsText() src/obj-firefox/dist/include/mozilla/dom/Text.h:58:3
#1 mozilla::dom::Selection::ContainsNode(nsINode&, bool, mozilla::ErrorResult&) src/dom/base/Selection.cpp:3220:24
#2 mozilla::dom::SelectionBinding::containsNode(JSContext*, JS::Handle<JSObject*>, mozilla::dom::Selection*, JSJitMethodCallArgs const&) src/obj-firefox/dom/bindings/SelectionBinding.cpp:889:21
#3 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:3260:13
#4 js::CallJSNative(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), JS::CallArgs const&) src/js/src/vm/JSContext-inl.h:280:15
#5 js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) src/js/src/vm/Interpreter.cpp:467:16
#6 InternalCall(JSContext*, js::AnyInvokeArgs const&) src/js/src/vm/Interpreter.cpp:516:12
#7 Interpret(JSContext*, js::RunState&) src/js/src/vm/Interpreter.cpp:3086:18
#8 js::RunScript(JSContext*, js::RunState&) src/js/src/vm/Interpreter.cpp:417:12
#9 js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) src/js/src/vm/Interpreter.cpp:489:15
#10 InternalCall(JSContext*, js::AnyInvokeArgs const&) src/js/src/vm/Interpreter.cpp:516:12
#11 js::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, js::AnyInvokeArgs const&, JS::MutableHandle<JS::Value>) src/js/src/vm/Interpreter.cpp:535:10
#12 JS::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, JS::HandleValueArray const&, JS::MutableHandle<JS::Value>) src/js/src/jsapi.cpp:2989:12
#13 mozilla::dom::EventHandlerNonNull::Call(JSContext*, JS::Handle<JS::Value>, mozilla::dom::Event&, JS::MutableHandle<JS::Value>, mozilla::ErrorResult&) src/obj-firefox/dom/bindings/EventHandlerBinding.cpp:264:37
#14 void mozilla::dom::EventHandlerNonNull::Call<nsISupports*>(nsISupports* const&, mozilla::dom::Event&, JS::MutableHandle<JS::Value>, mozilla::ErrorResult&, char const*, mozilla::dom::CallbackObject::ExceptionHandling, JSCompartment*) src/obj-firefox/dist/include/mozilla/dom/EventHandlerBinding.h:363:12
#15 mozilla::JSEventHandler::HandleEvent(mozilla::dom::Event*) src/dom/events/JSEventHandler.cpp:214:12
#16 mozilla::EventListenerManager::HandleEventSubType(mozilla::EventListenerManager::Listener*, mozilla::dom::Event*, mozilla::dom::EventTarget*) src/dom/events/EventListenerManager.cpp:1121:52
#17 mozilla::EventListenerManager::HandleEventInternal(nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event**, mozilla::dom::EventTarget*, nsEventStatus*) src/dom/events/EventListenerManager.cpp:1288:20
#18 mozilla::EventTargetChainItem::HandleEvent(mozilla::EventChainPostVisitor&, mozilla::ELMCreationDetector&) src/dom/events/EventDispatcher.cpp:348:17
#19 mozilla::EventTargetChainItem::HandleEventTargetChain(nsTArray<mozilla::EventTargetChainItem>&, mozilla::EventChainPostVisitor&, mozilla::EventDispatchingCallback*, mozilla::ELMCreationDetector&) src/dom/events/EventDispatcher.cpp:528:16
#20 mozilla::EventDispatcher::Dispatch(nsISupports*, nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsEventStatus*, mozilla::EventDispatchingCallback*, nsTArray<mozilla::dom::EventTarget*>*) src/dom/events/EventDispatcher.cpp:934:9
#21 nsDocumentViewer::LoadComplete(nsresult) src/layout/base/nsDocumentViewer.cpp:1066:7
#22 nsDocShell::EndPageLoad(nsIWebProgress*, nsIChannel*, nsresult) src/docshell/base/nsDocShell.cpp:7236:21
#23 nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, nsresult) src/docshell/base/nsDocShell.cpp:7029:7
#24 non-virtual thunk to nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, nsresult) src/docshell/base/nsDocShell.cpp
#25 nsDocLoader::DoFireOnStateChange(nsIWebProgress*, nsIRequest*, int&, nsresult) src/uriloader/base/nsDocLoader.cpp:1315:3
#26 nsDocLoader::doStopDocumentLoad(nsIRequest*, nsresult) src/uriloader/base/nsDocLoader.cpp:858:14
#27 nsDocLoader::DocLoaderIsEmpty(bool) src/uriloader/base/nsDocLoader.cpp:747:9
#28 nsDocLoader::OnStopRequest(nsIRequest*, nsISupports*, nsresult) src/uriloader/base/nsDocLoader.cpp:632:5
#29 non-virtual thunk to nsDocLoader::OnStopRequest(nsIRequest*, nsISupports*, nsresult) src/uriloader/base/nsDocLoader.cpp
#30 mozilla::net::nsLoadGroup::RemoveRequest(nsIRequest*, nsISupports*, nsresult) src/netwerk/base/nsLoadGroup.cpp:629:28
#31 nsIDocument::DoUnblockOnload() src/dom/base/nsDocument.cpp:8422:18
#32 nsDocument::UnblockOnload(bool) src/dom/base/nsDocument.cpp:8344:9
#33 nsIDocument::DispatchContentLoadedEvents() src/dom/base/nsDocument.cpp:5328:3
#34 mozilla::detail::RunnableMethodImpl<nsIDocument*, void (nsIDocument::*)(), true, (mozilla::RunnableKind)0>::Run() src/obj-firefox/dist/include/nsThreadUtils.h:1216:13
#35 mozilla::SchedulerGroup::Runnable::Run() src/xpcom/threads/SchedulerGroup.cpp:337:32
#36 nsThread::ProcessNextEvent(bool, bool*) src/xpcom/threads/nsThread.cpp:1090:14
#37 NS_ProcessNextEvent(nsIThread*, bool) src/xpcom/threads/nsThreadUtils.cpp:519:10
#38 mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) src/ipc/glue/MessagePump.cpp:97:21
#39 MessageLoop::RunInternal() src/ipc/chromium/src/base/message_loop.cc:326:10
#40 MessageLoop::Run() src/ipc/chromium/src/base/message_loop.cc:299:3
#41 nsBaseAppShell::Run() src/widget/nsBaseAppShell.cpp:157:27
#42 XRE_RunAppShell() src/toolkit/xre/nsEmbedFunctions.cpp:893:22
#43 mozilla::ipc::MessagePumpForChildProcess::Run(base::MessagePump::Delegate*) src/ipc/glue/MessagePump.cpp:269:9
#44 MessageLoop::RunInternal() src/ipc/chromium/src/base/message_loop.cc:326:10
#45 MessageLoop::Run() src/ipc/chromium/src/base/message_loop.cc:299:3
#46 XRE_InitChildProcess(int, char**, XREChildData const*) src/toolkit/xre/nsEmbedFunctions.cpp:719:34
#47 content_process_main(mozilla::Bootstrap*, int, char**) src/browser/app/../../ipc/contentproc/plugin-container.cpp:50:30
#48 main src/browser/app/nsBrowserApp.cpp:280:18
#49 __libc_start_main /build/glibc-Cl5G7W/glibc-2.23/csu/../csu/libc-start.c:291
#50 _start (firefox+0x423444)
Flags: in-testsuite?
The cast introduced in bug 1449670 doesn't make sense to me.

    bool isData = aNode.IsNodeOfType(nsINode::eDATA_NODE);
    if (isData) {
-     nodeLength = static_cast<nsIContent&>(aNode).TextLength();
+     nodeLength = aNode.AsText()->TextLength();
    } else {
      nodeLength = aNode.GetChildCount();
    }

CharacterData is a superset of Text, since it also includes comments / PI.

So that probably wants something like IsText() ? AsText()->TextLength() : 0, or something like that.
Blocks: 1449670
Flags: needinfo?(continuation)
Well, I guess it just wants AsCharacterData()->TextLength()...
Assignee: nobody → emilio
Yeah, I didn't notice that this was an eDATA_NODE test, not eTEXT.  AsCharacterData() makes sense here.
I just did a search and replace. :) Hopefully Boris answered your question.
Flags: needinfo?(continuation)
Yeah, for some reason mozreview didn't publish the review request. :(
Comment on attachment 8972197 [details]
Bug 1458016: Fix bad cast to Text.

https://reviewboard.mozilla.org/r/240860/#review246642
Attachment #8972197 - Flags: review?(bzbarsky) → review+
https://hg.mozilla.org/mozilla-central/rev/4c0f3401afe5
Status: NEW → RESOLVED
Closed: Last year
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
Can we land the test as a crashtest?
Huh, thought I had done that.
Flags: needinfo?(emilio)
You need to log in before you can comment on or make changes to this bug.