Created
April 30, 2014 01:48
-
-
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
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
var XPIScope = Cu.import('resource://gre/modules/XPIProvider.jsm'); | |
alert(XPIScope.XPIProvider) | |
var scope = XPIScope.XPIProvider.bootstrapScopes['ghForkable@jetpack']; | |
alert(scope) |
Noitidart
commented
May 3, 2014
single line promise:
var XPIScope = Cu.import('resource://gre/modules/addons/XPIProvider.jsm');
var scope = XPIScope.XPIProvider.bootstrapScopes['Profilist@jetpack'];
scope.getProfileSpecs(Object.keys(scope.ini)[5]).then(function(a){console.log('a:',a)},function(b){console.warn('b:',b)}).catch(function(c){console.error('c:',c)})
testing PromiseWorker promise
var aDOMWin = Services.wm.getMostRecentWindow('navigator:browser');
var cBaseWin = aDOMWin.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShellTreeItem)
.treeOwner
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIBaseWindow);
var cWinHandlePtrStr = cBaseWin.nativeHandle;
console.log(cWinHandlePtrStr);
var XPIScope = Cu.import('resource://gre/modules/addons/XPIProvider.jsm');
var scope = XPIScope.XPIProvider.bootstrapScopes['Profilist@jetpack'];
scope.ProfilistWorker.post('changeIconForAllWindows', ['C:\\Users\\Vayeate\\AppData\\Roaming\\Mozilla\\Firefox\\profilist_data\\launcher_icons\\BADGE-ID_youtube-2__CHANNEL-REF_beta.ico', ['0x2a079a']]).then(function(a){console.log('a:',a)},function(b){console.warn('b:',b)}).catch(function(c){console.error('c:',c)})
scope.ProfilistWorker.post('findLaunchers', ['Profiles/7i1dvxno.Unnamed Profile 8']).then(x=>console.log('x:',x),y=>console.warn('y:',y)).catch(z=>console.error('z:',z));
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)));
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