Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 Feb 2018 21:53:38 +0000 (UTC)
From:      Jan Beich <jbeich@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r460756 - in head/www/waterfox: . files
Message-ID:  <201802022153.w12LrcLN029753@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jbeich
Date: Fri Feb  2 21:53:38 2018
New Revision: 460756
URL: https://svnweb.freebsd.org/changeset/ports/460756

Log:
  www/waterfox: update to 56.0.4 (nop)
  
  - Apply some FF59 fixes
  
  Changes:	https://github.com/MrAlex94/Waterfox/compare/d7f689c984bf...56.0.4

Added:
  head/www/waterfox/files/patch-bug1428612   (contents, props changed)
  head/www/waterfox/files/patch-bug1429093   (contents, props changed)
  head/www/waterfox/files/patch-bug1429373   (contents, props changed)
  head/www/waterfox/files/patch-bug1431781   (contents, props changed)
  head/www/waterfox/files/patch-bug1433005   (contents, props changed)
Deleted:
  head/www/waterfox/files/patch-bug1425156
  head/www/waterfox/files/patch-waterfox416
Modified:
  head/www/waterfox/Makefile   (contents, props changed)
  head/www/waterfox/distinfo   (contents, props changed)

Modified: head/www/waterfox/Makefile
==============================================================================
--- head/www/waterfox/Makefile	Fri Feb  2 21:34:03 2018	(r460755)
+++ head/www/waterfox/Makefile	Fri Feb  2 21:53:38 2018	(r460756)
@@ -1,9 +1,7 @@
 # $FreeBSD$
 
 PORTNAME=	waterfox
-DISTVERSION=	56.0.3-65
-DISTVERSIONSUFFIX=	-gd7f689c984bf
-PORTREVISION=	1
+DISTVERSION=	56.0.4
 CATEGORIES=	www ipv6
 
 MAINTAINER=	jbeich@FreeBSD.org

Modified: head/www/waterfox/distinfo
==============================================================================
--- head/www/waterfox/distinfo	Fri Feb  2 21:34:03 2018	(r460755)
+++ head/www/waterfox/distinfo	Fri Feb  2 21:53:38 2018	(r460756)
@@ -1,3 +1,3 @@
-TIMESTAMP = 1517402710
-SHA256 (MrAlex94-Waterfox-56.0.3-65-gd7f689c984bf_GH0.tar.gz) = 2a15c44982991bc06890a4a14ffef7761bc698720b71e26f6a602ebd5feb020e
-SIZE (MrAlex94-Waterfox-56.0.3-65-gd7f689c984bf_GH0.tar.gz) = 394225706
+TIMESTAMP = 1517598190
+SHA256 (MrAlex94-Waterfox-56.0.4_GH0.tar.gz) = 291a7aa8e541802d1705cf68c694e300f9cb14fffc6c1d24e51b9ed486cd44b7
+SIZE (MrAlex94-Waterfox-56.0.4_GH0.tar.gz) = 394233214

Added: head/www/waterfox/files/patch-bug1428612
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/www/waterfox/files/patch-bug1428612	Fri Feb  2 21:53:38 2018	(r460756)
@@ -0,0 +1,69 @@
+commit 2bfc5ca48a44
+Author: Eric Rahm <erahm@mozilla.com>
+Date:   Wed Jan 17 16:38:18 2018 -0800
+
+    Bug 1428612 - Part 1: Use nsLiteralCString to wrap histogram names. r=gfritzsche a=lizzard
+    
+    This switches from `nsDependentCString` to `nsLiteralCString` when adding
+    histograms to the table. It will help save some memory and should avoid the OOM
+    smalls we have been seeing.
+    
+    --HG--
+    extra : source : 13493806c0472ebd52ab4140312747c5fbd42fbc
+---
+ toolkit/components/telemetry/TelemetryHistogram.cpp | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git toolkit/components/telemetry/TelemetryHistogram.cpp toolkit/components/telemetry/TelemetryHistogram.cpp
+index a90e5d24aab8..eb28684fe4d1 100644
+--- toolkit/components/telemetry/TelemetryHistogram.cpp
++++ toolkit/components/telemetry/TelemetryHistogram.cpp
+@@ -1740,9 +1740,14 @@ void TelemetryHistogram::InitializeGlobalState(bool canRecordBase,
+   // declaration point further up in this file.
+ 
+   // Populate the static histogram name->id cache.
+-  // Note that the histogram names are statically allocated.
++  // Note that the histogram names come from a static table so we can wrap them
++  // in a literal string to avoid allocations when it gets copied.
+   for (uint32_t i = 0; i < HistogramCount; i++) {
+-    gNameToHistogramIDMap.Put(nsDependentCString(gHistogramInfos[i].name()), HistogramID(i));
++    auto name = gHistogramInfos[i].name();
++
++    nsCString wrappedName;
++    wrappedName.AssignLiteral(name, strlen(name));
++    gNameToHistogramIDMap.Put(wrappedName, HistogramID(i));
+   }
+ 
+ #ifdef DEBUG
+
+commit e31ac19b6163
+Author: Eric Rahm <erahm@mozilla.com>
+Date:   Wed Jan 17 16:52:37 2018 -0800
+
+    Bug 1428612 - Part 2: Add an assertion to check the histogram name pointer. r=gfritzsche a=lizzard
+    
+    This adds a dignostic assertion that the name pointer is actually within the
+    static name table.
+    
+    --HG--
+    extra : source : 6931047d462f46b1f601cb5927e4185857400a63
+---
+ toolkit/components/telemetry/TelemetryHistogram.cpp | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git toolkit/components/telemetry/TelemetryHistogram.cpp toolkit/components/telemetry/TelemetryHistogram.cpp
+index eb28684fe4d1..926536e401b4 100644
+--- toolkit/components/telemetry/TelemetryHistogram.cpp
++++ toolkit/components/telemetry/TelemetryHistogram.cpp
+@@ -1745,6 +1745,11 @@ void TelemetryHistogram::InitializeGlobalState(bool canRecordBase,
+   for (uint32_t i = 0; i < HistogramCount; i++) {
+     auto name = gHistogramInfos[i].name();
+ 
++    // Make sure the name pointer is in a valid region. See bug 1428612.
++    MOZ_DIAGNOSTIC_ASSERT(name >= gHistogramStringTable);
++    MOZ_DIAGNOSTIC_ASSERT(
++        uintptr_t(name) < (uintptr_t(gHistogramStringTable) + sizeof(gHistogramStringTable)));
++
+     nsCString wrappedName;
+     wrappedName.AssignLiteral(name, strlen(name));
+     gNameToHistogramIDMap.Put(wrappedName, HistogramID(i));

Added: head/www/waterfox/files/patch-bug1429093
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/www/waterfox/files/patch-bug1429093	Fri Feb  2 21:53:38 2018	(r460756)
@@ -0,0 +1,135 @@
+commit 0476b46775d8
+Author: Tom Tung <shes050117@gmail.com>
+Date:   Wed Jan 10 18:05:07 2018 +0800
+
+    Bug 1429093 - Part 1: Only allow notification click to call allowWindowInteraction. r=bkelly, a=lizzard
+    
+    --HG--
+    extra : source : 20b048f7a32fc9d76827c2f06be1d50afb8bbd00
+---
+ dom/workers/ServiceWorkerPrivate.cpp | 14 +++++++++-----
+ 1 file changed, 9 insertions(+), 5 deletions(-)
+
+diff --git dom/workers/ServiceWorkerPrivate.cpp dom/workers/ServiceWorkerPrivate.cpp
+index 8b7cabf2a345..53b8cf30fa5c 100644
+--- dom/workers/ServiceWorkerPrivate.cpp
++++ dom/workers/ServiceWorkerPrivate.cpp
+@@ -1253,18 +1253,22 @@ public:
+     }
+ 
+     event->SetTrusted(true);
+-    aWorkerPrivate->GlobalScope()->AllowWindowInteraction();
+-    RefPtr<AllowWindowInteractionHandler> allowWindowInteraction =
+-      new AllowWindowInteractionHandler(aWorkerPrivate);
++
++    RefPtr<AllowWindowInteractionHandler> allowWindowInteraction;
++    if (mEventName.EqualsLiteral(NOTIFICATION_CLICK_EVENT_NAME)) {
++      allowWindowInteraction =
++        new AllowWindowInteractionHandler(aWorkerPrivate);
++    }
++
+     nsresult rv = DispatchExtendableEventOnWorkerScope(aCx,
+                                                        aWorkerPrivate->GlobalScope(),
+                                                        event,
+                                                        allowWindowInteraction);
+     // Don't reject when catching an exception
+-    if (NS_FAILED(rv) && rv != NS_ERROR_XPC_JS_THREW_EXCEPTION) {
++    if (NS_FAILED(rv) && rv != NS_ERROR_XPC_JS_THREW_EXCEPTION &&
++        allowWindowInteraction) {
+       allowWindowInteraction->FinishedWithResult(Rejected);
+     }
+-    aWorkerPrivate->GlobalScope()->ConsumeWindowInteraction();
+ 
+     return true;
+   }
+commit 13c168bfd520
+Author: Tom Tung <shes050117@gmail.com>
+Date:   Wed Jan 17 11:31:31 2018 +0800
+
+    Bug 1429093 - Part 2: A test to verify the close event is not allowed to window interaction. r=bkelly, a=lizzard
+    
+    --HG--
+    extra : source : abd11ceb68ca7f0b04a4e4b3dc49090c523ad067
+---
+ .../test/serviceworkers/notificationclose.html     |  2 +-
+ .../test/serviceworkers/notificationclose.js       | 31 ++++++++++++++--------
+ .../serviceworkers/test_notificationclose.html     |  6 +++--
+ 3 files changed, 25 insertions(+), 14 deletions(-)
+
+diff --git dom/workers/test/serviceworkers/notificationclose.html dom/workers/test/serviceworkers/notificationclose.html
+index 10c8da453976..f18801122efb 100644
+--- dom/workers/test/serviceworkers/notificationclose.html
++++ dom/workers/test/serviceworkers/notificationclose.html
+@@ -27,7 +27,7 @@
+   });
+ 
+   navigator.serviceWorker.onmessage = function(msg) {
+-    testWindow.callback(msg.data.result);
++    testWindow.callback(msg.data);
+   };
+ </script>
+ 
+diff --git dom/workers/test/serviceworkers/notificationclose.js dom/workers/test/serviceworkers/notificationclose.js
+index d482180752e5..f04a0ad24430 100644
+--- dom/workers/test/serviceworkers/notificationclose.js
++++ dom/workers/test/serviceworkers/notificationclose.js
+@@ -2,18 +2,27 @@
+ // http://creativecommons.org/publicdomain/zero/1.0/
+ //
+ onnotificationclose = function(e) {
+-  self.clients.matchAll().then(function(clients) {
+-    if (clients.length === 0) {
+-      dump("********************* CLIENTS LIST EMPTY! Test will timeout! ***********************\n");
+-      return;
+-    }
++  e.waitUntil(async function() {
++    let windowOpened = true;
++    await clients.openWindow("hello.html")
++      .catch(err => {
++        windowOpened = false;
++      });
+ 
+-    clients.forEach(function(client) {
+-      client.postMessage({ result: e.notification.data &&
+-                                   e.notification.data['complex'] &&
+-                                   e.notification.data['complex'][0] == "jsval" &&
+-                                   e.notification.data['complex'][1] == 5 });
++    self.clients.matchAll().then(function(clients) {
++      if (clients.length === 0) {
++        dump("*** CLIENTS LIST EMPTY! Test will timeout! ***\n");
++        return;
++      }
+ 
++      clients.forEach(function(client) {
++        client.postMessage({ result: e.notification.data &&
++                                     e.notification.data['complex'] &&
++                                     e.notification.data['complex'][0] == "jsval" &&
++                                     e.notification.data['complex'][1] == 5,
++                             windowOpened: windowOpened});
++
++      });
+     });
+-  });
++  }());
+ }
+diff --git dom/workers/test/serviceworkers/test_notificationclose.html dom/workers/test/serviceworkers/test_notificationclose.html
+index 032dd740bbff..f60482789ab5 100644
+--- dom/workers/test/serviceworkers/test_notificationclose.html
++++ dom/workers/test/serviceworkers/test_notificationclose.html
+@@ -24,11 +24,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1265841
+   function testFrame(src) {
+     var iframe = document.createElement("iframe");
+     iframe.src = src;
+-    window.callback = function(result) {
++    window.callback = function(data) {
+       window.callback = null;
+       document.body.removeChild(iframe);
+       iframe = null;
+-      ok(result, "Got notificationclose event with correct data.");
++      ok(data.result, "Got notificationclose event with correct data.");
++      ok(!data.windowOpened,
++         "Shouldn't allow to openWindow in notificationclose");
+       MockServices.unregister();
+       registration.unregister().then(function() {
+         SimpleTest.finish();
+

Added: head/www/waterfox/files/patch-bug1429373
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/www/waterfox/files/patch-bug1429373	Fri Feb  2 21:53:38 2018	(r460756)
@@ -0,0 +1,142 @@
+commit e98ed2368b14
+Author: Botond Ballo <botond@mozilla.com>
+Date:   Wed Jan 17 18:46:07 2018 -0500
+
+    Bug 1429373 - Add a clarifying comment to the declaration of APZCTreeManager::SetTargetAPZC(). r=kats, a=lizzard
+    
+    MozReview-Commit-ID: CT1H5TH3UXn
+    
+    --HG--
+    extra : source : 7acde19831d806ea2b27f19fc0de164272a8d691
+---
+ gfx/layers/apz/src/APZCTreeManager.h | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git gfx/layers/apz/src/APZCTreeManager.h gfx/layers/apz/src/APZCTreeManager.h
+index bcc84bac3a97..b4a92f07d4c5 100644
+--- gfx/layers/apz/src/APZCTreeManager.h
++++ gfx/layers/apz/src/APZCTreeManager.h
+@@ -267,6 +267,13 @@ public:
+    * for the different touch points. In the case where the touch point has no
+    * target, or the target is not a scrollable frame, the target's |mScrollId|
+    * should be set to FrameMetrics::NULL_SCROLL_ID.
++   * Note: For mouse events that start a scrollbar drag, both SetTargetAPZC()
++   *       and StartScrollbarDrag() will be called, and the calls may happen
++   *       in either order. That's fine - whichever arrives first will confirm
++   *       the block, and StartScrollbarDrag() will fill in the drag metrics.
++   *       If the block is confirmed before we have drag metrics, some events
++   *       in the drag block may be handled as no-ops until the drag metrics
++   *       arrive.
+    */
+   void SetTargetAPZC(
+       uint64_t aInputBlockId,
+commit ed5f41305349
+Author: Botond Ballo <botond@mozilla.com>
+Date:   Wed Jan 17 18:45:25 2018 -0500
+
+    Bug 1429373 - During hit-testing, ignore clips on layers whose parent has a perspective transform. r=kats, a=lizzard
+    
+    This corresponds to the treatment of such layers in AsyncCompositionManager
+    added in bug 1168263.
+    
+    MozReview-Commit-ID: 34IKk5TH9vV
+    
+    --HG--
+    extra : source : 5b0b60dd22e8f33634d9b0e425cad64b898b8500
+---
+ gfx/layers/apz/src/APZCTreeManager.cpp | 25 ++++++++++++++++++++-----
+ 1 file changed, 20 insertions(+), 5 deletions(-)
+
+diff --git gfx/layers/apz/src/APZCTreeManager.cpp gfx/layers/apz/src/APZCTreeManager.cpp
+index 2dfa9a3250b8..46f969d0fc7a 100644
+--- gfx/layers/apz/src/APZCTreeManager.cpp
++++ gfx/layers/apz/src/APZCTreeManager.cpp
+@@ -97,6 +97,10 @@ struct APZCTreeManager::TreeBuildingState {
+   // to facilitate re-using the same APZC for different layers that scroll
+   // together (and thus have the same ScrollableLayerGuid).
+   std::unordered_map<ScrollableLayerGuid, AsyncPanZoomController*, ScrollableLayerGuidHash> mApzcMap;
++
++  // As the tree is traversed, the top element of this stack tracks whether
++  // the parent scroll node has a perspective transform.
++  std::stack<bool> mParentHasPerspective;
+ };
+ 
+ class APZCTreeManager::CheckerboardFlushObserver : public nsIObserver {
+@@ -321,6 +325,7 @@ APZCTreeManager::UpdateHitTestingTreeImpl(uint64_t aRootLayerTreeId,
+     HitTestingTreeNode* next = nullptr;
+     uint64_t layersId = aRootLayerTreeId;
+     ancestorTransforms.push(Matrix4x4());
++    state.mParentHasPerspective.push(false);
+ 
+     state.mLayersIdsToDestroy.erase(aRootLayerTreeId);
+ 
+@@ -371,6 +376,7 @@ APZCTreeManager::UpdateHitTestingTreeImpl(uint64_t aRootLayerTreeId,
+           }
+ 
+           indents.push(gfx::TreeAutoIndent(mApzcTreeLog));
++          state.mParentHasPerspective.push(aLayerMetrics.TransformIsPerspective());
+         },
+         [&](ScrollNode aLayerMetrics)
+         {
+@@ -379,6 +385,7 @@ APZCTreeManager::UpdateHitTestingTreeImpl(uint64_t aRootLayerTreeId,
+           layersId = next->GetLayersId();
+           ancestorTransforms.pop();
+           indents.pop();
++          state.mParentHasPerspective.pop();
+         });
+ 
+     mApzcTreeLog << "[end]\n";
+@@ -715,6 +722,8 @@ APZCTreeManager::PrepareNodeForLayer(const ScrollNode& aLayer,
+     needsApzc = false;
+   }
+ 
++  bool parentHasPerspective = aState.mParentHasPerspective.top();
++
+   RefPtr<HitTestingTreeNode> node = nullptr;
+   if (!needsApzc) {
+     // Note: if layer properties must be propagated to nodes, RecvUpdate in
+@@ -726,7 +735,9 @@ APZCTreeManager::PrepareNodeForLayer(const ScrollNode& aLayer,
+         GetEventRegions(aLayer),
+         aLayer.GetVisibleRegion(),
+         aLayer.GetTransformTyped(),
+-        aLayer.GetClipRect() ? Some(ParentLayerIntRegion(*aLayer.GetClipRect())) : Nothing(),
++        (!parentHasPerspective && aLayer.GetClipRect())
++          ? Some(ParentLayerIntRegion(*aLayer.GetClipRect()))
++          : Nothing(),
+         GetEventRegionsOverride(aParent, aLayer));
+     node->SetScrollbarData(aLayer.GetScrollbarTargetContainerId(),
+                            aLayer.GetScrollbarAnimationId(),
+@@ -833,12 +844,14 @@ APZCTreeManager::PrepareNodeForLayer(const ScrollNode& aLayer,
+     // or not, depending on whether it went through the newApzc branch above.
+     MOZ_ASSERT(node->IsPrimaryHolder() && node->GetApzc() && node->GetApzc()->Matches(guid));
+ 
+-    ParentLayerIntRegion clipRegion = ComputeClipRegion(state->mController, aLayer);
++    Maybe<ParentLayerIntRegion> clipRegion = parentHasPerspective
++      ? Nothing()
++      : Some(ComputeClipRegion(state->mController, aLayer));
+     node->SetHitTestData(
+         GetEventRegions(aLayer),
+         aLayer.GetVisibleRegion(),
+         aLayer.GetTransformTyped(),
+-        Some(clipRegion),
++        clipRegion,
+         GetEventRegionsOverride(aParent, aLayer));
+     apzc->SetAncestorTransform(aAncestorTransform);
+ 
+@@ -910,12 +923,14 @@ APZCTreeManager::PrepareNodeForLayer(const ScrollNode& aLayer,
+     // instead of an exact one.
+     MOZ_ASSERT(aAncestorTransform.FuzzyEqualsMultiplicative(apzc->GetAncestorTransform()));
+ 
+-    ParentLayerIntRegion clipRegion = ComputeClipRegion(state->mController, aLayer);
++    Maybe<ParentLayerIntRegion> clipRegion = parentHasPerspective
++      ? Nothing()
++      : Some(ComputeClipRegion(state->mController, aLayer));
+     node->SetHitTestData(
+         GetEventRegions(aLayer),
+         aLayer.GetVisibleRegion(),
+         aLayer.GetTransformTyped(),
+-        Some(clipRegion),
++        clipRegion,
+         GetEventRegionsOverride(aParent, aLayer));
+   }
+ 

Added: head/www/waterfox/files/patch-bug1431781
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/www/waterfox/files/patch-bug1431781	Fri Feb  2 21:53:38 2018	(r460756)
@@ -0,0 +1,30 @@
+commit f6cb7152c208
+Author: Mats Palmgren <mats@mozilla.com>
+Date:   Tue Jan 23 00:00:03 2018 +0100
+
+    Bug 1431781 - Report at least OverflowIncomplete reflow status when we skip reflowing OverflowContainer children and have a next-in-flow.  r=dholbert a=lizzard
+    
+    --HG--
+    extra : source : cef7ac1c276ba50a6789ca916568434dbc6990ae
+---
+ layout/generic/nsContainerFrame.cpp | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git layout/generic/nsContainerFrame.cpp layout/generic/nsContainerFrame.cpp
+index d50e1fc6f613..732f24e00b1d 100644
+--- layout/generic/nsContainerFrame.cpp
++++ layout/generic/nsContainerFrame.cpp
+@@ -1160,6 +1160,13 @@ nsContainerFrame::ReflowOverflowContainerChildren(nsPresContext*           aPres
+     if (frame->GetPrevInFlow()->GetParent() != GetPrevInFlow()) {
+       // frame's prevInFlow has moved, skip reflowing this frame;
+       // it will get reflowed once it's been placed
++      if (GetNextInFlow()) {
++        // We report OverflowIncomplete status in this case to avoid our parent
++        // deleting our next-in-flows which might destroy non-empty frames.
++        nsReflowStatus status;
++        status.SetOverflowIncomplete();
++        aStatus.MergeCompletionStatusFrom(status);
++      }
+       continue;
+     }
+     // If the available vertical height has changed, we need to reflow

Added: head/www/waterfox/files/patch-bug1433005
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/www/waterfox/files/patch-bug1433005	Fri Feb  2 21:53:38 2018	(r460756)
@@ -0,0 +1,52 @@
+commit f2d8528c4e01
+Author: Dan Minor <dminor@mozilla.com>
+Date:   Fri Jan 26 11:46:51 2018 -0500
+
+    Bug 1433005 - Simplify codec pruning in NegotiateCodecs. r=bwc, a=lizzard
+---
+ media/webrtc/signaling/src/jsep/JsepTrack.cpp | 29 ++++++++++++++++-----------
+ 1 file changed, 17 insertions(+), 12 deletions(-)
+
+diff --git media/webrtc/signaling/src/jsep/JsepTrack.cpp media/webrtc/signaling/src/jsep/JsepTrack.cpp
+index 2fab2501b854..b921df77f3a0 100644
+--- media/webrtc/signaling/src/jsep/JsepTrack.cpp
++++ media/webrtc/signaling/src/jsep/JsepTrack.cpp
+@@ -486,21 +486,26 @@ JsepTrack::NegotiateCodecs(
+ 
+   // TODO(bug 814227): Remove this once we're ready to put multiple codecs in an
+   // answer.  For now, remove all but the first codec unless the red codec
+-  // exists, and then we include the others per RFC 5109, section 14.2.
+-  // Note: now allows keeping the telephone-event codec, if it appears, as the
+-  // last codec in the list.
++  // exists, in which case we include the others per RFC 5109, section 14.2.
+   if (!codecs->empty() && !red) {
+-    int newSize = dtmf ? 2 : 1;
+-    for (size_t i = 1; i < codecs->size(); ++i) {
+-      if (!dtmf || dtmf != (*codecs)[i]) {
+-        delete (*codecs)[i];
+-        (*codecs)[i] = nullptr;
++    std::vector<JsepCodecDescription*> codecsToKeep;
++
++    bool foundPreferredCodec = false;
++    for (auto codec: *codecs) {
++      if (codec == dtmf) {
++        codecsToKeep.push_back(codec);
++      // TODO: keep ulpfec when we enable it in Bug 875922
++      // } else if (codec == ulpfec) {
++      //   codecsToKeep.push_back(codec);
++      } else if (!foundPreferredCodec) {
++        codecsToKeep.insert(codecsToKeep.begin(), codec);
++        foundPreferredCodec = true;
++      } else {
++        delete codec;
+       }
+     }
+-    if (dtmf) {
+-      (*codecs)[newSize-1] = dtmf;
+-    }
+-    codecs->resize(newSize);
++
++    *codecs = codecsToKeep;
+   }
+ }
+ 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201802022153.w12LrcLN029753>