Merge cvs-trunk-mirror to mozilla-central. Conflict resolution:
authorBenjamin Smedberg <benjamin@smedbergs.us>
Mon, 05 May 2008 13:39:59 -0400
changeset 14932 631ebb79c3f7
parent 14894 f20056b91c23 (current diff)
parent 14931 09850bcd367b (diff)
child 14933 572802919ad2
push id23
push userbsmedberg@mozilla.com
push date2008-05-05 18:01 +0000
treeherdermozilla-central@631ebb79c3f7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone2.0a1pre
Merge cvs-trunk-mirror to mozilla-central. Conflict resolution: * client.mk: new NSS tag merge to client.py
client.mk
client.py
js/src/jsapi.cpp
js/src/jsdbgapi.cpp
js/src/jsopcode.cpp
toolkit/toolkit-makefiles.sh
xpfe/components/alerts/Makefile.in
xpfe/components/alerts/public/Makefile.in
xpfe/components/alerts/public/nsIAlertsService.idl
xpfe/components/alerts/src/Makefile.in
xpfe/components/alerts/src/nsAlertsService.cpp
xpfe/components/alerts/src/nsAlertsService.h
xpfe/components/console/Makefile.in
xpfe/components/console/jsconsole-clhandler.js
xpfe/components/console/resources/content/console.css
xpfe/components/console/resources/content/console.js
xpfe/components/console/resources/content/console.xul
xpfe/components/console/resources/content/consoleBindings.xml
xpfe/components/console/resources/locale/en-US/console.dtd
xpfe/components/console/resources/locale/en-US/console.properties
xpfe/components/extensions/Makefile.in
xpfe/components/extensions/public/Makefile.in
xpfe/components/extensions/public/nsIExtensionManager.idl
xpfe/components/extensions/src/Makefile.in
xpfe/components/extensions/src/nsExtensionManager.js
xpfe/components/updates/Makefile.in
xpfe/components/updates/src/Makefile.in
xpfe/components/updates/src/README.html
xpfe/components/updates/src/nsUpdateNotifier.js
--- a/accessible/src/base/nsAccessibilityService.cpp
+++ b/accessible/src/base/nsAccessibilityService.cpp
@@ -1521,17 +1521,17 @@ NS_IMETHODIMP nsAccessibilityService::Ge
           }
           if (tableAccessible && nsAccessible::Role(tableAccessible) != nsIAccessibleRole::ROLE_TABLE) {
             NS_ASSERTION(!roleMapEntry, "Should not be changing ARIA role, just overriding impl class role");
             // Not in table: override role (roleMap entry was null).
             roleMapEntry = &nsARIAMap::gEmptyRoleMap;
           }
           break;
         }
-        else if (tableFrame->GetType() == nsAccessibilityAtoms::tableCellFrame) {
+        else if (tableContent->Tag() == nsAccessibilityAtoms::table) {
           // Stop before we are fooled by any additional table ancestors
           // This table cell frameis part of a separate ancestor table.
           tryTagNameOrFrame = PR_FALSE;
           break;
         }
       }
 
       if (!tableContent)
--- a/accessible/src/base/nsDocAccessible.cpp
+++ b/accessible/src/base/nsDocAccessible.cpp
@@ -252,16 +252,19 @@ nsDocAccessible::GetState(PRUint32 *aSta
   nsCOMPtr<nsIXULDocument> xulDoc(do_QueryInterface(mDocument));
   if (!xulDoc)
 #endif
   {
     // XXX Need to invent better check to see if doc is focusable,
     // which it should be if it is scrollable. A XUL document could be focusable.
     // See bug 376803.
     *aState |= nsIAccessibleStates::STATE_FOCUSABLE;
+    if (gLastFocusedNode == mDOMNode) {
+      *aState |= nsIAccessibleStates::STATE_FOCUSED;
+    }
   }
 
   if (!mIsContentLoaded) {
     *aState |= nsIAccessibleStates::STATE_BUSY;
     if (aExtraState) {
       *aExtraState |= nsIAccessibleStates::EXT_STATE_STALE;
     }
   }
@@ -849,18 +852,28 @@ NS_IMETHODIMP nsDocAccessible::FireDocLo
           nsCOMPtr<nsIAccessibleStateChangeEvent> accEvent =
             new nsAccStateChangeEvent(this, nsIAccessibleStates::STATE_BUSY, PR_FALSE, PR_FALSE);
           FireAccessibleEvent(accEvent);
           FireAnchorJumpEvent();
         }
       }
     }
   }
+
   if (sameTypeRoot == treeItem) {
     // Not a frame or iframe
+    if (!isFinished) {
+      // Fire state change event to set STATE_BUSY when document is loading. For
+      // example, Window-Eyes expects to get it.
+      nsCOMPtr<nsIAccessibleStateChangeEvent> accEvent =
+        new nsAccStateChangeEvent(this, nsIAccessibleStates::STATE_BUSY,
+                                  PR_FALSE, PR_TRUE);
+      FireAccessibleEvent(accEvent);
+    }
+
     nsAccUtils::FireAccEvent(aEventType, this);
   }
   return NS_OK;
 }
 
 void nsDocAccessible::ScrollTimerCallback(nsITimer *aTimer, void *aClosure)
 {
   nsDocAccessible *docAcc = reinterpret_cast<nsDocAccessible*>(aClosure);
--- a/accessible/tests/mochitest/test_nsIAccessibleTable_4.html
+++ b/accessible/tests/mochitest/test_nsIAccessibleTable_4.html
@@ -95,16 +95,36 @@ function doTest()
     is(accTable4.role, Ci.nsIAccessibleRole.ROLE_TABLE, "wrong role");
 
     is(accTable4.cellRefAt(0,0).firstChild.name, "cell0", "wrong cell");
     is(accTable4.cellRefAt(0,1).firstChild.name, "cell1", "wrong cell");
     is(accTable4.cellRefAt(1,0).firstChild.name, "cell2", "wrong cell");
     is(accTable4.cellRefAt(1,1).firstChild.name, "cell3", "wrong cell");
   }
 
+  // Test table with display:inline and an outside table. We shouldn't be fooled
+  // by the outside table and shouldn't create table accessible and table cell
+  // accessible in this case
+  var table5 = document.getElementById("table5");
+  accNotCreated = false;
+  try {
+    var accTable1 = accService.getAccessibleFor(table1);
+  } catch (e) {
+    accNotCreated = true;
+  }
+  ok(accNotCreated, "wrongly created table accessible");
+  var t5Cell = document.getElementById("t5_cell");
+  accNotCreated = false;
+  try {
+    var accCell = accService.getAccessibleFor(t5Cell);
+  } catch (e) {
+    accNotCreated = true;
+  }
+  ok(accNotCreated, "wrongly created table cell accessible");
+
   SimpleTest.finish();
 }
 SimpleTest.waitForExplicitFinish();
 addLoadEvent(doTest);
   </script>
  </head>
 
  <body >
@@ -145,11 +165,23 @@ addLoadEvent(doTest);
      <td>cell0</td>
      <td>cell1</td>
     </tr>
     <tr>
      <td>cell2</td>
      <td>cell3</td>
     </tr>
    </table>
+
+   <table>
+   <tr>
+   <td style="display:block">
+     <table style="display:inline" id="table5">
+       <tr><td id="t5_cell">cell0</td></tr>
+     </table>
+   </td>
+   <td>cell1</td>
+   </tr>
+   </table>
+
   </center>
  </body>
 </html>
--- a/browser/EULA
+++ b/browser/EULA
@@ -1,26 +1,28 @@
-MOZILLA FIREFOX END-USER SOFTWARE LICENSE AGREEMENT
-Version 2.0
+ÔĽŅMOZILLA FIREFOX END-USER SOFTWARE LICENSE AGREEMENT
+Version 3.0, May 2008
 
 A SOURCE CODE VERSION OF CERTAIN FIREFOX BROWSER FUNCTIONALITY THAT YOU MAY USE, MODIFY AND DISTRIBUTE IS AVAILABLE TO YOU FREE-OF-CHARGE FROM WWW.MOZILLA.ORG UNDER THE MOZILLA PUBLIC LICENSE and other open source software licenses.
 
 The accompanying executable code version of Mozilla Firefox and related documentation (the "Product") is made available to you under the terms of this MOZILLA FIREFOX END-USER SOFTWARE LICENSE AGREEMENT (THE "AGREEMENT").  BY CLICKING THE "ACCEPT" BUTTON, OR BY INSTALLING OR USING THE MOZILLA FIREFOX BROWSER, YOU ARE CONSENTING TO BE BOUND BY THE AGREEMENT.  IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT, DO NOT CLICK THE "ACCEPT" BUTTON, AND DO NOT INSTALL OR USE ANY PART OF THE MOZILLA FIREFOX BROWSER.
 
 DURING THE MOZILLA FIREFOX INSTALLATION PROCESS, AND AT LATER TIMES, YOU MAY BE GIVEN THE OPTION OF INSTALLING ADDITIONAL COMPONENTS FROM THIRD-PARTY SOFTWARE PROVIDERS.  THE INSTALLATION AND USE OF THOSE THIRD-PARTY COMPONENTS MAY BE GOVERNED BY ADDITIONAL LICENSE AGREEMENTS.
 
 1.  LICENSE GRANT.  The Mozilla Corporation grants you a non-exclusive license to use the executable code version of the Product.  This Agreement will also govern any software upgrades provided by Mozilla that replace and/or supplement the original Product, unless such upgrades are accompanied by a separate license, in which case the terms of that license will govern.
 
 2.  TERMINATION.  If you breach this Agreement your right to use the Product will terminate immediately and without notice, but all provisions of this Agreement except the License Grant (Paragraph 1) will survive termination and continue in effect.  Upon termination, you must destroy all copies of the Product.
 
-3.  PROPRIETARY RIGHTS.  Portions of the Product are available in source code form under the terms of the Mozilla Public License and other open source licenses (collectively, "Open Source Licenses") at http://mozilla.org.  Nothing in this Agreement will be construed to limit any rights granted under the Open Source Licenses.  Subject to the foregoing, Mozilla, for itself and on behalf of its licensors, hereby reserves all intellectual property rights in the Product, except for the rights expressly granted in this Agreement.  You may not remove or alter any trademark, logo, copyright or other proprietary notice in or on the Product.  This license does not grant you any right to use the trademarks, service marks or logos of Mozilla or its licensors.
+3.  PROPRIETARY RIGHTS.  Portions of the Product are available in source code form under the terms of the Mozilla Public License and other open source licenses (collectively, "Open Source Licenses") at http://www.mozilla.org/MPL.  Nothing in this Agreement will be construed to limit any rights granted under the Open Source Licenses.  Subject to the foregoing, Mozilla, for itself and on behalf of its licensors, hereby reserves all intellectual property rights in the Product, except for the rights expressly granted in this Agreement.  You may not remove or alter any trademark, logo, copyright or other proprietary notice in or on the Product.  This license does not grant you any right to use the trademarks, service marks or logos of Mozilla or its licensors.
+
+4.  PRIVACY POLICY.  You agree to the Mozilla Firefox Privacy Policy, made available online at http://www.mozilla.com/legal/privacy/, as that policy may be changed from time to time.  When Mozilla changes the policy in a material way a notice will be posted on the website at www.mozilla.com and when any change is made in the privacy policy, the updated policy will be posted at the above link.  It is your responsibility to ensure that you understand the terms of the privacy policy, so you should periodically check the current version of the policy for changes.
 
-4.  PRIVACY POLICY.  You agree to the Mozilla Firefox Privacy Policy, made available online at http://www.mozilla.com/firefox/privacy/, as that policy may be changed from time to time.  When Mozilla changes the policy in a material way a notice will be posted on the website at www.mozilla.com and when any change is made in the privacy policy, the updated policy will be posted at the above link.  It is your responsibility to ensure that you understand the terms of the privacy policy, so you should periodically check the current version of the policy for changes.
+5.  WEBSITE INFORMATION SERVICES.  Mozilla and its contributors, licensors and partners work to provide the most accurate and up-to-date phishing and malware information.  However, they cannot guarantee that this information is comprehensive and error-free: some risky sites may not be identified, and some safe sites may be identified in error.
 
-5.  DISCLAIMER OF WARRANTY.  THE PRODUCT IS PROVIDED "AS IS" WITH ALL FAULTS.  TO THE EXTENT PERMITTED BY LAW, MOZILLA AND MOZILLA'S DISTRIBUTORS, AND LICENSORS HEREBY DISCLAIM ALL WARRANTIES, WHETHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES THAT THE PRODUCT IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE AND NON-INFRINGING.  YOU BEAR THE ENTIRE RISK AS TO SELECTING THE PRODUCT FOR YOUR PURPOSES AND AS TO THE QUALITY AND PERFORMANCE OF THE PRODUCT.  THIS LIMITATION WILL APPLY NOTWITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE OF ANY REMEDY.  SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF IMPLIED WARRANTIES, SO THIS DISCLAIMER MAY NOT APPLY TO YOU.
+6.  DISCLAIMER OF WARRANTY.  THE PRODUCT IS PROVIDED "AS IS" WITH ALL FAULTS.  TO THE EXTENT PERMITTED BY LAW, MOZILLA AND MOZILLA'S DISTRIBUTORS, AND LICENSORS HEREBY DISCLAIM ALL WARRANTIES, WHETHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES THAT THE PRODUCT IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE AND NON-INFRINGING.  YOU BEAR THE ENTIRE RISK AS TO SELECTING THE PRODUCT FOR YOUR PURPOSES AND AS TO THE QUALITY AND PERFORMANCE OF THE PRODUCT.  THIS LIMITATION WILL APPLY NOTWITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE OF ANY REMEDY.  SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF IMPLIED WARRANTIES, SO THIS DISCLAIMER MAY NOT APPLY TO YOU.
 
-6.  LIMITATION OF LIABILITY.  EXCEPT AS REQUIRED BY LAW, MOZILLA AND ITS DISTRIBUTORS, DIRECTORS, LICENSORS, CONTRIBUTORS AND AGENTS (COLLECTIVELY, THE "MOZILLA GROUP") WILL NOT BE LIABLE FOR ANY INDIRECT, SPECIAL, INCIDENTAL, CONSEQUENTIAL OR EXEMPLARY DAMAGES ARISING OUT OF OR IN ANY WAY RELATING TO THIS AGREEMENT OR THE USE OF OR INABILITY TO USE THE PRODUCT, INCLUDING WITHOUT LIMITATION DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, LOST PROFITS, LOSS OF DATA, AND COMPUTER FAILURE OR MALFUNCTION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND REGARDLESS OF THE THEORY (CONTRACT, TORT OR OTHERWISE) UPON WHICH SUCH CLAIM IS BASED.  THE MOZILLA GROUP'S COLLECTIVE LIABILITY UNDER THIS AGREEMENT WILL NOT EXCEED THE GREATER OF $500 (FIVE HUNDRED DOLLARS) AND THE FEES PAID BY YOU UNDER THE LICENSE (IF ANY).  SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL, CONSEQUENTIAL OR SPECIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
+7.  LIMITATION OF LIABILITY.  EXCEPT AS REQUIRED BY LAW, MOZILLA AND ITS DISTRIBUTORS, DIRECTORS, LICENSORS, CONTRIBUTORS AND AGENTS (COLLECTIVELY, THE "MOZILLA GROUP") WILL NOT BE LIABLE FOR ANY INDIRECT, SPECIAL, INCIDENTAL, CONSEQUENTIAL OR EXEMPLARY DAMAGES ARISING OUT OF OR IN ANY WAY RELATING TO THIS AGREEMENT OR THE USE OF OR INABILITY TO USE THE PRODUCT, INCLUDING WITHOUT LIMITATION DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, LOST PROFITS, LOSS OF DATA, AND COMPUTER FAILURE OR MALFUNCTION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND REGARDLESS OF THE THEORY (CONTRACT, TORT OR OTHERWISE) UPON WHICH SUCH CLAIM IS BASED.  THE MOZILLA GROUP'S COLLECTIVE LIABILITY UNDER THIS AGREEMENT WILL NOT EXCEED THE GREATER OF $500 (FIVE HUNDRED DOLLARS) AND THE FEES PAID BY YOU UNDER THE LICENSE (IF ANY).  SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL, CONSEQUENTIAL OR SPECIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
 
-7.  EXPORT CONTROLS.  This license is subject to all applicable export restrictions.  You must comply with all export and import laws and restrictions and regulations of any United States or foreign agency or authority relating to the Product and its use.
+8.  EXPORT CONTROLS.  This license is subject to all applicable export restrictions.  You must comply with all export and import laws and restrictions and regulations of any United States or foreign agency or authority relating to the Product and its use.
 
-8.  U.S. GOVERNMENT END-USERS.  This Product is a "commercial item," as that term is defined in 48 C.F.R. 2.101, consisting of "commercial computer software" and "commercial computer software documentation," as such terms are used in 48 C.F.R. 12.212 (Sept. 1995) and 48 C.F.R. 227.7202 (June 1995).  Consistent with 48 C.F.R. 12.212, 48 C.F.R. 27.405(b)(2) (June 1998) and 48 C.F.R. 227.7202, all U.S. Government End Users acquire the Product with only those rights as set forth therein.
+9.  U.S. GOVERNMENT END-USERS.  This Product is a "commercial item," as that term is defined in 48 C.F.R. 2.101, consisting of "commercial computer software" and "commercial computer software documentation," as such terms are used in 48 C.F.R. 12.212 (Sept. 1995) and 48 C.F.R. 227.7202 (June 1995).  Consistent with 48 C.F.R. 12.212, 48 C.F.R. 27.405(b)(2) (June 1998) and 48 C.F.R. 227.7202, all U.S. Government End Users acquire the Product with only those rights as set forth therein.
 
-9.  MISCELLANEOUS.  (a) This Agreement constitutes the entire agreement between Mozilla and you concerning the subject matter hereof, and it may only be modified by a written amendment signed by an authorized executive of Mozilla.  (b) Except to the extent applicable law, if any, provides otherwise, this Agreement will be governed by the laws of the state of California, U.S.A., excluding its conflict of law provisions.  (c) This Agreement will not be governed by the United Nations Convention on Contracts for the International Sale of Goods.  (d) If any part of this Agreement is held invalid or unenforceable, that part will be construed to reflect the parties' original intent, and the remaining portions will remain in full force and effect.  (e) A waiver by either party of any term or condition of this Agreement or any breach thereof, in any one instance, will not waive such term or condition or any subsequent breach thereof. (f) Except as required by law, the controlling language of this Agreement is English.  (g) You may assign your rights under this Agreement to any party that consents to, and agrees to be bound by, its terms; the Mozilla Corporation may assign its rights under this Agreement without condition.  (h) This Agreement will be binding upon and inure to the benefit of the parties, their successors and permitted assigns.
+10.  MISCELLANEOUS.  (a) This Agreement constitutes the entire agreement between Mozilla and you concerning the subject matter hereof, and it may only be modified by a written amendment signed by an authorized executive of Mozilla.  (b) Except to the extent applicable law, if any, provides otherwise, this Agreement will be governed by the laws of the state of California, U.S.A., excluding its conflict of law provisions.  (c) This Agreement will not be governed by the United Nations Convention on Contracts for the International Sale of Goods.  (d) If any part of this Agreement is held invalid or unenforceable, that part will be construed to reflect the parties' original intent, and the remaining portions will remain in full force and effect.  (e) A waiver by either party of any term or condition of this Agreement or any breach thereof, in any one instance, will not waive such term or condition or any subsequent breach thereof. (f) Except as required by law, the controlling language of this Agreement is English.  (g) You may assign your rights under this Agreement to any party that consents to, and agrees to be bound by, its terms; the Mozilla Corporation may assign its rights under this Agreement without condition.  (h) This Agreement will be binding upon and inure to the benefit of the parties, their successors and permitted assigns.
index 44d2de8eceb558b03639a139d94d4b0164726872..2b5be7b2ccb85994e26fd9d7e1f33036545ef887
GIT binary patch
literal 7633
zc$}?SYj4{|7X4lz|6yP(P#d6S*-17@`$=(RR}0%RBqwba{xTwm@-!5OnIWyHMgIGq
zduN8E7$?{T7HAzkhIj7c+;boL``*_1>AftS=09n*K0SMRcAu#{AOC%yo3gG~1zwEr
z^Nq=rE${Qnem=d=(+6pts>kAbDV7haD8xH03$y<9>(^&L-9Kuz{iMt6#eI{W-dECQ
z_bKivWVt>aKYxC|Vu|hykI(--ySkc)i`im&G5<qMZ{8ihUrrZdIls93eX^K}tJ(SV
zW;qp;%f)nhJ-xZRUyVuRv!6aF>$EAw^U*jF*K#M$#^cxitMGRvCc>G<rb?txUp$5<
zOfFJoYpF|dp{>fz7xC7bty5OyO_|m>BMV*cMExLZu``X>Kz!p=BH#v{?}RKfk!e?3
zy=rPDv=j1C>O!sxC2GTu<W{L;lOL0-)(UUUMr^m+(Z>9xi$ac!U5loKQ*nzD*Zxy+
z+pG$miYuL}(kZ^j;Cm}frOIfGGkLw0R*AwNbEDQN{_h<m$}}~bN|rlau7&!d(xzth
zhMtHwM^Dg|Ru!^VFwvyVMwPWBmxx1B^x)Q-tV!#GBeHrUA?zE|JF{wKH;!(pA8;B0
z8QwN6v*Y*V_+_*ynm$>>fpmGew|#$bG!o+NPNcB@6B*~fPE%FY2Lkb^O_>N|#cC&X
z>1tUNbP69dE*>AM5yGFa`lLl_phH>nc_UUztPHFok@R@03pAPK{7_~@X=)+q8+xR(
zo*W8snI<Q8&X7??5}##*p0<YZ=1&Eaygh`Foj}ZMFZa8a4H1G+yld?D+!5~ZVXv%7
zm2+MR<O4wi(bXH}k~TTup|ySlL`j^f>Hw~u|7GSqAPYgjG$l-TJ}ux6n;nxCyAIp9
z_E7^z4n8J4@99LUko9b|!Hd3#p7^Mm0pLr;@$2bP#4L-U_$HCyrc>M>N$7Ghxw)e=
zUZv=^b7L!Gy=H4G>0-ta;#D52FKGebJ+|3O=xA7F^`pF`uS2e}2LPEaCAPR%$ikUm
z8pEJ<T~k4eOu6VowmT}zoMu&3$dviz1VD04RTW+`$It4uCI^N46J&G&2;f}$&`GDO
zBFpIDT;UWP2ZTgx69i6dA2c3JWw5%(3WTTN7PiToGaAI;j65)1T+ePMceDA8k3dMg
zl~oeL>wO2|8!KSOL)~|Gu*Y9TTEI%8@6ASK8m|h^>{|^`H8rIhbW11;1*IIj)9qz(
zcO&AAl;vw8g<TRB#NjO*0+&?};`GR0?Hc<?h=?jgNP{LoISqkbpav@r{d<79e=;Op
z<7$B@)Yj}+xztozxgl}}j(iSzw~P7hVm7^-EIx|G?DDs}rT6Epu|0<BoW)^oDPEU*
zB{es8^EBW8k2NipGI5xiqJZV_Pq9nH!JG~){h=Vjq4)qe4|QGra&j^#swdaCSFrL1
zR}k&!au_I%z{*p6Z5sd=2r2YN*PKNR8t3yE-*vV<r3fxsHmg6OZsdG8M6C^OPNMw@
zeI|76RFQk*OI-gT@s1c0cX`{51)st#3VCD|IQx-u47zG4!Y*kfW3W=hazRgB_Jfr~
z7}AyWc{ruMR1oQa?`YRIet{_;1DR8qv1)@<q$(o|;(KyUO?khO_ERFz>zRZwxARGc
zb3Ue|pVg|Cb{F!8uA;BYrzkBZe`a7T-OKuU`i#NoXK<?md_^uI`TUlyAf;Ttr}2L8
z{5wpC7n}~W50mqc;&u*}|L9YJ9I;o)hXwN1>PMOGkTZ}Cln(kJQ=;Ul?_d;!c~Ypg
zEKVvf<pibGc`mG2UMyQ^9m_Rh<%=W=E~|roq4w_&Kx0(PA9Sp05CNx4$U*4Pn2W94
zaXI36#002}BP4{tY}Lx?nw1`C>p79`qmcN!+U76dFPIW;Px!N@%D9UR8V#<Mo-5_b
zaA_<*Q7=`KT+iLgf%lwVY2S$(fe<!Ubv-#}CVB!W_YL(7)p5Qtb)fYE3c)Gp<5MIT
z*`q?&l{VHAK@5s;P@gg?_<0DUmlTib+vV(TDrPqq^TjonDS<)e13HJmuQ6DpFrkvj
zp63Tn{1&79JvA~V)DT-^KaugFlCwe^IFJf&!*!Nhq3XCc$K-8MA*-19=<|&%xFOIb
z@ibQtsQR1Psz+*eAq@7*lJl;S%nZT7%niNAC@xg#tpX0Xn<4qiT4RrC()k50-Voim
zPiRDdBiAwsLJrMQ*m5)pzKi6uPUfn2bnh4!KoUN5^*^EiyV>&mYBIaVm^i->m=dWg
z`xx59DpW1q>wXT9UfLaSU1vtkWmDALSenp=)fD)Oifmo`R;G~KWG`mn_0O)G{5W#-
zT^GGT;5d>NQg8S=#DILOsbNMQF;50YW{TQW1-nL<XcaRGUhF`)EcpO*LSlsWjHMtD
zVllg;QsAPEvIJLdE>VKCuL+W&rPHR6;OYi_YpBT7sv_Pr65zj33|30|GD2~&KD^9T
z2IR{{It&m|5xRoYH;DFV_D|5c&y63f8RN<_yvkH{X*(zmo%P)CqDy5=k$X7v<NZ09
zm&gHf;8fC<N@Xz5<i3`m%w;>O*o3}6G5t7jfNy!?^i~vR8xX-=yW!H+(}OCu57%B)
zo$(nH!;Sz)_<N=OWc<W<@ruWb>)D;B3;_CSHhDX{nlYlMzM8{<R();|f~TQLbg~c1
z3}@2;vm|?z<0G@?F=^0q@dz5_Us}^t2cdBd`CMo&a}21GYK^}ReyCIm*E5tko9Q*r
z(x00U6+_rp@F8^wncT=Vj}n?^bHY4aOiAIZ4HYilMubUxe{>e1%L$_(KPJ115u1i8
zHb*~9u&7JUorL3BvNk3o!xK-$t~OPLL)8C(gCQ4r<&yR|7+5BuliySg^-V1@2@yqH
zFQHGPVOay28Ab}K!m-%6w&vj@9=KX3@n&W%ZN|e`cmn?$c=C{AE6GYkw`<6@kbZ;$
zVd50VB0V?3l`G6-*=T>9<%s`Gd>=u<0ryJ9et0hoEjFn8RK6bLOI{Q}&40WckHuk5
zf*$a^<;@aqvhGO4@|`Q1SEXiv?=O*Jk9ep#k&pflDf}aJ1`J2Hcgfue^pxL9{4Z1e
zH6`>PxAVoFIG^9#E#_CtxJ&4D!kWhHcBGJj_Ry?Q#-VCZa4pS!!SL9((>zG1D|TI-
z3&)uvHvAIQ5rNc+h{$UEcEv@;d|zrRhD(^KxKhz@qt_+V23jIY{|0$v2^jlX+8ZAO
zKOq^1#rzFTx1;4qT+TmC7dN!sZ8yMu*W7kxPKpB<Nwtka1obw_LEAl33rL4h19j<}
zh!?NL`RHP_7>Tpd>G;%#8%)V$lkW*@Q#S5V4p{de9@*cJdQ~{V!s^d5Hw`p7JsX{!
zo{7UHs2%U#ym{%<pr`BEtI?~oG0yy}!5qOy;Hz`5yU#d;cqlUIi+DA9F@AZtIyyW%
z>cqVM-c1SP#Rr2|Fr3#@oTcq7EJ?Zi47MoH0i(_??BK$zNiI;_3e>cgK|iFwS?HXO
zVa_%Bxarl^<Yqd5AHsbokA|x*9@BN*)M35}tw={cD^+h*Zx|v2i9qmR3PWOx5R(f1
zEJcv?GI<i<$tldHtd!sJw+pSUrIrww$7LB`=#T>8+cGA=U--Z;^N8iT5fo-32C<IU
zd+lZ~ueqXodP`#8>N)~XzPH2ZFE*JfDZN8saFn+6<{Uj2qETwpCW`Q6lz1-VN*G3w
z9I9~bg^1pwi}X*wiAlc~7^)CR<0eoEF#AX$BjPRT9TzFrE+}T0Ijmo7A;FfiV3jXX
zclqw@i1vK@OYS{YG_~9XW!NLk%y=zcDjHl;<y&7rSku!_ZhkP(7fiNPeW^EA?&od;
zO1l?Y(Z@1{CQ@p~R2A1{EY*Kbd7d{kV9@n`M2c&?LzLkO`WfJZf0|I*?@M@P9SD~R
zjONVvbHNh^hn}lldj=ebe#w+!Q(n^IvW*j8+cDGN4lfZ25(?o!_z1Q8=tr$656=`?
z<5&IkLtld$@pQPR<+{L(N-kL+wL2&2D6M*XTi0(jIssG@0~*5bbK$2NnlZv}6m-}P
zez!>&=uFGM?yYqC%ln=pboxhn#0Ii;BiZxtbf%CR+7Bz-h%x7syv*=~uu`R>2`x5(
c9)|2#P22gDet>Cr1MQURRgLS2ug`w^4@RPm<^TWy
--- a/browser/app/macbuild/license.r
+++ b/browser/app/macbuild/license.r
@@ -37,41 +37,43 @@ resource 'STR#' (5000, "English") {
 // Beware of 1024(?) byte (character?) line length limitation.  Split up long
 // lines.
 // If straight quotes are used ("), remember to escape them (\").
 // Newline is \n, to leave a blank line, use two of them.
 // 0xD2 and 0xD3 are curly double-quotes ("), 0xD4 and 0xD5 are curly
 //   single quotes ('), 0xD5 is also the apostrophe.
 data 'TEXT' (5000, "English") {
   "MINEFIELD END-USER SOFTWARE LICENSE AGREEMENT\n"
-  "Version 2.0\n"
+  "Version 3.0, May 2008\n"
   "\n"
   "A SOURCE CODE VERSION OF CERTAIN MINEFIELD BROWSER FUNCTIONALITY THAT YOU MAY USE, MODIFY AND DISTRIBUTE IS AVAILABLE TO YOU FREE-OF-CHARGE FROM WWW.MOZILLA.ORG UNDER THE MOZILLA PUBLIC LICENSE and other open source software licenses.\n"
   "\n"
   "The accompanying executable code version of Minefield and related documentation (the “Product”) is made available to you under the terms of this MINEFIELD END-USER SOFTWARE LICENSE AGREEMENT (THE “AGREEMENT”).  BY CLICKING THE “ACCEPT” BUTTON, OR BY INSTALLING OR USING THE MINEFIELD BROWSER, YOU ARE CONSENTING TO BE BOUND BY THE AGREEMENT.  IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT, DO NOT CLICK THE “ACCEPT” BUTTON, AND DO NOT INSTALL OR USE ANY PART OF THE MINEFIELD BROWSER.\n"
   "\n"
   "DURING THE MINEFIELD INSTALLATION PROCESS, AND AT LATER TIMES, YOU MAY BE GIVEN THE OPTION OF INSTALLING ADDITIONAL COMPONENTS FROM THIRD-PARTY SOFTWARE PROVIDERS.  THE INSTALLATION AND USE OF THOSE THIRD-PARTY COMPONENTS MAY BE GOVERNED BY ADDITIONAL LICENSE AGREEMENTS.\n"
   "\n"
   "1.  LICENSE GRANT.  The Mozilla Corporation grants you a non-exclusive license to use the executable code version of the Product.  This Agreement will also govern any software upgrades provided by Mozilla that replace and/or supplement the original Product, unless such upgrades are accompanied by a separate license, in which case the terms of that license will govern.\n"
   "\n"
   "2.  TERMINATION.  If you breach this Agreement your right to use the Product will terminate immediately and without notice, but all provisions of this Agreement except the License Grant (Paragraph 1) will survive termination and continue in effect.  Upon termination, you must destroy all copies of the Product.\n"
   "\n"
-  "3.  PROPRIETARY RIGHTS.  Portions of the Product are available in source code form under the terms of the Mozilla Public License and other open source licenses (collectively, “Open Source Licenses”) at http://mozilla.org.  Nothing in this Agreement will be construed to limit any rights granted under the Open Source Licenses.  Subject to the foregoing, Mozilla, for itself and on behalf of its licensors, hereby reserves all intellectual property rights in the Product, except for the rights expressly granted in this Agreement.  You may not remove or alter any trademark, logo, copyright or other proprietary notice in or on the Product.  This license does not grant you any right to use the trademarks, service marks or logos of Mozilla or its licensors.\n"
+  "3.  PROPRIETARY RIGHTS.  Portions of the Product are available in source code form under the terms of the Mozilla Public License and other open source licenses (collectively, “Open Source Licenses”) at http://www.mozilla.org/MPL.  Nothing in this Agreement will be construed to limit any rights granted under the Open Source Licenses.  Subject to the foregoing, Mozilla, for itself and on behalf of its licensors, hereby reserves all intellectual property rights in the Product, except for the rights expressly granted in this Agreement.  You may not remove or alter any trademark, logo, copyright or other proprietary notice in or on the Product.  This license does not grant you any right to use the trademarks, service marks or logos of Mozilla or its licensors.\n"
+  "\n"
+  "4.  PRIVACY POLICY.  You agree to the Mozilla Firefox Privacy Policy, made available online at http://www.mozilla.com/legal/privacy/, as that policy may be changed from time to time.  When Mozilla changes the policy in a material way a notice will be posted on the website at www.mozilla.com and when any change is made in the privacy policy, the updated policy will be posted at the above link.  It is your responsibility to ensure that you understand the terms of the privacy policy, so you should periodically check the current version of the policy for changes.\n"
   "\n"
-  "4.  PRIVACY POLICY.  You agree to the Mozilla Firefox Privacy Policy, made available online at http://www.mozilla.com/firefox/privacy/, as that policy may be changed from time to time.  When Mozilla changes the policy in a material way a notice will be posted on the website at www.mozilla.com and when any change is made in the privacy policy, the updated policy will be posted at the above link.  It is your responsibility to ensure that you understand the terms of the privacy policy, so you should periodically check the current version of the policy for changes.\n"
+  "5.  WEBSITE INFORMATION SERVICES.  Mozilla and its contributors, licensors and partners work to provide the most accurate and up-to-date phishing and malware information.  However, they cannot guarantee that this information is comprehensive and error-free: some risky sites may not be identified, and some safe sites may be identified in error.\n"
   "\n"
-  "5.  DISCLAIMER OF WARRANTY.  THE PRODUCT IS PROVIDED “AS IS” WITH ALL FAULTS.  TO THE EXTENT PERMITTED BY LAW, MOZILLA AND MOZILLA’S DISTRIBUTORS, AND LICENSORS HEREBY DISCLAIM ALL WARRANTIES, WHETHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES THAT THE PRODUCT IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE AND NON-INFRINGING.  YOU BEAR THE ENTIRE RISK AS TO SELECTING THE PRODUCT FOR YOUR PURPOSES AND AS TO THE QUALITY AND PERFORMANCE OF THE PRODUCT.  THIS LIMITATION WILL APPLY NOTWITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE OF ANY REMEDY.  SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF IMPLIED WARRANTIES, SO THIS DISCLAIMER MAY NOT APPLY TO YOU.\n"
+  "6.  DISCLAIMER OF WARRANTY.  THE PRODUCT IS PROVIDED “AS IS” WITH ALL FAULTS.  TO THE EXTENT PERMITTED BY LAW, MOZILLA AND MOZILLA’S DISTRIBUTORS, AND LICENSORS HEREBY DISCLAIM ALL WARRANTIES, WHETHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES THAT THE PRODUCT IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE AND NON-INFRINGING.  YOU BEAR THE ENTIRE RISK AS TO SELECTING THE PRODUCT FOR YOUR PURPOSES AND AS TO THE QUALITY AND PERFORMANCE OF THE PRODUCT.  THIS LIMITATION WILL APPLY NOTWITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE OF ANY REMEDY.  SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF IMPLIED WARRANTIES, SO THIS DISCLAIMER MAY NOT APPLY TO YOU.\n"
   "\n"
-  "6.  LIMITATION OF LIABILITY.  EXCEPT AS REQUIRED BY LAW, MOZILLA AND ITS DISTRIBUTORS, DIRECTORS, LICENSORS, CONTRIBUTORS AND AGENTS (COLLECTIVELY, THE “MOZILLA GROUP”) WILL NOT BE LIABLE FOR ANY INDIRECT, SPECIAL, INCIDENTAL, CONSEQUENTIAL OR EXEMPLARY DAMAGES ARISING OUT OF OR IN ANY WAY RELATING TO THIS AGREEMENT OR THE USE OF OR INABILITY TO USE THE PRODUCT, INCLUDING WITHOUT LIMITATION DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, LOST PROFITS, LOSS OF DATA, AND COMPUTER FAILURE OR MALFUNCTION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND REGARDLESS OF THE THEORY (CONTRACT, TORT OR OTHERWISE) UPON WHICH SUCH CLAIM IS BASED.  THE MOZILLA GROUP’S COLLECTIVE LIABILITY UNDER THIS AGREEMENT WILL NOT EXCEED THE GREATER OF $500 (FIVE HUNDRED DOLLARS) AND THE FEES PAID BY YOU UNDER THE LICENSE (IF ANY).  SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL, CONSEQUENTIAL OR SPECIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.\n"
+  "7.  LIMITATION OF LIABILITY.  EXCEPT AS REQUIRED BY LAW, MOZILLA AND ITS DISTRIBUTORS, DIRECTORS, LICENSORS, CONTRIBUTORS AND AGENTS (COLLECTIVELY, THE “MOZILLA GROUP”) WILL NOT BE LIABLE FOR ANY INDIRECT, SPECIAL, INCIDENTAL, CONSEQUENTIAL OR EXEMPLARY DAMAGES ARISING OUT OF OR IN ANY WAY RELATING TO THIS AGREEMENT OR THE USE OF OR INABILITY TO USE THE PRODUCT, INCLUDING WITHOUT LIMITATION DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, LOST PROFITS, LOSS OF DATA, AND COMPUTER FAILURE OR MALFUNCTION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND REGARDLESS OF THE THEORY (CONTRACT, TORT OR OTHERWISE) UPON WHICH SUCH CLAIM IS BASED.  THE MOZILLA GROUP’S COLLECTIVE LIABILITY UNDER THIS AGREEMENT WILL NOT EXCEED THE GREATER OF $500 (FIVE HUNDRED DOLLARS) AND THE FEES PAID BY YOU UNDER THE LICENSE (IF ANY).  SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL, CONSEQUENTIAL OR SPECIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.\n"
   "\n"
-  "7.  EXPORT CONTROLS.  This license is subject to all applicable export restrictions.  You must comply with all export and import laws and restrictions and regulations of any United States or foreign agency or authority relating to the Product and its use.\n"
+  "8.  EXPORT CONTROLS.  This license is subject to all applicable export restrictions.  You must comply with all export and import laws and restrictions and regulations of any United States or foreign agency or authority relating to the Product and its use.\n"
   "\n"
-  "8.  U.S. GOVERNMENT END-USERS.  This Product is a “commercial item,” as that term is defined in 48 C.F.R. 2.101, consisting of “commercial computer software” and “commercial computer software documentation,” as such terms are used in 48 C.F.R. 12.212 (Sept. 1995) and 48 C.F.R. 227.7202 (June 1995).  Consistent with 48 C.F.R. 12.212, 48 C.F.R. 27.405(b)(2) (June 1998) and 48 C.F.R. 227.7202, all U.S. Government End Users acquire the Product with only those rights as set forth therein.\n"
+  "9.  U.S. GOVERNMENT END-USERS.  This Product is a “commercial item,” as that term is defined in 48 C.F.R. 2.101, consisting of “commercial computer software” and “commercial computer software documentation,” as such terms are used in 48 C.F.R. 12.212 (Sept. 1995) and 48 C.F.R. 227.7202 (June 1995).  Consistent with 48 C.F.R. 12.212, 48 C.F.R. 27.405(b)(2) (June 1998) and 48 C.F.R. 227.7202, all U.S. Government End Users acquire the Product with only those rights as set forth therein.\n"
   "\n"
-  "9.  MISCELLANEOUS.  (a) This Agreement constitutes the entire agreement between Mozilla and you concerning the subject matter hereof, and it may only be modified by a written amendment signed by an authorized executive of Mozilla.  (b) Except to the extent applicable law, if any, provides otherwise, this Agreement will be governed by the laws of the state of California, U.S.A., excluding its conflict of law provisions.  (c) This Agreement will not be governed by the United Nations Convention on Contracts for the International Sale of Goods.  "
+  "10.  MISCELLANEOUS.  (a) This Agreement constitutes the entire agreement between Mozilla and you concerning the subject matter hereof, and it may only be modified by a written amendment signed by an authorized executive of Mozilla.  (b) Except to the extent applicable law, if any, provides otherwise, this Agreement will be governed by the laws of the state of California, U.S.A., excluding its conflict of law provisions.  (c) This Agreement will not be governed by the United Nations Convention on Contracts for the International Sale of Goods.  "
   "(d) If any part of this Agreement is held invalid or unenforceable, that part will be construed to reflect the parties’ original intent, and the remaining portions will remain in full force and effect.  (e) A waiver by either party of any term or condition of this Agreement or any breach thereof, in any one instance, will not waive such term or condition or any subsequent breach thereof. (f) Except as required by law, the controlling language of this Agreement is English.  "
   "(g) You may assign your rights under this Agreement to any party that consents to, and agrees to be bound by, its terms; the Mozilla Corporation may assign its rights under this Agreement without condition.  (h) This Agreement will be binding upon and inure to the benefit of the parties, their successors and permitted assigns."
 };
 
 data 'styl' (5000, "English") {
   // Number of styles following = 2
   $"0002"
 
@@ -90,18 +92,18 @@ data 'styl' (5000, "English") {
   // Style, unused?
   $"02"
   // Size = 12 point
   $"000C"
   // Color, RGB
   $"0000 0000 0000"
 
   // Style 2.  This is used to display the body.
-  // Start character = 58
-  $"0000 003A"
+  // Start character = 68
+  $"0000 0044"
   // Height = 16
   $"0010"
   // Ascent = 12
   $"000C"
   // Font family = 1024 (Lucida Grande)
   $"0400"
   // Style bitfield, 0x1=bold 0x2=italic 0x4=underline 0x8=outline
   // 0x10=shadow 0x20=condensed 0x40=extended
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -631,32 +631,40 @@ pref("urlclassifier.gethashnoise", 4);
 pref("urlclassifier.gethashtables", "goog-phish-shavar,goog-malware-shavar");
 
 // If an urlclassifier table has not been updated in this number of seconds,
 // a gethash request will be forced to check that the result is still in
 // the database.
 pref("urlclassifier.confirm-age", 2700);
 
 // Maximum size of the sqlite3 cache during an update, in bytes
-#ifdef UNIX_BUT_NOT_MAC
+#ifdef MOZ_WIDGET_GTK2
 pref("urlclassifier.updatecachemax", 104857600);
 #else
 pref("urlclassifier.updatecachemax", -1);
 #endif
 
 // URL for checking the reason for a malware warning.
 pref("browser.safebrowsing.malware.reportURL", "http://safebrowsing.clients.google.com/safebrowsing/diagnostic?client=%NAME%&hl=%LOCALE%&site=");
 
 #endif
 
-// defaults to true
-pref("browser.EULA.2.accepted", true);
+// defaults to true on Windows and Mac, because the installer shows this
+#ifdef XP_MACOSX
+pref("browser.EULA.3.accepted", true);
+#elifdef XP_WIN
+pref("browser.EULA.3.accepted", true);
+#else
+# Need to fix the unittest and talos machine profiles before flipping this by default
+#pref("browser.EULA.3.accepted", false);
+pref("browser.EULA.3.accepted", true);
+#endif
 
 // if we rev the EULA again, we should bump this so users agree to the new EULA
-pref("browser.EULA.version", 2);
+pref("browser.EULA.version", 3);
 
 pref("browser.sessionstore.enabled", true);
 pref("browser.sessionstore.resume_from_crash", true);
 pref("browser.sessionstore.resume_session_once", false);
 
 // minimal interval between two save operations in milliseconds
 pref("browser.sessionstore.interval", 10000);
 // maximum amount of POSTDATA to be saved in bytes per history entry (-1 = all of it)
--- a/browser/base/content/EULA.xhtml
+++ b/browser/base/content/EULA.xhtml
@@ -3,36 +3,38 @@
 <html lang="en" id="eula" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
 <head>
 <title>MOZILLA FIREFOX END-USER SOFTWARE LICENSE AGREEMENT</title>
 </head>
 
 <body>
 
 <p>MOZILLA FIREFOX END-USER SOFTWARE LICENSE AGREEMENT<br/>
-Version 2.0</p>
+Version 3.0, May 2008</p>
   
-<p>A SOURCE CODE VERSION OF CERTAIN FIREFOX BROWSER FUNCTIONALITY THAT YOU MAY USE, MODIFY AND DISTRIBUTE IS AVAILABLE TO YOU FREE-OF-CHARGE FROM WWW.MOZILLA.ORG UNDER THE MOZILLA PUBLIC LICENSE and other open source software licenses.</p>
+<p><b>A source code version of certain Firefox Browser functionality that you may use, modify and distribute is available to you free-of-charge from <a href="http://www.mozilla.org">www.mozilla.org</a> under the Mozilla Public License and other open source software licenses.</b></p>
 
-<p>The accompanying executable code version of Mozilla Firefox and related documentation (the ‚ÄúProduct‚ÄĚ) is made available to you under the terms of this MOZILLA FIREFOX END-USER SOFTWARE LICENSE AGREEMENT (THE ‚ÄúAGREEMENT‚ÄĚ).  BY CLICKING THE ‚ÄúACCEPT‚ÄĚ BUTTON, OR BY INSTALLING OR USING THE MOZILLA FIREFOX BROWSER, YOU ARE CONSENTING TO BE BOUND BY THE AGREEMENT.  IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT, DO NOT CLICK THE ‚ÄúACCEPT‚ÄĚ BUTTON, AND DO NOT INSTALL OR USE ANY PART OF THE MOZILLA FIREFOX BROWSER.</p>
+<p>The accompanying executable code version of Mozilla Firefox and related documentation (the "Product") is made available to you under the terms of this <b>Mozilla Firefox End-User Software License Agreement (the "Agreement").  By clicking the "Accept" button, or by installing or using the Mozilla Firefox Browser, you are consenting to be bound by the Agreement.  If you do not agree to the terms and conditions of this Agreement, do not click the "Accept" button, and do not install or use any part of the Mozilla Firefox Browser.</b></p>
 
-<p>DURING THE MOZILLA FIREFOX INSTALLATION PROCESS, AND AT LATER TIMES, YOU MAY BE GIVEN THE OPTION OF INSTALLING ADDITIONAL COMPONENTS FROM THIRD-PARTY SOFTWARE PROVIDERS.  THE INSTALLATION AND USE OF THOSE THIRD-PARTY COMPONENTS MAY BE GOVERNED BY ADDITIONAL LICENSE AGREEMENTS.</p>
+<p><b>During the Mozilla Firefox installation process, and at later times, you may be given the option of installing additional components from third-party software providers.  The installation and use of those third-party components may be governed by additional license agreements.</b></p>
 
 <p>1.  LICENSE GRANT.  The Mozilla Corporation grants you a non-exclusive license to use the executable code version of the Product.  This Agreement will also govern any software upgrades provided by Mozilla that replace and/or supplement the original Product, unless such upgrades are accompanied by a separate license, in which case the terms of that license will govern.</p>
 
 <p>2.  TERMINATION.  If you breach this Agreement your right to use the Product will terminate immediately and without notice, but all provisions of this Agreement except the License Grant (Paragraph 1) will survive termination and continue in effect.  Upon termination, you must destroy all copies of the Product.</p>
 
-<p>3.  PROPRIETARY RIGHTS.  Portions of the Product are available in source code form under the terms of the Mozilla Public License and other open source licenses (collectively, ‚ÄúOpen Source Licenses‚ÄĚ) at http://mozilla.org.  Nothing in this Agreement will be construed to limit any rights granted under the Open Source Licenses.  Subject to the foregoing, Mozilla, for itself and on behalf of its licensors, hereby reserves all intellectual property rights in the Product, except for the rights expressly granted in this Agreement.  You may not remove or alter any trademark, logo, copyright or other proprietary notice in or on the Product.  This license does not grant you any right to use the trademarks, service marks or logos of Mozilla or its licensors.</p>
+<p>3.  PROPRIETARY RIGHTS.  Portions of the Product are available in source code form under the terms of the Mozilla Public License and other open source licenses (collectively, "Open Source Licenses") at <a href="http://www.mozilla.org/MPL">http://www.mozilla.org/MPL</a>.  Nothing in this Agreement will be construed to limit any rights granted under the Open Source Licenses.  Subject to the foregoing, Mozilla, for itself and on behalf of its licensors, hereby reserves all intellectual property rights in the Product, except for the rights expressly granted in this Agreement.  You may not remove or alter any trademark, logo, copyright or other proprietary notice in or on the Product.  This license does not grant you any right to use the trademarks, service marks or logos of Mozilla or its licensors.</p>
+
+<p>4.  PRIVACY POLICY.  You agree to the Mozilla Firefox Privacy Policy, made available online at <a href="http://www.mozilla.com/legal/privacy/">http://www.mozilla.com/legal/privacy/</a>, as that policy may be changed from time to time.  When Mozilla changes the policy in a material way a notice will be posted on the website at www.mozilla.com and when any change is made in the privacy policy, the updated policy will be posted at the above link.  It is your responsibility to ensure that you understand the terms of the privacy policy, so you should periodically check the current version of the policy for changes.</p>
 
-<p>4.  PRIVACY POLICY.  You agree to the Mozilla Firefox Privacy Policy, made available online at http://www.mozilla.com/firefox/privacy/, as that policy may be changed from time to time.  When Mozilla changes the policy in a material way a notice will be posted on the website at www.mozilla.com and when any change is made in the privacy policy, the updated policy will be posted at the above link.  It is your responsibility to ensure that you understand the terms of the privacy policy, so you should periodically check the current version of the policy for changes.</p>
+<p>5.  WEBSITE INFORMATION SERVICES.  Mozilla and its contributors, licensors and partners work to provide the most accurate and up-to-date phishing and malware information.  However, they cannot guarantee that this information is comprehensive and error-free: some risky sites may not be identified, and some safe sites may be identified in error.</p>
 
-<p>5.  DISCLAIMER OF WARRANTY.  THE PRODUCT IS PROVIDED ‚ÄúAS IS‚ÄĚ WITH ALL FAULTS.  TO THE EXTENT PERMITTED BY LAW, MOZILLA AND MOZILLA‚ÄôS DISTRIBUTORS, AND LICENSORS HEREBY DISCLAIM ALL WARRANTIES, WHETHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES THAT THE PRODUCT IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE AND NON-INFRINGING.  YOU BEAR THE ENTIRE RISK AS TO SELECTING THE PRODUCT FOR YOUR PURPOSES AND AS TO THE QUALITY AND PERFORMANCE OF THE PRODUCT.  THIS LIMITATION WILL APPLY NOTWITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE OF ANY REMEDY.  SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF IMPLIED WARRANTIES, SO THIS DISCLAIMER MAY NOT APPLY TO YOU.</p>
+<p>6.  DISCLAIMER OF WARRANTY.  <b>The product is provided "as is" with all faults.  To the extent permitted by law, Mozilla and Mozilla’s distributors, and licensors hereby disclaim all warranties, whether express or implied, including without limitation warranties that the product is free of defects, merchantable, fit for a particular purpose and non-infringing.  You bear the entire risk as to selecting the product for your purposes and as to the quality and performance of the product.  This limitation will apply notwithstanding the failure of essential purpose of any remedy.  Some jurisdictions do not allow the exclusion or limitation of implied warranties, so this disclaimer may not apply to you.</b></p>
 
-<p>6.  LIMITATION OF LIABILITY.  EXCEPT AS REQUIRED BY LAW, MOZILLA AND ITS DISTRIBUTORS, DIRECTORS, LICENSORS, CONTRIBUTORS AND AGENTS (COLLECTIVELY, THE ‚ÄúMOZILLA GROUP‚ÄĚ) WILL NOT BE LIABLE FOR ANY INDIRECT, SPECIAL, INCIDENTAL, CONSEQUENTIAL OR EXEMPLARY DAMAGES ARISING OUT OF OR IN ANY WAY RELATING TO THIS AGREEMENT OR THE USE OF OR INABILITY TO USE THE PRODUCT, INCLUDING WITHOUT LIMITATION DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, LOST PROFITS, LOSS OF DATA, AND COMPUTER FAILURE OR MALFUNCTION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND REGARDLESS OF THE THEORY (CONTRACT, TORT OR OTHERWISE) UPON WHICH SUCH CLAIM IS BASED.  THE MOZILLA GROUP‚ÄôS COLLECTIVE LIABILITY UNDER THIS AGREEMENT WILL NOT EXCEED THE GREATER OF $500 (FIVE HUNDRED DOLLARS) AND THE FEES PAID BY YOU UNDER THE LICENSE (IF ANY).  SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL, CONSEQUENTIAL OR SPECIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.</p>
+<p>7.  LIMITATION OF LIABILITY.  <b>Except as required by law, Mozilla and its distributors, directors, licensors, contributors and agents (collectively, the "Mozilla Group") will not be liable for any indirect, special, incidental, consequential or exemplary damages arising out of or in any way relating to this agreement or the use of or inability to use the product, including without limitation damages for loss of goodwill, work stoppage, lost profits, loss of data, and computer failure or malfunction, even if advised of the possibility of such damages and regardless of the theory (contract, tort or otherwise) upon which such claim is based.  The Mozilla Group's collective liability under this agreement will not exceed the greater of $500 (five hundred dollars) and the fees paid by you under the license (if any).  Some jurisdictions do not allow the exclusion or limitation of incidental, consequential or special damages, so this exclusion and limitation may not apply to you.</b></p>
 
-<p>7.  EXPORT CONTROLS.  This license is subject to all applicable export restrictions.  You must comply with all export and import laws and restrictions and regulations of any United States or foreign agency or authority relating to the Product and its use.</p>
+<p>8.  EXPORT CONTROLS.  This license is subject to all applicable export restrictions.  You must comply with all export and import laws and restrictions and regulations of any United States or foreign agency or authority relating to the Product and its use.</p>
 
-<p>8.  U.S. GOVERNMENT END-USERS.  This Product is a ‚Äúcommercial item,‚ÄĚ as that term is defined in 48 C.F.R. 2.101, consisting of ‚Äúcommercial computer software‚ÄĚ and ‚Äúcommercial computer software documentation,‚ÄĚ as such terms are used in 48 C.F.R. 12.212 (Sept. 1995) and 48 C.F.R. 227.7202 (June 1995).  Consistent with 48 C.F.R. 12.212, 48 C.F.R. 27.405(b)(2) (June 1998) and 48 C.F.R. 227.7202, all U.S. Government End Users acquire the Product with only those rights as set forth therein.</p>
+<p>9.  U.S. GOVERNMENT END-USERS.  This Product is a "commercial item," as that term is defined in 48 C.F.R. 2.101, consisting of "commercial computer software" and "commercial computer software documentation," as such terms are used in 48 C.F.R. 12.212 (Sept. 1995) and 48 C.F.R. 227.7202 (June 1995).  Consistent with 48 C.F.R. 12.212, 48 C.F.R. 27.405(b)(2) (June 1998) and 48 C.F.R. 227.7202, all U.S. Government End Users acquire the Product with only those rights as set forth therein.</p>
 
-<p>9.  MISCELLANEOUS.  (a) This Agreement constitutes the entire agreement between Mozilla and you concerning the subject matter hereof, and it may only be modified by a written amendment signed by an authorized executive of Mozilla.  (b) Except to the extent applicable law, if any, provides otherwise, this Agreement will be governed by the laws of the state of California, U.S.A., excluding its conflict of law provisions.  (c) This Agreement will not be governed by the United Nations Convention on Contracts for the International Sale of Goods.  (d) If any part of this Agreement is held invalid or unenforceable, that part will be construed to reflect the parties’ original intent, and the remaining portions will remain in full force and effect.  (e) A waiver by either party of any term or condition of this Agreement or any breach thereof, in any one instance, will not waive such term or condition or any subsequent breach thereof. (f) Except as required by law, the controlling language of this Agreement is English.  (g) You may assign your rights under this Agreement to any party that consents to, and agrees to be bound by, its terms; the Mozilla Corporation may assign its rights under this Agreement without condition.  (h) This Agreement will be binding upon and inure to the benefit of the parties, their successors and permitted assigns.</p>
+<p>10.  MISCELLANEOUS.  (a) This Agreement constitutes the entire agreement between Mozilla and you concerning the subject matter hereof, and it may only be modified by a written amendment signed by an authorized executive of Mozilla.  (b) Except to the extent applicable law, if any, provides otherwise, this Agreement will be governed by the laws of the state of California, U.S.A., excluding its conflict of law provisions.  (c) This Agreement will not be governed by the United Nations Convention on Contracts for the International Sale of Goods.  (d) If any part of this Agreement is held invalid or unenforceable, that part will be construed to reflect the parties' original intent, and the remaining portions will remain in full force and effect.  (e) A waiver by either party of any term or condition of this Agreement or any breach thereof, in any one instance, will not waive such term or condition or any subsequent breach thereof. (f) Except as required by law, the controlling language of this Agreement is English.  (g) You may assign your rights under this Agreement to any party that consents to, and agrees to be bound by, its terms; the Mozilla Corporation may assign its rights under this Agreement without condition.  (h) This Agreement will be binding upon and inure to the benefit of the parties, their successors and permitted assigns.</p>
 
 </body>
-</html>
\ No newline at end of file
+</html>
--- a/browser/branding/unofficial/license.r
+++ b/browser/branding/unofficial/license.r
@@ -37,41 +37,43 @@ resource 'STR#' (5000, "English") {
 // Beware of 1024(?) byte (character?) line length limitation.  Split up long
 // lines.
 // If straight quotes are used ("), remember to escape them (\").
 // Newline is \n, to leave a blank line, use two of them.
 // 0xD2 and 0xD3 are curly double-quotes ("), 0xD4 and 0xD5 are curly
 //   single quotes ('), 0xD5 is also the apostrophe.
 data 'TEXT' (5000, "English") {
   "GRAN PARADISO END-USER SOFTWARE LICENSE AGREEMENT\n"
-  "Version 2.0\n"
+  "Version 3.0, May 2008\n"
   "\n"
-  "A SOURCE CODE VERSION OF CERTAIN GRAN PARADISO BROWSER FUNCTIONALITY THAT YOU MAY USE, MODIFY AND DISTRIBUTE IS AVAILABLE TO YOU FREE-OF-CHARGE FROM WWW.MOZILLA.ORG UNDER THE MOZILLA PUBLIC LICENSE and other open source software licenses.\n"
+  "A SOURCE CODE VERSION OF CERTAIN FIREFOX BROWSER FUNCTIONALITY THAT YOU MAY USE, MODIFY AND DISTRIBUTE IS AVAILABLE TO YOU FREE-OF-CHARGE FROM WWW.MOZILLA.ORG UNDER THE MOZILLA PUBLIC LICENSE and other open source software licenses.\n"
   "\n"
-  "The accompanying executable code version of Gran Paradiso and related documentation (the “Product”) is made available to you under the terms of this GRAN PARADISO END-USER SOFTWARE LICENSE AGREEMENT (THE “AGREEMENT”).  BY CLICKING THE “ACCEPT” BUTTON, OR BY INSTALLING OR USING THE GRAN PARADISO BROWSER, YOU ARE CONSENTING TO BE BOUND BY THE AGREEMENT.  IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT, DO NOT CLICK THE “ACCEPT” BUTTON, AND DO NOT INSTALL OR USE ANY PART OF THE GRAN PARADISO BROWSER.\n"
+  "The accompanying executable code version of Mozilla Firefox and related documentation (the “Product”) is made available to you under the terms of this MOZILLA FIREFOX END-USER SOFTWARE LICENSE AGREEMENT (THE “AGREEMENT”).  BY CLICKING THE “ACCEPT” BUTTON, OR BY INSTALLING OR USING THE MOZILLA FIREFOX BROWSER, YOU ARE CONSENTING TO BE BOUND BY THE AGREEMENT.  IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT, DO NOT CLICK THE “ACCEPT” BUTTON, AND DO NOT INSTALL OR USE ANY PART OF THE MOZILLA FIREFOX BROWSER.\n"
   "\n"
-  "DURING THE GRAN PARADISO INSTALLATION PROCESS, AND AT LATER TIMES, YOU MAY BE GIVEN THE OPTION OF INSTALLING ADDITIONAL COMPONENTS FROM THIRD-PARTY SOFTWARE PROVIDERS.  THE INSTALLATION AND USE OF THOSE THIRD-PARTY COMPONENTS MAY BE GOVERNED BY ADDITIONAL LICENSE AGREEMENTS.\n"
+  "DURING THE MOZILLA FIREFOX INSTALLATION PROCESS, AND AT LATER TIMES, YOU MAY BE GIVEN THE OPTION OF INSTALLING ADDITIONAL COMPONENTS FROM THIRD-PARTY SOFTWARE PROVIDERS.  THE INSTALLATION AND USE OF THOSE THIRD-PARTY COMPONENTS MAY BE GOVERNED BY ADDITIONAL LICENSE AGREEMENTS.\n"
   "\n"
   "1.  LICENSE GRANT.  The Mozilla Corporation grants you a non-exclusive license to use the executable code version of the Product.  This Agreement will also govern any software upgrades provided by Mozilla that replace and/or supplement the original Product, unless such upgrades are accompanied by a separate license, in which case the terms of that license will govern.\n"
   "\n"
   "2.  TERMINATION.  If you breach this Agreement your right to use the Product will terminate immediately and without notice, but all provisions of this Agreement except the License Grant (Paragraph 1) will survive termination and continue in effect.  Upon termination, you must destroy all copies of the Product.\n"
   "\n"
-  "3.  PROPRIETARY RIGHTS.  Portions of the Product are available in source code form under the terms of the Mozilla Public License and other open source licenses (collectively, “Open Source Licenses”) at http://mozilla.org.  Nothing in this Agreement will be construed to limit any rights granted under the Open Source Licenses.  Subject to the foregoing, Mozilla, for itself and on behalf of its licensors, hereby reserves all intellectual property rights in the Product, except for the rights expressly granted in this Agreement.  You may not remove or alter any trademark, logo, copyright or other proprietary notice in or on the Product.  This license does not grant you any right to use the trademarks, service marks or logos of Mozilla or its licensors.\n"
+  "3.  PROPRIETARY RIGHTS.  Portions of the Product are available in source code form under the terms of the Mozilla Public License and other open source licenses (collectively, “Open Source Licenses”) at http://www.mozilla.org/MPL.  Nothing in this Agreement will be construed to limit any rights granted under the Open Source Licenses.  Subject to the foregoing, Mozilla, for itself and on behalf of its licensors, hereby reserves all intellectual property rights in the Product, except for the rights expressly granted in this Agreement.  You may not remove or alter any trademark, logo, copyright or other proprietary notice in or on the Product.  This license does not grant you any right to use the trademarks, service marks or logos of Mozilla or its licensors.\n"
+  "\n"
+  "4.  PRIVACY POLICY.  You agree to the Mozilla Firefox Privacy Policy, made available online at http://www.mozilla.com/legal/privacy/, as that policy may be changed from time to time.  When Mozilla changes the policy in a material way a notice will be posted on the website at www.mozilla.com and when any change is made in the privacy policy, the updated policy will be posted at the above link.  It is your responsibility to ensure that you understand the terms of the privacy policy, so you should periodically check the current version of the policy for changes.\n"
   "\n"
-  "4.  PRIVACY POLICY.  You agree to the Mozilla Firefox Privacy Policy, made available online at http://www.mozilla.com/firefox/privacy/, as that policy may be changed from time to time.  When Mozilla changes the policy in a material way a notice will be posted on the website at www.mozilla.com and when any change is made in the privacy policy, the updated policy will be posted at the above link.  It is your responsibility to ensure that you understand the terms of the privacy policy, so you should periodically check the current version of the policy for changes.\n"
+  "5.  WEBSITE INFORMATION SERVICES.  Mozilla and its contributors, licensors and partners work to provide the most accurate and up-to-date phishing and malware information.  However, they cannot guarantee that this information is comprehensive and error-free: some risky sites may not be identified, and some safe sites may be identified in error.\n"
   "\n"
-  "5.  DISCLAIMER OF WARRANTY.  THE PRODUCT IS PROVIDED “AS IS” WITH ALL FAULTS.  TO THE EXTENT PERMITTED BY LAW, MOZILLA AND MOZILLA’S DISTRIBUTORS, AND LICENSORS HEREBY DISCLAIM ALL WARRANTIES, WHETHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES THAT THE PRODUCT IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE AND NON-INFRINGING.  YOU BEAR THE ENTIRE RISK AS TO SELECTING THE PRODUCT FOR YOUR PURPOSES AND AS TO THE QUALITY AND PERFORMANCE OF THE PRODUCT.  THIS LIMITATION WILL APPLY NOTWITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE OF ANY REMEDY.  SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF IMPLIED WARRANTIES, SO THIS DISCLAIMER MAY NOT APPLY TO YOU.\n"
+  "6.  DISCLAIMER OF WARRANTY.  THE PRODUCT IS PROVIDED “AS IS” WITH ALL FAULTS.  TO THE EXTENT PERMITTED BY LAW, MOZILLA AND MOZILLA’S DISTRIBUTORS, AND LICENSORS HEREBY DISCLAIM ALL WARRANTIES, WHETHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES THAT THE PRODUCT IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE AND NON-INFRINGING.  YOU BEAR THE ENTIRE RISK AS TO SELECTING THE PRODUCT FOR YOUR PURPOSES AND AS TO THE QUALITY AND PERFORMANCE OF THE PRODUCT.  THIS LIMITATION WILL APPLY NOTWITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE OF ANY REMEDY.  SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF IMPLIED WARRANTIES, SO THIS DISCLAIMER MAY NOT APPLY TO YOU.\n"
   "\n"
-  "6.  LIMITATION OF LIABILITY.  EXCEPT AS REQUIRED BY LAW, MOZILLA AND ITS DISTRIBUTORS, DIRECTORS, LICENSORS, CONTRIBUTORS AND AGENTS (COLLECTIVELY, THE “MOZILLA GROUP”) WILL NOT BE LIABLE FOR ANY INDIRECT, SPECIAL, INCIDENTAL, CONSEQUENTIAL OR EXEMPLARY DAMAGES ARISING OUT OF OR IN ANY WAY RELATING TO THIS AGREEMENT OR THE USE OF OR INABILITY TO USE THE PRODUCT, INCLUDING WITHOUT LIMITATION DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, LOST PROFITS, LOSS OF DATA, AND COMPUTER FAILURE OR MALFUNCTION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND REGARDLESS OF THE THEORY (CONTRACT, TORT OR OTHERWISE) UPON WHICH SUCH CLAIM IS BASED.  THE MOZILLA GROUP’S COLLECTIVE LIABILITY UNDER THIS AGREEMENT WILL NOT EXCEED THE GREATER OF $500 (FIVE HUNDRED DOLLARS) AND THE FEES PAID BY YOU UNDER THE LICENSE (IF ANY).  SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL, CONSEQUENTIAL OR SPECIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.\n"
+  "7.  LIMITATION OF LIABILITY.  EXCEPT AS REQUIRED BY LAW, MOZILLA AND ITS DISTRIBUTORS, DIRECTORS, LICENSORS, CONTRIBUTORS AND AGENTS (COLLECTIVELY, THE “MOZILLA GROUP”) WILL NOT BE LIABLE FOR ANY INDIRECT, SPECIAL, INCIDENTAL, CONSEQUENTIAL OR EXEMPLARY DAMAGES ARISING OUT OF OR IN ANY WAY RELATING TO THIS AGREEMENT OR THE USE OF OR INABILITY TO USE THE PRODUCT, INCLUDING WITHOUT LIMITATION DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, LOST PROFITS, LOSS OF DATA, AND COMPUTER FAILURE OR MALFUNCTION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND REGARDLESS OF THE THEORY (CONTRACT, TORT OR OTHERWISE) UPON WHICH SUCH CLAIM IS BASED.  THE MOZILLA GROUP’S COLLECTIVE LIABILITY UNDER THIS AGREEMENT WILL NOT EXCEED THE GREATER OF $500 (FIVE HUNDRED DOLLARS) AND THE FEES PAID BY YOU UNDER THE LICENSE (IF ANY).  SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL, CONSEQUENTIAL OR SPECIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.\n"
   "\n"
-  "7.  EXPORT CONTROLS.  This license is subject to all applicable export restrictions.  You must comply with all export and import laws and restrictions and regulations of any United States or foreign agency or authority relating to the Product and its use.\n"
+  "8.  EXPORT CONTROLS.  This license is subject to all applicable export restrictions.  You must comply with all export and import laws and restrictions and regulations of any United States or foreign agency or authority relating to the Product and its use.\n"
   "\n"
-  "8.  U.S. GOVERNMENT END-USERS.  This Product is a “commercial item,” as that term is defined in 48 C.F.R. 2.101, consisting of “commercial computer software” and “commercial computer software documentation,” as such terms are used in 48 C.F.R. 12.212 (Sept. 1995) and 48 C.F.R. 227.7202 (June 1995).  Consistent with 48 C.F.R. 12.212, 48 C.F.R. 27.405(b)(2) (June 1998) and 48 C.F.R. 227.7202, all U.S. Government End Users acquire the Product with only those rights as set forth therein.\n"
+  "9.  U.S. GOVERNMENT END-USERS.  This Product is a “commercial item,” as that term is defined in 48 C.F.R. 2.101, consisting of “commercial computer software” and “commercial computer software documentation,” as such terms are used in 48 C.F.R. 12.212 (Sept. 1995) and 48 C.F.R. 227.7202 (June 1995).  Consistent with 48 C.F.R. 12.212, 48 C.F.R. 27.405(b)(2) (June 1998) and 48 C.F.R. 227.7202, all U.S. Government End Users acquire the Product with only those rights as set forth therein.\n"
   "\n"
-  "9.  MISCELLANEOUS.  (a) This Agreement constitutes the entire agreement between Mozilla and you concerning the subject matter hereof, and it may only be modified by a written amendment signed by an authorized executive of Mozilla.  (b) Except to the extent applicable law, if any, provides otherwise, this Agreement will be governed by the laws of the state of California, U.S.A., excluding its conflict of law provisions.  (c) This Agreement will not be governed by the United Nations Convention on Contracts for the International Sale of Goods.  "
+  "10.  MISCELLANEOUS.  (a) This Agreement constitutes the entire agreement between Mozilla and you concerning the subject matter hereof, and it may only be modified by a written amendment signed by an authorized executive of Mozilla.  (b) Except to the extent applicable law, if any, provides otherwise, this Agreement will be governed by the laws of the state of California, U.S.A., excluding its conflict of law provisions.  (c) This Agreement will not be governed by the United Nations Convention on Contracts for the International Sale of Goods.  "
   "(d) If any part of this Agreement is held invalid or unenforceable, that part will be construed to reflect the parties’ original intent, and the remaining portions will remain in full force and effect.  (e) A waiver by either party of any term or condition of this Agreement or any breach thereof, in any one instance, will not waive such term or condition or any subsequent breach thereof. (f) Except as required by law, the controlling language of this Agreement is English.  "
   "(g) You may assign your rights under this Agreement to any party that consents to, and agrees to be bound by, its terms; the Mozilla Corporation may assign its rights under this Agreement without condition.  (h) This Agreement will be binding upon and inure to the benefit of the parties, their successors and permitted assigns."
 };
 
 data 'styl' (5000, "English") {
   // Number of styles following = 2
   $"0002"
 
@@ -90,18 +92,18 @@ data 'styl' (5000, "English") {
   // Style, unused?
   $"02"
   // Size = 12 point
   $"000C"
   // Color, RGB
   $"0000 0000 0000"
 
   // Style 2.  This is used to display the body.
-  // Start character = 62
-  $"0000 003E"
+  // Start character = 72
+  $"0000 0048"
   // Height = 16
   $"0010"
   // Ascent = 12
   $"000C"
   // Font family = 1024 (Lucida Grande)
   $"0400"
   // Style bitfield, 0x1=bold 0x2=italic 0x4=underline 0x8=outline
   // 0x10=shadow 0x20=condensed 0x40=extended
--- a/browser/themes/pinstripe/browser/browser.css
+++ b/browser/themes/pinstripe/browser/browser.css
@@ -43,21 +43,71 @@
 
 @import url("chrome://global/skin/");
 
 @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
 @namespace html url("http://www.w3.org/1999/xhtml");
 
 #main-window {
   -moz-binding: url("chrome://global/skin/globalBindings.xml#unifiedWindow");
-  -moz-appearance: none;
 }
 
 #main-window[chromehidden~="toolbar"][chromehidden~="location"][chromehidden~="directories"] {
   border-top: 1px solid rgba(0,0,0,0.65);
+  -moz-appearance: none;
+  background-color: #eeeeee;
+}
+
+/* ----- INACTIVE WINDOW ----- */
+
+#main-window:not([active="true"]) > #navigator-toolbox > toolbar {
+  border-top-color: rgba(255,255,255,0.45);
+  border-bottom-color: rgba(0,0,0,0.35);
+  background-color: #cfcfcf;
+}
+
+#main-window:not([active="true"]) > #navigator-toolbox > #nav-bar {
+  background-image: url("chrome://global/skin/toolbar/toolbar-background-inactive.png");
+}
+
+#main-window:not([active="true"]) > #navigator-toolbox > #PersonalToolbar {
+  background-image: url("chrome://browser/skin/bookmark_toolbar_background-inactive.png");
+}
+
+#main-window:not([active="true"]) > #navigator-toolbox > toolbar > toolbaritem,
+#main-window:not([active="true"]) > #navigator-toolbox > toolbar > toolbarbutton,
+#main-window:not([active="true"]) > #browser-bottombox {
+  opacity: 0.75;
+}
+
+#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;
+}
+
+#main-window:not([active="true"]) .tabbrowser-tab {
+  color: #575757;
+}
+
+#main-window:not([active="true"]) .tabbrowser-tab[selected="true"] > .tab-image-middle,
+#main-window:not([active="true"]) .tabbrowser-tab[selected="true"] > .tab-closebutton,
+#main-window:not([active="true"]) .tabbrowser-tab[selected="true"] > .tab-close-button {
+  background-image: url("chrome://browser/skin/tabbrowser/tab-middle-inactive.png");
+}
+
+#main-window:not([active="true"]) .tabbrowser-tab[selected="true"] > .tab-image-left {
+  background: url("chrome://browser/skin/tabbrowser/tab-left-inactive.png") no-repeat;
+}
+
+#main-window:not([active="true"]) .tabbrowser-tab[selected="true"] > .tab-image-right {
+  background: url("chrome://browser/skin/tabbrowser/tab-right-inactive.png") no-repeat;
 }
 
 /* ----- SEARCH FIELD ----- */
 
 #wrapper-search-container #searchbar html|*.textbox-input {
   visibility: hidden;
 }
 
--- a/browser/themes/pinstripe/browser/pageInfo.css
+++ b/browser/themes/pinstripe/browser/pageInfo.css
@@ -38,16 +38,25 @@
  * ***** END LICENSE BLOCK ***** */
 
 @import "chrome://global/skin/";
 
 #main-window {
   -moz-binding: url("chrome://global/skin/globalBindings.xml#unifiedWindow");
 }
 
+#main-window:not([active="true"]) > #topStackBar {
+  background-image: url("chrome://global/skin/toolbar/toolbar-background-inactive.png");
+  background-color: #cfcfcf;
+  border-bottom: 1px solid rgba(0,0,0,0.35);
+}
+
+#main-window:not([active="true"]) > #topStackBar > #viewGroup {
+  opacity: 0.7;
+}
 
 #topStackBar {
   display: -moz-box;
   background-color: #969696;
   border-bottom: 1px solid #404040;
   background-image: url("chrome://global/skin/toolbar/toolbar-background.gif");
   background-repeat: repeat-x;
   background-position: top right;
--- a/browser/themes/pinstripe/browser/places/organizer.css
+++ b/browser/themes/pinstripe/browser/places/organizer.css
@@ -1,14 +1,32 @@
 /* Unified toolbar */
 
 #places {
   -moz-binding: url("chrome://global/skin/globalBindings.xml#unifiedWindow");
 }
 
+/* Inactive Window */
+
+#places:not([active="true"]) > #placesToolbox > #placesToolbar {
+  background-image: url("chrome://global/skin/toolbar/toolbar-background-inactive.png");
+  background-color: #cfcfcf;
+  border-bottom: 1px solid rgba(0,0,0,0.35);
+}
+
+#places:not([active="true"]) > #placesToolbox > #placesToolbar > toolbarbutton,
+#places:not([active="true"]) > #placesToolbox > #placesToolbar > #searchFilter {
+  opacity: 0.7;
+}
+
+#places:not([active="true"]) > #placesView > #placesList {
+  background-color: #e8e8e8;
+}
+
+
 /* Places Organizer Sidebars */
 
 #placesList {
   -moz-appearance: none;
   border: none;
   margin: 0;
 }
 
--- a/browser/themes/pinstripe/browser/preferences/preferences.css
+++ b/browser/themes/pinstripe/browser/preferences/preferences.css
@@ -38,16 +38,26 @@
 #
 # ***** END LICENSE BLOCK *****
 */
 
 #BrowserPreferences {
   -moz-binding: url("chrome://global/skin/globalBindings.xml#unifiedPrefwindow");
 }
 
+#BrowserPreferences:not([active="true"]) > .paneSelector {
+  background-image: url("chrome://global/skin/toolbar/toolbar-background-tall-inactive.png");
+  background-color: #cfcfcf;
+  border-bottom: 1px solid rgba(0,0,0,0.35);
+}
+
+#BrowserPreferences:not([active="true"]) > .paneSelector > radio {
+  opacity: 0.7;
+}
+
 .prefWindow-dlgbuttons {
   margin: 0 12px 8px 12px;
 }
 
 #BrowserPreferences .prefWindow-dlgbuttons {
   padding-top: 0 !important;
 }
 
--- a/client.py
+++ b/client.py
@@ -1,12 +1,12 @@
 #!/usr/bin/python
 
 NSPR_CO_TAG = 'NSPR_4_7_1_RTM'
-NSS_CO_TAG  = 'NSS_3_12_RC2'
+NSS_CO_TAG  = 'NSS_3_12_RC3'
 
 NSPR_DIRS = ('nsprpub',)
 NSS_DIRS  = ('dbm',
              'security/nss',
              'security/coreconf',
              'security/dbm')
 
 # URL of the default hg repository to clone for Tamarin.
--- a/content/base/src/nsDocument.cpp
+++ b/content/base/src/nsDocument.cpp
@@ -2799,22 +2799,17 @@ nsDocument::DispatchContentLoadedEvents(
 
   if (mParentDocument) {
     target_frame =
       do_QueryInterface(mParentDocument->FindContentForSubDocument(this));
   }
 
   if (target_frame) {
     nsCOMPtr<nsIDocument> parent = mParentDocument;
-    while (parent) {
-      parent = parent->GetParentDocument();
-      if (!parent) {
-        break;
-      }
-
+    do {
       nsCOMPtr<nsIDOMDocumentEvent> document_event =
         do_QueryInterface(parent);
 
       nsCOMPtr<nsIDOMEvent> event;
       nsCOMPtr<nsIPrivateDOMEvent> privateEvent;
       if (document_event) {
         document_event->CreateEvent(NS_LITERAL_STRING("Events"),
                                     getter_AddRefs(event));
@@ -2846,17 +2841,19 @@ nsDocument::DispatchContentLoadedEvents(
 
             if (context) {
               nsEventDispatcher::Dispatch(parent, context, innerEvent, event,
                                           &status);
             }
           }
         }
       }
-    }
+      
+      parent = parent->GetParentDocument();
+    } while (parent);
   }
 
   UnblockOnload(PR_TRUE);
 }
 
 void
 nsDocument::EndLoad()
 {
--- a/content/base/test/Makefile.in
+++ b/content/base/test/Makefile.in
@@ -173,16 +173,17 @@ include $(topsrcdir)/config/rules.mk
 		file_XHR_pass3.txt \
 		file_XHR_pass3.txt^headers^ \
 		file_XHR_fail1.txt \
 		file_XHR_fail1.txt^headers^ \
 		test_bug428847.html \
 		file_bug428847-1.xhtml \
 		file_bug428847-2.xhtml \
 		test_bug425201.html \
+		test_bug431833.html \
 	$(NULL)
 
 libs:: $(_TEST_FILES)
 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
 
 check::
 	@$(EXIT_ON_ERROR) \
 	for f in $(subst .cpp,,$(CPP_UNIT_TESTS)); do \
--- a/content/base/test/test_bug308484.html
+++ b/content/base/test/test_bug308484.html
@@ -1,61 +1,61 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=308484
--->
-<head>
-  <title>Test for Bug 308484</title>
-  <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
-  <script type="text/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=308484">Mozilla Bug 308484</a>
-<p id="display"></p>
-<div id="content" style="display: none">
-  
-</div>
-<pre id="test">
-<script class="testbody" type="text/javascript">
-
-/** Test for Bug 308484 **/
-
-var headers = ["Host", "Content-Length", "Transfer-Encoding", "Via", "Upgrade"];
-var i, request;
-
-// Try setting headers in unprivileged context
-request = new XMLHttpRequest();
-request.open("GET", window.location.href);
-for (i = 0; i < headers.length; i++)
-  request.setRequestHeader(headers[i], "test" + i);
-
-// Read out headers
-netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect UniversalBrowserWrite");
-var channel = request.channel.QueryInterface(Components.interfaces.nsIHttpChannel);
-for (i = 0; i < headers.length; i++) {
-  // Retrieving Content-Length will throw an exception
-  var value = null;
-  try {
-    value = channel.getRequestHeader(headers[i]);
-  }
-  catch(e) {}
-
-  isnot(value, "test" + i, "Setting " + headers[i] + " header in unprivileged context");
-}
-
-// Try setting headers in privileged context
-request = new XMLHttpRequest();
-request.open("GET", window.location.href);
-for (i = 0; i < headers.length; i++)
-  request.setRequestHeader(headers[i], "test" + i);
-
-// Read out headers
-var channel = request.channel.QueryInterface(Components.interfaces.nsIHttpChannel);
-for (i = 0; i < headers.length; i++) {
-  var value = channel.getRequestHeader(headers[i]);
-  is(value, "test" + i, "Setting " + headers[i] + " header in privileged context");
-}
-</script>
-</pre>
-</body>
-</html>
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=308484
+-->
+<head>
+  <title>Test for Bug 308484</title>
+  <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
+  <script type="text/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=308484">Mozilla Bug 308484</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+  
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 308484 **/
+
+var headers = ["Host", "Content-Length", "Transfer-Encoding", "Via", "Upgrade"];
+var i, request;
+
+// Try setting headers in unprivileged context
+request = new XMLHttpRequest();
+request.open("GET", window.location.href);
+for (i = 0; i < headers.length; i++)
+  request.setRequestHeader(headers[i], "test" + i);
+
+// Read out headers
+netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect UniversalBrowserWrite");
+var channel = request.channel.QueryInterface(Components.interfaces.nsIHttpChannel);
+for (i = 0; i < headers.length; i++) {
+  // Retrieving Content-Length will throw an exception
+  var value = null;
+  try {
+    value = channel.getRequestHeader(headers[i]);
+  }
+  catch(e) {}
+
+  isnot(value, "test" + i, "Setting " + headers[i] + " header in unprivileged context");
+}
+
+// Try setting headers in privileged context
+request = new XMLHttpRequest();
+request.open("GET", window.location.href);
+for (i = 0; i < headers.length; i++)
+  request.setRequestHeader(headers[i], "test" + i);
+
+// Read out headers
+var channel = request.channel.QueryInterface(Components.interfaces.nsIHttpChannel);
+for (i = 0; i < headers.length; i++) {
+  var value = channel.getRequestHeader(headers[i]);
+  is(value, "test" + i, "Setting " + headers[i] + " header in privileged context");
+}
+</script>
+</pre>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/content/base/test/test_bug431833.html
@@ -0,0 +1,49 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=431833
+-->
+<head>
+  <title>Test for Bug 431833</title>
+  <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
+  <script type="text/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=431833">Mozilla Bug 431833</a>
+<p id="display">
+ <iframe id="f1" src="data:text/html,1"></iframe>
+ <iframe id="f2" src="data:text/html,2"></iframe>
+ <iframe id="f3" src="data:text/html,<iframe id='f4' src='data:text/html,3'></iframe>"></iframe>
+</p>
+<div id="content" style="display: none">
+  
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 431833 **/
+
+var str = "FAIL";
+function test(e) {
+  if (str == "FAIL")
+    str = "";
+
+  str += "PASS: " + e.target.id + '. '; 
+}
+
+window.addEventListener('DOMFrameContentLoaded',test,true);
+
+SimpleTest.waitForExplicitFinish();
+
+addLoadEvent(function() {
+  is(str, "PASS: f1. PASS: f2. PASS: f3. PASS: f4. ",
+     "DOMFrameContentLoaded events didn't fire?");
+  });
+
+addLoadEvent(SimpleTest.finish);
+</script>
+</pre>
+</body>
+</html>
+
--- a/content/events/src/nsDOMMessageEvent.cpp
+++ b/content/events/src/nsDOMMessageEvent.cpp
@@ -67,47 +67,57 @@ nsDOMMessageEvent::GetData(nsAString& aD
 NS_IMETHODIMP
 nsDOMMessageEvent::GetOrigin(nsAString& aOrigin)
 {
   aOrigin = mOrigin;
   return NS_OK;
 }
 
 NS_IMETHODIMP
+nsDOMMessageEvent::GetLastEventId(nsAString& aLastEventId)
+{
+  aLastEventId = mLastEventId;
+  return NS_OK;
+}
+
+NS_IMETHODIMP
 nsDOMMessageEvent::GetSource(nsIDOMWindow** aSource)
 {
   NS_IF_ADDREF(*aSource = mSource);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDOMMessageEvent::InitMessageEvent(const nsAString& aType,
                                     PRBool aCanBubble,
                                     PRBool aCancelable,
                                     const nsAString& aData,
                                     const nsAString& aOrigin,
+                                    const nsAString& aLastEventId,
                                     nsIDOMWindow* aSource)
 {
   nsresult rv = nsDOMEvent::InitEvent(aType, aCanBubble, aCancelable);
   NS_ENSURE_SUCCESS(rv, rv);
 
   mData = aData;
   mOrigin = aOrigin;
+  mLastEventId = aLastEventId;
   mSource = aSource;
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDOMMessageEvent::InitMessageEventNS(const nsAString& aNamespaceURI,
                                       const nsAString& aType,
                                       PRBool aCanBubble,
                                       PRBool aCancelable,
                                       const nsAString& aData,
                                       const nsAString& aOrigin,
+                                      const nsAString& aLastEventId,
                                       nsIDOMWindow* aSource)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 nsresult
 NS_NewDOMMessageEvent(nsIDOMEvent** aInstancePtrResult,
                       nsPresContext* aPresContext,
--- a/content/events/src/nsDOMMessageEvent.h
+++ b/content/events/src/nsDOMMessageEvent.h
@@ -39,17 +39,18 @@
 #ifndef nsDOMMessageEvent_h__
 #define nsDOMMessageEvent_h__
 
 #include "nsIDOMMessageEvent.h"
 #include "nsDOMEvent.h"
 #include "nsCycleCollectionParticipant.h"
 
 /**
- * Implements the MessageEvent event, used for cross-document messaging.
+ * Implements the MessageEvent event, used for cross-document messaging and
+ * server-sent events.
  *
  * See http://www.whatwg.org/specs/web-apps/current-work/#messageevent for
  * further details.
  */
 class nsDOMMessageEvent : public nsIDOMMessageEvent,
                           public nsDOMEvent
 {
 public:
@@ -64,12 +65,13 @@ public:
   NS_DECL_NSIDOMMESSAGEEVENT
 
   // Forward to base class
   NS_FORWARD_TO_NSDOMEVENT
 
 private:
   nsString mData;
   nsString mOrigin;
+  nsString mLastEventId;
   nsCOMPtr<nsIDOMWindow> mSource;
 };
 
 #endif // nsDOMMessageEvent_h__
--- a/content/html/content/src/nsGenericHTMLElement.cpp
+++ b/content/html/content/src/nsGenericHTMLElement.cpp
@@ -1353,17 +1353,23 @@ nsGenericHTMLElement::GetEventListenerMa
 
     // If we have a document, and it has a window, add the event
     // listener on the window (the inner window). If not, proceed as
     // normal.
     // XXXbz sXBL/XBL2 issue: should we instead use GetCurrentDoc() here,
     // override BindToTree for those classes and munge event listeners there?
     nsIDocument *document = GetOwnerDoc();
     nsresult rv = NS_OK;
-    if (document && (win = document->GetInnerWindow())) {
+
+    // FIXME (https://bugzilla.mozilla.org/show_bug.cgi?id=431767)
+    // nsDocument::GetInnerWindow can return an outer window in some cases,
+    // we don't want to stick an event listener on an outer window, so
+    // bail if it does.
+    if (document &&
+        (win = document->GetInnerWindow()) && win->IsInnerWindow()) {
       nsCOMPtr<nsPIDOMEventTarget> piTarget(do_QueryInterface(win));
       NS_ENSURE_TRUE(piTarget, NS_ERROR_FAILURE);
 
       rv = piTarget->GetListenerManager(PR_TRUE, aManager);
 
       if (NS_SUCCEEDED(rv)) {
         NS_ADDREF(*aTarget = win);
       }
--- a/content/xbl/test/file_bug379959_cross.html
+++ b/content/xbl/test/file_bug379959_cross.html
@@ -1,25 +1,25 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-<style>
-#div1 {
-  color: green;
-  -moz-binding: url(file_bug379959_xbl.xml#xbltest);
-}
-#div2 {
-  color: green;
-  -moz-binding: url(http://example.com/tests/content/xbl/test/file_bug379959_xbl.xml#xbltest);
-}
-</style>
-<body>
-<div id="div1"></div>
-<div id="div2"></div>
-<script>
-onload = function() {
-  nodes = document.getAnonymousNodes(document.getElementById('div1'));
-  parent.postMessage(nodes ? nodes.length : 0);
-  nodes = document.getAnonymousNodes(document.getElementById('div2'));
-  parent.postMessage(nodes ? nodes.length : 0);
-}
-</script>
-</html>
+<!DOCTYPE HTML>
+<html>
+<head>
+<style>
+#div1 {
+  color: green;
+  -moz-binding: url(file_bug379959_xbl.xml#xbltest);
+}
+#div2 {
+  color: green;
+  -moz-binding: url(http://example.com/tests/content/xbl/test/file_bug379959_xbl.xml#xbltest);
+}
+</style>
+<body>
+<div id="div1"></div>
+<div id="div2"></div>
+<script>
+onload = function() {
+  nodes = document.getAnonymousNodes(document.getElementById('div1'));
+  parent.postMessage(nodes ? nodes.length : 0, "http://localhost:8888");
+  nodes = document.getAnonymousNodes(document.getElementById('div2'));
+  parent.postMessage(nodes ? nodes.length : 0, "http://localhost:8888");
+}
+</script>
+</html>
--- a/content/xbl/test/file_bug379959_data.html
+++ b/content/xbl/test/file_bug379959_data.html
@@ -1,18 +1,18 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-<style>
-#d {
-  color: green;
-  -moz-binding: url(data:text/xml;charset=utf-8,%3C%3Fxml%20version%3D%221.0%22%3F%3E%0A%3Cbindings%20id%3D%22xbltestBindings%22%20xmlns%3D%22http%3A//www.mozilla.org/xbl%22%3E%0A%20%20%3Cbinding%20id%3D%22xbltest%22%3E%3Ccontent%3EPASS%3C/content%3E%3C/binding%3E%0A%3C/bindings%3E%0A);
-}
-</style>
-<body>
-<div id="d"></div>
-<script>
-onload = function() {
-  nodes = document.getAnonymousNodes(document.getElementById('d'));
-  parent.postMessage(nodes ? nodes.length : 0);
-}
-</script>
-</html>
+<!DOCTYPE HTML>
+<html>
+<head>
+<style>
+#d {
+  color: green;
+  -moz-binding: url(data:text/xml;charset=utf-8,%3C%3Fxml%20version%3D%221.0%22%3F%3E%0A%3Cbindings%20id%3D%22xbltestBindings%22%20xmlns%3D%22http%3A//www.mozilla.org/xbl%22%3E%0A%20%20%3Cbinding%20id%3D%22xbltest%22%3E%3Ccontent%3EPASS%3C/content%3E%3C/binding%3E%0A%3C/bindings%3E%0A);
+}
+</style>
+<body>
+<div id="d"></div>
+<script>
+onload = function() {
+  nodes = document.getAnonymousNodes(document.getElementById('d'));
+  parent.postMessage(nodes ? nodes.length : 0, "http://localhost:8888");
+}
+</script>
+</html>
--- a/content/xbl/test/test_bug379959.html
+++ b/content/xbl/test/test_bug379959.html
@@ -22,19 +22,24 @@ https://bugzilla.mozilla.org/show_bug.cg
 
   <pre id="test">
     <script class="testbody" type="application/javascript;version=1.7">
 SimpleTest.waitForExplicitFinish();
 
 gen = runTest();
 var messages = 0;
 
-document.addEventListener("message",
-                          function(e) { messages++; gen.send(e.data); },
-                          false);
+function receiveMessage(e)
+{
+  is(e.origin, "http://localhost:8888", "wrong sender!");
+  messages++;
+  gen.send(e.data);
+}
+
+window.addEventListener("message", receiveMessage, false);
 
 const prefName = "layout.debug.enable_data_xbl";
 
 function runTest() {
   iframe = document.getElementById('f');
 
   // Turn on loads of data-urls
   netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
--- a/dom/public/idl/base/nsIDOMWindowInternal.idl
+++ b/dom/public/idl/base/nsIDOMWindowInternal.idl
@@ -39,17 +39,17 @@
 
 #include "nsIDOMWindow2.idl"
 
 interface nsIPrompt;
 interface nsIControllers;
 interface nsIDOMLocation;
 interface nsIVariant;
 
-[scriptable, uuid(89b9ff5a-78db-430b-b3b4-66469457435a)]
+[scriptable, uuid(3414EBC7-731F-4697-9F43-ACA6F5050875)]
 interface nsIDOMWindowInternal : nsIDOMWindow2
 {
   readonly attribute nsIDOMWindowInternal        window;
 
   /* [replaceable] self */
   readonly attribute nsIDOMWindowInternal        self;
 
   readonly attribute nsIDOMNavigator             navigator;
@@ -200,20 +200,24 @@ interface nsIDOMWindowInternal : nsIDOMW
   nsIVariant                showModalDialog(in DOMString aURI,
                                             [optional] in nsIVariant aArgs,
                                             [optional] in DOMString aOptions);
 
   /**
    * Implements a safe message-passing system which can cross same-origin
    * boundaries.
    *
-   * This method, when called, causes a MessageEvent to be dispatched at the
-   * primary document for the window upon which this method is called.  (Note
-   * that the postMessage property on windows is allAccess and thus is readable
-   * cross-origin.)  The dispatched event will have message as its data, the
-   * calling context's window as its source, and a domain and URI determined by
-   * the calling context's main document URI.
+   * This method, when called, causes a MessageEvent to be asynchronously
+   * dispatched at the primary document for the window upon which this method is
+   * called.  (Note that the postMessage property on windows is allAccess and
+   * thus is readable cross-origin.)  The dispatched event will have message as
+   * its data, the calling context's window as its source, and an origin
+   * determined by the calling context's main document URI.  The targetOrigin
+   * argument specifies a URI and is used to restrict the message to be sent
+   * only when the target window has the same origin as targetOrigin (since,
+   * when the sender and the target have different origins, neither can read the
+   * location of the other).
    * 
    * See the WHATWG HTML5 specification, section 6.4, for more details.
    */
   [binaryname(PostMessageMoz)] void postMessage(in DOMString message,
-                                                [optional] in DOMString origin);
+                                                in DOMString targetOrigin);
 };
--- a/dom/public/idl/events/nsIDOMMessageEvent.idl
+++ b/dom/public/idl/events/nsIDOMMessageEvent.idl
@@ -38,56 +38,64 @@
 
 #include "nsIDOMEvent.idl"
 
 /**
  * The nsIDOMMessageEvent interface is used for server-sent events and for
  * cross-domain messaging.
  *
  * For more information on this interface, please see
- * http://www.whatwg.org/specs/web-apps/current-work/multipage/section-event0.html#event0
+ * http://www.whatwg.org/specs/web-apps/current-work/#messageevent
  */
-[scriptable, uuid(ca081997-91f9-40c1-890c-3edf39b6c571)]
+[scriptable, uuid(98150805-6A15-4667-815A-1A8C87CB4BBC)]
 interface nsIDOMMessageEvent : nsIDOMEvent
 {
   /**
    * Custom string data associated with this event.
    */
   readonly attribute DOMString data;
   
   /**
    * The origin of the site from which this event originated, which is the
    * scheme, ":", and if the URI has a host, "//" followed by the
    * host, and if the port is not the default for the given scheme,
    * ":" followed by that port.  This value does not have a trailing slash.
    */
   readonly attribute DOMString origin;
+
+  /**
+   * The last event ID string of the event source, for server-sent DOM events; this
+   * value is the empty string for cross-origin messaging.
+   */
+  readonly attribute DOMString lastEventId;
   
   /**
    * The window which originated this event.
    */
   readonly attribute nsIDOMWindow source;
 
   /**
    * Initializes this event with the given data, in a manner analogous to
    * the similarly-named method on the nsIDOMEvent interface, also setting the
-   * data, origin, and source attributes of this appropriately.
+   * data, origin, source, and lastEventId attributes of this appropriately.
    */
   void initMessageEvent(in DOMString aType,
                         in boolean aCanBubble,
                         in boolean aCancelable,
                         in DOMString aData,
                         in DOMString aOrigin,
+                        in DOMString aLastEventId,
                         in nsIDOMWindow aSource);
   
   /**
    * Initializes this event with the given data, in a manner analogous to
    * the similarly-named method on the Event interface, also setting the data,
-   * origin, and source attributes of this appropriately.
+   * origin, source, and lastEventId attributes of this appropriately.
    */
   void initMessageEventNS(in DOMString aNamespaceURI,
                           in DOMString aType,
                           in boolean aCanBubble,
                           in boolean aCancelable,
                           in DOMString aData,
                           in DOMString aOrigin,
+                          in DOMString aLastEventId,
                           in nsIDOMWindow aSource);
 };
--- a/dom/src/base/nsGlobalWindow.cpp
+++ b/dom/src/base/nsGlobalWindow.cpp
@@ -2236,55 +2236,55 @@ nsGlobalWindow::PostHandleEvent(nsEventC
         else
           fullScreen->HideAllOSChrome();
       }
     }
 
     // Set / unset the "active" attribute on the documentElement
     // of the top level window
     nsCOMPtr<nsIWidget> mainWidget = GetMainWidget();
-    NS_ENSURE_TRUE(mainWidget, nsnull);
-
-    // Get the top level widget (if the main widget is a sheet, this will
-    // be the sheet's top (non-sheet) parent).
-    nsCOMPtr<nsIWidget> topLevelWidget = mainWidget->GetSheetWindowParent();
-    if (!topLevelWidget)
-      topLevelWidget = mainWidget;
-
-    // Get the top level widget's nsGlobalWindow
-    nsCOMPtr<nsIDOMWindowInternal> topLevelWindow;
-    if (topLevelWidget == mainWidget) {
-      topLevelWindow = static_cast<nsIDOMWindowInternal *>(this);
-    } else {
-      // This is a workaround for the following problem:
-      // When a window with an open sheet loses focus, only the sheet window
-      // receives the NS_DEACTIVATE event. However, it's not the sheet that
-      // should lose the "active" attribute, but the containing top level window.
-      void* clientData;
-      topLevelWidget->GetClientData(clientData); // clientData is nsXULWindow
-      nsISupports* data = static_cast<nsISupports*>(clientData);
-      nsCOMPtr<nsIInterfaceRequestor> req(do_QueryInterface(data));
-      topLevelWindow = do_GetInterface(req);
-    }
-
-    if (topLevelWindow) {
-      // Only set the attribute if the document is a XUL document and the
-      // window is a chrome window
-      nsCOMPtr<nsIDOMDocument> domDoc;
-      topLevelWindow->GetDocument(getter_AddRefs(domDoc));
-      nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDoc));
-      nsCOMPtr<nsIDOMXULDocument> xulDoc(do_QueryInterface(doc));
-      nsCOMPtr<nsIDOMChromeWindow> chromeWin = do_QueryInterface(topLevelWindow);
-      if (xulDoc && chromeWin) {
-        nsCOMPtr<nsIContent> rootElem = doc->GetRootContent();
-        if (aVisitor.mEvent->message == NS_ACTIVATE)
-          rootElem->SetAttr(kNameSpaceID_None, nsGkAtoms::active,
-                            NS_LITERAL_STRING("true"), PR_TRUE);
-        else
-          rootElem->UnsetAttr(kNameSpaceID_None, nsGkAtoms::active, PR_TRUE);
+    if (mainWidget) {
+      // Get the top level widget (if the main widget is a sheet, this will
+      // be the sheet's top (non-sheet) parent).
+      nsCOMPtr<nsIWidget> topLevelWidget = mainWidget->GetSheetWindowParent();
+      if (!topLevelWidget)
+        topLevelWidget = mainWidget;
+
+      // Get the top level widget's nsGlobalWindow
+      nsCOMPtr<nsIDOMWindowInternal> topLevelWindow;
+      if (topLevelWidget == mainWidget) {
+        topLevelWindow = static_cast<nsIDOMWindowInternal *>(this);
+      } else {
+        // This is a workaround for the following problem:
+        // When a window with an open sheet loses focus, only the sheet window
+        // receives the NS_DEACTIVATE event. However, it's not the sheet that
+        // should lose the "active" attribute, but the containing top level window.
+        void* clientData;
+        topLevelWidget->GetClientData(clientData); // clientData is nsXULWindow
+        nsISupports* data = static_cast<nsISupports*>(clientData);
+        nsCOMPtr<nsIInterfaceRequestor> req(do_QueryInterface(data));
+        topLevelWindow = do_GetInterface(req);
+      }
+
+      if (topLevelWindow) {
+        // Only set the attribute if the document is a XUL document and the
+        // window is a chrome window
+        nsCOMPtr<nsIDOMDocument> domDoc;
+        topLevelWindow->GetDocument(getter_AddRefs(domDoc));
+        nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDoc));
+        nsCOMPtr<nsIDOMXULDocument> xulDoc(do_QueryInterface(doc));
+        nsCOMPtr<nsIDOMChromeWindow> chromeWin = do_QueryInterface(topLevelWindow);
+        if (xulDoc && chromeWin) {
+          nsCOMPtr<nsIContent> rootElem = doc->GetRootContent();
+          if (aVisitor.mEvent->message == NS_ACTIVATE)
+            rootElem->SetAttr(kNameSpaceID_None, nsGkAtoms::active,
+                              NS_LITERAL_STRING("true"), PR_TRUE);
+          else
+            rootElem->UnsetAttr(kNameSpaceID_None, nsGkAtoms::active, PR_TRUE);
+        }
       }
     }
   }
 
   if (aVisitor.mEvent->message == NS_RESIZE_EVENT) {
     mIsHandlingResizeEvent = PR_FALSE;
   } else if (aVisitor.mEvent->message == NS_PAGE_UNLOAD &&
              NS_IS_TRUSTED_EVENT(aVisitor.mEvent)) {
@@ -5181,151 +5181,238 @@ nsGlobalWindow::CallerInnerWindow()
   // raw pointer here and let the QI's addref be balanced by the nsCOMPtr
   // destructor's release.
   nsCOMPtr<nsPIDOMWindow> win = do_QueryWrappedNative(wrapper);
   if (!win)
     return GetCurrentInnerWindowInternal();
   return static_cast<nsGlobalWindow*>(win.get());
 }
 
+
+/**
+ * Class used to represent events generated by calls to Window.postMessage,
+ * which asynchronously creates and dispatches events.
+ */
+class PostMessageEvent : public nsRunnable
+{
+  public:
+    NS_DECL_NSIRUNNABLE
+
+    PostMessageEvent(nsGlobalWindow* aSource,
+                     const nsAString& aCallerOrigin,
+                     const nsAString& aMessage,
+                     nsGlobalWindow* aTargetWindow,
+                     nsIURI* aProvidedOrigin,
+                     PRBool aTrustedCaller)
+    : mSource(aSource),
+      mCallerOrigin(aCallerOrigin),
+      mMessage(aMessage),
+      mTargetWindow(aTargetWindow),
+      mProvidedOrigin(aProvidedOrigin),
+      mTrustedCaller(aTrustedCaller)
+    {
+      MOZ_COUNT_CTOR(PostMessageEvent);
+    }
+    
+    ~PostMessageEvent()
+    {
+      MOZ_COUNT_DTOR(PostMessageEvent);
+    }
+
+  private:
+    nsRefPtr<nsGlobalWindow> mSource;
+    nsString mCallerOrigin;
+    nsString mMessage;
+    nsRefPtr<nsGlobalWindow> mTargetWindow;
+    nsCOMPtr<nsIURI> mProvidedOrigin;
+    PRBool mTrustedCaller;
+};
+
+NS_IMETHODIMP
+PostMessageEvent::Run()
+{
+  NS_ABORT_IF_FALSE(mTargetWindow->IsOuterWindow(),
+                    "should have been passed an outer window!");
+  NS_ABORT_IF_FALSE(!mSource || mSource->IsOuterWindow(),
+                    "should have been passed an outer window!");
+
+  nsRefPtr<nsGlobalWindow> targetWindow =
+    mTargetWindow->GetCurrentInnerWindowInternal();
+  NS_ABORT_IF_FALSE(targetWindow->IsInnerWindow(),
+                    "we ordered an inner window!");
+
+  // Ensure that any origin which might have been provided is the origin of this
+  // window's document.  Note that we do this *now* instead of when postMessage
+  // is called because the target window might have been navigated to a
+  // different location between then and now.  If this check happened when
+  // postMessage was called, it would be fairly easy for a malicious webpage to
+  // intercept messages intended for another site by carefully timing navigation
+  // of the target window so it changed location after postMessage but before
+  // now.
+  if (mProvidedOrigin) {
+    // Get the target's origin either from its principal or, in the case the
+    // principal doesn't carry a URI (e.g. the system principal), the target's
+    // document.
+    nsIPrincipal* targetPrin = targetWindow->GetPrincipal();
+    if (!targetPrin)
+      return NS_OK;
+    nsCOMPtr<nsIURI> targetURI;
+    if (NS_FAILED(targetPrin->GetURI(getter_AddRefs(targetURI))))
+      return NS_OK;
+    if (!targetURI) {
+      targetURI = targetWindow->mDoc->GetDocumentURI();
+      if (!targetURI)
+        return NS_OK;
+    }
+
+    // Note: This is contrary to the spec with respect to file: URLs, which
+    //       the spec groups into a single origin, but given we intentionally
+    //       don't do that in other places it seems better to hold the line for
+    //       now.  Long-term, we want HTML5 to address this so that we can
+    //       be compliant while being safer.
+    nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
+    nsresult rv =
+      ssm->CheckSameOriginURI(mProvidedOrigin, targetURI, PR_TRUE);
+    if (NS_FAILED(rv))
+      return NS_OK;
+  }
+
+
+  // Create the event
+  nsCOMPtr<nsIDOMDocumentEvent> docEvent =
+    do_QueryInterface(targetWindow->mDocument);
+  if (!docEvent)
+    return NS_OK;
+  nsCOMPtr<nsIDOMEvent> event;
+  docEvent->CreateEvent(NS_LITERAL_STRING("MessageEvent"),
+                        getter_AddRefs(event));
+  if (!event)
+    return NS_OK;
+
+  nsCOMPtr<nsIDOMMessageEvent> message = do_QueryInterface(event);
+  nsresult rv = message->InitMessageEvent(NS_LITERAL_STRING("message"),
+                                          PR_FALSE /* non-bubbling */,
+                                          PR_TRUE /* cancelable */,
+                                          mMessage,
+                                          mCallerOrigin,
+                                          EmptyString(),
+                                          mSource);
+  if (NS_FAILED(rv))
+    return NS_OK;
+
+
+  // We can't simply call dispatchEvent on the window because doing so ends
+  // up flipping the trusted bit on the event, and we don't want that to
+  // happen because then untrusted content can call postMessage on a chrome
+  // window if it can get a reference to it.
+
+  nsIPresShell *shell = targetWindow->mDoc->GetPrimaryShell();
+  nsRefPtr<nsPresContext> presContext;
+  if (shell)
+    presContext = shell->GetPresContext();
+
+  nsEvent* internalEvent;
+  nsCOMPtr<nsIPrivateDOMEvent> privEvent = do_QueryInterface(message);
+  privEvent->SetTrusted(mTrustedCaller);
+  privEvent->GetInternalNSEvent(&internalEvent);
+
+  nsEventStatus status = nsEventStatus_eIgnore;
+  nsEventDispatcher::Dispatch(static_cast<nsPIDOMWindow*>(mTargetWindow),
+                              presContext,
+                              internalEvent,
+                              message,
+                              &status);
+  return NS_OK;
+}
+
 NS_IMETHODIMP
 nsGlobalWindow::PostMessageMoz(const nsAString& aMessage, const nsAString& aOrigin)
 {
-  FORWARD_TO_INNER_CREATE(PostMessageMoz, (aMessage, aOrigin));
+  // NB: Since much of what this method does must happen at event dispatch time,
+  //     this method does not forward to the inner window, unlike most other
+  //     methods.  We do this because the only time we need to refer to this
+  //     window, we need a reference to the outer window (the PostMessageEvent
+  //     ctor call), and we don't want to pay the price of forwarding to the
+  //     inner window for no actual benefit.  Furthermore, this function must
+  //     only be called from script anyway, which should only have references to
+  //     outer windows (and if script has an inner window we've already lost).
+  NS_ABORT_IF_FALSE(IsOuterWindow(), "only call this method on outer windows");
 
   //
   // Window.postMessage is an intentional subversion of the same-origin policy.
   // As such, this code must be particularly careful in the information it
   // exposes to calling code.
   //
   // http://www.whatwg.org/specs/web-apps/current-work/multipage/section-crossDocumentMessages.html
   //
 
-
   // First, get the caller's window
   nsRefPtr<nsGlobalWindow> callerInnerWin = CallerInnerWindow();
   if (!callerInnerWin)
     return NS_OK;
-  NS_ASSERTION(callerInnerWin->IsInnerWindow(), "should have gotten an inner window here");
+  NS_ABORT_IF_FALSE(callerInnerWin->IsInnerWindow(),
+                    "should have gotten an inner window here");
 
   // Compute the caller's origin either from its principal or, in the case the
   // principal doesn't carry a URI (e.g. the system principal), the caller's
-  // document.
+  // document.  We must get this now instead of when the event is created and
+  // dispatched, because ultimately it is the identity of the calling window
+  // *now* that determines who sent the message (and not an identity which might
+  // have changed due to intervening navigations).
   nsIPrincipal* callerPrin = callerInnerWin->GetPrincipal();
   if (!callerPrin)
     return NS_OK;
-  nsCOMPtr<nsIURI> callerURI;
-  if (NS_FAILED(callerPrin->GetURI(getter_AddRefs(callerURI))))
+  nsCOMPtr<nsIURI> callerOuterURI;
+  if (NS_FAILED(callerPrin->GetURI(getter_AddRefs(callerOuterURI))))
     return NS_OK;
-  if (!callerURI) {
+  if (!callerOuterURI) {
     nsCOMPtr<nsIDocument> doc = do_QueryInterface(callerInnerWin->mDocument);
     if (!doc)
       return NS_OK;
-    callerURI = doc->GetDocumentURI();
-    if (!callerURI)
+    callerOuterURI = doc->GetDocumentURI();
+    if (!callerOuterURI)
       return NS_OK;
   }
+  nsCOMPtr<nsIURI> callerURI = NS_GetInnermostURI(callerOuterURI);
+  if (!callerURI)
+    return NS_OK;
   const nsCString& empty = EmptyCString();
   nsCOMPtr<nsIURI> callerOrigin;
   if (NS_FAILED(callerURI->Clone(getter_AddRefs(callerOrigin))) ||
       NS_FAILED(callerOrigin->SetUserPass(empty)))
     return NS_OK;
 
 
-  // Calling postMessage on a closed window does nothing.
-  if (!mDocument)
-    return NS_OK;
-
-  nsCOMPtr<nsIDOMEventTarget> targetDoc = do_QueryInterface(mDocument);
-  nsCOMPtr<nsIDOMDocumentEvent> docEvent = do_QueryInterface(mDocument);
-
-
-  // Ensure that any origin which might have been provided is the origin of this
-  // window's document.
-  if (!aOrigin.IsVoid()) {
-    nsCOMPtr<nsIURI> providedOrigin;
+  // Convert the provided origin string into a URI for comparison purposes.
+  // "*" indicates no specific origin is required.
+  nsCOMPtr<nsIURI> providedOrigin;
+  if (!aOrigin.EqualsASCII("*")) {
     if (NS_FAILED(NS_NewURI(getter_AddRefs(providedOrigin), aOrigin)))
       return NS_ERROR_DOM_SYNTAX_ERR;
     if (NS_FAILED(providedOrigin->SetUserPass(empty)) ||
         NS_FAILED(providedOrigin->SetPath(empty)))
       return NS_OK;
-
-    // Get the target's origin either from its principal or, in the case the
-    // principal doesn't carry a URI (e.g. the system principal), the target's
-    // document.
-    nsIPrincipal* targetPrin = GetPrincipal();
-    if (!targetPrin)
-      return NS_OK;
-    nsCOMPtr<nsIURI> targetURI;
-    if (NS_FAILED(targetPrin->GetURI(getter_AddRefs(targetURI))))
-      return NS_OK;
-    if (!targetURI) {
-      nsCOMPtr<nsIDocument> targetDoc = do_QueryInterface(mDocument);
-      if (!targetDoc)
-        return NS_OK;
-      targetURI = targetDoc->GetDocumentURI();
-      if (!targetURI)
-        return NS_OK;
-    }
-    nsCOMPtr<nsIURI> targetOrigin;
-    if (NS_FAILED(targetURI->Clone(getter_AddRefs(targetOrigin))) ||
-        NS_FAILED(targetOrigin->SetUserPass(empty)) ||
-        NS_FAILED(targetOrigin->SetPath(empty)))
-      return NS_OK;
-
-    PRBool equal = PR_FALSE;
-    if (NS_FAILED(targetOrigin->Equals(providedOrigin, &equal)) || !equal)
-      return NS_OK;
-  }
-
-
-  // Create the event
-  nsCOMPtr<nsIDOMEvent> event;
-  docEvent->CreateEvent(NS_LITERAL_STRING("MessageEvent"),
-                        getter_AddRefs(event));
-  if (!event)
-    return NS_OK;
-  
+  }
+
   nsCAutoString origin;
   if (NS_FAILED(callerOrigin->GetPrePath(origin)))
     return NS_OK;
 
-  nsCOMPtr<nsIDOMMessageEvent> message = do_QueryInterface(event);
-  nsresult rv = message->InitMessageEvent(NS_LITERAL_STRING("message"),
-                                          PR_TRUE /* bubbling */,
-                                          PR_TRUE /* cancelable */,
-                                          aMessage,
-                                          NS_ConvertUTF8toUTF16(origin),
-                                          nsContentUtils::IsCallerChrome()
-                                          ? nsnull
-                                          : callerInnerWin->GetOuterWindowInternal());
-  if (NS_FAILED(rv))
-    return NS_OK;
-
-
-  // Finally, dispatch the event, ignoring the result to prevent an exception
-  // from revealing anything about the document for this window.
-  PRBool dummy;
-  targetDoc->DispatchEvent(message, &dummy);
-
-  // Cancel exceptions that might somehow be pending. XPConnect swallows these
-  // exceptions across JS contexts, but there can be concerns if the caller
-  // and the thrower are same-context but different-origin -- see bug 387706
-  // comment 26, waring the typo in it.  Consequently, we play it safe and always
-  // cancel exceptions.
-  nsAXPCNativeCallContext *ncc;
-  rv = nsContentUtils::XPConnect()->GetCurrentNativeCallContext(&ncc);
-  if (NS_FAILED(rv) || !ncc)
-    return NS_OK;
-
-  JSContext *cx = nsnull;
-  if (NS_SUCCEEDED(ncc->GetJSContext(&cx)))
-    ::JS_ClearPendingException(cx);
-
-  return NS_OK;
+  // Create and asynchronously dispatch a runnable which will handle actual DOM
+  // event creation and dispatch.
+  nsRefPtr<PostMessageEvent> event =
+    new PostMessageEvent(nsContentUtils::IsCallerChrome()
+                         ? nsnull
+                         : callerInnerWin->GetOuterWindowInternal(),
+                         NS_ConvertUTF8toUTF16(origin),
+                         aMessage,
+                         this,
+                         providedOrigin,
+                         nsContentUtils::IsCallerTrustedForWrite());
+  return NS_DispatchToCurrentThread(event);
 }
 
 class nsCloseEvent : public nsRunnable {
 public:
   nsCloseEvent (nsGlobalWindow *aWindow)
     : mWindow(aWindow)
   {
   }
--- a/dom/src/base/nsGlobalWindow.h
+++ b/dom/src/base/nsGlobalWindow.h
@@ -117,16 +117,17 @@ class nsScreen;
 class nsHistory;
 class nsIDocShellLoadInfo;
 class WindowStateHolder;
 class nsGlobalWindowObserver;
 class nsGlobalWindow;
 #ifdef OJI
 class nsDummyJavaPluginOwner;
 #endif
+class PostMessageEvent;
 
 class nsDOMOfflineResourceList;
 class nsDOMOfflineLoadStatusList;
 
 // permissible values for CheckOpenAllow
 enum OpenAllowValue {
   allowNot = 0,     // the window opening is denied
   allowNoAbuse,     // allowed: not a popup
@@ -738,16 +739,17 @@ protected:
 #endif
 
   nsCOMPtr<nsIDOMOfflineResourceList> mApplicationCache;
 
   nsDataHashtable<nsVoidPtrHashKey, void*> mCachedXBLPrototypeHandlers;
 
   friend class nsDOMScriptableHelper;
   friend class nsDOMWindowUtils;
+  friend class PostMessageEvent;
   static nsIFactory *sComputedDOMStyleFactory;
 };
 
 /*
  * nsGlobalChromeWindow inherits from nsGlobalWindow. It is the global
  * object created for a Chrome Window only.
  */
 class nsGlobalChromeWindow : public nsGlobalWindow,
--- a/dom/tests/mochitest/bugs/iframe_bug407839-1.html
+++ b/dom/tests/mochitest/bugs/iframe_bug407839-1.html
@@ -52,17 +52,17 @@ function run()
 
   try {
     storage = globalStorage[""];
     message += "\n passed globalStorage[\"\"]";
   }
   catch (ex) {
   }
 
-  window.parent.postMessage(message);
+  window.parent.postMessage(message, "http://localhost:8888");
 }
 
 window.addEventListener("load", run, false);
   </script>
 </head>
 <body>
 </body>
 </html>
--- a/dom/tests/mochitest/bugs/iframe_bug407839-2.html
+++ b/dom/tests/mochitest/bugs/iframe_bug407839-2.html
@@ -18,17 +18,17 @@ function run()
 
   try {
     storage = globalStorage["sub1.ält.example.org"];
   }
   catch (ex) {
     message += "\n failed globalStorage[sub1.ält.example.org]";
   }
 
-  window.parent.postMessage(message);
+  window.parent.postMessage(message, "http://localhost:8888");
 }
 
 window.addEventListener("load", run, false);
   </script>
 </head>
 <body>
 </body>
 </html>
--- a/dom/tests/mochitest/bugs/iframe_bug409349.html
+++ b/dom/tests/mochitest/bugs/iframe_bug409349.html
@@ -47,17 +47,17 @@ function run()
   
   try {
     storage = globalStorage["X.0.0.1"];
     message += "\n passed globalStorage[\"X.0.0.1\"]";
   }
   catch (ex) {
   }
   
-  window.parent.postMessage(message);
+  window.parent.postMessage(message, "http://localhost:8888");
 }
 
 window.addEventListener("load", run, false);
   </script>
 </head>
 <body>
 </body>
 </html>
--- a/dom/tests/mochitest/bugs/iframe_bug424093.html
+++ b/dom/tests/mochitest/bugs/iframe_bug424093.html
@@ -26,17 +26,17 @@ function run()
 
   try {
     storage = globalStorage["example.org"];
   }
   catch (ex) {
     message += "\n failed globalStorage[\"example.org\"]";
   }
 
-window.parent.postMessage(message);
+  window.parent.postMessage(message, "http://localhost:8888");
 }
 
 window.addEventListener("load", run, false);
   </script>
 </head>
 <body>
 </body>
 </html>
--- a/dom/tests/mochitest/bugs/test_bug407839.html
+++ b/dom/tests/mochitest/bugs/test_bug407839.html
@@ -31,14 +31,14 @@ function receiveMessage(evt)
 {
   is(evt.data, "child-response", "got wrong response");
 
   if (++gNumMessages == 2) {
     SimpleTest.finish();
   }
 }
 
-document.addEventListener("message", receiveMessage, false);
+window.addEventListener("message", receiveMessage, false);
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/tests/mochitest/bugs/test_bug409349.html
+++ b/dom/tests/mochitest/bugs/test_bug409349.html
@@ -24,13 +24,13 @@ function receiveMessage(evt)
   is(evt.origin, "http://127.0.0.1:8888", "wrong sender");
   ok(evt.source === window.frames.child, "wrong sender");
 
   is(evt.data, "child-response", "got wrong response");
 
   SimpleTest.finish();
 }
 
-document.addEventListener("message", receiveMessage, false);
+window.addEventListener("message", receiveMessage, false);
 </script>
 </pre>
 </body>
 </html>
--- a/dom/tests/mochitest/bugs/test_bug424093.html
+++ b/dom/tests/mochitest/bugs/test_bug424093.html
@@ -26,14 +26,14 @@ SimpleTest.waitForExplicitFinish();
 
 function receiveMessage(evt)
 {
   is(evt.data, "child-response", "got wrong response");
 
   SimpleTest.finish();
 }
 
-document.addEventListener("message", receiveMessage, false);
+window.addEventListener("message", receiveMessage, false);
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/tests/mochitest/dom-level0/child_ip_address.html
+++ b/dom/tests/mochitest/dom-level0/child_ip_address.html
@@ -22,17 +22,17 @@ function run()
   }
   catch (e)
   {
     domain = document.domain;
     if (domain !== "127.0.0.1")
       message += " ip-address-mutated-on-throw(" + domain + ")";
   }
 
-  window.parent.postMessage(message);
+  window.parent.postMessage(message, "http://localhost:8888");
 }
 
 window.addEventListener("load", run, false);
   </script>
 </head>
 <body>
 <h1 id="location">Somewhere!</h1>
 </body>
--- a/dom/tests/mochitest/dom-level0/idn_child.html
+++ b/dom/tests/mochitest/dom-level0/idn_child.html
@@ -51,17 +51,17 @@ function receiveMessage(evt)
       message  += punycodeTest("xn--exmple-cua.test");
       break;
 
     default:
       message += " unexpected-query(" + location.search + ")";
       break;
   }
 
-  evt.source.postMessage(message);
+  evt.source.postMessage(message, evt.origin);
 }
 
 function idnTest(newDomain)
 {
   var errors = "";
 
   try
   {
@@ -86,16 +86,16 @@ function punycodeTest(newDomain)
   catch (e)
   {
     errors += " error-thrown-setting-to-punycode(" + String(e).split("").join(",") + ")";
   }
 
   return errors;
 }
 
-document.addEventListener("message", receiveMessage, false);
+window.addEventListener("message", receiveMessage, false);
 window.addEventListener("load", run, false);
   </script>
 </head>
 <body>
 <h1 id="location">Somewhere!</h1>
 </body>
 </html>
--- a/dom/tests/mochitest/dom-level0/test_setting_document.domain_idn.html
+++ b/dom/tests/mochitest/dom-level0/test_setting_document.domain_idn.html
@@ -84,22 +84,22 @@ var messages =
 
 function receiveMessage(evt)
 {
   var origin = evt.origin;
   var match;
   if (/test$/.test(origin))
   {
     // XXX bug 414090
-    // The value of MessageEvent.domain with postMessage *should* always be IDN;
+    // The value of MessageEvent.origin with postMessage *should* always be IDN;
     // unfortunately, given our current setup for dealing with Unicode-based
     // domain-name spoofing, whether a domain is in the safe-for-IDN whitelist
     // affects the value of this property (likewise for window.location,
-    // document.location, MessageEvent.uri, document.domain, and probably a slew
-    // of other things).  :-(
+    // document.location, document.domain, and probably a slew of other
+    // things).  :-(
     //
     // These two tests should illustrate what currently happens and what should
     // happen once bug 414090 is fixed.
     todo_is(evt.origin, "http://sub1.exämple.test", "wrong sender");
     todo_isnot(evt.origin, "http://sub1.xn--exmple-cua.test", "wrong sender");
   }
   else
   {
@@ -142,29 +142,67 @@ function receiveMessage(evt)
       break;
   }
 
   state++;
 }
 
 function run()
 {
-  window.frames.idnKidWhitelist.postMessage("idn-whitelist");
-  ok(gotIDNWhitelist, "IDN whitelist message not received");
+  var target = window.frames.idnKidWhitelist;
+  target.postMessage("idn-whitelist", "http://sub1.ŌÄőĪŌĀő¨őīőĶőĻő≥őľőĪ.őīőŅőļőĻőľőģ");
+
+  // Double-timeouts account for 1) delay for message to be received by target
+  // window and 2) delay for response from target window to be received by this
+  // window.
 
-  window.frames.punycodeKidWhitelist.postMessage("punycode-whitelist");
-  ok(gotPunycodeWhitelist, "punycode whitelist message not received");
+  setTimeout(function()
+  {
+    setTimeout(function()
+    {
+      ok(gotIDNWhitelist, "IDN whitelist message not received");
+
+      var target = window.frames.punycodeKidWhitelist;
+      target.postMessage("punycode-whitelist", "http://sub1.ŌÄőĪŌĀő¨őīőĶőĻő≥őľőĪ.őīőŅőļőĻőľőģ");
+
+      setTimeout(function()
+      {
+        setTimeout(function()
+        {
+          ok(gotPunycodeWhitelist, "punycode whitelist message not received");
+
+          var target = window.frames.idnKidNoWhitelist;
+          target.postMessage("idn-nowhitelist", "http://sub1.exämple.test");
 
-  window.frames.idnKidNoWhitelist.postMessage("idn-nowhitelist");
-  ok(gotIDNNoWhitelist, "IDN no-whitelist message not received");
+          setTimeout(function()
+          {
+            setTimeout(function()
+            {
+              ok(gotIDNNoWhitelist, "IDN no-whitelist message not received");
+    
+              var target = window.frames.punycodeKidNoWhitelist;
+              target.postMessage("punycode-nowhitelist",
+                                 "http://sub1.exämple.test");
 
-  window.frames.punycodeKidNoWhitelist.postMessage("punycode-nowhitelist");
-  ok(gotPunycodeNoWhitelist, "punycode no-whitelist message not received");
+              setTimeout(function()
+              {
+                setTimeout(function()
+                {
+                  ok(gotPunycodeNoWhitelist,
+                     "punycode no-whitelist message not received");
 
-  SimpleTest.finish();
+                  SimpleTest.finish();
+                }, 0);
+              }, 0);
+            }, 0);
+          }, 0);
+        }, 0);
+      }, 0);
+    }, 0);
+  }, 0);
 }
 
-document.addEventListener("message", receiveMessage, false);
+window.addEventListener("message", receiveMessage, false);
 window.addEventListener("load", run, false);
 </script>
 </pre>
 </body>
 </html>
--- a/dom/tests/mochitest/dom-level0/test_setting_document.domain_to_shortened_ipaddr.html
+++ b/dom/tests/mochitest/dom-level0/test_setting_document.domain_to_shortened_ipaddr.html
@@ -24,13 +24,13 @@ function receiveMessage(evt)
   is(evt.origin, "http://127.0.0.1:8888", "wrong sender");
   ok(evt.source === window.frames.child, "wrong sender");
 
   is(evt.data, "child-response", "got wrong response");
 
   SimpleTest.finish();
 }
 
-document.addEventListener("message", receiveMessage, false);
+window.addEventListener("message", receiveMessage, false);
 </script>
 </pre>
 </body>
 </html>
--- a/dom/tests/mochitest/whatwg/Makefile.in
+++ b/dom/tests/mochitest/whatwg/Makefile.in
@@ -68,16 +68,19 @@ include $(topsrcdir)/config/rules.mk
 		test_postMessage_hash.html \
 		postMessage_hash.html \
 		test_postMessage_userpass.html \
 		postMessage_userpass_helper.html \
 		test_postMessage_origin.xhtml \
 		postMessage_origin_helper.xhtml \
 		test_postMessage_closed.html \
 		postMessage_closed_helper.html \
+		test_postMessage_jar.html \
+		postMessage.jar \
+		postMessage.jar^headers^ \
 		$(NULL)
 
 _CHROME_FILES	= \
 		test_postMessage_chrome.html \
 		$(NULL)		
 
 libs:: 	$(_TEST_FILES)
 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..e7861c7da512b3b2e1566bfa5e99f95b9fcb66fb
GIT binary patch
literal 598
zc$^FHW@Zs#U|`^2Fi)6k!6kmAeH9}E!!%|F1`!5PhJyU!65rI~;>7gS_^iYty^NCF
zoX`+X2IfpRagRhG4y|Be_zKj}I@x~mEdzn0)%9JjQzb2|uiq^==Bg($^W=UdU$3K4
z4(3jmJi0k2pDsVoC3!~G`O&dyU+>+Xza-SS^83%1uea-K-?(&ci)(S+!jN3X3lr3u
z*OpJTOX?|V{-AT1i9@;Zd17$7>!o9Q8U7CL{oaau&38>+GI#C#RQ=COGP=LsD|@NW
z@+RQB#gl0_E^qm9(sD14jriWpf{C0-YuEPO-W?KTBc^j9+vC+K*1Z?S)V#%VJO3<N
z*ZX?OO{2Gu8s!aBO?wiJ#SST2?B03$UeE!ab&Jvzmc=CNEL1reqcDkQielb!wV$e=
zpZwJ}+*SMH!<5PkVLP3lraE|Uci#Lsv}5ALFx%btR{MPCU#9(*_3bTtfldEK{Yy)q
zJ+&;aD_$($9q($$;<424p?rzT774G7r!ABI9bb4pQP<a{tUp(9;<tS=(T(40n~(G^
zh}nK$)ktm~&$9E|k8fGA#)HRTh4vx&FHdx)`=4W(y=gT|&Qre2i^MaHPo17p-uU1t
ztK7Xm>AJ@}k8)ck_Wil@uQac4pKa+ryR+rX`(7H|Z4Ntaoc8-<Y=fH4UjH`7$mg%W
xO9yx}GKn+eigI2C5CC!+mNbG`*b@LNBmsn0Ffasov$8?7Ff#Z9>5m}23;?aF`c(h`
new file mode 100644
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/postMessage.jar^headers^
@@ -0,0 +1,1 @@
+Content-Type: application/java-archive
--- a/dom/tests/mochitest/whatwg/postMessage_chrome_helper.html
+++ b/dom/tests/mochitest/whatwg/postMessage_chrome_helper.html
@@ -1,18 +1,18 @@
 <!DOCTYPE html>
 <html>
 <head>
   <title>postMessage chrome message receiver</title>
   <script type="application/javascript">
     function receiveMessage(evt)
     {
       // Content cannot post to chrome without privileges
-      window.parent.postMessage("SHOULD NOT GET THIS!");
-      
+      window.parent.postMessage("SHOULD NOT GET THIS!", "*");
+
       var msg = "post-to-content-response";
 
       if (evt.source !== null)
         msg += " wrong-source(" + evt.source + ")";
       if (!evt.isTrusted)
         msg += " unexpected-untrusted-event";
       if (evt.type !== "message")
         msg += " wrong-type(" + evt.type + ")";
@@ -23,18 +23,18 @@
 
       respond(msg);
     }
     
     function respond(msg)
     {
       // ...so get privileges and test that this works with privileges
       netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
-      window.parent.postMessage(msg);
+      window.parent.postMessage(msg, "*");
     }
     
-    document.addEventListener("message", receiveMessage, false);
+    window.addEventListener("message", receiveMessage, false);
   </script>
 </head>
 <body>
 <h1 id="domain">example.org</h1>
 </body>
 </html>
--- a/dom/tests/mochitest/whatwg/postMessage_closed_helper.html
+++ b/dom/tests/mochitest/whatwg/postMessage_closed_helper.html
@@ -1,26 +1,26 @@
 <!DOCTYPE html>
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
   <title>postMessage closed page</title>
   <script type="application/javascript">
 function receiveMessage(evt)
 {
-  evt.source.postMessage("FAIL");
+  evt.source.postMessage("FAIL", "*");
 }
 
-document.addEventListener("message", receiveMessage, false);
+window.addEventListener("message", receiveMessage, false);
 
 function setup()
 {
   var query = location.search.substring(1);
 
   if (query == "opener")
-    window.opener.postMessage("message");
+    window.opener.postMessage("message", "http://localhost:8888");
 }
 
 window.addEventListener("load", setup, false);
   </script>
 </head>
 <body>
 </body>
 </html>
--- a/dom/tests/mochitest/whatwg/postMessage_hash.html
+++ b/dom/tests/mochitest/whatwg/postMessage_hash.html
@@ -11,19 +11,21 @@ function receiveMessage(evt)
     response += " kid-at-wrong-uri(" + window.location.href + ")";
 
   if (evt.origin !== "http://localhost:8888")
     response += " wrong-origin(" + evt.origin + ")";
   if (evt.source !== window.parent)
     response += " wrong-source";
   if (evt.data !== "from-parent")
     response += " wrong-data(" + evt.data + ")";
+  if (evt.lastEventId !== "")
+    response += " wrong-lastEventId(" + evt.lastEventId + ")";
 
-  window.parent.postMessage(response);
+  window.parent.postMessage(response, "http://localhost:8888");
 }
 
-document.addEventListener("message", receiveMessage, false);
+window.addEventListener("message", receiveMessage, false);
   </script>
 </head>
 <body>
 <p>Kid iframe</p>
 </body>
 </html>
--- a/dom/tests/mochitest/whatwg/postMessage_helper.html
+++ b/dom/tests/mochitest/whatwg/postMessage_helper.html
@@ -3,49 +3,56 @@
 <head>
   <title>postMessage message receiver</title>
   <script type="application/javascript" src="browserFu.js"></script>
   <script type="application/javascript">
     function $(id) { return document.getElementById(id); }
 
     function setup()
     {
-      $("domain").textContent = location.hostname + ":" + (location.port || 80);
+      var target = $("domain");
+      target.textContent = location.hostname + ":" + (location.port || 80);
     }
 
     function receiveMessage(evt)
     {
       var response = evt.data + "-response";
 
+      if (evt.lastEventId !== "")
+        response += " wrong-lastEventId(" + evt.lastEventId + ")";
+
       if (evt.source !== window.parent)
       {
         response += " unexpected-source(" + evt.source + ")";
         response += " window-parent-is(" + window.parent + ")";
         response += " location(" + window.location.href + ")";
       }
 
-      if (isMozilla && evt.isTrusted)
-        response += " unexpected-trusted";
+      if (isMozilla)
+      {
+        if (evt.isTrusted !== false)
+          response += " unexpected-trusted";
+      }
 
       if (evt.type != "message")
         response += " wrong-type(" + evt.type + ")";
 
       var data = evt.data;
       if (data == "post-to-other-same-domain")
       {
         receiveSame(evt, response);
       }
       else if (data == "post-to-other-cross-domain")
       {
         receiveCross(evt, response);
       }
       else
       {
         response += " unexpected-message-to(" + window.location.href + ")";
-        window.parent.postMessage(response);
+        window.parent.postMessage(response, "http://localhost:8888");
         return;
       }
     }
 
     function receiveSame(evt, response)
     {
       var source = evt.source;
       try
@@ -63,17 +70,17 @@
           threw = true;
         }
         if (threw || privateVariable !== window.parent.privateVariable)
           response += " accessed-source!!!";
   
       }
       finally
       {
-        source.postMessage(response);
+        source.postMessage(response, evt.origin);
       }
     }
 
     function receiveCross(evt, response)
     {
       var source = evt.source;
       if (evt.origin != "http://localhost:8888")
         response += " unexpected-origin(" + evt.origin + ")";
@@ -85,19 +92,19 @@
       }
       catch (e)
       {
         threw = true;
       }
       if (!threw || privateVariable !== undefined)
         response += " accessed-source!!!";
 
-      source.postMessage(response);
+      source.postMessage(response, evt.origin);
     }
 
     window.addEventListener("load", setup, false);
-    document.addEventListener("message", receiveMessage, false);
+    window.addEventListener("message", receiveMessage, false);
   </script>
 </head>
 <body>
 <h1 id="domain"></h1>
 </body>
 </html>
--- a/dom/tests/mochitest/whatwg/postMessage_idn_helper.html
+++ b/dom/tests/mochitest/whatwg/postMessage_idn_helper.html
@@ -8,31 +8,33 @@
       var response = "idn-response";
 
       if (!(evt instanceof MessageEvent))
         response += " not-a-MessageEvent";
       if (evt.origin !== "http://localhost:8888")
         response += " wrong-sender-origin(" + evt.origin + ")";
       if (evt.data !== "idn-message")
         response += " wrong-data(" + evt.data + ")";
+      if (evt.lastEventId !== "")
+        response += " wrong-lastEventId(" + evt.lastEventId + ")";
       if (evt.source !== window.parent)
         response += " wrong-source";
-      if (evt.target !== document)
+      if (evt.target !== window)
         response += " wrong-target";
       if (evt.type !== "message")
         response += " wrong-type(" + evt.type + ")";
 
-      evt.source.postMessage(response);
+      evt.source.postMessage(response, evt.origin);
     }
-    document.addEventListener("message", receiveMessage, false);
+    window.addEventListener("message", receiveMessage, false);
 
     function setup()
     {
       var target = document.getElementById("location");
-      target.textContent = document.domain;
+      target.textContent = location.hostname + ":" + (location.port || 80);
     }
 
     window.addEventListener("load", setup, false);
   </script>
 </head>
 <body>
 <h1 id="location">No location!</h1>
 </body>
--- a/dom/tests/mochitest/whatwg/postMessage_joined_helper.html
+++ b/dom/tests/mochitest/whatwg/postMessage_joined_helper.html
@@ -4,38 +4,44 @@
 http://sub1.test1.example.org/tests/dom/tests/mochitest/whatwg/postMessage_joined_helper.html
 -->
 <head>
   <title>postMessage joined domains, inner frame</title>
   <script type="application/javascript" src="browserFu.js"></script>
   <script type="application/javascript">
     function receiveMessage(evt)
     {
-      var response, target;
+      var response, target, providedOrigin;
       var data = evt.data;
       if (data === "subframe-test-finished")
       {
         target = window.parent;
+        providedOrigin = "http://localhost:8888";
         response = "test-passed";
       }
       else if (data === "start-test")
       {
         target = window.frames.innermost;
+        providedOrigin = "http://example.org";
         response = "start-test";
       }
       else
       {
         target = window.parent;
+        providedOrigin = "http://localhost:8888";
         response = "not reached";
       }
 
+      if (evt.lastEventId !== "")
+        response += " wrong-lastEventId(" + evt.lastEventId + ")";
+
       if (evt.type !== "message")
         response += " wrong-type(" + evt.type + ")";
 
-      if (evt.target !== document)
+      if (evt.target !== window)
       {
         response += " wrong-target(" + evt.target + ")";
         response += " location(" + window.location.href + ")";
       }
 
       if (isMozilla && evt.isTrusted === true)
       {
         response += " unexpected-trusted-event";
@@ -50,31 +56,31 @@ http://sub1.test1.example.org/tests/dom/
         origin = "unreached";
 
       if (evt.origin !== origin)
       {
         response += " wrong-origin(" + evt.origin + ")";
         response += " location(" + window.location.href + ")";
       }
 
-      target.postMessage(response);
+      target.postMessage(response, providedOrigin);
     }
 
     function setup()
     {
       var oldDomain = document.domain;
       var newDomain = "example.org";
 
       document.domain = newDomain;
 
       var target = document.getElementById("location");
       target.textContent = "Location: " + oldDomain +
                            ", effective domain: " + newDomain;
 
-      document.addEventListener("message", receiveMessage, false);
+      window.addEventListener("message", receiveMessage, false);
     }
 
     window.addEventListener("load", setup, false);
   </script>
 </head>
 <body>
 <p id="location">No location!</p>
 
--- a/dom/tests/mochitest/whatwg/postMessage_joined_helper2.html
+++ b/dom/tests/mochitest/whatwg/postMessage_joined_helper2.html
@@ -6,29 +6,36 @@ http://example.org/tests/dom/tests/mochi
 <head>
   <title>postMessage joined domains, innermost frame</title>
   <script type="application/javascript" src="browserFu.js"></script>
   <script type="application/javascript">
     function receiveMessage(evt)
     {
       var response = "subframe-test-finished";
 
+      if (evt.origin !== "http://sub1.test1.example.org")
+      {
+        response += " wrong-origin(" + evt.origin + ")";
+        response += " location(" + window.location.href + ")";
+      }
+
       if (evt.data !== "start-test")
         response += " incorrect-subframe-data(" + evt.data + ")";
       if (evt.type !== "message")
         response += " wrong-type(" + evt.type + ")";
-      if (evt.target !== document)
+      if (evt.target !== window)
       {
         response += " wrong-target(" + evt.target + ")";
         response += " location(" + window.location.href + ")";
       }
 
-      if (isMozilla && evt.isTrusted)
+      if (isMozilla)
       {
-        response += " unexpected-trusted-event";
+        if (evt.isTrusted !== false)
+          response += " unexpected-trusted-event";
       }
 
       if (evt.source !== window.parent)
       {
         response += " unexpected-source(" + evt.source + ")";
         response += " window-parent-is(" + window.parent + ")";
         response += " location(" + window.location.href + ")";
       }
@@ -40,37 +47,31 @@ http://example.org/tests/dom/tests/mochi
       }
       catch (e)
       {
       }
 
       if (!passed)
         response += " expected-joined-domains";
 
-      if (evt.origin !== "http://sub1.test1.example.org")
-      {
-        response += " wrong-origin(" + evt.origin + ")";
-        response += " location(" + window.location.href + ")";
-      }
-
-      window.parent.postMessage(response);
+      window.parent.postMessage(response, "http://sub1.test1.example.org");
     }
     
     function setup()
     {
       var oldDomain = document.domain;
       var newDomain = "example.org"; // join with parent
 
       document.domain = newDomain;
 
       var target = document.getElementById("location");
       target.textContent = "Location: " + oldDomain +
                            ", effective domain: " + newDomain;
 
-      document.addEventListener("message", receiveMessage, false);
+      window.addEventListener("message", receiveMessage, false);
     }
 
     window.addEventListener("load", setup, false);
   </script>
 </head>
 <body>
 <p id="location">No location!</p>
 </body>
--- a/dom/tests/mochitest/whatwg/postMessage_onOther.html
+++ b/dom/tests/mochitest/whatwg/postMessage_onOther.html
@@ -1,52 +1,109 @@
 <!DOCTYPE html>
 <html>
 <head>
   <title>postMessage called through another frame</title>
   <script type="application/javascript">
+    var PATH = "/tests/dom/tests/mochitest/whatwg/postMessage_onOther.html";
+
     function receiveMessage(evt)
     {
-      var response = "response-to-sibling-sent-message";
+      if (evt.lastEventId !== "")
+      {
+        fail("unexpected non-empty lastEventId");
+        return;
+      }
+
+      switch (window.location.href)
+      {
+        case "http://example.com" + PATH:
+          receiveTopDomain(evt);
+          break;
+
+        case "http://test1.example.com" + PATH:
+          receiveSubDomain(evt);
+          break;
+
+        default:
+          fail("unexpected location");
+      }
+    }
+
+    function fail(msg)
+    {
+      window.parent.postMessage("FAIL " + msg, "*");
+    }
 
-      // Our parent frame called testSiblingPostMessage (below) on a frame
-      // containing this page on localhost:8888.  testSiblingPostMessage then
-      // called postMessage on this page on example.org:8000.  We thus expect
-      // to see an event whose source is the window of our sibling frame on
-      // localhost:8888.  In other words, the event we receive should have:
-      //
-      // http://localhost:8888/tests/dom/tests/mochitest/whatwg/postMessage_onOther.html
-      //
-      // and not
-      //
-      // http://localhost:8888/tests/dom/tests/mochitest/whatwg/test_postMessage_onOther.html
-      //
-      // as its source.
+    // The parent frame sends "start-test" to the subdomain frame to start.
+    // The subdomain frame then sets document.domain to the top domain so that
+    // the top domain frame can access it.  It then sends a message to the top
+    // domain frame to tell it to do likewise; once that happens, the top domain
+    // frame can then call a method on the subdomain frame window, which will
+    // call a method *on the top domain window* to send a message to the parent
+    // window.  We thus expect to see an event whose source is the subdomain
+    // window -- *not* the top domain window.  Therefore, its .origin should be:
+    //
+    //   http://test1.example.com
+    //
+    // and not
+    //
+    //   http://example.com
 
-      if (evt.data !== "message-from-sibling")
-        response += " wrong-data(" + evt.data + ")";
+    function receiveSubDomain(evt)
+    {
       if (evt.origin !== "http://localhost:8888")
-        response += " failed-wrong-origin(" + evt.origin + ")";
-      if (evt.source !== window.parent.firstFrame)
-        response += " failed-wrong-source";
+      {
+        fail("wrong top-domain origin: " + evt.origin);
+        return;
+      }
+      if (evt.data !== "start-test")
+      {
+        fail("wrong top-domain message: " + evt.origin);
+        return;
+      }
 
-      window.parent.postMessage(response);
+      document.domain = "example.com";
+      window.parent.topDomainFrame.postMessage("domain-switch",
+                                               "http://example.com");
+    }
+    
+    function receiveTopDomain(evt)
+    {
+      if (evt.origin !== "http://test1.example.com")
+      {
+        fail("wrong subdomain origin: " + evt.origin);
+        return;
+      }
+      if (evt.data !== "domain-switch")
+      {
+        fail("wrong subdomain message: " + evt.origin);
+        return;
+      }
+      if (evt.source !== window.parent.subDomainFrame)
+      {
+        fail("wrong source on message from subdomain");
+        return;
+      }
+
+      document.domain = "example.com";
+      window.parent.subDomainFrame.testSiblingPostMessage();
     }
 
     function testSiblingPostMessage()
     {
-      window.parent.secondFrame.postMessage("message-from-sibling");
+      window.parent.postMessage("test-finished", "http://localhost:8888");
     }
 
     function setup()
     {
       var target = document.getElementById("location");
-      target.textContent = document.domain;
+      target.textContent = location.hostname + ":" + (location.port || 80);
     }
 
-    document.addEventListener("message", receiveMessage, false);
+    window.addEventListener("message", receiveMessage, false);
     window.addEventListener("load", setup, false);
   </script>
 </head>
 <body>
 <h1 id="location">No location!</h1>
 </body>
 </html>
--- a/dom/tests/mochitest/whatwg/postMessage_origin_helper.xhtml
+++ b/dom/tests/mochitest/whatwg/postMessage_origin_helper.xhtml
@@ -1,36 +1,36 @@
 <!DOCTYPE html>
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
-  <title>postMessage throwing page</title>
+  <title>postMessage origin-testing helper page</title>
   <script type="application/javascript"><![CDATA[
 function receiveMessage(evt)
 {
   var response = "PASS";
 
   if (evt.origin !== "http://localhost:8888")
     response += " wrong-origin(" + evt.origin + ")";
   if (evt.source !== window.parent)
     response += " wrong-source";
   if (evt.data !== "PASS")
     response += " wrong-data(" + evt.data + ")";
 
-  window.parent.postMessage(response);
+  window.parent.postMessage(response, "http://localhost:8888");
 }
 
-document.addEventListener("message", receiveMessage, false);
+window.addEventListener("message", receiveMessage, false);
 
 
 // Aids for identifying origins
 
 function setup()
 {
   var target = document.getElementById("location");
-  target.textContent = document.domain + ":" + (location.port || 80);
+  target.textContent = location.hostname + ":" + (location.port || 80);
 }
 
 window.addEventListener("load", setup, false);
   ]]></script>
 </head>
 <body>
 <h1 id="location">No location!</h1>
 </body>
--- a/dom/tests/mochitest/whatwg/postMessage_override_helper.html
+++ b/dom/tests/mochitest/whatwg/postMessage_override_helper.html
@@ -1,42 +1,42 @@
 <!DOCTYPE html>
 <html>
 <head>
   <title>Overriding postMessage and dispatchEvent bindings</title>
   <script type="application/javascript">
     window.postMessage = function (evt)
     {
-      window.parent.postMessage("FAIL overridden postMessage called");
+      window.parent.postMessage("FAIL overridden postMessage called", "*");
     };
 
     var count = 0;
 
     function receiveMessage(evt)
     {
       count++;
       if (count == 1)
       {
         window.dispatchEvent = function(evt)
         {
-          window.parent.postMessage("FAIL");
+          window.parent.postMessage("FAIL", "*");
           throw "dispatchEvent threw";
         };
       }
 
-      window.parent.postMessage(evt.data);
+      window.parent.postMessage(evt.data, "http://localhost:8888");
     }
     
     function setup()
     {
       var target = document.getElementById("location");
-      target.textContent = document.domain;
+      target.textContent = location.hostname + ":" + (location.port || 80);
     }
 
-    document.addEventListener("message", receiveMessage, false);
+    window.addEventListener("message", receiveMessage, false);
 
     window.addEventListener("load", setup, false);
   </script>
 </head>
 <body>
 <h1 id="location">No location!</h1>
 </body>
 </html>
--- a/dom/tests/mochitest/whatwg/postMessage_throw_helper.html
+++ b/dom/tests/mochitest/whatwg/postMessage_throw_helper.html
@@ -2,22 +2,22 @@
 <html>
 <head>
   <title>postMessage throwing page</title>
   <script type="application/javascript">
     function receiveMessage(evt)
     {
       throw 17;
     }
-    document.addEventListener("message", receiveMessage, false);
+    window.addEventListener("message", receiveMessage, false);
 
     function setup()
     {
       var target = document.getElementById("location");
-      target.textContent = document.domain;
+      target.textContent = location.hostname + ":" + (location.port || 80);
     }
 
     window.addEventListener("load", setup, false);
   </script>
 </head>
 <body>
 <h1 id="location">No location!</h1>
 </body>
--- a/dom/tests/mochitest/whatwg/postMessage_userpass_helper.html
+++ b/dom/tests/mochitest/whatwg/postMessage_userpass_helper.html
@@ -6,26 +6,28 @@
 function sendMessage(evt)
 {
   var msg = "child-message";
 
   if (evt.origin !== "http://localhost:8888")
     msg += " wrong-origin(" + evt.origin + ")";
   if (evt.data !== "parent-message")
     msg += " wrong-data(" + evt.data + ")";
+  if (evt.lastEventId !== "")
+    msg += " wrong-lastEventId(" + evt.lastEventId + ")";
   if (evt.source !== window.parent)
     msg += " wrong-source";
 
   // It would be good to guarantee that we've been opened with a userinfo of
   // "bobhope:password", but Gecko elides that from the content-visible URL,
   // and I can't find another way to actually detect this programmatically.
 
-  window.parent.postMessage(msg);
+  window.parent.postMessage(msg, "http://localhost:8888");
 }
 
-document.addEventListener("message", sendMessage, false);
+window.addEventListener("message", sendMessage, false);
   </script>
 </head>
 <body>
 <p>Kid iframe</p>
 </body>
 </html>
 
--- a/dom/tests/mochitest/whatwg/test_MessageEvent.html
+++ b/dom/tests/mochitest/whatwg/test_MessageEvent.html
@@ -23,41 +23,47 @@ https://bugzilla.mozilla.org/show_bug.cg
 <script class="testbody" type="application/javascript">
 /** Test for Bug 387706 **/
 
 SimpleTest.waitForExplicitFinish();
 
 var data = "foobar";
 var origin = "http://cool.example.com";
 var bubbles = true, cancelable = true;
+var lastEventId = "lastEventId";
 
 var target;
 
 var count = 0;
 
 function sendMsg()
 {
   try
   {
     var evt = document.createEvent("MessageEvent");
     ok(evt instanceof MessageEvent, "I ordered a MessageEvent!");
   
     if (isMozilla)
     {
       is(evt.source, null,
-         "not initialized yet, so null in our implementation");    
+         "not initialized yet, so null in our implementation");
+      is(evt.lastEventId, "",
+         "not initialized yet, so empty string in our implementation");
     }
   
-    evt.initMessageEvent("message", bubbles, cancelable, data, origin, null);
+    evt.initMessageEvent("message", bubbles, cancelable, data, origin,
+                         lastEventId, null);
     ok(evt.source === null, "null source is fine for a MessageEvent");
   
-    evt.initMessageEvent("message", bubbles, cancelable, data, origin, window);
+    evt.initMessageEvent("message", bubbles, cancelable, data, origin,
+                         lastEventId, window);
   
     is(evt.data, data, "unexpected data");
     is(evt.origin, origin, "unexpected origin");
+    is(evt.lastEventId, lastEventId, "unexpected lastEventId");
   
     is(evt.cancelable, cancelable, "wrong cancelable property");
     is(evt.bubbles, bubbles, "wrong bubbling property");
     is(evt.source, window, "wrong source");
   
     return target.dispatchEvent(evt);
   }
   catch (e)
@@ -66,16 +72,17 @@ function sendMsg()
     return false;
   }
 }
 
 function recvMsg(evt)
 {
   is(evt.data, data, "unexpected data");
   is(evt.origin, origin, "unexpected origin");
+  is(evt.lastEventId, lastEventId, "unexpected lastEventId");
 
   is(evt.cancelable, cancelable, "wrong cancelable property");
   is(evt.bubbles, bubbles, "wrong bubbling property");
   is(evt.source, window, "wrong source");
 
   is(evt.target, target, "wrong target");
 
   if (target == evt.currentTarget)
--- a/dom/tests/mochitest/whatwg/test_MessageEvent_dispatchToOther.html
+++ b/dom/tests/mochitest/whatwg/test_MessageEvent_dispatchToOther.html
@@ -23,17 +23,18 @@ https://bugzilla.mozilla.org/show_bug.cg
 SimpleTest.waitForExplicitFinish();
 
 function run()
 {
   try
   {
     var msg = document.createEvent("MessageEvent");
     msg.initMessageEvent("message", true, true,
-                         "foo", "http://evil.com", window);
+                         "foo", "http://evil.com", "",
+                         window);
 
     try
     {
       var ex;
       window.frames.otherDomain.dispatchEvent(msg);
       ok(false, "should have thrown a security exception per HTML5");
     }
     catch (e)
--- a/dom/tests/mochitest/whatwg/test_postMessage.html
+++ b/dom/tests/mochitest/whatwg/test_postMessage.html
@@ -22,30 +22,40 @@ https://bugzilla.mozilla.org/show_bug.cg
 
 
 <pre id="test">
 <script class="testbody" type="application/javascript">
 /** Test for Bug 387706 **/
 
 SimpleTest.waitForExplicitFinish();
 
-var testsCompletedCount = 0;
-
 /** Variable for receivers to attempt to get. */
 window.privateVariable = 17;
 
-/** For sentinel finish, if necessary in deficient browsers */
+/** For sentinel finish, if necessary in deficient browsers. */
 var finished = false;
 
-/** Receives MessageEvents to this window. */
+/** Ends testing if it isn't already done. */
+function finish()
+{
+  if (!finished)
+  {
+    finished = true;
+    SimpleTest.finish();
+  }
+}
+
+/** Receives MessageEvents. */
 function messageReceiver(evt)
 {
   try
   {
     ok(evt instanceof MessageEvent, "umm, how did we get this?");
+    is(evt.lastEventId, "",
+       "postMessage creates events with empty lastEventId");
     is(evt.type, "message", "expected events of type 'message'");
   
     if (isMozilla)
     {
       ok(evt.isTrusted === false, "shouldn't have been a trusted event");
     }
   
     var data = evt.data;
@@ -56,78 +66,80 @@ function messageReceiver(evt)
     if (data === "post-to-self")
     {
       respondToSelf(evt);
       return;
     }
 
     switch (evt.data)
     {
-      case "post-to-self":
-        
       case "post-to-self-response":
         receiveSelf(evt);
         break;
   
       case "post-to-other-same-domain-response":
         receiveOtherSameDomain(evt);
         break;
   
       case "post-to-other-cross-domain-response":
         receiveOtherCrossDomain(evt);
+        
+        // All the tests have executed, so we're done.
+        finish();
         break;
   
       default:
         ok(false, "unexpected message: " + evt.data);
+        finish();
         break;
     }
   }
   catch (e)
   {
     ok(false, "error processing event with data '" + evt.data + "': " + e);
-  }
-
-  // if all the tests have executed, we're done
-  if (++testsCompletedCount == allTests.length)
-  {
-    finished = true;
-    SimpleTest.finish();
+    finish();
   }
 }
 
 
 /******************
  * SELF-RESPONDER *
  ******************/
 
 function respondToSelf(evt)
 {
   is(evt.origin, "http://localhost:8888", "event has wrong origin");
   is(evt.source, window, "we posted this message!");
   
-  evt.source.postMessage("post-to-self-response");
+  evt.source.postMessage("post-to-self-response", evt.origin);
 }
 
 
 /*************
  * RECEIVERS *
  *************/
 
 function receiveSelf(evt)
 {
   is(evt.origin, "http://localhost:8888", "event has wrong origin");
   is(evt.source, window, "we posted this message!");
+
+  window.frames.otherSameDomain.postMessage("post-to-other-same-domain",
+                                            "http://localhost:8888");
 }
 
 function receiveOtherSameDomain(evt)
 {
   is(evt.origin, "http://localhost:8888",
      "same-domain response event has wrong origin");
   is(evt.source, window.frames.otherSameDomain,
      "wrong source for same-domain message!");
+
+  window.frames.otherCrossDomain.postMessage("post-to-other-cross-domain",
+                                            "http://example.org:8000");
 }
 
 function receiveOtherCrossDomain(evt)
 {
   is(evt.origin, "http://example.org:8000",
      "same-domain response event has wrong origin");
 
   // can't use |is| here, because ok tries to get properties on its arguments
@@ -136,61 +148,20 @@ function receiveOtherCrossDomain(evt)
      "wrong source for cross-domain message!");
 }
 
 
 /**************
  * TEST SETUP *
  **************/
 
-document.addEventListener("message", messageReceiver, false);
-
-/**
- * Returns a nullary function which posts the given message to the given
- * destination.
- */
-function createMessageDispatcher(message, destination)
+function start()
 {
-  function dispatcher()
-  {
-    try
-    {
-      destination.postMessage(message);
-    }
-    catch (e)
-    {
-      ok(false, "error while calling postMessage: " + e);
-    }
-  }
-
-  return dispatcher;
+  window.postMessage("post-to-self", "http://localhost:8888");
 }
 
-var allTests =
-  [
-    createMessageDispatcher("post-to-self", window),
-    createMessageDispatcher("post-to-other-same-domain",
-                            window.frames.otherSameDomain),
-    createMessageDispatcher("post-to-other-cross-domain",
-                            window.frames.otherCrossDomain),
-  ];
-
-for (var i = 0, sz = allTests.length; i != sz; i++)
-  addLoadEvent(allTests[i]);
+window.addEventListener("load", start, false);
+window.addEventListener("message", messageReceiver, false);
 
-/**
- * Browsers which fail to send a response to a postMessage need this to
- * finish the test.
- */
-function sentinel()
-{
-  if (!finished)
-  {
-    ok(false, "shouldn't be necessary (finished in last of allTests)");
-    SimpleTest.finish();
-  }
-}
-
-addLoadEvent(sentinel);
 </script>
 </pre>
 </body>
 </html>
--- a/dom/tests/mochitest/whatwg/test_postMessage_basehref.html
+++ b/dom/tests/mochitest/whatwg/test_postMessage_basehref.html
@@ -23,24 +23,25 @@ https://bugzilla.mozilla.org/show_bug.cg
 SimpleTest.waitForExplicitFinish();
 
 function receiveMessage(evt)
 {
   is(evt.origin, "http://localhost:8888", "wrong sender");
   ok(evt.source === window, "wrong source");
 
   is(evt.data, "generate-event", "wrong data");
+  is(evt.lastEventId, "", "wrong lastEventId");
 
   SimpleTest.finish();
 }
 
-document.addEventListener("message", receiveMessage, false);
+window.addEventListener("message", receiveMessage, false);
 
 function run()
 {
-  window.postMessage("generate-event");
+  window.postMessage("generate-event", "http://localhost:8888");
 }
 
 window.addEventListener("load", run, false);
 </script>
 </pre>
 </body>
 </html>
--- a/dom/tests/mochitest/whatwg/test_postMessage_chrome.html
+++ b/dom/tests/mochitest/whatwg/test_postMessage_chrome.html
@@ -24,89 +24,88 @@ chrome://mochikit/content/chrome/dom/tes
 
 
 <pre id="test">
 <script class="testbody" type="application/javascript">
 /** Test for Bug 387706 **/
 
 SimpleTest.waitForExplicitFinish();
 
-var testsCompletedCount = 0;
+var finished = false;
+function finish()
+{
+  if (!finished)
+  {
+    finished = true;
+    SimpleTest.finish();
+  }
+}
 
 /** Receives MessageEvents to this window. */
 function messageReceiver(evt)
 {
   ok(evt instanceof MessageEvent, "umm, how did we get this?");
   is(evt.type, "message", "expected events of type 'message'");
+  is(evt.lastEventId, "", "postMessage creates events with empty lastEventId");
 
   switch (evt.data)
   {
     case "post-to-self":
       checkSelf(evt);
       break;
       
     case "post-to-content-response":
       receiveContent(evt);
       break;
 
     default:
       ok(false, "unexpected message: " + evt.data);
+      finish();
       break;
   }
-
-  // if all the tests have executed, we're done
-  if (++testsCompletedCount == allTests.length)
-    setTimeout(SimpleTest.finish, 0);
 }
 
 
 /******************
  * SELF-RESPONDER *
  ******************/
 
 function checkSelf(evt)
 {
   is(evt.isTrusted, true, "should have sent a trusted event");
   is(evt.origin, "chrome://mochikit", "wrong origin for chrome: URL");
   is(evt.source, null, "chrome posters get a null source, for security");
+
+  window.frames.contentDomain.postMessage("post-to-content",
+                                          "http://example.org");
 }
 
 
 /*************
  * RECEIVERS *
  *************/
 
 function receiveContent(evt)
 {
   is(evt.isTrusted, true, "should have sent a trusted event");
   is(evt.origin, "http://example.org", "content response event has wrong URI");
   is(evt.source, window.frames.contentDomain,
      "wrong source for same-domain message!");
+
+  finish();
 }
 
 
 /**************
  * TEST SETUP *
  **************/
 
-document.addEventListener("message", messageReceiver, false);
-
-/**
- * Returns a nullary function which posts the given message to the given
- * destination.
- */
-function createMessageDispatcher(message, destination)
+function run()
 {
-  return function() { destination.postMessage(message); };
+  window.addEventListener("message", messageReceiver, false);
+  window.postMessage("post-to-self", "*");
 }
 
-var allTests =
-  [
-    createMessageDispatcher("post-to-self", window),
-    createMessageDispatcher("post-to-content",
-                            window.frames.contentDomain),
-  ];
-  
-allTests.forEach(addLoadEvent);
+window.addEventListener("load", run, false);
 </script>
 </pre>
 </body>
 </html>
--- a/dom/tests/mochitest/whatwg/test_postMessage_closed.html
+++ b/dom/tests/mochitest/whatwg/test_postMessage_closed.html
@@ -18,48 +18,49 @@
 <script class="testbody" type="application/javascript">
 
 SimpleTest.waitForExplicitFinish();
 
 function receiveMessage(evt)
 {
   is(evt.origin, "http://localhost:8888", "wrong origin");
   ok(evt.source === openedWindow, "wrong source");
+  is(evt.lastEventId, "", "postMessage creates events with empty lastEventId");
 
   is(evt.data, "message", "wrong data");
   if (evt.data !== "message")
     return; // prevent recursion if bugs
 
   evt.source.close();
 
   function afterClose()
   {
     document.removeEventListener("message", receiveMessage, false);
-    evt.source.postMessage("NOT-RECEIVED");
+    evt.source.postMessage("NOT-RECEIVED", "*");
 
     var iframe = document.createElement("iframe");
     iframe.id = "insertedIframe";
     $("holder").appendChild(iframe);
     iframe.addEventListener("load", iframeLoaded, false);
     iframe.src = "postMessage_closed_helper.html?parent";
   }
 
   setTimeout(afterClose, 0);
 }
 
-document.addEventListener("message", receiveMessage, false);
+window.addEventListener("message", receiveMessage, false);
 
 function iframeLoaded(evt)
 {
   var iframe = $("insertedIframe");
   iframe.removeEventListener("load", iframeLoaded, false);
 
   var iframeWindow = iframe.contentWindow;
   $("holder").removeChild($("insertedIframe"));
-  iframeWindow.postMessage("NOT-RECEIVED");
+  iframeWindow.postMessage("NOT-RECEIVED", "*");
 
   SimpleTest.finish();
 }
 
 var openedWindow;
 
 function run()
 {
--- a/dom/tests/mochitest/whatwg/test_postMessage_hash.html
+++ b/dom/tests/mochitest/whatwg/test_postMessage_hash.html
@@ -20,26 +20,27 @@
 <script class="testbody" type="application/javascript">
 
 SimpleTest.waitForExplicitFinish();
 
 function receiveMessage(evt)
 {
   is(evt.origin, "http://localhost:8888", "wrong origin");
   ok(evt.source === window.frames.kid, "wrong source");
+  is(evt.lastEventId, "", "postMessage creates events with empty lastEventId");
 
   is(evt.data, "response-message", "wrong data");
 
   SimpleTest.finish();
 }
 
-document.addEventListener("message", receiveMessage, false);
+window.addEventListener("message", receiveMessage, false);
 
 function run()
 {
-  window.frames.kid.postMessage("from-parent");
+  window.frames.kid.postMessage("from-parent", "http://localhost:8888");
 }
 
 window.addEventListener("load", run, false);
 </script>
 </pre>
 </body>
 </html>
--- a/dom/tests/mochitest/whatwg/test_postMessage_idn.xhtml
+++ b/dom/tests/mochitest/whatwg/test_postMessage_idn.xhtml
@@ -36,39 +36,37 @@ function receiveMessage(evt)
   {
     ok(evt.isTrusted === false, "shouldn't have been a trusted event");
   }
 
   is(evt.origin, "http://sub1.ält.example.org:8000",
      "wrong origin -- IDN issue, perhaps?");
 
   is(evt.data, "idn-response", "unexpected test result");
+  is(evt.lastEventId, "", "postMessage creates events with empty lastEventId");
   ok(evt.source === idnWindow, "wrong source");
 
-  responseReceived = true;
+  SimpleTest.finish();
 }
-document.addEventListener("message", receiveMessage, false);
+window.addEventListener("message", receiveMessage, false);
 
 var xhtmlns = "http://www.w3.org/1999/xhtml";
 
 function setup()
 {
+  var idnFrame = document.getElementsByTagNameNS(xhtmlns, "iframe")[0];
+  idnWindow = idnFrame.contentWindow;
   try
   {
-    var idnFrame = document.getElementsByTagNameNS(xhtmlns, "iframe")[0];
-    idnWindow = idnFrame.contentWindow;
-    idnWindow.postMessage("idn-message");
-
-    ok(responseReceived, "should have gotten a response before returning");
+    idnWindow.postMessage("idn-message", "http://sub1.ält.example.org:8000");
   }
   catch (e)
   {
     ok(false, "failed to post message: " + e);
+    SimpleTest.finish();
   }
-
-  SimpleTest.finish();
 }
 
 addLoadEvent(setup);
 </script>
 </pre>
 </body>
 </html>
new file mode 100644
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/test_postMessage_jar.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=430251
+-->
+<head>
+  <title>postMessage's interaction with pages at jar: URIs</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="browserFu.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+  <base href="http://example.com/" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=430251">Mozilla Bug 430251</a>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+
+<iframe src="jar:http://example.com/tests/dom/tests/mochitest/whatwg/postMessage.jar!/postMessage_jar.html"
+        name="kid"></iframe>
+
+<pre id="test">
+<script class="testbody" type="application/javascript">
+/** Test for Bug 430251 **/
+
+SimpleTest.waitForExplicitFinish();
+
+function receiveMessage(evt)
+{
+  is(evt.origin, "http://example.com", "wrong sender");
+  ok(evt.source === window.frames.kid, "wrong source");
+
+  is(evt.data, "finish-test", "wrong data");
+  is(evt.lastEventId, "", "wrong lastEventId");
+
+  SimpleTest.finish();
+}
+
+window.addEventListener("message", receiveMessage, false);
+
+function run()
+{
+  window.frames.kid.postMessage("start-test", "http://example.com");
+}
+
+window.addEventListener("load", run, false);
+</script>
+</pre>
+</body>
+</html>
--- a/dom/tests/mochitest/whatwg/test_postMessage_joined.html
+++ b/dom/tests/mochitest/whatwg/test_postMessage_joined.html
@@ -30,37 +30,30 @@ function receiveTestResult(evt)
   ok(evt instanceof MessageEvent, "umm, how did we get this?");
   is(evt.type, "message", "expected events of type 'message'");
 
   if (isMozilla)
   {
     ok(evt.isTrusted === false, "shouldn't have been a trusted event");
   }
 
-  var data = evt.data;
-  
+  is(evt.lastEventId, "", "postMessage creates events with empty lastEventId");
+
   // Either we passed the test or we failed it.  The message's
   // contents should help to diagnose the failure.  Either way,
   // consider this the end of the test.
-  is(data, "test-passed", "unexpected test result");
+  is(evt.data, "test-passed", "unexpected test result");
   SimpleTest.finish();
 }
 
 function setup()
 {
-  document.addEventListener("message", receiveTestResult, false);
-  try
-  {
-    window.frames.container.postMessage("start-test");
-  }
-  catch (e)
-  {
-    ok(false, "failed to post message");
-    SimpleTest.finish();
-  }
+  window.addEventListener("message", receiveTestResult, false);
+  window.frames.container.postMessage("start-test",
+                                      "http://sub1.test1.example.org");
 }
 
 addLoadEvent(setup);
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/tests/mochitest/whatwg/test_postMessage_onOther.html
+++ b/dom/tests/mochitest/whatwg/test_postMessage_onOther.html
@@ -9,68 +9,44 @@ https://bugzilla.mozilla.org/show_bug.cg
   <script type="text/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=postMessage">Mozilla Bug 387706</a>
 <p id="display"></p>
 <div id="content" style="display: none"></div>
 
-<iframe src="http://localhost:8888/tests/dom/tests/mochitest/whatwg/postMessage_onOther.html"
-        name="firstFrame"></iframe>
-<iframe src="http://example.org:8000/tests/dom/tests/mochitest/whatwg/postMessage_onOther.html"
-        name="secondFrame"></iframe>
+<iframe src="http://example.com/tests/dom/tests/mochitest/whatwg/postMessage_onOther.html"
+        name="topDomainFrame"></iframe>
+<iframe src="http://test1.example.com/tests/dom/tests/mochitest/whatwg/postMessage_onOther.html"
+        name="subDomainFrame"></iframe>
 
 
 <pre id="test">
 <script class="testbody" type="application/javascript">
 /** Test for Bug 387706 **/
 
 SimpleTest.waitForExplicitFinish();
 
-var finished = false;
-
 /** Receives MessageEvents to this window. */
 function messageReceiver(evt)
 {
   ok(evt instanceof MessageEvent, "wrong event type");
-  is(evt.origin, "http://example.org:8000", "unexpected origin");
-  is(evt.data, "response-to-sibling-sent-message",
+  is(evt.origin, "http://test1.example.com", "unexpected origin");
+  is(evt.lastEventId, "", "postMessage creates events with empty lastEventId");
+  is(evt.data, "test-finished",
      "unexpected data in message");
 
-  // Handle buggy browsers that might somehow have received a message twice
-  if (finished)
-    return;
-
-  finished = true;
   SimpleTest.finish();
 }
 
-function postToSecondFrameThroughFirstFrame()
+function run()
 {
-  try
-  {
-    window.frames.firstFrame.testSiblingPostMessage();
-  }
-  catch (e)
-  {
-    ok(false, "threw exception trying to post through firstFrame: " + e);
-  }
+  window.frames.subDomainFrame.postMessage("start-test",
+                                           "http://test1.example.com");
 }
 
-/** For buggy browsers that didn't send a response. */
-function sentinel()
-{
-  if (!finished)
-  {
-    ok(false, "should have been finished by now -- didn't receive response?");
-    SimpleTest.finish();
-  }
-}
-
-document.addEventListener("message", messageReceiver, false);
-
-addLoadEvent(postToSecondFrameThroughFirstFrame);
-addLoadEvent(sentinel);
+window.addEventListener("message", messageReceiver, false);
+window.addEventListener("load", run, false);
 </script>
 </pre>
 </body>
 </html>
--- a/dom/tests/mochitest/whatwg/test_postMessage_origin.xhtml
+++ b/dom/tests/mochitest/whatwg/test_postMessage_origin.xhtml
@@ -38,24 +38,16 @@ https://bugzilla.mozilla.org/show_bug.cg
 SimpleTest.waitForExplicitFinish();
 
 function errorCheck(i, called, errorCode, actualCode)
 {
   ok(!called, "receiver should not have been called for test #" + i);
   is(actualCode, errorCode, "wrong error thrown in test #" + i);
 }
 
-function errorCheckTodo(i, called, errorCode, actualCode)
-{
-  todo(!called, "receiver should not have been called for test #" + i);
-  todo_is(actualCode, errorCode, "wrong error thrown in test #" + i);
-}
-
-var ONE_PASS = ["PASS"];
-
 var tests =
   [
    // 0
    {
      args: ["NOT-RECEIVED", ""],
      source: "sameDomain",
      code: DOMException.SYNTAX_ERR
    },
@@ -74,94 +66,94 @@ var tests =
      source: "sameDomain",
      code: DOMException.SYNTAX_ERR
    },
    {
      args: ["NOT-RECEIVED", "http: //"],
      source: "sameDomain",
      code: DOMException.SYNTAX_ERR,
 
-     throwsNoException: true
+     hasThrowsNoExceptionBug: true
    },
    // 5
    {
      args: ["NOT-RECEIVED", "http ://"],
      source: "sameDomain",
      code: DOMException.SYNTAX_ERR
    },
    {
      args: ["TODO", " http://localhost:8888"],
      source: "sameDomain",
      code: DOMException.SYNTAX_ERR,
 
      returnOrigin: "http://localhost:8888",
-     throwsNoException: true
+     hasThrowsNoExceptionBug: true
    },
    {
      args: ["NOT-RECEIVED", "hä"],
      source: "sameDomain",
      code: DOMException.SYNTAX_ERR
    },
    {
      args: ["NOT-RECEIVED", "http://lo\0k.com"],
      source: "sameDomain",
      code: DOMException.SYNTAX_ERR
    },
    {
      args: ["NOT-RECEIVED", "http: //localhost:8888"],
      source: "sameDomain",
      code: DOMException.SYNTAX_ERR,
 
-     throwsNoException: true
+     hasThrowsNoExceptionBug: true
    },
    // 10
    {
      args: ["NOT-RECEIVED", "http://localhost :8888"],
      source: "sameDomain",
      code: DOMException.SYNTAX_ERR
    },
    {
      args: ["NOT-RECEIVED", "http:// localhost:8888"],
      source: "sameDomain",
      code: DOMException.SYNTAX_ERR,
 
-     throwsNoException: true
+     hasThrowsNoExceptionBug: true
    },
    {
      args: ["TODO", "http://\nlocalhost:8888"],
      source: "sameDomain",
      code: DOMException.SYNTAX_ERR,
 
      returnOrigin: "http://localhost:8888",
-     throwsNoException: true
+     hasThrowsNoExceptionBug: true
    },
    {
      args: ["TODO", "http://localhost:8888\0"],
      source: "sameDomain",
      code: DOMException.SYNTAX_ERR,
 
      returnOrigin: "http://localhost:8888",
-     throwsNoException: true
+     hasThrowsNoExceptionBug: true
    },
    {
      args: ["TODO", "http://localhost:8888\n"],
      source: "sameDomain",
      code: DOMException.SYNTAX_ERR,
 
      returnOrigin: "http://localhost:8888",
-     throwsNoException: true
+     hasThrowsNoExceptionBug: true
    },
    // 15
    {
-     args: ONE_PASS,
+     args: ["PASS", "*"],
      source: "sameDomain",
      returnOrigin: "http://localhost:8888"
    },
    {
-     args: ["PASS", null],
+     args: ["PASS", "http://localhost:8888"],
      source: "sameDomain",
      returnOrigin: "http://localhost:8888"
    },
    {
      args: ["PASS", "http://example.com"],
      source: "otherDomain",
      returnOrigin: "http://example.com"
    },
@@ -306,171 +298,232 @@ var tests =
      returnOrigin: "http://sub1.ŌÄőĪŌĀő¨őīőĶőĻő≥őľőĪ.őīőŅőļőĻőľőģ"
    },
    // 45
    {
      args: ["PASS", "http://sub1.exämple.test"],
      source: "idnKidNoWhitelist",
      returnOrigin: "http://sub1.exämple.test",
 
-     wrongReturnOrigin: true
+     hasWrongReturnOriginBug: true
    },
    {
      args: ["PASS", "http://sub1.exämple.test:80"],
      source: "idnKidNoWhitelist",
      returnOrigin: "http://sub1.exämple.test",
 
-     wrongReturnOrigin: true
+     hasWrongReturnOriginBug: true
    },
    {
      args: ["PASS", "http://sub1.exämple.test:80/"],
      source: "idnKidNoWhitelist",
      returnOrigin: "http://sub1.exämple.test",
 
-     wrongReturnOrigin: true
+     hasWrongReturnOriginBug: true
    },
    {
      args: ["PASS", "http://sub1.exämple.test/"],
      source: "idnKidNoWhitelist",
      returnOrigin: "http://sub1.exämple.test",
 
-     wrongReturnOrigin: true
+     hasWrongReturnOriginBug: true
    },
    {
      args: ["PASS", "http://sub1.exämple.test/foobar"],
      source: "idnKidNoWhitelist",
      returnOrigin: "http://sub1.exämple.test",
 
-     wrongReturnOrigin: true
+     hasWrongReturnOriginBug: true
    },
    // 50
    {
      args: ["PASS", "http://sub1.xn--exmple-cua.test"],
      source: "idnKidNoWhitelist",
      returnOrigin: "http://sub1.exämple.test",
 
-     wrongReturnOrigin: true
+     hasWrongReturnOriginBug: true
    },
    {
      args: ["PASS", "http://sub1.xn--exmple-cua.test:80"],
      source: "idnKidNoWhitelist",
      returnOrigin: "http://sub1.exämple.test",
 
-     wrongReturnOrigin: true
+     hasWrongReturnOriginBug: true
    },
    {
      args: ["PASS", "http://sub1.xn--exmple-cua.test:80/"],
      source: "idnKidNoWhitelist",
      returnOrigin: "http://sub1.exämple.test",
 
-     wrongReturnOrigin: true
+     hasWrongReturnOriginBug: true
    },
    {
      args: ["PASS", "http://sub1.xn--exmple-cua.test/"],
      source: "idnKidNoWhitelist",
      returnOrigin: "http://sub1.exämple.test",
 
-     wrongReturnOrigin: true
+     hasWrongReturnOriginBug: true
    },
    {
      args: ["PASS", "http://sub1.xn--exmple-cua.test/foobar"],
      source: "idnKidNoWhitelist",
      returnOrigin: "http://sub1.exämple.test",
 
-     wrongReturnOrigin: true
+     hasWrongReturnOriginBug: true
    },
    // 55
    {
      args: ["NOT-RECEIVED", undefined],
      source: "sameDomain",
      code: DOMException.SYNTAX_ERR
    },
   ];
 
-function allTests()
+function allTests(callback)
 {
   var test, target, called;
 
-  function receive(evt)
+  function eventCheck(evt)
   {
-    var originCheck = test.wrongReturnOrigin ? todo_is : is;
+    ok(test === tests[i],
+       "i and test are out of sync!  async is hard, let's go shopping");
+
+    var originCheck = test.hasWrongReturnOriginBug ? todo_is : is;
     originCheck(evt.origin, test.returnOrigin, "wrong origin for #" + i);
     if (test.args[0] == "TODO")
       todo_is(evt.data, "PASS", "wrong data");
     else
       is(evt.data, "PASS", "wrong data");
+    is(evt.lastEventId, "",
+       "postMessage creates events with empty lastEventId");
     ok(evt.source === target, "wrong source");
     called = true;
   }
 
-  function post(win, args, err)
+  function nextTest()
   {
-    called = false;
-    win.postMessage.apply(win, args);
-  }
+    i++;
 
-  document.addEventListener("message", receive, false);
+    if (i === end)
+    {
+      removeListener(listener);
 
-  for (var i = 0, sz = tests.length; i < sz; i++)
-  {
+      setTimeout(callback, 0);
+      return;
+    }
+
     test = tests[i];
 
     target = $(test.source).contentWindow;
     try
     {
       called = false;
       target.postMessage.apply(target, test.args);
-      if (test.throwsNoException)
-        todo(false, "should throw on test #" + i);
-      else if (test.expectNoCallback)
-        (test.checkCallback || ok)(!called, "shouldn't have been called #" + i);
-      else
-        (test.checkCallback || ok)(called, "should have been called #" + i);
     }
     catch (e)
     {
-      (test.errorCheck || errorCheck)(i, called, e.code, test.code);
+      // Since an exception was thrown, we know at this point that we're not
+      // waiting on anything else in the queue of script to run, and we can just
+      // call nextTest directly.
+      errorCheck(i, called, e.code, test.code);
+      nextTest();
+      return;
     }
+
+    // We've set up the event generated by postMessage to be dispatched, and
+    // it's sitting in a queue somewhere.  However, it hasn't arrived yet, and
+    // the target document hasn't received the event -- so we need to continue
+    // our tests later.
+    setTimeout(function()
+    {
+      // The event was dispatched, and the target frame's code processed it and
+      // responded -- so now *that* response is sitting in the queue of script to
+      // execute.  Process pending script one more time so we know we've gotten
+      // the response.
+      setTimeout(function()
+      {
+        // Finally, we've posted our message and received our response, and
+        // there's nothing further coming down the pipe.
+        if (test.hasThrowsNoExceptionBug)
+          todo(false, "should throw on test #" + i);
+        else
+          ok(test.expectNoCallback ^ called, "should have been called #" + i);
+
+        nextTest();
+      }, 0);
+    }, 0);
   }
 
-  document.removeEventListener("message", receive, false);
+  var listener = registerMessageListener(eventCheck);
+
+  var i = -1, end = tests.length;
+  nextTest();
 }
 
-function oddballTests()
+function registerMessageListener(func, callback)
 {
-  var called;
   function receive(evt)
   {
+    func(evt);
+    if (callback)
+      callback();
+  }
+  
+  window.addEventListener("message", receive, false);
+  
+  return receive;
+}
+
+function removeListener(listener)
+{
+  window.removeEventListener("message", listener, false);
+}
+
+function oddballTests(callback)
+{
+  var called = false;
+
+  function eventChecks(evt)
+  {
     is(evt.origin, "http://localhost:8888", "wrong sender");
     is(evt.data, "PASS", "wrong data");
+    is(evt.lastEventId, "",
+       "postMessage creates events with empty lastEventId");
     ok(evt.source === window, "wrong source");
     called = true;
   }
-  document.addEventListener("message", receive, false);
-
-  try
-  {
-    called = false;
-    window.postMessage("PASS");
-    is(called, true, "should have been called");
 
-    called = false;
-    window.postMessage("PASS", null);
+  var listener = registerMessageListener(eventChecks, function()
+  {
     is(called, true, "should have been called");
-  }
-  finally
-  {
-    document.removeEventListener("message", receive, false);
-  }
+    removeListener(listener);
+    
+    called = false;
+    listener = registerMessageListener(eventChecks, function()
+    {
+      is(called, true, "should have been called");
+
+      removeListener(listener);
+      callback();
+    });
+    
+    window.postMessage("PASS", "http://localhost:8888");
+  });
+
+  window.postMessage("PASS", "http://localhost:8888");
 }
 
 function run()
 {
-  oddballTests();
-  allTests();
-  SimpleTest.finish();
+  oddballTests(function()
+  {
+    allTests(function()
+    {
+      SimpleTest.finish();
+    });
+  });
 }
 
 window.addEventListener("load", run, false);
 ]]></script>
 </pre>
 </body>
 </html>
--- a/dom/tests/mochitest/whatwg/test_postMessage_override.html
+++ b/dom/tests/mochitest/whatwg/test_postMessage_override.html
@@ -20,39 +20,50 @@ https://bugzilla.mozilla.org/show_bug.cg
 <pre id="test">
 <script class="testbody" type="application/javascript">
 /** Test for Bug 387706 **/
 
 SimpleTest.waitForExplicitFinish();
 
 var count = 0;
 
-function test()
+function test(callback)
 {
   try
   {
     count++;
     switch (count)
     {
       case 1:
-        window.frames[0].postMessage("PASS 1");
+        window.frames[0].postMessage("PASS 1", "http://example.org:8000");
         break;
 
       case 2:
-        window.frames[0].postMessage("PASS 2");
+        window.frames[0].postMessage("PASS 2", "http://example.org:8000");
         break;
   
       default:
         ok(false, "unexpected");
     }
   }
   catch (e)
   {
     ok(false, "error running test " + count + ": " + e);
   }
+
+  // Waiting for sent postMessage event to be processed...
+  setTimeout(function()
+  {
+    // Waiting for responding postMessage event to be processed...
+    setTimeout(function()
+    {
+      // We have our response!
+      callback();
+    }, 0);
+  }, 0);
 }
 
 function messageReceiver(evt)
 {
   var expect;
 
   switch (count)
   {
@@ -64,20 +75,30 @@ function messageReceiver(evt)
       expect = "PASS 2";
       break;
 
     default:
       expect = "unexpected";
       break;
   }
 
-  is(evt.data, expect, "uh-oh, we didn't get the right postMessage!");
+  is(evt.data, expect,
+     "uh-oh, we (" + count + ") didn't get the right postMessage!");
 }
 
-document.addEventListener("message", messageReceiver, false);
+window.addEventListener("message", messageReceiver, false);
 
-addLoadEvent(test);
-addLoadEvent(test);
-addLoadEvent(SimpleTest.finish);
+function run()
+{
+  test(function()
+  {
+    test(function()
+    {
+      SimpleTest.finish();
+    }, 0);
+  });
+}
+
+window.addEventListener("load", run, false);
 </script>
 </pre>
 </body>
 </html>
--- a/dom/tests/mochitest/whatwg/test_postMessage_special.xhtml
+++ b/dom/tests/mochitest/whatwg/test_postMessage_special.xhtml
@@ -24,17 +24,18 @@ SimpleTest.waitForExplicitFinish();
 var B64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
 
 /**
  * Encodes an array of bytes into a string using the base 64 encoding scheme.
  *
  * @param bytes
  *   An array of bytes to encode.
  */
-function b64(str) {
+function b64(str)
+{
   var byteArray = new Array(str.length);
   for (var i = 0, sz = str.length; i < sz; i++)
     byteArray[i] = str.charCodeAt(i);
 
   var index = 0;
   function get3Bytes()
   {
     if (byteArray.length - index < 3)
@@ -127,35 +128,42 @@ function messageReceiver(evt)
       // speaking.  For the specific case of about:blank it's also possible
       // that the origin is determined by the code that opens the window.  It's
       // not codified yet which of these two causes the identifier tokens on
       // the event generated by the new window to be those of this window, but
       // in either case this is what they should be.
       is(evt.origin, "http://localhost:8888",
          "wrong origin for event from about:blank");
       is(evt.source, aboutBlankWindow, "wrong source");
+
+      // ...and onto the next test
       aboutBlankResponseReceived = true;
+      setupBlank2();
     }
     else if (evt.data === "about:blank2-response")
     {
       is(evt.origin, "http://localhost:8888",
          "wrong origin for event from about:blank #2");
       is(evt.source, aboutBlank2Window, "wrong source");
       aboutBlank2ResponseReceived = true;
+
+      setupData();
     }
     else if (evt.data === "data-response")
     {
       // HTML5 defines the origin of a data: URI as the origin of the window or
       // script that opened the data: URI.
       is(evt.origin, "http://localhost:8888",
          "wrong origin for event from data URL (should be the origin of the " +
          "window/script that opened the URL, in this case the origin of this " +
          "file)");
       is(evt.source, dataWindow, "wrong source");
+
       dataResponseReceived = true;
+      finish();
     }
     else
     {
       ok(false, "unexpected message: " + evt.data);
     }
   }
   catch (e)
   {
@@ -177,34 +185,44 @@ function getContents(description, respon
     "\n" +
     "  if (evt.source !== window.parent)\n" +
     "    response += ' wrong-source';\n" +
     "  if (evt.origin !== 'http://localhost:8888')\n" +
     "    response += ' wrong-origin(' + evt.origin + ')';\n" +
     "  if (evt.data !== 'from-opener')\n" +
     "    response += ' wrong-data(' + evt.data + ')';\n" +
     "\n" +
-    "  window.parent.postMessage(response);\n" +
+    "  window.parent.postMessage(response, 'http://localhost:8888');\n" +
     "}\n" +
     "\n" +
     "function ready()\n" +
     "{\n" +
-    "  window.parent.postMessage('next-test');\n" +
+    "  window.parent.postMessage('next-test', 'http://localhost:8888');\n" +
     "}\n" +
     "\n" +
     "window.addEventListener('load', ready, false);\n" +
-    "document.addEventListener('message', receive, false);\n" +
+    "window.addEventListener('message', receive, false);\n" +
     "  </script>\n" +
     "</head>\n" +
     "<body><p>" + description + "</p></body>\n" +
     "</html>";
 
   return contents;
 }
 
+/** Finish the test, but don't finish twice if we timed out. */
+function finish()
+{
+  if (!finished)
+  {
+    finished = true;
+    SimpleTest.finish();
+  }
+}
+
 var xhtmlns = "http://www.w3.org/1999/xhtml";
 
 function insert(el)
 {
   var content = $("content");
   content.parentNode.insertBefore(el, content);
 }
 
@@ -231,18 +249,17 @@ function setupBlank()
 
 function blankFailed()
 {
   if (!aboutBlankResponseReceived && !finished)
   {
     ok(false,
        "test timed out (postMessage not accessible on window.parent in " +
        "the first about:blank iframe?)");
-    finished = true;
-    SimpleTest.finish();
+    finish();
   }
 }
 
 function setupBlank2()
 {
   var aboutBlank2Frame = document.createElementNS(xhtmlns, "iframe");
   aboutBlank2Frame.addEventListener("load", nextTest, false);
   aboutBlank2Frame.setAttribute("src", "about:blank");
@@ -271,18 +288,17 @@ function setupData()
 
 function dataFailed()
 {
   if (!dataResponseReceived && !finished)
   {
     ok(false,
        "test timed out (postMessage not accessible on window.parent in " +
        "the data: iframe?)");
-    finished = true;
-    SimpleTest.finish();
+    finish();
   }
 }
 
 var count = 0;
 function nextTest()
 {
   switch (count++)
   {
@@ -301,72 +317,40 @@ function nextTest()
     default:
       ok(false, "unreached");
       break;
   }
 }
 
 function testBlank()
 {
-  try
-  {
-    aboutBlankWindow.postMessage("from-opener");
-  }
-  catch (e)
-  {
-    ok(false, "exception thrown trying to post message #1 to about:blank");
-  }
-
-  ok(aboutBlankResponseReceived, "about:blank never got a response!");
-
-  setTimeout(setupBlank2, 0);
+  aboutBlankWindow.postMessage("from-opener", "http://localhost:8888");
 }
 
 function testBlank2()
 {
   // For some reason we can't access this across browsers prior to the iframe
   // loading, so set its value here.
   aboutBlank2Window = window.frames[1];
 
   var doc = aboutBlank2Window.document;
 
   doc.body.textContent = "This was about:blank #2";
 
   var script = doc.createElement("script");
-  script.textContent = "window.parent.postMessage('about:blank2-response');";
+  script.textContent =
+    "window.parent.postMessage('about:blank2-response', " +
+    "                          'http://localhost:8888');";
   doc.body.appendChild(script);
-
-  // Note that this script gets run synchronously, so we're done with the
-  // test here.
-  ok(aboutBlank2ResponseReceived, "postMessage from about:blank #2 failed");
-
-  setTimeout(setupData, 0);
 }
 
 function testData()
 {
-  try
-  {
-    dataWindow.postMessage("from-opener");
-  }
-  catch (e)
-  {
-    ok(false, "exception thrown trying to post message to data: URL window");
-  }
-
-  ok(dataResponseReceived, "we never got a response!");
-
-  // Don't re-report -- we must have already failed, and this can
-  // screw up the displayed results.
-  if (finished)
-    return;
-
-  finished = true;
-  SimpleTest.finish();
+  dataWindow.postMessage("from-opener", "http://localhost:8888");
 }
 
-document.addEventListener("message", messageReceiver, false);
+window.addEventListener("message", messageReceiver, false);
 
 addLoadEvent(setupBlank);
 ]]></script>
 </pre>
 </body>
 </html>
--- a/dom/tests/mochitest/whatwg/test_postMessage_throw.html
+++ b/dom/tests/mochitest/whatwg/test_postMessage_throw.html
@@ -25,17 +25,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 /** Test for Bug 387706 **/
 
 SimpleTest.waitForExplicitFinish();
 
 function atLoad()
 {
   try
   {
-    sameDomain.postMessage("foo");
+    sameDomain.postMessage("foo", "http://localhost:8888");
     ok(true, "should not have thrown for same-domain exception");
   }
   catch (e)
   {
     ok(false, "uh-oh, threw a same-domain exception: " + e);
   }
 
   setTimeout(next, 0);
@@ -46,17 +46,17 @@ function next()
   ok(true, "no pending-exception wackiness for same-domain");
   setTimeout(next2, 0);
 }
 
 function next2()
 {
   try
   {
-    crossDomain.postMessage("foo");
+    crossDomain.postMessage("foo", "http://example.org:8000");
     ok(true, "should not have thrown for cross-domain exception");
   }
   catch (e)
   {
     ok(false, "uh-oh, threw a cross-domain exception: " + e);
   }
 
   setTimeout(next3, 0);
--- a/dom/tests/mochitest/whatwg/test_postMessage_userpass.html
+++ b/dom/tests/mochitest/whatwg/test_postMessage_userpass.html
@@ -23,24 +23,25 @@ https://bugzilla.mozilla.org/show_bug.cg
 /** Test for Bug 417075 **/
 
 SimpleTest.waitForExplicitFinish();
 
 function receiveMessage(evt)
 {
   is(evt.origin, "http://example.org", "wrong origin");
   is(evt.data, "child-message", "wrong data");
+  is(evt.lastEventId, "", "postMessage creates events with empty lastEventId");
   ok(evt.source === window.frames.userPassKid, "wrong source");
   SimpleTest.finish();
 }
 
-document.addEventListener("message", receiveMessage, false);
+window.addEventListener("message", receiveMessage, false);
 
 function sendMessage(evt)
 {
-  window.frames.userPassKid.postMessage("parent-message");
+  window.frames.userPassKid.postMessage("parent-message", "http://example.org");
 }
 
 window.addEventListener("load", sendMessage, false);
 </script>
 </pre>
 </body>
 </html>
--- a/editor/ui/composer.js
+++ b/editor/ui/composer.js
@@ -92,23 +92,16 @@ pref("editor.toolbars.showbutton.ul", tr
 pref("editor.toolbars.showbutton.ol", true);
 pref("editor.toolbars.showbutton.outdent", true);
 pref("editor.toolbars.showbutton.indent", true);
 
 pref("editor.toolbars.showbutton.absolutePosition", true);
 pref("editor.toolbars.showbutton.decreaseZIndex", true);
 pref("editor.toolbars.showbutton.increaseZIndex", true);
 
-pref("editor.auto_save",                    false);
-pref("editor.auto_save_delay",              10);    // minutes
-pref("editor.use_html_editor",              0);
-pref("editor.html_editor",                  "");
-pref("editor.use_image_editor",             0);
-pref("editor.image_editor",                 "");
-
 pref("editor.history.url_maximum", 10);
 
 pref("editor.publish.",                      "");
 pref("editor.lastFileLocation.image",        "");
 pref("editor.lastFileLocation.html",         "");
 pref("editor.save_associated_files",         true);
 pref("editor.always_show_publish_dialog",    false);
 
--- a/editor/ui/composer/content/ComposerCommands.js
+++ b/editor/ui/composer/content/ComposerCommands.js
@@ -3856,17 +3856,17 @@ var nsPreferencesCommand =
     return true;
   },
 
   getCommandStateParams: function(aCommand, aParams, aRefCon) {},
   doCommandParams: function(aCommand, aParams, aRefCon) {},
 
   doCommand: function(aCommand)
   {
-    goPreferences('editor', 'chrome://editor/content/pref-composer.xul','editor');
+    goPreferences('composer_pane');
     window.content.focus();
   }
 };
 
 
 var nsFinishHTMLSource =
 {
   isCommandEnabled: function(aCommand, dummy)
--- a/editor/ui/composer/content/editorPrefsOverlay.xul
+++ b/editor/ui/composer/content/editorPrefsOverlay.xul
@@ -19,38 +19,58 @@
   <!-- editor startup toggle -->
   <groupbox id="generalStartupPreferences">
     <checkbox id="generalStartupEditor"
               insertafter="generalStartupMail,generalStartupBrowser"
               label="&editorCheck.label;"
               accesskey="&editorCheck.accesskey;"
               preference="general.startup.editor"/>
   </groupbox>
+  <!-- category tree entries for editor -->
+  <treechildren id="prefsPanelChildren">
+    <treeitem container="true"
+              id="composerItem"
+              insertafter="mailnews,navigator"
+              label="&compose.label;"
+              prefpane="composer_pane"
+              url="chrome://editor/content/pref-composer.xul"
+              helpTopic="composer_prefs_general">
+      <treechildren id="composerChildren">
+      <!-- XXX Move pref panes from below to here as they are migrated -->
+        <treeitem id="toolbarsItem"
+                  label="&toolbars.label;"
+                  prefpane="toolbars_pane"
+                  url="chrome://editor/content/pref-toolbars.xul"
+                  helpTopic="composer_prefs_toolbars"/>
+      </treechildren>
+    </treeitem>
+  </treechildren>
 
   <!-- category tree entries for editor -->
   <treechildren id="panelChildren">
     <treeitem container="true" id="editor" insertafter="mailnews,navigator">
       <treerow>       
-        <treecell url="chrome://editor/content/pref-composer.xul" label="&compose.label;" /> 
+        <treecell label="Migrated: &compose.label;"/> 
       </treerow>
+      <!-- XXX Move these up as we migrate the panels -->
       <treechildren>
         <treeitem>
           <treerow>
             <treecell url="chrome://editor/content/pref-editing.xul" label="&editing.label;"/> 
           </treerow>
         </treeitem>
         <!--     
         <treeitem>
           <treerow>
             <treecell url="chrome://editor/content/pref-publish.xul" label="&publish.label;"/> 
           </treerow>
         </treeitem>  
         -->
         <treeitem>
           <treerow>
-            <treecell url="chrome://editor/content/pref-toolbars.xul" label="&toolbars.label;"/> 
+            <treecell label="Migrated: &toolbars.label;"/> 
           </treerow>
         </treeitem>  
       </treechildren>
     </treeitem>
   </treechildren>
            
 </overlay>         
--- a/editor/ui/composer/content/pref-composer.xul
+++ b/editor/ui/composer/content/pref-composer.xul
@@ -35,159 +35,92 @@
  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 ***** -->
 
 <?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
 <?xul-overlay href="chrome://global/content/globalOverlay.xul"?>
 
-<!DOCTYPE page SYSTEM "chrome://editor/locale/pref-composer.dtd" >
+<!DOCTYPE overlay SYSTEM "chrome://editor/locale/pref-composer.dtd">
 
-<page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-      onload="parent.initPanel('chrome://editor/content/pref-composer.xul');"
-      headertitle="&pref.composer.title;">
+<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+  <prefpane id="composer_pane"
+            label="&pref.composer.title;"
+            script="chrome://editor/content/EdDialogCommon.js chrome://editor/content/editorUtilities.js">
 
-  <script type="application/x-javascript">
-  <!-- Add "shouldAutoSave", "autoSaveAmount" to _elementIDs when implemented -->
-  <![CDATA[
-    var _elementIDs = ["maintainTableStructure", "preserveFormatting", "saveAssociatedFiles", "showPublishDialog", "recentFiles", "useCSS", "crInPCreatesNewP"];
-  ]]>
-  </script>        
-  <script type="application/x-javascript" src="chrome://editor/content/EdDialogCommon.js"/>
-  <script type="application/x-javascript" src="chrome://editor/content/editorUtilities.js"/>
-        
-  <!-- Recent files menu -->
-  <groupbox>
-    <caption label="&recentFiles.title;"/>
-    <hbox align="center">
-      <label value = "&documentsInMenu.label;"
-        accesskey  = "&documentsInMenu.accesskey;"
-        control    = "recentFiles"/>
-      <textbox
-        id="recentFiles"
-        name="recent string" 
-        size="3" 
-        value="10" 
-        preftype="int" 
-        prefstring="editor.history.url_maximum"
-        oninput=" ValidateNumber(this, null, 0, 99); LimitStringLength('recentFiles',2);"
-      />
-    </hbox>
-  </groupbox>
+    <preferences id="composer_preferences">
+      <preference id="editor.history.url_maximum"
+                  name="editor.history.url_maximum"
+                  type="int"/>
+      <preference id="editor.prettyprint"
+                  name="editor.prettyprint"
+                  type="bool"
+                  inverted="true"/>
+      <preference id="editor.save_associated_files"
+                  name="editor.save_associated_files"
+                  type="bool"/>
+      <preference id="editor.always_show_publish_dialog"
+                  name="editor.always_show_publish_dialog"
+                  type="bool"/>
+      <preference id="editor.table.maintain_structure"
+                  name="editor.table.maintain_structure"
+                  type="bool"/>
+      <preference id="editor.use_css"
+                  name="editor.use_css"
+                  type="bool"/>
+      <preference id="editor.CR_creates_new_p"
+                  name="editor.CR_creates_new_p"
+                  type="bool"/>
+    </preferences>
 
-<!-- HTML formatting on output -->
-  <groupbox>
-    <caption label="&savingFiles.title;"/>
-    <spacer class="spacer"/>
-    <checkbox
-      label       = "&preserveExisting.label;"
-      id          = "preserveFormatting"
-      accesskey   = "&preserveExisting.accesskey;"
-      tooltiptext = "&preserveExisting.tooltip;"
-      preftype    = "bool"
-      prefstring  = "editor.prettyprint"
-      reversed    = "true"
-    />
-    <checkbox 
-      label      = "&saveAssociatedFiles.label;"
-      id         = "saveAssociatedFiles"
-      accesskey  = "&saveAssociatedFiles.accesskey;"
-      preftype   = "bool" 
-      prefindex  = "0" 
-      prefstring = "editor.save_associated_files"
-    />
-    <checkbox 
-      label      = "&showPublishDialog.label;"
-      id         = "showPublishDialog"
-      accesskey  = "&showPublishDialog.accesskey;"
-      preftype   = "bool" 
-      prefindex  = "0" 
-      prefstring = "editor.always_show_publish_dialog"
-    />
-  </groupbox>
-  
-  <groupbox align="start">
-    <caption label = "&composerEditing.label;"/>
-    <checkbox 
-      label       = "&maintainStructure.label;"
-      id          = "maintainTableStructure" 
-      accesskey   = "&maintainStructure.accesskey;"
-      tooltiptext = "&maintainStructure.tooltip;"
-      prefstring  = "editor.table.maintain_structure"
-    />
-    <checkbox
-      label      = "&useCSS.label;"
-      id         = "useCSS"
-      accesskey  = "&useCSS.accesskey;"
-      prefstring = "editor.use_css"
-    />
-    <checkbox
-      label      = "&crInPCreatesNewP.label;"
-      id         = "crInPCreatesNewP"
-      accesskey  = "&crInPCreatesNewP.accesskey;"
-      prefstring = "editor.CR_creates_new_p"
-      />
-  </groupbox>
+    <!-- Recent files menu -->
+    <groupbox>
+      <caption label="&recentFiles.title;"/>
+      <hbox align="center">
+        <label value="&documentsInMenu.label;"
+               accesskey="&documentsInMenu.accesskey;"
+               control="recentFiles"/>
+        <textbox id="recentFiles"
+                 name="recent string" 
+                 size="3" 
+                 value="10" 
+                 preference="editor.history.url_maximum" 
+                 oninput=" ValidateNumber(this, null, 0, 99); LimitStringLength('recentFiles',2);"/>
+      </hbox>
+    </groupbox>
 
-<!-- Take out Auto-Save; not supported at this time
-  <groupbox>
-    <caption label="&saving;"/>
-    <hbox align="center">
-      <checkbox 
-        label      = "&AutoSaveCheck;"
-        id         = "shouldAutoSave"
-        prefstring = "editor.auto_save"
-        name       = "autosave" 
-      />
-      <textbox
-        id="autoSaveAmount"
-        name="time" 
-        size="3" 
-        value="5" 
-        preftype="int" 
-        prefstring="editor.auto_save_delay"
-      />
-      <label value="&minText;" />
-    </hbox>
-  </groupbox>
--->
-
-<!-- External Editors are not supported at this time
+    <!-- HTML formatting on output -->
     <groupbox>
-      <caption label="&exterLegend.label;"/> 
-    <hbox>
-      <checkbox 
-        name       = "htmlSourceEditorCheckbox"
-        label      = "&htmlSource;"
-        preftype   = "int" 
-        prefindex  = "0" 
-        prefstring = "editor.use_html_editor"
-      />
-      <textbox
-        name = "&chooseButton.label;"
-        preftype   = "string" 
-      />
-      <button 
-        name  = ""
-        label = "&chooseButton.label;"
-      />
-    </hbox>
+      <caption label="&savingFiles.title;"/>
+      <checkbox id="preserveFormatting"
+                label="&preserveExisting.label;"
+                accesskey="&preserveExisting.accesskey;"
+                tooltiptext="&preserveExisting.tooltip;"
+                preference="editor.prettyprint"/>
+      <checkbox id="saveAssociatedFiles"
+                label="&saveAssociatedFiles.label;"
+                accesskey="&saveAssociatedFiles.accesskey;"
+                preference="editor.save_associated_files"/>
+      <checkbox id="showPublishDialog" 
+                label="&showPublishDialog.label;"
+                accesskey="&showPublishDialog.accesskey;"
+                preference="editor.always_show_publish_dialog"/>
+    </groupbox>
 
-    <hbox>
-      <checkbox 
-        name  = "htmlImageEditorCheckbox" 
-        label = "&imageeditor;"
-        preftype   = "int" 
-        prefindex  = "0" 
-        prefstring ="editor.use_image_editor"
-      />
-
-      <textbox
-        name="chooseButton.label" 
-        prefstring = "editor.image_editor"
-      />
-      <button label="&chooseButton.label;" />
-    </hbox> 
-
-  </groupbox>
-  -->
-</page>
+    <groupbox align="start">
+      <caption label="&composerEditing.label;"/>
+      <checkbox id="maintainTableStructure"
+                label="&maintainStructure.label;"
+                accesskey="&maintainStructure.accesskey;"
+                tooltiptext="&maintainStructure.tooltip;"
+                preference="editor.table.maintain_structure"/>
+      <checkbox id="useCSS"
+                label="&useCSS.label;"
+                accesskey="&useCSS.accesskey;"
+                preference="editor.use_css"/>
+      <checkbox id="crInPCreatesNewP"
+                label="&crInPCreatesNewP.label;"
+                accesskey="&crInPCreatesNewP.accesskey;"
+                preference="editor.CR_creates_new_p"/>
+    </groupbox>
+  </prefpane>
+</overlay>
--- a/editor/ui/composer/content/pref-toolbars.xul
+++ b/editor/ui/composer/content/pref-toolbars.xul
@@ -32,98 +32,200 @@
    - and other provisions required by the LGPL or the GPL. 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 ***** -->
 
 <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
 
-<!DOCTYPE page SYSTEM "chrome://editor/locale/pref-toolbars.dtd">
+<!DOCTYPE overlay SYSTEM "chrome://editor/locale/pref-toolbars.dtd">
 
-<page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-      onload="parent.initPanel('chrome://editor/content/pref-toolbars.xul');"
-      headertitle="&pref.toolbars.title;">
+<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+  <prefpane id="toolbars_pane"
+            label="&pref.toolbars.title;">
 
-  <script type="application/x-javascript">
-  <![CDATA[
-    var _elementIDs = [
-      "showNew", "showOpen", "showSave", "showPublish", "showPreview", "showSmaller", "showLarger", "showBold",
-      "showCut", "showCopy", "showPaste", "showPrint", "showFind", "showBullets", "showNumbers", "showItalic",
-      "showImage", "showHline", "showTable", "showLink", "showAnchor", "showOutdent", "showIndent", "showUnderline",
-      "showAbsolutePosition", "showDecreaseZIndex", "showIncreaseZIndex" ];
-  ]]>
-  </script>        
+    <preferences id="toolbars_preferences">
+      <preference id="editor.toolbars.showbutton.new"
+                  name="editor.toolbars.showbutton.new"
+                  type="bool"/>
+      <preference id="editor.toolbars.showbutton.open"
+                  name="editor.toolbars.showbutton.open"
+                  type="bool"/>
+      <preference id="editor.toolbars.showbutton.save"
+                  name="editor.toolbars.showbutton.save"
+                  type="bool"/>
+      <preference id="editor.toolbars.showbutton.publish"
+                  name="editor.toolbars.showbutton.publish"
+                  type="bool"/>
+      <preference id="editor.toolbars.showbutton.preview"
+                  name="editor.toolbars.showbutton.preview"
+                  type="bool"/>
+      <preference id="editor.toolbars.showbutton.cut"
+                  name="editor.toolbars.showbutton.cut"
+                  type="bool"/>
+      <preference id="editor.toolbars.showbutton.copy"
+                  name="editor.toolbars.showbutton.copy"
+                  type="bool"/>
+      <preference id="editor.toolbars.showbutton.paste"
+                  name="editor.toolbars.showbutton.paste"
+                  type="bool"/>
+      <preference id="editor.toolbars.showbutton.print"
+                  name="editor.toolbars.showbutton.print"
+                  type="bool"/>
+      <preference id="editor.toolbars.showbutton.find"
+                  name="editor.toolbars.showbutton.find"
+                  type="bool"/>
+      <preference id="editor.toolbars.showbutton.image"
+                  name="editor.toolbars.showbutton.image"
+                  type="bool"/>
+      <preference id="editor.toolbars.showbutton.hline"
+                  name="editor.toolbars.showbutton.hline"
+                  type="bool"/>
+      <preference id="editor.toolbars.showbutton.table"
+                  name="editor.toolbars.showbutton.table"
+                  type="bool"/>
+      <preference id="editor.toolbars.showbutton.link"
+                  name="editor.toolbars.showbutton.link"
+                  type="bool"/>
+      <preference id="editor.toolbars.showbutton.namedAnchor"
+                  name="editor.toolbars.showbutton.namedAnchor"
+                  type="bool"/>
+      <preference id="editor.toolbars.showbutton.DecreaseFontSize"
+                  name="editor.toolbars.showbutton.DecreaseFontSize"
+                  type="bool"/>
+      <preference id="editor.toolbars.showbutton.IncreaseFontSize"
+                  name="editor.toolbars.showbutton.IncreaseFontSize"
+                  type="bool"/>
+      <preference id="editor.toolbars.showbutton.bold"
+                  name="editor.toolbars.showbutton.bold"
+                  type="bool"/>
+      <preference id="editor.toolbars.showbutton.absolutePosition"
+                  name="editor.toolbars.showbutton.absolutePosition"
+                  type="bool"/>
+      <preference id="editor.toolbars.showbutton.ul"
+                  name="editor.toolbars.showbutton.ul"
+                  type="bool"/>
+      <preference id="editor.toolbars.showbutton.ol"
+                  name="editor.toolbars.showbutton.ol"
+                  type="bool"/>
+      <preference id="editor.toolbars.showbutton.italic"
+                  name="editor.toolbars.showbutton.italic"
+                  type="bool"/>
+      <preference id="editor.toolbars.showbutton.decreaseZIndex"
+                  name="editor.toolbars.showbutton.decreaseZIndex"
+                  type="bool"/>
+      <preference id="editor.toolbars.showbutton.outdent"
+                  name="editor.toolbars.showbutton.outdent"
+                  type="bool"/>
+      <preference id="editor.toolbars.showbutton.indent"
+                  name="editor.toolbars.showbutton.indent"
+                  type="bool"/>
+      <preference id="editor.toolbars.showbutton.underline"
+                  name="editor.toolbars.showbutton.underline"
+                  type="bool"/>
+      <preference id="editor.toolbars.showbutton.increaseZIndex"
+                  name="editor.toolbars.showbutton.increaseZIndex"
+                  type="bool"/>
+    </preferences>
 
-  <groupbox orient="horizontal">
-    <caption label="&composition.caption;"/>
-    <vbox flex="1">
-      <checkbox label="&new.label;"       id="showNew"
-                prefstring="editor.toolbars.showbutton.new"/>
-      <checkbox label="&open.label;"      id="showOpen"
-                prefstring="editor.toolbars.showbutton.open"/>
-      <checkbox label="&save.label;"      id="showSave"
-                prefstring="editor.toolbars.showbutton.save"/>
-      <checkbox label="&publish.label;"   id="showPublish"
-                prefstring="editor.toolbars.showbutton.publish"/>
-      <checkbox label="&preview.label;"   id="showPreview"
-                prefstring="editor.toolbars.showbutton.preview"/>
-    </vbox>
-    <vbox flex="1">
-      <checkbox label="&cut.label;"       id="showCut"
-                prefstring="editor.toolbars.showbutton.cut"/>
-      <checkbox label="&copy.label;"      id="showCopy"
-                prefstring="editor.toolbars.showbutton.copy"/>
-      <checkbox label="&paste.label;"     id="showPaste"
-                prefstring="editor.toolbars.showbutton.paste"/>
-      <checkbox label="&print.label;"     id="showPrint"
-                prefstring="editor.toolbars.showbutton.print"/>
-      <checkbox label="&find.label;"      id="showFind"
-                prefstring="editor.toolbars.showbutton.find"/>
-    </vbox>
-    <vbox flex="1">
-      <checkbox label="&image.label;"     id="showImage"
-                prefstring="editor.toolbars.showbutton.image"/>
-      <checkbox label="&hline.label;"     id="showHline"
-                prefstring="editor.toolbars.showbutton.hline"/>
-      <checkbox label="&table.label;"     id="showTable"
-                prefstring="editor.toolbars.showbutton.table"/>
-      <checkbox label="&link.label;"      id="showLink"
-                prefstring="editor.toolbars.showbutton.link"/>
-      <checkbox label="&anchor.label;"    id="showAnchor"
-                prefstring="editor.toolbars.showbutton.namedAnchor"/>
-    </vbox>
-  </groupbox>
+    <groupbox orient="horizontal">
+      <caption label="&composition.caption;"/>
+      <vbox flex="1">
+        <checkbox id="showNew"
+                  label="&new.label;"
+                  preference="editor.toolbars.showbutton.new"/>
+        <checkbox id="showOpen"
+                  label="&open.label;"
+                  preference="editor.toolbars.showbutton.open"/>
+        <checkbox id="showSave"
+                  label="&save.label;"
+                  preference="editor.toolbars.showbutton.save"/>
+        <checkbox id="showPublish"
+                  label="&publish.label;"
+                  preference="editor.toolbars.showbutton.publish"/>
+        <checkbox id="showPreview"
+                  label="&preview.label;"   
+                  preference="editor.toolbars.showbutton.preview"/>
+      </vbox>
+      <vbox flex="1">
+        <checkbox id="showCut"
+                  label="&cut.label;"
+                  preference="editor.toolbars.showbutton.cut"/>
+        <checkbox id="showCopy"
+                  label="&copy.label;"
+                  preference="editor.toolbars.showbutton.copy"/>
+        <checkbox id="showPaste"
+                  label="&paste.label;"
+                  preference="editor.toolbars.showbutton.paste"/>
+        <checkbox id="showPrint"
+                  label="&print.label;"
+                  preference="editor.toolbars.showbutton.print"/>
+        <checkbox id="showFind"
+                  label="&find.label;"
+                  preference="editor.toolbars.showbutton.find"/>
+      </vbox>
+      <vbox flex="1">
+        <checkbox id="showImage"
+                  label="&image.label;"
+                  preference="editor.toolbars.showbutton.image"/>
+        <checkbox id="showHline"
+                  label="&hline.label;"
+                  preference="editor.toolbars.showbutton.hline"/>
+        <checkbox id="showTable"
+                  label="&table.label;"
+                  preference="editor.toolbars.showbutton.table"/>
+        <checkbox id="showLink"
+                  label="&link.label;"
+                  preference="editor.toolbars.showbutton.link"/>
+        <checkbox id="showAnchor"
+                  label="&anchor.label;"
+                  preference="editor.toolbars.showbutton.namedAnchor"/>
+      </vbox>
+    </groupbox>
 
-  <groupbox orient="horizontal">
-    <caption label="&formatting.caption;"/>
-    <vbox flex="1">
-      <checkbox label="&smaller.label;"   id="showSmaller"
-                prefstring="editor.toolbars.showbutton.DecreaseFontSize"/>
-      <checkbox label="&larger.label;"    id="showLarger"
-                prefstring="editor.toolbars.showbutton.IncreaseFontSize"/>
-      <checkbox label="&bold.label;"      id="showBold"
-                prefstring="editor.toolbars.showbutton.bold"/>
-      <checkbox label="&absolutePosition.label;" id="showAbsolutePosition"
-                prefstring="editor.toolbars.showbutton.absolutePosition"/>
-    </vbox>
-    <vbox flex="1">
-      <checkbox label="&bullets.label;"   id="showBullets"
-                prefstring="editor.toolbars.showbutton.ul"/>
-      <checkbox label="&numbers.label;"   id="showNumbers"
-                prefstring="editor.toolbars.showbutton.ol"/>
-      <checkbox label="&italic.label;"    id="showItalic"
-                prefstring="editor.toolbars.showbutton.italic"/>
-      <checkbox label="&decreaseZIndex.label;" id="showDecreaseZIndex"
-                prefstring="editor.toolbars.showbutton.decreaseZIndex"/>
-    </vbox>
-    <vbox flex="1">
-      <checkbox label="&outdent.label;"   id="showOutdent"
-                prefstring="editor.toolbars.showbutton.outdent"/>
-      <checkbox label="&indent.label;"    id="showIndent"
-                prefstring="editor.toolbars.showbutton.indent"/>
-      <checkbox label="&underline.label;" id="showUnderline"
-                prefstring="editor.toolbars.showbutton.underline"/>
-      <checkbox label="&increaseZIndex.label;" id="showIncreaseZIndex"
-                prefstring="editor.toolbars.showbutton.increaseZIndex"/>
-    </vbox>
-  </groupbox>
-</page>
+    <groupbox orient="horizontal">
+      <caption label="&formatting.caption;"/>
+      <vbox flex="1">
+        <checkbox id="showSmaller"
+                  label="&smaller.label;"
+                  preference="editor.toolbars.showbutton.DecreaseFontSize"/>
+        <checkbox id="showLarger"
+                  label="&larger.label;"
+                  preference="editor.toolbars.showbutton.IncreaseFontSize"/>
+        <checkbox id="showBold"
+                  label="&bold.label;"
+                  preference="editor.toolbars.showbutton.bold"/>
+        <checkbox id="showAbsolutePosition"
+                  label="&absolutePosition.label;"
+                  preference="editor.toolbars.showbutton.absolutePosition"/>
+      </vbox>
+      <vbox flex="1">
+        <checkbox id="showBullets"
+                  label="&bullets.label;"
+                  preference="editor.toolbars.showbutton.ul"/>
+        <checkbox id="showNumbers"
+                  label="&numbers.label;"
+                  preference="editor.toolbars.showbutton.ol"/>
+        <checkbox id="showItalic"
+                  label="&italic.label;"
+                  preference="editor.toolbars.showbutton.italic"/>
+        <checkbox id="showDecreaseZIndex"
+                  label="&decreaseZIndex.label;"
+                  preference="editor.toolbars.showbutton.decreaseZIndex"/>
+      </vbox>
+      <vbox flex="1">
+        <checkbox id="showOutdent"
+                  label="&outdent.label;"
+                  preference="editor.toolbars.showbutton.outdent"/>
+        <checkbox id="showIndent"
+                  label="&indent.label;"
+                  preference="editor.toolbars.showbutton.indent"/>
+        <checkbox id="showUnderline"
+                  label="&underline.label;"
+                  preference="editor.toolbars.showbutton.underline"/>
+        <checkbox id="showIncreaseZIndex"
+                  label="&increaseZIndex.label;"
+                  preference="editor.toolbars.showbutton.increaseZIndex"/>
+      </vbox>
+    </groupbox>
+  </prefpane>
+</overlay>
--- a/editor/ui/jar.mn
+++ b/editor/ui/jar.mn
@@ -1,14 +1,15 @@
 comm.jar:
 % content editor %content/editor/ xpcnativewrappers=yes
 % overlay chrome://communicator/content/tasksOverlay.xul chrome://editor/content/editorTasksOverlay.xul
 % overlay chrome://messenger/content/mailWindowOverlay.xul chrome://editor/content/editorMailOverlay.xul
 #ifdef MOZ_SUITE
 % overlay chrome://communicator/content/pref/preftree.xul chrome://editor/content/editorPrefsOverlay.xul
+% overlay chrome://communicator/content/pref/preferences.xul chrome://editor/content/editorPrefsOverlay.xul
 % overlay chrome://communicator/content/pref/pref-appearance.xul chrome://editor/content/editorPrefsOverlay.xul
 % overlay chrome://navigator/content/navigatorOverlay.xul chrome://editor/content/editorNavigatorOverlay.xul
 % content editor-region %content/editor-region/ xpcnativewrappers=yes
 #endif
       content/editor/editor.xul                                (composer/content/editor.xul) 
       content/editor/editor.js                                 (composer/content/editor.js) 
       content/editor/publishprefs.js                           (composer/content/publishprefs.js) 
       content/editor/editorUtilities.js                        (composer/content/editorUtilities.js) 
--- a/extensions/cookie/test/file_domain_inner.html
+++ b/extensions/cookie/test/file_domain_inner.html
@@ -1,14 +1,14 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <META HTTP-EQUIV="Set-Cookie" CONTENT="meta=tag">
-  <script type="text/javascript">
+<!DOCTYPE HTML>
+<html>
+<head>
+  <META HTTP-EQUIV="Set-Cookie" CONTENT="meta=tag">
+  <script type="text/javascript">
     document.cookie = "can=has";
 
     // send a message to our test document, to say we're done loading
-    window.opener.postMessage("message");
-  </script>
-<body>
+    window.opener.postMessage("message", "http://localhost:8888");
+  </script>
+<body>
 <iframe name="frame1" src="http://example.org/tests/extensions/cookie/test/file_domain_inner_inner.html"></iframe>
-</body>
-</html>
+</body>
+</html>
--- a/extensions/cookie/test/file_domain_inner_inner.html
+++ b/extensions/cookie/test/file_domain_inner_inner.html
@@ -1,14 +1,14 @@
-<!DOCTYPE HTML>
-<html>
-<head>
+<!DOCTYPE HTML>
+<html>
+<head>
   <META HTTP-EQUIV="Set-Cookie" CONTENT="meta2=tag2">
-  <script type="text/javascript">
+  <script type="text/javascript">
     document.cookie = "can2=has2";
 
     // send a message to our test document, to say we're done loading
-    window.parent.opener.postMessage("message");
-  </script>
-</head>
+    window.parent.opener.postMessage("message", "http://localhost:8888");
+  </script>
+</head>
 <body>
-</body>
-</html>
+</body>
+</html>
--- a/extensions/cookie/test/file_image_inner.html
+++ b/extensions/cookie/test/file_image_inner.html
@@ -1,15 +1,15 @@
-<!DOCTYPE HTML>
-<html>
-<head>
+<!DOCTYPE HTML>
+<html>
+<head>
   <META HTTP-EQUIV="Set-Cookie" CONTENT="meta=tag">
   <script type="text/javascript">
     document.cookie = "can=has";
 
     // send a message to our test document, to say we're done loading
-    window.opener.postMessage("message");
+    window.opener.postMessage("message", "http://localhost:8888");
   </script>
-</head>
+</head>
 <body>
 <iframe name="frame1" src="http://example.org/tests/extensions/cookie/test/file_image_inner_inner.html"></iframe>
-</body>
-</html>
+</body>
+</html>
--- a/extensions/cookie/test/file_image_inner_inner.html
+++ b/extensions/cookie/test/file_image_inner_inner.html
@@ -1,20 +1,20 @@
-<!DOCTYPE HTML>
-<html>
-<head>
+<!DOCTYPE HTML>
+<html>
+<head>
   <link rel="stylesheet" type="text/css" media="all" href="http://example.org/tests/extensions/cookie/test/test1.css" />
   <link rel="stylesheet" type="text/css" media="all" href="http://example.com/tests/extensions/cookie/test/test2.css" />
   <META HTTP-EQUIV="Set-Cookie" CONTENT="meta2=tag2">
   <script type="text/javascript">
-    function runTest() {
+    function runTest() {
       document.cookie = "can2=has2";
 
       // send a message to our test document, to say we're done loading
-      window.parent.opener.postMessage("message");
+      window.parent.opener.postMessage("message", "http://localhost:8888");
     }
-  </script>
-</head>
+  </script>
+</head>
 <body>
 <img src="http://example.org/tests/extensions/cookie/test/image1.png" onload="runTest()" />
 <img src="http://example.com/tests/extensions/cookie/test/image2.png" onload="runTest()" />
-</body>
-</html>
+</body>
+</html>
--- a/extensions/cookie/test/file_loadflags_inner.html
+++ b/extensions/cookie/test/file_loadflags_inner.html
@@ -1,17 +1,17 @@
-<!DOCTYPE HTML>
-<html>
-<head>
+<!DOCTYPE HTML>
+<html>
+<head>
   <META HTTP-EQUIV="Set-Cookie" CONTENT="meta=tag">
   <script type="text/javascript">
     function runTest() {
       document.cookie = "can=has";
 
       // send a message to our test document, to say we're done loading
-      window.opener.postMessage("message");
+      window.opener.postMessage("message", "http://localhost:8888");
     }
   </script>
-</head>
+</head>
 <body>
 <img src="http://example.org/tests/extensions/cookie/test/image1.png" onload="runTest()" />
-</body>
-</html>
+</body>
+</html>
--- a/extensions/cookie/test/file_localhost_inner.html
+++ b/extensions/cookie/test/file_localhost_inner.html
@@ -1,14 +1,14 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <META HTTP-EQUIV="Set-Cookie" CONTENT="meta=tag">
-  <script type="text/javascript">
+<!DOCTYPE HTML>
+<html>
+<head>
+  <META HTTP-EQUIV="Set-Cookie" CONTENT="meta=tag">
+  <script type="text/javascript">
     document.cookie = "can=has";
 
     // send a message to our test document, to say we're done loading
-    window.opener.postMessage("message");
-  </script>
-<body>
+    window.opener.postMessage("message", "http://localhost:8888");
+  </script>
+<body>
 <iframe name="frame1" src="http://localhost:8888/tests/extensions/cookie/test/file_domain_inner_inner.html"></iframe>
-</body>
-</html>
+</body>
+</html>
--- a/extensions/cookie/test/file_loopback_inner.html
+++ b/extensions/cookie/test/file_loopback_inner.html
@@ -1,14 +1,14 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <META HTTP-EQUIV="Set-Cookie" CONTENT="meta=tag">
-  <script type="text/javascript">
+<!DOCTYPE HTML>
+<html>
+<head>
+  <META HTTP-EQUIV="Set-Cookie" CONTENT="meta=tag">
+  <script type="text/javascript">
     document.cookie = "can=has";
 
     // send a message to our test document, to say we're done loading
-    window.opener.postMessage("message");
-  </script>
-<body>
+    window.opener.postMessage("message", "http://localhost:8888");
+  </script>
+<body>
 <iframe name="frame1" src="http://127.0.0.1:8888/tests/extensions/cookie/test/file_domain_inner_inner.html"></iframe>
-</body>
-</html>
+</body>
+</html>
--- a/extensions/cookie/test/file_subdomain_inner.html
+++ b/extensions/cookie/test/file_subdomain_inner.html
@@ -1,14 +1,14 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <META HTTP-EQUIV="Set-Cookie" CONTENT="meta=tag">
-  <script type="text/javascript">
+<!DOCTYPE HTML>
+<html>
+<head>
+  <META HTTP-EQUIV="Set-Cookie" CONTENT="meta=tag">
+  <script type="text/javascript">
     document.cookie = "can=has";
 
     // send a message to our test document, to say we're done loading
-    window.opener.postMessage("message");
-  </script>
-<body>
+    window.opener.postMessage("message", "http://localhost:8888");
+  </script>
+<body>
 <iframe name="frame1" src="http://test2.example.org/tests/extensions/cookie/test/file_domain_inner_inner.html"></iframe>
-</body>
-</html>
+</body>
+</html>
--- a/extensions/cookie/test/file_testcommon.js
+++ b/extensions/cookie/test/file_testcommon.js
@@ -58,10 +58,10 @@ function runTest() {
   }
   is(count, gExpectedCookies, "incorrect number of cookies");
 
   gPopup.close();
   cs.removeAll();
   SimpleTest.finish();
 }
 
-document.addEventListener("message", messageReceiver, false);
+window.addEventListener("message", messageReceiver, false);
 
--- a/extensions/cookie/test/file_testloadflags.js
+++ b/extensions/cookie/test/file_testloadflags.js
@@ -102,10 +102,10 @@ function runTest() {
   is(gHeaders, gExpectedHeaders, "incorrect number of request headers");
 
   o.remove();
   gPopup.close();
   cs.removeAll();
   SimpleTest.finish();
 }
 
-document.addEventListener("message", messageReceiver, false);
+window.addEventListener("message", messageReceiver, false);
 
--- a/gfx/thebes/src/gfxWindowsFonts.cpp
+++ b/gfx/thebes/src/gfxWindowsFonts.cpp
@@ -68,16 +68,17 @@
 #include "nsIPrefLocalizedString.h"
 #include "nsServiceManagerUtils.h"
 
 #include "nsCRT.h"
 
 #include <math.h>
 
 #include "prlog.h"
+#include "prinit.h"
 static PRLogModuleInfo *gFontLog = PR_NewLogModule("winfonts");
 
 #define ROUND(x) floor((x) + 0.5)
 
 
 struct DCFromContext {
     DCFromContext(gfxContext *aContext) {
         dc = NULL;
@@ -1238,17 +1239,17 @@ public:
                 mAttr.SetLength(mMaxGlyphs);
                 mMaxGlyphs *= 2;
                 continue;
             }
 
             if (rv == E_PENDING) {
                 if (shapeDC == mDC) {
                     // we already tried this once, something failed, give up
-                    return GDI_ERROR;
+                    return E_PENDING;
                 }
 
                 SelectFont();
 
                 shapeDC = mDC;
                 continue;
             }
 
@@ -1331,18 +1332,20 @@ public:
 
         return rv;
     }
 
     HRESULT PlaceGDI() {
         SelectFont();
 
         nsAutoTArray<int,500> partialWidthArray;
+        // Callers incorrectly assume this code is infallible,
+        // so we must abort on this OOM condition.
         if (!partialWidthArray.SetLength(mNumGlyphs))
-            return GDI_ERROR;
+            PR_Abort();
         SIZE size;
 
         GetTextExtentExPointI(mDC,
                               (WORD*) mGlyphs.Elements(),
                               mNumGlyphs,
                               INT_MAX,
                               NULL,
                               partialWidthArray.Elements(),
@@ -2126,20 +2129,22 @@ gfxWindowsFontGroup::InitTextRunUniscrib
                 PR_LOG(gFontLog, PR_LOG_DEBUG, ("shaping failed"));
                 // we know we have the glyphs to display this font already
                 // so Uniscribe just doesn't know how to shape the script.
                 // Render the glyphs without shaping.
                 item->DisableShaping();
                 rv = item->Shape();
             }
 
-            NS_ASSERTION(SUCCEEDED(rv), "Failed to shape -- we should never hit this");
+            NS_ASSERTION(SUCCEEDED(rv), "Failed to shape, twice -- we should never hit this");
 
-            rv = item->Place();
-            NS_ASSERTION(SUCCEEDED(rv), "Failed to place -- this is pretty bad.");
+            if (SUCCEEDED(rv)) {
+                rv = item->Place();
+                NS_ASSERTION(SUCCEEDED(rv), "Failed to place -- this is pretty bad.");
+            }
 
             if (FAILED(rv)) {
                 aRun->ResetGlyphRuns();
 
                 /* Uniscribe doesn't like this font, use GDI instead */
                 item->GetCurrentFont()->GetFontEntry()->mForceGDI = PR_TRUE;
                 break;
             }
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -1325,16 +1325,17 @@ JS_InitStandardClasses(JSContext *cx, JS
            js_InitBlockClass(cx, obj) &&
            js_InitBooleanClass(cx, obj) &&
            js_InitCallClass(cx, obj) &&
            js_InitExceptionClasses(cx, obj) &&
            js_InitMathClass(cx, obj) &&
            js_InitNumberClass(cx, obj) &&
            js_InitRegExpClass(cx, obj) &&
            js_InitStringClass(cx, obj) &&
+           js_InitEval(cx, obj) &&
 #if JS_HAS_SCRIPT_OBJECT
            js_InitScriptClass(cx, obj) &&
 #endif
 #if JS_HAS_XML_SUPPORT
            js_InitXMLClasses(cx, obj) &&
 #endif
 #if JS_HAS_FILE_OBJECT
            js_InitFileClass(cx, obj) &&
--- a/js/src/jsdbgapi.cpp
+++ b/js/src/jsdbgapi.cpp
@@ -100,17 +100,18 @@ js_UntrapScriptCode(JSContext *cx, JSScr
     JSTrap *trap;
 
     code = script->code;
     rt = cx->runtime;
     DBG_LOCK(rt);
     for (trap = (JSTrap *)rt->trapList.next;
          trap != (JSTrap *)&rt->trapList;
          trap = (JSTrap *)trap->links.next) {
-        if (trap->script == script) {
+        if (trap->script == script &&
+            (size_t)(trap->pc - script->code) < script->length) {
             if (code == script->code) {
                 jssrcnote *sn, *notes;
                 size_t nbytes;
 
                 nbytes = script->length * sizeof(jsbytecode);
                 notes = SCRIPT_NOTES(script);
                 for (sn = notes; !SN_IS_TERMINATOR(sn); sn = SN_NEXT(sn))
                     continue;
--- a/js/src/jsopcode.cpp
+++ b/js/src/jsopcode.cpp
@@ -4612,17 +4612,17 @@ DecompileCode(JSPrinter *jp, JSScript *s
     /* Call recursive subroutine to do the hard work. */
     oldscript = jp->script;
     jp->script = script;
     oldcode = jp->script->code;
     oldmain = jp->script->main;
     code = js_UntrapScriptCode(cx, jp->script);
     if (code != oldcode) {
         jp->script->code = code;
-        jp->script->main = code + (oldmain - jp->script->code);
+        jp->script->main = code + (oldmain - oldcode);
         pc = code + (pc - oldcode);
     }
 
     ok = Decompile(&ss, pc, len, JSOP_NOP) != NULL;
     if (code != oldcode) {
         JS_free(cx, jp->script->code);
         jp->script->code = oldcode;
         jp->script->main = oldmain;
@@ -4902,85 +4902,108 @@ js_DecompileValueGenerator(JSContext *cx
     return js_DeflateString(cx, JSSTRING_CHARS(fallback),
                             JSSTRING_LENGTH(fallback));
 }
 
 static char *
 DecompileExpression(JSContext *cx, JSScript *script, JSFunction *fun,
                     jsbytecode *pc)
 {
+    jsbytecode *code, *oldcode, *oldmain;
     JSOp op;
     const JSCodeSpec *cs;
     jsbytecode *begin, *end;
     jssrcnote *sn;
     ptrdiff_t len;
     jsbytecode **pcstack;
     intN pcdepth;
     JSPrinter *jp;
     char *name;
 
     JS_ASSERT(script->main <= pc && pc < script->code + script->length);
+
+    pcstack = NULL;
+    oldcode = script->code;
+    oldmain = script->main;
+
+    /* From this point the control must flow through the label out. */
+    code = js_UntrapScriptCode(cx, script);
+    if (code != oldcode) {
+        script->code = code;
+        script->main = code + (oldmain - oldcode);
+        pc = code + (pc - oldcode);
+    }
+
     op = (JSOp) *pc;
-    if (op == JSOP_TRAP)
-        op = JS_GetTrapOpcode(cx, script, pc);
 
     /* None of these stack-writing ops generates novel values. */
     JS_ASSERT(op != JSOP_CASE && op != JSOP_CASEX &&
               op != JSOP_DUP && op != JSOP_DUP2 &&
               op != JSOP_SWAP);
 
     /*
      * |this| could convert to a very long object initialiser, so cite it by
      * its keyword name instead.
      */
-    if (op == JSOP_THIS)
-        return JS_strdup(cx, js_this_str);
+    if (op == JSOP_THIS) {
+        name = JS_strdup(cx, js_this_str);
+        goto out;
+    }
 
     /*
      * JSOP_BINDNAME is special: it generates a value, the base object of a
      * reference.  But if it is the generating op for a diagnostic produced by
      * js_DecompileValueGenerator, the name being bound is irrelevant.  Just
      * fall back to the base object.
      */
-    if (op == JSOP_BINDNAME)
-        return FAILED_EXPRESSION_DECOMPILER;
+    if (op == JSOP_BINDNAME) {
+        name = FAILED_EXPRESSION_DECOMPILER;
+        goto out;
+    }
 
     /* NAME ops are self-contained, others require left or right context. */
     cs = &js_CodeSpec[op];
     begin = pc;
     end = pc + cs->length;
     switch (JOF_MODE(cs->format)) {
       case JOF_PROP:
       case JOF_ELEM:
       case JOF_XMLNAME:
       case 0:
         sn = js_GetSrcNote(script, pc);
-        if (!sn)
-            return FAILED_EXPRESSION_DECOMPILER;
+        if (!sn) {
+            name = FAILED_EXPRESSION_DECOMPILER;
+            goto out;
+        }
         switch (SN_TYPE(sn)) {
           case SRC_PCBASE:
             begin -= js_GetSrcNoteOffset(sn, 0);
             break;
           case SRC_PCDELTA:
             end = begin + js_GetSrcNoteOffset(sn, 0);
             begin += cs->length;
             break;
           default:
-            return FAILED_EXPRESSION_DECOMPILER;
+            name = FAILED_EXPRESSION_DECOMPILER;
+            goto out;
         }
         break;
       default:;
     }
     len = PTRDIFF(end, begin, jsbytecode);
-    if (len <= 0)
-        return FAILED_EXPRESSION_DECOMPILER;
+    if (len <= 0) {
+        name = FAILED_EXPRESSION_DECOMPILER;
+        goto out;
+    }
 
     pcstack = (jsbytecode **) JS_malloc(cx, script->depth * sizeof *pcstack);
-    if (!pcstack)
-        return NULL;
+    if (!pcstack) {
+        name = NULL;
+        goto out;
+    }
 
     /* From this point the control must flow through the label out. */
     pcdepth = ReconstructPCStack(cx, script, begin, pcstack);
     if (pcdepth < 0) {
          name = FAILED_EXPRESSION_DECOMPILER;
          goto out;
     }
 
@@ -4992,16 +5015,22 @@ DecompileExpression(JSContext *cx, JSScr
         if (DecompileCode(jp, script, begin, (uintN) len, (uintN) pcdepth)) {
             name = (jp->sprinter.base) ? jp->sprinter.base : (char *) "";
             name = JS_strdup(cx, name);
         }
         js_DestroyPrinter(jp);
     }
 
   out:
+    if (code != oldcode) {
+        JS_free(cx, script->code);
+        script->code = oldcode;
+        script->main = oldmain;
+    }
+
     JS_free(cx, pcstack);
     return name;
 }
 
 static intN
 ReconstructPCStack(JSContext *cx, JSScript *script, jsbytecode *pc,
                    jsbytecode **pcstack)
 {
@@ -5193,17 +5222,20 @@ ReconstructPCStack(JSContext *cx, JSScri
              * [enterblock] or the pc that ended a simulated let expression
              * when [enterblock] defines zero locals as in:
              *
              *   let ([] = []) expr
              */
             JS_ASSERT(ndefs == 0);
             LOCAL_ASSERT(pcdepth >= 1);
             LOCAL_ASSERT(nuses == 0 ||
-                         *pcstack[pcdepth - 1] == JSOP_ENTERBLOCK);
+                         *pcstack[pcdepth - 1] == JSOP_ENTERBLOCK ||
+                         (*pcstack[pcdepth - 1] == JSOP_TRAP &&
+                          JS_GetTrapOpcode(cx, script, pcstack[pcdepth - 1])
+                          == JSOP_ENTERBLOCK));
             pcstack[pcdepth - 1] = pc;
             break;
         }
         pcdepth += ndefs;
     }
     LOCAL_ASSERT(pc == begin);
     return pcdepth;
 
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -1765,39 +1765,36 @@ nsBlockFrame::ReflowDirtyLines(nsBlockRe
     // This really sucks, but we have to look inside any blocks that have clear
     // elements inside them.
     // XXX what can we do smarter here?
     if (!line->IsDirty() && line->IsBlock() &&
         (line->mFirstChild->GetStateBits() & NS_BLOCK_HAS_CLEAR_CHILDREN)) {
       line->MarkDirty();
     }
 
-    ReplacedElementWidthToClear replacedWidthStruct;
-    ReplacedElementWidthToClear *replacedWidth = nsnull;
+    nsIFrame *replacedBlock = nsnull;
     if (line->IsBlock() &&
         !nsBlockFrame::BlockCanIntersectFloats(line->mFirstChild)) {
-      replacedWidthStruct =
-        nsBlockFrame::WidthToClearPastFloats(aState, line->mFirstChild);
-      replacedWidth = &replacedWidthStruct;
+      replacedBlock = line->mFirstChild;
     }
 
     // We have to reflow the line if it's a block whose clearance
     // might have changed, so detect that.
     if (!line->IsDirty() &&
         (line->GetBreakTypeBefore() != NS_STYLE_CLEAR_NONE ||
-         replacedWidth)) {
+         replacedBlock)) {
       nscoord curY = aState.mY;
       // See where we would be after applying any clearance due to
       // BRs.
       if (inlineFloatBreakType != NS_STYLE_CLEAR_NONE) {
         curY = aState.ClearFloats(curY, inlineFloatBreakType);
       }
 
       nscoord newY =
-        aState.ClearFloats(curY, line->GetBreakTypeBefore(), replacedWidth);
+        aState.ClearFloats(curY, line->GetBreakTypeBefore(), replacedBlock);
       
       if (line->HasClearance()) {
         // Reflow the line if it might not have clearance anymore.
         if (newY == curY
             // aState.mY is the clearance point which should be the
             // top border-edge of the block frame. If sliding the
             // block by deltaY isn't going to put it in the predicted
             // position, then we'd better reflow the line.
@@ -2791,32 +2788,30 @@ nsBlockFrame::ReflowBlockFrame(nsBlockRe
     // returned PR_FALSE (in which case the top-margin-root set our
     // clearance flag). Otherwise clear it now. We'll set it later on
     // ourselves if necessary.
     aLine->ClearHasClearance();
   }
   PRBool treatWithClearance = aLine->HasClearance();
 
   PRBool mightClearFloats = breakType != NS_STYLE_CLEAR_NONE;
-  ReplacedElementWidthToClear replacedWidthStruct;
-  ReplacedElementWidthToClear *replacedWidth = nsnull;
+  nsIFrame *replacedBlock = nsnull;
   if (!nsBlockFrame::BlockCanIntersectFloats(frame)) {
     mightClearFloats = PR_TRUE;
-    replacedWidthStruct = nsBlockFrame::WidthToClearPastFloats(aState, frame);
-    replacedWidth = &replacedWidthStruct;
+    replacedBlock = frame;
   }
 
   // If our top margin was counted as part of some parents top-margin
   // collapse and we are being speculatively reflowed assuming this
   // frame DID NOT need clearance, then we need to check that
   // assumption.
   if (!treatWithClearance && !applyTopMargin && mightClearFloats &&
       aState.mReflowState.mDiscoveredClearance) {
     nscoord curY = aState.mY + aState.mPrevBottomMargin.get();
-    nscoord clearY = aState.ClearFloats(curY, breakType, replacedWidth);
+    nscoord clearY = aState.ClearFloats(curY, breakType, replacedBlock);
     if (clearY != curY) {
       // Looks like that assumption was invalid, we do need
       // clearance. Tell our ancestor so it can reflow again. It is
       // responsible for actually setting our clearance flag before
       // the next reflow.
       treatWithClearance = PR_TRUE;
       // Only record the first frame that requires clearance
       if (!*aState.mReflowState.mDiscoveredClearance) {
@@ -2885,17 +2880,17 @@ nsBlockFrame::ReflowBlockFrame(nsBlockRe
       if (!treatWithClearance && !clearanceFrame && mightClearFloats) {
         // We don't know if we need clearance and this is the first,
         // optimistic pass.  So determine whether *this block* needs
         // clearance. Note that we do not allow the decision for whether
         // this block has clearance to change on the second pass; that
         // decision is only allowed to be made under the optimistic
         // first pass.
         nscoord curY = aState.mY + aState.mPrevBottomMargin.get();
-        nscoord clearY = aState.ClearFloats(curY, breakType, replacedWidth);
+        nscoord clearY = aState.ClearFloats(curY, breakType, replacedBlock);
         if (clearY != curY) {
           // Looks like we need clearance and we didn't know about it already. So
           // recompute collapsed margin
           treatWithClearance = PR_TRUE;
           // Remember this decision, needed for incremental reflow
           aLine->SetHasClearance();
           
           // Apply incoming margins
@@ -2913,17 +2908,17 @@ nsBlockFrame::ReflowBlockFrame(nsBlockRe
       // GetAvailableSpace method will return the right available
       // space. This undone as soon as the horizontal margins are
       // computed.
       topMargin = aState.mPrevBottomMargin.get();
       
       if (treatWithClearance) {
         nscoord currentY = aState.mY;
         // advance mY to the clear position.
-        aState.mY = aState.ClearFloats(aState.mY, breakType, replacedWidth);
+        aState.mY = aState.ClearFloats(aState.mY, breakType, replacedBlock);
         
         // Compute clearance. It's the amount we need to add to the top
         // border-edge of the frame, after applying collapsed margins
         // from the frame and its children, to get it to line up with
         // the bottom of the floats. The former is currentY + topMargin,
         // the latter is the current aState.mY.
         // Note that negative clearance is possible
         clearance = aState.mY - (currentY + topMargin);
@@ -2944,17 +2939,18 @@ nsBlockFrame::ReflowBlockFrame(nsBlockRe
     // Compute the available space for the block
     aState.GetAvailableSpace();
 #ifdef REALLY_NOISY_REFLOW
     printf("setting line %p isImpacted to %s\n", aLine.get(), aState.IsImpactedByFloat()?"true":"false");
 #endif
     PRBool isImpacted = aState.IsImpactedByFloat() ? PR_TRUE : PR_FALSE;
     aLine->SetLineIsImpactedByFloat(isImpacted);
     nsRect availSpace;
-    aState.ComputeBlockAvailSpace(frame, display, replacedWidth, availSpace);
+    aState.ComputeBlockAvailSpace(frame, display, replacedBlock != nsnull,
+                                  availSpace);
     
     // Now put the Y coordinate back to the top of the top-margin +
     // clearance, and flow the block.
     aState.mY -= topMargin;
     availSpace.y -= topMargin;
     if (NS_UNCONSTRAINEDSIZE != availSpace.height) {
       availSpace.height += topMargin;
     }
@@ -6772,17 +6768,16 @@ nsBlockFrame::BlockCanIntersectFloats(ns
 // However, the cases where it varies are the cases where the width fits
 // in the available space given, which means that variation shouldn't
 // matter.
 /* static */
 nsBlockFrame::ReplacedElementWidthToClear
 nsBlockFrame::WidthToClearPastFloats(nsBlockReflowState& aState,
                                      nsIFrame* aFrame)
 {
-  aState.GetAvailableSpace();
   nscoord leftOffset, rightOffset;
   nsCSSOffsetState offsetState(aFrame, aState.mReflowState.rendContext,
                                aState.mContentArea.width);
 
   ReplacedElementWidthToClear result;
   // A table outer frame is an exception in that it is a block child
   // that is not a containing block for its children.
   if (aFrame->GetType() == nsGkAtoms::tableOuterFrame) {
--- a/layout/generic/nsBlockFrame.h
+++ b/layout/generic/nsBlockFrame.h
@@ -292,17 +292,19 @@ public:
    * Returns whether aFrame is a block frame that will wrap its contents
    * around floats intruding on it from the outside.  (aFrame need not
    * be a block frame, but if it's not, the result will be false.)
    */
   static PRBool BlockCanIntersectFloats(nsIFrame* aFrame);
 
   /**
    * Returns the width that needs to be cleared past floats for blocks
-   * that cannot intersect floats.
+   * that cannot intersect floats.  aState must already have
+   * GetAvailableSpace called on it for the vertical position that we
+   * care about (which need not be its current mY)
    */
   struct ReplacedElementWidthToClear {
     nscoord marginLeft, borderBoxWidth, marginRight;
     nscoord MarginBoxWidth() const
       { return marginLeft + borderBoxWidth + marginRight; }
   };
   static ReplacedElementWidthToClear
     WidthToClearPastFloats(nsBlockReflowState& aState, nsIFrame* aFrame);
--- a/layout/generic/nsBlockReflowState.cpp
+++ b/layout/generic/nsBlockReflowState.cpp
@@ -249,19 +249,17 @@ nsBlockReflowState::ComputeReplacedBlock
 }
 
 // Compute the amount of available space for reflowing a block frame
 // at the current Y coordinate. This method assumes that
 // GetAvailableSpace has already been called.
 void
 nsBlockReflowState::ComputeBlockAvailSpace(nsIFrame* aFrame,
                                            const nsStyleDisplay* aDisplay,
-                                           nsBlockFrame::
-                                             ReplacedElementWidthToClear
-                                                               *aReplacedWidth,
+                                           PRBool aBlockAvoidsFloats,
                                            nsRect& aResult)
 {
 #ifdef REALLY_NOISY_REFLOW
   printf("CBAS frame=%p has float count %d\n", aFrame, mBand.GetFloatCount());
   mBand.List();
 #endif
   aResult.y = mY;
   aResult.height = GetFlag(BRS_UNCONSTRAINEDHEIGHT)
@@ -280,19 +278,20 @@ nsBlockReflowState::ComputeBlockAvailSpa
   // things to become extremely narrow when they'd fit quite well a
   // little bit lower).  Should the else be a quirk or something that
   // applies to a specific set of frame classes and no new ones?
   // If we did that, then for those frames where the condition below is
   // true but nsBlockFrame::BlockCanIntersectFloats is false,
   // nsBlockFrame::WidthToClearPastFloats would need to use the
   // shrink-wrap formula, max(MIN_WIDTH, min(avail width, PREF_WIDTH))
   // rather than just using MIN_WIDTH.
-  NS_ASSERTION(nsBlockFrame::BlockCanIntersectFloats(aFrame) == !aReplacedWidth,
+  NS_ASSERTION(nsBlockFrame::BlockCanIntersectFloats(aFrame) == 
+                 !aBlockAvoidsFloats,
                "unexpected replaced width");
-  if (!aReplacedWidth) {
+  if (!aBlockAvoidsFloats) {
     if (mBand.GetFloatCount()) {
       // Use the float-edge property to determine how the child block
       // will interact with the float.
       const nsStyleBorder* borderStyle = aFrame->GetStyleBorder();
       switch (borderStyle->mFloatEdge) {
         default:
         case NS_STYLE_FLOAT_EDGE_CONTENT:  // content and only content does runaround of floats
           // The child block will flow around the float. Therefore
@@ -350,19 +349,26 @@ nsBlockReflowState::ComputeBlockAvailSpa
       // Since there are no floats present the float-edge property
       // doesn't matter therefore give the block element all of the
       // available space since it will flow around the float itself.
       aResult.x = borderPadding.left;
       aResult.width = mContentArea.width;
     }
   }
   else {
+    nsBlockFrame::ReplacedElementWidthToClear replacedWidthStruct;
+    nsBlockFrame::ReplacedElementWidthToClear *replacedWidth = nsnull;
+    if (aFrame->GetType() == nsGkAtoms::tableOuterFrame) {
+      replacedWidth = &replacedWidthStruct;
+      replacedWidthStruct = nsBlockFrame::WidthToClearPastFloats(*this, aFrame);
+    }
+
     nscoord leftOffset, rightOffset;
     ComputeReplacedBlockOffsetsForFloats(aFrame, leftOffset, rightOffset,
-                                         aReplacedWidth);
+                                         replacedWidth);
     aResult.x = borderPadding.left + leftOffset;
     aResult.width = mContentArea.width - leftOffset - rightOffset;
   }
 
 #ifdef REALLY_NOISY_REFLOW
   printf("  CBAS: result %d %d %d %d\n", aResult.x, aResult.y, aResult.width, aResult.height);
 #endif
 }
@@ -1094,17 +1100,17 @@ nsBlockReflowState::PlaceBelowCurrentLin
     }
     fc = fc->Next();
   }
   return PR_TRUE;
 }
 
 nscoord
 nsBlockReflowState::ClearFloats(nscoord aY, PRUint8 aBreakType,
-                     nsBlockFrame::ReplacedElementWidthToClear *aReplacedWidth)
+                                nsIFrame *aReplacedBlock)
 {
 #ifdef DEBUG
   if (nsBlockFrame::gNoisyReflow) {
     nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
     printf("clear floats: in: aY=%d(%d)\n",
            aY, aY - BorderPadding().top);
   }
 #endif
@@ -1117,25 +1123,27 @@ nsBlockReflowState::ClearFloats(nscoord 
   
   const nsMargin& bp = BorderPadding();
   nscoord newY = aY;
 
   if (aBreakType != NS_STYLE_CLEAR_NONE) {
     newY = bp.top + mSpaceManager->ClearFloats(newY - bp.top, aBreakType);
   }
 
-  if (aReplacedWidth) {
+  if (aReplacedBlock) {
     for (;;) {
       GetAvailableSpace(newY, PR_FALSE);
+      nsBlockFrame::ReplacedElementWidthToClear replacedWidth =
+        nsBlockFrame::WidthToClearPastFloats(*this, aReplacedBlock);
       if (mBand.GetFloatCount() == 0 ||
-          PR_MAX(mAvailSpaceRect.x, aReplacedWidth->marginLeft) +
-            aReplacedWidth->borderBoxWidth +
+          PR_MAX(mAvailSpaceRect.x, replacedWidth.marginLeft) +
+            replacedWidth.borderBoxWidth +
             PR_MAX(mContentArea.width -
                      PR_MIN(mContentArea.width, mAvailSpaceRect.XMost()),
-                   aReplacedWidth->marginRight) <=
+                   replacedWidth.marginRight) <=
           mContentArea.width) {
         break;
       }
       // See the analogous code for inlines in nsBlockFrame::DoReflowInlineFrames
       if (mAvailSpaceRect.height > 0) {
         // See if there's room in the next band.
         newY += mAvailSpaceRect.height;
       } else {
--- a/layout/generic/nsBlockReflowState.h
+++ b/layout/generic/nsBlockReflowState.h
@@ -103,19 +103,19 @@ public:
   PRBool FlowAndPlaceFloat(nsFloatCache*   aFloatCache,
                            PRBool*         aIsLeftFloat,
                            nsReflowStatus& aReflowStatus,
                            PRBool          aForceFit);
   PRBool PlaceBelowCurrentLineFloats(nsFloatCacheFreeList& aFloats, PRBool aForceFit);
 
   // Returns the first coordinate >= aY that clears the
   // floats indicated by aBreakType and has enough width between floats
-  // (or no floats remaining) to accomodate aReplacedWidth.
+  // (or no floats remaining) to accomodate aReplacedBlock.
   nscoord ClearFloats(nscoord aY, PRUint8 aBreakType,
-    nsBlockFrame::ReplacedElementWidthToClear *aReplacedWidth = nsnull);
+                      nsIFrame *aReplacedBlock = nsnull);
 
   PRBool IsAdjacentWithTop() const {
     return mY ==
       ((mFlags & BRS_ISFIRSTINFLOW) ? mReflowState.mComputedBorderPadding.top : 0);
   }
 
   /**
    * Adjusts the border/padding to return 0 for the top if
@@ -135,28 +135,29 @@ public:
   // XXX maybe we should do the same adjustment for continuations here
   const nsMargin& Margin() const {
     return mReflowState.mComputedMargin;
   }
 
   // Reconstruct the previous bottom margin that goes above |aLine|.
   void ReconstructMarginAbove(nsLineList::iterator aLine);
 
-  // Caller must have called GetAvailableSpace for the current mY
+  // Caller must have called GetAvailableSpace for the correct position
+  // (which need not be the current mY).  Callers need only pass
+  // aReplacedWidth for outer table frames.
   void ComputeReplacedBlockOffsetsForFloats(nsIFrame* aFrame,
                                             nscoord& aLeftResult,
                                             nscoord& aRightResult,
-                                        nsBlockFrame::ReplacedElementWidthToClear
-                                                       *aReplacedWidth = nsnull);
+                                       nsBlockFrame::ReplacedElementWidthToClear
+                                                      *aReplacedWidth = nsnull);
 
   // Caller must have called GetAvailableSpace for the current mY
   void ComputeBlockAvailSpace(nsIFrame* aFrame,
                               const nsStyleDisplay* aDisplay,
-                              nsBlockFrame::ReplacedElementWidthToClear
-                                                               *aReplacedWidth,
+                              PRBool aBlockAvoidsFloats,
                               nsRect& aResult);
 
 protected:
   void RecoverFloats(nsLineList::iterator aLine, nscoord aDeltaY);
 
 public:
   void RecoverStateFrom(nsLineList::iterator aLine, nscoord aDeltaY);
 
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/430813-3-ref.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+	<title>Testcase, bug 430813</title>
+	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+</head>
+<body>
+<div style="margin-bottom: 1px">text</div>
+<div style="float:left;width:90px;height:300px"></div>
+<div style="margin-left:90px">
+This text should be near the top of the page, not pushed below the float.
+</div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/430813-3.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+	<title>Testcase, bug 430813</title>
+	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+</head>
+<body>
+<div style="margin-bottom: 1px">text</div>
+<div style="float:left;width:90px;height:300px"></div>
+<div style="overflow:hidden">
+This text should be near the top of the page, not pushed below the float.
+</div>
+</body>
+</html>
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -814,8 +814,9 @@ fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") == 
 == 428423-1b.html 428423-1-ref.html
 == 428521-1a.html 428521-1-ref.html
 == 428521-1b.html 428521-1-ref.html
 == 428521-1c.html 428521-1-ref.html
 == 429849-1.html 429849-1-ref.html
 == 430412-1.html 430412-1-ref.html
 == 430813-1.html 430813-1-ref.html
 == 430813-2.html 430813-2-ref.html
+== 430813-3.html 430813-3-ref.html
--- a/layout/xul/base/src/nsMenuPopupFrame.cpp
+++ b/layout/xul/base/src/nsMenuPopupFrame.cpp
@@ -1124,18 +1124,17 @@ nsMenuPopupFrame::SetPopupPosition(nsIFr
          * - - - - - - - - - - screenBottomTwips (bottom of the screen)
          *   |    \ 
          *   |     }  moveDistY
          *   |    / 
          *   +----  screenViewLocY + mRect.height
          */
 
         if ( (screenViewLocY + mRect.height) > screenBottomTwips ) {
-          // XXX Bug 84121 comment 48 says the next line has to use screenHeightTwips, why not screenBottomTwips?
-          PRInt32 moveDistY = (screenViewLocY + mRect.height) - screenHeightTwips;
+          PRInt32 moveDistY = (screenViewLocY + mRect.height) - screenBottomTwips;
           if ( screenViewLocY - moveDistY < screenTopTwips )
             moveDistY = screenViewLocY - screenTopTwips;          
           screenViewLocY -= moveDistY;
           ypos -= moveDistY; 
         } 
       }
       
       // Resize it to fit on the screen. By this point, we've given the popup as much
--- a/other-licenses/branding/firefox/license.r
+++ b/other-licenses/branding/firefox/license.r
@@ -37,41 +37,43 @@ resource 'STR#' (5000, "English") {
 // Beware of 1024(?) byte (character?) line length limitation.  Split up long
 // lines.
 // If straight quotes are used ("), remember to escape them (\").
 // Newline is \n, to leave a blank line, use two of them.
 // 0xD2 and 0xD3 are curly double-quotes ("), 0xD4 and 0xD5 are curly
 //   single quotes ('), 0xD5 is also the apostrophe.
 data 'TEXT' (5000, "English") {
   "MOZILLA FIREFOX END-USER SOFTWARE LICENSE AGREEMENT\n"
-  "Version 2.0\n"
+  "Version 3.0, May 2008\n"
   "\n"
   "A SOURCE CODE VERSION OF CERTAIN FIREFOX BROWSER FUNCTIONALITY THAT YOU MAY USE, MODIFY AND DISTRIBUTE IS AVAILABLE TO YOU FREE-OF-CHARGE FROM WWW.MOZILLA.ORG UNDER THE MOZILLA PUBLIC LICENSE and other open source software licenses.\n"
   "\n"
   "The accompanying executable code version of Mozilla Firefox and related documentation (the “Product”) is made available to you under the terms of this MOZILLA FIREFOX END-USER SOFTWARE LICENSE AGREEMENT (THE “AGREEMENT”).  BY CLICKING THE “ACCEPT” BUTTON, OR BY INSTALLING OR USING THE MOZILLA FIREFOX BROWSER, YOU ARE CONSENTING TO BE BOUND BY THE AGREEMENT.  IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT, DO NOT CLICK THE “ACCEPT” BUTTON, AND DO NOT INSTALL OR USE ANY PART OF THE MOZILLA FIREFOX BROWSER.\n"
   "\n"
   "DURING THE MOZILLA FIREFOX INSTALLATION PROCESS, AND AT LATER TIMES, YOU MAY BE GIVEN THE OPTION OF INSTALLING ADDITIONAL COMPONENTS FROM THIRD-PARTY SOFTWARE PROVIDERS.  THE INSTALLATION AND USE OF THOSE THIRD-PARTY COMPONENTS MAY BE GOVERNED BY ADDITIONAL LICENSE AGREEMENTS.\n"
   "\n"
   "1.  LICENSE GRANT.  The Mozilla Corporation grants you a non-exclusive license to use the executable code version of the Product.  This Agreement will also govern any software upgrades provided by Mozilla that replace and/or supplement the original Product, unless such upgrades are accompanied by a separate license, in which case the terms of that license will govern.\n"
   "\n"
   "2.  TERMINATION.  If you breach this Agreement your right to use the Product will terminate immediately and without notice, but all provisions of this Agreement except the License Grant (Paragraph 1) will survive termination and continue in effect.  Upon termination, you must destroy all copies of the Product.\n"
   "\n"
-  "3.  PROPRIETARY RIGHTS.  Portions of the Product are available in source code form under the terms of the Mozilla Public License and other open source licenses (collectively, “Open Source Licenses”) at http://mozilla.org.  Nothing in this Agreement will be construed to limit any rights granted under the Open Source Licenses.  Subject to the foregoing, Mozilla, for itself and on behalf of its licensors, hereby reserves all intellectual property rights in the Product, except for the rights expressly granted in this Agreement.  You may not remove or alter any trademark, logo, copyright or other proprietary notice in or on the Product.  This license does not grant you any right to use the trademarks, service marks or logos of Mozilla or its licensors.\n"
+  "3.  PROPRIETARY RIGHTS.  Portions of the Product are available in source code form under the terms of the Mozilla Public License and other open source licenses (collectively, “Open Source Licenses”) at http://www.mozilla.org/MPL.  Nothing in this Agreement will be construed to limit any rights granted under the Open Source Licenses.  Subject to the foregoing, Mozilla, for itself and on behalf of its licensors, hereby reserves all intellectual property rights in the Product, except for the rights expressly granted in this Agreement.  You may not remove or alter any trademark, logo, copyright or other proprietary notice in or on the Product.  This license does not grant you any right to use the trademarks, service marks or logos of Mozilla or its licensors.\n"
+  "\n"
+  "4.  PRIVACY POLICY.  You agree to the Mozilla Firefox Privacy Policy, made available online at http://www.mozilla.com/legal/privacy/, as that policy may be changed from time to time.  When Mozilla changes the policy in a material way a notice will be posted on the website at www.mozilla.com and when any change is made in the privacy policy, the updated policy will be posted at the above link.  It is your responsibility to ensure that you understand the terms of the privacy policy, so you should periodically check the current version of the policy for changes.\n"
   "\n"
-  "4.  PRIVACY POLICY.  You agree to the Mozilla Firefox Privacy Policy, made available online at http://www.mozilla.com/firefox/privacy/, as that policy may be changed from time to time.  When Mozilla changes the policy in a material way a notice will be posted on the website at www.mozilla.com and when any change is made in the privacy policy, the updated policy will be posted at the above link.  It is your responsibility to ensure that you understand the terms of the privacy policy, so you should periodically check the current version of the policy for changes.\n"
+  "5.  WEBSITE INFORMATION SERVICES.  Mozilla and its contributors, licensors and partners work to provide the most accurate and up-to-date phishing and malware information.  However, they cannot guarantee that this information is comprehensive and error-free: some risky sites may not be identified, and some safe sites may be identified in error.\n"
   "\n"
-  "5.  DISCLAIMER OF WARRANTY.  THE PRODUCT IS PROVIDED “AS IS” WITH ALL FAULTS.  TO THE EXTENT PERMITTED BY LAW, MOZILLA AND MOZILLA’S DISTRIBUTORS, AND LICENSORS HEREBY DISCLAIM ALL WARRANTIES, WHETHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES THAT THE PRODUCT IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE AND NON-INFRINGING.  YOU BEAR THE ENTIRE RISK AS TO SELECTING THE PRODUCT FOR YOUR PURPOSES AND AS TO THE QUALITY AND PERFORMANCE OF THE PRODUCT.  THIS LIMITATION WILL APPLY NOTWITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE OF ANY REMEDY.  SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF IMPLIED WARRANTIES, SO THIS DISCLAIMER MAY NOT APPLY TO YOU.\n"
+  "6.  DISCLAIMER OF WARRANTY.  THE PRODUCT IS PROVIDED “AS IS” WITH ALL FAULTS.  TO THE EXTENT PERMITTED BY LAW, MOZILLA AND MOZILLA’S DISTRIBUTORS, AND LICENSORS HEREBY DISCLAIM ALL WARRANTIES, WHETHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES THAT THE PRODUCT IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE AND NON-INFRINGING.  YOU BEAR THE ENTIRE RISK AS TO SELECTING THE PRODUCT FOR YOUR PURPOSES AND AS TO THE QUALITY AND PERFORMANCE OF THE PRODUCT.  THIS LIMITATION WILL APPLY NOTWITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE OF ANY REMEDY.  SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF IMPLIED WARRANTIES, SO THIS DISCLAIMER MAY NOT APPLY TO YOU.\n"
   "\n"
-  "6.  LIMITATION OF LIABILITY.  EXCEPT AS REQUIRED BY LAW, MOZILLA AND ITS DISTRIBUTORS, DIRECTORS, LICENSORS, CONTRIBUTORS AND AGENTS (COLLECTIVELY, THE “MOZILLA GROUP”) WILL NOT BE LIABLE FOR ANY INDIRECT, SPECIAL, INCIDENTAL, CONSEQUENTIAL OR EXEMPLARY DAMAGES ARISING OUT OF OR IN ANY WAY RELATING TO THIS AGREEMENT OR THE USE OF OR INABILITY TO USE THE PRODUCT, INCLUDING WITHOUT LIMITATION DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, LOST PROFITS, LOSS OF DATA, AND COMPUTER FAILURE OR MALFUNCTION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND REGARDLESS OF THE THEORY (CONTRACT, TORT OR OTHERWISE) UPON WHICH SUCH CLAIM IS BASED.  THE MOZILLA GROUP’S COLLECTIVE LIABILITY UNDER THIS AGREEMENT WILL NOT EXCEED THE GREATER OF $500 (FIVE HUNDRED DOLLARS) AND THE FEES PAID BY YOU UNDER THE LICENSE (IF ANY).  SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL, CONSEQUENTIAL OR SPECIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.\n"
+  "7.  LIMITATION OF LIABILITY.  EXCEPT AS REQUIRED BY LAW, MOZILLA AND ITS DISTRIBUTORS, DIRECTORS, LICENSORS, CONTRIBUTORS AND AGENTS (COLLECTIVELY, THE “MOZILLA GROUP”) WILL NOT BE LIABLE FOR ANY INDIRECT, SPECIAL, INCIDENTAL, CONSEQUENTIAL OR EXEMPLARY DAMAGES ARISING OUT OF OR IN ANY WAY RELATING TO THIS AGREEMENT OR THE USE OF OR INABILITY TO USE THE PRODUCT, INCLUDING WITHOUT LIMITATION DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, LOST PROFITS, LOSS OF DATA, AND COMPUTER FAILURE OR MALFUNCTION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND REGARDLESS OF THE THEORY (CONTRACT, TORT OR OTHERWISE) UPON WHICH SUCH CLAIM IS BASED.  THE MOZILLA GROUP’S COLLECTIVE LIABILITY UNDER THIS AGREEMENT WILL NOT EXCEED THE GREATER OF $500 (FIVE HUNDRED DOLLARS) AND THE FEES PAID BY YOU UNDER THE LICENSE (IF ANY).  SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL, CONSEQUENTIAL OR SPECIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.\n"
   "\n"
-  "7.  EXPORT CONTROLS.  This license is subject to all applicable export restrictions.  You must comply with all export and import laws and restrictions and regulations of any United States or foreign agency or authority relating to the Product and its use.\n"
+  "8.  EXPORT CONTROLS.  This license is subject to all applicable export restrictions.  You must comply with all export and import laws and restrictions and regulations of any United States or foreign agency or authority relating to the Product and its use.\n"
   "\n"
-  "8.  U.S. GOVERNMENT END-USERS.  This Product is a “commercial item,” as that term is defined in 48 C.F.R. 2.101, consisting of “commercial computer software” and “commercial computer software documentation,” as such terms are used in 48 C.F.R. 12.212 (Sept. 1995) and 48 C.F.R. 227.7202 (June 1995).  Consistent with 48 C.F.R. 12.212, 48 C.F.R. 27.405(b)(2) (June 1998) and 48 C.F.R. 227.7202, all U.S. Government End Users acquire the Product with only those rights as set forth therein.\n"
+  "9.  U.S. GOVERNMENT END-USERS.  This Product is a “commercial item,” as that term is defined in 48 C.F.R. 2.101, consisting of “commercial computer software” and “commercial computer software documentation,” as such terms are used in 48 C.F.R. 12.212 (Sept. 1995) and 48 C.F.R. 227.7202 (June 1995).  Consistent with 48 C.F.R. 12.212, 48 C.F.R. 27.405(b)(2) (June 1998) and 48 C.F.R. 227.7202, all U.S. Government End Users acquire the Product with only those rights as set forth therein.\n"
   "\n"
-  "9.  MISCELLANEOUS.  (a) This Agreement constitutes the entire agreement between Mozilla and you concerning the subject matter hereof, and it may only be modified by a written amendment signed by an authorized executive of Mozilla.  (b) Except to the extent applicable law, if any, provides otherwise, this Agreement will be governed by the laws of the state of California, U.S.A., excluding its conflict of law provisions.  (c) This Agreement will not be governed by the United Nations Convention on Contracts for the International Sale of Goods.  "
+  "10.  MISCELLANEOUS.  (a) This Agreement constitutes the entire agreement between Mozilla and you concerning the subject matter hereof, and it may only be modified by a written amendment signed by an authorized executive of Mozilla.  (b) Except to the extent applicable law, if any, provides otherwise, this Agreement will be governed by the laws of the state of California, U.S.A., excluding its conflict of law provisions.  (c) This Agreement will not be governed by the United Nations Convention on Contracts for the International Sale of Goods.  "
   "(d) If any part of this Agreement is held invalid or unenforceable, that part will be construed to reflect the parties’ original intent, and the remaining portions will remain in full force and effect.  (e) A waiver by either party of any term or condition of this Agreement or any breach thereof, in any one instance, will not waive such term or condition or any subsequent breach thereof. (f) Except as required by law, the controlling language of this Agreement is English.  "
   "(g) You may assign your rights under this Agreement to any party that consents to, and agrees to be bound by, its terms; the Mozilla Corporation may assign its rights under this Agreement without condition.  (h) This Agreement will be binding upon and inure to the benefit of the parties, their successors and permitted assigns."
 };
 
 data 'styl' (5000, "English") {
   // Number of styles following = 2
   $"0002"
 
@@ -90,18 +92,18 @@ data 'styl' (5000, "English") {
   // Style, unused?
   $"02"
   // Size = 12 point
   $"000C"
   // Color, RGB
   $"0000 0000 0000"
 
   // Style 2.  This is used to display the body.
-  // Start character = 64
-  $"0000 0040"
+  // Start character = 74
+  $"0000 004A"
   // Height = 16
   $"0010"
   // Ascent = 12
   $"000C"
   // Font family = 1024 (Lucida Grande)
   $"0400"
   // Style bitfield, 0x1=bold 0x2=italic 0x4=underline 0x8=outline
   // 0x10=shadow 0x20=condensed 0x40=extended
--- a/security/manager/ssl/src/nsIdentityChecking.cpp
+++ b/security/manager/ssl/src/nsIdentityChecking.cpp
@@ -272,16 +272,28 @@ static struct nsMyTrustedEVInfo myTruste
     SEC_OID_UNKNOWN,
     "CA:3A:FB:CF:12:40:36:4B:44:B2:16:20:88:80:48:39:19:93:7C:F7",
     "MEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMRswGQYD"
     "VQQDExJRdW9WYWRpcyBSb290IENBIDI=",
     "BQk=",
     nsnull
   },
   {
+    // CN=Network Solutions Certificate Authority,O=Network Solutions L.L.C.,C=US
+    "1.3.6.1.4.1.782.1.2.1.8.1",
+    "Network Solutions EV OID",
+    SEC_OID_UNKNOWN,
+    "74:F8:A3:C3:EF:E7:B3:90:06:4B:83:90:3C:21:64:60:20:E5:DF:CE",
+    "MGIxCzAJBgNVBAYTAlVTMSEwHwYDVQQKExhOZXR3b3JrIFNvbHV0aW9ucyBMLkwu"
+    "Qy4xMDAuBgNVBAMTJ05ldHdvcmsgU29sdXRpb25zIENlcnRpZmljYXRlIEF1dGhv"
+    "cml0eQ==",
+    "V8szb8JcFuZHFhfjkDFo4A==",
+    nsnull
+  },
+  {
     // OU=Sample Certification Authority,O=\"Sample, Inc.\",C=US
     "0.0.0.0",
     0, // for real entries use a string like "Sample INVALID EV OID"
     SEC_OID_UNKNOWN,
     "00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD:EE:FF:00:11:22:33"
     "Cg==",
     "Cg==",
     nsnull
--- a/testing/mochitest/server.js
+++ b/testing/mochitest/server.js
@@ -203,19 +203,19 @@ function serverShutdown(metadata, respon
 //
 
 /**
  * Creates a generator that iterates over the contents of
  * an nsIFile directory.
  */
 function dirIter(dir)
 {
-  var enum = dir.directoryEntries;
-  while (enum.hasMoreElements()) {
-    var file = enum.getNext();
+  var en = dir.directoryEntries;
+  while (en.hasMoreElements()) {
+    var file = en.getNext();
     yield file.QueryInterface(Ci.nsILocalFile);
   }
 }
 
 /**
  * Builds an optionally nested object containing links to the
  * files and directories within dir.
  */
--- a/toolkit/components/downloads/test/unit/head_download_manager.js
+++ b/toolkit/components/downloads/test/unit/head_download_manager.js
@@ -130,24 +130,22 @@ function addDownload(aResultFileName)
   var persist = Cc["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"]
                 .createInstance(Ci.nsIWebBrowserPersist);
   persist.persistFlags = nsIWBP.PERSIST_FLAGS_REPLACE_EXISTING_FILES |
                          nsIWBP.PERSIST_FLAGS_BYPASS_CACHE |
                          nsIWBP.PERSIST_FLAGS_AUTODETECT_APPLY_CONVERSION;
 
   var destFile = dirSvc.get("ProfD", Ci.nsIFile);
   destFile.append(aResultFileName || "download.result");
-  var srcFile = dirSvc.get("ProfD", Ci.nsIFile);
-  srcFile.append("LICENSE");
 
   // it is part of the active downloads the moment addDownload is called
   gDownloadCount++;
 
   var dl = dm.addDownload(nsIDownloadManager.DOWNLOAD_TYPE_DOWNLOAD,
-                          createURI("http://localhost:4444/LICENSE"),
+                          createURI("http://localhost:4444/res/language.properties"),
                           createURI(destFile), null, null,
                           Math.round(Date.now() * 1000), null, persist);
 
   // This will throw if it isn't found, and that would mean test failure, so no
   // try catch block
   var test = dm.getDownload(dl.id);
 
   persist.progressListener = dl.QueryInterface(Ci.nsIWebProgressListener);
--- a/toolkit/components/downloads/test/unit/test_history_expiration.js
+++ b/toolkit/components/downloads/test/unit/test_history_expiration.js
@@ -36,16 +36,21 @@
 
 /**
  * Test bug 251337 to make sure old downloads are expired and removed.
  * Make sure bug 431346 and bug 431597 don't cause crashes when batching.
  */
 
 function run_test()
 {
+  // Like the code, we check to see if nav-history-service exists
+  // (i.e MOZ_PLACES is enabled), so that we don't run this test if it doesn't.
+  if (!("@mozilla.org/browser/nav-history-service;1" in Cc))
+    return;
+
   let dm = Cc["@mozilla.org/download-manager;1"].
            getService(Ci.nsIDownloadManager);
   let db = dm.DBConnection;
 
   // Empty any old downloads
   db.executeSimpleSQL("DELETE FROM moz_downloads");
 
   let stmt = db.createStatement(
--- a/toolkit/components/places/tests/chrome/test_341972a.xul
+++ b/toolkit/components/places/tests/chrome/test_341972a.xul
@@ -46,20 +46,21 @@ var observer =
     if (iid.equals(Ci.nsIAnnotationObserver) ||
         iid.equals(Ci.nsISupports))
       return this;
     throw Cr.NS_ERROR_NO_INTERFACE;
   },
 
   // nsIAnnotationObserver
   onItemAnnotationSet: function(aItemId, aAnnotationName) {
-    if (aAnnotationName == "livemark/siteURI") {
+    if (aAnnotationName == "livemark/siteURI" &&
+        aItemId == gLivemarkId) {
       var newSiteURI = annosvc.getItemAnnotation(aItemId, aAnnotationName);
       ok(newSiteURI == FEEDSITESPEC,
-         "livemark site URI not changed to value in feed");
+         "livemark site URI changed to " + newSiteURI + " not to value in feed");
       annosvc.removeObserver(this);
       bmsvc.removeFolder(gLivemarkId);
       SimpleTest.finish();
     }
   },
   onItemAnnotationRemoved: function(aItemId, aAnnotationName) {},
   onPageAnnotationSet: function(aUri, aAnnotationName) {},
   onPageAnnotationRemoved: function(aUri, aAnnotationName) {}
--- a/toolkit/content/license.html
+++ b/toolkit/content/license.html
@@ -159,22 +159,24 @@
        and version you choose.)
     </p>
     
     <ul>
       <li><a href="about:license#apple-mozilla">Apple/Mozilla NPRuntime License</a></li>
       <li><a href="about:license#breakpad">Breakpad License</a></li>
       <li><a href="about:license#bspatch">bspatch License</a></li>
       <li><a href="about:license#cairo">Cairo Component Licenses</a></li>      
+      <li><a href="about:license#hunspell-nl">Dutch Spellchecking Dictionary</a></li>
       <li><a href="about:license#expat">Expat License</a></li>
       <li><a href="about:license#growl">Growl License</a></li>
       <li><a href="about:license#jpnic">Japan Network Information Centre License</a></li>
       <li><a href="about:license#jep">Java Embedding Plugin License</a></li>
       <li><a href="about:license#jemalloc">jemalloc License</a></li>
       <li><a href="about:license#openvision">OpenVision License</a></li>
+      <li><a href="about:license#hunspell-lt">Lithuanian Spellchecking Dictionary</a></li>
       <li><a href="about:license#xdg">Red Hat xdg_user_dir_lookup License</a></li>
       <li><a href="about:license#sparkle">Sparkle License</a></li>
       <li><a href="about:license#ucal">University of California License</a></li>      
     </ul>
     
     <ul>      
       <li><a href="about:license#other-notices">Other Required Notices</a>
       <li><a href="about:license#optional-notices">Optional Notices</a>
@@ -2045,16 +2047,57 @@ OF USE, DATA OR PROFITS, WHETHER IN AN A
 NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
 WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 </pre>
 
 
 
     <hr>
 
+    <h1><a name="hunspell-nl"></a>Dutch Spellchecking Dictionary</h1>
+
+    <p class="correctme">This license applies to certain files in the directory
+      <span class="path">l10n/nl/extensions/spellcheck/hunspell/</span>. (This
+      code only ships in some localized versions of this product.)</p>
+
+<pre>
+Copyright (c) 2006, 2007 OpenTaal
+Copyright (c) 2001, 2002, 2003, 2005 Simon Brouwer e.a.
+Copyright (c) 1996 Nederlandstalige Tex Gebruikersgroep
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without 
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this 
+list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, 
+this list of conditions and the following disclaimer in the documentation 
+and/or other materials provided with the distribution.
+* Neither the name of the OpenTaal, Simon Brouwer e.a., or Nederlandstalige Tex 
+Gebruikersgroep nor the names of its contributors may be used to endorse or 
+promote products derived from this software without specific prior written 
+permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+</pre>
+
+    <hr>
+
     <h1><a name="expat"></a>Expat License</h1>
 
     <p class="correctme">This license applies to certain files in the directory 
     <span class="path">parser/expat/</span>.</p>
 
 <pre>
 Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
                                and Clark Cooper
@@ -2346,16 +2389,57 @@ HOWEVER CAUSED AND ON ANY THEORY OF LIAB
 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 SUCH DAMAGE.
 </pre>
 
 
     <hr>
 
+    <h1><a name="hunspell-lt"></a>Lithuanian Spellchecking Dictionary</h1>
+
+    <p class="correctme">This license applies to certain files in the directory
+      <span class="path">l10n/lt/extensions/spellcheck/hunspell/</span>. (This
+      code only ships in some localized versions of this product.)</p>
+
+<pre>
+The project has been sponsored by the Information Society Development
+Committee of the Government of Republic of Lithuania.
+
+
+Copyright (c) Albertas Agejevas &lt;alga@uosis.mif.vu.lt&gt;, 2000, 2001
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+3. Neither the name of the Albertas Agejevas nor the names of its contributors
+   may be used to endorse or promote products derived from this software
+   without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY ALBERTAS AGEJEVAS AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED.  IN NO EVENT SHALL ALBERTAS AGEJEVAS OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+</pre>
+
+    <hr>
+
     <h1><a name="xdg"></a>Red Hat xdg_user_dir_lookup License</h1>
 
     <p class="correctme">This license applies to the 
     <span class="path">xdg_user_dir_lookup</span> function in
     <span class="path">xpcom/io/SpecialSystemDirectory.cpp</span>:</p>
     
 <pre>
 Copyright (c) 2007 Red Hat, Inc.
--- a/toolkit/themes/pinstripe/global/console/console.css
+++ b/toolkit/themes/pinstripe/global/console/console.css
@@ -40,16 +40,26 @@
   ======================================================================= */
 
 @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
 
 #JSConsoleWindow {
   -moz-binding: url("chrome://global/skin/globalBindings.xml#unifiedWindow");
 }
 
+#JSConsoleWindow:not([active="true"]) > #console-toolbox > #ToolbarMode {
+  background-image: url("chrome://global/skin/toolbar/toolbar-background-inactive.png");
+  background-color: #cfcfcf;
+  border-bottom: 1px solid rgba(0,0,0,0.35);
+}
+
+#JSConsoleWindow:not([active="true"]) > #console-toolbox > #ToolbarMode > toolbarbutton {
+  opacity: 0.7;
+}
+
 .console-box {
   background-color: -moz-Field;
   color: -moz-FieldText;
   overflow: auto;
 }
  
 /* ::::: console rows ::::: */
 
--- a/toolkit/themes/pinstripe/mozapps/downloads/downloads.css
+++ b/toolkit/themes/pinstripe/mozapps/downloads/downloads.css
@@ -106,16 +106,25 @@ richlistitem[type="download"] button {
   -moz-box-pack: end;
   -moz-padding-end: 4px;
   background-image: url("chrome://global/skin/toolbar/toolbar-background.gif");
   background-color: #9f9f9f;
   background-repeat: repeat-x;
   background-position: top left;
 }
 
+#downloadManager:not([active="true"]) #search {
+  background-image: url("chrome://global/skin/toolbar/toolbar-background-inactive.png");
+  background-color: #cfcfcf;
+}
+
+#downloadManager:not([active="true"]) #search > * {
+  opacity: 0.7;
+}
+
 #clearListButton {
   -moz-appearance: none;
   border: 1px solid #5F5F5F;
   -moz-border-radius: 4px;
   background: url(chrome://global/skin/icons/white-gray-gradient.gif) #A09E9D repeat-x top center;
   min-height: 0;
   min-width: 0;
   padding: 2px;
--- a/toolkit/themes/pinstripe/mozapps/extensions/extensions.css
+++ b/toolkit/themes/pinstripe/mozapps/extensions/extensions.css
@@ -1,12 +1,22 @@
 #extensionsManager {
   -moz-binding: url("chrome://global/skin/globalBindings.xml#unifiedWindow");
 }
 
+#extensionsManager:not([active="true"]) > #topStackBar > #viewGroup {
+  background-image: url("chrome://global/skin/toolbar/toolbar-background-inactive.png");
+  background-color: #cfcfcf;
+  border-bottom: 1px solid rgba(0,0,0,0.35);
+}
+
+#extensionsManager:not([active="true"]) > #topStackBar > #viewGroup > .radiogroupWrapper {
+  opacity: 0.7;
+}
+
 #extensionsBox {
   padding: 0;
   min-width:1px;
 }
 
 #resizerBox {
   margin-top: -12px;
   visibility: hidden;
--- a/toolkit/toolkit-makefiles.sh
+++ b/toolkit/toolkit-makefiles.sh
@@ -528,19 +528,16 @@ MAKEFILES_xpfe="
   xpfe/browser/public/Makefile
   xpfe/browser/src/Makefile
   xpfe/components/Makefile
   xpfe/components/directory/Makefile
   xpfe/components/download-manager/Makefile
   xpfe/components/download-manager/src/Makefile
   xpfe/components/download-manager/public/Makefile
   xpfe/components/download-manager/resources/Makefile
-  xpfe/components/extensions/Makefile
-  xpfe/components/extensions/src/Makefile
-  xpfe/components/extensions/public/Makefile
   xpfe/components/find/Makefile
   xpfe/components/find/public/Makefile
   xpfe/components/find/src/Makefile
   xpfe/components/filepicker/Makefile
   xpfe/components/filepicker/public/Makefile
   xpfe/components/filepicker/src/Makefile
   xpfe/components/history/Makefile
   xpfe/components/history/src/Makefile
@@ -550,24 +547,18 @@ MAKEFILES_xpfe="
   xpfe/components/related/src/Makefile
   xpfe/components/related/public/Makefile
   xpfe/components/startup/Makefile
   xpfe/components/startup/public/Makefile
   xpfe/components/startup/src/Makefile
   xpfe/components/autocomplete/Makefile
   xpfe/components/autocomplete/public/Makefile
   xpfe/components/autocomplete/src/Makefile
-  xpfe/components/updates/Makefile
-  xpfe/components/updates/src/Makefile
   xpfe/components/winhooks/Makefile
   xpfe/components/windowds/Makefile
-  xpfe/components/alerts/Makefile
-  xpfe/components/alerts/public/Makefile
-  xpfe/components/alerts/src/Makefile
-  xpfe/components/console/Makefile
   xpfe/components/resetPref/Makefile
   xpfe/components/build/Makefile
   xpfe/components/xremote/Makefile
   xpfe/components/xremote/public/Makefile
   xpfe/components/xremote/src/Makefile
   xpfe/appshell/Makefile
   xpfe/appshell/src/Makefile
   xpfe/appshell/public/Makefile
new file mode 100644
--- /dev/null
+++ b/tools/release/configs/tb-moz19-bootstrap.cfg
@@ -0,0 +1,84 @@
+version         = 3.0a1
+milestone       = 1.9
+# _BUILDn and _RELEASE will be appended as-needed
+productTag      = THUNDERBIRD_3_0a1
+# Branch name and pull dates to use for base tag
+branchTag       = HEAD
+#RelbranchOverride = GECKO19b5_20080326_RELBRANCH
+pullDate        = 2008-05-01 03:00 PDT
+l10n_pullDate   = 2008-05-01 03:00 PDT
+build           = 1
+# oldVersion and oldRc refer to the previous release
+oldVersion      = 2.0.0.14
+oldBuild        = 1
+appName         = mail
+product         = thunderbird
+# Absolute path to tinderbox build directory
+# The win32 ones are kept short because of a long path issue detailed in
+# bug# 400846
+linux_buildDir       = /builds/tinderbox/Tb-Mozilla1.9-Release
+macosx_buildDir      = /builds/tinderbox/Tb-Mozilla1.9-Release
+win32_buildDir       = /e/tb19rel
+linux_l10n_buildDir  = /builds/tinderbox/Tb-Mozilla1.9-l10n-Release
+macosx_l10n_buildDir = /builds/tinderbox/Tb-Mozilla1.9-l10n-Release
+win32_l10n_buildDir  = /e/tb19l10nrel
+# Absolute path to store bootstrap's logs
+linux_logDir    = /builds/logs
+macosx_logDir   = /builds/logs
+win32_logDir    = /builds/logs
+mozillaCvsroot  = tbirdbld@cvs.mozilla.org:/cvsroot
+l10nCvsroot     = tbirdbld@cvs.mozilla.org:/l10n
+mofoCvsroot     = tbirdbld@cvs.mozilla.org:/mofo
+anonCvsroot     = :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot
+# private staging area 
+stageHome       = /data/cltbld
+sourceDir       = /builds/source
+updateDir       = /builds/updates
+verifyDir       = /builds/verify
+tagDir          = /builds/tags
+configBumpDir   = /builds/config
+# Build platform, as specified by tinderbox
+linux_buildPlatform   = Linux_2.6.18-53.1.4.el5_Depend
+macosx_buildPlatform  = Darwin_8.8.4_Depend
+win32_buildPlatform   = WINNT_5.2_Depend
+linux_l10n_buildPlatform   = Linux_2.6.18-53.1.4.el5_Depend
+macosx_l10n_buildPlatform  = Darwin_8.8.4_Depend
+win32_l10n_buildPlatform   = WINNT_5.2_Depend
+from            = bootstrap@mozilla.org
+to              = nrthomas@gmail.com
+cc              = rtessner@mozillamessaging.com
+patcherConfig   = moz19-branch-patcher2.cfg
+# Tag to use for building MAR/MBSDIFF and other update tools
+patcherToolsRev = UPDATE_PACKAGING_R4
+linux_verifyConfig    = moz19-thunderbird-linux.cfg
+win32_verifyConfig    = moz19-thunderbird-win32.cfg
+macosx_verifyConfig   = moz19-thunderbird-mac.cfg
+blat            = /d/mozilla-build/blat261/full/blat.exe
+sendmail        = /usr/sbin/sendmail
+# dump Log output to stdout
+dumpLogs        = 1
+# symbol server variables
+symbolServer     = stage-old.mozilla.org
+symbolServerUser = tbirdbld
+symbolServerPath = /mnt/netapp/breakpad/symbols_tbrd
+win32_symbolServerKey  = /c/Documents and Settings/cltbld/.ssh/tbirdbld_dsa
+linux_symbolServerKey  = /home/cltbld/.ssh/tbirdbld_dsa
+macosx_symbolServerKey  = /Users/cltbld/.ssh/tbirdbld_dsa
+# username and server to push update snippets to
+ausUser           = cltbld
+ausServer         = aus2-staging.mozilla.org
+ausServerUrl      = https://aus2.mozilla.org
+buildTree       = MozillaRelease
+# where QA updates/builds go
+stagingUser     = cltbld
+stagingServer   = stage-old.mozilla.org
+# where beta updates/builds go
+ftpServer       = ftp.mozilla.org
+# where release updates/builds go
+bouncerServer   = download.mozilla.org
+# username and server to push builds
+sshUser         = cltbld
+sshServer       = stage-old.mozilla.org
+useTalkback     = 0
+useCvsCompression = 1
+useBetaChannel  = 0
--- a/widget/src/cocoa/nsMenuX.mm
+++ b/widget/src/cocoa/nsMenuX.mm
@@ -1303,149 +1303,151 @@ static OSStatus InstallMyMenuEventHandle
 //
 // Our (hackish) workaround is to shadow the OS's hashtable with another
 // hastable of our own (gShadowKeyEquivDB), and use it to "retain" and
 // "release" NSMenuItem objects as needed.  This resolves bmo bugs 422287 and
 // 423669.  When (if) Apple fixes this bug, we can remove this workaround.
 
 static NSMutableDictionary *gShadowKeyEquivDB = nil;
 
-// Class for numerical-index keys in gShadowKeyEquivDB (each is the NSUInteger
-// equivalent of an NSMenuItem's address).  Using this kind of key is more
-// efficient and also less dangerous -- we won't get into trouble if an
-// NSMenuItem object contains invalid pointers (as it appears they sometimes
-// do).
-//
-// Note: NSUInteger is 64-bit safe, but below we must (if we want to be able
-// build on OS X 10.4.X) create IndexNumbers using a method that _isn't_
-// 64-bit safe -- [NSNumber numberWithUnsignedInt:(unsigned int)value].  Once
-// we start compiling 64-bit binaries, we will need to change this to
-// [NSNumber numberWithUnsignedInteger:(NSUInteger)value] (which is only
-// available starting with OS X 10.5).  We should get a compiler error if we
-// try to compile a 64-bit binary without making this change.
-
-@interface IndexNumber : NSNumber
-- (BOOL)isEqual:(id)anObject;
-@end
-
-@implementation IndexNumber
-
-// Ensure that hastable comparisons use an NSNumber object's value -- not its
-// address in memory.
-- (BOOL)isEqual:(id)anObject
-{
-  if ([anObject isKindOfClass:[NSNumber class]])
-    return [self isEqualToNumber:(NSNumber *)anObject];
-  return [super isEqual:anObject];
-}
-
-@end
-
 // Class for values in gShadowKeyEquivDB.
 
 @interface KeyEquivDBItem : NSObject
 {
   NSMenuItem *mItem;
-  NSMutableIndexSet *mTables;
+  NSMutableSet *mTables;
 }
 
 - (id)initWithItem:(NSMenuItem *)aItem table:(NSMapTable *)aTable;
 - (BOOL)hasTable:(NSMapTable *)aTable;
 - (int)addTable:(NSMapTable *)aTable;
 - (int)removeTable:(NSMapTable *)aTable;
 
 @end
 
 @implementation KeyEquivDBItem
 
 - (id)initWithItem:(NSMenuItem *)aItem table:(NSMapTable *)aTable
 {
+  NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
+  
   if (!gShadowKeyEquivDB)
     gShadowKeyEquivDB = [[NSMutableDictionary alloc] init];
   self = [super init];
   if (aItem && aTable) {
-    mTables = [[NSMutableIndexSet alloc] init];
+    mTables = [[NSMutableSet alloc] init];
     mItem = [aItem retain];
-    [mTables addIndex:(NSUInteger)aTable];
+    [mTables addObject:[NSValue valueWithPointer:aTable]];
   } else {
     mTables = nil;
     mItem = nil;
   }
   return self;
+
+  NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
 - (void)dealloc
 {
+  NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
+
   if (mTables)
     [mTables release];
   if (mItem)
     [mItem release];
   [super dealloc];
+
+  NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 - (BOOL)hasTable:(NSMapTable *)aTable
 {
-  return [mTables containsIndex:(NSUInteger)aTable];
+  NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
+
+  return [mTables member:[NSValue valueWithPointer:aTable]] ? YES : NO;
+
+  NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(NO);
 }
 
 // Does nothing if aTable (its index value) is already present in mTables.
 - (int)addTable:(NSMapTable *)aTable
 {
+  NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
+
   if (aTable)
-    [mTables addIndex:(NSUInteger)aTable];
+    [mTables addObject:[NSValue valueWithPointer:aTable]];
   return [mTables count];
+
+  NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(0);
 }
 
 - (int)removeTable:(NSMapTable *)aTable
 {
-  if (aTable)
-    [mTables removeIndex:(NSUInteger)aTable];
+  NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
+
+  if (aTable) {
+    NSValue *objectToRemove =
+      [mTables member:[NSValue valueWithPointer:aTable]];
+    if (objectToRemove)
+      [mTables removeObject:objectToRemove];
+  }
   return [mTables count];
+
+  NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(0);
 }
 
 @end
 
+
 @interface NSMenu (MethodSwizzling)
 + (void)nsMenuX_NSMenu_addItem:(NSMenuItem *)aItem toTable:(NSMapTable *)aTable;
 + (void)nsMenuX_NSMenu_removeItem:(NSMenuItem *)aItem fromTable:(NSMapTable *)aTable;
 @end
 
 @implementation NSMenu (MethodSwizzling)
 
 + (void)nsMenuX_NSMenu_addItem:(NSMenuItem *)aItem toTable:(NSMapTable *)aTable
 {
+  NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
+
   if (aItem && aTable) {
-    IndexNumber *itemNumber = (IndexNumber *)
-      [NSNumber numberWithUnsignedInt:(NSUInteger)aItem];
-    KeyEquivDBItem *shadowItem = [gShadowKeyEquivDB objectForKey:itemNumber];
+    NSValue *key = [NSValue valueWithPointer:aItem];
+    KeyEquivDBItem *shadowItem = [gShadowKeyEquivDB objectForKey:key];
     if (shadowItem) {
       [shadowItem addTable:aTable];
     } else {
       shadowItem = [[KeyEquivDBItem alloc] initWithItem:aItem table:aTable];
-      [gShadowKeyEquivDB setObject:shadowItem forKey:itemNumber];
+      [gShadowKeyEquivDB setObject:shadowItem forKey:key];
       // Release after [NSMutableDictionary setObject:forKey:] retains it (so
       // that it will get dealloced when removeObjectForKey: is called).
       [shadowItem release];
     }
   }
+
+  NS_OBJC_END_TRY_ABORT_BLOCK;
+
   [self nsMenuX_NSMenu_addItem:aItem toTable:aTable];
 }
 
 + (void)nsMenuX_NSMenu_removeItem:(NSMenuItem *)aItem fromTable:(NSMapTable *)aTable
 {
   [self nsMenuX_NSMenu_removeItem:aItem fromTable:aTable];
+
+  NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
+
   if (aItem && aTable) {
-    IndexNumber *itemNumber = (IndexNumber *)
-      [NSNumber numberWithUnsignedInt:(NSUInteger)aItem];
-    KeyEquivDBItem *shadowItem = [gShadowKeyEquivDB objectForKey:itemNumber];
+    NSValue *key = [NSValue valueWithPointer:aItem];
+    KeyEquivDBItem *shadowItem = [gShadowKeyEquivDB objectForKey:key];
     if (shadowItem && [shadowItem hasTable:aTable]) {
       if (![shadowItem removeTable:aTable])
-        [gShadowKeyEquivDB removeObjectForKey:itemNumber];
+        [gShadowKeyEquivDB removeObjectForKey:key];
     }
   }
+
+  NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 @end
 
 // This class is needed to keep track of when the OS is (re)indexing all of
 // our menus.  This appears to only happen on Leopard and higher, and can
 // be triggered by opening the Help menu.  Some operations are unsafe while
 // this is happening -- notably the calls to [[NSImage alloc]
--- a/widget/src/os2/nsWindow.cpp
+++ b/widget/src/os2/nsWindow.cpp
@@ -2225,43 +2225,59 @@ BOOL nsWindow::NotifyForeignChildWindows
       NotifyForeignChildWindows(hwnd);
     }
   }
   return WinEndEnumWindows(hEnum);
 }
 
 //-------------------------------------------------------------------------
 //
+// Force a resize of child windows after a scroll to reset hover positions.
+//
+//-------------------------------------------------------------------------
+void nsWindow::ScrollChildWindows(PRInt32 aX, PRInt32 aY)
+{
+  nsIWidget *child = GetFirstChild();
+  while (child) {
+    nsRect rect;
+    child->GetBounds(rect);
+    child->Resize(rect.x + aX, rect.y + aY, rect.width, rect.height, PR_FALSE);
+    child = child->GetNextSibling();
+  }
+}
+//-------------------------------------------------------------------------
+//
 // Scroll the bits of a window
 //
 //-------------------------------------------------------------------------
 //XXX Scroll is obsolete and should go away soon
 NS_METHOD nsWindow::Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect)
 {
   RECTL rcl;
 
   if (nsnull != aClipRect)
   {
     rcl.xLeft = aClipRect->x;
     rcl.yBottom = aClipRect->y + aClipRect->height;
     rcl.xRight = rcl.xLeft + aClipRect->width;
     rcl.yTop = rcl.yBottom + aClipRect->height;
-    NS2PM( rcl);
+    NS2PM(rcl);
     // this rect is inex
   }
 
-    // this prevents screen corruption while scrolling during a
-    // Moz-originated drag - during a native drag, the screen
-    // isn't updated until the drag ends. so there's no corruption
+  // this prevents screen corruption while scrolling during a
+  // Moz-originated drag - during a native drag, the screen
+  // isn't updated until the drag ends. so there's no corruption
   HPS hps = 0;
   CheckDragStatus(ACTION_SCROLL, &hps);
 
   NotifyForeignChildWindows(mWnd);
-  WinScrollWindow( mWnd, aDx, -aDy, aClipRect ? &rcl : 0, 0, 0,
-                   0, SW_SCROLLCHILDREN | SW_INVALIDATERGN);
+  WinScrollWindow(mWnd, aDx, -aDy, aClipRect ? &rcl : 0, 0, 0,
+                  0, SW_SCROLLCHILDREN | SW_INVALIDATERGN);
+  ScrollChildWindows(aDx, aDy);
   Update();
 
   if (hps)
     ReleaseIfDragHPS(hps);
 
   return NS_OK;
 }
 
--- a/widget/src/os2/nsWindow.h
+++ b/widget/src/os2/nsWindow.h
@@ -326,16 +326,17 @@ protected:
    HBITMAP DataToBitmap(PRUint8* aImageData, PRUint32 aWidth,
                         PRUint32 aHeight, PRUint32 aDepth);
    HBITMAP CreateBitmapRGB(PRUint8* aImageData, PRUint32 aWidth, PRUint32 aHeight);
    // 'format' should be 'gfx_format' which is a PRInt32
    HBITMAP CreateTransparencyMask(PRInt32  format, PRUint8* aImageData,
                                   PRUint32 aWidth, PRUint32 aHeight);
 
    BOOL NotifyForeignChildWindows(HWND aWnd);
+   void ScrollChildWindows(PRInt32 aX, PRInt32 aY);
 
    // Enumeration of the methods which are accessible on the PM thread
    enum {
       CREATE,
       DESTROY,
       SET_FOCUS,
       UPDATE_WINDOW,
       SET_TITLE,
deleted file mode 100644
--- a/xpfe/components/alerts/Makefile.in
+++ /dev/null
@@ -1,52 +0,0 @@
-#
-# ***** 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.org code.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# 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 *****
-
-DEPTH   = ../../..
-topsrcdir = @top_srcdir@
-srcdir    = @srcdir@
-VPATH   = @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-DIRS    = public
-
-ifneq (,$(filter $(MOZ_WIDGET_TOOLKIT),windows gtk2))
-DIRS += src
-endif
-
-include $(topsrcdir)/config/rules.mk
-
deleted file mode 100644
--- a/xpfe/components/alerts/public/Makefile.in
+++ /dev/null
@@ -1,51 +0,0 @@
-#
-# ***** 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.org code.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# 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 *****
-
-DEPTH   = ../../../..
-topsrcdir = @top_srcdir@
-srcdir    = @srcdir@
-VPATH   = @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MODULE    = appcomps
-XPIDL_MODULE=alerts
-
-XPIDLSRCS = nsIAlertsService.idl \
-
-include $(topsrcdir)/config/rules.mk
-
deleted file mode 100644
--- a/xpfe/components/alerts/public/nsIAlertsService.idl
+++ /dev/null
@@ -1,79 +0,0 @@
-/* -*- Mode: IDL; 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 mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 2002
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Scott MacGregor <mscott@netscape.com>
- *
- * 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 ***** */
-
-
-#include "nsISupports.idl"
-#include "nsIObserver.idl"
-
-[scriptable, uuid(33d256d8-c002-4840-af73-811b2ec20079)]
-interface nsIAlertsService : nsISupports
-{
-   /**
-    * Displays a sliding notification window. Currently works under 
-    * Windows and Linux only.
-    *    
-    * @param imageUrl       A URL identifying the image to put in the alert.
-    * @param title          The title for the alert.
-    * @param text           The contents of the alert.
-    * @param textClickable  If true, causes the alert text to look like a link
-    *                       and notifies the listener when user attempts to 
-    *                       click the alert text.
-    * @param cookie         A blind cookie the alert will pass back to the 
-    *                       consumer during the alert listener callbacks.
-    * @param alertListener  Used for callbacks. May be null if the caller 
-    *                       doesn't care about callbacks.
-    *
-    * The following arguments will be passed to the alertListener's observe() 
-    * method:
-    *   subject - null
-    *   topic   - "alertfinished" when the alert goes away
-    *             "alertclickcallback" when the text is clicked
-    *   data    - the value of the cookie parameter passed to showAlertNotification.
-    */
-   void showAlertNotification(in AString  imageUrl, 
-                              in AString  title, 
-                              in AString  text, 
-                              in boolean  textClickable,
-                              in AString  cookie,
-                              in nsIObserver alertListener,
-                              in AString name);
-};
-
-%{ C++
-#define NS_ALERTSERVICE_CONTRACTID "@mozilla.org/alerts-service;1"
-%}
deleted file mode 100644
--- a/xpfe/components/alerts/src/Makefile.in
+++ /dev/null
@@ -1,68 +0,0 @@
-#! gmake
-# 
-# ***** 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.org code.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 2000
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# 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 *****
-
-DEPTH   = ../../../..
-topsrcdir = @top_srcdir@
-srcdir    = @srcdir@
-VPATH   = @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MODULE    = appcomps
-LIBRARY_NAME  = alerts_s
-MOZILLA_INTERNAL_API = 1
-
-REQUIRES  = xpcom \
-            string \
-            windowwatcher \
-            dom \
-            widget \
-            gfx \
-            $(NULL)
-
-CPPSRCS   = \
-    nsAlertsService.cpp \
-    $(NULL)
-
-# we don't want the shared lib, but we want to force the creation of a
-# static lib.
-FORCE_STATIC_LIB = 1
-
-include $(topsrcdir)/config/rules.mk
-
-EXTRA_DSO_LDOPTS += $(MOZ_COMPONENT_LIBS)
deleted file mode 100644
--- a/xpfe/components/alerts/src/nsAlertsService.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-/* -*- 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 mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 2002
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Scott MacGregor <mscott@netscape.com>
- *   Jens Bannmann <jens.b@web.de>
- *   Simon Montagu <smontagu@smontagu.org>
- *
- * 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 ***** */
-
-#include "nsAlertsService.h"
-#include "nsISupportsArray.h"
-#include "nsXPCOM.h"
-#include "nsISupportsPrimitives.h"
-#include "nsIServiceManager.h"
-#include "nsIDOMWindowInternal.h"
-#include "nsIWindowWatcher.h"
-#include "nsDependentString.h"
-#include "nsWidgetsCID.h"
-#include "nsILookAndFeel.h"
-
-#define ALERT_CHROME_URL "chrome://communicator/content/alerts/alert.xul"
-
-NS_IMPL_THREADSAFE_ADDREF(nsAlertsService)
-NS_IMPL_THREADSAFE_RELEASE(nsAlertsService)
-
-NS_INTERFACE_MAP_BEGIN(nsAlertsService)
-   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIAlertsService)
-   NS_INTERFACE_MAP_ENTRY(nsIAlertsService)
-NS_INTERFACE_MAP_END_THREADSAFE
-
-nsAlertsService::nsAlertsService()
-{
-}
-
-nsAlertsService::~nsAlertsService()
-{}
-
-NS_IMETHODIMP nsAlertsService::ShowAlertNotification(const nsAString & aImageUrl, const nsAString & aAlertTitle, 
-                                                     const nsAString & aAlertText, PRBool aAlertTextClickable,
-                                                     const nsAString & aAlertCookie,
-                                                     nsIObserver * aAlertListener,
-                                                     const nsAString & aAlertName)
-{
-  nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
-  nsCOMPtr<nsIDOMWindow> newWindow;
-  nsresult rv;
-
-  nsCOMPtr<nsISupportsArray> argsArray;
-  rv = NS_NewISupportsArray(getter_AddRefs(argsArray));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  // create scriptable versions of our strings that we can store in our nsISupportsArray....
-  nsCOMPtr<nsISupportsString> scriptableImageUrl (do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID));
-  NS_ENSURE_TRUE(scriptableImageUrl, NS_ERROR_FAILURE);
-
-  scriptableImageUrl->SetData(aImageUrl);
-  rv = argsArray->AppendElement(scriptableImageUrl);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  nsCOMPtr<nsISupportsString> scriptableAlertTitle (do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID));
-  NS_ENSURE_TRUE(scriptableAlertTitle, NS_ERROR_FAILURE);
-
-  scriptableAlertTitle->SetData(aAlertTitle);
-  rv = argsArray->AppendElement(scriptableAlertTitle);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  nsCOMPtr<nsISupportsString> scriptableAlertText (do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID));
-  NS_ENSURE_TRUE(scriptableAlertText, NS_ERROR_FAILURE);
-
-  scriptableAlertText->SetData(aAlertText);
-  rv = argsArray->AppendElement(scriptableAlertText);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  nsCOMPtr<nsISupportsPRBool> scriptableIsClickable (do_CreateInstance(NS_SUPPORTS_PRBOOL_CONTRACTID));
-  NS_ENSURE_TRUE(scriptableIsClickable, NS_ERROR_FAILURE);
-
-  scriptableIsClickable->SetData(aAlertTextClickable);
-  rv = argsArray->AppendElement(scriptableIsClickable);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  nsCOMPtr<nsISupportsString> scriptableAlertCookie (do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID));
-  NS_ENSURE_TRUE(scriptableAlertCookie, NS_ERROR_FAILURE);
-
-  scriptableAlertCookie->SetData(aAlertCookie);
-  rv = argsArray->AppendElement(scriptableAlertCookie);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  nsCOMPtr<nsISupportsPRInt32> scriptableOrigin (do_CreateInstance(NS_SUPPORTS_PRINT32_CONTRACTID));
-  NS_ENSURE_TRUE(scriptableOrigin, NS_ERROR_FAILURE);
-  nsCOMPtr<nsILookAndFeel> lookAndFeel = do_GetService("@mozilla.org/widget/lookandfeel;1");
-  if (lookAndFeel)
-  {
-    PRInt32 origin;
-    lookAndFeel->GetMetric(nsILookAndFeel::eMetric_AlertNotificationOrigin,
-                           origin);
-    scriptableOrigin->SetData(origin);
-  }
-  rv = argsArray->AppendElement(scriptableOrigin);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  if (aAlertListener)
-  {
-    nsCOMPtr<nsISupportsInterfacePointer> ifptr = do_CreateInstance(NS_SUPPORTS_INTERFACE_POINTER_CONTRACTID, &rv);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    nsCOMPtr<nsISupports> iSupports (do_QueryInterface(aAlertListener));
-    ifptr->SetData(iSupports);
-    ifptr->SetDataIID(&NS_GET_IID(nsIObserver));
-    argsArray->AppendElement(ifptr);
-  }
-  
-  rv = wwatch->OpenWindow(0, ALERT_CHROME_URL, "_blank",
-                 "chrome,dialog=yes,titlebar=no,popup=yes", argsArray,
-                 getter_AddRefs(newWindow));
-  return rv;
-}
deleted file mode 100644
--- a/xpfe/components/alerts/src/nsAlertsService.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- 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 mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 2002
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Scott MacGregor <mscott@netscape.com>
- *
- * 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 ***** */
-
-#ifndef nsAlertsService_h__
-#define nsAlertsService_h__
-
-#include "nsIAlertsService.h"
-#include "nsCOMPtr.h"
-
-#define NS_ALERTSSERVICE_CID { 0xa0ccaaf8, 0x9da, 0x44d8, { 0xb2, 0x50, 0x9a, 0xc3, 0xe9, 0x3c, 0x81, 0x17 } }
-
-class nsAlertsService : public nsIAlertsService
-{
-public:
-  NS_DECL_NSIALERTSSERVICE
-  NS_DECL_ISUPPORTS
-
-  nsAlertsService();
-  virtual ~nsAlertsService();
-
-protected:
-};
-
-#endif /* nsAlertsService_h__ */
deleted file mode 100644
--- a/xpfe/components/console/Makefile.in
+++ /dev/null
@@ -1,49 +0,0 @@
-#
-# ***** 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.org code.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# 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 *****
-
-
-DEPTH           = ../../..
-topsrcdir       = @top_srcdir@
-srcdir          = @srcdir@
-VPATH           = @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-EXTRA_COMPONENTS = jsconsole-clhandler.js
-
-include $(topsrcdir)/config/rules.mk
-
deleted file mode 100644
--- a/xpfe/components/console/jsconsole-clhandler.js
+++ /dev/null
@@ -1,136 +0,0 @@
-/* -*- 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.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1999
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Martijn Pieters <mj@digicool.com>
- *
- * 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 ***** */
-
-/*
- * -jsconsole commandline handler; starts up the JavaScript console.
- */
-
-/*
- * Constants
- */
-
-const JSCONSOLEHANDLER_CONTRACTID =
-    "@mozilla.org/commandlinehandler/general-startup;1?type=jsconsole";
-
-const JSCONSOLEHANDLER_CID = 
-    Components.ID('{1698ef18-c128-41a1-b4d0-7f9acd2ae86c}');
-
-/*
- * Classes
- */
-
-/* jsConsoleHandler class constructor */
-function jsConsoleHandler() {}
-
-/* jsConsoleHandler class def */
-jsConsoleHandler.prototype = {
-    commandLineArgument: '-jsconsole',
-    prefNameForStartup: 'general.startup.jsconsole',
-    chromeUrlForTask: 'chrome://global/content/console.xul',
-    helpText: 'Start with Javascript Console',
-    handlesArgs: false,
-    defaultArgs: null,
-    openWindowWithArgs: false
-};
-
-/*
- * Objects
- */
-
-/* jsConsoleHandler Module (for XPCOM registration) */
-var jsConsoleHandlerModule = {
-    registerSelf: function(compMgr, fileSpec, location, type) {
-        compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
-
-        compMgr.registerFactoryLocation(JSCONSOLEHANDLER_CID, 
-                                        'JS Console Commandline Handler component',
-                                        JSCONSOLEHANDLER_CONTRACTID, 
-                                        fileSpec,
-                                        location, 
-                                        type);
-        var catman = Components.classes["@mozilla.org/categorymanager;1"]
-            .getService(Components.interfaces.nsICategoryManager);
-        catman.addCategoryEntry("command-line-argument-handlers", "jsconsole command line handler",
-            JSCONSOLEHANDLER_CONTRACTID,
-            true, true);
-    },
-
-    unregisterSelf: function(compMgr, fileSpec, location) {
-        compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
-        compMgr.unregisterFactoryLocation(JSCONSOLEHANDLER_CID, fileSpec);
-        var catman = Components.classes["@mozilla.org/categorymanager;1"]
-            .getService(Components.interfaces.nsICategoryManager);
-        catman.deleteCategoryEntry("command-line-argument-handlers",
-            JSCONSOLEHANDLER_CONTRACTID, true);
-    },
-
-    getClassObject: function(compMgr, cid, iid) {
-        if (!cid.equals(JSCONSOLEHANDLER_CID))
-            throw Components.results.NS_ERROR_NO_INTERFACE;
-
-        if (!iid.equals(Components.interfaces.nsIFactory))
-            throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
-
-        return jsConsoleHandlerFactory;
-    },
-
-    canUnload: function(compMgr) { return true; }
-};
-
-/* jsConsoleHandler Class Factory */
-var jsConsoleHandlerFactory = {
-    createInstance: function(outer, iid) {
-        if (outer != null)
-            throw Components.results.NS_ERROR_NO_AGGREGATION;
-    
-        if (!iid.equals(Components.interfaces.nsICmdLineHandler) &&
-            !iid.equals(Components.interfaces.nsISupports))
-            throw Components.results.NS_ERROR_INVALID_ARG;
-
-        return new jsConsoleHandler();
-    }
-}
-
-/*
- * Functions
- */
-
-/* module initialisation */
-function NSGetModule(comMgr, fileSpec) { return jsConsoleHandlerModule; }
-
-// vim:sw=4:sr:sta:et:sts:
deleted file mode 100644
--- a/xpfe/components/console/resources/content/console.css
+++ /dev/null
@@ -1,61 +0,0 @@
-
-.console-box {
-  -moz-binding: url("chrome://global/content/consoleBindings.xml#console-box");
-  overflow: auto;
-}
-
-.console-rows {
-  -moz-user-focus: normal;
-}
-
-.console-row[type="error"],
-.console-row[type="warning"] {
-  -moz-binding: url("chrome://global/content/consoleBindings.xml#error");
-}
-
-.console-row[type="message"] {
-  -moz-binding: url("chrome://global/content/consoleBindings.xml#message");
-}
-
-.console-msg-text {
-  white-space: pre-wrap;
-}
-
-.console-error-source {
-  -moz-binding: url("chrome://global/content/consoleBindings.xml#console-error-source");
-}
-
-.console-dots {
-  width: 1px;
-}
-
-/* :::::::::: hiding and showing of rows for each mode :::::::::: */
-
-.console-box[mode="Warnings"] > .console-box-internal > .console-rows 
-    > .console-row[type="error"],
-.console-box[mode="Messages"] > .console-box-internal > .console-rows 
-    > .console-row[type="error"]
-{
-  display: none;
-}
-
-.console-box[mode="Errors"] > .console-box-internal > .console-rows 
-    > .console-row[type="warning"],
-.console-box[mode="Messages"] > .console-box-internal > .console-rows 
-    > .console-row[type="warning"]
-{
-  display: none;
-}
-
-.console-box[mode="Errors"] > .console-box-internal > .console-rows 
-    > .console-row[type="message"],
-.console-box[mode="Warnings"] > .console-box-internal > .console-rows 
-    > .console-row[type="message"]
-{
-  display: none;
-}
-
-/* If line number is 0, hide the line number section */
-.lineNumberRow[line="0"] {
-  display: none;
-}
deleted file mode 100644
--- a/xpfe/components/console/resources/content/console.js
+++ /dev/null
@@ -1,224 +0,0 @@
-/* -*- Mode: Java; tab-width: 4; 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.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Joe Hewitt <hewitt@netscape.com>
- *
- * 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 ***** */
-
-var gConsole, gConsoleBundle;
-
-/* :::::::: Console Initialization ::::::::::::::: */
-
-window.onload = function()
-{
-  gConsole = document.getElementById("ConsoleBox");
-  gConsoleBundle = document.getElementById("ConsoleBundle");
-  
-  top.controllers.insertControllerAt(0, ConsoleController);
-  
-  updateSortCommand(gConsole.sortOrder);
-  updateModeCommand(gConsole.mode);
-
-  var iframe = document.getElementById("Evaluator");
-  iframe.addEventListener("load", displayResult, true);
-}
-
-/* :::::::: Console UI Functions ::::::::::::::: */
-
-function changeMode(aMode)
-{
-  switch (aMode) {
-    case "Errors":
-    case "Warnings":
-    case "Messages":
-      gConsole.mode = aMode;
-      break;
-    case "All":
-      gConsole.mode = null;
-  }
-  
-  document.persist("ConsoleBox", "mode");
-}
-
-function clearConsole()
-{
-  gConsole.clear();
-}
-
-function changeSortOrder(aOrder)
-{
-  updateSortCommand(gConsole.sortOrder = aOrder);
-}
-
-function updateSortCommand(aOrder)
-{
-  var orderString = aOrder == 'reverse' ? "Descend" : "Ascend";
-  var bc = document.getElementById("Console:sort"+orderString);
-  bc.setAttribute("checked", true);  
-
-  orderString = aOrder == 'reverse' ? "Ascend" : "Descend";
-  bc = document.getElementById("Console:sort"+orderString);
-  bc.setAttribute("checked", false);
-}
-
-function updateModeCommand(aMode)
-{
-  var bc = document.getElementById("Console:mode" + aMode);
-  bc.setAttribute("checked", true);
-}
-
-function toggleToolbar(aEl)
-{
-  var bc = document.getElementById(aEl.getAttribute("observes"));
-  var truth = bc.getAttribute("checked");
-  bc.setAttribute("checked", truth != "true");
-  var toolbar = document.getElementById(bc.getAttribute("_toolbar"));
-  toolbar.setAttribute("hidden", truth);
-
-  document.persist(toolbar.id, "hidden");
-  document.persist(bc.id, "checked");
-}
-
-function copyItemToClipboard()
-{
-  gConsole.copySelectedItem();
-}
-
-function isItemSelected()
-{
-  return gConsole.selectedItem != null;
-}
-
-function UpdateCopyMenu()
-{
-  goUpdateCommand("cmd_copy");
-}
-
-function onEvalKeyPress(aEvent)
-{
-  if (aEvent.keyCode == 13)
-    evaluateTypein();
-}
-
-function evaluateTypein()
-{
-  var code = document.getElementById("TextboxEval").value;
-  var evaluator = document.getElementById("Evaluator").contentWindow;
-  evaluator.location = "about:blank"; // reset the iframe
-  evaluator.location = "javascript: " + code.replace(/%/g, "%25");
-}
-
-function displayResult()
-{
-  var resultRange = Evaluator.document.createRange();
-  resultRange.selectNode(Evaluator.document.documentElement);
-  var result = resultRange.toString();
-  if (result)
-    gConsole.mCService.logStringMessage(result);
-    // or could use appendMessage which doesn't persist
-}
-
-/* :::::::: Command Controller for the Window ::::::::::::::: */
-
-var ConsoleController = 
-{
-  isCommandEnabled: function (aCommand)
-  {
-    switch (aCommand) {
-      case "cmd_copy":
-        return isItemSelected();
-      default:
-        return false;
-    }
-  },
-  
-  supportsCommand: function (aCommand) 
-  {
-    switch (aCommand) {
-      case "cmd_copy":
-        return true;
-      default:
-        return false;
-    }
-  },
-  
-  doCommand: function (aCommand)
-  {
-    switch (aCommand) {
-      case "cmd_copy":
-        copyItemToClipboard();
-        break;
-      default:
-        break;
-    }
-  },
-  
-  onEvent: function (aEvent) 
-  {
-  }
-};
-
-// XXX DEBUG
-
-function debug(aText)
-{
-  var csClass = Components.classes['@mozilla.org/consoleservice;1'];
-  var cs = csClass.getService(Components.interfaces.nsIConsoleService);
-  cs.logStringMessage(aText);
-}
-
-function getStackTrace()
-{
-  var frame = Components.stack.caller;
-  var str = "";
-  while (frame) {
-    if (frame.filename)
-      str += frame.filename + ", Line " + frame.lineNumber;
-    else
-      str += "[" + gConsoleBundle.getString("noFile") + "]";
-    
-    str += " --> ";
-    
-    if (frame.functionName)
-      str += frame.functionName;
-    else
-      str += "[" + gConsoleBundle.getString("noFunction") + "]";
-      
-    str += "\n";
-    
-    frame = frame.caller;
-  }
-  
-  return str;
-}
deleted file mode 100644
--- a/xpfe/components/console/resources/content/console.xul
+++ /dev/null
@@ -1,178 +0,0 @@
-<?xml version="1.0"?> <!-- -*- tab-width: 4; indent-tabs-mode: nil -*- -->
-
-<!-- ***** 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 Communicator client code, released
- March 31, 1998.
-
- The Initial Developer of the Original Code is
- Netscape Communications Corporation.
- Portions created by the Initial Developer are Copyright (C) 1998-1999
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
-   Joe Hewitt <hewitt@netscape.com>
-
- 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 ***** -->
-
-<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?> 
-<?xml-stylesheet href="chrome://global/skin/console.css" type="text/css"?> 
-<?xml-stylesheet href="chrome://global/content/console.css" type="text/css"?> 
-
-<?xul-overlay href="chrome://global/content/globalOverlay.xul"?>
-<?xul-overlay href="chrome://communicator/content/utilityOverlay.xul"?>
-<?xul-overlay href="chrome://communicator/content/tasksOverlay.xul"?>
-
-<!DOCTYPE window [
-  <!ENTITY % console SYSTEM "chrome://global/locale/console.dtd"> %console;
-  <!ENTITY % util SYSTEM "chrome://communicator/locale/utilityOverlay.dtd"> %util;
-]>
-
-<window id="jsconsoleWindow"
-        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-        title="&console.title;"
-        windowtype="global:console"
-        width="640" height="480"
-        screenX="10" screenY="10"
-        persist="screenX screenY width height"> 
-
-<script type="application/x-javascript" src="chrome://global/content/globalOverlay.js"/>
-<script type="application/x-javascript" src="chrome://global/content/console.js"/>
-
-<stringbundle id="ConsoleBundle" src="chrome://global/locale/console.properties"/>
-<commandset id="tasksCommands"/>
-<command id="cmd_copy" oncommand="copyItemToClipboard()"/>
-<command id="cmd_close" oncommand="window.close()"/>
-<command id="cmd_quit"/>
-
-  <broadcaster id="Console:clear" label="&clear.label;" 
-               accesskey="&clear.accesskey;" 
-               oncommand="clearConsole();"/>
-  
-  <broadcaster id="Console:sortAscend" label="&sortFirst.label;" 
-               accesskey="&sortFirst.accesskey;"
-               oncommand="changeSortOrder('forward');"/>
-  <broadcaster id="Console:sortDescend" label="&sortLast.label;"
-               accesskey="&sortLast.accesskey;"
-               oncommand="changeSortOrder('reverse');"/>
-
-  <broadcaster id="Console:toggleToolbarMode" label="&toolbarMode.label;" 
-               oncommand="toggleToolbar(this);" checked="true" 
-               _toolbar="ToolbarMode"/>
-  <broadcaster id="Console:toggleToolbarEval" label="&toolbarEval.label;"
-               oncommand="toggleToolbar(this);" checked="true" 
-               _toolbar="ToolbarEval"/>
-
-<broadcasterset id="ModeBroadcasters">
-  <broadcaster id="Console:modeAll" label="&all.label;" 
-               accesskey="&all.accesskey;" 
-               oncommand="changeMode('All');"/>
-  <broadcaster id="Console:modeErrors" label="&errors.label;"
-               accesskey="&errors.accesskey;"
-               oncommand="changeMode('Errors');"/>
-  <broadcaster id="Console:modeWarnings" label="&warnings.label;"
-               accesskey="&warnings.accesskey;"
-               oncommand="changeMode('Warnings');"/>
-  <broadcaster id="Console:modeMessages" label="&messages.label;"
-               accesskey="&messages.accesskey;"
-               oncommand="changeMode('Messages');"/>
-</broadcasterset>
-
-<keyset id="tasksKeys">
-  <key id="key_copy"/>
-  <key id="key_close"/>
-  <key id="key_quit"/>
-</keyset>
-
-<popupset id="ContextMenus">
-  <popup id="ConsoleContext" onpopupshowing="UpdateCopyMenu()">
-    <menuitem type="radio" observes="Console:sortAscend"/>
-    <menuitem type="radio" observes="Console:sortDescend"/>
-    <menuseparator/>
-    <menuitem id="menu_copy_cm" observes="cmd_copy" label="&copyCmd.label;" accesskey="&copyCmd.accesskey;"/>
-  </popup>
-</popupset>
-  
-<toolbox>
-  <menubar id="main-menubar" class="chromeclass-menubar" grippytooltiptext="&menuBar.tooltip;">
-    <menu id="menu_File">
-      <menupopup id="menu_FilePopup">
-        <menuitem id="menu_close"/>
-      </menupopup>
-    </menu>
-
-    <menu id="menu_Edit">
-      <menupopup onpopupshowing="UpdateCopyMenu()">
-        <menuitem id="menu_copy"/>
-      </menupopup>
-    </menu>
-  
-    <menu id="menu_View">
-      <menupopup>
-       <menu label="&toolbarsCmd.label;" accesskey="&toolbarsCmd.accesskey;">
-          <menupopup> 
-            <menuitem type="checkbox" observes="Console:toggleToolbarMode"/>
-            <menuitem type="checkbox" observes="Console:toggleToolbarEval"/>
-          </menupopup>
-        </menu>
-        <menuseparator/>
-        <menuitem type="radio" observes="Console:sortAscend"/>
-        <menuitem type="radio" observes="Console:sortDescend"/>
-      </menupopup>
-    </menu>
-  
-    <!-- tasks menu filled from tasksOverlay -->
-    <menu id="tasksMenu"/>
-
-    <!-- window menu filled from tasksOverlay -->
-    <menu id="windowMenu"/>
-
-    <!-- help menu filled from globalOverlay -->
-    <menu id="menu_Help"/>
-  </menubar>
-
-  <toolbar class="chromeclass-toolbar" id="ToolbarMode" grippytooltiptext="&modeToolbar.tooltip;">
-    <toolbarbutton type="radio" group="mode" observes="Console:modeAll"/>
-    <toolbarbutton type="radio" group="mode" observes="Console:modeErrors"/>
-    <toolbarbutton type="radio" group="mode" observes="Console:modeWarnings"/>
-    <toolbarbutton type="radio" group="mode" observes="Console:modeMessages"/>
-    <toolbarseparator/>
-    <toolbarbutton observes="Console:clear"/>
-  </toolbar>
-  
-  <toolbar class="chromeclass-toolbar" id="ToolbarEval" grippytooltiptext="&entryToolbar.tooltip;">
-    <textbox id="TextboxEval" class="toolbar" value="" onkeypress="onEvalKeyPress(event)" flex="1"/>
-    <toolbarbutton id="ButtonEval" label="&evaluate.label;" oncommand="evaluateTypein()"/>
-  </toolbar>
-</toolbox>
-  
-<vbox id="ConsoleBox" class="console-box" flex="1" context="ConsoleContext" persist="sortOrder"/>
-
-<iframe name="Evaluator" id="Evaluator" collapsed="true"/>
-
-</window>
-
-
deleted file mode 100644
--- a/xpfe/components/console/resources/content/consoleBindings.xml
+++ /dev/null
@@ -1,394 +0,0 @@
-<?xml version="1.0"?>
-
-<!DOCTYPE bindings SYSTEM "chrome://global/locale/console.dtd">
-
-<bindings id="consoleBindings"
-          xmlns="http://www.mozilla.org/xbl"
-          xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-          xmlns:xbl="http://www.mozilla.org/xbl">
-
-  <binding id="console-box" extends="xul:box">
-    <content>  
-      <xul:stringbundle src="chrome://global/locale/console.properties" role="string-bundle"/>
-      <xul:vbox class="console-box-internal">
-        <xul:vbox class="console-rows" role="console-rows" xbl:inherits="dir=sortOrder"/>
-      </xul:vbox>
-    </content>
-  
-    <implementation implements="nsIConsoleListener">
-      <field name="limit" readonly="true">
-        250
-      </field>
-      <field name="_showChromeErrors">-1</field>
-      
-      <property name="showChromeErrors">
-        <getter><![CDATA[
-          if (this._showChromeErrors != -1)
-            return this._showChromeErrors;
-          var pref = Components.classes['@mozilla.org/preferences-service;1'].getService();
-          pref = pref.QueryInterface(Components.interfaces.nsIPrefBranch);
-
-          try {
-            return this._showChromeErrors = pref.getBoolPref("javascript.options.showInConsole");
-          }
-          catch(ex) {
-            return this._showChromeErrors = false;
-          }
-        ]]></getter>
-      </property>          
-
-      <property name="count" readonly="true">
-        <getter>return this.mCount</getter>
-      </property>
-    
-      <property name="mode">
-        <getter>return this.mMode;</getter>
-        <setter><![CDATA[
-          this.mMode = val || "All";
-          this.setAttribute("mode", this.mMode);
-          return val;
-        ]]></setter>
-      </property>
-    
-      <property name="sortOrder">
-        <getter>return this.getAttribute("sortOrder");</getter>
-        <setter>this.setAttribute("sortOrder", val); return val;</setter>
-      </property>
-      <field name="mSelectedItem">null</field>
-      <property name="selectedItem">
-        <getter>return this.mSelectedItem</getter>
-        <setter><![CDATA[
-          if (this.mSelectedItem)
-            this.mSelectedItem.removeAttribute("selected");
-          
-          this.mSelectedItem = val;
-          val.setAttribute("selected", "true");
-        ]]></setter>
-      </property>
-    
-      <method name="init">
-        <body><![CDATA[
-          this.mCount = 0;
-          
-          this.mConsoleRowBox = document.getAnonymousElementByAttribute(this, "role", "console-rows");
-          this.mStrBundle = document.getAnonymousElementByAttribute(this, "role", "string-bundle");
-          
-          try {
-            this.mCService = Components.classes['@mozilla.org/consoleservice;1']
-                           .getService(Components.interfaces.nsIConsoleService);
-            this.mCService.registerListener(this);
-          } catch (ex) {
-            this.appendMessage(
-              "Unable to display errors - couldn't get Console Service component. " +
-              "(Missing @mozilla.org/consoleservice;1)");
-            return;
-          }          
-                    
-          this.mMode = this.getAttribute("mode") || "All";
-
-          this.appendInitialItems();
-        ]]></body>
-      </method>
-    
-      <method name="destroy">
-        <body><![CDATA[
-          this.mCService.unregisterListener(this);
-        ]]></body>
-      </method>
-    
-      <method name="appendInitialItems">
-        <body><![CDATA[
-          var out = {}; // Throwaway references to support 'out' parameters.
-          this.mCService.getMessageArray(out, {});
-          var messages = out.value;
-      
-          // In case getMessageArray returns 0-length array as null
-          if (!messages)
-            messages = [];
-      
-          var limit = messages.length - this.limit;
-          if (limit < 0) limit = 0;
-        
-          // Checks if console ever been cleared
-          for (var i = messages.length - 1; i >= limit; --i)
-            if (!messages[i].message)
-              break;
-        
-          // Populate with messages after latest "clear"
-          while (++i < messages.length)
-            this.observe(messages[i]);
-        ]]></body>
-      </method>
-
-      <!-- nsIConsoleListener -->
-      <method name="observe">
-        <parameter name="aConsoleMessage"/>
-        <body><![CDATA[
-          /* This method may be called in cases where the code
-           * called by this method has thrown an exception because
-           * some resource ran OUT OF MEMORY (OOM).
-           *
-           * This method must not throw an exception, because
-           * an exception thrown by it could be asynchrounously
-           * dispatched back to this method resulting in an
-           * asynchronous loop - bug 288544.
-           *
-           * If you need any try/catch handling for code in this
-           * function, please stick it in its own try block inside
-           * the main try block. Do *NOT* use the main try block.
-           */
-          try {
-            if (aConsoleMessage instanceof 
-                Components.interfaces.nsIScriptError) {
-              // filter chrome urls
-              if (!this.showChromeErrors &&
-                  /^chrome:/.test(aConsoleMessage.sourceName))
-                return;
- 
-              this.appendError(aConsoleMessage);
-            } else if (aConsoleMessage.message) {
-              this.appendMessage(aConsoleMessage.message);
-            }
-          } catch (e) {
-            /* This catch block is for bug 288544,
-             * if you want to handle some edge case, please
-             * make your own inner try block inside preceding
-             * try block. Do *NOT* stick any code in here.
-             */
-          }
-        ]]></body>
-      </method>
-
-      <method name="appendError">
-        <parameter name="aObject"/>
-        <body><![CDATA[
-          var row = this.createConsoleRow();
-          var nsIScriptError = Components.interfaces.nsIScriptError;
-          
-          // Is this error actually just a non-fatal warning?
-          var warning = aObject.flags & nsIScriptError.warningFlag != 0;
-  
-          var typetext = warning ? "typeWarning" : "typeError";
-          row.setAttribute("typetext", this.mStrBundle.getString(typetext));
-          row.setAttribute("type", warning ? "warning" : "error");
-          row.setAttribute("msg", aObject.errorMessage);
-          row.setAttribute("category", aObject.category);
-          if (aObject.lineNumber || aObject.sourceName) {
-            row.setAttribute("url", aObject.sourceName);
-            row.setAttribute("line", aObject.lineNumber);
-          } else {
-            row.setAttribute("hideSource", "true");
-          }
-          if (aObject.sourceLine) {
-            row.setAttribute("code", aObject.sourceLine.replace(/\s/g, " "));
-            if (aObject.columnNumber) {
-              row.setAttribute("col", aObject.columnNumber);
-              row.setAttribute("errorDots", this.repeatChar(" ", aObject.columnNumber));
-              row.setAttribute("errorCaret", " ");
-            } else {
-              row.setAttribute("hideCaret", "true");
-            }
-          } else {
-            row.setAttribute("hideCode", "true");
-          }
-          this.appendConsoleRow(row);
-        ]]></body>
-      </method>
-            
-      <method name="appendMessage">
-        <parameter name="aMessage"/>
-        <parameter name="aType"/>
-        <body><![CDATA[
-          var row = this.createConsoleRow();
-          row.setAttribute("type", aType || "message");
-          row.setAttribute("msg", aMessage);
-          this.appendConsoleRow(row);
-        ]]></body>
-      </method>
-      
-      <method name="clear">
-        <body><![CDATA[
-          this.mCService.logStringMessage(null);
-          this.mCount = 0;
-          
-          var newRows = this.mConsoleRowBox.cloneNode(false);
-          this.mConsoleRowBox.parentNode.replaceChild(newRows, this.mConsoleRowBox);
-          this.mConsoleRowBox = newRows;
-        ]]></body>
-      </method>
-            
-      <method name="copySelectedItem">
-        <body><![CDATA[
-          if (this.mSelectedItem) try {
-            const clipURI = "@mozilla.org/widget/clipboardhelper;1";
-            const clipI = Components.interfaces.nsIClipboardHelper;
-            var clipboard = Components.classes[clipURI].getService(clipI);
-
-            clipboard.copyString(this.mSelectedItem.toString());
-          } catch (ex) {
-            // Unable to copy anything, die quietly
-          }
-        ]]></body>
-      </method>
-                  
-      <method name="createConsoleRow">
-        <body><![CDATA[
-          var row = document.createElement("box");
-          row.setAttribute("class", "console-row");
-          row._IsConsoleRow = true;
-          row._ConsoleBox = this;
-          return row;
-        ]]></body>
-      </method>
-            
-      <method name="appendConsoleRow">
-        <parameter name="aRow"/>
-        <body><![CDATA[
-          this.mConsoleRowBox.appendChild(aRow);
-          if (++this.mCount > this.limit) this.deleteFirst();
-        ]]></body>
-      </method>
-            
-      <method name="deleteFirst">
-        <body><![CDATA[
-          var node = this.mConsoleRowBox.firstChild;
-          this.mConsoleRowBox.removeChild(node);
-          --this.mCount;
-        ]]></body>
-      </method>
-
-      <method name="repeatChar">
-        <parameter name="aChar"/>
-        <parameter name="aCol"/>
-        <body><![CDATA[
-          if (--aCol <= 0)
-            return "";
-
-          for (var i = 2; i < aCol; i += i)
-            aChar += aChar;
-
-          return aChar + aChar.slice(0, aCol - aChar.length);
-        ]]></body>
-      </method>
-          
-      <constructor> this.init(); </constructor>
-      <destructor> this.destroy(); </destructor>
-    </implementation>
-    
-    <handlers>
-      <handler event="mousedown"><![CDATA[
-        if (event.button == 0 || event.button == 2) {
-          var target = event.originalTarget;
-  
-          while (target && !("_IsConsoleRow" in target))
-            target = target.parentNode;
-
-          if (target)
-            this.selectedItem = target;
-        }
-      ]]></handler>
-    </handlers>
-  </binding>
-
-  <binding id="error" extends="xul:box">
-    <content>
-      <xul:box class="console-row-internal-box" flex="1">
-        <xul:box class="console-row-icon" align="center" xbl:inherits="selected">
-          <xul:image class="console-icon" xbl:inherits="src,type"/>
-        </xul:box>
-        <xul:vbox class="console-row-content" xbl:inherits="selected" flex="1">
-          <xul:box class="console-row-msg" align="start">
-            <xul:label class="label" xbl:inherits="value=typetext"/>
-            <xul:description class="console-error-msg" xbl:inherits="xbl:text=msg" flex="1"/>
-          </xul:box>
-          <xul:box class="console-row-file" xbl:inherits="hidden=hideSource">
-            <xul:label class="label" value="&errFile.label;"/>
-            <xul:box class="console-error-source" xbl:inherits="url,line"/>
-            <xul:spacer flex="1"/>
-            <xul:hbox class="lineNumberRow" xbl:inherits="line">
-              <xul:label class="label" value="&errLine.label;"/>
-              <xul:label class="label" xbl:inherits="value=line"/>
-            </xul:hbox>
-          </xul:box>
-          <xul:vbox class="console-row-code" xbl:inherits="selected,hidden=hideCode">
-            <xul:label class="monospace console-code" xbl:inherits="value=code" crop="end"/>
-            <xul:box xbl:inherits="hidden=hideCaret">
-              <xul:label class="monospace console-dots" xbl:inherits="value=errorDots"/>
-              <xul:label class="monospace console-caret" xbl:inherits="value=errorCaret"/>
-              <xul:spacer flex="1"/>
-            </xul:box>
-          </xul:vbox>
-        </xul:vbox>
-      </xul:box>
-    </content>
-
-    <implementation>
-      
-      <method name="toString">
-        <body><![CDATA[
-          var msg = this.getAttribute("typetext") + " " + this.getAttribute("msg");
-          
-          var strBundle = this._ConsoleBox.mStrBundle;
-          
-          if (this.hasAttribute("line") && this.hasAttribute("url")) {
-            msg += "\n" + strBundle.getFormattedString("errFile", 
-                                        [this.getAttribute("url")]) + "\n";
-            if (this.hasAttribute("col")) {
-              msg += strBundle.getFormattedString("errLineCol",
-                         [this.getAttribute("line"), this.getAttribute("col")]);
-            } else
-              msg += strBundle.getFormattedString("errLine", [this.getAttribute("line")]);
-          }
-          
-          if (this.hasAttribute("code"))
-            msg += "\n" + strBundle.getString("errCode") + "\n" + this.getAttribute("code");
-          
-          return msg;
-        ]]></body>
-      </method>
-      
-    </implementation>
-    
-  </binding>
-  
-  <binding id="message" extends="xul:box">
-    <content>
-      <xul:box class="console-internal-box" flex="1">
-        <xul:box class="console-row-icon" align="center">
-          <xul:image class="console-icon" xbl:inherits="src,type"/>
-        </xul:box>
-        <xul:vbox class="console-row-content" xbl:inherits="selected" flex="1">
-          <xul:vbox class="console-row-msg" flex="1">
-            <xul:description class="console-msg-text" xbl:inherits="xbl:text=msg"/>
-          </xul:vbox>
-        </xul:vbox>
-      </xul:box>
-    </content>
-
-    <implementation>
-      <method name="toString">
-        <body><![CDATA[
-          return this.getAttribute("msg");
-        ]]></body>
-      </method>
-    </implementation>
-  </binding>
-
-  <binding id="console-error-source" extends="xul:box">
-    <content>
-      <xul:label class="text-link" xbl:inherits="value=url" crop="right"/>
-    </content>
-
-    <handlers>
-      <handler event="click" button="0"><![CDATA[
-          var url = this.getAttribute("url");
-          var line = getAttribute("line");  
-          window.openDialog(
-            "chrome://navigator/content/viewSource.xul", "_blank", 
-            "all,dialog=no", url, null, null, line);
-      ]]></handler>
-    </handlers>
-  </binding>
-
-</bindings>
-
deleted file mode 100644
--- a/xpfe/components/console/resources/locale/en-US/console.dtd
+++ /dev/null
@@ -1,68 +0,0 @@
-<!-- ***** 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 Communicator client code, released
- March 31, 1998.
-
- The Initial Developer of the Original Code is
- Netscape Communications Corporation.
- Portions created by the Initial Developer are Copyright (C) 1998-1999
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
-
- 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 ***** -->
-
-<!ENTITY console.title "Error Console">
-
-<!ENTITY menuBar.tooltip      "Menu Bar">
-<!ENTITY modeToolbar.tooltip  "Mode Toolbar">
-<!ENTITY entryToolbar.tooltip "Javascript Entry Toolbar">
-<!ENTITY errFile.label   "Source File:">
-<!ENTITY errLine.label   "Line:">
-<!ENTITY errColumn.label "Column:">
-
-<!ENTITY all.label       "All">
-<!ENTITY all.accesskey   "A">
-<!ENTITY errors.label    "Errors">
-<!ENTITY errors.accesskey "r">
-<!ENTITY warnings.label  "Warnings">
-<!ENTITY warnings.accesskey "n">
-<!ENTITY messages.label  "Messages">
-<!ENTITY messages.accesskey "M">
-<!ENTITY clear.label     "Clear">
-<!ENTITY clear.accesskey "l">
-<!ENTITY evaluate.label  "Evaluate">
-
-<!ENTITY sortFirst.label "First > Last Sort Order">
-<!ENTITY sortFirst.accesskey "f">
-<!ENTITY sortLast.label  "Last > First Sort Order">
-<!ENTITY sortLast.accesskey  "l">
-
-<!ENTITY toolbarsCmd.label "Show/Hide">
-<!ENTITY toolbarsCmd.accesskey "w">
-<!ENTITY toolbarMode.label "Mode">
-<!ENTITY toolbarEval.label "JavaScript Entry">
-
deleted file mode 100644
--- a/xpfe/components/console/resources/locale/en-US/console.properties
+++ /dev/null
@@ -1,7 +0,0 @@
-typeError=Error:
-typeWarning=Warning:
-errFile=Source File: %S
-errLine=Line: %S
-errLineCol=Line: %S, Column: %S
-errCode=Source Code:
-
deleted file mode 100644
--- a/xpfe/components/extensions/Makefile.in
+++ /dev/null
@@ -1,48 +0,0 @@
-# ***** 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 The Extension Manager.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corp.
-# Portions created by the Initial Developer are Copyright (C) 2004
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#   Ben Goodger <ben@mozilla.org>
-#
-# 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 LGPL or the GPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-DEPTH		= ../../..
-topsrcdir	= @top_srcdir@
-srcdir		= @srcdir@
-VPATH		= @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-DIRS		= public src
-
-include $(topsrcdir)/config/rules.mk
-
deleted file mode 100644
--- a/xpfe/components/extensions/public/Makefile.in
+++ /dev/null
@@ -1,51 +0,0 @@
-# ***** 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 The Extension Manager.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corp.
-# Portions created by the Initial Developer are Copyright (C) 2004
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#   Ben Goodger <ben@mozilla.org>
-#
-# 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 LGPL or the GPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-DEPTH		= ../../../..
-topsrcdir	= @top_srcdir@
-srcdir		= @srcdir@
-VPATH		= @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MODULE		= extensions
-XPIDL_MODULE	= extensions
-
-XPIDLSRCS	= nsIExtensionManager.idl
-
-include $(topsrcdir)/config/rules.mk
-
deleted file mode 100644
--- a/xpfe/components/extensions/public/nsIExtensionManager.idl
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- Mode: IDL; 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 the Extension Manager.
- *
- * The Initial Developer of the Original Code is Ben Goodger.
- * Portions created by the Initial Developer are Copyright (C) 2004
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *  Ben Goodger <ben@bengoodger.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "nsISupports.idl"
-
-interface nsIFile;
-
-[scriptable, uuid(c3515b0f-99f4-453b-805e-1fdf5724d6d9)]
-interface nsIExtensionManager : nsISupports
-{
-  const unsigned long FLAG_INSTALL_PROFILE = 0x01;
-
-  void installExtension(in nsIFile aXPIFile, in unsigned long aFlags);
-  void installTheme(in nsIFile aJARFile, in unsigned long aFlags);
-};
-
deleted file mode 100644
--- a/xpfe/components/extensions/src/Makefile.in
+++ /dev/null
@@ -1,47 +0,0 @@
-# ***** 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 The Extension Manager.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corp.
-# Portions created by the Initial Developer are Copyright (C) 2004
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#   Ben Goodger <ben@mozilla.org>
-#
-# 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 LGPL or the GPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-DEPTH		= ../../../..
-topsrcdir	= @top_srcdir@
-srcdir		= @srcdir@
-VPATH		= @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-include $(topsrcdir)/config/rules.mk
-
-EXTRA_COMPONENTS = nsExtensionManager.js
deleted file mode 100644
--- a/xpfe/components/extensions/src/nsExtensionManager.js
+++ /dev/null
@@ -1,164 +0,0 @@
-/* -*- 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 the Extension Manager.
- *
- * The Initial Developer of the Original Code is Ben Goodger.
- * Portions created by the Initial Developer are Copyright (C) 2004
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *  Ben Goodger <ben@bengoodger.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// nsExtensionManager
-//
-function nsExtensionManager()
-{
-}
-
-nsExtensionManager.prototype = {
-  /////////////////////////////////////////////////////////////////////////////  
-  // nsIExtensionManager
-  installExtension: function (aXPIFile, aFlags)
-  {
-    throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
-  },
-  
-  installTheme: function (aJARFile, aFlags)
-  {
-    throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
-  },
-  
-  /////////////////////////////////////////////////////////////////////////////
-  // nsIClassInfo
-  getInterfaces: function (aCount)
-  {
-    var interfaces = [Components.interfaces.nsIExtensionManager];
-    aCount.value = interfaces.length;
-    return interfaces;
-  },
-  
-  getHelperForLanguage: function (aLanguage)
-  {
-    return null;
-  },
-  
-  get contractID() 
-  {
-    return "@mozilla.org/extensions/manager;1";
-  },
-  
-  get classDescription()
-  {
-    return "Extension Manager";
-  },
-  
-  get classID() 
-  {
-    return Components.ID("{8A115FAA-7DCB-4e8f-979B-5F53472F51CF}");
-  },
-  
-  get implementationLanguage()
-  {
-    return Components.interfaces.nsIProgrammingLanguage.JAVASCRIPT;
-  },
-  
-  get flags()
-  {
-    return Components.interfaces.nsIClassInfo.SINGLETON;
-  },
-
-  /////////////////////////////////////////////////////////////////////////////
-  // nsISupports
-  QueryInterface: function (aIID) 
-  {
-    if (!aIID.equals(Components.interfaces.nsIExtensionManager))
-      throw Components.results.NS_ERROR_NO_INTERFACE;
-    return this;
-  }
-};
-
-var gModule = {
-  _firstTime: true,
-  
-  registerSelf: function (aComponentManager, aFileSpec, aLocation, aType) 
-  {
-    if (this._firstTime) {
-      this._firstTime = false;
-      throw Components.results.NS_ERROR_FACTORY_REGISTER_AGAIN;
-    }
-    aComponentManager = aComponentManager.QueryInterface(Components.interfaces.nsIComponentRegistrar);
-    
-    for (var key in this._objects) {
-      var obj = this._objects[key];
-      aComponentManager.registerFactoryLocation(obj.CID, obj.className, obj.contractID,
-                                                aFileSpec, aLocation, aType);
-    }
-  },
-  
-  getClassObject: function (aComponentManager, aCID, aIID) 
-  {
-    if (!aIID.equals(Components.interfaces.nsIFactory))
-      throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
-
-    for (var key in this._objects) {
-      if (aCID.equals(this._objects[key].CID))
-        return this._objects[key].factory;
-    }
-    
-    throw Components.results.NS_ERROR_NO_INTERFACE;
-  },
-  
-  _objects: {
-    manager: { CID        : nsExtensionManager.prototype.classID,
-               contractID : nsExtensionManager.prototype.contractID,
-               className  : nsExtensionManager.prototype.classDescription,
-               factory    : {
-                              createInstance: function (aOuter, aIID) 
-                              {
-                                if (aOuter != null)
-                                  throw Components.results.NS_ERROR_NO_AGGREGATION;
-                                
-                                return (new nsExtensionManager()).QueryInterface(aIID);
-                              }
-                            }
-             }
-   },
-  
-  canUnload: function (aComponentManager) 
-  {
-    return true;
-  }
-};
-
-function NSGetModule(compMgr, fileSpec) 
-{
-  return gModule;
-}
deleted file mode 100644
--- a/xpfe/components/updates/Makefile.in
+++ /dev/null
@@ -1,48 +0,0 @@
-# ***** 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 the Update Notifier.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 2002
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#   Samir Gehani <sgehani@netscape.com> (Original Author)
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-DEPTH		= ../../..
-topsrcdir	= @top_srcdir@
-srcdir		= @srcdir@
-VPATH		= @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-DIRS		= src
-
-include $(topsrcdir)/config/rules.mk
-
deleted file mode 100644
--- a/xpfe/components/updates/src/Makefile.in
+++ /dev/null
@@ -1,51 +0,0 @@
-# ***** 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 the Update Notifier.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 2002
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#   Samir Gehani <sgehani@netscape.com> (Original Author)
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-DEPTH		= ../../../..
-topsrcdir	= @top_srcdir@
-srcdir		= @srcdir@
-VPATH		= @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-EXTRA_COMPONENTS = nsUpdateNotifier.js
-
-include $(topsrcdir)/config/rules.mk
-
-clean::
-	rm -f $(DIST)/bin/components/nsUpdateNotifier.js
-
deleted file mode 100644
--- a/xpfe/components/updates/src/README.html
+++ /dev/null
@@ -1,82 +0,0 @@
-<html>
-<!-- ***** 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 the Update Notifier.
-   -
-   - The Initial Developer of the Original Code is
-   - Netscape Communications Corporation.
-   - Portions created by the Initial Developer are Copyright (C) 2002
-   - the Initial Developer. All Rights Reserved.
-   -
-   - Contributor(s):
-   -   Samir Gehani <sgehani@netscape.com> (Original Author)
-   -
-   - 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 LGPL or the GPL. 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 ***** -->
-
-<body>
-<span class="LXRSHORTDESC">
-<h1>
-Update Notifications
-</h1>
-</span>
-
-<span class="LXRLONGDESC">
-<h2>
-The updates.rdf datasource
-</h2>
-The updates.rdf datasource is an RDF file containing information about the latest updates available for the client.  It can be stored remotely.  
-</span>
-
-<h3>
-The updates.rdf preference
-</h3>
-The updates.rdf datasource is stored in a localized pref in communicator-region's region.properties file.  The datasource pref is <code>update_notifications.provider.0.datasource</code>.  See the update notifications specification at: <a href="http://www.mozilla.org/xpapps/updates/spec.html">http://www.mozilla.org/xpapps/updates/spec.html</a>.
-
-<h3>
-The updates.rdf format
-</h3>
-This RDF file stores the product name, the latest version available, the regsitry name (as registered in the mozilla version registry), and the URL to take users to if a new update has been detected and users wish to get it. The update notification module looks for this information rooted at the <code>urn:updates:latest</code> node.<p>
-
-An example of the updates.rdf file follows:
-<xmp>
-<?xml version="1.0"?>
-<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-         xmlns:NC="http://home.netscape.com/NC-rdf#">
-
-  <RDF:Description about="urn:updates:latest">
-    <NC:registryName>Browser</NC:registryName>
-    <NC:version>1.0.0.0</NC:version>
-    <NC:URL>http://home.netscape.com/computing/download/index.html</NC:URL>
-    <NC:productName>Mozilla</NC:productName>
-  </RDF:Description>
-
-</RDF:RDF>
-</xmp>
-
-<hr>
-Contact: <a href="mailto:sgehani@netscape.com">sgehani@netscape.com</a>
-</body>
-</html>
deleted file mode 100644
--- a/xpfe/components/updates/src/nsUpdateNotifier.js
+++ /dev/null
@@ -1,633 +0,0 @@
-/* -*- Mode: Java; 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 the Update Notifier.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 2002
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *  Samir Gehani <sgehani@netscape.com> (Original Author)
- *
- * 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 ***** */
-
-const kDebug               = false;
-const kUpdateCheckDelay    = 5 * 60 * 1000; // 5 minutes
-const kUNEnabledPref       = "update_notifications.enabled";
-const kUNDatasourceURIPref = "update_notifications.provider.0.datasource";
-const kUNFrequencyPref     = "update_notifications.provider.0.frequency";
-const kUNLastCheckedPref   = "update_notifications.provider.0.last_checked";
-const kUNBundleURI         =
-  "chrome://communicator/locale/update-notifications.properties";
-
-////////////////////////////////////////////////////////////////////////
-//
-//   nsUpdateNotifier : nsIProfileStartupListener, nsIObserver
-//
-//   Checks for updates of the client by polling a distributor's website
-//   for the latest available version of the software and comparing it
-//   with the version of the running client.
-//
-////////////////////////////////////////////////////////////////////////
-
-var nsUpdateNotifier =
-{
-  mInitialized: false,
-
-  onProfileStartup: function(aProfileName)
-  {
-    debug("onProfileStartup");
-
-    // Check if we've already been called.
-    if (this.mInitialized)
-      return;
-    this.mInitialized = true;
-
-    // now wait for the first app window to open
-    var observerService = Components.
-      classes["@mozilla.org/observer-service;1"].
-      getService(Components.interfaces.nsIObserverService);
-    observerService.addObserver(this, "domwindowopened", false);
-  },
-
-  mTimer: null, // need to hold on to timer ref
-
-  observe: function(aSubject, aTopic, aData)
-  {
-    debug("observe: " + aTopic);
-
-    if (aTopic == "domwindowopened")
-    {
-      try
-      {
-        const kITimer = Components.interfaces.nsITimer;
-        this.mTimer = Components.classes["@mozilla.org/timer;1"].
-          createInstance(kITimer);
-        this.mTimer.init(this, kUpdateCheckDelay, kITimer.TYPE_ONE_SHOT);
-
-        // we are no longer interested in the ``domwindowopened'' topic
-        var observerService = Components.
-          classes["@mozilla.org/observer-service;1"].
-          getService(Components.interfaces.nsIObserverService);
-        observerService.removeObserver(this, "domwindowopened");
-
-        // but we are interested in removing our timer reference on XPCOM
-        // shutdown so as not to leak.
-        observerService.addObserver(this, "xpcom-shutdown", false);
-      }
-      catch (ex)
-      {
-        debug("Exception init'ing timer: " + ex);
-      }
-    }
-    else if (aTopic == "timer-callback")
-    {
-      this.mTimer = null; // free up timer so it can be gc'ed
-      this.checkForUpdate();
-    }
-    else if (aTopic == "xpcom-shutdown")
-    {
-      /*
-       * We need to drop our timer reference here to avoid a leak
-       * since the timer keeps a reference to the observer.
-       */
-      this.mTimer = null;
-    }
-  },
-
-  checkForUpdate: function()
-  {
-    debug("checkForUpdate");
-
-    if (this.shouldCheckForUpdate())
-    {
-      try
-      {
-        // get update ds URI from prefs
-        var prefs = Components.classes["@mozilla.org/preferences-service;1"].
-          getService(Components.interfaces.nsIPrefBranch);
-        var updateDatasourceURI = prefs.
-          getComplexValue(kUNDatasourceURIPref,
-          Components.interfaces.nsIPrefLocalizedString).data;
-
-        var rdf = Components.classes["@mozilla.org/rdf/rdf-service;1"].
-          getService(Components.interfaces.nsIRDFService);
-        var ds = rdf.GetDataSource(updateDatasourceURI);
-
-        ds = ds.QueryInterface(Components.interfaces.nsIRDFXMLSink);
-        ds.addXMLSinkObserver(nsUpdateDatasourceObserver);
-      }
-      catch (ex)
-      {
-        debug("Exception getting updates.rdf: " + ex);
-      }
-    }
-  },
-
-  shouldCheckForUpdate: function()
-  {
-    debug("shouldCheckForUpdate");
-
-    var shouldCheck = false;
-
-    try
-    {
-      var prefs = Components.classes["@mozilla.org/preferences-service;1"].
-        getService(Components.interfaces.nsIPrefBranch);
-
-      if (prefs.getBoolPref(kUNEnabledPref))
-      {
-        var freq = prefs.getIntPref(kUNFrequencyPref) * (24 * 60 * 60); // secs
-        var now = (new Date().valueOf())/1000; // secs
-
-        if (!prefs.prefHasUserValue(kUNLastCheckedPref))
-        {
-          // setting last_checked pref first time so must randomize in
-          // order that servers don't get flooded with updates.rdf checks
-          // (and eventually downloads of new clients) all at the same time
-
-          var randomizedLastChecked = now + freq * (1 + Math.random());
-          prefs.setIntPref(kUNLastCheckedPref, randomizedLastChecked);
-
-          return false;
-        }
-
-        var lastChecked = prefs.getIntPref(kUNLastCheckedPref);
-        if ((lastChecked + freq) > now)
-          return false;
-
-        prefs.setIntPref(kUNLastCheckedPref, now);
-        prefs = prefs.QueryInterface(Components.interfaces.nsIPrefService);
-        prefs.savePrefFile(null); // flush prefs now
-
-        shouldCheck = true;
-      }
-    }
-    catch (ex)
-    {
-      shouldCheck = false;
-      debug("Exception in shouldCheckForUpdate: " + ex);
-    }
-
-    return shouldCheck;
-  },
-
-  QueryInterface: function(aIID)
-  {
-    if (aIID.equals(Components.interfaces.nsIObserver) ||
-        aIID.equals(Components.interfaces.nsIProfileStartupListener) ||
-        aIID.equals(Components.interfaces.nsISupports))
-      return this;
-
-    Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
-    return null;
-  }
-}
-
-////////////////////////////////////////////////////////////////////////
-//
-//   nsUpdateDatasourceObserver : nsIRDFXMLSinkObserver
-//
-//   Gets relevant info on latest available update after the updates.rdf
-//   datasource has completed loading asynchronously.
-//
-////////////////////////////////////////////////////////////////////////
-
-var nsUpdateDatasourceObserver =
-{
-  onBeginLoad: function(aSink)
-  {
-  },
-
-  onInterrupt: function(aSink)
-  {
-  },
-
-  onResume: function(aSink)
-  {
-  },
-
-  onEndLoad: function(aSink)
-  {
-    debug("onEndLoad");
-
-    aSink.removeXMLSinkObserver(this);
-
-    var ds = aSink.QueryInterface(Components.interfaces.nsIRDFDataSource);
-    var updateInfo = this.getUpdateInfo(ds);
-    if (updateInfo && this.newerVersionAvailable(updateInfo))
-    {
-      var promptService = Components.
-        classes["@mozilla.org/embedcomp/prompt-service;1"].
-        getService(Components.interfaces.nsIPromptService);
-      var winWatcher = Components.
-        classes["@mozilla.org/embedcomp/window-watcher;1"].
-        getService(Components.interfaces.nsIWindowWatcher);
-
-      var unBundle = this.getBundle(kUNBundleURI);
-      if (!unBundle)
-        return;
-
-      var title = unBundle.formatStringFromName("title",
-        [updateInfo.productName], 1);
-      var desc = unBundle.formatStringFromName("desc",
-        [updateInfo.productName], 1);
-      var button0Text = unBundle.GetStringFromName("getItNow");
-      var button1Text = unBundle.GetStringFromName("noThanks");
-      var checkMsg = unBundle.GetStringFromName("dontAskAgain");
-      var checkVal = {value:0};
-
-      var result = promptService.confirmEx(winWatcher.activeWindow, title, desc,
-        (promptService.BUTTON_POS_0 * promptService.BUTTON_TITLE_IS_STRING) +
-        (promptService.BUTTON_POS_1 * promptService.BUTTON_TITLE_IS_STRING),
-        button0Text, button1Text, null, checkMsg, checkVal);
-
-      // user wants update now so open new window
-      // (result => 0 is button0)
-      if (result == 0)
-      {
-        var browserURL = "chrome://navigator/content/navigator.xul";
-        try {
-          browserURL = Components.classes["@mozilla.org/preferences-service;1"]
-                                 .getService(Components.interfaces.nsIPrefBranch)
-                                 .getCharPref("browser.chromeURL");
-        } catch (e) {
-        }
-
-        var argstring = Components.classes["@mozilla.org/supports-string;1"]
-                                  .createInstance(Components.interfaces.nsISupportsString);
-        argstring.data = updateInfo.URL;
-        winWatcher.openWindow(winWatcher.activeWindow, browserURL,
-                              "_blank", "chrome,all,dialog=no", argstring);
-      }
-
-      // if "Don't ask again" was checked disable update notifications
-      if (checkVal.value)
-      {
-        var prefs = Components.classes["@mozilla.org/preferences-service;1"].
-          getService(Components.interfaces.nsIPrefBranch);
-        prefs.setBoolPref(kUNEnabledPref, false);
-      }
-    }
-  },
-
-  onError: function(aSink, aStatus, aErrorMsg)
-  {
-    debug("Error " + aStatus + ": " + aErrorMsg);
-    aSink.removeXMLSinkObserver(this);
-  },
-
-  getUpdateInfo: function(aDS)
-  {
-    var info = null;
-
-    try
-    {
-      var rdf = Components.classes["@mozilla.org/rdf/rdf-service;1"].
-        getService(Components.interfaces.nsIRDFService);
-      var src = "urn:updates:latest";
-
-      info = new Object;
-      info.registryName = this.getTarget(rdf, aDS, src, "registryName");
-      info.version = this.getTarget(rdf, aDS, src, "version");
-      info.URL = this.getTarget(rdf, aDS, src, "URL");
-      info.productName = this.getTarget(rdf, aDS, src, "productName");
-    }
-    catch (ex)
-    {
-      info = null;
-      debug("Exception getting update info: " + ex);
-
-      // NOTE: If the (possibly remote) datasource doesn't exist
-      //       or fails to load the first |GetTarget()| call will fail
-      //       bringing us to this exception handler.  In turn, we
-      //       will fail silently.  Testing has revealed that for a
-      //       non-existent datasource (invalid URI) the
-      //       |nsIRDFXMLSinkObserver.onEndLoad()| is called instead of
-      //       |nsIRDFXMLSinkObserver.onError()| as one may expect.  In
-      //       addition, if we QI the aSink parameter of |onEndLoad()|
-      //       to an |nsIRDFRemoteDataSource| and check the |loaded|
-      //       boolean, it reflects true so we can't use that.  The
-      //       safe way to know we have failed to load the datasource
-      //       is by handling the first exception as we are doing now.
-    }
-
-    return info;
-  },
-
-  getTarget: function(aRDF, aDS, aSrc, aProp)
-  {
-    var src = aRDF.GetResource(aSrc);
-    var arc = aRDF.GetResource("http://home.netscape.com/NC-rdf#" + aProp);
-    var target = aDS.GetTarget(src, arc, true);
-    return target.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
-  },
-
-  newerVersionAvailable: function(aUpdateInfo)
-  {
-    // sanity check
-    if (!aUpdateInfo.registryName || !aUpdateInfo.version)
-    {
-      debug("Sanity check failed: aUpdateInfo is invalid!");
-      return false;
-    }
-
-    // when we know we are updating the ``Browser'' component
-    // we can rely on Necko to give us the app version
-
-    if (aUpdateInfo.registryName == "Browser")
-      return this.neckoHaveNewer(aUpdateInfo);
-
-    return this.xpinstallHaveNewer(aUpdateInfo);
-  },
-
-  neckoHaveNewer: function(aUpdateInfo)
-  {
-    try
-    {
-      var httpHandler = Components.
-        classes["@mozilla.org/network/protocol;1?name=http"].
-        getService(Components.interfaces.nsIHttpProtocolHandler);
-      var synthesized = this.synthesizeVersion(httpHandler.misc,
-        httpHandler.productSub);
-      var local = new nsVersion(synthesized);
-      var server = new nsVersion(aUpdateInfo.version);
-
-      return (server.isNewerThan(local));
-    }
-    catch (ex)
-    {
-      // fail silently
-      debug("Exception getting httpHandler: " + ex);
-      return false;
-    }
-
-    return false; // return value expected from this function
-  },
-
-  xpinstallHaveNewer: function(aUpdateInfo)
-  {
-    // XXX Once InstallTrigger is a component we will be able to
-    //     get at it without needing to reference it from hiddenDOMWindow.
-    //     This will enable us to |compareVersion()|s even when
-    //     XPInstall is disabled but update notifications are enabled.
-    //     See <http://bugzilla.mozilla.org/show_bug.cgi?id=121506>.
-    var ass = Components.classes["@mozilla.org/appshell/appShellService;1"].
-      getService(Components.interfaces.nsIAppShellService);
-    var trigger = ass.hiddenDOMWindow.InstallTrigger;
-    var diffLevel = trigger.compareVersion(aUpdateInfo.registryName,
-      aUpdateInfo.version);
-    if (diffLevel < trigger.EQUAL && diffLevel != trigger.NOT_FOUND)
-      return true;
-    return false; // already have newer version or
-                  // fail silently if old version not found on disk
-  },
-
-  synthesizeVersion: function(aMisc, aProductSub)
-  {
-    // Strip out portion of nsIHttpProtocolHandler.misc that
-    // contains version info and stuff all ``missing'' portions
-    // with a default 0 value.  We are interested in the first 3
-    // numbers delimited by periods.  The 4th comes from aProductSub.
-    // e.g., x => x.0.0, x.1 => x.1.0, x.1.2 => x.1.2, x.1.2.3 => x.1.2
-
-    var synthesized = "0.0.0.";
-
-    // match only digits and periods after "rv:" in the misc
-    var onlyVer = /rv:([0-9.]+)/.exec(aMisc);
-
-    // original string in onlyVer[0], matched substring in onlyVer[1]
-    if (onlyVer && onlyVer.length >= 2)
-    {
-      var parts = onlyVer[1].split('.');
-      var len = parts.length;
-      if (len > 0)
-      {
-        synthesized = "";
-
-        // extract first 3 dot delimited numbers in misc (after "rv:")
-        for (var i = 0; i < 3; ++i)
-        {
-          synthesized += ((len >= i+1) ? parts[i] : "0") + ".";
-        }
-      }
-    }
-
-    // tack on productSub for nsVersion.mBuild field if available
-    synthesized += aProductSub ? aProductSub : "0";
-
-    return synthesized;
-  },
-
-  getBundle: function(aURI)
-  {
-    if (!aURI)
-      return null;
-
-    var bundle = null;
-    try
-    {
-      var strBundleService = Components.
-        classes["@mozilla.org/intl/stringbundle;1"].
-        getService(Components.interfaces.nsIStringBundleService);
-      bundle = strBundleService.createBundle(aURI);
-    }
-    catch (ex)
-    {
-      bundle = null;
-      debug("Exception getting bundle " + aURI + ": " + ex);
-    }
-
-    return bundle;
-  }
-}
-
-////////////////////////////////////////////////////////////////////////
-//
-//   nsVersion
-//
-//   Constructs a version object given a string representation.  This
-//   constructor populates the mMajor, mMinor, mRelease, and mBuild
-//   fields regardless of whether string contains all the fields.
-//   The default for all unspecified fields is 0.
-//
-////////////////////////////////////////////////////////////////////////
-
-function nsVersion(aStringVersion)
-{
-  var parts = aStringVersion.split('.');
-  var len = parts.length;
-
-  this.mMajor   = (len >= 1) ? this.getValidInt(parts[0]) : 0;
-  this.mMinor   = (len >= 2) ? this.getValidInt(parts[1]) : 0;
-  this.mRelease = (len >= 3) ? this.getValidInt(parts[2]) : 0;
-  this.mBuild   = (len >= 4) ? this.getValidInt(parts[3]) : 0;
-}
-
-nsVersion.prototype =
-{
-  isNewerThan: function(aOther)
-  {
-    if (this.mMajor == aOther.mMajor)
-    {
-      if (this.mMinor == aOther.mMinor)
-      {
-        if (this.mRelease == aOther.mRelease)
-        {
-          if (this.mBuild <= aOther.mBuild)
-            return false;
-          else
-            return true; // build is newer
-        }
-        else if (this.mRelease < aOther.mRelease)
-          return false;
-        el