<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Blog-O! (Posts about debugging)</title><link>https://bwinton.github.io/weblog.latte.ca/</link><description></description><atom:link rel="self" href="https://bwinton.github.io/weblog.latte.ca/tags/debugging.xml" type="application/rss+xml"></atom:link><language>en</language><lastBuildDate>Sat, 13 Apr 2019 21:03:20 GMT</lastBuildDate><generator>Nikola (getnikola.com)</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>How to (not quite) fix a bug.</title><link>https://bwinton.github.io/weblog.latte.ca/blake/tech/thunderbird/debugging/</link><dc:creator>Blake Winton</dc:creator><description>&lt;div&gt;&lt;p&gt;I’ve run into &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=545933"&gt;a bug&lt;/a&gt;.  It’s a really annoying bug, because it prevents me from changing
folders when I try to test any of my Thunderbird changes.&lt;/p&gt;
&lt;p&gt;I tried putting dump statements everywhere, to see if I could figure out
what was going on, but they were to no avail.  Then, I thought about
looking for the error code.&lt;/p&gt;
&lt;p&gt;So the &lt;a href="http://silver.warwickcompsoc.co.uk/mozilla/misc/nserror?0x805E0006"&gt;error lookup page&lt;/a&gt; says
that the error that’s reported is:&lt;/p&gt;
&lt;pre class="code literal-block"&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;Module&lt;/span&gt;          &lt;span class="nn"&gt;Severity&lt;/span&gt;        &lt;span class="n"&gt;Number&lt;/span&gt;
&lt;span class="n"&gt;CONTENT&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;    &lt;span class="n"&gt;Failure&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;     &lt;span class="mi"&gt;6&lt;/span&gt;
&lt;/pre&gt;


&lt;p&gt;And
&lt;a href="http://scotland.proximity.on.ca/dxr/mozilla-central/content/base/public/nsContentErrors.h.html#l59"&gt;DXR&lt;/a&gt;
says that Content Error 6 is:
    NS_ERROR_CONTENT_BLOCKED&lt;/p&gt;
&lt;p&gt;Which occurs, among other places,
&lt;a href="http://mxr.mozilla.org/comm-central/source/mozilla/content/base/src/nsDocument.cpp#1129"&gt;here&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;But when I set a breakpoint there, it didn’t hit it.  So instead of
trusting mxr or dxr, I did a grep (well, an ack, but same thing), and
started setting breakpoints on a few of the hits.&lt;/p&gt;
&lt;p&gt;The one that hit my breakpoint ended up being &lt;a href="http://mxr.mozilla.org/comm-central/source/mozilla/docshell/base/nsDocShell.cpp#7643"&gt;this
one&lt;/a&gt;
which, weirdly enough, isn’t even listed in the mxr results of &lt;a href="http://mxr.mozilla.org/comm-central/ident?i=NS_ERROR_CONTENT_BLOCKED"&gt;this
search&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Now that I’m at the breakpoint, we’re halfway there, I hope.  ;)&lt;/p&gt;
&lt;p&gt;How I got there was:&lt;/p&gt;
&lt;pre class="code literal-block"&gt;&lt;span&gt;&lt;/span&gt;(gdb) bt
#0  nsDocShell::InternalLoad (…) at …/mozilla/docshell/base/nsDocShell.cpp:7643
#1  0x152d9daa in nsDocShell::LoadURI (…) at …/mozilla/docshell/base/nsDocShell.cpp:1369
#2  0x13dc7581 in nsLocation::SetURI (…) at …/mozilla/dom/base/nsLocation.cpp:316
#3  0x13dc8af3 in nsLocation::SetHrefWithBase (…) at …/mozilla/dom/base/nsLocation.cpp:595
#4  0x13dc8cf9 in nsLocation::SetHrefWithContext (…) at …/mozilla/dom/base/nsLocation.cpp:542
#5  0x13dc9120 in nsLocation::SetHref (…) at …/mozilla/dom/base/nsLocation.cpp:510
#6  0x003fa28e in NS_InvokeByIndex_P (…) at …/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_unixish_x86.cpp:179
#7  0x120f88bb in XPCWrappedNative::CallMethod (…) at …/mozilla/js/src/xpconnect/src/xpcwrappednative.cpp:2727
#8  0x1210c0c6 in XPCWrappedNative::SetAttribute (…) at xpcprivate.h:2550
#9  0x12105530 in XPC_WN_GetterSetter (…) at …/mozilla/js/src/xpconnect/src/xpcwrappednativejsops.cpp:1792
#10 0x001141a7 in js_Invoke (…) at jsinterp.cpp:1388
[…]
&lt;/pre&gt;


&lt;p&gt;And it looks like we get there because the return value of
NS_CheckContentLoadPolicy is 0x80004003, or NS_ERROR_INVALID_POINTER.&lt;/p&gt;
&lt;p&gt;Then, after dinner, I tracked it down a little further, and if you place a
breakpoint on the “\n\nAAAAAA\nrv5=%x\n” line in &lt;a href="https://bug545933.bugzilla.mozilla.org/attachment.cgi?id=427516"&gt;this patch&lt;/a&gt;, you can
see that it’s the folder = do_QueryInterface(subFolder, &amp;amp;rv); line
which is causing the failure, because the subFolder’s mRawPtr is null.&lt;/p&gt;
&lt;p&gt;But I have no idea why &lt;em&gt;that&lt;/em&gt;’s happening, so I posted what I had, and
hoped that someone else could take it and run with it.  And Bienvenu did,
and now it’s much less of a problem for me, and I can go work on other
things.&lt;/p&gt;&lt;/div&gt;</description><category>debugging</category><category>mozilla</category><category>thunderbird</category><guid>https://bwinton.github.io/weblog.latte.ca/blake/tech/thunderbird/debugging/</guid><pubDate>Thu, 11 Mar 2010 03:17:58 GMT</pubDate></item></channel></rss>