Skip to content

Instantly share code, notes, and snippets.

@yajd
Created April 30, 2014 01:48
Show Gist options
  • Save yajd/17ee5b1b98cb717c8429 to your computer and use it in GitHub Desktop.
Save yajd/17ee5b1b98cb717c8429 to your computer and use it in GitHub Desktop.
_ff-addon-snippet-AccessBootstrapScope - example of how to access addon module scope of bootstrapped addon
var XPIScope = Cu.import('resource://gre/modules/XPIProvider.jsm');
alert(XPIScope.XPIProvider)
var scope = XPIScope.XPIProvider.bootstrapScopes['ghForkable@jetpack'];
alert(scope)
@Noitidart
Copy link

var getScope = function() { var XPIScope = Cu.import('resource://gre/modules/addons/XPIProvider.jsm'); return XPIScope.XPIProvider.bootstrapScopes['NativeShot@jetpack']; }

setTimeout(function(){
    var gClipboardHelper = Cc["@mozilla.org/widget/clipboardhelper;1"].getService(Ci.nsIClipboardHelper);
    gClipboardHelper.copyString(JSON.stringify(getScope().gEditor.winArr));
    console.log('copied');
}, 10000);



getScope().MainWorker.post('getAllWin', [{
    filterVisible: true,
    getPid: true,
    getTitle: true,
    getBounds: true
}]).then(winArr=>Cc["@mozilla.org/widget/clipboardhelper;1"].getService(Ci.nsIClipboardHelper).copyString(JSON.stringify(winArr)));

@Noitidart
Copy link

var getScope = function() { var XPIScope = Cu.import('resource://gre/modules/addons/XPIProvider.jsm'); return XPIScope.XPIProvider.bootstrapScopes['MouseControl@jetpack']; }; a = getScope();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment