Title: [207021] trunk
Revision
207021
Author
[email protected]
Date
2016-10-10 14:01:39 -0700 (Mon, 10 Oct 2016)

Log Message

Add support for Navigator.languages attribute
https://bugs.webkit.org/show_bug.cgi?id=163220

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Rebaseline W3C tests now that more checks are passing.

* web-platform-tests/html/dom/interfaces-expected.txt:
* web-platform-tests/html/webappapis/system-state-and-capabilities/the-navigator-object/navigatorlanguage-expected.txt:

Source/WebCore:

Add support for Navigator.languages attribute:
- https://html.spec.whatwg.org/#navigatorlanguage

Firefox and Chrome already support this.

Currently, we always return a single language for privacy reasons so
this API does not actually bring anything new besides interoperability
with other browsers and compliance with the HTML specification.

No new tests, rebaselined existing tests.

* page/NavigatorBase.cpp:
(WebCore::NavigatorBase::languages):
* page/NavigatorBase.h:
* page/NavigatorLanguage.idl:

LayoutTests:

Rebase existing test to reflect change.

* fast/dom/navigator-detached-no-crash-expected.txt:
* platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (207020 => 207021)


--- trunk/LayoutTests/ChangeLog	2016-10-10 20:59:48 UTC (rev 207020)
+++ trunk/LayoutTests/ChangeLog	2016-10-10 21:01:39 UTC (rev 207021)
@@ -1,5 +1,17 @@
 2016-10-10  Chris Dumez  <[email protected]>
 
+        Add support for Navigator.languages attribute
+        https://bugs.webkit.org/show_bug.cgi?id=163220
+
+        Reviewed by Darin Adler.
+
+        Rebase existing test to reflect change.
+
+        * fast/dom/navigator-detached-no-crash-expected.txt:
+        * platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt:
+
+2016-10-10  Chris Dumez  <[email protected]>
+
         Update MessageEvent to stop using legacy [ConstructorTemplate=Event]
         https://bugs.webkit.org/show_bug.cgi?id=163187
 

Modified: trunk/LayoutTests/fast/dom/navigator-detached-no-crash-expected.txt (207020 => 207021)


--- trunk/LayoutTests/fast/dom/navigator-detached-no-crash-expected.txt	2016-10-10 20:59:48 UTC (rev 207020)
+++ trunk/LayoutTests/fast/dom/navigator-detached-no-crash-expected.txt	2016-10-10 21:01:39 UTC (rev 207021)
@@ -8,6 +8,7 @@
 navigator.hardwareConcurrency is OK
 navigator.javaEnabled() is OK
 navigator.language is OK
+navigator.languages is OK
 navigator.mimeTypes is OK
 navigator.onLine is OK
 navigator.platform is OK
@@ -25,6 +26,7 @@
 navigator.hardwareConcurrency is OK
 navigator.javaEnabled() is OK
 navigator.language is OK
+navigator.languages is OK
 navigator.mimeTypes is OK
 navigator.onLine is OK
 navigator.platform is OK

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (207020 => 207021)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2016-10-10 20:59:48 UTC (rev 207020)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2016-10-10 21:01:39 UTC (rev 207021)
@@ -1,3 +1,15 @@
+2016-10-10  Chris Dumez  <[email protected]>
+
+        Add support for Navigator.languages attribute
+        https://bugs.webkit.org/show_bug.cgi?id=163220
+
+        Reviewed by Darin Adler.
+
+        Rebaseline W3C tests now that more checks are passing.
+
+        * web-platform-tests/html/dom/interfaces-expected.txt:
+        * web-platform-tests/html/webappapis/system-state-and-capabilities/the-navigator-object/navigatorlanguage-expected.txt:
+
 2016-10-10  Youenn Fablet  <[email protected]>
 
         Sync web-platform-tests up to revision 33f4da1

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt (207020 => 207021)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt	2016-10-10 20:59:48 UTC (rev 207020)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt	2016-10-10 21:01:39 UTC (rev 207021)
@@ -5382,7 +5382,7 @@
 PASS Navigator interface: attribute vendor 
 PASS Navigator interface: attribute vendorSub 
 PASS Navigator interface: attribute language 
-FAIL Navigator interface: attribute languages assert_true: The prototype object must have a property "languages" expected true got false
+PASS Navigator interface: attribute languages 
 PASS Navigator interface: attribute onLine 
 FAIL Navigator interface: operation registerProtocolHandler(DOMString,USVString,DOMString) assert_own_property: interface prototype object missing non-static operation expected property "registerProtocolHandler" missing
 FAIL Navigator interface: operation registerContentHandler(DOMString,USVString,DOMString) assert_own_property: interface prototype object missing non-static operation expected property "registerContentHandler" missing
@@ -5407,7 +5407,7 @@
 PASS Navigator interface: window.navigator must inherit property "vendor" with the proper type (7) 
 PASS Navigator interface: window.navigator must inherit property "vendorSub" with the proper type (8) 
 PASS Navigator interface: window.navigator must inherit property "language" with the proper type (9) 
-FAIL Navigator interface: window.navigator must inherit property "languages" with the proper type (10) assert_inherits: property "languages" not found in prototype chain
+FAIL Navigator interface: window.navigator must inherit property "languages" with the proper type (10) Unrecognized type [object Object]
 PASS Navigator interface: window.navigator must inherit property "onLine" with the proper type (11) 
 FAIL Navigator interface: window.navigator must inherit property "registerProtocolHandler" with the proper type (12) assert_inherits: property "registerProtocolHandler" not found in prototype chain
 FAIL Navigator interface: calling registerProtocolHandler(DOMString,USVString,DOMString) on window.navigator with too few arguments must throw TypeError assert_inherits: property "registerProtocolHandler" not found in prototype chain

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/system-state-and-capabilities/the-navigator-object/navigatorlanguage-expected.txt (207020 => 207021)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/system-state-and-capabilities/the-navigator-object/navigatorlanguage-expected.txt	2016-10-10 20:59:48 UTC (rev 207020)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/system-state-and-capabilities/the-navigator-object/navigatorlanguage-expected.txt	2016-10-10 21:01:39 UTC (rev 207021)
@@ -1,3 +1,3 @@
 
-FAIL NavigatorLanguage: the most preferred language is the one returned by navigator.language assert_true: expected true got false
+PASS NavigatorLanguage: the most preferred language is the one returned by navigator.language 
 

Modified: trunk/LayoutTests/platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt (207020 => 207021)


--- trunk/LayoutTests/platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt	2016-10-10 20:59:48 UTC (rev 207020)
+++ trunk/LayoutTests/platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt	2016-10-10 21:01:39 UTC (rev 207021)
@@ -9,6 +9,7 @@
 navigator.hardwareConcurrency is OK
 navigator.javaEnabled() is OK
 navigator.language is OK
+navigator.languages is OK
 navigator.mimeTypes is OK
 navigator.onLine is OK
 navigator.platform is OK
@@ -27,6 +28,7 @@
 navigator.hardwareConcurrency is OK
 navigator.javaEnabled() is OK
 navigator.language is OK
+navigator.languages is OK
 navigator.mimeTypes is OK
 navigator.onLine is OK
 navigator.platform is OK

Modified: trunk/Source/WebCore/ChangeLog (207020 => 207021)


--- trunk/Source/WebCore/ChangeLog	2016-10-10 20:59:48 UTC (rev 207020)
+++ trunk/Source/WebCore/ChangeLog	2016-10-10 21:01:39 UTC (rev 207021)
@@ -1,3 +1,26 @@
+2016-10-10  Chris Dumez  <[email protected]>
+
+        Add support for Navigator.languages attribute
+        https://bugs.webkit.org/show_bug.cgi?id=163220
+
+        Reviewed by Darin Adler.
+
+        Add support for Navigator.languages attribute:
+        - https://html.spec.whatwg.org/#navigatorlanguage
+
+        Firefox and Chrome already support this.
+
+        Currently, we always return a single language for privacy reasons so
+        this API does not actually bring anything new besides interoperability
+        with other browsers and compliance with the HTML specification.
+
+        No new tests, rebaselined existing tests.
+
+        * page/NavigatorBase.cpp:
+        (WebCore::NavigatorBase::languages):
+        * page/NavigatorBase.h:
+        * page/NavigatorLanguage.idl:
+
 2016-10-10  Brent Fulgham  <[email protected]>
 
         [Win][Direct2D] Implement dashed and dotted border line drawing

Modified: trunk/Source/WebCore/page/NavigatorBase.cpp (207020 => 207021)


--- trunk/Source/WebCore/page/NavigatorBase.cpp	2016-10-10 20:59:48 UTC (rev 207020)
+++ trunk/Source/WebCore/page/NavigatorBase.cpp	2016-10-10 21:01:39 UTC (rev 207021)
@@ -139,6 +139,12 @@
     return defaultLanguage();
 }
 
+Vector<String> NavigatorBase::languages()
+{
+    // We intentionally expose only the primary language for privacy reasons.
+    return { defaultLanguage() };
+}
+
 #if ENABLE(NAVIGATOR_HWCONCURRENCY)
 
 int NavigatorBase::hardwareConcurrency()

Modified: trunk/Source/WebCore/page/NavigatorBase.h (207020 => 207021)


--- trunk/Source/WebCore/page/NavigatorBase.h	2016-10-10 20:59:48 UTC (rev 207020)
+++ trunk/Source/WebCore/page/NavigatorBase.h	2016-10-10 21:01:39 UTC (rev 207021)
@@ -27,6 +27,7 @@
 #define NavigatorBase_h
 
 #include <wtf/Forward.h>
+#include <wtf/Vector.h>
 
 namespace WebCore {
 
@@ -46,6 +47,7 @@
     static bool onLine();
 
     static String language();
+    static Vector<String> languages();
 
 #if ENABLE(NAVIGATOR_HWCONCURRENCY)
     static int hardwareConcurrency();

Modified: trunk/Source/WebCore/page/NavigatorLanguage.idl (207020 => 207021)


--- trunk/Source/WebCore/page/NavigatorLanguage.idl	2016-10-10 20:59:48 UTC (rev 207020)
+++ trunk/Source/WebCore/page/NavigatorLanguage.idl	2016-10-10 21:01:39 UTC (rev 207021)
@@ -30,5 +30,5 @@
     NoInterfaceObject
 ] interface NavigatorLanguage {
     [Nondeterministic]  readonly attribute DOMString language;
-    // readonly attribute FrozenArray<DOMString> languages;
+    readonly attribute FrozenArray<DOMString> languages;
 };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to