From 6a20f50d7f78ffed54b554d181160d00b5a068a8c86d2f930250a14ceec5f7d2 Mon Sep 17 00:00:00 2001
From: Wolfgang Rosenauer <wolfgang@rosenauer.org>
Date: Tue, 19 Feb 2013 19:24:59 +0000
Subject: [PATCH] - update to Firefox 19.0 (bnc#804248)   * MFSA
 2013-21/CVE-2013-0783/2013-0784     Miscellaneous memory safety hazards   *
 MFSA 2013-22/CVE-2013-0772 (bmo#801366)     Out-of-bounds read in image
 rendering   * MFSA 2013-23/CVE-2013-0765 (bmo#830614)     Wrapped WebIDL
 objects can be wrapped again   * MFSA 2013-24/CVE-2013-0773 (bmo#809652)    
 Web content bypass of COW and SOW security wrappers   * MFSA
 2013-25/CVE-2013-0774 (bmo#827193)     Privacy leak in JavaScript Workers   *
 MFSA 2013-26/CVE-2013-0775 (bmo#831095)     Use-after-free in
 nsImageLoadingContent   * MFSA 2013-27/CVE-2013-0776 (bmo#796475)    
 Phishing on HTTPS connection through malicious proxy   * MFSA
 2013-28/CVE-2013-0780/CVE-2013-0782/CVE-2013-0777/    
 CVE-2013-0778/CVE-2013-0779/CVE-2013-0781     Use-after-free, out of bounds
 read, and buffer overflow issues     found using Address Sanitizer - removed
 obsolete patches   * mozilla-webrtc.patch   * mozilla-gstreamer-803287.patch
 - added patch to fix session restore window order (bmo#712763)

OBS-URL: https://build.opensuse.org/package/show/mozilla:Factory/MozillaFirefox?expand=0&rev=319
---
 MozillaFirefox.changes           |  27 +++
 MozillaFirefox.spec              |  14 +-
 compare-locales.tar.bz2          |   4 +-
 create-tar.sh                    |   4 +-
 firefox-18.0.2-source.tar.bz2    |   3 -
 firefox-19.0-source.tar.bz2      |   3 +
 firefox-712763.patch             |  95 ++++++++++
 firefox-kde.patch                |  36 ++--
 firefox-multilocale-chrome.patch |  20 +--
 l10n-18.0.2.tar.bz2              |   3 -
 l10n-19.0.tar.bz2                |   3 +
 mozilla-gstreamer-760140.patch   | 230 ++++++++++++------------
 mozilla-gstreamer-803287.patch   | 293 -------------------------------
 mozilla-kde.patch                |  38 ++--
 mozilla-webrtc.patch             | 103 -----------
 source-stamp.txt                 |   2 +-
 16 files changed, 297 insertions(+), 581 deletions(-)
 delete mode 100644 firefox-18.0.2-source.tar.bz2
 create mode 100644 firefox-19.0-source.tar.bz2
 create mode 100644 firefox-712763.patch
 delete mode 100644 l10n-18.0.2.tar.bz2
 create mode 100644 l10n-19.0.tar.bz2
 delete mode 100644 mozilla-gstreamer-803287.patch
 delete mode 100644 mozilla-webrtc.patch

diff --git a/MozillaFirefox.changes b/MozillaFirefox.changes
index 7c4651d..a10a924 100644
--- a/MozillaFirefox.changes
+++ b/MozillaFirefox.changes
@@ -1,3 +1,30 @@
+-------------------------------------------------------------------
+Sat Feb 16 07:08:55 UTC 2013 - wr@rosenauer.org
+
+- update to Firefox 19.0 (bnc#804248)
+  * MFSA 2013-21/CVE-2013-0783/2013-0784
+    Miscellaneous memory safety hazards
+  * MFSA 2013-22/CVE-2013-0772 (bmo#801366)
+    Out-of-bounds read in image rendering
+  * MFSA 2013-23/CVE-2013-0765 (bmo#830614)
+    Wrapped WebIDL objects can be wrapped again
+  * MFSA 2013-24/CVE-2013-0773 (bmo#809652)
+    Web content bypass of COW and SOW security wrappers
+  * MFSA 2013-25/CVE-2013-0774 (bmo#827193)
+    Privacy leak in JavaScript Workers
+  * MFSA 2013-26/CVE-2013-0775 (bmo#831095)
+    Use-after-free in nsImageLoadingContent
+  * MFSA 2013-27/CVE-2013-0776 (bmo#796475)
+    Phishing on HTTPS connection through malicious proxy
+  * MFSA 2013-28/CVE-2013-0780/CVE-2013-0782/CVE-2013-0777/
+    CVE-2013-0778/CVE-2013-0779/CVE-2013-0781
+    Use-after-free, out of bounds read, and buffer overflow issues
+    found using Address Sanitizer
+- removed obsolete patches
+  * mozilla-webrtc.patch
+  * mozilla-gstreamer-803287.patch
+- added patch to fix session restore window order (bmo#712763)
+
 -------------------------------------------------------------------
 Sat Feb  2 08:40:52 UTC 2013 - wr@rosenauer.org
 
diff --git a/MozillaFirefox.spec b/MozillaFirefox.spec
index 796659d..7c91415 100644
--- a/MozillaFirefox.spec
+++ b/MozillaFirefox.spec
@@ -2,7 +2,7 @@
 # spec file for package MozillaFirefox
 #
 # Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
-#               2006-2012 Wolfgang Rosenauer
+#               2006-2013 Wolfgang Rosenauer
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,8 +17,8 @@
 #
 
 
-%define major 18
-%define mainver %major.0.2
+%define major 19
+%define mainver %major.0
 %define update_channel release
 
 Name:           MozillaFirefox
@@ -54,7 +54,7 @@ BuildRequires:  pkgconfig(gstreamer-plugins-base-0.10)
 %endif
 Version:        %{mainver}
 Release:        0
-%define         releasedate 2013020100
+%define         releasedate 2013021500
 Provides:       firefox = %{mainver}
 Provides:       firefox = %{version}-%{release}
 Provides:       web_browser
@@ -95,10 +95,8 @@ Patch9:         mozilla-repo.patch
 Patch10:        mozilla-sle11.patch
 Patch11:        mozilla-disable-neon-option.patch
 Patch12:        mozilla-arm-disable-edsp.patch
-Patch13:        mozilla-gstreamer-803287.patch
 Patch14:        mozilla-ppc.patch
 Patch15:        mozilla-gstreamer-760140.patch
-Patch16:        mozilla-webrtc.patch
 Patch17:        mozilla-libproxy-compat.patch
 Patch18:        mozilla-webrtc-ppc.patch
 # Firefox/browser
@@ -108,6 +106,7 @@ Patch32:        firefox-kde-114.patch
 Patch33:        firefox-no-default-ualocale.patch
 Patch34:        firefox-multilocale-chrome.patch
 Patch35:        firefox-branded-icons.patch
+Patch36:        firefox-712763.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 Requires(post):   coreutils shared-mime-info desktop-file-utils
 Requires(postun): shared-mime-info desktop-file-utils
@@ -231,10 +230,8 @@ cd $RPM_BUILD_DIR/mozilla
 %endif
 #%patch11 -p1
 %patch12 -p1
-%patch13 -p1
 %patch14 -p1
 %patch15 -p1
-%patch16 -p1
 %patch17 -p1
 %patch18 -p1
 #
@@ -248,6 +245,7 @@ cd $RPM_BUILD_DIR/mozilla
 %patch33 -p1
 %patch34 -p1
 %patch35 -p1
+%patch36 -p1
 
 %build
 # no need to add build time to binaries
diff --git a/compare-locales.tar.bz2 b/compare-locales.tar.bz2
index 764399d..a8e00f7 100644
--- a/compare-locales.tar.bz2
+++ b/compare-locales.tar.bz2
@@ -1,3 +1,3 @@
 version https://git-lfs.github.com/spec/v1
-oid sha256:303cfab8a67f363ce82e08bfff2673287e810395e2481dd43731f16bd873d2d1
-size 29943
+oid sha256:c99b8f9452d036a265c4f9ba1c2f55ea0af4d7cd3d59d902aca8c85f58936f35
+size 29944
diff --git a/create-tar.sh b/create-tar.sh
index 7a3b49e..3f863a3 100644
--- a/create-tar.sh
+++ b/create-tar.sh
@@ -2,8 +2,8 @@
 
 CHANNEL="release"
 BRANCH="releases/mozilla-$CHANNEL"
-RELEASE_TAG="FIREFOX_18_0_2_RELEASE"
-VERSION="18.0.2"
+RELEASE_TAG="FIREFOX_19_0_RELEASE"
+VERSION="19.0"
 
 # mozilla
 echo "cloning $BRANCH..."
diff --git a/firefox-18.0.2-source.tar.bz2 b/firefox-18.0.2-source.tar.bz2
deleted file mode 100644
index 5a69265..0000000
--- a/firefox-18.0.2-source.tar.bz2
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:7d10b48806599d8e0e7173ea6ab16dcf45a12939f25ee9a58dd809b8b7b1c34b
-size 97962399
diff --git a/firefox-19.0-source.tar.bz2 b/firefox-19.0-source.tar.bz2
new file mode 100644
index 0000000..e090cd3
--- /dev/null
+++ b/firefox-19.0-source.tar.bz2
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:05dc0c4dc2a83bd0ee0cc3b67f5e7bac7fc3846e26c2c6ee910d6cc75b79441b
+size 99946627
diff --git a/firefox-712763.patch b/firefox-712763.patch
new file mode 100644
index 0000000..3ae1156
--- /dev/null
+++ b/firefox-712763.patch
@@ -0,0 +1,95 @@
+# HG changeset patch
+# User Tim Taubert <ttaubert@mozilla.com>
+# Date 1358185823 -3600
+# Node ID f7a2af238d06c17d10c49c94ef860434d5b76758
+Bug 712763 - Backout changes from bug 669272 to keep original window order when restoring a session
+
+diff --git a/browser/components/sessionstore/src/SessionStore.jsm b/browser/components/sessionstore/src/SessionStore.jsm
+--- a/browser/components/sessionstore/src/SessionStore.jsm
++++ b/browser/components/sessionstore/src/SessionStore.jsm
+@@ -1757,23 +1757,16 @@ let SessionStoreInternal = {
+ 
+     // We want to re-use the last opened window instead of opening a new one in
+     // the case where it's "empty" and not associated with a window in the session.
+     // We will do more processing via _prepWindowToRestoreInto if we need to use
+     // the lastWindow.
+     let lastWindow = this._getMostRecentBrowserWindow();
+     let canUseLastWindow = lastWindow &&
+                            !lastWindow.__SS_lastSessionWindowID;
+-    let lastSessionFocusedWindow = null;
+-    this.windowToFocus = lastWindow;
+-
+-    // move the last focused window to the start of the array so that we
+-    // minimize window movement (see bug 669272)
+-    lastSessionState.windows.unshift(
+-      lastSessionState.windows.splice(lastSessionState.selectedWindow - 1, 1)[0]);
+ 
+     // Restore into windows or open new ones as needed.
+     for (let i = 0; i < lastSessionState.windows.length; i++) {
+       let winState = lastSessionState.windows[i];
+       let lastSessionWindowID = winState.__lastSessionWindowID;
+       // delete lastSessionWindowID so we don't add that to the window again
+       delete winState.__lastSessionWindowID;
+ 
+@@ -1801,28 +1794,19 @@ let SessionStoreInternal = {
+         // Restore into that window - pretend it's a followup since we'll already
+         // have a focused window.
+         //XXXzpao This is going to merge extData together (taking what was in
+         //        winState over what is in the window already. The hack we have
+         //        in _preWindowToRestoreInto will prevent most (all?) Panorama
+         //        weirdness but we will still merge other extData.
+         //        Bug 588217 should make this go away by merging the group data.
+         this.restoreWindow(windowToUse, { windows: [winState] }, canOverwriteTabs, true);
+-        if (i == 0)
+-          lastSessionFocusedWindow = windowToUse;
+-
+-        // if we overwrote the tabs for our last focused window, we should
+-        // give focus to the window that had it in the previous session
+-        if (canOverwriteTabs && windowToUse == lastWindow)
+-          this.windowToFocus = lastSessionFocusedWindow;
+       }
+       else {
+-        let win = this._openWindowWithState({ windows: [winState] });
+-        if (i == 0)
+-          lastSessionFocusedWindow = win;
++        this._openWindowWithState({ windows: [winState] });
+       }
+     }
+ 
+     // Merge closed windows from this session with ones from last session
+     if (lastSessionState._closedWindows) {
+       this._closedWindows = this._closedWindows.concat(lastSessionState._closedWindows);
+       this._capClosedWindows();
+     }
+@@ -2735,27 +2719,27 @@ let SessionStoreInternal = {
+     this._setWindowStateBusy(aWindow);
+ 
+     if (root._closedWindows)
+       this._closedWindows = root._closedWindows;
+ 
+     var winData;
+     if (!root.selectedWindow || root.selectedWindow > root.windows.length) {
+       root.selectedWindow = 0;
+-    } else {
+-      // put the selected window at the beginning of the array to ensure that
+-      // it gets restored first
+-      root.windows.unshift(root.windows.splice(root.selectedWindow - 1, 1)[0]);
+     }
++
+     // open new windows for all further window entries of a multi-window session
+     // (unless they don't contain any tab data)
+     for (var w = 1; w < root.windows.length; w++) {
+       winData = root.windows[w];
+       if (winData && winData.tabs && winData.tabs[0]) {
+         var window = this._openWindowWithState({ windows: [winData] });
++        if (w == root.selectedWindow - 1) {
++          this.windowToFocus = window;
++        }
+       }
+     }
+     winData = root.windows[0];
+     if (!winData.tabs) {
+       winData.tabs = [];
+     }
+     // don't restore a single blank tab when we've had an external
+     // URL passed in for loading at startup (cf. bug 357419)
diff --git a/firefox-kde.patch b/firefox-kde.patch
index 9788901..c028382 100644
--- a/firefox-kde.patch
+++ b/firefox-kde.patch
@@ -2,7 +2,7 @@ diff --git a/browser/base/content/browser-kde.xul b/browser/base/content/browser
 new file mode 100644
 --- /dev/null
 +++ b/browser/base/content/browser-kde.xul
-@@ -0,0 +1,1274 @@
+@@ -0,0 +1,1276 @@
 +#filter substitution
 +<?xml version="1.0"?>
 +# -*- Mode: HTML -*-
@@ -668,38 +668,40 @@ new file mode 100644
 +                   class="chromeclass-toolbar-additional"
 +                   removable="false"
 +                   title="&socialToolbar.title;"
-+                   hidden="true">
++                   hidden="true"
++                   observes="socialActiveBroadcaster">
 +        <toolbarbutton id="social-provider-button"
 +                       class="toolbarbutton-1"
 +                       type="menu">
 +          <menupopup id="social-statusarea-popup">
-+            <menuitem id="social-statusarea-user" pack="start" align="center" class="menuitem-iconic"
-+                  onclick="SocialUI.showProfile(); document.getElementById('social-statusarea-popup').hidePopup();">
-+              <image id="social-statusarea-user-portrait"/>
++            <menuitem class="social-statusarea-user menuitem-iconic" pack="start" align="center"
++                      observes="socialBroadcaster_userDetails"
++                      oncommand="SocialUI.showProfile(); document.getElementById('social-statusarea-popup').hidePopup();">
++              <image class="social-statusarea-user-portrait"
++                     observes="socialBroadcaster_userDetails"/>
 +              <vbox>
-+                <label id="social-statusarea-notloggedin"
-+                       value="&social.notLoggedIn.label;"/>
-+                <label id="social-statusarea-username"/>
++                <label class="social-statusarea-loggedInStatus"
++                       observes="socialBroadcaster_userDetails"/>
 +              </vbox>
 +            </menuitem>
 +#ifndef XP_WIN
-+            <menuseparator/>
++            <menuseparator class="social-statusarea-separator"/>
 +#endif
-+            <menuitem id="social-toggle-sidebar-menuitem"
++            <menuitem class="social-toggle-sidebar-menuitem"
 +                      type="checkbox"
 +                      autocheck="false"
 +                      command="Social:ToggleSidebar"
 +                      label="&social.toggleSidebar.label;"
 +                      accesskey="&social.toggleSidebar.accesskey;"/>
-+            <menuitem id="social-toggle-notifications-menuitem"
++            <menuitem class="social-toggle-notifications-menuitem"
 +                      type="checkbox"
 +                      autocheck="false"
 +                      command="Social:ToggleNotifications"
 +                      label="&social.toggleNotifications.label;"
 +                      accesskey="&social.toggleNotifications.accesskey;"/>
-+            <menuseparator/>
-+            <menuitem id="social-remove-menuitem"
-+                      oncommand="SocialUI.disableWithConfirmation();"/>
++            <menuseparator class="social-statusarea-separator"/>
++            <menuitem class="social-toggle-menuitem" command="Social:Toggle"/>
++            <menuitem class="social-remove-menuitem" command="Social:Remove"/>
 +          </menupopup>
 +        </toolbarbutton>
 +      </toolbaritem>
@@ -1612,7 +1614,7 @@ new file mode 100644
 +
 +    cmdstr->SetData( NS_LITERAL_CSTRING( "RUN" ));
 +    command->AppendElement( cmdstr, false );
-+    nsCAutoString app;
++    nsAutoCString app;
 +    nsresult rv = aApplication->GetNativePath( app );
 +    NS_ENSURE_SUCCESS( rv, rv );
 +    appstr->SetData( app );
@@ -1651,7 +1653,7 @@ new file mode 100644
 +    if( !resstr )
 +        return NS_ERROR_FAILURE;
 +
-+    nsCAutoString path;
++    nsAutoCString path;
 +    resstr->GetData( path );
 +    if (path.IsEmpty())
 +        return NS_ERROR_FAILURE;
@@ -1847,7 +1849,7 @@ new file mode 100644
 diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in
 --- a/browser/installer/package-manifest.in
 +++ b/browser/installer/package-manifest.in
-@@ -579,18 +579,20 @@
+@@ -578,18 +578,20 @@
  @BINPATH@/@PREF_DIR@/healthreport-prefs.js
  #endif
  @BINPATH@/greprefs.js
diff --git a/firefox-multilocale-chrome.patch b/firefox-multilocale-chrome.patch
index c1f8968..e738488 100644
--- a/firefox-multilocale-chrome.patch
+++ b/firefox-multilocale-chrome.patch
@@ -1,13 +1,13 @@
 # HG changeset patch
 # User Wolfgang Rosenauer <wr@rosenauer.org>
-# Parent ba286b90465d93b93487c0de6f8ebe5d1821d2c0
+# Parent 1352398be333989afdf06a2d87d63df9fed61333
 Add searchplugins to chrome packaging for proper localization
 
 diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js
 --- a/browser/app/profile/firefox.js
 +++ b/browser/app/profile/firefox.js
-@@ -332,16 +332,20 @@ pref("browser.download.useToolkitUI", tr
- pref("browser.download.panel.removeFinishedDownloads", false);
+@@ -338,16 +338,20 @@ pref("browser.download.panel.shown", fal
+ pref("browser.download.panel.firstSessionCompleted", false);
  
  // search engines URL
  pref("browser.search.searchEnginesURL",      "https://addons.mozilla.org/%LOCALE%/firefox/search-engines/");
@@ -30,7 +30,7 @@ diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js
 diff --git a/browser/locales/Makefile.in b/browser/locales/Makefile.in
 --- a/browser/locales/Makefile.in
 +++ b/browser/locales/Makefile.in
-@@ -118,39 +118,48 @@ libs:: $(call MERGE_FILES,$(addprefix pr
+@@ -124,39 +124,48 @@ libs:: $(call MERGE_FILES,$(addprefix pr
  install:: $(DESTDIR)$(mozappdir)/defaults/profile/bookmarks.html ;
  
  install:: $(addprefix generic/profile/,$(PROFILE_FILES))
@@ -81,13 +81,13 @@ diff --git a/browser/locales/Makefile.in b/browser/locales/Makefile.in
  
  libs-%:
  	$(NSINSTALL) -D $(DIST)/install
- 	@$(MAKE) -C ../../toolkit/locales libs-$* BOTH_MANIFESTS=1
- 	@$(MAKE) -C ../../services/sync/locales AB_CD=$* XPI_NAME=locale-$* BOTH_MANIFESTS=1
+ 	@$(MAKE) -C ../../toolkit/locales libs-$*
+ 	@$(MAKE) -C ../../services/sync/locales AB_CD=$* XPI_NAME=locale-$*
 +	@$(MAKE) -B searchplugins AB_CD=$* XPI_NAME=locale-$*
- 	@$(MAKE) -C ../../extensions/spellcheck/locales AB_CD=$* XPI_NAME=locale-$* BOTH_MANIFESTS=1
- 	@$(MAKE) -C ../../intl/locales AB_CD=$* XPI_NAME=locale-$* BOTH_MANIFESTS=1
- 	@$(MAKE) libs AB_CD=$* XPI_NAME=locale-$* PREF_DIR=$(PREF_DIR) BOTH_MANIFESTS=1
- 	@$(MAKE) -C $(DEPTH)/$(MOZ_BRANDING_DIRECTORY)/locales AB_CD=$* XPI_NAME=locale-$* BOTH_MANIFESTS=1
+ 	@$(MAKE) -C ../../extensions/spellcheck/locales AB_CD=$* XPI_NAME=locale-$*
+ 	@$(MAKE) -C ../../intl/locales AB_CD=$* XPI_NAME=locale-$*
+ 	@$(MAKE) libs AB_CD=$* XPI_NAME=locale-$* PREF_DIR=$(PREF_DIR)
+ 	@$(MAKE) -C $(DEPTH)/$(MOZ_BRANDING_DIRECTORY)/locales AB_CD=$* XPI_NAME=locale-$*
  
  repackage-win32-installer: WIN32_INSTALLER_OUT=$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe
  repackage-win32-installer: $(call ESCAPE_WILDCARD,$(WIN32_INSTALLER_IN)) $(SUBMAKEFILES) libs-$(AB_CD)
diff --git a/l10n-18.0.2.tar.bz2 b/l10n-18.0.2.tar.bz2
deleted file mode 100644
index 77dbf25..0000000
--- a/l10n-18.0.2.tar.bz2
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:b79652190a017258d4493c9b91247c98e45fd4c40b85b44899b6bd54b4b7ed96
-size 52427390
diff --git a/l10n-19.0.tar.bz2 b/l10n-19.0.tar.bz2
new file mode 100644
index 0000000..30bbc48
--- /dev/null
+++ b/l10n-19.0.tar.bz2
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:b3a4758d6f980eeb9903974912059a3221fe575ff264291686e7eac781d7e7e4
+size 52867600
diff --git a/mozilla-gstreamer-760140.patch b/mozilla-gstreamer-760140.patch
index 62996f4..1a4216d 100644
--- a/mozilla-gstreamer-760140.patch
+++ b/mozilla-gstreamer-760140.patch
@@ -4,7 +4,7 @@ Bug 760140 - Query the GstRegistry for the required demuxers/decoders from canPl
 diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp
 --- a/content/base/src/nsContentUtils.cpp
 +++ b/content/base/src/nsContentUtils.cpp
-@@ -147,16 +147,19 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_
+@@ -143,16 +143,19 @@
  #include "xpcprivate.h" // nsXPConnect
  #include "nsScriptSecurityManager.h"
  #include "nsIChannelPolicy.h"
@@ -14,7 +14,7 @@ diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUti
  #ifdef MOZ_MEDIA
  #include "nsHTMLMediaElement.h"
 +#ifdef MOZ_GSTREAMER
-+#include "nsGStreamerDecoder.h"
++#include "GStreamerDecoder.h"
 +#endif
  #endif
  #include "nsDOMTouchEvent.h"
@@ -27,7 +27,7 @@ diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUti
 diff --git a/content/html/content/public/nsHTMLMediaElement.h b/content/html/content/public/nsHTMLMediaElement.h
 --- a/content/html/content/public/nsHTMLMediaElement.h
 +++ b/content/html/content/public/nsHTMLMediaElement.h
-@@ -263,17 +263,19 @@ public:
+@@ -259,17 +259,19 @@ public:
    void UpdateMediaSize(nsIntSize size);
  
    // Returns the CanPlayStatus indicating if we can handle this
@@ -48,30 +48,29 @@ diff --git a/content/html/content/public/nsHTMLMediaElement.h b/content/html/con
    // Returns true if we should handle this MIME type when it appears
    // as an <object> or as a toplevel page. If, in practice, our support
    // for the type is more limited than appears in the wild, we should return
-@@ -305,19 +307,16 @@ public:
+@@ -292,18 +294,16 @@ public:
+ #ifdef MOZ_WEBM
    static bool IsWebMType(const nsACString& aType);
    static const char gWebMTypes[2][11];
    static char const *const gWebMCodecs[4];
  #endif
  
  #ifdef MOZ_GSTREAMER
-   static bool IsGStreamerEnabled();
    static bool IsGStreamerSupportedType(const nsACString& aType);
 -  static bool IsH264Type(const nsACString& aType);
 -  static const char gH264Types[3][16];
--  static char const *const gH264Codecs[7];
  #endif
  
  #ifdef MOZ_WIDGET_GONK
-   static bool IsOmxEnabled();
    static bool IsOmxSupportedType(const nsACString& aType);
    static const char gOmxTypes[5][16];
-   static char const *const gH264Codecs[7];
  #endif
+ 
+ #if defined(MOZ_GSTREAMER) || defined(MOZ_WIDGET_GONK)
 diff --git a/content/html/content/src/nsHTMLMediaElement.cpp b/content/html/content/src/nsHTMLMediaElement.cpp
 --- a/content/html/content/src/nsHTMLMediaElement.cpp
 +++ b/content/html/content/src/nsHTMLMediaElement.cpp
-@@ -2128,51 +2128,34 @@ nsHTMLMediaElement::IsWebMType(const nsA
+@@ -2213,50 +2213,29 @@ nsHTMLMediaElement::IsWebMType(const nsA
        return true;
      }
    }
@@ -82,29 +81,25 @@ diff --git a/content/html/content/src/nsHTMLMediaElement.cpp b/content/html/cont
  
 -#if defined(MOZ_GSTREAMER) || defined(MOZ_WIDGET_GONK)
 +#ifdef MOZ_WIDGET_GONK
- char const *const nsHTMLMediaElement::gH264Codecs[7] = {
-   "avc1.42E01E",
-   "avc1.42001E",
-   "avc1.58A01E",
-   "avc1.4D401E",
-   "avc1.64001E",
-   "mp4a.40.2",
+ char const *const nsHTMLMediaElement::gH264Codecs[9] = {
+   "avc1.42E01E",  // H.264 Constrained Baseline Profile Level 3.0
+   "avc1.42001E",  // H.264 Baseline Profile Level 3.0
+   "avc1.58A01E",  // H.264 Extended Profile Level 3.0
+   "avc1.4D401E",  // H.264 Main Profile Level 3.0
+   "avc1.64001E",  // H.264 High Profile Level 3.0
+   "avc1.64001F",  // H.264 High Profile Level 3.1
+   "mp4v.20.3",    // 3GPP
+   "mp4a.40.2",    // AAC-LC
    nullptr
  };
- #endif
- 
- #ifdef MOZ_GSTREAMER
+-#endif
+-
+-#ifdef MOZ_GSTREAMER
 -const char nsHTMLMediaElement::gH264Types[3][16] = {
 -  "video/mp4",
 -  "video/3gpp",
 -  "video/quicktime",
 -};
--
- bool
- nsHTMLMediaElement::IsGStreamerEnabled()
- {
-   return Preferences::GetBool("media.gstreamer.enabled");
- }
 -
 -bool
 -nsHTMLMediaElement::IsH264Type(const nsACString& aType)
@@ -116,22 +111,26 @@ diff --git a/content/html/content/src/nsHTMLMediaElement.cpp b/content/html/cont
 -  }
 -  return false;
 -}
- #endif
- 
- #ifdef MOZ_WIDGET_GONK
+-#endif
+-
+-#ifdef MOZ_WIDGET_GONK
++
  const char nsHTMLMediaElement::gOmxTypes[5][16] = {
    "audio/mpeg",
    "audio/mp4",
    "video/mp4",
    "video/3gpp",
-@@ -2257,18 +2240,22 @@ nsHTMLMediaElement::IsDASHMPDType(const 
+   "video/quicktime",
+ };
+ 
+@@ -2319,18 +2298,22 @@ nsHTMLMediaElement::IsDASHMPDType(const 
  
    return false;
  }
  #endif
  
  /* static */
- nsHTMLMediaElement::CanPlayStatus 
+ nsHTMLMediaElement::CanPlayStatus
  nsHTMLMediaElement::CanHandleMediaType(const char* aMIMEType,
 -                                       char const *const ** aCodecList)
 +                                       const char *aCodecs,
@@ -148,7 +147,7 @@ diff --git a/content/html/content/src/nsHTMLMediaElement.cpp b/content/html/cont
  #endif
  #ifdef MOZ_OGG
    if (IsOggType(nsDependentCString(aMIMEType))) {
-@@ -2292,20 +2279,22 @@ nsHTMLMediaElement::CanHandleMediaType(c
+@@ -2354,20 +2337,22 @@ nsHTMLMediaElement::CanHandleMediaType(c
    if (IsDASHMPDType(nsDependentCString(aMIMEType))) {
      // DASH manifest uses WebM codecs only.
      *aCodecList = gWebMCodecs;
@@ -165,7 +164,7 @@ diff --git a/content/html/content/src/nsHTMLMediaElement.cpp b/content/html/cont
 +    *aCheckCodecList = false;
 +  if (aCodecList)
 +    *aCodecList = nullptr;
-+  if (nsGStreamerDecoder::CanHandleMediaType(aMIMEType, aCodecs))
++  if (GStreamerDecoder::CanHandleMediaType(aMIMEType, aCodecs))
 +    return CANPLAY_YES;
  #endif
  #ifdef MOZ_WIDGET_GONK
@@ -175,7 +174,7 @@ diff --git a/content/html/content/src/nsHTMLMediaElement.cpp b/content/html/cont
    }
  #endif
  #ifdef MOZ_MEDIA_PLUGINS
-@@ -2326,17 +2315,17 @@ bool nsHTMLMediaElement::ShouldHandleMed
+@@ -2388,17 +2373,17 @@ bool nsHTMLMediaElement::ShouldHandleMed
    if (IsOggType(nsDependentCString(aMIMEType)))
      return true;
  #endif
@@ -185,7 +184,7 @@ diff --git a/content/html/content/src/nsHTMLMediaElement.cpp b/content/html/cont
  #endif
  #ifdef MOZ_GSTREAMER
 -  if (IsH264Type(nsDependentCString(aMIMEType)))
-+  if (nsGStreamerDecoder::CanHandleMediaType(aMIMEType, nullptr))
++  if (GStreamerDecoder::CanHandleMediaType(aMIMEType, nullptr))
      return true;
  #endif
  #ifdef MOZ_WIDGET_GONK
@@ -194,7 +193,7 @@ diff --git a/content/html/content/src/nsHTMLMediaElement.cpp b/content/html/cont
    }
  #endif
  #ifdef MOZ_MEDIA_PLUGINS
-@@ -2367,26 +2356,31 @@ nsHTMLMediaElement::GetCanPlay(const nsA
+@@ -2429,26 +2414,31 @@ nsHTMLMediaElement::GetCanPlay(const nsA
  {
    nsContentTypeParser parser(aType);
    nsAutoString mimeType;
@@ -231,20 +230,20 @@ diff --git a/content/html/content/src/nsHTMLMediaElement.cpp b/content/html/cont
    // of the 'codecs' parameter
    nsCharSeparatedTokenizer tokenizer(codecs, ',');
    bool expectMoreTokens = false;
-@@ -2425,46 +2419,41 @@ nsHTMLMediaElement::CanPlayType(const ns
+@@ -2487,43 +2477,39 @@ nsHTMLMediaElement::CanPlayType(const ns
  }
  
  #ifdef MOZ_GSTREAMER
  bool
  nsHTMLMediaElement::IsGStreamerSupportedType(const nsACString& aMimeType)
  {
-   if (!IsGStreamerEnabled())
+   if (!MediaDecoder::IsGStreamerEnabled())
      return false;
 -  if (IsH264Type(aMimeType))
 +
 +  const char *type;
 +  NS_CStringGetData(aMimeType, &type, nullptr);
-+  if (nsGStreamerDecoder::CanHandleMediaType(type, nullptr))
++  if (GStreamerDecoder::CanHandleMediaType(type, nullptr))
      return true;
 -  if (!Preferences::GetBool("media.prefer-gstreamer", false))
 -    return false;
@@ -261,81 +260,115 @@ diff --git a/content/html/content/src/nsHTMLMediaElement.cpp b/content/html/cont
  }
  #endif
  
- already_AddRefed<nsMediaDecoder>
+ already_AddRefed<MediaDecoder>
  nsHTMLMediaElement::CreateDecoder(const nsACString& aType)
  {
+ 
  #ifdef MOZ_GSTREAMER
    // When enabled, use GStreamer for H.264, but not for codecs handled by our
    // bundled decoders, unless the "media.prefer-gstreamer" pref is set.
 -  if (IsGStreamerSupportedType(aType)) {
--    nsRefPtr<nsGStreamerDecoder> decoder = new nsGStreamerDecoder();
+-    nsRefPtr<GStreamerDecoder> decoder = new GStreamerDecoder();
 -    if (decoder->Init(this)) {
 -      return decoder.forget();
 +  if (!Preferences::GetBool("media.prefer-gstreamer", false)) {
 +    if (IsGStreamerSupportedType(aType)) {
-+      nsRefPtr<nsGStreamerDecoder> decoder = new nsGStreamerDecoder();
++      nsRefPtr<GStreamerDecoder> decoder = new GStreamerDecoder();
 +      if (decoder->Init(this)) {
 +        return decoder.forget();
 +      }
      }
    }
  #endif
--
+ 
  #ifdef MOZ_RAW
    if (IsRawType(aType)) {
-     nsRefPtr<nsRawDecoder> decoder = new nsRawDecoder();
+     nsRefPtr<RawDecoder> decoder = new RawDecoder();
      if (decoder->Init(this)) {
-       return decoder.forget();
-     }
-   }
- #endif
-@@ -2503,25 +2492,33 @@ nsHTMLMediaElement::CreateDecoder(const 
- #ifdef MOZ_WEBM
-   if (IsWebMType(aType)) {
-     nsRefPtr<nsWebMDecoder> decoder = new nsWebMDecoder();
-     if (decoder->Init(this)) {
-       return decoder.forget();
-     }
-   }
- #endif
--
- #ifdef MOZ_DASH
+@@ -2576,16 +2562,26 @@ nsHTMLMediaElement::CreateDecoder(const 
    if (IsDASHMPDType(aType)) {
-     nsRefPtr<nsDASHDecoder> decoder = new nsDASHDecoder();
+     nsRefPtr<DASHDecoder> decoder = new DASHDecoder();
      if (decoder->Init(this)) {
        return decoder.forget();
      }
    }
  #endif
+ 
 +#ifdef MOZ_GSTREAMER
 +  // use GStreamer as fallback if not preferred
 +  if (IsGStreamerSupportedType(aType)) {
-+    nsRefPtr<nsGStreamerDecoder> decoder = new nsGStreamerDecoder();
++    nsRefPtr<GStreamerDecoder> decoder = new GStreamerDecoder();
 +    if (decoder->Init(this)) {
 +      return decoder.forget();
 +    }
 +  }
 +#endif
- 
++
    return nullptr;
  }
  
- nsresult nsHTMLMediaElement::InitializeDecoderAsClone(nsMediaDecoder* aOriginal)
+ nsresult nsHTMLMediaElement::InitializeDecoderAsClone(MediaDecoder* aOriginal)
  {
    NS_ASSERTION(mLoadingSrc, "mLoadingSrc must already be set");
    NS_ASSERTION(mDecoder == nullptr, "Shouldn't have a decoder");
+ 
+diff --git a/content/media/gstreamer/GStreamerDecoder.cpp b/content/media/gstreamer/GStreamerDecoder.cpp
+--- a/content/media/gstreamer/GStreamerDecoder.cpp
++++ b/content/media/gstreamer/GStreamerDecoder.cpp
+@@ -2,18 +2,23 @@
+ /* vim:set ts=2 sw=2 sts=2 et cindent: */
+ /* 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/. */
+ 
+ #include "MediaDecoderStateMachine.h"
+ #include "GStreamerReader.h"
+ #include "GStreamerDecoder.h"
++#include "nsGStreamerFormatHelper.h"
+ 
+ namespace mozilla {
+ 
+ MediaDecoderStateMachine* GStreamerDecoder::CreateStateMachine()
+ {
+   return new MediaDecoderStateMachine(this, new GStreamerReader(this));
+ }
+ 
++bool GStreamerDecoder::CanHandleMediaType(const char* aMIMEType,
++                                            const char* aCodecs) {
++  return GStreamerFormatHelper::Instance()->CanHandleMediaType(aMIMEType, aCodecs);
++}
+ } // namespace mozilla
+ 
+diff --git a/content/media/gstreamer/GStreamerDecoder.h b/content/media/gstreamer/GStreamerDecoder.h
+--- a/content/media/gstreamer/GStreamerDecoder.h
++++ b/content/media/gstreamer/GStreamerDecoder.h
+@@ -11,13 +11,14 @@
+ 
+ namespace mozilla {
+ 
+ class GStreamerDecoder : public MediaDecoder
+ {
+ public:
+   virtual MediaDecoder* Clone() { return new GStreamerDecoder(); }
+   virtual MediaDecoderStateMachine* CreateStateMachine();
++  static bool CanHandleMediaType(const char* aMIMEType, const char* aCodecs);
+ };
+ 
+ } // namespace mozilla
+ 
+ #endif
 diff --git a/content/media/gstreamer/Makefile.in b/content/media/gstreamer/Makefile.in
 --- a/content/media/gstreamer/Makefile.in
 +++ b/content/media/gstreamer/Makefile.in
 @@ -17,16 +17,17 @@ LIBXUL_LIBRARY 	= 1
  
  EXPORTS		+= \
- 		nsGStreamerDecoder.h \
+ 		GStreamerDecoder.h \
  		$(NULL)
  
  CPPSRCS		= \
- 		nsGStreamerReader.cpp \
- 		nsGStreamerDecoder.cpp \
+ 		GStreamerReader.cpp \
+ 		GStreamerDecoder.cpp \
 +		nsGStreamerFormatHelper.cpp \
  		$(NULL)
  
@@ -345,45 +378,6 @@ diff --git a/content/media/gstreamer/Makefile.in b/content/media/gstreamer/Makef
  
  CFLAGS		+= $(GSTREAMER_CFLAGS)
  CXXFLAGS	+= $(GSTREAMER_CFLAGS)
-diff --git a/content/media/gstreamer/nsGStreamerDecoder.cpp b/content/media/gstreamer/nsGStreamerDecoder.cpp
---- a/content/media/gstreamer/nsGStreamerDecoder.cpp
-+++ b/content/media/gstreamer/nsGStreamerDecoder.cpp
-@@ -2,13 +2,19 @@
- /* vim:set ts=2 sw=2 sts=2 et cindent: */
- /* 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/. */
- 
- #include "nsBuiltinDecoderStateMachine.h"
- #include "nsGStreamerReader.h"
- #include "nsGStreamerDecoder.h"
-+#include "nsGStreamerFormatHelper.h"
- 
- nsDecoderStateMachine* nsGStreamerDecoder::CreateStateMachine()
- {
-   return new nsBuiltinDecoderStateMachine(this, new nsGStreamerReader(this));
- }
-+
-+bool nsGStreamerDecoder::CanHandleMediaType(const char* aMIMEType,
-+                                            const char* aCodecs) {
-+  return nsGStreamerFormatHelper::Instance()->CanHandleMediaType(aMIMEType, aCodecs);
-+}
-diff --git a/content/media/gstreamer/nsGStreamerDecoder.h b/content/media/gstreamer/nsGStreamerDecoder.h
---- a/content/media/gstreamer/nsGStreamerDecoder.h
-+++ b/content/media/gstreamer/nsGStreamerDecoder.h
-@@ -9,11 +9,12 @@
- 
- #include "nsBuiltinDecoder.h"
- 
- class nsGStreamerDecoder : public nsBuiltinDecoder
- {
- public:
-   virtual nsMediaDecoder* Clone() { return new nsGStreamerDecoder(); }
-   virtual nsDecoderStateMachine* CreateStateMachine();
-+  static bool CanHandleMediaType(const char* aMIMEType, const char* aCodecs);
- };
- 
- #endif
 diff --git a/content/media/gstreamer/nsGStreamerFormatHelper.cpp b/content/media/gstreamer/nsGStreamerFormatHelper.cpp
 new file mode 100644
 --- /dev/null
@@ -402,18 +396,18 @@ new file mode 100644
 +#define ENTRY_FORMAT(entry) entry[0]
 +#define ENTRY_CAPS(entry) entry[1]
 +
-+nsGStreamerFormatHelper* nsGStreamerFormatHelper::gInstance = nullptr;
++GStreamerFormatHelper* GStreamerFormatHelper::gInstance = nullptr;
 +
-+nsGStreamerFormatHelper *nsGStreamerFormatHelper::Instance() {
++GStreamerFormatHelper *GStreamerFormatHelper::Instance() {
 +  if (!gInstance) {
 +    gst_init(nullptr, nullptr);
-+    gInstance = new nsGStreamerFormatHelper();
++    gInstance = new GStreamerFormatHelper();
 +  }
 +
 +  return gInstance;
 +}
 +
-+nsGStreamerFormatHelper::nsGStreamerFormatHelper()
++GStreamerFormatHelper::GStreamerFormatHelper()
 +  : mFactories(nullptr),
 +    mCookie(0)
 +{
@@ -436,12 +430,12 @@ new file mode 100644
 +  memcpy(mCodecs, codecs, sizeof(codecs));
 +}
 +
-+nsGStreamerFormatHelper::~nsGStreamerFormatHelper() {
++GStreamerFormatHelper::~GStreamerFormatHelper() {
 +  if (mFactories)
 +    g_list_free(mFactories);
 +}
 +
-+bool nsGStreamerFormatHelper::CanHandleMediaType(const char* aMIMEType,
++bool GStreamerFormatHelper::CanHandleMediaType(const char* aMIMEType,
 +                                                 const char *aCodecs) {
 +  GstCaps *caps = ConvertFormatsToCaps(aMIMEType, aCodecs);
 +  if (!caps) {
@@ -454,7 +448,7 @@ new file mode 100644
 +  return ret;
 +}
 +
-+GstCaps *nsGStreamerFormatHelper::ConvertFormatsToCaps(const char *aMIMEType,
++GstCaps *GStreamerFormatHelper::ConvertFormatsToCaps(const char *aMIMEType,
 +                                                       const char *aCodecs) {
 +  unsigned int i;
 +
@@ -504,7 +498,7 @@ new file mode 100644
 +  return caps;
 +}
 +
-+bool nsGStreamerFormatHelper::HaveElementsToProcessCaps(GstCaps *aCaps) {
++bool GStreamerFormatHelper::HaveElementsToProcessCaps(GstCaps *aCaps) {
 +
 +  GList *factories = GetFactories();
 +
@@ -526,7 +520,7 @@ new file mode 100644
 +  return true;
 +}
 +
-+GList * nsGStreamerFormatHelper::GetFactories() {
++GList * GStreamerFormatHelper::GetFactories() {
 +  uint32_t cookie = gst_default_registry_get_feature_list_cookie ();
 +  if (cookie != mCookie) {
 +    g_list_free(mFactories);
@@ -555,23 +549,23 @@ new file mode 100644
 +#include <gst/gst.h>
 +#include <mozilla/Types.h>
 +
-+class nsGStreamerFormatHelper {
++class GStreamerFormatHelper {
 +  public:
-+    static nsGStreamerFormatHelper *Instance();
-+    ~nsGStreamerFormatHelper();
++    static GStreamerFormatHelper *Instance();
++    ~GStreamerFormatHelper();
 +
 +    bool CanHandleMediaType(const char *aMIMEType,
 +                            const char *aCodecs);
 +
 +  private:
-+    nsGStreamerFormatHelper();
++    GStreamerFormatHelper();
 +    GstCaps *ConvertFormatsToCaps(const char *aMIMEType,
 +                                  const char *aCodecs);
 +    char * const *CodecListFromCaps(GstCaps *aCaps);
 +    bool HaveElementsToProcessCaps(GstCaps *aCaps);
 +    GList *GetFactories();
 +
-+    static nsGStreamerFormatHelper *gInstance;
++    static GStreamerFormatHelper *gInstance;
 +
 +    const char *mContainers[3][2];
 +    const char *mCodecs[7][2];
diff --git a/mozilla-gstreamer-803287.patch b/mozilla-gstreamer-803287.patch
deleted file mode 100644
index 7b7b0f5..0000000
--- a/mozilla-gstreamer-803287.patch
+++ /dev/null
@@ -1,293 +0,0 @@
-# HG changeset patch
-# Parent 09328afa274e7cf6354f446ae37735218b796e7f
-# User Wolfgang Rosenauer <wr@rosenauer.org>
-Bug 803287 - Don't use GStreamer (when enabled) for Ogg/WebM if builtin backends present. (TM: 19)
-
-diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp
---- a/content/base/src/nsContentUtils.cpp
-+++ b/content/base/src/nsContentUtils.cpp
-@@ -6676,71 +6676,55 @@ nsContentUtils::FindInternalContentViewe
-       else
-       *aLoaderType = TYPE_UNKNOWN;
-     }
-     return docFactory.forget();
-   }
- 
- #ifdef MOZ_MEDIA
- #ifdef MOZ_OGG
--  if (nsHTMLMediaElement::IsOggEnabled()) {
--    for (unsigned int i = 0; i < ArrayLength(nsHTMLMediaElement::gOggTypes); ++i) {
--      const char* type = nsHTMLMediaElement::gOggTypes[i];
--      if (!strcmp(aType, type)) {
--        docFactory = do_GetService("@mozilla.org/content/document-loader-factory;1");
--        if (docFactory && aLoaderType) {
--          *aLoaderType = TYPE_CONTENT;
--        }
--        return docFactory.forget();
--      }
-+  if (nsHTMLMediaElement::IsOggType(nsDependentCString(aType))) {
-+    docFactory = do_GetService("@mozilla.org/content/document-loader-factory;1");
-+    if (docFactory && aLoaderType) {
-+      *aLoaderType = TYPE_CONTENT;
-     }
-+    return docFactory.forget();
-   }
- #endif
- 
- #ifdef MOZ_WEBM
--  if (nsHTMLMediaElement::IsWebMEnabled()) {
--    for (unsigned int i = 0; i < ArrayLength(nsHTMLMediaElement::gWebMTypes); ++i) {
--      const char* type = nsHTMLMediaElement::gWebMTypes[i];
--      if (!strcmp(aType, type)) {
--        docFactory = do_GetService("@mozilla.org/content/document-loader-factory;1");
--        if (docFactory && aLoaderType) {
--          *aLoaderType = TYPE_CONTENT;
--        }
--        return docFactory.forget();
--      }
-+  if (nsHTMLMediaElement::IsWebMType(nsDependentCString(aType))) {
-+    docFactory = do_GetService("@mozilla.org/content/document-loader-factory;1");
-+    if (docFactory && aLoaderType) {
-+      *aLoaderType = TYPE_CONTENT;
-     }
-+    return docFactory.forget();
-   }
- #endif
- 
- #ifdef MOZ_GSTREAMER
--  if (nsHTMLMediaElement::IsH264Enabled()) {
--    for (unsigned int i = 0; i < ArrayLength(nsHTMLMediaElement::gH264Types); ++i) {
--      const char* type = nsHTMLMediaElement::gH264Types[i];
--      if (!strcmp(aType, type)) {
--        docFactory = do_GetService("@mozilla.org/content/document-loader-factory;1");
--        if (docFactory && aLoaderType) {
--          *aLoaderType = TYPE_CONTENT;
--        }
--        return docFactory.forget();
--      }
-+  if (nsHTMLMediaElement::IsGStreamerSupportedType(nsDependentCString(aType))) {
-+    docFactory = do_GetService("@mozilla.org/content/document-loader-factory;1");
-+    if (docFactory && aLoaderType) {
-+      *aLoaderType = TYPE_CONTENT;
-     }
-+    return docFactory.forget();
-   }
- #endif
- 
- #ifdef MOZ_MEDIA_PLUGINS
-   if (nsHTMLMediaElement::IsMediaPluginsEnabled() &&
-       nsHTMLMediaElement::IsMediaPluginsType(nsDependentCString(aType))) {
-     docFactory = do_GetService("@mozilla.org/content/document-loader-factory;1");
-     if (docFactory && aLoaderType) {
-       *aLoaderType = TYPE_CONTENT;
-     }
-     return docFactory.forget();
-   }
- #endif // MOZ_MEDIA_PLUGINS
--
- #endif // MOZ_MEDIA
- 
-   return NULL;
- }
- 
- // static
- bool
- nsContentUtils::IsPatternMatching(nsAString& aValue, nsAString& aPattern,
-diff --git a/content/html/content/public/nsHTMLMediaElement.h b/content/html/content/public/nsHTMLMediaElement.h
---- a/content/html/content/public/nsHTMLMediaElement.h
-+++ b/content/html/content/public/nsHTMLMediaElement.h
-@@ -303,17 +303,18 @@ public:
- #ifdef MOZ_WEBM
-   static bool IsWebMEnabled();
-   static bool IsWebMType(const nsACString& aType);
-   static const char gWebMTypes[2][11];
-   static char const *const gWebMCodecs[4];
- #endif
- 
- #ifdef MOZ_GSTREAMER
--  static bool IsH264Enabled();
-+  static bool IsGStreamerEnabled();
-+  static bool IsGStreamerSupportedType(const nsACString& aType);
-   static bool IsH264Type(const nsACString& aType);
-   static const char gH264Types[3][16];
-   static char const *const gH264Codecs[7];
- #endif
- 
- #ifdef MOZ_WIDGET_GONK
-   static bool IsOmxEnabled();
-   static bool IsOmxSupportedType(const nsACString& aType);
-diff --git a/content/html/content/src/nsHTMLMediaElement.cpp b/content/html/content/src/nsHTMLMediaElement.cpp
---- a/content/html/content/src/nsHTMLMediaElement.cpp
-+++ b/content/html/content/src/nsHTMLMediaElement.cpp
-@@ -2148,34 +2148,29 @@ char const *const nsHTMLMediaElement::gH
- #ifdef MOZ_GSTREAMER
- const char nsHTMLMediaElement::gH264Types[3][16] = {
-   "video/mp4",
-   "video/3gpp",
-   "video/quicktime",
- };
- 
- bool
--nsHTMLMediaElement::IsH264Enabled()
-+nsHTMLMediaElement::IsGStreamerEnabled()
- {
--  return Preferences::GetBool("media.h264.enabled");
-+  return Preferences::GetBool("media.gstreamer.enabled");
- }
- 
- bool
- nsHTMLMediaElement::IsH264Type(const nsACString& aType)
- {
--  if (!IsH264Enabled()) {
--    return false;
--  }
--
-   for (uint32_t i = 0; i < ArrayLength(gH264Types); ++i) {
-     if (aType.EqualsASCII(gH264Types[i])) {
-       return true;
-     }
-   }
--
-   return false;
- }
- #endif
- 
- #ifdef MOZ_WIDGET_GONK
- const char nsHTMLMediaElement::gOmxTypes[5][16] = {
-   "audio/mpeg",
-   "audio/mp4",
-@@ -2424,34 +2419,63 @@ nsHTMLMediaElement::CanPlayType(const ns
-   default:
-   case CANPLAY_MAYBE:
-     aResult.AssignLiteral("maybe");
-     break;
-   }
-   return NS_OK;
- }
- 
-+#ifdef MOZ_GSTREAMER
-+bool
-+nsHTMLMediaElement::IsGStreamerSupportedType(const nsACString& aMimeType)
-+{
-+  if (!IsGStreamerEnabled())
-+    return false;
-+  if (IsH264Type(aMimeType))
-+    return true;
-+  if (!Preferences::GetBool("media.prefer-gstreamer", false))
-+    return false;
-+#ifdef MOZ_WEBM
-+  if (IsWebMType(aMimeType))
-+    return true;
-+#endif
-+#ifdef MOZ_OGG
-+  if (IsOggType(aMimeType))
-+    return true;
-+#endif
-+  return false;
-+}
-+#endif
-+
- already_AddRefed<nsMediaDecoder>
- nsHTMLMediaElement::CreateDecoder(const nsACString& aType)
- {
-+#ifdef MOZ_GSTREAMER
-+  // When enabled, use GStreamer for H.264, but not for codecs handled by our
-+  // bundled decoders, unless the "media.prefer-gstreamer" pref is set.
-+  if (IsGStreamerSupportedType(aType)) {
-+    nsRefPtr<nsGStreamerDecoder> decoder = new nsGStreamerDecoder();
-+    if (decoder->Init(this)) {
-+      return decoder.forget();
-+    }
-+  }
-+#endif
-+
- #ifdef MOZ_RAW
-   if (IsRawType(aType)) {
-     nsRefPtr<nsRawDecoder> decoder = new nsRawDecoder();
-     if (decoder->Init(this)) {
-       return decoder.forget();
-     }
-   }
- #endif
- #ifdef MOZ_OGG
-   if (IsOggType(aType)) {
--#ifdef MOZ_GSTREAMER 
--    nsRefPtr<nsGStreamerDecoder> decoder = new nsGStreamerDecoder();
--#else
-     nsRefPtr<nsOggDecoder> decoder = new nsOggDecoder();
--#endif
-     if (decoder->Init(this)) {
-       return decoder.forget();
-     }
-   }
- #endif
- #ifdef MOZ_WAVE
-   if (IsWaveType(aType)) {
-     nsRefPtr<nsWaveDecoder> decoder = new nsWaveDecoder();
-@@ -2473,44 +2497,32 @@ nsHTMLMediaElement::CreateDecoder(const 
-     nsRefPtr<nsMediaPluginDecoder> decoder = new nsMediaPluginDecoder(aType);
-     if (decoder->Init(this)) {
-       return decoder.forget();
-     }
-   }
- #endif
- #ifdef MOZ_WEBM
-   if (IsWebMType(aType)) {
--#ifdef MOZ_GSTREAMER 
--    nsRefPtr<nsGStreamerDecoder> decoder = new nsGStreamerDecoder();
--#else
-     nsRefPtr<nsWebMDecoder> decoder = new nsWebMDecoder();
--#endif
-     if (decoder->Init(this)) {
-       return decoder.forget();
-     }
-   }
- #endif
- 
- #ifdef MOZ_DASH
-   if (IsDASHMPDType(aType)) {
-     nsRefPtr<nsDASHDecoder> decoder = new nsDASHDecoder();
-     if (decoder->Init(this)) {
-       return decoder.forget();
-     }
-   }
- #endif
- 
--#ifdef MOZ_GSTREAMER 
--  if (IsH264Type(aType)) {
--    nsRefPtr<nsGStreamerDecoder> decoder = new nsGStreamerDecoder();
--    if (decoder->Init(this)) {
--      return decoder.forget();
--    }
--  }
--#endif
-   return nullptr;
- }
- 
- nsresult nsHTMLMediaElement::InitializeDecoderAsClone(nsMediaDecoder* aOriginal)
- {
-   NS_ASSERTION(mLoadingSrc, "mLoadingSrc must already be set");
-   NS_ASSERTION(mDecoder == nullptr, "Shouldn't have a decoder");
- 
-diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js
---- a/modules/libpref/src/init/all.js
-+++ b/modules/libpref/src/init/all.js
-@@ -164,17 +164,17 @@ pref("media.wave.enabled", true);
- #endif
- #ifdef MOZ_WEBM
- pref("media.webm.enabled", true);
- #endif
- #ifdef MOZ_DASH
- pref("media.dash.enabled", true);
- #endif
- #ifdef MOZ_GSTREAMER
--pref("media.h264.enabled", true);
-+pref("media.gstreamer.enabled", true);
- #endif
- #ifdef MOZ_WEBRTC
- pref("media.navigator.enabled", false);
- pref("media.peerconnection.enabled", false);
- pref("media.navigator.permission.disabled", false);
- #else
- #ifdef ANDROID
- pref("media.navigator.enabled", true);
diff --git a/mozilla-kde.patch b/mozilla-kde.patch
index fb4df31..a61f6f0 100644
--- a/mozilla-kde.patch
+++ b/mozilla-kde.patch
@@ -143,7 +143,7 @@ diff --git a/modules/libpref/src/Preferences.cpp b/modules/libpref/src/Preferenc
 diff --git a/toolkit/components/downloads/Makefile.in b/toolkit/components/downloads/Makefile.in
 --- a/toolkit/components/downloads/Makefile.in
 +++ b/toolkit/components/downloads/Makefile.in
-@@ -41,9 +41,12 @@ EXTRA_COMPONENTS = \
+@@ -42,9 +42,12 @@ EXTRA_COMPONENTS = \
    nsDownloadManagerUI.manifest \
    $(NULL)
  endif
@@ -159,7 +159,7 @@ diff --git a/toolkit/components/downloads/Makefile.in b/toolkit/components/downl
 diff --git a/toolkit/components/downloads/nsDownloadManager.cpp b/toolkit/components/downloads/nsDownloadManager.cpp
 --- a/toolkit/components/downloads/nsDownloadManager.cpp
 +++ b/toolkit/components/downloads/nsDownloadManager.cpp
-@@ -36,16 +36,20 @@
+@@ -41,16 +41,20 @@
  
  #ifdef XP_WIN
  #include <shlobj.h>
@@ -180,7 +180,7 @@ diff --git a/toolkit/components/downloads/nsDownloadManager.cpp b/toolkit/compon
  #include "AndroidBridge.h"
  #endif
  
-@@ -2253,16 +2257,25 @@ nsDownload::SetState(DownloadState aStat
+@@ -2740,16 +2744,25 @@ nsDownload::SetState(DownloadState aStat
        nsCOMPtr<nsIPrefBranch> pref(do_GetService(NS_PREFSERVICE_CONTRACTID));
  
        // Master pref to control this function.
@@ -206,7 +206,7 @@ diff --git a/toolkit/components/downloads/nsDownloadManager.cpp b/toolkit/compon
          int64_t goat = PR_Now() - mStartTime;
          showTaskbarAlert = goat > alertIntervalUSec;
  
-@@ -2286,19 +2299,20 @@ nsDownload::SetState(DownloadState aStat
+@@ -2775,19 +2788,20 @@ nsDownload::SetState(DownloadState aStat
                // If downloads are automatically removed per the user's
                // retention policy, there's no reason to make the text clickable
                // because if it is, they'll click open the download manager and
@@ -231,7 +231,7 @@ diff --git a/toolkit/components/downloads/nsDownloadManager.cpp b/toolkit/compon
 diff --git a/toolkit/content/jar.mn b/toolkit/content/jar.mn
 --- a/toolkit/content/jar.mn
 +++ b/toolkit/content/jar.mn
-@@ -46,29 +46,33 @@ toolkit.jar:
+@@ -49,29 +49,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)
@@ -2187,7 +2187,7 @@ diff --git a/toolkit/xre/nsKDEUtils.cpp b/toolkit/xre/nsKDEUtils.cpp
 new file mode 100644
 --- /dev/null
 +++ b/toolkit/xre/nsKDEUtils.cpp
-@@ -0,0 +1,341 @@
+@@ -0,0 +1,339 @@
 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 +/* 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
@@ -2353,8 +2353,6 @@ new file mode 100644
 +
 +bool nsKDEUtils::command( nsIArray* command, nsIArray** output)
 +    {
-+    NS_ENSURE_ARG( command );
-+
 +    nsTArray<nsCString> in;
 +    PRUint32 length;
 +    command->GetLength( &length );
@@ -3052,7 +3050,7 @@ diff --git a/widget/gtk2/Makefile.in b/widget/gtk2/Makefile.in
 diff --git a/widget/gtk2/nsFilePicker.cpp b/widget/gtk2/nsFilePicker.cpp
 --- a/widget/gtk2/nsFilePicker.cpp
 +++ b/widget/gtk2/nsFilePicker.cpp
-@@ -1,16 +1,17 @@
+@@ -1,31 +1,33 @@
  /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  /* 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
@@ -3070,14 +3068,12 @@ diff --git a/widget/gtk2/nsFilePicker.cpp b/widget/gtk2/nsFilePicker.cpp
  #include "nsIStringBundle.h"
  
  #include "nsArrayEnumerator.h"
-@@ -19,16 +20,17 @@
+ #include "nsMemory.h"
+ #include "nsEnumeratorUtils.h"
  #include "nsNetUtil.h"
  #include "nsReadableUtils.h"
  #include "mozcontainer.h"
  
- #include "prmem.h"
- #include "prlink.h"
- 
  #include "nsFilePicker.h"
 +#include "nsKDEUtils.h"
  
@@ -3088,7 +3084,7 @@ diff --git a/widget/gtk2/nsFilePicker.cpp b/widget/gtk2/nsFilePicker.cpp
  using namespace mozilla;
  
  #define MAX_PREVIEW_SIZE 180
-@@ -264,17 +266,19 @@ nsFilePicker::AppendFilters(int32_t aFil
+@@ -236,17 +238,19 @@ nsFilePicker::AppendFilters(int32_t aFil
    return nsBaseFilePicker::AppendFilters(aFilterMask);
  }
  
@@ -3109,7 +3105,7 @@ diff --git a/widget/gtk2/nsFilePicker.cpp b/widget/gtk2/nsFilePicker.cpp
  
    mFilters.AppendElement(filter);
    mFilterNames.AppendElement(name);
-@@ -388,16 +392,32 @@ nsFilePicker::Show(int16_t *aReturn)
+@@ -360,16 +364,32 @@ nsFilePicker::Show(int16_t *aReturn)
  
  NS_IMETHODIMP
  nsFilePicker::Open(nsIFilePickerShownCallback *aCallback)
@@ -3137,12 +3133,12 @@ diff --git a/widget/gtk2/nsFilePicker.cpp b/widget/gtk2/nsFilePicker.cpp
    nsXPIDLCString title;
    title.Adopt(ToNewUTF8String(mTitle));
  
-   GtkWindow *parent_widget = get_gtk_window_for_nsiwidget(mParentWidget);
+   GtkWindow *parent_widget =
+     GTK_WINDOW(mParentWidget->GetNativeData(NS_NATIVE_SHELLWIDGET));
  
    GtkFileChooserAction action = GetGtkFileChooserAction(mMode);
    const gchar *accept_button = (action == GTK_FILE_CHOOSER_ACTION_SAVE)
-                                ? GTK_STOCK_SAVE : GTK_STOCK_OPEN;
-@@ -588,8 +608,235 @@ nsFilePicker::Done(GtkWidget* file_choos
+@@ -561,8 +581,235 @@ nsFilePicker::Done(GtkWidget* file_choos
    if (mCallback) {
      mCallback->Done(result);
      mCallback = nullptr;
@@ -3170,7 +3166,7 @@ diff --git a/widget/gtk2/nsFilePicker.cpp b/widget/gtk2/nsFilePicker.cpp
 +
 +static PRInt32 windowToXid( nsIWidget* widget )
 +    {
-+    GtkWindow *parent_widget = get_gtk_window_for_nsiwidget( widget );
++    GtkWindow *parent_widget = GTK_WINDOW(widget->GetNativeData(NS_NATIVE_SHELLWIDGET));
 +    GdkWindow* gdk_window = gtk_widget_get_window( gtk_widget_get_toplevel( GTK_WIDGET( parent_widget )));
 +    return GDK_WINDOW_XID( gdk_window );
 +    }
@@ -3278,7 +3274,7 @@ diff --git a/widget/gtk2/nsFilePicker.cpp b/widget/gtk2/nsFilePicker.cpp
 +        }
 +
 +    nsTArray<nsCString> output;
-+    if( nsKDEUtils::commandBlockUi( command, get_gtk_window_for_nsiwidget( mParentWidget ), &output ))
++    if( nsKDEUtils::commandBlockUi( command, GTK_WINDOW(mParentWidget->GetNativeData(NS_NATIVE_SHELLWIDGET)), &output ))
 +        {
 +        *aReturn = nsIFilePicker::returnOK;
 +        mFiles.Clear();
@@ -3366,7 +3362,7 @@ diff --git a/widget/gtk2/nsFilePicker.cpp b/widget/gtk2/nsFilePicker.cpp
 +        }
 +
 +    nsTArray<nsCString> output;
-+    if( nsKDEUtils::commandBlockUi( command, get_gtk_window_for_nsiwidget( mParentWidget ), &output ))
++    if( nsKDEUtils::commandBlockUi( command, GTK_WINDOW(mParentWidget->GetNativeData(NS_NATIVE_SHELLWIDGET)), &output ))
 +        {
 +        *aReturn = nsIFilePicker::returnOK;
 +        mFileURL = output.Length() > 0 ? output[ 0 ] : nsCString();
diff --git a/mozilla-webrtc.patch b/mozilla-webrtc.patch
deleted file mode 100644
index 9436629..0000000
--- a/mozilla-webrtc.patch
+++ /dev/null
@@ -1,103 +0,0 @@
-# HG changeset patch
-# Parent 0b3f9d97af70d01863519daf4f57f8918b4bc17c
-# User Wolfgang Rosenauer <wr@rosenauer.org>
-Bug 805549 - signaling_sipcc fails to compile because of unused variable
-
-diff --git a/media/webrtc/signaling/signaling.gyp b/media/webrtc/signaling/signaling.gyp
---- a/media/webrtc/signaling/signaling.gyp
-+++ b/media/webrtc/signaling/signaling.gyp
-@@ -189,17 +189,16 @@
-             'SIP_OS_LINUX',
-             '_GNU_SOURCE',
-             'LINUX', 
-             'GIPS_VER=3510', 
-             'SECLIB_OPENSSL',
-           ],
-           
-           'cflags_mozilla': [
--            '-Werror',
-           ],
-         }],
-         ['OS=="win"', {
-           'include_dirs': [
-           ],		
-           'defines': [
-             'SIP_OS_WINDOWS',
-             'WIN32', 
-@@ -217,18 +216,16 @@
-           ],
-           'defines': [
-             'SIP_OS_OSX',
-             'OSX', 
-             '_FORTIFY_SOURCE=2',
-           ],
-           
-           'cflags_mozilla': [
--            '-Werror',
--            '-Wno-error=conversion'
-           ],
-         }],
-       ],
-     },
-   
-     #
-     # SIPCC
-     #
-@@ -641,17 +638,16 @@
-             'USE_TIMER_SELECT_BASED',
-             'FULL_BUILD',
-             'STUBBED_OUT',
-             'USE_PRINTF'
-             'LINUX',
-           ],
- 
-           'cflags_mozilla': [
--            '-Werror',
-           ],
-         }],
-         ['OS=="win"', {
-           'include_dirs': [
-           ],
-           
-           'sources': [
-             # SIPSTACK
-@@ -760,18 +756,16 @@
-             'FULL_BUILD',
-             'STUBBED_OUT',
-             'USE_PRINTF',
-             '_DARWIN_C_SOURCE',
-             'NO_NSPR_10_SUPPORT',
-           ],
-           
-           'cflags_mozilla': [
--            '-Werror',
--            '-Wno-error=conversion'
-           ],
-         }],
-       ],
-             
-     },
-   ],
- }
- 
-diff --git a/media/webrtc/signaling/src/sipcc/core/common/config_parser.c b/media/webrtc/signaling/src/sipcc/core/common/config_parser.c
---- a/media/webrtc/signaling/src/sipcc/core/common/config_parser.c
-+++ b/media/webrtc/signaling/src/sipcc/core/common/config_parser.c
-@@ -402,17 +402,16 @@ void config_set_ccm_ip_mac ()
- /*
-  * config_setup_element
-  * Setup elements that once were downloaded from CUCM in an XML file.
-  * Settings are stored in config.h
-  */
- void config_setup_elements (const char *sipUser, const char *sipPassword, const char *sipDomain)
- {
-     unsigned int i;
--    char buf[MAX_SIP_URL_LENGTH] = {'\0'};
-     char ip[MAX_SIP_URL_LENGTH] = {'\0'};
-     char option[MAX_SIP_URL_LENGTH] = {'\0'};
-     int line = 0;
-     cc_boolean isSecure = FALSE, isValid = TRUE;
-     char macaddr[MAC_ADDR_SIZE];
- 
-     compare_or_set_int_value(CFGID_MEDIA_PORT_RANGE_START, gStartMediaPort, (const unsigned char *) "startMediaPort");
-     compare_or_set_int_value(CFGID_MEDIA_PORT_RANGE_END, gStopMediaPort, (const unsigned char *) "stopMediaPort");
diff --git a/source-stamp.txt b/source-stamp.txt
index f18a9b5..bbf76f8 100644
--- a/source-stamp.txt
+++ b/source-stamp.txt
@@ -1,2 +1,2 @@
-REV=c4fe2b219941
+REV=20238b786063
 REPO=http://hg.mozilla.org/releases/mozilla-release