SummerOfCode/2013/SecurityReport/WeeklyUpdates/2013-06-24

From MozillaWiki
Jump to: navigation, search

This Week

Monday, 24 June

  • Finally, I was able to register a toolbox with UI. The add-on UI is created in securityReport.xhtml file because for .XUL files Firefox was giving permission denied errors in the Jetpack add-on.
var data = require("self").data;
let securityToolDefinition = {
   id: "security-report-tool",
   label: "Security Report",
   icon: data.url("images/icon.png"),
   url: data.url("securityReport.xhtml"),
   tooltip: "Security Report Tool",
   isTargetSupported: function() true,
   build: function() {}
 };
 gDevTools.registerTool(securityToolDefinition); // register a ToolBox

Tuesday, 25 June

  • GCLI command structure added to add-on. GCLI commands can us used by users to activate our tool as well as get reports of particular security type using Global Command Line commands.
// Register GCLI commands for our tool
function addCommands() {
   Cu.import("resource:///modules/devtools/gcli.jsm");
  /*
  * 'security-report' command.
  */
 gcli.addCommand({
   name: "security-report",
   description: "Control the security report tool using the following commands:"
 });
 // TODO --- Add more commands here
} // end of addCommands() function

Wednesday, 26 June

  • Next challenge for me to establish communication between a Toolbox panel code and content scripts in add-on.
  • I used "self.port.emit" and "addon.on" function, but it didn't work with a Toolbox.
  • From IRC channel #devtools I came to know that developer tools have EventEmitter APIs. This might help me to establish communication between Toolbox panel and content scripts.

Thursday, 27 June

  • After various trial and errors, finally I found a way to establish communication between content scripts and chrome scripts in Jetpack add-on. Thanks to "freddyb" on IRC for pointing me to useful links.
  • Communication between content scripts and chrome scripts was required for my project to send information about user selection of the security error tab to the chrome scripts. I need that information to switch view of security errors according to their category.

Friday, 28 June