diff options
author | Paul Rouget <me@paulrouget.com> | 2015-09-09 16:19:10 +0200 |
---|---|---|
committer | Paul Rouget <me@paulrouget.com> | 2015-09-29 08:14:30 +0200 |
commit | 132724be2b87d0cb6c8754345dc5595787797bcd (patch) | |
tree | 6ca0fdd0fd1eb6c2d57c98785116958c5e7e05cb | |
parent | e68bd8d4ffc7f2cd9511999760c7a67418a853e1 (diff) | |
download | servo-132724be2b87d0cb6c8754345dc5595787797bcd.tar.gz servo-132724be2b87d0cb6c8754345dc5595787797bcd.zip |
implement navigator.platform
-rw-r--r-- | components/script/dom/navigatorinfo.rs | 13 | ||||
-rw-r--r-- | tests/wpt/mozilla/meta/mozilla/navigator.html.ini | 12 | ||||
-rw-r--r-- | tests/wpt/mozilla/tests/mozilla/navigator.html | 14 |
3 files changed, 36 insertions, 3 deletions
diff --git a/components/script/dom/navigatorinfo.rs b/components/script/dom/navigatorinfo.rs index a3857f29844..a4857c5ac39 100644 --- a/components/script/dom/navigatorinfo.rs +++ b/components/script/dom/navigatorinfo.rs @@ -22,8 +22,19 @@ pub fn AppCodeName() -> DOMString { "Mozilla".to_owned() } +#[cfg(target_os = "windows")] pub fn Platform() -> DOMString { - "".to_owned() + "Win32".to_owned() +} + +#[cfg(any(target_os = "android", target_os = "linux"))] +pub fn Platform() -> DOMString { + "Linux".to_owned() +} + +#[cfg(target_os = "macos")] +pub fn Platform() -> DOMString { + "Mac".to_owned() } pub fn UserAgent() -> DOMString { diff --git a/tests/wpt/mozilla/meta/mozilla/navigator.html.ini b/tests/wpt/mozilla/meta/mozilla/navigator.html.ini new file mode 100644 index 00000000000..ade9b581949 --- /dev/null +++ b/tests/wpt/mozilla/meta/mozilla/navigator.html.ini @@ -0,0 +1,12 @@ +[navigator.html] + type: testharness + + [navigator.platform linux] + expected: + if os != "linux": FAIL + PASS + + [navigator.platform mac] + expected: + if os != "mac": FAIL + PASS diff --git a/tests/wpt/mozilla/tests/mozilla/navigator.html b/tests/wpt/mozilla/tests/mozilla/navigator.html index 83f74b6e6cf..cb245d9d660 100644 --- a/tests/wpt/mozilla/tests/mozilla/navigator.html +++ b/tests/wpt/mozilla/tests/mozilla/navigator.html @@ -15,9 +15,19 @@ test(function() { assert_equals(nav.taintEnabled(), false); assert_equals(nav.appName, "Netscape"); assert_equals(nav.appCodeName, "Mozilla"); - assert_equals(nav.platform, ""); assert_equals(nav.appVersion, "4.0"); -}); +}, "navigator"); + + +test(function() { + assert_equals(navigator.platform, "Linux"); +}, "navigator.platform linux"); + +test(function() { + assert_equals(navigator.platform, "Mac"); +}, "navigator.platform mac"); + + </script> </body> </html> |