Last active
August 26, 2016 21:02
-
-
Save oleksmarkh/6414044 to your computer and use it in GitHub Desktop.
reaching "gBrowser" object from Firefox add-on main code (e.g. to handle URL change)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Cc, Ci } from 'chrome'; | |
const mediator = Cc['@mozilla.org/appshell/window-mediator;1']; | |
const gBrowser = mediator.getService(Ci.nsIWindowMediator).getMostRecentWindow('navigator:browser').gBrowser; | |
function onLocationChange(aProgress, aRequest, aURI) { | |
console.log(aURI.spec); | |
}; | |
gBrowser.addProgressListener({ onLocationChange }, Ci.nsIWebProgress.NOTIFY_LOCATION); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
see https://developer.mozilla.org/en-US/docs/Code_snippets/Tabbed_browser