<?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>276709</bug_id>
          
          <creation_ts>2024-07-17 01:15:25 -0700</creation_ts>
          <short_desc>ceac.state.gov - failing and automatically exit the user</short_desc>
          <delta_ts>2024-07-19 08:44:35 -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>WebKit Misc.</component>
          <version>Other</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=260938</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=267569</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=267449</see_also>
          <bug_file_loc>https://ceac.state.gov/</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>193478</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Karl Dubost">karlcow</reporter>
          <assigned_to name="Karl Dubost">karlcow</assigned_to>
          <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2046674</commentid>
    <comment_count>0</comment_count>
    <who name="Karl Dubost">karlcow</who>
    <bug_when>2024-07-17 01:15:25 -0700</bug_when>
    <thetext>There is a long history with this site. 
see previously https://github.com/WebKit/WebKit/commit/0b543cc9ff31a50857a570a65f9d33f405b30a15
and https://github.com/WebKit/WebKit/pull/17329/files


The hypothesis this is still broken is because it doesn&apos;t try to match `.ceac.state.gov`, just `ceac.state.gov`

To note that the real issue is about Bug 267449


which manifests itself on this site by


There is a beforeunload

if (window.addEventListener) {
    window.addEventListener(&quot;beforeunload&quot;, ClearSession, false);
} else if (window.attachEvent) {
    window.attachEvent(&quot;onbeforeunload&quot;, ClearSession)
}

It fires a ClearSession.

Which triggers

else if (document.location.pathname.indexOf(&quot;Default.aspx&quot;) &lt; 0 &amp;&amp;
                typeof document.activeElement != &quot;undefined&quot; &amp;&amp;
            document.activeElement.toString().indexOf(&quot;HTMLBodyElement&quot;) &gt; 0 ||
            document.activeElement.toString().indexOf(&quot;HTMLInputElement&quot;) &gt; 0) {
        validNavigation = false;
    }

And triggers:

this.ExitClearSession()

Which triggers the e.preventDefault()

    if (validNavigation == false &amp;&amp;
             e != undefined) {
        if (ieMode == &quot;True&quot;) {
            e.returnValue = undefined;
        } else {
            e.preventDefault();
        }

And when the return is happening at the end of ClearSession it opens the alert. 



Firefox in the clear session is 

    } else if ((typeof document.activeElement != &quot;undefined&quot; &amp;&amp;
                document.activeElement != &quot;object&quot; &amp;&amp;
                typeof document.activeElement.name != &quot;undefined&quot;) &amp;&amp; (
                document.activeElement.toString().indexOf(&quot;aspx&quot;) &gt; 0 || //for the left menu exclusion                
                document.activeElement.name.indexOf(&quot;btn&quot;) &gt; 0 ||  //check for button click
                document.activeElement.name.indexOf(&quot;Button&quot;) &gt; 0 ||
                document.activeElement.type == &quot;button&quot;) ||
                document.activeElement.id.indexOf(&quot;cbx&quot;) &gt; 0 ||
                document.activeElement.id.indexOf(&quot;Radio&quot;) &gt; 0 ||
                document.activeElement.id.indexOf(&quot;radio&quot;) &gt; 0 ||
                document.activeElement.id.indexOf(&quot;chkbx&quot;) &gt; 0 ||
                document.activeElement.id.indexOf(&quot;Button&quot;) &gt; 0 ||
                document.activeElement.id.indexOf(&quot;button&quot;) &gt; 0) { // for button
        validNavigation = true;


Firefox: document.activeElement is input
Safari: document.activeElement is body

This will decide if validNavigation is true or false
And then will make WebKit fail for the next step.

Let’s make a test

https://codepen.io/webcompat/pen/zYbKgGd

&lt;input type=&quot;checkbox&quot; id=&quot;check&quot; onclick=&quot;logme(this)&quot;&gt;
&lt;div id=&quot;log&quot;&gt;&lt;/div&gt;

With 

var check = document.querySelector(&quot;#check&quot;);
var log = document.querySelector(&quot;#log&quot;);
function logme(element) {
  log.textContent += document.activeElement;
}

log.textContent = check;

* Firefox: HTMLInputElement
* Chrome: HTMLInputElement
* Safari: HTMLBodyElement


but there other ways to fail too.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2046675</commentid>
    <comment_count>1</comment_count>
    <who name="Karl Dubost">karlcow</who>
    <bug_when>2024-07-17 01:16:05 -0700</bug_when>
    <thetext>Let&apos;s try first to add again .ceac.state.gov</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2046676</commentid>
    <comment_count>2</comment_count>
    <who name="Karl Dubost">karlcow</who>
    <bug_when>2024-07-17 01:17:14 -0700</bug_when>
    <thetext>Note also that an outreach effort has been tried for a couple of years without success.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2046677</commentid>
    <comment_count>3</comment_count>
    <who name="Karl Dubost">karlcow</who>
    <bug_when>2024-07-17 01:24:10 -0700</bug_when>
    <thetext>&lt;rdar://127700271&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2046681</commentid>
    <comment_count>4</comment_count>
    <who name="Karl Dubost">karlcow</who>
    <bug_when>2024-07-17 01:45:47 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/30900</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2046762</commentid>
    <comment_count>5</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2024-07-17 11:38:11 -0700</bug_when>
    <thetext>Committed 281059@main (52ff8f16da2a): &lt;https://commits.webkit.org/281059@main&gt;

Reviewed commits have been landed. Closing PR #30900 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2047190</commentid>
    <comment_count>6</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2024-07-19 08:44:35 -0700</bug_when>
    <thetext>Committed 280938.64@integration/ci/127700271_52ff8f16da_safari-7619-branch (f63da3515898): &lt;https://commits.webkit.org/280938.64@integration/ci/127700271_52ff8f16da_safari-7619-branch&gt;

Reviewed commits have been landed. Closing PR #1420 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>