Skip to content

Commit 0a5dbae

Browse files
committed
more intelligible failure
1 parent 3a741e5 commit 0a5dbae

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

html5/js/Utilities.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,12 @@ const Utilities = {
126126
hash = "SHA-" + hash.substring(3);
127127
}
128128

129+
if (typeof crypto.subtle === "undefined") {
130+
return new Promise(function(resolve, reject) {
131+
reject(new Error("crypto.subtle API is not available in this context"));
132+
});
133+
}
134+
129135
const promise = new Promise(function(resolve, reject) {
130136
Utilities.clog("crypto.subtle=", crypto.subtle);
131137
Utilities.clog("crypto.subtle.importKey=", crypto.subtle.importKey);

0 commit comments

Comments
 (0)