Bug 1525208 - Part 5: Avoid using SameCOMIdentity to compare windows inside ThirdPartyUtil::IsThirdPartyWindow(); r=baku

Depends on D18646

Differential Revision: https://phabricator.services.mozilla.com/D18647

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ehsan Akhgari 2019-02-05 18:11:52 +00:00
parent 4eb46262c5
commit d7f642dba2

View File

@ -164,7 +164,12 @@ ThirdPartyUtil::IsThirdPartyWindow(mozIDOMWindowProxy* aWindow, nsIURI* aURI,
// We use GetScriptableParent rather than GetParent because we consider
// <iframe mozbrowser> to be a top-level frame.
parent = current->GetScriptableParent();
if (SameCOMIdentity(parent, current)) {
// We don't use SameCOMIdentity here since we know that nsPIDOMWindowOuter
// is only implemented by nsGlobalWindowOuter, so different objects of that
// type will not have different nsISupports COM identities, and checking the
// actual COM identity using SameCOMIdentity is expensive due to the virtual
// calls involved.
if (parent == current) {
// We're at the topmost content window. We already know the answer.
*aResult = false;
return NS_OK;