aboutsummaryrefslogtreecommitdiff
path: root/ext/js/pages/permissions-main.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/js/pages/permissions-main.js')
-rw-r--r--ext/js/pages/permissions-main.js82
1 files changed, 35 insertions, 47 deletions
diff --git a/ext/js/pages/permissions-main.js b/ext/js/pages/permissions-main.js
index 1659bea5..3092782b 100644
--- a/ext/js/pages/permissions-main.js
+++ b/ext/js/pages/permissions-main.js
@@ -17,7 +17,6 @@
*/
import {Application} from '../application.js';
-import {log} from '../core/logger.js';
import {promiseTimeout} from '../core/utilities.js';
import {DocumentFocusController} from '../dom/document-focus-controller.js';
import {querySelectorNotNull} from '../dom/query-selector.js';
@@ -87,63 +86,52 @@ function setupPermissionsToggles() {
}
}
-/** Entry point. */
-async function main() {
- try {
- const application = new Application();
+await Application.main(async (application) => {
+ const documentFocusController = new DocumentFocusController();
+ documentFocusController.prepare();
- const documentFocusController = new DocumentFocusController();
- documentFocusController.prepare();
+ const extensionContentController = new ExtensionContentController();
+ extensionContentController.prepare();
- const extensionContentController = new ExtensionContentController();
- extensionContentController.prepare();
+ setupPermissionsToggles();
- setupPermissionsToggles();
+ setupEnvironmentInfo(application.api);
- await application.prepare();
+ /** @type {HTMLInputElement} */
+ const permissionCheckbox1 = querySelectorNotNull(document, '#permission-checkbox-allow-in-private-windows');
+ /** @type {HTMLInputElement} */
+ const permissionCheckbox2 = querySelectorNotNull(document, '#permission-checkbox-allow-file-url-access');
+ /** @type {HTMLInputElement[]} */
+ const permissionsCheckboxes = [permissionCheckbox1, permissionCheckbox2];
- setupEnvironmentInfo(application.api);
+ const permissions = await Promise.all([
+ isAllowedIncognitoAccess(),
+ isAllowedFileSchemeAccess()
+ ]);
- /** @type {HTMLInputElement} */
- const permissionCheckbox1 = querySelectorNotNull(document, '#permission-checkbox-allow-in-private-windows');
- /** @type {HTMLInputElement} */
- const permissionCheckbox2 = querySelectorNotNull(document, '#permission-checkbox-allow-file-url-access');
- /** @type {HTMLInputElement[]} */
- const permissionsCheckboxes = [permissionCheckbox1, permissionCheckbox2];
-
- const permissions = await Promise.all([
- isAllowedIncognitoAccess(),
- isAllowedFileSchemeAccess()
- ]);
-
- for (let i = 0, ii = permissions.length; i < ii; ++i) {
- permissionsCheckboxes[i].checked = permissions[i];
- }
-
- const modalController = new ModalController();
- modalController.prepare();
+ for (let i = 0, ii = permissions.length; i < ii; ++i) {
+ permissionsCheckboxes[i].checked = permissions[i];
+ }
- const settingsController = new SettingsController(application);
- await settingsController.prepare();
+ const modalController = new ModalController();
+ modalController.prepare();
- const permissionsToggleController = new PermissionsToggleController(settingsController);
- permissionsToggleController.prepare();
+ const settingsController = new SettingsController(application);
+ await settingsController.prepare();
- const permissionsOriginController = new PermissionsOriginController(settingsController);
- permissionsOriginController.prepare();
+ const permissionsToggleController = new PermissionsToggleController(settingsController);
+ permissionsToggleController.prepare();
- const persistentStorageController = new PersistentStorageController(application);
- persistentStorageController.prepare();
+ const permissionsOriginController = new PermissionsOriginController(settingsController);
+ permissionsOriginController.prepare();
- await promiseTimeout(100);
+ const persistentStorageController = new PersistentStorageController(application);
+ persistentStorageController.prepare();
- document.documentElement.dataset.loaded = 'true';
+ await promiseTimeout(100);
- const settingsDisplayController = new SettingsDisplayController(settingsController, modalController);
- settingsDisplayController.prepare();
- } catch (e) {
- log.error(e);
- }
-}
+ document.documentElement.dataset.loaded = 'true';
-await main();
+ const settingsDisplayController = new SettingsDisplayController(settingsController, modalController);
+ settingsDisplayController.prepare();
+});