<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Exceptional Circumstances</title>
	<atom:link href="http://blog.mozilla.org/tglek/2007/12/05/exceptional-circumstances/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.mozilla.org/tglek/2007/12/05/exceptional-circumstances/</link>
	<description>Taras&#039; blog on Snappy, Startup, Telemetry and other Firefox peroformance matters</description>
	<lastBuildDate>Tue, 27 Nov 2012 16:50:13 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
	<item>
		<title>By: tglek</title>
		<link>http://blog.mozilla.org/tglek/2007/12/05/exceptional-circumstances/comment-page-1/#comment-8586</link>
		<dc:creator>tglek</dc:creator>
		<pubDate>Wed, 12 Dec 2007 00:14:37 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.org/tglek/2007/12/05/exceptional-circumstances/#comment-8586</guid>
		<description><![CDATA[Jonas,
If you look at the sample patch attached to today&#039;s blog entry I already flag cases that ignore errors.]]></description>
		<content:encoded><![CDATA[<p>Jonas,<br />
If you look at the sample patch attached to today&#8217;s blog entry I already flag cases that ignore errors.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonas Sicking</title>
		<link>http://blog.mozilla.org/tglek/2007/12/05/exceptional-circumstances/comment-page-1/#comment-8585</link>
		<dc:creator>Jonas Sicking</dc:creator>
		<pubDate>Wed, 12 Dec 2007 00:10:10 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.org/tglek/2007/12/05/exceptional-circumstances/#comment-8585</guid>
		<description><![CDATA[I think we need to do a lot of massaging on the C++ code first, in order to make the final pass over the code to turn on exceptions less daunting.

First of Alex mention one problem, non-NS_OK success values. We need to abolish these from the tree. I suspect this will have to be done manually since the cure will vary. There are also not that many of these so it shouldn&#039;t be too hard to do by hand.

The next thing is to try to reduce the amount of code we currently have with calling patterns like these:

int foo = 0;
CallXPIDLFunc(&amp;foo);
if (foo &gt; 4) {...

I.e. code that ignores the potential error code from an XPIDL call. These can be one of three things:

1. In many many cases the called function will never throw (or will only throw in out-of-memory situations).
2. Most other cases these callsites are just plain wrong and does need to be fixed to forward the error.
3. In a rare few cases the code is intentionally ignoring the error and basically does an implicit try/catch around the call.

If we could automatically eliminate 1 using automated tools we would have a much clearer picture of how to handle 2 vs 3 I think.

We could fix 1 by other using rocs suggestion, or by saying that non-throwing functions implemented in js should have any exceptions logged and ignored. Or something like it.

One way to separate 2 vs. 3 once 1 is taken care of would be to automatically write a patch that turns ignored return values into try/catches, and then we can manually go through the patch and remove the try/catches for the callers that fall into 2.]]></description>
		<content:encoded><![CDATA[<p>I think we need to do a lot of massaging on the C++ code first, in order to make the final pass over the code to turn on exceptions less daunting.</p>
<p>First of Alex mention one problem, non-NS_OK success values. We need to abolish these from the tree. I suspect this will have to be done manually since the cure will vary. There are also not that many of these so it shouldn&#8217;t be too hard to do by hand.</p>
<p>The next thing is to try to reduce the amount of code we currently have with calling patterns like these:</p>
<p>int foo = 0;<br />
CallXPIDLFunc(&amp;foo);<br />
if (foo &gt; 4) {&#8230;</p>
<p>I.e. code that ignores the potential error code from an XPIDL call. These can be one of three things:</p>
<p>1. In many many cases the called function will never throw (or will only throw in out-of-memory situations).<br />
2. Most other cases these callsites are just plain wrong and does need to be fixed to forward the error.<br />
3. In a rare few cases the code is intentionally ignoring the error and basically does an implicit try/catch around the call.</p>
<p>If we could automatically eliminate 1 using automated tools we would have a much clearer picture of how to handle 2 vs 3 I think.</p>
<p>We could fix 1 by other using rocs suggestion, or by saying that non-throwing functions implemented in js should have any exceptions logged and ignored. Or something like it.</p>
<p>One way to separate 2 vs. 3 once 1 is taken care of would be to automatically write a patch that turns ignored return values into try/catches, and then we can manually go through the patch and remove the try/catches for the callers that fall into 2.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jmdesp</title>
		<link>http://blog.mozilla.org/tglek/2007/12/05/exceptional-circumstances/comment-page-1/#comment-8514</link>
		<dc:creator>jmdesp</dc:creator>
		<pubDate>Mon, 10 Dec 2007 17:16:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.org/tglek/2007/12/05/exceptional-circumstances/#comment-8514</guid>
		<description><![CDATA[I just wanted to point one thing about the decision to use exceptions in C++ : If you want to use exceptions, then all the involved code *must* be perfectly correct RAII.

That&#039;s the one sentence lesson to get from the &quot;Cleaner, more elegant, and harder to recognize&quot; exception rant, http://blogs.msdn.com/oldnewthing/archive/2005/01/14/352949.aspx , only proper RAII code continues to work properly and does not unexpectedly break when you introduce exceptions.

Note that RAII code is a good thing in itself, converting the codebase to it would be a great thing, and the fact it makes exception &quot;work&quot; is only an added bonus.]]></description>
		<content:encoded><![CDATA[<p>I just wanted to point one thing about the decision to use exceptions in C++ : If you want to use exceptions, then all the involved code *must* be perfectly correct RAII.</p>
<p>That&#8217;s the one sentence lesson to get from the &#8220;Cleaner, more elegant, and harder to recognize&#8221; exception rant, <a href="http://blogs.msdn.com/oldnewthing/archive/2005/01/14/352949.aspx" rel="nofollow">http://blogs.msdn.com/oldnewthing/archive/2005/01/14/352949.aspx</a> , only proper RAII code continues to work properly and does not unexpectedly break when you introduce exceptions.</p>
<p>Note that RAII code is a good thing in itself, converting the codebase to it would be a great thing, and the fact it makes exception &#8220;work&#8221; is only an added bonus.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brendan Eich</title>
		<link>http://blog.mozilla.org/tglek/2007/12/05/exceptional-circumstances/comment-page-1/#comment-8296</link>
		<dc:creator>Brendan Eich</dc:creator>
		<pubDate>Fri, 07 Dec 2007 01:08:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.org/tglek/2007/12/05/exceptional-circumstances/#comment-8296</guid>
		<description><![CDATA[My comment 4 was geared at decoupling outparamdel work from exception work, in case it wasn&#039;t clear. If JS exceptions throw as C++ and vice versa, cool. If we could outparamdel faster before exceptionizing that would be good too. The pending JS exception is kept in the JSContext, essentially part of thread-local storage. No need to pass it up the stack as a return value, but we do need a failure return value that is not overloaded (null, -1, etc.).

Not sure this is worth it, but I thought I would mention it (again).

/be]]></description>
		<content:encoded><![CDATA[<p>My comment 4 was geared at decoupling outparamdel work from exception work, in case it wasn&#8217;t clear. If JS exceptions throw as C++ and vice versa, cool. If we could outparamdel faster before exceptionizing that would be good too. The pending JS exception is kept in the JSContext, essentially part of thread-local storage. No need to pass it up the stack as a return value, but we do need a failure return value that is not overloaded (null, -1, etc.).</p>
<p>Not sure this is worth it, but I thought I would mention it (again).</p>
<p>/be</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brendan Eich</title>
		<link>http://blog.mozilla.org/tglek/2007/12/05/exceptional-circumstances/comment-page-1/#comment-8295</link>
		<dc:creator>Brendan Eich</dc:creator>
		<pubDate>Fri, 07 Dec 2007 01:00:24 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.org/tglek/2007/12/05/exceptional-circumstances/#comment-8295</guid>
		<description><![CDATA[Although as I mentioned on a recent call, there is huge value in an analysis + a better scheme that avoids JS exceptions left pending when C++ suppresses (rightly or wrongly) a failure result by returning ok.

/be]]></description>
		<content:encoded><![CDATA[<p>Although as I mentioned on a recent call, there is huge value in an analysis + a better scheme that avoids JS exceptions left pending when C++ suppresses (rightly or wrongly) a failure result by returning ok.</p>
<p>/be</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brendan Eich</title>
		<link>http://blog.mozilla.org/tglek/2007/12/05/exceptional-circumstances/comment-page-1/#comment-8294</link>
		<dc:creator>Brendan Eich</dc:creator>
		<pubDate>Fri, 07 Dec 2007 00:59:28 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.org/tglek/2007/12/05/exceptional-circumstances/#comment-8294</guid>
		<description><![CDATA[Taras: there&#039;s close to zero value in the JS exception that&#039;s pending in a cx being mapped to some non-OK nsresult. Please do not consider XPConnect or the JS binding to XPIDL sacrosanct. Break it in order to outparamdel and exception-ize!

Mark: Mozilla 2 breaks binary compat as well as source API compat.

/be]]></description>
		<content:encoded><![CDATA[<p>Taras: there&#8217;s close to zero value in the JS exception that&#8217;s pending in a cx being mapped to some non-OK nsresult. Please do not consider XPConnect or the JS binding to XPIDL sacrosanct. Break it in order to outparamdel and exception-ize!</p>
<p>Mark: Mozilla 2 breaks binary compat as well as source API compat.</p>
<p>/be</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Banner (standard8)</title>
		<link>http://blog.mozilla.org/tglek/2007/12/05/exceptional-circumstances/comment-page-1/#comment-8272</link>
		<dc:creator>Mark Banner (standard8)</dc:creator>
		<pubDate>Thu, 06 Dec 2007 19:32:25 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.org/tglek/2007/12/05/exceptional-circumstances/#comment-8272</guid>
		<description><![CDATA[Would this mean we could loose the binary compatibility that Benjamin&#039;s been muttering about?

If so, I don&#039;t think we can accept this unless we are guaranteed to have a good c/c++ bridge to external libraries accessible from js.]]></description>
		<content:encoded><![CDATA[<p>Would this mean we could loose the binary compatibility that Benjamin&#8217;s been muttering about?</p>
<p>If so, I don&#8217;t think we can accept this unless we are guaranteed to have a good c/c++ bridge to external libraries accessible from js.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex Vincent</title>
		<link>http://blog.mozilla.org/tglek/2007/12/05/exceptional-circumstances/comment-page-1/#comment-8213</link>
		<dc:creator>Alex Vincent</dc:creator>
		<pubDate>Thu, 06 Dec 2007 03:22:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.org/tglek/2007/12/05/exceptional-circumstances/#comment-8213</guid>
		<description><![CDATA[s/thrower/dartboard/

Another item I should point out is XPCOM success codes other than NS_OK, like NS_SUCCESS_LOSS_OF_INSIGNIFICANT_DATA.  Your rewriting could have two levels of problems with that.  In C++, would you really want to throw a success code?  In JS, we use Components.returnCode (well, we should, anyway) - how would that fit into the revised XPCOM model, going from JS to C++?

Also, could I bribe you into forcing JS components to use nsIException and/or Components.Exception more?]]></description>
		<content:encoded><![CDATA[<p>s/thrower/dartboard/</p>
<p>Another item I should point out is XPCOM success codes other than NS_OK, like NS_SUCCESS_LOSS_OF_INSIGNIFICANT_DATA.  Your rewriting could have two levels of problems with that.  In C++, would you really want to throw a success code?  In JS, we use Components.returnCode (well, we should, anyway) &#8211; how would that fit into the revised XPCOM model, going from JS to C++?</p>
<p>Also, could I bribe you into forcing JS components to use nsIException and/or Components.Exception more?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert O'Callahan</title>
		<link>http://blog.mozilla.org/tglek/2007/12/05/exceptional-circumstances/comment-page-1/#comment-8196</link>
		<dc:creator>Robert O'Callahan</dc:creator>
		<pubDate>Wed, 05 Dec 2007 22:42:59 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.org/tglek/2007/12/05/exceptional-circumstances/#comment-8196</guid>
		<description><![CDATA[&gt; Unfortunately, most functions in Mozilla are
&gt; declared in XPIDL interfaces.

Fortunately, this is an overstatement.

I think we need to mark a whole lot of interfaces as &quot;script-callable, but not implementable by script&quot;. That would make address a lot of your problems right away and would also solve some other problems. I need to blog about this.]]></description>
		<content:encoded><![CDATA[<p>&gt; Unfortunately, most functions in Mozilla are<br />
&gt; declared in XPIDL interfaces.</p>
<p>Fortunately, this is an overstatement.</p>
<p>I think we need to mark a whole lot of interfaces as &#8220;script-callable, but not implementable by script&#8221;. That would make address a lot of your problems right away and would also solve some other problems. I need to blog about this.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
