merge m-c to ux
authorTim Taubert <tim.taubert@gmx.de>
Sun, 08 Jan 2012 15:02:29 +0100
changeset 85242 9a230265bad5fb7d2c4ead3c9e4173081d8e90a7
parent 85239 cf8c9f9aeefc43d6801c2253c9c08eda985d7568 (current diff)
parent 85241 371c513e15d71609bef93c88d0e476e3a73c5d9e (diff)
child 85250 0dd51bebba24a46d3bfe8ee77938424a1806ef31
child 85326 8409adc46f1456637010e3e54c2d08d2b5dbd1c1
child 85881 f24e29497bd409bc6001c05614aa62b0544e937a
child 109123 a8b32fd6d367c6dd9db567860ee4ed3935259be0
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone12.0a1
merge m-c to ux
--- a/browser/components/migration/src/nsIEProfileMigrator.cpp
+++ b/browser/components/migration/src/nsIEProfileMigrator.cpp
@@ -94,16 +94,18 @@
 #include "nsBrowserCompsCID.h"
 #include "nsIStringBundle.h"
 #include "nsNetUtil.h"
 #include "nsToolkitCompsCID.h"
 #include "nsUnicharUtils.h"
 #include "nsIWindowsRegKey.h"
 #include "nsISupportsPrimitives.h"
 
+#define kNotFound -1
+
 #define TRIDENTPROFILE_BUNDLE       "chrome://browser/locale/migration/migration.properties"
 
 #define REGISTRY_IE_MAIN_KEY \
   NS_LITERAL_STRING("Software\\Microsoft\\Internet Explorer\\Main")
 #define REGISTRY_IE_TYPEDURL_KEY \
   NS_LITERAL_STRING("Software\\Microsoft\\Internet Explorer\\TypedURLs")
 #define REGISTRY_IE_TOOLBAR_KEY \
   NS_LITERAL_STRING("Software\\Microsoft\\Internet Explorer\\Toolbar")
@@ -597,37 +599,41 @@ nsIEProfileMigrator::TestForIE7()
 
   if (!::ExpandEnvironmentStringsW(iePath.get(), 
                                    destination, 
                                    bufLength)) 
     return false; 
 
   iePath = destination; 
 
+  // Check if the path is enclosed in quotation marks.
   if (StringBeginsWith(iePath, NS_LITERAL_STRING("\""))) {
     iePath.Cut(0,1);
-    PRUint32 index = iePath.FindChar('\"', 0);
+    PRInt32 index = iePath.FindChar('\"', 0);
+
+    // After removing the opening quoation mark,
+    // remove the closing one and everything after it.
     if (index > 0)
       iePath.Cut(index,iePath.Length());
   }
 
   nsCOMPtr<nsILocalFile> lf; 
   NS_NewLocalFile(iePath, true, getter_AddRefs(lf)); 
 
   nsCOMPtr<nsILocalFileWin> lfw = do_QueryInterface(lf); 
   if (!lfw)
    return false;
    
   nsAutoString ieVersion;
   if (NS_FAILED(lfw->GetVersionInfoField("FileVersion", ieVersion)))
    return false;
 
   if (ieVersion.Length() > 2) {
-    PRUint32 index = ieVersion.FindChar('.', 0);
-    if (index < 0)
+    PRInt32 index = ieVersion.FindChar('.', 0);
+    if (index == kNotFound)
       return false;
     ieVersion.Cut(index, ieVersion.Length());
     PRInt32 ver = wcstol(ieVersion.get(), nsnull, 0);
     if (ver >= 7) // Found 7 or greater major version
       return true;
   }
 
   return false;
--- a/content/html/document/src/ImageDocument.cpp
+++ b/content/html/document/src/ImageDocument.cpp
@@ -376,16 +376,20 @@ ImageDocument::SetScriptGlobalObject(nsI
 
       target = do_QueryInterface(mImageContent);
       target->AddEventListener(NS_LITERAL_STRING("click"), this, false);
     }
 
     target = do_QueryInterface(aScriptGlobalObject);
     target->AddEventListener(NS_LITERAL_STRING("resize"), this, false);
     target->AddEventListener(NS_LITERAL_STRING("keypress"), this, false);
+
+    if (!nsContentUtils::IsChildOfSameType(this)) {
+      LinkStylesheet(NS_LITERAL_STRING("resource://gre/res/TopLevelImageDocument.css"));
+    }
   }
 }
 
 void
 ImageDocument::OnPageShow(bool aPersisted,
                           nsIDOMEventTarget* aDispatchStartTarget)
 {
   if (aPersisted) {
@@ -660,18 +664,16 @@ ImageDocument::CreateSyntheticDocument()
                                              kNameSpaceID_XHTML,
                                              nsIDOMNode::ELEMENT_NODE);
     NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
     nsRefPtr<nsGenericHTMLElement> styleContent = NS_NewHTMLStyleElement(nodeInfo.forget());
     NS_ENSURE_TRUE(styleContent, NS_ERROR_OUT_OF_MEMORY);
 
     styleContent->SetTextContent(NS_LITERAL_STRING("img { display: block; }"));
     head->AppendChildTo(styleContent, false);
-  } else {
-    LinkStylesheet(NS_LITERAL_STRING("resource://gre/res/TopLevelImageDocument.css"));
   }
 
   // Add the image element
   Element* body = GetBodyElement();
   if (!body) {
     NS_WARNING("no body on image document!");
     return NS_ERROR_FAILURE;
   }
--- a/content/html/document/src/VideoDocument.cpp
+++ b/content/html/document/src/VideoDocument.cpp
@@ -52,16 +52,17 @@ class VideoDocument : public MediaDocume
 public:
   virtual nsresult StartDocumentLoad(const char*         aCommand,
                                      nsIChannel*         aChannel,
                                      nsILoadGroup*       aLoadGroup,
                                      nsISupports*        aContainer,
                                      nsIStreamListener** aDocListener,
                                      bool                aReset = true,
                                      nsIContentSink*     aSink = nsnull);
+  virtual void SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObject);
 
 protected:
 
   // Sets document <title> to reflect the file name and description.
   void UpdateTitle(nsIChannel* aChannel);
 
   nsresult CreateSyntheticVideoDocument(nsIChannel* aChannel,
                                         nsIStreamListener** aListener);
@@ -89,16 +90,28 @@ VideoDocument::StartDocumentLoad(const c
   rv = CreateSyntheticVideoDocument(aChannel,
       getter_AddRefs(mStreamListener->mNextStream));
   NS_ENSURE_SUCCESS(rv, rv);
 
   NS_ADDREF(*aDocListener = mStreamListener);
   return rv;
 }
 
+void
+VideoDocument::SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObject)
+{
+  // Set the script global object on the superclass before doing
+  // anything that might require it....
+  MediaDocument::SetScriptGlobalObject(aScriptGlobalObject);
+
+  if (aScriptGlobalObject && !nsContentUtils::IsChildOfSameType(this)) {
+    LinkStylesheet(NS_LITERAL_STRING("resource://gre/res/TopLevelVideoDocument.css"));
+  }
+}
+
 nsresult
 VideoDocument::CreateSyntheticVideoDocument(nsIChannel* aChannel,
                                             nsIStreamListener** aListener)
 {
   // make our generic document
   nsresult rv = MediaDocument::CreateSyntheticDocument();
   NS_ENSURE_SUCCESS(rv, rv);
 
@@ -126,18 +139,16 @@ VideoDocument::CreateSyntheticVideoDocum
   UpdateTitle(aChannel);
 
   if (nsContentUtils::IsChildOfSameType(this)) {
     // Video documents that aren't toplevel should fill their frames and
     // not have margins
     element->SetAttr(kNameSpaceID_None, nsGkAtoms::style,
         NS_LITERAL_STRING("position:absolute; top:0; left:0; width:100%; height:100%"),
         true);
-  } else {
-    LinkStylesheet(NS_LITERAL_STRING("resource://gre/res/TopLevelVideoDocument.css"));
   }
 
   return body->AppendChildTo(element, false);
 }
 
 void
 VideoDocument::UpdateTitle(nsIChannel* aChannel)
 {