Landing fix for bug 239202, patch by trev@gtchat.de. Making nsIScriptGlobalObjectOwner not scriptable. r+sr=jst@mozilla.org

This commit is contained in:
jst%mozilla.jstenback.com 2004-07-16 17:03:10 +00:00
Родитель 1ebd6baf37
Коммит 693923a31f
25 изменённых файлов: 116 добавлений и 146 удалений

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

@ -57,7 +57,6 @@
#include "nsICSSStyleSheet.h" #include "nsICSSStyleSheet.h"
#include "nsIFrame.h" #include "nsIFrame.h"
#include "nsIScriptGlobalObjectOwner.h"
#include "nsIScriptGlobalObject.h" #include "nsIScriptGlobalObject.h"
#include "nsILinkHandler.h" #include "nsILinkHandler.h"
#include "nsIDOMDocument.h" #include "nsIDOMDocument.h"

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

@ -117,8 +117,6 @@ static const char kPrintingPromptService[] = "@mozilla.org/embedcomp/printingpro
#include "nsISupportsUtils.h" #include "nsISupportsUtils.h"
#include "nsIFrame.h" #include "nsIFrame.h"
#include "nsIScriptContext.h" #include "nsIScriptContext.h"
#include "nsIScriptGlobalObjectOwner.h"
#include "nsIScriptGlobalObject.h"
#include "nsILinkHandler.h" #include "nsILinkHandler.h"
#include "nsIDOMDocument.h" #include "nsIDOMDocument.h"
#include "nsISelectionListener.h" #include "nsISelectionListener.h"

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

@ -2027,7 +2027,7 @@ IsScriptEnabled(nsIDocument *aDoc, nsIDocShell *aContainer)
nsCOMPtr<nsIScriptGlobalObjectOwner> owner = do_GetInterface(aContainer); nsCOMPtr<nsIScriptGlobalObjectOwner> owner = do_GetInterface(aContainer);
NS_ENSURE_TRUE(owner, PR_TRUE); NS_ENSURE_TRUE(owner, PR_TRUE);
owner->GetScriptGlobalObject(getter_AddRefs(globalObject)); globalObject = owner->GetScriptGlobalObject();
NS_ENSURE_TRUE(globalObject, PR_TRUE); NS_ENSURE_TRUE(globalObject, PR_TRUE);
} }

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

@ -82,7 +82,6 @@
#include "nsIDOMScriptObjectFactory.h" #include "nsIDOMScriptObjectFactory.h"
#include "nsIPrincipal.h" #include "nsIPrincipal.h"
#include "nsIScriptGlobalObject.h" #include "nsIScriptGlobalObject.h"
#include "nsIScriptGlobalObjectOwner.h"
#include "nsIScriptObjectPrincipal.h" #include "nsIScriptObjectPrincipal.h"
#include "nsIConsoleService.h" #include "nsIConsoleService.h"
#include "nsIScriptError.h" #include "nsIScriptError.h"

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

@ -70,7 +70,6 @@
#include "nsXBLService.h" #include "nsXBLService.h"
#include "nsXBLInsertionPoint.h" #include "nsXBLInsertionPoint.h"
#include "nsIXPConnect.h" #include "nsIXPConnect.h"
#include "nsIScriptGlobalObjectOwner.h"
#include "nsIScriptContext.h" #include "nsIScriptContext.h"
#include "nsCRT.h" #include "nsCRT.h"

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

@ -40,6 +40,7 @@
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsXBLPrototypeBinding.h" #include "nsXBLPrototypeBinding.h"
#include "nsIScriptObjectPrincipal.h" #include "nsIScriptObjectPrincipal.h"
#include "nsIScriptGlobalObject.h"
#include "nsIScriptContext.h" #include "nsIScriptContext.h"
#include "nsIDOMScriptObjectFactory.h" #include "nsIDOMScriptObjectFactory.h"
#include "jsapi.h" #include "jsapi.h"
@ -424,38 +425,20 @@ nsXBLDocumentInfo::FlushSkinStylesheets()
// nsIScriptGlobalObjectOwner methods // nsIScriptGlobalObjectOwner methods
// //
NS_IMETHODIMP nsIScriptGlobalObject*
nsXBLDocumentInfo::GetScriptGlobalObject(nsIScriptGlobalObject** _result) nsXBLDocumentInfo::GetScriptGlobalObject()
{ {
if (!mGlobalObject) { if (!mGlobalObject) {
mGlobalObject = new nsXBLDocGlobalObject(); mGlobalObject = new nsXBLDocGlobalObject();
if (!mGlobalObject) { if (!mGlobalObject)
*_result = nsnull; return nsnull;
return NS_ERROR_OUT_OF_MEMORY;
}
mGlobalObject->SetGlobalObjectOwner(this); // does not refcount mGlobalObject->SetGlobalObjectOwner(this); // does not refcount
} }
*_result = mGlobalObject; return mGlobalObject;
NS_ADDREF(*_result);
return NS_OK;
}
NS_IMETHODIMP
nsXBLDocumentInfo::ReportScriptError(nsIScriptError *errorObject)
{
if (errorObject == nsnull)
return NS_ERROR_NULL_POINTER;
// Get the console service, where we're going to register the error.
nsCOMPtr<nsIConsoleService> consoleService (do_GetService("@mozilla.org/consoleservice;1"));
if (!consoleService)
return NS_ERROR_NOT_AVAILABLE;
return consoleService->LogMessage(errorObject);
} }
nsresult NS_NewXBLDocumentInfo(nsIDocument* aDocument, nsIXBLDocumentInfo** aResult) nsresult NS_NewXBLDocumentInfo(nsIDocument* aDocument, nsIXBLDocumentInfo** aResult)
@ -470,4 +453,3 @@ nsresult NS_NewXBLDocumentInfo(nsIDocument* aDocument, nsIXBLDocumentInfo** aRes
NS_ADDREF(*aResult); NS_ADDREF(*aResult);
return NS_OK; return NS_OK;
} }

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

@ -64,7 +64,7 @@ public:
NS_IMETHOD FlushSkinStylesheets(); NS_IMETHOD FlushSkinStylesheets();
// nsIScriptGlobalObjectOwner methods // nsIScriptGlobalObjectOwner methods
NS_DECL_NSISCRIPTGLOBALOBJECTOWNER virtual nsIScriptGlobalObject* GetScriptGlobalObject();
private: private:
nsCOMPtr<nsIDocument> mDocument; nsCOMPtr<nsIDocument> mDocument;

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

@ -145,8 +145,8 @@ nsXBLProtoImpl::CompilePrototypeMembers(nsXBLPrototypeBinding* aBinding)
// context. // context.
nsCOMPtr<nsIScriptGlobalObjectOwner> globalOwner( nsCOMPtr<nsIScriptGlobalObjectOwner> globalOwner(
do_QueryInterface(aBinding->XBLDocumentInfo())); do_QueryInterface(aBinding->XBLDocumentInfo()));
nsCOMPtr<nsIScriptGlobalObject> globalObject; nsIScriptGlobalObject* globalObject = globalOwner->GetScriptGlobalObject();
globalOwner->GetScriptGlobalObject(getter_AddRefs(globalObject)); NS_ENSURE_TRUE(globalObject, NS_ERROR_UNEXPECTED);
nsIScriptContext *context = globalObject->GetContext(); nsIScriptContext *context = globalObject->GetContext();

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

@ -630,11 +630,11 @@ nsXMLDocument::EndLoad()
nsEventStatus status = nsEventStatus_eIgnore; nsEventStatus status = nsEventStatus_eIgnore;
nsEvent event(NS_PAGE_LOAD); nsEvent event(NS_PAGE_LOAD);
nsCOMPtr<nsIScriptGlobalObject> sgo; nsIScriptGlobalObject* sgo = nsnull;
nsCOMPtr<nsIScriptGlobalObjectOwner> container = nsCOMPtr<nsIScriptGlobalObjectOwner> container =
do_QueryReferent(mDocumentContainer); do_QueryReferent(mDocumentContainer);
if (container) { if (container) {
container->GetScriptGlobalObject(getter_AddRefs(sgo)); sgo = container->GetScriptGlobalObject();
} }
nsCxPusher pusher(sgo); nsCxPusher pusher(sgo);

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

@ -1482,8 +1482,7 @@ nsXULElement::CompileEventHandler(nsIScriptContext* aContext,
nsCOMPtr<nsIScriptGlobalObjectOwner> globalOwner = nsCOMPtr<nsIScriptGlobalObjectOwner> globalOwner =
do_QueryInterface(protodoc); do_QueryInterface(protodoc);
nsCOMPtr<nsIScriptGlobalObject> global; nsIScriptGlobalObject* global = globalOwner->GetScriptGlobalObject();
globalOwner->GetScriptGlobalObject(getter_AddRefs(global));
NS_ENSURE_TRUE(global, NS_ERROR_UNEXPECTED); NS_ENSURE_TRUE(global, NS_ERROR_UNEXPECTED);
context = global->GetContext(); context = global->GetContext();
@ -4656,10 +4655,9 @@ nsXULPrototypeScript::Compile(const PRUnichar* aText,
nsIScriptContext *context = nsnull; nsIScriptContext *context = nsnull;
{ {
nsCOMPtr<nsIScriptGlobalObjectOwner> globalOwner nsCOMPtr<nsIScriptGlobalObjectOwner> globalOwner =
= do_QueryInterface(aPrototypeDocument); do_QueryInterface(aPrototypeDocument);
nsCOMPtr<nsIScriptGlobalObject> global; nsIScriptGlobalObject* global = globalOwner->GetScriptGlobalObject();
globalOwner->GetScriptGlobalObject(getter_AddRefs(global));
NS_ASSERTION(global != nsnull, "prototype doc has no script global"); NS_ASSERTION(global != nsnull, "prototype doc has no script global");
if (! global) if (! global)
return NS_ERROR_UNEXPECTED; return NS_ERROR_UNEXPECTED;

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

@ -71,7 +71,6 @@
#include "nsIPresShell.h" #include "nsIPresShell.h"
#include "nsIScriptContext.h" #include "nsIScriptContext.h"
#include "nsIScriptGlobalObject.h" #include "nsIScriptGlobalObject.h"
#include "nsIScriptGlobalObjectOwner.h"
#include "nsIServiceManager.h" #include "nsIServiceManager.h"
#include "nsITextContent.h" #include "nsITextContent.h"
#include "nsIURL.h" #include "nsIURL.h"

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

@ -3234,10 +3234,10 @@ nsXULDocument::OnStreamComplete(nsIStreamLoader* aLoader,
// Ignore the return value, as we don't need to propagate // Ignore the return value, as we don't need to propagate
// a failure to write to the FastLoad file, because this // a failure to write to the FastLoad file, because this
// method aborts that whole process on error. // method aborts that whole process on error.
nsCOMPtr<nsIScriptGlobalObjectOwner> globalOwner nsCOMPtr<nsIScriptGlobalObjectOwner> globalOwner =
= do_QueryInterface(mCurrentPrototype); do_QueryInterface(mCurrentPrototype);
nsCOMPtr<nsIScriptGlobalObject> global; nsIScriptGlobalObject* global =
globalOwner->GetScriptGlobalObject(getter_AddRefs(global)); globalOwner->GetScriptGlobalObject();
NS_ASSERTION(global != nsnull, "master prototype w/o global?!"); NS_ASSERTION(global != nsnull, "master prototype w/o global?!");
if (global) { if (global) {

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

@ -157,7 +157,7 @@ public:
virtual nsNodeInfoManager *GetNodeInfoManager(); virtual nsNodeInfoManager *GetNodeInfoManager();
// nsIScriptGlobalObjectOwner methods // nsIScriptGlobalObjectOwner methods
NS_DECL_NSISCRIPTGLOBALOBJECTOWNER virtual nsIScriptGlobalObject* GetScriptGlobalObject();
NS_DEFINE_STATIC_CID_ACCESSOR(NS_XULPROTOTYPEDOCUMENT_CID); NS_DEFINE_STATIC_CID_ACCESSOR(NS_XULPROTOTYPEDOCUMENT_CID);
@ -540,8 +540,8 @@ nsXULPrototypeDocument::Write(nsIObjectOutputStream* aStream)
} }
// Now serialize the document contents // Now serialize the document contents
nsCOMPtr<nsIScriptGlobalObject> globalObject; nsIScriptGlobalObject* globalObject = GetScriptGlobalObject();
rv |= GetScriptGlobalObject(getter_AddRefs(globalObject)); NS_ENSURE_TRUE(globalObject, NS_ERROR_UNEXPECTED);
nsIScriptContext *scriptContext = globalObject->GetContext(); nsIScriptContext *scriptContext = globalObject->GetContext();
@ -764,39 +764,13 @@ nsXULPrototypeDocument::NotifyLoadDone()
// nsIScriptGlobalObjectOwner methods // nsIScriptGlobalObjectOwner methods
// //
NS_IMETHODIMP nsIScriptGlobalObject*
nsXULPrototypeDocument::GetScriptGlobalObject(nsIScriptGlobalObject** _result) nsXULPrototypeDocument::GetScriptGlobalObject()
{ {
nsresult rv = NS_OK;
if (!mGlobalObject) if (!mGlobalObject)
rv = NewXULPDGlobalObject(getter_AddRefs(mGlobalObject)); NewXULPDGlobalObject(getter_AddRefs(mGlobalObject));
*_result = mGlobalObject;
NS_IF_ADDREF(*_result);
return rv;
}
NS_IMETHODIMP return mGlobalObject;
nsXULPrototypeDocument::ReportScriptError(nsIScriptError *errorObject)
{
nsresult rv;
if (errorObject == nsnull)
return NS_ERROR_NULL_POINTER;
// Get the console service, where we're going to register the error.
nsCOMPtr<nsIConsoleService> consoleService
(do_GetService("@mozilla.org/consoleservice;1"));
if (consoleService != nsnull) {
rv = consoleService->LogMessage(errorObject);
if (NS_SUCCEEDED(rv)) {
return NS_OK;
} else {
return rv;
}
} else {
return NS_ERROR_NOT_AVAILABLE;
}
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

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

@ -43,7 +43,6 @@
#include "nsIBaseWindow.idl" #include "nsIBaseWindow.idl"
#include "nsIScrollable.idl" #include "nsIScrollable.idl"
#include "nsITextScroll.idl" #include "nsITextScroll.idl"
#include "nsIScriptGlobalObjectOwner.idl"
/* /*
nsCHTMLDocShell implements: nsCHTMLDocShell implements:
@ -54,11 +53,10 @@ nsIDocShellTreeNode
nsIBaseWindow nsIBaseWindow
nsIScrollable nsIScrollable
nsITextScroll nsITextScroll
nsIScriptGlobalObjectOwner
*/ */
%{ C++ %{ C++
// {F1EAC762-87E9-11d3-AF80-00A024FFC08C} - // {F1EAC762-87E9-11d3-AF80-00A024FFC08C} -
#define NS_DOCSHELL_CID \ #define NS_DOCSHELL_CID \
{ 0xf1eac762, 0x87e9, 0x11d3, { 0xaf, 0x80, 0x00, 0xa0, 0x24, 0xff, 0xc0, 0x8c } } { 0xf1eac762, 0x87e9, 0x11d3, { 0xaf, 0x80, 0x00, 0xa0, 0x24, 0xff, 0xc0, 0x8c } }
#define NS_DOCSHELL_CONTRACTID \ #define NS_DOCSHELL_CONTRACTID \

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

@ -3835,45 +3835,16 @@ nsDocShell::ScrollByPages(PRInt32 numPages)
// nsDocShell::nsIScriptGlobalObjectOwner // nsDocShell::nsIScriptGlobalObjectOwner
//***************************************************************************** //*****************************************************************************
NS_IMETHODIMP nsIScriptGlobalObject*
nsDocShell::GetScriptGlobalObject(nsIScriptGlobalObject ** aGlobal) nsDocShell::GetScriptGlobalObject()
{ {
if (mIsBeingDestroyed) { if (mIsBeingDestroyed) {
return NS_ERROR_NOT_AVAILABLE; return nsnull;
} }
NS_ENSURE_ARG_POINTER(aGlobal); NS_ENSURE_SUCCESS(EnsureScriptEnvironment(), nsnull);
NS_ENSURE_SUCCESS(EnsureScriptEnvironment(), NS_ERROR_FAILURE);
*aGlobal = mScriptGlobal; return mScriptGlobal;
NS_IF_ADDREF(*aGlobal);
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::ReportScriptError(nsIScriptError * errorObject)
{
nsresult rv;
if (errorObject == nsnull)
return NS_ERROR_NULL_POINTER;
// Get the console service, where we're going to register the error.
nsCOMPtr<nsIConsoleService> consoleService
(do_GetService("@mozilla.org/consoleservice;1"));
if (consoleService != nsnull) {
rv = consoleService->LogMessage(errorObject);
if (NS_SUCCEEDED(rv)) {
return NS_OK;
}
else {
return rv;
}
}
else {
return NS_ERROR_NOT_AVAILABLE;
}
} }
//***************************************************************************** //*****************************************************************************
@ -6957,9 +6928,9 @@ NS_IMETHODIMP nsDocShell::EnsureFind()
// we promise that the nsIWebBrowserFind that we return has been set // we promise that the nsIWebBrowserFind that we return has been set
// up to point to the focussed, or content window, so we have to // up to point to the focussed, or content window, so we have to
// set that up each time. // set that up each time.
nsCOMPtr<nsIScriptGlobalObject> scriptGO;
rv = GetScriptGlobalObject(getter_AddRefs(scriptGO)); nsIScriptGlobalObject* scriptGO = GetScriptGlobalObject();
if (NS_FAILED(rv)) return rv; NS_ENSURE_TRUE(scriptGO, NS_ERROR_UNEXPECTED);
// default to our window // default to our window
nsCOMPtr<nsIDOMWindow> rootWindow = do_QueryInterface(scriptGO); nsCOMPtr<nsIDOMWindow> rootWindow = do_QueryInterface(scriptGO);

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

@ -214,7 +214,6 @@ public:
NS_DECL_NSITEXTSCROLL NS_DECL_NSITEXTSCROLL
NS_DECL_NSIDOCCHARSET NS_DECL_NSIDOCCHARSET
NS_DECL_NSIINTERFACEREQUESTOR NS_DECL_NSIINTERFACEREQUESTOR
NS_DECL_NSISCRIPTGLOBALOBJECTOWNER
NS_DECL_NSIWEBPROGRESSLISTENER NS_DECL_NSIWEBPROGRESSLISTENER
NS_DECL_NSIREFRESHURI NS_DECL_NSIREFRESHURI
NS_DECL_NSICONTENTVIEWERCONTAINER NS_DECL_NSICONTENTVIEWERCONTAINER
@ -226,6 +225,8 @@ public:
nsDocShellInfoLoadType ConvertLoadTypeToDocShellLoadInfo(PRUint32 aLoadType); nsDocShellInfoLoadType ConvertLoadTypeToDocShellLoadInfo(PRUint32 aLoadType);
PRUint32 ConvertDocShellLoadInfoToLoadType(nsDocShellInfoLoadType aDocShellLoadType); PRUint32 ConvertDocShellLoadInfoToLoadType(nsDocShellInfoLoadType aDocShellLoadType);
// nsIScriptGlobalObjectOwner methods
virtual nsIScriptGlobalObject* GetScriptGlobalObject();
protected: protected:
// Object Management // Object Management
virtual ~nsDocShell(); virtual ~nsDocShell();

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

@ -48,7 +48,6 @@ GRE_MODULE = 1
DIRS = idl coreEvents base DIRS = idl coreEvents base
XPIDLSRCS = nsIScriptContextOwner.idl \ XPIDLSRCS = nsIScriptContextOwner.idl \
nsIScriptGlobalObjectOwner.idl \
nsIEntropyCollector.idl \ nsIEntropyCollector.idl \
$(NULL) $(NULL)
@ -57,6 +56,7 @@ EXPORTS=nsIScriptContext.h \
nsIScriptObjectOwner.h \ nsIScriptObjectOwner.h \
nsIScriptObjectPrincipal.h \ nsIScriptObjectPrincipal.h \
nsIScriptGlobalObject.h \ nsIScriptGlobalObject.h \
nsIScriptGlobalObjectOwner.h \
nsIDOMScriptObjectFactory.h \ nsIDOMScriptObjectFactory.h \
nsDOMCID.h \ nsDOMCID.h \
nsIScriptExternalNameSet.h \ nsIScriptExternalNameSet.h \

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

@ -0,0 +1,66 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-1999
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Travis Bogard <travis@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsIScriptGlobalObjectOwner_h__
#define nsIScriptGlobalObjectOwner_h__
#include "nsISupports.h"
class nsIScriptGlobalObject;
#define NS_ISCRIPTGLOBALOBJECTOWNER_IID \
{0xfd25ca8e, 0x6b63, 0x435f, \
{ 0xb8, 0xc6, 0xb8, 0x07, 0x68, 0xa4, 0x0a, 0xdc }}
/**
* Implemented by any object capable of supplying a nsIScriptGlobalObject.
* The implentor may create the script global object on demand.
*/
class nsIScriptGlobalObjectOwner : public nsISupports
{
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISCRIPTGLOBALOBJECTOWNER_IID)
/**
* Returns the script global object
*/
virtual nsIScriptGlobalObject* GetScriptGlobalObject() = 0;
};
#endif /* nsIScriptGlobalObjectOwner_h__ */

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

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

@ -38,7 +38,6 @@
#include "nsJSEnvironment.h" #include "nsJSEnvironment.h"
#include "nsIScriptContextOwner.h" #include "nsIScriptContextOwner.h"
#include "nsIScriptGlobalObject.h" #include "nsIScriptGlobalObject.h"
#include "nsIScriptGlobalObjectOwner.h"
#include "nsIScriptObjectPrincipal.h" #include "nsIScriptObjectPrincipal.h"
#include "nsIDOMWindowInternal.h" #include "nsIDOMWindowInternal.h"
#include "nsIDOMNode.h" #include "nsIDOMNode.h"
@ -238,18 +237,10 @@ NS_ScriptErrorReporter(JSContext *cx,
} }
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
nsIScriptGlobalObjectOwner *owner = nsCOMPtr<nsIConsoleService> consoleService =
globalObject->GetGlobalObjectOwner(); do_GetService(NS_CONSOLESERVICE_CONTRACTID, &rv);
if (owner) { if (NS_SUCCEEDED(rv)) {
owner->ReportScriptError(errorObject); consoleService->LogMessage(errorObject);
} else {
// We lack an owner to report this error to, so let's just
// report it to the console service so as to not lose it.
nsCOMPtr<nsIConsoleService> consoleService =
do_GetService(NS_CONSOLESERVICE_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv)) {
consoleService->LogMessage(errorObject);
}
} }
} }
} }

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

@ -167,13 +167,12 @@ nsresult nsJSThunk::EvaluateScript(nsIChannel *aChannel)
} }
// So far so good: get the script context from its owner. // So far so good: get the script context from its owner.
nsCOMPtr<nsIScriptGlobalObject> global; nsIScriptGlobalObject* global = globalOwner->GetScriptGlobalObject();
rv = globalOwner->GetScriptGlobalObject(getter_AddRefs(global));
NS_ASSERTION(NS_SUCCEEDED(rv) && global, NS_ASSERTION(global,
"Unable to get an nsIScriptGlobalObject from the " "Unable to get an nsIScriptGlobalObject from the "
"ScriptGlobalObjectOwner!"); "ScriptGlobalObjectOwner!");
if (NS_FAILED(rv) || !global) { if (!global) {
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }

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

@ -57,7 +57,6 @@
#include "nsICSSStyleSheet.h" #include "nsICSSStyleSheet.h"
#include "nsIFrame.h" #include "nsIFrame.h"
#include "nsIScriptGlobalObjectOwner.h"
#include "nsIScriptGlobalObject.h" #include "nsIScriptGlobalObject.h"
#include "nsILinkHandler.h" #include "nsILinkHandler.h"
#include "nsIDOMDocument.h" #include "nsIDOMDocument.h"

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

@ -117,8 +117,6 @@ static const char kPrintingPromptService[] = "@mozilla.org/embedcomp/printingpro
#include "nsISupportsUtils.h" #include "nsISupportsUtils.h"
#include "nsIFrame.h" #include "nsIFrame.h"
#include "nsIScriptContext.h" #include "nsIScriptContext.h"
#include "nsIScriptGlobalObjectOwner.h"
#include "nsIScriptGlobalObject.h"
#include "nsILinkHandler.h" #include "nsILinkHandler.h"
#include "nsIDOMDocument.h" #include "nsIDOMDocument.h"
#include "nsISelectionListener.h" #include "nsISelectionListener.h"

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

@ -1075,8 +1075,7 @@ nsWebShellWindow::ConvertWebShellToDOMWindow(nsIWebShell* aShell, nsIDOMWindowIn
nsCOMPtr<nsIScriptGlobalObjectOwner> globalObjectOwner(do_QueryInterface(aShell)); nsCOMPtr<nsIScriptGlobalObjectOwner> globalObjectOwner(do_QueryInterface(aShell));
NS_ENSURE_TRUE(globalObjectOwner, NS_ERROR_FAILURE); NS_ENSURE_TRUE(globalObjectOwner, NS_ERROR_FAILURE);
nsCOMPtr<nsIScriptGlobalObject> globalObject; nsIScriptGlobalObject* globalObject = globalObjectOwner->GetScriptGlobalObject();
globalObjectOwner->GetScriptGlobalObject(getter_AddRefs(globalObject));
NS_ENSURE_TRUE(globalObject, NS_ERROR_FAILURE); NS_ENSURE_TRUE(globalObject, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMWindowInternal> newDOMWindow(do_QueryInterface(globalObject)); nsCOMPtr<nsIDOMWindowInternal> newDOMWindow(do_QueryInterface(globalObject));

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

@ -196,12 +196,12 @@ nsInstallTrigger::HandleContent(const char * aContentType,
// Get the global object of the target window for StartSoftwareUpdate // Get the global object of the target window for StartSoftwareUpdate
nsCOMPtr<nsIScriptGlobalObject> globalObject; nsIScriptGlobalObject* globalObject = nsnull;
nsCOMPtr<nsIScriptGlobalObjectOwner> globalObjectOwner = nsCOMPtr<nsIScriptGlobalObjectOwner> globalObjectOwner =
do_QueryInterface(aWindowContext); do_QueryInterface(aWindowContext);
if ( globalObjectOwner ) if ( globalObjectOwner )
{ {
globalObjectOwner->GetScriptGlobalObject(getter_AddRefs(globalObject)); globalObject = globalObjectOwner->GetScriptGlobalObject();
} }
if ( !globalObject ) if ( !globalObject )
return NS_ERROR_INVALID_ARG; return NS_ERROR_INVALID_ARG;