From 8ca630ef64efea81af9c37fb7285fdee31a68863 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Sat, 2 May 2020 14:57:37 -0400 Subject: [PATCH 01/17] Issue #1531 - Work around GCC 10 defaulting to -fno-common in media/ffvpx/libavcodec/ Build Reference: 26:39.53 ../../../build/unix/gold/ld: error: /home/mattatobin/development/.obj/trunk-f1f9fdabf/navigator-x86_64-pc-linux-gnu-gtk2/media/ffvpx/libavcodec/flac_parser.o: multiple definition of 'ff_flac_parser' 26:39.53 ../../../build/unix/gold/ld: /home/mattatobin/development/.obj/trunk-f1f9fdabf/navigator-x86_64-pc-linux-gnu-gtk2/media/ffvpx/libavcodec/dummy_funcs.o: previous definition here 26:39.53 collect2: error: ld returned 1 exit status 26:39.53 gmake[4]: *** [/home/mattatobin/development/binoc-central/platform/config/rules.mk:773: libmozavcodec.so] Error 1 See also: https://gcc.gnu.org/gcc-10/porting_to.html --- media/ffvpx/libavcodec/moz.build | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/media/ffvpx/libavcodec/moz.build b/media/ffvpx/libavcodec/moz.build index 9980e1556f..98562234f1 100644 --- a/media/ffvpx/libavcodec/moz.build +++ b/media/ffvpx/libavcodec/moz.build @@ -69,6 +69,11 @@ SOURCES += [ SYMBOLS_FILE = 'avcodec.symbols' NO_VISIBILITY_FLAGS = True +# GCC 10 defaults -fno-common, we don't care to solve this "properly" yet +# so use GCC < 10 behavior. +if CONFIG['GNU_CC'] and CONFIG['CC_VERSION'] >= '10.0.0': + CFLAGS += ['-fcommon'] + USE_LIBS += [ 'mozavutil' ] From 0c44ae0a3050e35bff0ad4624287da2378d5c3d1 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Sat, 2 May 2020 16:43:30 -0400 Subject: [PATCH 02/17] Issue #1449 - Implement URLSearchParams's sort() --- dom/url/URLSearchParams.cpp | 42 +++++++++++++++++++++++++++++++ dom/url/URLSearchParams.h | 6 ++++- dom/webidl/URLSearchParams.webidl | 4 +++ 3 files changed, 51 insertions(+), 1 deletion(-) diff --git a/dom/url/URLSearchParams.cpp b/dom/url/URLSearchParams.cpp index f762299f84..e2172ea0e1 100644 --- a/dom/url/URLSearchParams.cpp +++ b/dom/url/URLSearchParams.cpp @@ -448,6 +448,15 @@ URLSearchParams::GetValueAtIndex(uint32_t aIndex) const return mParams->GetValueAtIndex(aIndex); } +void +URLSearchParams::Sort(ErrorResult& aRv) +{ + aRv = mParams->Sort(); + if (!aRv.Failed()) { + NotifyObserver(); + } +} + // Helper functions for structured cloning inline bool ReadString(JSStructuredCloneReader* aReader, nsString& aString) @@ -472,6 +481,39 @@ ReadString(JSStructuredCloneReader* aReader, nsString& aString) return true; } +nsresult +URLParams::Sort() +{ + // Unfortunately we cannot use nsTArray<>.Sort() because it doesn't keep the + // correct order of the values for equal keys. + + // Let's sort the keys, without duplicates. + FallibleTArray keys; + for (const Param& param : mParams) { + if (!keys.Contains(param.mKey) && + !keys.InsertElementSorted(param.mKey, fallible)) { + return NS_ERROR_OUT_OF_MEMORY; + } + } + + FallibleTArray params; + + // Here we recreate the array starting from the sorted keys. + for (uint32_t keyId = 0, keysLength = keys.Length(); keyId < keysLength; + ++keyId) { + const nsString& key = keys[keyId]; + for (const Param& param : mParams) { + if (param.mKey.Equals(key) && + !params.AppendElement(param, fallible)) { + return NS_ERROR_OUT_OF_MEMORY; + } + } + } + + mParams.SwapElements(params); + return NS_OK; +} + inline bool WriteString(JSStructuredCloneWriter* aWriter, const nsString& aString) { diff --git a/dom/url/URLSearchParams.h b/dom/url/URLSearchParams.h index 9fefd78dde..e02c1179f6 100644 --- a/dom/url/URLSearchParams.h +++ b/dom/url/URLSearchParams.h @@ -70,7 +70,7 @@ public: void Get(const nsAString& aName, nsString& aRetval); - void GetAll(const nsAString& aName, nsTArray& aRetval); + void GetAll(const nsAString& aName, nsTArray& aRetval); void Set(const nsAString& aName, const nsAString& aValue); @@ -103,6 +103,8 @@ public: return mParams[aIndex].mValue; } + nsresult Sort(); + bool ReadStructuredClone(JSStructuredCloneReader* aReader); @@ -171,6 +173,8 @@ public: const nsAString& GetKeyAtIndex(uint32_t aIndex) const; const nsAString& GetValueAtIndex(uint32_t aIndex) const; + void Sort(ErrorResult& aRv); + void Stringify(nsString& aRetval) const { Serialize(aRetval); diff --git a/dom/webidl/URLSearchParams.webidl b/dom/webidl/URLSearchParams.webidl index b93f4e8b1e..2828d81ddd 100644 --- a/dom/webidl/URLSearchParams.webidl +++ b/dom/webidl/URLSearchParams.webidl @@ -22,6 +22,10 @@ interface URLSearchParams { sequence getAll(USVString name); boolean has(USVString name); void set(USVString name, USVString value); + + [Throws] + void sort(); + iterable; stringifier; }; From d62f0a0dd2bf5f6e3b4a1e7f94c28d13014319ed Mon Sep 17 00:00:00 2001 From: Moonchild Date: Mon, 4 May 2020 13:11:28 +0000 Subject: [PATCH 03/17] Issue #1517 - Remove dom.event.highrestimestamp.enabled pref This resolves #1517 --- dom/events/Event.cpp | 14 ------------- dom/events/test/test_eventTimeStamp.html | 6 ------ dom/smil/test/test_smilTimeEvents.xhtml | 12 ++++------- .../test_dom_input_event_on_htmleditor.html | 20 +++++-------------- .../test_dom_input_event_on_texteditor.html | 20 +++++-------------- modules/libpref/init/all.js | 1 - 6 files changed, 14 insertions(+), 59 deletions(-) diff --git a/dom/events/Event.cpp b/dom/events/Event.cpp index aff65b40fa..2f8800fb4e 100755 --- a/dom/events/Event.cpp +++ b/dom/events/Event.cpp @@ -45,9 +45,6 @@ extern bool IsCurrentThreadRunningChromeWorker(); static char *sPopupAllowedEvents; -static bool sReturnHighResTimeStamp = false; -static bool sReturnHighResTimeStampIsSet = false; - Event::Event(EventTarget* aOwner, nsPresContext* aPresContext, WidgetEvent* aEvent) @@ -68,13 +65,6 @@ Event::ConstructorInit(EventTarget* aOwner, SetOwner(aOwner); mIsMainThreadEvent = NS_IsMainThread(); - if (mIsMainThreadEvent && !sReturnHighResTimeStampIsSet) { - Preferences::AddBoolVarCache(&sReturnHighResTimeStamp, - "dom.event.highrestimestamp.enabled", - sReturnHighResTimeStamp); - sReturnHighResTimeStampIsSet = true; - } - mPrivateDataDuplicated = false; mWantsPopupControlCheck = false; @@ -1093,10 +1083,6 @@ Event::TimeStamp() const double Event::TimeStampImpl() const { - if (!sReturnHighResTimeStamp) { - return static_cast(mEvent->mTime); - } - if (mEvent->mTimeStamp.IsNull()) { return 0.0; } diff --git a/dom/events/test/test_eventTimeStamp.html b/dom/events/test/test_eventTimeStamp.html index 056203e920..5ca5cd47df 100644 --- a/dom/events/test/test_eventTimeStamp.html +++ b/dom/events/test/test_eventTimeStamp.html @@ -35,12 +35,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=77992 SimpleTest.waitForExplicitFinish(); SimpleTest.requestFlakyTimeout("untriaged"); -// We don't use SpecialPowers.pushPrefEnv since it can delay the test -// function until after the load event has fired which means we can't -// test the timestamp of the load event. -const kPrefName = "dom.event.highrestimestamp.enabled"; -var prevPrefValue = SpecialPowers.getBoolPref(kPrefName); -SpecialPowers.setBoolPref(kPrefName, true); testRegularEvents(); // Event.timeStamp should be relative to the time origin which is: diff --git a/dom/smil/test/test_smilTimeEvents.xhtml b/dom/smil/test/test_smilTimeEvents.xhtml index bf6924ddbb..002be5539b 100644 --- a/dom/smil/test/test_smilTimeEvents.xhtml +++ b/dom/smil/test/test_smilTimeEvents.xhtml @@ -236,14 +236,10 @@ function sanityCheckEvent(evt) is(evt.eventPhase, evt.AT_TARGET); is(evt.bubbles, false, "Event should not bubble"); is(evt.cancelable, false, "Event should not be cancelable"); - if (SpecialPowers.getBoolPref("dom.event.highrestimestamp.enabled")) { - var now = window.performance.now(); - ok(evt.timeStamp > 0 && evt.timeStamp < now, - "Event timeStamp (" + evt.timeStamp + ") should be > 0 but " + - "before the current time (" + now + ")"); - } else { - is(evt.timeStamp, 0, "Event timeStamp should be 0"); - } + var now = window.performance.now(); + ok(evt.timeStamp > 0 && evt.timeStamp < now, + "Event timeStamp (" + evt.timeStamp + ") should be > 0 but " + + "before the current time (" + now + ")"); ok(evt.view !== null, "Event view not set"); } diff --git a/editor/libeditor/tests/test_dom_input_event_on_htmleditor.html b/editor/libeditor/tests/test_dom_input_event_on_htmleditor.html index d1716a228e..dc8790750c 100644 --- a/editor/libeditor/tests/test_dom_input_event_on_htmleditor.html +++ b/editor/libeditor/tests/test_dom_input_event_on_htmleditor.html @@ -67,21 +67,11 @@ function runTests() "input event is fired on unexpected element: " + aEvent.target.tagName); ok(!aEvent.cancelable, "input event must not be cancelable"); ok(aEvent.bubbles, "input event must be bubbles"); - if (SpecialPowers.getBoolPref("dom.event.highrestimestamp.enabled")) { - var duration = Math.abs(window.performance.now() - aEvent.timeStamp); - ok(duration < 30 * 1000, - "perhaps, timestamp wasn't set correctly :" + aEvent.timeStamp + - " (expected it to be within 30s of the current time but it " + - "differed by " + duration + "ms)"); - } else { - var eventTime = new Date(aEvent.timeStamp); - var duration = Math.abs(Date.now() - aEvent.timeStamp); - ok(duration < 30 * 1000, - "perhaps, timestamp wasn't set correctly :" + - eventTime.toLocaleString() + - " (expected it to be within 30s of the current time but it " + - "differed by " + duration + "ms)"); - } + var duration = Math.abs(window.performance.now() - aEvent.timeStamp); + ok(duration < 30 * 1000, + "perhaps, timestamp wasn't set correctly :" + aEvent.timeStamp + + " (expected it to be within 30s of the current time but it " + + "differed by " + duration + "ms)"); inputEvent = aEvent; }; diff --git a/editor/libeditor/tests/test_dom_input_event_on_texteditor.html b/editor/libeditor/tests/test_dom_input_event_on_texteditor.html index b1395e99c6..abdd5f5d0c 100644 --- a/editor/libeditor/tests/test_dom_input_event_on_texteditor.html +++ b/editor/libeditor/tests/test_dom_input_event_on_texteditor.html @@ -41,21 +41,11 @@ function runTests() "input event is fired on unexpected element: " + aEvent.target.tagName); ok(!aEvent.cancelable, "input event must not be cancelable"); ok(aEvent.bubbles, "input event must be bubbles"); - if (SpecialPowers.getBoolPref("dom.event.highrestimestamp.enabled")) { - var duration = Math.abs(window.performance.now() - aEvent.timeStamp); - ok(duration < 30 * 1000, - "perhaps, timestamp wasn't set correctly :" + aEvent.timeStamp + - " (expected it to be within 30s of the current time but it " + - "differed by " + duration + "ms)"); - } else { - var eventTime = new Date(aEvent.timeStamp); - var duration = Math.abs(Date.now() - aEvent.timeStamp); - ok(duration < 30 * 1000, - "perhaps, timestamp wasn't set correctly :" + - eventTime.toLocaleString() + - " (expected it to be within 30s of the current time but it " + - "differed by " + duration + "ms)"); - } + var duration = Math.abs(window.performance.now() - aEvent.timeStamp); + ok(duration < 30 * 1000, + "perhaps, timestamp wasn't set correctly :" + aEvent.timeStamp + + " (expected it to be within 30s of the current time but it " + + "differed by " + duration + "ms)"); inputEvent = aEvent; }; diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index f43eae5de9..0f8b481387 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -1247,7 +1247,6 @@ pref("privacy.trackingprotection.pbmode.enabled", false); pref("dom.event.contextmenu.enabled", true); pref("dom.event.clipboardevents.enabled", true); -pref("dom.event.highrestimestamp.enabled", true); pref("dom.webcomponents.enabled", false); From c61d3aa36514e05d0d9fca3eb8f4f1d991ea9731 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Mon, 4 May 2020 20:49:56 +0000 Subject: [PATCH 04/17] Issue #1450 - Remove NVidia 3D-Vision utils Legacy, unmaintained and untested D3D9 stereo output behind a hidden pref that nobody ever uses... :P 'nuf said. Resolves #1450 --- gfx/layers/d3d9/CompositorD3D9.cpp | 39 ------- gfx/layers/d3d9/DeviceManagerD3D9.cpp | 24 ----- gfx/layers/d3d9/DeviceManagerD3D9.h | 9 -- gfx/layers/d3d9/Nv3DVUtils.cpp | 148 -------------------------- gfx/layers/d3d9/Nv3DVUtils.h | 86 --------------- gfx/layers/moz.build | 1 - gfx/thebes/gfxPrefs.h | 1 - 7 files changed, 308 deletions(-) delete mode 100644 gfx/layers/d3d9/Nv3DVUtils.cpp delete mode 100644 gfx/layers/d3d9/Nv3DVUtils.h diff --git a/gfx/layers/d3d9/CompositorD3D9.cpp b/gfx/layers/d3d9/CompositorD3D9.cpp index 85c19139f3..6f01e7d152 100644 --- a/gfx/layers/d3d9/CompositorD3D9.cpp +++ b/gfx/layers/d3d9/CompositorD3D9.cpp @@ -11,7 +11,6 @@ #include "mozilla/layers/ContentHost.h" #include "mozilla/layers/Effects.h" #include "nsWindowsHelpers.h" -#include "Nv3DVUtils.h" #include "gfxFailure.h" #include "mozilla/layers/LayerManagerComposite.h" #include "gfxPrefs.h" @@ -426,44 +425,6 @@ CompositorD3D9::DrawQuad(const gfx::Rect &aRect, MOZ_ASSERT(sourceCb->GetD3D9Texture()); MOZ_ASSERT(sourceCr->GetD3D9Texture()); - /* - * Send 3d control data and metadata - */ - if (mDeviceManager->GetNv3DVUtils()) { - Nv_Stereo_Mode mode; - switch (source->AsSourceD3D9()->GetStereoMode()) { - case StereoMode::LEFT_RIGHT: - mode = NV_STEREO_MODE_LEFT_RIGHT; - break; - case StereoMode::RIGHT_LEFT: - mode = NV_STEREO_MODE_RIGHT_LEFT; - break; - case StereoMode::BOTTOM_TOP: - mode = NV_STEREO_MODE_BOTTOM_TOP; - break; - case StereoMode::TOP_BOTTOM: - mode = NV_STEREO_MODE_TOP_BOTTOM; - break; - case StereoMode::MONO: - mode = NV_STEREO_MODE_MONO; - break; - } - - // Send control data even in mono case so driver knows to leave stereo mode. - mDeviceManager->GetNv3DVUtils()->SendNv3DVControl(mode, true, FIREFOX_3DV_APP_HANDLE); - - if (source->AsSourceD3D9()->GetStereoMode() != StereoMode::MONO) { - mDeviceManager->GetNv3DVUtils()->SendNv3DVControl(mode, true, FIREFOX_3DV_APP_HANDLE); - - RefPtr renderTarget; - d3d9Device->GetRenderTarget(0, getter_AddRefs(renderTarget)); - mDeviceManager->GetNv3DVUtils()->SendNv3DVMetaData((unsigned int)aRect.width, - (unsigned int)aRect.height, - (HANDLE)(sourceY->GetD3D9Texture()), - (HANDLE)(renderTarget)); - } - } - // Linear scaling is default here, adhering to mFilter is difficult since // presumably even with point filtering we'll still want chroma upsampling // to be linear. In the current approach we can't. diff --git a/gfx/layers/d3d9/DeviceManagerD3D9.cpp b/gfx/layers/d3d9/DeviceManagerD3D9.cpp index 09778bc9c1..5aa0e9825e 100644 --- a/gfx/layers/d3d9/DeviceManagerD3D9.cpp +++ b/gfx/layers/d3d9/DeviceManagerD3D9.cpp @@ -8,7 +8,6 @@ #include "nsIServiceManager.h" #include "nsIConsoleService.h" #include "nsPrintfCString.h" -#include "Nv3DVUtils.h" #include "plstr.h" #include #include "gfx2DGlue.h" @@ -263,21 +262,6 @@ DeviceManagerD3D9::Initialize() return false; } - if (gfxPrefs::StereoVideoEnabled()) { - /* Create an Nv3DVUtils instance */ - if (!mNv3DVUtils) { - mNv3DVUtils = new Nv3DVUtils(); - if (!mNv3DVUtils) { - NS_WARNING("Could not create a new instance of Nv3DVUtils."); - } - } - - /* Initialize the Nv3DVUtils object */ - if (mNv3DVUtils) { - mNv3DVUtils->Initialize(); - } - } - HMODULE d3d9 = LoadLibraryW(L"d3d9.dll"); decltype(Direct3DCreate9)* d3d9Create = (decltype(Direct3DCreate9)*) GetProcAddress(d3d9, "Direct3DCreate9"); @@ -385,14 +369,6 @@ DeviceManagerD3D9::Initialize() /* * Do some post device creation setup */ - if (mNv3DVUtils) { - IUnknown* devUnknown = nullptr; - if (mDevice) { - mDevice->QueryInterface(IID_IUnknown, (void **)&devUnknown); - } - mNv3DVUtils->SetDeviceInfo(devUnknown); - } - auto failCreateShaderMsg = "[D3D9] failed to create a critical resource (shader) code"; hr = mDevice->CreateVertexShader((DWORD*)LayerQuadVS, diff --git a/gfx/layers/d3d9/DeviceManagerD3D9.h b/gfx/layers/d3d9/DeviceManagerD3D9.h index d27b679ab0..394f84d9cd 100644 --- a/gfx/layers/d3d9/DeviceManagerD3D9.h +++ b/gfx/layers/d3d9/DeviceManagerD3D9.h @@ -18,7 +18,6 @@ namespace mozilla { namespace layers { class DeviceManagerD3D9; -class Nv3DVUtils; class Layer; class TextureSourceD3D9; @@ -179,11 +178,6 @@ public: // returns the register to be used for the mask texture, if appropriate uint32_t SetShaderMode(ShaderMode aMode, MaskType aMaskType); - /** - * Return pointer to the Nv3DVUtils instance - */ - Nv3DVUtils *GetNv3DVUtils() { return mNv3DVUtils; } - /** * Returns true if this device was removed. */ @@ -338,9 +332,6 @@ private: /* If this device was removed */ bool mDeviceWasRemoved; - /* Nv3DVUtils instance */ - nsAutoPtr mNv3DVUtils; - /** * Verifies all required device capabilities are present. */ diff --git a/gfx/layers/d3d9/Nv3DVUtils.cpp b/gfx/layers/d3d9/Nv3DVUtils.cpp deleted file mode 100644 index 72638228f2..0000000000 --- a/gfx/layers/d3d9/Nv3DVUtils.cpp +++ /dev/null @@ -1,148 +0,0 @@ -/* -*- Mode: C++; tab-width: 20; 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 - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "mozilla/DebugOnly.h" - -#include "nsIServiceManager.h" -#include "nsIConsoleService.h" -#include -#include "Nv3DVUtils.h" - -DEFINE_GUID(CLSID_NV3DVStreaming, -0xf7747266, 0x777d, 0x4f61, 0xa1, 0x75, 0xdd, 0x5a, 0xdf, 0x1e, 0x37, 0xdf); - -DEFINE_GUID(IID_INV3DVStreaming, -0xf98f9bb2, 0xb914, 0x4d44, 0x98, 0xfa, 0x6e, 0x37, 0x85, 0x16, 0x98, 0x55); - -namespace mozilla { -namespace layers { - -/** - * Constructor and Destructor - */ -Nv3DVUtils::Nv3DVUtils() - : m3DVStreaming (nullptr) -{ -} - -Nv3DVUtils::~Nv3DVUtils() -{ - UnInitialize(); -} - - -// Silence spurious warnings! -#if defined(WARNING) || defined WARN_IF_FALSE -#error We shouldn't be redefining these! -#endif -// Uncomment these to enable spurious warnings. -//#define WARNING(str) NS_WARNING(str) -//#define WARN_IF_FALSE(b, str) NS_WARNING_ASSERTION(b, str) -#define WARNING(str) -#define WARN_IF_FALSE(b, str) - -/** - * Initializes the Nv3DVUtils object. - */ -void -Nv3DVUtils::Initialize() -{ - /* - * Detect if 3D Streaming object is already loaded. Do nothing in that case. - */ - if (m3DVStreaming) { - WARNING("Nv3DVStreaming COM object already instantiated.\n"); - return; - } - - /* - * Create the COM object. If we fail at any stage, just return - */ - HRESULT hr = CoCreateInstance(CLSID_NV3DVStreaming, nullptr, CLSCTX_INPROC_SERVER, IID_INV3DVStreaming, (void**)(getter_AddRefs(m3DVStreaming))); - if (FAILED(hr) || !m3DVStreaming) { - WARNING("Nv3DVStreaming CoCreateInstance failed (disabled)."); - return; - } - - /* - * Initialize the object. Note that m3DVStreaming cannot be nullptr at this point. - */ - bool bRetVal = m3DVStreaming->Nv3DVInitialize(); - - if (!bRetVal) { - WARNING("Nv3DVStreaming Nv3DVInitialize failed!"); - return; - } -} - -/** - * Release resources used by the COM Object, and then release - * the COM Object (nsRefPtr gets released by setting to nullptr) - * - */ -void -Nv3DVUtils::UnInitialize() -{ - if (m3DVStreaming) { - m3DVStreaming->Nv3DVRelease(); - } -} - -/** - * Sets the device info, along with any other initialization that is needed after device creation - * Pass the D3D9 device pointer is an IUnknown input argument. - */ -void -Nv3DVUtils::SetDeviceInfo(IUnknown *devUnknown) -{ - if (!devUnknown) { - WARNING("D3D Device Pointer (IUnknown) is nullptr.\n"); - return; - } - - if (!m3DVStreaming) { - return; - } - - bool rv = m3DVStreaming->Nv3DVSetDevice(devUnknown); - if (!rv) { - WARNING("Nv3DVStreaming Nv3DVControl failed!"); - return; - } - - rv = m3DVStreaming->Nv3DVControl(NV_STEREO_MODE_RIGHT_LEFT, true, FIREFOX_3DV_APP_HANDLE); - WARN_IF_FALSE(rv, "Nv3DVStreaming Nv3DVControl failed!"); -} - -/* - * Send Stereo Control Information. Used mainly to re-route - * calls from ImageLayerD3D9 to the 3DV COM object - */ -void -Nv3DVUtils::SendNv3DVControl(Nv_Stereo_Mode eStereoMode, bool bEnableStereo, DWORD dw3DVAppHandle) -{ - if (!m3DVStreaming) - return; - - DebugOnly rv = m3DVStreaming->Nv3DVControl(eStereoMode, bEnableStereo, dw3DVAppHandle); - WARN_IF_FALSE(rv, "Nv3DVStreaming Nv3DVControl failed!"); -} - -/* - * Send Stereo Metadata. Used mainly to re-route calls - * from ImageLayerD3D9 to the 3DV COM object - */ -void -Nv3DVUtils::SendNv3DVMetaData(unsigned int dwWidth, unsigned int dwHeight, HANDLE hSrcLuma, HANDLE hDst) -{ - if (!m3DVStreaming) - return; - - DebugOnly rv = m3DVStreaming->Nv3DVMetaData((DWORD)dwWidth, (DWORD)dwHeight, hSrcLuma, hDst); - WARN_IF_FALSE(rv, "Nv3DVStreaming Nv3DVMetaData failed!"); -} - -} /* namespace layers */ -} /* namespace mozilla */ diff --git a/gfx/layers/d3d9/Nv3DVUtils.h b/gfx/layers/d3d9/Nv3DVUtils.h deleted file mode 100644 index 0712dd8882..0000000000 --- a/gfx/layers/d3d9/Nv3DVUtils.h +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- Mode: C++; tab-width: 20; 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 - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef GFX_NV3DVUTILS_H -#define GFX_NV3DVUTILS_H - -#include "Layers.h" -#include -#include - -namespace mozilla { -namespace layers { - -#define FIREFOX_3DV_APP_HANDLE 0xECB992B6 - -enum Nv_Stereo_Mode { - NV_STEREO_MODE_LEFT_RIGHT = 0, - NV_STEREO_MODE_RIGHT_LEFT = 1, - NV_STEREO_MODE_TOP_BOTTOM = 2, - NV_STEREO_MODE_BOTTOM_TOP = 3, - NV_STEREO_MODE_MONO = 4, - NV_STEREO_MODE_LAST = 5 -}; - -class INv3DVStreaming : public IUnknown { - -public: - virtual bool Nv3DVInitialize() = 0; - virtual bool Nv3DVRelease() = 0; - virtual bool Nv3DVSetDevice(IUnknown* pDevice) = 0; - virtual bool Nv3DVControl(Nv_Stereo_Mode eStereoMode, bool bEnableStereo, DWORD dw3DVAppHandle) = 0; - virtual bool Nv3DVMetaData(DWORD dwWidth, DWORD dwHeight, HANDLE hSrcLuma, HANDLE hDst) = 0; -}; - -/* - * Nv3DVUtils class - */ -class Nv3DVUtils { - -public: - Nv3DVUtils(); - ~Nv3DVUtils(); - - /* - * Initializes the Nv3DVUtils object. - */ - void Initialize(); - - /* - * Release any resources if needed - * - */ - void UnInitialize(); - - /* - * Sets the device info, along with any other initialization that is needed after device creation - * Pass the D3D9 device pointer is an IUnknown input argument - */ - void SetDeviceInfo(IUnknown *devUnknown); - - /* - * Send Stereo Control Information. Used mainly to re-route - * calls from ImageLayerD3D9 to the 3DV COM object - */ - void SendNv3DVControl(Nv_Stereo_Mode eStereoMode, bool bEnableStereo, DWORD dw3DVAppHandle); - - /* - * Send Stereo Metadata. Used mainly to re-route calls - * from ImageLayerD3D9 to the 3DV COM object - */ - void SendNv3DVMetaData(unsigned int dwWidth, unsigned int dwHeight, HANDLE hSrcLuma, HANDLE hDst); - -private: - - /* Nv3DVStreaming interface pointer */ - RefPtr m3DVStreaming; - -}; - - -} // namespace layers -} // namespace mozilla - -#endif /* GFX_NV3DVUTILS_H */ diff --git a/gfx/layers/moz.build b/gfx/layers/moz.build index 2a2fa11692..164f043505 100644 --- a/gfx/layers/moz.build +++ b/gfx/layers/moz.build @@ -72,7 +72,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': SOURCES += [ 'd3d9/CompositorD3D9.cpp', 'd3d9/DeviceManagerD3D9.cpp', - 'd3d9/Nv3DVUtils.cpp', ] if CONFIG['MOZ_ENABLE_D3D10_LAYER']: EXPORTS.mozilla.layers += [ diff --git a/gfx/thebes/gfxPrefs.h b/gfx/thebes/gfxPrefs.h index d02f156999..c38352c0d5 100644 --- a/gfx/thebes/gfxPrefs.h +++ b/gfx/thebes/gfxPrefs.h @@ -511,7 +511,6 @@ private: DECL_GFX_PREF(Live, "layers.progressive-paint", ProgressivePaint, bool, false); DECL_GFX_PREF(Live, "layers.shared-buffer-provider.enabled", PersistentBufferProviderSharedEnabled, bool, false); DECL_GFX_PREF(Live, "layers.single-tile.enabled", LayersSingleTileEnabled, bool, true); - DECL_GFX_PREF(Once, "layers.stereo-video.enabled", StereoVideoEnabled, bool, false); // We allow for configurable and rectangular tile size to avoid wasting memory on devices whose // screen size does not align nicely to the default tile size. Although layers can be any size, From 587a2fcd6347eddaeca6f43ef72f37ac8a238c04 Mon Sep 17 00:00:00 2001 From: adeshkp Date: Tue, 5 May 2020 08:43:34 +0530 Subject: [PATCH 05/17] Issue #457 - Fix warning about inline nsINode::GetFlattenedTreeParentNodeForStyle being undefined --- dom/base/ElementInlines.h | 1 + 1 file changed, 1 insertion(+) diff --git a/dom/base/ElementInlines.h b/dom/base/ElementInlines.h index df2cc2e24a..ad042e0637 100644 --- a/dom/base/ElementInlines.h +++ b/dom/base/ElementInlines.h @@ -8,6 +8,7 @@ #define mozilla_dom_ElementInlines_h #include "mozilla/dom/Element.h" +#include "nsIContentInlines.h" #include "nsIDocument.h" namespace mozilla { From 89ad46ab66ce2b260ec7192181f350052bf7962d Mon Sep 17 00:00:00 2001 From: Moonchild Date: Tue, 5 May 2020 23:16:58 +0000 Subject: [PATCH 06/17] Issue #1451 - Split out ICU data file on Windows This reduces the xul.dll size by 11 MB --- build/autoconf/icu.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/autoconf/icu.m4 b/build/autoconf/icu.m4 index b5111598c0..090d6c0a2d 100644 --- a/build/autoconf/icu.m4 +++ b/build/autoconf/icu.m4 @@ -38,7 +38,7 @@ if test -n "$USE_ICU"; then dnl We also don't do it on Windows because sometimes the file goes dnl missing -- possibly due to overzealous antivirus software? -- dnl which prevents the browser from starting up :( - if test -z "$JS_STANDALONE" -a "$OS_TARGET" != WINNT -a "$MOZ_WIDGET_TOOLKIT" != "android"; then + if test -z "$JS_STANDALONE"; then MOZ_ICU_DATA_ARCHIVE=1 else MOZ_ICU_DATA_ARCHIVE= From 27ea0aaf5502c1c1d09915026354f9929cc44922 Mon Sep 17 00:00:00 2001 From: Bas Schouten Date: Tue, 5 May 2020 23:22:19 +0000 Subject: [PATCH 07/17] Prevent the existance of dangling pointers upon failure of FindDataStart. --- modules/libjar/nsZipArchive.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/libjar/nsZipArchive.cpp b/modules/libjar/nsZipArchive.cpp index 841503ebf3..2f12af5f0c 100644 --- a/modules/libjar/nsZipArchive.cpp +++ b/modules/libjar/nsZipArchive.cpp @@ -217,16 +217,17 @@ nsresult nsZipHandle::Init(nsIFile *file, nsZipHandle **ret, #else handle->mNSPRFileDesc = fd.forget(); #endif - handle->mMap = map; handle->mFile.Init(file); handle->mTotalLen = (uint32_t) size; handle->mFileStart = buf; rv = handle->findDataStart(); if (NS_FAILED(rv)) { PR_MemUnmap(buf, (uint32_t) size); + handle->mFileStart = nullptr; PR_CloseFileMap(map); return rv; } + handle->mMap = map; handle.forget(ret); return NS_OK; } From 4f72c20f8317e7e550c4654bcddac642e132c3aa Mon Sep 17 00:00:00 2001 From: Moonchild Date: Tue, 5 May 2020 23:43:22 +0000 Subject: [PATCH 08/17] [js] Record load in MCreateThis alias set. --- js/src/jit/AliasAnalysisShared.cpp | 1 + js/src/jit/MIR.h | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/js/src/jit/AliasAnalysisShared.cpp b/js/src/jit/AliasAnalysisShared.cpp index 99c23d2a3e..21a479bf8d 100644 --- a/js/src/jit/AliasAnalysisShared.cpp +++ b/js/src/jit/AliasAnalysisShared.cpp @@ -134,6 +134,7 @@ GetObject(const MDefinition* ins) case MDefinition::Op_SetArgumentsObjectArg: case MDefinition::Op_GetFrameArgument: case MDefinition::Op_SetFrameArgument: + case MDefinition::Op_CreateThis: case MDefinition::Op_CompareExchangeTypedArrayElement: case MDefinition::Op_AtomicExchangeTypedArrayElement: case MDefinition::Op_AtomicTypedArrayElementBinop: diff --git a/js/src/jit/MIR.h b/js/src/jit/MIR.h index 81662a9be7..a7daea0819 100644 --- a/js/src/jit/MIR.h +++ b/js/src/jit/MIR.h @@ -5007,9 +5007,10 @@ class MCreateThis TRIVIAL_NEW_WRAPPERS NAMED_OPERANDS((0, getCallee), (1, getNewTarget)) - // Although creation of |this| modifies global state, it is safely repeatable. + // Performs a property read from |newTarget| if |newTarget| is a JSFunction + // with an own |.prototype| property. AliasSet getAliasSet() const override { - return AliasSet::None(); + return AliasSet::Load(AliasSet::Any); } bool possiblyCalls() const override { return true; From 105c7abd40f3fbf4dbaca839015f2960a11977a9 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Wed, 6 May 2020 00:17:32 +0000 Subject: [PATCH 09/17] [devtools] Port various upstream fixes --- devtools/client/shared/curl.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/devtools/client/shared/curl.js b/devtools/client/shared/curl.js index d9abf506aa..5ce9e96bba 100644 --- a/devtools/client/shared/curl.js +++ b/devtools/client/shared/curl.js @@ -91,7 +91,7 @@ const Curl = { if (utils.isUrlEncodedRequest(data) || ["PUT", "POST", "PATCH"].includes(data.method)) { postDataText = data.postDataText; - addPostData("--data"); + addPostData("--data-raw"); addPostData(utils.writePostDataTextParams(postDataText)); ignoredHeaders.add("content-length"); } else if (multipartRequest) { @@ -400,7 +400,12 @@ const CurlUtils = { * Credit: Google DevTools */ escapeStringWin: function (str) { - /* Replace quote by double quote (but not by \") because it is + /* + Replace dollar sign because of commands (e.g $(cmd.exe)) in + powershell when using double quotes. + Useful details http://www.rlmueller.net/PowerShellEscape.htm + + Replace quote by double quote (but not by \") because it is recognized by both cmd.exe and MS Crt arguments parser. Replace % by "%" because it could be expanded to an environment @@ -414,7 +419,8 @@ const CurlUtils = { Replace new line outside of quotes since cmd.exe doesn't let to do it inside. */ - return "\"" + str.replace(/"/g, "\"\"") + return "\"" + str.replace(/\$/g, "`$") + .replace(/"/g, "\"\"") .replace(/%/g, "\"%\"") .replace(/\\/g, "\\\\") .replace(/[\r\n]+/g, "\"^$&\"") + "\""; From 2442d307b5419c24355729caaafe85f504226e1d Mon Sep 17 00:00:00 2001 From: Moonchild Date: Wed, 6 May 2020 00:30:30 +0000 Subject: [PATCH 10/17] [dom] Reorder some calls to improve memory safety --- dom/media/webaudio/AudioBuffer.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/dom/media/webaudio/AudioBuffer.cpp b/dom/media/webaudio/AudioBuffer.cpp index e7eba2d48a..e4252dfcf8 100644 --- a/dom/media/webaudio/AudioBuffer.cpp +++ b/dom/media/webaudio/AudioBuffer.cpp @@ -254,8 +254,6 @@ void AudioBuffer::CopyFromChannel(const Float32Array& aDestination, uint32_t aChannelNumber, uint32_t aStartInChannel, ErrorResult& aRv) { - aDestination.ComputeLengthAndData(); - uint32_t length = aDestination.Length(); CheckedInt end = aStartInChannel; end += length; @@ -266,6 +264,7 @@ AudioBuffer::CopyFromChannel(const Float32Array& aDestination, uint32_t aChannel } JS::AutoCheckCannotGC nogc; + aDestination.ComputeLengthAndData(); JSObject* channelArray = mJSChannels[aChannelNumber]; const float* sourceData = nullptr; if (channelArray) { @@ -296,8 +295,6 @@ AudioBuffer::CopyToChannel(JSContext* aJSContext, const Float32Array& aSource, uint32_t aChannelNumber, uint32_t aStartInChannel, ErrorResult& aRv) { - aSource.ComputeLengthAndData(); - uint32_t length = aSource.Length(); CheckedInt end = aStartInChannel; end += length; @@ -320,6 +317,7 @@ AudioBuffer::CopyToChannel(JSContext* aJSContext, const Float32Array& aSource, return; } + aSource.ComputeLengthAndData(); bool isShared = false; float* channelData = JS_GetFloat32ArrayData(channelArray, &isShared, nogc); // The channelData arrays should all have originated in From 9ec0ef761489fb69a9731572f00dfb463ab07cb6 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Wed, 6 May 2020 10:54:14 +0000 Subject: [PATCH 11/17] [WebRTC] Port some upstream sctp fixes - add SCTP auth token boundary check. - turn off SCTP auth and address reconfiguration. --- netwerk/sctp/datachannel/DataChannel.cpp | 7 +++++++ netwerk/sctp/src/netinet/sctp_input.c | 22 +++++++++++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/netwerk/sctp/datachannel/DataChannel.cpp b/netwerk/sctp/datachannel/DataChannel.cpp index 19be43d1cd..4797353ca1 100644 --- a/netwerk/sctp/datachannel/DataChannel.cpp +++ b/netwerk/sctp/datachannel/DataChannel.cpp @@ -354,6 +354,13 @@ DataChannelConnection::Init(unsigned short aPort, uint16_t aNumStreams, bool aUs usrsctp_sysctl_set_sctp_blackhole(2); // ECN is currently not supported by the Firefox code usrsctp_sysctl_set_sctp_ecn_enable(0); + + // Disabling authentication and dynamic address reconfiguration as neither + // of them are used for data channel and only result in additional code + // paths being used. + usrsctp_sysctl_set_sctp_asconf_enable(0); + usrsctp_sysctl_set_sctp_auth_enable(0); + sctp_initialized = true; RefPtr shutdown = new DataChannelShutdown(); diff --git a/netwerk/sctp/src/netinet/sctp_input.c b/netwerk/sctp/src/netinet/sctp_input.c index 54f2f9ba35..1301b430c8 100644 --- a/netwerk/sctp/src/netinet/sctp_input.c +++ b/netwerk/sctp/src/netinet/sctp_input.c @@ -2073,7 +2073,7 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset, int init_offset, initack_offset, initack_limit; int retval; int error = 0; - uint8_t auth_chunk_buf[SCTP_PARAM_BUFFER_SIZE]; + uint8_t auth_chunk_buf[SCTP_CHUNK_BUFFER_SIZE]; #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; @@ -2264,8 +2264,12 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset, if (auth_skipped) { struct sctp_auth_chunk *auth; - auth = (struct sctp_auth_chunk *) - sctp_m_getptr(m, auth_offset, auth_len, auth_chunk_buf); + if (auth_len <= SCTP_CHUNK_BUFFER_SIZE) { + auth = (struct sctp_auth_chunk *) + sctp_m_getptr(m, auth_offset, auth_len, auth_chunk_buf); + } else { + auth = NULL; + } if ((auth == NULL) || sctp_handle_auth(stcb, auth, m, auth_offset)) { /* auth HMAC failed, dump the assoc and packet */ SCTPDBG(SCTP_DEBUG_AUTH1, @@ -4655,11 +4659,15 @@ sctp_process_control(struct mbuf *m, int iphlen, int *offset, int length, if (auth_skipped && (stcb != NULL)) { struct sctp_auth_chunk *auth; - auth = (struct sctp_auth_chunk *) - sctp_m_getptr(m, auth_offset, + if (auth_len <= SCTP_CHUNK_BUFFER_SIZE) { + auth = (struct sctp_auth_chunk *) + sctp_m_getptr(m, auth_offset, auth_len, chunk_buf); - got_auth = 1; - auth_skipped = 0; + got_auth = 1; + auth_skipped = 0; + } else { + auth = NULL; + } if ((auth == NULL) || sctp_handle_auth(stcb, auth, m, auth_offset)) { /* auth HMAC failed so dump it */ From 36f366b0ed5cfffea3e29ba6a3f9e0f4ffeac820 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Wed, 6 May 2020 11:15:48 +0000 Subject: [PATCH 12/17] [XPFE] Properly anchor XUL windows when tearing down --- xpfe/appshell/nsXULWindow.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/xpfe/appshell/nsXULWindow.cpp b/xpfe/appshell/nsXULWindow.cpp index 8f2d9fde5f..5850850651 100644 --- a/xpfe/appshell/nsXULWindow.cpp +++ b/xpfe/appshell/nsXULWindow.cpp @@ -455,6 +455,8 @@ NS_IMETHODIMP nsXULWindow::Destroy() if (mDestroying) return NS_OK; + nsCOMPtr kungFuDeathGrip(this); + mozilla::AutoRestore guard(mDestroying); mDestroying = true; @@ -467,16 +469,6 @@ NS_IMETHODIMP nsXULWindow::Destroy() if (parentWindow) parentWindow->RemoveChildWindow(this); - // let's make sure the window doesn't get deleted out from under us - // while we are trying to close....this can happen if the docshell - // we close ends up being the last owning reference to this xulwindow - - // XXXTAB This shouldn't be an issue anymore because the ownership model - // only goes in one direction. When webshell container is fully removed - // try removing this... - - nsCOMPtr placeHolder = this; - // Remove modality (if any) and hide while destroying. More than // a convenience, the hide prevents user interaction with the partially // destroyed window. This is especially necessary when the eldest window From 9339edef45c139d858a3c55922aa0ef5a3004379 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Wed, 6 May 2020 11:04:12 -0400 Subject: [PATCH 13/17] Hyperbola IceDove should use the toolkit SearchService --- toolkit/components/moz.build | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/toolkit/components/moz.build b/toolkit/components/moz.build index ec7ba689b3..acdb5d5e8f 100644 --- a/toolkit/components/moz.build +++ b/toolkit/components/moz.build @@ -87,8 +87,7 @@ if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']: DIRS += ['filepicker'] if CONFIG['MOZ_TOOLKIT_SEARCH'] and not CONFIG['MC_BASILISK'] \ - and not CONFIG['HYPE_ICEWEASEL'] \ - and not CONFIG['HYPE_ICEDOVE']: + and not CONFIG['HYPE_ICEWEASEL']: DIRS += ['search'] if CONFIG['MOZ_URL_CLASSIFIER']: From d71453cef36e37d16caa39f0ac8fc26627045921 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Thu, 7 May 2020 13:36:54 +0200 Subject: [PATCH 14/17] Issue #1536 - Part 1: Add timecode checking for the WebM parser --- dom/media/webm/WebMBufferedParser.cpp | 9 +++++++++ dom/media/webm/WebMBufferedParser.h | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/dom/media/webm/WebMBufferedParser.cpp b/dom/media/webm/WebMBufferedParser.cpp index 21154ab4bf..0f6b0cd54f 100644 --- a/dom/media/webm/WebMBufferedParser.cpp +++ b/dom/media/webm/WebMBufferedParser.cpp @@ -113,6 +113,7 @@ bool WebMBufferedParser::Append(const unsigned char* aBuffer, uint32_t aLength, } else { mClusterEndOffset = -1; } + mGotClusterTimecode = false; mState = READ_ELEMENT_ID; break; case BLOCKGROUP_ID: @@ -121,6 +122,11 @@ bool WebMBufferedParser::Append(const unsigned char* aBuffer, uint32_t aLength, case SIMPLEBLOCK_ID: /* FALLTHROUGH */ case BLOCK_ID: + if (!mGotClusterTimecode) { + WEBM_DEBUG("The Timecode element must appear before any Block or " + "SimpleBlock elements in a Cluster"); + return false; + } mBlockSize = mElement.mSize.mValue; mBlockTimecode = 0; mBlockTimecodeLength = BLOCK_TIMECODE_LENGTH; @@ -164,6 +170,7 @@ bool WebMBufferedParser::Append(const unsigned char* aBuffer, uint32_t aLength, break; case READ_TIMECODESCALE: if (!mGotTimecodeScale) { + WEBM_DEBUG("Should get the SegmentInfo first"); return false; } mTimecodeScale = mVInt.mValue; @@ -171,6 +178,7 @@ bool WebMBufferedParser::Append(const unsigned char* aBuffer, uint32_t aLength, break; case READ_CLUSTER_TIMECODE: mClusterTimecode = mVInt.mValue; + mGotClusterTimecode = true; mState = READ_ELEMENT_ID; break; case READ_BLOCK_TIMECODE: @@ -190,6 +198,7 @@ bool WebMBufferedParser::Append(const unsigned char* aBuffer, uint32_t aLength, // Don't insert invalid negative timecodes. if (mBlockTimecode >= 0 || mClusterTimecode >= uint16_t(abs(mBlockTimecode))) { if (!mGotTimecodeScale) { + WEBM_DEBUG("Should get the TimecodeScale first"); return false; } uint64_t absTimecode = mClusterTimecode + mBlockTimecode; diff --git a/dom/media/webm/WebMBufferedParser.h b/dom/media/webm/WebMBufferedParser.h index bc3de4ba07..858653fc17 100644 --- a/dom/media/webm/WebMBufferedParser.h +++ b/dom/media/webm/WebMBufferedParser.h @@ -75,6 +75,7 @@ struct WebMBufferedParser , mSkipBytes(0) , mTimecodeScale(1000000) , mGotTimecodeScale(false) + , mGotClusterTimecode(false) { if (mStartOffset != 0) { mState = FIND_CLUSTER_SYNC; @@ -260,6 +261,9 @@ private: // True if we read the timecode scale from the segment info or have // confirmed that the default value is to be used. bool mGotTimecodeScale; + + // True if we've read the cluster time code. + bool mGotClusterTimecode; }; class WebMBufferedState final From c604c8363dbbf618a26a91413bc68234a5a5a37f Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Thu, 7 May 2020 13:40:21 +0200 Subject: [PATCH 15/17] Issue #1536 - Part 2: Parse content to decide whether it's a media segment. --- dom/media/mediasource/ContainerParser.cpp | 31 ++++++++--------------- dom/media/webm/WebMBufferedParser.cpp | 6 +++++ dom/media/webm/WebMBufferedParser.h | 13 ++++++++-- 3 files changed, 27 insertions(+), 23 deletions(-) diff --git a/dom/media/mediasource/ContainerParser.cpp b/dom/media/mediasource/ContainerParser.cpp index b4dcfde8af..628f8d7cd6 100644 --- a/dom/media/mediasource/ContainerParser.cpp +++ b/dom/media/mediasource/ContainerParser.cpp @@ -154,31 +154,20 @@ public: MediaResult IsMediaSegmentPresent(MediaByteBuffer* aData) override { ContainerParser::IsMediaSegmentPresent(aData); - // XXX: This is overly primitive, needs to collect data as it's appended - // to the SB and handle, rather than assuming everything is present in a - // single aData segment. - // 0x1a45dfa3 // EBML - // ... - // DocType == "webm" - // ... - // 0x18538067 // Segment (must be "unknown" size) - // 0x1549a966 // -> Segment Info - // 0x1654ae6b // -> One or more Tracks - - // 0x1f43b675 // Cluster if (aData->Length() < 4) { return NS_ERROR_NOT_AVAILABLE; } - if ((*aData)[0] == 0x1f && (*aData)[1] == 0x43 && (*aData)[2] == 0xb6 && - (*aData)[3] == 0x75) { - return NS_OK; + + WebMBufferedParser parser(0); + nsTArray mapping; + ReentrantMonitor dummy("dummy"); + parser.AppendMediaSegmentOnly(); + bool result = parser.Append(aData->Elements(), aData->Length(), mapping, + dummy); + if (!result) { + return MediaResult(NS_ERROR_FAILURE, RESULT_DETAIL("Invalid webm content")); } - // 0x1c53bb6b // Cues - if ((*aData)[0] == 0x1c && (*aData)[1] == 0x53 && (*aData)[2] == 0xbb && - (*aData)[3] == 0x6b) { - return NS_OK; - } - return MediaResult(NS_ERROR_FAILURE, RESULT_DETAIL("Invalid webm content")); + return parser.GetClusterOffset() >= 0 ? NS_OK : NS_ERROR_NOT_AVAILABLE; } MediaResult ParseStartAndEndTimestamps(MediaByteBuffer* aData, diff --git a/dom/media/webm/WebMBufferedParser.cpp b/dom/media/webm/WebMBufferedParser.cpp index 0f6b0cd54f..979308cf0c 100644 --- a/dom/media/webm/WebMBufferedParser.cpp +++ b/dom/media/webm/WebMBufferedParser.cpp @@ -275,6 +275,12 @@ WebMBufferedParser::EndSegmentOffset(int64_t aOffset) return mBlockEndOffset; } +int64_t +WebMBufferedParser::GetClusterOffset() const +{ + return mClusterOffset; +} + // SyncOffsetComparator and TimeComparator are slightly confusing, in that // the nsTArray they're used with (mTimeMapping) is sorted by mEndOffset and // these comparators are used on the other fields of WebMTimeDataOffset. diff --git a/dom/media/webm/WebMBufferedParser.h b/dom/media/webm/WebMBufferedParser.h index 858653fc17..4245561fc1 100644 --- a/dom/media/webm/WebMBufferedParser.h +++ b/dom/media/webm/WebMBufferedParser.h @@ -67,7 +67,7 @@ struct WebMBufferedParser , mVIntLeft(0) , mBlockSize(0) , mClusterTimecode(0) - , mClusterOffset(0) + , mClusterOffset(-1) , mClusterEndOffset(-1) , mBlockOffset(0) , mBlockTimecode(0) @@ -87,6 +87,12 @@ struct WebMBufferedParser return mTimecodeScale; } + // Use this function when we would only feed media segment for the parser. + void AppendMediaSegmentOnly() + { + mGotTimecodeScale = true; + } + // If this parser is not expected to parse a segment info, it must be told // the appropriate timecode scale to use from elsewhere. void SetTimecodeScale(uint32_t aTimecodeScale) { @@ -115,6 +121,9 @@ struct WebMBufferedParser // This allows to determine the end of the interval containg aOffset. int64_t EndSegmentOffset(int64_t aOffset); + // Return the Cluster offset, return -1 if we can't find the Cluster. + int64_t GetClusterOffset() const; + // The offset at which this parser started parsing. Used to merge // adjacent parsers, in which case the later parser adopts the earlier // parser's mStartOffset. @@ -232,7 +241,7 @@ private: // Start offset of the cluster currently being parsed. Used as the sync // point offset for the offset-to-time mapping as each block timecode is - // been parsed. + // been parsed. -1 if unknown. int64_t mClusterOffset; // End offset of the cluster currently being parsed. -1 if unknown. From 2d3f069ae8f1a9dc63facb37f0bc9db8225d08a2 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Tue, 5 May 2020 23:04:10 +0300 Subject: [PATCH 16/17] Issue #1536 - Part 3: Parse content to decide whether it's an init segment. --- dom/media/mediasource/ContainerParser.cpp | 26 +++++++---------------- 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/dom/media/mediasource/ContainerParser.cpp b/dom/media/mediasource/ContainerParser.cpp index 628f8d7cd6..9711d4fb61 100644 --- a/dom/media/mediasource/ContainerParser.cpp +++ b/dom/media/mediasource/ContainerParser.cpp @@ -127,28 +127,18 @@ public: MediaResult IsInitSegmentPresent(MediaByteBuffer* aData) override { ContainerParser::IsInitSegmentPresent(aData); - // XXX: This is overly primitive, needs to collect data as it's appended - // to the SB and handle, rather than assuming everything is present in a - // single aData segment. - // 0x1a45dfa3 // EBML - // ... - // DocType == "webm" - // ... - // 0x18538067 // Segment (must be "unknown" size or contain a value large - // enough to include the Segment Information and Tracks - // elements that follow) - // 0x1549a966 // -> Segment Info - // 0x1654ae6b // -> One or more Tracks - - // 0x1a45dfa3 // EBML if (aData->Length() < 4) { return NS_ERROR_NOT_AVAILABLE; } - if ((*aData)[0] == 0x1a && (*aData)[1] == 0x45 && (*aData)[2] == 0xdf && - (*aData)[3] == 0xa3) { - return NS_OK; + WebMBufferedParser parser(0); + nsTArray mapping; + ReentrantMonitor dummy("dummy"); + bool result = parser.Append(aData->Elements(), aData->Length(), mapping, + dummy); + if (!result) { + return MediaResult(NS_ERROR_FAILURE, RESULT_DETAIL("Invalid webm content")); } - return MediaResult(NS_ERROR_FAILURE, RESULT_DETAIL("Invalid webm content")); + return parser.mInitEndOffset > 0 ? NS_OK : NS_ERROR_NOT_AVAILABLE; } MediaResult IsMediaSegmentPresent(MediaByteBuffer* aData) override From f51880be1f66a7594b244d75b48fb7eab2b8bc1d Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Thu, 7 May 2020 11:27:15 +0200 Subject: [PATCH 17/17] [Basilisk] [AM] Clean up addon-signing build leftovers. --- application/basilisk/components/nsBrowserGlue.js | 7 +------ application/basilisk/confvars.sh | 4 ---- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/application/basilisk/components/nsBrowserGlue.js b/application/basilisk/components/nsBrowserGlue.js index 3693de4b1d..7446d1110a 100644 --- a/application/basilisk/components/nsBrowserGlue.js +++ b/application/basilisk/components/nsBrowserGlue.js @@ -1044,12 +1044,7 @@ BrowserGlue.prototype = { }); } - let signingRequired; - if (AppConstants.MOZ_REQUIRE_SIGNING) { - signingRequired = true; - } else { - signingRequired = Services.prefs.getBoolPref("xpinstall.signatures.required"); - } + let signingRequired = Services.prefs.getBoolPref("xpinstall.signatures.required"); if (signingRequired) { let disabledAddons = AddonManager.getStartupChanges(AddonManager.STARTUP_CHANGE_DISABLED); diff --git a/application/basilisk/confvars.sh b/application/basilisk/confvars.sh index 18271711b8..6f980c3674 100644 --- a/application/basilisk/confvars.sh +++ b/application/basilisk/confvars.sh @@ -64,7 +64,3 @@ if test "$OS_ARCH" = "WINNT" -o \ "$OS_ARCH" = "Darwin"; then MOZ_CAN_DRAW_IN_TITLEBAR=1 fi - -# Disable checking that add-ons are signed by the trusted root -MOZ_ADDON_SIGNING=0 -MOZ_REQUIRE_SIGNING=0