Fixing bug 316794. Moving HandleDOMEvent() and Get/SetDocShell from nsIScriptGlobalObject to nsPIDOMWindow. r=mrbkap@gmail.com, sr=peterv@propagandism.org
git-svn-id: svn://10.0.0.236/trunk@185351 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -58,7 +58,7 @@
|
||||
#include "nsPIPluginInstancePeer.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIScriptContext.h"
|
||||
|
||||
@@ -50,10 +50,8 @@
|
||||
#include "nsPluginLogging.h"
|
||||
|
||||
#include "nsPIPluginInstancePeer.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
|
||||
#include "nsJSNPRuntime.h"
|
||||
|
||||
@@ -880,11 +878,10 @@ NS_IMETHODIMP ns4xPluginInstance::Stop(void)
|
||||
|
||||
// Make sure the plugin didn't leave popups enabled.
|
||||
if (mPopupStates.Count() > 0) {
|
||||
nsCOMPtr<nsIDOMWindow> window = GetDOMWindow();
|
||||
nsCOMPtr<nsPIDOMWindow> piwindow = do_QueryInterface(window);
|
||||
nsCOMPtr<nsPIDOMWindow> window = GetDOMWindow();
|
||||
|
||||
if (piwindow) {
|
||||
piwindow->PopPopupControlState(openAbused);
|
||||
if (window) {
|
||||
window->PopPopupControlState(openAbused);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -938,7 +935,7 @@ NS_IMETHODIMP ns4xPluginInstance::Stop(void)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMWindow>
|
||||
already_AddRefed<nsPIDOMWindow>
|
||||
ns4xPluginInstance::GetDOMWindow()
|
||||
{
|
||||
nsCOMPtr<nsPIPluginInstancePeer> pp (do_QueryInterface(mPeer));
|
||||
@@ -960,16 +957,7 @@ ns4xPluginInstance::GetDOMWindow()
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsIScriptGlobalObject *sgo = doc->GetScriptGlobalObject();
|
||||
|
||||
if (!sgo) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsIDOMWindow *window;
|
||||
CallQueryInterface(sgo, &window);
|
||||
|
||||
return window;
|
||||
return doc->GetWindow();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
@@ -1612,20 +1600,18 @@ ns4xPluginInstance::GetFormValue(nsAString& aValue)
|
||||
void
|
||||
ns4xPluginInstance::PushPopupsEnabledState(PRBool aEnabled)
|
||||
{
|
||||
nsCOMPtr<nsIDOMWindow> window = GetDOMWindow();
|
||||
nsCOMPtr<nsPIDOMWindow> piwindow = do_QueryInterface(window);
|
||||
|
||||
if (!piwindow)
|
||||
nsCOMPtr<nsPIDOMWindow> window = GetDOMWindow();
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
PopupControlState oldState =
|
||||
piwindow->PushPopupControlState(aEnabled ? openAllowed : openAbused,
|
||||
PR_TRUE);
|
||||
window->PushPopupControlState(aEnabled ? openAllowed : openAbused,
|
||||
PR_TRUE);
|
||||
|
||||
if (!mPopupStates.AppendElement(NS_INT32_TO_PTR(oldState))) {
|
||||
// Appending to our state stack failed, push what we just popped.
|
||||
|
||||
piwindow->PopPopupControlState(oldState);
|
||||
window->PopPopupControlState(oldState);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1640,16 +1626,14 @@ ns4xPluginInstance::PopPopupsEnabledState()
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> window = GetDOMWindow();
|
||||
nsCOMPtr<nsPIDOMWindow> piwindow = do_QueryInterface(window);
|
||||
|
||||
if (!piwindow)
|
||||
nsCOMPtr<nsPIDOMWindow> window = GetDOMWindow();
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
PopupControlState oldState =
|
||||
(PopupControlState)NS_PTR_TO_INT32(mPopupStates[last]);
|
||||
|
||||
piwindow->PopPopupControlState(oldState);
|
||||
window->PopPopupControlState(oldState);
|
||||
|
||||
mPopupStates.RemoveElementAt(last);
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class ns4xPluginStreamListener;
|
||||
class nsIDOMWindow;
|
||||
class nsPIDOMWindow;
|
||||
|
||||
struct nsInstanceStream
|
||||
{
|
||||
@@ -182,7 +182,7 @@ public:
|
||||
return mPeer;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMWindow> GetDOMWindow();
|
||||
already_AddRefed<nsPIDOMWindow> GetDOMWindow();
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
@@ -5713,7 +5713,8 @@ NS_IMETHODIMP nsPluginHostImpl::NewPluginURLStream(const nsString& aURL,
|
||||
|
||||
if (doc)
|
||||
{
|
||||
// Get the script global object owner and use that as the notification callback
|
||||
// Get the script global object owner and use that as the
|
||||
// notification callback.
|
||||
nsIScriptGlobalObject* global = doc->GetScriptGlobalObject();
|
||||
|
||||
if (global)
|
||||
|
||||
Reference in New Issue
Block a user