Date: Thu, 29 Mar 2018 00:53:36 +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: r465858 - in head/www/waterfox: . files Message-ID: <201803290053.w2T0raXq017067@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jbeich Date: Thu Mar 29 00:53:36 2018 New Revision: 465858 URL: https://svnweb.freebsd.org/changeset/ports/465858 Log: www/waterfox: apply some FF60 fixes Added: head/www/waterfox/files/patch-bug1340039 (contents, props changed) head/www/waterfox/files/patch-bug1402380 (contents, props changed) head/www/waterfox/files/patch-bug1409440 (contents, props changed) head/www/waterfox/files/patch-bug1416045 (contents, props changed) head/www/waterfox/files/patch-bug1433609 (contents, props changed) head/www/waterfox/files/patch-bug1441941 (contents, props changed) head/www/waterfox/files/patch-bug1443092 (contents, props changed) head/www/waterfox/files/patch-bug1444231 (contents, props changed) head/www/waterfox/files/patch-bug1448136 (contents, props changed) head/www/waterfox/files/patch-servo19654 (contents, props changed) Modified: head/www/waterfox/Makefile (contents, props changed) Modified: head/www/waterfox/Makefile ============================================================================== --- head/www/waterfox/Makefile Thu Mar 29 00:49:47 2018 (r465857) +++ head/www/waterfox/Makefile Thu Mar 29 00:53:36 2018 (r465858) @@ -2,6 +2,7 @@ PORTNAME= waterfox DISTVERSION= 56.1.0 +PORTREVISION= 1 CATEGORIES= www ipv6 MAINTAINER= jbeich@FreeBSD.org Added: head/www/waterfox/files/patch-bug1340039 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/www/waterfox/files/patch-bug1340039 Thu Mar 29 00:53:36 2018 (r465858) @@ -0,0 +1,232 @@ +commit 753d522440f6 +Author: Hector Zhao <bzhao@mozilla.com> +Date: Wed Mar 14 16:44:36 2018 +0800 + + Bug 1340039 - Set contentPolicyType when copying image, and pass it between processes. r=smaug, a=jcristau + + MozReview-Commit-ID: CJj1a1Lj699 + + --HG-- + extra : source : 445ec9da938f984a6fe2fe163c7f3d7be4710a77 +--- + dom/base/nsContentUtils.cpp | 2 ++ + dom/base/nsContentUtils.h | 1 + + dom/base/nsCopySupport.cpp | 1 + + dom/events/EventStateManager.cpp | 5 ++++- + dom/ipc/ContentParent.cpp | 2 ++ + dom/ipc/ContentParent.h | 1 + + dom/ipc/PBrowser.ipdl | 3 ++- + dom/ipc/PContent.ipdl | 1 + + dom/ipc/TabChild.cpp | 4 +++- + dom/ipc/TabChild.h | 3 ++- + dom/ipc/TabParent.cpp | 6 ++++-- + dom/ipc/TabParent.h | 3 ++- + widget/nsClipboardProxy.cpp | 5 ++++- + 13 files changed, 29 insertions(+), 8 deletions(-) + +diff --git dom/base/nsContentUtils.cpp dom/base/nsContentUtils.cpp +index fe773465faba..63e1ac06bf2d 100644 +--- dom/base/nsContentUtils.cpp ++++ dom/base/nsContentUtils.cpp +@@ -7986,6 +7986,7 @@ nsresult + nsContentUtils::IPCTransferableToTransferable(const IPCDataTransfer& aDataTransfer, + const bool& aIsPrivateData, + nsIPrincipal* aRequestingPrincipal, ++ const nsContentPolicyType& aContentPolicyType, + nsITransferable* aTransferable, + mozilla::dom::nsIContentParent* aContentParent, + mozilla::dom::TabChild* aTabChild) +@@ -8051,6 +8052,7 @@ nsContentUtils::IPCTransferableToTransferable(const IPCDataTransfer& aDataTransf + + aTransferable->SetIsPrivateData(aIsPrivateData); + aTransferable->SetRequestingPrincipal(aRequestingPrincipal); ++ aTransferable->SetContentPolicyType(aContentPolicyType); + return NS_OK; + } + +diff --git dom/base/nsContentUtils.h dom/base/nsContentUtils.h +index 356d3841b9e9..9ef79a569ea3 100644 +--- dom/base/nsContentUtils.h ++++ dom/base/nsContentUtils.h +@@ -2845,6 +2845,7 @@ public: + static nsresult IPCTransferableToTransferable(const mozilla::dom::IPCDataTransfer& aDataTransfer, + const bool& aIsPrivateData, + nsIPrincipal* aRequestingPrincipal, ++ const nsContentPolicyType& aContentPolicyType, + nsITransferable* aTransferable, + mozilla::dom::nsIContentParent* aContentParent, + mozilla::dom::TabChild* aTabChild); +diff --git dom/base/nsCopySupport.cpp dom/base/nsCopySupport.cpp +index 0f680c21c126..5e2d4065b3b7 100644 +--- dom/base/nsCopySupport.cpp ++++ dom/base/nsCopySupport.cpp +@@ -680,6 +680,7 @@ static nsresult AppendImagePromise(nsITransferable* aTransferable, + NS_ENSURE_SUCCESS(rv, rv); + + aTransferable->SetRequestingPrincipal(node->NodePrincipal()); ++ aTransferable->SetContentPolicyType(nsIContentPolicy::TYPE_INTERNAL_IMAGE); + + // add the dataless file promise flavor + return aTransferable->AddDataFlavor(kFilePromiseMime); +diff --git dom/events/EventStateManager.cpp dom/events/EventStateManager.cpp +index 4423e3aecc5e..bdc1bb6e50c9 100644 +--- dom/events/EventStateManager.cpp ++++ dom/events/EventStateManager.cpp +@@ -5469,8 +5469,11 @@ EventStateManager::DoContentCommandEvent(WidgetContentCommandEvent* aEvent) + transferable->GetIsPrivateData(&isPrivateData); + nsCOMPtr<nsIPrincipal> requestingPrincipal; + transferable->GetRequestingPrincipal(getter_AddRefs(requestingPrincipal)); ++ nsContentPolicyType contentPolicyType = nsIContentPolicy::TYPE_OTHER; ++ transferable->GetContentPolicyType(&contentPolicyType); + remote->SendPasteTransferable(ipcDataTransfer, isPrivateData, +- IPC::Principal(requestingPrincipal)); ++ IPC::Principal(requestingPrincipal), ++ contentPolicyType); + rv = NS_OK; + } else { + nsCOMPtr<nsICommandController> commandController = do_QueryInterface(controller); +diff --git dom/ipc/ContentParent.cpp dom/ipc/ContentParent.cpp +index e27f3eedc1b1..3c3d2fbc3735 100644 +--- dom/ipc/ContentParent.cpp ++++ dom/ipc/ContentParent.cpp +@@ -2605,6 +2605,7 @@ mozilla::ipc::IPCResult + ContentParent::RecvSetClipboard(const IPCDataTransfer& aDataTransfer, + const bool& aIsPrivateData, + const IPC::Principal& aRequestingPrincipal, ++ const uint32_t& aContentPolicyType, + const int32_t& aWhichClipboard) + { + nsresult rv; +@@ -2619,6 +2620,7 @@ ContentParent::RecvSetClipboard(const IPCDataTransfer& aDataTransfer, + rv = nsContentUtils::IPCTransferableToTransferable(aDataTransfer, + aIsPrivateData, + aRequestingPrincipal, ++ aContentPolicyType, + trans, this, nullptr); + NS_ENSURE_SUCCESS(rv, IPC_OK()); + +diff --git dom/ipc/ContentParent.h dom/ipc/ContentParent.h +index 1977cfbfd651..a1311bd39403 100644 +--- dom/ipc/ContentParent.h ++++ dom/ipc/ContentParent.h +@@ -976,6 +976,7 @@ private: + virtual mozilla::ipc::IPCResult RecvSetClipboard(const IPCDataTransfer& aDataTransfer, + const bool& aIsPrivateData, + const IPC::Principal& aRequestingPrincipal, ++ const uint32_t& aContentPolicyType, + const int32_t& aWhichClipboard) override; + + virtual mozilla::ipc::IPCResult RecvGetClipboard(nsTArray<nsCString>&& aTypes, +diff --git dom/ipc/PBrowser.ipdl dom/ipc/PBrowser.ipdl +index 3a7b21271fec..b1cf9efbe964 100644 +--- dom/ipc/PBrowser.ipdl ++++ dom/ipc/PBrowser.ipdl +@@ -720,7 +720,8 @@ child: + */ + async PasteTransferable(IPCDataTransfer aDataTransfer, + bool aIsPrivateData, +- Principal aRequestingPrincipal); ++ Principal aRequestingPrincipal, ++ uint32_t aContentPolicyType); + + /** + * Activate event forwarding from client to parent. +diff --git dom/ipc/PContent.ipdl dom/ipc/PContent.ipdl +index 7e33b2920cbe..4ab9da3cc105 100644 +--- dom/ipc/PContent.ipdl ++++ dom/ipc/PContent.ipdl +@@ -837,6 +837,7 @@ parent: + async SetClipboard(IPCDataTransfer aDataTransfer, + bool aIsPrivateData, + Principal aRequestingPrincipal, ++ uint32_t aContentPolicyType, + int32_t aWhichClipboard); + + // Given a list of supported types, returns the clipboard data for the +diff --git dom/ipc/TabChild.cpp dom/ipc/TabChild.cpp +index 50725636d280..72df59ea98c0 100644 +--- dom/ipc/TabChild.cpp ++++ dom/ipc/TabChild.cpp +@@ -2164,7 +2164,8 @@ TabChild::RecvNormalPrioritySelectionEvent(const WidgetSelectionEvent& aEvent) + mozilla::ipc::IPCResult + TabChild::RecvPasteTransferable(const IPCDataTransfer& aDataTransfer, + const bool& aIsPrivateData, +- const IPC::Principal& aRequestingPrincipal) ++ const IPC::Principal& aRequestingPrincipal, ++ const uint32_t& aContentPolicyType) + { + nsresult rv; + nsCOMPtr<nsITransferable> trans = +@@ -2175,6 +2176,7 @@ TabChild::RecvPasteTransferable(const IPCDataTransfer& aDataTransfer, + rv = nsContentUtils::IPCTransferableToTransferable(aDataTransfer, + aIsPrivateData, + aRequestingPrincipal, ++ aContentPolicyType, + trans, nullptr, this); + NS_ENSURE_SUCCESS(rv, IPC_OK()); + +diff --git dom/ipc/TabChild.h dom/ipc/TabChild.h +index f18906568c1c..48bd8e9eb86e 100644 +--- dom/ipc/TabChild.h ++++ dom/ipc/TabChild.h +@@ -454,7 +454,8 @@ public: + virtual mozilla::ipc::IPCResult + RecvPasteTransferable(const IPCDataTransfer& aDataTransfer, + const bool& aIsPrivateData, +- const IPC::Principal& aRequestingPrincipal) override; ++ const IPC::Principal& aRequestingPrincipal, ++ const uint32_t& aContentPolicyType) override; + + virtual mozilla::ipc::IPCResult + RecvActivateFrameEvent(const nsString& aType, const bool& aCapture) override; +diff --git dom/ipc/TabParent.cpp dom/ipc/TabParent.cpp +index d4e3d11ea2e9..ae43c24e8891 100644 +--- dom/ipc/TabParent.cpp ++++ dom/ipc/TabParent.cpp +@@ -2312,11 +2312,13 @@ TabParent::SendSelectionEvent(WidgetSelectionEvent& aEvent) + bool + TabParent::SendPasteTransferable(const IPCDataTransfer& aDataTransfer, + const bool& aIsPrivateData, +- const IPC::Principal& aRequestingPrincipal) ++ const IPC::Principal& aRequestingPrincipal, ++ const uint32_t& aContentPolicyType) + { + return PBrowserParent::SendPasteTransferable(aDataTransfer, + aIsPrivateData, +- aRequestingPrincipal); ++ aRequestingPrincipal, ++ aContentPolicyType); + } + + /*static*/ TabParent* +diff --git dom/ipc/TabParent.h dom/ipc/TabParent.h +index c31827499403..e3c2601ce0b4 100644 +--- dom/ipc/TabParent.h ++++ dom/ipc/TabParent.h +@@ -497,7 +497,8 @@ public: + + bool SendPasteTransferable(const IPCDataTransfer& aDataTransfer, + const bool& aIsPrivateData, +- const IPC::Principal& aRequestingPrincipal); ++ const IPC::Principal& aRequestingPrincipal, ++ const uint32_t& aContentPolicyType); + + static TabParent* GetFrom(nsFrameLoader* aFrameLoader); + +diff --git widget/nsClipboardProxy.cpp widget/nsClipboardProxy.cpp +index f7d863475b13..4fb90721c0b6 100644 +--- widget/nsClipboardProxy.cpp ++++ widget/nsClipboardProxy.cpp +@@ -37,8 +37,11 @@ nsClipboardProxy::SetData(nsITransferable *aTransferable, + aTransferable->GetIsPrivateData(&isPrivateData); + nsCOMPtr<nsIPrincipal> requestingPrincipal; + aTransferable->GetRequestingPrincipal(getter_AddRefs(requestingPrincipal)); ++ nsContentPolicyType contentPolicyType = nsIContentPolicy::TYPE_OTHER; ++ aTransferable->GetContentPolicyType(&contentPolicyType); + child->SendSetClipboard(ipcDataTransfer, isPrivateData, +- IPC::Principal(requestingPrincipal), aWhichClipboard); ++ IPC::Principal(requestingPrincipal), ++ contentPolicyType, aWhichClipboard); + + return NS_OK; + } Added: head/www/waterfox/files/patch-bug1402380 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/www/waterfox/files/patch-bug1402380 Thu Mar 29 00:53:36 2018 (r465858) @@ -0,0 +1,257 @@ +commit fb06fdcf7d66 +Author: Tooru Fujisawa <arai_a@mac.com> +Date: Sun Mar 25 17:23:48 2018 +0900 + + Bug 1402380 - Set text/x-moz-url flavor of data transfer for places container with URLs inside it. r=enndeakin, a=jcristau + + --HG-- + extra : source : e4cc022b417a1268fa063fe054aa79f3c141c2e2 +--- + .../components/places/tests/browser/browser.ini | 1 + + .../tests/browser/browser_drag_folder_on_newTab.js | 94 ++++++++++++++++++++++ + testing/mochitest/tests/SimpleTest/EventUtils.js | 86 ++++++++++++++++++++ + toolkit/components/places/PlacesUtils.jsm | 11 ++- + 4 files changed, 191 insertions(+), 1 deletion(-) + +diff --git browser/components/places/tests/browser/browser.ini browser/components/places/tests/browser/browser.ini +index 64b7782c5f83..33c4cf5cc416 100644 +--- browser/components/places/tests/browser/browser.ini ++++ browser/components/places/tests/browser/browser.ini +@@ -63,3 +63,4 @@ support-files = + support-files = + bookmark_dummy_1.html + bookmark_dummy_2.html ++[browser_drag_folder_on_newTab.js] +diff --git browser/components/places/tests/browser/browser_drag_folder_on_newTab.js browser/components/places/tests/browser/browser_drag_folder_on_newTab.js +new file mode 100644 +index 000000000000..00646fff18b4 +--- /dev/null ++++ browser/components/places/tests/browser/browser_drag_folder_on_newTab.js +@@ -0,0 +1,94 @@ ++/* Any copyright is dedicated to the Public Domain. ++ * http://creativecommons.org/publicdomain/zero/1.0/ */ ++ ++"use strict"; ++ ++add_task(async function setup() { ++ let toolbar = document.getElementById("PersonalToolbar"); ++ let wasCollapsed = toolbar.collapsed; ++ ++ // Uncollapse the personal toolbar if needed. ++ if (wasCollapsed) { ++ await promiseSetToolbarVisibility(toolbar, true); ++ } ++ ++ // Clean before and after so we don't have anything in the folders. ++ await PlacesUtils.bookmarks.eraseEverything(); ++ ++ registerCleanupFunction(async function() { ++ // Collapse the personal toolbar if needed. ++ if (wasCollapsed) { ++ await promiseSetToolbarVisibility(toolbar, false); ++ } ++ ++ await PlacesUtils.bookmarks.eraseEverything(); ++ }); ++}); ++ ++const TEST_FOLDER_NAME = "Test folder"; ++ ++add_task(async function test_change_location_from_Toolbar() { ++ let newTabButton = document.getElementById("new-tab-button"); ++ ++ let children = [ ++ { ++ title: "first", ++ url: "http://www.mochi.test/first" ++ }, ++ { ++ title: "second", ++ url: "http://www.mochi.test/second" ++ }, ++ { ++ type: PlacesUtils.bookmarks.TYPE_SEPARATOR, ++ }, ++ { ++ title: "third", ++ url: "http://www.mochi.test/third" ++ }, ++ ]; ++ let guid = PlacesUtils.history.makeGuid(); ++ await PlacesUtils.bookmarks.insertTree({ ++ guid: PlacesUtils.bookmarks.toolbarGuid, ++ children: [ ++ { ++ guid, ++ type: PlacesUtils.bookmarks.TYPE_FOLDER, ++ title: TEST_FOLDER_NAME, ++ children, ++ }, ++ ], ++ }); ++ ++ let folder = getToolbarNodeForItemGuid(guid); ++ ++ let loadedPromises = children.filter(item => "url" in item).map( ++ item => BrowserTestUtils.waitForNewTab(gBrowser, item.url, false, true)); ++ ++ let srcX = 10, srcY = 10; ++ // We should drag upwards, since dragging downwards opens menu instead. ++ let stepX = 0, stepY = -5; ++ ++ // We need to dispatch mousemove before dragging, to populate ++ // PlacesToolbar._cachedMouseMoveEvent, with the cursor position after the ++ // first step, so that the places code detects it as dragging upward. ++ EventUtils.synthesizeMouse(folder, srcX + stepX, srcY + stepY, ++ { type: "mousemove" }); ++ ++ await EventUtils.synthesizePlainDragAndDrop({ ++ srcElement: folder, ++ destElement: newTabButton, ++ srcX, ++ srcY, ++ stepX, ++ stepY, ++ }); ++ ++ let tabs = await Promise.all(loadedPromises); ++ ++ for (let tab of tabs) { ++ BrowserTestUtils.removeTab(tab); ++ } ++ ++ ok(true); ++}); +diff --git testing/mochitest/tests/SimpleTest/EventUtils.js testing/mochitest/tests/SimpleTest/EventUtils.js +index cad43966d91d..907cf60dc254 100644 +--- testing/mochitest/tests/SimpleTest/EventUtils.js ++++ testing/mochitest/tests/SimpleTest/EventUtils.js +@@ -17,6 +17,7 @@ + * synthesizeMouseExpectEvent + * synthesizeKeyExpectEvent + * synthesizeNativeOSXClick ++ * synthesizePlainDragAndDrop + * + * When adding methods to this file, please add a performance test for it. + */ +@@ -2161,6 +2162,91 @@ function synthesizeDrop(aSrcElement, aDestElement, aDragData, aDropEffect, aWind + } + } + ++/** ++ * Emulate a drag and drop by emulating a dragstart by mousedown and mousemove, ++ * and firing events dragenter, dragover, drop, and mouseup. ++ * This does not modify dataTransfer and tries to emulate the plain drag and ++ * drop as much as possible, compared to synthesizeDrop. ++ * ++ * @param aParams ++ * { ++ * srcElement: The element to start dragging ++ * destElement: The element to drop on ++ * srcX: The initial x coordinate inside srcElement ++ * srcY: The initial y coordinate inside srcElement ++ * stepX: The x-axis step for mousemove inside srcElement ++ * stepY: The y-axis step for mousemove inside srcElement ++ * destX: The x coordinate inside destElement ++ * destY: The x coordinate inside destElement ++ * srcWindow: The window for dispatching event on srcElement, ++ * defaults to the current window object ++ * destWindow: The window for dispatching event on destElement, ++ * defaults to the current window object ++ * } ++ */ ++async function synthesizePlainDragAndDrop(aParams) ++{ ++ let { ++ srcElement, ++ destElement, ++ srcX = 2, ++ srcY = 2, ++ stepX = 9, ++ stepY = 9, ++ destX = 2, ++ destY = 2, ++ srcWindow = window, ++ destWindow = window, ++ } = aParams; ++ ++ const ds = _EU_Cc["@mozilla.org/widget/dragservice;1"] ++ .getService(_EU_Ci.nsIDragService); ++ ds.startDragSession(); ++ ++ try { ++ let dataTransfer = null; ++ function trapDrag(aEvent) { ++ dataTransfer = aEvent.dataTransfer; ++ } ++ srcElement.addEventListener("dragstart", trapDrag, true); ++ synthesizeMouse(srcElement, srcX, srcY, { type: "mousedown" }, srcWindow); ++ ++ // Wait for the next event tick after each event dispatch, so that UI elements ++ // (e.g. menu) work like the real user input. ++ await new Promise(r => setTimeout(r, 0)); ++ ++ srcX += stepX; srcY += stepY; ++ synthesizeMouse(srcElement, srcX, srcY, { type: "mousemove" }, srcWindow); ++ ++ await new Promise(r => setTimeout(r, 0)); ++ ++ srcX += stepX; srcY += stepY; ++ synthesizeMouse(srcElement, srcX, srcY, { type: "mousemove" }, srcWindow); ++ ++ await new Promise(r => setTimeout(r, 0)); ++ ++ srcElement.removeEventListener("dragstart", trapDrag, true); ++ ++ await new Promise(r => setTimeout(r, 0)); ++ ++ let event = createDragEventObject("dragover", destElement, destWindow, ++ dataTransfer, {}); ++ sendDragEvent(event, destElement, destWindow); ++ ++ await new Promise(r => setTimeout(r, 0)); ++ ++ event = createDragEventObject("drop", destElement, destWindow, ++ dataTransfer, {}); ++ sendDragEvent(event, destElement, destWindow); ++ ++ await new Promise(r => setTimeout(r, 0)); ++ ++ synthesizeMouseAtCenter(destElement, { type: "mouseup" }, destWindow); ++ } finally { ++ ds.endDragSession(true, 0); ++ } ++} ++ + var PluginUtils = + { + withTestPlugin : function(callback) +diff --git toolkit/components/places/PlacesUtils.jsm toolkit/components/places/PlacesUtils.jsm +index f6315f68eb4c..5aebe0496ee8 100644 +--- toolkit/components/places/PlacesUtils.jsm ++++ toolkit/components/places/PlacesUtils.jsm +@@ -896,6 +896,11 @@ this.PlacesUtils = { + case this.TYPE_X_MOZ_URL: { + if (aFeedURI || PlacesUtils.nodeIsURI(aNode)) + return (aFeedURI || aNode.uri) + NEWLINE + aNode.title; ++ if (PlacesUtils.nodeIsContainer(aNode)) { ++ return PlacesUtils.getURLsForContainerNode(aNode) ++ .map(item => item.uri + "\n" + item.title) ++ .join("\n"); ++ } + return ""; + } + case this.TYPE_HTML: { +@@ -1491,7 +1496,11 @@ this.PlacesUtils = { + for (let i = 0; i < root.childCount; ++i) { + let child = root.getChild(i); + if (this.nodeIsURI(child)) +- urls.push({uri: child.uri, isBookmark: this.nodeIsBookmark(child)}); ++ urls.push({ ++ uri: child.uri, ++ isBookmark: this.nodeIsBookmark(child), ++ title: child.title, ++ }); + } + + if (!wasOpen) { Added: head/www/waterfox/files/patch-bug1409440 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/www/waterfox/files/patch-bug1409440 Thu Mar 29 00:53:36 2018 (r465858) @@ -0,0 +1,89 @@ +commit 362d0bb251e6 +Author: Andrew Osmond <aosmond@mozilla.com> +Date: Tue Mar 27 09:01:14 2018 -0400 + + Bug 1409440. r=tnikkel, a=RyanVM + + --HG-- + extra : source : 52c14d32d9812951c12d92b2594056fc15c5de80 +--- + image/Downscaler.cpp | 14 ++++++++++---- + image/DownscalingFilter.h | 14 ++++++++++---- + 2 files changed, 20 insertions(+), 8 deletions(-) + +diff --git image/Downscaler.cpp image/Downscaler.cpp +index 475d18319a19..f97d067720b6 100644 +--- image/Downscaler.cpp ++++ image/Downscaler.cpp +@@ -195,13 +195,14 @@ Downscaler::CommitRow() + int32_t inLineToRead = filterOffset + mLinesInBuffer; + MOZ_ASSERT(mCurrentInLine <= inLineToRead, "Reading past end of input"); + if (mCurrentInLine == inLineToRead) { ++ MOZ_RELEASE_ASSERT(mLinesInBuffer < mWindowCapacity, "Need more rows than capacity!"); + mXFilter.ConvolveHorizontally(mRowBuffer.get(), mWindow[mLinesInBuffer++], mHasAlpha); + } + + MOZ_ASSERT(mCurrentOutLine < mTargetSize.height, + "Writing past end of output"); + +- while (mLinesInBuffer == filterLength) { ++ while (mLinesInBuffer >= filterLength) { + DownscaleInputLine(); + + if (mCurrentOutLine == mTargetSize.height) { +@@ -297,9 +298,14 @@ Downscaler::DownscaleInputLine() + + // Shift the buffer. We're just moving pointers here, so this is cheap. + mLinesInBuffer -= diff; +- mLinesInBuffer = max(mLinesInBuffer, 0); +- for (int32_t i = 0; i < mLinesInBuffer; ++i) { +- swap(mWindow[i], mWindow[filterLength - mLinesInBuffer + i]); ++ mLinesInBuffer = min(max(mLinesInBuffer, 0), mWindowCapacity); ++ ++ // If we already have enough rows to satisfy the filter, there is no need ++ // to swap as we won't be writing more before the next convolution. ++ if (filterLength > mLinesInBuffer) { ++ for (int32_t i = 0; i < mLinesInBuffer; ++i) { ++ swap(mWindow[i], mWindow[filterLength - mLinesInBuffer + i]); ++ } + } + } + +diff --git image/DownscalingFilter.h image/DownscalingFilter.h +index 6f516d0e0d90..764aade2e63b 100644 +--- image/DownscalingFilter.h ++++ image/DownscalingFilter.h +@@ -232,13 +232,14 @@ protected: + int32_t inputRowToRead = filterOffset + mRowsInWindow; + MOZ_ASSERT(mInputRow <= inputRowToRead, "Reading past end of input"); + if (mInputRow == inputRowToRead) { ++ MOZ_RELEASE_ASSERT(mRowsInWindow < mWindowCapacity, "Need more rows than capacity!"); + mXFilter.ConvolveHorizontally(mRowBuffer.get(), mWindow[mRowsInWindow++], mHasAlpha); + } + + MOZ_ASSERT(mOutputRow < mNext.InputSize().height, + "Writing past end of output"); + +- while (mRowsInWindow == filterLength) { ++ while (mRowsInWindow >= filterLength) { + DownscaleInputRow(); + + if (mOutputRow == mNext.InputSize().height) { +@@ -297,9 +298,14 @@ private: + + // Shift the buffer. We're just moving pointers here, so this is cheap. + mRowsInWindow -= diff; +- mRowsInWindow = std::max(mRowsInWindow, 0); +- for (int32_t i = 0; i < mRowsInWindow; ++i) { +- std::swap(mWindow[i], mWindow[filterLength - mRowsInWindow + i]); ++ mRowsInWindow = std::min(std::max(mRowsInWindow, 0), mWindowCapacity); ++ ++ // If we already have enough rows to satisfy the filter, there is no need ++ // to swap as we won't be writing more before the next convolution. ++ if (filterLength > mRowsInWindow) { ++ for (int32_t i = 0; i < mRowsInWindow; ++i) { ++ std::swap(mWindow[i], mWindow[filterLength - mRowsInWindow + i]); ++ } + } + } + Added: head/www/waterfox/files/patch-bug1416045 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/www/waterfox/files/patch-bug1416045 Thu Mar 29 00:53:36 2018 (r465858) @@ -0,0 +1,338 @@ +commit 5d7b84950d03 +Author: vinoth <cegvinoth@gmail.com> +Date: Thu Mar 22 21:02:16 2018 +0200 + + Bug 1416045. r=mayhemer, a=RyanVM + + Reviewers: mayhemer + + Reviewed By: mayhemer + + Subscribers: freddyb, dveditz, mayhemer, ckerschb, vinoth + + Tags: PHID-PROJ-wkydohdk6pajyfn2llkb + + Bug #: 1416045 + + Differential Revision: https://phabricator.services.mozilla.com/D675 + + --HG-- + extra : source : a0a2092724797e534549cc2d80dc9c423bfaf43d + extra : amend_source : f1ddea498e322b79b6d1b9af45c7e04832f43ed1 +--- + .../test/csp/file_multipart_testserver.sjs | 110 ++++++++++++++++++++- + dom/security/test/csp/test_multipartchannel.html | 42 +++++++- + netwerk/streamconv/converters/nsMultiMixedConv.cpp | 36 +++++++ + netwerk/streamconv/converters/nsMultiMixedConv.h | 3 + + 4 files changed, 182 insertions(+), 9 deletions(-) + +diff --git dom/security/test/csp/file_multipart_testserver.sjs dom/security/test/csp/file_multipart_testserver.sjs +index d2eb58c82b52..3934df0a9572 100644 +--- dom/security/test/csp/file_multipart_testserver.sjs ++++ dom/security/test/csp/file_multipart_testserver.sjs +@@ -1,8 +1,11 @@ + // SJS file specifically for the needs of bug +-// Bug 1223743 - CSP: Check baseChannel for CSP when loading multipart channel ++// Bug 1416045/Bug 1223743 - CSP: Check baseChannel for CSP when loading multipart channel + + var CSP = "script-src 'unsafe-inline', img-src 'none'"; +-var BOUNDARY = "fooboundary" ++var rootCSP = "script-src 'unsafe-inline'"; ++var part1CSP = "img-src *"; ++var part2CSP = "img-src 'none'"; ++var BOUNDARY = "fooboundary"; + + // small red image + const IMG_BYTES = atob( +@@ -14,16 +17,72 @@ var RESPONSE = ` + var myImg = new Image; + myImg.src = "file_multipart_testserver.sjs?img"; + myImg.onerror = function(e) { +- window.parent.postMessage("img-blocked", "*"); ++ window.parent.postMessage({"test": "rootCSP_test", ++ "msg": "img-blocked"}, "*"); + }; + myImg.onload = function() { +- window.parent.postMessage("img-loaded", "*"); ++ window.parent.postMessage({"test": "rootCSP_test", ++ "msg": "img-loaded"}, "*"); + }; + document.body.appendChild(myImg); + </script> + `; + +-var myTimer; ++var RESPONSE1 = ` ++ <body> ++ <script> ++ var triggerNextPartFrame = document.createElement('iframe'); ++ var myImg = new Image; ++ myImg.src = "file_multipart_testserver.sjs?img"; ++ myImg.onerror = function(e) { ++ window.parent.postMessage({"test": "part1CSP_test", ++ "msg": "part1-img-blocked"}, "*"); ++ triggerNextPartFrame.src = 'file_multipart_testserver.sjs?sendnextpart'; ++ }; ++ myImg.onload = function() { ++ window.parent.postMessage({"test": "part1CSP_test", ++ "msg": "part1-img-loaded"}, "*"); ++ triggerNextPartFrame.src = 'file_multipart_testserver.sjs?sendnextpart'; ++ }; ++ document.body.appendChild(myImg); ++ document.body.appendChild(triggerNextPartFrame); ++ </script> ++ </body> ++`; ++ ++var RESPONSE2 = ` ++ <body> ++ <script> ++ var myImg = new Image; ++ myImg.src = "file_multipart_testserver.sjs?img"; ++ myImg.onerror = function(e) { ++ window.parent.postMessage({"test": "part2CSP_test", ++ "msg": "part2-img-blocked"}, "*"); ++ }; ++ myImg.onload = function() { ++ window.parent.postMessage({"test": "part2CSP_test", ++ "msg": "part2-img-loaded"}, "*"); ++ }; ++ document.body.appendChild(myImg); ++ </script> ++ </body> ++`; ++ ++function setGlobalState(data, key) ++{ ++ x = { data: data, QueryInterface: function(iid) { return this } }; ++ x.wrappedJSObject = x; ++ setObjectState(key, x); ++} ++ ++function getGlobalState(key) ++{ ++ var data; ++ getObjectState(key, function(x) { ++ data = x && x.wrappedJSObject.data; ++ }); ++ return data; ++} + + function handleRequest(request, response) + { +@@ -39,6 +98,29 @@ function handleRequest(request, response) + return; + } + ++ if (request.queryString == "partcspdoc") { ++ response.setHeader("Content-Security-Policy", rootCSP, false); ++ response.setHeader("Content-Type", ++ "multipart/x-mixed-replace; boundary=" + BOUNDARY, false); ++ response.setStatusLine(request.httpVersion, 200, "OK"); ++ response.processAsync(); ++ response.write("--"+BOUNDARY+"\r\n"); ++ sendNextPart(response, 1); ++ return; ++ } ++ ++ if (request.queryString == "sendnextpart") { ++ response.setStatusLine(request.httpVersion, 204, "No content"); ++ var blockedResponse = getGlobalState("root-document-response"); ++ if (typeof blockedResponse == "object") { ++ sendNextPart(blockedResponse, 2); ++ sendClose(blockedResponse); ++ } else { ++ dump("Couldn't find the stored response object."); ++ } ++ return; ++ } ++ + if (request.queryString == "img") { + response.setHeader("Content-Type", "image/png"); + response.write(IMG_BYTES); +@@ -48,3 +130,21 @@ function handleRequest(request, response) + // we should never get here - return something unexpected + response.write("d'oh"); + } ++ ++function sendClose(response) { ++ response.write("--"+BOUNDARY+"--\r\n"); ++ response.finish(); ++} ++ ++function sendNextPart(response, partNumber) { ++ response.write("Content-type: text/html" + "\r\n"); ++ if (partNumber == 1) { ++ response.write("Content-Security-Policy:" + part1CSP + "\r\n"); ++ response.write(RESPONSE1); ++ setGlobalState(response, "root-document-response"); ++ } else { ++ response.write("Content-Security-Policy:" + part2CSP + "\r\n"); ++ response.write(RESPONSE2); ++ } ++ response.write("--"+BOUNDARY+"\r\n"); ++} +diff --git dom/security/test/csp/test_multipartchannel.html dom/security/test/csp/test_multipartchannel.html +index 120f9712d0e0..1c03157cc0b4 100644 +--- dom/security/test/csp/test_multipartchannel.html ++++ dom/security/test/csp/test_multipartchannel.html +@@ -2,32 +2,66 @@ + <html> + <head> + <meta charset="utf-8"> +- <title>Bug 1223743 - CSP: Check baseChannel for CSP when loading multipart channel</title> ++ <title>Bug 1416045/Bug 1223743 - CSP: Check baseChannel for CSP when loading multipart channel</title> + <!-- Including SimpleTest.js so we can use waitForExplicitFinish !--> + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> + </head> + <body> + <iframe style="width:100%;" id="testframe"></iframe> ++<iframe style="width:100%;" id="testPartCSPframe"></iframe> + + <script class="testbody" type="text/javascript"> + ++var testsToRunMultipartCSP = { ++ rootCSP_test: false, ++ part1CSP_test: false, ++ part2CSP_test: false, ++}; ++ + SimpleTest.waitForExplicitFinish(); + ++function checkTestsCompleted() { ++ for (var prop in testsToRunMultipartCSP) { ++ // some test hasn't run yet so we're not done ++ if (!testsToRunMultipartCSP[prop]) { ++ return; ++ } ++ } ++ window.removeEventListener("message", receiveMessage); ++ SimpleTest.finish(); ++} + /* Description of the test: + * We apply a CSP to a multipart channel and then try to load an image + * within a segment making sure the image is blocked correctly by CSP. ++ * We also provide CSP for each part and try to load an image in each ++ * part and make sure the image is loaded in first part and blocked in ++ * second part correctly based on its CSP accordingly. + */ + + window.addEventListener("message", receiveMessage); + function receiveMessage(event) { +- is(event.data, "img-blocked", "image should be blocked"); +- window.removeEventListener("message", receiveMessage); +- SimpleTest.finish(); ++ switch (event.data.test) { ++ case "rootCSP_test": ++ is(event.data.msg, "img-blocked", "image should be blocked"); ++ testsToRunMultipartCSP["rootCSP_test"] = true; ++ break; ++ case "part1CSP_test": ++ is(event.data.msg, "part1-img-loaded", "Part1 image should be loaded"); ++ testsToRunMultipartCSP["part1CSP_test"] = true; ++ break; ++ case "part2CSP_test": ++ is(event.data.msg, "part2-img-blocked", "Part2 image should be blocked"); ++ testsToRunMultipartCSP["part2CSP_test"] = true; ++ break; ++ } ++ checkTestsCompleted(); + } + + // start the test + document.getElementById("testframe").src = "file_multipart_testserver.sjs?doc"; ++document.getElementById("testPartCSPframe").src = ++ "file_multipart_testserver.sjs?partcspdoc"; + + </script> + </body> +diff --git netwerk/streamconv/converters/nsMultiMixedConv.cpp netwerk/streamconv/converters/nsMultiMixedConv.cpp +index 1af800eb8d90..80cb030a6fab 100644 +--- netwerk/streamconv/converters/nsMultiMixedConv.cpp ++++ netwerk/streamconv/converters/nsMultiMixedConv.cpp +@@ -488,6 +488,12 @@ nsMultiMixedConv::OnStartRequest(nsIRequest *request, nsISupports *ctxt) + if (NS_FAILED(rv)) { + return rv; + } ++ nsCString csp; ++ rv = httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("content-security-policy"), ++ csp); ++ if (NS_SUCCEEDED(rv)) { ++ mRootContentSecurityPolicy = csp; ++ } + } else { + // try asking the channel directly + rv = mChannel->GetContentType(contentType); +@@ -528,6 +534,10 @@ nsMultiMixedConv::OnStartRequest(nsIRequest *request, nsISupports *ctxt) + mTokenizer.AddCustomToken("content-range", mTokenizer.CASE_INSENSITIVE, false); + mHeaderTokens[HEADER_RANGE] = + mTokenizer.AddCustomToken("range", mTokenizer.CASE_INSENSITIVE, false); ++ mHeaderTokens[HEADER_CONTENT_SECURITY_POLICY] = ++ mTokenizer.AddCustomToken("content-security-policy", ++ mTokenizer.CASE_INSENSITIVE, ++ false); + + mLFToken = mTokenizer.AddCustomToken("\n", mTokenizer.CASE_SENSITIVE, false); + mCRLFToken = mTokenizer.AddCustomToken("\r\n", mTokenizer.CASE_SENSITIVE, false); +@@ -1001,6 +1011,7 @@ nsMultiMixedConv::HeadersToDefault() + mContentLength = UINT64_MAX; + mContentType.Truncate(); + mContentDisposition.Truncate(); ++ mContentSecurityPolicy.Truncate(); + mIsByteRangeRequest = false; + } + +@@ -1053,6 +1064,31 @@ nsMultiMixedConv::ProcessHeader() + } + break; + } ++ case HEADER_CONTENT_SECURITY_POLICY: { ++ mContentSecurityPolicy = mResponseHeaderValue; ++ mContentSecurityPolicy.CompressWhitespace(); ++ nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(mChannel); ++ if (httpChannel) { ++ nsCString resultCSP = mRootContentSecurityPolicy; ++ if (!mContentSecurityPolicy.IsEmpty()) { ++ // We are updating the root channel CSP header respectively for ++ // each part as: CSP-root + CSP-partN, where N is the part number. ++ // Here we append current part's CSP to root CSP and reset CSP ++ // header for each part. ++ if (!resultCSP.IsEmpty()) { ++ resultCSP.Append(";"); ++ } ++ resultCSP.Append(mContentSecurityPolicy); ++ } ++ nsresult rv = httpChannel->SetResponseHeader( ++ NS_LITERAL_CSTRING("Content-Security-Policy"), ++ resultCSP, false); ++ if (NS_FAILED(rv)) { ++ return NS_ERROR_CORRUPTED_CONTENT; ++ } ++ } ++ break; ++ } + case HEADER_UNKNOWN: + // We ignore anything else... + break; +diff --git netwerk/streamconv/converters/nsMultiMixedConv.h netwerk/streamconv/converters/nsMultiMixedConv.h +index b46a094608a5..fdd7e73c7fd1 100644 +--- netwerk/streamconv/converters/nsMultiMixedConv.h ++++ netwerk/streamconv/converters/nsMultiMixedConv.h +@@ -151,6 +151,8 @@ protected: + nsCOMPtr<nsISupports> mContext; + nsCString mContentType; + nsCString mContentDisposition; ++ nsCString mContentSecurityPolicy; ++ nsCString mRootContentSecurityPolicy; + uint64_t mContentLength; + uint64_t mTotalSent; + +@@ -198,6 +200,7 @@ protected: + HEADER_SET_COOKIE, + HEADER_CONTENT_RANGE, + HEADER_RANGE, ++ HEADER_CONTENT_SECURITY_POLICY, + HEADER_UNKNOWN + } mResponseHeader; + // Cumulated value of a response header. Added: head/www/waterfox/files/patch-bug1433609 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/www/waterfox/files/patch-bug1433609 Thu Mar 29 00:53:36 2018 (r465858) @@ -0,0 +1,103 @@ +commit 9d65f87e8479 +Author: Valentin Gosu <valentin.gosu@gmail.com> +Date: Wed Feb 14 14:40:05 2018 +0100 + + Bug 1433609 - Ensure that deserialized URL is correct. r=mayhemer, a=RyanVM + + MozReview-Commit-ID: BMQfPzPhDhc + + --HG-- + extra : source : d0da2be2c9508f48b8e4804bd4a4ca3b37b56d4f +--- + netwerk/base/nsStandardURL.cpp | 64 ++++++++++++++++++++++++++++++++---------- + 1 file changed, 49 insertions(+), 15 deletions(-) + +diff --git netwerk/base/nsStandardURL.cpp netwerk/base/nsStandardURL.cpp +index 85ab13fed7ae..67dc701e7272 100644 +--- netwerk/base/nsStandardURL.cpp ++++ netwerk/base/nsStandardURL.cpp +@@ -3726,10 +3726,29 @@ ToIPCSegment(const nsStandardURL::URLSegment& aSegment) + } + + inline +-nsStandardURL::URLSegment +-FromIPCSegment(const ipc::StandardURLSegment& aSegment) ++MOZ_MUST_USE bool ++FromIPCSegment(const nsACString& aSpec, const ipc::StandardURLSegment& aSegment, nsStandardURL::URLSegment& aTarget) + { +- return nsStandardURL::URLSegment(aSegment.position(), aSegment.length()); ++ // This seems to be just an empty segment. ++ if (aSegment.length() == -1) { ++ aTarget = nsStandardURL::URLSegment(); ++ return true; ++ } ++ ++ // A value of -1 means an empty segment, but < -1 is undefined. ++ if (NS_WARN_IF(aSegment.length() < -1)) { ++ return false; ++ } ++ ++ // Make sure the segment does not extend beyond the spec. ++ if (NS_WARN_IF(aSegment.position() + aSegment.length() > aSpec.Length())) { ++ return false; ++ } ++ ++ aTarget.mPos = aSegment.position(); ++ aTarget.mLen = aSegment.length(); ++ ++ return true; + } + + void +@@ -3797,24 +3816,39 @@ nsStandardURL::Deserialize(const URIParams& aParams) + mPort = params.port(); + mDefaultPort = params.defaultPort(); + mSpec = params.spec(); +- mScheme = FromIPCSegment(params.scheme()); +- mAuthority = FromIPCSegment(params.authority()); +- mUsername = FromIPCSegment(params.username()); +- mPassword = FromIPCSegment(params.password()); *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201803290053.w2T0raXq017067>