{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/normandy/pulls/comments/142811379","pull_request_review_id":67228235,"id":142811379,"diff_hunk":"@@ -356,22 +358,80 @@ decorate_task(\n   }\n );\n \n+// Test init() first run\n decorate_task(\n   withPrefEnv({\n     set: [\n       [\"extensions.shield-recipe-client.dev_mode\", false],\n       [\"extensions.shield-recipe-client.first_run\", true],\n+      [\"extensions.shield-recipe-client.api_url\", \"https://example.com\"],\n     ],\n   }),\n   withStub(RecipeRunner, \"run\"),\n   withStub(RecipeRunner, \"registerTimer\"),\n-  async function testInitFirstRun(runStub, registerTimerStub) {\n+  withStub(RecipeRunner, \"watchPrefs\"),\n+  async function testInitFirstRun(runStub, registerTimerStub, watchPrefsStub) {\n     await RecipeRunner.init();\n     ok(runStub.called, \"RecipeRunner.run is called immediately on first run\");\n     ok(\n       !Services.prefs.getBoolPref(\"extensions.shield-recipe-client.first_run\"),\n       \"On first run, the first run pref is set to false\"\n     );\n     ok(registerTimerStub.called, \"RecipeRunner.registerTimer registers a timer\");\n+\n+    // RecipeRunner.init() sets this to false, but SpecialPowers\n+    // relies on the preferences it manages to actually change when it\n+    // tries to change them. Settings this back to true here allows\n+    // that to happen. Not doing this causes popPrefEnv to hang forever.\n+    Services.prefs.setBoolPref(\"extensions.shield-recipe-client.first_run\", true);\n+  }\n+);\n+\n+// Test that prefs are watched correctly\n+decorate_task(\n+  withPrefEnv({\n+    set: [\n+      [\"toolkit.telemetry.unified\", true],  // telemetry enabled\n+      [\"extensions.shield-recipe-client.dev_mode\", false],\n+      [\"extensions.shield-recipe-client.first_run\", false],\n+      [\"extensions.shield-recipe-client.enabled\", true],\n+      [\"extensions.shield-recipe-client.api_url\", \"https://example.com\"], // starts with \"https://\"\n+    ],\n+  }),\n+  withStub(RecipeRunner, \"run\"),\n+  withStub(RecipeRunner, \"enable\"),\n+  withStub(RecipeRunner, \"disable\"),\n+  withStub(CleanupManager, \"addCleanupHandler\"),\n+\n+  async function testPrefWatching(runStub, enableStub, disableStub, addCleanupHandlerStub) {\n+    await RecipeRunner.init();","path":"recipe-client-addon/test/browser/browser_RecipeRunner.js","position":67,"original_position":67,"commit_id":"cb52c6f500dbe6a01a5bee8dc1af3e7b753ab7d7","original_commit_id":"cb52c6f500dbe6a01a5bee8dc1af3e7b753ab7d7","user":{"login":"mythmon","id":305049,"avatar_url":"https://avatars3.githubusercontent.com/u/305049?v=4","gravatar_id":"","url":"https://api.github.com/users/mythmon","html_url":"https://github.com/mythmon","followers_url":"https://api.github.com/users/mythmon/followers","following_url":"https://api.github.com/users/mythmon/following{/other_user}","gists_url":"https://api.github.com/users/mythmon/gists{/gist_id}","starred_url":"https://api.github.com/users/mythmon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mythmon/subscriptions","organizations_url":"https://api.github.com/users/mythmon/orgs","repos_url":"https://api.github.com/users/mythmon/repos","events_url":"https://api.github.com/users/mythmon/events{/privacy}","received_events_url":"https://api.github.com/users/mythmon/received_events","type":"User","site_admin":false},"body":"Since `enable` is stubbed out, and the watchers are set through that, no. I think we're ok here.","created_at":"2017-10-04T22:38:30Z","updated_at":"2017-10-04T22:38:30Z","html_url":"https://github.com/mozilla/normandy/pull/1080#discussion_r142811379","pull_request_url":"https://api.github.com/repos/mozilla/normandy/pulls/1080","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/mozilla/normandy/pulls/comments/142811379"},"html":{"href":"https://github.com/mozilla/normandy/pull/1080#discussion_r142811379"},"pull_request":{"href":"https://api.github.com/repos/mozilla/normandy/pulls/1080"}},"in_reply_to_id":142555889},"pull_request":{"url":"https://api.github.com/repos/mozilla/normandy/pulls/1080","id":144001147,"html_url":"https://github.com/mozilla/normandy/pull/1080","diff_url":"https://github.com/mozilla/normandy/pull/1080.diff","patch_url":"https://github.com/mozilla/normandy/pull/1080.patch","issue_url":"https://api.github.com/repos/mozilla/normandy/issues/1080","number":1080,"state":"open","locked":false,"title":"Bug 1402528 - recipe-client-addon: Watch prefs and enable/disable as needed.","user":{"login":"mythmon","id":305049,"avatar_url":"https://avatars3.githubusercontent.com/u/305049?v=4","gravatar_id":"","url":"https://api.github.com/users/mythmon","html_url":"https://github.com/mythmon","followers_url":"https://api.github.com/users/mythmon/followers","following_url":"https://api.github.com/users/mythmon/following{/other_user}","gists_url":"https://api.github.com/users/mythmon/gists{/gist_id}","starred_url":"https://api.github.com/users/mythmon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mythmon/subscriptions","organizations_url":"https://api.github.com/users/mythmon/orgs","repos_url":"https://api.github.com/users/mythmon/repos","events_url":"https://api.github.com/users/mythmon/events{/privacy}","received_events_url":"https://api.github.com/users/mythmon/received_events","type":"User","site_admin":false},"body":"This is a fairly large (in terms of lines) change to `RecipeRunner`'s startup and pref handling. I think it should be fairly straight forward though. It is mostly just pretty verbose.","created_at":"2017-09-29T23:48:39Z","updated_at":"2017-10-04T22:38:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3db1b383e875ac8902071a77c0e2e8d4427bbac8","assignee":{"login":"rhelmer","id":61412,"avatar_url":"https://avatars0.githubusercontent.com/u/61412?v=4","gravatar_id":"","url":"https://api.github.com/users/rhelmer","html_url":"https://github.com/rhelmer","followers_url":"https://api.github.com/users/rhelmer/followers","following_url":"https://api.github.com/users/rhelmer/following{/other_user}","gists_url":"https://api.github.com/users/rhelmer/gists{/gist_id}","starred_url":"https://api.github.com/users/rhelmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhelmer/subscriptions","organizations_url":"https://api.github.com/users/rhelmer/orgs","repos_url":"https://api.github.com/users/rhelmer/repos","events_url":"https://api.github.com/users/rhelmer/events{/privacy}","received_events_url":"https://api.github.com/users/rhelmer/received_events","type":"User","site_admin":false},"assignees":[{"login":"rhelmer","id":61412,"avatar_url":"https://avatars0.githubusercontent.com/u/61412?v=4","gravatar_id":"","url":"https://api.github.com/users/rhelmer","html_url":"https://github.com/rhelmer","followers_url":"https://api.github.com/users/rhelmer/followers","following_url":"https://api.github.com/users/rhelmer/following{/other_user}","gists_url":"https://api.github.com/users/rhelmer/gists{/gist_id}","starred_url":"https://api.github.com/users/rhelmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhelmer/subscriptions","organizations_url":"https://api.github.com/users/rhelmer/orgs","repos_url":"https://api.github.com/users/rhelmer/repos","events_url":"https://api.github.com/users/rhelmer/events{/privacy}","received_events_url":"https://api.github.com/users/rhelmer/received_events","type":"User","site_admin":false},{"login":"Osmose","id":193106,"avatar_url":"https://avatars1.githubusercontent.com/u/193106?v=4","gravatar_id":"","url":"https://api.github.com/users/Osmose","html_url":"https://github.com/Osmose","followers_url":"https://api.github.com/users/Osmose/followers","following_url":"https://api.github.com/users/Osmose/following{/other_user}","gists_url":"https://api.github.com/users/Osmose/gists{/gist_id}","starred_url":"https://api.github.com/users/Osmose/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Osmose/subscriptions","organizations_url":"https://api.github.com/users/Osmose/orgs","repos_url":"https://api.github.com/users/Osmose/repos","events_url":"https://api.github.com/users/Osmose/events{/privacy}","received_events_url":"https://api.github.com/users/Osmose/received_events","type":"User","site_admin":false}],"requested_reviewers":[{"login":"rhelmer","id":61412,"avatar_url":"https://avatars0.githubusercontent.com/u/61412?v=4","gravatar_id":"","url":"https://api.github.com/users/rhelmer","html_url":"https://github.com/rhelmer","followers_url":"https://api.github.com/users/rhelmer/followers","following_url":"https://api.github.com/users/rhelmer/following{/other_user}","gists_url":"https://api.github.com/users/rhelmer/gists{/gist_id}","starred_url":"https://api.github.com/users/rhelmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhelmer/subscriptions","organizations_url":"https://api.github.com/users/rhelmer/orgs","repos_url":"https://api.github.com/users/rhelmer/repos","events_url":"https://api.github.com/users/rhelmer/events{/privacy}","received_events_url":"https://api.github.com/users/rhelmer/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/normandy/pulls/1080/commits","review_comments_url":"https://api.github.com/repos/mozilla/normandy/pulls/1080/comments","review_comment_url":"https://api.github.com/repos/mozilla/normandy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/normandy/issues/1080/comments","statuses_url":"https://api.github.com/repos/mozilla/normandy/statuses/cb52c6f500dbe6a01a5bee8dc1af3e7b753ab7d7","head":{"label":"mythmon:watch-prefs","ref":"watch-prefs","sha":"cb52c6f500dbe6a01a5bee8dc1af3e7b753ab7d7","user":{"login":"mythmon","id":305049,"avatar_url":"https://avatars3.githubusercontent.com/u/305049?v=4","gravatar_id":"","url":"https://api.github.com/users/mythmon","html_url":"https://github.com/mythmon","followers_url":"https://api.github.com/users/mythmon/followers","following_url":"https://api.github.com/users/mythmon/following{/other_user}","gists_url":"https://api.github.com/users/mythmon/gists{/gist_id}","starred_url":"https://api.github.com/users/mythmon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mythmon/subscriptions","organizations_url":"https://api.github.com/users/mythmon/orgs","repos_url":"https://api.github.com/users/mythmon/repos","events_url":"https://api.github.com/users/mythmon/events{/privacy}","received_events_url":"https://api.github.com/users/mythmon/received_events","type":"User","site_admin":false},"repo":{"id":49591352,"name":"normandy","full_name":"mythmon/normandy","owner":{"login":"mythmon","id":305049,"avatar_url":"https://avatars3.githubusercontent.com/u/305049?v=4","gravatar_id":"","url":"https://api.github.com/users/mythmon","html_url":"https://github.com/mythmon","followers_url":"https://api.github.com/users/mythmon/followers","following_url":"https://api.github.com/users/mythmon/following{/other_user}","gists_url":"https://api.github.com/users/mythmon/gists{/gist_id}","starred_url":"https://api.github.com/users/mythmon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mythmon/subscriptions","organizations_url":"https://api.github.com/users/mythmon/orgs","repos_url":"https://api.github.com/users/mythmon/repos","events_url":"https://api.github.com/users/mythmon/events{/privacy}","received_events_url":"https://api.github.com/users/mythmon/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mythmon/normandy","description":"Firefox recipe server","fork":true,"url":"https://api.github.com/repos/mythmon/normandy","forks_url":"https://api.github.com/repos/mythmon/normandy/forks","keys_url":"https://api.github.com/repos/mythmon/normandy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mythmon/normandy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mythmon/normandy/teams","hooks_url":"https://api.github.com/repos/mythmon/normandy/hooks","issue_events_url":"https://api.github.com/repos/mythmon/normandy/issues/events{/number}","events_url":"https://api.github.com/repos/mythmon/normandy/events","assignees_url":"https://api.github.com/repos/mythmon/normandy/assignees{/user}","branches_url":"https://api.github.com/repos/mythmon/normandy/branches{/branch}","tags_url":"https://api.github.com/repos/mythmon/normandy/tags","blobs_url":"https://api.github.com/repos/mythmon/normandy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mythmon/normandy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mythmon/normandy/git/refs{/sha}","trees_url":"https://api.github.com/repos/mythmon/normandy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mythmon/normandy/statuses/{sha}","languages_url":"https://api.github.com/repos/mythmon/normandy/languages","stargazers_url":"https://api.github.com/repos/mythmon/normandy/stargazers","contributors_url":"https://api.github.com/repos/mythmon/normandy/contributors","subscribers_url":"https://api.github.com/repos/mythmon/normandy/subscribers","subscription_url":"https://api.github.com/repos/mythmon/normandy/subscription","commits_url":"https://api.github.com/repos/mythmon/normandy/commits{/sha}","git_commits_url":"https://api.github.com/repos/mythmon/normandy/git/commits{/sha}","comments_url":"https://api.github.com/repos/mythmon/normandy/comments{/number}","issue_comment_url":"https://api.github.com/repos/mythmon/normandy/issues/comments{/number}","contents_url":"https://api.github.com/repos/mythmon/normandy/contents/{+path}","compare_url":"https://api.github.com/repos/mythmon/normandy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mythmon/normandy/merges","archive_url":"https://api.github.com/repos/mythmon/normandy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mythmon/normandy/downloads","issues_url":"https://api.github.com/repos/mythmon/normandy/issues{/number}","pulls_url":"https://api.github.com/repos/mythmon/normandy/pulls{/number}","milestones_url":"https://api.github.com/repos/mythmon/normandy/milestones{/number}","notifications_url":"https://api.github.com/repos/mythmon/normandy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mythmon/normandy/labels{/name}","releases_url":"https://api.github.com/repos/mythmon/normandy/releases{/id}","deployments_url":"https://api.github.com/repos/mythmon/normandy/deployments","created_at":"2016-01-13T17:54:36Z","updated_at":"2017-03-08T18:07:21Z","pushed_at":"2017-10-04T18:08:36Z","git_url":"git://github.com/mythmon/normandy.git","ssh_url":"git@github.com:mythmon/normandy.git","clone_url":"https://github.com/mythmon/normandy.git","svn_url":"https://github.com/mythmon/normandy","homepage":"http://normandy.readthedocs.org/","size":5497,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"2419d0290c102de54c058d0b2fa4bfd9dbb4ac8e","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars2.githubusercontent.com/u/131524?v=4","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":48456638,"name":"normandy","full_name":"mozilla/normandy","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars2.githubusercontent.com/u/131524?v=4","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/normandy","description":"Firefox recipe server","fork":false,"url":"https://api.github.com/repos/mozilla/normandy","forks_url":"https://api.github.com/repos/mozilla/normandy/forks","keys_url":"https://api.github.com/repos/mozilla/normandy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/normandy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/normandy/teams","hooks_url":"https://api.github.com/repos/mozilla/normandy/hooks","issue_events_url":"https://api.github.com/repos/mozilla/normandy/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/normandy/events","assignees_url":"https://api.github.com/repos/mozilla/normandy/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/normandy/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/normandy/tags","blobs_url":"https://api.github.com/repos/mozilla/normandy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/normandy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/normandy/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/normandy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/normandy/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/normandy/languages","stargazers_url":"https://api.github.com/repos/mozilla/normandy/stargazers","contributors_url":"https://api.github.com/repos/mozilla/normandy/contributors","subscribers_url":"https://api.github.com/repos/mozilla/normandy/subscribers","subscription_url":"https://api.github.com/repos/mozilla/normandy/subscription","commits_url":"https://api.github.com/repos/mozilla/normandy/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/normandy/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/normandy/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/normandy/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/normandy/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/normandy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/normandy/merges","archive_url":"https://api.github.com/repos/mozilla/normandy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/normandy/downloads","issues_url":"https://api.github.com/repos/mozilla/normandy/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/normandy/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/normandy/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/normandy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/normandy/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/normandy/releases{/id}","deployments_url":"https://api.github.com/repos/mozilla/normandy/deployments","created_at":"2015-12-22T22:18:19Z","updated_at":"2017-10-03T08:12:44Z","pushed_at":"2017-10-04T18:09:49Z","git_url":"git://github.com/mozilla/normandy.git","ssh_url":"git@github.com:mozilla/normandy.git","clone_url":"https://github.com/mozilla/normandy.git","svn_url":"https://github.com/mozilla/normandy","homepage":"https://wiki.mozilla.org/Firefox/Recipe_Server","size":5523,"stargazers_count":21,"watchers_count":21,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":37,"mirror_url":null,"open_issues_count":125,"forks":37,"open_issues":125,"watchers":21,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/normandy/pulls/1080"},"html":{"href":"https://github.com/mozilla/normandy/pull/1080"},"issue":{"href":"https://api.github.com/repos/mozilla/normandy/issues/1080"},"comments":{"href":"https://api.github.com/repos/mozilla/normandy/issues/1080/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/normandy/pulls/1080/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/normandy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/normandy/pulls/1080/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/normandy/statuses/cb52c6f500dbe6a01a5bee8dc1af3e7b753ab7d7"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"mythmon"}}