Fixing bug 318106. Stop assertion about setting mutation bits on outer window. r+sr=bzbarsky@mit.edu

This commit is contained in:
jst%mozilla.jstenback.com 2005-11-29 21:51:53 +00:00
Родитель 28be9114ec
Коммит 61c4a775a7
6 изменённых файлов: 27 добавлений и 9 удалений

Просмотреть файл

@ -93,8 +93,8 @@ class nsIDOMUserDataHandler;
// IID for the nsIDocument interface
#define NS_IDOCUMENT_IID \
{ 0x65d26965, 0x8fed, 0x4f55, \
{ 0x80, 0xef, 0xaa, 0xd0, 0x1d, 0xd6, 0x92, 0xfd } }
{ 0xbcb48147, 0xed60, 0x490e, \
{ 0xa2, 0x47, 0xe2, 0x35, 0x3c, 0xf7, 0xc8, 0x68 } }
// Flag for AddStyleSheet().
#define NS_STYLESHEET_FROM_CATALOG (1 << 0)
@ -506,6 +506,13 @@ public:
*/
virtual nsPIDOMWindow *GetWindow() = 0;
/**
* Return the inner window used as the script compilation scope for
* this document. If you're not absolutely sure you need this, use
* GetWindow().
*/
virtual nsPIDOMWindow *GetInnerWindow() = 0;
/**
* Get the script loader for this document
*/

Просмотреть файл

@ -2023,6 +2023,14 @@ nsDocument::GetWindow()
return win->GetOuterWindow();
}
nsPIDOMWindow *
nsDocument::GetInnerWindow()
{
nsCOMPtr<nsPIDOMWindow> win(do_QueryInterface(GetScriptGlobalObject()));
return win;
}
nsIScriptLoader *
nsDocument::GetScriptLoader()
{

Просмотреть файл

@ -455,6 +455,13 @@ public:
*/
virtual nsPIDOMWindow *GetWindow();
/**
* Return the inner window used as the script compilation scope for
* this document. If you're not absolutely sure you need this, use
* GetWindow().
*/
virtual nsPIDOMWindow *GetInnerWindow();
/**
* Get the script loader for this document
*/

Просмотреть файл

@ -740,7 +740,7 @@ nsEventListenerManager::AddEventListener(nsIDOMEventListener *aListener,
document = content->GetOwnerDoc();
else document = do_QueryInterface(mTarget);
if (document)
window = document->GetWindow();
window = document->GetInnerWindow();
else window = do_QueryInterface(mTarget);
if (window) {
NS_ASSERTION(window->IsInnerWindow(),

Просмотреть файл

@ -1735,8 +1735,7 @@ nsGenericHTMLElement::GetEventListenerManagerForAttr(nsIEventListenerManager** a
// override BindToTree for those classes and munge event listeners there?
nsIDocument *document = GetOwnerDoc();
nsresult rv = NS_OK;
if (document && (win = document->GetWindow()) &&
(win = win->GetCurrentInnerWindow())) {
if (document && (win = document->GetInnerWindow())) {
nsCOMPtr<nsIDOMEventReceiver> receiver(do_QueryInterface(win));
NS_ENSURE_TRUE(receiver, NS_ERROR_FAILURE);

Просмотреть файл

@ -565,10 +565,7 @@ nsXULElement::GetEventListenerManagerForAttr(nsIEventListenerManager** aManager,
nsIContent *root = doc->GetRootContent();
if ((!root || root == this) && !mNodeInfo->Equals(nsXULAtoms::overlay)) {
nsPIDOMWindow *window = doc->GetWindow();
if (!window || !(window = window->GetCurrentInnerWindow()))
return NS_ERROR_UNEXPECTED;
nsPIDOMWindow *window = doc->GetInnerWindow();
nsCOMPtr<nsIDOMEventReceiver> receiver = do_QueryInterface(window);
if (!receiver)