Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit d30793fa1067ba33b4cd358f4dbed8142e2db296 @foudfou committed Aug 28, 2011
Showing with 60 additions and 0 deletions.
  1. +5 −0 README.md
  2. +2 −0 doc/main.md
  3. +13 −0 lib/main.js
  4. +8 −0 package.json
  5. +32 −0 test/test-main.js
@@ -0,0 +1,5 @@
+This is the X-Private add-on. It contains:
+
+* A program (lib/main.js).
+* A few tests.
+* Some meager documentation.
@@ -0,0 +1,2 @@
+The main module is a program that creates a widget. When a user clicks on
+the widget, the program loads the mozilla.org website in a new tab.
@@ -0,0 +1,13 @@
+const widgets = require("widget");
+const tabs = require("tabs");
+
+var widget = widgets.Widget({
+ id: "mozilla-link",
+ label: "Mozilla website",
+ contentURL: "http://www.mozilla.org/favicon.ico",
+ onClick: function() {
+ tabs.open("http://www.mozilla.org/");
+ }
+});
+
+console.log("The add-on is running.");
@@ -0,0 +1,8 @@
+{
+ "name": "x-private",
+ "fullName": "X-Private",
+ "description": "auto-enables private browsing on site request",
+ "author": "Foudil <foudil.newbie+amo@gmail.com>",
+ "license": "MPL 1.1/GPL 2.0/LGPL 2.1",
+ "version": "0.1"
+}
@@ -0,0 +1,32 @@
+const main = require("main");
+
+exports.test_test_run = function(test) {
+ test.pass("Unit test running!");
+};
+
+exports.test_id = function(test) {
+ test.assert(require("self").id.length > 0);
+};
+
+exports.test_url = function(test) {
+ require("request").Request({
+ url: "http://www.mozilla.org/",
+ onComplete: function(response) {
+ test.assertEqual(response.statusText, "OK");
+ test.done();
+ }
+ }).get();
+ test.waitUntilDone(20000);
+};
+
+exports.test_open_tab = function(test) {
+ const tabs = require("tabs");
+ tabs.open({
+ url: "http://www.mozilla.org/",
+ onReady: function(tab) {
+ test.assertEqual(tab.url, "http://www.mozilla.org/");
+ test.done();
+ }
+ });
+ test.waitUntilDone(20000);
+};

0 comments on commit d30793f

Please sign in to comment.