Bug 1487263 - set requesting principal for macOS drags, r=mstange
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Thu, 30 Aug 2018 13:56:44 +0000
changeset 434087 57204974417c9b9feaba3c2306624f3dd5d57d12
parent 434086 037dab36696a698bb5859ea14318a8ca99379b57
child 434088 396e4cc1baef39466a97905f9b17356f8c9b5a20
push id34538
push userrgurzau@mozilla.com
push dateThu, 30 Aug 2018 21:48:04 +0000
treeherdermozilla-central@c45b51ec248e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1487263, 664717
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1487263 - set requesting principal for macOS drags, r=mstange The requesting principal is now required for saving content through nsIWebBrowserPersist, and so drag sessions on macOS need to provide one, just like drag sessions on Windows already do (see bug 664717). Differential Revision: https://phabricator.services.mozilla.com/D4673
widget/cocoa/nsDragService.mm
--- a/widget/cocoa/nsDragService.mm
+++ b/widget/cocoa/nsDragService.mm
@@ -321,16 +321,19 @@ nsDragService::InvokeDragSessionImpl(nsI
 
     for (uint32_t j = 0; j < count; j++) {
       nsCOMPtr<nsITransferable> currentTransferable =
         do_QueryElementAt(aTransferableArray, j);
       if (!currentTransferable) {
         return NS_ERROR_FAILURE;
       }
 
+      // Assign a principal:
+      currentTransferable->SetRequestingPrincipal(mSourceNode->NodePrincipal());
+
       // Transform the transferable to an NSDictionary
       NSDictionary* pasteboardOutputDict =
         nsClipboard::PasteboardDictFromTransferable(currentTransferable);
       if (!pasteboardOutputDict) {
         return NS_ERROR_FAILURE;
       }
 
       // write everything out to the general pasteboard