diff options
Diffstat (limited to 'chromium/components/keyed_service/core/refcounted_keyed_service_factory.cc')
-rw-r--r-- | chromium/components/keyed_service/core/refcounted_keyed_service_factory.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/chromium/components/keyed_service/core/refcounted_keyed_service_factory.cc b/chromium/components/keyed_service/core/refcounted_keyed_service_factory.cc index 7c44c2ce389..7afecda34f6 100644 --- a/chromium/components/keyed_service/core/refcounted_keyed_service_factory.cc +++ b/chromium/components/keyed_service/core/refcounted_keyed_service_factory.cc @@ -28,6 +28,12 @@ void RefcountedKeyedServiceFactory::SetTestingFactory( // destruction. bool add_context = ArePreferencesSetOn(context); + // Ensure that |context| is not marked as stale (e.g., due to it aliasing an + // instance that was destroyed in an earlier test) in order to avoid accesses + // to |context| in |ContextShutdown| from causing + // |AssertBrowserContextWasntDestroyed| to raise an error. + MarkContextLive(context); + // We have to go through the shutdown and destroy mechanisms because there // are unit tests that create a service on a context and then change the // testing service mid-test. |