merge commit for bug 440797
authorDaniel Brooks <db48x@db48x.net>
Fri, 25 Jul 2008 18:44:05 -0500
changeset 64780 2f65707123c71f26760cf32a08fececcf689eb3d
parent 64779 b331215da62a5d557a51d64da02510df6a2eeecb (current diff)
parent 64778 a962747a78cc9942282c3bd280d9f47b19f0c648 (diff)
child 64781 7b078592c1fdcd6ed75a5e5b909a0e33514bfa83
child 64885 ab9e6854e0faf1066b12b84166def09cb7225252
push id19389
push userffxbld
push dateWed, 06 Apr 2011 21:33:21 +0000
treeherdermozilla-central@8e9f90073a20 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs440797
merge commit for bug 440797
mobile/chrome/content/browser.js
mobile/chrome/content/browser.xul
mobile/chrome/locale/en-US/browser.dtd
--- a/mobile/Makefile.in
+++ b/mobile/Makefile.in
@@ -37,11 +37,11 @@
 
 DEPTH      = ..
 topsrcdir  = @top_srcdir@
 srcdir     = @srcdir@
 VPATH      = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-DIRS       = chrome app
+DIRS       = chrome app components
 
 include $(topsrcdir)/config/rules.mk
--- a/mobile/app/mobile.js
+++ b/mobile/app/mobile.js
@@ -156,8 +156,56 @@ pref("browser.search.update.log", false)
 pref("browser.search.updateinterval", 6);
 
 // enable search suggestions by default
 pref("browser.search.suggest.enabled", true);
 
 // enable xul error pages
 pref("browser.xul.error_pages.enabled", true);
 
+// Various and sundry awesomebar prefs (should remove/re-evaluate
+// these once bug 447900 is fixed)
+pref("browser.urlbar.clickSelectsAll", true);
+pref("browser.urlbar.doubleClickSelectsAll", false);
+pref("browser.urlbar.autoFill", false);
+pref("browser.urlbar.matchOnlyTyped", false);
+pref("browser.urlbar.matchBehavior", 1);
+pref("browser.urlbar.filter.javascript", true);
+pref("browser.urlbar.maxRichResults", 12);
+pref("browser.urlbar.search.chunkSize", 1000);
+pref("browser.urlbar.search.timeout", 100);
+pref("browser.urlbar.restrict.history", "^");
+pref("browser.urlbar.restrict.bookmark", "*");
+pref("browser.urlbar.restrict.tag", "+");
+pref("browser.urlbar.match.title", "#");
+pref("browser.urlbar.match.url", "@");
+pref("browser.history.grouping", "day");
+pref("browser.history.showSessions", false);
+pref("browser.sessionhistory.max_entries", 50);
+pref("browser.history_expire_days", 180);
+pref("browser.history_expire_days_min", 90);
+pref("browser.history_expire_sites", 40000);
+pref("privacy.item.history",     true);
+pref("browser.places.migratePostDataAnnotations", true);
+pref("browser.places.updateRecentTagsUri", true);
+pref("places.frecency.numVisits", 10);
+pref("places.frecency.numCalcOnIdle", 50);
+pref("places.frecency.numCalcOnMigrate", 50);
+pref("places.frecency.updateIdleTime", 60000);
+pref("places.frecency.firstBucketCutoff", 4);
+pref("places.frecency.secondBucketCutoff", 14);
+pref("places.frecency.thirdBucketCutoff", 31);
+pref("places.frecency.fourthBucketCutoff", 90);
+pref("places.frecency.firstBucketWeight", 100);
+pref("places.frecency.secondBucketWeight", 70);
+pref("places.frecency.thirdBucketWeight", 50);
+pref("places.frecency.fourthBucketWeight", 30);
+pref("places.frecency.defaultBucketWeight", 10);
+pref("places.frecency.embedVisitBonus", 0);
+pref("places.frecency.linkVisitBonus", 100);
+pref("places.frecency.typedVisitBonus", 2000);
+pref("places.frecency.bookmarkVisitBonus", 150);
+pref("places.frecency.downloadVisitBonus", 0);
+pref("places.frecency.permRedirectVisitBonus", 0);
+pref("places.frecency.tempRedirectVisitBonus", 0);
+pref("places.frecency.defaultVisitBonus", 0);
+pref("places.frecency.unvisitedBookmarkBonus", 140);
+pref("places.frecency.unvisitedTypedBonus", 200);
--- a/mobile/chrome/content/browser-ui.js
+++ b/mobile/chrome/content/browser-ui.js
@@ -34,31 +34,33 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 const TOOLBARSTATE_LOADING        = 1;
 const TOOLBARSTATE_LOADED         = 2;
 const TOOLBARSTATE_INDETERMINATE  = 3;
 
-const PANELMODE_VIEW              = 1;
-const PANELMODE_EDIT              = 2;
+const PANELMODE_NONE              = 0;
+const PANELMODE_URLVIEW           = 1;
+const PANELMODE_URLEDIT           = 2;
 const PANELMODE_BOOKMARK          = 3;
 const PANELMODE_BOOKMARKLIST      = 4;
+const PANELMODE_SIDEBAR           = 5;
+const PANELMODE_TABLIST           = 6;
+const PANELMODE_FULL              = 7;
 
 var BrowserUI = {
   _panel : null,
   _caption : null,
   _edit : null,
   _throbber : null,
   _autocompleteNavbuttons : null,
   _favicon : null,
   _faviconAdded : false,
-  _fadeoutID : null,
-  _allowHide : true,
 
   _titleChanged : function(aEvent) {
     if (aEvent.target != getBrowser().contentDocument)
       return;
 
     this._caption.value = aEvent.target.title;
   },
 
@@ -142,52 +144,49 @@ var BrowserUI = {
     this._edit.addEventListener("input", this, false);
     this._throbber = document.getElementById("urlbar-throbber");
     this._favicon = document.getElementById("urlbar-favicon");
     this._favicon.addEventListener("error", this, false);
     this._autocompleteNavbuttons = document.getElementById("autocomplete_navbuttons");
 
     getBrowser().addEventListener("DOMTitleChanged", this, true);
     getBrowser().addEventListener("DOMLinkAdded", this, true);
+    Browser.content.addEventListener("overpan", this, false);
+    Browser.content.addEventListener("pan", this, true);
   },
 
   update : function(aState) {
     if (aState == TOOLBARSTATE_INDETERMINATE) {
       this._faviconAdded = false;
       aState = TOOLBARSTATE_LOADED;
       this.setURI();
     }
 
     var toolbar = document.getElementById("toolbar-main");
     if (aState == TOOLBARSTATE_LOADING) {
-      this._showMode(PANELMODE_VIEW);
+      this.show(PANELMODE_URLVIEW);
 
       toolbar.setAttribute("mode", "loading");
       this._throbber.setAttribute("src", "chrome://browser/skin/images/throbber.gif");
       this._favicon.setAttribute("src", "");
       this._faviconAdded = false;
     }
     else if (aState == TOOLBARSTATE_LOADED) {
       toolbar.setAttribute("mode", "view");
       this._throbber.setAttribute("src", "");
       if (this._faviconAdded == false) {
         var faviconURI = getBrowser().currentURI.prePath + "/favicon.ico";
         this._setIcon(faviconURI);
       }
-/*
-      if (this._allowHide)
-        this.hide(3000);
-      this._allowHide = true;
-*/
     }
   },
 
   /* Set the location to the current content */
   setURI : function() {
-    var browser = getBrowser();
+    var browser = Browser.currentBrowser;
     var back = document.getElementById("cmd_back");
     var forward = document.getElementById("cmd_forward");
 
     back.setAttribute("disabled", !browser.canGoBack);
     forward.setAttribute("disabled", !browser.canGoForward);
 
     // Check for a bookmarked page
     var star = document.getElementById("tool-star");
@@ -207,46 +206,46 @@ var BrowserUI = {
 
     try {
       uri = this._URIFixup.createExposableURI(uri);
     } catch (ex) {}
 
     var urlString = uri.spec;
     if (urlString == "about:blank") {
       urlString = "";
-      this._showMode(PANELMODE_EDIT);
-      this._allowHide = false;
+      this.show(PANELMODE_URLEDIT);
     }
 
     this._caption.value = urlString;
     this._edit.value = urlString;
   },
 
   goToURI : function(aURI) {
     this._edit.reallyClosePopup();
 
     if (!aURI)
       aURI = this._edit.value;
 
     var flags = Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
     getBrowser().loadURIWithFlags(aURI, flags, null, null);
-    this._showMode(PANELMODE_VIEW);
+    this.show(PANELMODE_URLVIEW);
   },
 
   search : function() {
     var queryURI = "http://www.google.com/search?q=" + this._edit.value + "&hl=en&lr=&btnG=Search";
     getBrowser().loadURI(queryURI, null, null, false);
 
-    this._showMode(PANELMODE_VIEW);
+    this.show(PANELMODE_URLVIEW);
   },
 
   sizeAutocompletePopup : function () {
     var rect = document.getElementById("browser-container").getBoundingClientRect();
+    var toolbar = document.getElementById("toolbar-main");
     var popup = document.getElementById("popup_autocomplete");
-    popup.height = rect.bottom - rect.top;
+    popup.height = rect.bottom - rect.top - toolbar.boxObject.height;
   },
 
   openDefaultHistory : function () {
     if (!this._edit.value) {
       this._autocompleteNavbuttons.hidden = true;
       this._edit.showHistoryPopup();
     }
   },
@@ -291,54 +290,102 @@ var BrowserUI = {
       button.setAttribute("label", engine.name);
       if (engine.iconURI)
         button.setAttribute("image", engine.iconURI.spec);
       container.insertBefore(button, container.firstChild);
       button.engine = engine;
     }
   },
 
-  _showMode : function(aMode) {
-    if (this._fadeoutID) {
-      clearTimeout(this._fadeoutID);
-      this._fadeoutID = null;
-    }
+  mode : PANELMODE_NONE,
+  show : function(aMode) {
+    if (this.mode == aMode)
+      return;
+    this.mode = aMode;
 
     var toolbar = document.getElementById("toolbar-main");
     var bookmark = document.getElementById("bookmark-container");
     var urllist = document.getElementById("urllist-container");
-    if (aMode == PANELMODE_VIEW) {
+    var sidebar = document.getElementById("browser-controls");
+    var tablist = document.getElementById("tab-list-container");
+    var container = document.getElementById("browser-container");
+
+    // Make sure the UI elements are sized correctly since the window size can change
+    sidebar.left = toolbar.width = container.boxObject.width;
+    sidebar.height = tablist.height = container.boxObject.height - toolbar.boxObject.height;
+
+    if (aMode == PANELMODE_URLVIEW || aMode == PANELMODE_SIDEBAR ||
+        aMode == PANELMODE_TABLIST || aMode == PANELMODE_FULL)
+    {
       toolbar.setAttribute("mode", "view");
+      toolbar.top = 0;
+
       this._edit.hidden = true;
+      this._edit.reallyClosePopup();
       this._caption.hidden = false;
       bookmark.hidden = true;
       urllist.hidden = true;
+
+      let sidebarTo = toolbar.boxObject.width;
+      let tablistTo = -tablist.boxObject.width;
+      if (aMode == PANELMODE_SIDEBAR || aMode == PANELMODE_FULL)
+        sidebarTo -= sidebar.boxObject.width;
+      if (aMode == PANELMODE_TABLIST || aMode == PANELMODE_FULL)
+        tablistTo = 0;
+      sidebar.left = sidebarTo;
+      tablist.left = tablistTo;
     }
-    else if (aMode == PANELMODE_EDIT) {
+    else if (aMode == PANELMODE_URLEDIT) {
       toolbar.setAttribute("mode", "edit");
+      toolbar.top = 0;
       this._caption.hidden = true;
       this._edit.hidden = false;
       this._edit.focus();
+
       bookmark.hidden = true;
       urllist.hidden = true;
+      sidebar.left = toolbar.boxObject.width;
+      tablist.left = -tablist.boxObject.width;
     }
     else if (aMode == PANELMODE_BOOKMARK) {
+      toolbar.top = 0;
       toolbar.setAttribute("mode", "view");
       this._edit.hidden = true;
+      this._edit.reallyClosePopup();
       this._caption.hidden = false;
 
       urllist.hidden = true;
+      sidebar.left = toolbar.boxObject.width;
+      tablist.left = -tablist.boxObject.width;
+
       bookmark.hidden = false;
+      bookmark.width = container.boxObject.width;
     }
     else if (aMode == PANELMODE_BOOKMARKLIST) {
+      toolbar.top = 0;
       toolbar.setAttribute("mode", "view");
       this._edit.hidden = true;
+      this._edit.reallyClosePopup();
       this._caption.hidden = false;
 
+      bookmark.hidden = true;
+      sidebar.left = toolbar.boxObject.width;
+      tablist.left = -tablist.boxObject.width;
+
       urllist.hidden = false;
+      urllist.width = container.boxObject.width;
+      urllist.height = container.boxObject.height - toolbar.boxObject.height;
+    }
+    else if (aMode == PANELMODE_NONE) {
+      toolbar.top = -toolbar.boxObject.height;
+      sidebar.left = toolbar.boxObject.width;
+      tablist.left = -tablist.boxObject.width;
+
+      this._edit.reallyClosePopup();
+      urllist.hidden = true;
       bookmark.hidden = true;
     }
   },
 
   _showPlaces : function(aItems) {
     var list = document.getElementById("urllist-items");
     while (list.firstChild) {
       list.removeChild(list.firstChild);
@@ -374,80 +421,97 @@ var BrowserUI = {
     list.focus();
   },
 
   showHistory : function() {
     this._showPlaces(this._getHistory(6));
   },
 
   showBookmarks : function () {
+    this.show(PANELMODE_BOOKMARKLIST);
+
     var bms = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].getService(Ci.nsINavBookmarksService);
     this._showPlaces(this._getBookmarks([bms.bookmarksMenuFolder]));
   },
 
-  show : function() {
-    this._showMode(PANELMODE_VIEW);
+  newTab : function() {
+    Browser.content.newTab(true);
+    this.show(PANELMODE_URLEDIT);
   },
 
-  hide : function(aFadeout) {
-    if (!aFadeout) {
-      //FIXME hide toolbar stuff
-      this._showMode(PANELMODE_VIEW);
-    }
-    else {
-      //FIXME animate the close
-      //var self = this;
-      //this.fadeoutID = setTimeout(function() { self.hide(); }, aFadeout);
-    }
+  selectTab : function(aTab) {
+    Browser.content.selectTab(aTab);
+    this.show(PANELMODE_NONE);
   },
 
   handleEvent: function (aEvent) {
     switch (aEvent.type) {
       // Browser events
       case "DOMTitleChanged":
         this._titleChanged(aEvent);
         break;
       case "DOMLinkAdded":
         this._linkAdded(aEvent);
         break;
       // URL textbox events
       case "click":
-        this._showMode(PANELMODE_EDIT);
+        this.show(PANELMODE_URLEDIT);
         this.openDefaultHistory();
         break;
       case "input":
         if (this._edit.value) {
           this.updateSearchEngines();
           this._autocompleteNavbuttons.hidden = false;
         }
         break;
       case "keypress":
         if (aEvent.keyCode == aEvent.DOM_VK_ESCAPE) {
           this._edit.reallyClosePopup();
-          this._showMode(PANELMODE_VIEW);
+          this.show(PANELMODE_URLVIEW);
         }
         break;
       // Favicon events
       case "error":
         this._favicon.setAttribute("src", "chrome://browser/skin/images/default-favicon.png");
         break;
+      case "pan": {
+        // Default to hide the controls when user pans
+        let mode = PANELMODE_NONE;
+        // Open the urlbar controls if browser is at top of content
+        if (Browser.content.scrollY == 0)
+          mode = PANELMODE_URLVIEW
+
+        this.show(mode);
+        break;
+      }
+      case "overpan":
+        // Open the sidebar controls if we get a right side overpan
+        if (aEvent.detail == 2)
+          this.show(PANELMODE_SIDEBAR);
+        // Close the sidebar controls if we get a left side overpan
+        else if (aEvent.detail == 1)
+          this.show(PANELMODE_TABLIST);
+        break;
     }
   },
 
   supportsCommand : function(cmd) {
     var isSupported = false;
     switch (cmd) {
       case "cmd_back":
       case "cmd_forward":
       case "cmd_reload":
       case "cmd_stop":
       case "cmd_search":
       case "cmd_go":
       case "cmd_star":
       case "cmd_bookmarks":
+      case "cmd_menu":
+      case "cmd_newTab":
+      case "cmd_closeTab":
         isSupported = true;
         break;
       default:
         isSupported = false;
         break;
     }
     return isSupported;
   },
@@ -489,27 +553,39 @@ var BrowserUI = {
           document.getElementById("tool-star").setAttribute("starred", "true");
 
           var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
           var favicon = document.getElementById("urlbar-favicon");
           var faviconURI = ios.newURI(favicon.src, null, null);
 
           var fis = Cc["@mozilla.org/browser/favicon-service;1"].getService(Ci.nsIFaviconService);
           fis.setAndLoadFaviconForPage(bookmarkURI, faviconURI, true);
+
+          this.show(PANELMODE_NONE);
         }
         else {
-          this._showMode(PANELMODE_BOOKMARK);
+          this.show(PANELMODE_BOOKMARK);
           BookmarkHelper.edit(bookmarkURI);
         }
         break;
       }
       case "cmd_bookmarks":
-         this._showMode(PANELMODE_BOOKMARKLIST);
         this.showBookmarks();
         break;
+      case "cmd_menu":
+        if (this.mode == PANELMODE_FULL)
+          this.show(PANELMODE_NONE);
+        else
+          this.show(PANELMODE_FULL);
+        break;
+      case "cmd_newTab":
+        this.newTab();
+        break;
+      case "cmd_closeTab":
+        Browser.content.removeTab(Browser.content.browser);
     }
   }
 };
 
 var BookmarkHelper = {
   _item : null,
   _uri : null,
   _bmksvc : null,
@@ -584,17 +660,17 @@ var BookmarkHelper = {
 
     }
     this.close();
   },
 
   close : function() {
     window.removeEventListener("keypress", this, true);
     this._item = null;
-    BrowserUI.hide();
+    BrowserUI.show(PANELMODE_NONE);
   },
 
   handleEvent: function (aEvent) {
     switch (aEvent.type) {
       case "keypress":
         if (aEvent.keyCode == aEvent.DOM_VK_ESCAPE)
           this.close();
         break;
--- a/mobile/chrome/content/browser.js
+++ b/mobile/chrome/content/browser.js
@@ -96,19 +96,19 @@ var Browser = {
     var styleURI = ios.newURI("chrome://browser/content/scrollbars.css", null, null);
     styleSheets.loadAndRegisterSheet(styleURI, styleSheets.AGENT_SHEET);
 
     this._content = document.getElementById("content");
     this._content.progressListenerCreator = function (content, browser) {
       return new ProgressController(content, browser);
     };
 
+    this._content.tabList = document.getElementById("tab-list");
     this._content.newTab(true);
     this._content.addEventListener("DOMTitleChanged", this, true);
-    this._content.addEventListener("overpan", this, false);
     this._content.addEventListener("DOMUpdatePageReport", gPopupBlockerObserver.onUpdatePageReport, false);
     BrowserUI.init();
 
     this._spatialNavigation  = new SpatialNavigation(this.content);
 
     this.setupGeolocationPrompt();
 
     Cc["@mozilla.org/login-manager;1"].getService(Ci.nsILoginManager);
@@ -143,17 +143,18 @@ var Browser = {
         if (uriFlag) {
           whereURI = cmdLine.resolveURI(uriFlag);
           if (whereURI)
             whereURI = whereURI.spec;
         }
       } catch (e) {}
 
       if (whereURI) {
-        this.currentBrowser.loadURI(whereURI, null, null, false);
+        var self = this;
+        setTimeout(function() { self.currentBrowser.loadURI(whereURI, null, null, false); }, 0);
       }
     }
   },
 
   setupGeolocationPrompt: function() {
     try {
       var geolocationService = Cc["@mozilla.org/geolocation/service;1"].getService(Ci.nsIGeolocationService);
     }
@@ -207,58 +208,42 @@ var Browser = {
     return this._content.browser;
   },
 
   handleEvent: function (aEvent) {
     switch (aEvent.type) {
       case "DOMTitleChanged":
         this._titleChanged(aEvent);
         break;
-      case "overpan":
-        // Open the sidebar controls if we get a right side overpan
-        if (aEvent.detail == 2)
-          document.getElementById("browser-controls").collapsed = false;
-        // Close the sidebar controls if we get a left side overpan
-        else if (aEvent.detail == 1)
-          document.getElementById("browser-controls").collapsed = true;
-        break;
     }
   },
 
   supportsCommand : function(cmd) {
     var isSupported = false;
     switch (cmd) {
-      case "cmd_menu":
       case "cmd_fullscreen":
       case "cmd_addons":
       case "cmd_downloads":
-      case "cmd_newTab":
-      case "cmd_closeTab":
         isSupported = true;
         break;
       default:
         isSupported = false;
         break;
     }
     return isSupported;
   },
 
   isCommandEnabled : function(cmd) {
     return true;
   },
 
   doCommand : function(cmd) {
     var browser = this.content.browser;
-    var controls = document.getElementById("browser-controls");
 
     switch (cmd) {
-      case "cmd_menu":
-        this.content.tabListVisible = !this.content.tabListVisible;
-        controls.collapsed = !controls.collapsed;
-        break;
       case "cmd_fullscreen":
         window.fullScreen = !window.fullScreen;
         break;
       case "cmd_addons":
       {
         const EMTYPE = "Extension:Manager";
 
         var aOpenMode = "extensions";
@@ -280,33 +265,23 @@ var Browser = {
           const EMFEATURES = "chrome,dialog=no,resizable=yes";
           window.openDialog(EMURL, "", EMFEATURES);
         }
         break;
       }
       case "cmd_downloads":
         Cc["@mozilla.org/download-manager-ui;1"].getService(Ci.nsIDownloadManagerUI).show(window);
         break;
-      case "cmd_newTab":
-        this.newTab();
-        break;
-      case "cmd_closeTab":
-        this.content.removeTab(this.content.browser);
     }
   },
 
   getNotificationBox : function() {
     return document.getElementById("notifications");
   },
 
-  newTab: function() {
-    this.content.newTab(true);
-    BrowserUI._showMode(PANELMODE_EDIT);
-  },
-
   findState: FINDSTATE_FIND,
   openFind: function(aState) {
     this.findState = aState;
 
     var findbar = document.getElementById("findbar");
     var browser = findbar.browser;
     if (!browser) {
       browser = this.content.browser;
@@ -321,17 +296,42 @@ var Browser = {
   },
 
   doFind: function (aEvent) {
     var findbar = document.getElementById("findbar");
     if (Browser.findState == FINDSTATE_FIND)
       findbar.onFindCommand();
     else
       findbar.onFindAgainCommand(Browser.findState == FINDSTATE_FIND_PREVIOUS);
-   }
+  },  
+  translatePhoneNumbers: function(){
+    let doc = getBrowser().contentDocument;
+    let textnodes = doc.evaluate("//text()",
+                                 doc,
+                                 null,
+                                 XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
+                                 null);
+    let s, node, lastLastIndex;
+    let re = /(\+?1? ?-?\(?\d{3}\)?[ +-\.]\d{3}[ +-\.]\d{4})/
+     for (var i = 0; i < textnodes.snapshotLength; i++) {
+       node = textnodes.snapshotItem(i);
+       s = node.data;
+       if(s.match(re)){
+         s = s.replace(re,"<a href='tel:$1'> $1 </a>");   
+         try{
+           let replacement = doc.createElement("span");
+           replacement.innerHTML = s;
+           node.parentNode.insertBefore(replacement,node);
+           node.parentNode.removeChild(node);
+         }catch(e){
+           //do nothing, but continue
+         }
+       }
+     }
+  }
 };
 
 function ProgressController(aTabBrowser, aBrowser) {
   this._tabbrowser = aTabBrowser;
   this.init(aBrowser);
 }
 
 ProgressController.prototype = {
@@ -359,16 +359,17 @@ ProgressController.prototype = {
           this._tabbrowser.updateCanvasState();
         }
       }
     }
 
     if (aStateFlags & Ci.nsIWebProgressListener.STATE_IS_DOCUMENT) {
       if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP) {
         aWebProgress.DOMWindow.focus();
+        Browser.translatePhoneNumbers();
         this._tabbrowser.updateBrowser(this._browser, true);
         this._tabbrowser.updateCanvasState(true);
         //aWebProgress.DOMWindow.scrollbars.visible = false;
       }
     }
   },
 
   // This method is called to indicate progress changes for the currently
--- a/mobile/chrome/content/browser.xul
+++ b/mobile/chrome/content/browser.xul
@@ -72,16 +72,17 @@
     <!-- basic navigation -->
     <command id="cmd_back" label="&back.label;" disabled="true" oncommand="CommandUpdater.doCommand(this.id);"/>
     <command id="cmd_forward" label="&forward.label;" disabled="true" oncommand="CommandUpdater.doCommand(this.id);"/>
     <command id="cmd_reload" label="&reload.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
     <command id="cmd_stop" label="&stop.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
     <command id="cmd_search" label="&search.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
     <command id="cmd_go" label="&go.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
 
+    <!-- tabs -->
     <command id="cmd_newTab" label="&newtab.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
     <command id="cmd_closeTab" label="&closetab.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
 
     <!-- bookmarking -->
     <command id="cmd_star" label="&star.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
     <command id="cmd_bookmarks" label="&bookmarks.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
 
     <!-- misc -->
@@ -97,24 +98,23 @@
     <!-- editing -->
     <command id="cmd_cut" label="&cut.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
     <command id="cmd_copy" label="&copy.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
     <command id="cmd_copylink" label="&copylink.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
     <command id="cmd_paste" label="&paste.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
     <command id="cmd_delete" label="&delete.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
     <command id="cmd_selectAll" label="&selectAll.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
 
+    <!-- find -->
     <command id="cmd_find" oncommand="Browser.openFind(FINDSTATE_FIND);"/>
     <command id="cmd_findAgain" oncommand="Browser.openFind(FINDSTATE_FIND_AGAIN);"/>
     <command id="cmd_findPrevious" oncommand="Browser.openFind(FINDSTATE_FIND_PREVIOUS);"/>
   </commandset>
 
   <keyset id="mainKeyset">
-    <key id="key_menu" keycode="T" modifiers="accel" command="cmd_newTab"/>
-
     <!-- basic navigation -->
     <key id="key_back" keycode="VK_LEFT" command="cmd_back" modifiers="control"/>
     <key id="key_forward" keycode="VK_RIGHT" command="cmd_forward" modifiers="control"/>
     <key id="key_back2" keycode="VK_BACK" command="cmd_back"/>
     <key id="key_forward2" keycode="VK_BACK" command="cmd_forward" modifiers="shift"/>
     <key id="key_reload" keycode="VK_F5" command="cmd_reload"/>
 
     <!-- scrolling -->
@@ -122,16 +122,21 @@
     <key id="key_pageDown" keycode="VK_DOWN" command="cmd_scrollPageDown" modifiers="shift"/>
 
     <!-- misc -->
     <key id="key_menu" keycode="VK_F4" command="cmd_menu"/>
     <key id="key_fullscreen" keycode="VK_F6" command="cmd_fullscreen"/>
     <key id="key_addons" key="E" command="cmd_addons" modifiers="control"/>
     <key id="key_downloads" key="J" command="cmd_downloads" modifiers="control"/>
 
+    <!-- tabs -->
+    <key id="key_newTab" keycode="T" modifiers="accel" command="cmd_newTab"/>
+    <key id="key_closeTab" keycode="W" modifiers="accel" command="cmd_closeTab"/>
+
+    <!-- find -->
     <key id="key_find" key="&findOnCmd.commandkey;" command="cmd_find" modifiers="accel"/>
     <key id="key_findAgain" key="&findAgainCmd.commandkey;" command="cmd_findAgain" modifiers="accel"/>
     <key id="key_findPrevious" key="&findAgainCmd.commandkey;" command="cmd_findPrevious" modifiers="accel,shift"/>
     <key keycode="&findAgainCmd.commandkey2;" command="cmd_findAgain"/>
     <key keycode="&findAgainCmd.commandkey2;"  command="cmd_findPrevious" modifiers="shift"/>
   </keyset>
 
   <popupset id="mainPopupSet">
@@ -166,18 +171,38 @@
             </vbox>
             <description id="identity-popup-encryption-label" flex="1"/>
           </hbox>
         </vbox>
       </hbox>
     </panel>
   </popupset>
 
-  <toolbox id="toolbox-main">
-    <toolbar id="toolbar-main">
+  <stack id="browser-container" flex="1" style="overflow: hidden;">
+    <vbox id="browser">
+      <notificationbox id="notifications" flex="1">
+        <deckbrowser id="content" autocompletepopup="popup_autocomplete_content" flex="1"
+                     onnewtab="CommandUpdater.doCommand('cmd_newTab');"/>
+      </notificationbox>
+    </vbox>
+
+    <vbox id="browser-controls" style="-moz-stack-sizing: ignore; width: 80px;" top="60" left="0">
+      <toolbarbutton id="tool-back" class="browser-control-button" command="cmd_back"/>
+      <toolbarbutton id="tool-forward" class="browser-control-button" command="cmd_forward"/>
+      <toolbarbutton id="tool-star" class="browser-control-button" command="cmd_star"/>
+      <toolbarbutton id="tool-bookmarks" class="browser-control-button" command="cmd_bookmarks"/>
+      <toolbarbutton id="tool-actions" class="browser-control-button" command="cmd_actions"/>
+    </vbox>
+
+    <vbox id="tab-list-container" style="-moz-stack-sizing: ignore;" top="60" left="0">
+      <richlistbox id="tab-list" onselect="BrowserUI.selectTab(this.selectedItem);"/>
+      <button id="newtab-button" label="+" command="cmd_newTab"/>
+    </vbox>
+
+    <toolbar id="toolbar-main" style="-moz-stack-sizing: ignore; height: 60px;" top="0" left="0">
       <hbox id="urlbar-container" flex="1">
         <box id="identity-box"
              onclick="getIdentityHandler().handleIdentityButtonEvent(event);"
              onkeypress="getIdentityHandler().handleIdentityButtonEvent(event);">
           <stack id="urlbar-image-stack">
             <image id="urlbar-throbber" src=""/>
             <image id="urlbar-favicon" src=""/>
           </stack>
@@ -197,46 +222,24 @@
                  clickSelectsAll="true"/>
       </hbox>
       <hbox id="urlbar-icons">
         <toolbarbutton id="tool-reload" class="urlbar-icon-button" command="cmd_reload"/>
         <toolbarbutton id="tool-stop" class="urlbar-icon-button" command="cmd_stop"/>
         <toolbarbutton id="tool-go" class="urlbar-icon-button" command="cmd_go"/>
       </hbox>
     </toolbar>
-  </toolbox>
 
-  <stack flex="1">
-    <hbox id="browser-container" flex="1">
-      <vbox id="browser" flex="1">
-        <notificationbox id="notifications" flex="1">
-          <deckbrowser id="content" autocompletepopup="popup_autocomplete_content" flex="1"
-                       onnewtab="Browser.newTab()"/>
-        </notificationbox>
-      </vbox>
-      <vbox id="browser-controls" collapsed="true">
-        <toolbarbutton id="tool-back" class="browser-control-button" command="cmd_back"/>
-        <toolbarbutton id="tool-forward" class="browser-control-button" command="cmd_forward"/>
-        <toolbarbutton id="tool-star" class="browser-control-button" command="cmd_star"/>
-        <toolbarbutton id="tool-bookmarks" class="browser-control-button" command="cmd_bookmarks"/>
-        <toolbarbutton id="tool-actions" class="browser-control-button" command="cmd_actions"/>
-      </vbox>
-    </hbox>
-
-    <vbox id="urllist-container" flex="1" hidden="true">
+    <vbox id="urllist-container" hidden="true" style="-moz-stack-sizing: ignore;" top="60" left="0">
       <hbox id="urllist-items-container" flex="1">
         <richlistbox id="urllist-items" flex="1"/>
       </hbox>
-      <separator class="thin"/>
-      <hbox id="urllist-search">
-        <image class="tool-search"/>
-      </hbox>
     </vbox>
 
-    <vbox id="bookmark-container" flex="1" hidden="true">
+    <vbox id="bookmark-container" hidden="true" style="-moz-stack-sizing: ignore;" top="60" left="0">
       <vbox id="bookmark-form">
         <hbox align="start">
           <image id="bookmark-image" src="chrome://browser/skin/images/starred48.png"/>
           <grid id="bookmark-grid" flex="1">
             <columns>
               <column/>
               <column flex="1"/>
             </columns>
--- a/mobile/chrome/content/deckbrowser.xml
+++ b/mobile/chrome/content/deckbrowser.xml
@@ -4,21 +4,16 @@
 <bindings
     xmlns="http://www.mozilla.org/xbl"
     xmlns:xbl="http://www.mozilla.org/xbl"
     xmlns:html="http://www.w3.org/1999/xhtml"
     xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
   <binding id="deckbrowser">
     <content>
-      <xul:vbox class="tab-list-container" collapsed="true">
-        <xul:richlistbox anonid="tab-list" class="tab-list"
-                         onselect="this.parentNode.parentNode.selectTab(this.selectedItem)"/>
-        <xul:button class="newtab-button" label="+" xbl:inherits="oncommand=onnewtab"/>
-      </xul:vbox>
       <xul:deck flex="1" selectedIndex="0">
         <xul:stack anonid="cstack" flex="1" style="overflow: hidden;">
           <html:canvas anonid="ccanvas"
                        moz-opaque="true"
                        style="-moz-stack-sizing: ignore;"/>
         </xul:stack>
         <xul:deck anonid="display-list" flex="1"/>
       </xul:deck>
@@ -83,24 +78,19 @@
       </property>
 
       <property name="displayList" readonly="true">
         <getter>
           return document.getAnonymousElementByAttribute(this, "anonid", "display-list");
         </getter>
       </property>
 
-      <property name="tabList" readonly="true">
-        <getter>
-          return document.getAnonymousElementByAttribute(this, "anonid", "tab-list");
-        </getter>
-      </property>
-
-      <property name="tabListVisible" onget="return !this.tabList.parentNode.collapsed"
-                                      onset="this.tabList.parentNode.collapsed = !val; return val;"/>
+      <field name="tabList">
+        null
+      </field>
 
       <field name="progressListenerCreator"/>
 
       <method name="updateCanvasState">
         <parameter name="aNewDoc"/>
         <body><![CDATA[
           if (aNewDoc)
             this._updateViewState();
@@ -368,17 +358,17 @@
           if (doc instanceof HTMLDocument) {
             var tags = ["input", "textarea", "select"];
 
             for (var t = 0; t < tags.length; t++) {
               var elements = doc.getElementsByTagName(tags[t]);
               for (var e = 0; e < elements.length; e++) {
                 var element = elements[e];
                 var id;
-                if (element.id) 
+                if (element.id)
                   id = "#" + element.id;
                 else if (element.name)
                   id = "$" + element.name;
 
                 if (id)
                   state[id] = element.value;
               }
             }
@@ -635,16 +625,28 @@
 
       <property name="_effectiveCanvasDimensions" readonly="true">
         <getter><![CDATA[
           return [this._canvas.width / this._zoomLevel,
                   this._canvas.height / this._zoomLevel];
          ]]></getter>
       </property>
 
+      <property name="scrollX" readonly="true">
+        <getter><![CDATA[
+          return this.dragData.pageX - this.dragData.dragX / this._zoomLevel;
+         ]]></getter>
+      </property>
+
+      <property name="scrollY" readonly="true">
+        <getter><![CDATA[
+          return this.dragData.pageY - this.dragData.dragY / this._zoomLevel;
+         ]]></getter>
+      </property>
+
       <field name="_fireOverpan">
         0
       </field>
 
       /**
        * Given a set of page coordinates, constrain them such that they
        * fit within the rect defined by [0,0] and [x,y], where x and y are
        * the maximum values that can be used for the canvas' .top and .left
@@ -715,24 +717,29 @@
           return [aX, aY];
         ]]></body>
       </method>
 
       <method name="_moveCanvas">
         <parameter name="aDx"/>
         <parameter name="aDy"/>
         <body><![CDATA[
-          // constrain offsets to the actual scrollWidth/scrollHeight
-          var [x, y] = this._constrainPanCoords(aDx, aDy);
+          // Fire the panning event
+          var event = document.createEvent("UIEvents");
+          event.initUIEvent("pan", true, true, window, 0);
+          if (this.dispatchEvent(event)) {
+            // Constrain offsets to the actual scrollWidth/scrollHeight
+            var [x, y] = this._constrainPanCoords(aDx, aDy);
 
-          // Canvas needs to move up for content to scroll down
-          this.dragData.dragX = -x;
-          this.dragData.dragY = -y;
+            // Canvas needs to move up for content to scroll down
+            this.dragData.dragX = -x;
+            this.dragData.dragY = -y;
 
-          this._updateCanvasPosition();
+            this._updateCanvasPosition();
+          }
         ]]></body>
       </method>
 
       <!-- Pans directly to a given X/Y (in page coordinates) -->
       <method name="_panTo">
         <parameter name="aX"/>
         <parameter name="aY"/>
         <body><![CDATA[
--- a/mobile/chrome/locale/en-US/browser.dtd
+++ b/mobile/chrome/locale/en-US/browser.dtd
@@ -14,17 +14,17 @@
 <!ENTITY go.label              "Go">
 <!ENTITY go.tooltip            "Go">
 <!ENTITY star.label            "Star">
 <!ENTITY star.tooltip          "Bookmark this page">
 <!ENTITY bookmarks.label       "Bookmarks">
 <!ENTITY bookmarks.tooltip     "View bookmarks">
 
 <!ENTITY newtab.label          "New Tab">
-<!ENTITY closetab.label         "Close Tab">
+<!ENTITY closetab.label        "Close Tab">
 
 <!ENTITY cut.label             "Cut">
 <!ENTITY copy.label            "Copy">
 <!ENTITY copylink.label        "Copy Link Location">
 <!ENTITY paste.label           "Paste">
 <!ENTITY delete.label          "Delete">
 <!ENTITY selectAll.label       "Select All">
 <!ENTITY noSuggestions.label   "(No suggestions)">
--- a/mobile/chrome/skin/browser.css
+++ b/mobile/chrome/skin/browser.css
@@ -243,21 +243,21 @@ toolbarbutton.browser-control-button {
   background-color: rgba(207,207,207,0.9);
   border: 2px solid #fff !important;
   -moz-border-radius: 10px;
   _moz-box-align: start;
 }
 
 /* tab list */
 
-.tab-list-container {
+#tab-list-container {
   background-color: rgb(123,125,123);
 }
 
-.tab-list {
+#tab-list {
   -moz-appearance: none;
   margin: 0;
   padding: 4px;
   background-color: rgb(123,125,123);
 }
 
 richlistitem[type="documenttab"] {
   -moz-appearance: none;
@@ -266,20 +266,19 @@ richlistitem[type="documenttab"] {
   background: none;
   padding: 4px;
 }
 
 richlistitem[type="documenttab"][selected="true"] {
   border: 1px solid white !important;
 }
 
-.newtab-button {
+#newtab-button {
   -moz-appearance: none;
   background-color: rgba(207,207,207,0.9);
-  font-size: 24pt;
 }
 
 /* autocomplete */
 
 #popup_autocomplete {
   -moz-appearance: none;
   background-color: rgba(207,207,207,0.9);
 }
@@ -292,23 +291,23 @@ richlistitem[type="documenttab"][selecte
   direction: ltr !important;
 }
 
 .ac-result-type-bookmark {
    list-style-image: url("chrome://browser/skin/images/page-starred.png");
    width: 16px;
    height: 16px;
  }
- 
+
 .ac-result-type-tag {
    list-style-image: url("chrome://browser/skin/images/tag.png");
    width: 16px;
    height: 16px;
  }
- 
+
 .ac-comment {
   font-size: 1.15em;
 }
 
 .ac-extra > .ac-comment {
   font-size: inherit;
 }
 
new file mode 100644
--- /dev/null
+++ b/mobile/components/Makefile.in
@@ -0,0 +1,57 @@
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is Mozilla.
+#
+# The Initial Developer of the Original Code is
+# the Mozilla Foundation <http://www.mozilla.org/>.
+# Portions created by the Initial Developer are Copyright (C) 2007
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#   Mark Finkle <mfinkle@mozilla.com>
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+DEPTH      = ../..
+topsrcdir  = @top_srcdir@
+srcdir     = @srcdir@
+VPATH      = @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+MODULE = browsercomps
+XPIDL_MODULE = browsercompsbase
+
+#XPIDLSRCS = \
+#	$(NULL)
+
+#EXTRA_PP_COMPONENTS = \
+#	$(NULL)
+
+DIRS = protocols \
+	$(NULL)
+
+include $(topsrcdir)/config/rules.mk
new file mode 100644
--- /dev/null
+++ b/mobile/components/protocols/Makefile.in
@@ -0,0 +1,49 @@
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is Mozilla.
+#
+# The Initial Developer of the Original Code is
+# the Mozilla Foundation <http://www.mozilla.org/>.
+# Portions created by the Initial Developer are Copyright (C) 2008
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#   Brad Lassey <blassey@mozilla.com>
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+DEPTH      = ../../..
+topsrcdir  = @top_srcdir@
+srcdir     = @srcdir@
+VPATH      = @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+MODULE = protocols
+
+EXTRA_COMPONENTS = nsTelProtocolHandler.js
+
+include $(topsrcdir)/config/rules.mk
new file mode 100644
--- /dev/null
+++ b/mobile/components/protocols/nsTelProtocolHandler.js
@@ -0,0 +1,85 @@
+Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
+
+
+
+const kSCHEME = "tel";
+const kPROTOCOL_NAME = "Tel Protocol";
+const kPROTOCOL_CONTRACTID = "@mozilla.org/network/protocol;1?name=" + kSCHEME;
+const kPROTOCOL_CID = Components.ID("d4bc06cc-fa9f-48ce-98e4-5326ca96ba28");
+
+// Mozilla defined
+const kSIMPLEURI_CONTRACTID = "@mozilla.org/network/simple-uri;1";
+const kIOSERVICE_CONTRACTID = "@mozilla.org/network/io-service;1";
+
+const Ci = Components.interfaces;
+
+
+
+function TelProtocol()
+{
+}
+
+TelProtocol.prototype =
+{
+    
+  classDescription: "Handler for tel URIs",
+  classID:          Components.ID(kPROTOCOL_CID),
+  contractID:       kPROTOCOL_CONTRACTID,
+  QueryInterface: XPCOMUtils.generateQI([Ci.nsIProtocolHandler]),
+  
+  
+  scheme: kSCHEME,
+  defaultPort: -1,
+  protocolFlags: Ci.nsIProtocolHandler.URI_NORELATIVE | 
+                 Ci.nsIProtocolHandler.URI_NOAUTH,
+  
+  allowPort: function(port, scheme)
+  {
+    return false;
+  },
+  
+  newURI: function(spec, charset, baseURI)
+  {
+    var uri = Components.classes[kSIMPLEURI_CONTRACTID].createInstance(Ci.nsIURI);
+    uri.spec = spec;
+    return uri;
+  },
+  
+  
+  newChannel: function(aURI)
+  {
+    // aURI is a nsIUri, so get a string from it using .spec
+    let phoneNumber = aURI.spec;
+    
+    // strip away the kSCHEME: part
+    phoneNumber = phoneNumber.substring(phoneNumber.indexOf(":") + 1, phoneNumber.length);    
+    phoneNumber = encodeURI(phoneNumber);
+    
+    var ios = Components.classes[kIOSERVICE_CONTRACTID].getService(Ci.nsIIOService);
+    
+    try {
+      //try voipto:
+      let channel = ios.newChannel("voipto:"+phoneNumber, null, null);
+      return channel;
+    } catch(e){
+      //voipto not registered, try the next one
+    }
+    try {
+      //try callto:
+      let channel = ios.newChannel("callto:"+phoneNumber, null, null);
+      return channel;
+    } catch(e){
+      //callto not registered, try the next one
+    }
+    //try wtai:  
+    //this is our last equivalent protocol, so if it fails pass the exception on
+    let channel = ios.newChannel("wtai:"+phoneNumber, null, null);
+    return channel;
+  }
+};
+
+var components = [TelProtocol];
+function NSGetModule(compMgr, fileSpec) {
+  return XPCOMUtils.generateModule(components);
+}
+
--- a/mobile/confvars.sh
+++ b/mobile/confvars.sh
@@ -32,15 +32,15 @@
 # and other provisions required by the GPL or the LGPL. If you do not delete
 # the provisions above, a recipient may use your version of this file under
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 MOZ_APP_NAME=fennec
 MOZ_APP_DISPLAYNAME=Fennec
-MOZ_APP_VERSION=0.5
+MOZ_APP_VERSION=0.6
 
 MOZ_XUL_APP=1
 MOZ_UPDATER=0
 MOZ_ENABLE_LIBXUL=1
 MOZ_NO_XPCOM_OBSOLETE=1
 MOZ_XULRUNNER=1
--- a/mobile/installer/Makefile.in
+++ b/mobile/installer/Makefile.in
@@ -37,16 +37,21 @@
 
 DEPTH     = ../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
+GRE_MILESTONE = $(shell $(PYTHON) $(topsrcdir)/config/printconfigsetting.py $(LIBXUL_DIST)/bin/platform.ini Build Milestone)
+GRE_BUILDID = $(shell $(PYTHON) $(topsrcdir)/config/printconfigsetting.py $(LIBXUL_DIST)/bin/platform.ini Build BuildID)
+
+DEFINES += -DGRE_MILESTONE=$(GRE_MILESTONE) -DGRE_BUILDID=$(GRE_BUILDID) 
+
 NO_PKG_FILES = \
 	$(MOZ_APP_NAME)-config \
 	$(MOZ_APP_NAME)-bin.elf \
 	regchrome* \
 	regxpcom* \
 	xpcshell* \
 	xpidl* \
 	xpt_dump* \
@@ -63,17 +68,22 @@ ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_
 _BINPATH = /$(_APPNAME)/Contents/Resources
 endif
 
 include $(topsrcdir)/toolkit/mozapps/installer/packager.mk
 
 DEBDESTDIR=debian/$(MOZ_APP_NAME)
 
 ifeq ($(OS_TARGET),Linux)
-deb: 
+debian/control: $(srcdir)/debian/control.in $(LIBXUL_DIST)/bin/platform.ini
+	mkdir -p debian
+	$(PYTHON) $(topsrcdir)/config/Preprocessor.py \
+        $(AUTOMATION_PPARGS) $(DEFINES) $(ACDEFINES) $< > $@
+
+deb: debian/control
 	rm -rf $(DEBDESTDIR)/usr/local/*
 	$(NSINSTALL) -D $(DEBDESTDIR)/usr/local
 	cd $(DEBDESTDIR)/usr/local; cat $(DEPTH)/../../../../dist/$(PKG_BASENAME)$(PKG_SUFFIX) | $(UNMAKE_PACKAGE)  
 	rm -rf $(DEBDESTDIR)/usr/local/$(MOZ_APP_NAME)/xulrunner	
 	$(NSINSTALL)  debian/$(MOZ_APP_NAME).desktop $(DEBDESTDIR)/usr/share/applications/hildon/
 	$(NSINSTALL) -D $(DEBDESTDIR)/usr/share/dbus-1/services/
 	cp debian/$(MOZ_APP_NAME).service $(DEBDESTDIR)/usr/share/dbus-1/services/org.mozilla.$(MOZ_APP_NAME).service
 #	$(NSINSTALL) -m 755 debian/postinst debian/$(MOZ_APP_NAME)/DEBIAN
--- a/mobile/installer/debian/control.in
+++ b/mobile/installer/debian/control.in
@@ -1,18 +1,19 @@
+#filter substitution
 Source: fennec
 Section: user/internet
 Priority: extra
 Maintainer: Mozilla fennec <blassey@mozilla.com>
 Build-Depends: debhelper (>= 5)
 Standards-Version: 3.7.2
 
 Package: fennec
 Architecture: any
-Depends: ${shlibs:Depends}, xulrunner (>=1.9pre)
+Depends: ${shlibs:Depends}, xulrunner (>=@GRE_MILESTONE@-@GRE_BUILDID@)
 Description: Mozilla's mobile browser
  This browser is the full rendering engine of Mozilla Firefox combined with a user interface designed to make browsing the web on a mobile device a rich and uncompromised experience.
 XB-Maemo-Icon-26:
  MB5!.1PT*&@H````-24A$4@```!H````:"`8```"I2DS.````"7!(67,```L3
  M```+$P$`FIP8```%;$E$051(B:667XQ4U1W'/_>>>V?NG=F9V3^S_W%9<'#!
  M/Q1;NQ:EQH@:T2"EH>&A34R;]$U?Q%9-VH:41BUJFV"-B<8'^Z!-VP=E?37&
  M5=18L"SACVMVH<M.9W>8V9G9N7-G[O_3AP6$LD"$;W*3<T_R^W[.]Y=S3@Z<
  ME90H_)\DE\Y=J]3SHW_\1)6O#FV2NVD'D*\,W<T;JWK.0W>3OA[012N68]LW