Bug 1509384 - Use IPC::Principal instead of Principal URI string in Drag-and-Drop. r=smaug
authorTooru Fujisawa <arai_a@mac.com>
Fri, 04 Jan 2019 03:16:46 +0000
changeset 509605 32f94b7a8db69e3ab86135182fe8e43ea6926767
parent 509604 129f8c60783c4daba0c04106c3082c2f94890b66
child 509606 a10fd3e50ab84f5d82ec1fb61e8c5053c4fcc0c3
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1509384
milestone66.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 1509384 - Use IPC::Principal instead of Principal URI string in Drag-and-Drop. r=smaug Differential Revision: https://phabricator.services.mozilla.com/D13728
dom/base/nsContentAreaDragDrop.cpp
dom/base/nsContentAreaDragDrop.h
dom/events/DataTransfer.cpp
dom/events/EventStateManager.cpp
dom/events/EventStateManager.h
dom/ipc/PBrowser.ipdl
dom/ipc/TabChild.cpp
dom/ipc/TabChild.h
dom/ipc/TabParent.cpp
dom/ipc/TabParent.h
widget/gtk/nsDragService.cpp
widget/gtk/nsDragService.h
widget/nsBaseDragService.cpp
widget/nsBaseDragService.h
widget/nsDragServiceProxy.cpp
widget/nsIDragService.idl
widget/nsIDragSession.idl
--- a/dom/base/nsContentAreaDragDrop.cpp
+++ b/dom/base/nsContentAreaDragDrop.cpp
@@ -58,17 +58,17 @@ using namespace mozilla::dom;
 using mozilla::IgnoreErrors;
 
 class MOZ_STACK_CLASS DragDataProducer {
  public:
   DragDataProducer(nsPIDOMWindowOuter* aWindow, nsIContent* aTarget,
                    nsIContent* aSelectionTargetNode, bool aIsAltKeyPressed);
   nsresult Produce(DataTransfer* aDataTransfer, bool* aCanDrag,
                    Selection** aSelection, nsIContent** aDragNode,
-                   nsACString& aPrincipalURISpec);
+                   nsIPrincipal** aPrincipal);
 
  private:
   void AddString(DataTransfer* aDataTransfer, const nsAString& aFlavor,
                  const nsAString& aData, nsIPrincipal* aPrincipal,
                  bool aHidden = false);
   nsresult AddStringsToDataTransfer(nsIContent* aDragNode,
                                     DataTransfer* aDataTransfer);
   nsresult GetImageData(imgIContainer* aImage, imgIRequest* aRequest);
@@ -103,25 +103,25 @@ class MOZ_STACK_CLASS DragDataProducer {
   bool mIsAnchor;
   nsCOMPtr<imgIContainer> mImage;
 };
 
 nsresult nsContentAreaDragDrop::GetDragData(
     nsPIDOMWindowOuter* aWindow, nsIContent* aTarget,
     nsIContent* aSelectionTargetNode, bool aIsAltKeyPressed,
     DataTransfer* aDataTransfer, bool* aCanDrag, Selection** aSelection,
-    nsIContent** aDragNode, nsACString& aPrincipalURISpec) {
+    nsIContent** aDragNode, nsIPrincipal** aPrincipal) {
   NS_ENSURE_TRUE(aSelectionTargetNode, NS_ERROR_INVALID_ARG);
 
   *aCanDrag = true;
 
   DragDataProducer provider(aWindow, aTarget, aSelectionTargetNode,
                             aIsAltKeyPressed);
   return provider.Produce(aDataTransfer, aCanDrag, aSelection, aDragNode,
-                          aPrincipalURISpec);
+                          aPrincipal);
 }
 
 NS_IMPL_ISUPPORTS(nsContentAreaDragDropDataProvider, nsIFlavorDataProvider)
 
 // SaveURIToFile
 // used on platforms where it's possible to drag items (e.g. images)
 // into the file system
 nsresult nsContentAreaDragDropDataProvider::SaveURIToFile(
@@ -478,17 +478,17 @@ nsresult DragDataProducer::GetImageData(
   }
 
   return NS_OK;
 }
 
 nsresult DragDataProducer::Produce(DataTransfer* aDataTransfer, bool* aCanDrag,
                                    Selection** aSelection,
                                    nsIContent** aDragNode,
-                                   nsACString& aPrincipalURISpec) {
+                                   nsIPrincipal** aPrincipal) {
   MOZ_ASSERT(aCanDrag && aSelection && aDataTransfer && aDragNode,
              "null pointer passed to Produce");
   NS_ASSERTION(mWindow, "window not set");
   NS_ASSERTION(mSelectionTargetNode,
                "selection target node should have been set");
 
   *aDragNode = nullptr;
 
@@ -543,17 +543,17 @@ nsresult DragDataProducer::Produce(DataT
     nsCOMPtr<nsIFrameLoaderOwner> flo = do_QueryInterface(mTarget);
     if (flo) {
       RefPtr<nsFrameLoader> fl = flo->GetFrameLoader();
       if (fl) {
         TabParent* tp = static_cast<TabParent*>(fl->GetRemoteBrowser());
         if (tp) {
           // We have a TabParent, so it may have data for dnd in case the child
           // process started a dnd session.
-          tp->AddInitialDnDDataTo(aDataTransfer, aPrincipalURISpec);
+          tp->AddInitialDnDDataTo(aDataTransfer, aPrincipal);
         }
       }
     }
     return NS_OK;
   }
 
   if (isChromeShell && textControl) {
     // Only use the selection if the target node is in the selection.
--- a/dom/base/nsContentAreaDragDrop.h
+++ b/dom/base/nsContentAreaDragDrop.h
@@ -41,28 +41,27 @@ class nsContentAreaDragDrop {
    *                    not drag the link.
    * aDataTransfer - the dataTransfer for the drag event.
    * aCanDrag - [out] set to true if the drag may proceed, false to stop the
    *            drag entirely
    * aSelection - [out] set to the selection being dragged, or null if no
    *                    selection is being dragged.
    * aDragNode - [out] the link, image or area being dragged, or null if the
    *             drag occurred on another element.
-   * aPrincipalURISpec - [out] set to the URI of the triggering principal of
-   *                           the drag, or empty string if it's from
-   *                           browser chrome or OS
+   * aPrincipal - [out] set to the triggering principal of the drag, or null if
+   *                    it's from browser chrome or OS
    */
   static nsresult GetDragData(nsPIDOMWindowOuter* aWindow, nsIContent* aTarget,
                               nsIContent* aSelectionTargetNode,
                               bool aIsAltKeyPressed,
                               mozilla::dom::DataTransfer* aDataTransfer,
                               bool* aCanDrag,
                               mozilla::dom::Selection** aSelection,
                               nsIContent** aDragNode,
-                              nsACString& aPrincipalURISpec);
+                              nsIPrincipal** aPrincipal);
 };
 
 // this is used to save images to disk lazily when the image data is asked for
 // during the drop instead of when it is added to the drag data transfer. This
 // ensures that the image data is only created when an image drop is allowed.
 class nsContentAreaDragDropDataProvider : public nsIFlavorDataProvider {
   virtual ~nsContentAreaDragDropDataProvider() {}
 
--- a/dom/events/DataTransfer.cpp
+++ b/dom/events/DataTransfer.cpp
@@ -239,19 +239,38 @@ void DataTransfer::SetEffectAllowed(cons
 void DataTransfer::GetMozTriggeringPrincipalURISpec(
     nsAString& aPrincipalURISpec) {
   nsCOMPtr<nsIDragSession> dragSession = nsContentUtils::GetDragSession();
   if (!dragSession) {
     aPrincipalURISpec.Truncate(0);
     return;
   }
 
-  nsCString principalURISpec;
-  dragSession->GetTriggeringPrincipalURISpec(principalURISpec);
-  CopyUTF8toUTF16(principalURISpec, aPrincipalURISpec);
+  nsCOMPtr<nsIPrincipal> principal;
+  dragSession->GetTriggeringPrincipal(getter_AddRefs(principal));
+  if (!principal) {
+    aPrincipalURISpec.Truncate(0);
+    return;
+  }
+
+  nsCOMPtr<nsIURI> uri;
+  principal->GetURI(getter_AddRefs(uri));
+  if (!uri) {
+    aPrincipalURISpec.Truncate(0);
+    return;
+  }
+
+  nsAutoCString spec;
+  nsresult rv = uri->GetSpec(spec);
+  if (NS_FAILED(rv)) {
+    aPrincipalURISpec.Truncate(0);
+    return;
+  }
+
+  CopyUTF8toUTF16(spec, aPrincipalURISpec);
 }
 
 already_AddRefed<FileList> DataTransfer::GetFiles(
     nsIPrincipal& aSubjectPrincipal) {
   return mItems->Files(&aSubjectPrincipal);
 }
 
 void DataTransfer::GetTypes(nsTArray<nsString>& aTypes,
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -1245,30 +1245,30 @@ void EventStateManager::DispatchCrossPro
       if (tabParent->Manager()->IsContentParent()) {
         tabParent->Manager()->AsContentParent()->MaybeInvokeDragSession(
             tabParent);
       }
 
       nsCOMPtr<nsIDragSession> dragSession = nsContentUtils::GetDragSession();
       uint32_t dropEffect = nsIDragService::DRAGDROP_ACTION_NONE;
       uint32_t action = nsIDragService::DRAGDROP_ACTION_NONE;
-      nsCString principalURISpec;
+      nsCOMPtr<nsIPrincipal> principal;
       if (dragSession) {
         dragSession->DragEventDispatchedToChildProcess();
         dragSession->GetDragAction(&action);
-        dragSession->GetTriggeringPrincipalURISpec(principalURISpec);
+        dragSession->GetTriggeringPrincipal(getter_AddRefs(principal));
         RefPtr<DataTransfer> initialDataTransfer =
             dragSession->GetDataTransfer();
         if (initialDataTransfer) {
           dropEffect = initialDataTransfer->DropEffectInt();
         }
       }
 
       tabParent->SendRealDragEvent(*aEvent->AsDragEvent(), action, dropEffect,
-                                   principalURISpec);
+                                   IPC::Principal(principal));
       return;
     }
     case ePluginEventClass: {
       *aStatus = nsEventStatus_eConsumeNoDefault;
       remote->SendPluginEvent(*aEvent->AsPluginEvent());
       return;
     }
     default: { MOZ_CRASH("Attempt to send non-whitelisted event?"); }
@@ -1743,22 +1743,22 @@ void EventStateManager::GenerateDragGest
       auto protectDataTransfer = MakeScopeExit([&] {
         if (dataTransfer) {
           dataTransfer->Disconnect();
         }
       });
 
       RefPtr<Selection> selection;
       nsCOMPtr<nsIContent> eventContent, targetContent;
-      nsCString principalURISpec;
+      nsCOMPtr<nsIPrincipal> principal;
       mCurrentTarget->GetContentForEvent(aEvent, getter_AddRefs(eventContent));
       if (eventContent)
         DetermineDragTargetAndDefaultData(
             window, eventContent, dataTransfer, getter_AddRefs(selection),
-            getter_AddRefs(targetContent), principalURISpec);
+            getter_AddRefs(targetContent), getter_AddRefs(principal));
 
       // Stop tracking the drag gesture now. This should stop us from
       // reentering GenerateDragGesture inside DOM event processing.
       StopTrackingDragGesture();
 
       if (!targetContent) return;
 
       // Use our targetContent, now that we've determined it, as the
@@ -1811,17 +1811,17 @@ void EventStateManager::GenerateDragGest
       if (observerService) {
         observerService->NotifyObservers(dataTransfer,
                                          "on-datatransfer-available", nullptr);
       }
 
       if (status != nsEventStatus_eConsumeNoDefault) {
         bool dragStarted =
             DoDefaultDragStart(aPresContext, event, dataTransfer, targetContent,
-                               selection, principalURISpec);
+                               selection, principal);
         if (dragStarted) {
           sActiveESM = nullptr;
           MaybeFirePointerCancel(aEvent);
           aEvent->StopPropagation();
         }
       }
 
       // Reset mCurretTargetContent to what it was
@@ -1832,30 +1832,30 @@ void EventStateManager::GenerateDragGest
     // while dragging.
     FlushPendingEvents(aPresContext);
   }
 }  // GenerateDragGesture
 
 void EventStateManager::DetermineDragTargetAndDefaultData(
     nsPIDOMWindowOuter* aWindow, nsIContent* aSelectionTarget,
     DataTransfer* aDataTransfer, Selection** aSelection,
-    nsIContent** aTargetNode, nsACString& aPrincipalURISpec) {
+    nsIContent** aTargetNode, nsIPrincipal** aPrincipal) {
   *aTargetNode = nullptr;
 
   // GetDragData determines if a selection, link or image in the content
   // should be dragged, and places the data associated with the drag in the
   // data transfer.
   // mGestureDownContent is the node where the mousedown event for the drag
   // occurred, and aSelectionTarget is the node to use when a selection is used
   bool canDrag;
   nsCOMPtr<nsIContent> dragDataNode;
   bool wasAlt = (mGestureModifiers & MODIFIER_ALT) != 0;
   nsresult rv = nsContentAreaDragDrop::GetDragData(
       aWindow, mGestureDownContent, aSelectionTarget, wasAlt, aDataTransfer,
-      &canDrag, aSelection, getter_AddRefs(dragDataNode), aPrincipalURISpec);
+      &canDrag, aSelection, getter_AddRefs(dragDataNode), aPrincipal);
   if (NS_FAILED(rv) || !canDrag) return;
 
   // if GetDragData returned a node, use that as the node being dragged.
   // Otherwise, if a selection is being dragged, use the node within the
   // selection that was dragged. Otherwise, just use the mousedown target.
   nsIContent* dragContent = mGestureDownContent;
   if (dragDataNode)
     dragContent = dragDataNode;
@@ -1901,20 +1901,22 @@ void EventStateManager::DetermineDragTar
     // XXXndeakin rework this a bit. Find a way to just not call GetDragData if
     // we don't need to.
     if (dragContent != originalDragContent) aDataTransfer->ClearAll();
     *aTargetNode = dragContent;
     NS_ADDREF(*aTargetNode);
   }
 }
 
-bool EventStateManager::DoDefaultDragStart(
-    nsPresContext* aPresContext, WidgetDragEvent* aDragEvent,
-    DataTransfer* aDataTransfer, nsIContent* aDragTarget, Selection* aSelection,
-    const nsACString& aPrincipalURISpec) {
+bool EventStateManager::DoDefaultDragStart(nsPresContext* aPresContext,
+                                           WidgetDragEvent* aDragEvent,
+                                           DataTransfer* aDataTransfer,
+                                           nsIContent* aDragTarget,
+                                           Selection* aSelection,
+                                           nsIPrincipal* aPrincipal) {
   nsCOMPtr<nsIDragService> dragService =
       do_GetService("@mozilla.org/widget/dragservice;1");
   if (!dragService) return false;
 
   // Default handling for the dragstart event.
   //
   // First, check if a drag session already exists. This means that the drag
   // service was called directly within a draggesture handler. In this case,
@@ -1977,21 +1979,21 @@ bool EventStateManager::DoDefaultDragSta
       NS_NewDOMDragEvent(dragTarget, aPresContext, aDragEvent);
 
   // Use InvokeDragSessionWithSelection if a selection is being dragged,
   // such that the image can be generated from the selected text. However,
   // use InvokeDragSessionWithImage if a custom image was set or something
   // other than a selection is being dragged.
   if (!dragImage && aSelection) {
     dragService->InvokeDragSessionWithSelection(
-        aSelection, aPrincipalURISpec, transArray, action, event, dataTransfer);
+        aSelection, aPrincipal, transArray, action, event, dataTransfer);
   } else {
-    dragService->InvokeDragSessionWithImage(
-        dragTarget, aPrincipalURISpec, transArray, action, dragImage, imageX,
-        imageY, event, dataTransfer);
+    dragService->InvokeDragSessionWithImage(dragTarget, aPrincipal, transArray,
+                                            action, dragImage, imageX, imageY,
+                                            event, dataTransfer);
   }
 
   return true;
 }
 
 nsresult EventStateManager::GetContentViewer(nsIContentViewer** aCv) {
   *aCv = nullptr;
 
--- a/dom/events/EventStateManager.h
+++ b/dom/events/EventStateManager.h
@@ -1056,44 +1056,43 @@ class EventStateManager : public nsSuppo
    * Determine which node the drag should be targeted at.
    * This is either the node clicked when there is a selection, or, for HTML,
    * the element with a draggable property set to true.
    *
    * aSelectionTarget - target to check for selection
    * aDataTransfer - data transfer object that will contain the data to drag
    * aSelection - [out] set to the selection to be dragged
    * aTargetNode - [out] the draggable node, or null if there isn't one
-   * aPrincipalURISpec - [out] set to the URI of the triggering principal of
-   *                           the drag, or an empty string if it's from
-   *                           browser chrome or OS
+   * aPrincipal - [out] set to the triggering principal of the drag, or null
+   *                    if it's from browser chrome or OS
    */
   void DetermineDragTargetAndDefaultData(nsPIDOMWindowOuter* aWindow,
                                          nsIContent* aSelectionTarget,
                                          dom::DataTransfer* aDataTransfer,
                                          dom::Selection** aSelection,
                                          nsIContent** aTargetNode,
-                                         nsACString& aPrincipalURISpec);
+                                         nsIPrincipal** aPrincipal);
 
   /*
    * Perform the default handling for the dragstart event and set up a
    * drag for aDataTransfer if it contains any data. Returns true if a drag has
    * started.
    *
    * aDragEvent - the dragstart event
    * aDataTransfer - the data transfer that holds the data to be dragged
    * aDragTarget - the target of the drag
    * aSelection - the selection to be dragged
-   * aPrincipalURISpec - the URI of the triggering principal of the drag,
-   *                     or an empty string if it's from browser chrome or OS
+   * aPrincipal - the triggering principal of the drag, or null if it's from
+   *              browser chrome or OS
    */
   bool DoDefaultDragStart(nsPresContext* aPresContext,
                           WidgetDragEvent* aDragEvent,
                           dom::DataTransfer* aDataTransfer,
                           nsIContent* aDragTarget, dom::Selection* aSelection,
-                          const nsACString& aPrincipalURISpec);
+                          nsIPrincipal* aPrincipal);
 
   bool IsTrackingDragGesture() const { return mGestureDownContent != nullptr; }
   /**
    * Set the fields of aEvent to reflect the mouse position and modifier keys
    * that were set when the user first pressed the mouse button (stored by
    * BeginTrackingDragGesture). aEvent->mWidget must be
    * mCurrentTarget->GetNearestWidget().
    */
--- a/dom/ipc/PBrowser.ipdl
+++ b/dom/ipc/PBrowser.ipdl
@@ -563,17 +563,17 @@ parent:
     nested(inside_sync) sync DispatchWheelEvent(WidgetWheelEvent event);
     nested(inside_sync) sync DispatchMouseEvent(WidgetMouseEvent event);
     nested(inside_sync) sync DispatchKeyboardEvent(WidgetKeyboardEvent event);
 
     async InvokeDragSession(IPCDataTransfer[] transfers, uint32_t action,
                             OptionalShmem visualData,
                             uint32_t stride, SurfaceFormat format,
                             LayoutDeviceIntRect dragRect,
-                            nsCString principalURISpec);
+                            Principal principal);
 
     // After a compositor reset, it is necessary to reconnect each layers ID to
     // the compositor of the widget that will render those layers. Note that
     // this is sync so we can ensure that messages to the window compositor
     // arrive before the TabChild attempts to use its cross-process compositor
     // bridge.
     sync EnsureLayersConnected() returns (CompositorOptions compositorOptions);
 
@@ -710,17 +710,17 @@ child:
                                            uint64_t aInputBlockId,
                                            nsEventStatus aApzResponse);
 
     /*
      * We disable the input event queue when there is an active dnd session. We
      * don't need support RealDragEvent with input priority.
      */
     async RealDragEvent(WidgetDragEvent aEvent, uint32_t aDragAction,
-                        uint32_t aDropEffect, nsCString aPrincipalURISpec);
+                        uint32_t aDropEffect, Principal aPrincipal);
 
     async PluginEvent(WidgetPluginEvent aEvent);
 
     prio(input) async CompositionEvent(WidgetCompositionEvent event);
     async NormalPriorityCompositionEvent(WidgetCompositionEvent event);
 
     prio(input) async SelectionEvent(WidgetSelectionEvent event);
     async NormalPrioritySelectionEvent(WidgetSelectionEvent event);
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -1716,24 +1716,24 @@ mozilla::ipc::IPCResult TabChild::RecvRe
 mozilla::ipc::IPCResult TabChild::RecvNormalPriorityRealTouchMoveEvent(
     const WidgetTouchEvent& aEvent, const ScrollableLayerGuid& aGuid,
     const uint64_t& aInputBlockId, const nsEventStatus& aApzResponse) {
   return RecvRealTouchMoveEvent(aEvent, aGuid, aInputBlockId, aApzResponse);
 }
 
 mozilla::ipc::IPCResult TabChild::RecvRealDragEvent(
     const WidgetDragEvent& aEvent, const uint32_t& aDragAction,
-    const uint32_t& aDropEffect, const nsCString& aPrincipalURISpec) {
+    const uint32_t& aDropEffect, const IPC::Principal& aPrincipal) {
   WidgetDragEvent localEvent(aEvent);
   localEvent.mWidget = mPuppetWidget;
 
   nsCOMPtr<nsIDragSession> dragSession = nsContentUtils::GetDragSession();
   if (dragSession) {
     dragSession->SetDragAction(aDragAction);
-    dragSession->SetTriggeringPrincipalURISpec(aPrincipalURISpec);
+    dragSession->SetTriggeringPrincipal(aPrincipal);
     RefPtr<DataTransfer> initialDataTransfer = dragSession->GetDataTransfer();
     if (initialDataTransfer) {
       initialDataTransfer->SetDropEffectInt(aDropEffect);
     }
   }
 
   if (aEvent.mMessage == eDrop) {
     bool canDrop = true;
--- a/dom/ipc/TabChild.h
+++ b/dom/ipc/TabChild.h
@@ -327,17 +327,17 @@ class TabChild final : public TabChildBa
       const mozilla::WidgetMouseEvent& aEvent, const ScrollableLayerGuid& aGuid,
       const uint64_t& aInputBlockId) override;
   virtual mozilla::ipc::IPCResult RecvNormalPriorityRealMouseButtonEvent(
       const mozilla::WidgetMouseEvent& aEvent, const ScrollableLayerGuid& aGuid,
       const uint64_t& aInputBlockId) override;
 
   virtual mozilla::ipc::IPCResult RecvRealDragEvent(
       const WidgetDragEvent& aEvent, const uint32_t& aDragAction,
-      const uint32_t& aDropEffect, const nsCString& aPrincipalURISpec) override;
+      const uint32_t& aDropEffect, const IPC::Principal& aPrincipal) override;
 
   virtual mozilla::ipc::IPCResult RecvRealKeyEvent(
       const mozilla::WidgetKeyboardEvent& aEvent) override;
 
   virtual mozilla::ipc::IPCResult RecvNormalPriorityRealKeyEvent(
       const mozilla::WidgetKeyboardEvent& aEvent) override;
 
   virtual mozilla::ipc::IPCResult RecvMouseWheelEvent(
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -1175,29 +1175,29 @@ bool TabParent::QueryDropLinksForVerific
     mVerifyDropLinks.Clear();
     return false;
   }
   return true;
 }
 
 void TabParent::SendRealDragEvent(WidgetDragEvent& aEvent, uint32_t aDragAction,
                                   uint32_t aDropEffect,
-                                  const nsCString& aPrincipalURISpec) {
+                                  const IPC::Principal& aPrincipal) {
   if (mIsDestroyed || !mIsReadyToHandleInputEvents) {
     return;
   }
   MOZ_ASSERT(!Manager()->AsContentParent()->IsInputPriorityEventEnabled());
   aEvent.mRefPoint += GetChildProcessOffset();
   if (aEvent.mMessage == eDrop) {
     if (!QueryDropLinksForVerification()) {
       return;
     }
   }
   DebugOnly<bool> ret = PBrowserParent::SendRealDragEvent(
-      aEvent, aDragAction, aDropEffect, aPrincipalURISpec);
+      aEvent, aDragAction, aDropEffect, aPrincipal);
   NS_WARNING_ASSERTION(ret, "PBrowserParent::SendRealDragEvent() failed");
   MOZ_ASSERT(!ret || aEvent.HasBeenPostedToRemoteProcess());
 }
 
 LayoutDevicePoint TabParent::AdjustTapToChildWidget(
     const LayoutDevicePoint& aPoint) {
   return aPoint + LayoutDevicePoint(GetChildProcessOffset());
 }
@@ -3075,17 +3075,17 @@ mozilla::ipc::IPCResult TabParent::RecvA
   }
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult TabParent::RecvInvokeDragSession(
     nsTArray<IPCDataTransfer>&& aTransfers, const uint32_t& aAction,
     const OptionalShmem& aVisualDnDData, const uint32_t& aStride,
     const gfx::SurfaceFormat& aFormat, const LayoutDeviceIntRect& aDragRect,
-    const nsCString& aPrincipalURISpec) {
+    const IPC::Principal& aPrincipal) {
   mInitialDataTransferItems.Clear();
   nsIPresShell* shell = mFrameElement->OwnerDoc()->GetShell();
   if (!shell) {
     if (Manager()->IsContentParent()) {
       Unused << Manager()->AsContentParent()->SendEndDragSession(
           true, true, LayoutDeviceIntPoint(), 0);
       // Continue sending input events with input priority when stopping the dnd
       // session.
@@ -3113,41 +3113,30 @@ mozilla::ipc::IPCResult TabParent::RecvI
   } else {
     mDnDVisualization = gfx::CreateDataSourceSurfaceFromData(
         gfx::IntSize(aDragRect.width, aDragRect.height), aFormat,
         aVisualDnDData.get_Shmem().get<uint8_t>(), aStride);
   }
 
   mDragValid = true;
   mDragRect = aDragRect;
-  mDragPrincipalURISpec = aPrincipalURISpec;
+  mDragPrincipal = aPrincipal;
 
   esm->BeginTrackingRemoteDragGesture(mFrameElement);
 
   if (aVisualDnDData.type() == OptionalShmem::TShmem) {
     Unused << DeallocShmem(aVisualDnDData);
   }
 
   return IPC_OK();
 }
 
 void TabParent::AddInitialDnDDataTo(DataTransfer* aDataTransfer,
-                                    nsACString& aPrincipalURISpec) {
-  aPrincipalURISpec.Assign(mDragPrincipalURISpec);
-
-  nsCOMPtr<nsIPrincipal> principal;
-  if (!mDragPrincipalURISpec.IsEmpty()) {
-    // If principal is given, try using it first.
-    principal = BasePrincipal::CreateCodebasePrincipal(mDragPrincipalURISpec);
-  }
-  if (!principal) {
-    // Fallback to system principal, to handle like the data is from browser
-    // chrome or OS.
-    principal = nsContentUtils::GetSystemPrincipal();
-  }
+                                    nsIPrincipal** aPrincipal) {
+  NS_IF_ADDREF(*aPrincipal = mDragPrincipal);
 
   for (uint32_t i = 0; i < mInitialDataTransferItems.Length(); ++i) {
     nsTArray<IPCDataTransferItem>& itemArray = mInitialDataTransferItems[i];
     for (auto& item : itemArray) {
       RefPtr<nsVariantCC> variant = new nsVariantCC();
       // Special case kFilePromiseMime so that we get the right
       // nsIFlavorDataProvider for it.
       if (item.flavor().EqualsLiteral(kFilePromiseMime)) {
@@ -3178,22 +3167,22 @@ void TabParent::AddInitialDnDDataTo(Data
 
         mozilla::Unused << DeallocShmem(item.data().get_Shmem());
       }
 
       // We set aHidden to false, as we don't need to worry about hiding data
       // from content in the parent process where there is no content.
       // XXX: Nested Content Processes may change this
       aDataTransfer->SetDataWithPrincipalFromOtherProcess(
-          NS_ConvertUTF8toUTF16(item.flavor()), variant, i, principal,
+          NS_ConvertUTF8toUTF16(item.flavor()), variant, i, mDragPrincipal,
           /* aHidden = */ false);
     }
   }
   mInitialDataTransferItems.Clear();
-  mDragPrincipalURISpec.Truncate(0);
+  mDragPrincipal = nullptr;
 }
 
 bool TabParent::TakeDragVisualization(
     RefPtr<mozilla::gfx::SourceSurface>& aSurface,
     LayoutDeviceIntRect* aDragRect) {
   if (!mDragValid) return false;
 
   aSurface = mDnDVisualization.forget();
--- a/dom/ipc/TabParent.h
+++ b/dom/ipc/TabParent.h
@@ -405,17 +405,17 @@ class TabParent final : public PBrowserP
    * The following Send*Event() marks aEvent as posted to remote process if
    * it succeeded.  So, you can check the result with
    * aEvent.HasBeenPostedToRemoteProcess().
    */
   void SendRealMouseEvent(WidgetMouseEvent& aEvent);
 
   void SendRealDragEvent(WidgetDragEvent& aEvent, uint32_t aDragAction,
                          uint32_t aDropEffect,
-                         const nsCString& aPrincipalURISpec);
+                         const IPC::Principal& aPrincipal);
 
   void SendMouseWheelEvent(WidgetWheelEvent& aEvent);
 
   void SendRealKeyEvent(WidgetKeyboardEvent& aEvent);
 
   void SendRealTouchEvent(WidgetTouchEvent& aEvent);
 
   void SendPluginEvent(WidgetPluginEvent& aEvent);
@@ -526,20 +526,20 @@ class TabParent final : public PBrowserP
                         float aScale, nscolor aBackgroundColor);
   void RequestSubPaint(gfx::CrossProcessPaint* aPaint, float aScale,
                        nscolor aBackgroundColor);
 
   virtual mozilla::ipc::IPCResult RecvInvokeDragSession(
       nsTArray<IPCDataTransfer>&& aTransfers, const uint32_t& aAction,
       const OptionalShmem& aVisualDnDData, const uint32_t& aStride,
       const gfx::SurfaceFormat& aFormat, const LayoutDeviceIntRect& aDragRect,
-      const nsCString& aPrincipalURISpec) override;
+      const IPC::Principal& aPrincipal) override;
 
   void AddInitialDnDDataTo(DataTransfer* aDataTransfer,
-                           nsACString& aPrincipalURISpec);
+                           nsIPrincipal** aPrincipal);
 
   bool TakeDragVisualization(RefPtr<mozilla::gfx::SourceSurface>& aSurface,
                              LayoutDeviceIntRect* aDragRect);
 
   layout::RenderFrame* GetRenderFrame();
 
   mozilla::ipc::IPCResult RecvEnsureLayersConnected(
       CompositorOptions* aCompositorOptions) override;
@@ -657,17 +657,17 @@ class TabParent final : public PBrowserP
 
   uint32_t mChromeFlags;
 
   nsTArray<nsTArray<IPCDataTransferItem>> mInitialDataTransferItems;
 
   RefPtr<gfx::DataSourceSurface> mDnDVisualization;
   bool mDragValid;
   LayoutDeviceIntRect mDragRect;
-  nsCString mDragPrincipalURISpec;
+  nsCOMPtr<nsIPrincipal> mDragPrincipal;
 
   nsCOMPtr<nsILoadContext> mLoadContext;
 
   // We keep a strong reference to the frameloader after we've sent the
   // Destroy message and before we've received __delete__. This allows us to
   // dispatch message manager messages during this time.
   RefPtr<nsFrameLoader> mFrameLoader;
 
--- a/widget/gtk/nsDragService.cpp
+++ b/widget/gtk/nsDragService.cpp
@@ -280,28 +280,28 @@ static GtkWindow *GetGtkWindow(dom::Docu
 
   return GTK_WINDOW(toplevel);
 }
 
 // nsIDragService
 
 NS_IMETHODIMP
 nsDragService::InvokeDragSession(
-    nsINode *aDOMNode, const nsACString &aPrincipalURISpec,
-    nsIArray *aArrayTransferables, uint32_t aActionType,
+    nsINode *aDOMNode, nsIPrincipal *aPrincipal, nsIArray *aArrayTransferables,
+    uint32_t aActionType,
     nsContentPolicyType aContentPolicyType = nsIContentPolicy::TYPE_OTHER) {
   MOZ_LOG(sDragLm, LogLevel::Debug, ("nsDragService::InvokeDragSession"));
 
   // If the previous source drag has not yet completed, signal handlers need
   // to be removed from sGrabWidget and dragend needs to be dispatched to
   // the source node, but we can't call EndDragSession yet because we don't
   // know whether or not the drag succeeded.
   if (mSourceNode) return NS_ERROR_NOT_AVAILABLE;
 
-  return nsBaseDragService::InvokeDragSession(aDOMNode, aPrincipalURISpec,
+  return nsBaseDragService::InvokeDragSession(aDOMNode, aPrincipal,
                                               aArrayTransferables, aActionType,
                                               aContentPolicyType);
 }
 
 // nsBaseDragService
 nsresult nsDragService::InvokeDragSessionImpl(
     nsIArray *aArrayTransferables, const Maybe<CSSIntRegion> &aRegion,
     uint32_t aActionType) {
--- a/widget/gtk/nsDragService.h
+++ b/widget/gtk/nsDragService.h
@@ -58,18 +58,17 @@ class nsDragService final : public nsBas
   NS_DECL_NSIOBSERVER
 
   // nsBaseDragService
   virtual nsresult InvokeDragSessionImpl(
       nsIArray *anArrayTransferables,
       const mozilla::Maybe<mozilla::CSSIntRegion> &aRegion,
       uint32_t aActionType) override;
   // nsIDragService
-  NS_IMETHOD InvokeDragSession(nsINode *aDOMNode,
-                               const nsACString &aPrincipalURISpec,
+  NS_IMETHOD InvokeDragSession(nsINode *aDOMNode, nsIPrincipal *aPrincipal,
                                nsIArray *anArrayTransferables,
                                uint32_t aActionType,
                                nsContentPolicyType aContentPolicyType) override;
   NS_IMETHOD StartDragSession() override;
   NS_IMETHOD EndDragSession(bool aDoneDrag, uint32_t aKeyModifiers) override;
 
   // nsIDragSession
   NS_IMETHOD SetCanDrop(bool aCanDrop) override;
--- a/widget/nsBaseDragService.cpp
+++ b/widget/nsBaseDragService.cpp
@@ -145,26 +145,24 @@ nsBaseDragService::GetSourceDocument(Doc
 //
 NS_IMETHODIMP
 nsBaseDragService::GetSourceNode(nsINode** aSourceNode) {
   *aSourceNode = do_AddRef(mSourceNode).take();
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsBaseDragService::GetTriggeringPrincipalURISpec(
-    nsACString& aPrincipalURISpec) {
-  aPrincipalURISpec = mTriggeringPrincipalURISpec;
+nsBaseDragService::GetTriggeringPrincipal(nsIPrincipal** aPrincipal) {
+  NS_IF_ADDREF(*aPrincipal = mTriggeringPrincipal);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsBaseDragService::SetTriggeringPrincipalURISpec(
-    const nsACString& aPrincipalURISpec) {
-  mTriggeringPrincipalURISpec = aPrincipalURISpec;
+nsBaseDragService::SetTriggeringPrincipal(nsIPrincipal* aPrincipal) {
+  mTriggeringPrincipal = aPrincipal;
   return NS_OK;
 }
 
 //-------------------------------------------------------------------------
 
 NS_IMETHODIMP
 nsBaseDragService::GetData(nsITransferable* aTransferable,
                            uint32_t aItemIndex) {
@@ -196,27 +194,27 @@ DataTransfer* nsBaseDragService::GetData
 
 void nsBaseDragService::SetDataTransfer(DataTransfer* aDataTransfer) {
   mDataTransfer = aDataTransfer;
 }
 
 //-------------------------------------------------------------------------
 NS_IMETHODIMP
 nsBaseDragService::InvokeDragSession(
-    nsINode* aDOMNode, const nsACString& aPrincipalURISpec,
-    nsIArray* aTransferableArray, uint32_t aActionType,
+    nsINode* aDOMNode, nsIPrincipal* aPrincipal, nsIArray* aTransferableArray,
+    uint32_t aActionType,
     nsContentPolicyType aContentPolicyType = nsIContentPolicy::TYPE_OTHER) {
   AUTO_PROFILER_LABEL("nsBaseDragService::InvokeDragSession", OTHER);
 
   NS_ENSURE_TRUE(aDOMNode, NS_ERROR_INVALID_ARG);
   NS_ENSURE_TRUE(mSuppressLevel == 0, NS_ERROR_FAILURE);
 
   // stash the document of the dom node
   mSourceDocument = aDOMNode->OwnerDoc();
-  mTriggeringPrincipalURISpec.Assign(aPrincipalURISpec);
+  mTriggeringPrincipal = aPrincipal;
   mSourceNode = aDOMNode;
   mContentPolicyType = aContentPolicyType;
   mEndDragPoint = LayoutDeviceIntPoint(0, 0);
 
   // When the mouse goes down, the selection code starts a mouse
   // capture. However, this gets in the way of determining drag
   // feedback for things like trees because the event coordinates
   // are in the wrong coord system, so turn off mouse capture.
@@ -242,20 +240,19 @@ nsBaseDragService::InvokeDragSession(
     EndDragSession(true, 0);
   }
 
   return rv;
 }
 
 NS_IMETHODIMP
 nsBaseDragService::InvokeDragSessionWithImage(
-    nsINode* aDOMNode, const nsACString& aPrincipalURISpec,
-    nsIArray* aTransferableArray, uint32_t aActionType, nsINode* aImage,
-    int32_t aImageX, int32_t aImageY, DragEvent* aDragEvent,
-    DataTransfer* aDataTransfer) {
+    nsINode* aDOMNode, nsIPrincipal* aPrincipal, nsIArray* aTransferableArray,
+    uint32_t aActionType, nsINode* aImage, int32_t aImageX, int32_t aImageY,
+    DragEvent* aDragEvent, DataTransfer* aDataTransfer) {
   NS_ENSURE_TRUE(aDragEvent, NS_ERROR_NULL_POINTER);
   NS_ENSURE_TRUE(aDataTransfer, NS_ERROR_NULL_POINTER);
   NS_ENSURE_TRUE(mSuppressLevel == 0, NS_ERROR_FAILURE);
 
   mDataTransfer = aDataTransfer;
   mSelection = nullptr;
   mHasImage = true;
   mDragPopup = nullptr;
@@ -281,27 +278,29 @@ nsBaseDragService::InvokeDragSessionWith
       if (treeBody) {
         mRegion = treeBody->GetSelectionRegion();
       }
     }
   }
 #endif
 
   nsresult rv =
-      InvokeDragSession(aDOMNode, aPrincipalURISpec, aTransferableArray,
-                        aActionType, nsIContentPolicy::TYPE_INTERNAL_IMAGE);
+      InvokeDragSession(aDOMNode, aPrincipal, aTransferableArray, aActionType,
+                        nsIContentPolicy::TYPE_INTERNAL_IMAGE);
   mRegion = Nothing();
   return rv;
 }
 
 NS_IMETHODIMP
-nsBaseDragService::InvokeDragSessionWithSelection(
-    Selection* aSelection, const nsACString& aPrincipalURISpec,
-    nsIArray* aTransferableArray, uint32_t aActionType, DragEvent* aDragEvent,
-    DataTransfer* aDataTransfer) {
+nsBaseDragService::InvokeDragSessionWithSelection(Selection* aSelection,
+                                                  nsIPrincipal* aPrincipal,
+                                                  nsIArray* aTransferableArray,
+                                                  uint32_t aActionType,
+                                                  DragEvent* aDragEvent,
+                                                  DataTransfer* aDataTransfer) {
   NS_ENSURE_TRUE(aSelection, NS_ERROR_NULL_POINTER);
   NS_ENSURE_TRUE(aDragEvent, NS_ERROR_NULL_POINTER);
   NS_ENSURE_TRUE(mSuppressLevel == 0, NS_ERROR_FAILURE);
 
   mDataTransfer = aDataTransfer;
   mSelection = aSelection;
   mHasImage = true;
   mDragPopup = nullptr;
@@ -313,18 +312,18 @@ nsBaseDragService::InvokeDragSessionWith
   mScreenPosition.y = aDragEvent->ScreenY(CallerType::System);
   mInputSource = aDragEvent->MozInputSource();
 
   // just get the focused node from the selection
   // XXXndeakin this should actually be the deepest node that contains both
   // endpoints of the selection
   nsCOMPtr<nsINode> node = aSelection->GetFocusNode();
 
-  return InvokeDragSession(node, aPrincipalURISpec, aTransferableArray,
-                           aActionType, nsIContentPolicy::TYPE_OTHER);
+  return InvokeDragSession(node, aPrincipal, aTransferableArray, aActionType,
+                           nsIContentPolicy::TYPE_OTHER);
 }
 
 //-------------------------------------------------------------------------
 NS_IMETHODIMP
 nsBaseDragService::GetCurrentSession(nsIDragSession** aSession) {
   if (!aSession) return NS_ERROR_INVALID_ARG;
 
   // "this" also implements a drag session, so say we are one but only
@@ -409,17 +408,17 @@ nsBaseDragService::EndDragSession(bool a
   }
 
   mDoingDrag = false;
   mCanDrop = false;
 
   // release the source we've been holding on to.
   mSourceDocument = nullptr;
   mSourceNode = nullptr;
-  mTriggeringPrincipalURISpec.Truncate(0);
+  mTriggeringPrincipal = nullptr;
   mSelection = nullptr;
   mDataTransfer = nullptr;
   mHasImage = false;
   mUserCancelled = false;
   mDragPopup = nullptr;
   mImage = nullptr;
   mImageOffset = CSSIntPoint();
   mScreenPosition = CSSIntPoint();
--- a/widget/nsBaseDragService.h
+++ b/widget/nsBaseDragService.h
@@ -154,17 +154,17 @@ class nsBaseDragService : public nsIDrag
   bool mUserCancelled;
 
   bool mDragEventDispatchedToChildProcess;
 
   uint32_t mDragAction;
   uint32_t mDragActionFromChildProcess;
 
   nsCOMPtr<nsINode> mSourceNode;
-  nsCString mTriggeringPrincipalURISpec;
+  nsCOMPtr<nsIPrincipal> mTriggeringPrincipal;
 
   // the document at the drag source. will be null if it came from outside the
   // app.
   RefPtr<mozilla::dom::Document> mSourceDocument;
 
   // the contentpolicy type passed to the channel when initiating the drag
   // session
   nsContentPolicyType mContentPolicyType;
--- a/widget/nsDragServiceProxy.cpp
+++ b/widget/nsDragServiceProxy.cpp
@@ -22,44 +22,30 @@ using mozilla::gfx::DataSourceSurface;
 using mozilla::gfx::SourceSurface;
 using mozilla::gfx::SurfaceFormat;
 using mozilla::ipc::Shmem;
 
 nsDragServiceProxy::nsDragServiceProxy() {}
 
 nsDragServiceProxy::~nsDragServiceProxy() {}
 
-static void GetPrincipalURIFromNode(nsCOMPtr<nsINode>& sourceNode,
-                                    nsCString& aPrincipalURISpec) {
-  if (!sourceNode) {
-    return;
-  }
-
-  nsCOMPtr<nsIPrincipal> principal = sourceNode->NodePrincipal();
-  nsCOMPtr<nsIURI> principalURI;
-  nsresult rv = principal->GetURI(getter_AddRefs(principalURI));
-  if (NS_FAILED(rv) || !principalURI) {
-    return;
-  }
-
-  principalURI->GetSpec(aPrincipalURISpec);
-}
-
 nsresult nsDragServiceProxy::InvokeDragSessionImpl(
     nsIArray* aArrayTransferables, const Maybe<CSSIntRegion>& aRegion,
     uint32_t aActionType) {
   NS_ENSURE_STATE(mSourceDocument->GetDocShell());
   TabChild* child = TabChild::GetFrom(mSourceDocument->GetDocShell());
   NS_ENSURE_STATE(child);
   nsTArray<mozilla::dom::IPCDataTransfer> dataTransfers;
   nsContentUtils::TransferablesToIPCTransferables(
       aArrayTransferables, dataTransfers, false, child->Manager(), nullptr);
 
-  nsCString principalURISpec;
-  GetPrincipalURIFromNode(mSourceNode, principalURISpec);
+  nsCOMPtr<nsIPrincipal> principal;
+  if (mSourceNode) {
+    principal = mSourceNode->NodePrincipal();
+  }
 
   LayoutDeviceIntRect dragRect;
   if (mHasImage || mSelection) {
     nsPresContext* pc;
     RefPtr<SourceSurface> surface;
     DrawDrag(mSourceNode, aRegion, mScreenPosition, &dragRect, &surface, &pc);
 
     if (surface) {
@@ -78,21 +64,21 @@ nsresult nsDragServiceProxy::InvokeDragS
         // Save the surface data to shared memory.
         if (!surfaceData.IsReadable() || !surfaceData.get<char>()) {
           NS_WARNING("Failed to create shared memory for drag session.");
           return NS_ERROR_FAILURE;
         }
 
         mozilla::Unused << child->SendInvokeDragSession(
             dataTransfers, aActionType, surfaceData, stride,
-            dataSurface->GetFormat(), dragRect, principalURISpec);
+            dataSurface->GetFormat(), dragRect, IPC::Principal(principal));
         StartDragSession();
         return NS_OK;
       }
     }
   }
 
   mozilla::Unused << child->SendInvokeDragSession(
       dataTransfers, aActionType, mozilla::void_t(), 0,
-      static_cast<SurfaceFormat>(0), dragRect, principalURISpec);
+      static_cast<SurfaceFormat>(0), dragRect, IPC::Principal(principal));
   StartDragSession();
   return NS_OK;
 }
--- a/widget/nsIDragService.idl
+++ b/widget/nsIDragService.idl
@@ -37,26 +37,26 @@ interface nsIDragService : nsISupports
   const long DRAGDROP_ACTION_LINK = 4;
   const long DRAGDROP_ACTION_UNINITIALIZED = 64;
 
   /**
     * Starts a modal drag session with an array of transaferables.
     *
     * Note: This method is deprecated for non-native code.
     *
-    * @param  aPrincipalURISpec - the URI of the triggering principal of the
-    *            drag, or an empty string if it's from browser chrome or OS
+    * @param  aPrincipal - the triggering principal of the drag, or null if
+    *                      it's from browser chrome or OS
     * @param  aTransferables - an array of transferables to be dragged
     * @param  aActionType - specified which of copy/move/link are allowed
     * @param  aContentPolicyType - the contentPolicyType that will be
     *           passed to the loadInfo when creating a new channel
     *           (defaults to TYPE_OTHER)
     */
   void invokeDragSession (in Node aDOMNode,
-                          in AUTF8String aPrincipalURISpec,
+                          in nsIPrincipal aPrincipal,
                           in nsIArray aTransferables,
                           in unsigned long aActionType,
                           [optional] in nsContentPolicyType aContentPolicyType);
 
   /**
    * Starts a modal drag session using an image. The first four arguments are
    * the same as invokeDragSession.
    *
@@ -80,34 +80,34 @@ interface nsIDragService : nsISupports
    * rendered into an offscreen buffer in the same manner as it is currently
    * displayed. The document selection is hidden while drawing.
    *
    * The aDragEvent must be supplied as the current screen coordinates of the
    * event are needed to calculate the image location.
    */
   [noscript]
   void invokeDragSessionWithImage(in Node aDOMNode,
-                                  in AUTF8String aPrincipalURISpec,
+                                  in nsIPrincipal aPrincipal,
                                   in nsIArray aTransferableArray,
                                   in unsigned long aActionType,
                                   in Node aImage,
                                   in long aImageX,
                                   in long aImageY,
                                   in DragEvent aDragEvent,
                                   in DataTransferPtr aDataTransfer);
 
   /**
    * Start a modal drag session using the selection as the drag image.
    * The aDragEvent must be supplied as the current screen coordinates of the
    * event are needed to calculate the image location.
    *
    * Note: This method is deprecated for non-native code.
    */
   void invokeDragSessionWithSelection(in Selection aSelection,
-                                      in AUTF8String aPrincipalURISpec,
+                                      in nsIPrincipal aPrincipal,
                                       in nsIArray aTransferableArray,
                                       in unsigned long aActionType,
                                       in DragEvent aDragEvent,
                                       in DataTransferPtr aDataTransfer);
 
   /**
     * Returns the current Drag Session
     */
--- a/widget/nsIDragSession.idl
+++ b/widget/nsIDragSession.idl
@@ -51,21 +51,21 @@ interface nsIDragSession : nsISupports
 
   /**
     * The dom node that was originally dragged to start the session, which will be null if the
     * drag originated outside the application.
     */
   readonly attribute Node sourceNode;
 
   /**
-   * The URI spec of the triggering principal.  This may be different than
-   * sourceNode's principal when sourceNode is xul:browser and the drag is
+   * the triggering principal.  This may be different than sourceNode's
+   * principal when sourceNode is xul:browser and the drag is
    * triggered in a browsing context inside it.
    */
-  attribute AUTF8String triggeringPrincipalURISpec;
+  attribute nsIPrincipal triggeringPrincipal;
 
   /**
    * The data transfer object for the current drag.
    */
   [binaryname(DataTransferXPCOM)]
   attribute DataTransfer dataTransfer;
   [notxpcom, nostdcall] DataTransfer getDataTransfer();
   [notxpcom, nostdcall] void setDataTransfer(in DataTransfer aDataTransfer);