mozilla-kde.patch
changeset 1113 8e9195853a32
parent 1112 8a4f5aea2475
child 1119 4c5d44d40a03
--- a/mozilla-kde.patch	Sun Mar 17 10:00:10 2019 +0100
+++ b/mozilla-kde.patch	Tue Nov 19 22:54:22 2019 +0100
@@ -1,5 +1,9 @@
 # HG changeset patch
-# Parent  ff3da33eabc1d8760ec41a87afbaf44ded300ede
+# User msirringhaus@suse.de
+# Date 1559294891 -7200
+#      Fri May 31 11:28:11 2019 +0200
+# Node ID c2aa7198fb925e7fde96abf65b6f68b9b755f112
+# Parent  86d7ace0b36abf542e56fbb702a5f9b308b9bf77
 Description: Add KDE integration to Firefox (toolkit parts)
 Author: Wolfgang Rosenauer <wolfgang@rosenauer.org>
 Author: Lubos Lunak <lunak@suse.com>
@@ -9,8 +13,7 @@
 diff --git a/modules/libpref/Preferences.cpp b/modules/libpref/Preferences.cpp
 --- a/modules/libpref/Preferences.cpp
 +++ b/modules/libpref/Preferences.cpp
-@@ -81,16 +81,17 @@
- #include "nsXPCOMCID.h"
+@@ -88,16 +88,17 @@
  #include "nsXPCOM.h"
  #include "nsXULAppAPI.h"
  #include "nsZipArchive.h"
@@ -18,16 +21,17 @@
  #include "PLDHashTable.h"
  #include "plstr.h"
  #include "prlink.h"
+ #include "xpcpublic.h"
 +#include "nsKDEUtils.h"
  
+ #ifdef DEBUG
+ #  include <map>
+ #endif
+ 
  #ifdef MOZ_MEMORY
- #include "mozmemory.h"
+ #  include "mozmemory.h"
  #endif
- 
- #ifdef XP_WIN
- #include "windows.h"
- #endif
-@@ -4466,25 +4467,37 @@ float MOZ_MAYBE_UNUSED GetPref<float>(co
+@@ -4542,25 +4543,37 @@ nsresult Preferences::InitInitialObjects
    // application pref files for backwards compatibility.
    static const char* specialFiles[] = {
  #if defined(XP_MACOSX)
@@ -37,10 +41,10 @@
  #elif defined(XP_UNIX)
      "unix.js"
 +    , "" // placeholder for KDE  (empty is otherwise harmless)
- #if defined(_AIX)
+ #  if defined(_AIX)
      ,
      "aix.js"
- #endif
+ #  endif
  #elif defined(XP_BEOS)
      "beos.js"
  #endif
@@ -65,7 +69,7 @@
  
    // Load jar:$app/omni.jar!/defaults/preferences/*.js
    // or jar:$gre/omni.jar!/defaults/preferences/*.js.
-@@ -4532,17 +4545,17 @@ float MOZ_MAYBE_UNUSED GetPref<float>(co
+@@ -4606,17 +4619,17 @@ nsresult Preferences::InitInitialObjects
        }
  
        nsCOMPtr<nsIFile> path = do_QueryInterface(elem);
@@ -87,9 +91,9 @@
 diff --git a/modules/libpref/moz.build b/modules/libpref/moz.build
 --- a/modules/libpref/moz.build
 +++ b/modules/libpref/moz.build
-@@ -31,16 +31,20 @@ EXPORTS.mozilla += [
-     'StaticPrefs.h',
+@@ -110,16 +110,20 @@ EXPORTS.mozilla += [
  ]
+ EXPORTS.mozilla += sorted(['!' + g for g in gen_h])
  
  UNIFIED_SOURCES += [
      'Preferences.cpp',
@@ -97,21 +101,21 @@
  ]
  
 +LOCAL_INCLUDES += [
-+     '/toolkit/xre'
++    '/toolkit/xre'
 +]
 +
- include('/ipc/chromium/chromium-config.mozbuild')
+ gen_all_tuple = tuple(gen_h + gen_cpp + gen_rs)
  
- FINAL_LIBRARY = 'xul'
+ GENERATED_FILES += [gen_all_tuple]
  
- DEFINES['OS_ARCH'] = CONFIG['OS_ARCH']
- DEFINES['MOZ_WIDGET_TOOLKIT'] = CONFIG['MOZ_WIDGET_TOOLKIT']
- if CONFIG['MOZ_ENABLE_WEBRENDER']:
-     DEFINES['MOZ_ENABLE_WEBRENDER'] = True
+ static_pref_list = GENERATED_FILES[gen_all_tuple]
+ static_pref_list.script = 'init/generate_static_pref_list.py:emit_code'
+ static_pref_list.inputs = ['init/StaticPrefList.yaml']
+ 
 diff --git a/python/mozbuild/mozpack/chrome/flags.py b/python/mozbuild/mozpack/chrome/flags.py
 --- a/python/mozbuild/mozpack/chrome/flags.py
 +++ b/python/mozbuild/mozpack/chrome/flags.py
-@@ -220,16 +220,17 @@ class Flags(OrderedDict):
+@@ -227,16 +227,17 @@ class Flags(OrderedDict):
          'contentaccessible': Flag,
          'os': StringFlag,
          'osversion': VersionFlag,
@@ -132,7 +136,7 @@
 diff --git a/python/mozbuild/mozpack/chrome/manifest.py b/python/mozbuild/mozpack/chrome/manifest.py
 --- a/python/mozbuild/mozpack/chrome/manifest.py
 +++ b/python/mozbuild/mozpack/chrome/manifest.py
-@@ -39,16 +39,17 @@ class ManifestEntry(object):
+@@ -36,16 +36,17 @@ class ManifestEntry(object):
          'platformversion',
          'os',
          'osversion',
@@ -153,7 +157,7 @@
 diff --git a/toolkit/components/downloads/moz.build b/toolkit/components/downloads/moz.build
 --- a/toolkit/components/downloads/moz.build
 +++ b/toolkit/components/downloads/moz.build
-@@ -41,10 +41,14 @@ EXTRA_JS_MODULES += [
+@@ -41,10 +41,14 @@ XPCOM_MANIFESTS += [
  
  if CONFIG['MOZ_PLACES']:
      EXTRA_JS_MODULES += [
@@ -168,530 +172,32 @@
 +
  with Files('**'):
      BUG_COMPONENT = ('Toolkit', 'Downloads API')
-diff --git a/toolkit/content/jar.mn b/toolkit/content/jar.mn
---- a/toolkit/content/jar.mn
-+++ b/toolkit/content/jar.mn
-@@ -67,16 +67,18 @@ toolkit.jar:
-    content/global/bindings/calendar.js         (widgets/calendar.js)
-    content/global/bindings/checkbox.xml        (widgets/checkbox.xml)
-    content/global/bindings/datekeeper.js       (widgets/datekeeper.js)
-    content/global/bindings/datepicker.js       (widgets/datepicker.js)
-    content/global/bindings/datetimepopup.xml   (widgets/datetimepopup.xml)
-    content/global/bindings/datetimebox.xml     (widgets/datetimebox.xml)
-    content/global/bindings/datetimebox.css     (widgets/datetimebox.css)
- *  content/global/bindings/dialog.xml          (widgets/dialog.xml)
-+*  content/global/bindings/dialog-kde.xml      (widgets/dialog-kde.xml)
-+% override chrome://global/content/bindings/dialog.xml chrome://global/content/bindings/dialog-kde.xml desktop=kde
-    content/global/bindings/general.xml         (widgets/general.xml)
-    content/global/bindings/menu.xml            (widgets/menu.xml)
-    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/radio.xml           (widgets/radio.xml)
-    content/global/bindings/richlistbox.xml     (widgets/richlistbox.xml)
-diff --git a/toolkit/content/widgets/dialog-kde.xml b/toolkit/content/widgets/dialog-kde.xml
-new file mode 100644
---- /dev/null
-+++ b/toolkit/content/widgets/dialog-kde.xml
-@@ -0,0 +1,477 @@
-+<?xml version="1.0"?>
-+<!-- This Source Code Form is subject to the terms of the Mozilla Public
-+   - License, v. 2.0. If a copy of the MPL was not distributed with this
-+   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-+
-+<!DOCTYPE bindings [
-+  <!ENTITY % globalKeysDTD SYSTEM "chrome://global/locale/globalKeys.dtd">
-+  %globalKeysDTD;
-+]>
-+
-+<bindings id="dialogBindings"
-+          xmlns="http://www.mozilla.org/xbl"
-+          xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-+          xmlns:xbl="http://www.mozilla.org/xbl">
-+
-+  <binding id="dialog">
-+    <content>
-+      <xul:vbox class="box-inherit dialog-content-box" flex="1">
-+        <children/>
-+      </xul:vbox>
-+
-+      <xul:hbox class="dialog-button-box" anonid="buttons"
-+                xbl:inherits="pack=buttonpack,align=buttonalign,dir=buttondir,orient=buttonorient"
-+#ifdef XP_UNIX_GNOME
-+                >
-+        <xul:button dlgtype="disclosure" class="dialog-button" hidden="true"/>
-+        <xul:button dlgtype="help" class="dialog-button" hidden="true"/>
-+        <xul:button dlgtype="extra2" class="dialog-button" hidden="true"/>
-+        <xul:button dlgtype="extra1" class="dialog-button" hidden="true"/>
-+        <xul:spacer anonid="spacer" flex="1"/>
-+        <xul:button dlgtype="cancel" class="dialog-button"/>
-+        <xul:button dlgtype="accept" class="dialog-button" xbl:inherits="disabled=buttondisabledaccept"/>
-+#elif XP_UNIX
-+                >
-+	<xul:button dlgtype="help" class="dialog-button" hidden="true"/>
-+        <xul:button dlgtype="extra2" class="dialog-button" hidden="true"/>
-+        <xul:spacer anonid="spacer" flex="1"/>
-+        <xul:button dlgtype="accept" class="dialog-button" xbl:inherits="disabled=buttondisabledaccept"/>
-+        <xul:button dlgtype="extra1" class="dialog-button" hidden="true"/>
-+        <xul:button dlgtype="cancel" class="dialog-button"/>
-+        <xul:button dlgtype="disclosure" class="dialog-button" hidden="true"/>
-+#else
-+                pack="end">
-+        <xul:button dlgtype="extra2" class="dialog-button" hidden="true"/>
-+        <xul:spacer anonid="spacer" flex="1" hidden="true"/>
-+        <xul:button dlgtype="accept" class="dialog-button" xbl:inherits="disabled=buttondisabledaccept"/>
-+        <xul:button dlgtype="extra1" class="dialog-button" hidden="true"/>
-+        <xul:button dlgtype="cancel" class="dialog-button"/>
-+        <xul:button dlgtype="help" class="dialog-button" hidden="true"/>
-+        <xul:button dlgtype="disclosure" class="dialog-button" hidden="true"/>
-+#endif
-+      </xul:hbox>
-+
-+    <xul:keyset>
-+      <xul:key phase="capturing" oncommand="document.documentElement.openHelp(event)"
-+#ifdef XP_MACOSX
-+           key="&openHelpMac.commandkey;" modifiers="accel"/>
-+#else
-+           keycode="&openHelp.commandkey;"/>
-+#endif
-+    </xul:keyset>
-+
-+    </content>
-+
-+    <implementation>
-+      <field name="_mStrBundle">null</field>
-+      <field name="_closeHandler">(function(event) {
-+        if (!document.documentElement.cancelDialog())
-+          event.preventDefault();
-+      })</field>
-+
-+      <property name="buttons"
-+                onget="return this.getAttribute('buttons');"
-+                onset="this._configureButtons(val); return val;"/>
-+
-+      <property name="defaultButton">
-+        <getter>
-+        <![CDATA[
-+          if (this.hasAttribute("defaultButton"))
-+            return this.getAttribute("defaultButton");
-+          return "accept"; // default to the accept button
-+        ]]>
-+        </getter>
-+        <setter>
-+        <![CDATA[
-+          this._setDefaultButton(val);
-+          return val;
-+        ]]>
-+        </setter>
-+      </property>
-+
-+      <method name="acceptDialog">
-+        <body>
-+        <![CDATA[
-+          return this._doButtonCommand("accept");
-+        ]]>
-+        </body>
-+      </method>
-+
-+      <method name="cancelDialog">
-+        <body>
-+        <![CDATA[
-+          return this._doButtonCommand("cancel");
-+        ]]>
-+        </body>
-+      </method>
-+
-+      <method name="getButton">
-+        <parameter name="aDlgType"/>
-+        <body>
-+        <![CDATA[
-+          return this._buttons[aDlgType];
-+        ]]>
-+        </body>
-+      </method>
-+
-+      <method name="moveToAlertPosition">
-+        <body>
-+        <![CDATA[
-+          // hack. we need this so the window has something like its final size
-+          if (window.outerWidth == 1) {
-+            dump("Trying to position a sizeless window; caller should have called sizeToContent() or sizeTo(). See bug 75649.\n");
-+            sizeToContent();
-+          }
-+
-+          if (opener) {
-+            var xOffset = (opener.outerWidth - window.outerWidth) / 2;
-+            var yOffset = opener.outerHeight / 5;
-+
-+            var newX = opener.screenX + xOffset;
-+            var newY = opener.screenY + yOffset;
-+          } else {
-+            newX = (screen.availWidth - window.outerWidth) / 2;
-+            newY = (screen.availHeight - window.outerHeight) / 2;
-+          }
-+
-+          // ensure the window is fully onscreen (if smaller than the screen)
-+          if (newX < screen.availLeft)
-+            newX = screen.availLeft + 20;
-+          if ((newX + window.outerWidth) > (screen.availLeft + screen.availWidth))
-+            newX = (screen.availLeft + screen.availWidth) - window.outerWidth - 20;
-+
-+          if (newY < screen.availTop)
-+            newY = screen.availTop + 20;
-+          if ((newY + window.outerHeight) > (screen.availTop + screen.availHeight))
-+            newY = (screen.availTop + screen.availHeight) - window.outerHeight - 60;
-+
-+          window.moveTo( newX, newY );
-+        ]]>
-+        </body>
-+      </method>
-+
-+      <method name="centerWindowOnScreen">
-+        <body>
-+        <![CDATA[
-+          var xOffset = screen.availWidth / 2 - window.outerWidth / 2;
-+          var yOffset = screen.availHeight / 2 - window.outerHeight / 2;
-+
-+          xOffset = xOffset > 0 ? xOffset : 0;
-+          yOffset = yOffset > 0 ? yOffset : 0;
-+          window.moveTo(xOffset, yOffset);
-+        ]]>
-+        </body>
-+      </method>
-+
-+      <constructor>
-+      <![CDATA[
-+        this._configureButtons(this.buttons);
-+
-+        // listen for when window is closed via native close buttons
-+        window.addEventListener("close", this._closeHandler);
-+
-+        // for things that we need to initialize after onload fires
-+        window.addEventListener("load", this.postLoadInit);
-+
-+        window.moveToAlertPosition = this.moveToAlertPosition;
-+        window.centerWindowOnScreen = this.centerWindowOnScreen;
-+      ]]>
-+      </constructor>
-+
-+      <method name="postLoadInit">
-+        <parameter name="aEvent"/>
-+        <body>
-+        <![CDATA[
-+          function focusInit() {
-+            const dialog = document.documentElement;
-+            const defaultButton = dialog.getButton(dialog.defaultButton);
-+            // give focus to the first focusable element in the dialog
-+            if (!document.commandDispatcher.focusedElement) {
-+              document.commandDispatcher.advanceFocusIntoSubtree(dialog);
-+
-+              var focusedElt = document.commandDispatcher.focusedElement;
-+              if (focusedElt) {
-+                var initialFocusedElt = focusedElt;
-+                while (focusedElt.localName == "tab" ||
-+                       focusedElt.getAttribute("noinitialfocus") == "true") {
-+                  document.commandDispatcher.advanceFocusIntoSubtree(focusedElt);
-+                  focusedElt = document.commandDispatcher.focusedElement;
-+                  if (focusedElt == initialFocusedElt) {
-+                    if (focusedElt.getAttribute("noinitialfocus") == "true") {
-+                      focusedElt.blur();
-+                    }
-+                    break;
-+                  }
-+                }
-+
-+                if (initialFocusedElt.localName == "tab") {
-+                  if (focusedElt.hasAttribute("dlgtype")) {
-+                    // We don't want to focus on anonymous OK, Cancel, etc. buttons,
-+                    // so return focus to the tab itself
-+                    initialFocusedElt.focus();
-+                  }
-+                } else if (!/Mac/.test(navigator.platform) &&
-+                           focusedElt.hasAttribute("dlgtype") && focusedElt != defaultButton) {
-+                  defaultButton.focus();
-+                }
-+              }
-+            }
-+
-+            try {
-+              if (defaultButton)
-+                window.notifyDefaultButtonLoaded(defaultButton);
-+            } catch (e) { }
-+          }
-+
-+          // Give focus after onload completes, see bug 103197.
-+          setTimeout(focusInit, 0);
-+        ]]>
-+        </body>
-+      </method>
-+
-+      <method name="openHelp">
-+        <parameter name="event"/>
-+        <body>
-+        <![CDATA[
-+          var helpButton = document.documentElement.getButton("help");
-+          if (helpButton.disabled || helpButton.hidden)
-+            return;
-+          this._fireButtonEvent("help");
-+          event.stopPropagation();
-+          event.preventDefault();
-+        ]]>
-+        </body>
-+      </method>
-+
-+      <property name="mStrBundle">
-+        <getter>
-+        <![CDATA[
-+          if (!this._mStrBundle) {
-+            // need to create string bundle manually instead of using <xul:stringbundle/>
-+            // see bug 63370 for details
-+            this._mStrBundle = Cc["@mozilla.org/intl/stringbundle;1"]
-+                                 .getService(Ci.nsIStringBundleService)
-+                                 .createBundle("chrome://global/locale/dialog.properties");
-+          }
-+          return this._mStrBundle;
-+        ]]></getter>
-+      </property>
-+
-+      <method name="_configureButtons">
-+        <parameter name="aButtons"/>
-+        <body>
-+        <![CDATA[
-+          // by default, get all the anonymous button elements
-+          var buttons = {};
-+          this._buttons = buttons;
-+          buttons.accept = document.getAnonymousElementByAttribute(this, "dlgtype", "accept");
-+          buttons.cancel = document.getAnonymousElementByAttribute(this, "dlgtype", "cancel");
-+          buttons.extra1 = document.getAnonymousElementByAttribute(this, "dlgtype", "extra1");
-+          buttons.extra2 = document.getAnonymousElementByAttribute(this, "dlgtype", "extra2");
-+          buttons.help = document.getAnonymousElementByAttribute(this, "dlgtype", "help");
-+          buttons.disclosure = document.getAnonymousElementByAttribute(this, "dlgtype", "disclosure");
-+
-+          // look for any overriding explicit button elements
-+          var exBtns = this.getElementsByAttribute("dlgtype", "*");
-+          var dlgtype;
-+          var i;
-+          for (i = 0; i < exBtns.length; ++i) {
-+            dlgtype = exBtns[i].getAttribute("dlgtype");
-+            buttons[dlgtype].hidden = true; // hide the anonymous button
-+            buttons[dlgtype] = exBtns[i];
-+          }
-+
-+          // add the label and oncommand handler to each button
-+          for (dlgtype in buttons) {
-+            var button = buttons[dlgtype];
-+            button.addEventListener("command", this._handleButtonCommand, true);
-+
-+            // don't override custom labels with pre-defined labels on explicit buttons
-+            if (!button.hasAttribute("label")) {
-+              // dialog attributes override the default labels in dialog.properties
-+              if (this.hasAttribute("buttonlabel" + dlgtype)) {
-+                button.setAttribute("label", this.getAttribute("buttonlabel" + dlgtype));
-+                if (this.hasAttribute("buttonaccesskey" + dlgtype))
-+                  button.setAttribute("accesskey", this.getAttribute("buttonaccesskey" + dlgtype));
-+              } else if (dlgtype != "extra1" && dlgtype != "extra2") {
-+                button.setAttribute("label", this.mStrBundle.GetStringFromName("button-" + dlgtype));
-+                var accessKey = this.mStrBundle.GetStringFromName("accesskey-" + dlgtype);
-+                if (accessKey)
-+                  button.setAttribute("accesskey", accessKey);
-+              } else if (this.hasAttribute("buttonid" + dlgtype)) {
-+                document.l10n.setAttributes(button, this.getAttribute("buttonid" + dlgtype));
-+              }
-+            }
-+            // allow specifying alternate icons in the dialog header
-+            if (!button.hasAttribute("icon")) {
-+              // if there's an icon specified, use that
-+              if (this.hasAttribute("buttonicon" + dlgtype))
-+                button.setAttribute("icon", this.getAttribute("buttonicon" + dlgtype));
-+              // otherwise set defaults
-+              else
-+                switch (dlgtype) {
-+                  case "accept":
-+                    button.setAttribute("icon", "accept");
-+                    break;
-+                  case "cancel":
-+                    button.setAttribute("icon", "cancel");
-+                    break;
-+                  case "disclosure":
-+                    button.setAttribute("icon", "properties");
-+                    break;
-+                  case "help":
-+                    button.setAttribute("icon", "help");
-+                    break;
-+                  default:
-+                    break;
-+                }
-+            }
-+          }
-+
-+          // ensure that hitting enter triggers the default button command
-+          this.defaultButton = this.defaultButton;
-+
-+          // if there is a special button configuration, use it
-+          if (aButtons) {
-+            // expect a comma delimited list of dlgtype values
-+            var list = aButtons.split(",");
-+
-+            // mark shown dlgtypes as true
-+            var shown = { accept: false, cancel: false, help: false,
-+                          disclosure: false, extra1: false, extra2: false };
-+            for (i = 0; i < list.length; ++i)
-+              shown[list[i].replace(/ /g, "")] = true;
-+
-+            // hide/show the buttons we want
-+            for (dlgtype in buttons)
-+              buttons[dlgtype].hidden = !shown[dlgtype];
-+
-+            // show the spacer on Windows only when the extra2 button is present
-+            if (/Win/.test(navigator.platform)) {
-+              var spacer = document.getAnonymousElementByAttribute(this, "anonid", "spacer");
-+              spacer.removeAttribute("hidden");
-+              spacer.setAttribute("flex", shown.extra2 ? "1" : "0");
-+            }
-+          }
-+        ]]>
-+        </body>
-+      </method>
-+
-+      <method name="_setDefaultButton">
-+        <parameter name="aNewDefault"/>
-+        <body>
-+        <![CDATA[
-+          // remove the default attribute from the previous default button, if any
-+          var oldDefaultButton = this.getButton(this.defaultButton);
-+          if (oldDefaultButton)
-+            oldDefaultButton.removeAttribute("default");
-+
-+          var newDefaultButton = this.getButton(aNewDefault);
-+          if (newDefaultButton) {
-+            this.setAttribute("defaultButton", aNewDefault);
-+            newDefaultButton.setAttribute("default", "true");
-+          } else {
-+            this.setAttribute("defaultButton", "none");
-+            if (aNewDefault != "none")
-+              dump("invalid new default button: " + aNewDefault + ", assuming: none\n");
-+          }
-+        ]]>
-+        </body>
-+      </method>
-+
-+      <method name="_handleButtonCommand">
-+        <parameter name="aEvent"/>
-+        <body>
-+        <![CDATA[
-+          return document.documentElement._doButtonCommand(
-+                                        aEvent.target.getAttribute("dlgtype"));
-+        ]]>
-+        </body>
-+      </method>
-+
-+      <method name="_doButtonCommand">
-+        <parameter name="aDlgType"/>
-+        <body>
-+        <![CDATA[
-+          var button = this.getButton(aDlgType);
-+          if (!button.disabled) {
-+            var noCancel = this._fireButtonEvent(aDlgType);
-+            if (noCancel) {
-+              if (aDlgType == "accept" || aDlgType == "cancel") {
-+                var closingEvent = new CustomEvent("dialogclosing", {
-+                  bubbles: true,
-+                  detail: { button: aDlgType },
-+                });
-+                this.dispatchEvent(closingEvent);
-+                window.close();
-+              }
-+            }
-+            return noCancel;
-+          }
-+          return true;
-+        ]]>
-+        </body>
-+      </method>
-+
-+      <method name="_fireButtonEvent">
-+        <parameter name="aDlgType"/>
-+        <body>
-+        <![CDATA[
-+          var event = document.createEvent("Events");
-+          event.initEvent("dialog" + aDlgType, true, true);
-+
-+          // handle dom event handlers
-+          var noCancel = this.dispatchEvent(event);
-+
-+          // handle any xml attribute event handlers
-+          var handler = this.getAttribute("ondialog" + aDlgType);
-+          if (handler != "") {
-+            var fn = new Function("event", handler);
-+            var returned = fn(event);
-+            // eslint-disable-next-line mozilla/no-compare-against-boolean-literals
-+            if (returned == false)
-+              noCancel = false;
-+          }
-+
-+          return noCancel;
-+        ]]>
-+        </body>
-+      </method>
-+
-+      <method name="_hitEnter">
-+        <parameter name="evt"/>
-+        <body>
-+        <![CDATA[
-+          if (evt.defaultPrevented)
-+            return;
-+
-+          var btn = this.getButton(this.defaultButton);
-+          if (btn)
-+            this._doButtonCommand(this.defaultButton);
-+        ]]>
-+        </body>
-+      </method>
-+
-+    </implementation>
-+
-+    <handlers>
-+      <handler event="keypress" keycode="VK_RETURN"
-+               group="system" action="this._hitEnter(event);"/>
-+      <handler event="keypress" keycode="VK_ESCAPE" group="system">
-+        if (!event.defaultPrevented)
-+          this.cancelDialog();
-+      </handler>
-+#ifdef XP_MACOSX
-+      <handler event="keypress" key="." modifiers="meta" phase="capturing" action="this.cancelDialog();"/>
-+#else
-+      <handler event="focus" phase="capturing">
-+        var btn = this.getButton(this.defaultButton);
-+        if (btn)
-+          btn.setAttribute("default", event.originalTarget == btn || !(event.originalTarget instanceof Ci.nsIDOMXULButtonElement));
-+      </handler>
-+#endif
-+    </handlers>
-+
-+  </binding>
-+
-+</bindings>
-diff --git a/toolkit/mozapps/downloads/nsHelperAppDlg.js b/toolkit/mozapps/downloads/nsHelperAppDlg.js
---- a/toolkit/mozapps/downloads/nsHelperAppDlg.js
-+++ b/toolkit/mozapps/downloads/nsHelperAppDlg.js
-@@ -1030,30 +1030,60 @@ nsUnknownContentTypeDialog.prototype = {
- 
-       if (params.handlerApp &&
-           params.handlerApp.executable &&
-           params.handlerApp.executable.isFile()) {
+diff --git a/toolkit/mozapps/downloads/HelperAppDlg.jsm b/toolkit/mozapps/downloads/HelperAppDlg.jsm
+--- a/toolkit/mozapps/downloads/HelperAppDlg.jsm
++++ b/toolkit/mozapps/downloads/HelperAppDlg.jsm
+@@ -1199,36 +1199,66 @@ nsUnknownContentTypeDialog.prototype = {
+         params.handlerApp &&
+         params.handlerApp.executable &&
+         params.handlerApp.executable.isFile()
+       ) {
          // Remember the file they chose to run.
          this.chosenApp = params.handlerApp;
        }
      } else if ("@mozilla.org/applicationchooser;1" in Cc) {
 -      var nsIApplicationChooser = Ci.nsIApplicationChooser;
--      var appChooser = Cc["@mozilla.org/applicationchooser;1"]
--                         .createInstance(nsIApplicationChooser);
--      appChooser.init(this.mDialog, this.dialogElement("strings").getString("chooseAppFilePickerTitle"));
+-      var appChooser = Cc["@mozilla.org/applicationchooser;1"].createInstance(
+-        nsIApplicationChooser
+-      );
+-      appChooser.init(
+-        this.mDialog,
+-        this.dialogElement("strings").getString("chooseAppFilePickerTitle")
+-      );
 -      var contentTypeDialogObj = this;
 -      let appChooserCallback = function appChooserCallback_done(aResult) {
 -        if (aResult) {
--           contentTypeDialogObj.chosenApp = aResult.QueryInterface(Ci.nsILocalHandlerApp);
+-          contentTypeDialogObj.chosenApp = aResult.QueryInterface(
+-            Ci.nsILocalHandlerApp
+-          );
 -        }
 -        contentTypeDialogObj.finishChooseApp();
 -      };
@@ -728,13 +234,19 @@
 +        });
 +      } else {
 +        var nsIApplicationChooser = Ci.nsIApplicationChooser;
-+        var appChooser = Cc["@mozilla.org/applicationchooser;1"]
-+                           .createInstance(nsIApplicationChooser);
-+        appChooser.init(this.mDialog, this.dialogElement("strings").getString("chooseAppFilePickerTitle"));
++        var appChooser = Cc["@mozilla.org/applicationchooser;1"].createInstance(
++          nsIApplicationChooser
++        );
++        appChooser.init(
++          this.mDialog,
++          this.dialogElement("strings").getString("chooseAppFilePickerTitle")
++        );
 +        var contentTypeDialogObj = this;
 +        let appChooserCallback = function appChooserCallback_done(aResult) {
 +          if (aResult) {
-+             contentTypeDialogObj.chosenApp = aResult.QueryInterface(Ci.nsILocalHandlerApp);
++            contentTypeDialogObj.chosenApp = aResult.QueryInterface(
++              Ci.nsILocalHandlerApp
++            );
 +          }
 +          contentTypeDialogObj.finishChooseApp();
 +        };
@@ -744,16 +256,16 @@
 +      }
      } else {
        var nsIFilePicker = Ci.nsIFilePicker;
-       var fp = Cc["@mozilla.org/filepicker;1"]
-                  .createInstance(nsIFilePicker);
-       fp.init(this.mDialog,
-               this.dialogElement("strings").getString("chooseAppFilePickerTitle"),
-               nsIFilePicker.modeOpen);
- 
+       var fp = Cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
+       fp.init(
+         this.mDialog,
+         this.dialogElement("strings").getString("chooseAppFilePickerTitle"),
+         nsIFilePicker.modeOpen
+       );
 diff --git a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
 --- a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
 +++ b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
-@@ -15,16 +15,17 @@
+@@ -14,16 +14,17 @@
  #include "nsPrintfCString.h"
  #include "nsNetCID.h"
  #include "nsNetUtil.h"
@@ -764,17 +276,17 @@
  #include "nsIURI.h"
 +#include "nsKDEUtils.h"
  
+ using namespace mozilla;
+ 
  class nsUnixSystemProxySettings final : public nsISystemProxySettings {
   public:
    NS_DECL_ISUPPORTS
    NS_DECL_NSISYSTEMPROXYSETTINGS
  
-   nsUnixSystemProxySettings() : mSchemeProxySettings(4) {}
-   nsresult Init();
-@@ -42,16 +43,18 @@ class nsUnixSystemProxySettings final : 
-                                    nsACString& aResult);
-   nsresult GetProxyFromGConf(const nsACString& aScheme, const nsACString& aHost,
-                              int32_t aPort, nsACString& aResult);
+@@ -37,16 +38,18 @@ class nsUnixSystemProxySettings final : 
+   nsCOMPtr<nsIGSettingsCollection> mProxySettings;
+   nsInterfaceHashtable<nsCStringHashKey, nsIGSettingsCollection>
+       mSchemeProxySettings;
    nsresult GetProxyFromGSettings(const nsACString& aScheme,
                                   const nsACString& aHost, int32_t aPort,
                                   nsACString& aResult);
@@ -790,7 +302,7 @@
  nsUnixSystemProxySettings::GetMainThreadOnly(bool* aMainThreadOnly) {
    // dbus prevents us from being threadsafe, but this routine should not block
    // anyhow
-@@ -488,16 +491,19 @@ nsresult nsUnixSystemProxySettings::GetP
+@@ -381,21 +384,50 @@ nsresult nsUnixSystemProxySettings::GetP
    return NS_OK;
  }
  
@@ -806,20 +318,10 @@
      nsresult rv = GetProxyFromGSettings(aScheme, aHost, aPort, aResult);
      if (NS_SUCCEEDED(rv)) return rv;
    }
-   if (mGConf) return GetProxyFromGConf(aScheme, aHost, aPort, aResult);
  
    return GetProxyFromEnvironment(aScheme, aHost, aPort, aResult);
  }
-@@ -521,8 +527,34 @@ static const mozilla::Module::CIDEntry k
- static const mozilla::Module::ContractIDEntry kUnixProxyContracts[] = {
-     {NS_SYSTEMPROXYSETTINGS_CONTRACTID, &kNS_UNIXSYSTEMPROXYSERVICE_CID},
-     {nullptr}};
  
- static const mozilla::Module kUnixProxyModule = {
-     mozilla::Module::kVersion, kUnixProxyCIDs, kUnixProxyContracts};
- 
- NSMODULE_DEFN(nsUnixProxyModule) = &kUnixProxyModule;
-+
 +nsresult
 +nsUnixSystemProxySettings::GetProxyFromKDE(const nsACString& aScheme,
 +                                           const nsACString& aHost,
@@ -845,10 +347,16 @@
 +  return NS_OK;
 +}
 +
++
+ NS_IMPL_COMPONENT_FACTORY(nsUnixSystemProxySettings) {
+   auto result = MakeRefPtr<nsUnixSystemProxySettings>();
+   result->Init();
+   return result.forget().downcast<nsISupports>();
+ }
 diff --git a/toolkit/xre/moz.build b/toolkit/xre/moz.build
 --- a/toolkit/xre/moz.build
 +++ b/toolkit/xre/moz.build
-@@ -73,17 +73,19 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'co
+@@ -85,17 +85,19 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'co
          '../components/printingui',
      ]
  elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'uikit':
@@ -856,7 +364,7 @@
          'nsNativeAppSupportDefault.cpp',
          'UIKitDirProvider.mm',
      ]
- elif 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
+ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk':
 +    EXPORTS += ['nsKDEUtils.h']
      UNIFIED_SOURCES += [
 +        'nsKDEUtils.cpp',
@@ -867,7 +375,7 @@
          'nsNativeAppSupportDefault.cpp',
      ]
  
- if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk3':
+ if CONFIG['MOZ_HAS_REMOTE']:
 diff --git a/toolkit/xre/nsKDEUtils.cpp b/toolkit/xre/nsKDEUtils.cpp
 new file mode 100644
 --- /dev/null
@@ -916,7 +424,7 @@
 +    Display* dpy = XOpenDisplay( NULL );
 +    if( dpy == NULL )
 +        return false;
-+    Atom kde_full_session = XInternAtom( dpy, "KDE_FULL_SESSION", True );
++    Atom kde_full_session = XInternAtom( dpy, "KDE_FULL_SESSION", true );
 +    bool kde = false;
 +    if( kde_full_session != None )
 +        {
@@ -1273,7 +781,8 @@
 diff --git a/uriloader/exthandler/HandlerServiceParent.cpp b/uriloader/exthandler/HandlerServiceParent.cpp
 --- a/uriloader/exthandler/HandlerServiceParent.cpp
 +++ b/uriloader/exthandler/HandlerServiceParent.cpp
-@@ -1,16 +1,16 @@
+@@ -7,17 +7,17 @@
+ #include "mozilla/ipc/ProtocolUtils.h"
  #include "mozilla/Logging.h"
  #include "HandlerServiceParent.h"
  #include "nsIHandlerService.h"
@@ -1281,8 +790,8 @@
  #include "ContentHandlerService.h"
  #include "nsStringEnumerator.h"
  #ifdef MOZ_WIDGET_GTK
--#include "unix/nsGNOMERegistry.h"
-+#include "unix/nsCommonRegistry.h"
+-#  include "unix/nsGNOMERegistry.h"
++#  include "unix/nsCommonRegistry.h"
  #endif
  
  using mozilla::dom::ContentHandlerService;
@@ -1291,13 +800,13 @@
  using mozilla::dom::RemoteHandlerApp;
  
  namespace {
-@@ -246,17 +246,17 @@ mozilla::ipc::IPCResult HandlerServicePa
-   handlerSvc->Exists(info, exists);
-   return IPC_OK();
- }
- 
- mozilla::ipc::IPCResult HandlerServiceParent::RecvExistsForProtocol(
+@@ -288,17 +288,17 @@ mozilla::ipc::IPCResult HandlerServicePa
+ mozilla::ipc::IPCResult HandlerServiceParent::RecvExistsForProtocolOS(
      const nsCString& aProtocolScheme, bool* aHandlerExists) {
+   if (aProtocolScheme.Length() > MAX_SCHEME_LENGTH) {
+     *aHandlerExists = false;
+     return IPC_OK();
+   }
  #ifdef MOZ_WIDGET_GTK
    // Check the GNOME registry for a protocol handler
 -  *aHandlerExists = nsGNOMERegistry::HandlerExists(aProtocolScheme.get());
@@ -1308,19 +817,38 @@
    return IPC_OK();
  }
  
- mozilla::ipc::IPCResult HandlerServiceParent::RecvGetTypeFromExtension(
-     const nsCString& aFileExtension, nsCString* type) {
+ /*
+  * Check if a handler exists for the provided protocol. Check the datastore
+@@ -317,17 +317,17 @@ mozilla::ipc::IPCResult HandlerServicePa
+   nsCOMPtr<nsIExternalProtocolService> protoSvc =
+       do_GetService(NS_EXTERNALPROTOCOLSERVICE_CONTRACTID, &rv);
+   if (NS_WARN_IF(NS_FAILED(rv))) {
+     *aHandlerExists = false;
+     return IPC_OK();
+   }
+   rv = protoSvc->ExternalProtocolHandlerExists(aProtocolScheme.get(),
+                                                aHandlerExists);
+-
++##
+   if (NS_WARN_IF(NS_FAILED(rv))) {
+     *aHandlerExists = false;
+   }
+ #else
+   MOZ_RELEASE_ASSERT(false, "No implementation on this platform.");
+   *aHandlerExists = false;
+ #endif
+   return IPC_OK();
 diff --git a/uriloader/exthandler/moz.build b/uriloader/exthandler/moz.build
 --- a/uriloader/exthandler/moz.build
 +++ b/uriloader/exthandler/moz.build
-@@ -76,17 +76,19 @@ else:
+@@ -83,17 +83,19 @@ else:
      SOURCES += [
          osdir + '/nsOSHelperAppService.cpp',
      ]
      if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
          CXXFLAGS += ['-Wno-error=shadow']
  
- if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
+ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk':
      UNIFIED_SOURCES += [
 +        'unix/nsCommonRegistry.cpp',
          'unix/nsGNOMERegistry.cpp',
@@ -1333,7 +861,7 @@
          'android/nsExternalURLHandlerService.cpp',
          'android/nsMIMEInfoAndroid.cpp',
      ]
-@@ -120,16 +122,17 @@ include('/ipc/chromium/chromium-config.m
+@@ -133,16 +135,17 @@ include('/ipc/chromium/chromium-config.m
  FINAL_LIBRARY = 'xul'
  
  LOCAL_INCLUDES += [
@@ -1349,7 +877,7 @@
      CXXFLAGS += CONFIG['TK_CFLAGS']
      CXXFLAGS += CONFIG['MOZ_DBUS_CFLAGS']
  
- if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk3':
+ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk':
      CXXFLAGS += CONFIG['TK_CFLAGS']
 diff --git a/uriloader/exthandler/unix/nsCommonRegistry.cpp b/uriloader/exthandler/unix/nsCommonRegistry.cpp
 new file mode 100644
@@ -1591,19 +1119,19 @@
  #include "nsIIOService.h"
  #include "nsAutoPtr.h"
  #ifdef MOZ_ENABLE_DBUS
- #include "nsDBusHandlerApp.h"
+ #  include "nsDBusHandlerApp.h"
  #endif
 +#if defined(XP_UNIX) && !defined(XP_MACOSX)
 +#include "nsKDEUtils.h"
 +#endif
  
- nsresult nsMIMEInfoUnix::LoadUriInternal(nsIURI *aURI) {
+ nsresult nsMIMEInfoUnix::LoadUriInternal(nsIURI* aURI) {
 -  return nsGNOMERegistry::LoadURL(aURI);
 +  return nsCommonRegistry::LoadURL(aURI);
  }
  
  NS_IMETHODIMP
- nsMIMEInfoUnix::GetHasDefaultHandler(bool *_retval) {
+ nsMIMEInfoUnix::GetHasDefaultHandler(bool* _retval) {
    // if mDefaultApplication is set, it means the application has been set from
    // either /etc/mailcap or ${HOME}/.mailcap, in which case we don't want to
    // give the GNOME answer.
@@ -1678,8 +1206,8 @@
  #include "nsOSHelperAppService.h"
  #include "nsMIMEInfoUnix.h"
  #ifdef MOZ_WIDGET_GTK
--#include "nsGNOMERegistry.h"
-+#include "nsCommonRegistry.h"
+-#  include "nsGNOMERegistry.h"
++#  include "nsCommonRegistry.h"
  #endif
  #include "nsISupports.h"
  #include "nsString.h"
@@ -1688,7 +1216,7 @@
  #include "nsIURL.h"
  #include "nsIFileStreams.h"
  #include "nsILineInputStream.h"
-@@ -1031,17 +1031,17 @@ nsresult nsOSHelperAppService::GetHandle
+@@ -1025,17 +1025,17 @@ nsresult nsOSHelperAppService::GetHandle
  
  nsresult nsOSHelperAppService::OSProtocolHandlerExists(
      const char* aProtocolScheme, bool* aHandlerExists) {
@@ -1707,7 +1235,7 @@
      nsCOMPtr<nsIHandlerService> handlerSvc =
          do_GetService(NS_HANDLERSERVICE_CONTRACTID, &rv);
      if (NS_SUCCEEDED(rv) && handlerSvc) {
-@@ -1051,17 +1051,17 @@ nsresult nsOSHelperAppService::OSProtoco
+@@ -1045,17 +1045,17 @@ nsresult nsOSHelperAppService::OSProtoco
    }
  
    return rv;
@@ -1726,7 +1254,7 @@
  
  nsresult nsOSHelperAppService::GetFileTokenForPath(
      const char16_t* platformAppPath, nsIFile** aFile) {
-@@ -1142,17 +1142,17 @@ already_AddRefed<nsMIMEInfoBase> nsOSHel
+@@ -1136,17 +1136,17 @@ already_AddRefed<nsMIMEInfoBase> nsOSHel
    nsresult rv =
        LookUpTypeAndDescription(NS_ConvertUTF8toUTF16(aFileExt), majorType,
                                 minorType, mime_types_description, true);
@@ -1745,7 +1273,7 @@
  
      rv = LookUpTypeAndDescription(NS_ConvertUTF8toUTF16(aFileExt), majorType,
                                    minorType, mime_types_description, false);
-@@ -1254,17 +1254,17 @@ already_AddRefed<nsMIMEInfoBase> nsOSHel
+@@ -1248,17 +1248,17 @@ already_AddRefed<nsMIMEInfoBase> nsOSHel
  
    // Now look up our extensions
    nsAutoString extensions, mime_types_description;
@@ -1767,7 +1295,7 @@
 diff --git a/widget/gtk/moz.build b/widget/gtk/moz.build
 --- a/widget/gtk/moz.build
 +++ b/widget/gtk/moz.build
-@@ -116,16 +116,17 @@ include('/ipc/chromium/chromium-config.m
+@@ -126,16 +126,17 @@ include('/ipc/chromium/chromium-config.m
  
  FINAL_LIBRARY = 'xul'
  
@@ -1788,7 +1316,7 @@
 diff --git a/widget/gtk/nsFilePicker.cpp b/widget/gtk/nsFilePicker.cpp
 --- a/widget/gtk/nsFilePicker.cpp
 +++ b/widget/gtk/nsFilePicker.cpp
-@@ -4,32 +4,34 @@
+@@ -4,16 +4,17 @@
   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  
  #include "mozilla/Types.h"
@@ -1801,11 +1329,12 @@
  
  #include "nsGtkUtils.h"
  #include "nsIFileURL.h"
+ #include "nsIGIOService.h"
  #include "nsIURI.h"
  #include "nsIWidget.h"
  #include "nsIFile.h"
  #include "nsIStringBundle.h"
- 
+@@ -21,16 +22,17 @@
  #include "nsArrayEnumerator.h"
  #include "nsMemory.h"
  #include "nsEnumeratorUtils.h"
@@ -1822,14 +1351,14 @@
  // bug 1184009
  #define MAX_PREVIEW_SOURCE_SIZE 4096
  
- nsIFile *nsFilePicker::mPrevDisplayDirectory = nullptr;
-@@ -227,17 +229,19 @@ nsFilePicker::AppendFilters(int32_t aFil
+ nsIFile* nsFilePicker::mPrevDisplayDirectory = nullptr;
+@@ -228,17 +230,19 @@ nsFilePicker::AppendFilters(int32_t aFil
    mAllowURLs = !!(aFilterMask & filterAllowURLs);
    return nsBaseFilePicker::AppendFilters(aFilterMask);
  }
  
  NS_IMETHODIMP
- nsFilePicker::AppendFilter(const nsAString &aTitle, const nsAString &aFilter) {
+ nsFilePicker::AppendFilter(const nsAString& aTitle, const nsAString& aFilter) {
    if (aFilter.EqualsLiteral("..apps")) {
      // No platform specific thing we can do here, really....
 -    return NS_OK;
@@ -1844,12 +1373,12 @@
  
    mFilters.AppendElement(filter);
    mFilterNames.AppendElement(name);
-@@ -337,16 +341,39 @@ nsresult nsFilePicker::Show(int16_t *aRe
+@@ -338,16 +342,39 @@ nsresult nsFilePicker::Show(int16_t* aRe
    return NS_OK;
  }
  
  NS_IMETHODIMP
- nsFilePicker::Open(nsIFilePickerShownCallback *aCallback) {
+ nsFilePicker::Open(nsIFilePickerShownCallback* aCallback) {
    // Can't show two dialogs concurrently with the same filepicker
    if (mRunning) return NS_ERROR_NOT_AVAILABLE;
  
@@ -1879,12 +1408,12 @@
    nsCString title;
    title.Adopt(ToNewUTF8String(mTitle));
  
-   GtkWindow *parent_widget =
+   GtkWindow* parent_widget =
        GTK_WINDOW(mParentWidget->GetNativeData(NS_NATIVE_SHELLWIDGET));
  
    GtkFileChooserAction action = GetGtkFileChooserAction(mMode);
  
-@@ -571,16 +598,240 @@ void nsFilePicker::Done(void *file_choos
+@@ -573,16 +600,240 @@ void nsFilePicker::Done(void* file_choos
      mCallback->Done(result);
      mCallback = nullptr;
    } else {
@@ -2118,13 +1647,13 @@
 +    }
 +
  // All below functions available as of GTK 3.20+
- void *nsFilePicker::GtkFileChooserNew(const gchar *title, GtkWindow *parent,
+ void* nsFilePicker::GtkFileChooserNew(const gchar* title, GtkWindow* parent,
                                        GtkFileChooserAction action,
-                                       const gchar *accept_label) {
+                                       const gchar* accept_label) {
    static auto sGtkFileChooserNativeNewPtr =
-       (void *(*)(const gchar *, GtkWindow *, GtkFileChooserAction,
-                  const gchar *,
-                  const gchar *))dlsym(RTLD_DEFAULT,
+       (void* (*)(const gchar*, GtkWindow*, GtkFileChooserAction, const gchar*,
+                  const gchar*))dlsym(RTLD_DEFAULT,
+                                      "gtk_file_chooser_native_new");
 diff --git a/widget/gtk/nsFilePicker.h b/widget/gtk/nsFilePicker.h
 --- a/widget/gtk/nsFilePicker.h
 +++ b/widget/gtk/nsFilePicker.h
@@ -2135,7 +1664,7 @@
    nsTArray<nsCString> mFilterNames;
  
   private:
-   static nsIFile *mPrevDisplayDirectory;
+   static nsIFile* mPrevDisplayDirectory;
  
 +  bool kdeRunning();
 +  bool getKdeRunning();
@@ -2143,12 +1672,12 @@
 +  NS_IMETHODIMP kdeAppsDialog(PRInt16 *aReturn);
 +  nsCString kdeMakeFilter( int index );
 +
-   void *GtkFileChooserNew(const gchar *title, GtkWindow *parent,
+   void* GtkFileChooserNew(const gchar* title, GtkWindow* parent,
                            GtkFileChooserAction action,
-                           const gchar *accept_label);
-   void GtkFileChooserShow(void *file_chooser);
-   void GtkFileChooserDestroy(void *file_chooser);
-   void GtkFileChooserSetModal(void *file_chooser, GtkWindow *parent_widget,
+                           const gchar* accept_label);
+   void GtkFileChooserShow(void* file_chooser);
+   void GtkFileChooserDestroy(void* file_chooser);
+   void GtkFileChooserSetModal(void* file_chooser, GtkWindow* parent_widget,
                                gboolean modal);
  
 diff --git a/xpcom/components/ManifestParser.cpp b/xpcom/components/ManifestParser.cpp
@@ -2172,7 +1701,7 @@
    int argc;
  
    bool ischrome;
-@@ -392,16 +393,17 @@ void ParseManifest(NSLocationType aType,
+@@ -393,16 +394,17 @@ void ParseManifest(NSLocationType aType,
    NS_NAMED_LITERAL_STRING(kRemoteEnabled, "remoteenabled");
    NS_NAMED_LITERAL_STRING(kRemoteRequired, "remoterequired");
    NS_NAMED_LITERAL_STRING(kApplication, "application");
@@ -2190,7 +1719,7 @@
    NS_NAMED_LITERAL_STRING(kMain, "main");
    NS_NAMED_LITERAL_STRING(kContent, "content");
  
-@@ -447,39 +449,44 @@ void ParseManifest(NSLocationType aType,
+@@ -448,39 +450,44 @@ void ParseManifest(NSLocationType aType,
          CopyUTF8toUTF16(s, abi);
          abi.Insert(char16_t('_'), 0);
          abi.Insert(osTarget, 0);
@@ -2201,15 +1730,15 @@
    nsAutoString osVersion;
 +  nsAutoString desktop;
  #if defined(XP_WIN)
- #pragma warning(push)
- #pragma warning(disable : 4996)  // VC12+ deprecates GetVersionEx
+ #  pragma warning(push)
+ #  pragma warning(disable : 4996)  // VC12+ deprecates GetVersionEx
    OSVERSIONINFO info = {sizeof(OSVERSIONINFO)};
    if (GetVersionEx(&info)) {
      nsTextFormatter::ssprintf(osVersion, u"%ld.%ld", info.dwMajorVersion,
                                info.dwMinorVersion);
    }
 +  desktop = NS_LITERAL_STRING("win");
- #pragma warning(pop)
+ #  pragma warning(pop)
  #elif defined(MOZ_WIDGET_COCOA)
    SInt32 majorVersion = nsCocoaFeatures::OSXVersionMajor();
    SInt32 minorVersion = nsCocoaFeatures::OSXVersionMinor();
@@ -2235,7 +1764,7 @@
      process = kMain;
    }
  
-@@ -566,25 +573,27 @@ void ParseManifest(NSLocationType aType,
+@@ -567,25 +574,27 @@ void ParseManifest(NSLocationType aType,
      TriState stOsVersion = eUnspecified;
      TriState stOs = eUnspecified;
      TriState stABI = eUnspecified;
@@ -2263,7 +1792,7 @@
          continue;
        }
  
-@@ -621,17 +630,17 @@ void ParseManifest(NSLocationType aType,
+@@ -622,17 +631,17 @@ void ParseManifest(NSLocationType aType,
        }
  
        LogMessageWithContext(
@@ -2285,7 +1814,7 @@
 diff --git a/xpcom/components/moz.build b/xpcom/components/moz.build
 --- a/xpcom/components/moz.build
 +++ b/xpcom/components/moz.build
-@@ -44,12 +44,13 @@ LOCAL_INCLUDES += [
+@@ -66,16 +66,17 @@ LOCAL_INCLUDES += [
      '!..',
      '../base',
      '../build',
@@ -2297,8 +1826,12 @@
 +    '/toolkit/xre',
  ]
  
- if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
+ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk':
      CXXFLAGS += CONFIG['TK_CFLAGS']
+ 
+ if CONFIG['MOZ_LAYOUT_DEBUGGER']:
+     DEFINES['MOZ_LAYOUT_DEBUGGER'] = True
+ 
 diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp
 --- a/xpcom/io/nsLocalFileUnix.cpp
 +++ b/xpcom/io/nsLocalFileUnix.cpp
@@ -2310,15 +1843,15 @@
  #include "prlink.h"
  
  #ifdef MOZ_WIDGET_GTK
- #include "nsIGIOService.h"
-+#include "nsKDEUtils.h"
+ #  include "nsIGIOService.h"
++#  include "nsKDEUtils.h"
  #endif
  
  #ifdef MOZ_WIDGET_COCOA
- #include <Carbon/Carbon.h>
- #include "CocoaFileUtils.h"
- #include "prmem.h"
- #include "plbase64.h"
+ #  include <Carbon/Carbon.h>
+ #  include "CocoaFileUtils.h"
+ #  include "prmem.h"
+ #  include "plbase64.h"
  
 @@ -1902,62 +1903,77 @@ nsLocalFile::SetPersistentDescriptor(con