<?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: Evaluating JavaScript in an Embedded XULRunner/Gecko Window</title>
	<atom:link href="http://chadaustin.me/2009/02/evaluating-javascript-in-an-embedded-xulrunnergecko-window/feed/" rel="self" type="application/rss+xml" />
	<link>http://chadaustin.me/2009/02/evaluating-javascript-in-an-embedded-xulrunnergecko-window/</link>
	<description></description>
	<lastBuildDate>Sun, 22 Jan 2012 21:02:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: aegisknight</title>
		<link>http://chadaustin.me/2009/02/evaluating-javascript-in-an-embedded-xulrunnergecko-window/comment-page-1/#comment-4507</link>
		<dc:creator>aegisknight</dc:creator>
		<pubDate>Wed, 18 Feb 2009 21:42:47 +0000</pubDate>
		<guid isPermaLink="false">http://aegisknight.org/new/2009/02/17/evaluating-javascript-in-an-embedded-xulrunnergecko-window/#comment-4507</guid>
		<description>&lt;p&gt;More magic:&lt;/p&gt;

&lt;pre&gt;
// This is important: we need to ensure the &#039;inner&#039; DOM window is created.
// If we don&#039;t, it is initialized while XPConnect is walking the outer scope
// chain, which reinitializes the JS context.  This causes JS_SetOptions to be
// called in the middle of execution, disabling our DONT_REPORT_UNCAUGHT flag,
// which prevents exceptions from propagating out.
nsCOMPtr&lt;nsIDOMWindow&gt; domWindow;
rv = webBrowser-&gt;GetContentDOMWindow(getter_AddRefs(domWindow));
if (NS_FAILED(rv)) {
    throw GeckoError(&quot;Failed to get content DOM window&quot;);
}
nsCOMPtr&lt;nsPIDOMWindow&gt; outer(do_QueryInterface(domWindow));
nsCOMPtr&lt;nsPIDOMWindow&gt;(outer-&gt;EnsureInnerWindow());
&lt;/pre&gt;

&lt;p&gt;Run this code before calling JS_SetOptions.&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>More magic:</p>
<pre>
// This is important: we need to ensure the 'inner' DOM window is created.
// If we don't, it is initialized while XPConnect is walking the outer scope
// chain, which reinitializes the JS context.  This causes JS_SetOptions to be
// called in the middle of execution, disabling our DONT_REPORT_UNCAUGHT flag,
// which prevents exceptions from propagating out.
nsCOMPtr&lt;nsIDOMWindow&gt; domWindow;
rv = webBrowser-&gt;GetContentDOMWindow(getter_AddRefs(domWindow));
if (NS_FAILED(rv)) {
    throw GeckoError("Failed to get content DOM window");
}
nsCOMPtr&lt;nsPIDOMWindow&gt; outer(do_QueryInterface(domWindow));
nsCOMPtr&lt;nsPIDOMWindow&gt;(outer-&gt;EnsureInnerWindow());
</pre>
<p>Run this code before calling JS_SetOptions.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

