Closed Bug 1082855 Opened 10 years ago Closed 10 years ago

Consider returning geoip region directly in fireplace index.html, as data attribute

Categories

(Marketplace Graveyard :: Consumer Pages, defect, P2)

x86_64
Linux
defect

Tracking

(Not tracked)

RESOLVED FIXED
2014-11-11

People

(Reporter: mat, Assigned: mat)

References

Details

(Keywords: perf)

Currently, when the client has no region from the SIM (either because he is using a phone with a SIM from an unsupported region, or has no SIM at all, or isn't using a phone) we call consumer_info API to detect his region. In the case of the website and the iframed app, the user needs to call https://marketplace.firefox.com/ first, and because this doesn't use the CDN, we could return the region directly in that HTML, as a data attribute on the body. We would then be able to omit the consumer_info call if the user is not logged in (*) That would certainly be a very good thing for performance, this the round-trip just to get consumer_info is costly. The drawback is that it would complicate the code handling region in fireplace a little more. I'd like to do this, but I'd also like to hear other people opinions. (*) If he is logged in, we still need consumer_info to get the list of apps he installed/purchased/developed.
Assignee: nobody → mpillard
Priority: -- → P2
Target Milestone: --- → 2014-11-11
Status: NEW → ASSIGNED
Fixed in https://github.com/mozilla/fireplace/commit/57d7446a2c759bf1d42c9829e7d22ee610bb3649 QA: Pre-requisite: - Be in a region that is supported by Marketplace (or use a proxy/VPN in a supported region) - With developer tools network tab opened and cache emptied, check that: - Going to marketplace "/" does *not* make an XHR request to /api/v2/fireplace/consumer_info/ - The region is correctly detected (to the region you are in) anyway - Going to marketplace "/?mcc=470&mnc=01" does *not* make an XHR request to /api/v2/fireplace/consumer_info/ - The region is correctly detected (to Bangladesh) anyway - Going to marketplace "/?mcc=666&mnc=01" *does* make an XHR request to /api/v2/fireplace/consumer_info/ - The region is correctly detected (to the region you are in, since mcc is invalid) anyway
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Krupa , can you please help us with this bug because we are not in a supported version ?
Flags: needinfo?(krupa.mozbugs)
region is incorrectly detected as Rest of World when the user is in the US. https://www.dropbox.com/s/09t1bcdvu31wyq8/Screenshot%202014-11-11%2015.21.44.png?dl=0 ashes: ID: 99881
Status: RESOLVED → REOPENED
Flags: needinfo?(krupa.mozbugs)
Resolution: FIXED → ---
Weird, it's working for me in France. Krupa: can you execute console.log(document.body.dataset['region']) in your devtools console and tell me what is returned ?
Flags: needinfo?(krupa.mozbugs)
(In reply to Mathieu Pillard [:mat] from comment #5) > Weird, it's working for me in France. > > Krupa: can you execute console.log(document.body.dataset['region']) in your > devtools console and tell me what is returned ? it returns "restofworld". See https://www.dropbox.com/s/2u9lpmxq8p23p97/Screenshot%202014-11-11%2015.30.05.png?dl=0
Flags: needinfo?(krupa.mozbugs)
Uh, so somehow geoip returned "restofworld" for you when you made the initial request to https://marketplace.firefox.com/. Very weird. Another test for you in devtools console: var res = require('requests').get('https://marketplace.firefox.com/api/v2/fireplace/consumer-info/?5768797979567') console.log(res.response) (Wait for the "GOT" in the console before doing the console.log)
Also, opening Marketplace in a private window sets the region to US. (In reply to Mathieu Pillard [:mat] from comment #7) > Uh, so somehow geoip returned "restofworld" for you when you made the > initial request to https://marketplace.firefox.com/. Very weird. > > Another test for you in devtools console: > var res = > require('requests').get('https://marketplace.firefox.com/api/v2/fireplace/ > consumer-info/?5768797979567') > console.log(res.response) > > (Wait for the "GOT" in the console before doing the console.log) That returned "{"region":"us"}"
I forgot to close it back, can you retest ? STR are in comment 2. I think the original problem you had with it could have been caused by some caching that has been deactivated since then. It works fine for me in France.
Status: REOPENED → RESOLVED
Closed: 10 years ago10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.