Closed Bug 1420911 Opened 7 years ago Closed 7 years ago

Assertion failure: mBeforeUnloadListenerCount > 0, at /builds/worker/workspace/build/src/dom/base/nsGlobalWindowInner.cpp:6560

Categories

(Core :: DOM: Core & HTML, defect, P2)

52 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla59
Tracking Status
firefox-esr52 --- unaffected
firefox57 --- wontfix
firefox58 --- wontfix
firefox59 --- fixed

People

(Reporter: jkratzer, Assigned: nika)

References

(Blocks 1 open bug)

Details

(Keywords: assertion, testcase)

Attachments

(2 files)

Attached file trigger.html
Testcase found while fuzzing mozilla-central rev cad9c9573579.

OS|Linux|0.0.0 Linux 4.4.0-98-generic #121-Ubuntu SMP Tue Oct 10 14:24:03 UTC 2017 x86_64
CPU|amd64|family 6 model 78 stepping 3|1
GPU|||
Crash|SIGSEGV|0x0|0
0|0|libxul.so|nsGlobalWindowInner::EventListenerAdded|hg:hg.mozilla.org/mozilla-central:dom/base/nsGlobalWindowInner.cpp:cad9c9573579|6560|0x0
0|1|libxul.so|mozilla::EventListenerManager::AddEventListenerInternal|hg:hg.mozilla.org/mozilla-central:dom/events/EventListenerManager.cpp:cad9c9573579|425|0xc
0|2|libxul.so|mozilla::EventListenerManager::SetEventHandlerInternal|hg:hg.mozilla.org/mozilla-central:dom/events/EventListenerManager.cpp:cad9c9573579|762|0x1c
0|3|libxul.so|mozilla::EventListenerManager::SetEventHandler|hg:hg.mozilla.org/mozilla-central:dom/events/EventListenerManager.cpp:cad9c9573579|1656|0x19
0|4|libxul.so|mozilla::dom::WindowBinding::set_onbeforeunload|hg:hg.mozilla.org/mozilla-central:dom/events/EventNameList.h:cad9c9573579|535|0x19
0|5|libxul.so|mozilla::dom::WindowBinding::genericSetter|s3:gecko-generated-sources:fa9d3b5a62bbb7c8516d40865ce3e1a7ded042ef80ad94bc7ff84af35ae3e8742e079b705c675143183d72b61bf28473ebc30a485281408e38d9c5e51dd51741/dom/bindings/WindowBinding.cpp:|15550|0x11
0|6|libxul.so|js::CallJSNative|hg:hg.mozilla.org/mozilla-central:js/src/jscntxtinlines.h:cad9c9573579|291|0x6
0|7|libxul.so|js::InternalCallOrConstruct|hg:hg.mozilla.org/mozilla-central:js/src/vm/Interpreter.cpp:cad9c9573579|473|0xf
0|8|libxul.so|InternalCall|hg:hg.mozilla.org/mozilla-central:js/src/vm/Interpreter.cpp:cad9c9573579|522|0xd
0|9|libxul.so|js::Call|hg:hg.mozilla.org/mozilla-central:js/src/vm/Interpreter.cpp:cad9c9573579|541|0x5
0|10|libxul.so|js::CallSetter|hg:hg.mozilla.org/mozilla-central:js/src/vm/Interpreter.cpp:cad9c9573579|670|0x5
0|11|libxul.so|SetExistingProperty|hg:hg.mozilla.org/mozilla-central:js/src/vm/NativeObject.cpp:cad9c9573579|2729|0xb
0|12|libxul.so|js::NativeSetProperty<(js::QualifiedBool)1u>|hg:hg.mozilla.org/mozilla-central:js/src/vm/NativeObject.cpp:cad9c9573579|2757|0x2f
0|13|libxul.so|js::ForwardingProxyHandler::set|hg:hg.mozilla.org/mozilla-central:js/src/vm/NativeObject.h:cad9c9573579|1633|0x16
0|14|libxul.so|js::Proxy::setInternal|hg:hg.mozilla.org/mozilla-central:js/src/proxy/Proxy.cpp:cad9c9573579|404|0x23
0|15|libxul.so|js::Proxy::set|hg:hg.mozilla.org/mozilla-central:js/src/proxy/Proxy.cpp:cad9c9573579|414|0x19
0|16|libxul.so|js::ForwardingProxyHandler::set|hg:hg.mozilla.org/mozilla-central:js/src/vm/NativeObject.h:cad9c9573579|1632|0x16
0|17|libxul.so|js::CrossCompartmentWrapper::set|hg:hg.mozilla.org/mozilla-central:js/src/proxy/CrossCompartmentWrapper.cpp:cad9c9573579|238|0x47
0|18|libxul.so|js::Proxy::setInternal|hg:hg.mozilla.org/mozilla-central:js/src/proxy/Proxy.cpp:cad9c9573579|404|0x23
0|19|libxul.so|js::Proxy::set|hg:hg.mozilla.org/mozilla-central:js/src/proxy/Proxy.cpp:cad9c9573579|414|0x19
0|20|libxul.so|js::SetProperty|hg:hg.mozilla.org/mozilla-central:js/src/vm/NativeObject.h:cad9c9573579|1632|0x5
0|21|libxul.so|Interpret|hg:hg.mozilla.org/mozilla-central:js/src/vm/Interpreter.cpp:cad9c9573579|270|0x5
0|22|libxul.so|js::RunScript|hg:hg.mozilla.org/mozilla-central:js/src/vm/Interpreter.cpp:cad9c9573579|423|0xb
0|23|libxul.so|js::InternalCallOrConstruct|hg:hg.mozilla.org/mozilla-central:js/src/vm/Interpreter.cpp:cad9c9573579|495|0xf
0|24|libxul.so|InternalCall|hg:hg.mozilla.org/mozilla-central:js/src/vm/Interpreter.cpp:cad9c9573579|522|0xd
0|25|libxul.so|js::Call|hg:hg.mozilla.org/mozilla-central:js/src/vm/Interpreter.cpp:cad9c9573579|541|0x5
0|26|libxul.so|js::ForwardingProxyHandler::call|hg:hg.mozilla.org/mozilla-central:js/src/proxy/Wrapper.cpp:cad9c9573579|176|0x9
0|27|libxul.so|js::CrossCompartmentWrapper::call|hg:hg.mozilla.org/mozilla-central:js/src/proxy/CrossCompartmentWrapper.cpp:cad9c9573579|358|0x13
0|28|libxul.so|js::Proxy::call|hg:hg.mozilla.org/mozilla-central:js/src/proxy/Proxy.cpp:cad9c9573579|511|0x15
0|29|libxul.so|js::proxy_Call|hg:hg.mozilla.org/mozilla-central:js/src/proxy/Proxy.cpp:cad9c9573579|770|0x9
0|30|libxul.so|js::CallJSNative|hg:hg.mozilla.org/mozilla-central:js/src/jscntxtinlines.h:cad9c9573579|291|0x6
0|31|libxul.so|js::InternalCallOrConstruct|hg:hg.mozilla.org/mozilla-central:js/src/vm/Interpreter.cpp:cad9c9573579|455|0x12
0|32|libxul.so|InternalCall|hg:hg.mozilla.org/mozilla-central:js/src/vm/Interpreter.cpp:cad9c9573579|522|0xd
0|33|libxul.so|js::Call|hg:hg.mozilla.org/mozilla-central:js/src/vm/Interpreter.cpp:cad9c9573579|541|0x5
0|34|libxul.so|JS::Call|hg:hg.mozilla.org/mozilla-central:js/src/jsapi.cpp:cad9c9573579|3036|0x1c
0|35|libxul.so|mozilla::dom::EventHandlerNonNull::Call|s3:gecko-generated-sources:45c7673d6cdcb9ad297632b42609e09b31819dc7edd399050135d90eee920939c623d2fafd32c6b684bb31a39ce12b69569fa2cdaed88536fb4c8b46f692a33d/dom/bindings/EventHandlerBinding.cpp:|260|0x5
0|36|libxul.so|mozilla::JSEventHandler::HandleEvent|s3:gecko-generated-sources:d0cd062a8f2e61a1842e705e1539dafa6e2559f266e0cf39cc24ecbc1de67828060d8f7d4015631bcfe7c22d53ac77e562e84587fe96e76b41b346b32ed4aeb6/dist/include/mozilla/dom/EventHandlerBinding.h:|362|0x1f
0|37|libxul.so|mozilla::EventListenerManager::HandleEventSubType|hg:hg.mozilla.org/mozilla-central:dom/events/EventListenerManager.cpp:cad9c9573579|1111|0x14
0|38|libxul.so|mozilla::EventListenerManager::HandleEventInternal|hg:hg.mozilla.org/mozilla-central:dom/events/EventListenerManager.cpp:cad9c9573579|1286|0x15
0|39|libxul.so|mozilla::EventTargetChainItem::HandleEvent|hg:hg.mozilla.org/mozilla-central:dom/events/EventListenerManager.h:cad9c9573579|376|0xa
0|40|libxul.so|mozilla::EventTargetChainItem::HandleEventTargetChain|hg:hg.mozilla.org/mozilla-central:dom/events/EventDispatcher.cpp:cad9c9573579|462|0xf
0|41|libxul.so|mozilla::EventDispatcher::Dispatch|hg:hg.mozilla.org/mozilla-central:dom/events/EventDispatcher.cpp:cad9c9573579|827|0x5
0|42|libxul.so|nsDocumentViewer::LoadComplete|hg:hg.mozilla.org/mozilla-central:layout/base/nsDocumentViewer.cpp:cad9c9573579|1064|0x25
0|43|libxul.so|nsDocShell::EndPageLoad|hg:hg.mozilla.org/mozilla-central:docshell/base/nsDocShell.cpp:cad9c9573579|7867|0x18
0|44|libxul.so|nsDocShell::OnStateChange|hg:hg.mozilla.org/mozilla-central:docshell/base/nsDocShell.cpp:cad9c9573579|7661|0x18
0|45|libxul.so|nsDocLoader::DoFireOnStateChange|hg:hg.mozilla.org/mozilla-central:uriloader/base/nsDocLoader.cpp:cad9c9573579|1319|0x2b
0|46|libxul.so|nsDocLoader::doStopDocumentLoad|hg:hg.mozilla.org/mozilla-central:uriloader/base/nsDocLoader.cpp:cad9c9573579|862|0x22
0|47|libxul.so|nsDocLoader::DocLoaderIsEmpty|hg:hg.mozilla.org/mozilla-central:uriloader/base/nsDocLoader.cpp:cad9c9573579|751|0xf
0|48|libxul.so|nsDocLoader::OnStopRequest|hg:hg.mozilla.org/mozilla-central:uriloader/base/nsDocLoader.cpp:cad9c9573579|633|0x16
0|49|libxul.so|mozilla::net::nsLoadGroup::RemoveRequest|hg:hg.mozilla.org/mozilla-central:netwerk/base/nsLoadGroup.cpp:cad9c9573579|629|0x1f
0|50|libxul.so|nsDocument::DoUnblockOnload|hg:hg.mozilla.org/mozilla-central:dom/base/nsDocument.cpp:cad9c9573579|9388|0x20
0|51|libxul.so|nsDocument::UnblockOnload|hg:hg.mozilla.org/mozilla-central:dom/base/nsDocument.cpp:cad9c9573579|9310|0x5
0|52|libxul.so|nsDocument::DispatchContentLoadedEvents|hg:hg.mozilla.org/mozilla-central:dom/base/nsDocument.cpp:cad9c9573579|5677|0x11
0|53|libxul.so|mozilla::detail::RunnableMethodImpl<nsDocument*, void (nsDocument::*)(), true, (mozilla::RunnableKind)0u>::Run|hg:hg.mozilla.org/mozilla-central:xpcom/threads/nsThreadUtils.h:cad9c9573579|1142|0x13
0|54|libxul.so|mozilla::SchedulerGroup::Runnable::Run|hg:hg.mozilla.org/mozilla-central:xpcom/threads/SchedulerGroup.cpp:cad9c9573579|396|0x1c
0|55|libxul.so|nsThread::ProcessNextEvent|hg:hg.mozilla.org/mozilla-central:xpcom/threads/nsThread.cpp:cad9c9573579|1033|0x15
0|56|libxul.so|NS_ProcessNextEvent|hg:hg.mozilla.org/mozilla-central:xpcom/threads/nsThreadUtils.cpp:cad9c9573579|508|0x11
0|57|libxul.so|mozilla::ipc::MessagePump::Run|hg:hg.mozilla.org/mozilla-central:ipc/glue/MessagePump.cpp:cad9c9573579|97|0xa
0|58|libxul.so|MessageLoop::RunInternal|hg:hg.mozilla.org/mozilla-central:ipc/chromium/src/base/message_loop.cc:cad9c9573579|326|0x17
0|59|libxul.so|MessageLoop::Run|hg:hg.mozilla.org/mozilla-central:ipc/chromium/src/base/message_loop.cc:cad9c9573579|319|0x8
0|60|libxul.so|nsBaseAppShell::Run|hg:hg.mozilla.org/mozilla-central:widget/nsBaseAppShell.cpp:cad9c9573579|157|0xd
0|61|libxul.so|XRE_RunAppShell|hg:hg.mozilla.org/mozilla-central:toolkit/xre/nsEmbedFunctions.cpp:cad9c9573579|865|0x11
0|62|libxul.so|mozilla::ipc::MessagePumpForChildProcess::Run|hg:hg.mozilla.org/mozilla-central:ipc/glue/MessagePump.cpp:cad9c9573579|269|0x5
0|63|libxul.so|MessageLoop::RunInternal|hg:hg.mozilla.org/mozilla-central:ipc/chromium/src/base/message_loop.cc:cad9c9573579|326|0x17
0|64|libxul.so|MessageLoop::Run|hg:hg.mozilla.org/mozilla-central:ipc/chromium/src/base/message_loop.cc:cad9c9573579|319|0x8
0|65|libxul.so|XRE_InitChildProcess|hg:hg.mozilla.org/mozilla-central:toolkit/xre/nsEmbedFunctions.cpp:cad9c9573579|691|0x8
0|66|firefox|content_process_main|hg:hg.mozilla.org/mozilla-central:ipc/contentproc/plugin-container.cpp:cad9c9573579|63|0x14
0|67|firefox|main|hg:hg.mozilla.org/mozilla-central:browser/app/nsBrowserApp.cpp:cad9c9573579|280|0x11
0|68|libc-2.23.so||||0x20830
0|69|firefox|MOZ_ReportAssertionFailure|hg:hg.mozilla.org/mozilla-central:mfbt/Assertions.h:cad9c9573579|165|0x5
Flags: in-testsuite?
Nika's been making changes in this area recently so perhaps she has an idea of what's going on.
Flags: needinfo?(nika)
Priority: -- → P2
I ran the fuzz testcase under rr and this came up as the cause of
mBeforeUnloadListenerCount being -1.

This might not be the correct solution - the real problem might be that it's
possible to register a new event listener after FreeInnerObjects has been
called, but it will help keep the invariant that mBeforeUnloadListenerCount
never drops below 0.

MozReview-Commit-ID: EavGhe0Cfw
Attachment #8932221 - Flags: review?(kyle)
Flags: needinfo?(nika)
Assignee: nobody → nika
Attachment #8932221 - Flags: review?(kyle) → review+
Pushed by nika@thelayzells.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/dd961743507f
Ensure mBeforeUnloadListenerCount doesn't drop below 0 when FreeInnerObjects is called, r=qdot
https://hg.mozilla.org/mozilla-central/rev/dd961743507f
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
Is this testcase landable? Also, AFAICT, the affected code goes back to Fx55 timeframe - is there a user impact that warrants Beta uplift consideration here or can it ride the 59 train?
Flags: needinfo?(nika)
(In reply to Ryan VanderMeulen [:RyanVM] from comment #5)
> Is this testcase landable? Also, AFAICT, the affected code goes back to Fx55
> timeframe - is there a user impact that warrants Beta uplift consideration
> here or can it ride the 59 train?

This testcase requires custom elements which are disabled by default right now, and I don't know if it's possible to trigger without them. It's also not really a security bug, so I'm inclined to just let it ride the trains.

I should probably land this testcase. I'll look into doing that.
Flags: needinfo?(nika)
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: