W3C home > Mailing lists > Public > public-script-coord@w3.org > April to June 2013

Re: Future feedback

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Tue, 07 May 2013 22:05:27 -0400
Message-ID: <5189B2E7.6040606@mit.edu>
To: public-script-coord@w3.org
On 5/7/13 9:27 PM, Sean Hogan wrote:
> a. Queueing a task - that is, asynchronously executing a function

setTimeout does this, no?  If we really feel that the minimum 4ms delay 
it imposes is not OK, there have been proposals for a setImmediate, 
though I'd like to see some indication that it won't be abused like 
setTimeout has been.

> b. Isolating a task - that is, synchronously executing a function in
> such a way that errors are detected but not prevented from going to the
> console

This is also already possible, as far as I can tell, modulo a slight bug 
in Chrome.  Consider this testcase:

   function isolate(f) {
     try {
     } catch (e) {
       setTimeout(function() { throw e; }, 0);
   function g() {

The "nonexistent()" call is on line 10; the throw statement on line 6. 
The question is what goes to the console.

In Firefox, I get: ReferenceError: nonexistent is not defined @ 

In Chrome I get: Uncaught ReferenceError: nonexistent is not defined. 
whatever.html:10 (though only if the console is open before I run the 
testcase; if I open it after running the testcase, Chrome gets the line 
number wrong and claims it was on line 6).

In Opera I get:  Uncaught exception: ReferenceError: Undefined variable: 
Error thrown at line 6, column 43 in <anonymous function>() in 
     throw e;
Error initially occurred at line 10, column 4 in g() in whatever.html:

In Safari I get: ReferenceError: Can't find variable: nonexistent. 

In IE9 I get:  SCRIPT5009: 'nonexistent' is undefined
whatever.html, line 10 character 5

If synchronous reporting to the console is desired, that should also be 
possible, actually, like so:

   var reporter = document.createElement("div");
   function isolate(f) {
     try {
     } catch (e) {
       reporter.onclick = function() { throw e; };
       reporter.dispatchEvent(new Event("click"));

(with createEvent and whatnot as needed for older UAs).

Received on Wednesday, 8 May 2013 02:05:56 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:13 UTC