<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>226434</bug_id>
          
          <creation_ts>2021-05-30 06:01:25 -0700</creation_ts>
          <short_desc>window.scrollTo(null) throws an exception</short_desc>
          <delta_ts>2021-06-01 20:28:12 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebCore Misc.</component>
          <version>WebKit Local Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="zyscoder@gmail.com">zyscoder</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>bugs-noreply</cc>
    
    <cc>cdumez</cc>
    
    <cc>mcatanzaro</cc>
    
    <cc>simon.fraser</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1765204</commentid>
    <comment_count>0</comment_count>
    <who name="zyscoder@gmail.com">zyscoder</who>
    <bug_when>2021-05-30 06:01:25 -0700</bug_when>
    <thetext>Steps to reproduce:

(1) Open a tab and navigate to https://www.icann.org/;
(2) Run the following code in the Console of Devtools:
```
window.scrollTo(null);
```
(3) Then this code would throw an exception.

Actual results:

This code would throw an exception: `TypeError: null is not an object (evaluating &apos;arguments[0].left&apos;)`

Expected results:

As https://drafts.csswg.org/cssom-view/#dom-window-scroll says, 
```
If invoked with one argument, follow these substeps:
  - Let options be the argument.
  - Let x/y be the value of the left/top dictionary member of options, if present, or the viewport’s current scroll position on the x/y axis otherwise.
```

It seems reasonable to let x/y be the value of the viewport’s current scroll position on the x/y axis and no need to throw any exceptions for this code.

In my test, Chrome and Firefox would not throw any exceptions when evaluating this code.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1765837</commentid>
    <comment_count>1</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2021-06-01 17:56:29 -0700</bug_when>
    <thetext>If you type window.scrollTo on icann.org, you&apos;ll notice they are using some kind of polyfill:
function (){void 0!==arguments[0]&amp;&amp;(!0!==c(arguments[0])?g.call(t,e.body,void 0!==arguments[0].left?~~arguments[0].left:t.scrollX||t.pageXOffset,void 0!==arguments[0].top?~~arguments[0].top:t.scrollY||t.pageYOffset):o.scroll.call(t,void 0!==arguments[0].left?arguments[0].left:&quot;object&quot;!=typeof arguments[0]?arguments[0]:t.scrollX||t.pageXOffset,void 0!==arguments[0].top?arguments[0].top:void 0!==arguments[1]?arguments[1]:t.scrollY||t.pageYOffset))} = $1

They are not calling our window.scrollTo() implementation. As a matter of fact, our window.scrollTo() implementation never throws.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1765838</commentid>
    <comment_count>2</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2021-06-01 17:58:00 -0700</bug_when>
    <thetext>Chrome and Firefox are not getting the polypill for window.scrollTo, unclear why.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1765840</commentid>
    <comment_count>3</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2021-06-01 18:04:11 -0700</bug_when>
    <thetext>(In reply to Chris Dumez from comment #2)
&gt; Chrome and Firefox are not getting the polypill for window.scrollTo, unclear
&gt; why.

I think we are getting the polyfill  because of this check:
if (!(&quot;scrollBehavior&quot; in e.documentElement.style) || !0 === t.__forceSmoothScrollPolyfill__) {

We seem to be failing this: &quot;scrollBehavior&quot; in e.documentElement.style</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1765842</commentid>
    <comment_count>4</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2021-06-01 18:11:55 -0700</bug_when>
    <thetext>(In reply to Chris Dumez from comment #3)
&gt; (In reply to Chris Dumez from comment #2)
&gt; &gt; Chrome and Firefox are not getting the polypill for window.scrollTo, unclear
&gt; &gt; why.
&gt; 
&gt; I think we are getting the polyfill  because of this check:
&gt; if (!(&quot;scrollBehavior&quot; in e.documentElement.style) || !0 ===
&gt; t.__forceSmoothScrollPolyfill__) {
&gt; 
&gt; We seem to be failing this: &quot;scrollBehavior&quot; in e.documentElement.style

On WebKit trunk, in the develop menu, there is an experimental feature called CSSOM View Smooth Scrolling, which is off by default. If I turn it on, then icann.org stops using the polyfill and instead calls our native window.scrollTo(). I have verified that window.scrollTo(null) doesn&apos;t throw in such case.

Anyway, this is not really a but with our window.scrollTo implementation. The Website merely makes the decision NOT to use our window.scrollTo implementation because we don&apos;t support CSSOM View Smooth Scrolling.

Simon may know more about CSSOM View Smooth Scrolling, I have no idea what that is or if we&apos;re close to enabling it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1765858</commentid>
    <comment_count>5</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2021-06-01 20:28:12 -0700</bug_when>
    <thetext>ScrollBehavior is bug 188043.

Anyway, this bug is a website bug.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>