Changeset 265001 in webkit


Ignore:
Timestamp:
Jul 28, 2020 1:03:10 PM (4 years ago)
Author:
commit-queue@webkit.org
Message:

PerformanceObserver should work with 'type' and not just entryTypes
https://bugs.webkit.org/show_bug.cgi?id=209216

Patch by Rob Buis <rbuis@igalia.com> on 2020-07-28
Reviewed by Youenn Fablet.

LayoutTests/imported/w3c:

Add po-observe-type.any.html and po-observe-type.any.worker.html tests and
update improved test expectations.

  • web-platform-tests/performance-timeline/performanceobservers.js: Added.

(findMatch):
(checkEntries):
(wait):
(checkSorted):

  • web-platform-tests/performance-timeline/po-observe-type.any-expected.txt: Added.
  • web-platform-tests/performance-timeline/po-observe-type.any.html: Added.
  • web-platform-tests/performance-timeline/po-observe-type.any.js: Added.

(test):
(async_test):

  • web-platform-tests/performance-timeline/po-observe-type.any.worker-expected.txt: Added.
  • web-platform-tests/performance-timeline/po-observe-type.any.worker.html: Added.
  • web-platform-tests/resource-timing/buffered-flag.any-expected.txt:
  • web-platform-tests/resource-timing/buffered-flag.any.worker-expected.txt:
  • web-platform-tests/resource-timing/object-not-found-adds-entry-expected.txt:
  • web-platform-tests/user-timing/buffered-flag.any-expected.txt:
  • web-platform-tests/user-timing/buffered-flag.any.worker-expected.txt:

Source/WebCore:

Add support for 'type' attribute as specified here [1].

Tests: imported/w3c/web-platform-tests/performance-timeline/po-observe-type.any.html

imported/w3c/web-platform-tests/performance-timeline/po-observe-type.any.worker.html

[1] https://w3c.github.io/performance-timeline/#dom-performanceobserverinit

  • page/PerformanceObserver.cpp:

(WebCore::PerformanceObserver::observe):

  • page/PerformanceObserver.h:
  • page/PerformanceObserver.idl:

LayoutTests:

Adjust test to be aligned with the specification and skip
tests that time out.

  • TestExpectations:
  • performance-api/performance-observer-api-expected.txt:
  • performance-api/resources/observer-api.js:
Location:
trunk
Files:
6 added
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r264998 r265001  
     12020-07-28  Rob Buis  <rbuis@igalia.com>
     2
     3        PerformanceObserver should work with 'type' and not just `entryTypes`
     4        https://bugs.webkit.org/show_bug.cgi?id=209216
     5
     6        Reviewed by Youenn Fablet.
     7
     8        Adjust test to be aligned with the specification and skip
     9        tests that time out.
     10
     11        * TestExpectations:
     12        * performance-api/performance-observer-api-expected.txt:
     13        * performance-api/resources/observer-api.js:
     14
    1152020-07-28  Karl Rackler  <rackler@apple.com>
    216
  • trunk/LayoutTests/TestExpectations

    r264997 r265001  
    48824882# WebKit2 only.
    48834883js/throw-large-string-oom.html [ Skip ]
     4884
     4885webkit.org/b/214884 imported/w3c/web-platform-tests/performance-timeline/po-observe-type.any.html [ Skip ]
     4886webkit.org/b/214884 imported/w3c/web-platform-tests/performance-timeline/po-observe-type.any.worker.html [ Skip ]
     4887webkit.org/b/214883 imported/w3c/web-platform-tests/resource-timing/buffered-flag.any.html [ Skip ]
     4888webkit.org/b/214883 imported/w3c/web-platform-tests/resource-timing/buffered-flag.any.worker.html [ Skip ]
     4889webkit.org/b/214883 imported/w3c/web-platform-tests/user-timing/buffered-flag.any.html [ Skip ]
     4890webkit.org/b/214883 imported/w3c/web-platform-tests/user-timing/buffered-flag.any.worker.html [ Skip ]
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r264948 r265001  
     12020-07-28  Rob Buis  <rbuis@igalia.com>
     2
     3        PerformanceObserver should work with 'type' and not just `entryTypes`
     4        https://bugs.webkit.org/show_bug.cgi?id=209216
     5
     6        Reviewed by Youenn Fablet.
     7
     8        Add po-observe-type.any.html and po-observe-type.any.worker.html tests and
     9        update improved test expectations.
     10
     11        * web-platform-tests/performance-timeline/performanceobservers.js: Added.
     12        (findMatch):
     13        (checkEntries):
     14        (wait):
     15        (checkSorted):
     16        * web-platform-tests/performance-timeline/po-observe-type.any-expected.txt: Added.
     17        * web-platform-tests/performance-timeline/po-observe-type.any.html: Added.
     18        * web-platform-tests/performance-timeline/po-observe-type.any.js: Added.
     19        (test):
     20        (async_test):
     21        * web-platform-tests/performance-timeline/po-observe-type.any.worker-expected.txt: Added.
     22        * web-platform-tests/performance-timeline/po-observe-type.any.worker.html: Added.
     23        * web-platform-tests/resource-timing/buffered-flag.any-expected.txt:
     24        * web-platform-tests/resource-timing/buffered-flag.any.worker-expected.txt:
     25        * web-platform-tests/resource-timing/object-not-found-adds-entry-expected.txt:
     26        * web-platform-tests/user-timing/buffered-flag.any-expected.txt:
     27        * web-platform-tests/user-timing/buffered-flag.any.worker-expected.txt:
     28
    1292020-07-27  Chris Dumez  <cdumez@apple.com>
    230
  • trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffered-flag.any-expected.txt

    r264458 r265001  
    1 CONSOLE MESSAGE: TypeError: Member PerformanceObserverInit.entryTypes is required and must be an instance of sequence
    21
    3 Harness Error (FAIL), message = TypeError: Member PerformanceObserverInit.entryTypes is required and must be an instance of sequence
     2Harness Error (TIMEOUT), message = null
    43
    54TIMEOUT PerformanceObserver with buffered flag sees previous resource entries. Test timed out
    65
    7 Harness Error (FAIL), message = TypeError: Member PerformanceObserverInit.entryTypes is required and must be an instance of sequence
    8 
    9 TIMEOUT PerformanceObserver with buffered flag sees previous resource entries. Test timed out
    10 
  • trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffered-flag.any.worker-expected.txt

    r264458 r265001  
    11
    2 Harness Error (FAIL), message = Error in remote http://localhost:8800/resource-timing/buffered-flag.any.js: TypeError: Member PerformanceObserverInit.entryTypes is required and must be an instance of sequence
     2Harness Error (TIMEOUT), message = null
    33
    44TIMEOUT PerformanceObserver with buffered flag sees previous resource entries. Test timed out
  • trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/object-not-found-adds-entry-expected.txt

    r264458 r265001  
     1 
    12
    2 FAIL Test that an navigation object with a 404 response displays an entry promise_test: Unhandled rejection with value: object "TypeError: Member PerformanceObserverInit.entryTypes is required and must be an instance of sequence"
    3 FAIL Test that an navigation object with a 200 response displays an entry promise_test: Unhandled rejection with value: object "TypeError: Member PerformanceObserverInit.entryTypes is required and must be an instance of sequence"
    4 FAIL Test that an image object with a 404 response displays an entry promise_test: Unhandled rejection with value: object "TypeError: Member PerformanceObserverInit.entryTypes is required and must be an instance of sequence"
     3FAIL Test that an navigation object with a 404 response displays an entry assert_unreached: No performance entry was observed Reached unreachable code
     4FAIL Test that an navigation object with a 200 response displays an entry assert_unreached: No performance entry was observed Reached unreachable code
     5PASS Test that an image object with a 404 response displays an entry
    56
  • trunk/LayoutTests/imported/w3c/web-platform-tests/user-timing/buffered-flag.any-expected.txt

    r264255 r265001  
    1 CONSOLE MESSAGE: TypeError: Member PerformanceObserverInit.entryTypes is required and must be an instance of sequence
    2 CONSOLE MESSAGE: TypeError: Member PerformanceObserverInit.entryTypes is required and must be an instance of sequence
    31
    4 Harness Error (FAIL), message = TypeError: Member PerformanceObserverInit.entryTypes is required and must be an instance of sequence
     2Harness Error (TIMEOUT), message = null
    53
    64TIMEOUT PerformanceObserver with buffered flag sees previous marks Test timed out
    75TIMEOUT PerformanceObserver with buffered flag sees previous measures Test timed out
    86
    9 Harness Error (FAIL), message = TypeError: Member PerformanceObserverInit.entryTypes is required and must be an instance of sequence
    10 
    11 TIMEOUT PerformanceObserver with buffered flag sees previous marks Test timed out
    12 TIMEOUT PerformanceObserver with buffered flag sees previous measures Test timed out
    13 
  • trunk/LayoutTests/imported/w3c/web-platform-tests/user-timing/buffered-flag.any.worker-expected.txt

    r264255 r265001  
    11
    2 Harness Error (FAIL), message = Error in remote http://localhost:8800/user-timing/buffered-flag.any.js: TypeError: Member PerformanceObserverInit.entryTypes is required and must be an instance of sequence
     2Harness Error (TIMEOUT), message = null
    33
    44TIMEOUT PerformanceObserver with buffered flag sees previous marks Test timed out
  • trunk/LayoutTests/performance-api/performance-observer-api-expected.txt

    r211594 r265001  
    1414PASS observer.observe() threw exception TypeError: Not enough arguments.
    1515PASS observer.observe("mark") threw exception TypeError: Type error.
    16 PASS observer.observe({}) threw exception TypeError: Member PerformanceObserverInit.entryTypes is required and must be an instance of sequence.
     16PASS observer.observe({}) threw exception TypeError: no type or entryTypes were provided.
    1717PASS observer.observe({entryTypes:"mark"}) threw exception TypeError: Value is not a sequence.
    18 PASS observer.observe({entryTypes:[]}) threw exception TypeError: entryTypes cannot be an empty list.
    19 PASS observer.observe({entryTypes:["not-real"]}) threw exception TypeError: entryTypes contained only unsupported types.
     18PASS observer.observe({entryTypes:[]}) did not throw exception.
     19PASS observer.observe({entryTypes:["not-real"]}) did not throw exception.
    2020PASS observer.observe({entryTypes:["mark"]}) did not throw exception.
    2121PASS observer.observe({entryTypes:["mark", "not-real"]}) did not throw exception.
     
    4242PASS [Worker] observer.observe() threw exception TypeError: Not enough arguments.
    4343PASS [Worker] observer.observe("mark") threw exception TypeError: Type error.
    44 PASS [Worker] observer.observe({}) threw exception TypeError: Member PerformanceObserverInit.entryTypes is required and must be an instance of sequence.
     44PASS [Worker] observer.observe({}) threw exception TypeError: no type or entryTypes were provided.
    4545PASS [Worker] observer.observe({entryTypes:"mark"}) threw exception TypeError: Value is not a sequence.
    46 PASS [Worker] observer.observe({entryTypes:[]}) threw exception TypeError: entryTypes cannot be an empty list.
    47 PASS [Worker] observer.observe({entryTypes:["not-real"]}) threw exception TypeError: entryTypes contained only unsupported types.
     46PASS [Worker] observer.observe({entryTypes:[]}) did not throw exception.
     47PASS [Worker] observer.observe({entryTypes:["not-real"]}) did not throw exception.
    4848PASS [Worker] observer.observe({entryTypes:["mark"]}) did not throw exception.
    4949PASS [Worker] observer.observe({entryTypes:["mark", "not-real"]}) did not throw exception.
  • trunk/LayoutTests/performance-api/resources/observer-api.js

    r211594 r265001  
    1717shouldThrow(`observer.observe({})`);
    1818shouldThrow(`observer.observe({entryTypes:"mark"})`);
    19 shouldThrow(`observer.observe({entryTypes:[]})`);
    20 shouldThrow(`observer.observe({entryTypes:["not-real"]})`);
     19shouldNotThrow(`observer.observe({entryTypes:[]})`);
     20shouldNotThrow(`observer.observe({entryTypes:["not-real"]})`);
    2121shouldNotThrow(`observer.observe({entryTypes:["mark"]})`);
    2222shouldNotThrow(`observer.observe({entryTypes:["mark", "not-real"]})`);
  • trunk/Source/WebCore/ChangeLog

    r264993 r265001  
     12020-07-28  Rob Buis  <rbuis@igalia.com>
     2
     3        PerformanceObserver should work with 'type' and not just `entryTypes`
     4        https://bugs.webkit.org/show_bug.cgi?id=209216
     5
     6        Reviewed by Youenn Fablet.
     7
     8        Add support for 'type' attribute as specified here [1].
     9
     10        Tests: imported/w3c/web-platform-tests/performance-timeline/po-observe-type.any.html
     11               imported/w3c/web-platform-tests/performance-timeline/po-observe-type.any.worker.html
     12
     13        [1] https://w3c.github.io/performance-timeline/#dom-performanceobserverinit
     14
     15        * page/PerformanceObserver.cpp:
     16        (WebCore::PerformanceObserver::observe):
     17        * page/PerformanceObserver.h:
     18        * page/PerformanceObserver.idl:
     19
    1202020-07-28  Karl Rackler  <rackler@apple.com>
    221
  • trunk/Source/WebCore/page/PerformanceObserver.cpp

    r260851 r265001  
    6161        return Exception { TypeError };
    6262
    63     if (init.entryTypes.isEmpty())
    64         return Exception { TypeError, "entryTypes cannot be an empty list"_s };
    65 
    6663    OptionSet<PerformanceEntry::Type> filter;
    67     for (const String& entryType : init.entryTypes) {
    68         if (auto type = PerformanceEntry::parseEntryTypeString(entryType))
     64    if (init.entryTypes) {
     65        if (init.type)
     66            return Exception { TypeError, "either entryTypes or type must be provided"_s };
     67        for (auto& entryType : *init.entryTypes) {
     68            if (auto type = PerformanceEntry::parseEntryTypeString(entryType))
     69                filter.add(*type);
     70        }
     71        if (filter.isEmpty())
     72            return { };
     73    } else {
     74        if (!init.type)
     75            return Exception { TypeError, "no type or entryTypes were provided"_s };
     76        if (auto type = PerformanceEntry::parseEntryTypeString(*init.type))
    6977            filter.add(*type);
     78        else
     79            return { };
    7080    }
    71 
    72     if (filter.isEmpty())
    73         return Exception { TypeError, "entryTypes contained only unsupported types"_s };
    7481
    7582    m_typeFilter = filter;
  • trunk/Source/WebCore/page/PerformanceObserver.h

    r260851 r265001  
    4242public:
    4343    struct Init {
    44         Vector<String> entryTypes;
     44        Optional<Vector<String>> entryTypes;
     45        Optional<String> type;
    4546    };
    4647
  • trunk/Source/WebCore/page/PerformanceObserver.idl

    r263160 r265001  
    4141
    4242dictionary PerformanceObserverInit {
    43     required sequence<DOMString> entryTypes;
     43    sequence<DOMString> entryTypes;
     44    DOMString type;
    4445};
Note: See TracChangeset for help on using the changeset viewer.