diff --git a/dom/events/DataTransfer.cpp b/dom/events/DataTransfer.cpp index f29a19dde476..b209ba55a8f2 100644 --- a/dom/events/DataTransfer.cpp +++ b/dom/events/DataTransfer.cpp @@ -336,7 +336,8 @@ bool DataTransfer::HasType(const nsAString& aType) const { bool DataTransfer::HasFile() const { return mItems->HasFile(); } void DataTransfer::GetData(const nsAString& aFormat, nsAString& aData, - nsIPrincipal& aSubjectPrincipal, ErrorResult& aRv) { + nsIPrincipal& aSubjectPrincipal, + ErrorResult& aRv) const { // return an empty string if data for the format was not found aData.Truncate(); @@ -481,7 +482,7 @@ already_AddRefed DataTransfer::MozTypesAt( nsresult DataTransfer::GetDataAtNoSecurityCheck(const nsAString& aFormat, uint32_t aIndex, - nsIVariant** aData) { + nsIVariant** aData) const { return GetDataAtInternal(aFormat, aIndex, nsContentUtils::GetSystemPrincipal(), aData); } @@ -489,7 +490,7 @@ nsresult DataTransfer::GetDataAtNoSecurityCheck(const nsAString& aFormat, nsresult DataTransfer::GetDataAtInternal(const nsAString& aFormat, uint32_t aIndex, nsIPrincipal* aSubjectPrincipal, - nsIVariant** aData) { + nsIVariant** aData) const { *aData = nullptr; if (aFormat.IsEmpty()) { diff --git a/dom/events/DataTransfer.h b/dom/events/DataTransfer.h index 1d3305e940ae..3612060942cb 100644 --- a/dom/events/DataTransfer.h +++ b/dom/events/DataTransfer.h @@ -202,7 +202,7 @@ class DataTransfer final : public nsISupports, public nsWrapperCache { bool HasFile() const; void GetData(const nsAString& aFormat, nsAString& aData, - nsIPrincipal& aSubjectPrincipal, ErrorResult& aRv); + nsIPrincipal& aSubjectPrincipal, ErrorResult& aRv) const; void SetData(const nsAString& aFormat, const nsAString& aData, nsIPrincipal& aSubjectPrincipal, ErrorResult& aRv); @@ -281,7 +281,7 @@ class DataTransfer final : public nsISupports, public nsWrapperCache { mozilla::dom::Element* GetDragTarget() const { return mDragTarget; } nsresult GetDataAtNoSecurityCheck(const nsAString& aFormat, uint32_t aIndex, - nsIVariant** aData); + nsIVariant** aData) const; DataTransferItemList* Items() const { return mItems; } @@ -421,7 +421,7 @@ class DataTransfer final : public nsISupports, public nsWrapperCache { FileList* GetFilesInternal(ErrorResult& aRv, nsIPrincipal* aSubjectPrincipal); nsresult GetDataAtInternal(const nsAString& aFormat, uint32_t aIndex, nsIPrincipal* aSubjectPrincipal, - nsIVariant** aData); + nsIVariant** aData) const; nsresult SetDataAtInternal(const nsAString& aFormat, nsIVariant* aData, uint32_t aIndex, nsIPrincipal* aSubjectPrincipal); diff --git a/editor/libeditor/HTMLEditor.h b/editor/libeditor/HTMLEditor.h index 53764a188aea..0b6354e9e644 100644 --- a/editor/libeditor/HTMLEditor.h +++ b/editor/libeditor/HTMLEditor.h @@ -4172,9 +4172,10 @@ class HTMLEditor final : public TextEditor, * InsertFromDataTransfer() is called only when user drops data into * this editor. Don't use this method for other purposes. */ - MOZ_CAN_RUN_SCRIPT nsresult InsertFromDataTransfer( - dom::DataTransfer* aDataTransfer, int32_t aIndex, Document* aSourceDoc, - const EditorDOMPoint& aDroppedAt, bool aDoDeleteSelection); + MOZ_CAN_RUN_SCRIPT nsresult + InsertFromDataTransfer(const dom::DataTransfer* aDataTransfer, int32_t aIndex, + Document* aSourceDoc, const EditorDOMPoint& aDroppedAt, + bool aDoDeleteSelection); bool HavePrivateHTMLFlavor(nsIClipboard* clipboard); diff --git a/editor/libeditor/HTMLEditorDataTransfer.cpp b/editor/libeditor/HTMLEditorDataTransfer.cpp index eaca987513f8..11e3412c5f62 100644 --- a/editor/libeditor/HTMLEditorDataTransfer.cpp +++ b/editor/libeditor/HTMLEditorDataTransfer.cpp @@ -1771,7 +1771,7 @@ nsresult HTMLEditor::InsertFromTransferable(nsITransferable* aTransferable, return NS_OK; } -static void GetStringFromDataTransfer(DataTransfer* aDataTransfer, +static void GetStringFromDataTransfer(const DataTransfer* aDataTransfer, const nsAString& aType, int32_t aIndex, nsString& aOutputString) { nsCOMPtr variant; @@ -1788,7 +1788,7 @@ static void GetStringFromDataTransfer(DataTransfer* aDataTransfer, nsContentUtils::PlatformToDOMLineBreaks(aOutputString); } -nsresult HTMLEditor::InsertFromDataTransfer(DataTransfer* aDataTransfer, +nsresult HTMLEditor::InsertFromDataTransfer(const DataTransfer* aDataTransfer, int32_t aIndex, Document* aSourceDoc, const EditorDOMPoint& aDroppedAt,