w3c / w3c/webdriver

Returning lone surrogates fails

Open
#1,450 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Execute Async Script Execute Script needs-discussion
Dominant language
HTML
Stars
718
Forks
228
PR merge metrics
No merged PRs in 30d

Description

wd.execute_script(u"return '\\uD800'") fails (almost?) everywhere. (Sorry Jim, I don't have IE to hand.)

Chrome:

selenium.common.exceptions.WebDriverException: Message: unknown error: bad inspector message: {"id":18,"result":{"result":{"type":"object","value":{"status":0,"value":"\ud800"}}}}
  (Session info: chrome=77.0.3865.90)

Firefox:

selenium.common.exceptions.InvalidArgumentException: Message: unexpected end of hex escape at line 1 column 27

Safari doesn't throw, just returns None.

Per spec, because we use the ES JSON.[[Parse]] and JSON.[[Stringify]] functions, we should deal with lone surrogates fine. Except this appears to be a lie.

This cropped up from https://github.com/web-platform-tests/wpt/issues/17577.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the WebDriver script-execution behavior described by wd.execute_script and the linked web-platform-tests issue, then compare the Chrome, Firefox, and Safari failures against the specification's JSON parsing and stringifying requirements. Done means a lone surrogate is returned consistently according to the specification across the affected implementations.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.