function createMenuPopup(doc) {
	var menupopup = doc.createElement('menupopup');
	var visibleItem = doc.createElement('menuitem');
	var entireItem = doc.createElement('menuitem');
	menupopup.setAttribute('class', 'awesome-screenshot-menupopup');
	visibleItem.setAttribute('data-option', 'visible');
	entireItem.setAttribute('data-option', 'entire');
	visibleItem.setAttribute('class', 'menuitem-iconic');
	entireItem.setAttribute('class', 'menuitem-iconic');
	visibleItem.setAttribute('label', 'Capture Visible Part');
	entireItem.setAttribute('label', 'Capture Full page');
	visibleItem.setAttribute('image', data.url('img/visible.png'));
	entireItem.setAttribute('image', data.url('img/entire.png'));
	visibleItem.setAttribute('key', 'visibleKey');
	
	var separator = doc.createElement('menuseparator');
	
	var options = doc.createElement('menuitem');
	options.setAttribute('data-option', 'options');
	options.setAttribute('label', 'Options');
	
	menupopup.appendChild(visibleItem);
	menupopup.appendChild(entireItem);
	menupopup.appendChild(separator);
	menupopup.appendChild(options);
	return menupopup;
}
Example #2
0
  _configureSiteUI: function () {
    // configure pledge button
    if (!this.currentSite 
        || this.currentSite.host.startsWith("about::")
        || this.currentSite.unpledged) {
      this.pledgeButton.state("window", {
        disabled: true,
      });
      this.glowOff();
      return;
    }

    // configure pledge panel
    this.pledgePanel.port.emit("siteInfo", this.currentSite);

    if (this.currentSite.canPledge) {
      this.pledgeButton.state("window", {
        label: this._makeButtonLabel(),
        icon: data.url("images/pledge_supported.png"),
        disabled: false,
      });
      this.glowAdFreeSite();
    }
    else {
      this.pledgeButton.state("window", {
        label: this._makeButtonLabel(),
        icon: data.url("images/pledge_unsupported.png"),
        disabled: false,
      });
      // make the button glow to let use nominate the site
      this.glowNonFreeSite();
    }
  },
Example #3
0
	startNewInstance : function startNewInstance() {

		this.stopActiveInstance();

		const workers = require("sdk/content/worker");
		const window = this.getActiveWindow();
		const event_window = this.getEventWindow(window);

		if (event_window === null)
			return;

		if (this.tab) {
			console.log("this.tab", this.tab.index);
			console.log("active tab", Tabs.activeTab.index);
		}

		this.wUI = Tabs.activeTab.attach({
			contentScriptFile: data.url(JsLibrary.worker_UI),
		});

		this.tab = Tabs.activeTab;

		this.wEvent = workers.Worker({
			window: event_window,
			contentScriptFile: data.url(JsLibrary.event_worker),
		});

		this.registerStyleSheet();
		this.wUI.port.emit("init");
		this.wEvent.port.emit("init");

		this.startListening();
	},
Example #4
0
function injectMainCS() {

  var filterURL = controller.getWatchListFilterURLs();

  var modOptions = {
    include: filterURL,
    onAttach: onCsAttach,
    contentScriptFile: [
      data.url('common/dep/jquery.min.js'),
      data.url('ui/messageAdapter.js'),
      data.url('common/ui/inline/cs-mailvelope.js')
    ],
    contentStyle: getDynamicStyle('common/ui/inline/framestyles.css'),
    contentScriptOptions: {
      expose_messaging: false,
      data_path: data.url()
    },
    contentScriptWhen: 'ready',
    attachTo: ['existing', 'top', 'frame']
  };

  if (pageMods.mainPageMod !== undefined) {
    try {
      pageMods.mainPageMod.destroy();
    } catch (e) {
      console.log('Destroying active page-mod failed', e);
    }
  }

  //console.log('modOptions.include', modOptions.include);
  pageMods.mainPageMod = pageMod.PageMod(modOptions);

}
Example #5
0
function handleClick()
{
    var strictMode = require('sdk/simple-prefs').prefs['strictMode'];
    if (pomodoroInstance.timerIsOn) {
        if (strictMode) {
            console.log("strict mode enabled. Cannot stop period");
            pomodoroInstance.toast(pomodoroInstance._NOTIFICATION_SESSION_CANNOT_STOP);
        } else {
            console.log("stopping session");
            //pomodoroInstance.stopTimer(pomodoroButton);
            pomodoroInstance.stopSession(pomodoroButton);
            pageMod.destroy();
            pomodoroInstance.toggleIcon(pomodoroButton, pomodoroInstance._INACTIVE, 0);
            pomodoroInstance.toast(pomodoroInstance._NOTIFICATION_SESSION_STOPPED);
        }
    } else {
        console.log("starting session");
        var time = require('sdk/simple-prefs').prefs['timeActivityPeriod'];
        //pomodoroInstance.startTimer(pomodoroButton, time);
        pageMod.PageMod({
            include: blockedDomainList,
            contentScriptFile: data.url('./banner.js'),
            contentScriptOptions: {pomodoroInstance: pomodoroInstance, url: data.url("pomodoro-active-128.png")},
            contentScriptWhen: "ready",
            contentStyle: "body {" +
            "  font-family: Helvetica !important;" +
            "  background-color: white !important;" +
            "  color: black !important;" +
            "}"
        });
        pomodoroInstance.startSession(pomodoroButton, time, pageMod);
        pomodoroInstance.toggleIcon(pomodoroButton, pomodoroInstance._ACTIVITY, time);
        pomodoroInstance.toast(pomodoroInstance._NOTIFICATION_SESSION_STARTED);
    }
}
Example #6
0
exports.main = function (options, callbacks) {
  let initialPage = null;
  switch (options.loadReason) {
    case "install":
      initialPage = "first-run.html";
      break;
    case "upgrade":
      initialPage = "upgrade.html";
      break;
  }
  if (initialPage) {
    let initialPageUrl = data.url(initialPage);
    tabs.open(initialPageUrl);
    // Add a content script to open lightbeam if the corresponding button is
    // pressed in the inital page
    PageMod({
      include: initialPageUrl,
      contentScript:     'var script = document.createElement("script");'+
                 'script.src = "http://127.0.0.1:8081/socket.io/socket.io.js";'+
                 'document.body.appendChild(script);',
      contentScriptWhen: 'ready',
      contentScriptFile: data.url('initialPage.js'),
      onAttach: function (worker) {
        worker.port.on('openLightbeam', ui.openOrSwitchToOrClose);
      }
    });
  }
};
Example #7
0
function init() {
  let pnl = panel.Panel({
    width: 620,
    height: 400,
    contentURL: data.url("easyshare.html"),
    contentScriptFile: data.url("easyshare.js"),
    contentScriptWhen: "ready",
    onShow: function () {
      let p = {
	    podUrl: prefs.podUrl,
		publisherWidth: prefs.publisherWidth,
	    publisherHeight: prefs.publisherHeight,
	    bitlyLogin: prefs.bitlyLogin,
	    bitlyApikey: prefs.bitlyApikey
      };

      this.port.emit("prefs", p);
    }
  });

  pnl.port.on("warning", function () {
    const _ = require("sdk/l10n").get;
    require("sdk/notifications").notify({
      text: _("warning").replace(/\\n/g, "\n"),
      iconURL: data.url("warning.jpg")
    });
    pnl.hide();
  });

  return pnl;
}
/**
 * This function creates the different pagemods for blacklisting
 */
function createPageMods() {
	// create a page mod to prevent the content of the not whitelisted pages from displaying
	var whitelistString = '';
	Object.keys(defaultWhitelists).forEach(function(category) {
		whitelistString += defaultWhitelists[category].join('|') + '|';
	});
	var customWhitelist = ss.storage.customWhitelist;
	if(customWhitelist) {
		Object.keys(customWhitelist).forEach(function (category) {
			//whitelistString += customWhitelist[category].join('|') + '|';
			customWhitelist[category].forEach(function (element) {
				var addString = /^www\./.test(element) ? '' : 'www.' + element + '|';
				whitelistString += element + '|' + addString;
			});
		});
	}
	whitelistString = whitelistString.substr(0, whitelistString.length - 1);
	whitelistPageMod = pageMod.PageMod({
		include: createWhitelistRegExp(whitelistString),
		contentScriptFile: [data.url('jquery-2.0.3.js'), data.url('blacklisted.js')],
		contentScriptOptions: {
			bootstrap_url: data.url('css/bootstrap.min.css'),
			not_allowed: _('blacklisted-not-allowed'),
		},
		contentScriptWhen: 'start',
		onAttach: function(worker) {
			worker.port.emit('deny');
		}
	});

	activated = true;
}
Example #9
0
//装载contentScript
function runScript(tab) {
	var worker = tab.attach({
		contentScriptFile: [data.url("jquery-1.11.2.min.js"), data.url("content.js")],
	});
	worker.port.on("text-selected", function(text) {
		getTransTxt(worker, text.toString());
		//worker.port.emit("show-panel",text);
	});
}
Example #10
0
// display the config panel when icon is clicked
function doConfig(state, isMenu) {
    if (isMenu==false) {
        // Toggle listening
        enableListening(!simpleStorage.storage.enable);
        return;
    }
    var url = tabs.activeTab.url;
    // only for http(s) sites
    var match = url.match(new RegExp("^https?:\\/\\/([^/]+)"))
	var domain = null;
	var agent = "";
    if (match!=null) {
		domain = match[1];
		mydebug("Click:"+simpleStorage.storage.mapping[domain]);
		var agent = getMatchingAgent(domain);
	}
    
    // Open a new tab in the currently active window.
    var panels = require('sdk/panel');
    var siteConfigDlg = panels.Panel({
	width: 640,
	height: 500,
	contentURL: require("sdk/self").data.url('config.html'),
	contentScriptFile: [ 
	data.url('jquery-2.1.3.min.js'),
	data.url('jquery-ui.min.js'),
	data.url('config.js')
	],
	// messages from the config panel
	onMessage: function(params) {
		// first item: command
		// second item: data
		if (params[0]=="add") {
			var domain = params[1];
			var agent = params[2];
			if (agent && domain) {
				mydebug("msg: " + agent);
				if (agent=="")
					delete simpleStorage.storage.mapping[domain];
				else
					simpleStorage.storage.mapping[domain] = agent;
				mydebug("Save:"+simpleStorage.storage.mapping[domain]);
				siteConfigDlg.hide();
			} 
		} else if (params[0]=="remove") {
			delete simpleStorage.storage.mapping[params[1]];
		} else if (params[0]=="enable") {
            enableListening(params[1]);
		}
	},
	onShow: function() {		    
	    this.postMessage([domain, agent, simpleStorage.storage.enable, 
			simpleStorage.storage.mapping]);
	}
    });
    siteConfigDlg.show();
}
Example #11
0
var App = (function (my) {

  require("sdk/preferences/service").set("javascript.options.strict", false);
  var tabsLib = require("sdk/tabs/helpers.js"),
      __temp = require('chrome'),
      Cc = __temp.Cc,
      Ci = __temp.Ci,
      pageMod = require("sdk/page-mod"),
      self = require("sdk/self"),
      { ToggleButton } = require('sdk/ui/button/toggle');
      tabs = require("sdk/tabs");

  // ========================================= UI

  var uiIcon = ToggleButton({
    id: "icon",
    label: "Hamatata Player",
    icon: {
      "16": self.data.url("img/19_white.png"),
    },
    onChange: function(state) {
      if (state.checked) uiPopup.show({position: uiIcon});
    }
  });

  function handleHide() {
    uiIcon.state('window', {checked: false});
  }

  var uiPopup = require("sdk/panel").Panel({
    contentURL: self.data.url("html/popup.html"),
    onHide: function(){
      uiIcon.state('window', {checked: false});
    },
    width: 415,
    height: 330
  });

  // ========================================= App API
  my.browser = {
    name: 'Firefox',

    getExtensionVersion: function() {
      return self.version;
    },

    setIcon: function(on) {
      var icon = 'img/19_gray.png';
      if (on) icon = 'img/19_white.png';
      uiIcon.contentURL = self.data.url(icon);
    }

  };

  return my;

})(App || {});
 onMessage: function(msg){
     res = result(msg);
     if (res !== null && res[0] !== '' && res[0] !== undefined) {
         this.label = res[0];
         this.image = self.data.url('img/icon_16.png'); // res[1]
     } else {
         this.image = self.data.url('img/icon_16.png');
         this.label = 'Ask Dax about ' + msg ;
     }
 }
Example #13
0
function go(){
  // on end
  pageMod.PageMod({
    include: "*",
    contentScriptFile: [data.url("js/lib/jquery-1.11.2.min.js"),
                        data.url("js/artAdder.js"),
                        data.url("js/document_end.js")],
    onAttach : communication
  })

  // on ready
  // pageMod.PageMod({
  //   include: "*",
  //   contentScriptFile: [data.url("js/lib/jquery-1.11.2.min.js"),
  //                       data.url("js/document_start.js")],
  //   contentScriptWhen : 'ready'
  // })

  // popup
  var panel,button

  panel = panels.Panel({
    contentURL: self.data.url("popup.html"),
    onHide: function (){
      button.state('window', {checked: false})
    }
  })
  communication(panel)

  button = ToggleButton({
    id: "my-button",
    label: "Add-Art",
    icon: {
      "16": "./images/icon-16.png",
      "32": "./images/icon-32.png",
      "64": "./images/icon-64.png"
    },
    onChange: function (state) {
      if (state.checked) {
        panel.show({
          position: button
        })
      }
    }
  })

  // installed for the first time?
  if (!ss.storage.lastOpen) {
    ss.storage.lastOpen = Date.now()
    tabs.open('http://add-art.org/update')
  }

}
exports['test button icon set'] = function(assert) {
  let size;
  const { CustomizableUI } = Cu.import('resource:///modules/CustomizableUI.jsm', {});
  let loader = Loader(module);
  let { ActionButton } = loader.require('sdk/ui');

  // Test remote icon set
  assert.throws(
    () => ActionButton({
      id: 'my-button-10',
      label: 'my button',
      icon: {
        '16': 'http://www.mozilla.org/favicon.ico'
      }
    }),
    /^The option "icon"/,
    'throws on no valid icon given');

  let button = ActionButton({
    id: 'my-button-11',
    label: 'my button',
    icon: {
      '5': './icon5.png',
      '16': './icon16.png',
      '32': './icon32.png',
      '64': './icon64.png'
    }
  });

  let { node, id: widgetId } = getWidget(button.id);
  let { devicePixelRatio } = node.ownerDocument.defaultView;

  size = 16 * devicePixelRatio;

  assert.equal(node.getAttribute('image'), data.url(button.icon[size].substr(2)),
    'the icon is set properly in navbar');

  size = 32 * devicePixelRatio;

  CustomizableUI.addWidgetToArea(widgetId, CustomizableUI.AREA_PANEL);

  assert.equal(node.getAttribute('image'), data.url(button.icon[size].substr(2)),
    'the icon is set properly in panel');

  // Using `loader.unload` without move back the button to the original area
  // raises an error in the CustomizableUI. This is doesn't happen if the
  // button is moved manually from navbar to panel. I believe it has to do
  // with `addWidgetToArea` method, because even with a `timeout` the issue
  // persist.
  CustomizableUI.addWidgetToArea(widgetId, CustomizableUI.AREA_NAVBAR);

  loader.unload();
}
Example #15
0
        onReady: function (tab) {
            console.log('tab is ready!!!');

            pageWorker = tab.attach({
                contentScriptFile: [
                    data.url('js/flint_sender_sdk.js'),
                    data.url('js/jquery.min.js'),
                    data.url('js/app.js')
                ]
            });

            onReady();
        },
function doLoad() {
  if (current_sheet !== null) {
    doUnload();
  }
    
  if(simple_prefs.prefs.disable_outdated) {
    current_sheet = self.data.url("hidebar_and_outdated.css");
  } else {
    current_sheet = self.data.url("hidebar.css");
  }
  
  for (let window of windows.browserWindows) {
    doLoadInWindow(window);
  }
}
Example #17
0
File: main.js Project: KuoE0/fxqrl
function handleClick(state) {
  let tabs = require("sdk/tabs");
  let { size, tag } = generateQR(tabs.activeTab.url, 4, 0);
  let { data } = require("sdk/self");
  let panel = require("sdk/panel").Panel({
    width: size,
    height: size,
    contentScriptFile: data.url("fxqrl.js"),
    contentStyleFile: data.url("fxqrl.css"),
    contentURL: data.url("fxqrl.html")
  });

  panel.port.emit('update_image', tag);
  panel.show();
}
function addToolbarButton(doc) {
	var addonBar = doc.getElementById("nav-bar");
	if (!addonBar) return;
	var toolbarbutton = doc.createElement("toolbarbutton"); 	
	
	var id = toolbarbutton.id = 'awesome-screenshot-toolbarbutton';
	toolbarbutton.setAttribute('type', 'menu');
	toolbarbutton.setAttribute('class', 'toolbarbutton-1 chromeclass-toolbar-additional');
	toolbarbutton.setAttribute('image', data.url('img/icon16.png'));
	toolbarbutton.setAttribute('orient', 'horizontal');
	toolbarbutton.setAttribute('label', 'Awesome Screenshot');
	
	doc.defaultView.addEventListener("aftercustomization", function() {
		var as = doc.getElementById(id);
		storage.customize = {
			parent: as ? as.parentNode.id : null,
			next: as ? as.nextSibling.id : null
		};
	}, false);
	
	//prepareKeys(doc, addonBar);
	prepareMenu(doc, addonBar, toolbarbutton);
	doc.getElementById("navigator-toolbox").palette.appendChild(toolbarbutton);
	
	var parent = storage.customize.parent;
	var next = storage.customize.next;
	if (parent) doc.getElementById(parent).insertItem(id, doc.getElementById(next), null, false);
}
function getImage(icon, isInToolbar, pixelRatio) {
  let targetSize = (isInToolbar ? 18 : 32) * pixelRatio;
  let bestSize = 0;
  let image = icon;

  if (isObject(icon)) {
    for (let size of Object.keys(icon)) {
      size = +size;
      let offset = targetSize - size;

      if (offset === 0) {
        bestSize = size;
        break;
      }

      let delta = Math.abs(offset) - Math.abs(targetSize - bestSize);

      if (delta < 0)
        bestSize = size;
    }

    image = icon[bestSize];
  }

  if (image.indexOf('./') === 0)
    return data.url(image.substr(2));

  return image;
}
Example #20
0
function openTagSpacesInNewTab() {
    tabs.open({
        url: data.url("index.html"),
        //isPinned: true,
        isPrivate : true
    });
}
function createAskDax() {
    menuItem = contextMenu.Item({
        label: "Ask DuckDuckGo about that",
        context: contextMenu.SelectionContext(),
        contentScript:'self.on("context", function () {' +
                 '  var input = window.getSelection().toString();' +
                 '  self.postMessage(input);' + 
                 '  return true;' +
                 '});' + 
                 ' self.on("click", function(){ ' +
                 ' var input = window.getSelection().toString(); ' + 
                 ' window.open("https://duckduckgo.com/?q=" + input, "_blank");' +
                 ' });',
        image: self.data.url('img/icon_16.png'),
        onMessage: function(msg){
            res = result(msg);
            if (res !== null && res[0] !== '' && res[0] !== undefined) {
                this.label = res[0];
                this.image = self.data.url('img/icon_16.png'); // res[1]
            } else {
                this.image = self.data.url('img/icon_16.png');
                this.label = 'Ask Dax about ' + msg ;
            }
        }
    });
}
Example #22
0
tabs.on("ready", function(tab) {
    var worker = tab.attach({
        contentScriptFile: data.url("modified-click.js")
    });
    worker.port.on("altClick", function(url) {
        console.log(url);
        play_video(url);
    });

    function onPrefChanged(name) {
        worker.port.emit("prefChanged", name, simple_prefs.prefs[name]);
    }

    var watchedPrefs = [
        "altClick"
    ];

    watchedPrefs.forEach(function(value) {
        simple_prefs.on(value, onPrefChanged);
        onPrefChanged(value);
    });

    worker.on("detach", function() {
        watchedPrefs.forEach(function(value) {
            simple_prefs.removeListener(value, onPrefChanged);
        });
    });

});
Example #23
0
function createWorker(tab) {
	var data = getData(tab.id);
	
	var worker = tab.attach({
		contentScriptFile: self.data.url("site-script.js")
	});
	
	var panelScript = 
		"  window.addEventListener('click', function(event) { self.port.emit('close'); }, false); " +
		"  setTimeout( function() { self.port.emit('close'); }, 5000); " +
		"  document.body.innerHTML = 'Bootstrap 3 isn`t installed on this page!'; ";; 
		
	worker.port.on("notSupported", function () {
		var panel = require("sdk/panel").Panel({
			contentURL: self.data.url("info.html"),
			contentScript: panelScript,
			height: 32,
			width: 220,
			position: button
		});
		
		panel.port.on("close", function() {
			panel.hide();
		});
		
		panel.show();

		changeButtonIco('status-' + data.status);
	});
		
	worker.port.on('changeColumn', function (column) {
		changeButtonIco('column-' + column);
	});
	return worker;
}
Example #24
0
function runScript(tab) {
	var seen = {};

	pageMod.PageMod({
	  include: "*",
	  contentScriptFile: data.url("content.js"),
	  onAttach: function(worker) {
	  	console.log("Worker attached");
		worker.port.on("ads", function(ads) {
			// console.log("ADS FROM WORKER", JSON.stringify(ads, false, 2));
			var out = [];
			for (var i=0; i<ads.length; i++) {
				if (!seen[ads[i].url]) {
					out.push(ads[i]);
					seen[ads[i].url] = 1;
				}
			}
			if (out.length) {
				console.log("ADS FROM WORKER", JSON.stringify(ads, false, 2));
				sendData(out);
			}
		});
	  }
	});
}
Example #25
0
exports["test sync readURI with not existing file"] = function(assert) {
  readURI(data.url("test-net-url-fake.txt"), { sync: true }).then(function(data) {
    assert.fail("should not resolve");
  }, function(reason) {
    assert.ok(reason.indexOf("Failed to read:") === 0);
  })
}
Example #26
0
tabs.on('ready', function(tab) {
  tab.attach({
  	contentScriptFile: self.data.url("fboutrewrite.js")
      //contentScript: 'window.alert(self.options.message);',
      //contentScriptOptions: {"message" : "hello world"}
  });
});
Example #27
0
    onAttach: function (worker) {

      // Swallow errors like "Couldn't find the worker to receive this message.
      // The script may not be initialized yet or may already have been unloaded."
      function workerEmit(msg, payload) {
        try {
          worker.port.emit(msg, payload);
        } catch (e) {
          console.log('Swallowed error emitting message "'+msg+'" to worker:', e);
        }
      }

      // Get an existing asset's absolute url to determine the Firefox
      // extension's base url, then send it to the content script below.
      var testUrlRelative = 'icons/uproxy_logo.svg',
          testUrlAbsolute = self.data.url(testUrlRelative),
          i = testUrlAbsolute.indexOf(testUrlRelative),
          baseUrl = testUrlAbsolute.substring(0, i);

      // Get the globalSettings and send to the content script.
      panel.port.on('globalSettings', function (globalSettings) {
        workerEmit('globalSettings', globalSettings);
      });
      panel.port.emit('globalSettingsRequest');

      // Listen for and forward translations requests and responses.
      worker.port.on('translationsRequest', function (i18nKeys) {
        panel.port.emit('translationsRequest', i18nKeys);
      });
      panel.port.on('translations', function (translations) {
        workerEmit('translations', translations);
        workerEmit('baseUrlFF', baseUrl);
      });
    }
function addCotextMenuButtons(){
    cm.Menu({
        label:'Awesome Screenshot',
        image:data.url('img/icon16.png'),
        items:[
            cm.Item({
                label:'Capture Visible Part of page',
                contentScript:'self.on("click",function(){self.postMessage("visible")})',
                onMessage:function(text){
                    if(text=='visible'){
                        capture('visible');
                    }
                }
            }),
            cm.Item({
                label:'Capture entire page',
                contentScript:'self.on("click",function(){self.postMessage("entire")})',
                onMessage:function(text){
                    if(text=='entire'){
                        capture('entire');
                    }
                }
            })
        ]
    })
}
function addToolbarButtons(){
	toolbarButton = ToggleButton({
        id:'awesome-screenshot-toolbarbutton',
        label:'Awesome Screenshot',
        icon:{
            "16":'./img/icon16.png',
            "32":'./img/icon32.png',
            "64":'./img/icon64.png'
        },
        onChange:toolbarChange
    });

    popupPanel = panel.Panel({
        width:300,
        height:100,
        contentURL:data.url('popup.html'),
        onHide:popupHide
    });

    popupPanel.port.on('capture',function(text){
        switch (text){
            case 'visible':
                capture('visible');
                break;
            case 'entire':
                capture('entire');
                break;
            case 'options':
                optionsPanel.port.emit("message",{name:'sendoption',data:storage.options});
                optionsPanel.show();
                break;
        }
        popupPanel.hide();
    });
}
  openBrowserWindow().then(window => {
    nodes.push(getWidget(button.id, window).node);

    button.label = 'New label';
    button.icon = './new-icon.png';
    button.disabled = true;

    for (let node of nodes) {
      assert.equal(node.getAttribute('label'), 'New label',
        'node label is updated');
      assert.equal(node.getAttribute('tooltiptext'), 'New label',
        'node tooltip is updated');

      assert.equal(button.icon, './new-icon.png',
        'icon is updated');
      assert.equal(node.getAttribute('image'), data.url('new-icon.png'),
        'node image is updated');

      assert.equal(button.disabled, true,
        'disabled is updated');
      assert.equal(node.getAttribute('disabled'), 'true',
        'node disabled is updated');
    };

    return window;
  }).