From 582949cd30c2d8d20a16d3f972dabb164bddc029 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Tue, 11 Feb 2020 12:30:45 +0100 Subject: [CSP] Allow not having a Port for RessourceURI if the Scheme has no Default Port --- dom/security/nsCSPUtils.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/dom/security/nsCSPUtils.cpp b/dom/security/nsCSPUtils.cpp index d07ad7945..6d4f297d6 100644 --- a/dom/security/nsCSPUtils.cpp +++ b/dom/security/nsCSPUtils.cpp @@ -555,7 +555,21 @@ permitsPort(const nsAString& aEnforcementScheme, int32_t resourcePort; nsresult rv = aResourceURI->GetPort(&resourcePort); - NS_ENSURE_SUCCESS(rv, false); + if (NS_FAILED(rv) && aEnforcementPort.IsEmpty()) { + // If we cannot get a Port (e.g. because of an Custom Protocol handler) + // we need to check if a default port is associated with the Scheme + if (aEnforcementScheme.IsEmpty()) { + return false; + } + int defaultPortforScheme = + NS_GetDefaultPort(NS_ConvertUTF16toUTF8(aEnforcementScheme).get()); + + // If there is no default port associated with the Scheme ( + // defaultPortforScheme == -1) or it is an externally handled protocol ( + // defaultPortforScheme == 0 ) and the csp does not enforce a port - we can + // allow not having a port + return (defaultPortforScheme == -1 || defaultPortforScheme == 0); + } // Avoid unnecessary string creation/manipulation and don't block the // load if the resource to be loaded uses the default port for that -- cgit v1.2.3 From f16336a10d36f18eb55efb1d62c7205de9e916c4 Mon Sep 17 00:00:00 2001 From: sotaro Date: Fri, 14 Feb 2020 10:46:53 +0100 Subject: [Layers] Clear WrappingTextureSourceYCbCrBasic::mTexture correctly --- gfx/layers/composite/TextureHost.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gfx/layers/composite/TextureHost.cpp b/gfx/layers/composite/TextureHost.cpp index b342f1d18..8df7af4a8 100644 --- a/gfx/layers/composite/TextureHost.cpp +++ b/gfx/layers/composite/TextureHost.cpp @@ -555,6 +555,14 @@ void BufferTextureHost::DeallocateDeviceData() { if (mFirstSource && mFirstSource->NumCompositableRefs() > 0) { + // WrappingTextureSourceYCbCrBasic wraps YUV format BufferTextureHost. + // When BufferTextureHost is destroyed, data of + // WrappingTextureSourceYCbCrBasic becomes invalid. + if (mFirstSource->AsWrappingTextureSourceYCbCrBasic() && + mFirstSource->IsOwnedBy(this)) { + mFirstSource->SetOwner(nullptr); + mFirstSource->DeallocateDeviceData(); + } return; } -- cgit v1.2.3 From ceb9d0ad92ac1fc0d5844310f7542e397cdd8f05 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Fri, 14 Feb 2020 17:06:30 +0100 Subject: Issue #1441 - Guard appomni/greomni with UXP_CUSTOM_OMNI env var. This adds an addition to the environment set up for child processes (plugin container) so that it may still be able to pass the omni parameters there as-needed. --- ipc/glue/GeckoChildProcessHost.cpp | 1 + toolkit/xre/nsAppRunner.cpp | 72 ++++++++++++++++++++------------------ 2 files changed, 39 insertions(+), 34 deletions(-) diff --git a/ipc/glue/GeckoChildProcessHost.cpp b/ipc/glue/GeckoChildProcessHost.cpp index ea76f85f0..9e83a8729 100644 --- a/ipc/glue/GeckoChildProcessHost.cpp +++ b/ipc/glue/GeckoChildProcessHost.cpp @@ -712,6 +712,7 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector& aExt if (Omnijar::IsInitialized()) { // Make sure that child processes can find the omnijar // See XRE_InitCommandLine in nsAppRunner.cpp + newEnvVars["UXP_CUSTOM_OMNI"] = 1; nsAutoCString path; nsCOMPtr file = Omnijar::GetPath(Omnijar::GRE); if (file && NS_SUCCEEDED(file->GetNativePath(path))) { diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp index 035d35a9d..441c4a373 100644 --- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp @@ -4118,45 +4118,49 @@ XRE_InitCommandLine(int aArgc, char* aArgv[]) delete[] canonArgs; #endif - const char *path = nullptr; - ArgResult ar = CheckArg("greomni", true, &path); - if (ar == ARG_BAD) { - PR_fprintf(PR_STDERR, - "Error: argument --greomni requires a path argument or the " - "--osint argument was specified with the --greomni argument " - "which is invalid.\n"); - return NS_ERROR_FAILURE; - } + if (PR_GetEnv("UXP_CUSTOM_OMNI")) { + // Process CLI parameters for specifying custom omnijars + const char *path = nullptr; + ArgResult ar = CheckArg("greomni", true, &path); + if (ar == ARG_BAD) { + PR_fprintf(PR_STDERR, + "Error: argument --greomni requires a path argument or the " + "--osint argument was specified with the --greomni argument " + "which is invalid.\n"); + return NS_ERROR_FAILURE; + } - if (!path) - return rv; + if (!path) + return rv; - nsCOMPtr greOmni; - rv = XRE_GetFileFromPath(path, getter_AddRefs(greOmni)); - if (NS_FAILED(rv)) { - PR_fprintf(PR_STDERR, "Error: argument --greomni requires a valid path\n"); - return rv; - } + nsCOMPtr greOmni; + rv = XRE_GetFileFromPath(path, getter_AddRefs(greOmni)); + if (NS_FAILED(rv)) { + PR_fprintf(PR_STDERR, "Error: argument --greomni requires a valid path\n"); + return rv; + } - ar = CheckArg("appomni", true, &path); - if (ar == ARG_BAD) { - PR_fprintf(PR_STDERR, - "Error: argument --appomni requires a path argument or the " - "--osint argument was specified with the --appomni argument " - "which is invalid.\n"); - return NS_ERROR_FAILURE; - } + ar = CheckArg("appomni", true, &path); + if (ar == ARG_BAD) { + PR_fprintf(PR_STDERR, + "Error: argument --appomni requires a path argument or the " + "--osint argument was specified with the --appomni argument " + "which is invalid.\n"); + return NS_ERROR_FAILURE; + } - nsCOMPtr appOmni; - if (path) { - rv = XRE_GetFileFromPath(path, getter_AddRefs(appOmni)); - if (NS_FAILED(rv)) { - PR_fprintf(PR_STDERR, "Error: argument --appomni requires a valid path\n"); - return rv; - } - } + nsCOMPtr appOmni; + if (path) { + rv = XRE_GetFileFromPath(path, getter_AddRefs(appOmni)); + if (NS_FAILED(rv)) { + PR_fprintf(PR_STDERR, "Error: argument --appomni requires a valid path\n"); + return rv; + } + } + + mozilla::Omnijar::Init(greOmni, appOmni); + } // UXP_CUSTOM_OMNI - mozilla::Omnijar::Init(greOmni, appOmni); return rv; } -- cgit v1.2.3 From 32de0e3ccc2ec205e910ded6a748289a7a6feeea Mon Sep 17 00:00:00 2001 From: Henri Sivonen Date: Fri, 14 Feb 2020 13:24:59 +0100 Subject: [Parser] Move setting context to null to the correct location. --- parser/html/nsHtml5TreeBuilder.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/parser/html/nsHtml5TreeBuilder.cpp b/parser/html/nsHtml5TreeBuilder.cpp index a02626e47..b1225130a 100644 --- a/parser/html/nsHtml5TreeBuilder.cpp +++ b/parser/html/nsHtml5TreeBuilder.cpp @@ -141,8 +141,6 @@ nsHtml5TreeBuilder::startTokenization(nsHtml5Tokenizer* self) tokenizer->setState(NS_HTML5TOKENIZER_DATA); } } - contextName = nullptr; - contextNode = nullptr; } else { mode = NS_HTML5TREE_BUILDER_INITIAL; if (tokenizer->isViewingXmlSource()) { @@ -581,6 +579,8 @@ nsHtml5TreeBuilder::endTokenization() { formPointer = nullptr; headPointer = nullptr; + contextName = nullptr; + contextNode = nullptr; deepTreeSurrogateParent = nullptr; templateModeStack = nullptr; if (stack) { -- cgit v1.2.3 From 9600e2dc87ca84994ef2867ae1e81428da05cd06 Mon Sep 17 00:00:00 2001 From: Simon Giesecke Date: Fri, 14 Feb 2020 14:39:40 +0100 Subject: [IndexedDB] Ensure that strong references to newly created cursors are kept until the DOM Binding is created. This fixes random crashes on websites that use IndexedDB cursors. See also BZ bug 1599420 --- dom/indexedDB/ActorsChild.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dom/indexedDB/ActorsChild.cpp b/dom/indexedDB/ActorsChild.cpp index 30dc9b6da..85f876cdc 100644 --- a/dom/indexedDB/ActorsChild.cpp +++ b/dom/indexedDB/ActorsChild.cpp @@ -3291,6 +3291,10 @@ BackgroundCursorChild::HandleResponse( auto& responses = const_cast&>(aResponses); + // If a new cursor is created, we need to keep a reference to it until the + // ResultHelper creates a DOM Binding. + RefPtr newCursor; + for (ObjectStoreCursorResponse& response : responses) { StructuredCloneReadInfo cloneReadInfo(Move(response.cloneInfo())); cloneReadInfo.mDatabase = mTransaction->Database(); @@ -3300,8 +3304,6 @@ BackgroundCursorChild::HandleResponse( nullptr, cloneReadInfo.mFiles); - RefPtr newCursor; - if (mCursor) { mCursor->Reset(Move(response.key()), Move(cloneReadInfo)); } else { -- cgit v1.2.3