зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1179718 - Convert BrowserElement.webidl to use CheckAllPermissions. r=bz
This commit is contained in:
Родитель
a5886f19c7
Коммит
abd5560402
|
@ -478,29 +478,9 @@ nsBrowserElement::SetInputMethodActive(bool aIsActive,
|
||||||
{
|
{
|
||||||
NS_ENSURE_TRUE(IsBrowserElementOrThrow(aRv), nullptr);
|
NS_ENSURE_TRUE(IsBrowserElementOrThrow(aRv), nullptr);
|
||||||
|
|
||||||
nsCOMPtr<nsIFrameLoader> frameLoader = GetFrameLoader();
|
|
||||||
if (!frameLoader) {
|
|
||||||
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMElement> ownerElement;
|
|
||||||
nsresult rv = frameLoader->GetOwnerElement(getter_AddRefs(ownerElement));
|
|
||||||
if (NS_FAILED(rv)) {
|
|
||||||
aRv.Throw(rv);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsINode> node = do_QueryInterface(ownerElement);
|
|
||||||
nsCOMPtr<nsIPrincipal> principal = node->NodePrincipal();
|
|
||||||
if (!nsContentUtils::IsExactSitePermAllow(principal, "input-manage")) {
|
|
||||||
aRv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMDOMRequest> req;
|
nsCOMPtr<nsIDOMDOMRequest> req;
|
||||||
rv = mBrowserElementAPI->SetInputMethodActive(aIsActive,
|
nsresult rv = mBrowserElementAPI->SetInputMethodActive(aIsActive,
|
||||||
getter_AddRefs(req));
|
getter_AddRefs(req));
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
if (rv == NS_ERROR_INVALID_ARG) {
|
if (rv == NS_ERROR_INVALID_ARG) {
|
||||||
aRv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR);
|
aRv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR);
|
||||||
|
@ -652,27 +632,7 @@ nsBrowserElement::SetNFCFocus(bool aIsFocus,
|
||||||
{
|
{
|
||||||
NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
|
NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
|
||||||
|
|
||||||
nsRefPtr<nsFrameLoader> frameLoader = GetFrameLoader();
|
nsresult rv = mBrowserElementAPI->SetNFCFocus(aIsFocus);
|
||||||
if (!frameLoader) {
|
|
||||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMElement> ownerElement;
|
|
||||||
nsresult rv = frameLoader->GetOwnerElement(getter_AddRefs(ownerElement));
|
|
||||||
if (NS_FAILED(rv)) {
|
|
||||||
aRv.Throw(rv);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsINode> node = do_QueryInterface(ownerElement);
|
|
||||||
nsCOMPtr<nsIPrincipal> principal = node->NodePrincipal();
|
|
||||||
if (!nsContentUtils::IsExactSitePermAllow(principal, "nfc-manager")) {
|
|
||||||
aRv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
rv = mBrowserElementAPI->SetNFCFocus(aIsFocus);
|
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,13 +146,12 @@ interface BrowserElementPrivileged {
|
||||||
|
|
||||||
[Throws,
|
[Throws,
|
||||||
Pref="dom.mozBrowserFramesEnabled",
|
Pref="dom.mozBrowserFramesEnabled",
|
||||||
CheckPermissions="browser"]
|
CheckAllPermissions="browser input-manage"]
|
||||||
DOMRequest setInputMethodActive(boolean isActive);
|
DOMRequest setInputMethodActive(boolean isActive);
|
||||||
|
|
||||||
// Additional |nfc-manager| permission is required for setNFCFocus API
|
|
||||||
[Throws,
|
[Throws,
|
||||||
Pref="dom.mozBrowserFramesEnabled",
|
Pref="dom.mozBrowserFramesEnabled",
|
||||||
CheckPermissions="browser"]
|
CheckAllPermissions="browser setNFCFocus"]
|
||||||
void setNFCFocus(boolean isFocus);
|
void setNFCFocus(boolean isFocus);
|
||||||
|
|
||||||
[Throws,
|
[Throws,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче