Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intl.ListFormat not being returned for Chrome 71 in Xiaomi phone #16

Closed
Daymannovaes opened this issue May 2, 2020 · 2 comments
Closed

Comments

@Daymannovaes
Copy link

The error can be reproduced as the following:

const request = require("request");

function withUserAgent(userAgent) {
    return {
        url: "https://polyfill.app/api/polyfill?features=intl.list-format",
        headers: {
            "User-Agent": userAgent
        }
    };
}

// this is a real user agent from mi browser in a Xiaomi phone
const chrome71xiaomi = "Mozilla/5.0 (Linux; U; Android 10; en-us; SM-G975F Build/QP1A.190711.020) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/71.0.3578.141 Mobile Safari/537.36 XiaoMi/MiuiBrowser/12.1.3-g";

// this is a real user agent from a Pixel 2 XL
const chrome71      = "Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.141 Mobile Safari/537.36";

// This one is just like the above one, but with "XiaoMi/MiuiBrowser/12.1.3-g" added at the end
const chrome71fake  = "Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.141 Mobile Safari/537.36 XiaoMi/MiuiBrowser/12.1.3-g";

request(
    withUserAgent(chrome71xiaomi),
    (error, response, body) => console.log("chrome71xiaomi: ", body.length)
);

request(
    withUserAgent(chrome71),
    (error, response, body) => console.log("chrome71: ", body.length)
);

request(
    withUserAgent(chrome71fake),
    (error, response, body) => console.log("chrome71fake: ", body.length)
);

The resulting log is:

chrome71xiaomi:  0
chrome71fake:  0
chrome71:  15477

Which is obviously an error.

@Daymannovaes
Copy link
Author

I just discovered that any polyfill will work in Xiaomi user-agent.

If you request for https://polyfill.app/api/polyfill?features=requestidlecallback, in Chrome 40, the same happens.

const chrome40xiaomi = "Mozilla/5.0 (Linux; U; Android 10; en-us; SM-G975F Build/QP1A.190711.020) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/40.0.3578.141 Mobile Safari/537.36 XiaoMi/MiuiBrowser/12.1.3-g";
const chrome40       = "Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.3578.141 Mobile Safari/537.36";
const chrome40fake   = "Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.3578.141 Mobile Safari/537.36 XiaoMi/MiuiBrowser/12.1.3-g";

request(
    withUserAgent(chrome40xiaomi), (_, __, body) => console.log("chrome40xiaomi: ", body.length)
);

request(
    withUserAgent(chrome40), (_, __, body) => console.log("chrome40: ", body.length)
);

request(
    withUserAgent(chrome40fake), (_, __, body) => console.log("chrome40fake: ", body.length)
);

results in

chrome40:  4001
chrome40xiaomi:  0
chrome40fake:  0

@wessberg
Copy link
Owner

wessberg commented May 4, 2020

Hey there. Thanks for reporting it. It has been fixed and deployed to production.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants