Bug 1317599. Get rid of LegacyIsCallerChromeOrNativeCode use in datatransfer code. r=mystor

This commit is contained in:
Boris Zbarsky 2016-11-15 12:46:32 -05:00
Родитель e04996b20a
Коммит dda84c3ef8
5 изменённых файлов: 8 добавлений и 20 удалений

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

@ -498,7 +498,8 @@ DataTransfer::GetMozSourceNode(nsIDOMNode** aSourceNode)
}
already_AddRefed<DOMStringList>
DataTransfer::MozTypesAt(uint32_t aIndex, ErrorResult& aRv) const
DataTransfer::MozTypesAt(uint32_t aIndex, CallerType aCallerType,
ErrorResult& aRv) const
{
// Only the first item is valid for clipboard events
if (aIndex > 0 &&
@ -515,7 +516,7 @@ DataTransfer::MozTypesAt(uint32_t aIndex, ErrorResult& aRv) const
bool addFile = false;
for (uint32_t i = 0; i < items.Length(); i++) {
if (items[i]->ChromeOnly() && !nsContentUtils::LegacyIsCallerChromeOrNativeCode()) {
if (items[i]->ChromeOnly() && aCallerType != CallerType::System) {
continue;
}
@ -539,15 +540,6 @@ DataTransfer::MozTypesAt(uint32_t aIndex, ErrorResult& aRv) const
return types.forget();
}
NS_IMETHODIMP
DataTransfer::MozTypesAt(uint32_t aIndex, nsISupports** aTypes)
{
ErrorResult rv;
RefPtr<DOMStringList> types = MozTypesAt(aIndex, rv);
types.forget(aTypes);
return rv.StealNSResult();
}
nsresult
DataTransfer::GetDataAtNoSecurityCheck(const nsAString& aFormat,
uint32_t aIndex,

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

@ -18,6 +18,7 @@
#include "mozilla/Attributes.h"
#include "mozilla/EventForwards.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/File.h"
class nsINode;
@ -178,6 +179,7 @@ public:
}
already_AddRefed<DOMStringList> MozTypesAt(uint32_t aIndex,
CallerType aCallerType,
mozilla::ErrorResult& aRv) const;
void MozClearDataAt(const nsAString& aFormat, uint32_t aIndex,

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

@ -116,13 +116,6 @@ interface nsIDOMDataTransfer : nsISupports
*/
attribute DOMString mozCursor;
/**
* Holds a list of the format types of the data that is stored for an item
* at the specified index. If the index is not in the range from 0 to
* itemCount - 1, an empty string list is returned.
*/
nsISupports mozTypesAt(in unsigned long index);
/**
* Will be true when the user has cancelled the drag (typically by pressing
* Escape) and when the drag has been cancelled unexpectedly. This will be

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

@ -76,7 +76,7 @@ partial interface DataTransfer {
* at the specified index. If the index is not in the range from 0 to
* itemCount - 1, an empty string list is returned.
*/
[Throws]
[Throws, NeedsCallerType]
DOMStringList mozTypesAt(unsigned long index);
/**

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

@ -1274,7 +1274,8 @@ HTMLEditor::InsertFromDataTransfer(DataTransfer* aDataTransfer,
bool aDoDeleteSelection)
{
ErrorResult rv;
RefPtr<DOMStringList> types = aDataTransfer->MozTypesAt(aIndex, rv);
RefPtr<DOMStringList> types =
aDataTransfer->MozTypesAt(aIndex, CallerType::System, rv);
if (rv.Failed()) {
return rv.StealNSResult();
}