Commit 3788e097 authored by Devlin Cronin's avatar Devlin Cronin Committed by Commit Bot

[Extensions Menu] Properly clean up the views in BrowserActionApiTest

Properly dispose of the custom views created in BrowserActionApiTest
during the tear down phase. This prevents a UAF when the view tries to
clean up after the profile is destroyed.

This was just an issue in the test, not in the wild (where views
associated with a browser will never outlive the profile).

Bug: 984654

Change-Id: Ied7dc0bd9c471fa2445b92096550adf09575043a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2042390Reviewed-by: default avatarPeter Boström <pbos@chromium.org>
Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#739077}
parent e80df6f2
...@@ -113,6 +113,13 @@ class BrowserActionApiTest : public ExtensionApiTest { ...@@ -113,6 +113,13 @@ class BrowserActionApiTest : public ExtensionApiTest {
host_resolver()->AddRule("*", "127.0.0.1"); host_resolver()->AddRule("*", "127.0.0.1");
} }
void TearDownOnMainThread() override {
// Clean up the test util first, so that any created UI properly removes
// itself before profile destruction.
browser_action_test_util_ = nullptr;
ExtensionApiTest::TearDownOnMainThread();
}
protected: protected:
ExtensionActionTestHelper* GetBrowserActionsBar() { ExtensionActionTestHelper* GetBrowserActionsBar() {
if (!browser_action_test_util_) if (!browser_action_test_util_)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment