mozilla/addon-sdk — pull request #1223 by gijsk (2013-08-29 14:52:32+00:00)
Title: Bug 910190 - Fix jetpack test failures in test-ui-button.js, r?zer0

So the reason this breaks right now is because you leave a bunch of jetpack widgets in the placements (a la currentset) for the navbar, which have already been deleted. Getting the widget objects in the area then returns a list that contains nulls. The code uses a destructuring assignment to {id}, which blows up with a cryptic error message: " is null". Once you've got this all figured out, this makes sense, but I'll file a bug on the JS engine to provide a better exception in these cases, as this kind of sucks.

Anyhow. This is the simplest thing I could think of to avoid this problem - simply ask only for the ids, which is all you need anyway, and then get the widget for the one you care about.