fix: error if a11y support changed before ready (#16261)

This commit is contained in:
Shelley Vohr 2019-01-04 07:20:06 -08:00 committed by John Kleinschmidt
parent 2117524102
commit de0e4735de
3 changed files with 12 additions and 3 deletions

View file

@ -1022,7 +1022,14 @@ bool App::IsAccessibilitySupportEnabled() {
return ax_state->IsAccessibleBrowser();
}
void App::SetAccessibilitySupportEnabled(bool enabled) {
void App::SetAccessibilitySupportEnabled(bool enabled, mate::Arguments* args) {
if (!Browser::Get()->is_ready()) {
args->ThrowError(
"app.setAccessibilitySupportEnabled() can only be called "
"after app is ready");
return;
}
auto* ax_state = content::BrowserAccessibilityState::GetInstance();
if (enabled) {
ax_state->OnScreenReaderDetected();