Closed
Bug 983556
Opened 12 years ago
Closed 12 years ago
Defer loading of Persona include.js
Categories
(Marketplace Graveyard :: Consumer Pages, defect, P2)
Tracking
(Not tracked)
VERIFIED
FIXED
2014-03-25
People
(Reporter: cvan, Assigned: cvan)
References
()
Details
(Keywords: perf, Whiteboard: [qa+])
(Related to bug 983289.)
In the previous incarnation of the Marketplace, we injected into the page a script tag for Persona's `include.js` and waited for it to finish before we allowed the user to sign in (or automatically signed the user in using `navigator.id.watch`).
I'd like to start doing that again. This may pose problems for example on the homepage because the consumer info. API request depends on the user token. What we can do is use the user token that's saved in `localStorage`, make the request to the server, and render the homepage - business as usual. However, the user may have already logged out of Persona but we don't know yet (until the script is done loading and `navigator.id.watch.onlogout` has been called). The API would have to somehow know to reject the SSA, and the only way to do that is to verify the assertion with Persona. I'm hoping that we can assume that the user will always explicitly log out from our site, so in that case we have control and predictability here.
Maybe Mat and Mark have ideas. And maybe we can inject the user data into the page without needing to block on the consumer info. request to start the other XHRs. You guys tell me.
And there are probably other cases I'm forgetting right now. Anything else?
If we get this right, this is a *huge* win, especially considering `include.js` is uncacheable <https://github.com/mozilla/persona/issues/4105>.
Comment 1•12 years ago
|
||
One idea that came out of an IRC conversation: defer loading of Persona. Before the auth process finishes, proceed as if the user is unauthenticated. If any XHRs return a 403 before the auth process finishes, show a "Logging you in..." interstitial. Once auth finishes, retry those requests and attempt to render the page as normal. Otherwise, attempt to update the current view with information from requests that need to be authenticated (e.g. consumer-info => update the text and function of app install buttons).
It's less than ideal for some of the edge cases (e.g. a developer attempting to view a non-public app), but it should subjectively feel a lot faster to the average user.
| Assignee | ||
Comment 2•12 years ago
|
||
| Assignee | ||
Comment 3•12 years ago
|
||
https://github.com/mozilla/fireplace/commit/4cf5d8e
Steps to verify:
1. Download and install Speed Limit: http://mschrag.github.io/
2. Use the EDGE setting or comparably slow with "login.persona.org" as the host.
3. Load https://marketplace-dev.allizom.org and make sure that the API, images, etc. load first and then the Persona `include.js` eventually loads. Make sure that you can still interact with the page too. (And try other pages besides the homepage, por favor.)
4. Repeat these stpes as an authenticated / anonymous user.
5. Repeat these steps with a faster, low-latency connection.
Thanks so much!
Assignee: nobody → cvan
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Whiteboard: [qa+]
Target Milestone: --- → 2014-03-25
| Assignee | ||
Comment 4•12 years ago
|
||
Speed Limit's "Hosts" option doesn't actually work lol.
And Lion OS X's Network Link Conditioner doesn't actually you limit by host.
Charles <http://www.charlesproxy.com/> worked fantastic for me with these settings:
1. Enable Proxy > Throttling
2. Open Proxy > Throttling Settings
3. Enter login.persona.org with no protocol and no port:
http://f.cl.ly/items/0b3Q39093i1U2Y2t3t1Q/Screen%20Shot%202014-03-20%20at%2011.18.28%20AM.png
| Assignee | ||
Comment 5•12 years ago
|
||
Updated `async` attribute on `script` tag:
https://github.com/mozilla/zamboni/commit/a96a331
| Assignee | ||
Comment 6•12 years ago
|
||
| Assignee | ||
Comment 7•12 years ago
|
||
Comment 8•12 years ago
|
||
I have some directions in an email from dougt about how you can adjust the speed on the device itself. Haven't tried it yet (I get a device tomorrow) but that's also an option. I'd like to make it a post somewhere once we get the steps.
Comment 9•12 years ago
|
||
I have verified the scenarios from comment 4 using the Charles Proxy tool.
Screencast for anonymous user: http://screencast.com/t/1hauaoT7Cj
signed in: http://screencast.com/t/qOIB63af
login process: http://screencast.com/t/4t0EG9pgbfe
Please let me know if there are any other scenarios that I should verify.
Thank you!
Updated•12 years ago
|
Flags: needinfo?
| Assignee | ||
Comment 10•12 years ago
|
||
Good screencasts. I think you've covered everything. Thank you!
Flags: needinfo?
Comment 11•12 years ago
|
||
Thank you cvan! Verified as fixed in https://marketplace-dev.allizom.org/ on FF30 (Win 7).
Closing bug.
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•