<?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>137631</bug_id>
          
          <creation_ts>2014-10-10 18:13:56 -0700</creation_ts>
          <short_desc>DOMTimer nesting level may not impact each other.</short_desc>
          <delta_ts>2023-06-23 20:06:01 -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>DOM</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></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="Horky">chenhao</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ahmad.saleem792</cc>
    
    <cc>ap</cc>
    
    <cc>barraclough</cc>
    
    <cc>bfulgham</cc>
    
    <cc>cdumez</cc>
    
    <cc>chenhao</cc>
    
    <cc>commit-queue</cc>
    
    <cc>darin</cc>
    
    <cc>rniwa</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1041083</commentid>
    <comment_count>0</comment_count>
    <who name="Horky">chenhao</who>
    <bug_when>2014-10-10 18:13:56 -0700</bug_when>
    <thetext>First, there is a long story which come from:
   https://bugs.webkit.org/show_bug.cgi?id=42861

Current situation is the timer could forward the gesture state only if the nesting level is zero. The problem is the nesting level is managed in the Document (ScriptExecutionContext), that means all timers in the same document share one nesting level. If one repeat timer was launched, all other timers after that could not forward the gesture state, due to all of them has a non-zero nesting level.

Below is my testing page, three images at the end of page could delay the onload event. Then follow below steps to reproduce what I met:
1. Click &quot;Start repeating timer&quot; first
2. After the text change to &quot;Running...&quot;, click &quot;Goto next page&quot;
3. When WebKit page come out, click back button.

The expected page is the testing page, but it moves to the page before it, because the NavigationScheduler::mustLockBackForwardList refused the creation of new history item.

 &lt;html&gt;
 &lt;head&gt;
 &lt;/head&gt;
 &lt;body&gt;
 &lt;input type=&quot;button&quot; value=&quot;Goto next page&quot; onclick=&quot;gotoNextPage();&quot;&gt;
 &lt;input type=&quot;button&quot; value=&quot;Start repeating timer&quot; onclick=&quot;startRepeatingTimer();&quot;&gt;
 &lt;p&gt;
 &lt;div id=&quot;Timer&quot;&gt;Paused&lt;/div&gt;
 &lt;/p&gt;
 &lt;script type=&quot;text/javascript&quot;&gt;

 function gotoNextPage(){
    setTimeout(function(){location.href=&quot;http://www.webkit.org/&quot;;},300);
 }

 function startRepeatingTimer(){
   setInterval(function(){document.getElementById(&quot;Timer&quot;).innerHTML=&quot;Running...&quot;;},500);
 }
 &lt;/script&gt;

 &lt;img src=&quot;http://therecoveringpolitician.com/wp-content/uploads/2013/01/moderate.jpg&quot; width=&quot;640&quot; height=&quot;480&quot;&gt;
 &lt;img src=&quot;http://cullogo.com/full/wallpapers-high-resolution-widescreen-hd-pk.jpg&quot; width=&quot;640&quot; height=&quot;480&quot;&gt;
 &lt;img src=&quot;http://www.highresolutionwallpapers.net/wallpapers/autumn-1680x1050.jpg&quot; width=&quot;640&quot; height=&quot;480&quot;&gt;
 &lt;/body&gt;
 &lt;/html&gt;

According to Web App APIs defintion(http://www.w3.org/html/wg/drafts/html/CR/webappapis.html#timer-nesting-level), the nesting level of repeating timer will be increased in the loop. I doubt that the nesting level should be owned by the timer itself, do not share with others. Just as described in the definition, that is task&apos;s nesting level.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1041084</commentid>
    <comment_count>1</comment_count>
    <who name="Horky">chenhao</who>
    <bug_when>2014-10-10 18:22:03 -0700</bug_when>
    <thetext>I do not prefer to clear the nesting level before the early return in DOMTimer::fired, some algorithms rely on it. Maybe moving nesting level from Document to DOMTimer is a optional solution.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1042081</commentid>
    <comment_count>2</comment_count>
    <who name="Horky">chenhao</who>
    <bug_when>2014-10-15 23:47:06 -0700</bug_when>
    <thetext>(In reply to comment #1)
&gt; I do not prefer to clear the nesting level before the early return in DOMTimer::fired, some algorithms rely on it. Maybe moving nesting level from Document to DOMTimer is a optional solution.

I miss-understood that, the DOMTimer already has its own nesting level. So that is reasonable to clear the nesting level of script execution context.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1042711</commentid>
    <comment_count>3</comment_count>
      <attachid>240093</attachid>
    <who name="Horky">chenhao</who>
    <bug_when>2014-10-19 19:46:54 -0700</bug_when>
    <thetext>Created attachment 240093
Fixing patch for review

I&apos;d like to submit one patch to reset the nesting level in the script execution context, would you please help to review it?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1042725</commentid>
    <comment_count>4</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2014-10-19 20:41:51 -0700</bug_when>
    <thetext>The correct way to ask for review is to set the review flag to ?, not to +.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1042728</commentid>
    <comment_count>5</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2014-10-19 20:43:14 -0700</bug_when>
    <thetext>Attachment 240093 did not pass style-queue:


ERROR: Source/WebCore/page/DOMTimer.cpp:210:  Tab found; better to use spaces  [whitespace/tab] [1]
ERROR: Source/WebCore/page/DOMTimer.cpp:211:  Tab found; better to use spaces  [whitespace/tab] [1]
Total errors found: 2 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1042732</commentid>
    <comment_count>6</comment_count>
      <attachid>240098</attachid>
    <who name="Horky">chenhao</who>
    <bug_when>2014-10-19 21:35:40 -0700</bug_when>
    <thetext>Created attachment 240098
Fixing patch for review

Corrected the review flag and coding style. Thanks.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1042844</commentid>
    <comment_count>7</comment_count>
      <attachid>240098</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2014-10-20 09:53:10 -0700</bug_when>
    <thetext>Comment on attachment 240098
Fixing patch for review

View in context: https://bugs.webkit.org/attachment.cgi?id=240098&amp;action=review

Looks good. A few small issues.

A larger issues is that we require a regression test with every bug fix. Can we construct one that demonstrates this bug? If we cannot, then the change log should include information about why we were not able to construct a regression test.

&gt; Source/WebCore/ChangeLog:6
&gt; +        Unreviewed.

This needs to include the Reviewed by NOBODY (OOPS!) line so the patch management system can add the name of the reviewer here.

&gt; Source/WebCore/ChangeLog:9
&gt; +        (WebCore::DOMTimer::fired):

This needs to describe the change and explain why it’s correct.

&gt; Source/WebCore/page/DOMTimer.cpp:211
&gt; +

I suggest omitting this blank line.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1043074</commentid>
    <comment_count>8</comment_count>
      <attachid>240176</attachid>
    <who name="Horky">chenhao</who>
    <bug_when>2014-10-20 19:24:10 -0700</bug_when>
    <thetext>Created attachment 240176
Fixing patch for review

Thanks for Darin&apos;s Review!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1043075</commentid>
    <comment_count>9</comment_count>
    <who name="Horky">chenhao</who>
    <bug_when>2014-10-20 19:27:18 -0700</bug_when>
    <thetext>(In reply to comment #7)
&gt; Comment on attachment 240098 [details]
&gt; Fixing patch for review
&gt; 
&gt; View in context:
&gt; https://bugs.webkit.org/attachment.cgi?id=240098&amp;action=review
&gt; 
&gt; Looks good. A few small issues.
&gt; 
&gt; A larger issues is that we require a regression test with every bug fix. Can
&gt; we construct one that demonstrates this bug? If we cannot, then the change
&gt; log should include information about why we were not able to construct a
&gt; regression test.
&gt; 
&gt; &gt; Source/WebCore/ChangeLog:6
&gt; &gt; +        Unreviewed.
&gt; 
&gt; This needs to include the Reviewed by NOBODY (OOPS!) line so the patch
&gt; management system can add the name of the reviewer here.
&gt; 
&gt; &gt; Source/WebCore/ChangeLog:9
&gt; &gt; +        (WebCore::DOMTimer::fired):
&gt; 
&gt; This needs to describe the change and explain why it’s correct.
&gt; 
&gt; &gt; Source/WebCore/page/DOMTimer.cpp:211
&gt; &gt; +
&gt; 
&gt; I suggest omitting this blank line.

Thanks! I updated it again.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1125671</commentid>
    <comment_count>10</comment_count>
      <attachid>240093</attachid>
    <who name="Csaba Osztrogonác">ossy</who>
    <bug_when>2015-09-14 11:13:36 -0700</bug_when>
    <thetext>Comment on attachment 240093
Fixing patch for review

Cleared review+ from obsolete attachment 240093 so that this bug does not appear in http://webkit.org/pending-commit.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1503259</commentid>
    <comment_count>11</comment_count>
    <who name="Lucas Forschler">lforschler</who>
    <bug_when>2019-02-06 09:18:50 -0800</bug_when>
    <thetext>Mass move bugs into the DOM component.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1887856</commentid>
    <comment_count>12</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2022-07-30 07:40:30 -0700</bug_when>
    <thetext>I updated test case from Comment 0 with HTTPS link and new images:

Link - https://jsfiddle.net/c10wr9y3/show

In Safari 15.6, clicking on &quot;Goto Next Page&quot; does not work at all while it works fro all other browsers and I get following in Console:

Refused to display &apos;https://webkit.org/&apos; in a frame because it set &apos;X-Frame-Options&apos; to &apos;SAMEORIGIN&apos;.

I am not sure this is the behavior about this bug or not but this is my testing results, all other browsers allow to clicking &quot;Goto Next Page&quot; and then navigate by giving errors and upon return, they show &quot;Timer&quot; as &quot;PAUSED&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1963458</commentid>
    <comment_count>13</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2023-06-23 20:06:01 -0700</bug_when>
    <thetext>Similar patch in Blink: https://chromium.googlesource.com/chromium/src.git/+/81f013144ccfc759101193455919b4c1d04c1715</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>240093</attachid>
            <date>2014-10-19 19:46:54 -0700</date>
            <delta_ts>2015-09-14 11:13:36 -0700</delta_ts>
            <desc>Fixing patch for review</desc>
            <filename>review.patch</filename>
            <type>text/plain</type>
            <size>1027</size>
            <attacher name="Horky">chenhao</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBTb3VyY2UvV2Vi
Q29yZS9DaGFuZ2VMb2cJKHJldmlzaW9uIDE3NDg3MykKKysrIFNvdXJjZS9XZWJDb3JlL0NoYW5n
ZUxvZwkod29ya2luZyBjb3B5KQpAQCAtMSwzICsxLDEzIEBACisyMDE0LTEwLTE5ICBIb3JreSBD
aGVuICA8Y2hlbmhhb0B1Y3dlYi5jb20+CisKKyAgICAgICAgRE9NVGltZXIgbmVzdGluZyBsZXZl
bCBtYXkgbm90IGltcGFjdCBlYWNoIG90aGVyCisgICAgICAgIGh0dHBzOi8vYnVncy53ZWJraXQu
b3JnL3Nob3dfYnVnLmNnaT9pZD0xMzc2MzEKKworICAgICAgICBVbnJldmlld2VkLgorCisgICAg
ICAgICogcGFnZS9ET01UaW1lci5jcHA6CisgICAgICAgIChXZWJDb3JlOjpET01UaW1lcjo6Zmly
ZWQpOgorCiAyMDE0LTEwLTE5ICBDYXJsb3MgR2FyY2lhIENhbXBvcyAgPGNnYXJjaWFAaWdhbGlh
LmNvbT4KIAogICAgICAgICBbR1RLXSBNb3ZlIEd0a0RyYWdBbmREcm9wSGVscGVyIGZyb20gUGxh
dGZvcm0gdG8gV2ViS2l0MgpJbmRleDogU291cmNlL1dlYkNvcmUvcGFnZS9ET01UaW1lci5jcHAK
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PQotLS0gU291cmNlL1dlYkNvcmUvcGFnZS9ET01UaW1lci5jcHAJKHJldmlzaW9u
IDE3NDg3MykKKysrIFNvdXJjZS9XZWJDb3JlL3BhZ2UvRE9NVGltZXIuY3BwCSh3b3JraW5nIGNv
cHkpCkBAIC0yMDYsNyArMjA2LDkgQEAgdm9pZCBET01UaW1lcjo6ZmlyZWQoKQogICAgICAgICAg
ICAgbV90aHJvdHRsZVN0YXRlID0gU2hvdWxkVGhyb3R0bGU7CiAgICAgICAgICAgICB1cGRhdGVU
aW1lckludGVydmFsSWZOZWNlc3NhcnkoKTsKICAgICAgICAgfQotCisgICAgICAgIAorCWNvbnRl
eHQtPnNldFRpbWVyTmVzdGluZ0xldmVsKDApOworCQogICAgICAgICByZXR1cm47CiAgICAgfQog
Cg==
</data>

          </attachment>
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>240098</attachid>
            <date>2014-10-19 21:35:40 -0700</date>
            <delta_ts>2014-10-20 19:24:10 -0700</delta_ts>
            <desc>Fixing patch for review</desc>
            <filename>review.patch</filename>
            <type>text/plain</type>
            <size>976</size>
            <attacher name="Horky">chenhao</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBTb3VyY2UvV2Vi
Q29yZS9DaGFuZ2VMb2cJKHJldmlzaW9uIDE3NDg3MykKKysrIFNvdXJjZS9XZWJDb3JlL0NoYW5n
ZUxvZwkod29ya2luZyBjb3B5KQpAQCAtMSwzICsxLDEzIEBACisyMDE0LTEwLTE5ICBIb3JreSBD
aGVuICA8Y2hlbmhhb0B1Y3dlYi5jb20+CisKKyAgICAgICAgRE9NVGltZXIgbmVzdGluZyBsZXZl
bCBtYXkgbm90IGltcGFjdCBlYWNoIG90aGVyCisgICAgICAgIGh0dHBzOi8vYnVncy53ZWJraXQu
b3JnL3Nob3dfYnVnLmNnaT9pZD0xMzc2MzEKKworICAgICAgICBVbnJldmlld2VkLgorCisgICAg
ICAgICogcGFnZS9ET01UaW1lci5jcHA6CisgICAgICAgIChXZWJDb3JlOjpET01UaW1lcjo6Zmly
ZWQpOgorCiAyMDE0LTEwLTE5ICBDYXJsb3MgR2FyY2lhIENhbXBvcyAgPGNnYXJjaWFAaWdhbGlh
LmNvbT4KIAogICAgICAgICBbR1RLXSBNb3ZlIEd0a0RyYWdBbmREcm9wSGVscGVyIGZyb20gUGxh
dGZvcm0gdG8gV2ViS2l0MgpJbmRleDogU291cmNlL1dlYkNvcmUvcGFnZS9ET01UaW1lci5jcHAK
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PQotLS0gU291cmNlL1dlYkNvcmUvcGFnZS9ET01UaW1lci5jcHAJKHJldmlzaW9u
IDE3NDg3MykKKysrIFNvdXJjZS9XZWJDb3JlL3BhZ2UvRE9NVGltZXIuY3BwCSh3b3JraW5nIGNv
cHkpCkBAIC0yMDcsNiArMjA3LDggQEAgdm9pZCBET01UaW1lcjo6ZmlyZWQoKQogICAgICAgICAg
ICAgdXBkYXRlVGltZXJJbnRlcnZhbElmTmVjZXNzYXJ5KCk7CiAgICAgICAgIH0KIAorICAgICAg
ICBjb250ZXh0LT5zZXRUaW1lck5lc3RpbmdMZXZlbCgwKTsKKwogICAgICAgICByZXR1cm47CiAg
ICAgfQogCg==
</data>
<flag name="review"
          id="264861"
          type_id="1"
          status="-"
          setter="darin"
    />
          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>240176</attachid>
            <date>2014-10-20 19:24:10 -0700</date>
            <delta_ts>2014-10-22 20:09:52 -0700</delta_ts>
            <desc>Fixing patch for review</desc>
            <filename>review.patch</filename>
            <type>text/plain</type>
            <size>1464</size>
            <attacher name="Horky">chenhao</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBTb3VyY2UvV2Vi
Q29yZS9DaGFuZ2VMb2cJKHJldmlzaW9uIDE3NDkxOCkKKysrIFNvdXJjZS9XZWJDb3JlL0NoYW5n
ZUxvZwkod29ya2luZyBjb3B5KQpAQCAtMSwzICsxLDIwIEBACisyMDE0LTEwLTIwICBIb3JreSBD
aGVuICA8Y2hlbmhhb0B1Y3dlYi5jb20+CisKKyAgICAgICAgRE9NVGltZXIgbmVzdGluZyBsZXZl
bCBtYXkgbm90IGltcGFjdCBlYWNoIG90aGVyCisgICAgICAgIGh0dHBzOi8vYnVncy53ZWJraXQu
b3JnL3Nob3dfYnVnLmNnaT9pZD0xMzc2MzEKKworICAgICAgICBSZXZpZXdlZCBieSBOT0JPRFkg
KE9PUFMhKS4KKworICAgICAgICBSZXNldCB0aGUgc2hhcmVkIG5lc3RpbmcgbGV2ZWwgd2hlbiBm
aW5pc2hpbmcgb25lIHJlcGVhdCBvZiBET01UaW1lci4KKyAgICAgICAgVGhlIG5lc3RpbmcgbGV2
ZWwgb2YgU2NyaXB0IEV4ZWN1dGlvbiBDb250ZXh0IHNob3VsZCBwcmVzZW50IHRoZSBudW1iZXIg
b2YgcnVubmluZyBET01UaW1lciBpbiBvbmUgZG9jdW1lbnQuIAorICAgICAgICBFdmVuIGlmIHNl
dmVyYWwgcmVwZWF0IHRpbWVycyBhcmUgYWN0aXZlLCB0aGUgbmVzdGluZyBsZXZlbCBjb3VsZCBm
aWd1cmUgb3V0IGlmIG9uZSB0aW1lciBpcyBhY3R1YWxseSBuZXN0ZWQuCisKKyAgICAgICAgTm90
IHRlc3RhYmxlLCB0aGF0IG5lZWRzIHVzZXIgb3BlcmF0aW9uIGR1cmluZyB0ZXN0aW5nLiBQbGVh
c2UgcmVmZXIgdG8gYnVnIGRlc2NyaXB0aW9uIGZvciB0ZXN0aW5nLgorCisgICAgICAgICogcGFn
ZS9ET01UaW1lci5jcHA6CisgICAgICAgIChXZWJDb3JlOjpET01UaW1lcjo6ZmlyZWQpOgorICAg
ICAgICAgICAgLSByZXNldCB0aGUgbmVzdGluZyBsZXZlbCBiZWZvcmUgZWFybHkgcmV0dXJuLgor
CiAyMDE0LTEwLTIwICBNaWNoYWVsIFNhYm9mZiAgPG1zYWJvZmZAYXBwbGUuY29tPgogCiAgICAg
ICAgIE1ha2UgcG9zdCBjaGVja2luIHN1Z2dlc3RlZCBjaGFuZ2VzIHRvIHIxNzQ4NDcKSW5kZXg6
IFNvdXJjZS9XZWJDb3JlL3BhZ2UvRE9NVGltZXIuY3BwCj09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIFNvdXJjZS9X
ZWJDb3JlL3BhZ2UvRE9NVGltZXIuY3BwCShyZXZpc2lvbiAxNzQ5MTgpCisrKyBTb3VyY2UvV2Vi
Q29yZS9wYWdlL0RPTVRpbWVyLmNwcAkod29ya2luZyBjb3B5KQpAQCAtMjA3LDYgKzIwNyw3IEBA
IHZvaWQgRE9NVGltZXI6OmZpcmVkKCkKICAgICAgICAgICAgIHVwZGF0ZVRpbWVySW50ZXJ2YWxJ
Zk5lY2Vzc2FyeSgpOwogICAgICAgICB9CiAKKyAgICAgICAgY29udGV4dC0+c2V0VGltZXJOZXN0
aW5nTGV2ZWwoMCk7CiAgICAgICAgIHJldHVybjsKICAgICB9CiAK
</data>
<flag name="review"
          id="264938"
          type_id="1"
          status="+"
          setter="darin"
    />
          </attachment>
      

    </bug>

</bugzilla>