fix: error if a11y support changed before ready (#16261)
This commit is contained in:
		
					parent
					
						
							
								2117524102
							
						
					
				
			
			
				commit
				
					
						de0e4735de
					
				
			
		
					 3 changed files with 12 additions and 3 deletions
				
			
		| 
						 | 
					@ -1022,7 +1022,14 @@ bool App::IsAccessibilitySupportEnabled() {
 | 
				
			||||||
  return ax_state->IsAccessibleBrowser();
 | 
					  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();
 | 
					  auto* ax_state = content::BrowserAccessibilityState::GetInstance();
 | 
				
			||||||
  if (enabled) {
 | 
					  if (enabled) {
 | 
				
			||||||
    ax_state->OnScreenReaderDetected();
 | 
					    ax_state->OnScreenReaderDetected();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -192,7 +192,7 @@ class App : public AtomBrowserClient::Delegate,
 | 
				
			||||||
  void DisableHardwareAcceleration(mate::Arguments* args);
 | 
					  void DisableHardwareAcceleration(mate::Arguments* args);
 | 
				
			||||||
  void DisableDomainBlockingFor3DAPIs(mate::Arguments* args);
 | 
					  void DisableDomainBlockingFor3DAPIs(mate::Arguments* args);
 | 
				
			||||||
  bool IsAccessibilitySupportEnabled();
 | 
					  bool IsAccessibilitySupportEnabled();
 | 
				
			||||||
  void SetAccessibilitySupportEnabled(bool enabled);
 | 
					  void SetAccessibilitySupportEnabled(bool enabled, mate::Arguments* args);
 | 
				
			||||||
  Browser::LoginItemSettings GetLoginItemSettings(mate::Arguments* args);
 | 
					  Browser::LoginItemSettings GetLoginItemSettings(mate::Arguments* args);
 | 
				
			||||||
#if defined(USE_NSS_CERTS)
 | 
					#if defined(USE_NSS_CERTS)
 | 
				
			||||||
  void ImportCertificate(const base::DictionaryValue& options,
 | 
					  void ImportCertificate(const base::DictionaryValue& options,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1098,9 +1098,11 @@ details.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* `enabled` Boolean - Enable or disable [accessibility tree](https://developers.google.com/web/fundamentals/accessibility/semantics-builtin/the-accessibility-tree) rendering
 | 
					* `enabled` Boolean - Enable or disable [accessibility tree](https://developers.google.com/web/fundamentals/accessibility/semantics-builtin/the-accessibility-tree) rendering
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Manually enables Chrome's accessibility support, allowing to expose accessibility switch to users in application settings. https://www.chromium.org/developers/design-documents/accessibility for more
 | 
					Manually enables Chrome's accessibility support, allowing to expose accessibility switch to users in application settings. See [Chromium's accessibility docs](https://www.chromium.org/developers/design-documents/accessibility) for more
 | 
				
			||||||
details. Disabled by default.
 | 
					details. Disabled by default.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					This API must be called after the `ready` event is emitted.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
**Note:** Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default.
 | 
					**Note:** Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### `app.showAboutPanel` _macOS_ _Linux_
 | 
					### `app.showAboutPanel` _macOS_ _Linux_
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue