Bug 1340578 - Allow execCommand('paste') to be called from webextensions without a target, r=ehsan
This commit is contained in:
@@ -3242,9 +3242,10 @@ nsHTMLDocument::ExecCommand(const nsAString& commandID,
|
||||
|
||||
bool isCutCopy = (commandID.LowerCaseEqualsLiteral("cut") ||
|
||||
commandID.LowerCaseEqualsLiteral("copy"));
|
||||
bool isPaste = commandID.LowerCaseEqualsLiteral("paste");
|
||||
|
||||
// if editing is not on, bail
|
||||
if (!isCutCopy && !IsEditingOnAfterFlush()) {
|
||||
if (!isCutCopy && !isPaste && !IsEditingOnAfterFlush()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -3285,9 +3286,8 @@ nsHTMLDocument::ExecCommand(const nsAString& commandID,
|
||||
return false;
|
||||
}
|
||||
|
||||
bool restricted = commandID.LowerCaseEqualsLiteral("paste");
|
||||
if (restricted && !nsContentUtils::PrincipalHasPermission(&aSubjectPrincipal,
|
||||
nsGkAtoms::clipboardRead)) {
|
||||
if (isPaste && !nsContentUtils::PrincipalHasPermission(&aSubjectPrincipal,
|
||||
nsGkAtoms::clipboardRead)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user