Bug 1507540 part 5. Use more notxpcom attributes in widget/. r=ehsan
authorBoris Zbarsky <bzbarsky@mit.edu>
Mon, 19 Nov 2018 20:17:54 -0500
changeset 503591 f50e3a884aa8bfc672952a93cbafe02f376292bd
parent 503590 5cdbce9b4a51adadd43a80440cc451cf4b9b85a5
child 503592 6b60870ec6f8473b578be250179840c5316f0444
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs1507540
milestone65.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 1507540 part 5. Use more notxpcom attributes in widget/. r=ehsan
dom/base/nsContentAreaDragDrop.cpp
dom/events/EventStateManager.cpp
layout/printing/nsPrintJob.cpp
toolkit/components/printingui/ipc/nsPrintingProxy.cpp
widget/nsBaseDragService.cpp
widget/nsBaseDragService.h
widget/nsClipboardProxy.cpp
widget/nsDeviceContextSpecProxy.cpp
widget/nsIDragSession.idl
widget/nsIPrintSession.idl
widget/nsITransferable.idl
widget/nsPrintSession.cpp
widget/nsPrintSettingsService.cpp
widget/nsTransferable.cpp
widget/windows/nsDataObj.cpp
--- a/dom/base/nsContentAreaDragDrop.cpp
+++ b/dom/base/nsContentAreaDragDrop.cpp
@@ -336,21 +336,19 @@ nsContentAreaDragDropDataProvider::GetFl
       return NS_ERROR_FAILURE;
 
     nsCOMPtr<nsIFile> file;
     rv = destDirectory->Clone(getter_AddRefs(file));
     NS_ENSURE_SUCCESS(rv, rv);
 
     file->Append(targetFilename);
 
-    bool isPrivate;
-    aTransferable->GetIsPrivateData(&isPrivate);
+    bool isPrivate = aTransferable->GetIsPrivateData();
 
-    nsCOMPtr<nsIPrincipal> principal;
-    aTransferable->GetRequestingPrincipal(getter_AddRefs(principal));
+    nsCOMPtr<nsIPrincipal> principal = aTransferable->GetRequestingPrincipal();
     rv = SaveURIToFile(sourceURI, principal, file, isPrivate);
     // send back an nsIFile
     if (NS_SUCCEEDED(rv)) {
       CallQueryInterface(file, aData);
       *aDataLen = sizeof(nsIFile*);
     }
   }
 
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -5828,22 +5828,21 @@ EventStateManager::DoContentCommandEvent
 
             nsCOMPtr<nsITransferable> transferable = aEvent->mTransferable;
             IPCDataTransfer ipcDataTransfer;
             ContentParent* cp = remote->Manager()->AsContentParent();
             nsContentUtils::TransferableToIPCTransferable(transferable,
                                                           &ipcDataTransfer,
                                                           false, nullptr,
                                                           cp);
-            bool isPrivateData = false;
-            transferable->GetIsPrivateData(&isPrivateData);
-            nsCOMPtr<nsIPrincipal> requestingPrincipal;
-            transferable->GetRequestingPrincipal(getter_AddRefs(requestingPrincipal));
-            nsContentPolicyType contentPolicyType = nsIContentPolicy::TYPE_OTHER;
-            transferable->GetContentPolicyType(&contentPolicyType);
+            bool isPrivateData = transferable->GetIsPrivateData();
+            nsCOMPtr<nsIPrincipal> requestingPrincipal =
+              transferable->GetRequestingPrincipal();
+            nsContentPolicyType contentPolicyType =
+              transferable->GetContentPolicyType();
             remote->SendPasteTransferable(ipcDataTransfer, isPrivateData,
                                           IPC::Principal(requestingPrincipal),
                                           contentPolicyType);
             rv = NS_OK;
           } else {
             nsCOMPtr<nsICommandController> commandController = do_QueryInterface(controller);
             NS_ENSURE_STATE(commandController);
 
--- a/layout/printing/nsPrintJob.cpp
+++ b/layout/printing/nsPrintJob.cpp
@@ -709,19 +709,19 @@ nsPrintJob::DoCommonPrint(bool          
   if (!aIsPrintPreview) {
     rv = printData->mPrintSettings->GetPrintSession(
                                       getter_AddRefs(printSession));
     if (NS_FAILED(rv) || !printSession) {
       printSession = do_CreateInstance("@mozilla.org/gfx/printsession;1", &rv);
       NS_ENSURE_SUCCESS(rv, rv);
       printData->mPrintSettings->SetPrintSession(printSession);
     } else {
-      RefPtr<mozilla::layout::RemotePrintJobChild> remotePrintJob;
-      printSession->GetRemotePrintJob(getter_AddRefs(remotePrintJob));
-      if (NS_SUCCEEDED(rv) && remotePrintJob) {
+      RefPtr<layout::RemotePrintJobChild> remotePrintJob =
+        printSession->GetRemotePrintJob();
+      if (remotePrintJob) {
         // If we have a RemotePrintJob add it to the print progress listeners,
         // so it can forward to the parent.
         printData->mPrintProgressListeners.AppendElement(remotePrintJob);
         remotePrintJobListening = true;
       }
     }
 
   }
@@ -872,19 +872,19 @@ nsPrintJob::DoCommonPrint(bool          
 
           if (printData->mPrintSettings && !aIsPrintPreview) {
             // The user might have changed shrink-to-fit in the print dialog, so update our copy of its state
             printData->mPrintSettings->GetShrinkToFit(&printData->mShrinkToFit);
 
             // If we haven't already added the RemotePrintJob as a listener,
             // add it now if there is one.
             if (!remotePrintJobListening) {
-              RefPtr<mozilla::layout::RemotePrintJobChild> remotePrintJob;
-              printSession->GetRemotePrintJob(getter_AddRefs(remotePrintJob));
-              if (NS_SUCCEEDED(rv) && remotePrintJob) {
+              RefPtr<layout::RemotePrintJobChild> remotePrintJob =
+                printSession->GetRemotePrintJob();
+              if (remotePrintJob) {
                 printData->mPrintProgressListeners.AppendElement(
                                                      remotePrintJob);
                 remotePrintJobListening = true;
               }
             }
           }
         } else if (rv == NS_ERROR_NOT_IMPLEMENTED) {
           // This means the Dialog service was there,
@@ -3497,19 +3497,19 @@ nsPrintJob::StartPagePrintTimer(const Un
 
     RefPtr<nsPagePrintTimer> timer =
       new nsPagePrintTimer(this, mDocViewerPrint, doc, printPageDelay);
     timer.forget(&mPagePrintTimer);
 
     nsCOMPtr<nsIPrintSession> printSession;
     nsresult rv = mPrt->mPrintSettings->GetPrintSession(getter_AddRefs(printSession));
     if (NS_SUCCEEDED(rv) && printSession) {
-      RefPtr<mozilla::layout::RemotePrintJobChild> remotePrintJob;
-      printSession->GetRemotePrintJob(getter_AddRefs(remotePrintJob));
-      if (NS_SUCCEEDED(rv) && remotePrintJob) {
+      RefPtr<layout::RemotePrintJobChild> remotePrintJob =
+        printSession->GetRemotePrintJob();
+      if (remotePrintJob) {
         remotePrintJob->SetPagePrintTimer(mPagePrintTimer);
         remotePrintJob->SetPrintJob(this);
       }
     }
   }
 
   return mPagePrintTimer->Start(aPO.get());
 }
--- a/toolkit/components/printingui/ipc/nsPrintingProxy.cpp
+++ b/toolkit/components/printingui/ipc/nsPrintingProxy.cpp
@@ -153,22 +153,22 @@ nsPrintingProxy::ShowProgress(mozIDOMWin
   TabChild* pBrowser = static_cast<TabChild*>(tabchild.get());
 
   RefPtr<PrintProgressDialogChild> dialogChild =
     new PrintProgressDialogChild(openDialogObserver, printSettings);
 
   SendPPrintProgressDialogConstructor(dialogChild);
 
   // Get the RemotePrintJob if we have one available.
-  RefPtr<mozilla::layout::RemotePrintJobChild> remotePrintJob;
+  RefPtr<RemotePrintJobChild> remotePrintJob;
   if (printSettings) {
     nsCOMPtr<nsIPrintSession> printSession;
     nsresult rv = printSettings->GetPrintSession(getter_AddRefs(printSession));
     if (NS_SUCCEEDED(rv) && printSession) {
-      printSession->GetRemotePrintJob(getter_AddRefs(remotePrintJob));
+      remotePrintJob = printSession->GetRemotePrintJob();
     }
   }
 
   // NOTE: We set notifyOnOpen to true unconditionally. If the parent process
   // would get `false` for notifyOnOpen, then it will synthesize a notification
   // which will be sent asynchronously down to the child.
   *notifyOnOpen = true;
   mozilla::Unused << SendShowProgress(pBrowser, dialogChild, remotePrintJob,
--- a/widget/nsBaseDragService.cpp
+++ b/widget/nsBaseDragService.cpp
@@ -57,17 +57,17 @@ using namespace mozilla::image;
 
 #define DRAGIMAGES_PREF "nglayout.enable_drag_images"
 
 nsBaseDragService::nsBaseDragService()
   : mCanDrop(false), mOnlyChromeDrop(false), mDoingDrag(false),
     mHasImage(false), mUserCancelled(false),
     mDragEventDispatchedToChildProcess(false),
     mDragAction(DRAGDROP_ACTION_NONE),
-    mDragActionFromChildProcess(DRAGDROP_ACTION_UNINITIALIZED), mTargetSize(0,0),
+    mDragActionFromChildProcess(DRAGDROP_ACTION_UNINITIALIZED),
     mContentPolicyType(nsIContentPolicy::TYPE_OTHER),
     mSuppressLevel(0), mInputSource(MouseEvent_Binding::MOZ_SOURCE_MOUSE)
 {
 }
 
 nsBaseDragService::~nsBaseDragService() = default;
 
 NS_IMPL_ISUPPORTS(nsBaseDragService, nsIDragService, nsIDragSession)
@@ -114,32 +114,16 @@ nsBaseDragService::SetDragAction(uint32_
 //---------------------------------------------------------
 NS_IMETHODIMP
 nsBaseDragService::GetDragAction(uint32_t * anAction)
 {
   *anAction = mDragAction;
   return NS_OK;
 }
 
-//---------------------------------------------------------
-NS_IMETHODIMP
-nsBaseDragService::SetTargetSize(nsSize aDragTargetSize)
-{
-  mTargetSize = aDragTargetSize;
-  return NS_OK;
-}
-
-//---------------------------------------------------------
-NS_IMETHODIMP
-nsBaseDragService::GetTargetSize(nsSize * aDragTargetSize)
-{
-  *aDragTargetSize = mTargetSize;
-  return NS_OK;
-}
-
 //-------------------------------------------------------------------------
 
 NS_IMETHODIMP
 nsBaseDragService::GetNumDropItems(uint32_t * aNumItems)
 {
   *aNumItems = 0;
   return NS_ERROR_FAILURE;
 }
--- a/widget/nsBaseDragService.h
+++ b/widget/nsBaseDragService.h
@@ -158,17 +158,16 @@ protected:
   // true if the user cancelled the drag operation
   bool mUserCancelled;
 
   bool mDragEventDispatchedToChildProcess;
 
   uint32_t mDragAction;
   uint32_t mDragActionFromChildProcess;
 
-  nsSize mTargetSize;
   nsCOMPtr<nsINode> mSourceNode;
   nsCString mTriggeringPrincipalURISpec;
   nsCOMPtr<nsIDocument> mSourceDocument;          // the document at the drag source. will be null
                                                   //  if it came from outside the app.
   nsContentPolicyType mContentPolicyType;         // the contentpolicy type passed to the channel
                                                   // when initiating the drag session
   RefPtr<mozilla::dom::DataTransfer> mDataTransfer;
 
--- a/widget/nsClipboardProxy.cpp
+++ b/widget/nsClipboardProxy.cpp
@@ -28,22 +28,20 @@ nsClipboardProxy::SetData(nsITransferabl
                           nsIClipboardOwner *anOwner, int32_t aWhichClipboard)
 {
   ContentChild* child = ContentChild::GetSingleton();
 
   IPCDataTransfer ipcDataTransfer;
   nsContentUtils::TransferableToIPCTransferable(aTransferable, &ipcDataTransfer,
                                                 false, child, nullptr);
 
-  bool isPrivateData = false;
-  aTransferable->GetIsPrivateData(&isPrivateData);
-  nsCOMPtr<nsIPrincipal> requestingPrincipal;
-  aTransferable->GetRequestingPrincipal(getter_AddRefs(requestingPrincipal));
-  nsContentPolicyType contentPolicyType = nsIContentPolicy::TYPE_OTHER;
-  aTransferable->GetContentPolicyType(&contentPolicyType);
+  bool isPrivateData = aTransferable->GetIsPrivateData();
+  nsCOMPtr<nsIPrincipal> requestingPrincipal =
+    aTransferable->GetRequestingPrincipal();
+  nsContentPolicyType contentPolicyType = aTransferable->GetContentPolicyType();
   child->SendSetClipboard(ipcDataTransfer, isPrivateData,
                           IPC::Principal(requestingPrincipal),
                           contentPolicyType, aWhichClipboard);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
--- a/widget/nsDeviceContextSpecProxy.cpp
+++ b/widget/nsDeviceContextSpecProxy.cpp
@@ -55,18 +55,18 @@ nsDeviceContextSpecProxy::Init(nsIWidget
   // nsIPrintSettings only has a weak reference to nsIPrintSession, so we hold
   // it to make sure it's available for the lifetime of the print.
   rv = mPrintSettings->GetPrintSession(getter_AddRefs(mPrintSession));
   if (NS_FAILED(rv) || !mPrintSession) {
     NS_WARNING("We can't print via the parent without an nsIPrintSession.");
     return NS_ERROR_FAILURE;
   }
 
-  rv = mPrintSession->GetRemotePrintJob(getter_AddRefs(mRemotePrintJob));
-  if (NS_FAILED(rv) || !mRemotePrintJob) {
+  mRemotePrintJob = mPrintSession->GetRemotePrintJob();
+  if (!mRemotePrintJob) {
     NS_WARNING("We can't print via the parent without a RemotePrintJobChild.");
     return NS_ERROR_FAILURE;
   }
 
   return NS_OK;
 }
 
 already_AddRefed<PrintTarget>
--- a/widget/nsIDragSession.idl
+++ b/widget/nsIDragSession.idl
@@ -33,22 +33,16 @@ interface nsIDragSession : nsISupports
   attribute boolean onlyChromeDrop;
   
   /**
     * Sets the action (copy, move, link, et.c) for the current drag 
     */ 
   attribute unsigned long dragAction;
   
   /**
-    * Sets the current width and height of the drag target area. 
-    * It will contain the current size of the Frame that the drag is currently in
-    */  
-  [noscript] attribute nsSize targetSize;
- 
-  /**
     * Get the number of items that were dropped
     */
   readonly attribute unsigned long numDropItems;
   
   /**
     * The document where the drag was started, which will be null if the
     * drag originated outside the application. Useful for determining if a drop
     * originated in the same document.
--- a/widget/nsIPrintSession.idl
+++ b/widget/nsIPrintSession.idl
@@ -31,10 +31,10 @@ class RemotePrintJobChild;
 
 [uuid(424ae4bb-10ca-4f35-b84e-eab893322df4)]
 
 interface nsIPrintSession : nsISupports
 {
   /**
    * The remote print job is used for printing via the parent process.
    */
-  [noscript] attribute RemotePrintJobChildPtr remotePrintJob;
+  [notxpcom, nostdcall] attribute RemotePrintJobChildPtr remotePrintJob;
 };
--- a/widget/nsITransferable.idl
+++ b/widget/nsITransferable.idl
@@ -183,20 +183,20 @@ interface nsITransferable : nsISupports
 
   attribute nsIFormatConverter converter;
 
   /**
    * Use of the SetIsPrivateData() method generated by isPrivateData attribute should 
    * be avoided as much as possible because the value set may not reflect the status 
    * of the context in which the transferable was created.
    */
-  [noscript] attribute boolean isPrivateData;
+  [notxpcom, nostdcall] attribute boolean isPrivateData;
 
   /**
    * The principal of the source dom node this transferable was
    * created from and the contentPolicyType for the transferable.
    * Note, currently only used on Windows for network principal and
    * contentPolicyType information in clipboard and drag operations.
    */
-  [noscript] attribute nsIPrincipal requestingPrincipal;
-  [noscript] attribute nsContentPolicyType contentPolicyType;
+  [notxpcom, nostdcall] attribute nsIPrincipal requestingPrincipal;
+  [notxpcom, nostdcall] attribute nsContentPolicyType contentPolicyType;
 
 };
--- a/widget/nsPrintSession.cpp
+++ b/widget/nsPrintSession.cpp
@@ -26,23 +26,19 @@ nsPrintSession::~nsPrintSession()
 }
 
 //-----------------------------------------------------------------------------
 nsresult nsPrintSession::Init()
 {
   return NS_OK;
 }
 
-NS_IMETHODIMP
-nsPrintSession::GetRemotePrintJob(RemotePrintJobChild** aRemotePrintJob)
+RemotePrintJobChild*
+nsPrintSession::GetRemotePrintJob()
 {
-  MOZ_ASSERT(aRemotePrintJob);
-  RefPtr<RemotePrintJobChild> result = mRemotePrintJob;
-  result.forget(aRemotePrintJob);
-  return NS_OK;
+  return mRemotePrintJob;
 }
 
-NS_IMETHODIMP
+void
 nsPrintSession::SetRemotePrintJob(RemotePrintJobChild* aRemotePrintJob)
 {
   mRemotePrintJob = aRemotePrintJob;
-  return NS_OK;
 }
--- a/widget/nsPrintSettingsService.cpp
+++ b/widget/nsPrintSettingsService.cpp
@@ -95,21 +95,17 @@ nsPrintSettingsService::Init()
 NS_IMETHODIMP
 nsPrintSettingsService::SerializeToPrintData(nsIPrintSettings* aSettings,
                                              nsIWebBrowserPrint* aWBP,
                                              PrintData* data)
 {
   nsCOMPtr<nsIPrintSession> session;
   nsresult rv = aSettings->GetPrintSession(getter_AddRefs(session));
   if (NS_SUCCEEDED(rv) && session) {
-    RefPtr<RemotePrintJobChild> remotePrintJob;
-    rv = session->GetRemotePrintJob(getter_AddRefs(remotePrintJob));
-    if (NS_SUCCEEDED(rv)) {
-      data->remotePrintJobChild() = remotePrintJob;
-    }
+    data->remotePrintJobChild() = session->GetRemotePrintJob();
   }
 
   aSettings->GetStartPageRange(&data->startPageRange());
   aSettings->GetEndPageRange(&data->endPageRange());
 
   aSettings->GetEdgeTop(&data->edgeTop());
   aSettings->GetEdgeLeft(&data->edgeLeft());
   aSettings->GetEdgeBottom(&data->edgeBottom());
--- a/widget/nsTransferable.cpp
+++ b/widget/nsTransferable.cpp
@@ -511,62 +511,55 @@ nsTransferable::FlavorsTransferableCanEx
         aFlavors.AppendElement(flavorStr);
       }
     }
   }
 
   return NS_OK;
 }
 
-NS_IMETHODIMP
-nsTransferable::GetIsPrivateData(bool* aIsPrivateData)
+bool
+nsTransferable::GetIsPrivateData()
 {
   MOZ_ASSERT(mInitialized);
 
-  *aIsPrivateData = mPrivateData;
-  return NS_OK;
+  return mPrivateData;
 }
 
-NS_IMETHODIMP
+void
 nsTransferable::SetIsPrivateData(bool aIsPrivateData)
 {
   MOZ_ASSERT(mInitialized);
 
   mPrivateData = aIsPrivateData;
-  return NS_OK;
 }
 
-NS_IMETHODIMP
-nsTransferable::GetRequestingPrincipal(nsIPrincipal** aRequestingPrincipal)
+nsIPrincipal*
+nsTransferable::GetRequestingPrincipal()
 {
   MOZ_ASSERT(mInitialized);
 
-  nsCOMPtr<nsIPrincipal> principal = mRequestingPrincipal;
-  principal.forget(aRequestingPrincipal);
-  return NS_OK;
+  return mRequestingPrincipal;
 }
 
-NS_IMETHODIMP
+void
 nsTransferable::SetRequestingPrincipal(nsIPrincipal* aRequestingPrincipal)
 {
   MOZ_ASSERT(mInitialized);
 
   mRequestingPrincipal = aRequestingPrincipal;
-  return NS_OK;
 }
 
-NS_IMETHODIMP
-nsTransferable::GetContentPolicyType(nsContentPolicyType* aContentPolicyType)
+nsContentPolicyType
+nsTransferable::GetContentPolicyType()
 {
   MOZ_ASSERT(mInitialized);
 
-  *aContentPolicyType = mContentPolicyType;
-  return NS_OK;
+  return mContentPolicyType;
 }
 
-NS_IMETHODIMP
+void
 nsTransferable::SetContentPolicyType(nsContentPolicyType aContentPolicyType)
 {
   MOZ_ASSERT(mInitialized);
 
   mContentPolicyType = aContentPolicyType;
-  return NS_OK;
 }
--- a/widget/windows/nsDataObj.cpp
+++ b/widget/windows/nsDataObj.cpp
@@ -338,22 +338,21 @@ HRESULT nsDataObj::CreateStream(IStream 
     return res;
 
   nsDataObj::CStream *pStream = new nsDataObj::CStream();
   NS_ENSURE_TRUE(pStream, E_OUTOFMEMORY);
 
   pStream->AddRef();
 
   // query the requestingPrincipal from the transferable and add it to the new channel
-  nsCOMPtr<nsIPrincipal> requestingPrincipal;
-  mTransferable->GetRequestingPrincipal(getter_AddRefs(requestingPrincipal));
+  nsCOMPtr<nsIPrincipal> requestingPrincipal =
+    mTransferable->GetRequestingPrincipal();
   MOZ_ASSERT(requestingPrincipal, "can not create channel without a principal");
-  // default transferable content policy is nsIContentPolicy::TYPE_OTHER
-  uint32_t contentPolicyType = nsIContentPolicy::TYPE_OTHER;
-  mTransferable->GetContentPolicyType(&contentPolicyType);
+
+  uint32_t contentPolicyType = mTransferable->GetContentPolicyType();
   rv = pStream->Init(sourceURI, contentPolicyType, requestingPrincipal);
   if (NS_FAILED(rv))
   {
     pStream->Release();
     return E_FAIL;
   }
   *outStream = pStream;