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

[JS] Formatted value has to be a string when neither null nor undefined #14890

Merged
merged 1 commit into from
May 8, 2022

Conversation

calixteman
Copy link
Contributor

No description provided.

@Snuffleupagus
Copy link
Collaborator

Would it make sense to also add a ... || value === null check to the following block, to prevent a possible future bug?

if (value === undefined) {

Or, if that's not correct, how about a if (value === null) { return ""; } check just before

value = value.trim();

@Snuffleupagus Snuffleupagus linked an issue May 8, 2022 that may be closed by this pull request
@calixteman
Copy link
Contributor Author

The issue here was due to a formatted value which was a number (so no trim method).
The stored value shouldn't be null:

storage.setValue(id, { value: event.target.value });

storage.setValue(id, { value: elementData.userValue.toString() });

The call to trim is a kind of assertion that the value is a string (and thx to that we caught the error you reported).
Maybe we can be more explicit and add an assertion to check the type of value, wdyt ?

@Snuffleupagus
Copy link
Collaborator

Snuffleupagus commented May 8, 2022

Maybe we can be more explicit and add an assertion to check the type of value, wdyt ?

That might be the nicest solution; since an explicit error is always better than an implicit one.

@Snuffleupagus
Copy link
Collaborator

/botio-linux preview

@pdfjsbot
Copy link

pdfjsbot commented May 8, 2022

From: Bot.io (Linux m4)


Received

Command cmd_preview from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/bf24429f36bd3bb/output.txt

@pdfjsbot
Copy link

pdfjsbot commented May 8, 2022

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/bf24429f36bd3bb/output.txt

Total script time: 2.57 mins

Published

Copy link
Collaborator

@Snuffleupagus Snuffleupagus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me, with passing tests; thank you!

@Snuffleupagus
Copy link
Collaborator

/botio test

@pdfjsbot
Copy link

pdfjsbot commented May 8, 2022

From: Bot.io (Windows)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.193.163.58:8877/9a33fb322b964e0/output.txt

@pdfjsbot
Copy link

pdfjsbot commented May 8, 2022

From: Bot.io (Linux m4)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/d136a7983980082/output.txt

@pdfjsbot
Copy link

pdfjsbot commented May 8, 2022

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/d136a7983980082/output.txt

Total script time: 25.85 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  different ref/snapshot: 6

Image differences available at: http://54.241.84.105:8877/d136a7983980082/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

pdfjsbot commented May 8, 2022

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/9a33fb322b964e0/output.txt

Total script time: 31.86 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  different ref/snapshot: 1

Image differences available at: http://54.193.163.58:8877/9a33fb322b964e0/reftest-analyzer.html#web=eq.log

@Snuffleupagus Snuffleupagus merged commit 38c8235 into mozilla:master May 8, 2022
@calixteman calixteman deleted the 14889 branch May 8, 2022 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Annotation-data exceptions during e.g. printing
3 participants