Back out changeset 1defe29fdf3c, ffe31dc2d27f, 54bacc404a6f, 16772cb4a781, c169c3b8dfb2, 94f06945b818, 6a2724d755f3 for test failure.
authorMatt Brubeck <mbrubeck@mozilla.com>
Thu, 05 May 2011 14:21:38 -0700
changeset 69273 eaaa24ff93a01a285fda5bcfbef01c6cad99e69b
parent 69272 6fe900aa4679bd2ecd2e07afbe8dd9de26c03788
child 69274 8ccb9dff65d7032821c8ccc74ba744d1354ae251
push id76
push userbzbarsky@mozilla.com
push dateTue, 05 Jul 2011 17:00:57 +0000
treeherdermozilla-beta@d3a2732c35f1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone6.0a1
backs out1defe29fdf3c58be073d2600fa6b437751252a20
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Back out changeset 1defe29fdf3c, ffe31dc2d27f, 54bacc404a6f, 16772cb4a781, c169c3b8dfb2, 94f06945b818, 6a2724d755f3 for test failure.
build/binary-location.mk
mobile/chrome/content/browser.js
mobile/chrome/content/content.js
mobile/chrome/tests/Makefile.in
mobile/chrome/tests/addons/browser_install1_1/install.rdf
mobile/chrome/tests/addons/browser_install1_3/install.rdf
mobile/chrome/tests/browser_addons.js
mobile/chrome/tests/browser_formsZoom.js
mobile/chrome/tests/browser_history.js
mobile/chrome/tests/browser_install.xml
mobile/chrome/tests/browser_navigation.js
mobile/chrome/tests/browser_scroll.js
mobile/chrome/tests/browser_scrollbar.js
mobile/chrome/tests/browser_thumbnails.js
mobile/chrome/tests/browser_title.sjs
mobile/chrome/tests/browser_upgrade.rdf
mobile/chrome/tests/browser_viewport.js
mobile/chrome/tests/head.js
security/manager/Makefile.in
xulrunner/Makefile.in
xulrunner/app/Makefile.in
xulrunner/app/nsXULRunnerApp.cpp
xulrunner/stub/Makefile.in
xulrunner/stub/nsXULStub.cpp
xulrunner/tools/redit/Makefile.in
--- a/build/binary-location.mk
+++ b/build/binary-location.mk
@@ -35,22 +35,18 @@
 # 
 # ***** END LICENSE BLOCK *****
 
 # finds the location of the browser and puts it in the variable $(browser_path)
 
 ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
 PROGRAM = $(MOZ_APP_NAME)$(BIN_SUFFIX)
 else
-ifeq ($(MOZ_BUILD_APP),mobile)
-PROGRAM = $(MOZ_APP_NAME)$(BIN_SUFFIX)
-else
 PROGRAM = $(MOZ_APP_NAME)-bin$(BIN_SUFFIX)
 endif
-endif
 
 TARGET_DIST = $(TARGET_DEPTH)/dist
 
 ifeq ($(MOZ_BUILD_APP),camino)
 browser_path = $(TARGET_DIST)/Camino.app/Contents/MacOS/Camino
 else
 ifeq ($(OS_ARCH),Darwin)
 ifdef MOZ_DEBUG
--- a/mobile/chrome/content/browser.js
+++ b/mobile/chrome/content/browser.js
@@ -357,17 +357,16 @@ var Browser = {
       // Also open any commandline URLs, except the homepage
       if (commandURL && commandURL != this.getHomePage())
         this.addTab(commandURL, true);
     } else {
       this.addTab(commandURL || this.getHomePage(), true);
     }
 
     messageManager.addMessageListener("Browser:ViewportMetadata", this);
-    messageManager.addMessageListener("Browser:CanCaptureMouse:Return", this);
     messageManager.addMessageListener("Browser:FormSubmit", this);
     messageManager.addMessageListener("Browser:KeyPress", this);
     messageManager.addMessageListener("Browser:ZoomToPoint:Return", this);
     messageManager.addMessageListener("Browser:CanUnload:Return", this);
     messageManager.addMessageListener("scroll", this);
     messageManager.addMessageListener("Browser:CertException", this);
     messageManager.addMessageListener("Browser:BlockedSite", this);
 
@@ -1129,29 +1128,24 @@ var Browser = {
     let dummy = getComputedStyle(document.documentElement, "").width;
   },
 
   receiveMessage: function receiveMessage(aMessage) {
     let json = aMessage.json;
     let browser = aMessage.target;
 
     switch (aMessage.name) {
-      case "Browser:ViewportMetadata": {
+      case "Browser:ViewportMetadata":
         let tab = this.getTabForBrowser(browser);
         // Some browser such as iframes loaded dynamically into the chrome UI
         // does not have any assigned tab
         if (tab)
           tab.updateViewportMetadata(json);
         break;
-      }
-      case "Browser:CanCaptureMouse:Return": {
-        let tab = this.getTabForBrowser(browser);
-        tab.contentMightCaptureMouse = json.contentMightCaptureMouse;
-        break;
-      }
+
       case "Browser:FormSubmit":
         browser.lastLocation = null;
         break;
 
       case "Browser:CanUnload:Return": {
         if (!json.permit)
           return;
 
@@ -1542,17 +1536,17 @@ Browser.WebProgress.prototype = {
         if (json.x == 0 && json.y == 0)
           Browser.pageScrollboxScroller.scrollTo(0, 0);
       }
 
       aTab.scrolledAreaChanged();
       aTab.updateThumbnail();
 
       browser.messageManager.addMessageListener("MozScrolledAreaChanged", aTab.scrolledAreaChanged);
-      aTab.updateContentCapture();
+      ContentTouchHandler.updateContentCapture();
     });
   }
 };
 
 
 function nsBrowserAccess() { }
 
 nsBrowserAccess.prototype = {
@@ -1641,44 +1635,41 @@ const ContentTouchHandler = {
     document.addEventListener("TapDown", this, true);
     document.addEventListener("TapOver", this, false);
     document.addEventListener("TapUp", this, false);
     document.addEventListener("TapSingle", this, false);
     document.addEventListener("TapDouble", this, false);
     document.addEventListener("TapLong", this, false);
     document.addEventListener("TapMove", this, false);
 
-    document.addEventListener("PanBegin", this, false);
     document.addEventListener("PopupChanged", this, false);
     document.addEventListener("CancelTouchSequence", this, false);
 
     // Context menus have the following flow:
     //   [parent] mousedown -> TapLong -> Browser:MouseLong
     //   [child]  Browser:MouseLong -> contextmenu -> Browser:ContextMenu
     //   [parent] Browser:ContextMenu -> ...*
     //
     // * = Here some time will elapse. Although we get the context menu we need
     //     ASAP, we do not act on the context menu until we receive a LongTap.
     //     This is so we can show the context menu as soon as we know it is
     //     a long tap, without waiting for child process.
     //
     messageManager.addMessageListener("Browser:ContextMenu", this);
     messageManager.addMessageListener("Browser:Highlight", this);
     messageManager.addMessageListener("Browser:CaptureEvents", this);
+    messageManager.addMessageListener("Browser:CanCaptureMouse:Return", this);
   },
 
   handleEvent: function handleEvent(aEvent) {
     // ignore content events we generate
     if (aEvent.target.localName == "browser")
       return;
 
     switch (aEvent.type) {
-      case "PanBegin":
-        getBrowser().messageManager.sendAsyncMessage("Browser:MouseCancel", {});
-        break;
       case "PopupChanged":
       case "CancelTouchSequence":
         this._clearPendingMessages();
         break;
 
       default: {
         if (ContextHelper.popupState) {
           // Don't send content events when there's a popup
@@ -1721,16 +1712,21 @@ const ContentTouchHandler = {
           case "TapMove":
             this.tapMove(aEvent.clientX, aEvent.clientY);
             break;
         }
       }
     }
   },
 
+  updateContentCapture: function() {
+    this._messageId++;
+    messageManager.sendAsyncMessage("Browser:CanCaptureMouse", { messageId: this._messageId });
+  },
+
   receiveMessage: function receiveMessage(aMessage) {
     let json = aMessage.json;
     if (json.messageId != this._messageId)
       return;
 
     switch (aMessage.name) {
       case "Browser:ContextMenu":
         // Long tap
@@ -1755,16 +1751,21 @@ const ContentTouchHandler = {
         if (json.panning)
           this.panningPrevented = true;
 
         // We don't know if panning is allowed until the first touchmove event is processed.
         if (this.canCancelPan && json.type == "touchmove")
           Elements.browsers.customDragger.contentMouseCapture = this.panningPrevented;
         break;
       }
+      case "Browser:CanCaptureMouse:Return": {
+        let tab = Browser.getTabForBrowser(aMessage.target);
+        tab.contentMightCaptureMouse = json.contentMightCaptureMouse;
+        break;
+      }
     }
   },
 
   /** Invalidates any messages received from content that are sensitive to time. */
   _clearPendingMessages: function _clearPendingMessages() {
     this._messageId++;
     let browser = getBrowser();
     browser.messageManager.sendAsyncMessage("Browser:MouseCancel", {});
@@ -2951,20 +2952,16 @@ Tab.prototype = {
   },
 
   get active() {
     if (!this._browser)
       return false;
     return this._browser.getAttribute("type") == "content-primary";
   },
 
-  updateContentCapture: function() {
-    this._browser.messageManager.sendAsyncMessage("Browser:CanCaptureMouse", {});
-  },
-
   toString: function() {
     return "[Tab " + (this._browser ? this._browser.currentURI.spec : "(no browser)") + "]";
   }
 };
 
 // Helper used to hide IPC / non-IPC differences for rendering to a canvas
 function rendererFactory(aBrowser, aCanvas) {
   let wrapper = {};
--- a/mobile/chrome/content/content.js
+++ b/mobile/chrome/content/content.js
@@ -592,17 +592,18 @@ let Content = {
 
         let webNav = docShell.QueryInterface(Ci.nsIWebNavigation);
         webNav.reload(Ci.nsIWebNavigation.LOAD_FLAGS_CHARSET_CHANGE);
         break;
       }
 
       case "Browser:CanCaptureMouse": {
         sendAsyncMessage("Browser:CanCaptureMouse:Return", {
-          contentMightCaptureMouse: content.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils).mayHaveTouchEventListeners
+          contentMightCaptureMouse: content.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils).mayHaveTouchEventListeners,
+          messageId: json.messageId
         });
         break;
       }
     }
   },
 
   _resetFontSize: function _resetFontSize() {
     this._isZoomedToElement = false;
--- a/mobile/chrome/tests/Makefile.in
+++ b/mobile/chrome/tests/Makefile.in
@@ -34,17 +34,17 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH     = ../../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
-relativesrcdir  = mobile/chrome/tests
+relativesrcdir  = mobile/chrome
 TESTXPI  = $(CURDIR)/$(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)/addons
 ADDONSRC = $(srcdir)/addons
 
 include $(DEPTH)/config/autoconf.mk
 include $(topsrcdir)/config/rules.mk
 
 _BROWSER_FILES = \
   head.js \
--- a/mobile/chrome/tests/addons/browser_install1_1/install.rdf
+++ b/mobile/chrome/tests/addons/browser_install1_1/install.rdf
@@ -1,17 +1,17 @@
 <?xml version="1.0"?>
 
 <RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
      xmlns:em="http://www.mozilla.org/2004/em-rdf#">
 
   <Description about="urn:mozilla:install-manifest">
     <em:id>addon1@tests.mozilla.org</em:id>
     <em:version>1.0</em:version>
-    <em:updateURL>http://example.com/browser/mobile/chrome/tests/browser_upgrade.rdf</em:updateURL>
+    <em:updateURL>http://example.com/browser/mobile/chrome/browser_upgrade.rdf</em:updateURL>
     <em:bootstrap>true</em:bootstrap>
 
     <em:targetApplication>
       <Description>
         <em:id>toolkit@mozilla.org</em:id>
         <em:minVersion>0</em:minVersion>
         <em:maxVersion>*</em:maxVersion>
       </Description>
--- a/mobile/chrome/tests/addons/browser_install1_3/install.rdf
+++ b/mobile/chrome/tests/addons/browser_install1_3/install.rdf
@@ -1,17 +1,17 @@
 <?xml version="1.0"?>
 
 <RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
      xmlns:em="http://www.mozilla.org/2004/em-rdf#">
 
   <Description about="urn:mozilla:install-manifest">
     <em:id>addon1@tests.mozilla.org</em:id>
     <em:version>3.0</em:version>
-    <em:updateURL>http://example.com/browser/mobile/chrome/tests/browser_upgrade.rdf</em:updateURL>
+    <em:updateURL>http://example.com/browser/mobile/chrome/browser_upgrade.rdf</em:updateURL>
 
     <em:targetApplication>
       <Description>
         <em:id>toolkit@mozilla.org</em:id>
         <em:minVersion>0</em:minVersion>
         <em:maxVersion>*</em:maxVersion>
       </Description>
     </em:targetApplication>
--- a/mobile/chrome/tests/browser_addons.js
+++ b/mobile/chrome/tests/browser_addons.js
@@ -2,17 +2,17 @@
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 Components.utils.import("resource://gre/modules/AddonManager.jsm");
 Components.utils.import("resource://gre/modules/AddonUpdateChecker.jsm");
 Components.utils.import("resource://gre/modules/Services.jsm");
 Components.utils.import("resource://gre/modules/NetUtil.jsm");
 
-const RELATIVE_DIR = "browser/mobile/chrome/tests/";
+const RELATIVE_DIR = "browser/mobile/chrome/";
 const TESTROOT     = "http://example.com/" + RELATIVE_DIR;
 const TESTROOT2    = "http://example.org/" + RELATIVE_DIR;
 const PREF_LOGGING_ENABLED            = "extensions.logging.enabled";
 const PREF_SEARCH_MAXRESULTS          = "extensions.getAddons.maxResults";
 const CHROME_NAME                     = "mochikit";
 const PREF_AUTOUPDATE_DEFAULT         = "extensions.update.autoUpdateDefault"
 const PREF_GETADDONS_BROWSESEARCHRESULTS = "extensions.getAddons.search.browseURL";
 const PREF_GETADDONS_GETSEARCHRESULTS    = "extensions.getAddons.search.url";
--- a/mobile/chrome/tests/browser_formsZoom.js
+++ b/mobile/chrome/tests/browser_formsZoom.js
@@ -1,9 +1,11 @@
 let testURL_01 = chromeRoot + "browser_formsZoom.html";
+
+let baseURI = "http://mochi.test:8888/browser/mobile/chrome/";
 let testURL_02 = baseURI + "browser_formsZoom.html";
 messageManager.loadFrameScript(baseURI + "remote_formsZoom.js", true);
 
 // A queue to order the tests and a handle for each test
 var gTests = [];
 var gCurrentTest = null;
 
 //------------------------------------------------------------------------------
--- a/mobile/chrome/tests/browser_history.js
+++ b/mobile/chrome/tests/browser_history.js
@@ -1,13 +1,13 @@
 /*
  * Make sure history is being recorded when we visit websites.
  */
 
-var testURL_01 = baseURI + "browser_blank_01.html";
+var testURL_01 = "http://mochi.test:8888/browser/mobile/chrome/browser_blank_01.html";
 
 // A queue to order the tests and a handle for each test
 var gTests = [];
 var gCurrentTest = null;
 
 //------------------------------------------------------------------------------
 // Entry point (must be named "test")
 function test() {
--- a/mobile/chrome/tests/browser_install.xml
+++ b/mobile/chrome/tests/browser_install.xml
@@ -20,17 +20,17 @@
       <application>
         <name>Fennec</name>
         <appID>{a23983c0-fd0e-11dc-95ff-0800200c9a66}</appID>
         <min_version>0</min_version>
         <max_version>*</max_version>
       </application>
     </compatible_applications>
     <compatible_os>ALL</compatible_os>
-    <install size="2">http://example.com/browser/mobile/chrome/tests/addons/browser_install1_1.xpi</install>
+    <install size="2">http://example.com/browser/mobile/chrome/addons/browser_install1_1.xpi</install>
   </addon>
 
   <addon>
     <name>Install Tests 2</name>
     <type id='1'>Extension</type>
     <guid>addon2@tests.mozilla.org</guid>
     <version>1.0</version>
     <icon>http://example.com/icon.png</icon>
@@ -48,11 +48,11 @@
       <application>
         <name>Fennec</name>
         <appID>{a23983c0-fd0e-11dc-95ff-0800200c9a66}</appID>
         <min_version>0</min_version>
         <max_version>*</max_version>
       </application>
     </compatible_applications>
     <compatible_os>ALL</compatible_os>
-    <install size="2">http://example.com/browser/mobile/chrome/tests/addons/browser_install1_2.xpi</install>
+    <install size="2">http://example.com/browser/mobile/chrome/addons/browser_install1_2.xpi</install>
   </addon>
 </searchresults>
--- a/mobile/chrome/tests/browser_navigation.js
+++ b/mobile/chrome/tests/browser_navigation.js
@@ -1,11 +1,12 @@
 var testURL_01 = chromeRoot + "browser_blank_01.html";
 var testURL_02 = chromeRoot + "browser_blank_02.html";
 
+let baseURI = "http://mochi.test:8888/browser/mobile/chrome/";
 var titleURL = baseURI + "browser_title.sjs?";
 var pngURL = "data:image/gif;base64,R0lGODlhCwALAIAAAAAA3pn/ZiH5BAEAAAEALAAAAAALAAsAAAIUhA+hkcuO4lmNVindo7qyrIXiGBYAOw==";
 
 // A queue to order the tests and a handle for each test
 var gTests = [];
 var gCurrentTest = null;
 
 var back = document.getElementById("tool-back");
--- a/mobile/chrome/tests/browser_scroll.js
+++ b/mobile/chrome/tests/browser_scroll.js
@@ -1,15 +1,16 @@
 // Test behavior of window.scrollTo during page load (bug 654122).
 "use strict";
 
 var gTab;
 registerCleanupFunction(function() Browser.closeTab(gTab));
 
-const TEST_URL = baseURI + "browser_scroll.html";
+const BASE_URL = "http://mochi.test:8888/browser/mobile/chrome/";
+const TEST_URL = BASE_URL + "browser_scroll.html";
 
 function test() {
   waitForExplicitFinish();
   gTab = Browser.addTab(TEST_URL, true);
   onMessageOnce(gTab.browser.messageManager, "Browser:FirstPaint", function() {
     executeSoon(function() {
       let rect = Elements.browsers.getBoundingClientRect();
       is(rect.top, 0, "Titlebar is hidden.");
--- a/mobile/chrome/tests/browser_scrollbar.js
+++ b/mobile/chrome/tests/browser_scrollbar.js
@@ -1,8 +1,9 @@
+let baseURI = "http://mochi.test:8888/browser/mobile/chrome/";
 let testURL_01 = baseURI + "browser_scrollbar.sjs?";
 
 let gCurrentTest = null;
 let gTests = [];
 let gOpenedTabs = []; // for cleanup
 
 //------------------------------------------------------------------------------
 // Iterating tests by shifting test out one by one as runNextTest is called.
--- a/mobile/chrome/tests/browser_thumbnails.js
+++ b/mobile/chrome/tests/browser_thumbnails.js
@@ -32,16 +32,17 @@
  * 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 ***** */
 
+let baseURI = "http://mochi.test:8888/browser/mobile/chrome/";
 let testURL_blank = baseURI + "browser_blank_01.html";
 
 const DEFAULT_WIDTH = 800;
 
 function testURL(n) {
   if (n < 0)
     return testURL_blank;
 
--- a/mobile/chrome/tests/browser_title.sjs
+++ b/mobile/chrome/tests/browser_title.sjs
@@ -50,18 +50,18 @@ function handleRequest(request, response
     case "english_title":
       response.write("<title>English Title Page</title>");
       break;
     case "dynamic_title":
       response.write("<title>This is an english title page</title>");
       response.write("<script>window.addEventListener('load', function() { window.removeEventListener('load', arguments.callee, false); document.title = 'This is not a french title'; }, false);</script>");
       break;
     case "redirect":
-      response.write("<meta http-equiv='refresh' content='1;url=http://mochi.test:8888/browser/mobile/chrome/tests/browser_title.sjs?no_title'></meta>");
+      response.write("<meta http-equiv='refresh' content='1;url=http://mochi.test:8888/browser/mobile/chrome/browser_title.sjs?no_title'></meta>");
       break;
     case "location":
-      response.write("<script>window.addEventListener('load', function() { window.removeEventListener('load', arguments.callee, false); document.location = 'http://mochi.test:8888/browser/mobile/chrome/tests/browser_title.sjs?no_title' ; }, false);</script>");
+      response.write("<script>window.addEventListener('load', function() { window.removeEventListener('load', arguments.callee, false); document.location = 'http://mochi.test:8888/browser/mobile/chrome/browser_title.sjs?no_title' ; }, false);</script>");
       break;
     default:
       break;
   }
   response.write("</head><body>" + query + "</body></html>");
 }
--- a/mobile/chrome/tests/browser_upgrade.rdf
+++ b/mobile/chrome/tests/browser_upgrade.rdf
@@ -9,17 +9,17 @@
         <li>
           <Description>
             <em:version>2.0</em:version>
             <em:targetApplication>
               <Description>
                 <em:id>toolkit@mozilla.org</em:id>
                 <em:minVersion>0</em:minVersion>
                 <em:maxVersion>*</em:maxVersion>
-                <em:updateLink>http://example.com/browser/mobile/chrome/tests/addons/browser_install1_3.xpi</em:updateLink>
+                <em:updateLink>http://example.com/browser/mobile/chrome/addons/browser_install1_3.xpi</em:updateLink>
               </Description>
             </em:targetApplication>
           </Description>
         </li>
       </Seq>
     </em:updates>
   </Description>
 
--- a/mobile/chrome/tests/browser_viewport.js
+++ b/mobile/chrome/tests/browser_viewport.js
@@ -33,16 +33,17 @@
  * 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 ***** */
 
+let baseURI = "http://mochi.test:8888/browser/mobile/chrome/";
 let testURL_blank = baseURI + "browser_blank_01.html";
 
 const DEFAULT_WIDTH = 800;
 
 function testURL(n) {
   return baseURI + "browser_viewport.sjs" +
     "?metadata=" + encodeURIComponent(gTestData[n].metadata || "") +
     "&style=" + encodeURIComponent(gTestData[n].style || "") +
--- a/mobile/chrome/tests/head.js
+++ b/mobile/chrome/tests/head.js
@@ -78,11 +78,11 @@ let AsyncTests = {
     if (callback)
       callback(aMessage.json);
   }
 };
 
 let chromeRoot = getRootDirectory(gTestPath);
 // For some security reasons (which?), loading remote_head using chromeRoot
 // instead of baseURI make the browser_formsZoom.js test fails.
-let baseURI = "http://mochi.test:8888/browser/mobile/chrome/tests/";
+let baseURI = "http://mochi.test:8888/browser/mobile/chrome/";
 messageManager.loadFrameScript(baseURI + "remote_head.js", true);
 messageManager.loadFrameScript("chrome://mochikit/content/tests/SimpleTest/EventUtils.js", true);
--- a/security/manager/Makefile.in
+++ b/security/manager/Makefile.in
@@ -63,17 +63,17 @@ ifndef NSS_DISABLE_DBM
 NSSDBM3_LIB = $(DLL_PREFIX)nssdbm3$(DLL_SUFFIX)
 NSSDBM3_CHK = $(DLL_PREFIX)nssdbm3.chk
 else
 NSSDBM3_LIB = 
 NSSDBM3_CHK = 
 endif
 
 ifndef MOZ_NATIVE_NSS
-ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
+ifneq (,$(filter OS2 WINCE WINNT,$(OS_ARCH)))
 SDK_LIBS = \
   $(DIST)/lib/$(LIB_PREFIX)crmf.$(LIB_SUFFIX) \
   $(DIST)/lib/$(LIB_PREFIX)smime3.$(LIB_SUFFIX) \
   $(DIST)/lib/$(LIB_PREFIX)ssl3.$(LIB_SUFFIX) \
   $(DIST)/lib/$(LIB_PREFIX)nss3.$(LIB_SUFFIX) \
   $(DIST)/lib/$(LIB_PREFIX)nssutil3.$(LIB_SUFFIX) \
   $(NULL)
 else
@@ -157,18 +157,21 @@ else
 NSPR_LIB_DIR = $(ABS_DIST)/lib
 endif
 # Can't pass this in DEFAULT_GMAKE_FLAGS because that overrides
 # definitions in NSS, so just export it into the sub-make's environment.
 ifeq (WINNT_1,$(OS_TARGET)_$(MOZ_MEMORY))
 export DLLFLAGS
 endif
 
+ifndef WINCE
+# why is this disabled on WINCE?  See bug 514295.
 # To get debug symbols from NSS
 export MOZ_DEBUG_SYMBOLS
+endif
 
 ifdef .PYMAKE
 NSSMAKE = $(GMAKE)
 else
 NSSMAKE = $(MAKE)
 endif
 
 # NSS makefiles are not safe for parallel execution.
@@ -238,29 +241,48 @@ endif
 # See bug 580679 comment 18.
 DEFAULT_GMAKE_FLAGS += NSS_ENABLE_ZLIB=
 
 # Disable building of the test programs in security/nss/lib/zlib
 DEFAULT_GMAKE_FLAGS += PROGRAMS=
 
 ifdef CROSS_COMPILE
 
+ifdef WINCE
+DEFAULT_GMAKE_FLAGS += \
+	NATIVE_CC="$(HOST_CC)" \
+	CC="$(CC)" \
+	CCC="$(CC)" \
+	LINK="$(LD)" \
+	LD="$(LD) -DLL" \
+	AS="$(AS) -Cp -Sn -Zi -coff $(INCLUDES)" \
+	AR='$(AR) -NOLOG0 -OUT:$$@' \
+	RANLIB="echo" \
+	RC="$(RC) $(RCFLAGS)" \
+	OS_ARCH="$(OS_ARCH)" \
+	OS_TEST="$(OS_TEST)" \
+	CPU_ARCH="ARM" \
+	USE_MSYS=1 \
+	WINCE=1 \
+	$(NULL)
+else
 DEFAULT_GMAKE_FLAGS += \
 	NATIVE_CC="$(HOST_CC)" \
 	CC="$(CC)" \
 	CCC="$(CXX)" \
 	LINK="$(LD)" \
 	AS="$(AS)" \
 	AR='$(AR) $(AR_FLAGS:$@=$$@)' \
 	RANLIB="$(RANLIB)" \
 	RC="$(RC) $(RCFLAGS)" \
 	OS_ARCH="$(OS_ARCH)" \
 	OS_TEST="$(OS_TEST)" \
 	CPU_ARCH="$(TARGET_CPU)" \
 	$(NULL)
+endif
 
 # Android has pthreads integrated into -lc, so OS_LIBS is set to nothing
 ifeq ($(OS_TARGET), Android)
 DEFAULT_GMAKE_FLAGS += \
 	OS_RELEASE="2.6" \
 	OS_LIBS= \
 	STANDARDS_CFLAGS="-std=gnu89" \
 	DSO_CFLAGS="$(CFLAGS) -DCHECK_FORK_GETPID -DRTLD_NOLOAD=0 -DANDROID_VERSION=$(ANDROID_VERSION) -include $(ABS_topsrcdir)/security/manager/android_stub.h" \
--- a/xulrunner/Makefile.in
+++ b/xulrunner/Makefile.in
@@ -51,13 +51,13 @@ PARALLEL_DIRS = \
   $(NULL)
 
 ifeq ($(OS_ARCH),WINNT)
 ifdef MOZ_INSTALLER
 DIRS += installer/windows
 endif
 endif
 
-ifeq ($(OS_ARCH),WINNT)
+ifneq (,$(filter WINNT WINCE,$(OS_ARCH)))
 PARALLEL_DIRS += tools/redit
 endif
 
 include $(topsrcdir)/config/rules.mk
--- a/xulrunner/app/Makefile.in
+++ b/xulrunner/app/Makefile.in
@@ -49,17 +49,17 @@ include $(DEPTH)/config/autoconf.mk
 
 DIRS = profile
 
 PREF_JS_EXPORTS = $(srcdir)/xulrunner.js
 GARBAGE += $(addprefix $(DIST)/bin/defaults/pref/,xulrunner.js)
 
 DEFINES += -DAB_CD=$(AB_CD)
 
-ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
+ifneq (,$(filter OS2 WINCE WINNT,$(OS_ARCH)))
 PROGRAM = xulrunner$(BIN_SUFFIX)
 else
 PROGRAM = xulrunner-bin$(BIN_SUFFIX)
 endif
 
 DEFINES += -DXULRUNNER_PROGNAME=\"xulrunner\"
 
 ifdef TARGET_XPCOM_ABI
@@ -111,18 +111,22 @@ DEFINES += -DMOZ_WINCONSOLE=$(MOZ_WINCON
 # shouldn't get 755 perms need $(IFLAGS1) for either way of calling nsinstall.
 NSDISTMODE = copy
 
 include $(topsrcdir)/config/config.mk
 
 ifdef _MSC_VER
 # Always enter a Windows program through wmain, whether or not we're
 # a console application.
+ifdef WINCE
+WIN32_EXE_LDFLAGS += -ENTRY:mainWCRTStartup
+else
 WIN32_EXE_LDFLAGS += -ENTRY:wmainCRTStartup
 endif
+endif
 
 ifeq ($(OS_ARCH),WINNT)
 OS_LIBS += $(call EXPAND_LIBNAME,comctl32 comdlg32 uuid shell32 ole32 oleaut32 version winspool)
 RCINCLUDE = splash.rc
 ifndef GNU_CC
 RCFLAGS += -DMOZ_XULRUNNER -I$(srcdir)
 else
 RCFLAGS += -DMOZ_XULRUNNER --include-dir $(srcdir)
@@ -166,17 +170,17 @@ ifndef GNU_CC
 LDFLAGS += /HEAP:0x40000
 ifeq ($(OS_TEST),x86_64)
 # set stack to 2MB on x64 build.  See bug 582910
 LDFLAGS += -STACK:2097152
 endif
 endif
 endif
 
-ifneq (,$(filter-out OS2 WINNT,$(OS_ARCH)))
+ifneq (,$(filter-out OS2 WINCE WINNT,$(OS_ARCH)))
 ifeq (unix, $(MOZ_FS_LAYOUT))
 
 xulrunner:: $(topsrcdir)/build/unix/mozilla.in $(GLOBAL_DEPS)
 	cat $< | sed -e "s|%MOZAPPDIR%|$(installdir)|" \
                 -e "s|%MOZ_USER_DIR%|.mozilla/xulrunner|" \
                 -e "s|%MOZ_APP_DISPLAYNAME%|$(MOZ_APP_DISPLAYNAME)|" > $@
 	chmod +x $@
 
--- a/xulrunner/app/nsXULRunnerApp.cpp
+++ b/xulrunner/app/nsXULRunnerApp.cpp
@@ -69,17 +69,17 @@
  * @param fmt
  *        printf-style format string followed by arguments.
  */
 static void Output(PRBool isError, const char *fmt, ... )
 {
   va_list ap;
   va_start(ap, fmt);
 
-#if (defined(XP_WIN) && !MOZ_WINCONSOLE)
+#if (defined(XP_WIN) && !MOZ_WINCONSOLE) || defined(WINCE)
   char *msg = PR_vsmprintf(fmt, ap);
   if (msg)
   {
     UINT flags = MB_OK;
     if (isError)
       flags |= MB_ICONERROR;
     else
       flags |= MB_ICONINFORMATION;
@@ -169,16 +169,24 @@ static void Usage(const char *argv0)
            "Usage: " XULRUNNER_PROGNAME " [OPTIONS]\n"
            "       " XULRUNNER_PROGNAME " APP-FILE [APP-OPTIONS...]\n"
            "\n"
            "OPTIONS\n"
            "      --app                  specify APP-FILE (optional)\n"
            "  -h, --help                 show this message\n"
            "  -v, --version              show version\n"
            "  --gre-version              print the GRE version string on stdout\n"
+           "  --register-global          register this GRE in the machine registry\n"
+           "  --register-user            register this GRE in the user registry\n"
+           "  --unregister-global        unregister this GRE formerly registered with\n"
+           "                             --register-global\n"
+           "  --unregister-user          unregister this GRE formely registered with\n"
+           "                             --register-user\n"
+           "  --find-gre <version>       Find a GRE with version <version> and print\n"
+           "                             the path on stdout\n"
            "  --install-app <application> [<destination> [<directoryname>]]\n"
            "                             Install a XUL application.\n"
            "\n"
            "APP-FILE\n"
            "  Application initialization file.\n"
            "\n"
            "APP-OPTIONS\n"
            "  Application specific options.\n",
--- a/xulrunner/stub/Makefile.in
+++ b/xulrunner/stub/Makefile.in
@@ -68,17 +68,17 @@ LIBS = \
 
 # Need to link with CoreFoundation on Mac
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
 LIBS            += \
 		$(TK_LIBS) \
 		$(NULL)
 endif
 
-ifeq ($(OS_ARCH),WINNT)
+ifneq (,$(filter WINNT WINCE,$(OS_ARCH)))
 RCINCLUDE = xulrunner-stub.rc
 ifndef GNU_CC
 RCFLAGS += -DMOZ_XULRUNNER -I$(srcdir)
 else
 RCFLAGS += -DMOZ_XULRUNNER --include-dir $(srcdir)
 endif
 LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
 endif
@@ -89,18 +89,22 @@ MOZ_WINCONSOLE = 1
 else
 MOZ_WINCONSOLE = 0
 endif
 endif
 
 include $(topsrcdir)/config/config.mk
 
 ifdef _MSC_VER
+ifdef WINCE
+WIN32_EXE_LDFLAGS += -ENTRY:mainWCRTStartup
+else
 WIN32_EXE_LDFLAGS += -ENTRY:wmainCRTStartup
 endif
+endif
 
 LIBS += $(JEMALLOC_LIBS)
 
 include $(topsrcdir)/config/rules.mk
 
 ifeq ($(OS_ARCH),WINNT)
 OS_LIBS += $(call EXPAND_LIBNAME,shell32)
 endif
--- a/xulrunner/stub/nsXULStub.cpp
+++ b/xulrunner/stub/nsXULStub.cpp
@@ -81,17 +81,17 @@
 
 #define VERSION_MAXLEN 128
 
 static void Output(PRBool isError, const char *fmt, ... )
 {
   va_list ap;
   va_start(ap, fmt);
 
-#if (defined(XP_WIN) && !MOZ_WINCONSOLE)
+#if (defined(XP_WIN) && !MOZ_WINCONSOLE) || defined(WINCE)
   char msg[2048];
 
   vsnprintf(msg, sizeof(msg), fmt, ap);
 
   UINT flags = MB_OK;
   if (isError)
     flags |= MB_ICONERROR;
   else
@@ -186,16 +186,53 @@ public:
 private:
   nsXREAppData* mAppData;
 };
 
 XRE_CreateAppDataType XRE_CreateAppData;
 XRE_FreeAppDataType XRE_FreeAppData;
 XRE_mainType XRE_main;
 
+
+#ifdef WINCE
+void
+ForwardToWindow(HWND wnd) {
+  // For WinCE, we're stuck with providing our own argv[0] for the remote
+  // command-line.
+  WCHAR wPath[MAX_PATH] = L"dummy ";
+  WCHAR *wCmd = ::GetCommandLineW();
+  WCHAR wCwd[MAX_PATH];
+  _wgetcwd(wCwd, MAX_PATH);
+
+  // Construct a narrow UTF8 buffer <path> <commandline>\0<workingdir>\0
+  size_t len = wcslen(wPath) + wcslen(wCmd) + wcslen(wCwd) + 2;
+  WCHAR *wMsg = (WCHAR *)malloc(len * sizeof(*wMsg));
+  wcscpy(wMsg, wPath);
+  wcscpy(wMsg + wcslen(wPath), wCmd);                // The command line
+  wcscpy(wMsg + wcslen(wPath) + wcslen(wCmd) + 1, wCwd); // Working dir
+
+  // Then convert to UTF-8, assuming worst-case explosion of characters
+  char *msg = (char *)malloc(len * 4);
+  WideCharToMultiByte(CP_UTF8, 0, wMsg, len, msg, len * 4, NULL, NULL);
+
+  // We used to set dwData to zero, when we didn't send the working dir.
+  // Now we're using it as a version number.
+  COPYDATASTRUCT cds = { 1, len, (void *)msg };
+
+  // Bring the already running Mozilla process to the foreground.
+  // nsWindow will restore the window (if minimized) and raise it.
+  // for activating the existing window on wince we need "| 0x01"
+  // see http://msdn.microsoft.com/en-us/library/ms940024.aspx for details
+  ::SetForegroundWindow((HWND)(((ULONG) wnd) | 0x01));
+  ::SendMessage(wnd, WM_COPYDATA, 0, (LPARAM)&cds);
+  free(wMsg);
+  free(msg);
+}
+#endif
+
 int
 main(int argc, char **argv)
 {
   nsresult rv;
   char *lastSlash;
 
   char iniPath[MAXPATHLEN];
   char tmpPath[MAXPATHLEN];
@@ -357,16 +394,51 @@ main(int argc, char **argv)
   
   nsINIParser parser;
   rv = parser.Init(iniPath);
   if (NS_FAILED(rv)) {
     fprintf(stderr, "Could not read application.ini\n");
     return 1;
   }
 
+#ifdef WINCE
+  // On Windows Mobile and WinCE, we can save a lot of time by not
+  // waiting for XUL and XPCOM to load up.  Let's see if we can find
+  // an existing app window to forward our command-line to now.
+
+  // Shouldn't attempt this if the -no-remote parameter has been provided.
+  bool noRemote = false;
+  for (int i = 1; i < argc; i++) {
+    if (IsArg(argv[i], "no-remote")) {
+      noRemote = true;
+      break;
+    }
+  }
+
+  if (!noRemote) {
+    char windowName[512];  // Is there a const for appname like VERSION_MAXLEN?
+    rv = parser.GetString("App", "Name", windowName, sizeof(windowName));
+    if (NS_FAILED(rv)) {
+      fprintf(stderr, "Couldn't figure out the application name\n");
+      return 1;
+    }
+
+    // Lookup the hidden message window created by nsNativeAppSupport
+    strncat(windowName, "MessageWindow", sizeof(windowName) - strlen(windowName));
+    WCHAR wWindowName[512];
+    MultiByteToWideChar(CP_UTF8, 0, windowName, -1, wWindowName, sizeof(wWindowName));
+    HWND wnd = ::FindWindowW(wWindowName, NULL);
+    if (wnd) {
+      // Forward the command-line and bail out
+      ForwardToWindow(wnd);
+      return 0;
+    }
+  }
+#endif
+
   if (!greFound) {
     Output(PR_FALSE,
            "Could not find the Mozilla runtime.\n");
       return 1;
   }
 
 #ifdef XP_OS2
   // On OS/2 we need to set BEGINLIBPATH to be able to find XULRunner DLLs
@@ -406,17 +478,18 @@ main(int argc, char **argv)
 
   NS_LogInit();
 
   int retval;
 
   { // Scope COMPtr and AutoAppData
     nsCOMPtr<nsILocalFile> iniFile;
 #ifdef XP_WIN
-    // On Windows iniPath is UTF-8 encoded so we need to convert it.
+    // On Windows and Windows CE, iniPath is UTF-8 encoded,
+    // so we need to convert it.
     rv = NS_NewLocalFile(NS_ConvertUTF8toUTF16(iniPath), PR_FALSE,
                          getter_AddRefs(iniFile));
 #else
     rv = NS_NewNativeLocalFile(nsDependentCString(iniPath), PR_FALSE,
                                getter_AddRefs(iniFile));
 #endif
     if (NS_FAILED(rv)) {
       Output(PR_TRUE, "Couldn't find application.ini file.\n");
--- a/xulrunner/tools/redit/Makefile.in
+++ b/xulrunner/tools/redit/Makefile.in
@@ -47,9 +47,17 @@ MODULE = redit
 ifeq ($(OS_ARCH),WINNT)
 CPPSRCS    = redit.cpp
 PROGRAM    = redit$(BIN_SUFFIX)
 SDK_BINARY =  \
 	$(PROGRAM) \
 	$(NULL)
 endif
 
+ifeq ($(OS_ARCH),WINCE)
+HOST_CPPSRCS = redit.cpp
+HOST_PROGRAM = redit$(BIN_SUFFIX)
+SDK_BINARY   =  \
+	$(HOST_PROGRAM) \
+	$(NULL)
+endif
+
 include $(topsrcdir)/config/rules.mk