var require("sdk/tabs");
var buttons = require('sdk/ui/button/action');
var tabs = require("sdk/tabs");
var domain, reqest, response ;

var icons = 



var button = buttons.ActionButton({
  id: "contribute",
  label: "How to contribute!",
    icon: {
      "16": "./icon-16.png",
      "32": "./icon-32.png",
      "64": "./icon-64.png"
      },
      onClick: dealWithIt;
});

functon dealWithIt() {
    console.log(""); 

};

function toggleIcon(state) {
    if(state == true){
        button.icon.16 = "./


tab.on('ready', function(tab){
  req = require("sdk/request").Request({
      url: window.location.protocol + window.location.host + "/contribute.json",  
      onComplete: function(resp){
      if(req.status == 200){
        toggleIcon(true);
        console.log(url + " - Contribute.json available!");
      } else {
        toggleIcon(false);
        console.log(url + " - Contribute.json unavailable, humbug.");
   });
});



@@ -145,113 +145,124 @@
 s = 
-%0A%0A%0A%0Avar button = buttons.ActionButton(%7B%0A  id: %22contribute%22,%0A  label: %22How to contribute!%22,%0A    icon: %7B%0A  
+%7B%0A  %22inactive%22: %7B%0A    %2216%22: %22./icon-16.png%22,%0A    %2232%22: %22./icon-32.png%22,%0A    %2264%22: %22./icon-64.png%22%0A  %7D%0A  %22active%22: %7B%0A
     
@@ -288,18 +288,16 @@
 g%22,%0A    
-  
 %2232%22: %22.
@@ -311,18 +311,16 @@
 2.png%22,%0A
-  
     %2264%22
@@ -339,21 +339,134 @@
 .png%22%0A  
-    %7D
+%7D%0A%7D%0A%0A%0A%0Avar button = buttons.ActionButton(%7B%0A  id: %22contribute%22,%0A  label: %22How to contribute!%22,%0A    icon: icons.inactive
 ,%0A      
@@ -599,18 +599,16 @@
 %7B%0A      
-  
 button.i
@@ -614,17 +614,32 @@
 icon
-.16 = %22./
+ = icons.active;%0A    %7D%0A%7D
 %0A%0A%0At
@@ -724,79 +724,53 @@
 rl: 
-window.location.protocol + window.location.host + %22/contribute.json%22,  
+new URL(%22/contribute.json%22, window.location),
 %0A   
@@ -815,17 +815,18 @@
 f(re
-q
+sp
 .status 
 == 2
@@ -825,14 +825,56 @@
 tus 
-=
+%3E
 = 200
+ && resp.status %3C 300 && resp.json != null
 )%7B%0A 

Add some cleanup. * Move the icons into their own dictionary. * Use a url object to do the parsing. * Check for all 200-level statuses. * Check that the response was JSON.