├── share-icon.png ├── data ├── ui │ ├── scripts │ │ ├── jqueryStub.js │ │ ├── AutoCompleteRefresh.html │ │ ├── Select.html │ │ ├── blade │ │ │ ├── array.js │ │ │ ├── fn.js │ │ │ ├── url.js │ │ │ ├── object.js │ │ │ └── Widget.js │ │ ├── osTheme.js │ │ ├── Select.css │ │ ├── shareOptions.js │ │ ├── mediator.js │ │ ├── TextCounter.js │ │ ├── dispatch.js │ │ ├── jquery.textOverflow.js │ │ ├── friendly.js │ │ ├── Select.js │ │ └── isoDate.js │ └── share │ │ ├── i │ │ ├── bug_b.png │ │ ├── face2.png │ │ ├── thumb.jpg │ │ ├── loader.gif │ │ ├── sprite.png │ │ ├── sprite2.png │ │ └── LinkedIn_Logo16px.png │ │ ├── scripts │ │ └── widgets │ │ │ ├── TabButton.html │ │ │ ├── AddAccount.html │ │ │ ├── DebugPanel.html │ │ │ ├── ServicePanel.html │ │ │ ├── DebugPanel.js │ │ │ ├── TabButton.js │ │ │ ├── AddAccount.js │ │ │ ├── jigFuncs.js │ │ │ ├── AccountPanel.html │ │ │ └── ServicePanel.js │ │ ├── style │ │ ├── win.css │ │ ├── linux.css │ │ └── mac.css │ │ └── index.html ├── apps │ ├── google │ │ ├── google.png │ │ ├── google.webapp │ │ └── google.html │ ├── twitter │ │ ├── twitter.png │ │ ├── twitter.webapp │ │ └── twitter.html │ ├── facebook │ │ ├── facebook.png │ │ ├── facebook.webapp │ │ └── facebook.html │ └── common.js ├── skin │ ├── pinstripe │ │ ├── share-button.png │ │ ├── share-button-active.png │ │ ├── share-button-shared.png │ │ ├── share-button-sharing.png │ │ └── share.css │ ├── winstripe │ │ ├── share-button.png │ │ ├── share-button-active.png │ │ ├── share-button-shared.png │ │ ├── share-button-sharing.png │ │ └── share.css │ └── gnomestripe │ │ ├── share-button.png │ │ ├── share-button-active.png │ │ ├── share-button-shared.png │ │ ├── share-button-sharing.png │ │ └── share.css ├── locale │ └── en-US.properties └── servicesapi.js ├── tests ├── apps │ └── basic │ │ ├── basic.html │ │ ├── basic.webapp │ │ └── basic.js ├── page.html ├── corpus │ ├── shorturl_linkrel.html │ ├── shortlink_linkrel.html │ ├── shorturl_link.html │ ├── og_invalid_url.html │ └── opengraph.html ├── browser │ ├── browser_store.js │ ├── share.html │ ├── browser_panelReady.js │ ├── browser_errorNotification_newtab.js │ ├── head.js │ ├── Makefile.in │ └── keyvaluestore_tests.js ├── test-toggle-key.js ├── test-url-validate.js ├── test-button-state.js ├── test-error-notification.js ├── test-click-button.js ├── unit │ ├── head_helpers.js │ ├── test_securefilestore.js │ └── test_keyvaluestore.js ├── test-bookmark-page.js ├── Makefile.in ├── test-location-change.js ├── test-panel-service-panel.js ├── test_utils.js ├── test-email-addresses.js ├── test-panel-focus.js ├── test-share-options.js ├── test-smtp-send.js ├── test-share-state.js └── test-panel-service-prefs.js ├── package.json ├── dependencies.json ├── README.md ├── Makefile ├── extra └── share.html └── lib ├── addonutils.js ├── email └── mime.js └── overlay.js /share-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/fx-share-addon/HEAD/share-icon.png -------------------------------------------------------------------------------- /data/ui/scripts/jqueryStub.js: -------------------------------------------------------------------------------- 1 | //A stub file used for RequireJS optimizer builds. 2 | define({}); 3 | -------------------------------------------------------------------------------- /data/ui/share/i/bug_b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/fx-share-addon/HEAD/data/ui/share/i/bug_b.png -------------------------------------------------------------------------------- /data/ui/share/i/face2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/fx-share-addon/HEAD/data/ui/share/i/face2.png -------------------------------------------------------------------------------- /data/ui/share/i/thumb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/fx-share-addon/HEAD/data/ui/share/i/thumb.jpg -------------------------------------------------------------------------------- /data/apps/google/google.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/fx-share-addon/HEAD/data/apps/google/google.png -------------------------------------------------------------------------------- /data/ui/share/i/loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/fx-share-addon/HEAD/data/ui/share/i/loader.gif -------------------------------------------------------------------------------- /data/ui/share/i/sprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/fx-share-addon/HEAD/data/ui/share/i/sprite.png -------------------------------------------------------------------------------- /data/ui/share/i/sprite2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/fx-share-addon/HEAD/data/ui/share/i/sprite2.png -------------------------------------------------------------------------------- /data/apps/twitter/twitter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/fx-share-addon/HEAD/data/apps/twitter/twitter.png -------------------------------------------------------------------------------- /data/apps/facebook/facebook.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/fx-share-addon/HEAD/data/apps/facebook/facebook.png -------------------------------------------------------------------------------- /data/skin/pinstripe/share-button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/fx-share-addon/HEAD/data/skin/pinstripe/share-button.png -------------------------------------------------------------------------------- /data/skin/winstripe/share-button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/fx-share-addon/HEAD/data/skin/winstripe/share-button.png -------------------------------------------------------------------------------- /data/ui/share/i/LinkedIn_Logo16px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/fx-share-addon/HEAD/data/ui/share/i/LinkedIn_Logo16px.png -------------------------------------------------------------------------------- /data/skin/gnomestripe/share-button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/fx-share-addon/HEAD/data/skin/gnomestripe/share-button.png -------------------------------------------------------------------------------- /data/skin/gnomestripe/share-button-active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/fx-share-addon/HEAD/data/skin/gnomestripe/share-button-active.png -------------------------------------------------------------------------------- /data/skin/gnomestripe/share-button-shared.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/fx-share-addon/HEAD/data/skin/gnomestripe/share-button-shared.png -------------------------------------------------------------------------------- /data/skin/pinstripe/share-button-active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/fx-share-addon/HEAD/data/skin/pinstripe/share-button-active.png -------------------------------------------------------------------------------- /data/skin/pinstripe/share-button-shared.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/fx-share-addon/HEAD/data/skin/pinstripe/share-button-shared.png -------------------------------------------------------------------------------- /data/skin/pinstripe/share-button-sharing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/fx-share-addon/HEAD/data/skin/pinstripe/share-button-sharing.png -------------------------------------------------------------------------------- /data/skin/winstripe/share-button-active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/fx-share-addon/HEAD/data/skin/winstripe/share-button-active.png -------------------------------------------------------------------------------- /data/skin/winstripe/share-button-shared.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/fx-share-addon/HEAD/data/skin/winstripe/share-button-shared.png -------------------------------------------------------------------------------- /data/skin/winstripe/share-button-sharing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/fx-share-addon/HEAD/data/skin/winstripe/share-button-sharing.png -------------------------------------------------------------------------------- /data/skin/gnomestripe/share-button-sharing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/fx-share-addon/HEAD/data/skin/gnomestripe/share-button-sharing.png -------------------------------------------------------------------------------- /data/ui/scripts/AutoCompleteRefresh.html: -------------------------------------------------------------------------------- 1 |
This is just another web page
9 |with a couple of paragraphs
10 | 11 | 12 | -------------------------------------------------------------------------------- /data/ui/scripts/Select.html: -------------------------------------------------------------------------------- 1 |20 |
56 | This page demonstrates the use of the invokeService function. When you click the
57 | "Share" button, below, the page will ask your browser to connect it to an application
58 | that provides the "link.send" service.
59 |
62 | What happens next is up to your browser. If you are using a browser that understands the 63 | service discovery API, you may see a dialog box, "doorhanger" or other native user interface 64 | element. If you are not, you may see an HTML-native implementation of the service discovery 65 | API (depending on whether we've implemented that yet). 66 |
67 | 68 | 69 |elements. 92 | { 93 | get url() { 94 | return getTestUrl("page.html"); 95 | }, 96 | options: { 97 | message: "This is just another web page with a couple of paragraphs" 98 | }, 99 | cbSetupPage: function(cw) { 100 | let [p1, p2] = cw.document.getElementsByTagName("p"); 101 | let range = cw.document.createRange(); 102 | range.setStartBefore(p1); 103 | range.setEndAfter(p2); 104 | cw.getSelection().addRange(range); 105 | } 106 | } 107 | ]; 108 | 109 | 110 | function hasoptions(test, testOptions, options) { 111 | let passed = true; 112 | let msg; 113 | for (let option in testOptions) { 114 | let data = testOptions[option]; 115 | let message_data = options[option]; 116 | if (Array.isArray(data)) { 117 | // the message may have more array elements than we are testing for, this 118 | // is ok since some of those are hard to test (e.g. base64 images). So we 119 | // just test that anything in our test data IS in the message. 120 | new Assert(test).deepEqual(data, message_data, "option "+option); 121 | } else { 122 | test.assertEqual(data, message_data, "option "+option); 123 | } 124 | } 125 | } 126 | 127 | 128 | function testOne(test, theTest) { 129 | if (typeof(theTest) == 'undefined') { 130 | test.done(); 131 | return; 132 | } 133 | 134 | createTab(theTest.url, function(tab) { 135 | if (theTest.cbSetupPage) { 136 | theTest.cbSetupPage(getContentWindow()); 137 | } 138 | let panel = getMediator(); 139 | let options = panel.updateargs(); 140 | hasoptions(test, theTest.options, options); 141 | 142 | removeCurrentTab(function() { 143 | // run the next test 144 | testOne(test, tests.shift()); 145 | }); 146 | }); 147 | } 148 | 149 | exports.testShareOptions = function(test) { 150 | test.waitUntilDone(); 151 | testOne(test, tests.shift()); 152 | } 153 | -------------------------------------------------------------------------------- /tests/test-smtp-send.js: -------------------------------------------------------------------------------- 1 | // Sadly this is hard to make as a regular unit-test - it would require 2 | // hard-coding an smtp server and credentials into the test suite. 3 | // So for now, this test is enabled when certain magic environment variables 4 | // are set. 5 | const {Cc, Ci} = require("chrome") 6 | const {SslSmtpClient} = require("email/smtp"); 7 | const {MimeMultipart, MimeText, MimeBinary} = require("email/mime"); 8 | 9 | var environ = Cc["@mozilla.org/process/environment;1"] 10 | .getService(Ci.nsIEnvironment); 11 | 12 | let smtpArgs = { 13 | server: environ.get("FXSHARE_TEST_SMTP_SERVER") || 'smtp.gmail.com', 14 | port: environ.get("FXSHARE_TEST_SMTP_PORT") || 587, 15 | connectionType: environ.get("FXSHARE_TEST_SMTP_CONNECTION_TYPE") || 'starttls', 16 | email: environ.get("FXSHARE_TEST_SMTP_EMAIL") // may be a full "Name
" string 17 | }; 18 | 19 | let authArgs = { 20 | plain: { 21 | username: environ.get("FXSHARE_TEST_SMTP_USERNAME"), 22 | password: environ.get("FXSHARE_TEST_SMTP_PASSWORD") 23 | }, 24 | xoauth: null // we build this manually... 25 | }; 26 | 27 | function sendEmail(test, payload) { 28 | // first sort out the auth stuff. 29 | if (environ.get("FXSHARE_TEST_OAUTH_TOKEN")) { 30 | // this matches the oauthConfig structure that is used in fx-share 31 | authArgs.xoauth = { 32 | consumerSecret: environ.get("FXSHARE_TEST_OAUTH_CONSUMER_SECRET") || 'anonymous', 33 | consumerKey: environ.get("FXSHARE_TEST_OAUTH_CONSUMER_KEY") || 'anonymous', 34 | tokenSecret: environ.get("FXSHARE_TEST_OAUTH_TOKEN_SECRET"), 35 | token: environ.get("FXSHARE_TEST_OAUTH_TOKEN"), 36 | serviceProvider: { 37 | signatureMethod: "HMAC-SHA1", 38 | emailUrl: "https://mail.google.com/mail/b/%s/smtp/" 39 | } 40 | }; 41 | } else if (authArgs.plain.username && authArgs.plain.password) { 42 | // the auth structure is ready to go for plain authentication 43 | ; 44 | } else { 45 | // no concept of skipping a test, so just say it passed. 46 | console.log("skipping SMTP test as required environment variables not configured"); 47 | test.pass("skipping test as required environment variables not configured"); 48 | return; 49 | } 50 | 51 | // smtp module uses a 15 second connection timeout, so we use a little more. 52 | test.waitUntilDone(20000); 53 | let finished = false; 54 | let on_disconnect = function() { 55 | if (!finished) { 56 | test.fail("premature disconnection"); 57 | } else { 58 | test.pass("apparently we worked!"); 59 | } 60 | } 61 | 62 | let client = new SslSmtpClient(on_disconnect); 63 | let on_connected = function() { 64 | console.log("connected - starting login"); 65 | client.authenticate(authArgs, 66 | function() { 67 | // now we can send the message. 68 | let to = [environ.get("FXSHARE_TEST_EMAIL_TO") || smtpArgs.email]; 69 | payload.addHeader('To', to); 70 | payload.addHeader('From', to); 71 | client.sendMessage(to, payload, 72 | function() { 73 | finished = true; 74 | test.pass("message sent"); 75 | test.done(); 76 | }, 77 | function(why) { 78 | test.fail("message delivery failed: " + why); 79 | test.done(); 80 | } 81 | ); 82 | }, 83 | function(err) { 84 | test.fail("authentication failed: " + err.reply); 85 | test.done(); 86 | } 87 | ) 88 | } 89 | let on_error = function(err) { 90 | test.fail("connection failed: " + err.type + "/" + err.message + "/" + err.reply); 91 | test.done(); 92 | } 93 | let logging = true; 94 | client.connect(smtpArgs, on_connected, on_error, logging); 95 | } 96 | 97 | exports.testSmtpSimpleSend = function(test) { 98 | let msg = new MimeMultipart('alternative'); 99 | msg.addHeader('Subject', "simple test message from fx-share with funny \u00a9 char"); 100 | 101 | let part1 = new MimeText("hello there funny \u00a9har", 'plain') 102 | let part2 = new MimeText("hello there funny \u00a9har", 'html') 103 | msg.attach(part1); 104 | msg.attach(part2); 105 | sendEmail(test, msg); 106 | } 107 | 108 | exports.testSmtpImageSend = function(test) { 109 | let msg = new MimeMultipart('alternative'); 110 | msg.addHeader('Subject', "image test message from fx-share with funny \u00a9har"); 111 | 112 | let part2 = new MimeMultipart('related') 113 | let html = new MimeText('hello