Bug 1179718 - Convert BrowserElement.webidl to use CheckAllPermissions. r=bz

This commit is contained in:
Kan-Ru Chen 2015-07-03 16:07:06 +08:00
Родитель a5886f19c7
Коммит abd5560402
2 изменённых файлов: 5 добавлений и 46 удалений

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

@ -478,29 +478,9 @@ nsBrowserElement::SetInputMethodActive(bool aIsActive,
{
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;
rv = mBrowserElementAPI->SetInputMethodActive(aIsActive,
getter_AddRefs(req));
nsresult rv = mBrowserElementAPI->SetInputMethodActive(aIsActive,
getter_AddRefs(req));
if (NS_WARN_IF(NS_FAILED(rv))) {
if (rv == NS_ERROR_INVALID_ARG) {
aRv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR);
@ -652,27 +632,7 @@ nsBrowserElement::SetNFCFocus(bool aIsFocus,
{
NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
nsRefPtr<nsFrameLoader> frameLoader = GetFrameLoader();
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);
nsresult rv = mBrowserElementAPI->SetNFCFocus(aIsFocus);
if (NS_WARN_IF(NS_FAILED(rv))) {
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
}

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

@ -146,13 +146,12 @@ interface BrowserElementPrivileged {
[Throws,
Pref="dom.mozBrowserFramesEnabled",
CheckPermissions="browser"]
CheckAllPermissions="browser input-manage"]
DOMRequest setInputMethodActive(boolean isActive);
// Additional |nfc-manager| permission is required for setNFCFocus API
[Throws,
Pref="dom.mozBrowserFramesEnabled",
CheckPermissions="browser"]
CheckAllPermissions="browser setNFCFocus"]
void setNFCFocus(boolean isFocus);
[Throws,