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
// ViewPanel class | |
function ViewPanel(content, script) { | |
this.panel = Panel({ | |
width: sp.prefs['width'], | |
height: sp.prefs['height'], | |
contentURL: data.url(content), | |
contentScriptFile: data.url(script) | |
}); | |
// Using arrow functions to resolve scope issues |
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
const { id, name, prefixURI, rootURI, metadata, | |
version, loadReason, preferencesBranch } = require('@loader/options'); | |
console.log('id: ' + id + | |
'\nname: ' + name + | |
'\nprefixURI: ' + prefixURI + | |
'\nrootURI: ' + rootURI + | |
'\nmetadata: ' + JSON.stringify(metadata) + | |
'\nversion: ' + version + | |
'\nloadReason: ' + loadReason + |
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
id: jid1-ddYLv0ZiWhMetw@jetpack | |
name: theGreatestAddon | |
prefixURI: resource://jid1-ddylv0ziwhmetw-at-jetpack/ | |
rootURI: jar:file:///var/folders/m5/53z6crb100z72tmcb_rldn280000gn/T/tmpcZX_yD.mozrunner/extensions/jid1-ddYLv0ZiWhMetw@jetpack.xpi!/ | |
metadata: {"description":"a basic add-on","license":"MPL 2.0","main":"main","name":"theGreatestAddon","version":"0.1","permissions":{}} | |
version: 0.1 | |
loadReason: install | |
preferencesBranch: jid1-ddYLv0ZiWhMetw@jetpack |
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
const { uri, id, preferencesBranch, name, | |
loadReason, version, packed, isPrivate } = require('sdk/self'); | |
console.log('\nuri: ' + uri + | |
'\nid: ' + id + | |
'\npreferencesBranch: ' + preferencesBranch + | |
'\nname: ' + name + | |
'\nloadReason: ' + loadReason + | |
'\nversion: ' + version + | |
'\npacked: ' + packed + |
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
uri: addon:jid1-ddYLv0ZiWhMetw@jetpack | |
id: jid1-ddYLv0ZiWhMetw@jetpack | |
preferencesBranch: jid1-ddYLv0ZiWhMetw@jetpack | |
name: theGreatestAddon | |
loadReason: install | |
version: 0.1 | |
packed: true | |
isPrivateBrowsingSupported: false |
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
const { Cc, Ci, Cu, components } = require('chrome'); | |
Cu.import('resource://gre/modules/NetUtil.jsm'); | |
// Create a file to write | |
let file = Cc['@mozilla.org/file/local;1']. | |
createInstance(Ci.nsILocalFile); | |
file.initWithPath('/Users/sunny/Desktop'); | |
file.append('test-file.txt'); | |
file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0666); |
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
content foo chrome/content/ |
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
const { Cu, Ci } = require('chrome'); | |
const { NetUtil } = Cu.import('resource://gre/modules/NetUtil.jsm'); | |
let charset = 'UTF-8'; | |
let channel = NetUtil.newChannel('chrome://foo/content/test-file.txt', charset, null); | |
// `channel` obtained is an nsIChannel object. Open the channel synchronously. | |
let stream = channel.open(); | |
// Get the stream length |
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
const data = require('self').data; | |
const menuId; | |
const utils = require('api-utils/window/utils'); | |
const recent = utils.getMostRecentBrowserWindow(); | |
/** | |
* opts: an options object that includes a name, an image and a callback. | |
* note: the image can only be a file or data uri, see bug 802003 | |
*/ |
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
include: { | |
is: ['string', 'array', 'regexp', 'object'], | |
ok: (rule) => { | |
function checkURL(r) { | |
if (isRegExpOrString(r)) | |
return true; | |
if (Array.isArray(r) && r.length > 0) | |
return r.every(isRegExpOrString); | |
return false; |