SummerOfCode/2012/UserCSP/WeeklyUpdates/2012-05-21

From MozillaWiki
Jump to: navigation, search

This Week

Monday, 21 May

  • Database ("userCSP.sqlite") is created using third-party module "sqlite" for Jetpack.
  • To store user defined policies for web site "userCSPTable" table is created in "userCSP.sqlite" database.
  • I modified the third-party "sqlite" module to operate on my custom database table. Such as "tableUsedOrNew" method is added to check whether "userCSPTable" table exits on user's computer or not. IF not then it create the table.
  • The "userCSPTable" contains 11 columns. domainName, defaultSrc, scriptSrc, objectSrc, imgSrc, mediaSrc, styleSrc, frameSrc, fontSrc , xhrSrc, frameAncestors.
  • The data type of each field in the table is "text", and the "domainName" is the primary key to retrieve and store CSP policies from database.

Tuesday, 22 May

  • To dynamically create entries for Domain Name select drop down box in the UI, I used "tabs" module.
    • I registered for "ready" event listener of the "tabs" module. When this event listener fires, I retrieve the tab url string.
    • I used "url" module to convert url string into URL object, so that I can retrieve its properties like host, scheme, port, etc.
    • From "ready" event listener of tabs, I send "host" name to the add-on UI component to add host name to the drop down select menu list.
    • I also registered for "close" event listener in "tabs" module. This will send host name to add-on UI component to remove the host name from drop down select menu list. However, its coding is not yet completed.

Wednesday, 23 May

  • Added onchange evt listener to Directives drop down list. Also added logic to remember previous selected option.
  • Supported restore of rules upon directive re-selection.

Thursday, 24 May

  • Added Enable/Disable radio group to UI: It allows users to enable or disable there rules for the selected domain name
  • Bydefault state of Enable/Disable radio button is set to Enable
  • Added JS logic to remember state for each domain.

Friday, 25 May

  • Fixed bug in auto save of directives contents when domain name onchange event fires