From 782f06b1ec44043f858b8ad1f76225919ecd55db Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 25 Feb 2025 08:50:36 +0100 Subject: [PATCH] chore: update WPT (#4062) Co-authored-by: Uzlopak <5059100+Uzlopak@users.noreply.github.com> --- .../command-and-commandfor.tentative.idl | 15 -- test/fixtures/wpt/interfaces/fedcm.idl | 2 +- .../wpt/interfaces/gamepad-extensions.idl | 9 - test/fixtures/wpt/interfaces/gamepad.idl | 8 + test/fixtures/wpt/interfaces/html.idl | 21 ++- .../wpt/interfaces/media-capabilities.idl | 2 +- .../mediacapture-surface-control.idl | 2 +- test/fixtures/wpt/interfaces/ppa.idl | 66 +++++++ .../fixtures/wpt/interfaces/sanitizer-api.idl | 2 +- .../interfaces/sanitizer-api.tentative.idl | 66 +++++-- test/fixtures/wpt/interfaces/speech-api.idl | 4 +- test/fixtures/wpt/interfaces/webnn.idl | 7 - test/fixtures/wpt/resources/testdriver.js | 164 ++++++++++++++++++ .../service-worker/resources/router-rules.js | 31 ++++ .../static-router-invalid-rules.https.html | 29 ++++ 15 files changed, 377 insertions(+), 51 deletions(-) delete mode 100644 test/fixtures/wpt/interfaces/command-and-commandfor.tentative.idl create mode 100644 test/fixtures/wpt/interfaces/ppa.idl diff --git a/test/fixtures/wpt/interfaces/command-and-commandfor.tentative.idl b/test/fixtures/wpt/interfaces/command-and-commandfor.tentative.idl deleted file mode 100644 index 046a365939c..00000000000 --- a/test/fixtures/wpt/interfaces/command-and-commandfor.tentative.idl +++ /dev/null @@ -1,15 +0,0 @@ -interface mixin CommandElement { - [CEReactions,Reflect=commandfor] attribute Element? commandForElement; - [CEReactions,Reflect=command] attribute DOMString command; -}; - -interface CommandEvent : Event { - constructor(DOMString type, optional CommandEventInit eventInitDict = {}); - readonly attribute Element? source; - readonly attribute DOMString command; -}; - -dictionary CommandEventInit : EventInit { - Element? source = null; - DOMString command = ""; -}; diff --git a/test/fixtures/wpt/interfaces/fedcm.idl b/test/fixtures/wpt/interfaces/fedcm.idl index 07f7955ff64..f7038a6fee1 100644 --- a/test/fixtures/wpt/interfaces/fedcm.idl +++ b/test/fixtures/wpt/interfaces/fedcm.idl @@ -9,7 +9,7 @@ dictionary IdentityCredentialDisconnectOptions : IdentityProviderConfig { [Exposed=Window, SecureContext] interface IdentityCredential : Credential { - static Promise disconnect(optional IdentityCredentialDisconnectOptions options = {}); + static Promise disconnect(IdentityCredentialDisconnectOptions options); readonly attribute USVString? token; readonly attribute boolean isAutoSelected; }; diff --git a/test/fixtures/wpt/interfaces/gamepad-extensions.idl b/test/fixtures/wpt/interfaces/gamepad-extensions.idl index 81776a46ec9..330267d93b8 100644 --- a/test/fixtures/wpt/interfaces/gamepad-extensions.idl +++ b/test/fixtures/wpt/interfaces/gamepad-extensions.idl @@ -22,19 +22,10 @@ interface GamepadPose { readonly attribute Float32Array? angularAcceleration; }; -[Exposed=Window, SecureContext] -interface GamepadTouch { - readonly attribute unsigned long touchId; - readonly attribute octet surfaceId; - readonly attribute Float32Array position; - readonly attribute Uint32Array? surfaceDimensions; -}; - partial interface Gamepad { readonly attribute GamepadHand hand; readonly attribute FrozenArray hapticActuators; readonly attribute GamepadPose? pose; - readonly attribute FrozenArray? touchEvents; }; [Exposed=Window] diff --git a/test/fixtures/wpt/interfaces/gamepad.idl b/test/fixtures/wpt/interfaces/gamepad.idl index d922d7b80b0..200947968e3 100644 --- a/test/fixtures/wpt/interfaces/gamepad.idl +++ b/test/fixtures/wpt/interfaces/gamepad.idl @@ -12,6 +12,7 @@ interface Gamepad { readonly attribute GamepadMappingType mapping; readonly attribute FrozenArray axes; readonly attribute FrozenArray buttons; + readonly attribute FrozenArray touches; [SameObject] readonly attribute GamepadHapticActuator vibrationActuator; }; @@ -22,6 +23,13 @@ interface GamepadButton { readonly attribute double value; }; +dictionary GamepadTouch { + unsigned long touchId; + octet surfaceId; + DOMPointReadOnly position; + DOMRectReadOnly? surfaceDimensions; +}; + enum GamepadMappingType { "", "standard", diff --git a/test/fixtures/wpt/interfaces/html.idl b/test/fixtures/wpt/interfaces/html.idl index f10bb72e913..f48fd370281 100644 --- a/test/fixtures/wpt/interfaces/html.idl +++ b/test/fixtures/wpt/interfaces/html.idl @@ -957,6 +957,8 @@ HTMLInputElement includes PopoverInvokerElement; interface HTMLButtonElement : HTMLElement { [HTMLConstructor] constructor(); + [CEReactions] attribute DOMString command; + [CEReactions] attribute Element? commandForElement; [CEReactions] attribute boolean disabled; readonly attribute HTMLFormElement? form; [CEReactions] attribute USVString formAction; @@ -1450,10 +1452,10 @@ interface mixin CanvasDrawImage { interface mixin CanvasImageData { // pixel manipulation ImageData createImageData([EnforceRange] long sw, [EnforceRange] long sh, optional ImageDataSettings settings = {}); - ImageData createImageData(ImageData imagedata); + ImageData createImageData(ImageData imageData); ImageData getImageData([EnforceRange] long sx, [EnforceRange] long sy, [EnforceRange] long sw, [EnforceRange] long sh, optional ImageDataSettings settings = {}); - undefined putImageData(ImageData imagedata, [EnforceRange] long dx, [EnforceRange] long dy); - undefined putImageData(ImageData imagedata, [EnforceRange] long dx, [EnforceRange] long dy, [EnforceRange] long dirtyX, [EnforceRange] long dirtyY, [EnforceRange] long dirtyWidth, [EnforceRange] long dirtyHeight); + undefined putImageData(ImageData imageData, [EnforceRange] long dx, [EnforceRange] long dy); + undefined putImageData(ImageData imageData, [EnforceRange] long dx, [EnforceRange] long dy, [EnforceRange] long dirtyX, [EnforceRange] long dirtyY, [EnforceRange] long dirtyWidth, [EnforceRange] long dirtyHeight); }; enum CanvasLineCap { "butt", "round", "square" }; @@ -1710,6 +1712,18 @@ dictionary ToggleEventInit : EventInit { DOMString newState = ""; }; +[Exposed=Window] +interface CommandEvent : Event { + constructor(DOMString type, optional CommandEventInit eventInitDict = {}); + readonly attribute Element? source; + readonly attribute DOMString command; +}; + +dictionary CommandEventInit : EventInit { + Element? source = null; + DOMString command = ""; +}; + dictionary FocusOptions { boolean preventScroll = false; boolean focusVisible; @@ -2195,6 +2209,7 @@ interface mixin GlobalEventHandlers { attribute EventHandler onchange; attribute EventHandler onclick; attribute EventHandler onclose; + attribute EventHandler oncommand; attribute EventHandler oncontextlost; attribute EventHandler oncontextmenu; attribute EventHandler oncontextrestored; diff --git a/test/fixtures/wpt/interfaces/media-capabilities.idl b/test/fixtures/wpt/interfaces/media-capabilities.idl index 7bd8aca90c3..68ab0a8d0d1 100644 --- a/test/fixtures/wpt/interfaces/media-capabilities.idl +++ b/test/fixtures/wpt/interfaces/media-capabilities.idl @@ -90,7 +90,7 @@ dictionary MediaCapabilitiesInfo { }; dictionary MediaCapabilitiesDecodingInfo : MediaCapabilitiesInfo { - required MediaKeySystemAccess keySystemAccess; + required MediaKeySystemAccess? keySystemAccess; MediaDecodingConfiguration configuration; }; diff --git a/test/fixtures/wpt/interfaces/mediacapture-surface-control.idl b/test/fixtures/wpt/interfaces/mediacapture-surface-control.idl index 357b5c516f6..3a0ccf5faaf 100644 --- a/test/fixtures/wpt/interfaces/mediacapture-surface-control.idl +++ b/test/fixtures/wpt/interfaces/mediacapture-surface-control.idl @@ -5,7 +5,7 @@ partial interface CaptureController { sequence getSupportedZoomLevels(); - long getZoomLevel(); + readonly attribute long? zoomLevel; Promise increaseZoomLevel(); Promise decreaseZoomLevel(); Promise resetZoomLevel(); diff --git a/test/fixtures/wpt/interfaces/ppa.idl b/test/fixtures/wpt/interfaces/ppa.idl new file mode 100644 index 00000000000..a00d2deba87 --- /dev/null +++ b/test/fixtures/wpt/interfaces/ppa.idl @@ -0,0 +1,66 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content was automatically extracted by Reffy into webref +// (https://github.com/w3c/webref) +// Source: Privacy-Preserving Attribution: Level 1 (https://w3c.github.io/ppa/) + +partial interface Navigator { + [SecureContext, SameObject] readonly attribute PrivateAttribution privateAttribution; +}; + +enum PrivateAttributionProtocol { "dap-12-histogram", "tee-00" }; + +dictionary PrivateAttributionAggregationService { + required DOMString url; + required DOMString protocol; +}; + +[SecureContext, Exposed=Window] +interface PrivateAttributionAggregationServices { + readonly setlike; +}; + +[SecureContext, Exposed=Window] +interface PrivateAttribution { + readonly attribute PrivateAttributionAggregationServices aggregationServices; +}; + +dictionary PrivateAttributionImpressionOptions { + required unsigned long histogramIndex; + unsigned long filterData = 0; + required DOMString conversionSite; + unsigned long lifetimeDays = 30; +}; + +[SecureContext, Exposed=Window] +partial interface PrivateAttribution { + undefined saveImpression(PrivateAttributionImpressionOptions options); +}; + +dictionary PrivateAttributionConversionOptions { + required DOMString aggregationService; + double epsilon = 1.0; + + required unsigned long histogramSize; + + PrivateAttributionLogic logic = "last-touch"; + unsigned long value = 1; + unsigned long maxValue = 1; + + unsigned long lookbackDays; + unsigned long filterData; + sequence impressionSites = []; + sequence intermediarySites = []; +}; + +dictionary PrivateAttributionConversionResult { + required Uint8Array report; +}; + +[SecureContext, Exposed=Window] +partial interface PrivateAttribution { + Promise measureConversion(PrivateAttributionConversionOptions options); +}; + +enum PrivateAttributionLogic { + "last-touch", +}; diff --git a/test/fixtures/wpt/interfaces/sanitizer-api.idl b/test/fixtures/wpt/interfaces/sanitizer-api.idl index 86ec7875f49..70412cced28 100644 --- a/test/fixtures/wpt/interfaces/sanitizer-api.idl +++ b/test/fixtures/wpt/interfaces/sanitizer-api.idl @@ -11,7 +11,7 @@ dictionary SetHTMLUnsafeOptions { (Sanitizer or SanitizerConfig or SanitizerPresets) sanitizer = {}; }; -[Exposed=(Window,Worker)] +[Exposed=Window] interface Sanitizer { constructor(optional (SanitizerConfig or SanitizerPresets) configuration = "default"); diff --git a/test/fixtures/wpt/interfaces/sanitizer-api.tentative.idl b/test/fixtures/wpt/interfaces/sanitizer-api.tentative.idl index 3e843d8eb0c..4e597aeec7b 100644 --- a/test/fixtures/wpt/interfaces/sanitizer-api.tentative.idl +++ b/test/fixtures/wpt/interfaces/sanitizer-api.tentative.idl @@ -1,17 +1,61 @@ // https://wicg.github.io/sanitizer-api/ -[ - Exposed=Window, - SecureContext -] interface Sanitizer { - constructor(optional SanitizerConfig sanitizerConfig = {}); - DocumentFragment sanitize((DocumentFragment or Document) input); +enum SanitizerPresets { "default" }; +dictionary SetHTMLOptions { + (Sanitizer or SanitizerConfig or SanitizerPresets) sanitizer = "default"; +}; +dictionary SetHTMLUnsafeOptions { + (Sanitizer or SanitizerConfig or SanitizerPresets) sanitizer = {}; +}; + +[Exposed=Window] +interface Sanitizer { + constructor(optional (SanitizerConfig or SanitizerPresets) configuration = "default"); + + // Query configuration: + SanitizerConfig get(); + + // Modify a Sanitizer’s lists and fields: + undefined allowElement(SanitizerElementWithAttributes element); + undefined removeElement(SanitizerElement element); + undefined replaceElementWithChildren(SanitizerElement element); + undefined allowAttribute(SanitizerAttribute attribute); + undefined removeAttribute(SanitizerAttribute attribute); + undefined setComments(boolean allow); + undefined setDataAttributes(boolean allow); + + // Remove markup that executes script. May modify multiple lists: + undefined removeUnsafe(); +}; + +dictionary SanitizerElementNamespace { + required DOMString name; + DOMString? _namespace = "http://www.w3.org/1999/xhtml"; }; +// Used by "elements" +dictionary SanitizerElementNamespaceWithAttributes : SanitizerElementNamespace { + sequence attributes; + sequence removeAttributes; +}; + +typedef (DOMString or SanitizerElementNamespace) SanitizerElement; +typedef (DOMString or SanitizerElementNamespaceWithAttributes) SanitizerElementWithAttributes; + +dictionary SanitizerAttributeNamespace { + required DOMString name; + DOMString? _namespace = null; +}; +typedef (DOMString or SanitizerAttributeNamespace) SanitizerAttribute; + dictionary SanitizerConfig { - sequence allowElements; - sequence blockElements; - sequence dropElements; - sequence allowAttributes; - sequence dropAttributes; + sequence elements; + sequence removeElements; + sequence replaceWithChildrenElements; + + sequence attributes; + sequence removeAttributes; + + boolean comments; + boolean dataAttributes; }; diff --git a/test/fixtures/wpt/interfaces/speech-api.idl b/test/fixtures/wpt/interfaces/speech-api.idl index 025f9424f01..bc0635fa3f2 100644 --- a/test/fixtures/wpt/interfaces/speech-api.idl +++ b/test/fixtures/wpt/interfaces/speech-api.idl @@ -19,8 +19,8 @@ interface SpeechRecognition : EventTarget { undefined start(MediaStreamTrack audioTrack); undefined stop(); undefined abort(); - boolean onDeviceWebSpeechAvailable(DOMString lang); - boolean installOnDeviceSpeechRecognition(DOMString lang); + static Promise availableOnDevice(DOMString lang); + static Promise installOnDevice(DOMString lang); // event methods attribute EventHandler onaudiostart; diff --git a/test/fixtures/wpt/interfaces/webnn.idl b/test/fixtures/wpt/interfaces/webnn.idl index 3e1d9a9f440..63554edbffd 100644 --- a/test/fixtures/wpt/interfaces/webnn.idl +++ b/test/fixtures/wpt/interfaces/webnn.idl @@ -9,12 +9,6 @@ interface mixin NavigatorML { Navigator includes NavigatorML; WorkerNavigator includes NavigatorML; -enum MLDeviceType { - "cpu", - "gpu", - "npu" -}; - enum MLPowerPreference { "default", "high-performance", @@ -22,7 +16,6 @@ enum MLPowerPreference { }; dictionary MLContextOptions { - MLDeviceType deviceType = "cpu"; MLPowerPreference powerPreference = "default"; }; diff --git a/test/fixtures/wpt/resources/testdriver.js b/test/fixtures/wpt/resources/testdriver.js index aee319f5757..05301bf5589 100644 --- a/test/fixtures/wpt/resources/testdriver.js +++ b/test/fixtures/wpt/resources/testdriver.js @@ -82,6 +82,42 @@ * `bluetooth `_ module. */ bluetooth: { + /** + * Handle a bluetooth device prompt with the given params. Matches the + * `bluetooth.handleRequestDevicePrompt + * `_ + * WebDriver BiDi command. + * + * @example + * await test_driver.bidi.bluetooth.handleRequestDevicePrompt({ + * prompt: "pmt-e0a234b", + * accept: true, + * device: "dvc-9b3b872" + * }); + * + * @param {object} params - Parameters for the command. + * @param {string} params.prompt - The id of a bluetooth device prompt. + * Matches the + * `bluetooth.HandleRequestDevicePromptParameters:prompt `_ + * value. + * @param {bool} params.accept - Whether to accept a bluetooth device prompt. + * Matches the + * `bluetooth.HandleRequestDevicePromptAcceptParameters:accept `_ + * value. + * @param {string} params.device - The device id from a bluetooth device + * prompt to be accepted. Matches the + * `bluetooth.HandleRequestDevicePromptAcceptParameters:device `_ + * value. + * @param {Context} [params.context] The optional context parameter specifies in + * which browsing context the bluetooth device prompt should be handled. If not + * provided, the current browsing context is used. + * @returns {Promise} fulfilled after the bluetooth device prompt + * is handled, or rejected if the operation fails. + */ + handle_request_device_prompt: function(params) { + return window.test_driver_internal.bidi.bluetooth + .handle_request_device_prompt(params); + }, /** * Creates a simulated bluetooth adapter with the given params. Matches the * `bluetooth.simulateAdapter `_ @@ -105,6 +141,116 @@ */ simulate_adapter: function (params) { return window.test_driver_internal.bidi.bluetooth.simulate_adapter(params); + }, + /** + * Creates a simulated bluetooth peripheral with the given params. + * Matches the + * `bluetooth.simulatePreconnectedPeripheral `_ + * WebDriver BiDi command. + * + * @example + * await test_driver.bidi.bluetooth.simulatePreconnectedPeripheral({ + * "address": "09:09:09:09:09:09", + * "name": "Some Device", + * "manufacturerData": [{key: 17, data: "AP8BAX8="}], + * "knownServiceUuids": [ + * "12345678-1234-5678-9abc-def123456789", + * ], + * }); + * + * @param {object} params - Parameters for the command. + * @param {string} params.address - The address of the simulated + * bluetooth peripheral. Matches the + * `bluetooth.SimulatePreconnectedPeripheralParameters:address `_ + * value. + * @param {string} params.name - The name of the simulated bluetooth + * peripheral. Matches the + * `bluetooth.SimulatePreconnectedPeripheralParameters:name `_ + * value. + * @param {Array.ManufacturerData} params.manufacturerData - The manufacturerData of the + * simulated bluetooth peripheral. Matches the + * `bluetooth.SimulatePreconnectedPeripheralParameters:manufacturerData `_ + * value. + * @param {string} params.knownServiceUuids - The knownServiceUuids of + * the simulated bluetooth peripheral. Matches the + * `bluetooth.SimulatePreconnectedPeripheralParameters:knownServiceUuids `_ + * value. + * @param {Context} [params.context] The optional context parameter + * specifies in which browsing context the simulated bluetooth peripheral should be + * set. If not provided, the current browsing context is used. + * @returns {Promise} fulfilled after the simulated bluetooth peripheral is created + * and set, or rejected if the operation fails. + */ + simulate_preconnected_peripheral: function(params) { + return window.test_driver_internal.bidi.bluetooth + .simulate_preconnected_peripheral(params); + }, + /** + * `bluetooth.RequestDevicePromptUpdatedParameters `_ + * event. + */ + request_device_prompt_updated: { + /** + * @typedef {object} RequestDevicePromptUpdated + * `bluetooth.RequestDevicePromptUpdatedParameters `_ + * event. + */ + + /** + * Subscribes to the event. Events will be emitted only if + * there is a subscription for the event. This method does + * not add actual listeners. To listen to the event, use the + * `on` or `once` methods. The buffered events will be + * emitted before the command promise is resolved. + * + * @param {object} [params] Parameters for the subscription. + * @param {null|Array.<(Context)>} [params.contexts] The + * optional contexts parameter specifies which browsing + * contexts to subscribe to the event on. It should be + * either an array of Context objects, or null. If null, the + * event will be subscribed to globally. If omitted, the + * event will be subscribed to on the current browsing + * context. + * @returns {Promise} Resolves when the subscription + * is successfully done. + */ + subscribe: async function(params = {}) { + assertBidiIsEnabled(); + return window.test_driver_internal.bidi.bluetooth + .request_device_prompt_updated.subscribe(params); + }, + /** + * Adds an event listener for the event. + * + * @param {function(RequestDevicePromptUpdated): void} callback The + * callback to be called when the event is emitted. The + * callback is called with the event object as a parameter. + * @returns {function(): void} A function that removes the + * added event listener when called. + */ + on: function(callback) { + assertBidiIsEnabled(); + return window.test_driver_internal.bidi.bluetooth + .request_device_prompt_updated.on(callback); + }, + /** + * Adds an event listener for the event that is only called + * once and removed afterward. + * + * @return {Promise} The promise which + * is resolved with the event object when the event is emitted. + */ + once: function() { + assertBidiIsEnabled(); + return new Promise(resolve => { + const remove_handler = + window.test_driver_internal.bidi.bluetooth + .request_device_prompt_updated.on(event => { + resolve(event); + remove_handler(); + }); + }); + }, } }, /** @@ -1340,9 +1486,27 @@ bidi: { bluetooth: { + handle_request_device_prompt: function() { + throw new Error( + 'bidi.bluetooth.handle_request_device_prompt is not implemented by testdriver-vendor.js'); + }, simulate_adapter: function () { throw new Error( "bidi.bluetooth.simulate_adapter is not implemented by testdriver-vendor.js"); + }, + simulate_preconnected_peripheral: function() { + throw new Error( + 'bidi.bluetooth.simulate_preconnected_peripheral is not implemented by testdriver-vendor.js'); + }, + request_device_prompt_updated: { + async subscribe() { + throw new Error( + 'bidi.bluetooth.request_device_prompt_updated.subscribe is not implemented by testdriver-vendor.js'); + }, + on() { + throw new Error( + 'bidi.bluetooth.request_device_prompt_updated.on is not implemented by testdriver-vendor.js'); + } } }, log: { diff --git a/test/fixtures/wpt/service-workers/service-worker/resources/router-rules.js b/test/fixtures/wpt/service-workers/service-worker/resources/router-rules.js index 58c0e5cbbaf..27462b6c1d7 100644 --- a/test/fixtures/wpt/service-workers/service-worker/resources/router-rules.js +++ b/test/fixtures/wpt/service-workers/service-worker/resources/router-rules.js @@ -1,4 +1,7 @@ const TEST_CACHE_NAME = 'v1'; +// https://w3c.github.io/ServiceWorker/#check-router-registration-limit-algorithm +const CONDITION_MAX_RECURSION_DEPTH = 10; +const CONDITION_MAX_COUNT = 1024; const routerRules = { 'condition-urlpattern-constructed-source-network': [{ @@ -65,6 +68,34 @@ const routerRules = { condition: {requestMethod: 'connect'}, source: 'network' }], + 'condition-invalid-or-condition-depth': (() => { + const addOrCondition = (depth) => { + if (depth > CONDITION_MAX_RECURSION_DEPTH + 1) { + return {urlPattern: '/foo'}; + } + return { + or: [addOrCondition(depth + 1)] + }; + }; + return {condition: addOrCondition(1), source: 'network'}; + })(), + 'condition-invalid-not-condition-depth': (() => { + const generateNotCondition = (depth) => { + if (depth > CONDITION_MAX_RECURSION_DEPTH + 1) { + return { + urlPattern: '/**/example.txt', + }; + } + return {not: generateNotCondition(depth + 1)}; + }; + return {condition: generateNotCondition(1), source: 'network'}; + })(), + 'condition-invalid-router-size': [...Array(CONDITION_MAX_COUNT + 1)].map((val, i) => { + return { + condition: {urlPattern: `/foo-${i}`}, + source: 'network' + }; + }), 'condition-request-destination-script-network': [{condition: {requestDestination: 'script'}, source: 'network'}], 'condition-or-source-network': [{ diff --git a/test/fixtures/wpt/service-workers/service-worker/static-router-invalid-rules.https.html b/test/fixtures/wpt/service-workers/service-worker/static-router-invalid-rules.https.html index 616f85bd618..958d74374d8 100644 --- a/test/fixtures/wpt/service-workers/service-worker/static-router-invalid-rules.https.html +++ b/test/fixtures/wpt/service-workers/service-worker/static-router-invalid-rules.https.html @@ -19,6 +19,14 @@ 'condition-invalid-http-request-method'; const ROUTER_RULE_KEY_FORBIDDEN_REQUEST_METHOD = 'condition-invalid-forbidden-method'; +const ROUTER_RULE_KEY_INVALID_REQUEST_METHOD = + 'condition-invalid-request-method'; +const ROUTER_RULE_KEY_INVALID_OR_CONDITION_DEPTH = + 'condition-invalid-or-condition-depth'; +const ROUTER_RULE_KEY_INVALID_NOT_CONDITION_DEPTH = + 'condition-invalid-not-condition-depth'; +const ROUTER_RULE_KEY_INVALID_ROUTER_SIZE = + 'condition-invalid-router-size'; const ROUTER_RULE_KEY_LACK_OF_CONDITION = 'condition-lack-of-condition'; const ROUTER_RULE_KEY_LACK_OF_SOURCE = @@ -45,6 +53,27 @@ assert_equals(errors.length, 1); }, 'addRoutes should raise for forbidden request method.'); +promise_test(async t => { + const worker = await registerAndActivate(t, ROUTER_RULE_KEY_INVALID_OR_CONDITION_DEPTH); + t.add_cleanup(() => {reset_info_in_worker(worker)}); + const {errors} = await get_info_from_worker(worker); + assert_equals(errors.length, 1); +}, 'addRoutes should raise if or condition exceeds the depth limit'); + +promise_test(async t => { + const worker = await registerAndActivate(t, ROUTER_RULE_KEY_INVALID_NOT_CONDITION_DEPTH); + t.add_cleanup(() => {reset_info_in_worker(worker)}); + const {errors} = await get_info_from_worker(worker); + assert_equals(errors.length, 1); +}, 'addRoutes should raise if not condition exceeds the depth limit'); + +promise_test(async t => { + const worker = await registerAndActivate(t, ROUTER_RULE_KEY_INVALID_ROUTER_SIZE); + t.add_cleanup(() => {reset_info_in_worker(worker)}); + const {errors} = await get_info_from_worker(worker); + assert_equals(errors.length, 1); +}, 'addRoutes should raise if the number of router rules exceeds the length limit'); + promise_test(async t => { const worker = await registerAndActivate(t, ROUTER_RULE_KEY_LACK_OF_CONDITION); t.add_cleanup(() => {reset_info_in_worker(worker)});