зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1334080 - If a plugin is associated with a window that has no nsIWebNavigation, don't crash, r=qdot
MozReview-Commit-ID: CZLne2N498d --HG-- extra : rebase_source : aac04a1c16824fde27e3869109e7e8b591ce9296
This commit is contained in:
Родитель
a112ccc40d
Коммит
2772deba78
|
@ -1291,19 +1291,28 @@ nsPluginStreamListenerPeer::GetInterfaceGlobal(const nsIID& aIID, void** result)
|
|||
}
|
||||
|
||||
RefPtr<nsPluginInstanceOwner> owner = mPluginInstance->GetOwner();
|
||||
if (owner) {
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
nsresult rv = owner->GetDocument(getter_AddRefs(doc));
|
||||
if (NS_SUCCEEDED(rv) && doc) {
|
||||
if (nsPIDOMWindowOuter *window = doc->GetWindow()) {
|
||||
nsCOMPtr<nsIWebNavigation> webNav = do_GetInterface(window);
|
||||
nsCOMPtr<nsIInterfaceRequestor> ir = do_QueryInterface(webNav);
|
||||
return ir->GetInterface(aIID, result);
|
||||
}
|
||||
}
|
||||
if (!owner) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
nsresult rv = owner->GetDocument(getter_AddRefs(doc));
|
||||
if (NS_FAILED(rv) || !doc) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsPIDOMWindowOuter *window = doc->GetWindow();
|
||||
if (!window) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIWebNavigation> webNav = do_GetInterface(window);
|
||||
nsCOMPtr<nsIInterfaceRequestor> ir = do_QueryInterface(webNav);
|
||||
if (!ir) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return ir->GetInterface(aIID, result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
Загрузка…
Ссылка в новой задаче