mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 04:15:43 +00:00
Bug 780507 - Expose the idle service only to certified apps (and chrome). r=mounir
--HG-- extra : rebase_source : e4dfcb9b3416ee4ada8e4a6fd2e7f5b37b722bfe
This commit is contained in:
parent
752c1c2e43
commit
e428373c2e
@ -652,6 +652,19 @@ Navigator::AddIdleObserver(nsIIdleObserver* aIdleObserver)
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> win = do_QueryReferent(mWindow);
|
||||
NS_ENSURE_TRUE(win, NS_ERROR_UNEXPECTED);
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = win->GetExtantDoc();
|
||||
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
|
||||
|
||||
nsIPrincipal* principal = doc->NodePrincipal();
|
||||
if (!nsContentUtils::IsSystemPrincipal(principal)) {
|
||||
PRUint16 appStatus = nsIPrincipal::APP_STATUS_NOT_INSTALLED;
|
||||
principal->GetAppStatus(&appStatus);
|
||||
if (appStatus != nsIPrincipal::APP_STATUS_CERTIFIED) {
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
}
|
||||
|
||||
if (NS_FAILED(win->RegisterIdleObserver(aIdleObserver))) {
|
||||
NS_WARNING("Failed to add idle observer.");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user