The Add-on SDK is isolated by default and does not provide direct access to XPCOM. To use XPCOM objects, you need to exit the sandbox :
var {Cc, Ci, Cu} = require("chrome"); var {Services} = Cu.import("resource://gre/modules/Services.jsm"); var {FileUtils} = Cu.import("resource://gre/modules/FileUtils.jsm"); var file = FileUtils.getFile("ProfD", ["my_db_file_name.sqlite"]); var mDBConn = Services.storage.openDatabase(file);
Note that Components remains undefined - use Cc instead of Components.classes , Ci instead of Components.interfaces and Cu instead of Components.utils .
source share