Project

General

Profile

« Previous | Next » 

Revision 587c1a88

Added by koszko over 1 year ago

display an informative message in settings page if IndexedDB cannot be accessed

View differences:

html/settings.js
41 41
 * proprietary program, I am not going to enforce this in court.
42 42
 */
43 43

  
44
#IMPORT common/indexeddb.js AS haketilodb
44 45
#IMPORT html/dialog.js
45 46

  
47
#IF MOZILLA
48
#FROM common/browser.js IMPORT browser
49
#ENDIF
50

  
46 51
#FROM html/DOM_helpers.js     IMPORT by_id
47 52
#FROM html/text_entry_list.js IMPORT blocking_allowing_lists, repo_list
48 53
#FROM html/item_list.js       IMPORT mapping_list, resource_list
......
118 123
    containers[0].append((await repo_list(dialog_ctx)).main_div);
119 124
}
120 125

  
121
set_up_blocking_tab();
122
set_up_mappings_tab();
123
set_up_resources_tab();
124
set_up_new_payload_tab();
125
set_up_repos_tab();
126
function set_up_settings_view() {
127
    by_id("loader").remove();
128
    by_id("main_view").classList.remove("hide");
129

  
130
    set_up_blocking_tab();
131
    set_up_mappings_tab();
132
    set_up_resources_tab();
133
    set_up_new_payload_tab();
134
    set_up_repos_tab();
135
}
136

  
137
#IF MOZILLA
138
async function show_indexeddb_error() {
139
    const this_tab = await browser.tabs.getCurrent();
140
    if (this_tab.incognito)
141
	by_id("indexeddb_private_mode_explanation").classList.remove("hide");
142
#ELSE
143
function show_indexeddb_error() {
144
#ENDIF
145
    by_id("loader").remove();
146
    by_id("indexeddb_error").classList.remove("hide");
147
}
148

  
149
async function init_settings_page() {
150
    try {
151
	await haketilodb.get();
152
    } catch(e) {
153
	console.error(e);
154
	show_indexeddb_error();
155
	return;
156
    }
157

  
158
    set_up_settings_view();
159
}
160

  
161
#IF UNIT_TEST
162
window.init_settings_page = init_settings_page;
163
#ELSE
164
init_settings_page();
165
#ENDIF

Also available in: Unified diff