aboutsummaryrefslogtreecommitdiff
path: root/ext/js/accessibility/accessibility-controller.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/js/accessibility/accessibility-controller.js')
-rw-r--r--ext/js/accessibility/accessibility-controller.js17
1 files changed, 5 insertions, 12 deletions
diff --git a/ext/js/accessibility/accessibility-controller.js b/ext/js/accessibility/accessibility-controller.js
index 8250b369..2b352948 100644
--- a/ext/js/accessibility/accessibility-controller.js
+++ b/ext/js/accessibility/accessibility-controller.js
@@ -16,19 +16,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+import {isContentScriptRegistered, registerContentScript, unregisterContentScript} from '../background/script-manager.js';
import {log} from '../core.js';
/**
* This class controls the registration of accessibility handlers.
*/
export class AccessibilityController {
- /**
- * Creates a new instance.
- * @param {import('../background/script-manager.js').ScriptManager} scriptManager An instance of the `ScriptManager` class.
- */
- constructor(scriptManager) {
- /** @type {import('../background/script-manager.js').ScriptManager} */
- this._scriptManager = scriptManager;
+ constructor() {
/** @type {?import('core').TokenObject} */
this._updateGoogleDocsAccessibilityToken = null;
/** @type {?Promise<void>} */
@@ -90,19 +85,17 @@ export class AccessibilityController {
const id = 'googleDocsAccessibility';
try {
if (forceGoogleDocsHtmlRenderingAny) {
- if (await this._scriptManager.isContentScriptRegistered(id)) { return; }
+ if (await isContentScriptRegistered(id)) { return; }
/** @type {import('script-manager').RegistrationDetails} */
const details = {
allFrames: true,
- matchAboutBlank: true,
matches: ['*://docs.google.com/*'],
- urlMatches: '^[^:]*://docs\\.google\\.com/[\\w\\W]*$',
runAt: 'document_start',
js: ['js/accessibility/google-docs.js']
};
- await this._scriptManager.registerContentScript(id, details);
+ await registerContentScript(id, details);
} else {
- await this._scriptManager.unregisterContentScript(id);
+ await unregisterContentScript(id);
}
} catch (e) {
log.error(e);