Commit fd80e3d0 authored by Frédéric Wang's avatar Frédéric Wang Committed by Commit Bot

Add WPT tests for registerProtocolHandler and 'web+' schemes

This is a follow-up of [1] where the validation on the web and browser
processes have been unified. Tests for 'web+' have been added to
ProtocolHandlerRegistryTest (browser process). This CL adds similar and
more complete checks to the existing WPT test (web process).

The relevant section from the specification says [2]:

* Set scheme to scheme, converted to ASCII lowercase.
* If scheme is neither a safelisted scheme nor a string starting with
  "web+" followed by one or more ASCII lower alphas, then throw a
  "SecurityError" DOMException.

Bug: 971917, 952974, 627682

[1] https://chromium-review.googlesource.com/c/chromium/src/+/2362802
[2] https://html.spec.whatwg.org/multipage/system-state.html#normalize-protocol-handler-parameters

Change-Id: I769048bd4db6883a75d4237f20f23aa61452d732
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2371632Reviewed-by: default avatarGyuyoung Kim <gyuyoung@igalia.com>
Commit-Queue: Frédéric Wang <fwang@igalia.com>
Cr-Commit-Position: refs/heads/master@{#801004}
parent c5e398c0
...@@ -140,8 +140,16 @@ test(() => { ...@@ -140,8 +140,16 @@ test(() => {
/* web+ prefixed schemes must be followed by 1+ ascii alphas */ /* web+ prefixed schemes must be followed by 1+ ascii alphas */
'web+', 'web+',
'web+1', 'web+1',
'web+namewithid123',
'web+namewithtrailingspace ',
'web+préfixewithaccent', // é is not ascii alpha
'web+Kelvinsign', // ASCII-lower KELVIN SIGN is not k
'web+latinsmallletterlongſ', // ASCII-lower LATIN SMALL LETTER LONG S is not s
'web+dots.are.forbidden', 'web+dots.are.forbidden',
'web+dashes-are-forbidden', 'web+dashes-are-forbidden',
'web+underscores_are_forbidden',
'web+spaces are forbidden',
'web+non*alpha*are*forbidden',
'web+digits123areforbidden', 'web+digits123areforbidden',
].forEach(scheme => { ].forEach(scheme => {
test(() => { test(() => {
...@@ -191,6 +199,7 @@ test(() => { ...@@ -191,6 +199,7 @@ test(() => {
'WebCAL', 'WebCAL',
'WTAI', 'WTAI',
'web+myprotocol', 'web+myprotocol',
'web+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', // all alphas
'web+UpperCasedIsLowercased', 'web+UpperCasedIsLowercased',
'WEB+seeabove', 'WEB+seeabove',
'WeB+SeEaBoVe' 'WeB+SeEaBoVe'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment