Changeset 207021 in webkit


Ignore:
Timestamp:
Oct 10, 2016 2:01:39 PM (8 years ago)
Author:
Chris Dumez
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:

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:
Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r207016 r207021  
     12016-10-10  Chris Dumez  <cdumez@apple.com>
     2
     3        Add support for Navigator.languages attribute
     4        https://bugs.webkit.org/show_bug.cgi?id=163220
     5
     6        Reviewed by Darin Adler.
     7
     8        Rebase existing test to reflect change.
     9
     10        * fast/dom/navigator-detached-no-crash-expected.txt:
     11        * platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt:
     12
    1132016-10-10  Chris Dumez  <cdumez@apple.com>
    214
  • trunk/LayoutTests/fast/dom/navigator-detached-no-crash-expected.txt

    r169017 r207021  
    99navigator.javaEnabled() is OK
    1010navigator.language is OK
     11navigator.languages is OK
    1112navigator.mimeTypes is OK
    1213navigator.onLine is OK
     
    2627navigator.javaEnabled() is OK
    2728navigator.language is OK
     29navigator.languages is OK
    2830navigator.mimeTypes is OK
    2931navigator.onLine is OK
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r206999 r207021  
     12016-10-10  Chris Dumez  <cdumez@apple.com>
     2
     3        Add support for Navigator.languages attribute
     4        https://bugs.webkit.org/show_bug.cgi?id=163220
     5
     6        Reviewed by Darin Adler.
     7
     8        Rebaseline W3C tests now that more checks are passing.
     9
     10        * web-platform-tests/html/dom/interfaces-expected.txt:
     11        * web-platform-tests/html/webappapis/system-state-and-capabilities/the-navigator-object/navigatorlanguage-expected.txt:
     12
    1132016-10-10  Youenn Fablet  <youennf@gmail.com>
    214
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt

    r206634 r207021  
    53835383PASS Navigator interface: attribute vendorSub
    53845384PASS Navigator interface: attribute language
    5385 FAIL Navigator interface: attribute languages assert_true: The prototype object must have a property "languages" expected true got false
     5385PASS Navigator interface: attribute languages
    53865386PASS Navigator interface: attribute onLine
    53875387FAIL Navigator interface: operation registerProtocolHandler(DOMString,USVString,DOMString) assert_own_property: interface prototype object missing non-static operation expected property "registerProtocolHandler" missing
     
    54085408PASS Navigator interface: window.navigator must inherit property "vendorSub" with the proper type (8)
    54095409PASS Navigator interface: window.navigator must inherit property "language" with the proper type (9)
    5410 FAIL Navigator interface: window.navigator must inherit property "languages" with the proper type (10) assert_inherits: property "languages" not found in prototype chain
     5410FAIL Navigator interface: window.navigator must inherit property "languages" with the proper type (10) Unrecognized type [object Object]
    54115411PASS Navigator interface: window.navigator must inherit property "onLine" with the proper type (11)
    54125412FAIL Navigator interface: window.navigator must inherit property "registerProtocolHandler" with the proper type (12) assert_inherits: property "registerProtocolHandler" not found in prototype chain
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/system-state-and-capabilities/the-navigator-object/navigatorlanguage-expected.txt

    r206874 r207021  
    11
    2 FAIL NavigatorLanguage: the most preferred language is the one returned by navigator.language assert_true: expected true got false
     2PASS NavigatorLanguage: the most preferred language is the one returned by navigator.language
    33
  • trunk/LayoutTests/platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt

    r204853 r207021  
    1010navigator.javaEnabled() is OK
    1111navigator.language is OK
     12navigator.languages is OK
    1213navigator.mimeTypes is OK
    1314navigator.onLine is OK
     
    2829navigator.javaEnabled() is OK
    2930navigator.language is OK
     31navigator.languages is OK
    3032navigator.mimeTypes is OK
    3133navigator.onLine is OK
  • trunk/Source/WebCore/ChangeLog

    r207020 r207021  
     12016-10-10  Chris Dumez  <cdumez@apple.com>
     2
     3        Add support for Navigator.languages attribute
     4        https://bugs.webkit.org/show_bug.cgi?id=163220
     5
     6        Reviewed by Darin Adler.
     7
     8        Add support for Navigator.languages attribute:
     9        - https://html.spec.whatwg.org/#navigatorlanguage
     10
     11        Firefox and Chrome already support this.
     12
     13        Currently, we always return a single language for privacy reasons so
     14        this API does not actually bring anything new besides interoperability
     15        with other browsers and compliance with the HTML specification.
     16
     17        No new tests, rebaselined existing tests.
     18
     19        * page/NavigatorBase.cpp:
     20        (WebCore::NavigatorBase::languages):
     21        * page/NavigatorBase.h:
     22        * page/NavigatorLanguage.idl:
     23
    1242016-10-10  Brent Fulgham  <bfulgham@apple.com>
    225
  • trunk/Source/WebCore/page/NavigatorBase.cpp

    r201970 r207021  
    140140}
    141141
     142Vector<String> NavigatorBase::languages()
     143{
     144    // We intentionally expose only the primary language for privacy reasons.
     145    return { defaultLanguage() };
     146}
     147
    142148#if ENABLE(NAVIGATOR_HWCONCURRENCY)
    143149
  • trunk/Source/WebCore/page/NavigatorBase.h

    r201970 r207021  
    2828
    2929#include <wtf/Forward.h>
     30#include <wtf/Vector.h>
    3031
    3132namespace WebCore {
     
    4748
    4849    static String language();
     50    static Vector<String> languages();
    4951
    5052#if ENABLE(NAVIGATOR_HWCONCURRENCY)
  • trunk/Source/WebCore/page/NavigatorLanguage.idl

    r201970 r207021  
    3131] interface NavigatorLanguage {
    3232    [Nondeterministic]  readonly attribute DOMString language;
    33     // readonly attribute FrozenArray<DOMString> languages;
     33    readonly attribute FrozenArray<DOMString> languages;
    3434};
Note: See TracChangeset for help on using the changeset viewer.