Somehow when testing NetworkService I got in a state where opening a new tab creates this DCHECK failure:
23297:23342:1003/150051.636569:FATAL:service_worker_version.cc(748)] Check failed: !HasControllee().
#0 0x7f847c71ca07 base::debug::StackTrace::StackTrace()
#1 0x7f847c744011 logging::LogMessage::~LogMessage()
#2 0x7f8479ea6ad6 content::ServiceWorkerVersion::Doom()
#3 0x7f8479e7e24e content::ServiceWorkerRegistration::DeleteVersion()
#4 0x7f8479e55c31 content::ServiceWorkerInstalledScriptsSender::OnAbortSendingScript()
#5 0x7f8479e55fe0 content::ServiceWorkerInstalledScriptsSender::Sender::OnReadInfoComplete()
I guess my NewTabPage service worker disk entry is corrupted.
However we shouldn't be crashing.
I think what's happening is when opening a new tab, the provider host for the navigation (to the NTP) is created, and the SW is set as the controller at:
#1 0x7f8479ea600f content::ServiceWorkerVersion::AddControllee()
#2 0x7f8479e68b9c content::ServiceWorkerProviderHost::SetControllerVersionAttribute()
#3 0x7f8479e6952e content::ServiceWorkerProviderHost::AssociateRegistration()
#4 0x7f8479e340b2 content::ServiceWorkerControlleeRequestHandler::DidLookupRegistrationForMainResource()
DeleteVersion() tries to remove all the provider hosts before calling Doom(). However the provider host isn't added to the ServiceWorkerContextCore's list of hosts until SWDispatcherHost gets the OnProviderCreated message, which will never happen. Therefore the ServiceWorkerVersion keeps the controllee and DCHECKs in Doom().
Seems like the solution is for SWVersion to remove all its providers directly instead of having SWRegistration rely on SWSContextCore's list.
Comment 1 by bugdroid1@chromium.org
, Oct 3 2017