Changes

Jump to: navigation, search

Mozilla.dev.tech.xul

4,007 bytes added, 01:14, 24 November 2006
FAQ
Similarly, for onunload use the code:
window.addEventListener("unload", function(e) { shutdown(); }, false);
 
=== [http://groups.google.com/group/mozilla.dev.tech.xul/browse_thread/thread/f0aa44a69e64dda5/b86f0e12f5941092#b86f0e12f5941092 Is there an event which is called when the Firefox browser is initialized?] ===
 
An event is initiated when the application starts up and when the profile is changed. For more information please look at the following link: [http://lxr.mozilla.org/mozilla/source/toolkit/mozapps/extensions/src/nsExtensionManager.js.in#2703 nsExtensionManager.js]
 
=== [http://groups.google.com/group/mozilla.dev.tech.xul/browse_thread/thread/40b79fb4574cac8b/5c46a2cebfcae898#5c46a2cebfcae898 Is nsIVariant fully supported using python?] ===
 
Python has full support for variants. Pass a Python string/int/etc to the method requiring an nsIVariant. A Python object is convered when implmenting an interface taking an nsIVariant.
 
=== [http://groups.google.com/group/mozilla.dev.tech.xul/browse_thread/thread/b8916415bc0fa019/9c7fd67b21949317#9c7fd67b21949317 How do I close the "showPopup" which is automatically opened when the "oncontextmenu" event is called?] ===
 
If you have a similar code base as the following:
 
:<pre>
:onBookmarkContextMenu: function(event, id) {
: document.getElementById("bookmarkPopup").showPopup(document.getElementById(id),
: event.screenX + 6, event.screenY + 6, "popup", "bottomright",
: "bottomright");
:
:}
:</pre>
 
Use the hidePopup() function to solve this issue.
 
=== [http://groups.google.com/group/mozilla.dev.tech.xul/browse_thread/thread/9bf54cc3afe1c340/100724af248a02ad#100724af248a02ad What is an example of addProgressListener?] ===
 
An example of this is this:
 
:<pre>
:// Associate the progress listener for a "browser" to a listener object
:
:browserObject.addProgressListener( listObj,
: Components.interfaces.nsIWebProgress.NOTIFY_STATE_WINDOW );
:
:// Remember to define the object, something like this:
:
:listObj = new Object();
:
:listObj.wpl = Components.interfaces.nsIWebProgressListener;
:
:listObj.QueryInterface = function(aIID) {
: if (aIID.equals(listObj.wpl) ||
: aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
: aIID.equals(Components.interfaces.nsISupports)) return this;
: throw Components.results.NS_NOINTERFACE;
:
:}
:
:listObj.onStateChange = function(aProgress, aRequest, aFlag, aStatus) {
: if (aFlag & listObj.wpl.STATE_START) {
: // This fires when the load event is initiated
: } else {
: if (aFlag & listObj.wpl.STATE_STOP) {
: if ( aFlag & listObj.wpl.STATE_IS_WINDOW ) {
: // This fires when ALL load finish
: }
: if ( aFlag & listObj.wpl.STATE_IS_NETWORK ) {
: // Fires when ALL load are REALLY over,
: // do something "final" here
: // (my two cents)
: } else {
: // This fires when a load finishes
: }
: }
: }
: return 0;
:
:}
:
:// This fires when the location bar changes i.e load event is confirmed
:// or when the user switches tabs
:listObj.onLocationChange = function(aProgress, aRequest, aURI) {
:
:// do whatever you want to do
:return 0;
:
:}
:
:// For definitions of the remaining functions see XulPlanet.com
:listObj.onProgressChange = function() { return 0 };
:listObj.onStatusChange = function() { return 0 };
:listObj.onSecurityChange = function() { return 0 };
:listObj.onLinkIconAvailable = function() { return 0 };
:
:/*
: I use the progress listener to trap the end of a local HTML
: "template" file loading, and run XSLT transormations.
: In addition I need to evaluate the browser contentDocument DOM
: in order to clean "target" attributes on links, and so on.
:
: HTH
:*/
:</pre>
== UnAnswered Questions (UAQ) ==
1
edit

Navigation menu