- From: Ian Hickson <ian@hixie.ch>
- Date: Mon, 7 Jan 2013 19:34:13 +0000 (UTC)
- To: Boris Zbarsky <bzbarsky@MIT.EDU>, Simon Pieters <simonp@opera.com>, "olli@pettay.fi" <olli@pettay.fi>
- Cc: whatwg <whatwg@lists.whatwg.org>
On Mon, 12 Nov 2012, Boris Zbarsky wrote: > > Consider the attached testcase, which calls setTimeout on a window and > passes in a function from a different window. > <iframe></iframe> > <script> > window.onload = function() { > window.onerror = function(msg, file, line) { > alert('Parent handler: ' + msg + " " + file + " " + line); > } > frames[0].onerror = function(msg, file, line) { > alert('Subframe handler: ' + msg + " " + file + " " + line); > } > frames[0].setTimeout(function() { throw "oops"; }, 100); > } > </script> > When this function is then called, it throws. > > Gecko, WebKit, and Presto all seem to trigger the onerror handler of the > window setTimeout was called on in this case. > > Per spec, section 7.1.3.5.1, we have: > > Whenever an uncaught runtime script error occurs in one of the > scripts associated with a Document, the user agent must report > the error at the URL of the resource containing the script (as > established when the script was created), with the problematic > position (line number and column number) in that resource, in > the script's origin, using the onerror event handler of the > script's global object. > > But the global object is the window the function came from. So the spec > doesn't seem to match any of the above three rendering engines. Does it > match Trident? On Mon, 12 Nov 2012, Boris Zbarsky wrote: > > Looks like IE, in all the modes I can test, does what the spec says > right now. > > I'll be changing Gecko to align with IE and the spec (and, arguably, > sanity) here. Ok. I've left the spec as is here. Please do let me know if this is the wrong thing to do after all; I don't have any data on what is the more compatible behaviour and this stuff is subtle enough that I don't think sanity is necessarily unambiguously on the side of one answer or another. -- Ian Hickson U+1047E )\._.,--....,'``. fL http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,. Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Received on Monday, 7 January 2013 19:34:37 UTC