{"action":"created","comment":{"url":"https://api.github.com/repos/Kinto/kinto.js/pulls/comments/43140444","id":43140444,"diff_hunk":"@@ -0,0 +1,227 @@\n+/*\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *     http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+import BaseAdapter from \"../src/adapters/base\";\n+\n+Components.utils.import(\"resource://gre/modules/Sqlite.jsm\");\n+Components.utils.import(\"resource://gre/modules/Task.jsm\");\n+\n+const statements = {\n+  \"createCollectionData\": `\n+    CREATE TABLE collection_data (\n+      collection_name TEXT,\n+      record_id TEXT,\n+      record TEXT\n+    );`,\n+\n+  \"createCollectionMetadata\": `\n+    CREATE TABLE collection_metadata (\n+      collection_name TEXT PRIMARY KEY,\n+      last_modified INTEGER\n+    ) WITHOUT ROWID;`,\n+\n+  \"createCollectionDataRecordIdIndex\": `\n+    CREATE UNIQUE INDEX unique_collection_record\n+      ON collection_data(collection_name, record_id);`,\n+\n+  \"clearData\": `\n+    DELETE FROM collection_data\n+      WHERE collection_name = :collection_name;`,\n+\n+  \"createData\": `\n+    INSERT INTO collection_data (collection_name, record_id, record)\n+      VALUES (:collection_name, :record_id, :record)`,\n+\n+  \"updateData\": `\n+    UPDATE collection_data\n+      SET record = :record\n+        WHERE collection_name = :collection_name\n+        AND record_id = :record_id`,\n+\n+  \"deleteData\": `\n+    DELETE FROM collection_data\n+      WHERE collection_name = :collection_name\n+      AND record_id = :record_id`,\n+\n+  \"saveLastModified\": `\n+    REPLACE INTO collection_metadata (collection_name, last_modified)\n+      VALUES (:collection_name, :last_modified)`,\n+\n+  \"getLastModified\": `\n+    SELECT last_modified\n+      FROM collection_metadata\n+        WHERE collection_name = :collection_name`,\n+\n+  \"getRecord\": `\n+    SELECT record\n+      FROM collection_data\n+        WHERE collection_name = :collection_name\n+        AND record_id = :record_id`,\n+\n+  \"listRecords\": `\n+    SELECT record\n+      FROM collection_data\n+        WHERE collection_name = :collection_name`\n+};\n+\n+const createStatements = [\"createCollectionData\",\n+                          \"createCollectionMetadata\",\n+                          \"createCollectionDataRecordIdIndex\"];\n+\n+export default class FirefoxAdapter extends BaseAdapter {\n+  constructor(dbname) {\n+    super();\n+    this.dbname = dbname;\n+\n+    // make a promise to initialize\n+    const self = this;\n+    this.init = Task.spawn(function* () {\n+      let connection;\n+      try {\n+        connection = yield self._doOpenConnection();","path":"fx-src/FirefoxStorage.js","position":92,"original_position":92,"commit_id":"7e47e5fa6d4793c0eb91996ff91e639a550dcbf5","original_commit_id":"7e47e5fa6d4793c0eb91996ff91e639a550dcbf5","user":{"login":"rnewman","id":91722,"avatar_url":"https://avatars.githubusercontent.com/u/91722?v=3","gravatar_id":"","url":"https://api.github.com/users/rnewman","html_url":"https://github.com/rnewman","followers_url":"https://api.github.com/users/rnewman/followers","following_url":"https://api.github.com/users/rnewman/following{/other_user}","gists_url":"https://api.github.com/users/rnewman/gists{/gist_id}","starred_url":"https://api.github.com/users/rnewman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rnewman/subscriptions","organizations_url":"https://api.github.com/users/rnewman/orgs","repos_url":"https://api.github.com/users/rnewman/repos","events_url":"https://api.github.com/users/rnewman/events{/privacy}","received_events_url":"https://api.github.com/users/rnewman/received_events","type":"User","site_admin":false},"body":"If you move this outside the `try`, you don't need to check whether it exists inside the `finally`.","created_at":"2015-10-27T15:46:17Z","updated_at":"2015-10-27T15:46:17Z","html_url":"https://github.com/Kinto/kinto.js/pull/219#discussion_r43140444","pull_request_url":"https://api.github.com/repos/Kinto/kinto.js/pulls/219","_links":{"self":{"href":"https://api.github.com/repos/Kinto/kinto.js/pulls/comments/43140444"},"html":{"href":"https://github.com/Kinto/kinto.js/pull/219#discussion_r43140444"},"pull_request":{"href":"https://api.github.com/repos/Kinto/kinto.js/pulls/219"}}},"pull_request":{"url":"https://api.github.com/repos/Kinto/kinto.js/pulls/219","id":48336903,"html_url":"https://github.com/Kinto/kinto.js/pull/219","diff_url":"https://github.com/Kinto/kinto.js/pull/219.diff","patch_url":"https://github.com/Kinto/kinto.js/pull/219.patch","issue_url":"https://api.github.com/repos/Kinto/kinto.js/issues/219","number":219,"state":"open","locked":false,"title":"212 firefox entry point","user":{"login":"mozmark","id":1017161,"avatar_url":"https://avatars.githubusercontent.com/u/1017161?v=3","gravatar_id":"","url":"https://api.github.com/users/mozmark","html_url":"https://github.com/mozmark","followers_url":"https://api.github.com/users/mozmark/followers","following_url":"https://api.github.com/users/mozmark/following{/other_user}","gists_url":"https://api.github.com/users/mozmark/gists{/gist_id}","starred_url":"https://api.github.com/users/mozmark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozmark/subscriptions","organizations_url":"https://api.github.com/users/mozmark/orgs","repos_url":"https://api.github.com/users/mozmark/repos","events_url":"https://api.github.com/users/mozmark/events{/privacy}","received_events_url":"https://api.github.com/users/mozmark/received_events","type":"User","site_admin":false},"body":"This gives us everything we need to do to build the jsm from kinto.js.","created_at":"2015-10-21T14:15:45Z","updated_at":"2015-10-27T15:46:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"962bbead9b3d02afebc4c868b2580630e664143c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Kinto/kinto.js/pulls/219/commits","review_comments_url":"https://api.github.com/repos/Kinto/kinto.js/pulls/219/comments","review_comment_url":"https://api.github.com/repos/Kinto/kinto.js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Kinto/kinto.js/issues/219/comments","statuses_url":"https://api.github.com/repos/Kinto/kinto.js/statuses/7e47e5fa6d4793c0eb91996ff91e639a550dcbf5","head":{"label":"Kinto:212-firefox-entry-point","ref":"212-firefox-entry-point","sha":"7e47e5fa6d4793c0eb91996ff91e639a550dcbf5","user":{"login":"Kinto","id":13413813,"avatar_url":"https://avatars.githubusercontent.com/u/13413813?v=3","gravatar_id":"","url":"https://api.github.com/users/Kinto","html_url":"https://github.com/Kinto","followers_url":"https://api.github.com/users/Kinto/followers","following_url":"https://api.github.com/users/Kinto/following{/other_user}","gists_url":"https://api.github.com/users/Kinto/gists{/gist_id}","starred_url":"https://api.github.com/users/Kinto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kinto/subscriptions","organizations_url":"https://api.github.com/users/Kinto/orgs","repos_url":"https://api.github.com/users/Kinto/repos","events_url":"https://api.github.com/users/Kinto/events{/privacy}","received_events_url":"https://api.github.com/users/Kinto/received_events","type":"Organization","site_admin":false},"repo":{"id":35978199,"name":"kinto.js","full_name":"Kinto/kinto.js","owner":{"login":"Kinto","id":13413813,"avatar_url":"https://avatars.githubusercontent.com/u/13413813?v=3","gravatar_id":"","url":"https://api.github.com/users/Kinto","html_url":"https://github.com/Kinto","followers_url":"https://api.github.com/users/Kinto/followers","following_url":"https://api.github.com/users/Kinto/following{/other_user}","gists_url":"https://api.github.com/users/Kinto/gists{/gist_id}","starred_url":"https://api.github.com/users/Kinto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kinto/subscriptions","organizations_url":"https://api.github.com/users/Kinto/orgs","repos_url":"https://api.github.com/users/Kinto/repos","events_url":"https://api.github.com/users/Kinto/events{/privacy}","received_events_url":"https://api.github.com/users/Kinto/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Kinto/kinto.js","description":"A JavaScript client for Kinto.","fork":false,"url":"https://api.github.com/repos/Kinto/kinto.js","forks_url":"https://api.github.com/repos/Kinto/kinto.js/forks","keys_url":"https://api.github.com/repos/Kinto/kinto.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Kinto/kinto.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Kinto/kinto.js/teams","hooks_url":"https://api.github.com/repos/Kinto/kinto.js/hooks","issue_events_url":"https://api.github.com/repos/Kinto/kinto.js/issues/events{/number}","events_url":"https://api.github.com/repos/Kinto/kinto.js/events","assignees_url":"https://api.github.com/repos/Kinto/kinto.js/assignees{/user}","branches_url":"https://api.github.com/repos/Kinto/kinto.js/branches{/branch}","tags_url":"https://api.github.com/repos/Kinto/kinto.js/tags","blobs_url":"https://api.github.com/repos/Kinto/kinto.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Kinto/kinto.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Kinto/kinto.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/Kinto/kinto.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Kinto/kinto.js/statuses/{sha}","languages_url":"https://api.github.com/repos/Kinto/kinto.js/languages","stargazers_url":"https://api.github.com/repos/Kinto/kinto.js/stargazers","contributors_url":"https://api.github.com/repos/Kinto/kinto.js/contributors","subscribers_url":"https://api.github.com/repos/Kinto/kinto.js/subscribers","subscription_url":"https://api.github.com/repos/Kinto/kinto.js/subscription","commits_url":"https://api.github.com/repos/Kinto/kinto.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/Kinto/kinto.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/Kinto/kinto.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/Kinto/kinto.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/Kinto/kinto.js/contents/{+path}","compare_url":"https://api.github.com/repos/Kinto/kinto.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Kinto/kinto.js/merges","archive_url":"https://api.github.com/repos/Kinto/kinto.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Kinto/kinto.js/downloads","issues_url":"https://api.github.com/repos/Kinto/kinto.js/issues{/number}","pulls_url":"https://api.github.com/repos/Kinto/kinto.js/pulls{/number}","milestones_url":"https://api.github.com/repos/Kinto/kinto.js/milestones{/number}","notifications_url":"https://api.github.com/repos/Kinto/kinto.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Kinto/kinto.js/labels{/name}","releases_url":"https://api.github.com/repos/Kinto/kinto.js/releases{/id}","created_at":"2015-05-20T22:46:31Z","updated_at":"2015-10-22T20:33:28Z","pushed_at":"2015-10-27T15:21:23Z","git_url":"git://github.com/Kinto/kinto.js.git","ssh_url":"git@github.com:Kinto/kinto.js.git","clone_url":"https://github.com/Kinto/kinto.js.git","svn_url":"https://github.com/Kinto/kinto.js","homepage":"http://kintojs.readthedocs.org/","size":8488,"stargazers_count":17,"watchers_count":17,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":4,"mirror_url":null,"open_issues_count":28,"forks":4,"open_issues":28,"watchers":17,"default_branch":"master"}},"base":{"label":"Kinto:master","ref":"master","sha":"8f5e6e0f40ed19a195fb8d3dad7a4feeeba4e10f","user":{"login":"Kinto","id":13413813,"avatar_url":"https://avatars.githubusercontent.com/u/13413813?v=3","gravatar_id":"","url":"https://api.github.com/users/Kinto","html_url":"https://github.com/Kinto","followers_url":"https://api.github.com/users/Kinto/followers","following_url":"https://api.github.com/users/Kinto/following{/other_user}","gists_url":"https://api.github.com/users/Kinto/gists{/gist_id}","starred_url":"https://api.github.com/users/Kinto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kinto/subscriptions","organizations_url":"https://api.github.com/users/Kinto/orgs","repos_url":"https://api.github.com/users/Kinto/repos","events_url":"https://api.github.com/users/Kinto/events{/privacy}","received_events_url":"https://api.github.com/users/Kinto/received_events","type":"Organization","site_admin":false},"repo":{"id":35978199,"name":"kinto.js","full_name":"Kinto/kinto.js","owner":{"login":"Kinto","id":13413813,"avatar_url":"https://avatars.githubusercontent.com/u/13413813?v=3","gravatar_id":"","url":"https://api.github.com/users/Kinto","html_url":"https://github.com/Kinto","followers_url":"https://api.github.com/users/Kinto/followers","following_url":"https://api.github.com/users/Kinto/following{/other_user}","gists_url":"https://api.github.com/users/Kinto/gists{/gist_id}","starred_url":"https://api.github.com/users/Kinto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kinto/subscriptions","organizations_url":"https://api.github.com/users/Kinto/orgs","repos_url":"https://api.github.com/users/Kinto/repos","events_url":"https://api.github.com/users/Kinto/events{/privacy}","received_events_url":"https://api.github.com/users/Kinto/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Kinto/kinto.js","description":"A JavaScript client for Kinto.","fork":false,"url":"https://api.github.com/repos/Kinto/kinto.js","forks_url":"https://api.github.com/repos/Kinto/kinto.js/forks","keys_url":"https://api.github.com/repos/Kinto/kinto.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Kinto/kinto.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Kinto/kinto.js/teams","hooks_url":"https://api.github.com/repos/Kinto/kinto.js/hooks","issue_events_url":"https://api.github.com/repos/Kinto/kinto.js/issues/events{/number}","events_url":"https://api.github.com/repos/Kinto/kinto.js/events","assignees_url":"https://api.github.com/repos/Kinto/kinto.js/assignees{/user}","branches_url":"https://api.github.com/repos/Kinto/kinto.js/branches{/branch}","tags_url":"https://api.github.com/repos/Kinto/kinto.js/tags","blobs_url":"https://api.github.com/repos/Kinto/kinto.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Kinto/kinto.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Kinto/kinto.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/Kinto/kinto.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Kinto/kinto.js/statuses/{sha}","languages_url":"https://api.github.com/repos/Kinto/kinto.js/languages","stargazers_url":"https://api.github.com/repos/Kinto/kinto.js/stargazers","contributors_url":"https://api.github.com/repos/Kinto/kinto.js/contributors","subscribers_url":"https://api.github.com/repos/Kinto/kinto.js/subscribers","subscription_url":"https://api.github.com/repos/Kinto/kinto.js/subscription","commits_url":"https://api.github.com/repos/Kinto/kinto.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/Kinto/kinto.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/Kinto/kinto.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/Kinto/kinto.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/Kinto/kinto.js/contents/{+path}","compare_url":"https://api.github.com/repos/Kinto/kinto.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Kinto/kinto.js/merges","archive_url":"https://api.github.com/repos/Kinto/kinto.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Kinto/kinto.js/downloads","issues_url":"https://api.github.com/repos/Kinto/kinto.js/issues{/number}","pulls_url":"https://api.github.com/repos/Kinto/kinto.js/pulls{/number}","milestones_url":"https://api.github.com/repos/Kinto/kinto.js/milestones{/number}","notifications_url":"https://api.github.com/repos/Kinto/kinto.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Kinto/kinto.js/labels{/name}","releases_url":"https://api.github.com/repos/Kinto/kinto.js/releases{/id}","created_at":"2015-05-20T22:46:31Z","updated_at":"2015-10-22T20:33:28Z","pushed_at":"2015-10-27T15:21:23Z","git_url":"git://github.com/Kinto/kinto.js.git","ssh_url":"git@github.com:Kinto/kinto.js.git","clone_url":"https://github.com/Kinto/kinto.js.git","svn_url":"https://github.com/Kinto/kinto.js","homepage":"http://kintojs.readthedocs.org/","size":8488,"stargazers_count":17,"watchers_count":17,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":4,"mirror_url":null,"open_issues_count":28,"forks":4,"open_issues":28,"watchers":17,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Kinto/kinto.js/pulls/219"},"html":{"href":"https://github.com/Kinto/kinto.js/pull/219"},"issue":{"href":"https://api.github.com/repos/Kinto/kinto.js/issues/219"},"comments":{"href":"https://api.github.com/repos/Kinto/kinto.js/issues/219/comments"},"review_comments":{"href":"https://api.github.com/repos/Kinto/kinto.js/pulls/219/comments"},"review_comment":{"href":"https://api.github.com/repos/Kinto/kinto.js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Kinto/kinto.js/pulls/219/commits"},"statuses":{"href":"https://api.github.com/repos/Kinto/kinto.js/statuses/7e47e5fa6d4793c0eb91996ff91e639a550dcbf5"}}}}