Skip to content

PouchDB on Chrome Applications

Howon Lee edited this page May 27, 2013 · 6 revisions

Currently, functionality in Chrome Applications is pretty rudimentary. Actually, that was sort of a lie. Here's the explanation:

Nearly all of PouchDB works fine on Chrome Apps, except for the fact that the latest manifest version (manifest version 2) absolutely bans the use of eval() in Chrome applications. Makes sense, because eval() is insecure, but it means that the parts of our code that uses eval() just don't work unless you use an older manifest version. To complicate matters, the older manifest version has actually been phased out in the newer versions of Chrome. You can actually work around this using sandboxing.

I have a working example of a Chrome app that doesn't use eval() at chromepouch.com.

How to test or use the functionality for Chrome Apps:

Two options:

  1. You want to test the tests which use eval() in some way shape or form:
    1. Install a version of Chrome that's before when they took the legacy stuff out, which included the ability to mess with security like we did and enable eval()'s. Go here for details on the old version.
    2. Go to chrome extensions, enable developer mode, install the package app from the pouchdb directory. Run the app. This brings up test.html, the web runner. The tests should all pass.
  2. You don't mind that all the tests which use eval() in some way shape or form fail:
    1. Change the manifest_version in manifest.json to 2, instead of 1 which it currently is
    2. Go to Chrome extensions, enable Developer Mode, install the package app from the Pouchdb directory. Run the app. This brings up test.html, the web runner.