diff --git a/mozilla/content/base/src/nsDocumentViewer.cpp b/mozilla/content/base/src/nsDocumentViewer.cpp index 401d55fa2ab..0267a39805d 100644 --- a/mozilla/content/base/src/nsDocumentViewer.cpp +++ b/mozilla/content/base/src/nsDocumentViewer.cpp @@ -57,7 +57,6 @@ #include "nsICSSStyleSheet.h" #include "nsIFrame.h" -#include "nsIScriptGlobalObjectOwner.h" #include "nsIScriptGlobalObject.h" #include "nsILinkHandler.h" #include "nsIDOMDocument.h" diff --git a/mozilla/content/base/src/nsPrintEngine.cpp b/mozilla/content/base/src/nsPrintEngine.cpp index 5709d379fbd..76dba175305 100644 --- a/mozilla/content/base/src/nsPrintEngine.cpp +++ b/mozilla/content/base/src/nsPrintEngine.cpp @@ -117,8 +117,6 @@ static const char kPrintingPromptService[] = "@mozilla.org/embedcomp/printingpro #include "nsISupportsUtils.h" #include "nsIFrame.h" #include "nsIScriptContext.h" -#include "nsIScriptGlobalObjectOwner.h" -#include "nsIScriptGlobalObject.h" #include "nsILinkHandler.h" #include "nsIDOMDocument.h" #include "nsISelectionListener.h" diff --git a/mozilla/content/html/document/src/nsHTMLContentSink.cpp b/mozilla/content/html/document/src/nsHTMLContentSink.cpp index 8d6c607bfdf..0b99103f65b 100644 --- a/mozilla/content/html/document/src/nsHTMLContentSink.cpp +++ b/mozilla/content/html/document/src/nsHTMLContentSink.cpp @@ -2027,7 +2027,7 @@ IsScriptEnabled(nsIDocument *aDoc, nsIDocShell *aContainer) nsCOMPtr owner = do_GetInterface(aContainer); NS_ENSURE_TRUE(owner, PR_TRUE); - owner->GetScriptGlobalObject(getter_AddRefs(globalObject)); + globalObject = owner->GetScriptGlobalObject(); NS_ENSURE_TRUE(globalObject, PR_TRUE); } diff --git a/mozilla/content/xbl/src/nsBindingManager.cpp b/mozilla/content/xbl/src/nsBindingManager.cpp index e8e93d95c1d..cd3b5d15090 100644 --- a/mozilla/content/xbl/src/nsBindingManager.cpp +++ b/mozilla/content/xbl/src/nsBindingManager.cpp @@ -82,7 +82,6 @@ #include "nsIDOMScriptObjectFactory.h" #include "nsIPrincipal.h" #include "nsIScriptGlobalObject.h" -#include "nsIScriptGlobalObjectOwner.h" #include "nsIScriptObjectPrincipal.h" #include "nsIConsoleService.h" #include "nsIScriptError.h" diff --git a/mozilla/content/xbl/src/nsXBLBinding.cpp b/mozilla/content/xbl/src/nsXBLBinding.cpp index 7af41198977..e1dfceba937 100644 --- a/mozilla/content/xbl/src/nsXBLBinding.cpp +++ b/mozilla/content/xbl/src/nsXBLBinding.cpp @@ -70,7 +70,6 @@ #include "nsXBLService.h" #include "nsXBLInsertionPoint.h" #include "nsIXPConnect.h" -#include "nsIScriptGlobalObjectOwner.h" #include "nsIScriptContext.h" #include "nsCRT.h" diff --git a/mozilla/content/xbl/src/nsXBLDocumentInfo.cpp b/mozilla/content/xbl/src/nsXBLDocumentInfo.cpp index f4ab4e50fce..b237d951d54 100644 --- a/mozilla/content/xbl/src/nsXBLDocumentInfo.cpp +++ b/mozilla/content/xbl/src/nsXBLDocumentInfo.cpp @@ -40,6 +40,7 @@ #include "nsIDocument.h" #include "nsXBLPrototypeBinding.h" #include "nsIScriptObjectPrincipal.h" +#include "nsIScriptGlobalObject.h" #include "nsIScriptContext.h" #include "nsIDOMScriptObjectFactory.h" #include "jsapi.h" @@ -424,38 +425,20 @@ nsXBLDocumentInfo::FlushSkinStylesheets() // nsIScriptGlobalObjectOwner methods // -NS_IMETHODIMP -nsXBLDocumentInfo::GetScriptGlobalObject(nsIScriptGlobalObject** _result) +nsIScriptGlobalObject* +nsXBLDocumentInfo::GetScriptGlobalObject() { if (!mGlobalObject) { mGlobalObject = new nsXBLDocGlobalObject(); - if (!mGlobalObject) { - *_result = nsnull; - return NS_ERROR_OUT_OF_MEMORY; - } - + if (!mGlobalObject) + return nsnull; + mGlobalObject->SetGlobalObjectOwner(this); // does not refcount } - *_result = 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 consoleService (do_GetService("@mozilla.org/consoleservice;1")); - - if (!consoleService) - return NS_ERROR_NOT_AVAILABLE; - return consoleService->LogMessage(errorObject); + return mGlobalObject; } nsresult NS_NewXBLDocumentInfo(nsIDocument* aDocument, nsIXBLDocumentInfo** aResult) @@ -470,4 +453,3 @@ nsresult NS_NewXBLDocumentInfo(nsIDocument* aDocument, nsIXBLDocumentInfo** aRes NS_ADDREF(*aResult); return NS_OK; } - diff --git a/mozilla/content/xbl/src/nsXBLDocumentInfo.h b/mozilla/content/xbl/src/nsXBLDocumentInfo.h index a2052493b43..96377e993cc 100644 --- a/mozilla/content/xbl/src/nsXBLDocumentInfo.h +++ b/mozilla/content/xbl/src/nsXBLDocumentInfo.h @@ -64,7 +64,7 @@ public: NS_IMETHOD FlushSkinStylesheets(); // nsIScriptGlobalObjectOwner methods - NS_DECL_NSISCRIPTGLOBALOBJECTOWNER + virtual nsIScriptGlobalObject* GetScriptGlobalObject(); private: nsCOMPtr mDocument; diff --git a/mozilla/content/xbl/src/nsXBLProtoImpl.cpp b/mozilla/content/xbl/src/nsXBLProtoImpl.cpp index 420d322f351..e5d1d4e8b7e 100644 --- a/mozilla/content/xbl/src/nsXBLProtoImpl.cpp +++ b/mozilla/content/xbl/src/nsXBLProtoImpl.cpp @@ -145,8 +145,8 @@ nsXBLProtoImpl::CompilePrototypeMembers(nsXBLPrototypeBinding* aBinding) // context. nsCOMPtr globalOwner( do_QueryInterface(aBinding->XBLDocumentInfo())); - nsCOMPtr globalObject; - globalOwner->GetScriptGlobalObject(getter_AddRefs(globalObject)); + nsIScriptGlobalObject* globalObject = globalOwner->GetScriptGlobalObject(); + NS_ENSURE_TRUE(globalObject, NS_ERROR_UNEXPECTED); nsIScriptContext *context = globalObject->GetContext(); diff --git a/mozilla/content/xml/document/src/nsXMLDocument.cpp b/mozilla/content/xml/document/src/nsXMLDocument.cpp index 89745c74a07..ad9a613f8f5 100644 --- a/mozilla/content/xml/document/src/nsXMLDocument.cpp +++ b/mozilla/content/xml/document/src/nsXMLDocument.cpp @@ -630,11 +630,11 @@ nsXMLDocument::EndLoad() nsEventStatus status = nsEventStatus_eIgnore; nsEvent event(NS_PAGE_LOAD); - nsCOMPtr sgo; + nsIScriptGlobalObject* sgo = nsnull; nsCOMPtr container = do_QueryReferent(mDocumentContainer); if (container) { - container->GetScriptGlobalObject(getter_AddRefs(sgo)); + sgo = container->GetScriptGlobalObject(); } nsCxPusher pusher(sgo); diff --git a/mozilla/content/xul/content/src/nsXULElement.cpp b/mozilla/content/xul/content/src/nsXULElement.cpp index 17849fd2759..0b692c85c4c 100644 --- a/mozilla/content/xul/content/src/nsXULElement.cpp +++ b/mozilla/content/xul/content/src/nsXULElement.cpp @@ -1482,8 +1482,7 @@ nsXULElement::CompileEventHandler(nsIScriptContext* aContext, nsCOMPtr globalOwner = do_QueryInterface(protodoc); - nsCOMPtr global; - globalOwner->GetScriptGlobalObject(getter_AddRefs(global)); + nsIScriptGlobalObject* global = globalOwner->GetScriptGlobalObject(); NS_ENSURE_TRUE(global, NS_ERROR_UNEXPECTED); context = global->GetContext(); @@ -4656,10 +4655,9 @@ nsXULPrototypeScript::Compile(const PRUnichar* aText, nsIScriptContext *context = nsnull; { - nsCOMPtr globalOwner - = do_QueryInterface(aPrototypeDocument); - nsCOMPtr global; - globalOwner->GetScriptGlobalObject(getter_AddRefs(global)); + nsCOMPtr globalOwner = + do_QueryInterface(aPrototypeDocument); + nsIScriptGlobalObject* global = globalOwner->GetScriptGlobalObject(); NS_ASSERTION(global != nsnull, "prototype doc has no script global"); if (! global) return NS_ERROR_UNEXPECTED; diff --git a/mozilla/content/xul/document/src/nsXULContentSink.cpp b/mozilla/content/xul/document/src/nsXULContentSink.cpp index de92a1ea104..d420067ea71 100644 --- a/mozilla/content/xul/document/src/nsXULContentSink.cpp +++ b/mozilla/content/xul/document/src/nsXULContentSink.cpp @@ -71,7 +71,6 @@ #include "nsIPresShell.h" #include "nsIScriptContext.h" #include "nsIScriptGlobalObject.h" -#include "nsIScriptGlobalObjectOwner.h" #include "nsIServiceManager.h" #include "nsITextContent.h" #include "nsIURL.h" diff --git a/mozilla/content/xul/document/src/nsXULDocument.cpp b/mozilla/content/xul/document/src/nsXULDocument.cpp index d8b236458e6..97d14138343 100644 --- a/mozilla/content/xul/document/src/nsXULDocument.cpp +++ b/mozilla/content/xul/document/src/nsXULDocument.cpp @@ -3234,10 +3234,10 @@ nsXULDocument::OnStreamComplete(nsIStreamLoader* aLoader, // Ignore the return value, as we don't need to propagate // a failure to write to the FastLoad file, because this // method aborts that whole process on error. - nsCOMPtr globalOwner - = do_QueryInterface(mCurrentPrototype); - nsCOMPtr global; - globalOwner->GetScriptGlobalObject(getter_AddRefs(global)); + nsCOMPtr globalOwner = + do_QueryInterface(mCurrentPrototype); + nsIScriptGlobalObject* global = + globalOwner->GetScriptGlobalObject(); NS_ASSERTION(global != nsnull, "master prototype w/o global?!"); if (global) { diff --git a/mozilla/content/xul/document/src/nsXULPrototypeDocument.cpp b/mozilla/content/xul/document/src/nsXULPrototypeDocument.cpp index 75d54e497b0..1ec6da928a5 100644 --- a/mozilla/content/xul/document/src/nsXULPrototypeDocument.cpp +++ b/mozilla/content/xul/document/src/nsXULPrototypeDocument.cpp @@ -157,7 +157,7 @@ public: virtual nsNodeInfoManager *GetNodeInfoManager(); // nsIScriptGlobalObjectOwner methods - NS_DECL_NSISCRIPTGLOBALOBJECTOWNER + virtual nsIScriptGlobalObject* GetScriptGlobalObject(); NS_DEFINE_STATIC_CID_ACCESSOR(NS_XULPROTOTYPEDOCUMENT_CID); @@ -540,8 +540,8 @@ nsXULPrototypeDocument::Write(nsIObjectOutputStream* aStream) } // Now serialize the document contents - nsCOMPtr globalObject; - rv |= GetScriptGlobalObject(getter_AddRefs(globalObject)); + nsIScriptGlobalObject* globalObject = GetScriptGlobalObject(); + NS_ENSURE_TRUE(globalObject, NS_ERROR_UNEXPECTED); nsIScriptContext *scriptContext = globalObject->GetContext(); @@ -764,39 +764,13 @@ nsXULPrototypeDocument::NotifyLoadDone() // nsIScriptGlobalObjectOwner methods // -NS_IMETHODIMP -nsXULPrototypeDocument::GetScriptGlobalObject(nsIScriptGlobalObject** _result) +nsIScriptGlobalObject* +nsXULPrototypeDocument::GetScriptGlobalObject() { - nsresult rv = NS_OK; if (!mGlobalObject) - rv = NewXULPDGlobalObject(getter_AddRefs(mGlobalObject)); - *_result = mGlobalObject; - NS_IF_ADDREF(*_result); - return rv; -} + NewXULPDGlobalObject(getter_AddRefs(mGlobalObject)); -NS_IMETHODIMP -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 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; - } + return mGlobalObject; } //---------------------------------------------------------------------- diff --git a/mozilla/docshell/base/nsCDocShell.idl b/mozilla/docshell/base/nsCDocShell.idl index 38a048eb9bb..5b870c1d1ce 100644 --- a/mozilla/docshell/base/nsCDocShell.idl +++ b/mozilla/docshell/base/nsCDocShell.idl @@ -43,7 +43,6 @@ #include "nsIBaseWindow.idl" #include "nsIScrollable.idl" #include "nsITextScroll.idl" -#include "nsIScriptGlobalObjectOwner.idl" /* nsCHTMLDocShell implements: @@ -54,11 +53,10 @@ nsIDocShellTreeNode nsIBaseWindow nsIScrollable nsITextScroll -nsIScriptGlobalObjectOwner */ %{ C++ -// {F1EAC762-87E9-11d3-AF80-00A024FFC08C} - +// {F1EAC762-87E9-11d3-AF80-00A024FFC08C} - #define NS_DOCSHELL_CID \ { 0xf1eac762, 0x87e9, 0x11d3, { 0xaf, 0x80, 0x00, 0xa0, 0x24, 0xff, 0xc0, 0x8c } } #define NS_DOCSHELL_CONTRACTID \ diff --git a/mozilla/docshell/base/nsDocShell.cpp b/mozilla/docshell/base/nsDocShell.cpp index 1b2201fc0f0..9231db46a9a 100644 --- a/mozilla/docshell/base/nsDocShell.cpp +++ b/mozilla/docshell/base/nsDocShell.cpp @@ -3835,45 +3835,16 @@ nsDocShell::ScrollByPages(PRInt32 numPages) // nsDocShell::nsIScriptGlobalObjectOwner //***************************************************************************** -NS_IMETHODIMP -nsDocShell::GetScriptGlobalObject(nsIScriptGlobalObject ** aGlobal) +nsIScriptGlobalObject* +nsDocShell::GetScriptGlobalObject() { if (mIsBeingDestroyed) { - return NS_ERROR_NOT_AVAILABLE; + return nsnull; } - NS_ENSURE_ARG_POINTER(aGlobal); - NS_ENSURE_SUCCESS(EnsureScriptEnvironment(), NS_ERROR_FAILURE); + NS_ENSURE_SUCCESS(EnsureScriptEnvironment(), nsnull); - *aGlobal = 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 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; - } + return mScriptGlobal; } //***************************************************************************** @@ -6957,9 +6928,9 @@ NS_IMETHODIMP nsDocShell::EnsureFind() // we promise that the nsIWebBrowserFind that we return has been set // up to point to the focussed, or content window, so we have to // set that up each time. - nsCOMPtr scriptGO; - rv = GetScriptGlobalObject(getter_AddRefs(scriptGO)); - if (NS_FAILED(rv)) return rv; + + nsIScriptGlobalObject* scriptGO = GetScriptGlobalObject(); + NS_ENSURE_TRUE(scriptGO, NS_ERROR_UNEXPECTED); // default to our window nsCOMPtr rootWindow = do_QueryInterface(scriptGO); diff --git a/mozilla/docshell/base/nsDocShell.h b/mozilla/docshell/base/nsDocShell.h index bbc23d1b6c4..54331ef10f1 100644 --- a/mozilla/docshell/base/nsDocShell.h +++ b/mozilla/docshell/base/nsDocShell.h @@ -214,7 +214,6 @@ public: NS_DECL_NSITEXTSCROLL NS_DECL_NSIDOCCHARSET NS_DECL_NSIINTERFACEREQUESTOR - NS_DECL_NSISCRIPTGLOBALOBJECTOWNER NS_DECL_NSIWEBPROGRESSLISTENER NS_DECL_NSIREFRESHURI NS_DECL_NSICONTENTVIEWERCONTAINER @@ -226,6 +225,8 @@ public: nsDocShellInfoLoadType ConvertLoadTypeToDocShellLoadInfo(PRUint32 aLoadType); PRUint32 ConvertDocShellLoadInfoToLoadType(nsDocShellInfoLoadType aDocShellLoadType); + // nsIScriptGlobalObjectOwner methods + virtual nsIScriptGlobalObject* GetScriptGlobalObject(); protected: // Object Management virtual ~nsDocShell(); diff --git a/mozilla/dom/public/Makefile.in b/mozilla/dom/public/Makefile.in index a77083847bd..6afc416071f 100644 --- a/mozilla/dom/public/Makefile.in +++ b/mozilla/dom/public/Makefile.in @@ -48,7 +48,6 @@ GRE_MODULE = 1 DIRS = idl coreEvents base XPIDLSRCS = nsIScriptContextOwner.idl \ - nsIScriptGlobalObjectOwner.idl \ nsIEntropyCollector.idl \ $(NULL) @@ -57,6 +56,7 @@ EXPORTS=nsIScriptContext.h \ nsIScriptObjectOwner.h \ nsIScriptObjectPrincipal.h \ nsIScriptGlobalObject.h \ + nsIScriptGlobalObjectOwner.h \ nsIDOMScriptObjectFactory.h \ nsDOMCID.h \ nsIScriptExternalNameSet.h \ diff --git a/mozilla/dom/public/nsIScriptGlobalObjectOwner.idl b/mozilla/dom/public/nsIScriptGlobalObjectOwner.h similarity index 68% rename from mozilla/dom/public/nsIScriptGlobalObjectOwner.idl rename to mozilla/dom/public/nsIScriptGlobalObjectOwner.h index cbbeaf3ef3a..9b6103b24e9 100644 --- a/mozilla/dom/public/nsIScriptGlobalObjectOwner.idl +++ b/mozilla/dom/public/nsIScriptGlobalObjectOwner.h @@ -1,6 +1,5 @@ -/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * - * ***** BEGIN LICENSE BLOCK ***** +/* -*- 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 @@ -13,11 +12,11 @@ * for the specific language governing rights and limitations under the * License. * - * The Original Code is the Mozilla browser. + * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is - * Netscape Communications, Inc. - * Portions created by the Initial Developer are Copyright (C) 1999 + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998-1999 * the Initial Developer. All Rights Reserved. * * Contributor(s): @@ -37,34 +36,31 @@ * * ***** END LICENSE BLOCK ***** */ -#include "nsISupports.idl" +#ifndef nsIScriptGlobalObjectOwner_h__ +#define nsIScriptGlobalObjectOwner_h__ -%{ C++ -#include "nscore.h" -#include "nsIScriptGlobalObject.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 and is - * allowed (though not expected) to throw it away on release. + * The implentor may create the script global object on demand. */ -interface nsIScriptGlobalObject; -interface nsIScriptError; - -[scriptable, uuid(413E8400-A87F-11d3-AFC6-00A024FFC08C)] -interface nsIScriptGlobalObjectOwner : nsISupports +class nsIScriptGlobalObjectOwner : public nsISupports { +public: + NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISCRIPTGLOBALOBJECTOWNER_IID) + /** * Returns the script global object */ - nsIScriptGlobalObject getScriptGlobalObject(); - - /** - * Error notification method. Informs the owner that an error - * occurred while a script was being evaluted. - * - */ - void reportScriptError(in nsIScriptError aError); + virtual nsIScriptGlobalObject* GetScriptGlobalObject() = 0; }; + +#endif /* nsIScriptGlobalObjectOwner_h__ */ diff --git a/mozilla/dom/src/base/nsJSEnvironment.cpp b/mozilla/dom/src/base/nsJSEnvironment.cpp index fc5b8839c25..93b8796d95a 100644 --- a/mozilla/dom/src/base/nsJSEnvironment.cpp +++ b/mozilla/dom/src/base/nsJSEnvironment.cpp @@ -38,7 +38,6 @@ #include "nsJSEnvironment.h" #include "nsIScriptContextOwner.h" #include "nsIScriptGlobalObject.h" -#include "nsIScriptGlobalObjectOwner.h" #include "nsIScriptObjectPrincipal.h" #include "nsIDOMWindowInternal.h" #include "nsIDOMNode.h" @@ -238,18 +237,10 @@ NS_ScriptErrorReporter(JSContext *cx, } if (NS_SUCCEEDED(rv)) { - nsIScriptGlobalObjectOwner *owner = - globalObject->GetGlobalObjectOwner(); - if (owner) { - owner->ReportScriptError(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 consoleService = - do_GetService(NS_CONSOLESERVICE_CONTRACTID, &rv); - if (NS_SUCCEEDED(rv)) { - consoleService->LogMessage(errorObject); - } + nsCOMPtr consoleService = + do_GetService(NS_CONSOLESERVICE_CONTRACTID, &rv); + if (NS_SUCCEEDED(rv)) { + consoleService->LogMessage(errorObject); } } } diff --git a/mozilla/dom/src/jsurl/nsJSProtocolHandler.cpp b/mozilla/dom/src/jsurl/nsJSProtocolHandler.cpp index 0387232518b..7cff0b23f56 100644 --- a/mozilla/dom/src/jsurl/nsJSProtocolHandler.cpp +++ b/mozilla/dom/src/jsurl/nsJSProtocolHandler.cpp @@ -167,13 +167,12 @@ nsresult nsJSThunk::EvaluateScript(nsIChannel *aChannel) } // So far so good: get the script context from its owner. - nsCOMPtr global; - rv = globalOwner->GetScriptGlobalObject(getter_AddRefs(global)); + nsIScriptGlobalObject* global = globalOwner->GetScriptGlobalObject(); - NS_ASSERTION(NS_SUCCEEDED(rv) && global, + NS_ASSERTION(global, "Unable to get an nsIScriptGlobalObject from the " "ScriptGlobalObjectOwner!"); - if (NS_FAILED(rv) || !global) { + if (!global) { return NS_ERROR_FAILURE; } diff --git a/mozilla/layout/base/nsDocumentViewer.cpp b/mozilla/layout/base/nsDocumentViewer.cpp index 401d55fa2ab..0267a39805d 100644 --- a/mozilla/layout/base/nsDocumentViewer.cpp +++ b/mozilla/layout/base/nsDocumentViewer.cpp @@ -57,7 +57,6 @@ #include "nsICSSStyleSheet.h" #include "nsIFrame.h" -#include "nsIScriptGlobalObjectOwner.h" #include "nsIScriptGlobalObject.h" #include "nsILinkHandler.h" #include "nsIDOMDocument.h" diff --git a/mozilla/layout/printing/nsPrintEngine.cpp b/mozilla/layout/printing/nsPrintEngine.cpp index 5709d379fbd..76dba175305 100644 --- a/mozilla/layout/printing/nsPrintEngine.cpp +++ b/mozilla/layout/printing/nsPrintEngine.cpp @@ -117,8 +117,6 @@ static const char kPrintingPromptService[] = "@mozilla.org/embedcomp/printingpro #include "nsISupportsUtils.h" #include "nsIFrame.h" #include "nsIScriptContext.h" -#include "nsIScriptGlobalObjectOwner.h" -#include "nsIScriptGlobalObject.h" #include "nsILinkHandler.h" #include "nsIDOMDocument.h" #include "nsISelectionListener.h" diff --git a/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp b/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp index 49be29aa12b..7ad79afe51f 100644 --- a/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp +++ b/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp @@ -1075,8 +1075,7 @@ nsWebShellWindow::ConvertWebShellToDOMWindow(nsIWebShell* aShell, nsIDOMWindowIn nsCOMPtr globalObjectOwner(do_QueryInterface(aShell)); NS_ENSURE_TRUE(globalObjectOwner, NS_ERROR_FAILURE); - nsCOMPtr globalObject; - globalObjectOwner->GetScriptGlobalObject(getter_AddRefs(globalObject)); + nsIScriptGlobalObject* globalObject = globalObjectOwner->GetScriptGlobalObject(); NS_ENSURE_TRUE(globalObject, NS_ERROR_FAILURE); nsCOMPtr newDOMWindow(do_QueryInterface(globalObject)); diff --git a/mozilla/xpinstall/src/nsInstallTrigger.cpp b/mozilla/xpinstall/src/nsInstallTrigger.cpp index 9d9cc8ae251..5215ae93b6a 100644 --- a/mozilla/xpinstall/src/nsInstallTrigger.cpp +++ b/mozilla/xpinstall/src/nsInstallTrigger.cpp @@ -196,12 +196,12 @@ nsInstallTrigger::HandleContent(const char * aContentType, // Get the global object of the target window for StartSoftwareUpdate - nsCOMPtr globalObject; + nsIScriptGlobalObject* globalObject = nsnull; nsCOMPtr globalObjectOwner = do_QueryInterface(aWindowContext); if ( globalObjectOwner ) { - globalObjectOwner->GetScriptGlobalObject(getter_AddRefs(globalObject)); + globalObject = globalObjectOwner->GetScriptGlobalObject(); } if ( !globalObject ) return NS_ERROR_INVALID_ARG;