Fix PermissionObserver OOB access crash

This change fixes a crash caused by an OOB access from the
|chooser_observer_| when removing the observer upon the destruction of
SiteSettingsHandler. The crash occurs when the following conditions are

1. An off the record profile is created.
2. A chooser permission is granted in the off the record profile.
3. The chrome://settings/content page is opened in the main profile
4. The off the record window is closed.
5. The chrome://settings/content page is closed.

The SiteSettingsHandler will attempt to remove itself from the off the
record ChooserContextBase upon destruction, but the off the record
ChooserContextBase was already destroyed previously, therefore accessing
memory that has already been freed.

This change removes the logic that adds the SiteSettingsHandler to the
off the record ChooserContextBase, since the UI does not actually
display off the record chooser permissions anyways. I created for adding this feature.

Bug: 926501
Change-Id: I87359a3d67020a80b9fb698d5252c320436317de
Reviewed-by: Dan Beam <>
Commit-Queue: Ovidio de Jesús Ruiz-Henríquez <>
Cr-Original-Commit-Position: refs/heads/master@{#628468}(cherry picked from commit 15a43eca69de36953bd187b5b4f9595388aa91c2)
Reviewed-by: Ovidio de Jesús Ruiz-Henríquez <>
Cr-Commit-Position: refs/branch-heads/3683@{#161}
Cr-Branched-From: e51029943e0a38dd794b73caaf6373d5496ae783-refs/heads/master@{#625896}
2 files changed