Return to mozilla-dev-extensions
FAQ
(↑ top)
- Assuming you have chrome privileges, this should work:
var Ci = Components.interfaces;
var topLevelWindow =
window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShellTreeItem)
.rootTreeItem
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindow)
.QueryInterface(Ci.nsIDOMChromeWindow);
var sidebar = topLevelWindow.document.getElementById("sidebar");
alert(sidebar.contentDocument);
- The problem with most JS frameworks is that they bootstrap by dynamically appending script elements, which doesn't work in XUL, last I checked. Take a look at the bottom of http://svn.dojotoolkit.org/dojo/trunk/dojo.js
see what it's trying to load and write out the script element by hand.
- In the Debug menu, uncheck Exclude Browser Files.
- Use the debugger by typing in a command like this: /break chrome://myextension/content/myfile.js 123
- Then I suggest using flat chrome. If you turn off the XUL cache you don't even need to restart to see changes, simply open a new window.
- You shouldn't store data there, so there's nothing to backup.
- Do not store files within the extension directory.
- The Profile directory is meant to do so.
- Storing files within the extension directory is a no-no because it might break the multi-user support of those Mozilla products, as it is possible to install extensions directly within the application directory.
- Inspector, Talkback and the default theme are nowadays installed like this.
- When user chooses to uninstall an extension, a nsIObserverService notification is sent out. The problem is, while your extension is still active, user can cancel uninstallation, and when it is physically uninstalled, your code can't run.
- Right. And if you uninstall Firefox, the profile data is left behind.
- It would be nice to give the option of clearing extension's data, but it should be implemented at application level, not by each extension individually.
- It might be an option to stick with it and perform stuff when it comes to application shutdown.
- The Sanitize stuff does this (clean stuff on exit).
- http://lxr.mozilla.org/mozilla1.8/so...ents/nsBrowser...
- Firefox will clean all those preferences which are still "default", that is not changed by the user or the application/extension.
- To provide those default preferences to your extension see: http://kb.mozillazine.org/Dev_:_Usin...lt_preferences
- BTW: Resetting prefences to default will clear them in case no default prefence is (still) available.
- Those will be completely removed upon next application launch.
- Not unless you make it a separate window. There's a bug in bugzilla about stacking other widgets on top of browser/iframe, which hopefully will be fixed for Gecko 1.9.
- CustomizeGoogle extension already has support for switching Gmail to HTTPS (and calendar possibly, too).
- Are you aware of the "mailredirect" extension? It allows bouncing to arbitrary addresses. It seems what you want is a one button access to that extension with a prefilled bounce address, right?
- It's best to define singletons as custom XPCOM services. You'll avoid problems like these.
- In our company I write this extension that connects to our GroupWare server (HTTP). What server should search extension work against? Did you mean Exchange?
- String properties are implemented as IMAP user flags. However not all servers support user flags, in which case you get reduced functionality as follows: all flags are stored in your local cache and are lost if your cache gets invalidated, and only "known" properties are copied when messages are copied. The list of "known" properties is: junkscore junkscoreorigin label priority keywords.
- Keywords - In the GUI they are called Tags. They replace the old Labels.
- Preserved properties source code - nsImapMailFolder::CopyMessages
- It's a common oversight when working with JavaScript callbacks. Both setTimeout( fn, ... ) and addEventListener(receiver, fn, .. ) have this problem. In the case of setTimeout fn is called with this equal to the window. In the case of addEventListener fn is called with this equal to the receiver that you added the event listener to. In your case that is also the window.
- It is possible to get events and timer notifications in an object-oriented manner. For events it is as simple as passing an object instead of a function. This object's handleEvent method will get called with this equal to the object itself. However you would need to add logic to distinguish multiple events, or create a separate object for each event, which would require you to track event objects to avoid leaking.
- If you want an object-oriented timer callback then currently the only way to do this is from an extension where you can use the timer service to register a callback object. This object's notify method will get called with this equal to the object itself. In this case it is even more vital that you track your objects to avoid leaking.