Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intermittent failure in /url/percent-encoding.window.html #27737

Closed
jdm opened this issue Nov 4, 2020 · 4 comments
Closed

Intermittent failure in /url/percent-encoding.window.html #27737

jdm opened this issue Nov 4, 2020 · 4 comments
Labels
I-intermittent Problem reproduces intermittently. L-python Python is required

Comments

@jdm
Copy link
Member

jdm commented Nov 4, 2020

  ▶ Unexpected subtest result in /url/percent-encoding.window.html:
  │ FAIL [expected PASS] b'Input \\u2020 with encoding utf-8'
  │   → output is null
  │ FAIL [expected PASS] b'Input \\x0eA with encoding big5'
  │   → output is null
  │ FAIL [expected PASS] b'Input \\x0eA with encoding utf-8'
  │   → output is null
  │ FAIL [expected PASS] b'Input \\u203e\\\\ with encoding utf-8'
  │   → output is null
  │ FAIL [expected PASS] b'Input \\ue5e5 with encoding utf-8'
  │   → output is null
  │ FAIL [expected PASS] b'Input \\u2212 with encoding utf-8'
  │   → output is null
  │ FAIL [expected PASS] b'Input \\xe1| with encoding utf-8'
  │   → output is null
  │ 
  │ runTests/</frame.onload<@http://web-platform.test:8000/url/percent-encoding.window.js:16:11
  │ Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:2044:25
  └ Test.prototype.step_func_done/<@http://web-platform.test:8000/resources/testharness.js:2085:32
@jdm jdm added the I-intermittent Problem reproduces intermittently. label Nov 4, 2020
@jdm
Copy link
Member Author

jdm commented Nov 4, 2020

This result isn't actually intermittent, but it only happens when running the test under python3:

+ env PYTHONIOENCODING=utf-8 python3 ./mach test-wpt --release --processes 20 --log-raw test-wpt-py3.log --log-errorsummary wpt-py3-errorsummary.log url

@jdm jdm added the L-python Python is required label Nov 4, 2020
@ghostd
Copy link
Contributor

ghostd commented Nov 17, 2020

I can reproduce the issue on my computer (Debian, python 3.8). To fix the problem i had to change the script percent-encoding.py into this:

def numeric_references(input):
    output = b""
    for cp in input:
        output += b"&#x" + format(ord(cp), "X").encode('ascii') + b";"
    return output

def main(request, response):
    # Undo the "magic" space with + replacement as otherwise base64 decoding will fail.
    value = request.GET.first(b"value").replace(b" ", b"+")
    encoding = request.GET.first(b"encoding")

    output_value = numeric_references(base64.b64decode(value).decode("utf-8"))
    return (
        [(b"Content-Type", b"text/html;charset=" + encoding)],
        b"""<!doctype html>
<a href="https://doesnotmatter.invalid/?%s#%s">test</a>
""" % (output_value, output_value))

The 3 modified lines are:

  • output += b"&#x" + format(ord(cp), "X").encode('ascii') + b";"
  • value = request.GET.first(b"value").replace(b" ", b"+")
  • output_value = numeric_references(base64.b64decode(value).decode("utf-8"))

I have issues to run WPT with Python 2 on my computer, so i cant check the compatibility of these changes.

@andreubotella
Copy link
Contributor

This bug was fixed upstream in web-platform-tests/wpt#26643, which got merged into servo in #27736.

@jdm
Copy link
Member Author

jdm commented Dec 24, 2020

Thanks!

@jdm jdm closed this as completed Dec 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-intermittent Problem reproduces intermittently. L-python Python is required
Projects
None yet
Development

No branches or pull requests

3 participants