bool AssertAppStatus(PBrowserParent* aActor, unsigned short aStatus) { if (!aActor) { NS_WARNING("Testing process capability for null actor"); return false; } TabParent* tab = TabParent::GetFrom(aActor); nsCOMPtr<mozIApplication> app = tab->GetOwnOrContainingApp(); return CheckAppStatusHelper(app, aStatus); }
bool AssertAppProcess(PBrowserParent* aActor, AssertAppProcessType aType, const char* aCapability) { if (!aActor) { NS_WARNING("Testing process capability for null actor"); return false; } TabParent* tab = TabParent::GetFrom(aActor); nsCOMPtr<mozIApplication> app = tab->GetOwnOrContainingApp(); return CheckAppTypeHelper(app, aType, aCapability, tab->IsBrowserElement()); }
bool AssertAppProcess(PBrowserParent* aActor, AssertAppProcessType aType, const char* aCapability) { if (!aActor) { NS_WARNING("Testing process capability for null actor"); return false; } TabParent* tab = static_cast<TabParent*>(aActor); nsCOMPtr<mozIApplication> app = tab->GetOwnOrContainingApp(); bool aValid = false; // isBrowser frames inherit their app descriptor to identify their // data storage, but they don't inherit the capability associated // with that descriptor. if (app && (aType == ASSERT_APP_HAS_PERMISSION || !tab->IsBrowserElement())) { switch (aType) { case ASSERT_APP_HAS_PERMISSION: case ASSERT_APP_PROCESS_PERMISSION: if (!NS_SUCCEEDED(app->HasPermission(aCapability, &aValid))) { aValid = false; } break; case ASSERT_APP_PROCESS_MANIFEST_URL: { nsAutoString manifestURL; if (NS_SUCCEEDED(app->GetManifestURL(manifestURL)) && manifestURL.EqualsASCII(aCapability)) { aValid = true; } break; } default: break; } } if (!aValid) { printf_stderr("Security problem: Content process does not have `%s'. It will be killed.\n", aCapability); ContentParent* process = tab->Manager(); process->KillHard(); } return aValid; }
bool AssertAppStatus(PBrowserParent* aActor, unsigned short aStatus) { if (!aActor) { NS_WARNING("Testing process capability for null actor"); return false; } TabParent* tab = static_cast<TabParent*>(aActor); nsCOMPtr<mozIApplication> app = tab->GetOwnOrContainingApp(); if (app) { unsigned short appStatus = 0; if (NS_SUCCEEDED(app->GetAppStatus(&appStatus))) { return appStatus == aStatus; } } return false; }