title: Selenium FirefoxDriver - WebElement.click() is getting hanged if window is closing on click using Geckodriver
body: <p><strong>Meta :-</strong></p>
  
  <ul>
  <li>Selenium 3.3.1</li>
  <li>Firefox v52.0.1 (32-bit)</li>
  <li>Geckodriver v0.15.0 (32-bit)</li>
  <li>Windows 10</li>
  <li>Java v1.8_121 (32-bit)</li>
  </ul>
  
  <p>I have prepared two <code>.html</code> to reproduce this issue.</p>
  
  <ul>
  <li><p>mainWindow.html</p>
  
  <pre><code>&lt;title&gt;Main Window&lt;/title&gt;
  &lt;input type="submit" value ="Open Window" id="open" onclick="openWindow()"&gt;
  
  &lt;script&gt;
  function openWindow() 
  {
   window.open("newWindow.html", "", "width=500,height=500");
  }
  </code></pre>
  
  <p></p></li>
  <li><p>newWindow.html</p>
  
  <pre><code>&lt;title&gt;New Window&lt;/title&gt;
  &lt;input type="submit" value="Close Window" id="close" onclick="closeWindow()"&gt;
  
  &lt;script&gt;
  function closeWindow() 
  {
   window.close();
  }
  &lt;/script&gt;
  </code></pre></li>
  </ul>
  
  <p><strong>Selenium steps to reproduced :-</strong></p>
  
  <pre><code>System.setProperty("webdriver.gecko.driver", "geckodriverWin32-0.15.0.exe");
  
  WebDriver driver = new FirefoxDriver();
  driver.get("file:///mainWindow.html");
  driver.manage().window().maximize();
  
  driver.findElement(By.id("open")).click(); //This works fine
  
  String curWindowHandle = driver.getWindowHandle();
  Set&lt;String&gt; winHandles = driver.getWindowHandles();
  
  for(String win : winHandles) {
      if (!curWindowHandle.toString().equals(win)) {
           driver.switchTo().window(win);
      }
  }
  
  driver.findElement(By.id("close")).click(); //This click is getting hanged in infinity loop and my test case is not responded. No next line executed after this line.
  </code></pre>
  
  <p><strong>Question :-</strong>
  Why <a href="https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/WebElement.html#click--" rel="nofollow noreferrer"><code>WebElement.click()</code></a> is getting hanged in that case if click event is going to close current window in <code>firefox</code> using <code>FirefoxDriver</code> while it's working fine on <code>chrome</code> using <code>ChromeDriver</code>.</p>
  
  <p><strong>Note:-</strong> If I'm using last line as :-</p>
  
  <pre><code>((JavascriptExecutor)driver).executeScript("arguments[0].click()", driver.findElement(By.id("close")));
  </code></pre>
  
  <p>After performing click this line is also getting hanged.</p>
  
  <p>Please anyone suggest me How to solve this issue?</p>