Bug 226965 - window.scrollBy misses checking the type of options param
Summary: window.scrollBy misses checking the type of options param
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-14 04:42 PDT by zyscoder@gmail.com
Modified: 2021-06-15 08:46 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description zyscoder@gmail.com 2021-06-14 04:42:04 PDT
Steps to reproduce:

(1) Open a tab and navigate to any URL;
(2) Open Devtools and run the following code in the Console:
```
window.scrollBy('\u{1a}');
```

Actual results:

This code would be evaluated successfully without any exceptions thrown.

Expected results:

As https://drafts.csswg.org/cssom-view/#dom-window-scrollby says, the param should be of ScrollToOptions type. Thus a TypeError exception should be thrown for this code.

In my test, both Chrome and Firefox would throw exceptions:
Chrome: `TypeError: Failed to execute 'scrollBy' on 'Window': cannot convert to dictionary.`
Firefox: `Window.scrollBy: Value can't be converted to a dictionary.`
Comment 1 Chris Dumez 2021-06-15 08:44:38 PDT
window.scrollBy('\u{1a}'); gives me a TypeError on Safari 15. This is likely already fixed.
Comment 2 Chris Dumez 2021-06-15 08:46:51 PDT
(In reply to Chris Dumez from comment #1)
> window.scrollBy('\u{1a}'); gives me a TypeError on Safari 15. This is likely
> already fixed.

I recommend trying Safari Technology Preview or Safari 15 beta.