Closed Bug 22598 Opened 25 years ago Closed 25 years ago

No access to document from a plugin

Categories

(Core Graveyard :: Plug-ins, enhancement, P3)

All
Windows NT
enhancement

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: serhunt, Assigned: serhunt)

Details

Current plugin API does not allow to access document.
Proposed fix is to add a method to nsIPluginTagInfo as follows:

nsIPluginTagInfo.h

   NS_IMETHOD GetDOMElement(nsIDOMElement* *result) = 0;
==================
nsPluginInstancePeer.h

class nsPluginInstancePeerImpl
...
   NS_IMETHOD GetDOMElement(nsIDOMElement* *result);
==================
nsPluginInstancePeer.cpp

NS_IMETHODIMP nsPluginInstancePeerImpl::GetDOMElement(nsIDOMElement* *result)
{
  if (nsnull != mOwner)
  {
    nsIPluginTagInfo  *tinfo;
    nsresult          rv;

    rv = mOwner->QueryInterface(kIPluginTagInfoIID, (void **)&tinfo);

    if (NS_OK == rv)
    {
      rv = tinfo->GetDOMElement(result);
      NS_RELEASE(tinfo);
    }

    return rv;
  }
  else
  {
    *result = nsnull;
    return NS_ERROR_FAILURE;
  }
}
==================
nsObjectFrame.cpp

class nsPluginInstanceOwner
...
  NS_IMETHOD GetDOMElement(nsIDOMElement* *result);
...
NS_IMETHODIMP nsPluginInstanceOwner::GetDOMElement(nsIDOMElement* *result)
{
  nsresult rv = NS_ERROR_FAILURE;

  *result = nsnull;

  if (nsnull != mOwner)
  {
    nsIContent  *cont;

    mOwner->GetContent(&cont);

    if (nsnull != cont)
    {
      rv = cont->QueryInterface(nsIDOMElement::GetIID(), (void **)result);
      NS_RELEASE(cont);
    }
  }
  return rv;
}
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Checked in.
Andrei, please mark this bug as VERIFIED.
QA Contact: shrir → av
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.