dscrank
dscrank

Reputation: 31

WebSQL in Chrome 32

I have a Chrome extension I wrote to log the searches I do in various search engines. Up until a few days ago, it worked fine. And then it stopped. Poking around in the code, as far as I can determine, the WebSQL stopped working. The commands are running, and there's a database in the resources tab, but there's no table in it. With no table, nothing gets stored, and nothing gets retrieved.

This is using the same code that worked a week ago: the only change that I can see is that Chrome updated from version 31 to version 32. I've tried unloading and reloading the extension, and tried several different versions of the code, but so far, nothing. Has Chrome stopped supporting WebSQL? I can't find any information on that. Or is there a simple fix, like a new permission I need to add in the extensions manifest?

For reference, the relevant lines of code look like this:

var searchrecord = {};
searchrecord.webdb = {};
searchrecord.webdb.db = null;

searchrecord.webdb.open = function() {
  console.log("Creating database.");
  var dbSize = 5 * 1024 * 1024; // 5MB
  searchrecord.webdb.db = openDatabase("SearchRecord", "1.2", 
                                         "Query Recorder database", dbSize);
};

searchrecord.webdb.createTable = function() {
  console.log("Creating table.");
  var db = searchrecord.webdb.db;
  db.transaction(function(tx) {
     tx.executeSql("CREATE TABLE IF NOT EXISTS searchrecord(ID " +
                  "INTEGER PRIMARY KEY ASC, query TEXT, results TEXT," +
                  "  finds TEXT, notes TEXT, engine TEXT," + 
                  "  options TEXT, time_performed DATETIME, synced TEXT)", []);    
  });
};

searchrecord.webdb.open();
searchrecord.webdb.createTable();

Thanks for the help.

Upvotes: 2

Views: 503

Answers (1)

dscrank
dscrank

Reputation: 31

Problem resolved, but I'm answering my own question in case others have the same issue. The problem apparently was that I needed the unlimitedStorage permission set in the Extension manifest. As I was under the 5 MB limit for local storage, this indicates either a bug or that Google has lowered the storage threshold in Chrome.

Upvotes: 1

Related Questions