mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1317720. Use NeedsCallerType instead of NeedsSubjectPrincipal for DataTransfer.types. r=mystor
This commit is contained in:
parent
dda84c3ef8
commit
784a52fd02
@ -311,8 +311,7 @@ DataTransfer::GetFiles(nsIDOMFileList** aFileList)
|
||||
}
|
||||
|
||||
void
|
||||
DataTransfer::GetTypes(nsTArray<nsString>& aTypes,
|
||||
nsIPrincipal& aSubjectPrincipal) const
|
||||
DataTransfer::GetTypes(nsTArray<nsString>& aTypes, CallerType aCallerType) const
|
||||
{
|
||||
// When called from bindings, aTypes will be empty, but since we might have
|
||||
// Gecko-internal callers too, clear it to be safe.
|
||||
@ -327,7 +326,7 @@ DataTransfer::GetTypes(nsTArray<nsString>& aTypes,
|
||||
DataTransferItem* item = items->ElementAt(i);
|
||||
MOZ_ASSERT(item);
|
||||
|
||||
if (item->ChromeOnly() && !nsContentUtils::IsSystemPrincipal(&aSubjectPrincipal)) {
|
||||
if (item->ChromeOnly() && aCallerType != CallerType::System) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -136,8 +136,7 @@ public:
|
||||
void SetDragImage(Element& aElement, int32_t aX, int32_t aY,
|
||||
ErrorResult& aRv);
|
||||
|
||||
void GetTypes(nsTArray<nsString>& aTypes,
|
||||
nsIPrincipal& aSubjectPrincipal) const;
|
||||
void GetTypes(nsTArray<nsString>& aTypes, CallerType aCallerType) const;
|
||||
|
||||
void GetData(const nsAString& aFormat, nsAString& aData,
|
||||
nsIPrincipal& aSubjectPrincipal,
|
||||
|
@ -19,7 +19,7 @@ interface DataTransfer {
|
||||
|
||||
// ReturnValueNeedsContainsHack on .types because lots of extension
|
||||
// code was expecting .contains() back when it was a DOMStringList.
|
||||
[Pure, Cached, Frozen, NeedsSubjectPrincipal, ReturnValueNeedsContainsHack]
|
||||
[Pure, Cached, Frozen, NeedsCallerType, ReturnValueNeedsContainsHack]
|
||||
readonly attribute sequence<DOMString> types;
|
||||
[Throws, NeedsSubjectPrincipal]
|
||||
DOMString getData(DOMString format);
|
||||
|
@ -935,7 +935,7 @@ EditorEventListener::CanDrop(nsIDOMDragEvent* aEvent)
|
||||
NS_ENSURE_TRUE(dataTransfer, false);
|
||||
|
||||
nsTArray<nsString> types;
|
||||
dataTransfer->GetTypes(types, *nsContentUtils::GetSystemPrincipal());
|
||||
dataTransfer->GetTypes(types, CallerType::System);
|
||||
|
||||
// Plaintext editors only support dropping text. Otherwise, HTML and files
|
||||
// can be dropped as well.
|
||||
|
@ -380,7 +380,7 @@ nsFileControlFrame::DnDListener::IsValidDropData(nsIDOMDataTransfer* aDOMDataTra
|
||||
|
||||
// We only support dropping files onto a file upload control
|
||||
nsTArray<nsString> types;
|
||||
dataTransfer->GetTypes(types, *nsContentUtils::GetSystemPrincipal());
|
||||
dataTransfer->GetTypes(types, CallerType::System);
|
||||
|
||||
return types.Contains(NS_LITERAL_STRING("Files"));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user