Blog-o! Notes from latte.ca

Sun, 25 Mar 2012

I think what I want is pretty simple, or at least, reasonably common. I’m just looking for a couple of programs.

An SMTP server which will accept mail for the accounts at latte.ca, and deliver it to a Maildir of my choosing, and let me send mail through it if, and only if, I’ve logged in with the password to that account. (Being able to define a few aliases would also be nice.)

And an IMAP server which will expose the previously-mentioned Maildir, after I’ve logged in with the password to that account.

And yet, every time I try to set that up, something completely falls over for no particularly understandable reason, and I end up wasting an afternoon (or more) of my life. I had hoped this time would be different, since I decided not to install and configure everything myself, but instead bought a copy of OS X Lion Server which was supposed to do all the hard work for me. I’m not going to enumerate all the problems I ran into, but I will say that I still haven’t managed to get there. I’m just done for tonight.

Anyways, if anyone reading this has a working setup that meets the requirements (and the added requirement of needing to use Dovecot and Postfix, since those are what’s installed), I would love to get a copy of their config files. And in the meantime, I might seriously look into getting a refund for Lion Server, given how badly it’s failed me. :P

[Posted at 21:52 by Blake Winton] link
Tue, 06 Mar 2012

A few people recently asked me about building Thunderbird on the latest version of Mac OS X. Since I have it working, and to give myself a place to point to the next time they ask, I figured it would be a good idea to blog about it.

So, here’s my .mozconfig.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Debug .mozconfig
mk_add_options MOZ_MAKE_FLAGS=-j4
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../objdir-`basename \`pwd\``-`hg branch`
# mk_add_options AUTOCONF=autoconf213
ac_add_options --enable-application=mail
ac_add_options --enable-extensions=default,inspector
ac_add_options --enable-inspector-apis

# Compilation options
ac_add_options --disable-optimize
ac_add_options --enable-debug
ac_add_options --enable-tests
ac_add_options --disable-jemalloc
#ac_add_options --enable-trace-malloc
ac_add_options --enable-chrome-format=symlink

ac_add_options --with-macos-sdk=/Developer/SDKs/MacOSX10.7.sdk
ac_add_options --enable-macos-target=10.7

# For NSS symbols
export MOZ_DEBUG_SYMBOLS=1
#ac_add_options --enable-debug-symbols="-gdwarf-2"

#Use ccache
#ac_add_options --with-ccache=/usr/local/bin/ccache

# We don't have GCC anymore, since XCode 4.2, so use clang instead.
CC=clang
CXX=clang++

There are probably a bunch of things I don’t really need in there, so if anyone wants to take it, and cut it down to the minimal set, I would definitely appreciate it. But in the meantime, this works for me, and will probably work for you, too.

[Posted at 10:34 by Blake Winton] link
Thu, 08 Dec 2011

Much of the new work I’m doing these days is being stored in git repositories. Now, I’m not the biggest fan of git, particularly its UI, but the advantages of GitHub and GitX are hard to ignore. Despite that, I still really missed being able to type hg out to see which patches I would be pushing, so, after a short chat with (and demo from) Ben, I came up with the following:

Somewhere in your path, add a file named git-outgoing which contains the following contents:

# !/bin/sh
# Uh, there shouldn’t be a space between the # and ! in the previous
# line, but the highlighter I’m using seems to require it…
git push --dry-run $1 2>&1 | awk '/^ / {print $1}' | xargs git log

(Make sure it’s executable by whomever needs to use it!)

Then, in your git config, add the following section:

[alias]
    out = outgoing

And finally, you should be able to type git out, and see something like:

commit 7d4c9b89a4663a07bed030669bae2d3c73ec78dc
Author: Blake Winton <bwinton@latte.ca>
Date:   Thu Dec 8 12:22:41 2011 -0500

    Blear 2

commit a4e8c6627bc26d7371fb2614a1c47aaf694957bd
Author: Blake Winton <bwinton@latte.ca>
Date:   Thu Dec 8 12:18:04 2011 -0500

    Bleah.

So, hopefully some of the rest of you will find this helpful, too, and if you know of a better way to do this, please let me know in the comments!

[Posted at 13:04 by Blake Winton] link
Tue, 27 Sep 2011

On a previous post in a different blog, some commenters were asking us if we were considering doing things that we have planned to do for a while now, and that led me to realize that I haven’t been communicating the future of Thunderbird’s UI nearly well enough. I mainly blame it on my trying to do too many other things, and thus failing to cover all the bases. So, having said all that, here is the list of things, in no particular order, that I would like to see worked on in the next few versions of Thunderbird. But first, I’ld like to say a little bit about why I want them.

I recently heard about someone who said “Thunderbird looks like iTunes”, and while that’s rather complimentary given the amount of time Apple puts into making things look good, it doesn’t really lead me to believe that people can pick our product out of a screenshot. And so one of the overall goals is to make Thunderbird iconic. You can always tell when a screenshot is of Apple mail, based on the layout and the lack of colour, and Firefox is similarly immediately recognizable because of the big circular back button and smaller rectangular forward button. Similarly, I’m hoping to have Thunderbird look different to other apps, while still fitting in on the platform, and maintaining a little consistency with Firefox. Of course, that’s not the only goal, nor even the main goal. My main idea for Thunderbird is to let you focus on the content that’s important to you, and not be distracted by things you don’t care about. Hopefully most of the changes I talk about here will help that, and as a side benefit also help to give us a more unique style.

  • A simple thing that will make the product nicer to use is just to line things up. We’re all over the place, and it should be fairly simple to make this better. There are a couple of bugs that are related to this, and I suspect we could file a few more for various other parts.

  • We want to put the tabs on top, because they let us put the compose and address book into tabs, while still having the appropriate toolbars. (As well, having everything be a tab makes the application more consistent, as described in the next point.)

  • This leads into removing the standalone Compose and Address Book windows. You’ll still be able to open a window for those functions, but it will just be a regular window with a Compose or Address Book tab. (No bugs for this yet. Removals are sensitive things, and we want to get the replacement UI working well before we remove the existing UI.)

  • We really want the Thunderbird button, so that we can hide the menus, and have less Glass on Windows, and make the most common actions easier to find and use.

  • But, to add that button, we first need to see what the most common menu items people use are, therefore we need Test Pilot.

  • We would like to add a HomeTab, to give people a personalized place to land when they start Thunderbird, or open a new window.

  • We would like to merge the Gloda bar and Quick Filter bar, cause duh.

  • Having two different settings locations is too confusing for me, let alone people who don’t care about the details of the product. We want to merge those into a single searchable place for all the settings, a la Mac System Prefs.

  • This next change is more a small, personal thing, rather than part of a grand plan. It was originally suggested by Mike Beltzner, and while I’ve had some time to work on it, I haven’t had enough to push it through to completion. Basically, I’ld like to be able to order my email by date, while grouping it by subject. (This is different than threading, because I don’t care about which replies are to which messages. I just want a single group for the subject, with the messages ordered by date within that group, and the groups ordered by the date of the most recent message.) There’s no bug for this yet, but as mentioned, I started to write an extension, before hitting some annoying bugs that made it hard.

  • Compactify the header. It’s really too big. Well, that’s a bit of a lie. What I really mean here is that we should move the buttons and their toolbar out of the header, to float just above it. This would allow people to easily turn them off (by removing the entire toolbar), and for those of us who like to keep them, it would make them more visually distinct. As an added bonus, in vertical mode, we could merge that toolbar with the other toolbars, to get something like the pictures of what Thunderbird could look like posted by Asa Dotzler.

  • And finally, I think we should remove the Migration Assistant. It was very useful in the 2.0⇒3.0 transition, but it’s been less and less useful as time goes on, and as people have moved more and more onto Thunderbird 3, and 4, and 5… (No bug for this one either, again, because removals are sensitive things.)

See all the bugs in one big list.

Many thank-yous to Alex Faaborg, and areweprettyyet for the code to link the bugs, and the basis of the styling to make them stand out.

[Posted at 11:02 by Blake Winton] link
Thu, 08 Sep 2011

Add-ons are an important part of many Mozilla products, and many people have noticed that they’ve taken a hit as we’ve switched to the Rapid Release process. To help users have a little more control over how well their Firefox works, I would like to propose the following slight modification to the automatic Update process:

It all starts when Firefox (and Thunderbird) notice an update is available.

We immediately check the user’s add-ons to see if they are compatible, or if there are compatible versions we haven’t downloaded yet.

If all the add-ons are compatible (or will be made so at the next download), we show the NoAddons dialog:

NoAddons dialog

It‘s the same as the current Firefox or Thunderbird update dialog, and as you would expect, the “Ask Later” and “Update Firefox” buttons do the same things that they do now.

On the other hand, if there are in-compatible add-ons, we show the Addons dialog:

Addons dialog

As you can see, we let the user know which add-ons are incompatible, and give the user an extra button at the bottom to do something different.

The new “Update when my add-ons work” button (wording to be clarified later) will check the add-ons periodically, and automatically update Firefox when all the add-ons are compatible. If the add-ons aren’t compatible after a week (period of time to be configurable), the user will be shown this dialog again, with the (hopefully smaller) list of incompatible add-ons.

Showing the user which add-ons are incompatible will let them decide whether the add-ons are important enough to not upgrade, or whether they can live with the (hopefully short) period of reduced functionality.

As always, comments welcome, but keep them polite or they’ll be deleted.

[Posted at 14:49 by Blake Winton] link
Wed, 15 Jun 2011

A friend of mine recently said:

EVERY behavior aspect of EVERY application should be user-settable if the user is prepared to drill down far enough. No exceptions. Even if the user will be shooting his own foot by messing with it.

I, obviously, disagree with him, and wanted to explain why in a few more characters than Twitter would allow.

While giving the user complete control over every aspect of an application seems like a good idea, there are two slightly-hidden downsides to it.

First, every choice you give the user doubles the amount of testing you have to do. (Okay, it doesn’t exactly double it, but it certainly adds a testing, maintenance, and support burden.) Is it a responsible use of your time to implement these options if less than 1% of your users will ever change them (and risk shooting their own feet), or would it be better for everyone to implement a feature that more people would use?

Second, Emacs notwithstanding, you’ll never get to a great text editor by customizing a mail reader. The whole Unix (and iOS, oddly) philosophy is to write each app to do one thing, and do it well. Not to do a whole bunch of optional things. And if you’re doing only one thing, presenting an option to the user to do it or not doesn’t make a lot of sense.

And finally, because I can’t count, if you offer people too much choice, it imposes a cognitive burden on them which can lead to their making no choices at all, or at least not making them any happier than when they had fewer choices.

To bring this back to the product I’m working on, we are going out of our way to make Thunderbird more usable and part of that is simplifying it by offering fewer, more meaningful choices.

[Posted at 10:13 by Blake Winton] link
Wed, 01 Jun 2011

One of the big questions I had when I started writing patches was who I should ask to review them. Now that I’ve been in the community for a while, I’ve got a much better sense of who I should be talking to for the type of things I’m likely to write, but there are still times when I want to make a change in a part of the code that I haven’t touched before, and I’m not sure who to ask. In those cases, I usually fall back to a fairly simple (if non-obvious) set of steps to try and figure out who to pick.

  1. Get the list of files I’ve changed.
  2. Get the hg log for those files.
  3. Check through the log for “r=”, and “sr=”.

Of course, that’s a fairly easy set of steps to automate, and so I present my first cut at the automated reviewer chooser!

Of course, there are a lot of things I’ld like to do with this, such as:

  • Improving the documentation.
  • Checking to see how well this script would have done on previous commits.
  • Taking into account the length of the queues for the reviewers.
  • Adding some sort of recent-ness calculations.

But I think that this tool is useful enough in its current state that releasing it and getting feedback on what to actually work on would be a win.

To use it, be in a mercurial source repo, and type getReviewer.py to get a list of suggested reviewers for the current differences, or getReviewer.py temp.diff or getReviewer.py https://bugzilla.mozilla.org/attachment.cgi\?id\=536017 to specify a different set of changes.

[Posted at 20:13 by Blake Winton] link
Thu, 31 Mar 2011

Since we released the GetAnAccount addon, we’ve had a lot of feedback. Many of the people who commented were looking for the option of getting an ad-supported account instead of paying for email access. We were always planning on integrating ad-supported services, as soon as we could, but of course, doing this required a redesign.

One important note before we get to the good stuff: I’ve used GMail soley as an example of a well-known ad-supported email provider here. We may or may not be partnering with them, and you should not take these screenshots as proof of our intentions one way or another.

As you can see from this first mockup, the initial view makes it much more obvious that you don’t need to create a new account just to use Thunderbird.

Initial View

If you click in the bottom half, it expands up to make it more obvious that that’s what you want to do, and to allow us to display more information (although we don’t have any extra information to display there yet.

Existing Address

On the other hand, if you click on the top, we do have more information that you probably want to see before continuing on.

New Address

And this is something like what we hope to show you when the results have been returned. (Note: the Terms of Service, Existing Account, and Do It Later buttons are still there, but have been scrolled off the bottom of the dialog in this mockup.)

Search Results

And finally, once you pick one of the providers, we expand that list to show you all of the results for that provider.

Provider Chosen

Feedback, as always, is welcome, either here or in the forum.

[Posted at 21:41 by Blake Winton] link
Fri, 25 Mar 2011

A co-worker of mine recently mentioned that he had a problem where he all-too-often accidentally quit his applications by hitting ⌘-q (command-q). Since he has been having problems with Thunderbird that I can’t fix, I thought I might do a little digging and see if I could come up with some way of helping him. And so here’s what I found:

In the System Preferences application, there’s a “Keyboard” section.

The Keyboard Preference Pane

One of the things you can choose in that section is “Keyboard Shortcuts”.

The Keyboard Shortcuts

Pick a relatively innocuous function, like turning Zoom on and off.

(Note: DO NOT choose Front Row for this!)

The Access Shortcuts

And assign that function to ⌘-q.

The New Shortcut

Now, whenever you hit ⌘-q, it will do whatever you selected, instead of quitting the application. Ta-da!

[Posted at 17:48 by Blake Winton] link
Fri, 25 Feb 2011

Over the past week, I’ve been working on fixing some of the reported bugs in the OpenSearch add-on for Thunderbird, and now I think I’ve fixed enough of them to release a new version.

You can find the full details on the Mozilla Labs blog, or you could just jump straight to the OpenSearch add-on page to install it. And please leave your feedback about the add-on on our Google group!

[Posted at 11:25 by Blake Winton] link
Fri, 24 Dec 2010

I was reading Making Software by Andy Oram and Greg Wilson, and got to the chapter about An Automated Fault Prediction System. It’s a pretty neat chapter, and it got me wondering which files in the Thunderbird code base had the most bugs. Now, I don’t have all the info I need, but I figured an easy first pass would be to go through the commit logs, and for each commit that started with “bug ”, add one to the files changed in that commit. Hmm, that sounded unintuitive. Let me just paste (and link) the code:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from mercurial import ui, hg
import operator
import re

ext = re.compile("(\.c(pp)?|\.js|\.xml)$")

repo = hg.repository(ui.ui(), ".")
changes = [repo[i] for i in repo
                   if repo[i].description().lower().startswith("bug ")]

master = {}

for change in changes:
  files = [f for f in change.files() if ext.search(f)]
  for f in files:
    master[f] = master.get(f, 0) + 1

files = master.items()
files.sort()
counts = master.items()
counts.sort(key=operator.itemgetter(1))
counts.reverse()
print "\n".join([c[0] + ":" + str(c[1]) for c in counts[:10]])

And so, without further ado, here are the files that have been changed the most in bug fixes, and the number of times they've been changed:

  • mail/base/content/mailWindowOverlay.js:109
  • suite/browser/browser-prefs.js:73
  • suite/browser/navigator.js:70
  • mail/base/content/msgMail3PaneWindow.js:69
  • mail/app/profile/all-thunderbird.js:67
  • suite/common/src/nsSessionStore.js:66
  • mail/components/compose/content/MsgComposeCommands.js:60
  • mailnews/imap/src/nsImapMailFolder.cpp:56
  • suite/browser/tabbrowser.xml:53
  • mail/base/content/msgHdrViewOverlay.js:52

As a side note, for the mozilla repo it looks like this:

  • js/src/jstracer.cpp:780
  • browser/base/content/browser.js:654
  • layout/base/nsCSSFrameConstructor.cpp:410
  • layout/base/nsPresShell.cpp:400
  • js/src/jsobj.cpp:399
  • browser/base/content/tabbrowser.xml:397
  • widget/src/windows/nsWindow.cpp:390
  • toolkit/components/places/src/nsNavHistory.cpp:374
  • js/src/jsinterp.cpp:345
  • js/src/jsapi.cpp:343
[Posted at 14:59 by Blake Winton] link
Sat, 04 Dec 2010

I’ve created a couple of checklists, and would like to hear any feedback on them. They are a Review Checklist, and a Commit Checklist.

They came about after I had been working mostly on experimental add-ons for a while, and then attempted to push a couple of reviewed fixes. Since I was out of practice, I managed to get something minor wrong on both of the pushes. (The first one failed to attribute the patch to the proper author; The second one failed to mention the bug number in the commit message.) Since I’m a bit of a perfectionist, this really annoyed me, and so I vowed to write up the steps that I go through when I need to commit and push a patch, so that I could refer to them later, since if checklists can save lives, then I figure they can probably also help me do my job better. But before I go to that, I needed to review a patch, so I wrote up some of the things I look for when I review a patch too.

[Posted at 19:49 by Blake Winton] link
Tue, 30 Nov 2010

I was recently modifying an add-on for the upcoming Thunderbird 3.3, and part of what I wanted to do was to run some javascript in a chrome context that added some DOM nodes to a document in a content context. But when I ran the following code:

1
2
3
4
5
6
7
8
9
let browser = document.getElementById('tabmail').getBrowserForSelectedTab();
let doc = browser.contentDocument;
dump("\n\n\n\nXXXXXXXXXX\n");
dump("DOM Content loaded for " + doc.location + "\n");
var topBar = document.createElement("div");
topBar.innerHTML = "We got it!!!!!";
dump("iB = "+doc.body.insertBefore+"\n");
dump("fC = "+doc.body.firstChild+"\n");
doc.body.insertBefore(topBar, doc.body.firstChild);

I got the following error:

WARNING: NS_ENSURE_SUCCESS(rv, rv) failed with result 0x80530009: file /Volumes/Devel/thunderbird/src-central/mozilla/content/base/src/nsNodeUtils.h, line 304
WARNING: NS_ENSURE_SUCCESS(rv, rv) failed with result 0x80530009: file /Volumes/Devel/thunderbird/src-central/mozilla/content/base/src/nsGenericElement.cpp, line 4077
-- Exception object --
[snip…]
+ message (string) 'Operation is not supported'
+ result (number) 2152923145
+ name (string) 'NS_ERROR_DOM_NOT_SUPPORTED_ERR'

Poking around a little, it seemed like I had reasonable things for the insertBefore method, the firstChild attribute, and the topBar variable, and so since it was late, and I couldn't see what I had done wrong, I went to bed.

That turned out to be a the best thing for me to do, because this morning Jonathan Protzenko came to the rescue, saying (in response to a similar problem with a Firefox 4.0 beta 7 extension):

If you're modifying some content DOM from chrome code, you need to make sure the child you're appending was created using the unprivileged document, not the global document.

// This is chrome code, this is wrong because the span is now chrome
// and you're trying to insert it into content
myContentNode.appendChild(document.createElement("span"))

// This is right, appending a content node to another content node
myContentNode.appendChild(myContentNode.ownerDocument.createElement("span"))

I've hit this issue at least three times when upgrading stuff for Gecko 2.0. Might be what you're looking for .

And sure enough, when I changed var topBar = document.createElement("div"); to var topBar = doc.createElement("div"); , it all started working beautifully.

Thank you, Jonathan!

[Posted at 10:58 by Blake Winton] link
Wed, 25 Aug 2010

As someone who works on an email client, I’m interested in making my communications more secure. So, with the assistance of Ludovic and Gozer, I got a client certificate that would allow me to sign and encrypt my messages. (Check out the envelope and lock in the image below.)

An outgoing message, with an envelope and a
lock

Most of the time, I’ll probably just sign my messages – after all, that’s what I’ve set it up to do by default – but it’s nice to know that if there’s something I need to encrypt, that option is now available to me.

[Posted at 17:34 by Blake Winton] link
Mon, 19 Jul 2010

A co-worker of mine was having problems remembering where the makefile puts the binary for Thunderbird when you build it yourself. Now, I type in the path far too often, so I know where it is (on my computer, anyways), but since I type it in far too often, I grabbed someone's zsh function that launched Firefox, and modified it to launch Thunderbird from either the build directory or the source directory, but only on Mac OS X.

Anyways, here it is, I hope some of you find it useful.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
thunderbird() {
  local -a currdir;
  currdir=$PWD:t;
  for nm in LanikaiDebug ShredderDebug Lanikai Shredder; do
    if [ -d "./mozilla/dist/$nm.app" ]; then
      ./mozilla/dist/$nm.app/Contents/MacOS/thunderbird-bin $*
      break;
    elif [ -d "../objdir-$currdir/mozilla/dist/$nm.app" ]; then
      ../objdir-$currdir/mozilla/dist/$nm.app/Contents/MacOS/thunderbird-bin $*
      break;
    fi
  done
}
[Posted at 10:20 by Blake Winton] link
Fri, 16 Apr 2010

I’ve been reviewing a patch from Andreas and Standard8 which adds lightweight theme support (aka personas) to Thunderbird. It’s so cool that I couldn’t resist taking a screenshot, and posting it for you all to see!

Pretty new persona

It looks like there’s a good chance the code will make it in to Thunderbird 3.1 beta 2, so with any luck, soon your Thunderbird will be a pretty as mine.

[Posted at 09:55 by Blake Winton] link
Sat, 03 Apr 2010

For the next version of Thunderbird, Bryan Clark, Andreas Nilsson, and I have done a lot of work to make it easier to upgrade your profile from Thunderbird 2, and we would like to hear what you think of it, and how we can make it even better.

There are some things we’re particularly interested in (mostly on the “Disk space” tab), such as:

  1. Are your existing settings preserved?
  2. If you have no previous settings do we choose “Do not Synchronize” by default?
  3. For those of you who choose not to synchronize your messages, does that appear to work correctly?

We also have some more general questions, like:

  1. Does it look okay? Do the sizes seem correct?
  2. Do the options make sense, and how can we make them clearer?
  3. Do the buttons work the way you think they should?

You can download the builds for various Operating Systems at the following links:

Windows

Mac OS X

Linux

And please leave your feedback on Mozilla Messaging’s GetSatsifaction Topic by the end of day on this coming Wednesday (April 7th), so that we have time to tweak the code and the design before the deadline.

Thanks!

[Posted at 22:08 by Blake Winton] link
Tue, 30 Mar 2010

For your reading pleasure this week, we have a guest post from Wei Xian Woo. Wei is a student working on Thunderbird as part of UCOSP, and has just had his first bug marked as FIXED. Anyways, that’s enough out of me. Here’s Wei’s post:

Programming Thunderbird in Visual Studio.

During this term’s Undergraduate Capstone Open Source Projects (UCOSP) Code Sprint held at the University of Toronto in January, I wrote a simple Python script for the Thunderbird team to make setting up a Visual C++ project for Thunderbird slightly easier for those of us working on Windows. Blake suggested making this script public so others could benefit from it, so here it is! The script is generic enough to be used for any project, not just Thunderbird. Feel free to use it and make modifications as you see fit :)

Using the script to create a Visual C++ project for Thunderbird

Create an empty Visual C++ project in Visual Studio.

From the command prompt launched by mozilla-buildstart-msvc9.bat, do:

python /path/to/refreshvcproj.py
--vcproj=/path/to/thunderbird.vcproj --dir=/path/to/gecko-sdk
--dir=/path/to/mozilla/comm-central/mozilla/xpcom
--dir=/path/to/mozilla/comm-central/mail

All files in the specified directories will be included in the project. I suggest including only the directories you will be working with.

Configuring the project for debugging:

Open the VC++ project file in Visual Studio, and then open the project's Properties.

Go to: Configuration Properties -> Debugging.

Set Command to pathtoobjdirmozilladistbinthunderbird.exe

Set Environment to XPCOM_DEBUG_BREAK=warn

And… you’re done!

For better C++ IntelliSense, you might also want to consider getting Visual Assist X (an add-on for VS).

Happy coding!

And you can find the script over here.

Thanks, Wei!

[Posted at 10:11 by Blake Winton] link
Wed, 10 Mar 2010

I’ve run into a bug. It’s a really annoying bug, because it prevents me from changing folders when I try to test any of my Thunderbird changes.

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.

So the error lookup page says that the error that’s reported is:

Module          Severity        Number
CONTENT (25)    Failure (1)     6

And DXR says that Content Error 6 is: NS_ERROR_CONTENT_BLOCKED

Which occurs, among other places, here

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.

The one that hit my breakpoint ended up being this one which, weirdly enough, isn’t even listed in the mxr results of this search

Now that I’m at the breakpoint, we’re halfway there, I hope. ;)

How I got there was:

(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
[]

And it looks like we get there because the return value of NS_CheckContentLoadPolicy is 0x80004003, or NS_ERROR_INVALID_POINTER.

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 this patch, you can see that it’s the folder = do_QueryInterface(subFolder, &rv); line which is causing the failure, because the subFolder’s mRawPtr is null.

But I have no idea why that’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.

[Posted at 22:17 by Blake Winton] link
Sun, 20 Dec 2009

Earlier today, I was asked by Andreas Nilsson to give him a hand with a folder pane header bug he was trying to fix. In the middle of digging around in the code, I thought “I should really write this down, so that I can understand it later.”, and so here it is.

The main place we’ll need to change is in this object.

We start in the load method, which calls registerMode, to add the mode with its localized name. There is also a default list of modes, which will come into play later.

When the user chooses to cycle the mode, it calls the setter for mode, passing it the modename, which comes from the _modeNames list (which contains both the defaults and any newly-registered modes). Then, in the setter, if the mode is a default mode, it will fail the if-test, and get the localized name from the “bundle_messenger” string bundle. If it’s a newly-registered mode, they will have passed in a localized name which we will have stored in this._modeDisplayNames, and so we will use that.

The point of the bug is to switch the label-and-two-buttons to a dropdown menu, so at this point I think we should start with an empty menulist in the XUL, and in the load method add menuitems corresponding to the values in the _modeNames array. Then, in the registerMode and unregisterMode methods, we should add and remove new menuitems, which I’m hoping will just automatically show up in the dropdown. Finally, we need to change the setter for mode to not calculate the new name, but just select the appropriate menuitem set the mode attribute on the _treeElement, and call _rebuild(). At that point, I think we’re done, but only time will tell.

Okay, so this was really posted on Dec 22nd, but I wanted to back-date it so as not to bump Amy’s “Welcome” post off the top a mere day after she posted it.

[Posted at 16:45 by Blake Winton] link