Commits

Makoto Kato committed 39ecac5

Sync CVS @ 2008-12-08 20:54 JST

  • Participants
  • Parent commits 2aa8ea2

Comments (0)

Files changed (169)

File accessible/src/base/nsAccessibilityUtils.cpp

   }
 }
 
+already_AddRefed<nsIAccessibleText>
+nsAccUtils::GetTextAccessibleFromSelection(nsISelection *aSelection,
+                                           nsIDOMNode **aNode)
+{
+  // Get accessible from selection's focus DOM point (the DOM point where
+  // selection is ended).
+  
+  nsCOMPtr<nsIDOMNode> resultNode;
+  aSelection->GetFocusNode(getter_AddRefs(resultNode));
+  if (!resultNode)
+    return nsnull;
+  
+  // Get DOM node that focus DOM point points to.
+  nsCOMPtr<nsIContent> content(do_QueryInterface(resultNode));
+  if (content && content->IsNodeOfType(nsINode::eELEMENT)) {
+    PRInt32 offset = 0;
+    aSelection->GetFocusOffset(&offset);
+    
+    PRInt32 childCount = static_cast<PRInt32>(content->GetChildCount());
+    NS_ASSERTION(offset >= 0 && offset <= childCount,
+                 "Wrong focus offset in selection!");
+    
+    // The offset can be after last child of container node that means DOM point
+    // is placed immediately after the last child. In this case use focusNode
+    // as result node.
+    if (offset != childCount) {
+      nsCOMPtr<nsIContent> child = content->GetChildAt(offset);
+      resultNode = do_QueryInterface(child);
+    }
+  }
+  
+  nsIAccessibilityService *accService = nsAccessNode::GetAccService();
+  
+  // Get text accessible containing the result node.
+  while (resultNode) {
+    // Make sure to get the correct starting node for selection events inside
+    // XBL content trees.
+    nsCOMPtr<nsIDOMNode> relevantNode;
+    nsresult rv = accService->
+    GetRelevantContentNodeFor(resultNode, getter_AddRefs(relevantNode));
+    if (NS_FAILED(rv))
+      return nsnull;
+    
+    if (relevantNode)
+      resultNode.swap(relevantNode);
+    
+    nsCOMPtr<nsIContent> content = do_QueryInterface(resultNode);
+    if (!content || !content->IsNodeOfType(nsINode::eTEXT)) {
+      nsCOMPtr<nsIAccessible> accessible;
+      accService->GetAccessibleFor(resultNode, getter_AddRefs(accessible));
+      if (accessible) {
+        nsIAccessibleText *textAcc = nsnull;
+        CallQueryInterface(accessible, &textAcc);
+        if (textAcc) {
+          if (aNode)
+            NS_ADDREF(*aNode = resultNode);
+          
+          return textAcc;
+        }
+      }
+    }
+    
+    nsCOMPtr<nsIDOMNode> parentNode;
+    resultNode->GetParentNode(getter_AddRefs(parentNode));
+    resultNode.swap(parentNode);
+  }
+  
+  NS_NOTREACHED("No nsIAccessibleText for selection change event!");
+  
+  return nsnull;
+}
+
 nsresult
 nsAccUtils::ScrollSubstringTo(nsIFrame *aFrame,
                               nsIDOMNode *aStartNode, PRInt32 aStartIndex,

File accessible/src/base/nsAccessibilityUtils.h

 #include "nsIDocShellTreeItem.h"
 #include "nsPoint.h"
 #include "nsIAccessibleDocument.h"
+#include "nsIAccessibleText.h"
 
 class nsAccUtils
 {
                            nsIAccessible **aTreeItemParent);
 
   /**
+   * Return text accessible containing focus point of the given selection.
+   * Used for normal and misspelling selection changes processing.
+   *
+   * @param aSelection  [in] the given selection
+   * @param aNode       [out, optional] the DOM node of text accessible
+   * @return            text accessible
+   */
+  static already_AddRefed<nsIAccessibleText>
+  GetTextAccessibleFromSelection(nsISelection *aSelection,
+                                 nsIDOMNode **aNode = nsnull);
+
+  /**
    * Helper method to scroll range into view, used for implementation of
    * nsIAccessibleText::scrollSubstringTo().
    *

File accessible/src/base/nsCaretAccessible.cpp

 
 NS_IMETHODIMP nsCaretAccessible::NotifySelectionChanged(nsIDOMDocument *aDoc, nsISelection *aSel, PRInt16 aReason)
 {
+  NS_ENSURE_ARG(aDoc);
+  
+  nsCOMPtr<nsIDOMNode> docNode(do_QueryInterface(aDoc));
+  nsCOMPtr<nsIAccessibleDocument> accDoc =
+    nsAccessNode::GetDocAccessibleFor(docNode);
+  
+  // Don't fire events until document is loaded.
+  if (!accDoc)
+    return NS_OK;
+  
+  nsCOMPtr<nsIAccessible> accForDoc(do_QueryInterface(accDoc));
+  if (nsAccessible::State(accForDoc) & nsIAccessibleStates::STATE_BUSY)
+    return NS_OK;
+
   NS_ENSURE_TRUE(mRootAccessible, NS_ERROR_FAILURE);
 
   mLastUsedSelection = do_GetWeakReference(aSel);
 
-  nsCOMPtr<nsIDocument> doc = do_QueryInterface(aDoc);
-  NS_ENSURE_TRUE(doc, NS_OK);
-  nsIPresShell *presShell = doc->GetPrimaryShell();
-  NS_ENSURE_TRUE(presShell, NS_OK);
+  PRInt32 rangeCount = 0;
+  nsresult rv = aSel->GetRangeCount(&rangeCount);
+  NS_ENSURE_SUCCESS(rv, rv);
 
-  // Get first nsIAccessibleText in parent chain and fire caret-move, selection-change event for it
-  nsCOMPtr<nsIAccessible> accessible;
-  nsIAccessibilityService *accService = mRootAccessible->GetAccService();
-  NS_ENSURE_TRUE(accService, NS_ERROR_FAILURE);
-  // Get accessible from selection's focus node or its parent
-  nsCOMPtr<nsIDOMNode> focusNode;
-  aSel->GetFocusNode(getter_AddRefs(focusNode));
-  if (!focusNode) {
+  if (rangeCount == 0) {
     mLastTextAccessible = nsnull;
     return NS_OK; // No selection
   }
 
-  nsCOMPtr<nsIAccessibleDocument> docAccessible =
-    nsAccessNode::GetDocAccessibleFor(focusNode);
-  nsCOMPtr<nsIAccessible> accessibleForDoc =
-    do_QueryInterface(docAccessible);
-  if (!accessibleForDoc) {
-    return NS_OK;
-  }
-  PRUint32 docState;
-  accessibleForDoc->GetFinalState(&docState, nsnull);
-  if (docState & nsIAccessibleStates::STATE_BUSY) {
-    return NS_OK;  // Don't fire caret moves until doc loaded
-  }
-
-  nsCOMPtr<nsIDOMNode> nodeWithCaret = focusNode;
-
-  nsCOMPtr<nsIAccessibleText> textAcc;
-  while (focusNode) {
-    // Make sure to get the correct starting node for selection events inside XBL content trees
-    nsCOMPtr<nsIDOMNode> relevantNode;
-    if (NS_SUCCEEDED(accService->GetRelevantContentNodeFor(focusNode, getter_AddRefs(relevantNode))) && relevantNode) {
-      focusNode  = relevantNode;
-    }
-
-    nsCOMPtr<nsIContent> content = do_QueryInterface(focusNode);
-    if (!content || !content->IsNodeOfType(nsINode::eTEXT)) {
-      accService->GetAccessibleInShell(focusNode, presShell,  getter_AddRefs(accessible));
-      textAcc = do_QueryInterface(accessible);
-      if (textAcc) {
-        break;
-      }
-    }
-    nsCOMPtr<nsIDOMNode> parentNode;
-    focusNode->GetParentNode(getter_AddRefs(parentNode));
-    focusNode.swap(parentNode);
-  }
-  NS_ASSERTION(textAcc, "No nsIAccessibleText for caret move event!"); // No nsIAccessibleText for caret move event!
-  NS_ENSURE_TRUE(textAcc, NS_ERROR_FAILURE);
+  nsCOMPtr<nsIDOMNode> textNode;
+  nsCOMPtr<nsIAccessibleText> textAcc =
+    nsAccUtils::GetTextAccessibleFromSelection(aSel, getter_AddRefs(textNode));
+  NS_ENSURE_STATE(textAcc);
 
   PRInt32 caretOffset;
-  nsresult rv = textAcc->GetCaretOffset(&caretOffset);
+  rv = textAcc->GetCaretOffset(&caretOffset);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (textAcc == mLastTextAccessible && caretOffset == mLastCaretOffset) {
   mLastTextAccessible = textAcc;
 
   nsCOMPtr<nsIAccessibleCaretMoveEvent> event =
-    new nsAccCaretMoveEvent(focusNode);
+    new nsAccCaretMoveEvent(textNode);
   NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY);
 
   return mRootAccessible->FireDelayedAccessibleEvent(event);

File accessible/tests/mochitest/Makefile.in

 		test_bug368835.xul \
 		test_bug420863.html \
 		test_cssattrs.html \
+		test_events_caretmove.html \
 		test_groupattrs.xul \
 	$(warning test_table_indexes.html temporarily disabled) \
 		test_nsIAccessible_actions.html \

File accessible/tests/mochitest/test_events_caretmove.html

+<html>
+
+<head>
+  <title>Accessible caret move events testing</title>
+
+  <link rel="stylesheet" type="text/css"
+        href="chrome://mochikit/content/tests/SimpleTest/test.css" />
+
+  <script type="application/javascript"
+          src="chrome://mochikit/content/MochiKit/packed.js"></script>
+  <script type="application/javascript"
+          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript"
+          src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
+
+  <script type="application/javascript"
+          src="chrome://mochikit/content/a11y/accessible/common.js"></script>
+
+  <script type="application/javascript">
+    function synthMouseTest(aNode)
+    {
+      this.node = aNode;
+      this.testFunc = function testFunc()
+      {
+        synthesizeMouse(this.node, 1, 1, {});
+      }
+    }
+
+    function synthKeyTest(aNode, aKey)
+    {
+      this.node = aNode;
+      this.testFunc = function testFunc()
+      {
+        synthesizeKey(aKey, {});
+      }
+    }
+
+    function synthTabTest(aNode, aBackTab)
+    {
+      this.node = aNode;
+      this.testFunc = function testFunc()
+      {
+        synthesizeKey("VK_TAB", {shiftKey: aBackTab});
+      }
+    }
+
+    function synthFocusTest(aNode)
+    {
+      // bug 460417
+      this.node = aNode;
+      this.testFunc = function testFunc()
+      {
+        this.node.focus();
+      }
+    }
+
+    function synthSelectAllTest(aNode)
+    {
+      // bug 460417
+      this.node = aNode;
+      this.testFunc = function testFunc()
+      {
+        this.node.select();
+      }
+    }
+
+    var gTestsArray = [];
+    var gTestIdx = -1;
+
+    var gCaretMoveHandler =
+    {
+      handleEvent: function handleEvent(aEvent)
+      {
+        if (aEvent.DOMNode == gTestsArray[gTestIdx].node)
+          gTestsArray[gTestIdx].wasCaught = true;
+      }
+    };
+
+    function doTest()
+    {
+      window.setTimeout(
+        function()
+        {
+          if (gTestIdx == gTestsArray.length - 1) {
+          
+            unregisterA11yEventListener(nsIAccessibleEvent.EVENT_TEXT_CARET_MOVED,
+                                        gCaretMoveHandler);
+
+            for (var idx = 0; idx < gTestsArray.length; idx++)
+              ok(gTestsArray[idx].wasCaught, "test " + idx + " failed");
+
+            SimpleTest.finish();
+            return;
+          }
+
+          gTestsArray[++gTestIdx].testFunc();
+          doTest();
+        },
+        100
+      );
+    }
+
+    function doTests()
+    {
+      var textbox = document.getElementById("textbox");
+      textbox.boxObject = getBoxObjectForHTMLElm(textbox);
+
+      gTestsArray.push(new synthFocusTest(textbox));
+      gTestsArray.push(new synthSelectAllTest(textbox));
+      gTestsArray.push(new synthMouseTest(textbox));
+      gTestsArray.push(new synthKeyTest(textbox, "VK_RIGHT"));
+
+      var textarea = document.getElementById("textarea");
+      textarea.boxObject = getBoxObjectForHTMLElm(textarea);
+
+      gTestsArray.push(new synthMouseTest(textarea));
+      gTestsArray.push(new synthKeyTest(textarea, "VK_RIGHT"));
+      gTestsArray.push(new synthKeyTest(textarea, "VK_DOWN"));
+
+      var p = document.getElementById("p");
+      p.boxObject = getBoxObjectForHTMLElm(p);
+
+      gTestsArray.push(new synthMouseTest(p));
+      gTestsArray.push(new synthKeyTest(p, "VK_RIGHT"));
+      gTestsArray.push(new synthKeyTest(p, "VK_DOWN"));
+
+      gTestsArray.push(new synthTabTest(textarea, true));
+      gTestsArray.push(new synthTabTest(p));
+
+      registerA11yEventListener(nsIAccessibleEvent.EVENT_TEXT_CARET_MOVED,
+                                gCaretMoveHandler);
+
+      doTest();
+    }
+
+    function getBoxObjectForHTMLElm(aElm)
+    {
+      var boxObject = {
+        x: aElm.offsetLeft,
+        y: aElm.offsetTop
+      };
+
+      var parent = aElm;
+      while ((parent = parent.parentNode) != document) {
+        boxObject.x += parent.offsetLeft;
+        boxObject.y += parent.offsetTop;
+      }
+
+      return boxObject;
+    }
+
+    SimpleTest.waitForExplicitFinish();
+    addLoadEvent(doTests);
+  </script>
+</head>
+
+<body>
+
+  <a target="_blank"
+     href="https://bugzilla.mozilla.org/show_bug.cgi?id=454377"
+     title="Accessible caret move events testing">
+    Mozilla Bug 454377
+  </a>
+  <p id="display"></p>
+  <div id="content" style="display: none"></div>
+  <pre id="test">
+  </pre>
+
+  <input id="textbox" value="hello"/>
+  <textarea id="textarea">text<br>text</textarea>
+  <p id="p" contentEditable="true"><span>text</span><br/>text</p>
+
+</body>
+</html>

File accessible/tests/mochitest/test_nsIAccessible_focus.html

             ok(aFocusMgr.mIsFocusHandled,
                "Focus wasn't recieved for element with ID " + aFocusMgr.mName + ".");
 
-            if (aFocusMgr.mName != "aria-link") {
+            if ((aFocusMgr.mName != "aria-link") && (aFocusMgr.mName != "aria-link2")) {
               var states = {}, extraStates = {};
               aFocusMgr.mAcc.getFinalState(states, extraStates);
               ok(states.value & nsIAccessibleStates.STATE_FOCUSED,

File browser/EULA.rtf

-{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fmodern\fprq1\fcharset0 MS Shell Dialog;}}
-\viewkind4\uc1\pard\cf1\lang1033\b\f0\fs20 MOZILLA FIREFOX END-USER SOFTWARE LICENSE AGREEMENT\b0\par
-Version 3.0, May 2008\par
-\par
-\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 www.mozilla.org under the Mozilla Public License and other open source software licenses.\b0\par
-\par
-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.\b0\par
-\par
-\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.\b0\par
-\par
-\b 1.  LICENSE GRANT.\b0  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.\par
-\par
-\b 2.  TERMINATION.\b0  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.\par
-\par
-\b 3.  PROPRIETARY RIGHTS.\b0  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.\par
-\par
-\b 4.  PRIVACY POLICY.\b0  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.\par
-\par
-\b 5.  WEBSITE INFORMATION SERVICES.\b0  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.\par
-\par
-\b 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.\b0\par
-\par
-\b 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.\b0\par
-\par
-\b 8.  EXPORT CONTROLS.\b0  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.\par
-\par
-\b 9.  U.S. GOVERNMENT END-USERS.\b0  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.\par
-\par
-\b 10.  MISCELLANEOUS.\b0  (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.\par
-}

File browser/app/Makefile.in

 	cp $(srcdir)/macbuild/dsstore $(DIST)/branding/dsstore
 	cp $(srcdir)/macbuild/background.png $(DIST)/branding/background.png
 	cp $(srcdir)/macbuild/disk.icns $(DIST)/branding/disk.icns
-	cp $(srcdir)/macbuild/license.r $(DIST)/branding/license.r
 endif
 ifneq (,$(filter gtk2,$(MOZ_WIDGET_TOOLKIT)))
 	cp $(srcdir)/mozicon128.png $(DIST)/branding/mozicon128.png

File browser/app/macbuild/license.r

-// See /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/Script.h for language IDs.
-data 'LPic' (5000) {
-  // Default language ID, 0 = English
-  $"0000"
-  // Number of entries in list
-  $"0001"
-
-  // Entry 1
-  // Language ID, 0 = English
-  $"0000"
-  // Resource ID, 0 = STR#/TEXT/styl 5000
-  $"0000"
-  // Multibyte language, 0 = no
-  $"0000"
-};
-
-resource 'STR#' (5000, "English") {
-  {
-    // Language (unused?) = English
-    "English",
-    // Accept (Agree)
-    "Accept",
-    // Decline (Disagree)
-    "Decline",
-    // Print, ellipsis is 0xC9
-    "Print�",
-    // Save As, ellipsis is 0xC9
-    "Save As�",
-    // Descriptive text, curly quotes are 0xD2 and 0xD3
-    "You are about to install\n"
-    "Minefield.\n"
-    "\n"
-    "Please read the license agreement.  If you agree to its terms and accept, click �Accept� to access the software.  Otherwise, click �Decline� to cancel."
-  };
-};
-
-// 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 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://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"
-  "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"
-  "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"
-  "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"
-  "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"
-  "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"
-  "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"
-
-  // Style 1.  This is used to display the header lines in bold text.
-  // Start character = 0
-  $"0000 0000"
-  // 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
-  $"01"
-  // Style, unused?
-  $"02"
-  // Size = 12 point
-  $"000C"
-  // Color, RGB
-  $"0000 0000 0000"
-
-  // Style 2.  This is used to display the body.
-  // 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
-  $"00"
-  // Style, unused?
-  $"02"
-  // Size = 12 point
-  $"000C"
-  // Color, RGB
-  $"0000 0000 0000"
-};

File browser/app/module.ver

 WIN32_MODULE_COMPANYNAME=Mozilla Corporation
 WIN32_MODULE_COPYRIGHT=�Firefox and Mozilla Developers, according to the MPL 1.1/GPL 2.0/LGPL 2.1 licenses, as applicable.
-WIN32_MODULE_PRODUCTVERSION=3,0,5,0
-WIN32_MODULE_PRODUCTVERSION_STRING=3.0.5pre
+WIN32_MODULE_PRODUCTVERSION=3,0,6,0
+WIN32_MODULE_PRODUCTVERSION_STRING=3.0.6pre
 WIN32_MODULE_TRADEMARKS=Firefox is a Trademark of The Mozilla Foundation.
 WIN32_MODULE_DESCRIPTION=Firefox
 WIN32_MODULE_PRODUCTNAME=Firefox

File browser/app/profile/firefox.js

 pref("browser.safebrowsing.malware.enabled", true);
 
 // Non-enhanced mode (local url lists) URL list to check for updates
-pref("browser.safebrowsing.provider.0.updateURL", "http://safebrowsing.clients.google.com/safebrowsing/downloads?client={moz:client}&appver={moz:version}&pver=2.1");
+pref("browser.safebrowsing.provider.0.updateURL", "http://safebrowsing.clients.google.com/safebrowsing/downloads?client={moz:client}&appver={moz:version}&pver=2.2");
 
 pref("browser.safebrowsing.dataProvider", 0);
 
 // Does the provider name need to be localizable?
 pref("browser.safebrowsing.provider.0.name", "Google");
 pref("browser.safebrowsing.provider.0.lookupURL", "http://safebrowsing.clients.google.com/safebrowsing/lookup?sourceid=firefox-antiphish&features=TrustRank&client={moz:client}&appver={moz:version}&");
-pref("browser.safebrowsing.provider.0.keyURL", "https://sb-ssl.google.com/safebrowsing/newkey?client={moz:client}&appver={moz:version}&pver=2.1");
+pref("browser.safebrowsing.provider.0.keyURL", "https://sb-ssl.google.com/safebrowsing/newkey?client={moz:client}&appver={moz:version}&pver=2.2");
 pref("browser.safebrowsing.provider.0.reportURL", "http://safebrowsing.clients.google.com/safebrowsing/report?");
-pref("browser.safebrowsing.provider.0.gethashURL", "http://safebrowsing.clients.google.com/safebrowsing/gethash?client={moz:client}&appver={moz:version}&pver=2.1");
+pref("browser.safebrowsing.provider.0.gethashURL", "http://safebrowsing.clients.google.com/safebrowsing/gethash?client={moz:client}&appver={moz:version}&pver=2.2");
 
 // privacy policy -- Both url and fallbackurl must exist, although they may
 // point to the same file.  fallbackurl must be a chrome url
 
 #endif
 
-// 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
-pref("browser.EULA.3.accepted", false);
-#endif
-
-// if we rev the EULA again, we should bump this so users agree to the new EULA
 pref("browser.EULA.version", 3);
+pref("browser.rights.version", 3);
+pref("browser.rights.3.shown", false);
 
 #ifdef DEBUG
-pref("browser.EULA.override", true);
+// Don't show the about:rights notification in debug builds.
+pref("browser.rights.override", true);
 #endif
 
 pref("browser.sessionstore.enabled", true);

File browser/base/Makefile.in

 ifneq (,$(filter windows mac cocoa gtk2, $(MOZ_WIDGET_TOOLKIT)))
 DEFINES += -DCONTEXT_COPY_IMAGE_CONTENTS=1
 endif
+
+ifneq (,$(BUILD_OFFICIAL)$(MOZILLA_OFFICIAL))
+DEFINES += -DOFFICIAL_BUILD=1
+endif

File browser/base/content/aboutRights.xhtml

+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html [
+  <!ENTITY % htmlDTD PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+  %htmlDTD;
+  <!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
+  %brandDTD;
+  <!ENTITY % securityPrefsDTD SYSTEM "chrome://browser/locale/preferences/security.dtd">
+  %securityPrefsDTD;
+  <!ENTITY % aboutRightsDTD SYSTEM "chrome://browser/locale/aboutRights.dtd">
+  %aboutRightsDTD;
+]>
+# ***** 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
+# Gervase Markham.
+# Portions created by the Initial Developer are Copyright (C) 2008
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#   Justin Dolske <dolske@mozilla.com>
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+<head>
+  <title>&rights.pagetitle;</title>
+  <link rel="stylesheet" href="chrome://global/skin/about.css" type="text/css"/>
+</head>
+
+<body id="your-rights" dir="&rights.locale-direction;">
+<div id="aboutPageContainer" class="aboutPageWideContainer">
+
+<h1>&rights.intro-header;</h1>
+
+<p>&rights.intro;</p>
+
+<ul>
+  <li>&rights.intro-point1a;<a href="http://www.mozilla.org/MPL/">&rights.intro-point1b;</a>&rights.intro-point1c;</li>
+#ifdef OFFICIAL_BUILD
+# Point 2 discusses Mozilla trademarks, and isn't needed when the build is unbranded.
+# Point 3 discusses privacy policy, unbranded builds get a placeholder (for the vendor to replace)
+# Point 4 discusses web service terms, unbranded builds gets a placeholder (for the vendor to replace)
+  <li>&rights.intro-point2a;<a href="http://www.mozilla.org/foundation/trademarks/policy.html">&rights.intro-point2b;</a>&rights.intro-point2c;</li>
+  <li>&rights.intro-point3a;<a href="http://www.mozilla.com/legal/privacy/">&rights.intro-point3b;</a>&rights.intro-point3c;</li>
+  <li>&rights.intro-point4a;<a href="about:rights#webservices" onclick="showServices();">&rights.intro-point4b;</a>&rights.intro-point4c;</li>
+#else
+  <li>&rights.intro-point3-unbranded;</li>
+  <li>&rights.intro-point4a-unbranded;<a href="about:rights#webservices" onclick="showServices();">&rights.intro-point4b-unbranded;</a>&rights.intro-point4c-unbranded;</li>
+#endif
+</ul>
+
+<div id="webservices-container">
+  <a name="webservices"/>
+  <h3>&rights.webservices-header;</h3>
+
+#ifdef OFFICIAL_BUILD
+  <p>&rights.webservices-a;<code>&rights.webservices-b;</code>&rights.webservices-c-190;</p>
+#else
+  <p>&rights.webservices-unbranded;</p>
+#endif
+
+  <ol>
+#ifdef OFFICIAL_BUILD
+# Terms only apply to official builds, unbranded builds get a placeholder.
+    <li>&rights.webservices-term1;</li>
+    <li>&rights.webservices-term2;</li>
+    <li>&rights.webservices-term3;</li>
+    <li><strong>&rights.webservices-term4;</strong></li>
+    <li><strong>&rights.webservices-term5;</strong></li>
+    <li>&rights.webservices-term6;</li>
+    <li>&rights.webservices-term7;</li>
+#else
+    <li>&rights.webservices-term1-unbranded;</li>
+#endif
+  </ol>
+</div>
+
+<script type="application/x-javascript"><![CDATA[
+  var servicesDiv = document.getElementById("webservices-container");
+  servicesDiv.style.display = "none";
+
+  function showServices() {
+    servicesDiv.style.display = "";
+  }
+]]></script>
+
+</div>
+</body>
+</html>

File browser/base/jar.mn

 *       content/browser/aboutDialog.xul               (content/aboutDialog.xul)
 *       content/browser/aboutDialog.js                (content/aboutDialog.js)
         content/browser/aboutDialog.css               (content/aboutDialog.css)
+*       content/browser/aboutRights.xhtml             (content/aboutRights.xhtml)
 *       content/browser/aboutRobots.xhtml             (content/aboutRobots.xhtml)
         content/browser/aboutRobots-icon.png          (content/aboutRobots-icon.png)
         content/browser/aboutRobots-widget-left.png   (content/aboutRobots-widget-left.png)

File browser/branding/unofficial/Makefile.in

 	cp $(srcdir)/dsstore $(DIST)/branding/dsstore
 	cp $(srcdir)/background.png $(DIST)/branding/background.png
 	cp $(srcdir)/disk.icns $(DIST)/branding/disk.icns
-	cp $(srcdir)/license.r $(DIST)/branding/license.r
 endif
 ifeq ($(OS_ARCH),WINNT)
 	cp $(srcdir)/firefox.ico  $(DIST)/branding/app.ico

File browser/branding/unofficial/license.r

-// See /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/Script.h for language IDs.
-data 'LPic' (5000) {
-  // Default language ID, 0 = English
-  $"0000"
-  // Number of entries in list
-  $"0001"
-
-  // Entry 1
-  // Language ID, 0 = English
-  $"0000"
-  // Resource ID, 0 = STR#/TEXT/styl 5000
-  $"0000"
-  // Multibyte language, 0 = no
-  $"0000"
-};
-
-resource 'STR#' (5000, "English") {
-  {
-    // Language (unused?) = English
-    "English",
-    // Accept (Agree)
-    "Accept",
-    // Decline (Disagree)
-    "Decline",
-    // Print, ellipsis is 0xC9
-    "Print�",
-    // Save As, ellipsis is 0xC9
-    "Save As�",
-    // Descriptive text, curly quotes are 0xD2 and 0xD3
-    "You are about to install\n"
-    "Gran Paradiso.\n"
-    "\n"
-    "Please read the license agreement.  If you agree to its terms and accept, click �Accept� to access the software.  Otherwise, click �Decline� to cancel."
-  };
-};
-
-// 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 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://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"
-  "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"
-  "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"
-  "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"
-  "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"
-  "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"
-  "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"
-
-  // Style 1.  This is used to display the header lines in bold text.
-  // Start character = 0
-  $"0000 0000"
-  // 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
-  $"01"
-  // Style, unused?
-  $"02"
-  // Size = 12 point
-  $"000C"
-  // Color, RGB
-  $"0000 0000 0000"
-
-  // Style 2.  This is used to display the body.
-  // 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
-  $"00"
-  // Style, unused?
-  $"02"
-  // Size = 12 point
-  $"000C"
-  // Color, RGB
-  $"0000 0000 0000"
-};

File browser/components/Makefile.in

 EXTRA_PP_COMPONENTS = \
 	nsBrowserContentHandler.js \
 	nsBrowserGlue.js \
+	aboutRights.js \
 	aboutRobots.js \
 	$(NULL)
 
 
 DIRS += build
 
+ifneq (,$(BUILD_OFFICIAL)$(MOZILLA_OFFICIAL))
+DEFINES += -DOFFICIAL_BUILD=1
+endif
+
 include $(topsrcdir)/config/rules.mk

File browser/components/aboutRights.js

+/* ***** 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 about:robots.
+ *
+ * The Initial Developer of the Original Code is Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Ryan Flint <rflint@mozilla.com>
+ *   Justin Dolske <dolske@mozilla.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+const Cc = Components.classes;
+const Ci = Components.interfaces;
+
+Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
+
+function AboutRights() {}
+AboutRights.prototype = {
+  classDescription: "about:rights",
+  contractID: "@mozilla.org/network/protocol/about;1?what=rights",
+  classID: Components.ID("{89e9da80-4c03-46a0-a357-cf77bbef98b9}"),
+  QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule]),
+ 
+  getURIFlags: function(aURI) {
+    return (Ci.nsIAboutModule.ALLOW_SCRIPT |
+            Ci.nsIAboutModule.URI_SAFE_FOR_UNTRUSTED_CONTENT);
+  },
+
+  newChannel: function(aURI) {
+    var ios = Cc["@mozilla.org/network/io-service;1"].
+              getService(Ci.nsIIOService);
+
+    var secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].
+                 getService(Ci.nsIScriptSecurityManager);
+
+    var channel = ios.newChannel("chrome://browser/content/aboutRights.xhtml",
+                                 null, null);
+    var principal = secMan.getCodebasePrincipal(aURI);
+
+    channel.originalURI = aURI;
+    channel.owner = principal;
+
+    return channel;
+  }
+};
+
+function NSGetModule(compMgr, fileSpec)
+  XPCOMUtils.generateModule([AboutRights]);

File browser/components/nsBrowserContentHandler.js

                          .getService(nsIHttpProtocolHandler).misc;
 
   if (mstone != savedmstone) {
+    // Bug 462254. Previous releases had a default pref to suppress the EULA
+    // agreement if the platform's installer had already shown one. Now with
+    // about:rights we've removed the EULA stuff and default pref, but we need
+    // a way to make existing profiles retain the default that we removed.
+    if (savedmstone)
+      prefb.setBoolPref("browser.rights.3.shown", true);
+    
     prefb.setCharPref("browser.startup.homepage_override.mstone", mstone);
     return (savedmstone ? OVERRIDE_NEW_MSTONE : OVERRIDE_NEW_PROFILE);
   }

File browser/components/nsBrowserGlue.js

 }
 
 BrowserGlue.prototype = {
+  __prefs: null,
+  get _prefs() {
+    if (!this.__prefs)
+      this.__prefs = Cc["@mozilla.org/preferences-service;1"].
+                     getService(Ci.nsIPrefBranch);
+    return this.__prefs;
+  },
+
   _saveSession: false,
 
   _setPrefToSaveSession: function()
   // profile startup handler (contains profile initialization routines)
   _onProfileStartup: function() 
   {
-    // Check to see if the EULA must be shown on startup
-
-    var prefBranch = Cc["@mozilla.org/preferences-service;1"].
-                     getService(Ci.nsIPrefBranch);
-    var mustDisplayEULA = false;
-    try {
-      mustDisplayEULA = !prefBranch.getBoolPref("browser.EULA.override");
-    } catch (e) {
-      // Pref might not exist
-    }
-
-    // Make sure it hasn't already been accepted
-    if (mustDisplayEULA) {
-      try {
-        var EULAVersion = prefBranch.getIntPref("browser.EULA.version");
-        mustDisplayEULA = !prefBranch.getBoolPref("browser.EULA." + EULAVersion + ".accepted");
-      } catch(ex) {
-      }
-    }
-
-    if (mustDisplayEULA) {
-      var ww2 = Cc["@mozilla.org/embedcomp/window-watcher;1"].
-                getService(Ci.nsIWindowWatcher);
-      ww2.openWindow(null, "chrome://browser/content/EULA.xul", 
-                     "_blank", "chrome,centerscreen,modal,resizable=yes", null);
-    }
-
     this.Sanitizer.onStartup();
     // check if we're in safe mode
     var app = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULAppInfo).
   // Browser startup complete. All initial windows have opened.
   _onBrowserStartup: function()
   {
+    // Show about:rights notification, if needed.
+    if (this._shouldShowRights())
+      this._showRightsNotification();
+
     var prefBranch = Cc["@mozilla.org/preferences-service;1"].
                      getService(Ci.nsIPrefBranch);
     // If new add-ons were installed during startup open the add-ons manager.
     }
   },
 
+  /*
+   * _shouldShowRights - Determines if the user should be shown the
+   * about:rights notification. The notification should *not* be shown if
+   * we've already shown the current version, or if the override pref says to
+   * never show it. The notification *should* be shown if it's never been seen
+   * before, if a newer version is available, or if the override pref says to
+   * always show it.
+   */
+  _shouldShowRights : function () {
+    // Look for an unconditional override pref. If set, do what it says.
+    // (true --> never show, false --> always show)
+    try {
+      return !this._prefs.getBoolPref("browser.rights.override");
+    } catch (e) { }
+    // Ditto, for the legacy EULA pref.
+    try {
+      return !this._prefs.getBoolPref("browser.EULA.override");
+    } catch (e) { }
+
+#ifndef OFFICIAL_BUILD
+    // Non-official builds shouldn't shouldn't show the notification.
+    return false;
+#endif
+
+    // Look to see if the user has seen the current version or not.
+    var currentVersion = this._prefs.getIntPref("browser.rights.version");
+    try {
+      return !this._prefs.getBoolPref("browser.rights." + currentVersion + ".shown");
+    } catch (e) { }
+
+    // Legacy: If the user accepted a EULA, we won't annoy them with the
+    // equivalent about:rights page until the version changes.
+    try {
+      return !this._prefs.getBoolPref("browser.EULA." + currentVersion + ".accepted");
+    } catch (e) { }
+
+    // We haven't shown the notification before, so do so now.
+    return true;
+  },
+
+  _showRightsNotification : function () {
+    // Stick the notification onto the selected tab of the active browser window.
+    var win = this._getMostRecentBrowserWindow();
+    var browser = win.gBrowser; // for closure in notification bar callback
+    var notifyBox = browser.getNotificationBox();
+
+    var bundleService = Cc["@mozilla.org/intl/stringbundle;1"].
+                        getService(Ci.nsIStringBundleService);
+    var brandBundle  = bundleService.createBundle("chrome://branding/locale/brand.properties");
+    var rightsBundle = bundleService.createBundle("chrome://browser/locale/aboutRights.properties");
+
+    var buttonLabel     = rightsBundle.GetStringFromName("buttonLabel");
+    var buttonAccessKey = rightsBundle.GetStringFromName("buttonAccessKey");
+    var productName     = brandBundle.GetStringFromName("brandFullName");
+    var notifyText      = rightsBundle.formatStringFromName("notifyText", [productName], 1);
+    
+    var buttons = [
+                    {
+                      label:     buttonLabel,
+                      accessKey: buttonAccessKey,
+                      popup:     null,
+                      callback: function(aNotificationBar, aButton) {
+                        browser.selectedTab = browser.addTab("about:rights");
+                      }
+                    }
+                  ];
+
+    // Set pref to indicate we've shown the notification.
+    var currentVersion = this._prefs.getIntPref("browser.rights.version");
+    this._prefs.setBoolPref("browser.rights." + currentVersion + ".shown", true);
+
+    var box = notifyBox.appendNotification(notifyText, "about-rights", null, notifyBox.PRIORITY_INFO_LOW, buttons);
+    box.persistence = 3; // // arbitrary number, just so bar sticks around for a bit
+  },
+
   // returns the (cached) Sanitizer constructor
   get Sanitizer() 
   {
     }
   },
 
+#ifdef XP_UNIX
+#ifndef XP_MACOSX
+#define BROKEN_WM_Z_ORDER
+#endif
+#endif
+#ifdef XP_OS2
+#define BROKEN_WM_Z_ORDER
+#endif
+
+  // this returns the most recent non-popup browser window
+  _getMostRecentBrowserWindow : function ()
+  {
+    var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
+             getService(Components.interfaces.nsIWindowMediator);
+
+#ifdef BROKEN_WM_Z_ORDER
+    var win = wm.getMostRecentWindow("navigator:browser", true);
+
+    // if we're lucky, this isn't a popup, and we can just return this
+    if (win && win.document.documentElement.getAttribute("chromehidden")) {
+      win = null;
+      var windowList = wm.getEnumerator("navigator:browser", true);
+      // this is oldest to newest, so this gets a bit ugly
+      while (windowList.hasMoreElements()) {
+        var nextWin = windowList.getNext();
+        if (!nextWin.document.documentElement.getAttribute("chromehidden"))
+          win = nextWin;
+      }
+    }
+#else
+    var windowList = wm.getZOrderDOMWindowEnumerator("navigator:browser", true);
+    if (!windowList.hasMoreElements())
+      return null;
+
+    var win = windowList.getNext();
+    while (win.document.documentElement.getAttribute("chromehidden")) {
+      if (!windowList.hasMoreElements())
+        return null;
+
+      win = windowList.getNext();
+    }
+#endif
+
+    return win;
+  },
+
   // for XPCOM
   classDescription: "Firefox Browser Glue Service",
   classID:          Components.ID("{eab9012e-5f74-4cbc-b2b5-a590235513cc}"),

File browser/components/places/content/utils.js

 
 const LOAD_IN_SIDEBAR_ANNO = "bookmarkProperties/loadInSidebar";
 const DESCRIPTION_ANNO = "bookmarkProperties/description";
+const GUID_ANNO = "placesInternal/GUID";
 const LMANNO_FEEDURI = "livemark/feedURI";
 const LMANNO_SITEURI = "livemark/siteURI";
 const ORGANIZER_FOLDER_ANNO = "PlacesOrganizer/OrganizerFolder";
     var itemTitle = aData.title;
     var keyword = aData.keyword || null;
     var annos = aData.annos || [];
-    if (aExcludeAnnotations) {
-      annos = annos.filter(function(aValue, aIndex, aArray) {
-        return aExcludeAnnotations.indexOf(aValue.name) == -1;
-      });
-    }
+    // always exclude GUID when copying any item
+    var excludeAnnos = [GUID_ANNO];
+    if (aExcludeAnnotations)
+      excludeAnnos = excludeAnnos.concat(aExcludeAnnotations);
+    annos = annos.filter(function(aValue, aIndex, aArray) {
+      return excludeAnnos.indexOf(aValue.name) == -1;
+    });
     var childTxns = [];
     if (aData.dateAdded)
       childTxns.push(this.ptm.editItemDateAdded(null, aData.dateAdded));
         childItems.push(this.ptm.editItemLastModified(null, aData.lastModified));
 
       var annos = aData.annos || [];
+      annos = annos.filter(function(aAnno) {
+        // always exclude GUID when copying any item
+        return aAnno.name != GUID_ANNO;
+      });
       return this.ptm.createFolder(aData.title, aContainer, aIndex, annos, childItems);
     }
   },
         siteURI = PlacesUtils._uri(aAnno.value);
         return false;
       }
-      return true;
-    }, this);
+      // always exclude GUID when copying any item
+      return aAnno.name != GUID_ANNO;
+    });
     return this.ptm.createLivemark(feedURI, siteURI, aData.title, aContainer,
                                    aIndex, aData.annos);
   },
         if (copy) {
           // Copying a child of a live-bookmark by itself should result
           // as a new normal bookmark item (bug 376731)
-          var copyBookmarkAnno =
-            this._getBookmarkItemCopyTransaction(data, container, index,
-                                                 ["livemark/bookmarkFeedURI"]);
-          return copyBookmarkAnno;
+          return this._getBookmarkItemCopyTransaction(data, container, index,
+                                                      ["livemark/bookmarkFeedURI"]);
         }
         else
           return this.ptm.moveItem(data.id, container, index);

File browser/components/places/tests/browser/Makefile.in

 _BROWSER_TEST_FILES = \
 	browser_425884.js \
 	browser_423515.js \
+	browser_457473_no_copy_guid.js \
 	$(NULL)
 
 libs:: $(_BROWSER_TEST_FILES)

File browser/components/places/tests/browser/browser_457473_no_copy_guid.js

+/* vim:set ts=2 sw=2 sts=2 et: */
+/* ***** 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 Places test code.
+ *
+ * The Initial Developer of the Original Code is Mozilla Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *  Dietrich Ayala <dietrich@mozilla.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+function test() {
+  // sanity check
+  ok(PlacesUtils, "checking PlacesUtils, running in chrome context?");
+  ok(PlacesUIUtils, "checking PlacesUIUtils, running in chrome context?");
+
+  /*
+  - create, a test folder, add bookmark, separator, livemark to it
+  - fetch guids for all
+  - copy the folder
+  - test that guids are all different
+  - undo copy
+  - redo copy
+  - test that guids for the copy stay the same
+  */
+
+  var toolbarId = PlacesUtils.toolbarFolderId;
+  var toolbarNode = PlacesUtils.getFolderContents(toolbarId).root;
+
+  var oldCount = toolbarNode.childCount;
+  var testRootId = PlacesUtils.bookmarks.createFolder(toolbarId, "test root", -1);
+  is(toolbarNode.childCount, oldCount+1, "confirm test root node is a container, and is empty");
+  var testRootNode = toolbarNode.getChild(toolbarNode.childCount-1);
+  asContainer(testRootNode);
+  testRootNode.containerOpen = true;
+  is(testRootNode.childCount, 0, "confirm test root node is a container, and is empty");
+
+  // create folder A, fill it w/ each item type
+  var folderAId = PlacesUtils.bookmarks.createFolder(testRootId, "A", -1);
+  PlacesUtils.bookmarks.insertBookmark(folderAId, PlacesUtils._uri("http://foo"),
+                                       -1, "test bookmark");
+  PlacesUtils.bookmarks.insertSeparator(folderAId, -1);
+  PlacesUtils.livemarks.createLivemarkFolderOnly(folderAId, "test livemark",
+                                                 PlacesUtils._uri("http://test"),
+                                                 PlacesUtils._uri("http://test"), -1);
+
+  var folderANode = testRootNode.getChild(0);
+  var folderAGUIDs = getGUIDs(folderANode);
+
+  // test the test function
+  ok(checkGUIDs(folderANode, folderAGUIDs, true), "confirm guid test works");;
+
+  // serialize the folder
+  var serializedNode = PlacesUtils.wrapNode(folderANode, PlacesUtils.TYPE_X_MOZ_PLACE_CONTAINER);
+  var rawNode = PlacesUtils.unwrapNodes(serializedNode, PlacesUtils.TYPE_X_MOZ_PLACE_CONTAINER).shift();
+  ok(rawNode.type, "confirm json node was made");
+
+  // create a transaction from the serialization
+  // this exercises the guid-filtering
+  var transaction = PlacesUIUtils.makeTransaction(rawNode,
+                                                  PlacesUtils.TYPE_X_MOZ_PLACE_CONTAINER,
+                                                  testRootId, -1, true);
+  ok(transaction, "create transaction");
+
+  // execute it, copying to the test root folder
+  PlacesUIUtils.ptm.doTransaction(transaction);
+  is(testRootNode.childCount, 2, "create test folder via copy");
+
+  // check GUIDs are different
+  var folderBNode = testRootNode.getChild(1);
+  ok(checkGUIDs(folderBNode, folderAGUIDs, false), "confirm folder A GUIDs don't match folder B GUIDs");
+  var folderBGUIDs = getGUIDs(folderBNode);
+  ok(checkGUIDs(folderBNode, folderBGUIDs, true), "confirm test of new GUIDs");
+  
+  // undo the transaction, confirm the removal
+  PlacesUIUtils.ptm.undoTransaction();
+  is(testRootNode.childCount, 1, "confirm undo removed the copied folder");
+
+  // redo the transaction
+  // confirming GUIDs persist through undo/redo
+  PlacesUIUtils.ptm.redoTransaction();
+  is(testRootNode.childCount, 2, "confirm redo re-copied the folder");
+  folderBNode = testRootNode.getChild(1);
+  ok(checkGUIDs(folderBNode, folderAGUIDs, false), "folder B GUIDs after undo/redo don't match folder A GUIDs"); // sanity check
+
+  // XXXdietrich fails since GUIDs are created lazily. the anno
+  // isn't present at the time the transaction is first executed,
+  // and undo just undoes the original transaction - doesn't pull
+  // in any new changes.
+  //ok(checkGUIDs(folderBNode, folderBGUIDs, true, true), "folder B GUIDs after under/redo should match pre-undo/redo folder B GUIDs");
+
+  // clean up
+  PlacesUIUtils.ptm.undoTransaction();
+  PlacesUtils.bookmarks.removeItem(testRootId);
+}
+
+function getGUIDs(aNode) {
+  asContainer(aNode);
+  aNode.containerOpen = true;
+  var GUIDs = {
+    folder: PlacesUtils.bookmarks.getItemGUID(aNode.itemId),
+    bookmark: PlacesUtils.bookmarks.getItemGUID(aNode.getChild(0).itemId),
+    separator: PlacesUtils.bookmarks.getItemGUID(aNode.getChild(1).itemId),
+    livemark: PlacesUtils.bookmarks.getItemGUID(aNode.getChild(2).itemId)
+  };
+  aNode.containerOpen = false;
+  return GUIDs;
+}
+
+function checkGUIDs(aFolderNode, aGUIDs, aShouldMatch) {
+
+  function check(aNode, aGUID, aEquals) {
+    var nodeGUID = PlacesUtils.bookmarks.getItemGUID(aNode.itemId);
+    return aEquals ? (nodeGUID == aGUID) : (nodeGUID != aGUID);
+  }
+
+  asContainer(aFolderNode);
+  aFolderNode.containerOpen = true;
+
+  var allMatch = check(aFolderNode, aGUIDs.folder, aShouldMatch) &&
+                 check(aFolderNode.getChild(0), aGUIDs.bookmark, aShouldMatch) &&
+                 check(aFolderNode.getChild(1), aGUIDs.separator, aShouldMatch) &&
+                 check(aFolderNode.getChild(2), aGUIDs.livemark, aShouldMatch);
+
+  aFolderNode.containerOpen = false;
+  return allMatch;
+}

File browser/components/sessionstore/src/nsSessionStore.js

       || aTextarea instanceof Ci.nsIDOMHTMLInputElement && aTextarea.type != "password")) {
       return false; // nothing to save
     }
+    if (/^(?:\d+\|)+/.test(id)) {
+      // text could be restored into a subframe, so skip it (see bug 463206)
+      return false;
+    }
     
     if (!aPanel.__SS_text) {
       aPanel.__SS_text = [];
    *        bool this isn't the restoration of the first window
    */
   restoreWindow: function sss_restoreWindow(aWindow, aState, aOverwriteTabs, aFollowUp) {
-    if (this._restoreCount) {
-      this._restoreCount--;
-      if (this._restoreCount == 0) {
-        // This was the last window restored at startup, notify observers.
-        var observerService = Cc["@mozilla.org/observer-service;1"].
-                              getService(Ci.nsIObserverService);
-        observerService.notifyObservers(null, NOTIFY_WINDOWS_RESTORED, "");
-      }
-    }
-
     if (!aFollowUp) {
       this.windowToFocus = aWindow;
     }
     try {
       var root = typeof aState == "string" ? this._safeEval(aState) : aState;
       if (!root.windows[0]) {
+        this._notifyIfAllWindowsRestored();
         return; // nothing to restore
       }
     }
     catch (ex) { // invalid state object - don't restore anything 
       debug(ex);
+      this._notifyIfAllWindowsRestored();
       return;
     }
     
     
     this.restoreHistoryPrecursor(aWindow, winData.tabs, (aOverwriteTabs ?
       (parseInt(winData.selected) || 1) : 0), 0, 0);
+
+    this._notifyIfAllWindowsRestored();
   },
 
   /**
       return;
     }
     
+    // XSS note: always call this before injecting content into a document!
+    function hasExpectedURL(aDocument, aURL)
+      !aURL || aURL.replace(/#.*/, "") == aDocument.location.href.replace(/#.*/, "");
+    
     var textArray = this.__SS_restore_text ? this.__SS_restore_text.split(" ") : [];
-    function restoreTextData(aContent, aPrefix) {
+    function restoreTextData(aContent, aPrefix, aURL) {
       textArray.forEach(function(aEntry) {
-        if (/^((?:\d+\|)*)(#?)([^\s=]+)=(.*)$/.test(aEntry) && (!RegExp.$1 || RegExp.$1 == aPrefix)) {
+        if (/^((?:\d+\|)*)(#?)([^\s=]+)=(.*)$/.test(aEntry) &&
+            RegExp.$1 == aPrefix && hasExpectedURL(aContent.document, aURL)) {
           var document = aContent.document;
           var node = RegExp.$2 ? document.getElementById(RegExp.$3) : document.getElementsByName(RegExp.$3)[0] || null;
           if (node && "value" in node) {
     
     let window = this.ownerDocument.defaultView;
     function restoreTextDataAndScrolling(aContent, aData, aPrefix) {
-      restoreTextData(aContent, aPrefix);
+      restoreTextData(aContent, aPrefix, aData.url);
       if (aData.innerHTML) {
         window.setTimeout(function() {
-          if (aContent.document.designMode == "on")
+          if (aContent.document.designMode == "on" &&
+              hasExpectedURL(aContent.document, aData.url)) {
             aContent.document.body.innerHTML = aData.innerHTML;
+          }
         }, 0);
       }
       if (aData.scroll && /(\d+),(\d+)/.test(aData.scroll)) {
         aContent.scrollTo(RegExp.$1, RegExp.$2);
       }
       for (var i = 0; i < aContent.frames.length; i++) {
-        if (aData.children && aData.children[i]) {
-          restoreTextDataAndScrolling(aContent.frames[i], aData.children[i], i + "|" + aPrefix);
+        if (aData.children && aData.children[i] &&
+          hasExpectedURL(aContent.document, aData.url)) {
+          restoreTextDataAndScrolling(aContent.frames[i], aData.children[i], aPrefix + i + "|");
         }
       }
     }
     
-    var content = aEvent.originalTarget.defaultView;
-    if (this.currentURI.spec == "about:config") {
-      // unwrap the document for about:config because otherwise the properties
-      // of the XBL bindings - as the textbox - aren't accessible (see bug 350718)
-      content = content.wrappedJSObject;
+    if (hasExpectedURL(aEvent.originalTarget, this.__SS_restore_data.url)) {
+      var content = aEvent.originalTarget.defaultView;
+      if (this.currentURI.spec == "about:config") {
+        // unwrap the document for about:config because otherwise the properties
+        // of the XBL bindings - as the textbox - aren't accessible (see bug 350718)
+        content = content.wrappedJSObject;
+      }
+      restoreTextDataAndScrolling(content, this.__SS_restore_data, "");
     }
-    restoreTextDataAndScrolling(content, this.__SS_restore_data, "");
     
     // notify the tabbrowser that this document has been completely restored
     var event = this.ownerDocument.createEvent("Events");
     return str;
   },
 
+  _notifyIfAllWindowsRestored: function sss_notifyIfAllWindowsRestored() {
+    if (this._restoreCount) {
+      this._restoreCount--;
+      if (this._restoreCount == 0) {
+        // This was the last window restored at startup, notify observers.
+        var observerService = Cc["@mozilla.org/observer-service;1"].
+                              getService(Ci.nsIObserverService);
+        observerService.notifyObservers(null, NOTIFY_WINDOWS_RESTORED, "");
+      }
+    }
+  },
+
+
 /* ........ Storage API .............. */
 
   /**

File browser/config/version.txt

-3.0.5pre
+3.0.6pre

File browser/fuel/test/browser_Application.js

 const Ci = Components.interfaces;
 const Cc = Components.classes;
 
+// This listens for the next opened window and checks it is of the right url.
+// opencallback is called when the new window is fully loaded
+// closecallback is called when the window is closed
+function WindowOpenListener(url, opencallback, closecallback) {
+  this.url = url;
+  this.opencallback = opencallback;
+  this.closecallback = closecallback;
+
+  var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
+           getService(Ci.nsIWindowMediator);
+  wm.addListener(this);
+}
+
+WindowOpenListener.prototype = {
+  url: null,
+  opencallback: null,
+  closecallback: null,
+  window: null,
+  domwindow: null,
+
+  handleEvent: function(event) {
+    is(this.domwindow.document.location.href, this.url, "Should have opened the correct window");
+
+    this.domwindow.removeEventListener("load", this, false);
+    // Allow any other load handlers to execute
+    var self = this;
+    executeSoon(function() { self.opencallback(self.domwindow); } );
+  },
+
+  onWindowTitleChange: function(window, title) {
+  },
+
+  onOpenWindow: function(window) {
+    if (this.window)
+      return;
+
+    this.window = window;
+    this.domwindow = window.QueryInterface(Ci.nsIInterfaceRequestor)
+                           .getInterface(Ci.nsIDOMWindowInternal);
+    this.domwindow.addEventListener("load", this, false);
+  },
+
+  onCloseWindow: function(window) {
+    if (this.window != window)
+      return;
+
+    var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
+             getService(Ci.nsIWindowMediator);
+    wm.removeListener(this);
+    this.opencallback = null;
+    this.window = null;
+    this.domwindow = null;
+
+    // Let the window close complete
+    executeSoon(this.closecallback);
+    this.closecallback = null;
+  }
+};
+
 function test() {
   ok(Application, "Check global access to Application");
   
   var wMediator = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator);
   var console = wMediator.getMostRecentWindow("global:console");
   waitForExplicitFinish();
-  if (!console) {
-    Application.console.open();
-  }
-  setTimeout(checkConsole, 500);
+  ok(!console, "Console should not already be open");
+
+  new WindowOpenListener("chrome://global/content/console.xul", consoleOpened, consoleClosed);
+  Application.console.open();
 }
 
-function checkConsole() {
-  var wMediator = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator);
-  var console = wMediator.getMostRecentWindow("global:console");
-  ok(console, "Check to see if the console window opened");
-  if (console)
-    console.close();
+function consoleOpened(win) {
+  win.close();
+}