Difference between revisions of "User:AaronMT"

From CDOT Wiki
Jump to: navigation, search
m (Modify the Browser - Extensions)
m (Mozilla Labs)
Line 311: Line 311:
  
 
<font color="red">'''Removal instructions:'''</font> Tools -> Addons -> Uninstall -> Restart the browser
 
<font color="red">'''Removal instructions:'''</font> Tools -> Addons -> Uninstall -> Restart the browser
 +
 +
==== XPCOM - Extension ====
 +
http://aaronmt.wordpress.com/2008/11/15/my-first-xpcom-extension-lab/
  
 
== Bugs ==
 
== Bugs ==

Revision as of 20:10, 14 November 2008

Greetings

AaronMT.jpg

Hello, my name is Aaron Train. I am a recent graduate of Computer Programming and Analysis. As of the previous winter (08), I have transferred into the BSD program to earn a degree. Currently, I am enrolled in a whole slew of different courses ranging from the 3rd to the 7th semester. I find open source fascinating, particularly Mozilla's projects as well as Canonical's Ubuntu GNU/Linux project. I look forward to tinkering with the innards of Firefox, in DPS909. I also enjoy learning more about software development, open source and current/future web applications, and lastly modern programming languages.

  • Name: Aaron Train
  • Program: Bachelor of Software Development
  • Hometown: Thornhill, Ontario

Contact

  • Internet Relay Chat (IRC)
  • E-Mail
    • Seneca E-Mail: amtrain at learn.senecac dot on dot ca
    • Personal E-Mail: aaron dot train at gmail dot com

Blog

DPS909A - Fall 2008

After reading about many projects and finding my interests, I have selected a project that stands out for me as something I'd be willing to help contribute to and sounds like fun to work with in the process. I have an interest in computer security and this seems like a fit. I can relate to this function of the browser being implemented in a sense to how people want to surf anonymously in public areas. For example, if I *must* do some online banking while on a public terminal at school - privacy is a must

Project for DPS909

Project Name Description Leader(s) Community or Communities
Contribute to Private Browsing Tests The new Private Browsing feature (see bug 248970 and the test plan) needs thorough tests written in order to insure its proper functionality. This will involve collaborating with those writing the patch and tests in order to develop a full suite of tests. Aaron Train Mozilla

Project Notes

  • To run a single unit-test use check-one SOLO_FILE
    • Example
mozilla-central$ make -C obj*/netwerk/test check-one SOLO_FILE=test_bug248970.js

Deliverance for DPS909

Contributions for DPS909

FSOSS 2008 Report

Free Software and Open Source Symposium 2008 Report

Bugs for DPS909

Labs

Mozilla Labs

In preparation for DPS909 - Lab #2 (Week 3) I will outline my intended computer/OS that I will be documenting my process through the lab on ...

Ubuntu GNU/Linux - Mozilla Build (Minefield 3.1b1pre)

The process involved in building Mozilla Firefox (Minefield 3.1b1pre) on Ubuntu GNU/Linux involved many steps (all of which are new to me entirely):

  • Hardware
    • 2048MB Ram and 15GB left on this Linux partition
  • Preparation
    • Make sure Ubuntu is up to date
      sudo apt-get install update
    • Linux Build Prerequisites
      • A recent POSIX Shell
      • A C++ compiler.
      • Perl 5.6 or higher. Older perl versions may work if you upgrade File::Spec to version 0.8
      • GNU make 3.79.1 or higher. Other varieties of "make" will not work.
      • CVS 1.11 or higher
      • the GTK2 widget toolkit
      • libXt-devel for X11/Intrinsic.h, X11/Shell.h
      • libIDL 0.6.3
      • zip 2.3
      • freetype 2.1.0
      • fontconfig
      • pkg-config 0.9.0

Most if not all packages were installed with the following command

apt-get build-dep firefox
sudo apt-get install libdbus-glib-1-dev curl
sudo apt-get install libcurl4-openssl-dev
Obtaining the Mozilla-Central Source & Installing/Configuring Mercurial

The next step, should you choose to install Firefox 3.01+ is to grab Mercurial and set it up properly.

  • sudo apt-get install python-setuptools python-dev build-essential 
  • sudo easy_install -U mercurial
Configuration (Highly Suggested)
  • It is highly suggested that you follow these configuration instructions here
Fetching the latest trunk build of Firefox
  • hg clone http://hg.mozilla.org/mozilla-central/ ~/Desktop/src
Building on Ubuntu GNU/Linux

Configure and build as usual using a .mozconfig file and make -f client.mk.

  • My ~/.mozconfig
# My first mozilla config
. $topsrcdir/browser/config/mozconfig
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-@CONFIG_GUESS@
ac_add_options --disable-optimize
ac_add_options --enable-debug
ac_add_options --disable-static --enable-shared
  • Building!
cd ~/Desktop/src/
make -f client.mk build
  • Running Firefox
cd ~/Desktop/src/obj-i686-pc-linux-gnu/dist/bin/
./firefox
  • Total Build Time: ~ 45 minutes

Minefield 3.1b1pre


Mozilla Ubiquity

Ubiquity Commands - Work in Progress

Display IP address
  • Displays users IP address immediately

by AaronMT

Usage: ip

Utilizes the whatismyip website to parse the IP and display it right in the console

CmdUtils.CreateCommand({
name: "ip",
  homepage: "http://aaronmt.wordpress.com",
  author: { name: "Aaron Train", email: "aaron.train@gmail.com"},
  description: "Displays your internal IP address.",
  help: "Just type IP",
  icon: "http://whatismyip.com/favicon.ico",
  preview: function(pblock) {
    var url = "http://whatismyip.com/automation/n09230945.asp";
    jQuery.get( url, function(data) {
       pblock.innerHTML = data;
    });
  },
  execute: function() {
    var url = "http://whatismyip.com";
    Utils.openUrlInBrowser(url);
  },
});
Search MedicineNet
  • Searches MedicineNet with a given keyword

by AaronMT

Usage: health keyword phrase

CmdUtils.CreateCommand(
{
	name: "health",
	homepage: "http://medicinenet.com",
	author: { name: "Aaron Train", email: "aaron.train@gmail.com" },
	description: "Takes keyword phrase and searches MedicineNet",
	help: "health <i>keyword phrase</i>",
	icon: "http://images.medicinenet.com/images/fav/MN.ico",
	takes: {"Enter a noun": noun_arb_text},
	preview: function(pblock, keywordPhrase)
	{
		pblock.innerHTML = "Search the MedicineNet by entering any phrase <b>" + keywordPhrase.text + "</b>"
	},

	execute: function(keywordPhrase)
	{
		var searchURL = "http://www.medicinenet.com/" + keywordPhrase.text;
		Utils.openUrlInBrowser(searchURL);
	}
});
Pastebin
  • Transfers selected text to a new pastebin>

Usage: pb

CmdUtils.CreateCommand({
name: "pb",
  homepage: "http://aaronmt.wordpress.com",
  author: { name: "Aaron Train", email: "aaron.train@gmail.com"},
  description: "Transfers selected text to a new Pastebin.",
  help: "Selected text will be sent to a new Pastebin",
  icon: "http://pastebin.ca/pastebin.ico",
  preview: function(pblock) {
    var text=context.focusedWindow.document.getSelection();
    var url = "http://pastebin.ca";
  },
  execute: function() {
    var url = "http://pastebin.ca";
    var text=context.focusedWindow.document.getSelection();
    displayMessage(text);
    Utils.openUrlInBrowser(url);
  },
});

Real World Mozilla Source Code Reading Lab

For this lab, I have selected the browser function, Bookmarks -> Bookmark This Page and have done a little digging in the latest Mozilla Trunk build to find out where the functionality is situated deep within the Mozilla code.

What my digging through Mozilla Cross Reference has uncovered:

An initial search for Bookmark This Page revealed..

  • browser.dtd
    • <!ENTITY bookmarkThisPageCmd.label "Bookmark This Page">
  • browser-menubar.inc
    •  <menuitem label="&bookmarkThisPageCmd.label;" command="Browser:AddBookmarkAs" key="addBookmarkAsKb"/>
  • browser.js
    • // Disable inappropriate commands / submenus  var disabledItems = [''Browser:AddBookmarkAs'];

My search led me to browser.js but I could not find anything related to AddBookmarkAs.

Bugs, Bugzilla, and Debugging

For this lab, I will look at the primary bug associated with my project: Bug #248970

Bug associated with Bug #248970

  • Depends On
    • Bug #456884 - Provide a way to open a link to Private Browsing Mode
    • Bug #457110 - Support in-memory DB for the downloads manager back-end
  • Blocker
    • Bug #454792 - Should safe browsing code react to private browsing mode?

Bug Fixing with Mozilla Thunderbird 3.0b1pre

Tbshredder.png

  • For this lab, I downloaded a fresh trunk build of Mozilla Thunderbird 3.0b1pre from mercurial.
hg clone http://hg.mozilla.org/comm-central/ src
  • Once the repository had been cloned, I updated
python client.py checkout
  • This essentially, pulls the core mozilla-central codebase (Firefox 3.1/xulrunner 1.9.1) into mozilla/

and pulls the following directories from cvs (the directories prefixed by extensions/ go into mozilla/extensions):

    • calendar
    • extensions/irc (Chatzilla)
    • extensions/typeaheadfind
    • extensions/venkman
    • extensions/wallet
    • directory/c-sdk
  • Using the following ~/.mozconfig, I built Mozilla Thunderbird / Shredder 3.01b1pre
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-@CONFIG_GUESS@ 
ac_add_options --disable-optimize 
ac_add_options --enable-debug 
ac_add_options --disable static --enable-shared 
ac_add_options --enable-application=mail
  • Next, I tested the bug
    • Notice the mishandling of proper hyper linking. The text that is hyper linked should not be.

Tbshredderbug.png

  • Next, I submitted a bug on Bugzilla
  • Following that, I began to scour for the cause of this bug looking through the hinted mozilla/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp

and found the line, #197, with the following condition

if (inString.FindChar('.', pos) != kNotFound) // if we have a '.' after the @ sign....
  • For this function to perform properly, the line needs to be changed to
if ((inString.FindChar('.', pos) != kNotFound) && (inString.Find("..",0)==kNotFound))
  • Next, I created a patch for the solution by executing the following
hg diff -p -U 8 > patch.txt

The contents of the patch containing the solution to the problem can be found here, Bug #6817 - Patch

  • Lastly, I submitted my patch to my created bug on Bugzilla, asking for review from David.Humphrey.

Dive into Mozilla Modifying Firefox using an Extension Lab

Experience + Code Used found here http://aaronmt.wordpress.com/2008/10/28/lab-7-modifying-mozilla-firefoxs-tab-behaviour/

Modify the Browser - Extensions

The following is an extension written in November 2008, Week 8 of DPS909. addtabbrowser.xpi - 'Add Tab Browser' is a very minimalistic extension that modifies the behavior of the placement of tabs after they open. Behavior of tabs is altered in that new tabs are placed after the currently selected tab, rather than placed at the very end of the tab list. This extension was written as an introduction into the world of writing extensions and modifying behavior of Mozilla Firefox.

Download link here: Addtabbeside.xpi‎ (file size: 2 KB, MIME type: application/x-xpinstall)

File contents contained within addtabbeside.xpi

  • addtabbeside@senecac.on.ca
    • chrome.manifest
    • install.rdf
      • chrome
        • content
          • addtabbeside.js
          • overlay.xul


Install instructions: Drag addtabbeside.xpi into your main browser. The addons install manager will detect and properly install the extension.

Removal instructions: Tools -> Addons -> Uninstall -> Restart the browser

XPCOM - Extension

http://aaronmt.wordpress.com/2008/11/15/my-first-xpcom-extension-lab/

Bugs

Ubuntu

[1] Bugs I have reported

Firefox

[2] Bugs I have reported

External Projects

I am deeply passionate with the Ubuntu project. Having first used it in its infancy and being involved with the community, collaborating with the community to better the product has been a hobby and passion of mine for the past few years. I have been contributing to many tutorials and solutions in the community, such as: