calling window.open synchronously triggers timeouts

UNCONFIRMED
Unassigned

Status

()

Core
DOM: Core & HTML
UNCONFIRMED
2 years ago
2 years ago

People

(Reporter: calvin.metcalf, Unassigned, NeedInfo)

Tracking

40 Branch
x86_64
Mac OS X
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

568 bytes, text/html
Details
(Reporter)

Description

2 years ago
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36

Steps to reproduce:

opening a window causes timeouts to fire synchronously

the following script (gist: https://gist.github.com/calvinmetcalf/f29eae737d52ae8fd54a) when executed on a page that allows popups and doesn't have the window open (from a previous try):

```
var called = false;
setTimeout(function (){
  console.log('should be true', called);
});
console.log('opening');

window.open('http://example.com/some/url', 'title', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=100, height=200, top=20, left=20');

console.log('opened');
called = true;
```



Actual results:

the timeout is called synchronously when window.open is called leading to the messages


prints to console 

    opening

    should be true false

    opened

being printed


Expected results:

the timeout should be called asynchronously after the code that changes the variable and print:

    opening

    opened

    should be true true

Comment 1

2 years ago
Created attachment 8658451 [details]
1202918.html

Updated

2 years ago
Component: Untriaged → DOM: Core & HTML
Product: Firefox → Core
(Reporter)

Updated

2 years ago
OS: Unspecified → Mac OS X
Hardware: Unspecified → x86_64
Yeah, window.open spins the event loop when it has to bring up an actual toplevel window.  We should probably suppress events on the caller for the duration or something.
Flags: needinfo?(bugs)
You need to log in before you can comment on or make changes to this bug.