mozilla-kde.patch
changeset 748 72ba5129e5fd
parent 738 f118b88b7d7f
child 757 7913ca5779dc
--- a/mozilla-kde.patch	Thu Jun 12 22:59:33 2014 +0200
+++ b/mozilla-kde.patch	Wed Jul 09 14:56:22 2014 +0200
@@ -85,7 +85,7 @@
      path->GetNativeLeafName(leaf);
  
      // Do we care if a file provided by this process fails to load?
-     if (Substring(leaf, leaf.Length() - 4).Equals(NS_LITERAL_CSTRING(".xpi")))
+     if (Substring(leaf, leaf.Length() - 4).EqualsLiteral(".xpi"))
        ReadExtensionPrefs(path);
      else
 -      pref_LoadPrefsInDir(path, nullptr, 0);
@@ -217,7 +217,7 @@
  #include "AndroidBridge.h"
  using namespace mozilla::widget::android;
  #endif
-@@ -2722,16 +2726,25 @@ nsDownload::SetState(DownloadState aStat
+@@ -2729,16 +2733,25 @@ nsDownload::SetState(DownloadState aStat
        nsCOMPtr<nsIPrefBranch> pref(do_GetService(NS_PREFSERVICE_CONTRACTID));
  
        // Master pref to control this function.
@@ -243,7 +243,7 @@
          int64_t goat = PR_Now() - mStartTime;
          showTaskbarAlert = goat > alertIntervalUSec;
  
-@@ -2759,19 +2772,20 @@ nsDownload::SetState(DownloadState aStat
+@@ -2766,19 +2779,20 @@ nsDownload::SetState(DownloadState aStat
                // because if it is, they'll click open the download manager and
                // the items they downloaded will have been removed.
                alerts->ShowAlertNotification(
@@ -268,7 +268,7 @@
 diff --git a/toolkit/content/jar.mn b/toolkit/content/jar.mn
 --- a/toolkit/content/jar.mn
 +++ b/toolkit/content/jar.mn
-@@ -58,29 +58,33 @@ toolkit.jar:
+@@ -55,29 +55,33 @@ toolkit.jar:
     content/global/viewZoomOverlay.js          (viewZoomOverlay.js)
  *+ content/global/bindings/autocomplete.xml    (widgets/autocomplete.xml)
     content/global/bindings/browser.xml         (widgets/browser.xml)
@@ -290,7 +290,7 @@
     content/global/bindings/menulist.xml        (widgets/menulist.xml)
     content/global/bindings/notification.xml    (widgets/notification.xml)
     content/global/bindings/numberbox.xml       (widgets/numberbox.xml)
- *  content/global/bindings/popup.xml           (widgets/popup.xml)
+    content/global/bindings/popup.xml           (widgets/popup.xml)
  *+ content/global/bindings/preferences.xml     (widgets/preferences.xml)
 +*+ content/global/bindings/preferences-kde.xml (widgets/preferences-kde.xml)
 +% override chrome://global/content/bindings/preferences.xml chrome://global/content/bindings/preferences-kde.xml desktop=kde
@@ -339,7 +339,7 @@
 +        <xul:button dlgtype="cancel" class="dialog-button"/>
 +        <xul:button dlgtype="accept" class="dialog-button" xbl:inherits="disabled=buttondisabledaccept"/>
 +#elif XP_UNIX
-+                pack="end">
++                >
 +	<xul:button dlgtype="help" class="dialog-button" hidden="true"/>
 +	<xul:button dlgtype="extra2" class="dialog-button" hidden="true"/>
 +	<xul:spacer anonid="spacer" flex="1" hidden="true"/>
@@ -760,7 +760,7 @@
 new file mode 100644
 --- /dev/null
 +++ b/toolkit/content/widgets/preferences-kde.xml
-@@ -0,0 +1,1333 @@
+@@ -0,0 +1,1343 @@
 +<?xml version="1.0"?>
 +
 +<!DOCTYPE bindings [
@@ -793,6 +793,25 @@
 +
 +  <binding id="preferences">
 +    <implementation implements="nsIObserver">
++      <method name="_constructAfterChildren">
++      <body>
++      <![CDATA[
++      // This method will be called after each one of the child
++      // <preference> elements is constructed. Its purpose is to propagate
++      // the values to the associated form elements
++
++      var elements = this.getElementsByTagName("preference");
++      for (let element of elements) {
++        if (!element._constructed) {
++          return;
++        }
++      }
++      for (let element of elements) {
++        element.updateElements();
++      }
++      ]]>
++      </body>
++      </method>
 +      <method name="observe">
 +        <parameter name="aSubject"/>
 +        <parameter name="aTopic"/>
@@ -864,6 +883,8 @@
 +    <implementation>
 +      <constructor>
 +      <![CDATA[
++        this._constructed = true;
++
 +        // if the element has been inserted without the name attribute set,
 +        // we have nothing to do here
 +        if (!this.name)
@@ -889,18 +910,20 @@
 +                preference = parentPrefs[l];
 +            }
 +          }
-+          this._setValue(preference ? preference.value 
-+                                    : this.valueFromPreferences, false);
++
++          // Don't use the value setter here, we don't want updateElements to be prematurely fired.
++          this._value = preference ? preference.value : this.valueFromPreferences;
 +        }
 +        else
-+          this._setValue(this.valueFromPreferences, false);
++          this._value = this.valueFromPreferences;
++        this.preferences._constructAfterChildren();
 +      ]]>
 +      </constructor>
 +      <destructor>
 +        this.preferences.rootBranchInternal
 +            .removeObserver(this.name, this.preferences);
 +      </destructor>
-+      
++      <field name="_constructed">false</field>
 +      <property name="instantApply">
 +        <getter>
 +          return this.getAttribute("instantApply") == "true" || this.preferences.instantApply;
@@ -932,24 +955,19 @@
 +      <field name="_value">null</field>
 +      <method name="_setValue">
 +        <parameter name="aValue"/>
-+        <parameter name="aUpdate"/>
 +        <body>
 +        <![CDATA[
-+          if (aUpdate && this.value !== aValue) {
++          if (this.value !== aValue) {
 +            this._value = aValue;
 +            if (this.instantApply)
 +              this.valueFromPreferences = aValue;
 +            this.preferences.fireChangedEvent(this);
 +          }
-+          else if (!aUpdate) {
-+            this._value = aValue;
-+            this.updateElements();
-+          }
 +          return aValue;
 +        ]]>
 +        </body>
 +      </method>
-+      <property name="value" onget="return this._value" onset="return this._setValue(val, true);"/>
++      <property name="value" onget="return this._value" onset="return this._setValue(val);"/>
 +      
 +      <property name="locked">
 +        <getter>
@@ -1336,7 +1354,7 @@
 +        </xul:deck>
 +      </xul:hbox>
 +      <xul:hbox anonid="dlg-buttons" class="prefWindow-dlgbuttons" pack="end">
-+#ifdef XP_UNIX_GNOME
++#ifndef XP_UNIX
 +        <xul:button dlgtype="disclosure" class="dialog-button" hidden="true"/>
 +        <xul:button dlgtype="help" class="dialog-button" hidden="true" icon="help"/>
 +        <xul:button dlgtype="extra2" class="dialog-button" hidden="true"/>
@@ -1344,14 +1362,6 @@
 +        <xul:spacer anonid="spacer" flex="1"/>
 +        <xul:button dlgtype="cancel" class="dialog-button" icon="cancel"/>
 +        <xul:button dlgtype="accept" class="dialog-button" icon="accept"/>
-+#elif XP_UNIX
-+        <xul:button dlgtype="extra2" class="dialog-button" hidden="true"/>
-+        <xul:spacer anonid="spacer" flex="1"/>
-+        <xul:button dlgtype="accept" class="dialog-button" icon="accept"/>
-+        <xul:button dlgtype="extra1" class="dialog-button" hidden="true"/>
-+        <xul:button dlgtype="cancel" class="dialog-button" icon="cancel"/>
-+        <xul:button dlgtype="help" class="dialog-button" hidden="true" icon="help"/>
-+        <xul:button dlgtype="disclosure" class="dialog-button" hidden="true"/>
 +#else
 +        <xul:button dlgtype="extra2" class="dialog-button" hidden="true"/>
 +        <xul:spacer anonid="spacer" flex="1"/>
@@ -2626,7 +2636,7 @@
 diff --git a/uriloader/exthandler/moz.build b/uriloader/exthandler/moz.build
 --- a/uriloader/exthandler/moz.build
 +++ b/uriloader/exthandler/moz.build
-@@ -80,17 +80,19 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'coco
+@@ -75,17 +75,19 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'coco
  else:
      # These files can't be built in unified mode because they force NSPR logging.
      SOURCES += [
@@ -3584,7 +3594,7 @@
 diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp
 --- a/xpcom/io/nsLocalFileUnix.cpp
 +++ b/xpcom/io/nsLocalFileUnix.cpp
-@@ -43,16 +43,17 @@
+@@ -44,16 +44,17 @@
  #include "nsIDirectoryEnumerator.h"
  #include "nsISimpleEnumerator.h"
  #include "private/pprio.h"
@@ -3602,8 +3612,8 @@
  #include "prmem.h"
  #include "plbase64.h"
  
-@@ -1816,46 +1817,52 @@ nsLocalFile::SetPersistentDescriptor(con
-     return InitWithNativePath(aPersistentDescriptor);
+@@ -1962,53 +1963,55 @@ nsLocalFile::SetPersistentDescriptor(con
+   return InitWithNativePath(aPersistentDescriptor);
  #endif
  }
  
@@ -3611,66 +3621,73 @@
  nsLocalFile::Reveal()
  {
  #ifdef MOZ_WIDGET_GTK
--    nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
--    nsCOMPtr<nsIGnomeVFSService> gnomevfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
--    if (!giovfs && !gnomevfs)
--        return NS_ERROR_FAILURE;
+-  nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
+-  nsCOMPtr<nsIGnomeVFSService> gnomevfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
+-  if (!giovfs && !gnomevfs) {
+-    return NS_ERROR_FAILURE;
+-  }
 -
-+    nsAutoCString url;
-     bool isDirectory;
-     if (NS_FAILED(IsDirectory(&isDirectory)))
-         return NS_ERROR_FAILURE;
++  nsAutoCString url;
+   bool isDirectory;
+   if (NS_FAILED(IsDirectory(&isDirectory))) {
+     return NS_ERROR_FAILURE;
+   }
  
-+    nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
-     if (isDirectory) {
--        if (giovfs)
--            return giovfs->ShowURIForInput(mPath);
--        else 
--            /* Fallback to GnomeVFS */
--            return gnomevfs->ShowURIForInput(mPath);
-+        url = mPath;
-     } else if (giovfs && NS_SUCCEEDED(giovfs->OrgFreedesktopFileManager1ShowItems(mPath))) {
-         return NS_OK;
-     } else {
-         nsCOMPtr<nsIFile> parentDir;
-         nsAutoCString dirPath;
-         if (NS_FAILED(GetParent(getter_AddRefs(parentDir))))
-             return NS_ERROR_FAILURE;
-         if (NS_FAILED(parentDir->GetNativePath(dirPath)))
-             return NS_ERROR_FAILURE;
++  nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
+   if (isDirectory) {
+-    if (giovfs) {
+-      return giovfs->ShowURIForInput(mPath);
+-    } else
+-      /* Fallback to GnomeVFS */
+-    {
+-      return gnomevfs->ShowURIForInput(mPath);
+-    }
++    url = mPath;
+   } else if (giovfs && NS_SUCCEEDED(giovfs->OrgFreedesktopFileManager1ShowItems(mPath))) {
+     return NS_OK;
+   } else {
+     nsCOMPtr<nsIFile> parentDir;
+     nsAutoCString dirPath;
+     if (NS_FAILED(GetParent(getter_AddRefs(parentDir)))) {
+       return NS_ERROR_FAILURE;
+     }
+     if (NS_FAILED(parentDir->GetNativePath(dirPath))) {
+       return NS_ERROR_FAILURE;
+     }
  
--        if (giovfs)
--            return giovfs->ShowURIForInput(dirPath);
--        else 
--            return gnomevfs->ShowURIForInput(dirPath);        
-+        url = dirPath;
-     }
+-    if (giovfs) {
+-      return giovfs->ShowURIForInput(dirPath);
+-    } else {
+-      return gnomevfs->ShowURIForInput(dirPath);
+-    }
++    url = dirPath;
+   }
 +
-+    if(nsKDEUtils::kdeSupport()) {
-+      nsTArray<nsCString> command;
-+      command.AppendElement( NS_LITERAL_CSTRING("REVEAL") );
-+      command.AppendElement( mPath );
-+      return nsKDEUtils::command( command ) ? NS_OK : NS_ERROR_FAILURE;
-+    }
++  if(nsKDEUtils::kdeSupport()) {
++    nsTArray<nsCString> command;
++    command.AppendElement( NS_LITERAL_CSTRING("REVEAL") );
++    command.AppendElement( mPath );
++    return nsKDEUtils::command( command ) ? NS_OK : NS_ERROR_FAILURE;
++  }
 +
-+    nsCOMPtr<nsIGnomeVFSService> gnomevfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
-+    if (!giovfs && !gnomevfs)
-+      return NS_ERROR_FAILURE;
++  nsCOMPtr<nsIGnomeVFSService> gnomevfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
++  if (!giovfs && !gnomevfs)
++    return NS_ERROR_FAILURE;
 +
-+    if (giovfs)
-+      return giovfs->ShowURIForInput(url);
-+    else
-+      return gnomevfs->ShowURIForInput(url);
++  if (giovfs)
++    return giovfs->ShowURIForInput(url);
++  else
++    return gnomevfs->ShowURIForInput(url);
  #elif defined(MOZ_WIDGET_COCOA)
-     CFURLRef url;
-     if (NS_SUCCEEDED(GetCFURL(&url))) {
-       nsresult rv = CocoaFileUtils::RevealFileInFinder(url);
-       ::CFRelease(url);
-       return rv;
-     }
-     return NS_ERROR_FAILURE;
-@@ -1863,16 +1870,23 @@ nsLocalFile::Reveal()
-     return NS_ERROR_FAILURE;
+   CFURLRef url;
+   if (NS_SUCCEEDED(GetCFURL(&url))) {
+     nsresult rv = CocoaFileUtils::RevealFileInFinder(url);
+     ::CFRelease(url);
+     return rv;
+   }
+   return NS_ERROR_FAILURE;
+@@ -2016,16 +2019,22 @@ nsLocalFile::Reveal()
+   return NS_ERROR_FAILURE;
  #endif
  }
  
@@ -3678,18 +3695,17 @@
  nsLocalFile::Launch()
  {
  #ifdef MOZ_WIDGET_GTK
-+    if( nsKDEUtils::kdeSupport()) {
-+      nsTArray<nsCString> command;
-+      command.AppendElement( NS_LITERAL_CSTRING("OPEN") );
-+      command.AppendElement( mPath );
-+      return nsKDEUtils::command( command ) ? NS_OK : NS_ERROR_FAILURE;
-+    }
-+
-     nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
-     nsCOMPtr<nsIGnomeVFSService> gnomevfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
-     if (giovfs) {
-       return giovfs->ShowURIForInput(mPath);
-     } else if (gnomevfs) {
-       /* GnomeVFS fallback */
-       return gnomevfs->ShowURIForInput(mPath);
-     }
++  if( nsKDEUtils::kdeSupport()) {
++    nsTArray<nsCString> command;
++    command.AppendElement( NS_LITERAL_CSTRING("OPEN") );
++    command.AppendElement( mPath );
++    return nsKDEUtils::command( command ) ? NS_OK : NS_ERROR_FAILURE;
++  }
+   nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
+   nsCOMPtr<nsIGnomeVFSService> gnomevfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
+   if (giovfs) {
+     return giovfs->ShowURIForInput(mPath);
+   } else if (gnomevfs) {
+     /* GnomeVFS fallback */
+     return gnomevfs->ShowURIForInput(mPath);
+   }