mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-09 09:18:42 +09:00
Issue #2361 - Base implementation of Navigator.Clipboard
This hard-refuses any reads from clipboard with a promise rejection.
This commit is contained in:
parent
c4fdd1d9ee
commit
3478c01fc8
13 changed files with 327 additions and 11 deletions
|
|
@ -1204,16 +1204,12 @@ DataTransfer::ConvertFromVariant(nsIVariant* aVariant,
|
|||
return true;
|
||||
}
|
||||
|
||||
char16_t* chrs;
|
||||
uint32_t len = 0;
|
||||
nsresult rv = aVariant->GetAsWStringWithSize(&len, &chrs);
|
||||
nsAutoString str;
|
||||
nsresult rv = aVariant->GetAsAString(str);
|
||||
if (NS_FAILED(rv)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsAutoString str;
|
||||
str.Adopt(chrs, len);
|
||||
|
||||
nsCOMPtr<nsISupportsString>
|
||||
strSupports(do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID));
|
||||
if (!strSupports) {
|
||||
|
|
@ -1225,7 +1221,7 @@ DataTransfer::ConvertFromVariant(nsIVariant* aVariant,
|
|||
strSupports.forget(aSupports);
|
||||
|
||||
// each character is two bytes
|
||||
*aLength = str.Length() << 1;
|
||||
*aLength = str.Length() * 2;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1410,9 +1406,7 @@ DataTransfer::CacheExternalClipboardFormats()
|
|||
return;
|
||||
}
|
||||
|
||||
nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
|
||||
nsCOMPtr<nsIPrincipal> sysPrincipal;
|
||||
ssm->GetSystemPrincipal(getter_AddRefs(sysPrincipal));
|
||||
nsCOMPtr<nsIPrincipal> sysPrincipal = nsContentUtils::GetSystemPrincipal();
|
||||
|
||||
// Check if the clipboard has any files
|
||||
bool hasFileData = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue