Bug 1507540 part 5. Use more notxpcom attributes in widget/. r=ehsan

This commit is contained in:
Boris Zbarsky 2018-11-19 20:17:54 -05:00
Родитель ec2e099db9
Коммит 0216588e17
15 изменённых файлов: 50 добавлений и 94 удалений

Просмотреть файл

@ -341,11 +341,9 @@ nsContentAreaDragDropDataProvider::GetFlavorData(nsITransferable *aTransferable,
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)) {

Просмотреть файл

@ -5833,12 +5833,11 @@ EventStateManager::DoContentCommandEvent(WidgetContentCommandEvent* aEvent)
&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);

Просмотреть файл

@ -714,9 +714,9 @@ nsPrintJob::DoCommonPrint(bool aIsPrintPreview,
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);
@ -877,9 +877,9 @@ nsPrintJob::DoCommonPrint(bool aIsPrintPreview,
// 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;
@ -3502,9 +3502,9 @@ nsPrintJob::StartPagePrintTimer(const UniquePtr<nsPrintObject>& aPO)
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);
}

Просмотреть файл

@ -158,12 +158,12 @@ nsPrintingProxy::ShowProgress(mozIDOMWindowProxy* parent,
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();
}
}

Просмотреть файл

@ -62,7 +62,7 @@ nsBaseDragService::nsBaseDragService()
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)
{
@ -119,22 +119,6 @@ nsBaseDragService::GetDragAction(uint32_t * anAction)
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

Просмотреть файл

@ -163,7 +163,6 @@ protected:
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

Просмотреть файл

@ -33,12 +33,10 @@ nsClipboardProxy::SetData(nsITransferable *aTransferable,
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);

Просмотреть файл

@ -60,8 +60,8 @@ nsDeviceContextSpecProxy::Init(nsIWidget* aWidget,
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;
}

Просмотреть файл

@ -37,12 +37,6 @@ interface nsIDragSession : nsISupports
*/
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
*/

Просмотреть файл

@ -36,5 +36,5 @@ interface nsIPrintSession : nsISupports
/**
* The remote print job is used for printing via the parent process.
*/
[noscript] attribute RemotePrintJobChildPtr remotePrintJob;
[notxpcom, nostdcall] attribute RemotePrintJobChildPtr remotePrintJob;
};

Просмотреть файл

@ -188,7 +188,7 @@ interface nsITransferable : nsISupports
* 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
@ -196,7 +196,7 @@ interface nsITransferable : nsISupports
* 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;
};

Просмотреть файл

@ -31,18 +31,14 @@ 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;
}

Просмотреть файл

@ -100,11 +100,7 @@ nsPrintSettingsService::SerializeToPrintData(nsIPrintSettings* aSettings,
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());

Просмотреть файл

@ -516,57 +516,50 @@ nsTransferable::FlavorsTransferableCanExport(nsTArray<nsCString>& aFlavors)
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;
}

Просмотреть файл

@ -343,12 +343,11 @@ HRESULT nsDataObj::CreateStream(IStream **outStream)
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))
{