Changeset 212193 in webkit


Ignore:
Timestamp:
Feb 11, 2017 7:14:47 AM (7 years ago)
Author:
Chris Dumez
Message:

Implement URL's toJSON()
https://bugs.webkit.org/show_bug.cgi?id=167979

Reviewed by Sam Weinig.

LayoutTests/imported/w3c:

Re-sync URL tests from upstream to gain test coverage for
URL's toJSON().

  • web-platform-tests/url/interfaces-expected.txt:
  • web-platform-tests/url/interfaces.html:
  • web-platform-tests/url/url-tojson-expected.txt: Added.
  • web-platform-tests/url/url-tojson.html: Added.
  • web-platform-tests/url/w3c-import.log:

Source/WebCore:

Implement URL's toJSON() as per:

This is already supported by Firefox.

Also, drop URLUtils.idl as it is no longer in the specification.
Merge its content to DOMURL.idl as per the URL specification.

Finally, mark href attribute as stringifier and drop the toString()
operation to match the specification. This fixes a bug where our
toString property was not enumerable but should have been.

Tests: fast/url/url-tojson.html

imported/w3c/web-platform-tests/url/url-tojson.html

  • CMakeLists.txt:
  • DerivedSources.make:
  • WebCore.xcodeproj/project.pbxproj:
  • html/DOMURL.idl:
  • html/URLUtils.h:

(WebCore::URLUtils<T>::toJSON):

  • html/URLUtils.idl: Removed.

LayoutTests:

Extend test coverage.

  • fast/url/url-tojson-expected.txt: Added.
  • fast/url/url-tojson.html: Added.
Location:
trunk
Files:
4 added
1 deleted
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r212191 r212193  
     12017-02-11  Chris Dumez  <cdumez@apple.com>
     2
     3        Implement URL's toJSON()
     4        https://bugs.webkit.org/show_bug.cgi?id=167979
     5
     6        Reviewed by Sam Weinig.
     7
     8        Extend test coverage.
     9
     10        * fast/url/url-tojson-expected.txt: Added.
     11        * fast/url/url-tojson.html: Added.
     12
    1132017-02-11  Carlos Garcia Campos  <cgarcia@igalia.com>
    214
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r212181 r212193  
     12017-02-11  Chris Dumez  <cdumez@apple.com>
     2
     3        Implement URL's toJSON()
     4        https://bugs.webkit.org/show_bug.cgi?id=167979
     5
     6        Reviewed by Sam Weinig.
     7
     8        Re-sync URL tests from upstream to gain test coverage for
     9        URL's toJSON().
     10
     11        * web-platform-tests/url/interfaces-expected.txt:
     12        * web-platform-tests/url/interfaces.html:
     13        * web-platform-tests/url/url-tojson-expected.txt: Added.
     14        * web-platform-tests/url/url-tojson.html: Added.
     15        * web-platform-tests/url/w3c-import.log:
     16
    1172017-02-10  Sam Weinig  <sam@webkit.org>
    218
  • trunk/LayoutTests/imported/w3c/web-platform-tests/url/interfaces-expected.txt

    r211930 r212193  
    88PASS URL interface: existence and properties of interface prototype object's "constructor" property
    99PASS URL interface: attribute href
    10 FAIL URL interface: stringifier assert_true: property is not enumerable expected true got false
     10PASS URL interface: stringifier
    1111PASS URL interface: attribute origin
    1212PASS URL interface: attribute protocol
     
    2020PASS URL interface: attribute searchParams
    2121PASS URL interface: attribute hash
     22PASS URL interface: operation toJSON()
    2223PASS URL must be primary interface of new URL("http://foo")
    2324PASS Stringification of new URL("http://foo")
     
    3435PASS URL interface: new URL("http://foo") must inherit property "searchParams" with the proper type (10)
    3536PASS URL interface: new URL("http://foo") must inherit property "hash" with the proper type (11)
     37PASS URL interface: new URL("http://foo") must inherit property "toJSON" with the proper type (12)
    3638PASS URLSearchParams interface: existence and properties of interface object
    3739PASS URLSearchParams interface object length
  • trunk/LayoutTests/imported/w3c/web-platform-tests/url/interfaces.html

    r209861 r212193  
    2525  readonly attribute URLSearchParams searchParams;
    2626           attribute USVString hash;
     27
     28  USVString toJSON();
    2729};
    2830
  • trunk/LayoutTests/imported/w3c/web-platform-tests/url/w3c-import.log

    r209861 r212193  
    3131/LayoutTests/imported/w3c/web-platform-tests/url/url-origin.html
    3232/LayoutTests/imported/w3c/web-platform-tests/url/url-setters.html
     33/LayoutTests/imported/w3c/web-platform-tests/url/url-tojson.html
    3334/LayoutTests/imported/w3c/web-platform-tests/url/urlsearchparams-append.html
    3435/LayoutTests/imported/w3c/web-platform-tests/url/urlsearchparams-constructor.html
  • trunk/Source/WebCore/CMakeLists.txt

    r211962 r212193  
    565565    html/TimeRanges.idl
    566566    html/URLSearchParams.idl
    567     html/URLUtils.idl
    568567    html/ValidityState.idl
    569568    html/VoidCallback.idl
  • trunk/Source/WebCore/ChangeLog

    r212192 r212193  
     12017-02-11  Chris Dumez  <cdumez@apple.com>
     2
     3        Implement URL's toJSON()
     4        https://bugs.webkit.org/show_bug.cgi?id=167979
     5
     6        Reviewed by Sam Weinig.
     7
     8        Implement URL's toJSON() as per:
     9        - https://url.spec.whatwg.org/#dom-url-tojson
     10
     11        This is already supported by Firefox.
     12
     13        Also, drop URLUtils.idl as it is no longer in the specification.
     14        Merge its content to DOMURL.idl as per the URL specification.
     15
     16        Finally, mark href attribute as stringifier and drop the toString()
     17        operation to match the specification. This fixes a bug where our
     18        toString property was not enumerable but should have been.
     19
     20        Tests: fast/url/url-tojson.html
     21               imported/w3c/web-platform-tests/url/url-tojson.html
     22
     23        * CMakeLists.txt:
     24        * DerivedSources.make:
     25        * WebCore.xcodeproj/project.pbxproj:
     26        * html/DOMURL.idl:
     27        * html/URLUtils.h:
     28        (WebCore::URLUtils<T>::toJSON):
     29        * html/URLUtils.idl: Removed.
     30
    1312017-02-11  Carlos Garcia Campos  <cgarcia@igalia.com>
    232
  • trunk/Source/WebCore/DerivedSources.cpp

    r211962 r212193  
    616616#include "JSUIEvent.cpp"
    617617#include "JSUIEventInit.cpp"
    618 #include "JSURLUtils.cpp"
    619618#if ENABLE(USER_MESSAGE_HANDLERS)
    620619#include "JSUserMessageHandler.cpp"
  • trunk/Source/WebCore/DerivedSources.make

    r211962 r212193  
    496496    $(WebCore)/html/TimeRanges.idl \
    497497    $(WebCore)/html/URLSearchParams.idl \
    498     $(WebCore)/html/URLUtils.idl \
    499498    $(WebCore)/html/ValidityState.idl \
    500499    $(WebCore)/html/VoidCallback.idl \
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r212144 r212193  
    98139813                5C4304B3191AEF46000E2BC0 /* JSEXTShaderTextureLOD.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSEXTShaderTextureLOD.cpp; sourceTree = "<group>"; };
    98149814                5C4304B4191AEF46000E2BC0 /* JSEXTShaderTextureLOD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSEXTShaderTextureLOD.h; sourceTree = "<group>"; };
    9815                 5C5381AE1D8791CA00E2EBE6 /* URLUtils.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = URLUtils.idl; sourceTree = "<group>"; };
    98169815                5C5381AF1D8793E000E2EBE6 /* URLSearchParams.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = URLSearchParams.idl; sourceTree = "<group>"; };
    98179816                5C5381B01D87D45700E2EBE6 /* URLSearchParams.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLSearchParams.cpp; sourceTree = "<group>"; };
     
    1952019519                                5C5381AF1D8793E000E2EBE6 /* URLSearchParams.idl */,
    1952119520                                656B9DCA189DE10000BB842C /* URLUtils.h */,
    19522                                 5C5381AE1D8791CA00E2EBE6 /* URLUtils.idl */,
    1952319521                                F5A154251279534D00D0B0C0 /* ValidationMessage.cpp */,
    1952419522                                F5A154261279534D00D0B0C0 /* ValidationMessage.h */,
  • trunk/Source/WebCore/html/DOMURL.idl

    r208096 r212193  
    3737    ExportMacro=WEBCORE_EXPORT,
    3838] interface DOMURL {
     39    [SetterMayThrowException, URL] stringifier attribute USVString href;
     40    readonly attribute USVString origin;
     41    attribute USVString protocol;
     42    attribute USVString username;
     43    attribute USVString password;
     44    attribute USVString host;
     45    attribute USVString hostname;
     46    attribute USVString port;
     47    attribute USVString pathname;
     48    attribute USVString hash;
     49    attribute USVString search;
     50    [CachedAttribute] readonly attribute URLSearchParams searchParams;
     51
     52    USVString toJSON();
     53
     54    // https://w3c.github.io/FileAPI/#creating-revoking.
    3955    [CallWith=ScriptExecutionContext] static DOMString createObjectURL(Blob blob);
    4056    [CallWith=ScriptExecutionContext] static void revokeObjectURL(DOMString url);
    4157};
    42 
    43 DOMURL implements URLUtils;
  • trunk/Source/WebCore/html/URLUtils.h

    r211636 r212193  
    3737
    3838    String toString() const;
     39    String toJSON() const;
    3940
    4041    String origin() const;
     
    7071template <typename T>
    7172String URLUtils<T>::toString() const
     73{
     74    return href().string();
     75}
     76
     77template <typename T>
     78String URLUtils<T>::toJSON() const
    7279{
    7380    return href().string();
Note: See TracChangeset for help on using the changeset viewer.