Merge.
authorAndreas Gal <gal@mozilla.com>
Tue, 23 Sep 2008 00:37:10 -0700
changeset 19605 b222647a14cb9bb942b62c714511a324a7701ec9
parent 19604 385c9e591c97d92a8923a2bc4de7ae3a92f974ab (current diff)
parent 19532 ad2eb162ecfc527df0404da09c7d10939ab28352 (diff)
child 19606 15aecdaab936f81b0ff03ac3764d604127767985
child 19650 9496f3b0fa10f49bd774f22350d8840120554544
push idunknown
push userunknown
push dateunknown
milestone1.9.1b1pre
Merge.
toolkit/content/buildconfig.html.in
--- a/accessible/tests/mochitest/test_bug420863.html
+++ b/accessible/tests/mochitest/test_bug420863.html
@@ -89,17 +89,29 @@ https://bugzilla.mozilla.org/show_bug.cg
       //////////////////////////////////////////////////////////////////////////
       // td with registered 'click' event handler (sequel, see doTest2())
       ok(gTdClickEventHandler, gID + ": 'click' action hasn't been performed");
 
       // unregister click event handler
       gNode.removeEventListener("click", gClickHandler, false);
 
       // check actions
-      is(gAcc.numActions, 0, gID + ": shouldn't have actions");
+      // XXX see bug 456347, sometimes after removing the event listener, the
+      // accessible is no longer valid. When fixing that bug, remove the
+      // try/exception and simply test for the gAcc.numActions value directly.
+      var numActions = -1;
+      try {
+        numActions = gAcc.numActions;
+      } catch(e) {}
+
+      if (numActions == -1)
+        todo(false,
+             "gAcc.numActions should not throw after click handler was removed!");
+      else
+        is(numActions, 0, gID + ": shouldn't have actions");
 
       SimpleTest.finish();
     }
 
     SimpleTest.waitForExplicitFinish();
     addLoadEvent(doTest);
   </script>
 </head>
--- a/accessible/tests/mochitest/test_groupattrs.xul
+++ b/accessible/tests/mochitest/test_groupattrs.xul
@@ -49,41 +49,46 @@
 
       //////////////////////////////////////////////////////////////////////////
       // xul:listbox (bug 417317)
       testGroupAttrs("item1", "1", "2");
       testGroupAttrs("item2", "2", "2");
 
       //////////////////////////////////////////////////////////////////////////
       // xul:menu (bug 443881)
-      var menu1 = document.getElementById("menu_item1");
-      menu1.open = true;
-
-      window.setTimeout(function() {
-        var menu2 = document.getElementById("menu_item2");
-        menu2.open = true;
-
-        window.setTimeout(function() {
-          testGroupAttrs("menu_item1.1", "1", "1");
-          testGroupAttrs("menu_item1.2", "1", "3");
-          testGroupAttrs("menu_item1.4", "2", "3");
-          testGroupAttrs("menu_item2", "3", "3");
-          testGroupAttrs("menu_item2.1", "1", "2", "1");
-          testGroupAttrs("menu_item2.2", "2", "2", "1");
-
-          SimpleTest.finish();
-        }, 0);
-      }, 0);
+      if (navigator.platform == "Win32") {
+	      var menu1 = document.getElementById("menu_item1");
+	      menu1.open = true;
+	
+	      window.setTimeout(function() {
+	        var menu2 = document.getElementById("menu_item2");
+	        menu2.open = true;
+	
+	        window.setTimeout(function() {
+	          testGroupAttrs("menu_item1.1", "1", "1");
+	          testGroupAttrs("menu_item1.2", "1", "3");
+	          testGroupAttrs("menu_item1.4", "2", "3");
+	          testGroupAttrs("menu_item2", "3", "3");
+	          testGroupAttrs("menu_item2.1", "1", "2", "1");
+	          testGroupAttrs("menu_item2.2", "2", "2", "1");
+	
+	          SimpleTest.finish();
+	        }, 0);
+	      }, 0);
+      }
 
       //////////////////////////////////////////////////////////////////////////
       // ARIA menu (bug 441888)
       testGroupAttrs("aria-menuitem", "1", "3");
       testGroupAttrs("aria-menuitemcheckbox", "2", "3");
       testGroupAttrs("aria-menuitemradio", "3", "3");
       testGroupAttrs("aria-menuitem2", "1", "1");
+      if (navigator.platform != "Win32")
+        SimpleTest.finish();
+
     }
 
     SimpleTest.waitForExplicitFinish();
     addLoadEvent(doTest);
   ]]>
   </script>
 
   <body xmlns="http://www.w3.org/1999/xhtml">
--- a/accessible/tests/mochitest/test_nsIAccessibleImage.html
+++ b/accessible/tests/mochitest/test_nsIAccessibleImage.html
@@ -70,18 +70,18 @@ https://bugzilla.mozilla.org/show_bug.cg
         // See if parent's screen coordinates plus image's parent relative
         // coordinates equal to image's screen coordinates.
         var parentAccX = {}, parentAccY = {}, parentAccWidth = {},
             parentAccHeight = {};
         imageParentAcc.getBounds(parentAccX, parentAccY, parentAccWidth,
                                  parentAccHeight);
         is(parentAccX.value + parentX.value, screenX.value,
            "Wrong screen x coordinate for " + aID + "!");
-        is(parentAccY.value + parentY.value, screenY.value,
-           "Wrong screen y coordinate for " + aID + "!");
+// XXX see bug 456344        is(parentAccY.value + parentY.value, screenY.value,
+//           "Wrong screen y coordinate for " + aID + "!");
       }
 
       var width = {}, height = {};
       imageAcc.getImageSize(width, height);
       is(width.value, aWidth, "Wrong width for " + aID + "!");
       is(height.value, aHeight, "wrong height for " + aID + "!");
     }
 
--- a/accessible/tests/mochitest/test_nsIAccessibleTable_1.html
+++ b/accessible/tests/mochitest/test_nsIAccessibleTable_1.html
@@ -72,17 +72,18 @@ function doTest()
   try {
     columnHeader = accTable.columnHeader;
     columnHeaderIndex =columnHeader.getIndexAt(0,2);
     is(columnHeaderIndex, 2, "columnheaderindex is wrong");
   }
   catch (e) {
     works = false;
   }
-  todo(works, "columnHeader should not throw");
+  if (!works)
+    todo(works, "columnHeader should not throw");
 
   var columnDescription;
   works = true;
   try{
     columnDescription = accTable.getColumnDescription(1);
   }
   catch (e) {
     works = false;
--- a/browser/app/Makefile.in
+++ b/browser/app/Makefile.in
@@ -67,17 +67,17 @@ DEFINES += -DAPP_UA_NAME="$(APP_UA_NAME)
 
 DIST_FILES = application.ini
 
 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)
 
-SOURCE_STAMP := $(shell hg identify -i $(topsrcdir) 2>/dev/null)
+SOURCE_STAMP := $(shell cd $(topsrcdir) ; hg identify 2>/dev/null | cut -f1 -d' ')
 ifdef SOURCE_STAMP
 DEFINES += -DMOZ_SOURCE_STAMP="$(SOURCE_STAMP)"
 endif
 
 SOURCE_REPO := $(shell hg -R $(topsrcdir) showconfig paths.default 2>/dev/null | sed s/^ssh:/http:/)
 ifdef SOURCE_REPO
 DEFINES += -DMOZ_SOURCE_REPO="$(SOURCE_REPO)"
 endif
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -305,16 +305,17 @@ pref("browser.link.open_newwindow", 3);
 
 // 0: no restrictions - divert everything
 // 1: don't divert window.open at all
 // 2: don't divert window.open with features
 pref("browser.link.open_newwindow.restriction", 2);
 
 // Tabbed browser
 pref("browser.tabs.autoHide", false);
+pref("browser.tabs.closeWindowWithLastTab", true);
 pref("browser.tabs.warnOnClose", true);
 pref("browser.tabs.warnOnOpen", true);
 pref("browser.tabs.maxOpenBeforeWarn", 15);
 pref("browser.tabs.loadInBackground", true);
 pref("browser.tabs.loadFolderAndReplace", true);
 pref("browser.tabs.opentabfor.middleclick", true);
 pref("browser.tabs.loadDivertedInBackground", false);
 pref("browser.tabs.loadBookmarksInBackground", false);
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -2037,17 +2037,17 @@ function canonizeUrl(aTriggeringEvent, a
     return;
 
   var url = gURLBar.value;
 
   // Only add the suffix when the URL bar value isn't already "URL-like".
   // Since this function is called from handleURLBarCommand, which receives
   // both mouse (from the go button) and keyboard events, we also make sure not
   // to do the fixup unless we get a keyboard event, to match user expectations.
-  if (!/^(www|https?)\b|\/\s*$/i.test(url) &&
+  if (!/^\s*(www|https?)\b|\/\s*$/i.test(url) &&
       (aTriggeringEvent instanceof KeyEvent)) {
 #ifdef XP_MACOSX
     var accel = aTriggeringEvent.metaKey;
 #else
     var accel = aTriggeringEvent.ctrlKey;
 #endif
     var shift = aTriggeringEvent.shiftKey;
 
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -1405,18 +1405,22 @@
             if (aFireBeforeUnload) {
               let ds = this.getBrowserForTab(aTab).docShell;
               if (ds.contentViewer && !ds.contentViewer.permitUnload())
                 return null;
             }
 
             var l = this.mTabContainer.childNodes.length;
             if (l == 1) {
-              closeWindow(true);
-              return null;
+              if (this.mPrefs.getBoolPref("browser.tabs.closeWindowWithLastTab")) {
+                closeWindow(true);
+                return null;
+              }
+              BrowserOpenTab();
+              l++;
             }
             if (l == 2) {
               var autohide = this.mPrefs.getBoolPref("browser.tabs.autoHide");
               var tabStripHide = !window.toolbar.visible;
               if (autohide || tabStripHide)
                 this.setStripVisibilityTo(false);
             }
 
@@ -1464,17 +1468,17 @@
         </body>
       </method>
 
       <method name="_endRemoveTab">
         <parameter name="aTab"/>
         <body>
           <![CDATA[
             if (!aTab)
-              return null;
+              return;
 
             var browser = this.getBrowserForTab(aTab);
             var length = this.mTabs.length;
 
             // Get the index of the tab we're removing before unselecting it
             var currentIndex = this.mTabContainer.selectedIndex;
             var index = aTab._tPos;
 
--- a/browser/components/preferences/tabs.js
+++ b/browser/components/preferences/tabs.js
@@ -66,31 +66,30 @@ var gTabsPane = {
    * browser.tabs.warnOnOpen
    * - true if the user should be warned if he attempts to open a lot of tabs at
    *   once (e.g. a large folder of bookmarks), false otherwise
    */
 
   /**
    * Determines where a link which opens a new window will open.
    *
-   * @returns 2 if such links should be opened in new windows,
-   *          3 if such links should be opened in new tabs
+   * @returns |true| if such links should be opened in new tabs
    */
   readLinkTarget: function() {
     var openExternal = document.getElementById("browser.link.open_external");
-    return openExternal.value != 2 ? 3 : 2;
+    return openExternal.value != 2;
   },
 
   /**
    * Ensures that pages opened in new windows by web pages and pages opened by
    * external applications both open in the same way (e.g. in a new tab, window,
    * etc.).
    *
    * @returns 2 if such links should be opened in new windows,
    *          3 if such links should be opened in new tabs
    */
   writeLinkTarget: function() {
     var linkTargeting = document.getElementById("linkTargeting");
-    document.getElementById("browser.link.open_newwindow").value = linkTargeting.value;
-    return linkTargeting.value;
+    var linkTarget = linkTargeting.checked ? 3 : 2;
+    document.getElementById("browser.link.open_newwindow").value = linkTarget;
+    return linkTarget;
   }
 };
-
--- a/browser/components/preferences/tabs.xul
+++ b/browser/components/preferences/tabs.xul
@@ -58,32 +58,24 @@
       <preference id="browser.tabs.autoHide"           name="browser.tabs.autoHide"           type="bool" inverted="true"/>
       <preference id="browser.tabs.loadInBackground"   name="browser.tabs.loadInBackground"   type="bool" inverted="true"/>
       <preference id="browser.tabs.warnOnClose"        name="browser.tabs.warnOnClose"        type="bool"/>
       <preference id="browser.tabs.warnOnOpen"         name="browser.tabs.warnOnOpen"         type="bool"/>
     </preferences>
     
     <script type="application/x-javascript" src="chrome://browser/content/preferences/tabs.js"/>
 
-    <vbox id="linksOpenInBox">
-      <label control="linkTargeting">&newPagesIn.label;</label>
-      <radiogroup id="linkTargeting" class="indent"
-                  preference="browser.link.open_external"
-                  onsyncfrompreference="return gTabsPane.readLinkTarget();"
-                  onsynctopreference="return gTabsPane.writeLinkTarget();">
-        <radio label="&inNewWindow.label;" accesskey="&inNewWindow.accesskey;" value="2"/>
-        <radio label="&inNewTab.label;" accesskey="&inNewTab.accesskey;" value="3"/>
-      </radiogroup>
-    </vbox>
-
-    <separator id="tabsSeparator"/>
-
     <!-- XXX flex below is a hack because wrapping checkboxes don't reflow
              properly; see bug 349098 -->
     <vbox id="tabPrefsBox" align="start" flex="1">
+      <checkbox id="linkTargeting" label="&newWindowsAsTabs.label;"
+                accesskey="&newWindowsAsTabs.accesskey;"
+                preference="browser.link.open_external"
+                onsyncfrompreference="return gTabsPane.readLinkTarget();"
+                onsynctopreference="return gTabsPane.writeLinkTarget();"/>
       <checkbox id="warnCloseMultiple" label="&warnCloseMultipleTabs.label;"
                 accesskey="&warnCloseMultipleTabs.accesskey;"
                 preference="browser.tabs.warnOnClose"/>
       <checkbox id="warnOpenMany" label="&warnOpenManyTabs.label;"
                 accesskey="&warnOpenManyTabs.accesskey;"
                 preference="browser.tabs.warnOnOpen"/>
       <checkbox id="showTabBar" label="&showTabBar.label;"
                 accesskey="&showTabBar.accesskey;"
--- a/browser/locales/en-US/chrome/browser/preferences/tabs.dtd
+++ b/browser/locales/en-US/chrome/browser/preferences/tabs.dtd
@@ -1,13 +1,10 @@
-<!ENTITY newPagesIn.label             "New pages should be opened in:">
-<!ENTITY inNewWindow.label            "a new window">
-<!ENTITY inNewWindow.accesskey        "w">
-<!ENTITY inNewTab.label               "a new tab">
-<!ENTITY inNewTab.accesskey           "t">
+<!ENTITY newWindowsAsTabs.label       "Open new windows in a new tab instead">
+<!ENTITY newWindowsAsTabs.accesskey   "t">
 
 <!ENTITY warnCloseMultipleTabs.label  "Warn me when closing multiple tabs">
 <!ENTITY warnCloseMultipleTabs.accesskey  "m">
 
 <!ENTITY warnOpenManyTabs.label       "Warn me when opening multiple tabs might slow down &brandShortName;">
 <!ENTITY warnOpenManyTabs.accesskey   "o">
 
 <!ENTITY showTabBar.label             "Always show the tab bar">
--- a/browser/themes/pinstripe/browser/browser.css
+++ b/browser/themes/pinstripe/browser/browser.css
@@ -70,17 +70,17 @@
 }
 
 #main-window:not([active="true"]) > #browser > vbox > #sidebar,
 #main-window:not([active="true"]) > #browser > vbox > sidebarheader { 
   background-color: #e8e8e8;
 }
 
 #main-window:not([active="true"]) .tabbrowser-strip {
-  background-color: #cfcfcf;
+  background-color: #e2e2e2;
 }
 
 #main-window:not([active="true"]) .tabbrowser-tab {
   color: #575757;
 }
 
 #main-window:not([active="true"]) .tabbrowser-tab[selected="true"] {
   background-color: -moz-mac-chrome-inactive;
new file mode 100644
--- /dev/null
+++ b/build/wince/shunt/build/vs9/mozce_shunt_static.sln
@@ -0,0 +1,62 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mozce_shunt_static", "mozce_shunt_static.vcproj", "{082BAB06-D10F-4C57-B123-F84DC06C246D}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Pocket PC 2003 (ARMV4) = Debug|Pocket PC 2003 (ARMV4)
+		Debug|Smartphone 2003 (ARMV4) = Debug|Smartphone 2003 (ARMV4)
+		Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I) = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I) = Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)
+		Debug|Windows Mobile 6 Professional SDK (ARMV4I) = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
+		Debug|Windows Mobile 6 Standard SDK (ARMV4I) = Debug|Windows Mobile 6 Standard SDK (ARMV4I)
+		Release|Pocket PC 2003 (ARMV4) = Release|Pocket PC 2003 (ARMV4)
+		Release|Smartphone 2003 (ARMV4) = Release|Smartphone 2003 (ARMV4)
+		Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I) = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I) = Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)
+		Release|Windows Mobile 6 Professional SDK (ARMV4I) = Release|Windows Mobile 6 Professional SDK (ARMV4I)
+		Release|Windows Mobile 6 Standard SDK (ARMV4I) = Release|Windows Mobile 6 Standard SDK (ARMV4I)
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{082BAB06-D10F-4C57-B123-F84DC06C246D}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
+		{082BAB06-D10F-4C57-B123-F84DC06C246D}.Debug|Pocket PC 2003 (ARMV4).Build.0 = Debug|Pocket PC 2003 (ARMV4)
+		{082BAB06-D10F-4C57-B123-F84DC06C246D}.Debug|Pocket PC 2003 (ARMV4).Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
+		{082BAB06-D10F-4C57-B123-F84DC06C246D}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)
+		{082BAB06-D10F-4C57-B123-F84DC06C246D}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)
+		{082BAB06-D10F-4C57-B123-F84DC06C246D}.Debug|Smartphone 2003 (ARMV4).Deploy.0 = Debug|Smartphone 2003 (ARMV4)
+		{082BAB06-D10F-4C57-B123-F84DC06C246D}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{082BAB06-D10F-4C57-B123-F84DC06C246D}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{082BAB06-D10F-4C57-B123-F84DC06C246D}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Deploy.0 = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{082BAB06-D10F-4C57-B123-F84DC06C246D}.Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I).ActiveCfg = Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)
+		{082BAB06-D10F-4C57-B123-F84DC06C246D}.Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I).Build.0 = Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)
+		{082BAB06-D10F-4C57-B123-F84DC06C246D}.Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I).Deploy.0 = Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)
+		{082BAB06-D10F-4C57-B123-F84DC06C246D}.Debug|Windows Mobile 6 Professional SDK (ARMV4I).ActiveCfg = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
+		{082BAB06-D10F-4C57-B123-F84DC06C246D}.Debug|Windows Mobile 6 Professional SDK (ARMV4I).Build.0 = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
+		{082BAB06-D10F-4C57-B123-F84DC06C246D}.Debug|Windows Mobile 6 Professional SDK (ARMV4I).Deploy.0 = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
+		{082BAB06-D10F-4C57-B123-F84DC06C246D}.Debug|Windows Mobile 6 Standard SDK (ARMV4I).ActiveCfg = Debug|Windows Mobile 6 Standard SDK (ARMV4I)
+		{082BAB06-D10F-4C57-B123-F84DC06C246D}.Debug|Windows Mobile 6 Standard SDK (ARMV4I).Build.0 = Debug|Windows Mobile 6 Standard SDK (ARMV4I)
+		{082BAB06-D10F-4C57-B123-F84DC06C246D}.Debug|Windows Mobile 6 Standard SDK (ARMV4I).Deploy.0 = Debug|Windows Mobile 6 Standard SDK (ARMV4I)
+		{082BAB06-D10F-4C57-B123-F84DC06C246D}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Pocket PC 2003 (ARMV4)
+		{082BAB06-D10F-4C57-B123-F84DC06C246D}.Release|Pocket PC 2003 (ARMV4).Build.0 = Release|Pocket PC 2003 (ARMV4)
+		{082BAB06-D10F-4C57-B123-F84DC06C246D}.Release|Pocket PC 2003 (ARMV4).Deploy.0 = Release|Pocket PC 2003 (ARMV4)
+		{082BAB06-D10F-4C57-B123-F84DC06C246D}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)
+		{082BAB06-D10F-4C57-B123-F84DC06C246D}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)
+		{082BAB06-D10F-4C57-B123-F84DC06C246D}.Release|Smartphone 2003 (ARMV4).Deploy.0 = Release|Smartphone 2003 (ARMV4)
+		{082BAB06-D10F-4C57-B123-F84DC06C246D}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{082BAB06-D10F-4C57-B123-F84DC06C246D}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{082BAB06-D10F-4C57-B123-F84DC06C246D}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{082BAB06-D10F-4C57-B123-F84DC06C246D}.Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)
+		{082BAB06-D10F-4C57-B123-F84DC06C246D}.Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I).Build.0 = Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)
+		{082BAB06-D10F-4C57-B123-F84DC06C246D}.Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)
+		{082BAB06-D10F-4C57-B123-F84DC06C246D}.Release|Windows Mobile 6 Professional SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 6 Professional SDK (ARMV4I)
+		{082BAB06-D10F-4C57-B123-F84DC06C246D}.Release|Windows Mobile 6 Professional SDK (ARMV4I).Build.0 = Release|Windows Mobile 6 Professional SDK (ARMV4I)
+		{082BAB06-D10F-4C57-B123-F84DC06C246D}.Release|Windows Mobile 6 Professional SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 6 Professional SDK (ARMV4I)
+		{082BAB06-D10F-4C57-B123-F84DC06C246D}.Release|Windows Mobile 6 Standard SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 6 Standard SDK (ARMV4I)
+		{082BAB06-D10F-4C57-B123-F84DC06C246D}.Release|Windows Mobile 6 Standard SDK (ARMV4I).Build.0 = Release|Windows Mobile 6 Standard SDK (ARMV4I)
+		{082BAB06-D10F-4C57-B123-F84DC06C246D}.Release|Windows Mobile 6 Standard SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 6 Standard SDK (ARMV4I)
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal
new file mode 100644
--- /dev/null
+++ b/build/wince/shunt/build/vs9/mozce_shunt_static.vcproj
@@ -0,0 +1,1261 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="mozce_shunt_static"
+	ProjectGUID="{082BAB06-D10F-4C57-B123-F84DC06C246D}"
+	RootNamespace="mozce_shunt_static"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Pocket PC 2003 (ARMV4)"
+		/>
+		<Platform
+			Name="Smartphone 2003 (ARMV4)"
+		/>
+		<Platform
+			Name="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+		/>
+		<Platform
+			Name="Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
+		/>
+		<Platform
+			Name="Windows Mobile 6 Professional SDK (ARMV4I)"
+		/>
+		<Platform
+			Name="Windows Mobile 6 Standard SDK (ARMV4I)"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Pocket PC 2003 (ARMV4)"
+			OutputDirectory="Pocket PC 2003 (ARMV4)\$(ConfigurationName)"
+			IntermediateDirectory="Pocket PC 2003 (ARMV4)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\include"
+				PreprocessorDefinitions="_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);_DEBUG;DEBUG;_LIB;$(ARCHFAM);$(_ARCHFAM_);MOZCE_STATIC_BUILD;MOZCE_SHUNT_EXPORTS"
+				MinimalRebuild="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="1"
+				BufferSecurityCheck="false"
+				EnableFunctionLevelLinking="true"
+				TreatWChar_tAsBuiltInType="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG;_UNICODE;UNICODE;_WIN32_WCE;UNDER_CE"
+				Culture="1033"
+				AdditionalIncludeDirectories="$(IntDir)"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				AdditionalOptions=" /subsystem:windowsce,5.01 /machine:THUMB"
+				OutputFile="$(InputDir)/shunt_dbg.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|Smartphone 2003 (ARMV4)"
+			OutputDirectory="Smartphone 2003 (ARMV4)\$(ConfigurationName)"
+			IntermediateDirectory="Smartphone 2003 (ARMV4)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\include"
+				PreprocessorDefinitions="_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);_DEBUG;DEBUG;_LIB;$(ARCHFAM);$(_ARCHFAM_);MOZCE_STATIC_BUILD;MOZCE_SHUNT_EXPORTS"
+				MinimalRebuild="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="1"
+				BufferSecurityCheck="false"
+				EnableFunctionLevelLinking="true"
+				TreatWChar_tAsBuiltInType="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG;_UNICODE;UNICODE;_WIN32_WCE;UNDER_CE"
+				Culture="1033"
+				AdditionalIncludeDirectories="$(IntDir)"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				AdditionalOptions=" /subsystem:windowsce,5.01 /machine:THUMB"
+				OutputFile="$(InputDir)/shunt_dbg.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+			OutputDirectory="$(PlatformName)\Debug"
+			IntermediateDirectory="$(PlatformName)\Debug"
+			ConfigurationType="2"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\include"
+				PreprocessorDefinitions="_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);_DEBUG;DEBUG;_LIB;$(ARCHFAM);$(_ARCHFAM_);MOZCE_STATIC_BUILD;MOZCE_SHUNT_EXPORTS"
+				MinimalRebuild="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="1"
+				BufferSecurityCheck="false"
+				EnableFunctionLevelLinking="true"
+				TreatWChar_tAsBuiltInType="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG;_UNICODE;UNICODE;_WIN32_WCE;UNDER_CE"
+				Culture="1033"
+				AdditionalIncludeDirectories="$(IntDir)"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalOptions=" /SUBSYSTEM:WINDOWSCE,5.01 /MACHINE:THUMB"
+				OutputFile="$(OutDir)\mozce_shunt.dll"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
+			OutputDirectory="Windows Mobile 5.0 Smartphone SDK (ARMV4I)\$(ConfigurationName)"
+			IntermediateDirectory="Windows Mobile 5.0 Smartphone SDK (ARMV4I)\$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\include"
+				PreprocessorDefinitions="_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);_DEBUG;DEBUG;_LIB;$(ARCHFAM);$(_ARCHFAM_);MOZCE_STATIC_BUILD;MOZCE_SHUNT_EXPORTS"
+				MinimalRebuild="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="1"
+				BufferSecurityCheck="false"
+				EnableFunctionLevelLinking="true"
+				TreatWChar_tAsBuiltInType="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG;_UNICODE;UNICODE;_WIN32_WCE;UNDER_CE"
+				Culture="1033"
+				AdditionalIncludeDirectories="$(IntDir)"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalOptions=" /SUBSYSTEM:WINDOWSCE,5.01 /MACHINE:THUMB"
+				OutputFile="$(OutDir)\mozce_shunt.dll"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|Windows Mobile 6 Professional SDK (ARMV4I)"
+			OutputDirectory="Windows Mobile 6 Professional SDK (ARMV4I)\$(ConfigurationName)"
+			IntermediateDirectory="Windows Mobile 6 Professional SDK (ARMV4I)\$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\include"
+				PreprocessorDefinitions="_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);_DEBUG;DEBUG;_LIB;$(ARCHFAM);$(_ARCHFAM_);MOZCE_SHUNT_EXPORTS;DEBUG_NSPR_ALL;TIMELINE;API_LOGGING;WINCE_MEMORY_CHECKPOINTING;SHUNT_LOG_ENABLED"
+				MinimalRebuild="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="1"
+				BufferSecurityCheck="false"
+				EnableFunctionLevelLinking="true"
+				TreatWChar_tAsBuiltInType="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+				CompileAs="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG;_UNICODE;UNICODE;_WIN32_WCE;UNDER_CE"
+				Culture="1033"
+				AdditionalIncludeDirectories="$(IntDir)"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalOptions=" /SUBSYSTEM:WINDOWSCE,5.02"
+				OutputFile="$(OutDir)\mozce_shunt.dll"
+				GenerateDebugInformation="true"
+				ImportLibrary="$(OutDir)\mozce_shunt.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine="copy &quot;$(TargetDir)$(TargetName).dll&quot; &quot;$(ProjectDir)&quot;&#x0D;&#x0A;copy &quot;$(TargetDir)$(TargetName).lib&quot; &quot;$(ProjectDir)&quot;&#x0D;&#x0A;"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory="\"
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|Windows Mobile 6 Standard SDK (ARMV4I)"
+			OutputDirectory="Windows Mobile 6 Standard SDK (ARMV4I)\$(ConfigurationName)"
+			IntermediateDirectory="Windows Mobile 6 Standard SDK (ARMV4I)\$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\include"
+				PreprocessorDefinitions="_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);_DEBUG;DEBUG;_LIB;$(ARCHFAM);$(_ARCHFAM_);MOZCE_SHUNT_EXPORTS;DEBUG_NSPR_ALL;TIMELINE;API_LOGGING;WINCE_MEMORY_CHECKPOINTING;SHUNT_LOG_ENABLED"
+				MinimalRebuild="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="1"
+				BufferSecurityCheck="false"
+				EnableFunctionLevelLinking="true"
+				TreatWChar_tAsBuiltInType="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+				CompileAs="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG;_UNICODE;UNICODE;_WIN32_WCE;UNDER_CE"
+				Culture="1033"
+				AdditionalIncludeDirectories="$(IntDir)"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalOptions=" /SUBSYSTEM:WINDOWSCE,5.02"
+				OutputFile="$(OutDir)\mozce_shunt.dll"
+				GenerateDebugInformation="true"
+				ImportLibrary="$(OutDir)\mozce_shunt.lib"
+				TargetMachine="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+				AuthenticodeSignature="false"
+				ProvisionDevice="0"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine="copy &quot;$(TargetDir)$(TargetName).dll&quot; &quot;$(ProjectDir)&quot;&#x0D;&#x0A;copy &quot;$(TargetDir)$(TargetName).lib&quot; &quot;$(ProjectDir)&quot;&#x0D;&#x0A;"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory="\"
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Pocket PC 2003 (ARMV4)"
+			OutputDirectory="Pocket PC 2003 (ARMV4)\$(ConfigurationName)"
+			IntermediateDirectory="Pocket PC 2003 (ARMV4)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				Optimization="2"
+				AdditionalIncludeDirectories="..\..\include"
+				PreprocessorDefinitions="_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);NDEBUG;_LIB;$(ARCHFAM);$(_ARCHFAM_);MOZCE_STATIC_BUILD;MOZCE_SHUNT_EXPORTS"
+				ExceptionHandling="1"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				EnableFunctionLevelLinking="true"
+				FloatingPointModel="2"
+				TreatWChar_tAsBuiltInType="false"
+				RuntimeTypeInfo="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+				CompileForArchitecture="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG;_UNICODE;UNICODE;_WIN32_WCE;UNDER_CE"
+				Culture="1033"
+				AdditionalIncludeDirectories="$(IntDir)"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				AdditionalOptions=" /subsystem:windowsce,5.01 /machine:THUMB"
+				OutputFile="$(InputDir)/shunt.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Smartphone 2003 (ARMV4)"
+			OutputDirectory="Smartphone 2003 (ARMV4)\$(ConfigurationName)"
+			IntermediateDirectory="Smartphone 2003 (ARMV4)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				Optimization="2"
+				AdditionalIncludeDirectories="..\..\include"
+				PreprocessorDefinitions="_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);NDEBUG;_LIB;$(ARCHFAM);$(_ARCHFAM_);MOZCE_STATIC_BUILD;MOZCE_SHUNT_EXPORTS"
+				ExceptionHandling="1"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				EnableFunctionLevelLinking="true"
+				FloatingPointModel="2"
+				TreatWChar_tAsBuiltInType="false"
+				RuntimeTypeInfo="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+				CompileForArchitecture="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG;_UNICODE;UNICODE;_WIN32_WCE;UNDER_CE"
+				Culture="1033"
+				AdditionalIncludeDirectories="$(IntDir)"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				AdditionalOptions=" /subsystem:windowsce,5.01 /machine:THUMB"
+				OutputFile="$(InputDir)/shunt.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+			OutputDirectory="$(PlatformName)\Release"
+			IntermediateDirectory="$(PlatformName)\Release"
+			ConfigurationType="2"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				Optimization="2"
+				AdditionalIncludeDirectories="..\..\include"
+				PreprocessorDefinitions="_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);NDEBUG;_LIB;$(ARCHFAM);$(_ARCHFAM_);MOZCE_STATIC_BUILD;MOZCE_SHUNT_EXPORTS"
+				ExceptionHandling="0"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				TreatWChar_tAsBuiltInType="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG;_UNICODE;UNICODE;_WIN32_WCE;UNDER_CE"
+				Culture="1033"
+				AdditionalIncludeDirectories="$(IntDir)"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalOptions=" /SUBSYSTEM:WINDOWSCE,5.01 /MACHINE:THUMB"
+				OutputFile="$(OutDir)\mozce_shunt.dll"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
+			OutputDirectory="Windows Mobile 5.0 Smartphone SDK (ARMV4I)\$(ConfigurationName)"
+			IntermediateDirectory="Windows Mobile 5.0 Smartphone SDK (ARMV4I)\$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				Optimization="2"
+				AdditionalIncludeDirectories="..\..\include"
+				PreprocessorDefinitions="_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);NDEBUG;_LIB;$(ARCHFAM);$(_ARCHFAM_);MOZCE_STATIC_BUILD;MOZCE_SHUNT_EXPORTS"
+				ExceptionHandling="0"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				TreatWChar_tAsBuiltInType="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG;_UNICODE;UNICODE;_WIN32_WCE;UNDER_CE"
+				Culture="1033"
+				AdditionalIncludeDirectories="$(IntDir)"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalOptions=" /SUBSYSTEM:WINDOWSCE,5.01 /MACHINE:THUMB"
+				OutputFile="$(OutDir)\mozce_shunt.dll"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Windows Mobile 6 Professional SDK (ARMV4I)"
+			OutputDirectory="Windows Mobile 6 Professional SDK (ARMV4I)\$(ConfigurationName)"
+			IntermediateDirectory="Windows Mobile 6 Professional SDK (ARMV4I)\$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				Optimization="2"
+				AdditionalIncludeDirectories="..\..\include"
+				PreprocessorDefinitions="_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);NDEBUG;_LIB;$(ARCHFAM);$(_ARCHFAM_);MOZCE_SHUNT_EXPORTS"
+				ExceptionHandling="1"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				EnableFunctionLevelLinking="true"
+				FloatingPointModel="2"
+				TreatWChar_tAsBuiltInType="false"
+				RuntimeTypeInfo="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+				CompileAs="0"
+				CompileForArchitecture="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG;_UNICODE;UNICODE;_WIN32_WCE;UNDER_CE"
+				Culture="1033"
+				AdditionalIncludeDirectories="$(IntDir)"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalOptions=" /SUBSYSTEM:WINDOWSCE,5.02"
+				OutputFile="$(OutDir)\mozce_shunt.dll"
+				ImportLibrary="$(OutDir)\mozce_shunt.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine="copy &quot;$(TargetDir)$(TargetName).dll&quot; &quot;$(ProjectDir)&quot;&#x0D;&#x0A;copy &quot;$(TargetDir)$(TargetName).lib&quot; &quot;$(ProjectDir)&quot;&#x0D;&#x0A;"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Windows Mobile 6 Standard SDK (ARMV4I)"
+			OutputDirectory="Windows Mobile 6 Standard SDK (ARMV4I)\$(ConfigurationName)"
+			IntermediateDirectory="Windows Mobile 6 Standard SDK (ARMV4I)\$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				Optimization="2"
+				AdditionalIncludeDirectories="..\..\include"
+				PreprocessorDefinitions="_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);NDEBUG;_LIB;$(ARCHFAM);$(_ARCHFAM_);MOZCE_SHUNT_EXPORTS"
+				ExceptionHandling="1"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				EnableFunctionLevelLinking="true"
+				FloatingPointModel="2"
+				TreatWChar_tAsBuiltInType="false"
+				RuntimeTypeInfo="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+				CompileAs="0"
+				CompileForArchitecture="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG;_UNICODE;UNICODE;_WIN32_WCE;UNDER_CE"
+				Culture="1033"
+				AdditionalIncludeDirectories="$(IntDir)"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalOptions=" /SUBSYSTEM:WINDOWSCE,5.02"
+				OutputFile="$(OutDir)\mozce_shunt.dll"
+				ImportLibrary="$(OutDir)\mozce_shunt.lib"
+				TargetMachine="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine="copy &quot;$(TargetDir)$(TargetName).dll&quot; &quot;$(ProjectDir)&quot;&#x0D;&#x0A;copy &quot;$(TargetDir)$(TargetName).lib&quot; &quot;$(ProjectDir)&quot;&#x0D;&#x0A;"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\a2w.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\assert.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\clipboard.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\direct.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\errno.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\io.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\map.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\mbstring.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\mozce_dbg.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\nclog.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\process.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\signal.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\stat.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\stdio.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\stdlib.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\string.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\time.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\w2a.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\win32.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\win32A.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\win32W.cpp"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath="..\..\include\crtdbg.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\include\ddeml.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\include\direct.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\include\dlgs.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\include\errno.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\include\fcntl.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\include\intshcut.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\include\io.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\include\map.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\include\mbstring.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\include\mozce_defs.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\mozce_internal.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\include\mozce_shunt.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\include\new.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\include\process.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\include\rasdlg.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\include\signal.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\include\time_conversions.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\include\unistd.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\include\varargs.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\include\winresrc.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\include\winsock2.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\include\winspool.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\include\winsvc.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\include\zmouse.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
--- a/build/wince/shunt/include/mozce_defs.h
+++ b/build/wince/shunt/include/mozce_defs.h
@@ -97,26 +97,28 @@
 #define EACCES          13
 #define EFAULT          14
 #define EBUSY           16
 #define EEXIST          17
 #define EXDEV           18
 #define ENODEV          19
 #define ENOTDIR         20
 #define EISDIR          21
+#define EINVAL          22
 #define ENFILE          23
 #define EMFILE          24
 #define ENOTTY          25
 #define EFBIG           27
 #define ENOSPC          28
 #define ESPIPE          29
 #define EROFS           30
 #define EMLINK          31
 #define EPIPE           32
 #define EDOM            33
+#define ERANGE          34
 #define EDEADLK         36
 #ifndef ENAMETOOLONG
 #define ENAMETOOLONG    38
 #endif
 #define ENOLCK          39
 #define ENOSYS          40
 #ifndef ENOTEMPTY
 #define ENOTEMPTY       41
@@ -160,16 +162,19 @@
 // From stdlib.h
 #define _MAX_PATH       MAX_PATH
 
 // From sys/types.h
 typedef int ptrdiff_t;
 typedef long _off_t;
 typedef long off_t;
 
+// Not defined anywhere
+typedef INT_PTR intptr_t; 
+
 // From sys/stat.h
 #if !defined(_STAT_DEFINED)
 #define _STAT_DEFINED
 #define _S_IFDIR    0040000 /* stat, is a directory */
 #define _S_IFREG    0100000 /* stat, is a normal file */
 #define _S_IREAD    0000400 /* stat, can read */
 #define _S_IWRITE   0000200 /* stat, can write */
 #define	_S_IEXEC	0000100
--- a/build/wince/shunt/include/mozce_shunt.h
+++ b/build/wince/shunt/include/mozce_shunt.h
@@ -56,16 +56,17 @@
 #ifndef MOZCE_SHUNT_EXPORTS
 
 #define _mkdir		mkdir
 #define _rmdir		rmdir
 #define _chmod		chmod
 #define _isatty		isatty
 #undef fileno
 #define fileno      (int)_fileno
+#define fstat       (int)_fstat
 #define _mbctolower tolower
 #define _mbsicmp    mbsicmp
 #define _mbsdec     mbsdec
 #define _getpid		getpid
 #define _access		access
 #define	_fdopen		fdopen
 #define _getcwd     getcwd
 #define _open open
@@ -123,16 +124,21 @@
 #define CallWindowProcA            CallWindowProcW
 #define GetWindowLongA             GetWindowLongW
 #define SetWindowLongA             SetWindowLongW
 #define GetMonitorInfoW           GetMonitorInfo
 
 #undef  GetProcAddress
 #define GetProcAddress            GetProcAddressA
 
+#define SHELLEXECUTEINFOW         SHELLEXECUTEINFO
+#define ShellExecuteExW(x)        ShellExecuteEx(x)
+
+#define MapVirtualKeyEx(a,b,c)    MapVirtualKey(a,b)
+
 
 //still need these
 #define GetCurrentDirectory       GetCurrentDirectoryW
 #define OpenSemaphore             OpenSemaphoreW
 #define SetCurrentDirectoryW      SetCurrentDirectoryW
 
 #endif // MOZCE_SHUNT_EXPORTS
 
new file mode 100644
--- /dev/null
+++ b/build/wince/shunt/mozce_dbg.c
@@ -0,0 +1,81 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * ***** 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 CE Shunt Library.
+ *
+ * The Initial Developer of the Original Code is Mozilla Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   John Wolfe, 21-July-2008
+ *
+ * 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 ***** */
+
+#include "mozce_internal.h"
+
+#include <stdarg.h>
+
+
+#ifndef SHUNT_LOG_ENABLED
+
+void mozce_DebugInit() { };
+void mozce_DebugDeinit() { };
+void mozce_DebugWriteToLog(char *str) { };
+
+#else
+
+#define LOGFILE     "\\Storage Card\\shuntlog.txt"
+
+FILE *gpDebugFile = NULL;
+
+void mozce_DebugInit()
+{
+    if ( NULL == gpDebugFile )
+        gpDebugFile = fopen(LOGFILE, "a+");
+}
+
+void mozce_DebugDeinit()
+{
+    if ( gpDebugFile ) {
+        fclose( gpDebugFile );
+        gpDebugFile = NULL;
+    }
+}
+
+void mozce_DebugWriteToLog(char *str)
+{
+    if ( NULL == gpDebugFile )
+        mozce_DebugInit();
+
+    if ( gpDebugFile ) {
+        fprintf(gpDebugFile, "%s", str);
+        fflush(gpDebugFile);
+    }
+}
+
+#endif
--- a/build/wince/tools/Makefile
+++ b/build/wince/tools/Makefile
@@ -1,19 +1,99 @@
-all:
-	cl vs8ppc2003arm/arm-wince-as.c
-	mv arm-wince-as.exe vs8ppc2003arm
-	cl vs8ppc2003arm/arm-wince-gcc.c
-	mv arm-wince-gcc.exe vs8ppc2003arm
-	cl vs8ppc2003arm/arm-wince-lib.c
-	mv arm-wince-lib.exe vs8ppc2003arm
-	cl vs8ppc2003arm/arm-wince-link.c
-	mv arm-wince-link.exe vs8ppc2003arm
-	rm -f *.obj
-	devenv ../shunt/build/vs8/mozce_shunt_static.sln -Rebuild "Release|Windows Mobile 6 Standard SDK (ARMV4I)"
+#
+# ***** 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 CE Shunt Library.
+#
+# The Initial Developer of the Original Code is Mozilla Corporation.
+# Portions created by the Initial Developer are Copyright (C) 2008
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#	John Wolfe (wolfe@lobo.us)
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either of 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 *****
+
+DEVENV_FLAG=-
+
+CC=cl
+
+MOZCE_DEVENV=vs$(MOZ_MSVCVERSION)
+
+MOZCE_SHUNT_SLN=../shunt/build/$(MOZCE_DEVENV)/mozce_shunt_static.sln
+MOZCE_PROJECT="Release|Windows Mobile 6 Standard SDK (ARMV4I)"
+MOZCE_SHUNT_DLL=../shunt/build/$(MOZCE_DEVENV)/mozce_shunt.dll
+MOZCE_TOOLS_DIR=$(MOZCE_DEVENV)ppc2003arm
+
+BUILD_SWITCH=$(DEVENV_FLAG)Build
+REBUILD_SWITCH=$(DEVENV_FLAG)Rebuild
+CLEAN_SWITCH=$(DEVENV_FLAG)clean
+
+
+all: output_some_env \
+	 $(MOZCE_TOOLS_DIR)/arm-wince-as.exe \
+	 $(MOZCE_TOOLS_DIR)/arm-wince-gcc.exe \
+	 $(MOZCE_TOOLS_DIR)/arm-wince-lib.exe \
+	 $(MOZCE_TOOLS_DIR)/arm-wince-link.exe \
+	 $(MOZCE_TOOLS_DIR)/arm-wince-res.exe 
+	devenv $(MOZCE_SHUNT_SLN) $(BUILD_SWITCH) $(MOZCE_PROJECT)
 
 clobber:
-	rm -f vs8ppc2003arm/*.exe
-	rm -f vs8ppc2003arm/*.obj
+	rm -f $(MOZCE_TOOLS_DIR)/*.exe
+	rm -f $(MOZCE_TOOLS_DIR)/*.obj
 	rm -f *.obj
 	rm -f *.exe
-	devenv ../shunt/build/vs8/mozce_shunt_static.sln -clean "Release|Windows Mobile 6 Standard SDK (ARMV4I)"
+	rm -rf bin
+	devenv $(MOZCE_SHUNT_SLN) $(CLEAN_SWITCH) $(MOZCE_PROJECT)
+
+output_some_env:
+	@echo FOUND $(MOZCE_DEVENV)
+	@echo FOUND $(MOZCE_DEVENV): VSINSTALLDIR=$(VSINSTALLDIR) / MINGW32=$(MINGW32) / MSYSTEM=$(MSYSTEM)
+	@echo FOUND $(MOZCE_DEVENV)
+
+$(MOZCE_TOOLS_DIR)/arm-wince-as.exe:	$(MOZCE_TOOLS_DIR)/arm-wince-as.c
+	$(CC) $(MOZCE_TOOLS_DIR)/arm-wince-as.c
+	mkdir -p bin;
+	cp arm-wince-as.exe bin; mv arm-wince-as.exe $(MOZCE_TOOLS_DIR); rm *.obj
 
+$(MOZCE_TOOLS_DIR)/arm-wince-gcc.exe:	$(MOZCE_TOOLS_DIR)/arm-wince-gcc.c
+	$(CC) $(MOZCE_TOOLS_DIR)/arm-wince-gcc.c
+	mkdir -p bin;
+	cp arm-wince-gcc.exe bin; mv arm-wince-gcc.exe $(MOZCE_TOOLS_DIR); rm *.obj
+
+$(MOZCE_TOOLS_DIR)/arm-wince-lib.exe:	$(MOZCE_TOOLS_DIR)/arm-wince-lib.c
+	$(CC) $(MOZCE_TOOLS_DIR)/arm-wince-lib.c
+	mkdir -p bin;
+	cp arm-wince-lib.exe bin; mv arm-wince-lib.exe $(MOZCE_TOOLS_DIR); rm *.obj
+
+$(MOZCE_TOOLS_DIR)/arm-wince-link.exe:	$(MOZCE_TOOLS_DIR)/arm-wince-link.c
+	$(CC) $(MOZCE_TOOLS_DIR)/arm-wince-link.c
+	mkdir -p bin;
+	cp arm-wince-link.exe bin; mv arm-wince-link.exe $(MOZCE_TOOLS_DIR); rm *.obj
+
+$(MOZCE_TOOLS_DIR)/arm-wince-res.exe:	$(MOZCE_TOOLS_DIR)/arm-wince-res.c
+	$(CC) $(MOZCE_TOOLS_DIR)/arm-wince-res.c
+	mkdir -p bin;
+	cp arm-wince-res.exe bin; mv arm-wince-res.exe $(MOZCE_TOOLS_DIR); rm *.obj
+
new file mode 100644
--- /dev/null
+++ b/build/wince/tools/vs8ppc2003arm/arm-wince-res.c
@@ -0,0 +1,19 @@
+#include "toolspath.h"
+
+int
+main(int argc, char **argv)
+{
+  int iRetVal;
+  char* args[1000];
+  int i = 0;
+  int j = 0;
+  int k = 0;
+  int s = 0;
+  args[i++] = RC_PATH;
+
+  argpath_conv(&argv[1], &args[i]);
+
+  dumpargs(args);
+
+  return run(args);
+}
--- a/build/wince/tools/vs8ppc2003arm/toolspath.h
+++ b/build/wince/tools/vs8ppc2003arm/toolspath.h
@@ -1,163 +1,276 @@
-#include <windows.h>
-#include <stdio.h>
-#include <process.h>
-
-#ifndef TOPSRCDIR
-#include "../topsrcdir.h"
-#endif
-
-#define WCE_BIN   "c:\\Program Files\\Microsoft Visual Studio 8\\VC\\ce\\bin\\x86_arm\\"
-#define WCE_CRT   "c:\\Program Files\\Microsoft Visual Studio 8\\VC/ce\\lib\\armv4i"
-#define WCE_INC   "C:\\Program Files\\Windows Mobile 6 SDK\\Smartphone\\Include\\Armv4i"
-#define WCE_LIB   "C:\\Program Files\\Windows Mobile 6 SDK\\Smartphone\\Lib\\Armv4i"
-
-#define SHUNT_LIB TOPSRCDIR "/build/wince/shunt/build/vs8/"
-#define SHUNT_INC TOPSRCDIR "/build/wince/shunt/include/"
-
-#define ASM_PATH  WCE_BIN "armasm.exe"
-#define CL_PATH   WCE_BIN "cl.exe"
-#define LIB_PATH  WCE_BIN "lib.exe"
-#define LINK_PATH WCE_BIN "link.exe"
-
-#define MAX_NOLEAK_BUFFERS 100
-char noleak_buffers[MAX_NOLEAK_BUFFERS][1024];
-static int next_buffer = 0;
-
-int argpath_conv(char **args_in, char **args_out)
-{
- int i = 0;
-
- while (args_in[i])
- {
-   args_out[i] = args_in[i];
-
-   if (args_in[i])
-   {
-     char *offset = strstr(args_out[i], "/cygdrive/");
-
-     if (offset) {
-
-       strcpy(offset, offset+9);
-       offset[0] = offset[1];
-       offset[1] = ':';
-       offset[2] = '/';
-     }
-
-     if ( (args_out[i][0] == '-' || args_out[i][0] == '/') &&
-          (args_out[i][1] == 'D'))
-     {
-
-       offset = strstr(args_out[i]+2, "=");
-       if (offset)
-       {
-         char* equalsChar = offset;
-
-         if (equalsChar[1] == '"')
-         {
-           *equalsChar = '\0';
-
-           strcpy(noleak_buffers[next_buffer], args_out[i]);
-
-           *equalsChar = '=';
-
-           strcat(noleak_buffers[next_buffer], "=\\\"");
-           strcat(noleak_buffers[next_buffer], equalsChar+1);
-           strcat(noleak_buffers[next_buffer], "\\\"");
-
-           args_out[i] = noleak_buffers[next_buffer];
-
-           next_buffer++;
-
-           if (next_buffer > MAX_NOLEAK_BUFFERS) {
-             printf("next_buffer>MAX_NOLEAK_BUFFERS\n");
-             exit(-1);
-           }
-         }
-       }
-     }
-   }
-   i++;
- }
- args_out[i] = NULL;
- return i;
-}
-
-void dumpargs(char** args)
-{
- int i = 0;
-
- if (args[0] == NULL)
-   printf(":: first element is null!\n");
-
- while(args[i])
-   printf("%s ", args[i++]);
-
- printf("\n");
- fflush(stdout);
- fflush(stderr);
-}
-
-
-DWORD run(char** args)
-{
-
- DWORD exitCode;
- STARTUPINFO si;
- PROCESS_INFORMATION pi;
-
- char theArgs[1024*16];
-
- int totalLen = 0;
- int i, j;
-
-
- // Clear any link env variable that might get us tangled up
- _putenv("LINK=");
- _putenv("LIBPATH=");
- _putenv("CC=");
-
- _putenv("INCLUDE=" WCE_INC);
- _putenv("LIB=" WCE_LIB);
-
- for (j=1; args[j]; j++)
- {
-   int len = strlen(args[j]);
-   strcat(&theArgs[totalLen], args[j]);
-   totalLen += len;
-
-   strcat(&theArgs[totalLen], " ");
-   totalLen++;
- }
-
- i = strlen(args[0]);
- for (j=0; j<i; j++)
- {
-   if (args[0][j] == '/')
-     args[0][j] = '\\';
- }
-
- ZeroMemory( &si, sizeof(si) );
- si.cb = sizeof(si);
- ZeroMemory( &pi, sizeof(pi));
-
- CreateProcess(args[0],
-               theArgs,
-               NULL,
-               NULL,
-               0,
-               0,
-               NULL,
-               NULL,
-               &si,              // Pointer to STARTUPINFO structure.
-               &pi);
-
-
- // Wait until child process exits.
- WaitForSingleObject( pi.hProcess, INFINITE );
- GetExitCodeProcess(pi.hProcess, &exitCode);
- // Close process and thread handles.
- CloseHandle( pi.hProcess );
- CloseHandle( pi.hThread );
-
- return exitCode;
-}
+#include <windows.h>
+#include <stdio.h>
+#include <process.h>
+
+#ifndef TOPSRCDIR
+#include "../topsrcdir.h"
+#endif
+
+#define WCE_BIN   "c:\\Program Files\\Microsoft Visual Studio 8\\VC\\ce\\bin\\x86_arm\\"
+#define WCE_RC_BIN "C:\\Program Files\\Microsoft SDKs\\Windows\\v6.0a\\bin\\"
+#define WCE_CRT   "c:\\Program Files\\Microsoft Visual Studio 8\\VC/ce\\lib\\armv4i"
+#define WCE_INC   "C:\\Program Files\\Windows Mobile 6 SDK\\Smartphone\\Include\\Armv4i"
+#define WCE_LIB   "C:\\Program Files\\Windows Mobile 6 SDK\\Smartphone\\Lib\\Armv4i"
+
+#define SHUNT_LIB TOPSRCDIR "/build/wince/shunt/build/vs8/"
+#define SHUNT_INC TOPSRCDIR "/build/wince/shunt/include/"
+
+#define ASM_PATH  WCE_BIN "armasm.exe"
+#define CL_PATH   WCE_BIN "cl.exe"
+#define LIB_PATH  WCE_BIN "lib.exe"
+#define LINK_PATH WCE_BIN "link.exe"
+#define RC_PATH   WCE_RC_BIN "rc.exe"
+
+#define MAX_NOLEAK_BUFFERS 100
+char noleak_buffers[MAX_NOLEAK_BUFFERS][1024];
+static int next_buffer = 0;
+
+int argpath_conv(char **args_in, char **args_out)
+{
+  int i = 0;
+
+  while (args_in[i])
+  {
+    char *offset;
+
+    args_out[i] = args_in[i];
+
+    if (args_in[i])
+    {
+      // First, look for the case of "-Fo/c/xxxxxxx" and "/Fo/c/xxxxx"
+      if ( (args_out[i][0] == '-' || args_out[i][0] == '/') &&
+           (args_out[i][1] == 'F') && (args_out[i][2] == 'o') &&
+           (args_out[i][3] == '/') && (strlen(args_out[i]) > 5) ) {
+
+        //printf("ARGS_IN: -FoXXXX is %s\n",args_in[i]);
+
+        strcpy(noleak_buffers[next_buffer], args_in[i]);
+
+        noleak_buffers[next_buffer][0] = '/';
+        noleak_buffers[next_buffer][3] = noleak_buffers[next_buffer][4];
+        noleak_buffers[next_buffer][4] = ':';
+
+        args_out[i] = noleak_buffers[next_buffer];
+
+        //printf("ARGS_OUT: -FoXXXX is %s\n",args_out[i]);
+
+        next_buffer++;
+      }
+      else if ((args_out[i][0] == '/') && (args_out[i][2] == '/'))
+      {
+        // Assume this is a pathname, and adjust accordingly
+        //printf("ARGS_IN: PATHNAME ASSUMED: %s\n", args_in[i]);
+
+        strcpy(noleak_buffers[next_buffer], args_in[i]);
+
+        noleak_buffers[next_buffer][0] = noleak_buffers[next_buffer][1];
+        noleak_buffers[next_buffer][1] = ':';
+
+        args_out[i] = noleak_buffers[next_buffer];
+        //printf("ARGS_OUT: PATHNAME MODIFIED TO BE: %s\n", args_out[i]);
+
+        next_buffer++;
+      }
+      else if ((args_out[i][0] == '\\') && (args_out[i][2] == '\\'))
+      {
+        // Assume this is a pathname, and adjust accordingly
+        //printf("ARGS_IN: PATHNAME ASSUMED: %s\n", args_in[i]);
+
+        strcpy(noleak_buffers[next_buffer], args_in[i]);
+
+        noleak_buffers[next_buffer][0] = noleak_buffers[next_buffer][1];
+        noleak_buffers[next_buffer][1] = ':';
+
+        args_out[i] = noleak_buffers[next_buffer];
+        //printf("ARGS_OUT: PATHNAME MODIFIED TO BE: %s\n", args_out[i]);
+
+        next_buffer++;
+      }
+      else if ((args_out[i][0] == '\\') && (args_out[i][1] == '\\') &&
+               (args_out[i][3] == '\\') && (args_out[i][4] == '\\'))
+      {
+        // Assume this is a pathname, and adjust accordingly
+        //printf("ARGS_IN: PATHNAME ASSUMED: %s\n", args_in[i]);
+
+        noleak_buffers[next_buffer][0] = args_in[i][2];
+        noleak_buffers[next_buffer][1] = ':';
+        noleak_buffers[next_buffer][2] = '\0';
+
+        strcpy(noleak_buffers[next_buffer], &args_in[i][3]);
+
+        args_out[i] = noleak_buffers[next_buffer];
+        //printf("ARGS_OUT: PATHNAME MODIFIED TO BE: %s\n", args_out[i]);
+
+        next_buffer++;
+      }
+      else if ( strstr(args_out[i], "OUT:") || strstr(args_out[i], "DEF:") )
+      {
+        // Deal with -OUT:/c/....
+        //
+        // NOTE: THERE IS A BUG IN THIS IMPLEMENTATION IF 
+        //       THERE IS A SPACE IN THE TOPSRCDIR PATH.
+        //
+        // Should really check for spaces, then double-quote
+        // the path if any space is found.
+        // -- wolfe@lobo.us  25-Aug-08
+        if ((args_out[i][5] == '/') && (args_out[i][7] == '/'))
+        {
+          // Assume this is a pathname, and adjust accordingly
+          //printf("ARGS_IN: PATHNAME ASSUMED: %s\n", args_in[i]);
+
+          strcpy(noleak_buffers[next_buffer], args_in[i]);
+
+          noleak_buffers[next_buffer][5] = noleak_buffers[next_buffer][6];
+          noleak_buffers[next_buffer][6] = ':';
+
+          args_out[i] = noleak_buffers[next_buffer];
+          //printf("ARGS_OUT: PATHNAME MODIFIED TO BE: %s\n", args_out[i]);
+        }
+        // Deal with -OUT:"/c/...."
+        else if ((args_out[i][6] == '/') && (args_out[i][8] == '/'))
+        {
+          // Assume this is a pathname, and adjust accordingly
+          //printf("ARGS_IN: PATHNAME ASSUMED: %s\n", args_in[i]);
+
+          strcpy(noleak_buffers[next_buffer], args_in[i]);
+
+          noleak_buffers[next_buffer][6] = noleak_buffers[next_buffer][7];
+          noleak_buffers[next_buffer][7] = ':';
+
+          args_out[i] = noleak_buffers[next_buffer];
+          //printf("ARGS_OUT: PATHNAME MODIFIED TO BE: %s\n", args_out[i]);
+        }
+
+        next_buffer++;
+      }
+      else
+      {
+        char *offset = strstr(args_out[i], "/cygdrive/");
+
+        if (offset) {
+
+          strcpy(offset, offset+9);
+          offset[0] = offset[1];
+          offset[1] = ':';
+          offset[2] = '/';
+        }
+
+        if ( (args_out[i][0] == '-' || args_out[i][0] == '/') &&
+             (args_out[i][1] == 'D'))
+        {
+
+          offset = strstr(args_out[i]+2, "=");
+          if (offset)
+          {
+            char* equalsChar = offset;
+
+            if (equalsChar[1] == '"')
+            {
+              *equalsChar = '\0';
+
+              strcpy(noleak_buffers[next_buffer], args_out[i]);
+
+              *equalsChar = '=';
+
+              strcat(noleak_buffers[next_buffer], "=\\\"");
+              strcat(noleak_buffers[next_buffer], equalsChar+1);
+              strcat(noleak_buffers[next_buffer], "\\\"");
+
+              args_out[i] = noleak_buffers[next_buffer];
+
+              next_buffer++;
+            }
+          }
+        }
+      }
+
+      if (next_buffer > MAX_NOLEAK_BUFFERS) {
+        printf("OOPS - next_buffer > MAX_NOLEAK_BUFFERS\n");
+        exit(-1);
+      }
+    }
+    i++;
+  }
+  args_out[i] = NULL;
+  return i;
+}
+
+void dumpargs(char** args)
+{
+ int i = 0;
+
+ if (args[0] == NULL)
+   printf(":: first element is null!\n");
+
+ while(args[i])
+   printf("%s ", args[i++]);
+
+ printf("\n");
+ fflush(stdout);
+ fflush(stderr);
+}
+
+
+DWORD run(char** args)
+{
+
+ DWORD exitCode;
+ STARTUPINFO si;
+ PROCESS_INFORMATION pi;
+
+ char theArgs[1024*16];
+
+ int totalLen = 0;
+ int i, j;
+
+
+ // Clear any link env variable that might get us tangled up
+ _putenv("LINK=");
+ _putenv("LIBPATH=");
+ _putenv("CC=");
+
+ _putenv("INCLUDE=" WCE_INC);
+ _putenv("LIB=" WCE_LIB);
+
+ for (j=1; args[j]; j++)
+ {
+   int len = strlen(args[j]);
+   strcat(&theArgs[totalLen], args[j]);
+   totalLen += len;
+
+   strcat(&theArgs[totalLen], " ");
+   totalLen++;
+ }
+
+ i = strlen(args[0]);
+ for (j=0; j<i; j++)
+ {
+   if (args[0][j] == '/')
+     args[0][j] = '\\';
+ }
+
+ ZeroMemory( &si, sizeof(si) );
+ si.cb = sizeof(si);
+ ZeroMemory( &pi, sizeof(pi));
+
+ CreateProcess(args[0],
+               theArgs,
+               NULL,
+               NULL,
+               0,
+               0,
+               NULL,
+               NULL,
+               &si,              // Pointer to STARTUPINFO structure.
+               &pi);
+
+
+ // Wait until child process exits.
+ WaitForSingleObject( pi.hProcess, INFINITE );
+ GetExitCodeProcess(pi.hProcess, &exitCode);
+ // Close process and thread handles.
+ CloseHandle( pi.hProcess );
+ CloseHandle( pi.hThread );
+
+ return exitCode;
+}
new file mode 100644
--- /dev/null
+++ b/build/wince/tools/vs9ppc2003arm/arm-wince-as.c
@@ -0,0 +1,17 @@
+#include "toolspath.h"
+
+int 
+main(int argc, char **argv)
+{  
+  char* args[1000];
+  int i = 0;
+  
+  args[i++] = ASM_PATH;
+  args[i++] = "-I\"" WCE_INC "\""; 
+
+  i += argpath_conv(&argv[1], &args[i]);
+
+  dumpargs(args);
+
+  return run(args);
+}
new file mode 100644
--- /dev/null
+++ b/build/wince/tools/vs9ppc2003arm/arm-wince-gcc.c
@@ -0,0 +1,92 @@
+#include "toolspath.h"
+
+int
+main(int argc, char **argv)
+{
+  int startOfArgvs;
+  int i = 0;
+  int j = 0;
+  int link = 0;
+
+  char* args[1000];
+  char  outputFileArg[1000];
+
+  args[i++] = CL_PATH;
+  args[i++] = "/I\"" WCE_INC "\"";
+  args[i++] = "/I\"" SHUNT_INC "\"";
+  args[i++] = "/FI\"mozce_shunt.h\"";
+
+  args[i++] = "/DMOZCE_STATIC_BUILD";
+  args[i++] = "/DUNICODE";
+  args[i++] = "/D_UNICODE_";
+  args[i++] = "/DARM";
+  args[i++] = "/D_ARM_";
+  args[i++] = "/DWINCE";
+  args[i++] = "/D_WIN32_WCE=0x502";
+  args[i++] = "/DUNDER_CE";
+  args[i++] = "/DWIN32_PLATFORM_WFSP";
+//  args[i++] = "/DWIN32_PLATFORM_PSPC";
+//  args[i++] = "/DPOCKETPC2003_UI_MODEL";
+  args[i++] = "/D_WINDOWS";
+
+  args[i++] = "/Zc:wchar_t-";          //
+  args[i++] = "/GS-";                  // disable security checks
+  args[i++] = "/GR-";                  // disable C++ RTTI
+  args[i++] = "/fp:fast";
+
+  startOfArgvs = i;
+
+  i += argpath_conv(&argv[1], &args[i]);
+
+  // if /Fe is passed, then link
+  //
+  // if -o is passed, then blank out this argument, and place a "/Fo"
+  // before the next argument
+  while(argv[j])
+    {
+      if (strncmp(argv[j], "-o", 2) == 0)
+	{
+	  printf("%s is -o\n",argv[j]);
+
+
+	  link = strstr(args[startOfArgvs+j], ".obj") ? 0:1;
+
+
+	  // If we are outputting a .OBJ file, then we are
+	  // NOT linking, and we need to do some fancy
+	  // footwork to output "/FoFILENAME" as an argument
+	  args[startOfArgvs+j-1] = "";
+	  strcpy(outputFileArg, ( strstr(args[startOfArgvs+j], ".exe") )?"/Fe":"/Fo");
+	  strcat(outputFileArg, args[startOfArgvs+j]);
+	  args[startOfArgvs+j] = outputFileArg;
+	}
+      j++;
+    }
+
+  if (link)
+    {
+      args[i++] = "/link";
+
+      args[i++] = "/ENTRY:main";
+
+      args[i++] = "/SUBSYSTEM:WINDOWSCE,5.02";
+
+      args[i++] = "/LIBPATH:\"" WCE_LIB "\"";
+      args[i++] = "/LIBPATH:\"" WCE_CRT "\"";
+      args[i++] = "/LIBPATH:\"" SHUNT_LIB "\"";
+      args[i++] = "mozce_shunt.lib";
+      args[i++] = "winsock.lib";
+      args[i++] = "corelibc.lib";
+      args[i++] = "coredll.lib";
+
+
+      args[i++] = "/NODEFAULTLIB:LIBC";
+      args[i++] = "/NODEFAULTLIB:OLDNAMES";
+
+    }
+
+  args[i] = NULL;
+
+  dumpargs(args);
+  return run(args);
+}
new file mode 100644
--- /dev/null
+++ b/build/wince/tools/vs9ppc2003arm/arm-wince-lib.c
@@ -0,0 +1,16 @@
+#include "toolspath.h"
+
+
+int 
+main(int argc, char **argv)
+{
+  char* args[1000];
+  int i = 0;
+
+  args[i++] = LIB_PATH;
+
+  argpath_conv(&argv[1], &args[i]);
+
+  return run(args);
+
+}
new file mode 100644
--- /dev/null
+++ b/build/wince/tools/vs9ppc2003arm/arm-wince-link.c
@@ -0,0 +1,62 @@
+#include "toolspath.h"
+
+int
+main(int argc, char **argv)
+{
+  int iRetVal;
+  char* args[1000];
+  int i = 0;
+  int j = 0;
+  int k = 0;
+  int s = 0;
+  args[i++] = LINK_PATH;
+
+  args[i++] = "/LIBPATH:\"" WCE_LIB "\"";
+  args[i++] = "/LIBPATH:\"" WCE_CRT "\"";
+  args[i++] = "/LIBPATH:\"" SHUNT_LIB "\"";
+
+  args[i++] = "winsock.lib";
+  args[i++] = "corelibc.lib";
+  args[i++] = "coredll.lib";
+  args[i++] = "ceshell.lib";
+  args[i++] = "ole32.lib";
+  args[i++] = "mmtimer.lib";
+  args[i++] = "mozce_shunt.lib";
+
+  args[i++] = "/NODEFAULTLIB:LIBC";
+  args[i++] = "/NODEFAULTLIB:OLDNAMES";
+
+  // if -DLL is not passed, then change the entry to 'main'
+  while(argv[j])
+    {
+	  if (strncmp(argv[j], "-DLL", 4) == 0 || strncmp(argv[j], "/DLL", 4) == 0)
+		{
+		  k = 1;
+
+		}
+	  if (strncmp(argv[j], "-entry", 6) == 0 || strncmp(argv[j], "/entry", 6) == 0 || strncmp(argv[j], "-ENTRY", 6) == 0 || strncmp(argv[j], "/ENTRY",6 ) == 0)
+		{
+		  k = 1;
+
+		}
+	  if (strncmp(argv[j], "-subsystem:", 11) == 0 || strncmp(argv[j], "/subsystem:", 11) == 0 || strncmp(argv[j], "-SUBSYSTEM:", 11) == 0 || strncmp(argv[j], "/SUBSYSTEM:", 11) == 0)
+		{
+		  s = 1;
+
+		}
+      j++;
+    }
+
+  if (k==0)
+    args[i++] = "/ENTRY:main";
+
+  if (s==0){
+    args[i++] = "/subsystem:\"WINDOWSCE,5.02\"";
+  }
+
+  argpath_conv(&argv[1], &args[i]);
+
+  dumpargs(args);
+
+  return run(args);
+}
new file mode 100644
--- /dev/null
+++ b/build/wince/tools/vs9ppc2003arm/arm-wince-res.c
@@ -0,0 +1,19 @@
+#include "toolspath.h"
+
+int
+main(int argc, char **argv)
+{
+  int iRetVal;
+  char* args[1000];
+  int i = 0;
+  int j = 0;
+  int k = 0;
+  int s = 0;
+  args[i++] = RC_PATH;
+
+  argpath_conv(&argv[1], &args[i]);
+
+  dumpargs(args);
+
+  return run(args);
+}
new file mode 100644
--- /dev/null
+++ b/build/wince/tools/vs9ppc2003arm/toolspath.h
@@ -0,0 +1,277 @@
+#include <windows.h>
+#include <stdio.h>
+#include <process.h>
+
+#ifndef TOPSRCDIR
+#include "../topsrcdir.h"
+#endif
+
+#define WCE_BIN    "c:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\ce\\bin\\x86_arm\\"
+#define WCE_RC_BIN "c:\\Program Files\\Microsoft SDKs\\Windows\\v6.0a\\bin\\"
+#define WCE_CRT    "c:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\ce\\lib\\armv4i"
+#define WCE_INC    "c:\\Program Files\\Windows Mobile 6 SDK\\Smartphone\\Include\\Armv4i"
+#define WCE_LIB    "c:\\Program Files\\Windows Mobile 6 SDK\\Smartphone\\Lib\\Armv4i"
+
+
+#define SHUNT_LIB TOPSRCDIR "/build/wince/shunt/build/vs9/"
+#define SHUNT_INC TOPSRCDIR "/build/wince/shunt/include/"
+
+#define ASM_PATH  WCE_BIN "armasm.exe"
+#define CL_PATH   WCE_BIN "cl.exe"
+#define LIB_PATH  WCE_BIN "lib.exe"
+#define LINK_PATH WCE_BIN "link.exe"
+#define RC_PATH   WCE_RC_BIN "rc.exe"
+
+#define MAX_NOLEAK_BUFFERS 100
+char noleak_buffers[MAX_NOLEAK_BUFFERS][1024];
+static int next_buffer = 0;
+
+int argpath_conv(char **args_in, char **args_out)
+{
+  int i = 0;
+
+  while (args_in[i])
+  {
+    char *offset;
+
+    args_out[i] = args_in[i];
+
+    if (args_in[i])
+    {
+      // First, look for the case of "-Fo/c/xxxxxxx" and "/Fo/c/xxxxx"
+      if ( (args_out[i][0] == '-' || args_out[i][0] == '/') &&
+           (args_out[i][1] == 'F') && (args_out[i][2] == 'o') &&
+           (args_out[i][3] == '/') && (strlen(args_out[i]) > 5) ) {
+
+        //printf("ARGS_IN: -FoXXXX is %s\n",args_in[i]);
+
+        strcpy(noleak_buffers[next_buffer], args_in[i]);
+
+        noleak_buffers[next_buffer][0] = '/';
+        noleak_buffers[next_buffer][3] = noleak_buffers[next_buffer][4];
+        noleak_buffers[next_buffer][4] = ':';
+
+        args_out[i] = noleak_buffers[next_buffer];
+
+        //printf("ARGS_OUT: -FoXXXX is %s\n",args_out[i]);
+
+        next_buffer++;
+      }
+      else if ((args_out[i][0] == '/') && (args_out[i][2] == '/'))
+      {
+        // Assume this is a pathname, and adjust accordingly
+        //printf("ARGS_IN: PATHNAME ASSUMED: %s\n", args_in[i]);
+
+        strcpy(noleak_buffers[next_buffer], args_in[i]);
+
+        noleak_buffers[next_buffer][0] = noleak_buffers[next_buffer][1];
+        noleak_buffers[next_buffer][1] = ':';
+
+        args_out[i] = noleak_buffers[next_buffer];
+        //printf("ARGS_OUT: PATHNAME MODIFIED TO BE: %s\n", args_out[i]);
+
+        next_buffer++;
+      }
+      else if ((args_out[i][0] == '\\') && (args_out[i][2] == '\\'))
+      {
+        // Assume this is a pathname, and adjust accordingly
+        //printf("ARGS_IN: PATHNAME ASSUMED: %s\n", args_in[i]);
+
+        strcpy(noleak_buffers[next_buffer], args_in[i]);
+
+        noleak_buffers[next_buffer][0] = noleak_buffers[next_buffer][1];
+        noleak_buffers[next_buffer][1] = ':';
+
+        args_out[i] = noleak_buffers[next_buffer];
+        //printf("ARGS_OUT: PATHNAME MODIFIED TO BE: %s\n", args_out[i]);
+
+        next_buffer++;
+      }
+      else if ((args_out[i][0] == '\\') && (args_out[i][1] == '\\') &&
+               (args_out[i][3] == '\\') && (args_out[i][4] == '\\'))
+      {
+        // Assume this is a pathname, and adjust accordingly
+        //printf("ARGS_IN: PATHNAME ASSUMED: %s\n", args_in[i]);
+
+        noleak_buffers[next_buffer][0] = args_in[i][2];
+        noleak_buffers[next_buffer][1] = ':';
+        noleak_buffers[next_buffer][2] = '\0';
+
+        strcpy(noleak_buffers[next_buffer], &args_in[i][3]);
+
+        args_out[i] = noleak_buffers[next_buffer];
+        //printf("ARGS_OUT: PATHNAME MODIFIED TO BE: %s\n", args_out[i]);
+
+        next_buffer++;
+      }
+      else if ( strstr(args_out[i], "OUT:") || strstr(args_out[i], "DEF:") )
+      {
+        // Deal with -OUT:/c/....
+        //
+        // NOTE: THERE IS A BUG IN THIS IMPLEMENTATION IF 
+        //       THERE IS A SPACE IN THE TOPSRCDIR PATH.
+        //
+        // Should really check for spaces, then double-quote
+        // the path if any space is found.
+        // -- wolfe@lobo.us  25-Aug-08
+        if ((args_out[i][5] == '/') && (args_out[i][7] == '/'))
+        {
+          // Assume this is a pathname, and adjust accordingly
+          //printf("ARGS_IN: PATHNAME ASSUMED: %s\n", args_in[i]);
+
+          strcpy(noleak_buffers[next_buffer], args_in[i]);
+
+          noleak_buffers[next_buffer][5] = noleak_buffers[next_buffer][6];
+          noleak_buffers[next_buffer][6] = ':';
+
+          args_out[i] = noleak_buffers[next_buffer];
+          //printf("ARGS_OUT: PATHNAME MODIFIED TO BE: %s\n", args_out[i]);
+        }
+        // Deal with -OUT:"/c/...."
+        else if ((args_out[i][6] == '/') && (args_out[i][8] == '/'))
+        {
+          // Assume this is a pathname, and adjust accordingly
+          //printf("ARGS_IN: PATHNAME ASSUMED: %s\n", args_in[i]);
+
+          strcpy(noleak_buffers[next_buffer], args_in[i]);
+
+          noleak_buffers[next_buffer][6] = noleak_buffers[next_buffer][7];
+          noleak_buffers[next_buffer][7] = ':';
+
+          args_out[i] = noleak_buffers[next_buffer];
+          //printf("ARGS_OUT: PATHNAME MODIFIED TO BE: %s\n", args_out[i]);
+        }
+
+        next_buffer++;
+      }
+      else
+      {
+        char *offset = strstr(args_out[i], "/cygdrive/");
+
+        if (offset) {
+
+          strcpy(offset, offset+9);
+          offset[0] = offset[1];
+          offset[1] = ':';
+          offset[2] = '/';
+        }
+
+        if ( (args_out[i][0] == '-' || args_out[i][0] == '/') &&
+             (args_out[i][1] == 'D'))
+        {
+
+          offset = strstr(args_out[i]+2, "=");
+          if (offset)
+          {
+            char* equalsChar = offset;
+
+            if (equalsChar[1] == '"')
+            {
+              *equalsChar = '\0';
+
+              strcpy(noleak_buffers[next_buffer], args_out[i]);
+
+              *equalsChar = '=';
+
+              strcat(noleak_buffers[next_buffer], "=\\\"");
+              strcat(noleak_buffers[next_buffer], equalsChar+1);
+              strcat(noleak_buffers[next_buffer], "\\\"");
+
+              args_out[i] = noleak_buffers[next_buffer];
+
+              next_buffer++;
+            }
+          }
+        }
+      }
+
+      if (next_buffer > MAX_NOLEAK_BUFFERS) {
+        printf("OOPS - next_buffer > MAX_NOLEAK_BUFFERS\n");
+        exit(-1);
+      }
+    }
+    i++;
+  }
+  args_out[i] = NULL;
+  return i;
+}
+
+void dumpargs(char** args)
+{
+ int i = 0;
+
+ if (args[0] == NULL)
+   printf(":: first element is null!\n");
+
+ while(args[i])
+   printf("%s ", args[i++]);
+
+ printf("\n");
+ fflush(stdout);
+ fflush(stderr);
+}
+
+
+DWORD run(char** args)
+{
+
+ DWORD exitCode;
+ STARTUPINFO si;
+ PROCESS_INFORMATION pi;
+
+ char theArgs[1024*16];
+
+ int totalLen = 0;
+ int i, j;
+
+
+ // Clear any link env variable that might get us tangled up
+ _putenv("LINK=");
+ _putenv("LIBPATH=");
+ _putenv("CC=");
+
+ _putenv("INCLUDE=" WCE_INC);
+ _putenv("LIB=" WCE_LIB);
+
+ for (j=1; args[j]; j++)
+ {
+   int len = strlen(args[j]);
+   strcat(&theArgs[totalLen], args[j]);
+   totalLen += len;
+
+   strcat(&theArgs[totalLen], " ");
+   totalLen++;
+ }
+
+ i = strlen(args[0]);
+ for (j=0; j<i; j++)
+ {
+   if (args[0][j] == '/')
+     args[0][j] = '\\';
+ }
+
+ ZeroMemory( &si, sizeof(si) );
+ si.cb = sizeof(si);
+ ZeroMemory( &pi, sizeof(pi));
+
+ CreateProcess(args[0],
+               theArgs,
+               NULL,
+               NULL,
+               0,
+               0,
+               NULL,
+               NULL,
+               &si,              // Pointer to STARTUPINFO structure.
+               &pi);
+
+
+ // Wait until child process exits.
+ WaitForSingleObject( pi.hProcess, INFINITE );
+ GetExitCodeProcess(pi.hProcess, &exitCode);
+ // Close process and thread handles.
+ CloseHandle( pi.hProcess );
+ CloseHandle( pi.hThread );
+
+ return exitCode;
+}
--- a/caps/src/nsScriptSecurityManager.cpp
+++ b/caps/src/nsScriptSecurityManager.cpp
@@ -1703,18 +1703,17 @@ nsScriptSecurityManager::CanExecuteScrip
         if (docshell) 
         {
             // Is this script running from mail?
             PRUint32 appType;
             rv = docshell->GetAppType(&appType);
             if (NS_FAILED(rv)) return rv;
             if (appType == nsIDocShell::APP_TYPE_MAIL) 
             {
-                // we are temporarily disabling js in mail for TB 3.0 b1
-                *result = PR_FALSE; // mIsMailJavaScriptEnabled;
+                *result = mIsMailJavaScriptEnabled;
             }
         }
     }
 
     if (!*result)
         return NS_OK; // Do not run scripts
 
     //-- Check for a per-site policy
@@ -3781,17 +3780,18 @@ nsScriptSecurityManager::ScriptSecurityP
 {
     PRBool temp;
     nsresult rv = mSecurityPref->SecurityGetBoolPref(sJSEnabledPrefName, &temp);
     // JavaScript defaults to enabled in failure cases.
     mIsJavaScriptEnabled = NS_FAILED(rv) || temp;
 
     rv = mSecurityPref->SecurityGetBoolPref(sJSMailEnabledPrefName, &temp);
     // JavaScript in Mail defaults to disabled in failure cases.
-    mIsMailJavaScriptEnabled = NS_SUCCEEDED(rv) && temp;
+    // disable javascript in mailnews for TB 3.0 beta1
+    mIsMailJavaScriptEnabled = PR_FALSE; // NS_SUCCEEDED(rv) && temp;
 
     rv = mSecurityPref->SecurityGetBoolPref(sFileOriginPolicyPrefName, &temp);
     sStrictFileOriginPolicy = NS_SUCCEEDED(rv) && temp;
 
 #ifdef XPC_IDISPATCH_SUPPORT
     rv = mSecurityPref->SecurityGetBoolPref(sXPCDefaultGrantAllName, &temp);
     // Granting XPC Priveleges defaults to disabled in failure cases.
     mXPCDefaultGrantAll = NS_SUCCEEDED(rv) && temp;
--- a/config/JarMaker.py
+++ b/config/JarMaker.py
@@ -263,43 +263,48 @@ class JarMaker(object):
         jf = ZipFile(jarfilepath, 'w', lock = True)
       outHelper = self.OutputHelper_jar(jf)
     else:
       outHelper = getattr(self, 'OutputHelper_' + self.outputFormat)(jarfile)
     register = {}
     # This loop exits on either
     # - the end of the jar.mn file
     # - an line in the jar.mn file that's not part of a jar section
-    while True:
-      try:
-        l = lines.next()
-      except StopIteration:
-        # we're done with this jar.mn, and this jar section
-        self.finalizeJar(jarfile, chromebasepath, register)
-        if jf is not None:
-          jf.close()
-        # reraise the StopIteration for makeJar
-        raise
-      if self.ignore.match(l):
-        continue
-      m = self.regline.match(l)
-      if  m:
-        rline = m.group(1)
-        register[rline] = 1
-        continue
-      m = self.entryline.match(l)
-      if not m:
-        # neither an entry line nor chrome reg, this jar section is done
-        self.finalizeJar(jarfile, chromebasepath, register)
-        if jf is not None:
-          jf.close()
-        lines.pushback(l)
-        return
-      self._processEntryLine(m, sourcedirs, topsourcedir, localedirs,
-                            outHelper, jf)
+    # - on an exception raised, close the jf in that case in a finally
+    try:
+      while True:
+        try:
+          l = lines.next()
+        except StopIteration:
+          # we're done with this jar.mn, and this jar section
+          self.finalizeJar(jarfile, chromebasepath, register)
+          if jf is not None:
+            jf.close()
+          # reraise the StopIteration for makeJar
+          raise
+        if self.ignore.match(l):
+          continue
+        m = self.regline.match(l)
+        if  m:
+          rline = m.group(1)
+          register[rline] = 1
+          continue
+        m = self.entryline.match(l)
+        if not m:
+          # neither an entry line nor chrome reg, this jar section is done
+          self.finalizeJar(jarfile, chromebasepath, register)
+          if jf is not None:
+            jf.close()
+          lines.pushback(l)
+          return
+        self._processEntryLine(m, sourcedirs, topsourcedir, localedirs,
+                              outHelper, jf)
+    finally:
+      if jf is not None:
+        jf.close()
     return
 
   def _processEntryLine(self, m, 
                         sourcedirs, topsourcedir, localedirs,
                         outHelper, jf):
       out = m.group('output')
       src = m.group('source') or os.path.basename(out)
       # pick the right sourcedir -- l10n, topsrc or src
@@ -398,17 +403,21 @@ def main():
   jm.processIncludes(options.I)
   jm.outputFormat = options.f
   if options.e:
     jm.useChromeManifest = True
     jm.useJarfileManifest = False
   noise = logging.INFO
   if options.verbose is not None:
     noise = (options.verbose and logging.DEBUG) or logging.WARN
-  logging.basicConfig(level = noise, format = "%(message)s")
+  if sys.version_info[:2] > (2,3):
+    logging.basicConfig(format = "%(message)s")
+  else:
+    logging.basicConfig()
+  logging.getLogger().setLevel(noise)
   if not args:
     jm.makeJar(infile=sys.stdin,
                sourcedirs=options.s, topsourcedir=options.t,
                localedirs=options.l10n_src,
                jardir=options.j)
     return
   topsrc = options.t
   topsrc = os.path.normpath(os.path.abspath(topsrc))
--- a/config/MozZipFile.py
+++ b/config/MozZipFile.py
@@ -133,16 +133,19 @@ class ZipFile(zipfile.ZipFile):
 
     if self.fp.mode != 'r+b':
       # adjust file mode if we originally just wrote, now we rewrite
       self.fp.close()
       self.fp = open(self.filename, 'r+b')
     all = map(lambda zi: (zi, True), self.filelist) + \
         map(lambda zi: (zi, False), self._remove)
     all.sort(lambda l, r: cmp(l[0].header_offset, r[0].header_offset))
+    # empty _remove for multiple closes
+    self._remove = []
+
     lengths = [all[i+1][0].header_offset - all[i][0].header_offset
                for i in xrange(len(all)-1)]
     lengths.append(self.end - all[-1][0].header_offset)
     to_pos = 0
     for (zi, keep), length in zip(all, lengths):
       if not keep:
         continue
       oldoff = zi.header_offset
--- a/config/Preprocessor.py
+++ b/config/Preprocessor.py
@@ -169,18 +169,17 @@ class Preprocessor:
     pass
 
   def getCommandLineParser(self, unescapeDefines = False):
     escapedValue = re.compile('".*"$')
     def handleE(option, opt, value, parser):
       for k,v in os.environ.iteritems():
         self.context[k] = v
     def handleD(option, opt, value, parser):
-      vals = value.split('=')
-      assert len(vals) < 3
+      vals = value.split('=', 1)
       if len(vals) == 1:
         vals.append(1)
       elif unescapeDefines and escapedValue.match(vals[1]):
         # strip escaped string values
         vals[1] = vals[1][1:-1]
       self.context[vals[0]] = vals[1]
     def handleU(option, opt, value, parser):
       del self.context[value]
--- a/config/autoconf.mk.in
+++ b/config/autoconf.mk.in
@@ -36,16 +36,18 @@
 #
 # ***** END LICENSE BLOCK *****
 
 # A netscape style .mk file for autoconf builds
 
 INCLUDED_AUTOCONF_MK = 1
 USE_AUTOCONF 	= 1
 MOZILLA_CLIENT	= 1
+target          = @target@
+ac_configure_args = @ac_configure_args@
 BUILD_MODULES	= @BUILD_MODULES@
 MOZILLA_VERSION = @MOZILLA_VERSION@
 FIREFOX_VERSION	= @FIREFOX_VERSION@
 
 MOZ_BUILD_APP = @MOZ_BUILD_APP@
 MOZ_APP_NAME	= @MOZ_APP_NAME@
 MOZ_APP_DISPLAYNAME = @MOZ_APP_DISPLAYNAME@
 MOZ_APP_VERSION = @MOZ_APP_VERSION@
--- a/config/nsinstall.c
+++ b/config/nsinstall.c
@@ -159,31 +159,40 @@ togid(char *group)
 	fail("cannot find gid for %s", group);
     return gid;
 }
 
 static void
 copyfile( char *name, char *toname, mode_t mode, char *group, char *owner,
           int dotimes, uid_t uid, gid_t gid )
 {
-  int fromfd, tofd, cc, wc, exists;
+  int fromfd, tofd = -1, cc, wc, exists;
   char buf[BUFSIZ], *bp;
   struct stat sb, tosb;
   struct utimbuf utb;
 
   exists = (lstat(toname, &tosb) == 0);
 
   fromfd = open(name, O_RDONLY);
   if (fromfd < 0 || fstat(fromfd, &sb) < 0)
     fail("cannot access %s", name);
-  if (exists && (!S_ISREG(tosb.st_mode) || access(toname, W_OK) < 0))
-    (void) (S_ISDIR(tosb.st_mode) ? rmdir : unlink)(toname);
-  tofd = open(toname, O_CREAT | O_WRONLY, 0666);
-  if (tofd < 0)
-    fail("cannot create %s", toname);
+  if (exists) {
+    if (S_ISREG(tosb.st_mode)) {
+      /* See if we can open it. This is more reliable than 'access'. */
+      tofd = open(toname, O_CREAT | O_WRONLY, 0666);
+    }
+    if (tofd < 0) {
+      (void) (S_ISDIR(tosb.st_mode) ? rmdir : unlink)(toname);
+    }
+  }
+  if (tofd < 0) {
+    tofd = open(toname, O_CREAT | O_WRONLY, 0666);
+    if (tofd < 0)
+      fail("cannot create %s", toname);
+  }
 
   bp = buf;
   while ((cc = read(fromfd, bp, sizeof buf)) > 0)
   {
     while ((wc = write(tofd, bp, (unsigned int)cc)) > 0)
     {
       if ((cc -= wc) == 0)
         break;
--- a/content/xbl/src/nsXBLService.cpp
+++ b/content/xbl/src/nsXBLService.cpp
@@ -142,21 +142,23 @@ IsAncestorBinding(nsIDocument* aDocument
       nsCOMPtr<nsIURL> compareURL = do_QueryInterface(compareURI, &rv);
       NS_ENSURE_SUCCESS(rv, PR_TRUE); // assume the worst
       
       rv = compareURL->SetRef(EmptyCString());
       NS_ENSURE_SUCCESS(rv, PR_TRUE); // assume the worst
 
       rv = compareURL->Equals(aChildBindingURI, &equal);
     } else {
+      // Just compare the URIs
       rv = binding->PrototypeBinding()->BindingURI()->Equals(aChildBindingURI,
                                                              &equal);
-      NS_ENSURE_SUCCESS(rv, PR_TRUE); // assume the worst
     }
 
+    NS_ENSURE_SUCCESS(rv, PR_TRUE); // assume the worst
+
     if (equal) {
       ++bindingRecursion;
       if (bindingRecursion < NS_MAX_XBL_BINDING_RECURSION) {
         continue;
       }
       nsCAutoString spec;
       aChildBindingURI->GetSpec(spec);
       NS_ConvertUTF8toUTF16 bindingURI(spec);
--- a/embedding/components/find/public/nsIFind.idl
+++ b/embedding/components/find/public/nsIFind.idl
@@ -46,31 +46,27 @@ interface nsIFind : nsISupports
 {
   attribute boolean findBackwards;
   attribute boolean caseSensitive;
 
   /**
    * Use "find entire words" mode by setting to a word breaker
    * or null, to disable "entire words" mode.
    */
-  attribute nsIWordBreaker wordBreaker;
+  [noscript] attribute nsIWordBreaker wordBreaker;
 
   /**
    * Find some text in the current context. The implementation is
    * responsible for performing the find and highlighting the text.
    *
    * @param aPatText     The text to search for.
    * @param aSearchRange A Range specifying domain of search.
    * @param aStartPoint  A Range specifying search start point.
    *                     If not collapsed, we'll start from
    *                     end (forward) or start (backward).
-   *                     May be null; if so, we'll start at the start
-   *                     (forward) or end (back) of aSearchRange.
    * @param aEndPoint    A Range specifying search end point.
    *                     If not collapsed, we'll end at
    *                     end (forward) or start (backward).
-   *                     May be null; if so, we'll end at the end
-   *                     (forward) or start (back) of aSearchRange.
    * @retval             A range spanning the match that was found (or null).
    */
   nsIDOMRange Find(in wstring aPatText, in nsIDOMRange aSearchRange,
                    in nsIDOMRange aStartPoint, in nsIDOMRange aEndPoint);
 };
--- a/embedding/test/Makefile.in
+++ b/embedding/test/Makefile.in
@@ -38,15 +38,16 @@ DEPTH		= ../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = embedding/test
 
 include $(DEPTH)/config/autoconf.mk
 include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES =	test_bug293834.html \
-		bug293834_form.html \
-		$(NULL)
+_TEST_FILES = \
+	test_bug293834.html \
+	bug293834_form.html \
+	test_nsFind.html \
+	$(NULL)
 
 libs:: $(_TEST_FILES)
 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
new file mode 100644
--- /dev/null
+++ b/embedding/test/test_nsFind.html
@@ -0,0 +1,128 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=450048
+-->
+<head>
+  <title>Test for nsFind::Find()</title>
+  <script type="application/javascript" src="/MochiKit/MochiKit.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=450048">Mozilla Bug 450048</a>
+<p id="display">This is the text to search i<b>n&shy;t</b>o</p>
+<div id="content" style="display: none">
+  
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 450048 **/
+
+  // Check nsFind class and its nsIFind interface.
+
+  netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
+
+  var rf = Components.classes["@mozilla.org/embedcomp/rangefind;1"]
+                     .getService(Components.interfaces.nsIFind);
+
+  var display = window.document.getElementById("display");
+  var searchRange = window.document.createRange();
+  searchRange.setStart(display, 0);
+  searchRange.setEnd(display, display.childNodes.length);
+  var startPt = searchRange;
+  var endPt = searchRange;
+
+  // Check |null| detection on |aPatText| parameter.
+  try {
+    rf.Find(null, searchRange, startPt, endPt);
+
+    ok(false, "Missing NS_ERROR_NULL_POINTER exception");
+  } catch (e if (e instanceof Components.interfaces.nsIException &&
+                 e.result == Components.results.NS_ERROR_NULL_POINTER)) {
+    ok(true, null);
+  }
+
+  // Check |null| detection on |aSearchRange| parameter.
+  try {
+    rf.Find("", null, startPt, endPt);
+
+    ok(false, "Missing NS_ERROR_ILLEGAL_VALUE exception");
+  } catch (e if (e instanceof Components.interfaces.nsIException &&
+                 e.result == Components.results.NS_ERROR_ILLEGAL_VALUE)) {
+    ok(true, null);
+  }
+
+  // Check |null| detection on |aStartPoint| parameter.
+  try {
+    rf.Find("", searchRange, null, endPt);
+
+    ok(false, "Missing NS_ERROR_ILLEGAL_VALUE exception");
+  } catch (e if (e instanceof Components.interfaces.nsIException &&
+                 e.result == Components.results.NS_ERROR_ILLEGAL_VALUE)) {
+    ok(true, null);
+  }
+
+  // Check |null| detection on |aEndPoint| parameter.
+  try {
+    rf.Find("", searchRange, startPt, null);
+
+    ok(false, "Missing NS_ERROR_ILLEGAL_VALUE exception");
+  } catch (e if (e instanceof Components.interfaces.nsIException &&
+                 e.result == Components.results.NS_ERROR_ILLEGAL_VALUE)) {
+    ok(true, null);
+  }
+
+  var searchValue, retRange;
+
+  rf.findBackwards = false;
+
+  rf.caseSensitive = false;
+
+  searchValue = "TexT";
+  retRange = rf.Find(searchValue, searchRange, startPt, endPt);
+  ok(retRange, "\"" + searchValue + "\" not found (not caseSensitive)");
+
+  rf.caseSensitive = true;
+
+  // searchValue = "TexT";
+  retRange = rf.Find(searchValue, searchRange, startPt, endPt);
+  ok(!retRange, "\"" + searchValue + "\" found (caseSensitive)");
+
+  searchValue = "text";
+  retRange = rf.Find(searchValue, searchRange, startPt, endPt);
+  ok(retRange, "\"" + searchValue + "\" not found");
+
+  // Matches |i<b>n&shy;t</b>o|.
+  searchValue = "into";
+  retRange = rf.Find(searchValue, searchRange, startPt, endPt);
+  ok(retRange, "\"" + searchValue + "\" not found");
+
+  // Matches inside |search|.
+  searchValue = "ear";
+  retRange = rf.Find(searchValue, searchRange, startPt, endPt);
+  ok(retRange, "\"" + searchValue + "\" not found");
+
+  // Set new start point (to end of last search).
+  startPt = retRange.endContainer.ownerDocument.createRange();
+  startPt.setStart(retRange.endContainer, retRange.endOffset);
+  startPt.setEnd(retRange.endContainer, retRange.endOffset);
+
+  searchValue = "t";
+  retRange = rf.Find(searchValue, searchRange, startPt, endPt);
+  ok(retRange, "\"" + searchValue + "\" not found (forward)");
+
+  searchValue = "the";
+  retRange = rf.Find(searchValue, searchRange, startPt, endPt);
+  ok(!retRange, "\"" + searchValue + "\" found (forward)");
+
+  rf.findBackwards = true;
+
+  // searchValue = "the";
+  retRange = rf.Find(searchValue, searchRange, startPt, endPt);
+  ok(retRange, "\"" + searchValue + "\" not found (backward)");
+</script>
+</pre>
+</body>
+</html>
--- a/gfx/thebes/public/gfxFont.h
+++ b/gfx/thebes/public/gfxFont.h
@@ -449,31 +449,43 @@ public:
         NS_LOG_ADDREF(this, mRefCnt, "gfxFont", sizeof(*this));
         return mRefCnt;
     }
     nsrefcnt Release(void) {
         NS_PRECONDITION(0 != mRefCnt, "dup release");
         --mRefCnt;
         NS_LOG_RELEASE(this, mRefCnt, "gfxFont");
         if (mRefCnt == 0) {
-            // Don't delete just yet; return the object to the cache for
-            // possibly recycling within some time limit
-            gfxFontCache::GetCache()->NotifyReleased(this);
+            NotifyReleased();
+            // |this| may have been deleted.
             return 0;
         }
         return mRefCnt;
     }
 
     PRInt32 GetRefCount() { return mRefCnt; }
 
 protected:
     nsAutoRefCnt mRefCnt;
 
+    void NotifyReleased() {
+        gfxFontCache *cache = gfxFontCache::GetCache();
+        if (cache) {
+            // Don't delete just yet; return the object to the cache for
+            // possibly recycling within some time limit
+            cache->NotifyReleased(this);
+        } else {
+            // The cache may have already been shut down.
+            delete this;
+        }
+    }
+
+    gfxFont(gfxFontEntry *aFontEntry, const gfxFontStyle *aFontStyle);
+
 public:
-    gfxFont(gfxFontEntry *aFontEntry, const gfxFontStyle *aFontStyle);
     virtual ~gfxFont();
 
     const nsString& GetName() const { return mFontEntry->Name(); }
     const gfxFontStyle *GetStyle() const { return &mStyle; }
 
     virtual nsString GetUniqueName() = 0;
 
     // Font metrics
@@ -632,17 +644,16 @@ public:
         if (!mIsValid)
             return PR_FALSE;
         return mFontEntry->HasCharacter(ch); 
     }
 
 protected:
     nsRefPtr<gfxFontEntry> mFontEntry;
 
-    // The family name of the font
     PRPackedBool               mIsValid;
     nsExpirationState          mExpirationState;
     gfxFontStyle               mStyle;
     nsAutoTArray<gfxGlyphExtents*,1> mGlyphExtentsArray;
 
     // synthetic bolding for environments where this is not supported by the platform
     PRUint32                   mSyntheticBoldOffset;  // number of devunit pixels to offset double-strike, 0 ==> no bolding
 
@@ -1475,19 +1486,20 @@ private:
     nsExpirationState mExpirationState;
     PRUint32          mAppUnitsPerDevUnit;
     PRUint32          mFlags;
     PRUint32          mCharacterCount;
     PRUint32          mHashCode;
 };
 
 class THEBES_API gfxFontGroup : public gfxTextRunFactory {
-public:
+protected:
     gfxFontGroup(const nsAString& aFamilies, const gfxFontStyle *aStyle);
 
+public:
     virtual ~gfxFontGroup() {
         mFonts.Clear();
     }
 
     virtual gfxFont *GetFontAt(PRInt32 i) {
         return static_cast<gfxFont*>(mFonts[i]);
     }
     virtual PRUint32 FontListLength() const {
--- a/gfx/thebes/src/gfxFontconfigUtils.cpp
+++ b/gfx/thebes/src/gfxFontconfigUtils.cpp
@@ -103,19 +103,19 @@ gfxFontconfigUtils::GetThebesWeight(FcPa
     if (weight <= FC_WEIGHT_BLACK)
         return 900;
 
     // FC_WEIGHT_EXTRABLACK was introduced in fontconfig-2.4.91 (2007)
     return 901;
 }
 
 gfxFontconfigUtils::gfxFontconfigUtils()
+    : mLastConfig(NULL)
 {
     mAliasTable.Init(50);
-    UpdateFontListInternal(PR_TRUE);
 }
 
 nsresult
 gfxFontconfigUtils::GetFontList(const nsACString& aLangGroup,
                                 const nsACString& aGenericFamily,
                                 nsStringArray& aListOfFonts)
 {
     aListOfFonts.Clear();
@@ -301,21 +301,34 @@ nsresult
 gfxFontconfigUtils::UpdateFontList()
 {
     return UpdateFontListInternal(PR_TRUE);
 }
 
 nsresult
 gfxFontconfigUtils::UpdateFontListInternal(PRBool aForce)
 {
-    if (!aForce && FcConfigUptoDate(NULL))
+    if (!aForce) {
+        // This checks periodically according to fontconfig's configured
+        // <rescan> interval.
+        FcInitBringUptoDate();
+    } else if (!FcConfigUptoDate(NULL)) { // check now with aForce
+        mLastConfig = NULL;
+        FcInitReinitialize();
+    }
+
+    // FcInitReinitialize() (used by FcInitBringUptoDate) creates a new config
+    // before destroying the old config, so the only way that we'd miss an
+    // update is if fontconfig did more than one update and the memory for the
+    // most recent config happened to be at the same location as the original
+    // config.
+    FcConfig *currentConfig = FcConfigGetCurrent();
+    if (currentConfig == mLastConfig)
         return NS_OK;
 
-    FcInitReinitialize();
-
     mFonts.Clear();
     mAliasForSingleFont.Clear();
     mAliasForMultiFonts.Clear();
     mNonExistingFonts.Clear();
 
     mAliasTable.Clear();
 
     nsresult rv = GetFontListInternal(mFonts);
@@ -332,19 +345,17 @@ gfxFontconfigUtils::UpdateFontListIntern
         return NS_ERROR_FAILURE;
 
     nsCOMPtr<nsIPrefBranch> prefBranch;
     prefs->GetBranch(0, getter_AddRefs(prefBranch));
     if (!prefBranch)
         return NS_ERROR_FAILURE;
 
     nsXPIDLCString list;
-    rv = prefBranch->GetCharPref("font.alias-list", getter_Copies(list));
-    if (NS_FAILED(rv))
-        return NS_OK;
+    prefBranch->GetCharPref("font.alias-list", getter_Copies(list));
 
     if (!list.IsEmpty()) {
         const char kComma = ',';
         const char *p, *p_end;
         list.BeginReading(p);
         list.EndReading(p_end);
         while (p < p_end) {
             while (nsCRT::IsAsciiSpace(*p)) {
@@ -358,30 +369,29 @@ gfxFontconfigUtils::UpdateFontListIntern
                 /* nothing */ ;
             nsCAutoString name(Substring(start, p));
             name.CompressWhitespace(PR_FALSE, PR_TRUE);
             mAliasForMultiFonts.AppendCString(name);
             p++;
         }
     }
 
-    if (mAliasForMultiFonts.Count() == 0)
-        return NS_OK;
-
     for (PRInt32 i = 0; i < mAliasForMultiFonts.Count(); i++) {
         nsRefPtr<gfxFontNameList> fonts = new gfxFontNameList;
         nsCAutoString fontname(*mAliasForMultiFonts.CStringAt(i));
         rv = GetResolvedFonts(fontname, fonts);
         if (NS_FAILED(rv))
             return rv;
 
         nsCAutoString key;
         ToLowerCase(fontname, key);
         mAliasTable.Put(key, fonts);
     }
+
+    mLastConfig = currentConfig;
     return NS_OK;
 }
 
 nsresult
 gfxFontconfigUtils::GetResolvedFonts(const nsACString& aName,
                                      gfxFontNameList* aResult)
 {
     FcPattern *pat = NULL;
@@ -438,32 +448,36 @@ gfxFontconfigUtils::GetStandardFamilyNam
     // The fontconfig has generic family names in the font list.
     if (aFontName.EqualsLiteral("serif") ||
         aFontName.EqualsLiteral("sans-serif") ||
         aFontName.EqualsLiteral("monospace")) {
         aFamilyName.Assign(aFontName);
         return NS_OK;
     }
 
+    nsresult rv = UpdateFontListInternal();
+    if (NS_FAILED(rv))
+        return rv;
+
     NS_ConvertUTF16toUTF8 fontname(aFontName);
 
     if (mFonts.IndexOf(fontname) >= 0) {
         aFamilyName.Assign(aFontName);
         return NS_OK;
     }
 
     if (mNonExistingFonts.IndexOf(fontname) >= 0)
         return NS_OK;
 
     FcPattern *pat = NULL;
     FcObjectSet *os = NULL;
     FcFontSet *givenFS = NULL;
     nsCStringArray candidates;
     FcFontSet *candidateFS = NULL;
-    nsresult rv = NS_ERROR_FAILURE;
+    rv = NS_ERROR_FAILURE;
 
     pat = FcPatternCreate();
     if (!pat)
         goto end;
 
     FcPatternAddString(pat, FC_FAMILY, (FcChar8 *)fontname.get());
 
     os = FcObjectSetBuild(FC_FAMILY, FC_FILE, FC_INDEX, NULL);
--- a/gfx/thebes/src/gfxFontconfigUtils.h
+++ b/gfx/thebes/src/gfxFontconfigUtils.h
@@ -94,11 +94,13 @@ protected:
     nsresult UpdateFontListInternal(PRBool aForce = PR_FALSE);
 
     nsCStringArray mFonts;
     nsCStringArray mNonExistingFonts;
     nsCStringArray mAliasForSingleFont;
     nsCStringArray mAliasForMultiFonts;
 
     nsDataHashtable<nsCStringHashKey, nsRefPtr<gfxFontNameList> > mAliasTable;
+
+    FcConfig *mLastConfig;
 };
 
 #endif /* GFX_FONTCONFIG_UTILS_H */
new file mode 100755
--- /dev/null
+++ b/js/tests/e4x/extensions/regress-450871-01.js
@@ -0,0 +1,67 @@
+/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+
+/* ***** 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 JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Gary Kwong
+ *
+ * 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 ***** */
+
+gTestfile = 'regress-450871-01.js';
+
+var summary = 'Do not crash: __proto__ = <x/>; <x/>.lastIndexOf(this, false)';
+var BUGNUMBER = 450871;
+var actual = 'No Crash';
+var expect = 'No Crash';
+
+printBugNumber(BUGNUMBER);
+START(summary);
+
+if (typeof window == 'object')
+{
+    actual = expect = 'Test skipped for browser based tests due destruction of the prototype';
+}
+else
+{
+    try
+    {
+        __proto__ = <x/>; 
+        <x/>.lastIndexOf(this, false);
+    }
+    catch(ex)
+    {
+    }
+}
+
+TEST(1, expect, actual);
+
+END();
new file mode 100755
--- /dev/null
+++ b/js/tests/e4x/extensions/regress-450871-02.js
@@ -0,0 +1,68 @@
+/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+
+/* ***** 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 JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Gary Kwong
+ *
+ * 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 ***** */
+
+gTestfile = 'regress-450871-02.js';
+
+var summary = 'Do not crash: __proto__ = <x/>; <x/>.indexOf(this)';
+var BUGNUMBER = 450871;
+var actual = 'No Crash';
+var expect = 'No Crash';
+
+printBugNumber(BUGNUMBER);
+START(summary);
+
+
+if (typeof window == 'object')
+{
+    actual = expect = 'Test skipped for browser based tests due destruction of the prototype';
+}
+else
+{
+    try
+    {
+        __proto__ = <x/>; 
+        <x/>.indexOf(this);
+    }
+    catch(ex)
+    {
+    }
+}
+
+TEST(1, expect, actual);
+
+END();
new file mode 100755
--- /dev/null
+++ b/js/tests/js1_5/Regress/regress-451884.js
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** 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 JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Martijn Wargers
+ *                 Brendan Eich
+ *
+ * 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 ***** */
+
+var gTestfile = 'regress-451884.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 451884;
+var summary = 'Do not crash [@ QuoteString]';
+var actual = 'No Crash';
+var expect = 'No Crash';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+  enterFunc ('test');
+  printBugNumber(BUGNUMBER);
+  printStatus (summary);
+
+  try
+  {
+    (function(k){eval("k.y")})();
+  }
+  catch(ex)
+  {
+  }
+
+  reportCompare(expect, actual, summary);
+
+  exitFunc ('test');
+}
new file mode 100755
--- /dev/null
+++ b/js/tests/js1_5/Regress/regress-453397.js
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** 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 JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Boris Zbarsky
+ *
+ * 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 ***** */
+
+var gTestfile = 'regress-453397.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 453397;
+var summary = 'Do not assert with JIT: script->main <= target && target < script->code + script->length';
+var actual = 'No Crash';
+var expect = 'No Crash';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+  enterFunc ('test');
+  printBugNumber(BUGNUMBER);
+  printStatus (summary);
+
+  jit(true);
+
+  function computeEscapeSpeed(real) {
+    for (var j = 1; j < 4; ++j) {
+      if (real > 2) {
+      }
+    }
+  }
+
+  const numRows = 4;
+  const numCols = 4;
+  var realStep = 1.5;
+  for (var i = 0, curReal = -2.1;
+       i < numCols;
+       ++i, curReal += realStep) {
+    for (var j = 0; j < numRows; ++j) {
+      computeEscapeSpeed(curReal);
+    }
+  }
+
+  jit(false);
+
+  reportCompare(expect, actual, summary);
+
+  exitFunc ('test');
+}
new file mode 100755
--- /dev/null
+++ b/js/tests/js1_5/Regress/regress-455758-01.js
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** 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 JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Jesse Ruderman
+ *
+ * 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 ***** */
+
+var gTestfile = 'regress-455758-01.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 455758;
+var summary = 'Do not assert: (m != JSVAL_INT) || isInt32(*vp)';
+var actual = 'No Crash';
+var expect = 'No Crash';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+  enterFunc ('test');
+  printBugNumber(BUGNUMBER);
+  printStatus (summary);
+
+  jit(true);
+
+  (function() { for (var j = 0; j < 5; ++j) { var t = 3 % (-0); } })();
+
+  jit(false);
+
+  reportCompare(expect, actual, summary);
+
+  exitFunc ('test');
+}
new file mode 100755
--- /dev/null
+++ b/js/tests/js1_5/Regress/regress-455758-02.js
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** 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 JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Jesse Ruderman
+ *
+ * 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 ***** */
+
+var gTestfile = 'regress-455758-02.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 455758;
+var summary = 'Do not crash: divide by zero';
+var actual = 'No Crash';
+var expect = 'No Crash';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+  enterFunc ('test');
+  printBugNumber(BUGNUMBER);
+  printStatus (summary);
+ 
+  jit(true);
+
+  (function() { for (var j = 0; j < 5; ++j) { 3 % (-0); } })();
+
+  jit(false);
+
+  reportCompare(expect, actual, summary);
+
+  exitFunc ('test');
+}
--- a/js/tests/js1_5/extensions/regress-452168.js
+++ b/js/tests/js1_5/extensions/regress-452168.js
@@ -47,20 +47,26 @@ test();
 //-----------------------------------------------------------------------------
 
 function test()
 {
   enterFunc ('test');
   printBugNumber(BUGNUMBER);
   printStatus (summary);
 
-  jit(true);
-  gczeal(2);
+  if (typeof gczeal == 'undefined')
+  {
+      expect = actual = 'Test requires gczeal, skipped.';
+  }
+  else
+  {
+    jit(true);
+    gczeal(2);
 
-  var a, b; gczeal(2); (function() { for (var p in this) { } })();
+    var a, b; gczeal(2); (function() { for (var p in this) { } })();
 
-  gczeal(0);
-  jit(false);
-
+    gczeal(0);
+    jit(false);
+  }
   reportCompare(expect, actual, summary);
 
   exitFunc ('test');
 }
--- a/js/tests/js1_6/extensions/regress-455464-04.js
+++ b/js/tests/js1_6/extensions/regress-455464-04.js
@@ -49,20 +49,27 @@ test();
 //-----------------------------------------------------------------------------
 
 function test()
 {
   enterFunc ('test');
   printBugNumber(BUGNUMBER);
   printStatus (summary);
 
-  jit(true);
-  gczeal(2);
+  if (typeof gczeal == 'undefined')
+  {
+      expect = actual = 'Test requires gczeal, skipped.';
+  }
+  else
+  {
+    jit(true);
+    gczeal(2);
 
-  a=b=c=d=0; this.__defineGetter__('g', gc); for each (y in this);
+    a=b=c=d=0; this.__defineGetter__('g', gc); for each (y in this);
 
-  gczeal(0);
-  jit(false);
+    gczeal(0);
+    jit(false);
+  }
 
   reportCompare(expect, actual, summary);
 
   exitFunc ('test');
 }
new file mode 100755
--- /dev/null
+++ b/js/tests/js1_7/expressions/regress-418051.js
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** 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 JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Jesse Ruderman
+ *
+ * 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 ***** */
+
+var gTestfile = 'regress-418051.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 418051;
+var summary = 'Do not assert: (pnkey)->pn_arity == PN_NULLARY && ' + 
+  '((pnkey)->pn_type == TOK_NUMBER || (pnkey)->pn_type == TOK_STRING || ' +
+  '(pnkey)->pn_type == TOK_NAME)';
+var actual = 'No Crash';
+var expect = 'No Crash';
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+  enterFunc ('test');
+  printBugNumber(BUGNUMBER);
+  printStatus (summary);
+ 
+  try
+  {
+    eval("({x:[]}={x}");
+  }
+  catch(ex)
+  {
+  }
+  reportCompare(expect, actual, summary);
+
+  exitFunc ('test');
+}
new file mode 100755
--- /dev/null
+++ b/js/tests/js1_7/expressions/regress-451340.js
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** 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 JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Jesse Ruderman
+ *
+ * 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 ***** */
+
+var gTestfile = 'regress-451340.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 451340;
+var summary = 'Do no crash [@ CheckDestructuring]';
+var actual = 'No Crash';
+var expect = 'No Crash';
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+  enterFunc ('test');
+  printBugNumber(BUGNUMBER);
+  printStatus (summary);
+ 
+  function x([y]) { }
+
+  reportCompare(expect, actual, summary);
+
+  exitFunc ('test');
+}
--- a/js/tests/public-failures.txt
+++ b/js/tests/public-failures.txt
@@ -67,40 +67,40 @@ TEST_ID=e4x/extensions/regress-337226.js
 TEST_ID=e4x/extensions/regress-337226.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=shell, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=ABNORMAL.*, TEST_DESCRIPTION=`.``*`/e4x/extensions/regress-337226.js:`.``*`: ReferenceError: reference to undefined XML name @mozilla.org/js/function::parseInt
 TEST_ID=e4x/extensions/regress-374025.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=.*, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=intel64, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=ABNORMAL 5, TEST_DESCRIPTION=`.``*`/e4x/extensions/regress-374025.js:`.``*`: out of memory
 TEST_ID=e4x/extensions/regress-374025.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=.*, TEST_OS=darwin, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=CRASHED.*, TEST_DESCRIPTION=
 TEST_ID=e4x/extensions/regress-374025.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=.*, TEST_OS=linux, TEST_KERNEL=.*, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=CRASHED.*, TEST_DESCRIPTION=
 TEST_ID=e4x/extensions/regress-374025.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=.*, TEST_OS=nt, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=ABNORMAL.*, TEST_DESCRIPTION=
 TEST_ID=e4x/extensions/regress-410192.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=.*, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=Section 1 of test - Proper quoting of attribute by uneval/toSource reason: Expected value '"v"', Actual value 'v'
 TEST_ID=ecma/Math/15.8.2.5.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=debug, TEST_TYPE=browser, TEST_OS=nt, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=Infinity/Math.atan2(-0, 1) reason: wrong value
 TEST_ID=ecma/Math/15.8.2.5.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=debug, TEST_TYPE=browser, TEST_OS=nt, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=Infinity/Math.atan2(-1, Infinity) reason: wrong value
-TEST_ID=ecma/Math/15.8.2.6.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=shell, TEST_OS=darwin, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=Infinity/Math.ceil(-0.9) reason: wrong value
-TEST_ID=ecma/Math/15.8.2.6.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=shell, TEST_OS=darwin, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=Infinity/Math.ceil(-Number.MIN_VALUE) reason: wrong value
-TEST_ID=ecma/Math/15.8.2.6.js, TEST_BRANCH=1.9.0, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=shell, TEST_OS=darwin, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=Infinity/Math.ceil(-0.9) reason: wrong value
-TEST_ID=ecma/Math/15.8.2.6.js, TEST_BRANCH=1.9.0, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=shell, TEST_OS=darwin, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=Infinity/Math.ceil(-Number.MIN_VALUE) reason: wrong value
+TEST_ID=ecma/Math/15.8.2.6.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=shell, TEST_OS=darwin, TEST_KERNEL=.*, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=Infinity/Math.ceil(-0.9) reason: wrong value
+TEST_ID=ecma/Math/15.8.2.6.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=shell, TEST_OS=darwin, TEST_KERNEL=.*, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=Infinity/Math.ceil(-Number.MIN_VALUE) reason: wrong value
+TEST_ID=ecma/Math/15.8.2.6.js, TEST_BRANCH=1.9.0, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=shell, TEST_OS=darwin, TEST_KERNEL=.*, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=Infinity/Math.ceil(-0.9) reason: wrong value
+TEST_ID=ecma/Math/15.8.2.6.js, TEST_BRANCH=1.9.0, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=shell, TEST_OS=darwin, TEST_KERNEL=.*, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=Infinity/Math.ceil(-Number.MIN_VALUE) reason: wrong value
 TEST_ID=ecma/Math/15.8.2.6.js, TEST_BRANCH=1.9.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=.*, TEST_OS=darwin, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=Infinity/Math.ceil(-0.9) reason: wrong value
 TEST_ID=ecma/Math/15.8.2.6.js, TEST_BRANCH=1.9.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=.*, TEST_OS=darwin, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=Infinity/Math.ceil(-Number.MIN_VALUE) reason: wrong value
 TEST_ID=ecma/String/15.5.4.6-2.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=debug, TEST_TYPE=browser, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=var f = new Object( String.prototype.indexOf ); f('[object Window @ `.``*` (native @ `.``*`)]') reason: wrong value
 TEST_ID=ecma/TypeConversion/9.2.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=.*, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=!(0/0) reason: wrong value
 TEST_ID=ecma/TypeConversion/9.2.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=.*, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=1000 % 0 ? true : false reason: wrong value
 TEST_ID=ecma/TypeConversion/9.3.1-3.js, TEST_BRANCH=.*, TEST_REPO=.*, TEST_BUILDTYPE=debug, TEST_TYPE=browser, TEST_OS=linux, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=-s2 == -Infinity || -s2 == -1.7976931348623157e+308  reason: wrong value
 TEST_ID=ecma/TypeConversion/9.3.1-3.js, TEST_BRANCH=.*, TEST_REPO=.*, TEST_BUILDTYPE=debug, TEST_TYPE=browser, TEST_OS=linux, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=parseInt(s2) == Infinity || parseInt(s2) == 1.7976931348623157e+308 reason: wrong value
 TEST_ID=ecma/TypeConversion/9.3.1-3.js, TEST_BRANCH=.*, TEST_REPO=.*, TEST_BUILDTYPE=debug, TEST_TYPE=browser, TEST_OS=linux, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=parseInt(s2,10) == Infinity || parseInt(s2,10) == 1.7976931348623157e+308 reason: wrong value
 TEST_ID=ecma/TypeConversion/9.3.1-3.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=debug, TEST_TYPE=.*, TEST_OS=linux, TEST_KERNEL=.*, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=-s2 == -Infinity || -s2 == -1.7976931348623157e+308  reason: wrong value
 TEST_ID=ecma/TypeConversion/9.3.1-3.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=debug, TEST_TYPE=.*, TEST_OS=linux, TEST_KERNEL=.*, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=parseInt(s2) == Infinity || parseInt(s2) == 1.7976931348623157e+308 reason: wrong value
 TEST_ID=ecma/TypeConversion/9.3.1-3.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=debug, TEST_TYPE=.*, TEST_OS=linux, TEST_KERNEL=.*, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=parseInt(s2,10) == Infinity || parseInt(s2,10) == 1.7976931348623157e+308 reason: wrong value
-TEST_ID=ecma/TypeConversion/9.3.1-3.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=opt, TEST_TYPE=shell, TEST_OS=darwin, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=-s2 == -Infinity || -s2 == -1.7976931348623157e+308  reason: wrong value
-TEST_ID=ecma/TypeConversion/9.3.1-3.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=opt, TEST_TYPE=shell, TEST_OS=darwin, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=parseInt(s2) == Infinity || parseInt(s2) == 1.7976931348623157e+308 reason: wrong value
-TEST_ID=ecma/TypeConversion/9.3.1-3.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=opt, TEST_TYPE=shell, TEST_OS=darwin, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=parseInt(s2,10) == Infinity || parseInt(s2,10) == 1.7976931348623157e+308 reason: wrong value
-TEST_ID=ecma/TypeConversion/9.3.1-3.js, TEST_BRANCH=1.9.0, TEST_REPO=.*, TEST_BUILDTYPE=debug, TEST_TYPE=.*, TEST_OS=linux, TEST_KERNEL=.*, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=-s2 == -Infinity || -s2 == -1.7976931348623157e+308  reason: wrong value
-TEST_ID=ecma/TypeConversion/9.3.1-3.js, TEST_BRANCH=1.9.0, TEST_REPO=.*, TEST_BUILDTYPE=debug, TEST_TYPE=.*, TEST_OS=linux, TEST_KERNEL=.*, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=parseInt(s2) == Infinity || parseInt(s2) == 1.7976931348623157e+308 reason: wrong value
-TEST_ID=ecma/TypeConversion/9.3.1-3.js, TEST_BRANCH=1.9.0, TEST_REPO=.*, TEST_BUILDTYPE=debug, TEST_TYPE=.*, TEST_OS=linux, TEST_KERNEL=.*, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=parseInt(s2,10) == Infinity || parseInt(s2,10) == 1.7976931348623157e+308 reason: wrong value
-TEST_ID=ecma/TypeConversion/9.3.1-3.js, TEST_BRANCH=1.9.0, TEST_REPO=.*, TEST_BUILDTYPE=opt, TEST_TYPE=shell, TEST_OS=darwin, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=-s2 == -Infinity || -s2 == -1.7976931348623157e+308  reason: wrong value
-TEST_ID=ecma/TypeConversion/9.3.1-3.js, TEST_BRANCH=1.9.0, TEST_REPO=.*, TEST_BUILDTYPE=opt, TEST_TYPE=shell, TEST_OS=darwin, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=parseInt(s2) == Infinity || parseInt(s2) == 1.7976931348623157e+308 reason: wrong value
-TEST_ID=ecma/TypeConversion/9.3.1-3.js, TEST_BRANCH=1.9.0, TEST_REPO=.*, TEST_BUILDTYPE=opt, TEST_TYPE=shell, TEST_OS=darwin, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=parseInt(s2,10) == Infinity || parseInt(s2,10) == 1.7976931348623157e+308 reason: wrong value
+TEST_ID=ecma/TypeConversion/9.3.1-3.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=opt, TEST_TYPE=shell, TEST_OS=darwin, TEST_KERNEL=.*, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=-s2 == -Infinity || -s2 == -1.7976931348623157e+308  reason: wrong value
+TEST_ID=ecma/TypeConversion/9.3.1-3.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=opt, TEST_TYPE=shell, TEST_OS=darwin, TEST_KERNEL=.*, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=parseInt(s2) == Infinity || parseInt(s2) == 1.7976931348623157e+308 reason: wrong value
+TEST_ID=ecma/TypeConversion/9.3.1-3.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=opt, TEST_TYPE=shell, TEST_OS=darwin, TEST_KERNEL=.*, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=parseInt(s2,10) == Infinity || parseInt(s2,10) == 1.7976931348623157e+308 reason: wrong value
+TEST_ID=ecma/TypeConversion/9.3.1-3.js, TEST_BRANCH=1.9.0, TEST_REPO=.*, TEST_BUILDTYPE=debug, TEST_TYPE=.*, TEST_OS=linux, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=-s2 == -Infinity || -s2 == -1.7976931348623157e+308  reason: wrong value
+TEST_ID=ecma/TypeConversion/9.3.1-3.js, TEST_BRANCH=1.9.0, TEST_REPO=.*, TEST_BUILDTYPE=debug, TEST_TYPE=.*, TEST_OS=linux, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=parseInt(s2) == Infinity || parseInt(s2) == 1.7976931348623157e+308 reason: wrong value
+TEST_ID=ecma/TypeConversion/9.3.1-3.js, TEST_BRANCH=1.9.0, TEST_REPO=.*, TEST_BUILDTYPE=debug, TEST_TYPE=.*, TEST_OS=linux, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=parseInt(s2,10) == Infinity || parseInt(s2,10) == 1.7976931348623157e+308 reason: wrong value
+TEST_ID=ecma/TypeConversion/9.3.1-3.js, TEST_BRANCH=1.9.0, TEST_REPO=.*, TEST_BUILDTYPE=opt, TEST_TYPE=shell, TEST_OS=darwin, TEST_KERNEL=.*, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=-s2 == -Infinity || -s2 == -1.7976931348623157e+308  reason: wrong value
+TEST_ID=ecma/TypeConversion/9.3.1-3.js, TEST_BRANCH=1.9.0, TEST_REPO=.*, TEST_BUILDTYPE=opt, TEST_TYPE=shell, TEST_OS=darwin, TEST_KERNEL=.*, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=parseInt(s2) == Infinity || parseInt(s2) == 1.7976931348623157e+308 reason: wrong value
+TEST_ID=ecma/TypeConversion/9.3.1-3.js, TEST_BRANCH=1.9.0, TEST_REPO=.*, TEST_BUILDTYPE=opt, TEST_TYPE=shell, TEST_OS=darwin, TEST_KERNEL=.*, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=parseInt(s2,10) == Infinity || parseInt(s2,10) == 1.7976931348623157e+308 reason: wrong value
 TEST_ID=ecma_3/Array/regress-322135-02.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=debug, TEST_TYPE=.*, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=TIMED OUT, TEST_DESCRIPTION=
 TEST_ID=ecma_3/Array/regress-322135-02.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=opt, TEST_TYPE=.*, TEST_OS=linux, TEST_KERNEL=.*, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=TIMED OUT, TEST_DESCRIPTION=
 TEST_ID=ecma_3/Array/regress-322135-02.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=opt, TEST_TYPE=browser, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=TIMED OUT, TEST_DESCRIPTION=
 TEST_ID=ecma_3/Array/regress-322135-03.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=.*, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=TIMED OUT, TEST_DESCRIPTION=
 TEST_ID=ecma_3/Array/regress-322135-03.js, TEST_BRANCH=1.9.0, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=browser, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=TIMED OUT, TEST_DESCRIPTION=
 TEST_ID=ecma_3/Array/regress-322135-03.js, TEST_BRANCH=1.9.0, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=shell, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=ABNORMAL.*, TEST_DESCRIPTION=`.``*`/ecma_3/Array/regress-322135-03.js:`.``*`: out of memory
 TEST_ID=ecma_3/Array/regress-322135-03.js, TEST_BRANCH=1.9.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=.*, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=ABNORMAL.*, TEST_DESCRIPTION=`.``*`/ecma_3/Array/regress-322135-03.js:`.``*`: out of memory
 TEST_ID=ecma_3/Array/regress-322135-04.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=.*, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=TIMED OUT, TEST_DESCRIPTION=
@@ -296,16 +296,21 @@ TEST_ID=js1_5/Regress/regress-422348.js,
 TEST_ID=js1_5/Regress/regress-422348.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=shell, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=ABNORMAL.*, TEST_DESCRIPTION=`.``*`/js1_5/Regress/regress-422348.js:`.``*`: out of memory
 TEST_ID=js1_5/Regress/regress-422348.js, TEST_BRANCH=1.9.0, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=.*, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=intel64, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=ABNORMAL 5, TEST_DESCRIPTION=`.``*`/js1_5/Regress/regress-422348.js:`.``*`: out of memory
 TEST_ID=js1_5/Regress/regress-422348.js, TEST_BRANCH=1.9.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=.*, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=intel64, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=ABNORMAL 5, TEST_DESCRIPTION=`.``*`/js1_5/Regress/regress-422348.js:`.``*`: out of memory
 TEST_ID=js1_5/Regress/regress-452495.js, TEST_BRANCH=.*, TEST_REPO=mozilla-central, TEST_BUILDTYPE=debug, TEST_TYPE=.*, TEST_OS=linux, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=CRASHED signal 11 SIGSEGV, TEST_DESCRIPTION=; messages: BUGNUMBER: 452495
 TEST_ID=js1_5/Regress/regress-452495.js, TEST_BRANCH=1.9.1, TEST_REPO=.*, TEST_BUILDTYPE=debug, TEST_TYPE=.*, TEST_OS=darwin, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=CRASHED signal 11 SIGSEGV, TEST_DESCRIPTION=; messages: BUGNUMBER: 452495
 TEST_ID=js1_5/Regress/regress-452573-02.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=shell, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=No test results reported
 TEST_ID=js1_5/Regress/regress-452573-02.js, TEST_BRANCH=1.9.0, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=shell, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=No test results reported
 TEST_ID=js1_5/Regress/regress-452573-02.js, TEST_BRANCH=1.9.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=.*, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=No test results reported
+TEST_ID=js1_5/Regress/regress-453397.js, TEST_BRANCH=1.9.1, TEST_REPO=mozilla-central, TEST_BUILDTYPE=debug, TEST_TYPE=.*, TEST_OS=darwin, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=CRASHED.*, TEST_DESCRIPTION=`.``*`Assertion failure: script->main <= target && target < script->code + script->length, at `.``*`jsopcode.cpp:
+TEST_ID=js1_5/Regress/regress-453397.js, TEST_BRANCH=1.9.1, TEST_REPO=mozilla-central, TEST_BUILDTYPE=debug, TEST_TYPE=.*, TEST_OS=linux, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=CRASHED.*, TEST_DESCRIPTION=`.``*`Assertion failure: script->main <= target && target < script->code + script->length, at `.``*`jsopcode.cpp:
+TEST_ID=js1_5/Regress/regress-453397.js, TEST_BRANCH=1.9.1, TEST_REPO=mozilla-central, TEST_BUILDTYPE=debug, TEST_TYPE=.*, TEST_OS=nt, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=ABNORMAL 3, TEST_DESCRIPTION=;
+TEST_ID=js1_5/Regress/regress-453397.js, TEST_BRANCH=1.9.1, TEST_REPO=mozilla-central, TEST_BUILDTYPE=opt, TEST_TYPE=browser, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=CRASHED.*, TEST_DESCRIPTION=;
+TEST_ID=js1_5/Regress/regress-453397.js, TEST_BRANCH=1.9.1, TEST_REPO=mozilla-central, TEST_BUILDTYPE=opt, TEST_TYPE=shell, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=No test results reported
 TEST_ID=js1_5/Regress/regress-454981.js, TEST_BRANCH=1.9.1, TEST_REPO=.*, TEST_BUILDTYPE=debug, TEST_TYPE=.*, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=intel64, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=CRASHED.*, TEST_DESCRIPTION=`.``*`Assertion failure: size_t(p - cx->fp->slots) < cx->fp->script->nslots, at `.``*`jstracer.cpp:
 TEST_ID=js1_5/Regress/regress-454981.js, TEST_BRANCH=1.9.1, TEST_REPO=.*, TEST_BUILDTYPE=opt, TEST_TYPE=.*, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=intel64, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=TIMED OUT, TEST_DESCRIPTION=
 TEST_ID=js1_5/decompilation/regress-351219.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=.*, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=Decompilation of immutable infinity, NaN decompile Infinity as 1/0 reason: Expected value ' function ( ) { return 1 / 0 ; } ', Actual value ' function ( ) { return Infinity ; } '
 TEST_ID=js1_5/decompilation/regress-351219.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=.*, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=Decompilation of immutable infinity, NaN: decompile NaN as 0/0 reason: Expected value ' function ( ) { var NaN = 0 / 0 ; return NaN ; } ', Actual value ' function ( ) { var NaN = NaN ; return NaN ; } '
 TEST_ID=js1_5/decompilation/regress-352013.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=.*, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=decompilation of new parenthetic expressions reason: Expected value ' function ( ) { new ( x ( y ) ( z ) ) ; } ', Actual value ' function ( ) { new x ( y ) ( z ) ; } '
 TEST_ID=js1_5/decompilation/regress-352013.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=.*, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=decompilation of new parenthetic expressions reason: Expected value ' function ( ) { new ( x ( y ) . z ) ; } ', Actual value ' function ( ) { new x ( y ) . z ; } '
 TEST_ID=js1_5/decompilation/regress-352013.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=.*, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=decompilation of new parenthetic expressions reason: Expected value ' function ( ) { new ( x ( z ) ) ( w ) ; } ', Actual value ' function ( ) { new x ( z ) ( w ) ; } '
 TEST_ID=js1_5/decompilation/regress-352360.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=.*, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=Decompilation of negative 0 reason: Expected value ' function ( ) { return - 0 ; } ', Actual value ' function ( ) { return 0 ; } '
@@ -528,16 +533,19 @@ TEST_ID=js1_7/decompilation/regress-3557
 TEST_ID=js1_7/decompilation/regress-356247.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=.*, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=Decompilation of let {} = [1] in a loop: g : (function() { for(let x in []) let {} = [1]; }) reason: Expected value ' function ( ) { for ( let x in [ ] ) let [ ] = [ 1 ] ; } ', Actual value ' function ( ) { for ( let x in [ ] ) { let [ ] = [ 1 ] ; } } '
 TEST_ID=js1_7/decompilation/regress-356247.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=.*, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=Decompilation of let {} = [1] in a loop: g : (function() { while(0) let {} = [1]; }) reason: Expected value ' function ( ) { while ( 0 ) let [ ] = [ 1 ] ; } ', Actual value ' function ( ) { while ( 0 ) { let [ ] = [ 1 ] ; } } '
 TEST_ID=js1_7/decompilation/regress-375794.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=.*, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=Decompilation of array comprehension with catch guard reason: Expected value ' function ( ) { try { } catch ( a if [ b for each ( c in [ ] ) ] ) { } } ', Actual value ' function ( ) { try { } catch ( a if [ b for each ( [ ] in [ ] ) ] ) { } } '
 TEST_ID=js1_7/decompilation/regress-375794.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=.*, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=Decompilation of array comprehension with catch guard: compile actual reason: Expected value 'No Error', Actual value 'SyntaxError: invalid for/in left-hand side'
 TEST_ID=js1_7/decompilation/regress-380506.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=.*, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=Decompilation of nested-for and for-if comprehensions reason: Expected value ' function ( ) { return [ i * i for ( i in [ 0 ] ) if ( i % 2 ) ] ; } ', Actual value ' function ( ) { return [ i * i for ( i in [ 0 ] ) ] ; } '
 TEST_ID=js1_7/decompilation/regress-380506.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=.*, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=Decompilation of nested-for and for-if comprehensions reason: Expected value ' function ( ) { return [ i * j for ( i in [ 0 ] ) for ( j in [ 1 ] ) ] ; } ', Actual value ' function ( ) { return [ i * j for ( i in [ 0 ] ) ] ; } '
 TEST_ID=js1_7/decompilation/regress-381108.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=.*, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=decompilation of object literal should have space following : reason: Expected value 'true', Actual value 'false'
 TEST_ID=js1_7/decompilation/regress-429252.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=shell, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=trap should not change decompilation of { let x }: after trap reason: Expected value ' function f ( ) { { let x ; } } ', Actual value ' function f ( ) { { let x ; } let x ; } '
+TEST_ID=js1_7/expressions/regress-418051.js, TEST_BRANCH=1.9.0, TEST_REPO=CVS, TEST_BUILDTYPE=debug, TEST_TYPE=.*, TEST_OS=darwin, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=CRASHED.*, TEST_DESCRIPTION=`.``*`Assertion failure: (pnkey)->pn_arity == PN_NULLARY && ((pnkey)->pn_type == TOK_NUMBER || (pnkey)->pn_type == TOK_STRING || (pnkey)->pn_type == TOK_NAME), at `.``*`jsparse.c:
+TEST_ID=js1_7/expressions/regress-418051.js, TEST_BRANCH=1.9.0, TEST_REPO=CVS, TEST_BUILDTYPE=debug, TEST_TYPE=.*, TEST_OS=linux, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=CRASHED.*, TEST_DESCRIPTION=`.``*`Assertion failure: (pnkey)->pn_arity == PN_NULLARY && ((pnkey)->pn_type == TOK_NUMBER || (pnkey)->pn_type == TOK_STRING || (pnkey)->pn_type == TOK_NAME), at `.``*`jsparse.c:
+TEST_ID=js1_7/expressions/regress-418051.js, TEST_BRANCH=1.9.0, TEST_REPO=CVS, TEST_BUILDTYPE=debug, TEST_TYPE=.*, TEST_OS=nt, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=ABNORMAL, TEST_DESCRIPTION=;
 TEST_ID=js1_7/expressions/regress-421806.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=debug, TEST_TYPE=.*, TEST_OS=darwin, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=CRASHED.*, TEST_DESCRIPTION=`.``*`Assertion failure: !fp->blockChain || OBJ_GET_PARENT(cx, obj) == fp->blockChain, at `.``*`jsinterp.c:
 TEST_ID=js1_7/expressions/regress-421806.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=debug, TEST_TYPE=.*, TEST_OS=linux, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=CRASHED.*, TEST_DESCRIPTION=`.``*`Assertion failure: !fp->blockChain || OBJ_GET_PARENT(cx, obj) == fp->blockChain, at `.``*`jsinterp.c:
 TEST_ID=js1_7/expressions/regress-421806.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=debug, TEST_TYPE=.*, TEST_OS=nt, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=ABNORMAL.*, TEST_DESCRIPTION=
 TEST_ID=js1_7/extensions/regress-351102-04.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=debug, TEST_TYPE=.*, TEST_OS=darwin, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=CRASHED.*, TEST_DESCRIPTION=`.``*`Assertion failure: !fp->blockChain || OBJ_GET_PARENT(cx, obj) == fp->blockChain, at `.``*`jsinterp.c:
 TEST_ID=js1_7/extensions/regress-351102-04.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=debug, TEST_TYPE=.*, TEST_OS=linux, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=CRASHED.*, TEST_DESCRIPTION=`.``*`Assertion failure: !fp->blockChain || OBJ_GET_PARENT(cx, obj) == fp->blockChain, at `.``*`jsinterp.c:
 TEST_ID=js1_7/extensions/regress-351102-04.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=debug, TEST_TYPE=.*, TEST_OS=nt, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=ABNORMAL.*, TEST_DESCRIPTION=
 TEST_ID=js1_7/extensions/regress-351102-05.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=debug, TEST_TYPE=.*, TEST_OS=darwin, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=CRASHED.*, TEST_DESCRIPTION=`.``*`Assertion failure: !fp->blockChain || OBJ_GET_PARENT(cx, obj) == fp->blockChain, at `.``*`jsinterp.c:
 TEST_ID=js1_7/extensions/regress-351102-05.js, TEST_BRANCH=1.8.1, TEST_REPO=.*, TEST_BUILDTYPE=debug, TEST_TYPE=.*, TEST_OS=linux, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=CRASHED.*, TEST_DESCRIPTION=`.``*`Assertion failure: !fp->blockChain || OBJ_GET_PARENT(cx, obj) == fp->blockChain, at `.``*`jsinterp.c:
@@ -645,10 +653,10 @@ TEST_ID=js1_8_1/String/regress-305064.js
 TEST_ID=js1_8_1/String/regress-305064.js, TEST_BRANCH=1.9.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=.*, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=OGHAM SPACE MARK:"\u1680\u1680\u1680".trimRight() reason: Expected value '', Actual value '\u1680\u1680\u1680'
 TEST_ID=js1_8_1/String/regress-305064.js, TEST_BRANCH=1.9.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=.*, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=OGHAM SPACE MARK:"\u1680\u1680\u1680a".trim() reason: Expected value 'a', Actual value '\u1680\u1680\u1680a'
 TEST_ID=js1_8_1/String/regress-305064.js, TEST_BRANCH=1.9.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=.*, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=OGHAM SPACE MARK:"\u1680\u1680\u1680a".trimLeft() reason: Expected value 'a', Actual value '\u1680\u1680\u1680a'
 TEST_ID=js1_8_1/String/regress-305064.js, TEST_BRANCH=1.9.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=.*, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=OGHAM SPACE MARK:"\u1680\u1680\u1680a\u1680\u1680\u1680".trim() reason: Expected value 'a', Actual value '\u1680\u1680\u1680a\u1680\u1680\u1680'
 TEST_ID=js1_8_1/String/regress-305064.js, TEST_BRANCH=1.9.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=.*, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=OGHAM SPACE MARK:"\u1680\u1680\u1680a\u1680\u1680\u1680".trimLeft() reason: Expected value 'a\u1680\u1680\u1680', Actual value '\u1680\u1680\u1680a\u1680\u1680\u1680'
 TEST_ID=js1_8_1/String/regress-305064.js, TEST_BRANCH=1.9.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=.*, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=OGHAM SPACE MARK:"\u1680\u1680\u1680a\u1680\u1680\u1680".trimRight() reason: Expected value '\u1680\u1680\u1680a', Actual value '\u1680\u1680\u1680a\u1680\u1680\u1680'
 TEST_ID=js1_8_1/String/regress-305064.js, TEST_BRANCH=1.9.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=.*, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=OGHAM SPACE MARK:"a\u1680\u1680\u1680".trim() reason: Expected value 'a', Actual value 'a\u1680\u1680\u1680'
 TEST_ID=js1_8_1/String/regress-305064.js, TEST_BRANCH=1.9.1, TEST_REPO=.*, TEST_BUILDTYPE=.*, TEST_TYPE=.*, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=.*, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=NORMAL, TEST_DESCRIPTION=OGHAM SPACE MARK:"a\u1680\u1680\u1680".trimRight() reason: Expected value 'a', Actual value 'a\u1680\u1680\u1680'
-TEST_ID=js1_8_1/trace/trace-test.js, TEST_BRANCH=1.9.1, TEST_REPO=.*, TEST_BUILDTYPE=debug, TEST_TYPE=.*, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=intel64, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=CRASHED signal 6 SIGABRT, TEST_DESCRIPTION=`.``*`Assertion failure: size_t(p - cx->fp->slots) < cx->fp->script->nslots, at jstracer.cpp:
+TEST_ID=js1_8_1/trace/trace-test.js, TEST_BRANCH=1.9.1, TEST_REPO=.*, TEST_BUILDTYPE=debug, TEST_TYPE=.*, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=intel64, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=CRASHED signal 6 SIGABRT, TEST_DESCRIPTION=`.``*`Assertion failure: size_t(p - cx->fp->slots) < cx->fp->script->nslots, at `.``*`jstracer.cpp:
 TEST_ID=js1_8_1/trace/trace-test.js, TEST_BRANCH=1.9.1, TEST_REPO=.*, TEST_BUILDTYPE=opt, TEST_TYPE=.*, TEST_OS=.*, TEST_KERNEL=.*, TEST_PROCESSORTYPE=intel64, TEST_MEMORY=.*, TEST_CPUSPEED=.*, TEST_TIMEZONE=.*, TEST_RESULT=FAILED, TEST_EXITSTATUS=TIMED OUT, TEST_DESCRIPTION=
--- a/js/tests/universe.data
+++ b/js/tests/universe.data
@@ -1,38 +1,72 @@
+TEST_OS=darwin, TEST_KERNEL=8.11.0, TEST_PROCESSORTYPE=powerpc32, TEST_MEMORY=1, TEST_CPUSPEED=slow, TEST_TIMEZONE=-0400, TEST_BRANCH=1.8.1, TEST_REPO=CVS, TEST_BUILDTYPE=debug, TEST_TYPE=shell
+TEST_OS=darwin, TEST_KERNEL=8.11.0, TEST_PROCESSORTYPE=powerpc32, TEST_MEMORY=1, TEST_CPUSPEED=slow, TEST_TIMEZONE=-0400, TEST_BRANCH=1.8.1, TEST_REPO=CVS, TEST_BUILDTYPE=opt, TEST_TYPE=shell
+TEST_OS=darwin, TEST_KERNEL=8.11.0, TEST_PROCESSORTYPE=powerpc32, TEST_MEMORY=1, TEST_CPUSPEED=slow, TEST_TIMEZONE=-0400, TEST_BRANCH=1.9.0, TEST_REPO=CVS, TEST_BUILDTYPE=debug, TEST_TYPE=shell
+TEST_OS=darwin, TEST_KERNEL=8.11.0, TEST_PROCESSORTYPE=powerpc32, TEST_MEMORY=1, TEST_CPUSPEED=slow, TEST_TIMEZONE=-0400, TEST_BRANCH=1.9.0, TEST_REPO=CVS, TEST_BUILDTYPE=opt, TEST_TYPE=shell
+TEST_OS=darwin, TEST_KERNEL=8.11.0, TEST_PROCESSORTYPE=powerpc32, TEST_MEMORY=1, TEST_CPUSPEED=slow, TEST_TIMEZONE=-0400, TEST_BRANCH=1.9.1, TEST_REPO=mozilla-central, TEST_BUILDTYPE=debug, TEST_TYPE=shell
+TEST_OS=darwin, TEST_KERNEL=8.11.0, TEST_PROCESSORTYPE=powerpc32, TEST_MEMORY=1, TEST_CPUSPEED=slow, TEST_TIMEZONE=-0400, TEST_BRANCH=1.9.1, TEST_REPO=mozilla-central, TEST_BUILDTYPE=opt, TEST_TYPE=shell
 TEST_OS=darwin, TEST_KERNEL=8.11.0, TEST_PROCESSORTYPE=powerpc32, TEST_MEMORY=4, TEST_CPUSPEED=slow, TEST_TIMEZONE=-0700, TEST_BRANCH=1.8.1, TEST_REPO=CVS, TEST_BUILDTYPE=debug, TEST_TYPE=browser
+TEST_OS=darwin, TEST_KERNEL=8.11.0, TEST_PROCESSORTYPE=powerpc32, TEST_MEMORY=4, TEST_CPUSPEED=slow, TEST_TIMEZONE=-0700, TEST_BRANCH=1.8.1, TEST_REPO=CVS, TEST_BUILDTYPE=debug, TEST_TYPE=shell
 TEST_OS=darwin, TEST_KERNEL=8.11.0, TEST_PROCESSORTYPE=powerpc32, TEST_MEMORY=4, TEST_CPUSPEED=slow, TEST_TIMEZONE=-0700, TEST_BRANCH=1.8.1, TEST_REPO=CVS, TEST_BUILDTYPE=opt, TEST_TYPE=browser
+TEST_OS=darwin, TEST_KERNEL=8.11.0, TEST_PROCESSORTYPE=powerpc32, TEST_MEMORY=4, TEST_CPUSPEED=slow, TEST_TIMEZONE=-0700, TEST_BRANCH=1.8.1, TEST_REPO=CVS, TEST_BUILDTYPE=opt, TEST_TYPE=shell
 TEST_OS=darwin, TEST_KERNEL=8.11.0, TEST_PROCESSORTYPE=powerpc32, TEST_MEMORY=4, TEST_CPUSPEED=slow, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.0, TEST_REPO=CVS, TEST_BUILDTYPE=debug, TEST_TYPE=browser
+TEST_OS=darwin, TEST_KERNEL=8.11.0, TEST_PROCESSORTYPE=powerpc32, TEST_MEMORY=4, TEST_CPUSPEED=slow, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.0, TEST_REPO=CVS, TEST_BUILDTYPE=debug, TEST_TYPE=shell
 TEST_OS=darwin, TEST_KERNEL=8.11.0, TEST_PROCESSORTYPE=powerpc32, TEST_MEMORY=4, TEST_CPUSPEED=slow, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.0, TEST_REPO=CVS, TEST_BUILDTYPE=opt, TEST_TYPE=browser
+TEST_OS=darwin, TEST_KERNEL=8.11.0, TEST_PROCESSORTYPE=powerpc32, TEST_MEMORY=4, TEST_CPUSPEED=slow, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.0, TEST_REPO=CVS, TEST_BUILDTYPE=opt, TEST_TYPE=shell
+TEST_OS=darwin, TEST_KERNEL=9.5.0, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=4, TEST_CPUSPEED=medium, TEST_TIMEZONE=-0700, TEST_BRANCH=1.8.1, TEST_REPO=CVS, TEST_BUILDTYPE=debug, TEST_TYPE=browser
 TEST_OS=darwin, TEST_KERNEL=9.5.0, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=4, TEST_CPUSPEED=medium, TEST_TIMEZONE=-0700, TEST_BRANCH=1.8.1, TEST_REPO=CVS, TEST_BUILDTYPE=debug, TEST_TYPE=shell
+TEST_OS=darwin, TEST_KERNEL=9.5.0, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=4, TEST_CPUSPEED=medium, TEST_TIMEZONE=-0700, TEST_BRANCH=1.8.1, TEST_REPO=CVS, TEST_BUILDTYPE=opt, TEST_TYPE=browser
 TEST_OS=darwin, TEST_KERNEL=9.5.0, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=4, TEST_CPUSPEED=medium, TEST_TIMEZONE=-0700, TEST_BRANCH=1.8.1, TEST_REPO=CVS, TEST_BUILDTYPE=opt, TEST_TYPE=shell
+TEST_OS=darwin, TEST_KERNEL=9.5.0, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=4, TEST_CPUSPEED=medium, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.0, TEST_REPO=CVS, TEST_BUILDTYPE=debug, TEST_TYPE=browser
 TEST_OS=darwin, TEST_KERNEL=9.5.0, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=4, TEST_CPUSPEED=medium, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.0, TEST_REPO=CVS, TEST_BUILDTYPE=debug, TEST_TYPE=shell
+TEST_OS=darwin, TEST_KERNEL=9.5.0, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=4, TEST_CPUSPEED=medium, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.0, TEST_REPO=CVS, TEST_BUILDTYPE=opt, TEST_TYPE=browser
 TEST_OS=darwin, TEST_KERNEL=9.5.0, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=4, TEST_CPUSPEED=medium, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.0, TEST_REPO=CVS, TEST_BUILDTYPE=opt, TEST_TYPE=shell
+TEST_OS=darwin, TEST_KERNEL=9.5.0, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=4, TEST_CPUSPEED=medium, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.1, TEST_REPO=mozilla-central, TEST_BUILDTYPE=debug, TEST_TYPE=browser
 TEST_OS=darwin, TEST_KERNEL=9.5.0, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=4, TEST_CPUSPEED=medium, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.1, TEST_REPO=mozilla-central, TEST_BUILDTYPE=debug, TEST_TYPE=shell
+TEST_OS=darwin, TEST_KERNEL=9.5.0, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=4, TEST_CPUSPEED=medium, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.1, TEST_REPO=mozilla-central, TEST_BUILDTYPE=opt, TEST_TYPE=browser
 TEST_OS=darwin, TEST_KERNEL=9.5.0, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=4, TEST_CPUSPEED=medium, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.1, TEST_REPO=mozilla-central, TEST_BUILDTYPE=opt, TEST_TYPE=shell
 TEST_OS=linux, TEST_KERNEL=2.6.18, TEST_PROCESSORTYPE=amd32, TEST_MEMORY=4, TEST_CPUSPEED=slow, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.0, TEST_REPO=CVS, TEST_BUILDTYPE=debug, TEST_TYPE=browser
+TEST_OS=linux, TEST_KERNEL=2.6.18, TEST_PROCESSORTYPE=amd32, TEST_MEMORY=4, TEST_CPUSPEED=slow, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.0, TEST_REPO=CVS, TEST_BUILDTYPE=debug, TEST_TYPE=shell
 TEST_OS=linux, TEST_KERNEL=2.6.18, TEST_PROCESSORTYPE=amd32, TEST_MEMORY=4, TEST_CPUSPEED=slow, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.0, TEST_REPO=CVS, TEST_BUILDTYPE=opt, TEST_TYPE=browser
+TEST_OS=linux, TEST_KERNEL=2.6.18, TEST_PROCESSORTYPE=amd32, TEST_MEMORY=4, TEST_CPUSPEED=slow, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.0, TEST_REPO=CVS, TEST_BUILDTYPE=opt, TEST_TYPE=shell
+TEST_OS=linux, TEST_KERNEL=2.6.18, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=4, TEST_CPUSPEED=medium, TEST_TIMEZONE=-0700, TEST_BRANCH=1.8.1, TEST_REPO=CVS, TEST_BUILDTYPE=debug, TEST_TYPE=shell
+TEST_OS=linux, TEST_KERNEL=2.6.18, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=4, TEST_CPUSPEED=medium, TEST_TIMEZONE=-0700, TEST_BRANCH=1.8.1, TEST_REPO=CVS, TEST_BUILDTYPE=opt, TEST_TYPE=browser
+TEST_OS=linux, TEST_KERNEL=2.6.18, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=4, TEST_CPUSPEED=medium, TEST_TIMEZONE=-0700, TEST_BRANCH=1.8.1, TEST_REPO=CVS, TEST_BUILDTYPE=opt, TEST_TYPE=shell
 TEST_OS=linux, TEST_KERNEL=2.6.18, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=4, TEST_CPUSPEED=medium, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.0, TEST_REPO=CVS, TEST_BUILDTYPE=debug, TEST_TYPE=shell
 TEST_OS=linux, TEST_KERNEL=2.6.18, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=4, TEST_CPUSPEED=medium, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.0, TEST_REPO=CVS, TEST_BUILDTYPE=opt, TEST_TYPE=shell
+TEST_OS=linux, TEST_KERNEL=2.6.18, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=4, TEST_CPUSPEED=medium, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.1, TEST_REPO=mozilla-central, TEST_BUILDTYPE=debug, TEST_TYPE=browser
+TEST_OS=linux, TEST_KERNEL=2.6.18, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=4, TEST_CPUSPEED=medium, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.1, TEST_REPO=mozilla-central, TEST_BUILDTYPE=debug, TEST_TYPE=shell
+TEST_OS=linux, TEST_KERNEL=2.6.18, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=4, TEST_CPUSPEED=medium, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.1, TEST_REPO=mozilla-central, TEST_BUILDTYPE=opt, TEST_TYPE=browser
+TEST_OS=linux, TEST_KERNEL=2.6.18, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=4, TEST_CPUSPEED=medium, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.1, TEST_REPO=mozilla-central, TEST_BUILDTYPE=opt, TEST_TYPE=shell
 TEST_OS=linux, TEST_KERNEL=2.6.18, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=4, TEST_CPUSPEED=medium, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.1, TEST_REPO=tracemonkey, TEST_BUILDTYPE=debug, TEST_TYPE=shell
 TEST_OS=linux, TEST_KERNEL=2.6.18, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=4, TEST_CPUSPEED=medium, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.1, TEST_REPO=tracemonkey, TEST_BUILDTYPE=opt, TEST_TYPE=shell
 TEST_OS=linux, TEST_KERNEL=2.6.18, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=4, TEST_CPUSPEED=slow, TEST_TIMEZONE=-0700, TEST_BRANCH=1.8.1, TEST_REPO=CVS, TEST_BUILDTYPE=debug, TEST_TYPE=shell
+TEST_OS=linux, TEST_KERNEL=2.6.18, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=4, TEST_CPUSPEED=slow, TEST_TIMEZONE=-0700, TEST_BRANCH=1.8.1, TEST_REPO=CVS, TEST_BUILDTYPE=opt, TEST_TYPE=browser
 TEST_OS=linux, TEST_KERNEL=2.6.18, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=4, TEST_CPUSPEED=slow, TEST_TIMEZONE=-0700, TEST_BRANCH=1.8.1, TEST_REPO=CVS, TEST_BUILDTYPE=opt, TEST_TYPE=shell
+TEST_OS=linux, TEST_KERNEL=2.6.18, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=4, TEST_CPUSPEED=slow, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.0, TEST_REPO=CVS, TEST_BUILDTYPE=debug, TEST_TYPE=browser
 TEST_OS=linux, TEST_KERNEL=2.6.18, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=4, TEST_CPUSPEED=slow, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.0, TEST_REPO=CVS, TEST_BUILDTYPE=debug, TEST_TYPE=shell
+TEST_OS=linux, TEST_KERNEL=2.6.18, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=4, TEST_CPUSPEED=slow, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.0, TEST_REPO=CVS, TEST_BUILDTYPE=opt, TEST_TYPE=browser
 TEST_OS=linux, TEST_KERNEL=2.6.18, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=4, TEST_CPUSPEED=slow, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.0, TEST_REPO=CVS, TEST_BUILDTYPE=opt, TEST_TYPE=shell
+TEST_OS=linux, TEST_KERNEL=2.6.18, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=4, TEST_CPUSPEED=slow, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.1, TEST_REPO=mozilla-central, TEST_BUILDTYPE=debug, TEST_TYPE=browser
 TEST_OS=linux, TEST_KERNEL=2.6.18, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=4, TEST_CPUSPEED=slow, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.1, TEST_REPO=mozilla-central, TEST_BUILDTYPE=debug, TEST_TYPE=shell
+TEST_OS=linux, TEST_KERNEL=2.6.18, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=4, TEST_CPUSPEED=slow, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.1, TEST_REPO=mozilla-central, TEST_BUILDTYPE=opt, TEST_TYPE=browser
 TEST_OS=linux, TEST_KERNEL=2.6.18, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=4, TEST_CPUSPEED=slow, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.1, TEST_REPO=mozilla-central, TEST_BUILDTYPE=opt, TEST_TYPE=shell
 TEST_OS=linux, TEST_KERNEL=2.6.18, TEST_PROCESSORTYPE=intel64, TEST_MEMORY=4, TEST_CPUSPEED=fast, TEST_TIMEZONE=-0700, TEST_BRANCH=1.8.1, TEST_REPO=CVS, TEST_BUILDTYPE=debug, TEST_TYPE=shell
+TEST_OS=linux, TEST_KERNEL=2.6.18, TEST_PROCESSORTYPE=intel64, TEST_MEMORY=4, TEST_CPUSPEED=fast, TEST_TIMEZONE=-0700, TEST_BRANCH=1.8.1, TEST_REPO=CVS, TEST_BUILDTYPE=opt, TEST_TYPE=browser
 TEST_OS=linux, TEST_KERNEL=2.6.18, TEST_PROCESSORTYPE=intel64, TEST_MEMORY=4, TEST_CPUSPEED=fast, TEST_TIMEZONE=-0700, TEST_BRANCH=1.8.1, TEST_REPO=CVS, TEST_BUILDTYPE=opt, TEST_TYPE=shell
 TEST_OS=linux, TEST_KERNEL=2.6.18, TEST_PROCESSORTYPE=intel64, TEST_MEMORY=4, TEST_CPUSPEED=fast, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.0, TEST_REPO=CVS, TEST_BUILDTYPE=debug, TEST_TYPE=shell
 TEST_OS=linux, TEST_KERNEL=2.6.18, TEST_PROCESSORTYPE=intel64, TEST_MEMORY=4, TEST_CPUSPEED=fast, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.0, TEST_REPO=CVS, TEST_BUILDTYPE=opt, TEST_TYPE=shell
 TEST_OS=linux, TEST_KERNEL=2.6.18, TEST_PROCESSORTYPE=intel64, TEST_MEMORY=4, TEST_CPUSPEED=fast, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.1, TEST_REPO=mozilla-central, TEST_BUILDTYPE=debug, TEST_TYPE=shell
 TEST_OS=linux, TEST_KERNEL=2.6.18, TEST_PROCESSORTYPE=intel64, TEST_MEMORY=4, TEST_CPUSPEED=fast, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.1, TEST_REPO=mozilla-central, TEST_BUILDTYPE=opt, TEST_TYPE=shell
 TEST_OS=nt, TEST_KERNEL=5.1, TEST_PROCESSORTYPE=amd32, TEST_MEMORY=2, TEST_CPUSPEED=medium, TEST_TIMEZONE=-0700, TEST_BRANCH=1.8.1, TEST_REPO=CVS, TEST_BUILDTYPE=debug, TEST_TYPE=browser
+TEST_OS=nt, TEST_KERNEL=5.1, TEST_PROCESSORTYPE=amd32, TEST_MEMORY=2, TEST_CPUSPEED=medium, TEST_TIMEZONE=-0700, TEST_BRANCH=1.8.1, TEST_REPO=CVS, TEST_BUILDTYPE=debug, TEST_TYPE=shell
 TEST_OS=nt, TEST_KERNEL=5.1, TEST_PROCESSORTYPE=amd32, TEST_MEMORY=2, TEST_CPUSPEED=medium, TEST_TIMEZONE=-0700, TEST_BRANCH=1.8.1, TEST_REPO=CVS, TEST_BUILDTYPE=opt, TEST_TYPE=browser
 TEST_OS=nt, TEST_KERNEL=5.1, TEST_PROCESSORTYPE=amd32, TEST_MEMORY=2, TEST_CPUSPEED=medium, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.0, TEST_REPO=CVS, TEST_BUILDTYPE=debug, TEST_TYPE=browser
+TEST_OS=nt, TEST_KERNEL=5.1, TEST_PROCESSORTYPE=amd32, TEST_MEMORY=2, TEST_CPUSPEED=medium, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.0, TEST_REPO=CVS, TEST_BUILDTYPE=debug, TEST_TYPE=shell
 TEST_OS=nt, TEST_KERNEL=5.1, TEST_PROCESSORTYPE=amd32, TEST_MEMORY=2, TEST_CPUSPEED=medium, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.0, TEST_REPO=CVS, TEST_BUILDTYPE=opt, TEST_TYPE=browser
+TEST_OS=nt, TEST_KERNEL=5.1, TEST_PROCESSORTYPE=amd32, TEST_MEMORY=2, TEST_CPUSPEED=medium, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.0, TEST_REPO=CVS, TEST_BUILDTYPE=opt, TEST_TYPE=shell
 TEST_OS=nt, TEST_KERNEL=5.1, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=2, TEST_CPUSPEED=fast, TEST_TIMEZONE=-0700, TEST_BRANCH=1.8.1, TEST_REPO=CVS, TEST_BUILDTYPE=debug, TEST_TYPE=shell
 TEST_OS=nt, TEST_KERNEL=5.1, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=2, TEST_CPUSPEED=fast, TEST_TIMEZONE=-0700, TEST_BRANCH=1.8.1, TEST_REPO=CVS, TEST_BUILDTYPE=opt, TEST_TYPE=shell
 TEST_OS=nt, TEST_KERNEL=5.1, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=2, TEST_CPUSPEED=fast, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.0, TEST_REPO=CVS, TEST_BUILDTYPE=debug, TEST_TYPE=shell
 TEST_OS=nt, TEST_KERNEL=5.1, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=2, TEST_CPUSPEED=fast, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.0, TEST_REPO=CVS, TEST_BUILDTYPE=opt, TEST_TYPE=shell
 TEST_OS=nt, TEST_KERNEL=5.1, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=2, TEST_CPUSPEED=fast, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.1, TEST_REPO=mozilla-central, TEST_BUILDTYPE=debug, TEST_TYPE=shell
 TEST_OS=nt, TEST_KERNEL=5.1, TEST_PROCESSORTYPE=intel32, TEST_MEMORY=2, TEST_CPUSPEED=fast, TEST_TIMEZONE=-0700, TEST_BRANCH=1.9.1, TEST_REPO=mozilla-central, TEST_BUILDTYPE=opt, TEST_TYPE=shell
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -1085,42 +1085,34 @@ nsDisplayTransform::GetResultingTransfor
 
 /* Painting applies the transform, paints the sublist, then unapplies
  * the transform.
  */
 void nsDisplayTransform::Paint(nsDisplayListBuilder *aBuilder,
                                nsIRenderingContext *aCtx,
                                const nsRect &aDirtyRect)
 {
-  /* Here's how this is going to work:
-   * 1. Convert the stored transform matrix into a gfxMatrix
-   * 2. Read out the old graphics matrix.
-   * 3. Compute the net graphics matrix at this point.
-   * 4. Set that as the active matrix.
-   * 5. Apply the inverse transform to the dirty rect so that children think
-   *    they're drawing in local space.
-   * 6. Render everything.
-   * 7. Reset the matrix.
+  /* Get the local transform matrix with which we'll transform all wrapped
+   * elements.  If this matrix is singular, we shouldn't display anything
+   * and can abort.
    */
+  gfxMatrix newTransformMatrix =
+    GetResultingTransformMatrix(mFrame, aBuilder->ToReferenceFrame(mFrame),
+                                 mFrame->PresContext()->AppUnitsPerDevPixel(),
+                                nsnull);
+  if (newTransformMatrix.IsSingular())
+    return;
+
   /* Get the context and automatically save and restore it. */
   gfxContext* gfx = aCtx->ThebesContext();
   gfxContextAutoSaveRestore autoRestorer(gfx);
 
-  /* Unit conversion is based on the local presentation context. */
-  float factor = mFrame->PresContext()->AppUnitsPerDevPixel();
-
-  /* Compute the new matrix by taking the old matrix and multiplying the
-   * transform matrix of this frame only.  The new transform is prepended to
-   * the old transform, since that way, if we have several stacked transforms,
-   * the innermost transform is applied first.
+  /* Get the new CTM by applying this transform after all of the
+   * transforms preceding it.
    */
-  gfxMatrix newTransformMatrix =
-    GetResultingTransformMatrix(mFrame, aBuilder->ToReferenceFrame(mFrame),
-                                factor, nsnull);
-
   newTransformMatrix.Multiply(gfx->CurrentMatrix());
 
   /* Set the matrix for the transform based on the old matrix and the new
    * transform data.
    */
   gfx->SetMatrix(newTransformMatrix);
 
   /* Now, send the paint call down.  As we do this, we need to be sure to
--- a/layout/generic/nsObjectFrame.cpp
+++ b/layout/generic/nsObjectFrame.cpp
@@ -1805,24 +1805,27 @@ MatchPluginName(nsPluginInstanceOwner *a
                  aPluginName,
                  strlen(aPluginName)) == 0;
 }
 
 static PRBool
 DoDelayedStop(nsPluginInstanceOwner *aInstanceOwner, PRBool aDelayedStop)
 {
   // Don't delay stopping QuickTime (bug 425157), Flip4Mac (bug 426524),
-  // XStandard (bug 430219), CMISS Zinc (bug 429604).
+  // XStandard (bug 430219), CMISS Zinc (bug 429604). ARM Flash (454756)
   if (aDelayedStop
 #ifndef XP_WIN
       && !::MatchPluginName(aInstanceOwner, "QuickTime")
       && !::MatchPluginName(aInstanceOwner, "Flip4Mac")
       && !::MatchPluginName(aInstanceOwner, "XStandard plugin")
       && !::MatchPluginName(aInstanceOwner, "CMISS Zinc Plugin")
 #endif
+#if defined(XP_UNIX) && defined(__arm__)
+      && !::MatchPluginName(aInstanceOwner, "Shockwave Flash")
+#endif
       ) {
     nsCOMPtr<nsIRunnable> evt = new nsStopPluginRunnable(aInstanceOwner);
     NS_DispatchToCurrentThread(evt);
     return PR_TRUE;
   }
   return PR_FALSE;
 }
 
--- a/layout/reftests/reftest-sanity/reftest.list
+++ b/layout/reftests/reftest-sanity/reftest.list
@@ -1,17 +1,18 @@
 == data:text/html,<body> about:blank
 == data:text/plain, about:blank
 != data:text/plain,HELLO about:blank
 
 # these tests make sure async reftests work:
-== test-async.xul test-async-ref.xul
+== test-async.xul test-async-ref.xul
 == test-async.html test-async-ref.html
 
-# This makes sure that the harness is choosing HTML vs. XHTML processing
-# based on the file extensions.
+# Makes sure that the file: protocol handler and HTTP server both
+# choose HTML vs. XHTML processing based on the file extensions.
 != html-vs-xhtml-by-extension.html html-vs-xhtml-by-extension.xhtml
+HTTP != html-vs-xhtml-by-extension.html html-vs-xhtml-by-extension.xhtml
 
 # make sure red and green colors are not the default and are different from
 # each other
 != green.html default.html
 != green.html red.html
 != red.html default.html
new file mode 100644
--- /dev/null
+++ b/layout/reftests/svg/mask-transformed-01-ref.svg
@@ -0,0 +1,8 @@
+<!--
+     Any copyright is dedicated to the Public Domain.
+     http://creativecommons.org/licenses/publicdomain/
+-->
+<svg xmlns="http://www.w3.org/2000/svg" width="400" height="400">
+  <rect width="50%" height="50%" fill="lime"/>
+</svg>
+
new file mode 100644
--- /dev/null
+++ b/layout/reftests/svg/mask-transformed-01.svg
@@ -0,0 +1,17 @@
+<!--
+     Any copyright is dedicated to the Public Domain.
+     http://creativecommons.org/licenses/publicdomain/
+-->
+<svg xmlns="http://www.w3.org/2000/svg" width="400" height="400">
+  <defs>
+    <mask id="m1" maskUnits="objectBoundingBox" maskContentUnits="objectBoundingBox">
+      <rect x="0" y="0" width="1" height="1" fill="white"/>
+    </mask>
+  </defs>
+  <foreignObject width="100%" height="100%" transform="scale(0.5)">
+    <svg style="width:100%; height:100%;">
+      <rect width="100%" height="100%" fill="lime" mask="url(#m1)"/>
+    </svg>
+  </foreignObject>
+</svg>
+
--- a/layout/reftests/svg/reftest.list
+++ b/layout/reftests/svg/reftest.list
@@ -47,16 +47,18 @@ include moz-only/reftest.list
 == foreignObject-overflow-01.svg pass.svg
 == getElementById-a-element-01.svg pass.svg
 fails == inline-in-xul-basic-01.xul pass.svg
 == image-scaling-01.svg pass.svg
 == image-scaling-02.svg pass.svg
 == invalid-text-01.svg pass.svg
 == linearGradient-basic-01.svg pass.svg
 == linearGradient-basic-02.svg pass.svg
+# Bug 456323
+# == mask-transformed-01.svg mask-transformed-01-ref.svg
 == nested-viewBox-01.svg pass.svg
 == objectBoundingBox-and-pattern-01a.svg objectBoundingBox-and-pattern-01-ref.svg
 == objectBoundingBox-and-pattern-01b.svg objectBoundingBox-and-pattern-01-ref.svg
 == objectBoundingBox-and-pattern-01c.svg objectBoundingBox-and-pattern-01-ref.svg
 # skip the next test on cocoa, since behaviour depends on the -minor- version of the 10.4 OS.
 # See bugs 379610 and 432298.
 random-if(MOZ_WIDGET_TOOLKIT=="cocoa") == opacity-and-gradient-01.svg pass.svg
 == opacity-and-pattern-01.svg pass.svg
--- a/layout/reftests/transform/reftest.list
+++ b/layout/reftests/transform/reftest.list
@@ -1,59 +1,67 @@
+# Transforms specifying singular matrices shouldn't display at all.
+# NOTE: Regressions might manifest themselves as reftest timeouts on
+# this test.
+== singular-1a.html about:blank
 # Multiple transforms should act identically to nested divs.
 == compound-1a.html compound-1-ref.html
 != compound-1a.html compound-1-fail.html
 # translatex should act like position: relative
 == translatex-1a.html translatex-1-ref.html
-random == translatex-1b.html translatex-1-ref.html # bug 455138
+== translatex-1b.html translatex-1-ref.html
 == translatex-1c.html translatex-1-ref.html
 == translatex-1d.html translatex-1-ref.html
 == translatex-1e.html translatex-1-ref.html
 == translatex-1a.html translatex-1-ref-2.html
 # translatey should act like position: relative
 == translatey-1a.html translatey-1-ref.html
-random == translatey-1b.html translatey-1-ref.html # bug 455138
+== translatey-1b.html translatey-1-ref.html
 == translatey-1c.html translatey-1-ref.html
 == translatey-1d.html translatey-1-ref.html
 == translatey-1e.html translatey-1-ref.html
 # matrices defined to be translations should act like position: relative
 == translatex-2.html translatex-1-ref.html
 == translatey-2.html translatey-1-ref.html
 # translate should act like position: relative
 != translate-1a.html translate-1-ref.html
-random == translate-1b.html translate-1-ref.html # bug 455138
+== translate-1b.html translate-1-ref.html
 == translate-1c.html translate-1-ref.html
 == translate-1d.html translate-1-ref.html
 == translate-1e.html translate-1-ref.html
 == translate-2a.html translate-2-ref.html
-# rotate: Several rotations of the same object should be idempotent
-== rotate-1a.html rotate-1-ref.html
-== rotate-1b.html rotate-1-ref.html
-== rotate-1c.html rotate-1-ref.html
-== rotate-1d.html rotate-1-ref.html
-== rotate-1e.html rotate-1-ref.html
-# rotate: 90deg rotations should be indistinguishable from objects constructed to look the same.
+# rotate: Several rotations of the same object should be idempotent.  These
+# tests are currently disabled because of subpixel (< 0.00001 gfx units)
+# rounding errors.
+random == rotate-1a.html rotate-1-ref.html
+random == rotate-1b.html rotate-1-ref.html
+random == rotate-1c.html rotate-1-ref.html
+random == rotate-1d.html rotate-1-ref.html
+random == rotate-1e.html rotate-1-ref.html
+# rotate: 90deg rotations should be indistinguishable from objects constructed
+# to look the same.
 == rotate-2a.html rotate-2-ref.html
-# -moz-transform-origin: We should NOT get the same images when using different -moz-transform-origins.
+# -moz-transform-origin: We should NOT get the same images when using different
+# -moz-transform-origins.
 != origin-1a.html origin-1-ref.html
 != origin-1b.html origin-1-ref.html
-# -moz-transform-origin: We should get the same images when using equivalent -moz-transform-origins.
+# -moz-transform-origin: We should get the same images when using equivalent
+# -moz-transform-origins.
 == origin-2a.html origin-2-ref.html
 == origin-2b.html origin-2-ref.html
 == origin-2c.html origin-2-ref.html
 # "Translate" with percentages should be indistinguishable from translate with
-# equivalent values.  This entire family of reftests has subpixel rounding
-# errors, however, and so they're marked "random" until a resolution is found.
-random == percent-1a.html percent-1-ref.html
-random == percent-1b.html percent-1-ref.html
-random == percent-1c.html percent-1-ref.html
-random == percent-1d.html percent-1-ref.html # bug 455138
-random == percent-1e.html percent-1-ref.html # bug 455138
-random == percent-1f.html percent-1-ref.html # bug 455138
-random == percent-1g.html percent-1-ref.html
+# equivalent values.
+== percent-1a.html percent-1-ref.html
+== percent-1b.html percent-1-ref.html
+== percent-1c.html percent-1-ref.html
+== percent-1d.html percent-1-ref.html
+== percent-1e.html percent-1-ref.html
+== percent-1f.html percent-1-ref.html
+== percent-1g.html percent-1-ref.html
 # Transformed elements are abs-pos and fixed-pos containing blocks.
 == abspos-1a.html abspos-1-ref.html
 == abspos-1b.html abspos-1-ref.html
 == abspos-1c.html abspos-1-ref.html
 == abspos-1d.html abspos-1-ref.html
 != abspos-1e.html abspos-1-ref.html
 # Origin can use "top" "right" etc.
 == origin-name-1a.html origin-name-1-ref.html
--- a/layout/reftests/transform/rotate-1-ref.html
+++ b/layout/reftests/transform/rotate-1-ref.html
@@ -1,9 +1,9 @@
 <html>
 <head>
 </head>
 <body>
-  <div style="-moz-transform: rotate(45deg);">
+  <div style="-moz-transform: rotate(45deg); width: 100px; height: 100px;">
     Test Text
   </div>
 </body>
 </html>
--- a/layout/reftests/transform/rotate-1a.html
+++ b/layout/reftests/transform/rotate-1a.html
@@ -1,9 +1,9 @@
 <html>
 <head>
 </head>
 <body>
-  <div style="-moz-transform: rotate(45deg) rotate(360deg);">
+  <div style="-moz-transform: rotate(45deg) rotate(360deg); width: 100px; height: 100px;">
     Test Text
   </div>
 </body>
 </html>
--- a/layout/reftests/transform/rotate-1b.html
+++ b/layout/reftests/transform/rotate-1b.html
@@ -1,9 +1,9 @@
 <html>
 <head>
 </head>
 <body>
-  <div style="-moz-transform: rotate(45deg) rotate(400grad);">
+  <div style="-moz-transform: rotate(45deg) rotate(400grad); width: 100px; height: 100px;">
     Test Text
   </div>
 </body>
 </html>
--- a/layout/reftests/transform/rotate-1c.html
+++ b/layout/reftests/transform/rotate-1c.html
@@ -1,9 +1,9 @@
 <html>
 <head>
 </head>
 <body>
-  <div style="-moz-transform: rotate(45deg) rotate(100deg) rotate(80deg) rotate(200grad);">
+  <div style="-moz-transform: rotate(45deg) rotate(100deg) rotate(80deg) rotate(200grad); width: 100px; height: 100px;">
     Test Text
   </div>
 </body>
 </html>
--- a/layout/reftests/transform/rotate-1d.html
+++ b/layout/reftests/transform/rotate-1d.html
@@ -1,9 +1,9 @@
 <html>
 <head>
 </head>
 <body>
-  <div style="-moz-transform: rotate(-45deg) rotate(100grad);">
+  <div style="-moz-transform: rotate(-45deg) rotate(100grad); width: 100px; height: 100px;">
     Test Text
   </div>
 </body>
 </html>
--- a/layout/reftests/transform/rotate-1e.html
+++ b/layout/reftests/transform/rotate-1e.html
@@ -1,9 +1,9 @@
 <html>
 <head>
 </head>
 <body>
-  <div style="-moz-transform: rotate(-135deg) rotate(3.1415926535897932384626433rad);">
+  <div style="-moz-transform: rotate(-135deg) rotate(3.1415926535897932384626433rad); width: 100px; height: 100px;">
     Test Text
   </div>
 </body>
 </html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/transform/singular-1a.html
@@ -0,0 +1,9 @@
+<html>
+<head>
+</head>
+<body>
+  <div style="-moz-transform: matrix(1, 1, 1, 1, 0, 0); width: 100px; height: 100px; background-color: gold;">
+    This shouldn't be visible.
+  </div>
+</body>
+</html>
--- a/layout/reftests/transform/translate-1b.html
+++ b/layout/reftests/transform/translate-1b.html
@@ -1,9 +1,9 @@
 <html>
 <head>
 </head>
 <body>
-  <div style="-moz-transform: translate(50px) rotate(360deg);">
+  <div style="-moz-transform: translate(50px, 50px) rotate(360deg);">
     Test Text
   </div>
 </body>
 </html>
--- a/layout/style/nsStyleTransformMatrix.cpp
+++ b/layout/style/nsStyleTransformMatrix.cpp
@@ -43,17 +43,18 @@
 #include "nsCSSValue.h"
 #include "nsStyleContext.h"
 #include "nsPresContext.h"
 #include "nsRuleNode.h"
 #include "nsCSSKeywords.h"
 #include <math.h>
 
 /* Arguably, this loses precision, but it doesn't hurt! */
-const float kPi = 3.1415926535897932384626433f;
+const float kPi      = 3.1415926535897932384626433832795f;
+const float kTwoPi   = 6.283185307179586476925286766559f;
 const float kEpsilon = 0.0001f;
 
 /* Computes tan(theta).  For values of theta such that
  * tan(theta) is undefined or arbitrarily large, SafeTangent
  * returns a managably large or small value of the correct sign.
  */
 static float SafeTangent(float aTheta)
 {
@@ -68,34 +69,48 @@ static float SafeTangent(float aTheta)
   if (cosTheta >= 0 && cosTheta < kEpsilon)
     cosTheta = kEpsilon;
   else if (cosTheta < 0 && cosTheta >= -kEpsilon)
     cosTheta = -kEpsilon;
   
   return sinTheta / cosTheta;
 }
 
+/* Helper function to constrain an angle to a value in the range [-pi, pi),
+ * which reduces accumulated floating point errors from trigonometric functions
+ * by keeping the error terms small.
+ */
+static inline float ConstrainFloatValue(float aValue)
+{
+  /* Get in range [0, 2pi) */
+  aValue = fmod(aValue, kTwoPi);
+  return aValue >= kPi ? aValue - kTwoPi : aValue;
+}
+
 /* Converts an nsCSSValue containing an angle into an equivalent measure
- * of radians.
+ * of radians.  The value is guaranteed to be in the range (-pi, pi) to
+ * minimize error.
  */
 static float CSSToRadians(const nsCSSValue &aValue)
 {
   NS_PRECONDITION(aValue.IsAngularUnit(),
                   "Expected an angle, but didn't find one!");
   
   switch (aValue.GetUnit()) {
   case eCSSUnit_Degree:
     /* 360deg = 2pi rad, so deg = pi / 180 rad */
-    return aValue.GetFloatValue() * kPi / 180.0f;
+    return
+      ConstrainFloatValue(aValue.GetFloatValue() * kPi / 180.0f);
   case eCSSUnit_Grad:
     /* 400grad = 2pi rad, so grad = pi / 200 rad */
-    return aValue.GetFloatValue() * kPi / 200.0f;
+    return
+      ConstrainFloatValue(aValue.GetFloatValue() * kPi / 200.0f);
   case eCSSUnit_Radian:
     /* Yay identity transforms! */
-    return aValue.GetFloatValue();
+    return ConstrainFloatValue(aValue.GetFloatValue());
   default:
     NS_NOTREACHED("Unexpected angular unit!");
     return 0.0f;
   }
 }
 
 /* Constructor sets the data to the identity matrix. */
 nsStyleTransformMatrix::nsStyleTransformMatrix()
@@ -119,39 +134,40 @@ void nsStyleTransformMatrix::SetToIdenti
   mX[1] = 0.0f;
   mY[0] = 0.0f;
   mY[1] = 0.0f;
 }
 
 /* Adds the constant translation to the scale factor translation components. */
 nscoord nsStyleTransformMatrix::GetXTranslation(const nsRect& aBounds) const
 {
-  return nscoord(aBounds.width * mX[0] + aBounds.height * mY[0]) + mDelta[0];
+  return NSToCoordRound(aBounds.width * mX[0] + aBounds.height * mY[0]) +
+    mDelta[0];
 }
 nscoord nsStyleTransformMatrix::GetYTranslation(const nsRect& aBounds) const
 {
-  return nscoord(aBounds.width * mX[1] + aBounds.height * mY[1]) + mDelta[1];
+  return NSToCoordRound(aBounds.width * mX[1] + aBounds.height * mY[1]) +
+    mDelta[1];
 }
 
 /* GetThebesMatrix converts the stored matrix in a few steps. */
 gfxMatrix nsStyleTransformMatrix::GetThebesMatrix(const nsRect& aBounds,
-                                                  PRInt32 aScale) const
+                                                  float aScale) const
 {
   /* Compute the graphics matrix.  We take the stored main elements, along with
    * the delta, and add in the matrices:
    *
    * | 0 0 dx1|
    * | 0 0 dx2| * width
    * | 0 0   0|
    *
    * | 0 0 dy1|
    * | 0 0 dy2| * height
    * | 0 0   0|
    */
-
   return gfxMatrix(mMain[0], mMain[1], mMain[2], mMain[3],
                    NSAppUnitsToFloatPixels(GetXTranslation(aBounds), aScale),
                    NSAppUnitsToFloatPixels(GetYTranslation(aBounds), aScale));
 }
 
 /* Performs the matrix multiplication necessary to multiply the two matrices,
  * then hands back a reference to ourself.
  */
@@ -171,22 +187,20 @@ nsStyleTransformMatrix::operator *= (con
    * |a1 c1 e1| |a0 c0 e0|   |a0a1 + b0c1    c0a1 + d0c1     e0a1 + f0c1 + e1|
    * |b1 d1 f1|x|b0 d0 f0| = |a0b1 + b0d1    c0b1 + d0d1     e0b1 + f0d1 + f1|
    * |0  0  1 | | 0  0  1|   |          0              0                    1|
    */
   newMatrix[0] = aOther.mMain[0] * mMain[0] + aOther.mMain[1] * mMain[2];
   newMatrix[1] = aOther.mMain[0] * mMain[1] + aOther.mMain[1] * mMain[3];
   newMatrix[2] = aOther.mMain[2] * mMain[0] + aOther.mMain[3] * mMain[2];
   newMatrix[3] = aOther.mMain[2] * mMain[1] + aOther.mMain[3] * mMain[3];
-  newDelta[0] =
-    NSCoordMultiply(aOther.mDelta[0], mMain[0]) +
-    NSCoordMultiply(aOther.mDelta[1], mMain[2]) + mDelta[0];
-  newDelta[1] =
-    NSCoordMultiply(aOther.mDelta[0], mMain[1]) +
-    NSCoordMultiply(aOther.mDelta[1], mMain[3]) + mDelta[1];
+  newDelta[0] = NSToCoordRound(aOther.mDelta[0] * mMain[0] +
+                               aOther.mDelta[1] * mMain[2]) + mDelta[0];
+  newDelta[1] = NSToCoordRound(aOther.mDelta[0] * mMain[1] +
+                               aOther.mDelta[1] * mMain[3]) + mDelta[1];
 
   /* For consistent terminology, let u0, u1, v0, and v1 be the four transform
    * coordinates from our matrix, and let x0, x1, y0, and y1 be the four
    * transform coordinates from the other  matrix.  Then the new transform
    * coordinates are:
    *
    * u0' = a1u0 + c1u1 + x0
    * u1' = b1u0 + d1u1 + x1
--- a/layout/style/nsStyleTransformMatrix.h
+++ b/layout/style/nsStyleTransformMatrix.h
@@ -76,17 +76,17 @@ class nsStyleTransformMatrix
    * matrix.  The transformation takes points in the frame's
    * local space and converts them to points in the frame's
    * transformed space.
    *
    * @param aBounds The frame's bounding rectangle.
    * @param aFactor The number of app units per device pixel.
    * @return A Thebes matrix corresponding to the transform.
    */
-  gfxMatrix GetThebesMatrix(const nsRect& aBounds, PRInt32 aFactor) const;
+  gfxMatrix GetThebesMatrix(const nsRect& aBounds, float aFactor) const;
 
   /**
    * Multiplies this matrix by another matrix, in that order.  If A'
    * is the value of A after A *= B, then for any vector x, the
    * equivalence A'(x) == A(B(x)) holds.
    *
    * @param aOther The matrix to multiply this matrix by.
    * @return A reference to this matrix.
@@ -170,14 +170,14 @@ class nsStyleTransformMatrix
    * |       0        0     mX[1]| <-- Scaled by width of element
    * |       0        0         1|
    *
    * |       0        0     mY[0]|
    * |       0        0     mY[1]| <-- Scaled by height of element
    * |       0        0         1|
    */
   float mMain[4];
-  nscoord  mDelta[2];
+  nscoord mDelta[2];
   float mX[2];
   float mY[2];
 };
 
 #endif
--- a/layout/svg/base/src/nsSVGMaskFrame.cpp
+++ b/layout/svg/base/src/nsSVGMaskFrame.cpp
@@ -101,30 +101,23 @@ nsSVGMaskFrame::ComputeMaskAlpha(nsSVGRe
   mMaskParent = aParent;
   mMaskParentMatrix = aMatrix;
 
   for (nsIFrame* kid = mFrames.FirstChild(); kid;
        kid = kid->GetNextSibling()) {
     nsSVGUtils::PaintChildWithEffects(aContext, nsnull, kid);
   }
 
+  gfxRect clipExtents = gfx->GetClipExtents();
   gfx->Restore();
 
   nsRefPtr<gfxPattern> pattern = gfx->PopGroup();
   if (!pattern || pattern->CairoStatus())
     return nsnull;
 
-  nsRefPtr<gfxASurface> surface = pattern->GetSurface();
-  if (!surface || surface->CairoStatus())
-    return nsnull;
-
-  surface->SetDeviceOffset(gfxPoint(0,0));
-
-  gfxRect clipExtents = gfx->GetClipExtents();
-
 #ifdef DEBUG_tor
   fprintf(stderr, "clip extent: %f,%f %fx%f\n",
           clipExtents.X(), clipExtents.Y(),
           clipExtents.Width(), clipExtents.Height());
 #endif
 
   PRBool resultOverflows;
   gfxIntSize surfaceSize =
@@ -138,20 +131,21 @@ nsSVGMaskFrame::ComputeMaskAlpha(nsSVGRe
 
   if (resultOverflows)
     return nsnull;
 
   nsRefPtr<gfxImageSurface> image =
     new gfxImageSurface(surfaceSize, gfxASurface::ImageFormatARGB32);
   if (!image || image->CairoStatus())
     return nsnull;
+  image->SetDeviceOffset(-clipExtents.pos);
 
   gfxContext transferCtx(image);
   transferCtx.SetOperator(gfxContext::OPERATOR_SOURCE);
-  transferCtx.SetSource(surface);
+  transferCtx.SetPattern(pattern);
   transferCtx.Paint();
 
   PRUint8 *data   = image->Data();
   PRInt32  stride = image->Stride();
 
   nsIntRect rect(0, 0, surfaceSize.width, surfaceSize.height);
   nsSVGUtils::UnPremultiplyImageDataAlpha(data, stride, rect);
   nsSVGUtils::ConvertImageDataToLinearRGB(data, stride, rect);
@@ -167,20 +161,17 @@ nsSVGMaskFrame::ComputeMaskAlpha(nsSVGRe
                         pixel[GFX_ARGB32_OFFSET_G] * 0.7154 +
                         pixel[GFX_ARGB32_OFFSET_B] * 0.0721) *
                        (pixel[GFX_ARGB32_OFFSET_A] / 255.0) * aOpacity);
 
       memset(pixel, alpha, 4);
     }
 
   gfxPattern *retval = new gfxPattern(image);
-  if (retval) {
-    retval->SetMatrix(gfxMatrix().Translate(-clipExtents.pos));
-    NS_ADDREF(retval);
-  }
+  NS_IF_ADDREF(retval);
   return retval;
 }
 
 nsIAtom *
 nsSVGMaskFrame::GetType() const
 {
   return nsGkAtoms::svgMaskFrame;
 }
--- a/toolkit/components/microformats/src/Microformats.js
+++ b/toolkit/components/microformats/src/Microformats.js
@@ -75,28 +75,49 @@ var Microformats = {
       }
     } else if (Microformats[name].attributeValues) {
       microformatNodes =
         Microformats.getElementsByAttribute(rootElement,
                                             Microformats[name].attributeName,
                                             Microformats[name].attributeValues);
       
     }
+    
+
+    function isVisible(node, checkChildren) {
+      if (node.getBoundingClientRect) {
+        var box = node.getBoundingClientRect();
+      } else {
+        var box = node.ownerDocument.getBoxObjectFor(node);
+      }
+      /* If the parent has is an empty box, double check the children */
+      if ((box.height == 0) || (box.width == 0)) {
+        if (checkChildren && node.childNodes.length > 0) {
+          for(let i=0; i < node.childNodes.length; i++) {
+            if (node.childNodes[i].nodeType == Components.interfaces.nsIDOMNode.ELEMENT_NODE) {
+              /* For performance reasons, we only go down one level */
+              /* of children */
+              if (isVisible(node.childNodes[i], false)) {
+                return true;
+              }
+            }
+          }
+        }
+        return false
+      }
+      return true;
+    }
+    
     /* Create objects for the microformat nodes and put them into the microformats */
     /* array */
     for (let i = 0; i < microformatNodes.length; i++) {
       /* If showHidden undefined or false, don't add microformats to the list that aren't visible */
       if (!options || !options.hasOwnProperty("showHidden") || !options.showHidden) {
         if (microformatNodes[i].ownerDocument) {
-          if (microformatNodes[i].getBoundingClientRect) {
-            var box = microformatNodes[i].getBoundingClientRect();
-          } else {
-            var box = microformatNodes[i].ownerDocument.getBoxObjectFor(microformatNodes[i]);
-          }
-          if ((box.height == 0) || (box.width == 0)) {
+          if (!isVisible(microformatNodes[i], true)) {
             continue;
           }
         }
       }
       try {
         if (options && options.debug) {
           /* Don't validate in the debug case so that we don't get errors thrown */
           /* in the debug case, we want all microformats, even if they are invalid */
@@ -434,16 +455,25 @@ var Microformats = {
             return unescape(propnode[pairs[name]].substring(protocol.length));
           }
         }
       }
      /* Special case - if this node is a value, use the parent node to get all the values */
       if (Microformats.matchClass(propnode, "value")) {
         return Microformats.parser.textGetter(parentnode, parentnode);
       } else {
+        /* Virtual case */
+        if (!parentnode && (Microformats.getElementsByClassName(propnode, "type").length > 0)) {
+          var tempNode = propnode.cloneNode(true);
+          var typeNodes = Microformats.getElementsByClassName(tempNode, "type");
+          for (let i=0; i < typeNodes.length; i++) {
+            typeNodes[i].parentNode.removeChild(typeNodes[i]);
+          }
+          return Microformats.parser.textGetter(tempNode);
+        }
         return Microformats.parser.textGetter(propnode, parentnode);
       }
     },
     /**
      * Used to specifically retrieve an email address in a microformat node.
      * This includes at an href, as well as removing subject if specified and
      * the mailto prefix.
      *
@@ -464,16 +494,25 @@ var Microformats = {
         }
       } else {
         /* Special case - if this node is a value, use the parent node to get all the values */
         /* If this case gets executed, per the value design pattern, the result */
         /* will be the EXACT email address with no extra parsing required */
         if (Microformats.matchClass(propnode, "value")) {
           return Microformats.parser.textGetter(parentnode, parentnode);
         } else {
+          /* Virtual case */
+          if (!parentnode && (Microformats.getElementsByClassName(propnode, "type").length > 0)) {
+            var tempNode = propnode.cloneNode(true);
+            var typeNodes = Microformats.getElementsByClassName(tempNode, "type");
+            for (let i=0; i < typeNodes.length; i++) {
+              typeNodes[i].parentNode.removeChild(typeNodes[i]);
+            }
+            return Microformats.parser.textGetter(tempNode);
+          }
           return Microformats.parser.textGetter(propnode, parentnode);
         }
       }
     },
     /**
      * Used when a caller needs the text inside a particular DOM node.
      * It calls defaultGetter to handle all the subtleties of getting
      * text from a microformat.
@@ -519,19 +558,16 @@ var Microformats = {
      * @param  parentnode The parent node of the property. If it is a subproperty,
      *                    this is the parent property node. If it is not, this is the
      *                    microformat node.
      * @return A string with the property value.
      */
     datatypeHelper: function(prop, node, parentnode) {
       var result;
       var datatype = prop.datatype;
-      if (prop.implied) {
-        datatype = prop.subproperties[prop.implied].datatype;
-      }
       switch (datatype) {
         case "dateTime":
           result = Microformats.parser.dateTimeGetter(node, parentnode);
           break;
         case "anyURI":
           result = Microformats.parser.uriGetter(node, parentnode);
           break;
         case "email":
@@ -549,42 +585,46 @@ var Microformats = {
             result = parseFloat(asText);
           }
           break;
         case "custom":
           result = prop.customGetter(node, parentnode);
           break;
         case "microformat":
           try {
-            result = new Microformats[prop.microformat].mfObject(node);
+            result = new Microformats[prop.microformat].mfObject(node, true);
           } catch (ex) {
-            /* We can swallow this exception. If the creation of the */
-            /* mf object fails, then the node isn't a microformat */
+            /* There are two reasons we get here, one because the node is not */
+            /* a microformat and two because the node is a microformat and */
+            /* creation failed. If the node is not a microformat, we just fall */
+            /* through and use the default getter since there are some cases */
+            /* (location in hCalendar) where a property can be either a microformat */
+            /* or a string. If creation failed, we break and simply don't add the */
+            /* microformat property to the parent microformat */
+            if (ex != "Node is not a microformat (" + prop.microformat + ")") {
+              break;
+            }
           }
           if (result != undefined) {
             if (prop.microformat_property) {
               result = result[prop.microformat_property];
             }
             break;
           }
         default:
           result = Microformats.parser.textGetter(node, parentnode);
           break;
       }
       /* This handles the case where one property implies another property */
       /* For instance, org by itself is actually org.organization-name */
-      if (prop.implied && (result != undefined)) {
-        var temp = result;
-        result = {};
-        result[prop.implied] = temp;
-      }
       if (prop.values && (result != undefined)) {
         var validType = false;
         for (let value in prop.values) {
           if (result.toLowerCase() == prop.values[value]) {
+            result = result.toLowerCase();
             validType = true;
             break;
           }
         }
         if (!validType) {
           return;
         }
       }
@@ -678,18 +718,16 @@ var Microformats = {
       }
       if (!parentnode || (!result && propobj.subproperties)) {
         if (propobj.virtual) {
           if (propobj.virtualGetter) {
             result = propobj.virtualGetter(mfnode || propnode);
           } else {
             result = Microformats.parser.datatypeHelper(propobj, propnode);
           }
-        } else if (propobj.implied) {
-          result = Microformats.parser.datatypeHelper(propobj, propnode);
         }
       } else if (!result) {
         result = Microformats.parser.datatypeHelper(propobj, propnode, parentnode);
       }
       return result;
     },
     getMicroformatProperty: function getMicroformatProperty(in_mfnode, mfname, propname) {
       var mfnode = in_mfnode;
@@ -1352,23 +1390,23 @@ var hCard_definition = {
     },
     "note" : {
       plural: true,
       datatype: "HTML"
     },
     "org" : {
       subproperties: {
         "organization-name" : {
+          virtual: true
         },
         "organization-unit" : {
           plural: true
         }
       },
-      plural: true,
-      implied: "organization-name"
+      plural: true
     },
     "photo" : {
       plural: true,
       datatype: "anyURI"
     },
     "rev" : {
       datatype: "dateTime"
     },
@@ -1387,21 +1425,21 @@ var hCard_definition = {
     },
     "tel" : {
       subproperties: {
         "type" : {
           plural: true,
           values: ["msg", "home", "work", "pref", "voice", "fax", "cell", "video", "pager", "bbs", "car", "isdn", "pcs"]
         },
         "value" : {
-          datatype: "tel"
+          datatype: "tel",
+          virtual: true
         }
       },
-      plural: true,
-      implied: "value"
+      plural: true
     },
     "tz" : {
     },
     "uid" : {
       datatype: "anyURI"
     },
     "url" : {
       plural: true,
--- a/toolkit/components/microformats/tests/test_Microformats.html
+++ b/toolkit/components/microformats/tests/test_Microformats.html
@@ -1,15 +1,22 @@
 <html>
 <head>
   <title>Testing Microformats.js</title>
   <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"></link>
+  <style type="text/css">
+    /*vcards weee! */
+    .floated div {
+      float:left;
+    }
+  </style>
+
 </head>
 <body>
 <div id="content" style="display: none">
   <div id="test_1">
     <div class="vcard" id="vcard1_node">
      <a class="url fn" href="http://tantek.com/">Tantek Çelik</a>
      <div id="vcard1_org" class="org">Technorati</div>
     </div>  
@@ -60,17 +67,17 @@
   </a>
   
   <div class="vcard" id="value_test">
     <span class="fn">
       <span class="value">John</span>
       <span><span class="value">Middle</span></span>
       <span class="value">Doe</span>
     </span>
-  </span>
+  </div>
 
   <div class="vcard" id="nested_vcard1">
     <div class="agent vcard" id="nested_vcard2">
       <div class="agent vcard" id="nested_vcard3">
         <span class="fn">Bob Smith</span>
         <span class="title">Office Assistant</span>
       </div>
       <span class="fn">Jack Jones</span>
@@ -88,81 +95,104 @@
   <div class="vevent" id="vcal_vcard">
     <div class="vcard">
       <span class="description">
         <span class="fn org">Mozilla</span>'s Birthday
       </span>
     </div>
     <span class="dtstart">1998-01-22</span>
   </div>
+
+  <div id="geo_vcard" class="vcard">
+    <span class="fn">John Doe</span>
+    <span class="geo" id="ill_geo5">abc;def</span>
+  </div>
+  <div id="loc_vevent" class="vevent">
+    <span class="summary">Party</span>
+    <span class="location">The White House</span>
+  </div>
+  <div id="loc_vcard_vevent" class="vevent">
+    <span class="summary">Party</span>
+    <span class="location vcard"><span class="fn">The White House</span></span>
+  </div>
   
-<div class="vcard" id="valuespace_1">
-<span class="fn">
-<span class="value">John</span>
-<span class="value"> </span>
-<span class="value">Doe</span>
-</span>
-</div>
-<div class="vcard" id="valuespace_2">
-<span class="fn">
-<span class="value">John</span>
-<span class="value">    </span>
-<span class="value">Doe</span>
-</span>
-</div>
-<div class="vcard" id="valuespace_3">
-<span class="fn">
-<span class="value">  John</span>
-<span class="value">    </span>
-<span class="value">Doe  </span>
-</span>
-</div>
-<div class="vcard" id="valuespace_4">
-<span class="fn">
-<span class="value">John    </span>
-<span class="value">    Doe</span>
-</span>
-</div>
-<div class="vcard" id="valuespace_5">
-<span class="fn">
-<span class="value">    John</span>
-<span class="value">    Doe    </span>
-</span>
-<div class="vcard" id="valuespace_6">
-<span class="fn">
-<span class="value">John
-</span>
-<span class="value">
-Doe</span>
-</span>
-</div>
-<div class="vcard" id="valuespace_7">
-<span class="fn">
-<span class="value">John</span>
-<span class="value">Doe</span>
-</span>
-</div>
+  <div class="vcard" id="valuespace_1">
+    <span class="fn">
+      <span class="value">John</span>
+      <span class="value"> </span>
+      <span class="value">Doe</span>
+    </span>
+  </div>
+  <div class="vcard" id="valuespace_2">
+    <span class="fn">
+      <span class="value">John</span>
+      <span class="value">    </span>
+      <span class="value">Doe</span>
+    </span>
+  </div>
+  <div class="vcard" id="valuespace_3">
+    <span class="fn">
+      <span class="value">  John</span>
+      <span class="value">    </span>
+      <span class="value">Doe  </span>
+    </span>
+  </div>
+  <div class="vcard" id="valuespace_4">
+    <span class="fn">
+      <span class="value">John    </span>
+      <span class="value">    Doe</span>
+    </span>
+  </div>
+  <div class="vcard" id="valuespace_5">
+    <span class="fn">
+      <span class="value">    John</span>
+      <span class="value">    Doe    </span>
+    </span>
+  </div>
+  <div class="vcard" id="valuespace_6">
+    <span class="fn">
+      <span class="value">John
+      </span>
+      <span class="value">
+      Doe</span>
+      </span>
+  </div>
+  <div class="vcard" id="valuespace_7">
+    <span class="fn">
+      <span class="value">John</span>
+      <span class="value">Doe</span>
+    </span>
+  </div>
  
   <span id="austin" class="location">Austin - Sixth Street</span>
   <table summary="Timetable">
     <thead>
       <tr>
         <th id="location-1"><a href="#austin" class="include"></a>New York</th>
       </tr>
     </thead>
     <tbody>
       <tr>
         <th id="time-1"><abbr title="2008-01-01" class="dtstart">Jan 1, 2008</abbr></th>
         <td id="nested_header_include" class="vevent" headers="time-1 location-1"><div class="summary">New Years Party</div></td>
       </tr>
     </tbody>
   </table>
 
- 
 </div>
+
+<div id="float_test">
+  <div class="vcard floated" id="one">
+    <div class="fn">John Doe</div>
+  </div>
+  <div class="vcard" id="two">
+    <div class="fn">John Smith</div>
+  </div>
+</div>
+
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 test_Microformats();
 test_hCard();
 
 function test_Microformats() {
   netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
@@ -223,16 +253,25 @@ function test_Microformats() {
   var dateCal = new hCalendar(document.getElementById("date_vcal"));
   jsdate = Microformats.dateFromISO8601(dateCal.dtstart);
   origdate = Microformats.iso8601FromDate(jsdate, true);
   is(dateCal.dtstart, origdate, "date round trip");
 
   var dateCal = new hCalendar(document.getElementById("vcal_vcard"));
   is(dateCal.description, "Mozilla's Birthday", "vcard in vcal");
 
+  is(Microformats.count("hCard", document.getElementById("float_test")), 2, "Check Microformats.count for floated div");
+
+  var hcard = new hCard(document.getElementById("geo_vcard"));
+  ok(!hcard.geo, "Check if invalid geo does not exist");
+  var hcal = new hCalendar(document.getElementById("loc_vevent"));
+  is(hcal.location, "The White House", "Check if non vcard location works");
+  var hcal = new hCalendar(document.getElementById("loc_vcard_vevent"));
+  is(hcal.location.fn, "The White House", "Check if vcard location works");
+
   var nestedCal = new hCalendar(document.getElementById("nested_header_include"));
   is(nestedCal.dtstart, "2008-01-01", "nested_header_include - dtstart");
   is(nestedCal.location, "Austin - Sixth Street", "nested_header_include - location");
   is(nestedCal.summary, "New Years Party", "nested_header_include - summary");
 
   var valueCard = new hCard(document.getElementById("valuespace_1"));
   is(valueCard.fn, "John Doe", "valuespace_1");
   var valueCard = new hCard(document.getElementById("valuespace_2"));
--- a/toolkit/components/microformats/tests/test_Microformats_hCard.html
+++ b/toolkit/components/microformats/tests/test_Microformats_hCard.html
@@ -185,16 +185,26 @@
     <area class="tel" href="tel:+1.415.555.1237">call me</area>
     <a class="tel" href="fax:+1.415.555.1238">call me</a>
     <object class="tel" data="fax:+1.415.555.1239">call me</object>
     <area class="tel" href="fax:+1.415.555.1240">call me</area>
     <a class="tel" href="modem:+1.415.555.1241">call me</a>
     <object class="tel" data="modem:+1.415.555.1242">call me</object>
     <area class="tel" href="modem:+1.415.555.1243">call me</area>
   </div>
+  
+  <div class="vcard" id="21-tel.2">
+    <span class="fn">John Doe</span>
+    <span class="tel"><span class="type">Home</span> +1.415.555.1212</span>
+  </div>
+
+  <div class="vcard" id="21-tel.3">
+    <span class="fn">John Doe</span>
+    <span class="tel"><span class="type">Home</span><span class="type"> Pref</span> +1.415.555.1212</span>
+  </div>
 
   <!--     TODO: add test for 'extended' -->
   <div class="vcard" id="22-adr">
     <p class="fn">John Doe</p>
     <p class="adr">
       <span class="street-address">1231 Main St.</span>
       <span class="locality">Beverly Hills</span>
       <span class="region">California</span>
@@ -535,16 +545,25 @@
     <map id="foo"><area class="url uid" href="http://theryanking.com/contact/" alt="my other hcard" /></map>
   </div>
 
   <div class="vcard" id="39-noteHTML">
     <a class="fn">Joe Public</a>
     <span class="note"><b>Note</b></span>
   </div>
 
+  <div class="vcard" id="email-type">
+		      <span class="fn">John Doe</span>
+		      <span class="email">
+			      <span class="type">internet</span>
+			      <a href="mailto:notthis@example.com">john@example.com</a>
+		      </span>
+       </div>
+
+
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 test_Microformats();
 test_hCard();
 
 function test_Microformats() {
@@ -786,16 +805,27 @@ function test_hCard() {
   is(hcard.tel[3].type[0], "home", "21-tel - type");
   is(hcard.tel[4].value, "+1.415.555.1235", "21-tel - tel");
   is(hcard.tel[5].value, "+1.415.555.1236", "21-tel - tel");
   is(hcard.tel[6].value, "+1.415.555.1238", "21-tel - tel");
   is(hcard.tel[7].value, "+1.415.555.1239", "21-tel - tel");
   is(hcard.tel[8].value, "+1.415.555.1241", "21-tel - tel");
   is(hcard.tel[9].value, "+1.415.555.1242", "21-tel - tel");
 
+  hcard = new hCard(document.getElementById("21-tel.2"));
+
+  is(hcard.tel[0].type[0], "home", "21-tel.2 - type");
+  is(hcard.tel[0].value, "+1.415.555.1212", "21-tel.2 - tel");
+  
+  hcard = new hCard(document.getElementById("21-tel.3"));
+
+  is(hcard.tel[0].type[0], "home", "21-tel.3 - type (home)");
+  is(hcard.tel[0].type[1], "pref", "21-tel.3 - type (pref)");
+  is(hcard.tel[0].value, "+1.415.555.1212", "21-tel.3 - tel");
+
   hcard = new hCard(document.getElementById("22-adr"));
 
   is(hcard.fn, "John Doe", "22-adr - fn");
   is(hcard.n["given-name"][0], "John", "22-adr - given-name");
   is(hcard.n["family-name"][0], "Doe", "22-adr - family-name");
   is(hcard.adr[0]["street-address"][0], "1231 Main St.", "22-adr - street-address");
   is(hcard.adr[0].locality, "Beverly Hills", "22-adr - locality");
   is(hcard.adr[0].region, "California", "22-adr - region");
@@ -1137,15 +1167,18 @@ function test_hCard() {
   is(hcard.uid, "http://theryanking.com/contact/", "38-uid.4 - uid");
   is(hcard.url[0], "http://theryanking.com/contact/", "38-uid.4 - url");
 
   hcard = new hCard(document.getElementById("39-noteHTML"));
 
   is(hcard.note[0], "Note", "39-noteHTML - note");
   is(hcard.note[0].toHTML(), "<b>Note</b>", "39-noteHTML - note as HTML");
   is(hcard.note[0].match("Note"), "Note", "39-noteHTML - match in note");
-  
+
+  hcard = new hCard(document.getElementById("email-type"));
+  is(hcard.email[0].type, "internet", "email - type no value (type)");
+  is(hcard.email[0].value, "john@example.com", "email - type no value (value)");
 }
 
 </script>
 </pre>
 </body>
 </html>
--- a/toolkit/components/viewsource/content/viewSourceUtils.js
+++ b/toolkit/components/viewsource/content/viewSourceUtils.js
@@ -124,16 +124,21 @@ var gViewSourceUtils = {
 
           var webBrowserPersist = Components
                                   .classes["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"]
                                   .createInstance(this.mnsIWebBrowserPersist);
           // the default setting is to not decode. we need to decode.
           webBrowserPersist.persistFlags = this.mnsIWebBrowserPersist.PERSIST_FLAGS_REPLACE_EXISTING_FILES;
           webBrowserPersist.progressListener = this.viewSourceProgressListener;
           webBrowserPersist.saveURI(uri, null, null, null, null, file);
+
+          // register the file to be deleted on app exit
+          Components.classes["@mozilla.org/uriloader/external-helper-app-service;1"]
+                    .getService(Components.interfaces.nsPIExternalAppLauncher)
+                    .deleteTemporaryFileOnExit(file);
         } else {
           // we'll use nsIWebPageDescriptor to get the source because it may not have to refetch
           // the file from the server
           var webShell = Components.classes["@mozilla.org/webshell;1"].createInstance();
           this.viewSourceProgressListener.webShell = webShell;
           var progress = webShell.QueryInterface(this.mnsIWebProgress);
           progress.addProgressListener(this.viewSourceProgressListener,
                                        this.mnsIWebProgress.NOTIFY_STATE_DOCUMENT);
@@ -235,16 +240,21 @@ var gViewSourceUtils = {
             coStream.init(foStream, this.data.doc.characterSet, 0, null);
 
             // write the source to the file
             coStream.writeString(webNavigation.document.body.textContent);
           
             // clean up
             coStream.close();
             foStream.close();
+
+            // register the file to be deleted on app exit
+            Components.classes["@mozilla.org/uriloader/external-helper-app-service;1"]
+                      .getService(Components.interfaces.nsPIExternalAppLauncher)
+                      .deleteTemporaryFileOnExit(this.file);
           }
 
           // Determine the command line arguments to pass to the editor.
           // We currently support a %LINE% placeholder which is set to the passed
           // line number (or to 0 if there's none)
           var editorArgs = [];
           var prefs = Components.classes["@mozilla.org/preferences-service;1"]
                                 .getService(Components.interfaces.nsIPrefBranch);
--- a/toolkit/content/Makefile.in
+++ b/toolkit/content/Makefile.in
@@ -40,21 +40,43 @@ DEPTH     = ../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 CHROME_DEPS = buildconfig.html
 
 include $(DEPTH)/config/autoconf.mk
 
-DEFINES += -DMOZ_APP_VERSION=$(MOZ_APP_VERSION)
+DEFINES += \
+  -DMOZ_APP_VERSION=$(MOZ_APP_VERSION) \
+  -Dtarget="$(target)" \
+  -Dac_configure_args="$(ac_configure_args)" \
+  -DCC="$(CC)" \
+  -DCC_VERSION="$(CC_VERSION)" \
+  -DCFLAGS="$(CFLAGS)" \
+  -DCXX="$(CXX)" \
+  -DCXX_VERSION="$(CXX_VERSION)" \
+  -DCXXFLAGS="$(CXXFLAGS)" \
+  -DCPPFLAGS="$(CPPFLAGS)" \
+  $(NULL)
+
+CHANGESET := $(shell cd $(topsrcdir) ; hg identify 2>/dev/null | cut -f1 -d' ')
+ifdef CHANGESET
+DEFINES += -DSOURCE_CHANGESET="$(CHANGESET)"
+endif
+
+# strip a trailing slash from the repo URL because it's not always present,
+# and we want to construct a working URL in buildconfig.html
+# make+shell+sed = awful
+_dollar=$$
+SOURCE_REPO := $(shell hg -R $(topsrcdir) showconfig paths.default 2>/dev/null | sed -e "s/^ssh:/http:/" -e "s/\/$(_dollar)//" )
+ifdef SOURCE_REPO
+DEFINES += -DSOURCE_REPO="$(SOURCE_REPO)"
+endif
 
 ifdef ENABLE_TESTS
 DIRS += tests
 endif
 
 EXTRA_JS_MODULES = debug.js
 EXTRA_PP_JS_MODULES = debug.js
 
 include $(topsrcdir)/config/rules.mk
-
-distclean::
-	$(RM) -f buildconfig.html
rename from toolkit/content/buildconfig.html.in
rename to toolkit/content/buildconfig.html
--- a/toolkit/content/buildconfig.html.in
+++ b/toolkit/content/buildconfig.html
@@ -1,17 +1,24 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+#filter substitution
 <html>
 <head>
   <title>about:buildconfig</title>
   <link rel="stylesheet" href="chrome://global/skin/about.css" type="text/css">
 </head>
 <body class="aboutPageWideContainer">
 <h1>about:buildconfig</h1>
 <p> </p>
+#ifdef SOURCE_REPO
+#ifdef SOURCE_CHANGESET
+<h2>Source</h2>
+<p>Built from <a href="@SOURCE_REPO@/rev/@SOURCE_CHANGESET@">@SOURCE_REPO@/rev/@SOURCE_CHANGESET@</a></p>
+#endif
+#endif
 <h2>Build platform</h2>
 <table>
   <tbody>
     <tr>
       <th>target</th>
     </tr>
     <tr>
       <td>@target@</td>
--- a/toolkit/content/jar.mn
+++ b/toolkit/content/jar.mn
@@ -6,17 +6,17 @@ toolkit.jar:
 # work with Geckos from before 1.9, when there was a separate file
 %  override chrome://global/content/nsTransferable.js chrome://global/content/nsDragAndDrop.js
 *  content/global/license.html                (license.html)
    content/global/XPCNativeWrapper.js         (XPCNativeWrapper.js)
 *  content/global/xul.css                     (xul.css)
 *  content/global/about.xhtml                 (about.xhtml)
    content/global/plugins.html
    content/global/plugins.css
-+  content/global/buildconfig.html            (buildconfig.html)
+*+  content/global/buildconfig.html            (buildconfig.html)
 +  content/global/charsetOverlay.js           (charsetOverlay.js)
 +  content/global/charsetOverlay.xul          (charsetOverlay.xul)
 *+ content/global/commonDialog.js             (commonDialog.js)
 *+ content/global/commonDialog.xul            (commonDialog.xul)
    content/global/commonDialog.css            (commonDialog.css)
 *  content/global/contentAreaUtils.js         (contentAreaUtils.js)
 *  content/global/customizeCharset.js         (customizeCharset.js)
 *  content/global/customizeCharset.xul        (customizeCharset.xul)
--- a/toolkit/mozapps/installer/windows/nsis/common.nsh
+++ b/toolkit/mozapps/installer/windows/nsis/common.nsh
@@ -3184,19 +3184,21 @@
   !endif
 !macroend
 
 /**
  * If present removes the VirtualStore directory for this installation. Uses the
  * program files directory path and the current install location to determine
  * the sub-directory in the VirtualStore directory.
  *
- * $R7 = stores the value of the open command and the path macros return values
- * $R8 = stores the handler's registry key name
- * $R9 = _DEFAULT_VALUE and _RESULT
+ * $R5 = various path values.
+ * $R6 = length of the long path to $PROGRAMFILES
+ * $R7 = length of the long path to $INSTDIR
+ * $R8 = long path to $PROGRAMFILES
+ * $R9 = long path to $INSTDIR
  */
 !macro CleanVirtualStore
 
   !ifndef ${_MOZFUNC_UN}CleanVirtualStore
     !define _MOZFUNC_UN_TMP ${_MOZFUNC_UN}
     !insertmacro ${_MOZFUNC_UN_TMP}GetLongPath
     !undef _MOZFUNC_UN
     !define _MOZFUNC_UN ${_MOZFUNC_UN_TMP}
@@ -3205,49 +3207,48 @@
     !verbose push
     !verbose ${_MOZFUNC_VERBOSE}
     !define ${_MOZFUNC_UN}CleanVirtualStore "!insertmacro ${_MOZFUNC_UN}CleanVirtualStoreCall"
 
     Function ${_MOZFUNC_UN}CleanVirtualStore
       Push $R9
       Push $R8
       Push $R7
-
-      StrLen $R9 "$INSTDIR"
-
-      ; Get the installation's directory name including the preceding slash
-      start:
-      IntOp $R8 $R8 - 1
-      IntCmp $R8 -$R9 end end +1
-      StrCpy $R7 "$INSTDIR" 1 $R8
-      StrCmp $R7 "\" +1 start
-
-      StrCpy $R9 "$INSTDIR" "" $R8
+      Push $R6
+      Push $R5
+
+      ${${_MOZFUNC_UN}GetLongPath} "$INSTDIR" $R9
+      StrCmp $R9 "" end +1
+      ${${_MOZFUNC_UN}GetLongPath} "$PROGRAMFILES" $R8
       StrCmp $R8 "" end +1
 
-      ClearErrors
-      ${${_MOZFUNC_UN}GetLongPath} "$PROGRAMFILES$R9" $R8
-      StrCmp $R8 "" end +1
-      ${${_MOZFUNC_UN}GetLongPath} "$INSTDIR" $R7
-      StrCmp $R7 "" end +1
-
-      ; Compare the installation's directory path with the path created by
-      ; concatenating the installation's directory name and the path to the
-      ; program files directory.
-      StrCmp "$R7" "$R8" +1 end
-
-      StrCpy $R8 "$PROGRAMFILES" "" 2 ; Remove the drive letter and colon
-      StrCpy $R7 "$PROFILE\AppData\Local\VirtualStore$R8$R9"
-
-      IfFileExists "$R7" 0 end
-      RmDir /r "$R7"
+      StrLen $R7 "$R9"
+      StrLen $R6 "$R8"
+      ; Only continue If the length of $INSTDIR is greater than the length of
+      ; $PROGRAMFILES
+      IntCmp $R7 $R6 end end +1
+
+      ; Copy from the start of $INSTDIR the length of $PROGRAMFILES 
+      StrCpy $R5 "$R9" $R6
+      StrCmp "$R5" "$R8" +1 end ; Check if $INSTDIR is under $PROGRAMFILES
+
+      ; Remove the drive letter and colon from the $INSTDIR long path
+      StrCpy $R5 "$R9" "" 2
+      StrCpy $R5 "$PROFILE\AppData\Local\VirtualStore$R5"
+      ${${_MOZFUNC_UN}GetLongPath} "$R5" $R5
+      StrCmp $R5 "" end +1
+
+      IfFileExists "$R5" +1 end
+      RmDir /r "$R5"
 
       end:
       ClearErrors
 
+      Pop $R5
+      Pop $R6
       Pop $R7
       Pop $R8
       Pop $R9
     FunctionEnd
 
     !verbose pop
   !endif
 !macroend
@@ -3283,21 +3284,21 @@
 
 /**
  * If present removes the updates directory located in the profile's local
  * directory for this installation.
  *
  * @param   _REL_PROFILE_PATH
  *          The relative path to the profile directory from $LOCALAPPDATA.
  *
- * $R6 = stores single characters to find the first "\" from the right of
- *       $INSTDIR and the long path to $INSTDIR
- * $R7 = long path of the concatenation of Program Files and the  installation
- *       directory name (e.g. $PROGRAMFILES$R68)
- * $R8 = installation directory name
+ * $R4 = various path values.
+ * $R5 = length of the long path to $PROGRAMFILES
+ * $R6 = length of the long path to $INSTDIR
+ * $R7 = long path to $PROGRAMFILES
+ * $R8 = long path to $INSTDIR
  * $R9 = _REL_PROFILE_PATH
  */
 !macro CleanUpdatesDir
 
   !ifndef ${_MOZFUNC_UN}CleanUpdatesDir
     !define _MOZFUNC_UN_TMP ${_MOZFUNC_UN}
     !insertmacro ${_MOZFUNC_UN_TMP}GetLongPath
     !undef _MOZFUNC_UN
@@ -3308,51 +3309,52 @@
     !verbose ${_MOZFUNC_VERBOSE}
     !define ${_MOZFUNC_UN}CleanUpdatesDir "!insertmacro ${_MOZFUNC_UN}CleanUpdatesDirCall"
 
     Function ${_MOZFUNC_UN}CleanUpdatesDir
       Exch $R9
       Push $R8
       Push $R7
       Push $R6
-
-      StrCmp $R9 "" end +1   ; The path to the app's profiles is required
-      StrLen $R8 "$INSTDIR"
-
-      ; Get the installation's directory name including the preceding slash
-      start:
-      IntOp $R7 $R7 - 1
-      IntCmp $R7 -$R8 end end +1
-      StrCpy $R6 "$INSTDIR" 1 $R7
-      StrCmp $R6 "\" +1 start
-
-      StrCpy $R8 "$INSTDIR" "" $R7
+      Push $R5
+      Push $R4
+
+      StrCmp $R9 "" end +1 ; The relative path to the app's profiles is required
+      ${${_MOZFUNC_UN}GetLongPath} "$INSTDIR" $R8
       StrCmp $R8 "" end +1
-
-      ClearErrors
-      ${${_MOZFUNC_UN}GetLongPath} "$PROGRAMFILES$R8" $R7
+      ${${_MOZFUNC_UN}GetLongPath} "$PROGRAMFILES" $R7
       StrCmp $R7 "" end +1
-      ${${_MOZFUNC_UN}GetLongPath} "$INSTDIR" $R6
-      StrCmp $R6 "" end +1
-
-      ; Compare the installation's directory path with the path created by
-      ; concatenating the installation's directory name and the path to the
-      ; program files directory.
-      StrCmp "$R6" "$R7" +1 end
-
-      StrCpy $R6 "$LOCALAPPDATA\$R9$R8"
-
-      ${${_MOZFUNC_UN}GetLongPath} "$R6" $R6
-      StrCmp $R6 "" end +1
-      IfFileExists "$R6\updates" +1 end
-      RmDir /r "$R6"
+
+      StrLen $R6 "$R8"
+      StrLen $R5 "$R7"
+      ; Only continue If the length of $INSTDIR is greater than the length of
+      ; $PROGRAMFILES
+      IntCmp $R6 $R5 end end +1
+
+      ; Copy from the start of $INSTDIR the length of $PROGRAMFILES 
+      StrCpy $R4 "$R8" $R5
+      StrCmp "$R4" "$R7" +1 end ; Check if $INSTDIR is under $PROGRAMFILES
+
+      ; Copy the relative path to $INSTDIR from $PROGRAMFILES
+      StrCpy $R4 "$R8" "" $R5
+
+      ; Concatenate the path to $LOCALAPPDATA the relative profile path and the
+      ; relative path to $INSTDIR from $PROGRAMFILES
+      StrCpy $R4 "$LOCALAPPDATA\$R9$R4"
+      ${${_MOZFUNC_UN}GetLongPath} "$R4" $R4
+      StrCmp $R4 "" end +1
+
+      IfFileExists "$R4\updates" +1 end
+      RmDir /r "$R4"
 
       end:
       ClearErrors
 
+      Pop $R4
+      Pop $R5
       Pop $R6
       Pop $R7
       Pop $R8
       Exch $R9
     FunctionEnd
 
     !verbose pop
   !endif
@@ -3818,17 +3820,17 @@
  * @param   _PATH_TO_DESTINATION
  *          Destination path to copy the files to. This must not end with a \.
  *
  * @param   _PREFIX_ERROR_CREATEDIR
  *          Prefix for the directory creation error message. The directory path
  *          will be inserted below this string.
  *
  * @param   _SUFFIX_ERROR_CREATEDIR
- *          Prefix for the directory creation error message. The directory path
+ *          Suffix for the directory creation error message. The directory path
  *          will be inserted above this string.
  *
  * $0  = destination file's parent directory used in the create_dir label
  * $R0 = copied value from $R6 (e.g. _PATH_TO_SOURCE)
  * $R1 = copied value from $R7 (e.g. _PATH_TO_DESTINATION)
  * $R2 = string length of the path to source
  * $R3 = relative path from the path to source
  * $R4 = copied value from $R8 (e.g. _PREFIX_ERROR_CREATEDIR)
--- a/toolkit/toolkit-makefiles.sh
+++ b/toolkit/toolkit-makefiles.sh
@@ -641,17 +641,16 @@ MAKEFILES_xulapp="
   toolkit/crashreporter/google-breakpad/src/client/windows/Makefile
   toolkit/crashreporter/google-breakpad/src/client/windows/handler/Makefile
   toolkit/crashreporter/google-breakpad/src/client/windows/sender/Makefile
   toolkit/crashreporter/google-breakpad/src/common/Makefile
   toolkit/crashreporter/google-breakpad/src/common/mac/Makefile
   toolkit/crashreporter/google-breakpad/src/common/windows/Makefile
   toolkit/crashreporter/google-breakpad/src/tools/mac/dump_syms/Makefile
   toolkit/content/Makefile
-  toolkit/content/buildconfig.html
   toolkit/obsolete/Makefile
   toolkit/components/alerts/Makefile
   toolkit/components/alerts/public/Makefile
   toolkit/components/alerts/src/Makefile
   toolkit/components/autocomplete/Makefile
   toolkit/components/autocomplete/public/Makefile
   toolkit/components/autocomplete/src/Makefile
   toolkit/components/Makefile
new file mode 100644
--- /dev/null
+++ b/widget/src/cocoa/crashtests/444260-1.xul
@@ -0,0 +1,3 @@
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+<hbox><button width="7788025414616">S</button></hbox>
+</window>
new file mode 100644
--- /dev/null
+++ b/widget/src/cocoa/crashtests/444864-1.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<html>
+<body>
+<div style="padding: 10px;"><input type="button" value="Go" style="letter-spacing: 331989pt;"></div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/widget/src/cocoa/crashtests/449111-1.html
@@ -0,0 +1,4 @@
+<html>
+<head></head>
+<body><div style="display: -moz-box; word-spacing: 549755813889px;"><button>T </button></div></body>
+</html>
--- a/widget/src/cocoa/crashtests/crashtests.list
+++ b/widget/src/cocoa/crashtests/crashtests.list
@@ -1,3 +1,6 @@
 load 397209-1.html
 load 403296-1.xhtml
 load 419737-1.html
+load 444260-1.xul
+load 444864-1.html
+load 449111-1.html
--- a/widget/src/cocoa/nsChildView.mm
+++ b/widget/src/cocoa/nsChildView.mm
@@ -491,33 +491,16 @@ nsresult nsChildView::StandardCreate(nsI
     mParentView = reinterpret_cast<NSView*>(aNativeParent);
   
   // create our parallel NSView and hook it up to our parent. Recall
   // that NS_NATIVE_WIDGET is the NSView.
   NSRect r;
   GeckoRectToNSRect(mBounds, r);
   mView = [CreateCocoaView(r) retain];
   if (!mView) return NS_ERROR_FAILURE;
-  
-#if DEBUG
-  // if our parent is a popup window, we're most certainly coming from a <select> list dropdown which
-  // we handle in a different way than other platforms. It's ok that we don't have a parent
-  // view because we bailed before even creating the cocoa widgetry and as a result, we
-  // don't need to assert. However, if that's not the case, we definitely want to assert
-  // to show views aren't getting correctly parented.
-  if (aParent) {
-    nsWindowType windowType;
-    aParent->GetWindowType(windowType);
-    if (windowType != eWindowType_popup)
-      NS_ASSERTION(mParentView && mView, "couldn't hook up new NSView in hierarchy");
-  }
-  else {
-    NS_ASSERTION(mParentView && mView, "couldn't hook up new NSView in hierarchy");
-  }
-#endif
 
   // If this view was created in a Gecko view hierarchy, the initial state
   // is hidden.  If the view is attached only to a native NSView but has
   // no Gecko parent (as in embedding), the initial state is visible.
   if (mParentWidget)
     [mView setHidden:YES];
   else
     mVisible = PR_TRUE;
@@ -1642,16 +1625,20 @@ NS_IMETHODIMP nsChildView::Update()
 
 
 // Scroll the bits of a view and its children
 // FIXME: I'm sure the invalidating can be optimized, just no time now.
 NS_IMETHODIMP nsChildView::Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
 
+  NS_ASSERTION(mParentView, "Attempting to scroll a view that does not have a parent");
+  if (!mParentView)
+    return NS_ERROR_NOT_AVAILABLE;
+
   BOOL viewWasDirty = NO;
   if (mVisible) {
     viewWasDirty = [mView needsDisplay];
 
     NSSize scrollVector = {aDx,aDy};
     [mView scrollRect: [mView visibleRect] by:scrollVector];
   }
   
@@ -2244,19 +2231,23 @@ NSEvent* gLastDragEvent = nil;
                                                           NSURLPboardType,
                                                           NSFilesPromisePboardType,
                                                           kWildcardPboardType,
                                                           kCorePboardType_url,
                                                           kCorePboardType_urld,
                                                           kCorePboardType_urln,
                                                           nil]];
   [[NSNotificationCenter defaultCenter] addObserver:self
-                                           selector:@selector(controlTintChanged)
+                                           selector:@selector(systemColorChanged)
                                                name:NSControlTintDidChangeNotification
                                              object:nil];
+  [[NSNotificationCenter defaultCenter] addObserver:self
+                                           selector:@selector(systemColorChanged)
+                                               name:NSSystemColorsDidChangeNotification
+                                             object:nil];
 
   return self;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
 
 - (void)dealloc
@@ -2318,17 +2309,17 @@ NSEvent* gLastDragEvent = nil;
 // mozView method, set the NSWindow that this view is associated with (even when
 // not in the view hierarchy).
 - (void)setNativeWindow:(NSWindow*)aWindow
 {
   mWindow = aWindow;
 }
 
 
-- (void)controlTintChanged
+- (void)systemColorChanged
 {
   if (!mGeckoChild)
     return;
 
   nsGUIEvent guiEvent(PR_TRUE, NS_THEMECHANGED, mGeckoChild);
   mGeckoChild->DispatchWindowEvent(guiEvent);
 }
 
--- a/widget/src/cocoa/nsCocoaWindow.mm
+++ b/widget/src/cocoa/nsCocoaWindow.mm
@@ -1731,22 +1731,16 @@ NS_IMETHODIMP nsCocoaWindow::EndSecureKe
 
     mUnifiedToolbarHeight = 0.0f;
     mSuppressPainting = NO;
 
     // setBottomCornerRounded: is a private API call, so we check to make sure
     // we respond to it just in case.
     if ([self respondsToSelector:@selector(setBottomCornerRounded:)])
       [self setBottomCornerRounded:NO];
-
-    // This method only exists on Leopard.
-    if ([self respondsToSelector:@selector(setAutorecalculatesContentBorderThickness:forEdge:)]) {
-      [self setAutorecalculatesContentBorderThickness:NO forEdge:NSMaxYEdge];
-      [self setContentBorderThickness:0.0f forEdge:NSMaxYEdge];
-    }
   }
   return self;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
 
 - (void)dealloc
@@ -1798,18 +1792,16 @@ NS_IMETHODIMP nsCocoaWindow::EndSecureKe
 // This is called by nsNativeThemeCocoa.mm's DrawUnifiedToolbar.
 // We need to know the toolbar's height in order to draw the correct
 // unified gradient in the titlebar.
 - (void)setUnifiedToolbarHeight:(float)aToolbarHeight
 {
   if (mUnifiedToolbarHeight == aToolbarHeight)
     return;
   mUnifiedToolbarHeight = aToolbarHeight;
-  if ([self respondsToSelector:@selector(setContentBorderThickness:forEdge:)])
-    [self setContentBorderThickness:aToolbarHeight forEdge:NSMaxYEdge];
   [self redrawTitlebar];
 }
 
 
 - (float)unifiedToolbarHeight
 {
   return mUnifiedToolbarHeight;
 }
--- a/widget/src/cocoa/nsNativeThemeCocoa.h
+++ b/widget/src/cocoa/nsNativeThemeCocoa.h
@@ -90,47 +90,49 @@ public:
   PRBool ThemeNeedsComboboxDropmarker();
 
 protected:  
 
   nsresult GetSystemColor(PRUint8 aWidgetType, nsILookAndFeel::nsColorID& aColorID);
   nsresult GetSystemFont(PRUint8 aWidgetType, nsSystemFontID& aFont);
 
   // HITheme drawing routines
-  void DrawFrame (CGContextRef context, HIThemeFrameKind inKind,
-                  const HIRect& inBoxRect, PRBool inIsDisabled,
-                  PRInt32 inState);
+  void DrawFrame(CGContextRef context, HIThemeFrameKind inKind,
+                 const HIRect& inBoxRect, PRBool inIsDisabled,
+                 PRInt32 inState);
   void DrawProgress(CGContextRef context, const HIRect& inBoxRect,
                     PRBool inIsIndeterminate, PRBool inIsHorizontal,
-                    PRInt32 inValue);
-  void DrawTab (CGContextRef context, const HIRect& inBoxRect,
-                PRBool inIsDisabled, PRBool inIsFrontmost, 
-                PRBool inIsHorizontal, PRBool inTabBottom,
-                PRInt32 inState);
-  void DrawTabPanel (CGContextRef context, const HIRect& inBoxRect);
-  void DrawScale (CGContextRef context, const HIRect& inBoxRect,
-                  PRBool inIsDisabled, PRInt32 inState,
-                  PRBool inDirection, PRBool inIsReverse,
-                  PRInt32 inCurrentValue,
-                  PRInt32 inMinValue, PRInt32 inMaxValue);
+                    PRInt32 inValue, nsIFrame* aFrame);
+  void DrawTab(CGContextRef context, const HIRect& inBoxRect,
+               PRBool inIsDisabled, PRBool inIsFrontmost, 
+               PRBool inIsHorizontal, PRBool inTabBottom,
+               PRInt32 inState, nsIFrame* aFrame);
+  void DrawTabPanel(CGContextRef context, const HIRect& inBoxRect, nsIFrame* aFrame);
+  void DrawScale(CGContextRef context, const HIRect& inBoxRect,
+                 PRBool inIsDisabled, PRInt32 inState,
+                 PRBool inDirection, PRBool inIsReverse,
+                 PRInt32 inCurrentValue,
+                 PRInt32 inMinValue, PRInt32 inMaxValue,
+                 nsIFrame* aFrame);
   void DrawRadioButton(CGContextRef cgContext, const HIRect& inBoxRect, PRBool inSelected,
-                       PRBool inDisabled, PRInt32 inState);
+                       PRBool inDisabled, PRInt32 inState, nsIFrame* aFrame);
   void DrawPushButton(CGContextRef cgContext, const HIRect& inBoxRect, PRBool inIsDefault,
-                      PRBool inDisabled, PRInt32 inState);
-  void DrawButton (CGContextRef context, ThemeButtonKind inKind,
-                   const HIRect& inBoxRect, PRBool inIsDefault, 
-                   PRBool inDisabled, ThemeButtonValue inValue,
-                   ThemeButtonAdornment inAdornment, PRInt32 inState);
-  void DrawSpinButtons (CGContextRef context, ThemeButtonKind inKind,
-                        const HIRect& inBoxRect,
-                        PRBool inDisabled, ThemeDrawState inDrawState,
-                        ThemeButtonAdornment inAdornment, PRInt32 inState);
+                      PRBool inDisabled, PRInt32 inState, nsIFrame* aFrame);
+  void DrawButton(CGContextRef context, ThemeButtonKind inKind,
+                  const HIRect& inBoxRect, PRBool inIsDefault, 
+                  PRBool inDisabled, ThemeButtonValue inValue,
+                  ThemeButtonAdornment inAdornment, PRInt32 inState, nsIFrame* aFrame);
+  void DrawSpinButtons(CGContextRef context, ThemeButtonKind inKind,
+                       const HIRect& inBoxRect,
+                       PRBool inDisabled, ThemeDrawState inDrawState,
+                       ThemeButtonAdornment inAdornment, PRInt32 inState,
+                       nsIFrame* aFrame);
   void DrawCheckbox(CGContextRef context, ThemeButtonKind inKind,
                     const HIRect& inBoxRect, PRBool inChecked, 
-                    PRBool inDisabled, PRInt32 inState);
+                    PRBool inDisabled, PRInt32 inState, nsIFrame* aFrame);
   void DrawUnifiedToolbar(CGContextRef cgContext, const HIRect& inBoxRect,
                           nsIFrame *aFrame);
 
   // Scrollbars
   void DrawScrollbar(CGContextRef aCGContext, const HIRect& aBoxRect, nsIFrame *aFrame);
   void GetScrollbarPressStates (nsIFrame *aFrame, PRInt32 aButtonStates[]);
   void GetScrollbarDrawInfo (HIThemeTrackDrawInfo& aTdi, nsIFrame *aFrame, 
                              const HIRect& aRect, PRBool aShouldGetButtonStates);
--- a/widget/src/cocoa/nsNativeThemeCocoa.mm
+++ b/widget/src/cocoa/nsNativeThemeCocoa.mm
@@ -112,30 +112,47 @@ static void InflateControlRect(NSRect* r
   int controlSize = EnumSizeForCocoaSize(cocoaControlSize);
   const float* buttonMargins = marginSet[osIndex][controlSize];
   rect->origin.x -= buttonMargins[leftMargin];
   rect->origin.y -= buttonMargins[bottomMargin];
   rect->size.width += buttonMargins[leftMargin] + buttonMargins[rightMargin];
   rect->size.height += buttonMargins[bottomMargin] + buttonMargins[topMargin];
 }
 
-static NSWindow* NativeWindowForFrame(nsIFrame* aFrame, int* aLevelsUp = NULL)
+static NSWindow* NativeWindowForFrame(nsIFrame* aFrame, int* aLevelsUp = NULL,
+                                      nsIWidget** aTopLevelWidget = NULL)
 {
   if (!aFrame)
     return nil;  
 
   nsIWidget* widget = aFrame->GetWindow();
   if (!widget)
     return nil;
 
   nsIWidget* topLevelWidget = widget->GetTopLevelWidget(aLevelsUp);
+  if (aTopLevelWidget)
+    *aTopLevelWidget = topLevelWidget;
 
   return (NSWindow*)topLevelWidget->GetNativeData(NS_NATIVE_WINDOW);
 }
 
+static BOOL FrameIsInActiveWindow(nsIFrame* aFrame)
+{
+  nsIWidget* topLevelWidget = NULL;
+  NSWindow* win = NativeWindowForFrame(aFrame, NULL, &topLevelWidget);
+  if (!topLevelWidget || !win)
+    return YES;
+
+  // XUL popups, e.g. the toolbar customization popup, can't become key windows,
+  // but controls in these windows should still get the active look.
+  nsWindowType windowType;
+  topLevelWidget->GetWindowType(windowType);
+  return [win isKeyWindow] || (windowType == eWindowType_popup);
+}
+
 NS_IMPL_ISUPPORTS1(nsNativeThemeCocoa, nsITheme)
 
 
 nsNativeThemeCocoa::nsNativeThemeCocoa()
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   mPushButtonCell = [[NSButtonCell alloc] initTextCell:nil];
@@ -158,33 +175,35 @@ nsNativeThemeCocoa::~nsNativeThemeCocoa(
   [mRadioButtonCell release];
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 void
 nsNativeThemeCocoa::DrawCheckbox(CGContextRef cgContext, ThemeButtonKind inKind,
                                  const HIRect& inBoxRect, PRBool inChecked,
-                                 PRBool inDisabled, PRInt32 inState)
+                                 PRBool inDisabled, PRInt32 inState, nsIFrame* aFrame)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   HIThemeButtonDrawInfo bdi;
   bdi.version = 0;
   bdi.kind = inKind;
 
+  BOOL isActive = FrameIsInActiveWindow(aFrame);
+
   if (inDisabled)
     bdi.state = kThemeStateUnavailable;
   else if ((inState & NS_EVENT_STATE_ACTIVE) && (inState & NS_EVENT_STATE_HOVER))
     bdi.state = kThemeStatePressed;
   else
-    bdi.state = kThemeStateActive;
+    bdi.state = isActive ? kThemeStateActive : kThemeStateInactive;
 
   bdi.value = inChecked ? kThemeButtonOn : kThemeButtonOff;
-  bdi.adornment = (inState & NS_EVENT_STATE_FOCUS) ? kThemeAdornmentFocus : kThemeAdornmentNone;
+  bdi.adornment = (inState & NS_EVENT_STATE_FOCUS && isActive) ? kThemeAdornmentFocus : kThemeAdornmentNone;
 
   HIRect drawFrame = inBoxRect;
 
   // on Tiger, shift the checkbox rendering down 1px to get the frame
   // in the right spot
   if (!nsToolkit::OnLeopardOrLater() && inKind == kThemeSmallCheckBox)
     drawFrame.origin.y += 1;
 
@@ -343,17 +362,17 @@ nsNativeThemeCocoa::DrawCellWithScaling(
 
 #if DRAW_IN_FRAME_DEBUG
   CGContextSetRGBFillColor(cgContext, 0.0, 0.0, 0.5, 0.25);
   CGContextFillRect(cgContext, destRect);
 #endif
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
-                                        
+
 // These are the sizes that Gecko needs to request to draw if it wants
 // to get a standard-sized Aqua radio button drawn. Note that the rects
 // that draw these are actually a little bigger.
 #define NATURAL_MINI_RADIO_BUTTON_WIDTH 11
 #define NATURAL_MINI_RADIO_BUTTON_HEIGHT 11
 #define NATURAL_SMALL_RADIO_BUTTON_WIDTH 14
 #define NATURAL_SMALL_RADIO_BUTTON_HEIGHT 14
 #define NATURAL_REGULAR_RADIO_BUTTON_WIDTH 16
@@ -371,23 +390,23 @@ static const float radioButtonMargins[2]
     {0, 4, 0, -4}, // mini
     {0, 3, 0, -3}, // small
     {0, 3, 0, -3}  // regular
   }
 };
 
 void
 nsNativeThemeCocoa::DrawRadioButton(CGContextRef cgContext, const HIRect& inBoxRect, PRBool inSelected,
-                                    PRBool inDisabled, PRInt32 inState)
+                                    PRBool inDisabled, PRInt32 inState, nsIFrame* aFrame)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   NSRect drawRect = NSMakeRect(inBoxRect.origin.x, inBoxRect.origin.y, inBoxRect.size.width, inBoxRect.size.height);
 
-  [mRadioButtonCell setEnabled:!inDisabled];
+  [mRadioButtonCell setEnabled:(!inDisabled && FrameIsInActiveWindow(aFrame))];
   [mRadioButtonCell setShowsFirstResponder:(inState & NS_EVENT_STATE_FOCUS)];
   [mRadioButtonCell setState:(inSelected ? NSOnState : NSOffState)];
   [mRadioButtonCell setHighlighted:((inState & NS_EVENT_STATE_ACTIVE) && (inState & NS_EVENT_STATE_HOVER))];
 
   // Always use a regular size control because for some reason NSCell doesn't respect other
   // size choices here. Maybe because of a rendering context/ctm setup it doesn't like?
   NSControlSize controlSize = NSRegularControlSize;
   [mRadioButtonCell setControlSize:controlSize];
@@ -429,25 +448,30 @@ static const float pushButtonMargins[2][
 
 // The height at which we start doing square buttons instead of rounded buttons
 // Rounded buttons look bad if drawn at a height greater than 26, so at that point
 // we switch over to doing square buttons which looks fine at any size.
 #define DO_SQUARE_BUTTON_HEIGHT 26
 
 void
 nsNativeThemeCocoa::DrawPushButton(CGContextRef cgContext, const HIRect& inBoxRect, PRBool inIsDefault,
-                                   PRBool inDisabled, PRInt32 inState)
+                                   PRBool inDisabled, PRInt32 inState, nsIFrame* aFrame)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   NSRect drawRect = NSMakeRect(inBoxRect.origin.x, inBoxRect.origin.y, inBoxRect.size.width, inBoxRect.size.height);
 
+  BOOL isActive = FrameIsInActiveWindow(aFrame);
+
   [mPushButtonCell setEnabled:!inDisabled];
-  [mPushButtonCell setHighlighted:((inState & NS_EVENT_STATE_ACTIVE) && (inState & NS_EVENT_STATE_HOVER) || (inIsDefault && !inDisabled))];
-  [mPushButtonCell setShowsFirstResponder:(inState & NS_EVENT_STATE_FOCUS)];
+  [mPushButtonCell setHighlighted:(((inState & NS_EVENT_STATE_ACTIVE) &&
+                                    (inState & NS_EVENT_STATE_HOVER) ||
+                                    (inIsDefault && !inDisabled)) && 
+                                   isActive)];
+  [mPushButtonCell setShowsFirstResponder:(inState & NS_EVENT_STATE_FOCUS) && !inDisabled && isActive];
 
   CGAffineTransform savedCTM = CGContextGetCTM(cgContext);
 
   // This flips the image in place and is necessary to work around a bug in the way
   // NSButtonCell draws buttons.
   CGContextScaleCTM(cgContext, 1.0f, -1.0f);
   CGContextTranslateCTM(cgContext, 0.0f, -(2.0 * drawRect.origin.y + drawRect.size.height));
 
@@ -501,34 +525,44 @@ nsNativeThemeCocoa::DrawPushButton(CGCon
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 
 void
 nsNativeThemeCocoa::DrawButton(CGContextRef cgContext, ThemeButtonKind inKind,
                                const HIRect& inBoxRect, PRBool inIsDefault, PRBool inDisabled,
                                ThemeButtonValue inValue, ThemeButtonAdornment inAdornment,
-                               PRInt32 inState)
+                               PRInt32 inState, nsIFrame* aFrame)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
+  BOOL isActive = FrameIsInActiveWindow(aFrame);
+
   HIThemeButtonDrawInfo bdi;
   bdi.version = 0;
   bdi.kind = inKind;
   bdi.value = inValue;
   bdi.adornment = inAdornment;
 
-  if (inDisabled)
+  if (inDisabled) {
     bdi.state = kThemeStateUnavailable;
-  else if ((inState & NS_EVENT_STATE_ACTIVE) && (inState & NS_EVENT_STATE_HOVER))
+  }
+  else if ((inState & NS_EVENT_STATE_ACTIVE) && (inState & NS_EVENT_STATE_HOVER)) {
     bdi.state = kThemeStatePressed;
-  else
-    bdi.state = (inKind == kThemeArrowButton) ? kThemeStateUnavailable : kThemeStateActive;
+  }
+  else {
+    if (inKind == kThemeArrowButton)
+      bdi.state = kThemeStateUnavailable; // these are always drawn as unavailable
+    else if (!isActive && (inKind == kThemeListHeaderButton || inKind == kThemePopupButton))
+      bdi.state = kThemeStateInactive;
+    else
+      bdi.state = kThemeStateActive;
+  }
 
-  if (inState & NS_EVENT_STATE_FOCUS)
+  if (inState & NS_EVENT_STATE_FOCUS && isActive)
     bdi.adornment |= kThemeAdornmentFocus;
 
   if (inIsDefault && !inDisabled)
     bdi.adornment |= kThemeAdornmentDefault;
 
   HIRect drawFrame = inBoxRect;
   PRBool needsScaling = PR_FALSE;
   int drawWidth = 0, drawHeight = 0;
@@ -628,46 +662,51 @@ nsNativeThemeCocoa::DrawButton(CGContext
 }
 
 
 void
 nsNativeThemeCocoa::DrawSpinButtons(CGContextRef cgContext, ThemeButtonKind inKind,
                                     const HIRect& inBoxRect, PRBool inDisabled,
                                     ThemeDrawState inDrawState,
                                     ThemeButtonAdornment inAdornment,
-                                    PRInt32 inState)
+                                    PRInt32 inState, nsIFrame* aFrame)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   HIThemeButtonDrawInfo bdi;
   bdi.version = 0;
   bdi.kind = inKind;
-  bdi.state = inDrawState;
   bdi.value = kThemeButtonOff;
   bdi.adornment = inAdornment;
 
   if (inDisabled)
     bdi.state = kThemeStateUnavailable;
+  else
+    bdi.state = FrameIsInActiveWindow(aFrame) ? inDrawState : kThemeStateActive;
 
   HIThemeDrawButton(&inBoxRect, &bdi, cgContext, HITHEME_ORIENTATION, NULL);
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 
 void
 nsNativeThemeCocoa::DrawFrame(CGContextRef cgContext, HIThemeFrameKind inKind,
                               const HIRect& inBoxRect, PRBool inIsDisabled, PRInt32 inState)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   HIThemeFrameDrawInfo fdi;
   fdi.version = 0;
   fdi.kind = inKind;
+
+  // We don't ever set an inactive state for this because it doesn't
+  // look right (see other apps).
   fdi.state = inIsDisabled ? kThemeStateUnavailable : kThemeStateActive;
+
   // for some reason focus rings on listboxes draw incorrectly
   if (inKind == kHIThemeFrameListBox)
     fdi.isFocused = 0;
   else
     fdi.isFocused = (inState & NS_EVENT_STATE_FOCUS) != 0;
 
   // HIThemeDrawFrame takes the rect for the content area of the frame, not
   // the bounding rect for the frame. Here we reduce the size of the rect we
@@ -697,68 +736,69 @@ nsNativeThemeCocoa::DrawFrame(CGContextR
 
   HIThemeDrawFrame(&drawRect, &fdi, cgContext, HITHEME_ORIENTATION);
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 
 void
-nsNativeThemeCocoa::DrawProgress(CGContextRef cgContext,
-                                 const HIRect& inBoxRect, PRBool inIsIndeterminate, 
-                                 PRBool inIsHorizontal, PRInt32 inValue)
+nsNativeThemeCocoa::DrawProgress(CGContextRef cgContext, const HIRect& inBoxRect,
+                                 PRBool inIsIndeterminate, PRBool inIsHorizontal,
+                                 PRInt32 inValue, nsIFrame* aFrame)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   HIThemeTrackDrawInfo tdi;
 
   PRInt32 stepsPerSecond = inIsIndeterminate ? 60 : 30;
   PRInt32 milliSecondsPerStep = 1000 / stepsPerSecond;
 
   tdi.version = 0;
   tdi.kind = inIsIndeterminate ? kThemeMediumIndeterminateBar: kThemeMediumProgressBar;
   tdi.bounds = inBoxRect;
   tdi.min = 0;
   tdi.max = 100;
   tdi.value = inValue;
   tdi.attributes = inIsHorizontal ? kThemeTrackHorizontal : 0;
-  tdi.enableState = kThemeTrackActive;
+  tdi.enableState = FrameIsInActiveWindow(aFrame) ? kThemeTrackActive : kThemeTrackInactive;
   tdi.trackInfo.progress.phase = PR_IntervalToMilliseconds(PR_IntervalNow()) /
                                  milliSecondsPerStep % 16;
 
   HIThemeDrawTrack(&tdi, NULL, cgContext, HITHEME_ORIENTATION);
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 
 void
-nsNativeThemeCocoa::DrawTabPanel(CGContextRef cgContext, const HIRect& inBoxRect)
+nsNativeThemeCocoa::DrawTabPanel(CGContextRef cgContext, const HIRect& inBoxRect,
+                                 nsIFrame* aFrame)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   HIThemeTabPaneDrawInfo tpdi;
 
   tpdi.version = 0;
-  tpdi.state = kThemeStateActive;
+  tpdi.state = FrameIsInActiveWindow(aFrame) ? kThemeStateActive : kThemeStateInactive;
   tpdi.direction = kThemeTabNorth;
   tpdi.size = kHIThemeTabSizeNormal;
 
   HIThemeDrawTabPane(&inBoxRect, &tpdi, cgContext, HITHEME_ORIENTATION);
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 
 void
 nsNativeThemeCocoa::DrawScale(CGContextRef cgContext, const HIRect& inBoxRect,
                               PRBool inIsDisabled, PRInt32 inState,
                               PRBool inIsVertical, PRBool inIsReverse,
-                              PRInt32 inCurrentValue,
-                              PRInt32 inMinValue, PRInt32 inMaxValue)
+                              PRInt32 inCurrentValue, PRInt32 inMinValue,
+                              PRInt32 inMaxValue, nsIFrame* aFrame)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   HIThemeTrackDrawInfo tdi;
 
   tdi.version = 0;
   tdi.kind = kThemeMediumSlider;
   tdi.bounds = inBoxRect;
@@ -767,50 +807,53 @@ nsNativeThemeCocoa::DrawScale(CGContextR
   tdi.value = inCurrentValue;
   tdi.attributes = kThemeTrackShowThumb;
   if (!inIsVertical)
     tdi.attributes |= kThemeTrackHorizontal;
   if (inIsReverse)
     tdi.attributes |= kThemeTrackRightToLeft;
   if (inState & NS_EVENT_STATE_FOCUS)
     tdi.attributes |= kThemeTrackHasFocus;
-  tdi.enableState = inIsDisabled ? kThemeTrackDisabled : kThemeTrackActive;
+  if (inIsDisabled)
+    tdi.enableState = kThemeTrackDisabled;
+  else
+    tdi.enableState = FrameIsInActiveWindow(aFrame) ? kThemeTrackActive : kThemeTrackInactive;
   tdi.trackInfo.slider.thumbDir = kThemeThumbPlain;
   tdi.trackInfo.slider.pressState = 0;
 
   HIThemeDrawTrack(&tdi, NULL, cgContext, HITHEME_ORIENTATION);
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 
 void
 nsNativeThemeCocoa::DrawTab(CGContextRef cgContext, const HIRect& inBoxRect,
                             PRBool inIsDisabled, PRBool inIsFrontmost,
                             PRBool inIsHorizontal, PRBool inTabBottom,
-                            PRInt32 inState)
+                            PRInt32 inState, nsIFrame* aFrame)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   HIThemeTabDrawInfo tdi;
 
   tdi.version = 0;
 
   if (inIsFrontmost) {
     if (inIsDisabled) 
       tdi.style = kThemeTabFrontUnavailable;
     else
-      tdi.style = kThemeTabFront;
+      tdi.style = FrameIsInActiveWindow(aFrame) ? kThemeTabFront : kThemeTabFrontInactive;
   } else {
     if (inIsDisabled)
       tdi.style = kThemeTabNonFrontUnavailable;
     else if ((inState & NS_EVENT_STATE_ACTIVE) && (inState & NS_EVENT_STATE_HOVER))
       tdi.style = kThemeTabNonFrontPressed;
     else
-      tdi.style = kThemeTabNonFront;  
+      tdi.style = FrameIsInActiveWindow(aFrame) ? kThemeTabNonFront : kThemeTabNonFrontInactive;
   }
 
   // don't yet support vertical tabs
   tdi.direction = inTabBottom ? kThemeTabSouth : kThemeTabNorth;
   tdi.size = kHIThemeTabSizeNormal;
   tdi.adornment = kThemeAdornmentNone;
 
   HIThemeDrawTab(&inBoxRect, &tdi, cgContext, HITHEME_ORIENTATION, NULL);
@@ -888,16 +931,20 @@ nsNativeThemeCocoa::GetScrollbarDrawInfo
   aTdi.value = curpos;
   aTdi.attributes = 0;
   aTdi.enableState = kThemeTrackActive;
   if (isHorizontal)
     aTdi.attributes |= kThemeTrackHorizontal;
 
   aTdi.trackInfo.scrollbar.viewsize = (SInt32)thumbSize;
 
+  // This should be done early on so things like "kThemeTrackNothingToScroll" can
+  // override the active enable state.
+  aTdi.enableState = FrameIsInActiveWindow(aFrame) ? kThemeTrackActive : kThemeTrackInactive;
+
   /* Only display features if we have enough room for them.
    * Gecko still maintains the scrollbar info; this is just a visual issue (bug 380185).
    */
   PRInt32 longSideLength = (PRInt32)(isHorizontal ? (aRect.size.width) : (aRect.size.height));
   if (longSideLength >= (isSmall ? MIN_SMALL_SCROLLBAR_SIZE_WITH_THUMB : MIN_SCROLLBAR_SIZE_WITH_THUMB)) {
     aTdi.attributes |= kThemeTrackShowThumb;
   }
   else if (longSideLength < (isSmall ? MIN_SMALL_SCROLLBAR_SIZE : MIN_SCROLLBAR_SIZE)) {
@@ -1172,59 +1219,59 @@ nsNativeThemeCocoa::DrawWidgetBackground
       break;
 
     case NS_THEME_TOOLTIP:
       CGContextSetRGBFillColor(cgContext, 1.0, 1.0, 0.78, 1.0);
       CGContextFillRect(cgContext, macRect);
       break;
 
     case NS_THEME_CHECKBOX:
-      DrawCheckbox(cgContext, kThemeCheckBox, macRect, IsChecked(aFrame), IsDisabled(aFrame), eventState);
+      DrawCheckbox(cgContext, kThemeCheckBox, macRect, IsChecked(aFrame), IsDisabled(aFrame), eventState, aFrame);
       break;
 
     case NS_THEME_CHECKBOX_SMALL:
-      DrawCheckbox(cgContext, kThemeSmallCheckBox, macRect, IsChecked(aFrame), IsDisabled(aFrame), eventState);
+      DrawCheckbox(cgContext, kThemeSmallCheckBox, macRect, IsChecked(aFrame), IsDisabled(aFrame), eventState, aFrame);
       break;
 
     case NS_THEME_RADIO:
     case NS_THEME_RADIO_SMALL:
-      DrawRadioButton(cgContext, macRect, IsSelected(aFrame), IsDisabled(aFrame), eventState);
+      DrawRadioButton(cgContext, macRect, IsSelected(aFrame), IsDisabled(aFrame), eventState, aFrame);
       break;
 
     case NS_THEME_BUTTON:
-      DrawPushButton(cgContext, macRect, IsDefaultButton(aFrame), IsDisabled(aFrame), eventState);
+      DrawPushButton(cgContext, macRect, IsDefaultButton(aFrame), IsDisabled(aFrame), eventState, aFrame);
       break;
 
     case NS_THEME_BUTTON_BEVEL:
       DrawButton(cgContext, kThemeMediumBevelButton, macRect,
                  IsDefaultButton(aFrame), IsDisabled(aFrame), 
-                 kThemeButtonOff, kThemeAdornmentNone, eventState);
+                 kThemeButtonOff, kThemeAdornmentNone, eventState, aFrame);
       break;
 
     case NS_THEME_SPINNER: {
       ThemeDrawState state = kThemeStateActive;
       nsIContent* content = aFrame->GetContent();
       if (content->AttrValueIs(kNameSpaceID_None, nsWidgetAtoms::state,
                                NS_LITERAL_STRING("up"), eCaseMatters)) {
         state = kThemeStatePressedUp;
       }
       else if (content->AttrValueIs(kNameSpaceID_None, nsWidgetAtoms::state,
                                     NS_LITERAL_STRING("down"), eCaseMatters)) {
         state = kThemeStatePressedDown;
       }
 
       DrawSpinButtons(cgContext, kThemeIncDecButton, macRect, IsDisabled(aFrame),
-                      state, kThemeAdornmentNone, eventState);
+                      state, kThemeAdornmentNone, eventState, aFrame);
     }
       break;
 
     case NS_THEME_TOOLBAR_BUTTON:
       DrawButton(cgContext, kThemePushButton, macRect,
                  IsDefaultButton(aFrame), IsDisabled(aFrame),
-                 kThemeButtonOn, kThemeAdornmentNone, eventState);
+                 kThemeButtonOn, kThemeAdornmentNone, eventState, aFrame);
       break;
 
     case NS_THEME_TOOLBAR_SEPARATOR: {
       HIThemeSeparatorDrawInfo sdi = { 0, kThemeStateActive };
       HIThemeDrawSeparator(&macRect, &sdi, cgContext, HITHEME_ORIENTATION);
     }
       break;
 
@@ -1238,23 +1285,23 @@ nsNativeThemeCocoa::DrawWidgetBackground
       HIThemeHeaderDrawInfo hdi = { 0, kThemeStateActive, kHIThemeHeaderKindWindow };
       HIThemeDrawHeader(&macRect, &hdi, cgContext, HITHEME_ORIENTATION);
     }
       break;
       
     case NS_THEME_DROPDOWN:
       DrawButton(cgContext, kThemePopupButton, macRect,
                  IsDefaultButton(aFrame), IsDisabled(aFrame), 
-                 kThemeButtonOn, kThemeAdornmentNone, eventState);
+                 kThemeButtonOn, kThemeAdornmentNone, eventState, aFrame);
       break;
 
     case NS_THEME_DROPDOWN_BUTTON:
-      DrawButton (cgContext, kThemeArrowButton, macRect, PR_FALSE,
-                  IsDisabled(aFrame), kThemeButtonOn,
-                  kThemeAdornmentArrowDownArrow, eventState);
+      DrawButton(cgContext, kThemeArrowButton, macRect, PR_FALSE,
+                 IsDisabled(aFrame), kThemeButtonOn,
+                 kThemeAdornmentArrowDownArrow, eventState, aFrame);
       break;
 
     case NS_THEME_GROUPBOX: {
       HIThemeGroupBoxDrawInfo gdi = { 0, kThemeStateActive, kHIThemeGroupBoxKindPrimary };
       HIThemeDrawGroupBox(&macRect, &gdi, cgContext, HITHEME_ORIENTATION);
       break;
     }
 
@@ -1272,45 +1319,45 @@ nsNativeThemeCocoa::DrawWidgetBackground
       }
 
       DrawFrame(cgContext, kHIThemeFrameTextFieldSquare,
                 macRect, (IsDisabled(aFrame) || IsReadOnly(aFrame)), eventState);
       break;
       
     case NS_THEME_PROGRESSBAR:
       DrawProgress(cgContext, macRect, IsIndeterminateProgress(aFrame),
-                   PR_TRUE, GetProgressValue(aFrame));
+                   PR_TRUE, GetProgressValue(aFrame), aFrame);
       break;
 
     case NS_THEME_PROGRESSBAR_VERTICAL:
       DrawProgress(cgContext, macRect, IsIndeterminateProgress(aFrame),
-                   PR_FALSE, GetProgressValue(aFrame));
+                   PR_FALSE, GetProgressValue(aFrame), aFrame);
       break;
 
     case NS_THEME_PROGRESSBAR_CHUNK:
     case NS_THEME_PROGRESSBAR_CHUNK_VERTICAL:
       // do nothing, covered by the progress bar cases above
       break;
 
     case NS_THEME_TREEVIEW_TWISTY:
       DrawButton(cgContext, kThemeDisclosureButton, macRect, PR_FALSE, IsDisabled(aFrame), 
-                 kThemeDisclosureRight, kThemeAdornmentNone, eventState);
+                 kThemeDisclosureRight, kThemeAdornmentNone, eventState, aFrame);
       break;
 
     case NS_THEME_TREEVIEW_TWISTY_OPEN:
       DrawButton(cgContext, kThemeDisclosureButton, macRect, PR_FALSE, IsDisabled(aFrame), 
-                 kThemeDisclosureDown, kThemeAdornmentNone, eventState);
+                 kThemeDisclosureDown, kThemeAdornmentNone, eventState, aFrame);
       break;
 
     case NS_THEME_TREEVIEW_HEADER_CELL: {
       TreeSortDirection sortDirection = GetTreeSortDirection(aFrame);
       DrawButton(cgContext, kThemeListHeaderButton, macRect, PR_FALSE, IsDisabled(aFrame), 
                  sortDirection == eTreeSortDirection_Natural ? kThemeButtonOff : kThemeButtonOn,
                  sortDirection == eTreeSortDirection_Descending ?
-                 kThemeAdornmentHeaderButtonSortUp : kThemeAdornmentNone, eventState);      
+                 kThemeAdornmentHeaderButtonSortUp : kThemeAdornmentNone, eventState, aFrame);      
     }
       break;
 
     case NS_THEME_TREEVIEW_TREEITEM:
     case NS_THEME_TREEVIEW:
       // HIThemeSetFill is not available on 10.3
       // HIThemeSetFill(kThemeBrushWhite, NULL, cgContext, HITHEME_ORIENTATION);
       CGContextSetRGBFillColor(cgContext, 1.0, 1.0, 1.0, 1.0);
@@ -1333,17 +1380,17 @@ nsNativeThemeCocoa::DrawWidgetBackground
       if (!maxpos)
         maxpos = 100;
 
       PRBool reverse = aFrame->GetContent()->
         AttrValueIs(kNameSpaceID_None, nsWidgetAtoms::dir,
                     NS_LITERAL_STRING("reverse"), eCaseMatters);
       DrawScale(cgContext, macRect, IsDisabled(aFrame), eventState,
                 (aWidgetType == NS_THEME_SCALE_VERTICAL), reverse,
-                curpos, minpos, maxpos);
+                curpos, minpos, maxpos, aFrame);
     }
       break;
 
     case NS_THEME_SCALE_THUMB_HORIZONTAL:
     case NS_THEME_SCALE_THUMB_VERTICAL:
       // do nothing, drawn by scale
       break;
 
@@ -1414,30 +1461,30 @@ nsNativeThemeCocoa::DrawWidgetBackground
       }
     }
       break;
 
     case NS_THEME_LISTBOX:
       // HIThemeSetFill is not available on 10.3
       CGContextSetRGBFillColor(cgContext, 1.0, 1.0, 1.0, 1.0);
       CGContextFillRect(cgContext, macRect);
-      DrawFrame(cgContext, kHIThemeFrameListBox,
-                macRect, (IsDisabled(aFrame) || IsReadOnly(aFrame)), eventState);
+      DrawFrame(cgContext, kHIThemeFrameListBox, macRect,
+                (IsDisabled(aFrame) || IsReadOnly(aFrame)), eventState);
       break;
     
     case NS_THEME_TAB: {
       DrawTab(cgContext, macRect,
               IsDisabled(aFrame), IsSelectedTab(aFrame),
               PR_TRUE, IsBottomTab(aFrame),
-              eventState);
+              eventState, aFrame);
     }
       break;
 
     case NS_THEME_TAB_PANELS:
-      DrawTabPanel(cgContext, macRect);
+      DrawTabPanel(cgContext, macRect, aFrame);
       break;
   }
 
   nativeDrawing.EndNativeDrawing();
 
   return NS_OK;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
--- a/widget/src/os2/nsSound.cpp
+++ b/widget/src/os2/nsSound.cpp
@@ -1,8 +1,9 @@
+/* vim: set sw=2 sts=2 et cin: */
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  *
  * ***** 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
@@ -19,16 +20,18 @@
  * Netscape Communications Corporation.
  * Portions created by the Initial Developer are Copyright (C) 2000
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  *   Stuart Parmenter <pavlov@netscape.com>
  *   John Fairhurst <john_fairhurst@iname.com>
  *   IBM Corp.
+ *   Peter Weilbacher <mozilla@Weilbacher.org>
+ *   Lars Erdmann
  *
  * 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
@@ -38,68 +41,380 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nscore.h"
 #include "plstr.h"
 #include <stdio.h>
 #include <string.h>
+#include <stdlib.h>
 
 #define INCL_DOS
 #define INCL_DOSERRORS
+#define INCL_MMIOOS2
 #include <os2.h>
+#include <mmioos2.h>
+#include <mcios2.h>
+#define MCI_ERROR_LENGTH 128
 
 #include "nsSound.h"
 #include "nsIURL.h"
 #include "nsNetUtil.h"
 
 #include "nsDirectoryServiceDefs.h"
 
 #include "nsNativeCharsetUtils.h"
 
 NS_IMPL_ISUPPORTS2(nsSound, nsISound, nsIStreamLoaderObserver)
 
-static int                gInitialized = 0;
-static PRBool             gMMPMInstalled = PR_FALSE;
+static int sInitialized = 0;
+static PRBool sMMPMInstalled = PR_FALSE;
+static HMODULE sHModMMIO = NULLHANDLE;
+static HMODULE sHModMDM = NULLHANDLE;
+
+// function pointer definitions, include underscore (work around redef. warning)
+HMMIO (*APIENTRY _mmioOpen)(PSZ, PMMIOINFO, ULONG);
+USHORT (*APIENTRY _mmioClose)(HMMIO, USHORT);
+ULONG (*APIENTRY _mmioGetFormats)(PMMFORMATINFO, LONG, PVOID, PLONG, ULONG, ULONG);
+ULONG (*APIENTRY _mciSendCommand)(USHORT, USHORT, ULONG, PVOID, USHORT);
+#ifdef DEBUG
+ULONG (*APIENTRY _mmioGetLastError)(HMMIO);
+ULONG (*APIENTRY _mmioQueryFormatCount)(PMMFORMATINFO, PLONG, ULONG, ULONG);
+ULONG (*APIENTRY _mmioGetFormatName)(PMMFORMATINFO, PSZ, PLONG, ULONG, ULONG);
+ULONG (*APIENTRY _mciGetErrorString)(ULONG, PSZ, USHORT);
+#endif
+ULONG (*APIENTRY _mmioIniFileHandler)(PMMINIFILEINFO, ULONG);
+
+// argument structure to pass to the background thread
+typedef struct _ARGBUFFER
+{
+  HEV hev;
+  PRUint32 bufLen;
+  const char *buffer;
+  PSZ pszFilename;
+} ARGBUFFER;
+
+////////////////////////////////////////////////////////////////////////
+
+static void InitGlobals(void)
+{
+  ULONG ulrc = 0;
+  char LoadError[CCHMAXPATH];
 
-static void
-InitGlobals(void)
+  ulrc = DosLoadModule(LoadError, CCHMAXPATH, "MMIO", &sHModMMIO);
+  ulrc += DosLoadModule(LoadError, CCHMAXPATH, "MDM", &sHModMDM);
+  if (ulrc == NO_ERROR) {
+#ifdef DEBUG
+    printf("InitGlobals: MMOS2 is installed, both DLLs loaded\n");
+#endif
+    sMMPMInstalled = PR_TRUE;
+    // MMOS2 is installed, so we can query the necessary functions
+    // mmio functions are in MMIO.DLL
+    ulrc = DosQueryProcAddr(sHModMMIO, 0L, "mmioOpen", (PFN *)&_mmioOpen);
+    ulrc += DosQueryProcAddr(sHModMMIO, 0L, "mmioClose", (PFN *)&_mmioClose);
+    ulrc += DosQueryProcAddr(sHModMMIO, 0L, "mmioGetFormats", (PFN *)&_mmioGetFormats);
+    // mci functions are in MDM.DLL
+    ulrc += DosQueryProcAddr(sHModMDM, 0L, "mciSendCommand", (PFN *)&_mciSendCommand);
+#ifdef DEBUG
+    ulrc += DosQueryProcAddr(sHModMMIO, 0L, "mmioGetLastError", (PFN *)&_mmioGetLastError);
+    ulrc += DosQueryProcAddr(sHModMMIO, 0L, "mmioQueryFormatCount", (PFN *)&_mmioQueryFormatCount);
+    ulrc += DosQueryProcAddr(sHModMMIO, 0L, "mmioGetFormatName", (PFN *)&_mmioGetFormatName);
+    ulrc += DosQueryProcAddr(sHModMDM, 0L, "mciGetErrorString", (PFN *)&_mciGetErrorString);
+#endif
+
+    ulrc += DosQueryProcAddr(sHModMMIO, 0L, "mmioIniFileHandler", (PFN *)&_mmioIniFileHandler);
+
+    // if one of these failed, we have some kind of non-functional MMOS2 installation
+    if (ulrc != NO_ERROR) {
+      NS_WARNING("MMOS2 is installed, but seems to have corrupt DLLs");
+      sMMPMInstalled = PR_FALSE;
+    }
+  }
+}
+
+////////////////////////////////////////////////////////////////////////
+
+// Tries to determine the data format in the buffer using file "magic"
+// and a loop through MMOS2 audio codecs.
+// Returns the FourCC handle for the format, or 0 when failing to find format
+// and codec.
+FOURCC determineFourCC(PRUint32 aDataLen, const char *aData)
 {
-  APIRET ulrc;
-  HMODULE hmod;
-  char LoadError[CCHMAXPATH];
-  ulrc = DosLoadModule(LoadError, CCHMAXPATH, "MMPM", &hmod);
-  if (ulrc == NO_ERROR) {
-    gMMPMInstalled = PR_TRUE;
+  FOURCC fcc = 0;
+
+  // Start to compare the first bytes of the data with magic to determine the
+  // most likely format upfront.
+  if (memcmp(aData, "RIFF", 4) == 0) {                                    // WAV
+    fcc = mmioFOURCC('W', 'A', 'V', 'E');
+  } else if (memcmp(aData, "ID3", 3) == 0 ||       // likely MP3 with ID3 header
+             ((aData[0] & 0xFF) == 0xFF &&   // various versions of MPEG layer 3
+              ((aData[1] & 0xFE) == 0xFA ||                                // v1
+               (aData[1] & 0xFE) == 0xF2 ||                                // v2
+               (aData[1] & 0xFE) == 0xE2)))                              // v2.5
+  {
+    fcc = mmioFOURCC('M','P','3',' ');
+  } else if (memcmp(aData, "OggS", 4) == 0) {                             // OGG
+    fcc = mmioFOURCC('O','G','G','S');
+  } else if (memcmp(aData, "fLaC", 4) == 0) {                            // FLAC
+    fcc = mmioFOURCC('f','L','a','C');
   }
-  DosFreeModule(hmod);
-  gInitialized = 1;
+
+  // The following is too flakey because several OS/2 IOProc don't behave as
+  // they should and would cause us to crash. So just skip this for now...
+#if 0
+  if (fcc) // already found one
+    return fcc;
+
+  // None of the popular formats found, so use the list of MMOS2 audio codecs to
+  // find one that can open the file.
+  MMFORMATINFO mmfi;
+  LONG lNum;
+  memset(&mmfi, '\0', sizeof(mmfi));
+  mmfi.ulStructLen = sizeof(mmfi);
+  mmfi.ulMediaType |= MMIO_MEDIATYPE_AUDIO;
+  ULONG ulrc = _mmioQueryFormatCount(&mmfi, &lNum, 0L, 0L);
+
+  PMMFORMATINFO mmflist = (PMMFORMATINFO)calloc(lNum, sizeof(MMFORMATINFO));
+  LONG lFormats;
+  ulrc = _mmioGetFormats(&mmfi, lNum, mmflist, &lFormats, 0L, 0L);
+
+  MMIOINFO mi;
+  memset(&mi, '\0', sizeof(mi));
+  mi.fccChildIOProc = FOURCC_MEM;
+  unsigned char szBuffer[sizeof(FOURCC) + CCHMAXPATH + 4];
+  for (int i = lFormats-1; i >= 0; i--) {
+    // Loop through formats. Do it backwards to find at least WAV before the
+    // faulty VORBIS/FLAC/MP3 IOProcs that will open any format.
+    MMFORMATINFO mmfi = mmflist[i];
+#ifdef DEBUG
+    LONG lBytesRead;
+    _mmioGetFormatName(&mmfi, (char *)szBuffer, &lBytesRead, 0L, 0L);
+    printf("determineFour Codec %d: name=%s media=0x%lx ext=%s fcc=%c%c%c%c/%ld/%p\n",
+           i, szBuffer, mmfi.ulMediaType, mmfi.szDefaultFormatExt,
+           (char)(mmfi.fccIOProc), (char)(mmfi.fccIOProc >> 8),
+           (char)(mmfi.fccIOProc >> 16), (char)(mmfi.fccIOProc >> 24),
+           mmfi.fccIOProc, (void *)mmfi.fccIOProc);
+#endif
+
+    // this codec likely crashes the program when the buffer is not of the
+    // expected format
+    if (mmfi.fccIOProc == mmioFOURCC('A','V','C','A')) {
+      continue;
+    }
+
+    mi.fccIOProc = mmfi.fccIOProc;
+    HMMIO hmmio= _mmioOpen(NULL, &mi, MMIO_READ);
+    if (hmmio) {
+      fcc = mmfi.fccIOProc;
+      _mmioClose(hmmio, 0);
+      break;
+    }
+  }
+  free(mmflist);
+#endif
+
+#ifdef DEBUG
+  printf("determineFourCC: Codec fcc is 0x%lx or --%c%c%c%c--\n", fcc,
+         (char)(fcc), (char)(fcc >> 8), (char)(fcc >> 16), (char)(fcc >> 24));
+#endif
+
+  return fcc;
 }
 
+// Play the sound that was set up in the argument structure. If an error occurs,
+// beep at least.  To be used as function for a new background thread.
+static void playSound(void *aArgs)
+{
+  ULONG ulrc = NO_ERROR;
+  ARGBUFFER args;
+  memcpy(&args, aArgs, sizeof(args));
+
+  MMIOINFO mi;
+  memset(&mi, '\0', sizeof(mi));
+  HMMIO hmmio = NULLHANDLE;
+
+  do { // inner block (break in case of error)
+    if (args.pszFilename) {
+      // determine size of file that we want to read
+      FILESTATUS3 fs3;
+      memset(&fs3, '\0', sizeof(fs3));
+      ulrc = DosQueryPathInfo(args.pszFilename, FIL_STANDARD, &fs3, sizeof(fs3));
+      mi.cchBuffer = fs3.cbFile;
+    } else {
+      // use size of the existing buffer
+      mi.cchBuffer = args.bufLen;
+    }
+
+    // Read or copy the sound into a local memory buffer for easy playback.
+    // (If we got the sound in a buffer originally, that buffer could
+    // "disappear" while we are still playing it.)
+    ulrc = DosAllocMem((PPVOID)&mi.pchBuffer, mi.cchBuffer,
+#ifdef OS2_HIGH_MEMORY             /* only if compiled with high-memory  */
+                       OBJ_ANY | /* support, we can allocate anywhere! */
+#endif
+                       PAG_READ | PAG_WRITE | PAG_COMMIT);
+    if (ulrc != NO_ERROR) {
+#ifdef DEBUG
+      printf("playSound: Could not allocate the sound buffer, ulrc=%ld\n", ulrc);
+#endif
+      break;
+    }
+
+    if (args.pszFilename) {
+      // read the sound from file into memory
+      HFILE hf = NULLHANDLE;
+      ULONG ulAction = 0;
+      ulrc = DosOpen(args.pszFilename, &hf, &ulAction, 0, FILE_NORMAL,
+                     OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW,
+                     OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE,
+                     NULL);
+      if (ulrc != NO_ERROR) {
+#ifdef DEBUG
+        printf("playSound: could not open the sound file \"%s\" (%ld)\n",
+               args.pszFilename, ulrc);
+#endif
+        break;
+      }
+      ULONG ulRead = 0;
+      ulrc = DosRead(hf, mi.pchBuffer, mi.cchBuffer, &ulRead);
+      DosClose(hf);
+      if (ulrc != NO_ERROR) {
+#ifdef DEBUG
+        printf("playSound: read %ld of %ld bytes from the sound file \"%s\" (%ld)\n",
+               ulRead, mi.cchBuffer, args.pszFilename, ulrc);
+#endif
+        break;
+      }
+    } else {
+      // copy the passed sound buffer into local memory
+      memcpy(mi.pchBuffer, args.buffer, args.bufLen);
+    }
+
+    DosPostEventSem(args.hev); // calling thread can continue
+
+    // Now the sound is loaded into memory in any case, play it from there.
+    mi.fccChildIOProc = FOURCC_MEM;
+    mi.fccIOProc = determineFourCC(mi.cchBuffer, mi.pchBuffer);
+    if (!mi.fccIOProc) {
+      NS_WARNING("playSound: unknown sound format in memory buffer");
+      break;
+    }
+    mi.ulTranslate = MMIO_TRANSLATEDATA | MMIO_TRANSLATEHEADER;
+    hmmio = _mmioOpen(NULL, &mi, MMIO_READ | MMIO_DENYWRITE);
+
+    if (!hmmio) {
+#ifdef DEBUG
+      ULONG ulrc = _mmioGetLastError(hmmio);
+      if (args.pszFilename) {
+        printf("playSound: mmioOpen failed, cannot play sound from \"%s\" (%ld)\n",
+               args.pszFilename, ulrc);
+      } else {
+        printf("playSound: mmioOpen failed, cannot play sound buffer (%ld)\n",
+               ulrc);
+      }
+#endif
+      break;
+    }
+
+    // open the sound device
+    MCI_OPEN_PARMS mop;
+    memset(&mop, '\0', sizeof(mop));
+    mop.pszElementName = (PSZ)hmmio;
+    mop.pszDeviceType = (PSZ)MAKEULONG(MCI_DEVTYPE_WAVEFORM_AUDIO, 0);
+    ulrc = _mciSendCommand(0, MCI_OPEN,
+                           MCI_OPEN_MMIO | MCI_OPEN_TYPE_ID | MCI_OPEN_SHAREABLE | MCI_WAIT,
+                           (PVOID)&mop, 0);
+    if (ulrc != MCIERR_SUCCESS) {
+#ifdef DEBUG
+      CHAR errorBuffer[MCI_ERROR_LENGTH];
+      _mciGetErrorString(ulrc, errorBuffer, MCI_ERROR_LENGTH);
+      printf("playSound: mciSendCommand with MCI_OPEN_MMIO returned %ld: %s\n",
+             ulrc, errorBuffer);
+#endif
+      break;
+    }
+
+    // play the sound
+    MCI_PLAY_PARMS mpp;
+    memset(&mpp, '\0', sizeof(mpp));
+    ulrc = _mciSendCommand(mop.usDeviceID, MCI_PLAY, MCI_WAIT, &mpp, 0);
+#ifdef DEBUG
+    // just ignore further failures in non-debug mode
+    if (ulrc != MCIERR_SUCCESS) {
+      CHAR errorBuffer[MCI_ERROR_LENGTH];
+      _mciGetErrorString(ulrc, errorBuffer, MCI_ERROR_LENGTH);
+      printf("playSound: mciSendCommand with MCI_PLAY returned %ld: %s\n",
+             ulrc, errorBuffer);
+    }
+#endif
+
+    // end playing
+    ulrc = _mciSendCommand(mop.usDeviceID, MCI_STOP, MCI_WAIT, &mpp, 0); // be nice
+    ulrc = _mciSendCommand(mop.usDeviceID, MCI_CLOSE, MCI_WAIT, &mpp, 0);
+#ifdef DEBUG
+    if (ulrc != MCIERR_SUCCESS) {
+      CHAR errorBuffer[MCI_ERROR_LENGTH];
+      _mciGetErrorString(ulrc, errorBuffer, MCI_ERROR_LENGTH);
+      printf("playSound: mciSendCommand with MCI_CLOSE returned %ld: %s\n",
+             ulrc, errorBuffer);
+    }
+#endif
+    _mmioClose(hmmio, 0);
+    DosFreeMem(mi.pchBuffer);
+    _endthread();
+  } while(0); // end of inner block
+
+  // cleanup after an error
+  WinAlarm(HWND_DESKTOP, WA_WARNING); // Beep()
+  if (hmmio)
+    _mmioClose(hmmio, 0);
+  if (mi.pchBuffer)
+    DosFreeMem(mi.pchBuffer);
+}
 
 ////////////////////////////////////////////////////////////////////////
+
 nsSound::nsSound()
 {
-  if (!gInitialized) {
+  if (!sInitialized) {
     InitGlobals();
   }
+  sInitialized++;
+#ifdef DEBUG
+  printf("nsSound::nsSound: sInitialized=%d\n", sInitialized);
+#endif
 }
 
 nsSound::~nsSound()
 {
+  sInitialized--;
+#ifdef DEBUG
+  printf("nsSound::~nsSound: sInitialized=%d\n", sInitialized);
+#endif
+  // (try to) unload modules after last user ended
+  if (!sInitialized) {
+#ifdef DEBUG
+    printf("nsSound::~nsSound: Trying to free modules...\n");
+#endif
+    ULONG ulrc;
+    ulrc = DosFreeModule(sHModMMIO);
+    ulrc += DosFreeModule(sHModMDM);
+    if (ulrc != NO_ERROR) {
+      NS_WARNING("DosFreeModule did not work");
+    }
+  }
 }
 
 NS_IMETHODIMP nsSound::OnStreamComplete(nsIStreamLoader *aLoader,
                                         nsISupports *context,
                                         nsresult aStatus,
                                         PRUint32 dataLen,
                                         const PRUint8 *data)
 {
-
   if (NS_FAILED(aStatus)) {
 #ifdef DEBUG
     if (aLoader) {
       nsCOMPtr<nsIRequest> request;
       aLoader->GetRequest(getter_AddRefs(request));
       if (request) {
         nsCOMPtr<nsIURI> uri;
         nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);
@@ -112,94 +427,38 @@ NS_IMETHODIMP nsSound::OnStreamComplete(
             }
         }
       }
     }
 #endif
     return NS_ERROR_FAILURE;
   }
 
-  if (memcmp(data, "RIFF", 4) || (!gMMPMInstalled)) {
-    NS_WARNING("We only support WAV files currently.\n");
+  if (!sMMPMInstalled) {
+    NS_WARNING("Sound output only works with MMOS2 installed");
     Beep();
     return NS_OK;
   }
 
-  nsresult rv;
-    
-  static const char *kSoundTmpFileName = "mozsound.wav";
+  ARGBUFFER arg;
+  memset(&arg, '\0', sizeof(arg));
+  APIRET rc = DosCreateEventSem(NULL, &(arg.hev), 0UL, 0UL);
 
-  nsCOMPtr<nsIFile> soundTmp;
-  rv = NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(soundTmp));
-  if (NS_FAILED(rv)) return rv;
-  rv = soundTmp->AppendNative(nsDependentCString(kSoundTmpFileName));
-  nsCAutoString soundFilename;
-  (void) soundTmp->GetNativePath(soundFilename);
-  FILE *fp = fopen(soundFilename.get(), "wb+");
-  if (fp) {
-    fwrite(data, dataLen, 1, fp);
-    fclose(fp);
-    HOBJECT hobject = WinQueryObject(soundFilename.get());
-    WinSetObjectData(hobject, "OPEN=DEFAULT");
-  } else {
-    NS_WARNING("Could not open WAV file for binary writing.\n");
-    Beep();
-  }
+  // Play the sound on a new thread using MMOS2, in this case pass
+  // the memory buffer in the argument structure.
+  arg.bufLen = dataLen;
+  arg.buffer = (char *)data;
+  _beginthread(playSound, NULL, 32768, (void *)&arg);
+
+  // Wait until the buffer was copied, but not indefinitely to not block the
+  // UI in case a really large sound file is copied.
+  rc = DosWaitEventSem(arg.hev, 100);
+  rc = DosCloseEventSem(arg.hev);
 
   return NS_OK;
-
-#ifdef OLDCODE /* Some day we could try to get this working */
-  ULONG ulRC;
-  CHAR errorBuffer[128];
-
-  HMMIO hmmio;
-  MMIOINFO mmioinfo;
-
-  memset(&mmioinfo, 0, sizeof(MMIOINFO));
-  mmioinfo.fccIOProc = FOURCC_MEM;
-  mmioinfo.cchBuffer = dataLen;
-  mmioinfo.pchBuffer = (char*)data;
-  USHORT usDeviceID;
-
-  hmmio = mmioOpen(NULL, &mmioinfo, MMIO_READWRITE);
-
-  MCI_OPEN_PARMS mop;
-  memset(&mop, 0, sizeof(MCI_OPEN_PARMS));
-
-  mop.pszElementName = (char*)hmmio;
-  CHAR DeviceType[] = "waveaudio";
-  mop.pszDeviceType = (PSZ)&DeviceType;
-
-  ulRC = mciSendCommand(0, MCI_OPEN, MCI_OPEN_MMIO | MCI_WAIT, &mop, 0);
-
-  if (ulRC != MCIERR_SUCCESS) {
-     ulRC = mciGetErrorString(ulRC, errorBuffer, 128);
-  }
-
-  usDeviceID = mop.usDeviceID;
-
-  MCI_OPEN_PARMS mpp;
-
-  memset(&mpp, 0, sizeof(MCI_OPEN_PARMS));
-  ulRC = mciSendCommand(usDeviceID, MCI_PLAY, MCI_WAIT, &mpp, 0);
-
-  if (ulRC != MCIERR_SUCCESS) {
-     ulRC = mciGetErrorString(ulRC, errorBuffer, 128);
-  }
-
-  MCI_GENERIC_PARMS mgp;
-  memset(&mgp, 0, sizeof(MCI_GENERIC_PARMS));
-  ulRC = mciSendCommand(usDeviceID, MCI_CLOSE, MCI_WAIT, &mgp, 0);
-
-  if (ulRC != MCIERR_SUCCESS) {
-     ulRC = mciGetErrorString(ulRC, errorBuffer, 128);
-  }
-
-  mmioClose(hmmio, 0);
-#endif
 }
 
 NS_METHOD nsSound::Beep()
 {
   WinAlarm(HWND_DESKTOP, WA_WARNING);
 
   return NS_OK;
 }
@@ -216,25 +475,32 @@ NS_METHOD nsSound::Play(nsIURL *aURL)
 
 NS_IMETHODIMP nsSound::Init()
 {
   return NS_OK;
 }
 
 NS_IMETHODIMP nsSound::PlaySystemSound(const nsAString &aSoundAlias)
 {
-  /* We don't have a default mail sound on OS/2, so just beep */
-  /* Also just beep if MMPM isn't installed */
-  if (aSoundAlias.EqualsLiteral("_moz_mailbeep") || (!gMMPMInstalled)) {
+  // We don't have a default mail sound on OS/2, so just beep.
+  // Also just beep if MMPM isn't installed.
+  if (aSoundAlias.EqualsLiteral("_moz_mailbeep") || (!sMMPMInstalled)) {
     Beep();
+    return NS_OK;
   }
-  else {
-    nsCAutoString nativeSoundAlias;
-    NS_CopyUnicodeToNative(aSoundAlias, nativeSoundAlias);
-    HOBJECT hobject = WinQueryObject(nativeSoundAlias.get());
-    if (hobject)
-      WinSetObjectData(hobject, "OPEN=DEFAULT");
-    else 
-      Beep();
-  }
+  nsCAutoString nativeSoundAlias;
+  NS_CopyUnicodeToNative(aSoundAlias, nativeSoundAlias);
+
+  ARGBUFFER arg;
+  memset(&arg, '\0', sizeof(arg));
+  APIRET rc = DosCreateEventSem(NULL, &(arg.hev), 0UL, 0UL);
+
+  // Play the sound on a new thread using MMOS2, in this case pass
+  // the filename in the argument structure.
+  arg.pszFilename = (PSZ)nativeSoundAlias.get();
+  _beginthread(playSound, NULL, 32768, (void *)&arg);
+
+  // Try to wait a while until the file is loaded, but not too long...
+  rc = DosWaitEventSem(arg.hev, 100);
+  rc = DosCloseEventSem(arg.hev);
+
   return NS_OK;
 }
-
--- a/xpcom/tests/unit/test_nsIMutableArray.js
+++ b/xpcom/tests/unit/test_nsIMutableArray.js
@@ -33,25 +33,123 @@
  * 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 ***** */
 
 const Ci = Components.interfaces;
 const Cr = Components.results;
 const Cc = Components.classes;
+const CC = Components.Constructor;
+
+var MutableArray = CC("@mozilla.org/array;1", "nsIMutableArray");
+var SupportsString = CC("@mozilla.org/supports-string;1", "nsISupportsString");
+
+function create_n_element_array(n)
+{
+  var arr = new MutableArray();
+  for (let i=0; i<n; i++) {
+    let str = new SupportsString();
+    str.data = "element " + i;
+    arr.appendElement(str, false);
+  }
+  return arr;
+}
 
 function test_appending_null_actually_inserts()
 {
-  var arr = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray);
+  var arr = new MutableArray();
   do_check_eq(0, arr.length);
   arr.appendElement(null, false);
   do_check_eq(1, arr.length);
 }
 
+function test_object_gets_appended()
+{
+  var arr = new MutableArray();
+  var str = new SupportsString();
+  str.data = "hello";
+  arr.appendElement(str, false);
+  do_check_eq(1, arr.length);
+  var obj = arr.queryElementAt(0, Ci.nsISupportsString);
+  do_check_eq(str, obj);
+}
+
+function test_insert_at_beginning()
+{
+  var arr = create_n_element_array(5);
+  // just a sanity check
+  do_check_eq(5, arr.length);
+  var str = new SupportsString();
+  str.data = "hello";
+  arr.insertElementAt(str, 0, false);
+  do_check_eq(6, arr.length);
+  var obj = arr.queryElementAt(0, Ci.nsISupportsString);
+  do_check_eq(str, obj);
+  // check the data of all the other objects
+  for (let i=1; i<arr.length; i++) {
+    let obj = arr.queryElementAt(i, Ci.nsISupportsString);
+    do_check_eq("element " + (i-1), obj.data);
+  }
+}
+
+function test_replace_element()
+{
+  var arr = create_n_element_array(5);
+  // just a sanity check
+  do_check_eq(5, arr.length);
+  var str = new SupportsString();
+  str.data = "hello";
+  // replace first element
+  arr.replaceElementAt(str, 0, false);
+  do_check_eq(5, arr.length);
+  var obj = arr.queryElementAt(0, Ci.nsISupportsString);
+  do_check_eq(str, obj);
+  // replace last element
+  arr.replaceElementAt(str, arr.length - 1, false);
+  do_check_eq(5, arr.length);
+  obj = arr.queryElementAt(arr.length - 1, Ci.nsISupportsString);
+  do_check_eq(str, obj);
+  // replace after last element, should insert empty elements
+  arr.replaceElementAt(str, 9, false);
+  do_check_eq(10, arr.length);
+  obj = arr.queryElementAt(9, Ci.nsISupportsString);
+  do_check_eq(str, obj);
+  // AFAIK there's no way to check the empty elements, since you can't QI them.
+}
+
+function test_clear()
+{
+  var arr = create_n_element_array(5);
+  // just a sanity check
+  do_check_eq(5, arr.length);
+  arr.clear();
+  do_check_eq(0, arr.length);
+}
+
+function test_enumerate()
+{
+  var arr = create_n_element_array(5);
+  do_check_eq(5, arr.length);
+  var en = arr.enumerate();
+  var i = 0;
+  while (en.hasMoreElements()) {
+    let str = en.getNext();
+    do_check_true(str instanceof Ci.nsISupportsString);
+    do_check_eq(str.data, "element " + i);
+    i++;
+  }
+  do_check_eq(arr.length, i);
+}
+
 var tests = [
   test_appending_null_actually_inserts,
+  test_object_gets_appended,
+  test_insert_at_beginning,
+  test_replace_element,
+  test_clear,
+  test_enumerate,
 ];
 
 function run_test() {
   for (var i = 0; i < tests.length; i++)
     tests[i]();
 }