Last Comment Bug 1202918 - calling window.open synchronously triggers timeouts
: calling window.open synchronously triggers timeouts
Status: UNCONFIRMED
:
Product: Core
Classification: Components
Component: DOM: Core & HTML (show other bugs)
: 40 Branch
: x86_64 Mac OS X
-- normal (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
: Andrew Overholt [:overholt]
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2015-09-08 16:59 PDT by calvin.metcalf
Modified: 2015-09-08 19:11 PDT (History)
3 users (show)
bzbarsky: needinfo? (bugs)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
1202918.html (568 bytes, text/html)
2015-09-08 17:13 PDT, Loic
no flags Details

Description User image calvin.metcalf 2015-09-08 16:59:02 PDT
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 User image Loic 2015-09-08 17:13:30 PDT
Created attachment 8658451 [details]
1202918.html
Comment 2 User image Boris Zbarsky [:bz] (vacation Aug 14-27) 2015-09-08 19:11:01 PDT
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.

Note You need to log in before you can comment on or make changes to this bug.