{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/comments/25485198","id":25485198,"diff_hunk":"@@ -0,0 +1,63 @@\n+## Email startup flow","path":"apps/email/docs/startup.md","position":1,"original_position":1,"commit_id":"7d8f41f19303f833552bc490fe6bf87e1349526a","original_commit_id":"29431e0b1e8e4881e5a57bc6ce6272283743954a","user":{"login":"jrburke","id":73359,"avatar_url":"https://avatars.githubusercontent.com/u/73359?v=3","gravatar_id":"","url":"https://api.github.com/users/jrburke","html_url":"https://github.com/jrburke","followers_url":"https://api.github.com/users/jrburke/followers","following_url":"https://api.github.com/users/jrburke/following{/other_user}","gists_url":"https://api.github.com/users/jrburke/gists{/gist_id}","starred_url":"https://api.github.com/users/jrburke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrburke/subscriptions","organizations_url":"https://api.github.com/users/jrburke/orgs","repos_url":"https://api.github.com/users/jrburke/repos","events_url":"https://api.github.com/users/jrburke/events{/privacy}","received_events_url":"https://api.github.com/users/jrburke/received_events","type":"User","site_admin":false},"body":"Fixed in comment commit: 7d8f41f19303f833552bc490fe6bf87e1349526a","created_at":"2015-02-27T02:52:00Z","updated_at":"2015-02-27T02:52:00Z","html_url":"https://github.com/mozilla-b2g/gaia/pull/28509#discussion_r25485198","pull_request_url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/28509","_links":{"self":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/comments/25485198"},"html":{"href":"https://github.com/mozilla-b2g/gaia/pull/28509#discussion_r25485198"},"pull_request":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/28509"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/28509","id":30118342,"html_url":"https://github.com/mozilla-b2g/gaia/pull/28509","diff_url":"https://github.com/mozilla-b2g/gaia/pull/28509.diff","patch_url":"https://github.com/mozilla-b2g/gaia/pull/28509.patch","issue_url":"https://api.github.com/repos/mozilla-b2g/gaia/issues/28509","number":28509,"state":"open","locked":false,"title":"Bug 1128739 - [email] Refactor to streamline startup","user":{"login":"jrburke","id":73359,"avatar_url":"https://avatars.githubusercontent.com/u/73359?v=3","gravatar_id":"","url":"https://api.github.com/users/jrburke","html_url":"https://github.com/jrburke","followers_url":"https://api.github.com/users/jrburke/followers","following_url":"https://api.github.com/users/jrburke/following{/other_user}","gists_url":"https://api.github.com/users/jrburke/gists{/gist_id}","starred_url":"https://api.github.com/users/jrburke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrburke/subscriptions","organizations_url":"https://api.github.com/users/jrburke/orgs","repos_url":"https://api.github.com/users/jrburke/repos","events_url":"https://api.github.com/users/jrburke/events{/privacy}","received_events_url":"https://api.github.com/users/jrburke/received_events","type":"User","site_admin":false},"body":"A refactor of the email startup that uses localStorage and a flatter startup structure once the start card is known, where html_cache_restore is the decision maker. There are some notes about how the code is structured in docs/startup.md in the pull request.\r\n\r\nThat doc is meant to be a long term statement of the startup structure, below are some notes for those familiar with how the code works now and the diffs from that state:\r\n\r\n### No more \"set up account?\" dialog\r\n\r\nI removed the confirm dialog when the user does not have an account but calls email with an activity. This simplified the flow and I think is a better user experience. Now setup_account_info is shown with an error message in the card indicating an account is needed. This part needs ux-review, and here is a capture of how it looks:\r\n\r\n![new_setup_account_info](https://cloud.githubusercontent.com/assets/73359/6402309/7b317394-bdbb-11e4-9267-93ff00a69724.png)\r\n\r\n\r\n### Removed some async setup\r\n\r\nBoth `cards` and `model` now depend on a `cards_init` and `model_init` respectively that allow it to do more synchronous configuration. The contents or mapping of the init modules can be changed via module config for different environments. This helped reduce the number of async hops at runtime between files for setting up those modules.\r\n\r\nSo the change in model_acctsslice_startup_test.js is mainly about that change: model setup does not emit an \"api\" notification, so the `api` module is just directly referenced as a dependency.\r\n\r\n### No fragment ID dispatch\r\n\r\nThe ticket talked about doing fragment ID dispatch to any arbitrary card, but these changes alone were big enough that I felt just getting this stabilized was the first step. So I will file a follow-on bug for that once we have sat with this for a bit. It could be that service worker use comes along fast enough that it would just fall out of that work too.\r\n\r\n### Startup performance\r\n\r\nI seemed to get about a 40-50ms averaged hit by going with localStorage when tested locally. So instead of it being 400ms for visually complete, it was more like 450ms instead. That is still the lowest startup for visually complete for an app, and I think worth the cost given the move away from horrible cookie APIs and the ability to cache more cards.\r\n\r\nIn addition, some later events, moz-content-interactive and moz-chrome-interactive seemed to slightly improve, but the final app-loaded metric did not, it seemed to reflect the startup cost delay. So those intermittent metrics probably just got pushed forward ahead of some work that needs to complete anyway. My bet is that some of the card pieces that are less dependent on model being completely ready before executing can now run sooner.\r\n\r\n### request-sync testing shows an IDB error\r\n\r\nWhen the app closes itself after syncing, I will see messages like this:\r\n\r\n    W/E-Mail  (10208): [JavaScript Warning: \"An IndexedDB transaction that was not yet complete has been aborted due to page navigation.\" {file: \"app://email.gaiamobile.org/js/ext/main-frame-setup.js\" line: 5186}]\r\n\r\nI can get these on master too, so not caused by this change, and they do not seem to be fatal, but want to call out that I have seen them.\r\n\r\n### document.hidden on startup\r\n\r\nhtml_cache_restore uses a setTimeout to test document.hidden when notifications start up the app, because document.hidden was false at that point in startup without the setTimeout. I would like to think the app is so fast now we are testing things before they are ready, but I think it is more likely just a bug in the platform, and will be filing a bug for that issue. However I want to work up a simpler test case for it first.\r\n\r\n### Beware zombie syncs!\r\n\r\nIf testing periodic sync, due to bug xxx, canceled sync operations never die! A restart does not kill them. A reset-gaia though seems to do the trick. On the plus side, the email app does not freak out when getting these older syncs, just lets them pass through.\r\n","created_at":"2015-02-26T21:30:05Z","updated_at":"2015-02-27T02:52:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"79be35c299e80bbc9fcc0614616b3c0f04a93df2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/28509/commits","review_comments_url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/28509/comments","review_comment_url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla-b2g/gaia/issues/28509/comments","statuses_url":"https://api.github.com/repos/mozilla-b2g/gaia/statuses/7d8f41f19303f833552bc490fe6bf87e1349526a","head":{"label":"jrburke:bug1128739-email-startup-refactor","ref":"bug1128739-email-startup-refactor","sha":"7d8f41f19303f833552bc490fe6bf87e1349526a","user":{"login":"jrburke","id":73359,"avatar_url":"https://avatars.githubusercontent.com/u/73359?v=3","gravatar_id":"","url":"https://api.github.com/users/jrburke","html_url":"https://github.com/jrburke","followers_url":"https://api.github.com/users/jrburke/followers","following_url":"https://api.github.com/users/jrburke/following{/other_user}","gists_url":"https://api.github.com/users/jrburke/gists{/gist_id}","starred_url":"https://api.github.com/users/jrburke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrburke/subscriptions","organizations_url":"https://api.github.com/users/jrburke/orgs","repos_url":"https://api.github.com/users/jrburke/repos","events_url":"https://api.github.com/users/jrburke/events{/privacy}","received_events_url":"https://api.github.com/users/jrburke/received_events","type":"User","site_admin":false},"repo":{"id":7672193,"name":"gaia","full_name":"jrburke/gaia","owner":{"login":"jrburke","id":73359,"avatar_url":"https://avatars.githubusercontent.com/u/73359?v=3","gravatar_id":"","url":"https://api.github.com/users/jrburke","html_url":"https://github.com/jrburke","followers_url":"https://api.github.com/users/jrburke/followers","following_url":"https://api.github.com/users/jrburke/following{/other_user}","gists_url":"https://api.github.com/users/jrburke/gists{/gist_id}","starred_url":"https://api.github.com/users/jrburke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrburke/subscriptions","organizations_url":"https://api.github.com/users/jrburke/orgs","repos_url":"https://api.github.com/users/jrburke/repos","events_url":"https://api.github.com/users/jrburke/events{/privacy}","received_events_url":"https://api.github.com/users/jrburke/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jrburke/gaia","description":"Gaia is a HTML5-based Phone UI for the Boot 2 Gecko Project","fork":true,"url":"https://api.github.com/repos/jrburke/gaia","forks_url":"https://api.github.com/repos/jrburke/gaia/forks","keys_url":"https://api.github.com/repos/jrburke/gaia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jrburke/gaia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jrburke/gaia/teams","hooks_url":"https://api.github.com/repos/jrburke/gaia/hooks","issue_events_url":"https://api.github.com/repos/jrburke/gaia/issues/events{/number}","events_url":"https://api.github.com/repos/jrburke/gaia/events","assignees_url":"https://api.github.com/repos/jrburke/gaia/assignees{/user}","branches_url":"https://api.github.com/repos/jrburke/gaia/branches{/branch}","tags_url":"https://api.github.com/repos/jrburke/gaia/tags","blobs_url":"https://api.github.com/repos/jrburke/gaia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jrburke/gaia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jrburke/gaia/git/refs{/sha}","trees_url":"https://api.github.com/repos/jrburke/gaia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jrburke/gaia/statuses/{sha}","languages_url":"https://api.github.com/repos/jrburke/gaia/languages","stargazers_url":"https://api.github.com/repos/jrburke/gaia/stargazers","contributors_url":"https://api.github.com/repos/jrburke/gaia/contributors","subscribers_url":"https://api.github.com/repos/jrburke/gaia/subscribers","subscription_url":"https://api.github.com/repos/jrburke/gaia/subscription","commits_url":"https://api.github.com/repos/jrburke/gaia/commits{/sha}","git_commits_url":"https://api.github.com/repos/jrburke/gaia/git/commits{/sha}","comments_url":"https://api.github.com/repos/jrburke/gaia/comments{/number}","issue_comment_url":"https://api.github.com/repos/jrburke/gaia/issues/comments{/number}","contents_url":"https://api.github.com/repos/jrburke/gaia/contents/{+path}","compare_url":"https://api.github.com/repos/jrburke/gaia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jrburke/gaia/merges","archive_url":"https://api.github.com/repos/jrburke/gaia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jrburke/gaia/downloads","issues_url":"https://api.github.com/repos/jrburke/gaia/issues{/number}","pulls_url":"https://api.github.com/repos/jrburke/gaia/pulls{/number}","milestones_url":"https://api.github.com/repos/jrburke/gaia/milestones{/number}","notifications_url":"https://api.github.com/repos/jrburke/gaia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jrburke/gaia/labels{/name}","releases_url":"https://api.github.com/repos/jrburke/gaia/releases{/id}","created_at":"2013-01-17T18:57:05Z","updated_at":"2015-02-26T20:47:35Z","pushed_at":"2015-02-27T02:44:48Z","git_url":"git://github.com/jrburke/gaia.git","ssh_url":"git@github.com:jrburke/gaia.git","clone_url":"https://github.com/jrburke/gaia.git","svn_url":"https://github.com/jrburke/gaia","homepage":"https://wiki.mozilla.org/B2G","size":891281,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"mozilla-b2g:master","ref":"master","sha":"2769db0e5fe75986ff9b16b39f63ec328eff62ff","user":{"login":"mozilla-b2g","id":1261292,"avatar_url":"https://avatars.githubusercontent.com/u/1261292?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla-b2g","html_url":"https://github.com/mozilla-b2g","followers_url":"https://api.github.com/users/mozilla-b2g/followers","following_url":"https://api.github.com/users/mozilla-b2g/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-b2g/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-b2g/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-b2g/subscriptions","organizations_url":"https://api.github.com/users/mozilla-b2g/orgs","repos_url":"https://api.github.com/users/mozilla-b2g/repos","events_url":"https://api.github.com/users/mozilla-b2g/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-b2g/received_events","type":"Organization","site_admin":false},"repo":{"id":2317369,"name":"gaia","full_name":"mozilla-b2g/gaia","owner":{"login":"mozilla-b2g","id":1261292,"avatar_url":"https://avatars.githubusercontent.com/u/1261292?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla-b2g","html_url":"https://github.com/mozilla-b2g","followers_url":"https://api.github.com/users/mozilla-b2g/followers","following_url":"https://api.github.com/users/mozilla-b2g/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-b2g/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-b2g/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-b2g/subscriptions","organizations_url":"https://api.github.com/users/mozilla-b2g/orgs","repos_url":"https://api.github.com/users/mozilla-b2g/repos","events_url":"https://api.github.com/users/mozilla-b2g/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-b2g/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla-b2g/gaia","description":"Gaia is a HTML5-based Phone UI for the Boot 2 Gecko Project. NOTE: For details of what branches are used for what releases, see","fork":false,"url":"https://api.github.com/repos/mozilla-b2g/gaia","forks_url":"https://api.github.com/repos/mozilla-b2g/gaia/forks","keys_url":"https://api.github.com/repos/mozilla-b2g/gaia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla-b2g/gaia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla-b2g/gaia/teams","hooks_url":"https://api.github.com/repos/mozilla-b2g/gaia/hooks","issue_events_url":"https://api.github.com/repos/mozilla-b2g/gaia/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla-b2g/gaia/events","assignees_url":"https://api.github.com/repos/mozilla-b2g/gaia/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla-b2g/gaia/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla-b2g/gaia/tags","blobs_url":"https://api.github.com/repos/mozilla-b2g/gaia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla-b2g/gaia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla-b2g/gaia/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla-b2g/gaia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla-b2g/gaia/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla-b2g/gaia/languages","stargazers_url":"https://api.github.com/repos/mozilla-b2g/gaia/stargazers","contributors_url":"https://api.github.com/repos/mozilla-b2g/gaia/contributors","subscribers_url":"https://api.github.com/repos/mozilla-b2g/gaia/subscribers","subscription_url":"https://api.github.com/repos/mozilla-b2g/gaia/subscription","commits_url":"https://api.github.com/repos/mozilla-b2g/gaia/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla-b2g/gaia/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla-b2g/gaia/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla-b2g/gaia/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla-b2g/gaia/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla-b2g/gaia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla-b2g/gaia/merges","archive_url":"https://api.github.com/repos/mozilla-b2g/gaia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla-b2g/gaia/downloads","issues_url":"https://api.github.com/repos/mozilla-b2g/gaia/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla-b2g/gaia/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla-b2g/gaia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla-b2g/gaia/labels{/name}","releases_url":"https://api.github.com/repos/mozilla-b2g/gaia/releases{/id}","created_at":"2011-09-03T01:38:46Z","updated_at":"2015-02-26T23:10:18Z","pushed_at":"2015-02-26T23:10:24Z","git_url":"git://github.com/mozilla-b2g/gaia.git","ssh_url":"git@github.com:mozilla-b2g/gaia.git","clone_url":"https://github.com/mozilla-b2g/gaia.git","svn_url":"https://github.com/mozilla-b2g/gaia","homepage":"https://wiki.mozilla.org/B2G","size":1436225,"stargazers_count":1878,"watchers_count":1878,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2234,"mirror_url":null,"open_issues_count":899,"forks":2234,"open_issues":899,"watchers":1878,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/28509"},"html":{"href":"https://github.com/mozilla-b2g/gaia/pull/28509"},"issue":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/issues/28509"},"comments":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/issues/28509/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/28509/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/28509/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/statuses/7d8f41f19303f833552bc490fe6bf87e1349526a"}}}}