Backed out changeset 7fdbccdc1e94
authorGavin Sharp <gavin@mozilla.com>
Tue, 26 Aug 2008 19:40:21 -0400
changeset 18432 6c7c234319ba58c4dc1d876c22df36631337c6c3
parent 18431 7fdbccdc1e94321e936dfbe9f9403d45b8027d17
child 18433 d5a093d32472ff65d5ecdaeeb4bd18544f8fbbe6
push idunknown
push userunknown
push dateunknown
milestone1.9.1a2pre
backs out7fdbccdc1e94321e936dfbe9f9403d45b8027d17
Backed out changeset 7fdbccdc1e94
.hgignore
browser/base/content/browser.js
browser/base/content/browser.xul
browser/base/content/utilityOverlay.js
browser/installer/unix/packages-static
browser/installer/windows/packages-static
content/html/content/src/nsHTMLScriptElement.cpp
content/xul/content/src/nsXULElement.cpp
dom/src/jsurl/nsJSProtocolHandler.cpp
toolkit/components/satchel/src/nsFormFillController.cpp
toolkit/components/satchel/test/Makefile.in
toolkit/components/satchel/test/test_basic_form.html
--- a/.hgignore
+++ b/.hgignore
@@ -21,10 +21,8 @@
 
 # Build directories
 ^obj
 
 # Build directories for js shell
 _DBG\.OBJ/
 _OPT\.OBJ/
 
-# my objdirs
-^ff-opt
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -1498,26 +1498,33 @@ function loadOneOrMoreURIs(aURIString)
   // so that we don't disrupt startup
   try {
     gBrowser.loadTabs(aURIString.split("|"), false, true);
   } 
   catch (e) {
   }
 }
 
-function openLocation() {
-  if (window.fullScreen)
-    FullScreen.mouseoverToggle(true);
-
+function focusAndSelectUrlBar()
+{
   if (gURLBar && isElementVisible(gURLBar) && !gURLBar.readOnly) {
     gURLBar.focus();
     gURLBar.select();
-    return;
+    return true;
   }
-
+  return false;
+}
+
+function openLocation()
+{
+  if (window.fullScreen)
+    FullScreen.mouseoverToggle(true);
+
+  if (focusAndSelectUrlBar())
+    return;
 #ifdef XP_MACOSX
   if (window.location.href != getBrowserURL()) {
     var win = getTopWin();
     if (win) {
       // If there's an open browser window, it should handle this command
       win.focus()
       win.openLocation();
     }
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -192,16 +192,17 @@
 #include browser-context.inc
     </popup>
 
     <popup id="placesContext"/>
 
     <!-- Popup for site identity information -->
     <panel id="identity-popup" position="after_start" hidden="true" noautofocus="true"
            onpopupshown="document.getElementById('identity-popup-more-info-button').focus();"
+           onpopuphidden="focusAndSelectUrlBar();" norestorefocus="true"
            chromedir="&locale.dir;">
       <hbox id="identity-popup-container" align="top">
         <image id="identity-popup-icon"/>
         <vbox id="identity-popup-content-box">
           <label id="identity-popup-connectedToLabel" value="&identity.connectedTo;"/>
           <label id="identity-popup-connectedToLabel2"
                  value="&identity.unverifiedsite2;"/>
           <description id="identity-popup-content-host"/>
--- a/browser/base/content/utilityOverlay.js
+++ b/browser/base/content/utilityOverlay.js
@@ -141,21 +141,18 @@ function openUILink( url, e, ignoreButto
  * - Alt is ignored for menu items selected using the keyboard so you don't accidentally save stuff.  
  *    (Currently, the Alt isn't sent here at all for menu items, but that will change in bug 126189.)
  * - Alt is hard to use in context menus, because pressing Alt closes the menu.
  * - Alt can't be used on the bookmarks toolbar because Alt is used for "treat this as something draggable".
  * - The button is ignored for the middle-click-paste-URL feature, since it's always a middle-click.
  */
 function whereToOpenLink( e, ignoreButton, ignoreAlt )
 {
-  // This method must treat a null event like a left click without modifier keys (i.e.
-  // e = { shiftKey:false, ctrlKey:false, metaKey:false, altKey:false, button:0 })
-  // for compatibility purposes.
   if (!e)
-    return "current";
+    e = { shiftKey:false, ctrlKey:false, metaKey:false, altKey:false, button:0 };
 
   var shift = e.shiftKey;
   var ctrl =  e.ctrlKey;
   var meta =  e.metaKey;
   var alt  =  e.altKey && !ignoreAlt;
 
   // ignoreButton allows "middle-click paste" to use function without always opening in a new window.
   var middle = !ignoreButton && e.button == 1;
--- a/browser/installer/unix/packages-static
+++ b/browser/installer/unix/packages-static
@@ -236,17 +236,16 @@ bin/components/nsLivemarkService.js
 bin/components/nsTaggingService.js
 bin/components/nsDefaultCLH.js
 bin/components/nsContentPrefService.js
 bin/components/nsContentDispatchChooser.js
 bin/components/nsHandlerService.js
 bin/components/nsWebHandlerApp.js
 bin/components/libdbusservice.so
 bin/components/aboutRobots.js
-bin/components/nsBadCertHandler.js
 
 ; Modules
 bin/modules/*
 
 ; Safe Browsing
 bin/components/nsSafebrowsingApplication.js
 bin/components/nsUrlClassifierListManager.js
 bin/components/nsUrlClassifierLib.js
--- a/browser/installer/windows/packages-static
+++ b/browser/installer/windows/packages-static
@@ -242,17 +242,16 @@ bin\components\txEXSLTRegExFunctions.js
 bin\components\nsLivemarkService.js
 bin\components\nsTaggingService.js
 bin\components\nsDefaultCLH.js
 bin\components\nsContentPrefService.js
 bin\components\nsContentDispatchChooser.js
 bin\components\nsHandlerService.js
 bin\components\nsWebHandlerApp.js
 bin\components\aboutRobots.js
-bin\components\nsBadCertHandler.js
 
 ; Modules
 bin\modules\*
 
 ; Safe Browsing
 bin\components\nsSafebrowsingApplication.js
 bin\components\nsUrlClassifierListManager.js
 bin\components\nsUrlClassifierLib.js
--- a/content/html/content/src/nsHTMLScriptElement.cpp
+++ b/content/html/content/src/nsHTMLScriptElement.cpp
@@ -367,17 +367,16 @@ protected:
 
 NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(Script)
 
 
 nsHTMLScriptElement::nsHTMLScriptElement(nsINodeInfo *aNodeInfo,
                                          PRBool aFromParser)
   : nsGenericHTMLElement(aNodeInfo)
 {
-  printf("New script element\n");
   mDoneAddingChildren = !aFromParser;
   AddMutationObserver(this);
 }
 
 nsHTMLScriptElement::~nsHTMLScriptElement()
 {
 }
 
@@ -506,17 +505,16 @@ nsHTMLScriptElement::GetScriptType(nsASt
 already_AddRefed<nsIURI>
 nsHTMLScriptElement::GetScriptURI()
 {
   nsIURI *uri = nsnull;
   nsAutoString src;
   GetSrc(src);
   if (!src.IsEmpty())
     NS_NewURI(&uri, src);
-  printf("spec: %s\n", NS_ConvertUTF16toUTF8(src).get());
   return uri;
 }
 
 void
 nsHTMLScriptElement::GetScriptText(nsAString& text)
 {
   GetText(text);
 }
--- a/content/xul/content/src/nsXULElement.cpp
+++ b/content/xul/content/src/nsXULElement.cpp
@@ -418,17 +418,17 @@ nsXULElement::QueryInterface(REFNSIID aI
     } else if (aIID.Equals(NS_GET_IID(nsIFrameLoaderOwner))) {
         inst = static_cast<nsIFrameLoaderOwner*>(new nsXULElementTearoff(this));
         NS_ENSURE_TRUE(inst, NS_ERROR_OUT_OF_MEMORY);
     } else {
         return PostQueryInterface(aIID, aInstancePtr);
     }
 
     NS_ADDREF(inst);
-
+ 
     *aInstancePtr = inst;
     return NS_OK;
 }
 
 //----------------------------------------------------------------------
 // nsIDOMNode interface
 
 nsresult
@@ -477,17 +477,17 @@ NS_IMETHODIMP
 nsXULElement::GetElementsByAttribute(const nsAString& aAttribute,
                                      const nsAString& aValue,
                                      nsIDOMNodeList** aReturn)
 {
     nsCOMPtr<nsIAtom> attrAtom(do_GetAtom(aAttribute));
     NS_ENSURE_TRUE(attrAtom, NS_ERROR_OUT_OF_MEMORY);
     void* attrValue = new nsString(aValue);
     NS_ENSURE_TRUE(attrValue, NS_ERROR_OUT_OF_MEMORY);
-    nsContentList *list =
+    nsContentList *list = 
         new nsContentList(this,
                           nsXULDocument::MatchAttribute,
                           nsContentUtils::DestroyMatchString,
                           attrValue,
                           PR_TRUE,
                           attrAtom,
                           kNameSpaceID_Unknown);
     NS_ENSURE_TRUE(list, NS_ERROR_OUT_OF_MEMORY);
@@ -510,18 +510,18 @@ nsXULElement::GetElementsByAttributeNS(c
       nsresult rv =
         nsContentUtils::NameSpaceManager()->RegisterNameSpace(aNamespaceURI,
                                                               nameSpaceId);
       NS_ENSURE_SUCCESS(rv, rv);
     }
 
     void* attrValue = new nsString(aValue);
     NS_ENSURE_TRUE(attrValue, NS_ERROR_OUT_OF_MEMORY);
-
-    nsContentList *list =
+    
+    nsContentList *list = 
         new nsContentList(this,
                           nsXULDocument::MatchAttribute,
                           nsContentUtils::DestroyMatchString,
                           attrValue,
                           PR_TRUE,
                           attrAtom,
                           nameSpaceId);
     NS_ENSURE_TRUE(list, NS_ERROR_OUT_OF_MEMORY);
@@ -562,17 +562,17 @@ nsXULElement::GetEventListenerManagerFor
     return nsGenericElement::GetEventListenerManagerForAttr(aManager,
                                                             aTarget,
                                                             aDefer);
 }
 
 PRBool
 nsXULElement::IsFocusable(PRInt32 *aTabIndex)
 {
-  /*
+  /* 
    * Returns true if an element may be focused, and false otherwise. The inout
    * argument aTabIndex will be set to the tab order index to be used; -1 for
    * elements that should not be part of the tab order and a greater value to
    * indicate its tab order.
    *
    * Confusingly, the supplied value for the aTabIndex argument may indicate
    * whether the element may be focused as a result of the -moz-user-focus
    * property, where -1 means no and 0 means yes.
@@ -593,17 +593,17 @@ nsXULElement::IsFocusable(PRInt32 *aTabI
    *
    * If aTabIndex is null, then the tabindex is not computed, and
    * true is returned for non-disabled controls and false otherwise.
    */
 
   // elements are not focusable by default
   PRBool shouldFocus = PR_FALSE;
 
-  nsCOMPtr<nsIDOMXULControlElement> xulControl =
+  nsCOMPtr<nsIDOMXULControlElement> xulControl = 
     do_QueryInterface(static_cast<nsIContent*>(this));
   if (xulControl) {
     // a disabled element cannot be focused and is not part of the tab order
     PRBool disabled;
     xulControl->GetDisabled(&disabled);
     if (disabled) {
       if (aTabIndex)
         *aTabIndex = -1;
@@ -1032,17 +1032,17 @@ nsXULElement::RemoveChildAt(PRUint32 aIn
             // If any of this fails, we'll just set the current item to null
             if (newCurrentIndex == -1)
               newCurrentIndex = -2;
         }
       }
     }
 
     rv = nsGenericElement::RemoveChildAt(aIndex, aNotify);
-
+    
     if (newCurrentIndex == -2)
         controlElement->SetCurrentItem(nsnull);
     else if (newCurrentIndex > -1) {
         // Make sure the index is still valid
         PRInt32 treeRows;
         listBox->GetRowCount(&treeRows);
         if (treeRows > 0) {
             newCurrentIndex = PR_MIN((treeRows - 1), newCurrentIndex);
@@ -1103,17 +1103,17 @@ nsXULElement::BeforeSetAttr(PRInt32 aNam
     if (aNamespaceID == kNameSpaceID_None && aName == nsGkAtoms::accesskey &&
         IsInDoc()) {
         const nsAttrValue* attrVal = FindLocalOrProtoAttr(aNamespaceID, aName);
         if (attrVal) {
             nsAutoString oldValue;
             attrVal->ToString(oldValue);
             UnregisterAccessKey(oldValue);
         }
-    }
+    } 
     else if (aNamespaceID == kNameSpaceID_None && (aName ==
              nsGkAtoms::command || aName == nsGkAtoms::observes) && IsInDoc()) {
 //         XXX sXBL/XBL2 issue! Owner or current document?
         nsAutoString oldValue;
         GetAttr(kNameSpaceID_None, nsGkAtoms::observes, oldValue);
         if (oldValue.IsEmpty()) {
           GetAttr(kNameSpaceID_None, nsGkAtoms::command, oldValue);
         }
@@ -1308,34 +1308,34 @@ PRInt32
 nsXULElement::FindAttrValueIn(PRInt32 aNameSpaceID,
                               nsIAtom* aName,
                               AttrValuesArray* aValues,
                               nsCaseTreatment aCaseSensitive) const
 {
   NS_ASSERTION(aName, "Must have attr name");
   NS_ASSERTION(aNameSpaceID != kNameSpaceID_Unknown, "Must have namespace");
   NS_ASSERTION(aValues, "Null value array");
-
+  
   const nsAttrValue* val = FindLocalOrProtoAttr(aNameSpaceID, aName);
   if (val) {
     for (PRInt32 i = 0; aValues[i]; ++i) {
       if (val->Equals(*aValues[i], aCaseSensitive)) {
         return i;
       }
     }
     return ATTR_VALUE_NO_MATCH;
   }
   return ATTR_MISSING;
 }
 
 nsresult
 nsXULElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, PRBool aNotify)
 {
     // This doesn't call BeforeSetAttr/AfterSetAttr for now.
-
+    
     NS_ASSERTION(nsnull != aName, "must have attribute name");
     nsresult rv;
 
     // Because It's Hard to maintain a magic ``unset'' value in
     // the local attributes, we'll fault all the attributes,
     // unhook ourselves from the prototype, and then remove the
     // local copy of the attribute that we want to unset. In
     // other words, we'll become ``heavyweight''.
@@ -2287,19 +2287,19 @@ nsXULElement::SetFocus(nsPresContext* aP
 
     aPresContext->EventStateManager()->SetContentState(this,
                                                        NS_EVENT_STATE_FOCUS);
 }
 
 void
 nsXULElement::RemoveFocus(nsPresContext* aPresContext)
 {
-  if (!aPresContext)
+  if (!aPresContext) 
     return;
-
+  
   if (IsInDoc()) {
     aPresContext->EventStateManager()->SetContentState(nsnull,
                                                        NS_EVENT_STATE_FOCUS);
   }
 }
 
 nsIContent *
 nsXULElement::GetBindingParent() const
@@ -2456,17 +2456,17 @@ nsresult nsXULElement::MakeHeavyweight()
         if (hadAttributes &&
             mAttrsAndChildren.GetAttr(protoattr->mName.LocalName(),
                                       protoattr->mName.NamespaceID())) {
             continue;
         }
 
         // XXX we might wanna have a SetAndTakeAttr that takes an nsAttrName
         nsAttrValue attrValue(protoattr->mValue);
-
+        
         // Style rules need to be cloned.
         if (attrValue.Type() == nsAttrValue::eCSSStyleRule) {
             nsCOMPtr<nsICSSRule> ruleClone;
             rv = attrValue.GetCSSStyleRuleValue()->Clone(*getter_AddRefs(ruleClone));
             NS_ENSURE_SUCCESS(rv, rv);
 
             nsCOMPtr<nsICSSStyleRule> styleRule = do_QueryInterface(ruleClone);
             attrValue.SetTo(styleRule);
@@ -2921,17 +2921,17 @@ nsXULPrototypeElement::SetAttrAt(PRUint3
         mAttributes[aPos].mValue.ParseAtom(aValue);
 
         return NS_OK;
     }
     else if (mAttributes[aPos].mName.Equals(nsGkAtoms::_class)) {
         mHasClassAttribute = PR_TRUE;
         // Compute the element's class list
         mAttributes[aPos].mValue.ParseAtomArray(aValue);
-
+        
         return NS_OK;
     }
     else if (mAttributes[aPos].mName.Equals(nsGkAtoms::style)) {
         mHasStyleAttribute = PR_TRUE;
         // Parse the element's 'style' attribute
         nsCOMPtr<nsICSSStyleRule> rule;
         nsICSSParser* parser = GetCSSParser();
         NS_ENSURE_TRUE(parser, NS_ERROR_OUT_OF_MEMORY);
--- a/dom/src/jsurl/nsJSProtocolHandler.cpp
+++ b/dom/src/jsurl/nsJSProtocolHandler.cpp
@@ -590,25 +590,24 @@ nsJSChannel::Open(nsIInputStream **aResu
 
     return mStreamChannel->Open(aResult);
 }
 
 NS_IMETHODIMP
 nsJSChannel::AsyncOpen(nsIStreamListener *aListener, nsISupports *aContext)
 {
     NS_ENSURE_ARG(aListener);
-printf("AsyncOpen\n");
+
     // First make sure that we have a usable inner window; we'll want to make
     // sure that we execute against that inner and no other.
     nsIScriptGlobalObject* global = GetGlobalObject(this);
     if (!global) {
-      printf("no global object!\n");
         return NS_ERROR_NOT_AVAILABLE;
     }
-printf("got global object\n");
+
     nsCOMPtr<nsPIDOMWindow> win(do_QueryInterface(global));
     NS_ASSERTION(win, "Our global is not a window??");
 
     // Make sure we create a new inner window if one doesn't already exist (see
     // bug 306630).
     mOriginalInnerWindow = win->EnsureInnerWindow();
     if (!mOriginalInnerWindow) {
         return NS_ERROR_NOT_AVAILABLE;
--- a/toolkit/components/satchel/src/nsFormFillController.cpp
+++ b/toolkit/components/satchel/src/nsFormFillController.cpp
@@ -394,29 +394,21 @@ nsFormFillController::GetTextValue(nsASt
     aTextValue.Truncate();
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsFormFillController::SetTextValue(const nsAString & aTextValue)
 {
-  nsAutoString value(aTextValue);
   nsCOMPtr<nsIDOMNSEditableElement> editable = do_QueryInterface(mFocusedInput);
   if (editable) {
-    // Don't fill in more than maxLength
-    PRInt32 maxLength;
-    if (NS_SUCCEEDED(mFocusedInput->GetMaxLength(&maxLength)) && maxLength) {
-      nsAutoString trimmedValue;
-      value.Left(trimmedValue, maxLength);
-
-      mSuppressOnInput = PR_TRUE;
-      editable->SetUserInput(trimmedValue);
-      mSuppressOnInput = PR_FALSE;
-    }
+    mSuppressOnInput = PR_TRUE;
+    editable->SetUserInput(aTextValue);
+    mSuppressOnInput = PR_FALSE;
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsFormFillController::GetSelectionStart(PRInt32 *aSelectionStart)
 {
   nsCOMPtr<nsIDOMNSHTMLInputElement> input = do_QueryInterface(mFocusedInput);
--- a/toolkit/components/satchel/test/Makefile.in
+++ b/toolkit/components/satchel/test/Makefile.in
@@ -35,27 +35,19 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH   = ../../../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH   = @srcdir@
-relativesrcdir  = toolkit/components/satchel/test
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = test_satchel
 
 XPCSHELL_TESTS = \
   unit \
   $(NULL)
 
-# Mochitest tests
-MOCHI_TESTS = \
-		test_basic_form.html \
-		$(NULL)
-
 include $(topsrcdir)/config/rules.mk
 
-libs:: $(MOCHI_TESTS)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
deleted file mode 100644
--- a/toolkit/components/satchel/test/test_basic_form.html
+++ /dev/null
@@ -1,91 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <title>Test for satchel</title>
-  <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script> 
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-Satchel test: simple form fill
-<p id="display"></p>
-
-<iframe id="iframe"></iframe>
-
-<div id="content" style="display: none">
-</div>
-
-<pre id="test">
-<script class="testbody" type="text/javascript">
-
-/** Test for Satchel **/
-function startTest() {
-  netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
-
-  // Get the formHistory service
-  var formHistory = Components.classes["@mozilla.org/satchel/form-history;1"].
-                    getService(Components.interfaces.nsIFormHistory2);
-
-  // Make sure it's not already initialized somehow
-  ok(!formHistory.hasEntries, "no existing entries");
-
-  // add some test entries
-  var testData = [{name: "text", value: "data-basic", expect: "data-basic"},
-                  {name: "text-max", value: "data-maxlength01234567890", expect: "data"}
-                 ];
-
-  testData.forEach(function (entry) formHistory.addEntry(entry.name, entry.value));
-
-  // Simple check to see if everything was added fine.
-  ok(formHistory.hasEntries, "entries exist");
-
-  // Now load a document and check that the form was filled out correctly.
-  var iframe = $("iframe");
-  iframe.addEventListener("load", doTest, false);
-
-  var formDocURL = 'data:text/html,<form><input type="text" id="text" name="text"><input type="text" id="text-max" name="text-max" maxlength="4"></form>'
-  iframe.setAttribute("src", formDocURL);
-
-  function doTest() {
-    iframe.removeEventListener("load", doTest, false);
-
-    var text = iframe.contentWindow.document.getElementById("text");
-    var text_max = iframe.contentWindow.document.getElementById("text-max");
-    ok(text, "got text element");
-    ok(text_max, "got text-max element");
-
-    function triggerFormFill(aTarget) {
-      aTarget.focus();
-      synthesizeKey("VK_DOWN", {}, window);
-      synthesizeKey("VK_DOWN", {}, window);
-      synthesizeKey("VK_ENTER", {}, window);
-    }
-
-    triggerFormFill(text);
-    triggerFormFill(text_max);
-
-    is(text.value, testData[0].value, "text filled in correctly");
-    is(text_max.value, testData[1].value, "text_max filled in correctly");
-
-    // clean up
-    cleanUp();
-  }
-  
-  function cleanUp() {
-    netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
-
-    // Remove the added entries
-    formHistory.removeAllEntries();
-
-    SimpleTest.finish();
-  }
-}
-
-window.onload = startTest;
-
-SimpleTest.waitForExplicitFinish();
-</script>
-</pre>
-</body>
-</html>