{"action":"created","comment":{"url":"https://api.github.com/repos/servo/servo/pulls/comments/58208365","id":58208365,"diff_hunk":"@@ -145,6 +143,36 @@ fn read_prefs() -> Result<HashMap<String, Pref>, ()> {\n     Ok(prefs)\n }\n \n+pub fn extend_prefs(extension: HashMap<String, Pref>) {\n+    PREFS.lock().unwrap().extend(extension);\n+}\n+\n+pub fn add_user_prefs() {\n+    if let Some(ref dir) = opts::get().profile_dir {\n+        let mut path = PathBuf::from(dir);\n+        path.push(\"prefs.json\");\n+        if let Ok(file) = File::open(path) {\n+            if let Ok(prefs) = read_prefs_from_file(file) {\n+                extend_prefs(prefs);\n+            }\n+        } else {\n+            println!(\"Error opening prefs.json from profile_dir\");","path":"components/util/prefs.rs","position":59,"original_position":59,"commit_id":"aa48a400c49e4e809b53cf035e55f58157d0c949","original_commit_id":"aa48a400c49e4e809b53cf035e55f58157d0c949","user":{"login":"Manishearth","id":1617736,"avatar_url":"https://avatars.githubusercontent.com/u/1617736?v=3","gravatar_id":"","url":"https://api.github.com/users/Manishearth","html_url":"https://github.com/Manishearth","followers_url":"https://api.github.com/users/Manishearth/followers","following_url":"https://api.github.com/users/Manishearth/following{/other_user}","gists_url":"https://api.github.com/users/Manishearth/gists{/gist_id}","starred_url":"https://api.github.com/users/Manishearth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Manishearth/subscriptions","organizations_url":"https://api.github.com/users/Manishearth/orgs","repos_url":"https://api.github.com/users/Manishearth/repos","events_url":"https://api.github.com/users/Manishearth/events{/privacy}","received_events_url":"https://api.github.com/users/Manishearth/received_events","type":"User","site_admin":false},"body":"this should be to stderr.","created_at":"2016-04-01T13:55:23Z","updated_at":"2016-04-01T13:55:23Z","html_url":"https://github.com/servo/servo/pull/10114#discussion_r58208365","pull_request_url":"https://api.github.com/repos/servo/servo/pulls/10114","_links":{"self":{"href":"https://api.github.com/repos/servo/servo/pulls/comments/58208365"},"html":{"href":"https://github.com/servo/servo/pull/10114#discussion_r58208365"},"pull_request":{"href":"https://api.github.com/repos/servo/servo/pulls/10114"}}},"pull_request":{"url":"https://api.github.com/repos/servo/servo/pulls/10114","id":63664942,"html_url":"https://github.com/servo/servo/pull/10114","diff_url":"https://github.com/servo/servo/pull/10114.diff","patch_url":"https://github.com/servo/servo/pull/10114.patch","issue_url":"https://api.github.com/repos/servo/servo/issues/10114","number":10114,"state":"open","locked":false,"title":"Load prefs.json from profile-dir if --profile-dir is specified at launch","user":{"login":"matthewbentley","id":1930163,"avatar_url":"https://avatars.githubusercontent.com/u/1930163?v=3","gravatar_id":"","url":"https://api.github.com/users/matthewbentley","html_url":"https://github.com/matthewbentley","followers_url":"https://api.github.com/users/matthewbentley/followers","following_url":"https://api.github.com/users/matthewbentley/following{/other_user}","gists_url":"https://api.github.com/users/matthewbentley/gists{/gist_id}","starred_url":"https://api.github.com/users/matthewbentley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthewbentley/subscriptions","organizations_url":"https://api.github.com/users/matthewbentley/orgs","repos_url":"https://api.github.com/users/matthewbentley/repos","events_url":"https://api.github.com/users/matthewbentley/events{/privacy}","received_events_url":"https://api.github.com/users/matthewbentley/received_events","type":"User","site_admin":false},"body":"In response to #10098 \r\nTries to load `prefs.json` from the profile-dir and merge them into the preferences if `--profile-dir` is specified at launch.  The profile-dir preferences take precedence over the default preferences, but command line preferences still take precedence over everything.\r\n\r\nAlso adds some tests for `prefs.rs`.  These rely on the contents of `resources/prefs.json` (at least `test_get_set_reset_extend()` does), so they may need to be re-worked a bit.\n\n<!-- Reviewable:start -->\n---\nThis change is [<img src=\"https://reviewable.io/review_button.svg\" height=\"35\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.io/reviews/servo/servo/10114)\n<!-- Reviewable:end -->\n","created_at":"2016-03-22T03:22:28Z","updated_at":"2016-04-01T13:55:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f5e1cc3412ec53da7f47853bb9bd291163ffc360","assignee":{"login":"Manishearth","id":1617736,"avatar_url":"https://avatars.githubusercontent.com/u/1617736?v=3","gravatar_id":"","url":"https://api.github.com/users/Manishearth","html_url":"https://github.com/Manishearth","followers_url":"https://api.github.com/users/Manishearth/followers","following_url":"https://api.github.com/users/Manishearth/following{/other_user}","gists_url":"https://api.github.com/users/Manishearth/gists{/gist_id}","starred_url":"https://api.github.com/users/Manishearth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Manishearth/subscriptions","organizations_url":"https://api.github.com/users/Manishearth/orgs","repos_url":"https://api.github.com/users/Manishearth/repos","events_url":"https://api.github.com/users/Manishearth/events{/privacy}","received_events_url":"https://api.github.com/users/Manishearth/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/servo/servo/pulls/10114/commits","review_comments_url":"https://api.github.com/repos/servo/servo/pulls/10114/comments","review_comment_url":"https://api.github.com/repos/servo/servo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/servo/servo/issues/10114/comments","statuses_url":"https://api.github.com/repos/servo/servo/statuses/aa48a400c49e4e809b53cf035e55f58157d0c949","head":{"label":"matthewbentley:master","ref":"master","sha":"aa48a400c49e4e809b53cf035e55f58157d0c949","user":{"login":"matthewbentley","id":1930163,"avatar_url":"https://avatars.githubusercontent.com/u/1930163?v=3","gravatar_id":"","url":"https://api.github.com/users/matthewbentley","html_url":"https://github.com/matthewbentley","followers_url":"https://api.github.com/users/matthewbentley/followers","following_url":"https://api.github.com/users/matthewbentley/following{/other_user}","gists_url":"https://api.github.com/users/matthewbentley/gists{/gist_id}","starred_url":"https://api.github.com/users/matthewbentley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthewbentley/subscriptions","organizations_url":"https://api.github.com/users/matthewbentley/orgs","repos_url":"https://api.github.com/users/matthewbentley/repos","events_url":"https://api.github.com/users/matthewbentley/events{/privacy}","received_events_url":"https://api.github.com/users/matthewbentley/received_events","type":"User","site_admin":false},"repo":{"id":54421248,"name":"servo","full_name":"matthewbentley/servo","owner":{"login":"matthewbentley","id":1930163,"avatar_url":"https://avatars.githubusercontent.com/u/1930163?v=3","gravatar_id":"","url":"https://api.github.com/users/matthewbentley","html_url":"https://github.com/matthewbentley","followers_url":"https://api.github.com/users/matthewbentley/followers","following_url":"https://api.github.com/users/matthewbentley/following{/other_user}","gists_url":"https://api.github.com/users/matthewbentley/gists{/gist_id}","starred_url":"https://api.github.com/users/matthewbentley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthewbentley/subscriptions","organizations_url":"https://api.github.com/users/matthewbentley/orgs","repos_url":"https://api.github.com/users/matthewbentley/repos","events_url":"https://api.github.com/users/matthewbentley/events{/privacy}","received_events_url":"https://api.github.com/users/matthewbentley/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/matthewbentley/servo","description":"The Servo Browser Engine","fork":true,"url":"https://api.github.com/repos/matthewbentley/servo","forks_url":"https://api.github.com/repos/matthewbentley/servo/forks","keys_url":"https://api.github.com/repos/matthewbentley/servo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/matthewbentley/servo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/matthewbentley/servo/teams","hooks_url":"https://api.github.com/repos/matthewbentley/servo/hooks","issue_events_url":"https://api.github.com/repos/matthewbentley/servo/issues/events{/number}","events_url":"https://api.github.com/repos/matthewbentley/servo/events","assignees_url":"https://api.github.com/repos/matthewbentley/servo/assignees{/user}","branches_url":"https://api.github.com/repos/matthewbentley/servo/branches{/branch}","tags_url":"https://api.github.com/repos/matthewbentley/servo/tags","blobs_url":"https://api.github.com/repos/matthewbentley/servo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/matthewbentley/servo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/matthewbentley/servo/git/refs{/sha}","trees_url":"https://api.github.com/repos/matthewbentley/servo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/matthewbentley/servo/statuses/{sha}","languages_url":"https://api.github.com/repos/matthewbentley/servo/languages","stargazers_url":"https://api.github.com/repos/matthewbentley/servo/stargazers","contributors_url":"https://api.github.com/repos/matthewbentley/servo/contributors","subscribers_url":"https://api.github.com/repos/matthewbentley/servo/subscribers","subscription_url":"https://api.github.com/repos/matthewbentley/servo/subscription","commits_url":"https://api.github.com/repos/matthewbentley/servo/commits{/sha}","git_commits_url":"https://api.github.com/repos/matthewbentley/servo/git/commits{/sha}","comments_url":"https://api.github.com/repos/matthewbentley/servo/comments{/number}","issue_comment_url":"https://api.github.com/repos/matthewbentley/servo/issues/comments{/number}","contents_url":"https://api.github.com/repos/matthewbentley/servo/contents/{+path}","compare_url":"https://api.github.com/repos/matthewbentley/servo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/matthewbentley/servo/merges","archive_url":"https://api.github.com/repos/matthewbentley/servo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/matthewbentley/servo/downloads","issues_url":"https://api.github.com/repos/matthewbentley/servo/issues{/number}","pulls_url":"https://api.github.com/repos/matthewbentley/servo/pulls{/number}","milestones_url":"https://api.github.com/repos/matthewbentley/servo/milestones{/number}","notifications_url":"https://api.github.com/repos/matthewbentley/servo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/matthewbentley/servo/labels{/name}","releases_url":"https://api.github.com/repos/matthewbentley/servo/releases{/id}","deployments_url":"https://api.github.com/repos/matthewbentley/servo/deployments","created_at":"2016-03-21T20:42:58Z","updated_at":"2016-03-21T19:34:51Z","pushed_at":"2016-03-22T03:35:31Z","git_url":"git://github.com/matthewbentley/servo.git","ssh_url":"git@github.com:matthewbentley/servo.git","clone_url":"https://github.com/matthewbentley/servo.git","svn_url":"https://github.com/matthewbentley/servo","homepage":"https://servo.org/","size":179025,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":true,"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":"servo:master","ref":"master","sha":"db63aa423fcfc87e47d9250680737ef11d2c3d26","user":{"login":"servo","id":2566135,"avatar_url":"https://avatars.githubusercontent.com/u/2566135?v=3","gravatar_id":"","url":"https://api.github.com/users/servo","html_url":"https://github.com/servo","followers_url":"https://api.github.com/users/servo/followers","following_url":"https://api.github.com/users/servo/following{/other_user}","gists_url":"https://api.github.com/users/servo/gists{/gist_id}","starred_url":"https://api.github.com/users/servo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/servo/subscriptions","organizations_url":"https://api.github.com/users/servo/orgs","repos_url":"https://api.github.com/users/servo/repos","events_url":"https://api.github.com/users/servo/events{/privacy}","received_events_url":"https://api.github.com/users/servo/received_events","type":"Organization","site_admin":false},"repo":{"id":3390243,"name":"servo","full_name":"servo/servo","owner":{"login":"servo","id":2566135,"avatar_url":"https://avatars.githubusercontent.com/u/2566135?v=3","gravatar_id":"","url":"https://api.github.com/users/servo","html_url":"https://github.com/servo","followers_url":"https://api.github.com/users/servo/followers","following_url":"https://api.github.com/users/servo/following{/other_user}","gists_url":"https://api.github.com/users/servo/gists{/gist_id}","starred_url":"https://api.github.com/users/servo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/servo/subscriptions","organizations_url":"https://api.github.com/users/servo/orgs","repos_url":"https://api.github.com/users/servo/repos","events_url":"https://api.github.com/users/servo/events{/privacy}","received_events_url":"https://api.github.com/users/servo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/servo/servo","description":"The Servo Browser Engine","fork":false,"url":"https://api.github.com/repos/servo/servo","forks_url":"https://api.github.com/repos/servo/servo/forks","keys_url":"https://api.github.com/repos/servo/servo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/servo/servo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/servo/servo/teams","hooks_url":"https://api.github.com/repos/servo/servo/hooks","issue_events_url":"https://api.github.com/repos/servo/servo/issues/events{/number}","events_url":"https://api.github.com/repos/servo/servo/events","assignees_url":"https://api.github.com/repos/servo/servo/assignees{/user}","branches_url":"https://api.github.com/repos/servo/servo/branches{/branch}","tags_url":"https://api.github.com/repos/servo/servo/tags","blobs_url":"https://api.github.com/repos/servo/servo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/servo/servo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/servo/servo/git/refs{/sha}","trees_url":"https://api.github.com/repos/servo/servo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/servo/servo/statuses/{sha}","languages_url":"https://api.github.com/repos/servo/servo/languages","stargazers_url":"https://api.github.com/repos/servo/servo/stargazers","contributors_url":"https://api.github.com/repos/servo/servo/contributors","subscribers_url":"https://api.github.com/repos/servo/servo/subscribers","subscription_url":"https://api.github.com/repos/servo/servo/subscription","commits_url":"https://api.github.com/repos/servo/servo/commits{/sha}","git_commits_url":"https://api.github.com/repos/servo/servo/git/commits{/sha}","comments_url":"https://api.github.com/repos/servo/servo/comments{/number}","issue_comment_url":"https://api.github.com/repos/servo/servo/issues/comments{/number}","contents_url":"https://api.github.com/repos/servo/servo/contents/{+path}","compare_url":"https://api.github.com/repos/servo/servo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/servo/servo/merges","archive_url":"https://api.github.com/repos/servo/servo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/servo/servo/downloads","issues_url":"https://api.github.com/repos/servo/servo/issues{/number}","pulls_url":"https://api.github.com/repos/servo/servo/pulls{/number}","milestones_url":"https://api.github.com/repos/servo/servo/milestones{/number}","notifications_url":"https://api.github.com/repos/servo/servo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/servo/servo/labels{/name}","releases_url":"https://api.github.com/repos/servo/servo/releases{/id}","deployments_url":"https://api.github.com/repos/servo/servo/deployments","created_at":"2012-02-08T19:07:25Z","updated_at":"2016-04-01T13:39:47Z","pushed_at":"2016-04-01T13:44:49Z","git_url":"git://github.com/servo/servo.git","ssh_url":"git@github.com:servo/servo.git","clone_url":"https://github.com/servo/servo.git","svn_url":"https://github.com/servo/servo","homepage":"https://servo.org/","size":213304,"stargazers_count":6406,"watchers_count":6406,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1054,"mirror_url":null,"open_issues_count":1420,"forks":1054,"open_issues":1420,"watchers":6406,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/servo/servo/pulls/10114"},"html":{"href":"https://github.com/servo/servo/pull/10114"},"issue":{"href":"https://api.github.com/repos/servo/servo/issues/10114"},"comments":{"href":"https://api.github.com/repos/servo/servo/issues/10114/comments"},"review_comments":{"href":"https://api.github.com/repos/servo/servo/pulls/10114/comments"},"review_comment":{"href":"https://api.github.com/repos/servo/servo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/servo/servo/pulls/10114/commits"},"statuses":{"href":"https://api.github.com/repos/servo/servo/statuses/aa48a400c49e4e809b53cf035e55f58157d0c949"}}}}