<?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>210512</bug_id>
          
          <creation_ts>2020-04-14 13:16:18 -0700</creation_ts>
          <short_desc>Storage events are fired for the same tab</short_desc>
          <delta_ts>2020-11-23 10:02:26 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>New Bugs</component>
          <version>Safari 13</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>211503</dup_id>
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=211503</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Merih Akar">merihakar</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>bdrasin</cc>
    
    <cc>beidson</cc>
    
    <cc>cdumez</cc>
    
    <cc>jimmy</cc>
    
    <cc>rkit.ru</cc>
    
    <cc>sihui_liu</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1641518</commentid>
    <comment_count>0</comment_count>
      <attachid>396456</attachid>
    <who name="Merih Akar">merihakar</who>
    <bug_when>2020-04-14 13:16:18 -0700</bug_when>
    <thetext>Created attachment 396456
testcase

As per specification storage events should be fired for the tabs other than the tab that&apos;s changing the storage area, however it&apos;s also fired on the same tab in Safari.

Note that the issue happens when the testcase file is served via a server, doesn&apos;t happen when you open it directly in the browser.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1641624</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2020-04-14 17:47:07 -0700</bug_when>
    <thetext>&lt;rdar://problem/61799443&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1709846</commentid>
    <comment_count>2</comment_count>
    <who name="Jimmy Thomsen">jimmy</who>
    <bug_when>2020-11-22 13:26:19 -0800</bug_when>
    <thetext>I can confirm this with Safari 13.1 (14609.1.20.111.8) on macOS 10.14.6 (18G4032), as well as with Safari on iOS (iPhone) 13.7.

Work around: Only execute OnStorage logic if document is not focused:

if (!document.hasFocus())
{
    // Execute OnStorage logic - tab does not have focus
}

Notice though that hasFocus() will return false in the active tab if Developer Tools is open and has focus.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1709847</commentid>
    <comment_count>3</comment_count>
    <who name="Jimmy Thomsen">jimmy</who>
    <bug_when>2020-11-22 13:35:32 -0800</bug_when>
    <thetext>Work around suggestion only makes sense if OnStorage events are triggered by user interaction, of course. Also, it seems Safari Developer Tools does not steal focus from the document - Chrome Developer Tools does.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1709849</commentid>
    <comment_count>4</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2020-11-22 16:17:38 -0800</bug_when>
    <thetext>This rings a bell and I thought I had fixed this. Are you able to try in Safari Technology Preview?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1709850</commentid>
    <comment_count>5</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2020-11-22 16:21:34 -0800</bug_when>
    <thetext>This looks a lot like</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1709851</commentid>
    <comment_count>6</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2020-11-22 16:22:08 -0800</bug_when>
    <thetext>(In reply to Chris Dumez from comment #5)
&gt; This looks a lot like

This looks a lot like https://bugs.webkit.org/show_bug.cgi?id=211503 which got fixed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1709896</commentid>
    <comment_count>7</comment_count>
    <who name="Jimmy Thomsen">jimmy</who>
    <bug_when>2020-11-23 08:21:11 -0800</bug_when>
    <thetext>(In reply to Chris Dumez from comment #6)
&gt; (In reply to Chris Dumez from comment #5)
&gt; &gt; This looks a lot like
&gt; 
&gt; This looks a lot like https://bugs.webkit.org/show_bug.cgi?id=211503 which
&gt; got fixed.

Chris Dumez: It sure does sound like the same thing. Safari Version 14.0.1 (14610.2.11.51.9) works as expected. I can no longer reproduce the problem with localStorage. I think its safe to close this bug report, although I&apos;m not the one who initially reported the bug - I just confirmed it.

 - Thank you

Jimmy</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1709912</commentid>
    <comment_count>8</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2020-11-23 10:02:26 -0800</bug_when>
    <thetext>(In reply to Jimmy Thomsen from comment #7)
&gt; (In reply to Chris Dumez from comment #6)
&gt; &gt; (In reply to Chris Dumez from comment #5)
&gt; &gt; &gt; This looks a lot like
&gt; &gt; 
&gt; &gt; This looks a lot like https://bugs.webkit.org/show_bug.cgi?id=211503 which
&gt; &gt; got fixed.
&gt; 
&gt; Chris Dumez: It sure does sound like the same thing. Safari Version 14.0.1
&gt; (14610.2.11.51.9) works as expected. I can no longer reproduce the problem
&gt; with localStorage. I think its safe to close this bug report, although I&apos;m
&gt; not the one who initially reported the bug - I just confirmed it.
&gt; 
&gt;  - Thank you
&gt; 
&gt; Jimmy

Awesome. Thank you for confirming!

*** This bug has been marked as a duplicate of bug 211503 ***</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>396456</attachid>
            <date>2020-04-14 13:16:18 -0700</date>
            <delta_ts>2020-04-14 13:16:18 -0700</delta_ts>
            <desc>testcase</desc>
            <filename>storage_bug.html</filename>
            <type>text/html</type>
            <size>622</size>
            <attacher name="Merih Akar">merihakar</attacher>
            
              <data encoding="base64">PCFkb2N0eXBlIGh0bWw+CjxodG1sPgogICAgPGhlYWQ+CiAgICAgICAgPG1ldGEgY2hhcnNldD0i
dXRmLTgiPgogICAgICAgIDxzY3JpcHQ+CiAgICAgICAgICAgIHdpbmRvdy5hZGRFdmVudExpc3Rl
bmVyKCJsb2FkIiwgKCkgPT4gewogICAgICAgICAgICAgICAgd2luZG93LmFkZEV2ZW50TGlzdGVu
ZXIoInN0b3JhZ2UiLCBldiA9PiB7CiAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coZXYu
c3RvcmFnZUFyZWEuZ2V0SXRlbShldi5rZXkpKTsKICAgICAgICAgICAgICAgICAgICBldi5zdG9y
YWdlQXJlYS5yZW1vdmVJdGVtKGV2LmtleSkKICAgICAgICAgICAgICAgIH0pOwoKICAgICAgICAg
ICAgICAgIGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoImJ1dHRvbiIpLmFkZEV2ZW50TGlzdGVuZXIo
ImNsaWNrIiwgKCkgPT4gewogICAgICAgICAgICAgICAgICAgIGxvY2FsU3RvcmFnZS5zZXRJdGVt
KCJrZXkiLCAidmFsdWUiKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9KTsKICAg
ICAgICA8L3NjcmlwdD4KICAgIDwvaGVhZD4KICAgIDxib2R5PgogICAgICAgIDxidXR0b24gdHlw
ZT0iYnV0dG9uIj5TZXQgc3RvcmFnZTwvYnV0dG9uPgogICAgPC9ib2R5Pgo8L2h0bWw+Cg==
</data>

          </attachment>
      

    </bug>

</bugzilla>