{"action":"created","comment":{"url":"https://api.github.com/repos/servo/servo/pulls/comments/133545207","pull_request_review_id":56739579,"id":133545207,"diff_hunk":"@@ -391,6 +392,79 @@ impl<T: DomObject> HeapSizeOf for MutNullableJS<T> {\n     }\n }\n \n+/// A holder that allows to lazily initialize the value only once\n+/// `JS<T>`, using OnceCell\n+/// Essentially a `OnceCell<JS<T>>`.\n+///\n+/// This should only be used as a field in other DOM objects; see warning\n+/// on `JS<T>`.\n+#[must_root]\n+pub struct OnceCellJS<T: DomObject> {\n+    ptr: OnceCell<JS<T>>,\n+}\n+\n+impl<T: DomObject> OnceCellJS<T> {\n+    /// Create a new `OnceCellJS` with value\n+    pub fn new(initial: Option<&T>) -> OnceCellJS<T> {\n+        debug_assert!(thread_state::get().is_script());\n+        OnceCellJS {\n+            ptr: OnceCell::new_with_value(initial.map(JS::from_ref).unwrap()),\n+        }\n+    }\n+\n+    /// Retrieve a copy of the current inner value. If it is `None`, it is\n+    /// initialized with the result of `cb` first.\n+    #[allow(unrooted_must_root)]\n+    pub unsafe fn or_init<F>(&self, cb: F) -> &T","path":"components/script/dom/bindings/js.rs","position":35,"original_position":35,"commit_id":"8eb6069059e462ef503215667cb2301258468595","original_commit_id":"8eb6069059e462ef503215667cb2301258468595","user":{"login":"nox","id":123095,"avatar_url":"https://avatars0.githubusercontent.com/u/123095?v=4","gravatar_id":"","url":"https://api.github.com/users/nox","html_url":"https://github.com/nox","followers_url":"https://api.github.com/users/nox/followers","following_url":"https://api.github.com/users/nox/following{/other_user}","gists_url":"https://api.github.com/users/nox/gists{/gist_id}","starred_url":"https://api.github.com/users/nox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nox/subscriptions","organizations_url":"https://api.github.com/users/nox/orgs","repos_url":"https://api.github.com/users/nox/repos","events_url":"https://api.github.com/users/nox/events{/privacy}","received_events_url":"https://api.github.com/users/nox/received_events","type":"User","site_admin":false},"body":"You cannot retrieve a `&T` from a `MutNullableJS<T>`. IMO the method should be named `init_once` just like in Mitochondria.","created_at":"2017-08-16T19:32:32Z","updated_at":"2017-08-16T19:32:32Z","html_url":"https://github.com/servo/servo/pull/18059#discussion_r133545207","pull_request_url":"https://api.github.com/repos/servo/servo/pulls/18059","_links":{"self":{"href":"https://api.github.com/repos/servo/servo/pulls/comments/133545207"},"html":{"href":"https://github.com/servo/servo/pull/18059#discussion_r133545207"},"pull_request":{"href":"https://api.github.com/repos/servo/servo/pulls/18059"}}},"pull_request":{"url":"https://api.github.com/repos/servo/servo/pulls/18059","id":135483909,"html_url":"https://github.com/servo/servo/pull/18059","diff_url":"https://github.com/servo/servo/pull/18059.diff","patch_url":"https://github.com/servo/servo/pull/18059.patch","issue_url":"https://api.github.com/repos/servo/servo/issues/18059","number":18059,"state":"open","locked":false,"title":"Using OnceCell<T> from Mitochondria","user":{"login":"sendilkumarn","id":12471122,"avatar_url":"https://avatars0.githubusercontent.com/u/12471122?v=4","gravatar_id":"","url":"https://api.github.com/users/sendilkumarn","html_url":"https://github.com/sendilkumarn","followers_url":"https://api.github.com/users/sendilkumarn/followers","following_url":"https://api.github.com/users/sendilkumarn/following{/other_user}","gists_url":"https://api.github.com/users/sendilkumarn/gists{/gist_id}","starred_url":"https://api.github.com/users/sendilkumarn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sendilkumarn/subscriptions","organizations_url":"https://api.github.com/users/sendilkumarn/orgs","repos_url":"https://api.github.com/users/sendilkumarn/repos","events_url":"https://api.github.com/users/sendilkumarn/events{/privacy}","received_events_url":"https://api.github.com/users/sendilkumarn/received_events","type":"User","site_admin":false},"body":"<!-- Please describe your changes on the following line: -->\r\n---\r\n<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->\r\n- [x] `./mach build -d` does not report any errors\r\n- [x] `./mach test-tidy` does not report any errors\r\n- [x] These changes fix #13402  (github issue number if applicable).\r\n\r\n<!-- Either: -->\r\n- [ ] There are tests for these changes OR\r\n- [ ] These changes do not require tests because _____\r\n\r\n<!-- Also, please make sure that \"Allow edits from maintainers\" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->\r\n\r\n<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->\n\n<!-- Reviewable:start -->\n---\nThis change is [<img src=\"https://reviewable.io/review_button.svg\" height=\"34\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.io/reviews/servo/servo/18059)\n<!-- Reviewable:end -->\n","created_at":"2017-08-13T06:32:45Z","updated_at":"2017-08-16T19:32:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d8bafbeb4ca2c12f50af7b2ecc2eb7016c69510f","assignee":{"login":"nox","id":123095,"avatar_url":"https://avatars0.githubusercontent.com/u/123095?v=4","gravatar_id":"","url":"https://api.github.com/users/nox","html_url":"https://github.com/nox","followers_url":"https://api.github.com/users/nox/followers","following_url":"https://api.github.com/users/nox/following{/other_user}","gists_url":"https://api.github.com/users/nox/gists{/gist_id}","starred_url":"https://api.github.com/users/nox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nox/subscriptions","organizations_url":"https://api.github.com/users/nox/orgs","repos_url":"https://api.github.com/users/nox/repos","events_url":"https://api.github.com/users/nox/events{/privacy}","received_events_url":"https://api.github.com/users/nox/received_events","type":"User","site_admin":false},"assignees":[{"login":"nox","id":123095,"avatar_url":"https://avatars0.githubusercontent.com/u/123095?v=4","gravatar_id":"","url":"https://api.github.com/users/nox","html_url":"https://github.com/nox","followers_url":"https://api.github.com/users/nox/followers","following_url":"https://api.github.com/users/nox/following{/other_user}","gists_url":"https://api.github.com/users/nox/gists{/gist_id}","starred_url":"https://api.github.com/users/nox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nox/subscriptions","organizations_url":"https://api.github.com/users/nox/orgs","repos_url":"https://api.github.com/users/nox/repos","events_url":"https://api.github.com/users/nox/events{/privacy}","received_events_url":"https://api.github.com/users/nox/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/servo/servo/pulls/18059/commits","review_comments_url":"https://api.github.com/repos/servo/servo/pulls/18059/comments","review_comment_url":"https://api.github.com/repos/servo/servo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/servo/servo/issues/18059/comments","statuses_url":"https://api.github.com/repos/servo/servo/statuses/8eb6069059e462ef503215667cb2301258468595","head":{"label":"sendilkumarn:mito","ref":"mito","sha":"8eb6069059e462ef503215667cb2301258468595","user":{"login":"sendilkumarn","id":12471122,"avatar_url":"https://avatars0.githubusercontent.com/u/12471122?v=4","gravatar_id":"","url":"https://api.github.com/users/sendilkumarn","html_url":"https://github.com/sendilkumarn","followers_url":"https://api.github.com/users/sendilkumarn/followers","following_url":"https://api.github.com/users/sendilkumarn/following{/other_user}","gists_url":"https://api.github.com/users/sendilkumarn/gists{/gist_id}","starred_url":"https://api.github.com/users/sendilkumarn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sendilkumarn/subscriptions","organizations_url":"https://api.github.com/users/sendilkumarn/orgs","repos_url":"https://api.github.com/users/sendilkumarn/repos","events_url":"https://api.github.com/users/sendilkumarn/events{/privacy}","received_events_url":"https://api.github.com/users/sendilkumarn/received_events","type":"User","site_admin":false},"repo":{"id":83688540,"name":"servo","full_name":"sendilkumarn/servo","owner":{"login":"sendilkumarn","id":12471122,"avatar_url":"https://avatars0.githubusercontent.com/u/12471122?v=4","gravatar_id":"","url":"https://api.github.com/users/sendilkumarn","html_url":"https://github.com/sendilkumarn","followers_url":"https://api.github.com/users/sendilkumarn/followers","following_url":"https://api.github.com/users/sendilkumarn/following{/other_user}","gists_url":"https://api.github.com/users/sendilkumarn/gists{/gist_id}","starred_url":"https://api.github.com/users/sendilkumarn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sendilkumarn/subscriptions","organizations_url":"https://api.github.com/users/sendilkumarn/orgs","repos_url":"https://api.github.com/users/sendilkumarn/repos","events_url":"https://api.github.com/users/sendilkumarn/events{/privacy}","received_events_url":"https://api.github.com/users/sendilkumarn/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sendilkumarn/servo","description":"The Servo Browser Engine","fork":true,"url":"https://api.github.com/repos/sendilkumarn/servo","forks_url":"https://api.github.com/repos/sendilkumarn/servo/forks","keys_url":"https://api.github.com/repos/sendilkumarn/servo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sendilkumarn/servo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sendilkumarn/servo/teams","hooks_url":"https://api.github.com/repos/sendilkumarn/servo/hooks","issue_events_url":"https://api.github.com/repos/sendilkumarn/servo/issues/events{/number}","events_url":"https://api.github.com/repos/sendilkumarn/servo/events","assignees_url":"https://api.github.com/repos/sendilkumarn/servo/assignees{/user}","branches_url":"https://api.github.com/repos/sendilkumarn/servo/branches{/branch}","tags_url":"https://api.github.com/repos/sendilkumarn/servo/tags","blobs_url":"https://api.github.com/repos/sendilkumarn/servo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sendilkumarn/servo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sendilkumarn/servo/git/refs{/sha}","trees_url":"https://api.github.com/repos/sendilkumarn/servo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sendilkumarn/servo/statuses/{sha}","languages_url":"https://api.github.com/repos/sendilkumarn/servo/languages","stargazers_url":"https://api.github.com/repos/sendilkumarn/servo/stargazers","contributors_url":"https://api.github.com/repos/sendilkumarn/servo/contributors","subscribers_url":"https://api.github.com/repos/sendilkumarn/servo/subscribers","subscription_url":"https://api.github.com/repos/sendilkumarn/servo/subscription","commits_url":"https://api.github.com/repos/sendilkumarn/servo/commits{/sha}","git_commits_url":"https://api.github.com/repos/sendilkumarn/servo/git/commits{/sha}","comments_url":"https://api.github.com/repos/sendilkumarn/servo/comments{/number}","issue_comment_url":"https://api.github.com/repos/sendilkumarn/servo/issues/comments{/number}","contents_url":"https://api.github.com/repos/sendilkumarn/servo/contents/{+path}","compare_url":"https://api.github.com/repos/sendilkumarn/servo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sendilkumarn/servo/merges","archive_url":"https://api.github.com/repos/sendilkumarn/servo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sendilkumarn/servo/downloads","issues_url":"https://api.github.com/repos/sendilkumarn/servo/issues{/number}","pulls_url":"https://api.github.com/repos/sendilkumarn/servo/pulls{/number}","milestones_url":"https://api.github.com/repos/sendilkumarn/servo/milestones{/number}","notifications_url":"https://api.github.com/repos/sendilkumarn/servo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sendilkumarn/servo/labels{/name}","releases_url":"https://api.github.com/repos/sendilkumarn/servo/releases{/id}","deployments_url":"https://api.github.com/repos/sendilkumarn/servo/deployments","created_at":"2017-03-02T14:44:38Z","updated_at":"2017-03-02T14:25:51Z","pushed_at":"2017-08-15T19:16:31Z","git_url":"git://github.com/sendilkumarn/servo.git","ssh_url":"git@github.com:sendilkumarn/servo.git","clone_url":"https://github.com/sendilkumarn/servo.git","svn_url":"https://github.com/sendilkumarn/servo","homepage":"https://servo.org/","size":284896,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_projects":true,"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":"4ddf6dbd153969e990d05298bc25a06be868319c","user":{"login":"servo","id":2566135,"avatar_url":"https://avatars1.githubusercontent.com/u/2566135?v=4","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://avatars1.githubusercontent.com/u/2566135?v=4","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":"2017-08-16T15:32:56Z","pushed_at":"2017-08-16T19:18:51Z","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":361293,"stargazers_count":9851,"watchers_count":9851,"language":null,"has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1688,"mirror_url":null,"open_issues_count":2265,"forks":1688,"open_issues":2265,"watchers":9851,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/servo/servo/pulls/18059"},"html":{"href":"https://github.com/servo/servo/pull/18059"},"issue":{"href":"https://api.github.com/repos/servo/servo/issues/18059"},"comments":{"href":"https://api.github.com/repos/servo/servo/issues/18059/comments"},"review_comments":{"href":"https://api.github.com/repos/servo/servo/pulls/18059/comments"},"review_comment":{"href":"https://api.github.com/repos/servo/servo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/servo/servo/pulls/18059/commits"},"statuses":{"href":"https://api.github.com/repos/servo/servo/statuses/8eb6069059e462ef503215667cb2301258468595"}}}}
{"actor":{"display_login":"nox"}}