mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-03-30 17:18:57 +00:00
fix: navigator.languages should include base language per spec
Per the HTML spec, navigator.languages should return the user's preferred languages. Most browsers return at least ["en-US", "en"] to include the base language tag alongside the regional variant. This matches Chrome, Firefox, and Safari behavior and improves compatibility with sites that check for language negotiation.
This commit is contained in:
@@ -15,8 +15,9 @@
|
||||
testing.expectEqual(true, validPlatforms.includes(navigator.platform));
|
||||
testing.expectEqual('en-US', navigator.language);
|
||||
testing.expectEqual(true, Array.isArray(navigator.languages));
|
||||
testing.expectEqual(1, navigator.languages.length);
|
||||
testing.expectEqual(2, navigator.languages.length);
|
||||
testing.expectEqual('en-US', navigator.languages[0]);
|
||||
testing.expectEqual('en', navigator.languages[1]);
|
||||
testing.expectEqual(true, navigator.onLine);
|
||||
testing.expectEqual(true, navigator.cookieEnabled);
|
||||
testing.expectEqual(true, navigator.hardwareConcurrency > 0);
|
||||
|
||||
@@ -40,8 +40,8 @@ pub fn getUserAgent(_: *const Navigator, page: *Page) []const u8 {
|
||||
return page._session.browser.app.config.http_headers.user_agent;
|
||||
}
|
||||
|
||||
pub fn getLanguages(_: *const Navigator) [1][]const u8 {
|
||||
return .{"en-US"};
|
||||
pub fn getLanguages(_: *const Navigator) [2][]const u8 {
|
||||
return .{ "en-US", "en" };
|
||||
}
|
||||
|
||||
pub fn getPlatform(_: *const Navigator) []const u8 {
|
||||
|
||||
Reference in New Issue
Block a user