Commit e0f00ad7 authored by Romain Courteaud's avatar Romain Courteaud

Remove openDatabase error when loading jIO.

Do not display error in browser not implementing WebSQL.
WebSQLStorage will raise an error is used in such browsers.
parent 2db25474
/*global window, RSVP, Blob, XMLHttpRequest, QueryFactory, Query, atob, /*global window, RSVP, Blob, XMLHttpRequest, QueryFactory, Query, atob,
FileReader, ArrayBuffer, Uint8Array */ FileReader, ArrayBuffer, Uint8Array, navigator */
(function (window, RSVP, Blob, QueryFactory, Query, atob, (function (window, RSVP, Blob, QueryFactory, Query, atob,
FileReader, ArrayBuffer, Uint8Array) { FileReader, ArrayBuffer, Uint8Array, navigator) {
"use strict"; "use strict";
if (window.openDatabase === undefined) {
window.openDatabase = function () {
throw new Error('WebSQL is not supported by ' + navigator.userAgent);
};
}
var util = {}, var util = {},
jIO; jIO;
...@@ -504,4 +510,4 @@ ...@@ -504,4 +510,4 @@
window.jIO = jIO; window.jIO = jIO;
}(window, RSVP, Blob, QueryFactory, Query, atob, }(window, RSVP, Blob, QueryFactory, Query, atob,
FileReader, ArrayBuffer, Uint8Array)); FileReader, ArrayBuffer, Uint8Array, navigator));
...@@ -11,9 +11,17 @@ ...@@ -11,9 +11,17 @@
equal = QUnit.equal, equal = QUnit.equal,
module = QUnit.module, module = QUnit.module,
big_string = "", big_string = "",
db = openDatabase('jio:qunit', '1.0', '', 2 * 1024 * 1024), db,
j; j;
try {
db = openDatabase('jio:qunit', '1.0', '', 2 * 1024 * 1024);
} catch (ignore) {
}
if (db === undefined) {
return;
}
function getSpy() { function getSpy() {
return new RSVP.Promise(function (resolve, reject) { return new RSVP.Promise(function (resolve, reject) {
var spy; var spy;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment