{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/memchaser/pulls/comments/32315958","id":32315958,"diff_hunk":"@@ -5,68 +5,25 @@\n \"use strict\";\n \n const { Cc, Ci, Cu } = require(\"chrome\");\n-const { EventEmitter } = require(\"sdk/deprecated/events\");\n+const { emit, on, off } = require(\"sdk/event/core\");\n const prefs = require(\"sdk/preferences/service\");\n const timers = require(\"sdk/timers\");\n const unload = require(\"sdk/system/unload\");\n \n const config = require(\"./config\");\n \n-Cu.import('resource://gre/modules/Services.jsm');\n-\n-const reporter = EventEmitter.compose({\n-  _pref_gc_notifications: null,\n-\n-  constructor: function Reporter() {\n-    // Report unhandled errors from listeners\n-    this.on(\"error\", console.exception.bind(console));\n-\n-    // Make sure we clean-up correctly\n-    unload.ensure(this, 'unload');\n-\n-    if (config.application.branch >= 16) {\n-      this._pref_gc_notifications = config.preferences.memory_notify;\n-    }\n-    else {\n-      this._pref_gc_notifications = config.preferences.memory_log;\n-    }\n+const PREF_GC_NOTIFICATIONS = config.preferences.memory_notify;\n \n-    // Ensure GC/CC observer and console messages preference is enabled\n-    this._isEnabled = prefs.get(this._pref_gc_notifications);\n-    if (!this._isEnabled)\n-      this._enable();\n-\n-    Services.obs.addObserver(this, config.application.topic_cc_statistics, false);\n-    Services.obs.addObserver(this, config.application.topic_gc_statistics, false);\n-  },\n-\n-  get pref_gc_notifications() {\n-    return this._pref_gc_notifications;\n-  },\n-\n-  unload: function Reporter_unload() {\n-    this._removeAllListeners();\n-\n-    Services.obs.removeObserver(this, config.application.topic_cc_statistics, false);\n-    Services.obs.removeObserver(this, config.application.topic_gc_statistics, false);\n-  },\n-\n-  _enable: function Reporter__enable() {\n-    var modifiedPrefs = JSON.parse(prefs.get(config.preferences.modified_prefs,\n-                                             \"{}\"));\n-    if (!modifiedPrefs.hasOwnProperty(this._pref_gc_notifications)) {\n-      modifiedPrefs[this._pref_gc_notifications] = prefs.get(this._pref_gc_notifications);\n-    }\n+Cu.import('resource://gre/modules/Services.jsm');","path":"extension/lib/garbage-collector.js","position":58,"original_position":58,"commit_id":"860275bc98a86f2a3a8a8620728938a8ff30435c","original_commit_id":"860275bc98a86f2a3a8a8620728938a8ff30435c","user":{"login":"xabolcs","id":568751,"avatar_url":"https://avatars.githubusercontent.com/u/568751?v=3","gravatar_id":"","url":"https://api.github.com/users/xabolcs","html_url":"https://github.com/xabolcs","followers_url":"https://api.github.com/users/xabolcs/followers","following_url":"https://api.github.com/users/xabolcs/following{/other_user}","gists_url":"https://api.github.com/users/xabolcs/gists{/gist_id}","starred_url":"https://api.github.com/users/xabolcs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xabolcs/subscriptions","organizations_url":"https://api.github.com/users/xabolcs/orgs","repos_url":"https://api.github.com/users/xabolcs/repos","events_url":"https://api.github.com/users/xabolcs/events{/privacy}","received_events_url":"https://api.github.com/users/xabolcs/received_events","type":"User","site_admin":false},"body":"There are a lot constant definitions on the top.\r\n[L#15][1] as the target line? Just before `const PREF_GC_NOTIFICATIONS = ...`?\r\n\r\n[1]: #diff-53480c83f96ac16463911489e52d2c3eL15","created_at":"2015-06-12T13:38:02Z","updated_at":"2015-06-12T13:38:02Z","html_url":"https://github.com/mozilla/memchaser/pull/217#discussion_r32315958","pull_request_url":"https://api.github.com/repos/mozilla/memchaser/pulls/217","_links":{"self":{"href":"https://api.github.com/repos/mozilla/memchaser/pulls/comments/32315958"},"html":{"href":"https://github.com/mozilla/memchaser/pull/217#discussion_r32315958"},"pull_request":{"href":"https://api.github.com/repos/mozilla/memchaser/pulls/217"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/memchaser/pulls/217","id":36587786,"html_url":"https://github.com/mozilla/memchaser/pull/217","diff_url":"https://github.com/mozilla/memchaser/pull/217.diff","patch_url":"https://github.com/mozilla/memchaser/pull/217.patch","issue_url":"https://api.github.com/repos/mozilla/memchaser/issues/217","number":217,"state":"open","locked":false,"title":"Say goodbye to EventEmitters!","user":{"login":"xabolcs","id":568751,"avatar_url":"https://avatars.githubusercontent.com/u/568751?v=3","gravatar_id":"","url":"https://api.github.com/users/xabolcs","html_url":"https://github.com/xabolcs","followers_url":"https://api.github.com/users/xabolcs/followers","following_url":"https://api.github.com/users/xabolcs/following{/other_user}","gists_url":"https://api.github.com/users/xabolcs/gists{/gist_id}","starred_url":"https://api.github.com/users/xabolcs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xabolcs/subscriptions","organizations_url":"https://api.github.com/users/xabolcs/orgs","repos_url":"https://api.github.com/users/xabolcs/repos","events_url":"https://api.github.com/users/xabolcs/events{/privacy}","received_events_url":"https://api.github.com/users/xabolcs/received_events","type":"User","site_admin":false},"body":"Fix for half of #103:\r\n * this fix doesn't centralize the message emitters\r\n * this fix migrates GC and memory reporter modules to use `event/core` SDK module","created_at":"2015-05-31T19:34:32Z","updated_at":"2015-06-12T13:38:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"99a2a837fff8f250f2f6e1160416c0ca9c97921a","assignee":{"login":"xabolcs","id":568751,"avatar_url":"https://avatars.githubusercontent.com/u/568751?v=3","gravatar_id":"","url":"https://api.github.com/users/xabolcs","html_url":"https://github.com/xabolcs","followers_url":"https://api.github.com/users/xabolcs/followers","following_url":"https://api.github.com/users/xabolcs/following{/other_user}","gists_url":"https://api.github.com/users/xabolcs/gists{/gist_id}","starred_url":"https://api.github.com/users/xabolcs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xabolcs/subscriptions","organizations_url":"https://api.github.com/users/xabolcs/orgs","repos_url":"https://api.github.com/users/xabolcs/repos","events_url":"https://api.github.com/users/xabolcs/events{/privacy}","received_events_url":"https://api.github.com/users/xabolcs/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/memchaser/pulls/217/commits","review_comments_url":"https://api.github.com/repos/mozilla/memchaser/pulls/217/comments","review_comment_url":"https://api.github.com/repos/mozilla/memchaser/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/memchaser/issues/217/comments","statuses_url":"https://api.github.com/repos/mozilla/memchaser/statuses/860275bc98a86f2a3a8a8620728938a8ff30435c","head":{"label":"xabolcs:branch-issue-103-goodbye-eventemitter","ref":"branch-issue-103-goodbye-eventemitter","sha":"860275bc98a86f2a3a8a8620728938a8ff30435c","user":{"login":"xabolcs","id":568751,"avatar_url":"https://avatars.githubusercontent.com/u/568751?v=3","gravatar_id":"","url":"https://api.github.com/users/xabolcs","html_url":"https://github.com/xabolcs","followers_url":"https://api.github.com/users/xabolcs/followers","following_url":"https://api.github.com/users/xabolcs/following{/other_user}","gists_url":"https://api.github.com/users/xabolcs/gists{/gist_id}","starred_url":"https://api.github.com/users/xabolcs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xabolcs/subscriptions","organizations_url":"https://api.github.com/users/xabolcs/orgs","repos_url":"https://api.github.com/users/xabolcs/repos","events_url":"https://api.github.com/users/xabolcs/events{/privacy}","received_events_url":"https://api.github.com/users/xabolcs/received_events","type":"User","site_admin":false},"repo":{"id":8762547,"name":"memchaser","full_name":"xabolcs/memchaser","owner":{"login":"xabolcs","id":568751,"avatar_url":"https://avatars.githubusercontent.com/u/568751?v=3","gravatar_id":"","url":"https://api.github.com/users/xabolcs","html_url":"https://github.com/xabolcs","followers_url":"https://api.github.com/users/xabolcs/followers","following_url":"https://api.github.com/users/xabolcs/following{/other_user}","gists_url":"https://api.github.com/users/xabolcs/gists{/gist_id}","starred_url":"https://api.github.com/users/xabolcs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xabolcs/subscriptions","organizations_url":"https://api.github.com/users/xabolcs/orgs","repos_url":"https://api.github.com/users/xabolcs/repos","events_url":"https://api.github.com/users/xabolcs/events{/privacy}","received_events_url":"https://api.github.com/users/xabolcs/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/xabolcs/memchaser","description":"Bugfix fork of MemChaser","fork":true,"url":"https://api.github.com/repos/xabolcs/memchaser","forks_url":"https://api.github.com/repos/xabolcs/memchaser/forks","keys_url":"https://api.github.com/repos/xabolcs/memchaser/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xabolcs/memchaser/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xabolcs/memchaser/teams","hooks_url":"https://api.github.com/repos/xabolcs/memchaser/hooks","issue_events_url":"https://api.github.com/repos/xabolcs/memchaser/issues/events{/number}","events_url":"https://api.github.com/repos/xabolcs/memchaser/events","assignees_url":"https://api.github.com/repos/xabolcs/memchaser/assignees{/user}","branches_url":"https://api.github.com/repos/xabolcs/memchaser/branches{/branch}","tags_url":"https://api.github.com/repos/xabolcs/memchaser/tags","blobs_url":"https://api.github.com/repos/xabolcs/memchaser/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xabolcs/memchaser/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xabolcs/memchaser/git/refs{/sha}","trees_url":"https://api.github.com/repos/xabolcs/memchaser/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xabolcs/memchaser/statuses/{sha}","languages_url":"https://api.github.com/repos/xabolcs/memchaser/languages","stargazers_url":"https://api.github.com/repos/xabolcs/memchaser/stargazers","contributors_url":"https://api.github.com/repos/xabolcs/memchaser/contributors","subscribers_url":"https://api.github.com/repos/xabolcs/memchaser/subscribers","subscription_url":"https://api.github.com/repos/xabolcs/memchaser/subscription","commits_url":"https://api.github.com/repos/xabolcs/memchaser/commits{/sha}","git_commits_url":"https://api.github.com/repos/xabolcs/memchaser/git/commits{/sha}","comments_url":"https://api.github.com/repos/xabolcs/memchaser/comments{/number}","issue_comment_url":"https://api.github.com/repos/xabolcs/memchaser/issues/comments{/number}","contents_url":"https://api.github.com/repos/xabolcs/memchaser/contents/{+path}","compare_url":"https://api.github.com/repos/xabolcs/memchaser/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xabolcs/memchaser/merges","archive_url":"https://api.github.com/repos/xabolcs/memchaser/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xabolcs/memchaser/downloads","issues_url":"https://api.github.com/repos/xabolcs/memchaser/issues{/number}","pulls_url":"https://api.github.com/repos/xabolcs/memchaser/pulls{/number}","milestones_url":"https://api.github.com/repos/xabolcs/memchaser/milestones{/number}","notifications_url":"https://api.github.com/repos/xabolcs/memchaser/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xabolcs/memchaser/labels{/name}","releases_url":"https://api.github.com/repos/xabolcs/memchaser/releases{/id}","created_at":"2013-03-13T22:04:43Z","updated_at":"2015-03-27T23:57:46Z","pushed_at":"2015-06-06T01:03:42Z","git_url":"git://github.com/xabolcs/memchaser.git","ssh_url":"git@github.com:xabolcs/memchaser.git","clone_url":"https://github.com/xabolcs/memchaser.git","svn_url":"https://github.com/xabolcs/memchaser","homepage":"","size":667,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"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":"45fd7accf66835762f1ef92470e9a5f1e8370980","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","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":3109755,"name":"memchaser","full_name":"mozilla/memchaser","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","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/memchaser","description":"Firefox extension to chase the memory usage and garbage collector activity","fork":false,"url":"https://api.github.com/repos/mozilla/memchaser","forks_url":"https://api.github.com/repos/mozilla/memchaser/forks","keys_url":"https://api.github.com/repos/mozilla/memchaser/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/memchaser/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/memchaser/teams","hooks_url":"https://api.github.com/repos/mozilla/memchaser/hooks","issue_events_url":"https://api.github.com/repos/mozilla/memchaser/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/memchaser/events","assignees_url":"https://api.github.com/repos/mozilla/memchaser/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/memchaser/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/memchaser/tags","blobs_url":"https://api.github.com/repos/mozilla/memchaser/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/memchaser/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/memchaser/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/memchaser/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/memchaser/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/memchaser/languages","stargazers_url":"https://api.github.com/repos/mozilla/memchaser/stargazers","contributors_url":"https://api.github.com/repos/mozilla/memchaser/contributors","subscribers_url":"https://api.github.com/repos/mozilla/memchaser/subscribers","subscription_url":"https://api.github.com/repos/mozilla/memchaser/subscription","commits_url":"https://api.github.com/repos/mozilla/memchaser/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/memchaser/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/memchaser/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/memchaser/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/memchaser/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/memchaser/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/memchaser/merges","archive_url":"https://api.github.com/repos/mozilla/memchaser/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/memchaser/downloads","issues_url":"https://api.github.com/repos/mozilla/memchaser/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/memchaser/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/memchaser/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/memchaser/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/memchaser/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/memchaser/releases{/id}","created_at":"2012-01-05T11:53:21Z","updated_at":"2015-03-27T23:59:26Z","pushed_at":"2015-06-06T01:03:42Z","git_url":"git://github.com/mozilla/memchaser.git","ssh_url":"git@github.com:mozilla/memchaser.git","clone_url":"https://github.com/mozilla/memchaser.git","svn_url":"https://github.com/mozilla/memchaser","homepage":"https://wiki.mozilla.org/QA/Automation_Services/Projects/Addons/MemChaser","size":946,"stargazers_count":31,"watchers_count":31,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":18,"mirror_url":null,"open_issues_count":47,"forks":18,"open_issues":47,"watchers":31,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/memchaser/pulls/217"},"html":{"href":"https://github.com/mozilla/memchaser/pull/217"},"issue":{"href":"https://api.github.com/repos/mozilla/memchaser/issues/217"},"comments":{"href":"https://api.github.com/repos/mozilla/memchaser/issues/217/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/memchaser/pulls/217/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/memchaser/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/memchaser/pulls/217/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/memchaser/statuses/860275bc98a86f2a3a8a8620728938a8ff30435c"}}}}