Merge pull request #1 from pressbooks/cagp-dev-mtl-patch-1

Update request-queue.js
pull/80/head
Carlos Gutiérrez 2020-02-27 00:11:51 -06:00 committed by GitHub
commit b3fa5028bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 4 deletions

View File

@ -27,7 +27,11 @@ H5P.RequestQueue = (function ($, EventDispatcher) {
* @returns {boolean}
*/
RequestQueue.prototype.add = function (url, data) {
if (!window.localStorage) {
try {
if (!window.localStorage) {
return false;
}
} catch(err) {
return false;
}
@ -56,7 +60,11 @@ H5P.RequestQueue = (function ($, EventDispatcher) {
* @returns {boolean|Array} Stored requests
*/
RequestQueue.prototype.getStoredRequests = function () {
if (!window.localStorage) {
try {
if (!window.localStorage) {
return false;
}
} catch(err) {
return false;
}
@ -74,7 +82,11 @@ H5P.RequestQueue = (function ($, EventDispatcher) {
* @returns {boolean} True if the storage was successfully cleared
*/
RequestQueue.prototype.clearQueue = function () {
if (!window.localStorage) {
try {
if (!window.localStorage) {
return false;
}
} catch(err) {
return false;
}
@ -89,7 +101,11 @@ H5P.RequestQueue = (function ($, EventDispatcher) {
*/
RequestQueue.prototype.resumeQueue = function () {
// Not supported
if (!H5PIntegration || !window.navigator || !window.localStorage) {
try {
if (!H5PIntegration || !window.navigator || !window.localStorage) {
return false;
}
} catch(err) {
return false;
}