I am trying to convert a Google Chrome extension to Firefox using the Addon SDK (Jetpack). The following code (runs as a content script)
var property, winProperties = {}; for (property in window) { winProperties[property] = true; }
throws this exception on startup in Firefox 5.0 and 6.0:
Traceback (most recent call last): File "sfc-bgcore.js", line 299, in null File "resource://jid1-q4cqhvcl3sc4vq-at-jetpack-api-utils-lib/content/content-proxy.js", line 519, in null for each (name in Object.keys(obj)) { [Exception... "Component is not available" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: resource://jid1-q4cqhvcl3sc4vq-at-jetpack-api-utils-lib/securable-module.js -> resource://jid1-q4cqhvcl3sc4vq-at-jetpack-api-utils-lib/content/content-proxy.js :: <TOP_LEVEL> :: line 519" data: no]
Does anyone know how to catch this exception or how to avoid the "problem" property and continue the loop?
Note that I cannot just put the try-catch statement in the body of the loop, since even this causes an error:
for (var property in window) {};
However, if I execute the same or similar expression in Firefox "Web Console", then it works fine:
for (var property in window) { console.log(property); };
source share