зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1654803 - Fixing the crash issue in PermissionDelegateHandler::GetPermission(). r=baku
At very rare situations, we won't be able to get the top level window context. Perhaps, it's the case that the window has been detached from the dom tree while checking the permission. So, we need to check the top level window context before we really use it. Differential Revision: https://phabricator.services.mozilla.com/D85978
This commit is contained in:
Родитель
8b5b04028f
Коммит
aaf012c1e2
|
@ -262,7 +262,7 @@ nsresult PermissionDelegateHandler::GetPermission(const nsACString& aType,
|
|||
bc) {
|
||||
RefPtr<WindowContext> topWC = bc->GetTopWindowContext();
|
||||
|
||||
if (topWC->IsInProcess()) {
|
||||
if (topWC && topWC->IsInProcess()) {
|
||||
// If the top-level window context is in the same process, we directly get
|
||||
// the node principal from the top-level document to test the permission.
|
||||
// We cannot check the lists in the window context in this case since the
|
||||
|
@ -276,7 +276,7 @@ nsresult PermissionDelegateHandler::GetPermission(const nsACString& aType,
|
|||
if (topDoc) {
|
||||
principal = topDoc->NodePrincipal();
|
||||
}
|
||||
} else {
|
||||
} else if (topWC) {
|
||||
// Get the delegated permissions from the top-level window context.
|
||||
DelegatedPermissionList list =
|
||||
aExactHostMatch ? topWC->GetDelegatedExactHostMatchPermissions()
|
||||
|
|
Загрузка…
Ссылка в новой задаче