Disable or delete places.sqlite

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Disable or delete places.sqlite

Andreas Franz
Xulrunner automatically creates a places.sqlite file in the profile directory. Due to performanve optimizations it is at least 10MB of size and grows in chunks of 10MB. Is there a way to disable the history to get rid of this file or at least delete it on application closing? My problem is that the profile of the users of my xulrunner application is stored on a server and so the profile gets very large.

I searched a bit around but didn't find a way to solve my problem.
_______________________________________________
dev-tech-xul mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xul
Reply | Threaded
Open this post in threaded view
|

Re: Disable or delete places.sqlite

Neil-4
Andreas Franz wrote:

>Xulrunner automatically creates a places.sqlite file in the profile directory. Due to performance optimizations it is at least 10MB of size and grows in chunks of 10MB. Is there a way to disable the history to get rid of this file or at least delete it on application closing?
>
Try the places.history.enabled preference.

--
Warning: May contain traces of nuts.
_______________________________________________
dev-tech-xul mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xul
Reply | Threaded
Open this post in threaded view
|

Re: Disable or delete places.sqlite

Andreas Franz
Am Sonntag, 2. Februar 2014 13:04:54 UTC+1 schrieb Neil:

> Andreas Franz wrote:
>
>
>
> >Xulrunner automatically creates a places.sqlite file in the profile directory. Due to performance optimizations it is at least 10MB of size and grows in chunks of 10MB. Is there a way to disable the history to get rid of this file or at least delete it on application closing?
>
> >
>
> Try the places.history.enabled preference.
>
>
>
> --
>
> Warning: May contain traces of nuts.

I set places.history.enabled to false and I've also deleted places.sqlite by hand but it's always recreated on startup and has a size of 10240KB.
_______________________________________________
dev-tech-xul mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xul
Reply | Threaded
Open this post in threaded view
|

Re: Disable or delete places.sqlite

Andreas Franz
In reply to this post by Andreas Franz
I've found a solution: I added an observer that listens to the "places-connection-closed" event:

function clearDB() {
        try {
                var file = Components.classes["@mozilla.org/file/directory_service;1"].
           getService(Components.interfaces.nsIProperties).
           get("ProfD", Components.interfaces.nsIFile);
                file.append("places.sqlite");
                if (file.exists()){
                        file.remove(false);
                }
        } catch(ex) { }
}

function myObserver()
{
  this.register();
}

myObserver.prototype = {
  observe: function(subject, topic, data) {
        clearDB();
  },
  register: function() {
    var observerService = Components.classes["@mozilla.org/observer-service;1"]
                          .getService(Components.interfaces.nsIObserverService);
    observerService.addObserver(this, "places-connection-closed", false);
  },
  unregister: function() {
    var observerService = Components.classes["@mozilla.org/observer-service;1"]
                            .getService(Components.interfaces.nsIObserverService);
    observerService.removeObserver(this, "places-connection-closed");
  }
}
observer = new myObserver();
_______________________________________________
dev-tech-xul mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xul