Skip to content

Instantly share code, notes, and snippets.

@makotom
Last active December 3, 2019 12:39
Show Gist options
  • Save makotom/f45e83a9f2bd0512dca8218a3e2a24a4 to your computer and use it in GitHub Desktop.
Save makotom/f45e83a9f2bd0512dca8218a3e2a24a4 to your computer and use it in GitHub Desktop.
Pages will not be loaded in child windows in Firefox Preview build #13031728 and #13371033
<!doctype html>
<html lang="en">
<meta charset="UTF-8">
<title>Manipulating child window</title>
<a href="https://example.com/" target="tc-20191203-2-child">Click this hyperlink to open <code>example.com</code> in a new window</a>
<script>
{
let flipFlop = false;
document.querySelector('a').addEventListener('click', (evt) => {
window.open('', 'tc-20191203-2-child', 'width=600,height=400');
if (!flipFlop) {
evt.preventDefault();
window.setTimeout(() => {
evt.target.click();
});
}
flipFlop = !flipFlop;
});
}
</script>
<!doctype html>
<html lang="en">
<meta charset="UTF-8">
<title>Manipulating child window</title>
<a href="https://example.com/" target="tc-20191203-child">Click this hyperlink to open <code>example.com</code> in a new window</a>
<script>
document.querySelector('a').addEventListener('click', () => {
window.open('', 'tc-20191203-child', 'width=600,height=400');
});
</script>
@makotom
Copy link
Author

makotom commented Dec 3, 2019

These test cases are inteded to demonstrate that, in Firefox Preview build #13031728, the specified page in a hyperlink won't be loaded in its target window if the target window is artificially opened along with the navigation event.

For instance, try the following steps with tc-20191203.html (or with https://makotom.net/tc-20191203.html instead):

  1. Open the page.
  2. Click the hyperlink in the page.

Expected result is:
https://example.com/ is shown in a new window (tab).

Actual result with the current Firefox Preview is:
A blank page is shown.

I also found out that, if there are another "ticks" between window.open and actual navigation, this issue will not appear.
See tc-20191203-2.html and see what are different from the main test case tc-20191203.html by comparing codes and their behaviour with the repro steps described above.

@makotom
Copy link
Author

makotom commented Dec 3, 2019

I confirmed the same phenomena with Nightly 191203 10:27 (Build #13371033)

@makotom
Copy link
Author

makotom commented Dec 3, 2019

I also want to note that, due to this behaviour (which is neither confirmed with old Firefox Mobile nor Chrome), some buttons (e.g. a button to open a debit card statement) in the online banking website of MUFG Bank will not work in build #13031728.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment