From 88810ef1eba8601fc272f219f01cba51c08fe63d Mon Sep 17 00:00:00 2001 From: "dbaron%fas.harvard.edu" Date: Wed, 20 Jun 2001 03:27:48 +0000 Subject: [PATCH] Fix bad getters on nsIDocument and nsIScriptContext to use out params rather than return |AddRef|ed pointers. b=81289 r=jaggernaut sr=jst a=asa git-svn-id: svn://10.0.0.236/trunk@97540 18797224-902f-48f8-a5cc-f745e15eee43 --- .../src/base/nsAccessibilityService.cpp | 8 +- mozilla/accessible/src/base/nsAccessible.cpp | 3 +- .../accessible/src/base/nsRootAccessible.cpp | 3 +- .../accessible/src/nsAccessibilityService.cpp | 8 +- mozilla/accessible/src/nsAccessible.cpp | 3 +- mozilla/accessible/src/nsRootAccessible.cpp | 3 +- mozilla/caps/src/nsScriptSecurityManager.cpp | 9 +- mozilla/chrome/src/nsChromeRegistry.cpp | 12 +- mozilla/content/base/public/nsIDocument.h | 26 ++-- mozilla/content/base/src/nsContentList.cpp | 4 +- mozilla/content/base/src/nsContentUtils.cpp | 11 +- mozilla/content/base/src/nsCopySupport.cpp | 3 +- mozilla/content/base/src/nsDocument.cpp | 117 ++++++++++------- mozilla/content/base/src/nsDocument.h | 26 ++-- mozilla/content/base/src/nsDocumentViewer.cpp | 17 ++- mozilla/content/base/src/nsGenericElement.cpp | 7 +- .../base/src/nsHTMLContentSerializer.cpp | 3 +- mozilla/content/base/src/nsScriptLoader.cpp | 2 +- mozilla/content/base/src/nsSelection.cpp | 2 +- .../content/base/src/nsStyleLinkElement.cpp | 4 +- mozilla/content/base/src/nsStyleSet.cpp | 6 +- .../content/base/src/nsSyncLoadService.cpp | 2 +- .../events/src/nsEventListenerManager.cpp | 3 +- .../events/src/nsEventStateManager.cpp | 48 ++++--- .../html/content/src/nsGenericHTMLElement.cpp | 21 +-- .../html/content/src/nsHTMLAnchorElement.cpp | 2 +- .../html/content/src/nsHTMLButtonElement.cpp | 2 +- .../html/content/src/nsHTMLFrameElement.cpp | 2 +- .../html/content/src/nsHTMLIFrameElement.cpp | 2 +- .../html/content/src/nsHTMLImageElement.cpp | 4 +- .../html/content/src/nsHTMLInputElement.cpp | 5 +- .../html/content/src/nsHTMLSelectElement.cpp | 2 +- .../content/src/nsHTMLTableRowElement.cpp | 7 +- .../content/src/nsHTMLTextAreaElement.cpp | 2 +- .../html/document/src/nsHTMLContentSink.cpp | 20 ++- .../html/document/src/nsHTMLDocument.cpp | 8 +- .../html/document/src/nsImageDocument.cpp | 8 +- mozilla/content/xbl/src/nsBindingManager.cpp | 12 +- .../content/xbl/src/nsXBLPrototypeBinding.cpp | 9 +- .../content/xbl/src/nsXBLPrototypeHandler.cpp | 3 +- mozilla/content/xbl/src/nsXBLService.cpp | 15 ++- .../content/xbl/src/nsXBLWindowHandler.cpp | 3 +- .../content/xml/content/src/nsXMLElement.cpp | 5 +- .../xml/document/src/nsXMLContentSink.cpp | 13 +- .../content/xul/content/src/nsXULElement.cpp | 35 ++--- .../xul/content/src/nsXULPopupListener.cpp | 2 +- .../xul/content/src/nsXULTreeElement.cpp | 17 +-- .../document/src/nsXULCommandDispatcher.cpp | 3 +- .../xul/document/src/nsXULContentSink.cpp | 8 +- .../xul/document/src/nsXULDocument.cpp | 124 ++++++++++-------- .../content/xul/document/src/nsXULDocument.h | 28 ++-- .../xul/document/src/nsXULPrototypeCache.cpp | 3 +- .../xul/templates/src/nsXULContentUtils.cpp | 3 +- .../templates/src/nsXULTemplateBuilder.cpp | 3 +- mozilla/docshell/base/nsDocShell.cpp | 12 +- mozilla/dom/public/nsIScriptContext.h | 2 +- mozilla/dom/src/base/nsDOMClassInfo.cpp | 6 +- mozilla/dom/src/base/nsFocusController.cpp | 3 +- mozilla/dom/src/base/nsGlobalWindow.cpp | 10 +- mozilla/dom/src/base/nsJSEnvironment.cpp | 46 ++++--- mozilla/dom/src/base/nsJSEnvironment.h | 2 +- mozilla/dom/src/base/nsJSUtils.cpp | 8 +- mozilla/dom/src/base/nsLocation.cpp | 2 +- mozilla/dom/src/base/nsWindowRoot.cpp | 3 +- mozilla/editor/base/nsHTMLEditor.cpp | 5 +- .../editor/libeditor/html/nsHTMLEditor.cpp | 5 +- .../webBrowser/nsWebBrowserPersist.cpp | 2 +- .../windowwatcher/src/nsWindowWatcher.cpp | 8 +- .../accessproxy/nsAccessProxy.cpp | 2 +- .../inspector/base/src/inCSSValueSearch.cpp | 6 +- .../base/src/inSearchOrphanImages.cpp | 6 +- .../base/src/nsCSSRuleDataSource.cpp | 2 +- .../extensions/p3p/src/nsP3PObserverHTML.cpp | 4 +- .../extensions/p3p/src/nsP3PObserverXML.cpp | 4 +- .../source/xml/parser/nsSyncLoader.cpp | 2 +- .../source/xslt/XSLTProcessor.cpp | 7 +- .../wallet/cookieviewer/nsCookieViewer.cpp | 2 +- .../extensions/wallet/src/nsWalletService.cpp | 3 +- mozilla/extensions/wallet/src/wallet.cpp | 13 +- .../xmlextras/base/src/nsXMLHttpRequest.cpp | 2 +- .../xmlextras/tests/TestXMLExtras.cpp | 3 +- mozilla/layout/base/nsCSSFrameConstructor.cpp | 8 +- mozilla/layout/base/nsCSSRendering.cpp | 4 +- mozilla/layout/base/nsDocumentViewer.cpp | 17 ++- mozilla/layout/base/nsPresShell.cpp | 35 ++--- mozilla/layout/base/src/nsCopySupport.cpp | 3 +- mozilla/layout/generic/nsImageFrame.cpp | 2 +- mozilla/layout/generic/nsImageMap.cpp | 3 +- mozilla/layout/generic/nsSelection.cpp | 2 +- mozilla/layout/html/base/src/nsImageFrame.cpp | 2 +- mozilla/layout/html/base/src/nsImageMap.cpp | 3 +- mozilla/layout/html/base/src/nsPresShell.cpp | 35 ++--- .../html/forms/src/nsGfxTextControlFrame2.cpp | 3 +- .../layout/html/forms/src/nsLabelFrame.cpp | 3 +- .../html/style/src/nsCSSFrameConstructor.cpp | 8 +- .../layout/html/style/src/nsCSSRendering.cpp | 4 +- .../TableContentTest/TableContentTest.cpp | 14 +- mozilla/layout/style/nsStyleSet.cpp | 6 +- mozilla/layout/xul/base/src/nsBoxObject.cpp | 12 +- .../layout/xul/base/src/nsMenuPopupFrame.cpp | 3 +- .../xul/base/src/nsPopupSetBoxObject.cpp | 3 +- .../src/outliner/src/nsOutlinerSelection.cpp | 17 +-- .../xul/base/src/tree/src/nsTreeSelection.cpp | 17 +-- mozilla/mailnews/compose/src/nsMsgSend.cpp | 3 +- mozilla/modules/oji/src/ProxyClassLoader.cpp | 3 +- mozilla/modules/oji/src/lcglue.cpp | 3 +- .../modules/oji/src/nsCSecurityContext.cpp | 3 +- .../plugin/base/src/nsPluginHostImpl.cpp | 3 +- .../plugin/nglsrc/nsPluginHostImpl.cpp | 3 +- mozilla/rdf/chrome/src/nsChromeRegistry.cpp | 12 +- .../rdf/tests/domds/nsRDFDOMDataSource.cpp | 3 +- mozilla/uriloader/base/nsDocLoader.cpp | 5 +- .../webshell/tests/viewer/nsBrowserWindow.cpp | 8 +- mozilla/webshell/tests/viewer/nsViewerApp.cpp | 3 +- .../webshell/tests/viewer/nsWebCrawler.cpp | 6 +- .../webshell/tests/viewer/nsXPBaseWindow.cpp | 2 +- .../src/xpwidgets/nsBaseDragService.cpp | 3 +- .../xpfe/appshell/src/nsWebShellWindow.cpp | 3 +- mozilla/xpinstall/src/nsInstallTrigger.cpp | 3 +- .../src/nsJSInstallTriggerGlobal.cpp | 9 +- 120 files changed, 655 insertions(+), 495 deletions(-) diff --git a/mozilla/accessible/src/base/nsAccessibilityService.cpp b/mozilla/accessible/src/base/nsAccessibilityService.cpp index a4413ad5107..6ca72a6265e 100644 --- a/mozilla/accessible/src/base/nsAccessibilityService.cpp +++ b/mozilla/accessible/src/base/nsAccessibilityService.cpp @@ -322,10 +322,7 @@ NS_IMETHODIMP nsAccessibilityService::GetInfo(nsISupports* aFrame, nsIFrame** aR NS_ASSERTION(shells > 0,"Error no shells!"); #endif - *aShell = document->GetShellAt(0); - NS_IF_ADDREF(*aShell); - - return NS_OK; + return document->GetShellAt(0, aShell); } NS_IMETHODIMP @@ -347,7 +344,8 @@ nsAccessibilityService::CreateHTMLIFrameAccessible(nsIDOMNode* node, nsISupports nsCOMPtr doc; if (NS_SUCCEEDED(content->GetDocument(*getter_AddRefs(doc))) && doc) { - nsCOMPtr presShell = getter_AddRefs(doc->GetShellAt(0)); + nsCOMPtr presShell; + doc->GetShellAt(0, getter_AddRefs(presShell)); if (presShell) { nsCOMPtr supps; presShell->GetSubShellFor(content, getter_AddRefs(supps)); diff --git a/mozilla/accessible/src/base/nsAccessible.cpp b/mozilla/accessible/src/base/nsAccessible.cpp index 67cf574f558..d344cc2ca4e 100644 --- a/mozilla/accessible/src/base/nsAccessible.cpp +++ b/mozilla/accessible/src/base/nsAccessible.cpp @@ -1340,8 +1340,7 @@ nsAccessible::GetDocShellObjects(nsIDocShell* aDocShell, (*aPresShell)->GetDocument(getter_AddRefs(doc)); if (!doc) return NS_ERROR_FAILURE; - *aContent = doc->GetRootContent(); // this addrefs - return NS_OK; + return doc->GetRootContent(aContent); // this addrefs } //------------------------------------------------------- diff --git a/mozilla/accessible/src/base/nsRootAccessible.cpp b/mozilla/accessible/src/base/nsRootAccessible.cpp index 2c881a7a99b..ccf7a699798 100644 --- a/mozilla/accessible/src/base/nsRootAccessible.cpp +++ b/mozilla/accessible/src/base/nsRootAccessible.cpp @@ -133,7 +133,8 @@ NS_IMETHODIMP nsRootAccessible::GetAccRole(PRUint32 *aAccRole) NS_IMETHODIMP nsRootAccessible::GetAccValue(PRUnichar * *aAccValue) { - nsCOMPtr pURI(mDocument->GetDocumentURL()); + nsCOMPtr pURI; + mDocument->GetDocumentURL(getter_AddRefs(pURI)); char *path; pURI->GetSpec(&path); *aAccValue = ToNewUnicode(nsDependentCString(path)); diff --git a/mozilla/accessible/src/nsAccessibilityService.cpp b/mozilla/accessible/src/nsAccessibilityService.cpp index a4413ad5107..6ca72a6265e 100644 --- a/mozilla/accessible/src/nsAccessibilityService.cpp +++ b/mozilla/accessible/src/nsAccessibilityService.cpp @@ -322,10 +322,7 @@ NS_IMETHODIMP nsAccessibilityService::GetInfo(nsISupports* aFrame, nsIFrame** aR NS_ASSERTION(shells > 0,"Error no shells!"); #endif - *aShell = document->GetShellAt(0); - NS_IF_ADDREF(*aShell); - - return NS_OK; + return document->GetShellAt(0, aShell); } NS_IMETHODIMP @@ -347,7 +344,8 @@ nsAccessibilityService::CreateHTMLIFrameAccessible(nsIDOMNode* node, nsISupports nsCOMPtr doc; if (NS_SUCCEEDED(content->GetDocument(*getter_AddRefs(doc))) && doc) { - nsCOMPtr presShell = getter_AddRefs(doc->GetShellAt(0)); + nsCOMPtr presShell; + doc->GetShellAt(0, getter_AddRefs(presShell)); if (presShell) { nsCOMPtr supps; presShell->GetSubShellFor(content, getter_AddRefs(supps)); diff --git a/mozilla/accessible/src/nsAccessible.cpp b/mozilla/accessible/src/nsAccessible.cpp index 67cf574f558..d344cc2ca4e 100644 --- a/mozilla/accessible/src/nsAccessible.cpp +++ b/mozilla/accessible/src/nsAccessible.cpp @@ -1340,8 +1340,7 @@ nsAccessible::GetDocShellObjects(nsIDocShell* aDocShell, (*aPresShell)->GetDocument(getter_AddRefs(doc)); if (!doc) return NS_ERROR_FAILURE; - *aContent = doc->GetRootContent(); // this addrefs - return NS_OK; + return doc->GetRootContent(aContent); // this addrefs } //------------------------------------------------------- diff --git a/mozilla/accessible/src/nsRootAccessible.cpp b/mozilla/accessible/src/nsRootAccessible.cpp index 2c881a7a99b..ccf7a699798 100644 --- a/mozilla/accessible/src/nsRootAccessible.cpp +++ b/mozilla/accessible/src/nsRootAccessible.cpp @@ -133,7 +133,8 @@ NS_IMETHODIMP nsRootAccessible::GetAccRole(PRUint32 *aAccRole) NS_IMETHODIMP nsRootAccessible::GetAccValue(PRUnichar * *aAccValue) { - nsCOMPtr pURI(mDocument->GetDocumentURL()); + nsCOMPtr pURI; + mDocument->GetDocumentURL(getter_AddRefs(pURI)); char *path; pURI->GetSpec(&path); *aAccValue = ToNewUnicode(nsDependentCString(path)); diff --git a/mozilla/caps/src/nsScriptSecurityManager.cpp b/mozilla/caps/src/nsScriptSecurityManager.cpp index 54608b47ec5..e5996817caf 100644 --- a/mozilla/caps/src/nsScriptSecurityManager.cpp +++ b/mozilla/caps/src/nsScriptSecurityManager.cpp @@ -883,7 +883,8 @@ nsScriptSecurityManager::GetRootDocShell(JSContext *cx, nsIDocShell **result) nsCOMPtr docshell; nsCOMPtr scriptContext = (nsIScriptContext*)JS_GetContextPrivate(cx); if (!scriptContext) return NS_ERROR_FAILURE; - nsCOMPtr globalObject(dont_AddRef(scriptContext->GetGlobalObject())); + nsCOMPtr globalObject; + scriptContext->GetGlobalObject(getter_AddRefs(globalObject)); if (!globalObject) return NS_ERROR_FAILURE; rv = globalObject->GetDocShell(getter_AddRefs(docshell)); if (NS_FAILED(rv)) return rv; @@ -1168,7 +1169,8 @@ nsScriptSecurityManager::GetPrincipalAndFrame(JSContext *cx, NS_REINTERPRET_CAST(nsIScriptContext*,JS_GetContextPrivate(cx)); if (scriptContext) { - nsCOMPtr global = scriptContext->GetGlobalObject(); + nsCOMPtr global; + scriptContext->GetGlobalObject(getter_AddRefs(global)); NS_ENSURE_TRUE(global, NS_ERROR_FAILURE); nsCOMPtr globalData = do_QueryInterface(global); NS_ENSURE_TRUE(globalData, NS_ERROR_FAILURE); @@ -1427,7 +1429,8 @@ CheckConfirmDialog(JSContext* cx, const PRUnichar *szMessage, const PRUnichar *s nsCOMPtr scriptContext = (nsIScriptContext*)JS_GetContextPrivate(cx); if (scriptContext) { - nsCOMPtr globalObject(dont_AddRef(scriptContext->GetGlobalObject())); + nsCOMPtr globalObject; + scriptContext->GetGlobalObject(getter_AddRefs(globalObject)); NS_ASSERTION(globalObject, "script context has no global object"); nsCOMPtr domWin = do_QueryInterface(globalObject); if (domWin) diff --git a/mozilla/chrome/src/nsChromeRegistry.cpp b/mozilla/chrome/src/nsChromeRegistry.cpp index 0fb83fb7578..d27295d73d1 100644 --- a/mozilla/chrome/src/nsChromeRegistry.cpp +++ b/mozilla/chrome/src/nsChromeRegistry.cpp @@ -1186,7 +1186,8 @@ NS_IMETHODIMP nsChromeRegistry::RefreshWindow(nsIDOMWindowInternal* aWindow) // Deal with the backstop sheets first. PRInt32 shellCount = document->GetNumberOfShells(); for (PRInt32 k = 0; k < shellCount; k++) { - nsCOMPtr shell = getter_AddRefs(document->GetShellAt(k)); + nsCOMPtr shell; + document->GetShellAt(k, getter_AddRefs(shell)); if (shell) { nsCOMPtr styleSet; rv = shell->GetStyleSet(getter_AddRefs(styleSet)); @@ -1255,12 +1256,14 @@ NS_IMETHODIMP nsChromeRegistry::RefreshWindow(nsIDOMWindowInternal* aWindow) rv = container->GetInlineStyleSheet(getter_AddRefs(inlineSheet)); if (NS_FAILED(rv)) return rv; - PRInt32 count = document->GetNumberOfStyleSheets(); + PRInt32 count = 0; + document->GetNumberOfStyleSheets(&count); // Iterate over the style sheets. for (PRInt32 i = 0; i < count; i++) { // Get the style sheet - nsCOMPtr styleSheet = getter_AddRefs(document->GetStyleSheetAt(i)); + nsCOMPtr styleSheet; + document->GetStyleSheetAt(i, getter_AddRefs(styleSheet)); // Make sure we aren't the special style sheets that never change. We // want to skip those. @@ -2758,7 +2761,8 @@ nsChromeRegistry::GetBackstopSheets(nsIDocShell* aDocShell, nsISupportsArray **a nsCOMPtr content(do_QueryInterface(elt)); nsCOMPtr doc; content->GetDocument(*getter_AddRefs(doc)); - nsCOMPtr docURL = getter_AddRefs(doc->GetDocumentURL()); + nsCOMPtr docURL; + doc->GetDocumentURL(getter_AddRefs(docURL)); nsCOMPtr url; rv = NS_NewURI(getter_AddRefs(url), token, docURL); diff --git a/mozilla/content/base/public/nsIDocument.h b/mozilla/content/base/public/nsIDocument.h index 93631deafb9..47de8a41a68 100644 --- a/mozilla/content/base/public/nsIDocument.h +++ b/mozilla/content/base/public/nsIDocument.h @@ -85,7 +85,7 @@ public: // All documents have a memory arena associated with them which is // used for memory allocation during document creation. This call // returns the arena associated with this document. - virtual nsIArena* GetArena() = 0; + NS_IMETHOD GetArena(nsIArena** aArena) = 0; NS_IMETHOD StartDocumentLoad(const char* aCommand, nsIChannel* aChannel, @@ -104,7 +104,7 @@ public: /** * Return the URL for the document. May return null. */ - virtual nsIURI* GetDocumentURL() const = 0; + NS_IMETHOD GetDocumentURL(nsIURI** aURL) const = 0; /** * Return the principal responsible for this document. @@ -201,23 +201,23 @@ public: nsIPresShell** aInstancePtrResult) = 0; virtual PRBool DeleteShell(nsIPresShell* aShell) = 0; virtual PRInt32 GetNumberOfShells() = 0; - virtual nsIPresShell* GetShellAt(PRInt32 aIndex) = 0; + NS_IMETHOD GetShellAt(PRInt32 aIndex, nsIPresShell** aShell) = 0; /** * Return the parent document of this document. Will return null * unless this document is within a compound document and has a parent. */ - virtual nsIDocument* GetParentDocument() = 0; - virtual void SetParentDocument(nsIDocument* aParent) = 0; - virtual void AddSubDocument(nsIDocument* aSubDoc) = 0; - virtual PRInt32 GetNumberOfSubDocuments() = 0; - virtual nsIDocument* GetSubDocumentAt(PRInt32 aIndex) = 0; + NS_IMETHOD GetParentDocument(nsIDocument** aParent) = 0; + NS_IMETHOD SetParentDocument(nsIDocument* aParent) = 0; + NS_IMETHOD AddSubDocument(nsIDocument* aSubDoc) = 0; + NS_IMETHOD GetNumberOfSubDocuments(PRInt32* aCount) = 0; + NS_IMETHOD GetSubDocumentAt(PRInt32 aIndex, nsIDocument** aSubDoc) = 0; /** * Return the root content object for this document. */ - virtual nsIContent* GetRootContent() = 0; - virtual void SetRootContent(nsIContent* aRoot) = 0; + NS_IMETHOD GetRootContent(nsIContent** aRoot) = 0; + NS_IMETHOD SetRootContent(nsIContent* aRoot) = 0; /** * Get the direct children of the document - content in @@ -231,9 +231,9 @@ public: * Get the style sheets owned by this document. * Style sheets are ordered, most significant last. */ - virtual PRInt32 GetNumberOfStyleSheets() = 0; - virtual nsIStyleSheet* GetStyleSheetAt(PRInt32 aIndex) = 0; - virtual PRInt32 GetIndexOfStyleSheet(nsIStyleSheet* aSheet) = 0; + NS_IMETHOD GetNumberOfStyleSheets(PRInt32* aCount) = 0; + NS_IMETHOD GetStyleSheetAt(PRInt32 aIndex, nsIStyleSheet** aSheet) = 0; + NS_IMETHOD GetIndexOfStyleSheet(nsIStyleSheet* aSheet, PRInt32* aIndex) = 0; virtual void AddStyleSheet(nsIStyleSheet* aSheet) = 0; virtual void RemoveStyleSheet(nsIStyleSheet* aSheet) = 0; NS_IMETHOD UpdateStyleSheets(nsISupportsArray* aOldSheets, nsISupportsArray* aNewSheets) = 0; diff --git a/mozilla/content/base/src/nsContentList.cpp b/mozilla/content/base/src/nsContentList.cpp index 14962d26f13..8b22c6509ce 100644 --- a/mozilla/content/base/src/nsContentList.cpp +++ b/mozilla/content/base/src/nsContentList.cpp @@ -696,8 +696,8 @@ nsContentList::PopulateSelf() PopulateWith(mRootContent, PR_FALSE); } else if (mDocument) { - nsIContent *root; - root = mDocument->GetRootContent(); + nsIContent *root = nsnull; + mDocument->GetRootContent(&root); if (root) { PopulateWith(root, PR_TRUE); NS_RELEASE(root); diff --git a/mozilla/content/base/src/nsContentUtils.cpp b/mozilla/content/base/src/nsContentUtils.cpp index 0061748d513..9f257e7dfdd 100644 --- a/mozilla/content/base/src/nsContentUtils.cpp +++ b/mozilla/content/base/src/nsContentUtils.cpp @@ -121,13 +121,13 @@ nsresult nsContentUtils::GetDynamicScriptGlobal(JSContext* aContext, nsIScriptGlobalObject** aNativeGlobal) { - nsIScriptGlobalObject* nativeGlobal = nsnull; nsCOMPtr scriptCX; GetDynamicScriptContext(aContext, getter_AddRefs(scriptCX)); - if (scriptCX) { - *aNativeGlobal = nativeGlobal = scriptCX->GetGlobalObject(); + if (!scriptCX) { + *aNativeGlobal = nsnull; + return NS_ERROR_FAILURE; } - return nativeGlobal ? NS_OK : NS_ERROR_FAILURE; + return scriptCX->GetGlobalObject(aNativeGlobal); } //static @@ -451,7 +451,8 @@ nsContentUtils::ReparentContentWrapper(nsIContent *aContent, nsCOMPtr new_parent; if (!aNewParent) { - nsCOMPtr root(dont_AddRef(old_doc->GetRootContent())); + nsCOMPtr root; + old_doc->GetRootContent(getter_AddRefs(root)); if (root.get() == aContent) { new_parent = old_doc; diff --git a/mozilla/content/base/src/nsCopySupport.cpp b/mozilla/content/base/src/nsCopySupport.cpp index 1165c366d2f..4897cd48dc5 100644 --- a/mozilla/content/base/src/nsCopySupport.cpp +++ b/mozilla/content/base/src/nsCopySupport.cpp @@ -92,7 +92,8 @@ nsresult nsCopySupport::HTMLCopy(nsISelection *aSel, nsIDocument *aDoc, PRInt16 nsCOMPtr doc = do_QueryInterface(aDoc); if (doc) { - nsCOMPtr shell(dont_AddRef(doc->GetShellAt(0))); + nsCOMPtr shell; + doc->GetShellAt(0, getter_AddRefs(shell)); if (shell) { nsCOMPtr context; shell->GetPresContext(getter_AddRefs(context) ); diff --git a/mozilla/content/base/src/nsDocument.cpp b/mozilla/content/base/src/nsDocument.cpp index b72a214fd52..2fc63f6babd 100644 --- a/mozilla/content/base/src/nsDocument.cpp +++ b/mozilla/content/base/src/nsDocument.cpp @@ -169,10 +169,12 @@ nsDOMStyleSheetList::GetLength(PRUint32* aLength) // been added or removed. if (-1 == mLength) { PRUint32 count = 0; - PRInt32 i, imax = mDocument->GetNumberOfStyleSheets(); + PRInt32 i, imax = 0; + mDocument->GetNumberOfStyleSheets(&imax); for (i = 0; i < imax; i++) { - nsCOMPtr sheet(dont_AddRef(mDocument->GetStyleSheetAt(i))); + nsCOMPtr sheet; + mDocument->GetStyleSheetAt(i, getter_AddRefs(sheet)); if (!sheet) continue; nsCOMPtr domss(do_QueryInterface(sheet)); @@ -198,11 +200,13 @@ nsDOMStyleSheetList::Item(PRUint32 aIndex, nsIDOMStyleSheet** aReturn) *aReturn = nsnull; if (nsnull != mDocument) { PRUint32 count = 0; - PRInt32 i, imax = mDocument->GetNumberOfStyleSheets(); + PRInt32 i, imax = 0; + mDocument->GetNumberOfStyleSheets(&imax); // XXX Not particularly efficient, but does anyone care? for (i = 0; (i < imax) && (nsnull == *aReturn); i++) { - nsCOMPtr sheet(dont_AddRef(mDocument->GetStyleSheetAt(i))); + nsCOMPtr sheet; + mDocument->GetStyleSheetAt(i, getter_AddRefs(sheet)); if (!sheet) continue; nsCOMPtr domss(do_QueryInterface(sheet)); @@ -587,12 +591,11 @@ nsresult nsDocument::Init() return rv; } -nsIArena* nsDocument::GetArena() +NS_IMETHODIMP +nsDocument::GetArena(nsIArena** aArena) { - if (nsnull != mArena) { - NS_ADDREF(mArena); - } - return mArena; + NS_IF_ADDREF(*aArena = mArena); + return NS_OK; } NS_IMETHODIMP @@ -725,11 +728,11 @@ const nsString* nsDocument::GetDocumentTitle() const return &mDocumentTitle; } -nsIURI* nsDocument::GetDocumentURL() const +NS_IMETHODIMP +nsDocument::GetDocumentURL(nsIURI** aURI) const { - nsIURI* url = mDocumentURL; - NS_IF_ADDREF(url); - return url; + NS_IF_ADDREF(*aURI = mDocumentURL); + return NS_OK; } NS_IMETHODIMP @@ -1022,61 +1025,64 @@ PRInt32 nsDocument::GetNumberOfShells() return mPresShells.Count(); } -nsIPresShell* nsDocument::GetShellAt(PRInt32 aIndex) +NS_IMETHODIMP +nsDocument::GetShellAt(PRInt32 aIndex, nsIPresShell** aShell) { - nsIPresShell* shell = (nsIPresShell*) mPresShells.ElementAt(aIndex); - if (nsnull != shell) { - NS_ADDREF(shell); - } - return shell; + *aShell = (nsIPresShell*) mPresShells.ElementAt(aIndex); + NS_IF_ADDREF(*aShell); + return NS_OK; } -nsIDocument* nsDocument::GetParentDocument() +NS_IMETHODIMP +nsDocument::GetParentDocument(nsIDocument** aParent) { - if (nsnull != mParentDocument) { - NS_ADDREF(mParentDocument); - } - return mParentDocument; + NS_IF_ADDREF(*aParent = mParentDocument); + return NS_OK; } /** * Note that we do *not* AddRef our parent because that would * create a circular reference. */ -void nsDocument::SetParentDocument(nsIDocument* aParent) +NS_IMETHODIMP +nsDocument::SetParentDocument(nsIDocument* aParent) { mParentDocument = aParent; + return NS_OK; } -void nsDocument::AddSubDocument(nsIDocument* aSubDoc) +NS_IMETHODIMP +nsDocument::AddSubDocument(nsIDocument* aSubDoc) { NS_ADDREF(aSubDoc); mSubDocuments.AppendElement(aSubDoc); + return NS_OK; } -PRInt32 nsDocument::GetNumberOfSubDocuments() +NS_IMETHODIMP +nsDocument::GetNumberOfSubDocuments(PRInt32* aCount) { - return mSubDocuments.Count(); + *aCount = mSubDocuments.Count(); + return NS_OK; } -nsIDocument* nsDocument::GetSubDocumentAt(PRInt32 aIndex) +NS_IMETHODIMP +nsDocument::GetSubDocumentAt(PRInt32 aIndex, nsIDocument** aSubDoc) { - nsIDocument* doc = (nsIDocument*) mSubDocuments.ElementAt(aIndex); - if (nsnull != doc) { - NS_ADDREF(doc); - } - return doc; + *aSubDoc = (nsIDocument*) mSubDocuments.ElementAt(aIndex); + NS_IF_ADDREF(*aSubDoc); + return NS_OK; } -nsIContent* nsDocument::GetRootContent() +NS_IMETHODIMP +nsDocument::GetRootContent(nsIContent** aRoot) { - if (nsnull != mRootContent) { - NS_ADDREF(mRootContent); - } - return mRootContent; + NS_IF_ADDREF(*aRoot = mRootContent); + return NS_OK; } -void nsDocument::SetRootContent(nsIContent* aRoot) +NS_IMETHODIMP +nsDocument::SetRootContent(nsIContent* aRoot) { if (mRootContent) { PRInt32 indx = mChildren->IndexOf(mRootContent); @@ -1090,6 +1096,7 @@ void nsDocument::SetRootContent(nsIContent* aRoot) } mRootContent = aRoot; + return NS_OK; } NS_IMETHODIMP @@ -1116,21 +1123,26 @@ nsDocument::GetChildCount(PRInt32& aCount) return NS_OK; } -PRInt32 nsDocument::GetNumberOfStyleSheets() +NS_IMETHODIMP +nsDocument::GetNumberOfStyleSheets(PRInt32* aCount) { - return mStyleSheets.Count(); + *aCount = mStyleSheets.Count(); + return NS_OK; } -nsIStyleSheet* nsDocument::GetStyleSheetAt(PRInt32 aIndex) +NS_IMETHODIMP +nsDocument::GetStyleSheetAt(PRInt32 aIndex, nsIStyleSheet** aSheet) { - nsIStyleSheet* sheet = (nsIStyleSheet*)mStyleSheets.ElementAt(aIndex); - NS_IF_ADDREF(sheet); - return sheet; + *aSheet = (nsIStyleSheet*)mStyleSheets.ElementAt(aIndex); + NS_IF_ADDREF(*aSheet); + return NS_OK; } -PRInt32 nsDocument::GetIndexOfStyleSheet(nsIStyleSheet* aSheet) +NS_IMETHODIMP +nsDocument::GetIndexOfStyleSheet(nsIStyleSheet* aSheet, PRInt32* aIndex) { - return mStyleSheets.IndexOf(aSheet); + *aIndex = mStyleSheets.IndexOf(aSheet); + return NS_OK; } void nsDocument::InternalAddStyleSheet(nsIStyleSheet* aSheet) // subclass hook for sheet ordering @@ -2294,7 +2306,8 @@ nsDocument::GetBoxObjectFor(nsIDOMElement* aElement, nsIBoxObject** aResult) } } - nsCOMPtr shell(getter_AddRefs(GetShellAt(0))); + nsCOMPtr shell; + GetShellAt(0, getter_AddRefs(shell)); if (!shell) return NS_ERROR_FAILURE; @@ -2964,7 +2977,8 @@ nsDocument::DispatchEvent(nsIDOMEvent* aEvent) if (count == 0) return NS_OK; - nsCOMPtr shell(getter_AddRefs(GetShellAt(0))); + nsCOMPtr shell; + GetShellAt(0, getter_AddRefs(shell)); // Retrieve the context nsCOMPtr presContext; @@ -2986,7 +3000,8 @@ nsDocument::CreateEvent(const nsAReadableString& aEventType, nsIDOMEvent** aRetu if (count == 0) return NS_OK; - nsCOMPtr shell(getter_AddRefs(GetShellAt(0))); + nsCOMPtr shell; + GetShellAt(0, getter_AddRefs(shell)); // Retrieve the context nsCOMPtr presContext; diff --git a/mozilla/content/base/src/nsDocument.h b/mozilla/content/base/src/nsDocument.h index 1265483942a..9e1b5e34046 100644 --- a/mozilla/content/base/src/nsDocument.h +++ b/mozilla/content/base/src/nsDocument.h @@ -212,7 +212,7 @@ class nsDocument : public nsIDocument, public: NS_DECL_ISUPPORTS - virtual nsIArena* GetArena(); + NS_IMETHOD GetArena(nsIArena** aArena); NS_IMETHOD Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup); @@ -233,7 +233,7 @@ public: /** * Return the URL for the document. May return null. */ - virtual nsIURI* GetDocumentURL() const; + NS_IMETHOD GetDocumentURL(nsIURI** aURI) const; /** * Return the principal responsible for this document. @@ -328,23 +328,23 @@ public: #endif virtual PRBool DeleteShell(nsIPresShell* aShell); virtual PRInt32 GetNumberOfShells(); - virtual nsIPresShell* GetShellAt(PRInt32 aIndex); + NS_IMETHOD GetShellAt(PRInt32 aIndex, nsIPresShell** aShell); /** * Return the parent document of this document. Will return null * unless this document is within a compound document and has a parent. */ - virtual nsIDocument* GetParentDocument(); - virtual void SetParentDocument(nsIDocument* aParent); - virtual void AddSubDocument(nsIDocument* aSubDoc); - virtual PRInt32 GetNumberOfSubDocuments(); - virtual nsIDocument* GetSubDocumentAt(PRInt32 aIndex); + NS_IMETHOD GetParentDocument(nsIDocument** aParent); + NS_IMETHOD SetParentDocument(nsIDocument* aParent); + NS_IMETHOD AddSubDocument(nsIDocument* aSubDoc); + NS_IMETHOD GetNumberOfSubDocuments(PRInt32* aCount); + NS_IMETHOD GetSubDocumentAt(PRInt32 aIndex, nsIDocument** aSubDoc); /** * Return the root content object for this document. */ - virtual nsIContent* GetRootContent(); - virtual void SetRootContent(nsIContent* aRoot); + NS_IMETHOD GetRootContent(nsIContent** aRoot); + NS_IMETHOD SetRootContent(nsIContent* aRoot); /** * Get the direct children of the document - content in @@ -358,9 +358,9 @@ public: * Get the style sheets owned by this document. * These are ordered, highest priority last */ - virtual PRInt32 GetNumberOfStyleSheets(); - virtual nsIStyleSheet* GetStyleSheetAt(PRInt32 aIndex); - virtual PRInt32 GetIndexOfStyleSheet(nsIStyleSheet* aSheet); + NS_IMETHOD GetNumberOfStyleSheets(PRInt32* aCount); + NS_IMETHOD GetStyleSheetAt(PRInt32 aIndex, nsIStyleSheet** aSheet); + NS_IMETHOD GetIndexOfStyleSheet(nsIStyleSheet* aSheet, PRInt32* aIndex); virtual void AddStyleSheet(nsIStyleSheet* aSheet); virtual void RemoveStyleSheet(nsIStyleSheet* aSheet); diff --git a/mozilla/content/base/src/nsDocumentViewer.cpp b/mozilla/content/base/src/nsDocumentViewer.cpp index 485367d1a58..7409fda5f57 100644 --- a/mozilla/content/base/src/nsDocumentViewer.cpp +++ b/mozilla/content/base/src/nsDocumentViewer.cpp @@ -2001,7 +2001,8 @@ DocumentViewerImpl::IsParentAFrameSet(nsIWebShell * aParent) nsCOMPtr doc; shell->GetDocument(getter_AddRefs(doc)); if (doc) { - nsCOMPtr rootContent = getter_AddRefs(doc->GetRootContent()); + nsCOMPtr rootContent; + doc->GetRootContent(getter_AddRefs(rootContent)); if (rootContent) { if (NS_SUCCEEDED(FindFrameSetWithIID(rootContent, NS_GET_IID(nsIDOMHTMLFrameSetElement)))) { isFrameSet = PR_TRUE; @@ -2059,7 +2060,8 @@ DocumentViewerImpl::GetWebShellTitleAndURL(nsIWebShell * aWebShell, } } - nsCOMPtr url(getter_AddRefs(doc->GetDocumentURL())); + nsCOMPtr url; + doc->GetDocumentURL(getter_AddRefs(url)); if (url) { char * urlCStr; url->GetSpec(&urlCStr); @@ -2576,7 +2578,7 @@ DocumentViewerImpl::GetPresShellAndRootContent(nsIWebShell * aWebShell, presShell->GetDocument(getter_AddRefs(doc)); if (!doc) return; - *aContent = doc->GetRootContent(); // this addrefs + doc->GetRootContent(aContent); // this addrefs *aPresShell = presShell.get(); NS_ADDREF(*aPresShell); } @@ -3702,10 +3704,12 @@ DocumentViewerImpl::CreateStyleSet(nsIDocument* aDocument, rv = nsComponentManager::CreateInstance(kStyleSetCID,nsnull,NS_GET_IID(nsIStyleSet),(void**)aStyleSet); if (NS_OK == rv) { - PRInt32 index = aDocument->GetNumberOfStyleSheets(); + PRInt32 index = 0; + aDocument->GetNumberOfStyleSheets(&index); while (0 < index--) { - nsCOMPtr sheet(getter_AddRefs(aDocument->GetStyleSheetAt(index))); + nsCOMPtr sheet; + aDocument->GetStyleSheetAt(index, getter_AddRefs(sheet)); /* * GetStyleSheetAt will return all style sheets in the document but @@ -3986,7 +3990,8 @@ NS_IMETHODIMP DocumentViewerImpl::SelectAll() } else if (mDocument) { - nsCOMPtr rootContent = getter_AddRefs(mDocument->GetRootContent()); + nsCOMPtr rootContent; + mDocument->GetRootContent(getter_AddRefs(rootContent)); bodyNode = do_QueryInterface(rootContent); } if (!bodyNode) return NS_ERROR_FAILURE; diff --git a/mozilla/content/base/src/nsGenericElement.cpp b/mozilla/content/base/src/nsGenericElement.cpp index 90e02fecd95..0ac421f14e8 100644 --- a/mozilla/content/base/src/nsGenericElement.cpp +++ b/mozilla/content/base/src/nsGenericElement.cpp @@ -406,7 +406,7 @@ nsNode3Tearoff::GetBaseURI(nsAWritableString& aURI) doc->GetBaseURL(*getter_AddRefs(uri)); if (!uri) { - uri = dont_AddRef(doc->GetDocumentURL()); + doc->GetDocumentURL(getter_AddRefs(uri)); } } @@ -2009,8 +2009,8 @@ nsGenericElement::RenderFrame(nsIPresContext* aPresContext) PRInt32 i, n; n = mDocument->GetNumberOfShells(); for (i = 0; i < n; i++) { - nsIPresShell* shell; - shell = mDocument->GetShellAt(i); + nsCOMPtr shell; + mDocument->GetShellAt(i, getter_AddRefs(shell)); nsIFrame* frame; shell->GetPrimaryFrameFor(this, &frame); while (nsnull != frame) { @@ -2035,7 +2035,6 @@ nsGenericElement::RenderFrame(nsIPresContext* aPresContext) // If frame has a next-in-flow, repaint it too frame->GetNextInFlow(&frame); } - NS_RELEASE(shell); } return NS_OK; diff --git a/mozilla/content/base/src/nsHTMLContentSerializer.cpp b/mozilla/content/base/src/nsHTMLContentSerializer.cpp index 15280882036..a7cf75456e5 100644 --- a/mozilla/content/base/src/nsHTMLContentSerializer.cpp +++ b/mozilla/content/base/src/nsHTMLContentSerializer.cpp @@ -283,7 +283,8 @@ nsHTMLContentSerializer::SerializeAttributes(nsIContent* aContent, nsCOMPtr document; aContent->GetDocument(*getter_AddRefs(document)); if (document) { - nsCOMPtr uri = dont_AddRef(document->GetDocumentURL()); + nsCOMPtr uri; + document->GetDocumentURL(getter_AddRefs(uri)); if (uri) { nsAutoString absURI; rv = NS_MakeAbsoluteURI(absURI, valueStr, uri); diff --git a/mozilla/content/base/src/nsScriptLoader.cpp b/mozilla/content/base/src/nsScriptLoader.cpp index 12fd2de5b9e..2fd0f7587e3 100644 --- a/mozilla/content/base/src/nsScriptLoader.cpp +++ b/mozilla/content/base/src/nsScriptLoader.cpp @@ -397,7 +397,7 @@ nsScriptLoader::ProcessScriptElement(nsIDOMHTMLScriptElement *aElement, else { request->mLoading = PR_FALSE; request->mIsInline = PR_TRUE; - request->mURI = dont_AddRef(mDocument->GetDocumentURL()); + mDocument->GetDocumentURL(getter_AddRefs(request->mURI)); nsCOMPtr scriptElement(do_QueryInterface(aElement)); if (scriptElement) { diff --git a/mozilla/content/base/src/nsSelection.cpp b/mozilla/content/base/src/nsSelection.cpp index 80bb4a7a7d5..a3248222698 100644 --- a/mozilla/content/base/src/nsSelection.cpp +++ b/mozilla/content/base/src/nsSelection.cpp @@ -3016,7 +3016,7 @@ NS_IMETHODIMP nsSelection::SelectAll() rv = shell->GetDocument(getter_AddRefs(doc)); if (NS_FAILED(rv) || !doc) return rv?rv:NS_ERROR_FAILURE; - rootContent = getter_AddRefs(doc->GetRootContent()); + doc->GetRootContent(getter_AddRefs(rootContent)); if (!rootContent) return NS_ERROR_FAILURE; } diff --git a/mozilla/content/base/src/nsStyleLinkElement.cpp b/mozilla/content/base/src/nsStyleLinkElement.cpp index f72c6df5a2f..3cf866d18ff 100644 --- a/mozilla/content/base/src/nsStyleLinkElement.cpp +++ b/mozilla/content/base/src/nsStyleLinkElement.cpp @@ -307,7 +307,9 @@ nsStyleLinkElement::UpdateStyleSheet(PRBool aNotify, nsIDocument *aOldDocument, } } if (prevSheet) { - insertionPoint = doc->GetIndexOfStyleSheet(prevSheet) + 1; + PRInt32 sheetIndex = 0; + doc->GetIndexOfStyleSheet(prevSheet, &sheetIndex); + insertionPoint = sheetIndex + 1; } else { insertionPoint = 0; diff --git a/mozilla/content/base/src/nsStyleSet.cpp b/mozilla/content/base/src/nsStyleSet.cpp index e8504d1aa0f..2ed87c83f2a 100644 --- a/mozilla/content/base/src/nsStyleSet.cpp +++ b/mozilla/content/base/src/nsStyleSet.cpp @@ -521,14 +521,16 @@ void StyleSetImpl::AddDocStyleSheet(nsIStyleSheet* aSheet, nsIDocument* aDocumen if (EnsureArray(&mDocSheets)) { mDocSheets->RemoveElement(aSheet); // lowest index last - PRInt32 newDocIndex = aDocument->GetIndexOfStyleSheet(aSheet); + PRInt32 newDocIndex = 0; + aDocument->GetIndexOfStyleSheet(aSheet, &newDocIndex); PRUint32 count; nsresult rv = mDocSheets->Count(&count); if (NS_FAILED(rv)) return; // XXX error? PRUint32 index; for (index = 0; index < count; index++) { nsIStyleSheet* sheet = (nsIStyleSheet*)mDocSheets->ElementAt(index); - PRInt32 sheetDocIndex = aDocument->GetIndexOfStyleSheet(sheet); + PRInt32 sheetDocIndex = 0; + aDocument->GetIndexOfStyleSheet(sheet, &sheetDocIndex); if (sheetDocIndex < newDocIndex) { mDocSheets->InsertElementAt(aSheet, index); index = count; // break loop diff --git a/mozilla/content/base/src/nsSyncLoadService.cpp b/mozilla/content/base/src/nsSyncLoadService.cpp index 3f5bf58f63e..c9408065a2f 100644 --- a/mozilla/content/base/src/nsSyncLoadService.cpp +++ b/mozilla/content/base/src/nsSyncLoadService.cpp @@ -267,7 +267,7 @@ nsSyncLoader::LoadDocument(nsIURI* documentURI, nsIDOMDocument **_retval) // XXX Need to find a better way to do this rather than // chaining through a bunch of getters and QIs nsCOMPtr global; - global = dont_AddRef(scriptCX->GetGlobalObject()); + scriptCX->GetGlobalObject(getter_AddRefs(global)); if (!global) return NS_ERROR_FAILURE; nsCOMPtr docshell; diff --git a/mozilla/content/events/src/nsEventListenerManager.cpp b/mozilla/content/events/src/nsEventListenerManager.cpp index f4143150cce..019587931a3 100644 --- a/mozilla/content/events/src/nsEventListenerManager.cpp +++ b/mozilla/content/events/src/nsEventListenerManager.cpp @@ -2573,7 +2573,8 @@ nsEventListenerManager::DispatchEvent(nsIDOMEvent* aEvent) if (count == 0) return NS_OK; - nsCOMPtr shell = getter_AddRefs(document->GetShellAt(0)); + nsCOMPtr shell; + document->GetShellAt(0, getter_AddRefs(shell)); // Retrieve the context nsCOMPtr aPresContext; diff --git a/mozilla/content/events/src/nsEventStateManager.cpp b/mozilla/content/events/src/nsEventStateManager.cpp index a422d23cd12..921178808b2 100644 --- a/mozilla/content/events/src/nsEventStateManager.cpp +++ b/mozilla/content/events/src/nsEventStateManager.cpp @@ -410,7 +410,8 @@ nsEventStateManager::PreHandleEvent(nsIPresContext* aPresContext, nsCOMPtr doc; gLastFocusedContent->GetDocument(*getter_AddRefs(doc)); if (doc) { - nsCOMPtr shell = getter_AddRefs(doc->GetShellAt(0)); + nsCOMPtr shell; + doc->GetShellAt(0, getter_AddRefs(shell)); if (shell) { nsCOMPtr oldPresContext; shell->GetPresContext(getter_AddRefs(oldPresContext)); @@ -507,7 +508,8 @@ nsEventStateManager::PreHandleEvent(nsIPresContext* aPresContext, nsCOMPtr doc; gLastFocusedContent->GetDocument(*getter_AddRefs(doc)); if (doc) { - nsCOMPtr shell = getter_AddRefs(doc->GetShellAt(0)); + nsCOMPtr shell; + doc->GetShellAt(0, getter_AddRefs(shell)); if (shell) { nsCOMPtr oldPresContext; shell->GetPresContext(getter_AddRefs(oldPresContext)); @@ -599,7 +601,7 @@ nsEventStateManager::PreHandleEvent(nsIPresContext* aPresContext, document = do_QueryInterface(domDoc); nsCOMPtr shell; nsCOMPtr context; - shell = getter_AddRefs(document->GetShellAt(0)); + document->GetShellAt(0, getter_AddRefs(shell)); shell->GetPresContext(getter_AddRefs(context)); focusContent->SetFocus(context); } @@ -648,8 +650,8 @@ nsEventStateManager::PreHandleEvent(nsIPresContext* aPresContext, if (gLastFocusedDocument && gLastFocusedPresContext) { if (gLastFocusedContent) { // Blur the element. - nsCOMPtr shell = - getter_AddRefs(gLastFocusedDocument->GetShellAt(0)); + nsCOMPtr shell; + gLastFocusedDocument->GetShellAt(0, getter_AddRefs(shell)); if (shell) { nsCOMPtr oldPresContext; shell->GetPresContext(getter_AddRefs(oldPresContext)); @@ -1148,7 +1150,8 @@ nsEventStateManager::ChangeTextSize(PRInt32 change) nsCOMPtr doc = do_QueryInterface(domDoc); if(!doc) return NS_ERROR_FAILURE; - nsCOMPtr presShell = getter_AddRefs(doc->GetShellAt(0)); + nsCOMPtr presShell; + doc->GetShellAt(0, getter_AddRefs(presShell)); if(!presShell) return NS_ERROR_FAILURE; nsCOMPtr presContext; presShell->GetPresContext(getter_AddRefs(presContext)); @@ -1311,7 +1314,7 @@ nsEventStateManager::DoWheelScroll(nsIPresContext* aPresContext, else { // If there is no focused content, get the document content EnsureDocument(presShell); - focusContent = dont_AddRef(mDocument->GetRootContent()); + mDocument->GetRootContent(getter_AddRefs(focusContent)); } if (!focusContent) @@ -2577,7 +2580,8 @@ nsEventStateManager::ShiftFocus(PRBool forward, nsIContent* aRoot) { #ifdef DEBUG_DOCSHELL_FOCUS { - nsCOMPtr presShell = getter_AddRefs(mDocument->GetShellAt(0)); + nsCOMPtr presShell; + mDocument->GetShellAt(0, getter_AddRefs(presShell)); if (presShell) { nsCOMPtr presContext; presShell->GetPresContext(getter_AddRefs(presContext)); @@ -2623,7 +2627,7 @@ nsEventStateManager::ShiftFocus(PRBool forward, nsIContent* aRoot) //} } else if (nsnull == mCurrentFocus) { - mCurrentFocus = mDocument->GetRootContent(); + mDocument->GetRootContent(&mCurrentFocus); if (nsnull == mCurrentFocus) { return; } @@ -2676,7 +2680,8 @@ nsEventStateManager::ShiftFocus(PRBool forward, nsIContent* aRoot) // rememeber whether mSpecialTopOfDoc was set PRBool wasSpecialDocFocus = mSpecialTopOfDoc; - nsCOMPtr rootContent = getter_AddRefs(mDocument->GetRootContent()); + nsCOMPtr rootContent; + mDocument->GetRootContent(getter_AddRefs(rootContent)); // Check here to see if the HTMLFrame wants to do anything special // with the focus. i.e. like focusing a docshell child, or if it @@ -3591,7 +3596,8 @@ nsEventStateManager::SendFocusBlur(nsIPresContext* aPresContext, nsIContent *aCo // associated view manager on exit from this function. // See bug 53763. nsCOMPtr kungFuDeathGrip; - nsCOMPtr shell = getter_AddRefs(doc->GetShellAt(0)); + nsCOMPtr shell; + doc->GetShellAt(0, getter_AddRefs(shell)); if (shell) { shell->GetViewManager(getter_AddRefs(kungFuDeathGrip)); @@ -4255,7 +4261,8 @@ nsEventStateManager::FigureOutKindOfDoc(nsIDocument* aDoc, eDocType* aDocType) *aDocType = eChrome; - nsCOMPtr presShell = getter_AddRefs(aDoc->GetShellAt(0)); + nsCOMPtr presShell; + aDoc->GetShellAt(0, getter_AddRefs(presShell)); if (!presShell) return NS_ERROR_FAILURE; nsCOMPtr presContext; presShell->GetPresContext(getter_AddRefs(presContext)); @@ -4281,7 +4288,8 @@ nsEventStateManager::FigureOutKindOfDoc(nsIDocument* aDoc, eDocType* aDocType) *aDocType = eGenericContent; // See if we are a frame set - nsCOMPtrrootContent = getter_AddRefs(aDoc->GetRootContent()); + nsCOMPtr rootContent; + aDoc->GetRootContent(getter_AddRefs(rootContent)); if (IsFrameSetDoc(rootContent)) { *aDocType = eFrameSet; return NS_OK; @@ -4307,7 +4315,7 @@ nsEventStateManager::FigureOutKindOfDoc(nsIDocument* aDoc, eDocType* aDocType) parentPresShell->GetDocument(getter_AddRefs(parentDoc)); if (!parentDoc) return NS_ERROR_FAILURE; - rootContent = getter_AddRefs(parentDoc->GetRootContent()); + parentDoc->GetRootContent(getter_AddRefs(rootContent)); nsCOMPtr content = getter_AddRefs(FindContentForDocShell(parentPresShell, rootContent, docShell)); @@ -4340,7 +4348,8 @@ nsEventStateManager::GetDocShellsFromDoc(nsIDocument* aDocument, NS_ASSERTION(aDocShell, "Pointer is null!"); NS_ASSERTION(aParentDS, "Pointer is null!"); - nsCOMPtr presShell = getter_AddRefs(aDocument->GetShellAt(0)); + nsCOMPtr presShell; + aDocument->GetShellAt(0, getter_AddRefs(presShell)); if (!presShell) return NS_ERROR_FAILURE; nsCOMPtr presContext; @@ -4486,7 +4495,8 @@ nsEventStateManager::GetLastContent(nsIDocShell* aDocShell) presShell->GetDocument(getter_AddRefs(doc)); if (!doc) return nsnull; - nsCOMPtr rootContent = getter_AddRefs(doc->GetRootContent()); + nsCOMPtr rootContent; + doc->GetRootContent(getter_AddRefs(rootContent)); if (!rootContent) return nsnull; nsIContent* last = nsnull; @@ -4605,7 +4615,8 @@ nsEventStateManager::FocusAfterHTMLIFrameDoc(nsIDocShell* aDocShell, aParentDocShell->GetPresContext(getter_AddRefs(parentPresContext)); if (!parentPresContext) return PR_FALSE; - nsCOMPtr rootContent = getter_AddRefs(parentDoc->GetRootContent()); + nsCOMPtr rootContent; + parentDoc->GetRootContent(getter_AddRefs(rootContent)); if (!rootContent) return PR_FALSE; // Now that we have the Root Content for the Parent Doc @@ -4714,7 +4725,8 @@ nsEventStateManager::FocusWithinHTMLFrameDoc(nsIContent* aRootContent, parentPresShell->GetDocument(getter_AddRefs(parentDoc)); if (!parentDoc) return PR_FALSE; - nsCOMPtr rootContent = getter_AddRefs(parentDoc->GetRootContent()); + nsCOMPtr rootContent; + parentDoc->GetRootContent(getter_AddRefs(rootContent)); if (!rootContent) return PR_FALSE; // Look up the content diff --git a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp index 8c7245b4e91..c1414402a63 100644 --- a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp +++ b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp @@ -741,7 +741,8 @@ nsGenericHTMLElement::GetOffsetRect(nsRect& aRect, if(mDocument) { // Get Presentation shell 0 - nsCOMPtr presShell = getter_AddRefs(mDocument->GetShellAt(0)); + nsCOMPtr presShell; + mDocument->GetShellAt(0, getter_AddRefs(presShell)); if(presShell) { // Flush all pending notifications so that our frames are uptodate @@ -768,7 +769,8 @@ nsGenericHTMLElement::GetOffsetRect(nsRect& aRect, // Find the frame parent whose content's tagName either matches // the tagName passed in or is the document element. - nsCOMPtr docElement(getter_AddRefs(mDocument->GetRootContent())); + nsCOMPtr docElement; + mDocument->GetRootContent(getter_AddRefs(docElement)); nsIFrame* parent = frame; nsCOMPtr parentContent; frame->GetParent(&parent); @@ -1025,7 +1027,8 @@ nsGenericHTMLElement::InNavQuirksMode(nsIDocument* aDoc) if (aDoc) { nsCompatibility mode; // multiple shells on the same doc are out of luck - nsIPresShell* shell = aDoc->GetShellAt(0); + nsCOMPtr shell; + aDoc->GetShellAt(0, getter_AddRefs(shell)); if (shell) { nsCOMPtr presContext; shell->GetPresContext(getter_AddRefs(presContext)); @@ -1035,7 +1038,6 @@ nsGenericHTMLElement::InNavQuirksMode(nsIDocument* aDoc) status = PR_TRUE; } } - NS_RELEASE(shell); } } return status; @@ -2545,7 +2547,8 @@ nsGenericHTMLElement::GetPrimaryFrame(nsIHTMLContent* aContent, } // Get presentation shell 0 - nsIPresShell* presShell = doc->GetShellAt(0); + nsCOMPtr presShell; + doc->GetShellAt(0, getter_AddRefs(presShell)); if (nsnull != presShell) { nsIFrame *frame = nsnull; presShell->GetPrimaryFrameFor(aContent, &frame); @@ -2553,7 +2556,6 @@ nsGenericHTMLElement::GetPrimaryFrame(nsIHTMLContent* aContent, res = frame->QueryInterface(NS_GET_IID(nsIFormControlFrame), (void**)&aFormControlFrame); } - NS_RELEASE(presShell); } NS_RELEASE(doc); } @@ -2578,7 +2580,8 @@ nsGenericHTMLElement::GetPrimaryPresState(nsIHTMLContent* aContent, return result; } - nsCOMPtr presShell = getter_AddRefs(doc->GetShellAt(0)); + nsCOMPtr presShell; + doc->GetShellAt(0, getter_AddRefs(presShell)); NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE); nsCOMPtr frameManager; @@ -2621,10 +2624,10 @@ nsGenericHTMLElement::GetPresContext(nsIHTMLContent* aContent, if (NS_OK == aContent->GetDocument(doc)) { if (nsnull != doc) { // Get presentation shell 0 - nsIPresShell* presShell = doc->GetShellAt(0); + nsCOMPtr presShell; + doc->GetShellAt(0, getter_AddRefs(presShell)); if (nsnull != presShell) { res = presShell->GetPresContext(aPresContext); - NS_RELEASE(presShell); } NS_RELEASE(doc); } diff --git a/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp b/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp index cc94c9b760e..4bf6d433422 100644 --- a/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp @@ -336,7 +336,7 @@ nsHTMLAnchorElement::RemoveFocus(nsIPresContext* aPresContext) return NS_ERROR_NULL_POINTER; nsCOMPtr rootContent; - rootContent = getter_AddRefs(doc->GetRootContent()); + doc->GetRootContent(getter_AddRefs(rootContent)); rv = esm->SetContentState(rootContent, NS_EVENT_STATE_FOCUS); } diff --git a/mozilla/content/html/content/src/nsHTMLButtonElement.cpp b/mozilla/content/html/content/src/nsHTMLButtonElement.cpp index 45576b55da3..8d6cc90a49d 100644 --- a/mozilla/content/html/content/src/nsHTMLButtonElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLButtonElement.cpp @@ -308,7 +308,7 @@ nsHTMLButtonElement::RemoveFocus(nsIPresContext* aPresContext) return NS_ERROR_NULL_POINTER; nsCOMPtr rootContent; - rootContent = getter_AddRefs(doc->GetRootContent()); + doc->GetRootContent(getter_AddRefs(rootContent)); rv = esm->SetContentState(rootContent, NS_EVENT_STATE_FOCUS); } diff --git a/mozilla/content/html/content/src/nsHTMLFrameElement.cpp b/mozilla/content/html/content/src/nsHTMLFrameElement.cpp index 0a69f340b9d..7de73aad5d0 100644 --- a/mozilla/content/html/content/src/nsHTMLFrameElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLFrameElement.cpp @@ -179,7 +179,7 @@ nsHTMLFrameElement::GetContentDocument(nsIDOMDocument** aContentDocument) nsCOMPtr presShell; - presShell = dont_AddRef(mDocument->GetShellAt(0)); + mDocument->GetShellAt(0, getter_AddRefs(presShell)); NS_ENSURE_TRUE(presShell, NS_OK); nsCOMPtr tmp; diff --git a/mozilla/content/html/content/src/nsHTMLIFrameElement.cpp b/mozilla/content/html/content/src/nsHTMLIFrameElement.cpp index 2429afc45b6..3aeaa1f251a 100644 --- a/mozilla/content/html/content/src/nsHTMLIFrameElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLIFrameElement.cpp @@ -184,7 +184,7 @@ nsHTMLIFrameElement::GetContentDocument(nsIDOMDocument** aContentDocument) nsCOMPtr presShell; - presShell = dont_AddRef(mDocument->GetShellAt(0)); + mDocument->GetShellAt(0, getter_AddRefs(presShell)); NS_ENSURE_TRUE(presShell, NS_OK); nsCOMPtr tmp; diff --git a/mozilla/content/html/content/src/nsHTMLImageElement.cpp b/mozilla/content/html/content/src/nsHTMLImageElement.cpp index 8cb1826ec83..54f935af1ab 100644 --- a/mozilla/content/html/content/src/nsHTMLImageElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLImageElement.cpp @@ -639,7 +639,7 @@ nsHTMLImageElement::GetCallerSourceURL(nsIURI** sourceURL) if (doc) { result = doc->GetBaseURL(*sourceURL); if (!*sourceURL) { - *sourceURL = doc->GetDocumentURL(); + doc->GetDocumentURL(sourceURL); } } } @@ -918,7 +918,7 @@ nsHTMLImageElement::SetSrcInner(nsIURI* aBaseURL, if (NS_SUCCEEDED(result) && mOwnerDocument) { nsCOMPtr shell; - shell = dont_AddRef(mOwnerDocument->GetShellAt(0)); + mOwnerDocument->GetShellAt(0, getter_AddRefs(shell)); if (shell) { nsCOMPtr context; diff --git a/mozilla/content/html/content/src/nsHTMLInputElement.cpp b/mozilla/content/html/content/src/nsHTMLInputElement.cpp index 4052c0d1aad..d1094998f7c 100644 --- a/mozilla/content/html/content/src/nsHTMLInputElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLInputElement.cpp @@ -743,7 +743,7 @@ nsHTMLInputElement::RemoveFocus(nsIPresContext* aPresContext) nsCOMPtr rootContent; - rootContent = getter_AddRefs(doc->GetRootContent()); + doc->GetRootContent(getter_AddRefs(rootContent)); rv = esm->SetContentState(rootContent, NS_EVENT_STATE_FOCUS); } @@ -852,7 +852,8 @@ nsHTMLInputElement::Click() PRInt32 numShells = doc->GetNumberOfShells(); nsCOMPtr context; for (PRInt32 i=0; i shell = getter_AddRefs(doc->GetShellAt(i)); + nsCOMPtr shell; + doc->GetShellAt(i, getter_AddRefs(shell)); if (shell) { rv = shell->GetPresContext(getter_AddRefs(context)); if (context) { diff --git a/mozilla/content/html/content/src/nsHTMLSelectElement.cpp b/mozilla/content/html/content/src/nsHTMLSelectElement.cpp index 5e29257c743..cc949f65322 100644 --- a/mozilla/content/html/content/src/nsHTMLSelectElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLSelectElement.cpp @@ -1084,7 +1084,7 @@ nsHTMLSelectElement::RemoveFocus(nsIPresContext* aPresContext) return NS_ERROR_NULL_POINTER; nsCOMPtr rootContent; - rootContent = dont_AddRef(doc->GetRootContent()); + doc->GetRootContent(getter_AddRefs(rootContent)); rv = esm->SetContentState(rootContent, NS_EVENT_STATE_FOCUS); } diff --git a/mozilla/content/html/content/src/nsHTMLTableRowElement.cpp b/mozilla/content/html/content/src/nsHTMLTableRowElement.cpp index aceab73a405..99e9f51747a 100644 --- a/mozilla/content/html/content/src/nsHTMLTableRowElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLTableRowElement.cpp @@ -190,11 +190,13 @@ void DebugList(nsIDOMHTMLTableElement* aTable) { nsIDocument* doc = nsnull; result = content->GetDocument(doc); if (NS_SUCCEEDED(result) && (nsnull != doc)) { - nsIContent* root = doc->GetRootContent(); + nsIContent* root = nsnull; + doc->GetRootContent(&root); if (root) { root->List(); } - nsIPresShell* shell = doc->GetShellAt(0); + nsCOMPtr shell; + doc->GetShellAt(0, getter_AddRefs(shell)); if (nsnull != shell) { nsIFrame* rootFrame; shell->GetRootFrame(rootFrame); @@ -202,7 +204,6 @@ void DebugList(nsIDOMHTMLTableElement* aTable) { rootFrame->List(stdout, 0); } } - NS_RELEASE(shell); NS_RELEASE(doc); } NS_RELEASE(content); diff --git a/mozilla/content/html/content/src/nsHTMLTextAreaElement.cpp b/mozilla/content/html/content/src/nsHTMLTextAreaElement.cpp index 13cb8ccc6e6..a02cae8df19 100644 --- a/mozilla/content/html/content/src/nsHTMLTextAreaElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLTextAreaElement.cpp @@ -270,7 +270,7 @@ nsHTMLTextAreaElement::RemoveFocus(nsIPresContext* aPresContext) return NS_ERROR_NULL_POINTER; nsCOMPtr rootContent; - rootContent = getter_AddRefs(doc->GetRootContent()); + doc->GetRootContent(getter_AddRefs(rootContent)); rv = esm->SetContentState(rootContent, NS_EVENT_STATE_FOCUS); } diff --git a/mozilla/content/html/document/src/nsHTMLContentSink.cpp b/mozilla/content/html/document/src/nsHTMLContentSink.cpp index 17928fba118..a30e29abb4b 100644 --- a/mozilla/content/html/document/src/nsHTMLContentSink.cpp +++ b/mozilla/content/html/document/src/nsHTMLContentSink.cpp @@ -1552,7 +1552,7 @@ SinkContext::DemoteContainer(const nsIParserNode& aNode) if (mSink && mSink->mDocument) { PRInt32 ns = mSink->mDocument->GetNumberOfShells(); if (ns > 0) { - presShell = dont_AddRef(mSink->mDocument->GetShellAt(0)); + mSink->mDocument->GetShellAt(0, getter_AddRefs(presShell)); if (presShell) { presShell->GetFrameManager(getter_AddRefs(frameManager)); presShell->GetPresContext(getter_AddRefs(presContext)); @@ -2364,7 +2364,8 @@ HTMLContentSink::Init(nsIDocument* aDoc, // Make root part - nsCOMPtr doc_root(dont_AddRef(mDocument->GetRootContent())); + nsCOMPtr doc_root; + mDocument->GetRootContent(getter_AddRefs(doc_root)); if (doc_root) { // If the document already has a root we'll use it. This will @@ -2452,7 +2453,8 @@ HTMLContentSink::DidBuildModel(PRInt32 aQualityLevel) // XXX this is silly; who cares? RickG cares. It's part of the regression test. So don't bug me. PRInt32 i, ns = mDocument->GetNumberOfShells(); for (i = 0; i < ns; i++) { - nsCOMPtr shell(dont_AddRef(mDocument->GetShellAt(i))); + nsCOMPtr shell; + mDocument->GetShellAt(i, getter_AddRefs(shell)); if (shell) { nsCOMPtr vm; nsresult rv = shell->GetViewManager(getter_AddRefs(vm)); @@ -3518,7 +3520,8 @@ HTMLContentSink::StartLayout() PRInt32 i, ns = mDocument->GetNumberOfShells(); for (i = 0; i < ns; i++) { - nsCOMPtr shell(dont_AddRef(mDocument->GetShellAt(i))); + nsCOMPtr shell; + mDocument->GetShellAt(i, getter_AddRefs(shell)); if (shell) { // Make shell an observer for next time shell->BeginObservingDocument(); @@ -3573,7 +3576,8 @@ HTMLContentSink::StartLayout() // scroll bars. ns = mDocument->GetNumberOfShells(); for (i = 0; i < ns; i++) { - nsCOMPtr shell(dont_AddRef(mDocument->GetShellAt(i))); + nsCOMPtr shell; + mDocument->GetShellAt(i, getter_AddRefs(shell)); if (shell) { nsCOMPtr vm; shell->GetViewManager(getter_AddRefs(vm)); @@ -3643,7 +3647,8 @@ HTMLContentSink::ScrollToRef() PRInt32 i, ns = mDocument->GetNumberOfShells(); for (i = 0; i < ns; i++) { - nsCOMPtr shell(dont_AddRef(mDocument->GetShellAt(i))); + nsCOMPtr shell; + mDocument->GetShellAt(i, getter_AddRefs(shell)); if (shell) { // Scroll to the anchor shell->FlushPendingNotifications(); @@ -4858,7 +4863,8 @@ HTMLContentSink::DumpContentModel() FILE* out=::fopen("rtest_html.txt", "a"); if(out!=nsnull) { if(mDocument) { - nsIContent* root = mDocument->GetRootContent(); + nsIContent* root = nsnull; + mDocument->GetRootContent(&root); if(root) { if(mDocumentURI) { char* buff[1]={0}; diff --git a/mozilla/content/html/document/src/nsHTMLDocument.cpp b/mozilla/content/html/document/src/nsHTMLDocument.cpp index f205855b350..5b5b675af84 100644 --- a/mozilla/content/html/document/src/nsHTMLDocument.cpp +++ b/mozilla/content/html/document/src/nsHTMLDocument.cpp @@ -1028,7 +1028,7 @@ nsHTMLDocument::GetBaseURL(nsIURI*& aURL) const NS_ADDREF(aURL); } else { - aURL = GetDocumentURL(); + GetDocumentURL(&aURL); } return NS_OK; } @@ -2036,7 +2036,7 @@ nsHTMLDocument::GetSourceDocumentURL(JSContext* cx, if (NS_SUCCEEDED(result)) { nsCOMPtr doc(do_QueryInterface(document, &result)); if (doc) { - *sourceURL = doc->GetDocumentURL(); + doc->GetDocumentURL(sourceURL); result = sourceURL ? NS_OK : NS_ERROR_FAILURE; } } @@ -2680,7 +2680,7 @@ nsHTMLDocument::GetWidth(PRInt32* aWidth) // We make the assumption that the first presentation shell // is the one for which we need information. - shell = getter_AddRefs(GetShellAt(0)); + GetShellAt(0, getter_AddRefs(shell)); if (shell) { PRInt32 width, height; @@ -2702,7 +2702,7 @@ nsHTMLDocument::GetHeight(PRInt32* aHeight) // We make the assumption that the first presentation shell // is the one for which we need information. - shell = getter_AddRefs(GetShellAt(0)); + GetShellAt(0, getter_AddRefs(shell)); if (shell) { PRInt32 width, height; diff --git a/mozilla/content/html/document/src/nsImageDocument.cpp b/mozilla/content/html/document/src/nsImageDocument.cpp index 6545e4315f0..a7ef2ba998b 100644 --- a/mozilla/content/html/document/src/nsImageDocument.cpp +++ b/mozilla/content/html/document/src/nsImageDocument.cpp @@ -277,7 +277,8 @@ nsImageDocument::StartImageLoad(nsIURI* aURL, nsIStreamListener*& aListener) // so that we can pass it back upwards. - nsIPresShell* shell = GetShellAt(0); + nsCOMPtr shell; + GetShellAt(0, getter_AddRefs(shell)); if (nsnull != shell) { nsCOMPtr cx; shell->GetPresContext(getter_AddRefs(cx)); @@ -301,7 +302,6 @@ nsImageDocument::StartImageLoad(nsIURI* aURL, nsIStreamListener*& aListener) NS_RELEASE(group); } } - NS_RELEASE(shell); } // Finally, start the layout going @@ -401,7 +401,8 @@ nsImageDocument::StartLayout() PRInt32 i, ns = GetNumberOfShells(); for (i = 0; i < ns; i++) { - nsIPresShell* shell = GetShellAt(i); + nsCOMPtr shell; + GetShellAt(i, getter_AddRefs(shell)); if (nsnull != shell) { // Make shell an observer for next time shell->BeginObservingDocument(); @@ -421,7 +422,6 @@ nsImageDocument::StartLayout() vm->EnableRefresh(NS_VMREFRESH_IMMEDIATE); } - NS_RELEASE(shell); } } } diff --git a/mozilla/content/xbl/src/nsBindingManager.cpp b/mozilla/content/xbl/src/nsBindingManager.cpp index 7cdec403551..872ceee99cf 100644 --- a/mozilla/content/xbl/src/nsBindingManager.cpp +++ b/mozilla/content/xbl/src/nsBindingManager.cpp @@ -145,7 +145,8 @@ nsXBLDocumentInfo::SetPrototypeBinding(const nsAReadableCString& aRef, nsIXBLPro nsresult NS_NewXBLDocumentInfo(nsIDocument* aDocument, nsIXBLDocumentInfo** aResult) { - nsCOMPtr url = getter_AddRefs(aDocument->GetDocumentURL()); + nsCOMPtr url; + aDocument->GetDocumentURL(getter_AddRefs(url)); nsXPIDLCString str; url->GetSpec(getter_Copies(str)); @@ -626,7 +627,8 @@ nsBindingManager::ChangeDocumentFor(nsIContent* aContent, nsIDocument* aOldDocum SetAnonymousNodesFor(aContent, nsnull); for (PRInt32 i = aOldDocument->GetNumberOfShells() - 1; i >= 0; --i) { - nsCOMPtr shell = dont_AddRef( aOldDocument->GetShellAt(i) ); + nsCOMPtr shell; + aOldDocument->GetShellAt(i, getter_AddRefs(shell)); NS_ASSERTION(shell != nsnull, "Zoiks! nsIPresShell::ShellAt() broke"); // See if the element has nsIAnonymousContentCreator-created @@ -881,7 +883,8 @@ nsBindingManager::LoadBindingDocument(nsIDocument* aBoundDoc, const nsAReadableS uri->SetSpec(url); - nsCOMPtr docURL = getter_AddRefs(aBoundDoc->GetDocumentURL()); + nsCOMPtr docURL; + aBoundDoc->GetDocumentURL(getter_AddRefs(docURL)); nsXPIDLCString scheme; docURL->GetScheme(getter_Copies(scheme)); @@ -990,7 +993,8 @@ nsBindingManager::PutXBLDocumentInfo(nsIXBLDocumentInfo* aDocumentInfo) nsCOMPtr doc; aDocumentInfo->GetDocument(getter_AddRefs(doc)); - nsCOMPtr uri(getter_AddRefs(doc->GetDocumentURL())); + nsCOMPtr uri; + doc->GetDocumentURL(getter_AddRefs(uri)); nsXPIDLCString str; uri->GetSpec(getter_Copies(str)); diff --git a/mozilla/content/xbl/src/nsXBLPrototypeBinding.cpp b/mozilla/content/xbl/src/nsXBLPrototypeBinding.cpp index 89e1d85608d..2ac64a25ca0 100644 --- a/mozilla/content/xbl/src/nsXBLPrototypeBinding.cpp +++ b/mozilla/content/xbl/src/nsXBLPrototypeBinding.cpp @@ -479,7 +479,8 @@ nsXBLPrototypeBinding::LoadResources(PRBool* aResult) nsCOMPtr doc; info->GetDocument(getter_AddRefs(doc)); - nsCOMPtr docURL = getter_AddRefs(doc->GetDocumentURL()); + nsCOMPtr docURL; + doc->GetDocumentURL(getter_AddRefs(docURL)); for (PRInt32 i = 0; i < childCount; i++) { nsCOMPtr resource; @@ -528,7 +529,8 @@ nsXBLPrototypeBinding::LoadResources(PRBool* aResult) PRBool doneLoading; nsAutoString empty, media; resource->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::media, media); - PRInt32 numSheets = doc->GetNumberOfStyleSheets(); + PRInt32 numSheets = 0; + doc->GetNumberOfStyleSheets(&numSheets); rv = cssLoader->LoadStyleLink(nsnull, url, empty, media, kNameSpaceID_Unknown, numSheets, nsnull, @@ -1419,7 +1421,8 @@ nsXBLPrototypeBinding::NotifyBoundElements() if (parent) parent->IndexOf(content, index); - nsCOMPtr shell = getter_AddRefs(doc->GetShellAt(0)); + nsCOMPtr shell; + doc->GetShellAt(0, getter_AddRefs(shell)); if (shell) { nsIFrame* childFrame; shell->GetPrimaryFrameFor(content, &childFrame); diff --git a/mozilla/content/xbl/src/nsXBLPrototypeHandler.cpp b/mozilla/content/xbl/src/nsXBLPrototypeHandler.cpp index e6e88b875c6..f7ba0df0cd1 100644 --- a/mozilla/content/xbl/src/nsXBLPrototypeHandler.cpp +++ b/mozilla/content/xbl/src/nsXBLPrototypeHandler.cpp @@ -215,7 +215,8 @@ nsXBLPrototypeHandler::ExecuteHandler(nsIDOMEventReceiver* aReceiver, // Fix for bug #45989 nsCOMPtr document; mHandlerElement->GetDocument(*getter_AddRefs(document)); - nsCOMPtr url = getter_AddRefs(document->GetDocumentURL()); + nsCOMPtr url; + document->GetDocumentURL(getter_AddRefs(url)); PRBool isChrome = PR_FALSE; PRBool isRes = PR_FALSE; diff --git a/mozilla/content/xbl/src/nsXBLService.cpp b/mozilla/content/xbl/src/nsXBLService.cpp index 6392b4cbdce..f99ae4a6244 100644 --- a/mozilla/content/xbl/src/nsXBLService.cpp +++ b/mozilla/content/xbl/src/nsXBLService.cpp @@ -136,7 +136,8 @@ public: if (parent) parent->IndexOf(mBoundElement, index); - nsCOMPtr shell = getter_AddRefs(doc->GetShellAt(0)); + nsCOMPtr shell; + doc->GetShellAt(0, getter_AddRefs(shell)); if (shell) { nsIFrame* childFrame; shell->GetPrimaryFrameFor(mBoundElement, &childFrame); @@ -359,12 +360,14 @@ nsXBLStreamListener::Load(nsIDOMEvent* aEvent) // Remove ourselves from the set of pending docs. nsCOMPtr bindingManager; doc->GetBindingManager(getter_AddRefs(bindingManager)); - nsCOMPtr uri(getter_AddRefs(mBindingDocument->GetDocumentURL())); + nsCOMPtr uri; + mBindingDocument->GetDocumentURL(getter_AddRefs(uri)); nsXPIDLCString str; uri->GetSpec(getter_Copies(str)); bindingManager->RemoveLoadingDocListener(nsCAutoString(NS_STATIC_CAST(const char*, str))); - nsCOMPtr root = getter_AddRefs(mBindingDocument->GetRootContent()); + nsCOMPtr root; + mBindingDocument->GetRootContent(getter_AddRefs(root)); if (root) nsXBLService::StripWhitespaceNodes(root); else { @@ -949,7 +952,8 @@ NS_IMETHODIMP nsXBLService::GetBindingInternal(nsIContent* aBoundElement, // We have a doc. Obtain our specific binding element. // Walk the children looking for the binding that matches the ref // specified in the URL. - nsCOMPtr root = getter_AddRefs(doc->GetRootContent()); + nsCOMPtr root; + doc->GetRootContent(getter_AddRefs(root)); if (!root) return NS_ERROR_FAILURE; @@ -1328,7 +1332,8 @@ nsXBLService::FetchBindingDocument(nsIContent* aBoundElement, nsIDocument* aBoun // It generates text nodes even for whitespace. The following // call walks the generated document tree and trims out these // nodes. - nsCOMPtr root = getter_AddRefs(doc->GetRootContent()); + nsCOMPtr root; + doc->GetRootContent(getter_AddRefs(root)); if (root) StripWhitespaceNodes(root); diff --git a/mozilla/content/xbl/src/nsXBLWindowHandler.cpp b/mozilla/content/xbl/src/nsXBLWindowHandler.cpp index 4e1a36aeba3..7734d1a2719 100644 --- a/mozilla/content/xbl/src/nsXBLWindowHandler.cpp +++ b/mozilla/content/xbl/src/nsXBLWindowHandler.cpp @@ -134,7 +134,8 @@ nsXBLSpecialDocInfo::GetHandlers(nsIXBLDocumentInfo* aInfo, if (!binding) { nsCOMPtr doc; aInfo->GetDocument(getter_AddRefs(doc)); - nsCOMPtr root = getter_AddRefs(doc->GetRootContent()); + nsCOMPtr root; + doc->GetRootContent(getter_AddRefs(root)); if (root) { // no root, no handlers. don't crash please. PRInt32 childCount; root->ChildCount(childCount); diff --git a/mozilla/content/xml/content/src/nsXMLElement.cpp b/mozilla/content/xml/content/src/nsXMLElement.cpp index 27e4aa35dc5..641532140fe 100644 --- a/mozilla/content/xml/content/src/nsXMLElement.cpp +++ b/mozilla/content/xml/content/src/nsXMLElement.cpp @@ -243,7 +243,7 @@ nsXMLElement::GetXMLBaseURI(nsIURI **aURI) nsCOMPtr docBase; mDocument->GetBaseURL(*getter_AddRefs(docBase)); if (!docBase) { - docBase = dont_AddRef(mDocument->GetDocumentURL()); + mDocument->GetDocumentURL(getter_AddRefs(docBase)); } if (base.IsEmpty()) { *aURI = docBase.get(); @@ -595,7 +595,8 @@ nsXMLElement::GetScriptObject(nsIScriptContext* aContext, void** aScriptObject) "nsXMLElement::mScriptObject"); // See if we have a frame. - nsCOMPtr shell = getter_AddRefs(mDocument->GetShellAt(0)); + nsCOMPtr shell; + mDocument->GetShellAt(0, getter_AddRefs(shell)); if (shell) { nsIFrame* frame; shell->GetPrimaryFrameFor(this, &frame); diff --git a/mozilla/content/xml/document/src/nsXMLContentSink.cpp b/mozilla/content/xml/document/src/nsXMLContentSink.cpp index 7ea709649c7..dae209243e5 100644 --- a/mozilla/content/xml/document/src/nsXMLContentSink.cpp +++ b/mozilla/content/xml/document/src/nsXMLContentSink.cpp @@ -254,7 +254,8 @@ nsXMLContentSink::ScrollToRef() { PRInt32 i, ns = mDocument->GetNumberOfShells(); for (i = 0; i < ns; i++) { - nsCOMPtr shell(dont_AddRef(mDocument->GetShellAt(i))); + nsCOMPtr shell; + mDocument->GetShellAt(i, getter_AddRefs(shell)); if (shell) { shell->FlushPendingNotifications(); // Scroll to the anchor @@ -270,7 +271,8 @@ nsXMLContentSink::DidBuildModel(PRInt32 aQualityLevel) // XXX this is silly; who cares? PRInt32 i, ns = mDocument->GetNumberOfShells(); for (i = 0; i < ns; i++) { - nsCOMPtr shell( dont_AddRef(mDocument->GetShellAt(i)) ); + nsCOMPtr shell; + mDocument->GetShellAt(i, getter_AddRefs(shell)); if (shell) { nsCOMPtr vm; shell->GetViewManager(getter_AddRefs(vm)); @@ -1584,7 +1586,8 @@ nsXMLContentSink::StartLayout() PRInt32 i, ns = mDocument->GetNumberOfShells(); for (i = 0; i < ns; i++) { - nsIPresShell* shell = mDocument->GetShellAt(i); + nsCOMPtr shell; + mDocument->GetShellAt(i, getter_AddRefs(shell)); if (nsnull != shell) { // Make shell an observer for next time shell->BeginObservingDocument(); @@ -1603,7 +1606,6 @@ nsXMLContentSink::StartLayout() RefreshIfEnabled(vm); } - NS_RELEASE(shell); } } @@ -1637,7 +1639,8 @@ nsXMLContentSink::StartLayout() // scroll bars. ns = mDocument->GetNumberOfShells(); for (i = 0; i < ns; i++) { - nsCOMPtr shell(dont_AddRef(mDocument->GetShellAt(i))); + nsCOMPtr shell; + mDocument->GetShellAt(i, getter_AddRefs(shell)); if (shell) { nsCOMPtr vm; shell->GetViewManager(getter_AddRefs(vm)); diff --git a/mozilla/content/xul/content/src/nsXULElement.cpp b/mozilla/content/xul/content/src/nsXULElement.cpp index 2951111a50a..9d11f7086f5 100644 --- a/mozilla/content/xul/content/src/nsXULElement.cpp +++ b/mozilla/content/xul/content/src/nsXULElement.cpp @@ -831,7 +831,8 @@ nsXULElement::GetParentNode(nsIDOMNode** aParentNode) } else if (mDocument) { // XXX This is a mess because of our fun multiple inheritance heirarchy - nsCOMPtr root = dont_AddRef( mDocument->GetRootContent() ); + nsCOMPtr root; + mDocument->GetRootContent(getter_AddRefs(root)); nsCOMPtr thisIContent; QueryInterface(NS_GET_IID(nsIContent), getter_AddRefs(thisIContent)); @@ -1765,8 +1766,8 @@ nsXULElement::GetContainingNameSpace(nsINameSpace*& aNameSpace) const // nsIXMLContent. If we're in a document, try to doc's root // element. if (mDocument) { - nsCOMPtr docroot - = dont_AddRef( mDocument->GetRootContent() ); + nsCOMPtr docroot; + mDocument->GetRootContent(getter_AddRefs(docroot)); // Wow! Nasty cast to get an unambiguous, non-const // nsISupports pointer. We want to make sure that we're not @@ -1799,7 +1800,7 @@ nsXULElement::GetXMLBaseURI(nsIURI **aURI) if (mDocument) { mDocument->GetBaseURL(*aURI); if (!*aURI) { - *aURI = mDocument->GetDocumentURL(); + mDocument->GetDocumentURL(aURI); } } return NS_OK; @@ -1875,7 +1876,8 @@ nsXULElement::AddScriptEventListener(nsIAtom* aName, if (NS_FAILED(rv)) return rv; } - nsCOMPtr root(getter_AddRefs(mDocument->GetRootContent())); + nsCOMPtr root; + mDocument->GetRootContent(getter_AddRefs(root)); nsCOMPtr content(do_QueryInterface(NS_STATIC_CAST(nsIStyledContent*, this))); if ((!root || root == content) && !NodeInfo()->Equals(nsXULAtoms::overlay)) { nsCOMPtr receiver = do_QueryInterface(global); @@ -1990,7 +1992,8 @@ nsXULElement::DispatchEvent(nsIDOMEvent* aEvent) if (count == 0) return NS_OK; - nsCOMPtr shell = getter_AddRefs(mDocument->GetShellAt(0)); + nsCOMPtr shell; + mDocument->GetShellAt(0, getter_AddRefs(shell)); // Retrieve the context nsCOMPtr aPresContext; @@ -2135,7 +2138,8 @@ nsXULElement::GetScriptObject(nsIScriptContext* aContext, void** aScriptObject) nsCOMPtr ourTag; GetTag(*getter_AddRefs(ourTag)); if (mDocument && CanHaveBinding(ourTag)) { - nsCOMPtr shell = getter_AddRefs(mDocument->GetShellAt(0)); + nsCOMPtr shell; + mDocument->GetShellAt(0, getter_AddRefs(shell)); if (shell) { nsIFrame* frame; shell->GetPrimaryFrameFor(NS_STATIC_CAST(nsIStyledContent*, this), &frame); @@ -3996,15 +4000,14 @@ nsXULElement::ExecuteJSCode(nsIDOMElement* anElement, nsEvent* aEvent) PRInt32 count = document->GetNumberOfShells(); for (PRInt32 i = 0; i < count; i++) { - nsIPresShell* shell = document->GetShellAt(i); - if (nsnull == shell) + nsCOMPtr shell; + document->GetShellAt(i, getter_AddRefs(shell)); + if (!shell) continue; // Retrieve the context in which our DOM event will fire. nsCOMPtr aPresContext; shell->GetPresContext(getter_AddRefs(aPresContext)); - - NS_RELEASE(shell); // Handle the DOM event nsEventStatus status = nsEventStatus_eIgnore; @@ -4394,7 +4397,8 @@ nsXULElement::Focus() if (count == 0) return NS_OK; - nsCOMPtr shell = getter_AddRefs(mDocument->GetShellAt(0)); + nsCOMPtr shell; + mDocument->GetShellAt(0, getter_AddRefs(shell)); // Retrieve the context nsCOMPtr aPresContext; @@ -4412,7 +4416,8 @@ nsXULElement::Blur() if (count == 0) return NS_OK; - nsCOMPtr shell = getter_AddRefs(mDocument->GetShellAt(0)); + nsCOMPtr shell; + mDocument->GetShellAt(0, getter_AddRefs(shell)); // Retrieve the context nsCOMPtr aPresContext; @@ -4433,7 +4438,7 @@ nsXULElement::Click() nsCOMPtr context; for (PRInt32 i=0; iGetShellAt(i)); + doc->GetShellAt(i, getter_AddRefs(shell)); shell->GetPresContext(getter_AddRefs(context)); nsEventStatus status = nsEventStatus_eIgnore; @@ -4465,7 +4470,7 @@ nsXULElement::Command() PRBool isButton = NodeInfo()->Equals(NS_LITERAL_STRING("button")); for (PRInt32 i=0; iGetShellAt(i)); + doc->GetShellAt(i, getter_AddRefs(shell)); shell->GetPresContext(getter_AddRefs(context)); nsEventStatus status = nsEventStatus_eIgnore; diff --git a/mozilla/content/xul/content/src/nsXULPopupListener.cpp b/mozilla/content/xul/content/src/nsXULPopupListener.cpp index 2bd4e6303cc..c46acfdeb5f 100644 --- a/mozilla/content/xul/content/src/nsXULPopupListener.cpp +++ b/mozilla/content/xul/content/src/nsXULPopupListener.cpp @@ -390,7 +390,7 @@ XULPopupListenerImpl::FireFocusOnTargetContent(nsIDOMNode* aTargetNode) nsCOMPtr shell; nsCOMPtr context; nsCOMPtr tempdoc = do_QueryInterface(domDoc); - shell = getter_AddRefs(tempdoc->GetShellAt(0)); // Get nsIDOMElement for targetNode + tempdoc->GetShellAt(0, getter_AddRefs(shell)); // Get nsIDOMElement for targetNode shell->GetPresContext(getter_AddRefs(context)); nsCOMPtr content = do_QueryInterface(aTargetNode); diff --git a/mozilla/content/xul/content/src/nsXULTreeElement.cpp b/mozilla/content/xul/content/src/nsXULTreeElement.cpp index c4b097a174d..65a38f3433a 100644 --- a/mozilla/content/xul/content/src/nsXULTreeElement.cpp +++ b/mozilla/content/xul/content/src/nsXULTreeElement.cpp @@ -440,15 +440,16 @@ nsXULTreeElement::FireOnSelectHandler() return NS_OK; PRInt32 count = document->GetNumberOfShells(); - for (PRInt32 i = 0; i < count; i++) { - nsCOMPtr shell = getter_AddRefs(document->GetShellAt(i)); - if (nsnull == shell) - continue; + for (PRInt32 i = 0; i < count; i++) { + nsCOMPtr shell; + document->GetShellAt(i, getter_AddRefs(shell)); + if (!shell) + continue; + + // Retrieve the context in which our DOM event will fire. + nsCOMPtr aPresContext; + shell->GetPresContext(getter_AddRefs(aPresContext)); - // Retrieve the context in which our DOM event will fire. - nsCOMPtr aPresContext; - shell->GetPresContext(getter_AddRefs(aPresContext)); - nsEventStatus status = nsEventStatus_eIgnore; nsEvent event; event.eventStructType = NS_EVENT; diff --git a/mozilla/content/xul/document/src/nsXULCommandDispatcher.cpp b/mozilla/content/xul/document/src/nsXULCommandDispatcher.cpp index 0505dda3d75..f6f251f0dbd 100644 --- a/mozilla/content/xul/document/src/nsXULCommandDispatcher.cpp +++ b/mozilla/content/xul/document/src/nsXULCommandDispatcher.cpp @@ -351,7 +351,8 @@ nsXULCommandDispatcher::UpdateCommands(const nsAReadableString& aEventName) PRInt32 count = document->GetNumberOfShells(); for (PRInt32 i = 0; i < count; i++) { - nsCOMPtr shell = dont_AddRef(document->GetShellAt(i)); + nsCOMPtr shell; + document->GetShellAt(i, getter_AddRefs(shell)); if (! shell) continue; diff --git a/mozilla/content/xul/document/src/nsXULContentSink.cpp b/mozilla/content/xul/document/src/nsXULContentSink.cpp index 46db10143e7..8f7a31edaa6 100644 --- a/mozilla/content/xul/document/src/nsXULContentSink.cpp +++ b/mozilla/content/xul/document/src/nsXULContentSink.cpp @@ -493,7 +493,8 @@ XULContentSinkImpl::DidBuildModel(PRInt32 aQualityLevel) // XXX this is silly; who cares? PRInt32 i, ns = mDocument->GetNumberOfShells(); for (i = 0; i < ns; i++) { - nsIPresShell* shell = mDocument->GetShellAt(i); + nsCOMPtr shell; + mDocument->GetShellAt(i, getter_AddRefs(shell)); if (nsnull != shell) { nsIViewManager* vm; shell->GetViewManager(&vm); @@ -501,7 +502,6 @@ XULContentSinkImpl::DidBuildModel(PRInt32 aQualityLevel) vm->SetQuality(nsContentQuality(aQualityLevel)); } NS_RELEASE(vm); - NS_RELEASE(shell); } } #endif @@ -860,8 +860,10 @@ XULContentSinkImpl::ProcessStyleLink(nsIContent* aElement, return NS_ERROR_FAILURE; // doc went away! PRBool doneLoading; + PRInt32 numSheets = 0; + doc->GetNumberOfStyleSheets(&numSheets); rv = mCSSLoader->LoadStyleLink(aElement, url, aTitle, aMedia, kNameSpaceID_Unknown, - doc->GetNumberOfStyleSheets(), + numSheets, ((blockParser) ? mParser : nsnull), doneLoading, nsnull); if (NS_SUCCEEDED(rv) && blockParser && (! doneLoading)) { diff --git a/mozilla/content/xul/document/src/nsXULDocument.cpp b/mozilla/content/xul/document/src/nsXULDocument.cpp index 54028471404..c08af923b9c 100644 --- a/mozilla/content/xul/document/src/nsXULDocument.cpp +++ b/mozilla/content/xul/document/src/nsXULDocument.cpp @@ -595,12 +595,11 @@ nsXULDocument::Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) return NS_ERROR_NOT_IMPLEMENTED; } -nsIArena* -nsXULDocument::GetArena() +NS_IMETHODIMP +nsXULDocument::GetArena(nsIArena** aArena) { - nsIArena* result = mArena; - NS_IF_ADDREF(result); - return result; + NS_IF_ADDREF(*aArena = mArena); + return NS_OK; } NS_IMETHODIMP @@ -753,12 +752,11 @@ nsXULDocument::GetDocumentTitle() const return &mDocumentTitle; } -nsIURI* -nsXULDocument::GetDocumentURL() const +NS_IMETHODIMP +nsXULDocument::GetDocumentURL(nsIURI** aURI) const { - nsIURI* result = mDocumentURL; - NS_IF_ADDREF(result); - return result; + NS_IF_ADDREF(*aURI = mDocumentURL); + return NS_OK; } NS_IMETHODIMP @@ -792,7 +790,7 @@ nsXULDocument::GetBaseURL(nsIURI*& aURL) const NS_ADDREF(aURL); } else { - aURL = GetDocumentURL(); + GetDocumentURL(&aURL); } return NS_OK; } @@ -1006,61 +1004,61 @@ nsXULDocument::GetNumberOfShells() return mPresShells.Count(); } -nsIPresShell* -nsXULDocument::GetShellAt(PRInt32 aIndex) +NS_IMETHODIMP +nsXULDocument::GetShellAt(PRInt32 aIndex, nsIPresShell** aShell) { - nsIPresShell* shell = NS_STATIC_CAST(nsIPresShell*, mPresShells[aIndex]); - NS_IF_ADDREF(shell); - return shell; + *aShell = NS_STATIC_CAST(nsIPresShell*, mPresShells[aIndex]); + NS_IF_ADDREF(*aShell); + return NS_OK; } -nsIDocument* -nsXULDocument::GetParentDocument() +NS_IMETHODIMP +nsXULDocument::GetParentDocument(nsIDocument** aParent) { - NS_IF_ADDREF(mParentDocument); - return mParentDocument; + NS_IF_ADDREF(*aParent = mParentDocument); + return NS_OK; } -void +NS_IMETHODIMP nsXULDocument::SetParentDocument(nsIDocument* aParent) { // Note that we do *not* AddRef our parent because that would // create a circular reference. mParentDocument = aParent; + return NS_OK; } -void +NS_IMETHODIMP nsXULDocument::AddSubDocument(nsIDocument* aSubDoc) { NS_ADDREF(aSubDoc); mSubDocuments.AppendElement(aSubDoc); + return NS_OK; } -PRInt32 -nsXULDocument::GetNumberOfSubDocuments() +NS_IMETHODIMP +nsXULDocument::GetNumberOfSubDocuments(PRInt32 *aCount) { - return mSubDocuments.Count(); + *aCount = mSubDocuments.Count(); + return NS_OK; } -nsIDocument* -nsXULDocument::GetSubDocumentAt(PRInt32 aIndex) +NS_IMETHODIMP +nsXULDocument::GetSubDocumentAt(PRInt32 aIndex, nsIDocument** aSubDoc) { - nsIDocument* doc = (nsIDocument*) mSubDocuments.ElementAt(aIndex); - if (nsnull != doc) { - NS_ADDREF(doc); - } - return doc; + *aSubDoc = (nsIDocument*) mSubDocuments.ElementAt(aIndex); + NS_IF_ADDREF(*aSubDoc); + return NS_OK; } -nsIContent* -nsXULDocument::GetRootContent() +NS_IMETHODIMP +nsXULDocument::GetRootContent(nsIContent** aRoot) { - nsIContent* result = mRootContent; - NS_IF_ADDREF(result); - return result; + NS_IF_ADDREF(*aRoot = mRootContent); + return NS_OK; } -void +NS_IMETHODIMP nsXULDocument::SetRootContent(nsIContent* aRoot) { if (mRootContent) { @@ -1070,6 +1068,7 @@ nsXULDocument::SetRootContent(nsIContent* aRoot) if (mRootContent) { mRootContent->SetDocument(this, PR_TRUE, PR_TRUE); } + return NS_OK; } NS_IMETHODIMP @@ -1093,24 +1092,26 @@ nsXULDocument::GetChildCount(PRInt32& aCount) return NS_ERROR_NOT_IMPLEMENTED; } -PRInt32 -nsXULDocument::GetNumberOfStyleSheets() +NS_IMETHODIMP +nsXULDocument::GetNumberOfStyleSheets(PRInt32 *aCount) { - return mStyleSheets.Count(); + *aCount = mStyleSheets.Count(); + return NS_OK; } -nsIStyleSheet* -nsXULDocument::GetStyleSheetAt(PRInt32 aIndex) +NS_IMETHODIMP +nsXULDocument::GetStyleSheetAt(PRInt32 aIndex, nsIStyleSheet** aSheet) { - nsIStyleSheet* sheet = NS_STATIC_CAST(nsIStyleSheet*, mStyleSheets[aIndex]); - NS_IF_ADDREF(sheet); - return sheet; + *aSheet = NS_STATIC_CAST(nsIStyleSheet*, mStyleSheets[aIndex]); + NS_IF_ADDREF(*aSheet); + return NS_OK; } -PRInt32 -nsXULDocument::GetIndexOfStyleSheet(nsIStyleSheet* aSheet) +NS_IMETHODIMP +nsXULDocument::GetIndexOfStyleSheet(nsIStyleSheet* aSheet, PRInt32* aIndex) { - return mStyleSheets.IndexOf(aSheet); + *aIndex = mStyleSheets.IndexOf(aSheet); + return NS_OK; } void @@ -2375,7 +2376,8 @@ nsXULDocument::GetElementsByTagName(const nsAReadableString& aTagName, return rv; } - nsIContent* root = GetRootContent(); + nsIContent* root = nsnull; + GetRootContent(&root); NS_ASSERTION(root != nsnull, "no doc root"); if (root != nsnull) { @@ -2401,7 +2403,8 @@ nsXULDocument::GetElementsByAttribute(const nsAReadableString& aAttribute, return rv; } - nsIContent* root = GetRootContent(); + nsIContent* root = nsnull; + GetRootContent(&root); NS_ASSERTION(root != nsnull, "no doc root"); if (root != nsnull) { @@ -2680,7 +2683,7 @@ nsXULDocument::GetWidth(PRInt32* aWidth) // We make the assumption that the first presentation shell // is the one for which we need information. - shell = getter_AddRefs(GetShellAt(0)); + GetShellAt(0, getter_AddRefs(shell)); if (shell) { PRInt32 width, height; @@ -2702,7 +2705,7 @@ nsXULDocument::GetHeight(PRInt32* aHeight) // We make the assumption that the first presentation shell // is the one for which we need information. - shell = getter_AddRefs(GetShellAt(0)); + GetShellAt(0, getter_AddRefs(shell)); if (shell) { PRInt32 width, height; @@ -3112,7 +3115,8 @@ nsXULDocument::GetElementsByTagNameNS(const nsAReadableString& aNamespaceURI, *aReturn = elements; - nsCOMPtr root = dont_AddRef(GetRootContent()); + nsCOMPtr root; + GetRootContent(getter_AddRefs(root)); NS_ASSERTION(root, "no doc root"); if (root) { @@ -3846,7 +3850,8 @@ nsXULDocument::StartLayout(void) PRInt32 count = GetNumberOfShells(); for (PRInt32 i = 0; i < count; i++) { - nsCOMPtr shell = getter_AddRefs(GetShellAt(i)); + nsCOMPtr shell; + GetShellAt(i, getter_AddRefs(shell)); if (nsnull == shell) continue; @@ -4115,7 +4120,8 @@ nsXULDocument::DispatchEvent(nsIDOMEvent* aEvent) if (count == 0) return NS_OK; - nsCOMPtr shell = getter_AddRefs(GetShellAt(0)); + nsCOMPtr shell; + GetShellAt(0, getter_AddRefs(shell)); // Retrieve the context nsCOMPtr presContext; @@ -4138,7 +4144,8 @@ nsXULDocument::CreateEvent(const nsAReadableString& aEventType, if (count == 0) return NS_OK; - nsCOMPtr shell = getter_AddRefs(GetShellAt(0)); + nsCOMPtr shell; + GetShellAt(0, getter_AddRefs(shell)); // Retrieve the context nsCOMPtr presContext; @@ -6009,7 +6016,8 @@ nsXULDocument::GetBoxObjectFor(nsIDOMElement* aElement, nsIBoxObject** aResult) } } - nsCOMPtr shell(getter_AddRefs(GetShellAt(0))); + nsCOMPtr shell; + GetShellAt(0, getter_AddRefs(shell)); if (!shell) return NS_ERROR_FAILURE; diff --git a/mozilla/content/xul/document/src/nsXULDocument.h b/mozilla/content/xul/document/src/nsXULDocument.h index 6447ca05ec5..c8dd1195fde 100644 --- a/mozilla/content/xul/document/src/nsXULDocument.h +++ b/mozilla/content/xul/document/src/nsXULDocument.h @@ -116,7 +116,7 @@ public: NS_DECL_NSISTREAMLOADEROBSERVER // nsIDocument interface - virtual nsIArena* GetArena(); + NS_IMETHOD GetArena(nsIArena** aArena); NS_IMETHOD Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup); @@ -133,7 +133,7 @@ public: virtual const nsString* GetDocumentTitle() const; - virtual nsIURI* GetDocumentURL() const; + NS_IMETHOD GetDocumentURL(nsIURI** aURI) const; NS_IMETHOD GetPrincipal(nsIPrincipal **aPrincipal); @@ -186,31 +186,29 @@ public: virtual PRInt32 GetNumberOfShells(); - virtual nsIPresShell* GetShellAt(PRInt32 aIndex); + NS_IMETHOD GetShellAt(PRInt32 aIndex, nsIPresShell** aShell); - virtual nsIDocument* GetParentDocument(); + NS_IMETHOD GetParentDocument(nsIDocument** aParent); - virtual void SetParentDocument(nsIDocument* aParent); + NS_IMETHOD SetParentDocument(nsIDocument* aParent); - virtual void AddSubDocument(nsIDocument* aSubDoc); + NS_IMETHOD AddSubDocument(nsIDocument* aSubDoc); - virtual PRInt32 GetNumberOfSubDocuments(); + NS_IMETHOD GetNumberOfSubDocuments(PRInt32* aCount); - virtual nsIDocument* GetSubDocumentAt(PRInt32 aIndex); + NS_IMETHOD GetSubDocumentAt(PRInt32 aIndex, nsIDocument** aSubDoc); - virtual nsIContent* GetRootContent(); + NS_IMETHOD GetRootContent(nsIContent** aRoot); - virtual void SetRootContent(nsIContent* aRoot); + NS_IMETHOD SetRootContent(nsIContent* aRoot); NS_IMETHOD ChildAt(PRInt32 aIndex, nsIContent*& aResult) const; NS_IMETHOD IndexOf(nsIContent* aPossibleChild, PRInt32& aIndex) const; NS_IMETHOD GetChildCount(PRInt32& aCount); - virtual PRInt32 GetNumberOfStyleSheets(); - - virtual nsIStyleSheet* GetStyleSheetAt(PRInt32 aIndex); - - virtual PRInt32 GetIndexOfStyleSheet(nsIStyleSheet* aSheet); + NS_IMETHOD GetNumberOfStyleSheets(PRInt32* aCount); + NS_IMETHOD GetStyleSheetAt(PRInt32 aIndex, nsIStyleSheet** aSheet); + NS_IMETHOD GetIndexOfStyleSheet(nsIStyleSheet* aSheet, PRInt32* aIndex); virtual void AddStyleSheet(nsIStyleSheet* aSheet); virtual void RemoveStyleSheet(nsIStyleSheet* aSheet); diff --git a/mozilla/content/xul/document/src/nsXULPrototypeCache.cpp b/mozilla/content/xul/document/src/nsXULPrototypeCache.cpp index 83a8a7b081c..c7703c22a86 100644 --- a/mozilla/content/xul/document/src/nsXULPrototypeCache.cpp +++ b/mozilla/content/xul/document/src/nsXULPrototypeCache.cpp @@ -250,7 +250,8 @@ nsXULPrototypeCache::PutXBLDocumentInfo(nsIXBLDocumentInfo* aDocumentInfo) nsCOMPtr doc; aDocumentInfo->GetDocument(getter_AddRefs(doc)); - nsCOMPtr uri(getter_AddRefs(doc->GetDocumentURL())); + nsCOMPtr uri; + doc->GetDocumentURL(getter_AddRefs(uri)); nsXPIDLCString str; uri->GetSpec(getter_Copies(str)); diff --git a/mozilla/content/xul/templates/src/nsXULContentUtils.cpp b/mozilla/content/xul/templates/src/nsXULContentUtils.cpp index 882fd83cf40..a22663527be 100644 --- a/mozilla/content/xul/templates/src/nsXULContentUtils.cpp +++ b/mozilla/content/xul/templates/src/nsXULContentUtils.cpp @@ -289,7 +289,8 @@ nsXULContentUtils::GetElementRefResource(nsIContent* aElement, nsIRDFResource** rv = aElement->GetDocument(*getter_AddRefs(doc)); if (NS_FAILED(rv)) return rv; - nsCOMPtr url = dont_AddRef( doc->GetDocumentURL() ); + nsCOMPtr url; + doc->GetDocumentURL(getter_AddRefs(url)); NS_ASSERTION(url != nsnull, "element has no document"); if (! url) return NS_ERROR_UNEXPECTED; diff --git a/mozilla/content/xul/templates/src/nsXULTemplateBuilder.cpp b/mozilla/content/xul/templates/src/nsXULTemplateBuilder.cpp index 0f914ecebc4..957a68179c4 100644 --- a/mozilla/content/xul/templates/src/nsXULTemplateBuilder.cpp +++ b/mozilla/content/xul/templates/src/nsXULTemplateBuilder.cpp @@ -798,7 +798,8 @@ nsXULTemplateBuilder::LoadDataSources() // // rdf:bookmarks rdf:history http://foo.bar.com/blah.cgi?baz=9 // - nsCOMPtr docurl = dont_AddRef(doc->GetDocumentURL()); + nsCOMPtr docurl; + doc->GetDocumentURL(getter_AddRefs(docurl)); nsAutoString datasources; mRoot->GetAttribute(kNameSpaceID_None, nsXULAtoms::datasources, datasources); diff --git a/mozilla/docshell/base/nsDocShell.cpp b/mozilla/docshell/base/nsDocShell.cpp index 5329a3d2deb..facd7d40afe 100644 --- a/mozilla/docshell/base/nsDocShell.cpp +++ b/mozilla/docshell/base/nsDocShell.cpp @@ -1566,7 +1566,8 @@ PrintDocTree(nsIDocShellTreeNode * aParentNode, int aLevel) } nsCOMPtr esm; presContext->GetEventStateManager(getter_AddRefs(esm)); - nsCOMPtrrootContent(getter_AddRefs(doc->GetRootContent())); + nsCOMPtr rootContent; + doc->GetRootContent(getter_AddRefs(rootContent)); printf("DS %p Ty %s Doc %p DW %p EM %p CN %p\n", parentAsDocShell.get(), @@ -2685,7 +2686,8 @@ nsDocShell::SetFocus() GetPresContext(getter_AddRefs(presContext)); if (presContext) { presContext->GetEventStateManager(getter_AddRefs(esm)); - nsCOMPtr rootContent(getter_AddRefs(document->GetRootContent())); + nsCOMPtr rootContent; + document->GetRootContent(getter_AddRefs(rootContent)); if (esm && rootContent) { // Either focus the document or the "first" piece of content if (doFocusDoc) { @@ -2784,7 +2786,8 @@ nsDocShell::FocusNextChild(nsIBaseWindow * aCurrentFocus, PRBool aForward) nsIEventStateManager::eDocType docType; if (NS_FAILED(esm->FigureOutKindOfDoc(document, &docType))) return PR_FALSE; - nsCOMPtr rootContent = getter_AddRefs(document->GetRootContent()); + nsCOMPtr rootContent; + document->GetRootContent(getter_AddRefs(rootContent)); if (!rootContent) return PR_FALSE; PRBool hasTabIndexes; @@ -5871,7 +5874,8 @@ nsDocShell::SetCanvasHasFocus(PRBool aCanvasHasFocus) presShell->GetDocument(getter_AddRefs(doc)); if (!doc) return NS_ERROR_FAILURE; - nsCOMPtr rootContent = getter_AddRefs(doc->GetRootContent()); + nsCOMPtr rootContent; + doc->GetRootContent(getter_AddRefs(rootContent)); if (!rootContent) return NS_ERROR_FAILURE; nsIFrame* frame; diff --git a/mozilla/dom/public/nsIScriptContext.h b/mozilla/dom/public/nsIScriptContext.h index 88c26d30165..ec7a6661d76 100644 --- a/mozilla/dom/public/nsIScriptContext.h +++ b/mozilla/dom/public/nsIScriptContext.h @@ -217,7 +217,7 @@ public: * Return the global object. * **/ - NS_IMETHOD_(nsIScriptGlobalObject*) GetGlobalObject() = 0; + NS_IMETHOD GetGlobalObject(nsIScriptGlobalObject** aGlobalObject) = 0; /** * Return the native script context diff --git a/mozilla/dom/src/base/nsDOMClassInfo.cpp b/mozilla/dom/src/base/nsDOMClassInfo.cpp index b1bec1a9eb0..1ac0b07f049 100644 --- a/mozilla/dom/src/base/nsDOMClassInfo.cpp +++ b/mozilla/dom/src/base/nsDOMClassInfo.cpp @@ -2010,7 +2010,8 @@ nsElementSH::PostCreate(nsIXPConnectWrappedNative *wrapper, JSContext *cx, } // See if we have a frame. - nsCOMPtr shell = getter_AddRefs(doc->GetShellAt(0)); + nsCOMPtr shell; + doc->GetShellAt(0, getter_AddRefs(shell)); if (!shell) { return NS_OK; @@ -2643,7 +2644,8 @@ nsHTMLExternalObjSH::GetPluginInstance(nsIXPConnectWrappedNative *wrapper, doc->FlushPendingNotifications(); // See if we have a frame. - nsCOMPtr shell(getter_AddRefs(doc->GetShellAt(0))); + nsCOMPtr shell; + doc->GetShellAt(0, getter_AddRefs(shell)); if (!shell) { return NS_OK; diff --git a/mozilla/dom/src/base/nsFocusController.cpp b/mozilla/dom/src/base/nsFocusController.cpp index 02890b03b9e..5bc2cb37c2d 100644 --- a/mozilla/dom/src/base/nsFocusController.cpp +++ b/mozilla/dom/src/base/nsFocusController.cpp @@ -202,7 +202,8 @@ nsFocusController::MoveFocus(PRBool aForward, nsIDOMElement* aElt) if (count == 0) return NS_OK; - nsCOMPtr shell(getter_AddRefs(doc->GetShellAt(0))); + nsCOMPtr shell; + doc->GetShellAt(0, getter_AddRefs(shell)); if (!shell) return NS_OK; diff --git a/mozilla/dom/src/base/nsGlobalWindow.cpp b/mozilla/dom/src/base/nsGlobalWindow.cpp index f36dd1b56a1..fdce2a5ade2 100644 --- a/mozilla/dom/src/base/nsGlobalWindow.cpp +++ b/mozilla/dom/src/base/nsGlobalWindow.cpp @@ -356,7 +356,7 @@ NS_IMETHODIMP GlobalWindowImpl::SetNewDocument(nsIDOMDocument* aDocument) nsCOMPtr docURL; if (doc) { - docURL = dont_AddRef(doc->GetDocumentURL()); + doc->GetDocumentURL(getter_AddRefs(docURL)); doc = nsnull; // Forces release now } @@ -2580,7 +2580,8 @@ NS_IMETHODIMP GlobalWindowImpl::DispatchEvent(nsIDOMEvent* aEvent) if (count == 0) return NS_OK; - nsCOMPtr shell = getter_AddRefs(idoc->GetShellAt(0)); + nsCOMPtr shell; + idoc->GetShellAt(0, getter_AddRefs(shell)); // Retrieve the context nsCOMPtr aPresContext; @@ -3749,14 +3750,15 @@ GlobalWindowImpl::SecurityCheckURL(const char *aURL) nsCOMPtr scriptcx = (nsIScriptContext *) JS_GetContextPrivate(cx); if (scriptcx) { - nsCOMPtr gobj(dont_AddRef(scriptcx->GetGlobalObject())); + nsCOMPtr gobj; + scriptcx->GetGlobalObject(getter_AddRefs(gobj)); nsCOMPtr caller(do_QueryInterface(gobj)); if (caller) { nsCOMPtr callerDOMdoc; caller->GetDocument(getter_AddRefs(callerDOMdoc)); nsCOMPtr callerDoc(do_QueryInterface(callerDOMdoc)); if (callerDoc) - baseURI = dont_AddRef(callerDoc->GetDocumentURL()); + callerDoc->GetDocumentURL(getter_AddRefs(baseURI)); } } diff --git a/mozilla/dom/src/base/nsJSEnvironment.cpp b/mozilla/dom/src/base/nsJSEnvironment.cpp index 30dca76f3a2..66bc72b0f0b 100644 --- a/mozilla/dom/src/base/nsJSEnvironment.cpp +++ b/mozilla/dom/src/base/nsJSEnvironment.cpp @@ -86,7 +86,8 @@ NS_ScriptErrorReporter(JSContext *cx, // XXX this means we are not going to get error reports on non DOM contexts nsJSUtils::GetDynamicScriptContext(cx, getter_AddRefs(context)); if (context) { - nsCOMPtr globalObject( dont_AddRef( context->GetGlobalObject() ) ); + nsCOMPtr globalObject; + context->GetGlobalObject(getter_AddRefs(globalObject)); if (globalObject) { nsCOMPtr owner; @@ -242,7 +243,8 @@ nsJSContext::DOMBranchCallback(JSContext *cx, JSScript *script) // If we get here we're most likely executing an infinite loop in JS, // we'll tell the user about this and we'll give the user the option // of stopping the execution of the script. - nsCOMPtr global(dont_AddRef(ctx->GetGlobalObject())); + nsCOMPtr global; + ctx->GetGlobalObject(getter_AddRefs(global)); NS_ENSURE_TRUE(global, JS_TRUE); nsCOMPtr docShell; @@ -424,7 +426,8 @@ nsJSContext::EvaluateStringWithValue(const nsAReadableString& aScript, aPrincipal->GetJSPrincipals(&jsprin); } else { - nsCOMPtr global = dont_AddRef(GetGlobalObject()); + nsCOMPtr global; + GetGlobalObject(getter_AddRefs(global)); if (!global) return NS_ERROR_FAILURE; nsCOMPtr objPrincipal = do_QueryInterface(global, &rv); @@ -540,7 +543,8 @@ nsJSContext::EvaluateString(const nsAReadableString& aScript, aPrincipal->GetJSPrincipals(&jsprin); } else { - nsCOMPtr global = dont_AddRef(GetGlobalObject()); + nsCOMPtr global; + GetGlobalObject(getter_AddRefs(global)); if (!global) return NS_ERROR_FAILURE; nsCOMPtr objPrincipal = do_QueryInterface(global, &rv); @@ -810,7 +814,8 @@ nsJSContext::CompileEventHandler(void *aTarget, nsIAtom *aName, { JSPrincipals *jsprin = nsnull; - nsCOMPtr global = dont_AddRef(GetGlobalObject()); + nsCOMPtr global; + GetGlobalObject(getter_AddRefs(global)); if (global) { // XXXbe why the two-step QI? speed up via a new GetGlobalObjectData func? nsCOMPtr globalData = do_QueryInterface(global); @@ -863,7 +868,8 @@ nsJSContext::CompileFunction(void* aTarget, { JSPrincipals *jsprin = nsnull; - nsCOMPtr global = getter_AddRefs(GetGlobalObject()); + nsCOMPtr global; + GetGlobalObject(getter_AddRefs(global)); if (global) { // XXXbe why the two-step QI? speed up via a new GetGlobalObjectData func? nsCOMPtr globalData = do_QueryInterface(global); @@ -977,20 +983,23 @@ nsJSContext::SetDefaultLanguageVersion(const char* aVersion) return NS_OK; } -NS_IMETHODIMP_(nsIScriptGlobalObject*) -nsJSContext::GetGlobalObject() +NS_IMETHODIMP +nsJSContext::GetGlobalObject(nsIScriptGlobalObject** aGlobalObject) { JSObject *global = ::JS_GetGlobalObject(mContext); + *aGlobalObject = nsnull; if (!global) { - return nsnull; + NS_WARNING("Context has no global."); + return NS_OK; } JSClass *c = JS_GET_CLASS(mContext, global); if (!c || ((~c->flags) & (JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS))) { - return nsnull; + NS_WARNING("Global is not an nsISupports."); + return NS_OK; } nsCOMPtr native = @@ -1006,17 +1015,16 @@ nsJSContext::GetGlobalObject() wrapped_native->GetNative(getter_AddRefs(native)); } - nsIScriptGlobalObject *script_global = nsnull; - - if (native) { - // We have private data (either directly from ::JS_GetPrivate() or - // through wrapped_native->GetNative()), check if it's a - // nsIScriptGlobalObject - - CallQueryInterface(native, &script_global); + if (!native) { + NS_WARNING("XPConnect wrapped native doesn't wrap anything."); + return NS_OK; } - return script_global; + // We have private data (either directly from ::JS_GetPrivate() or + // through wrapped_native->GetNative()), check if it's a + // nsIScriptGlobalObject + + return CallQueryInterface(native, aGlobalObject); } NS_IMETHODIMP_(void*) diff --git a/mozilla/dom/src/base/nsJSEnvironment.h b/mozilla/dom/src/base/nsJSEnvironment.h index a6fbfc04ab6..e5a3bb18107 100644 --- a/mozilla/dom/src/base/nsJSEnvironment.h +++ b/mozilla/dom/src/base/nsJSEnvironment.h @@ -89,7 +89,7 @@ public: void** aFunctionObject); NS_IMETHOD SetDefaultLanguageVersion(const char* aVersion); - NS_IMETHOD_(nsIScriptGlobalObject*) GetGlobalObject(); + NS_IMETHOD GetGlobalObject(nsIScriptGlobalObject** aGlobalObject); NS_IMETHOD_(void *) GetNativeContext(); NS_IMETHOD InitContext(nsIScriptGlobalObject *aGlobalObject); NS_IMETHOD IsContextInitialized(); diff --git a/mozilla/dom/src/base/nsJSUtils.cpp b/mozilla/dom/src/base/nsJSUtils.cpp index a1ceacc12de..6450a664147 100644 --- a/mozilla/dom/src/base/nsJSUtils.cpp +++ b/mozilla/dom/src/base/nsJSUtils.cpp @@ -285,13 +285,11 @@ nsresult nsJSUtils::GetDynamicScriptGlobal(JSContext* aContext, nsIScriptGlobalObject** aNativeGlobal) { - nsIScriptGlobalObject* nativeGlobal = nsnull; nsCOMPtr scriptCX; GetDynamicScriptContext(aContext, getter_AddRefs(scriptCX)); - if (scriptCX) { - *aNativeGlobal = nativeGlobal = scriptCX->GetGlobalObject(); - } - return nativeGlobal ? NS_OK : NS_ERROR_FAILURE; + if (!scriptCX) + return NS_ERROR_FAILURE; + return scriptCX->GetGlobalObject(aNativeGlobal); } nsresult diff --git a/mozilla/dom/src/base/nsLocation.cpp b/mozilla/dom/src/base/nsLocation.cpp index 5900708b098..8fd6b586d51 100644 --- a/mozilla/dom/src/base/nsLocation.cpp +++ b/mozilla/dom/src/base/nsLocation.cpp @@ -830,7 +830,7 @@ LocationImpl::GetSourceURL(JSContext* cx, nsIURI** sourceURI) result = doc->GetBaseURL(*sourceURI); if (!*sourceURI) { - *sourceURI = doc->GetDocumentURL(); + doc->GetDocumentURL(sourceURI); } } } diff --git a/mozilla/dom/src/base/nsWindowRoot.cpp b/mozilla/dom/src/base/nsWindowRoot.cpp index 66bf558fc08..f6bd276d0af 100644 --- a/mozilla/dom/src/base/nsWindowRoot.cpp +++ b/mozilla/dom/src/base/nsWindowRoot.cpp @@ -97,7 +97,8 @@ nsWindowRoot::DispatchEvent(nsIDOMEvent* aEvt) if (count == 0) return NS_OK; - nsCOMPtr shell = getter_AddRefs(doc->GetShellAt(0)); + nsCOMPtr shell; + doc->GetShellAt(0, getter_AddRefs(shell)); // Retrieve the context nsCOMPtr aPresContext; diff --git a/mozilla/editor/base/nsHTMLEditor.cpp b/mozilla/editor/base/nsHTMLEditor.cpp index 419f8e4637f..bbe18ce0cfd 100644 --- a/mozilla/editor/base/nsHTMLEditor.cpp +++ b/mozilla/editor/base/nsHTMLEditor.cpp @@ -3239,7 +3239,7 @@ nsHTMLEditor::GetEmbeddedObjects(nsISupportsArray** aNodeList) if (!doc) return NS_ERROR_UNEXPECTED; - rootContent = doc->GetRootContent(); + doc->GetRootContent(getter_AddRefs(rootContent)); iter->Init(rootContent); @@ -3932,7 +3932,8 @@ nsCOMPtr nsHTMLEditor::FindPreElement() if (!doc) return 0; - nsIContent* rootContent = doc->GetRootContent(); + nsCOMPtr rootContent; + doc->GetRootContent(getter_AddRefs(rootContent)); if (!rootContent) return 0; diff --git a/mozilla/editor/libeditor/html/nsHTMLEditor.cpp b/mozilla/editor/libeditor/html/nsHTMLEditor.cpp index 419f8e4637f..bbe18ce0cfd 100644 --- a/mozilla/editor/libeditor/html/nsHTMLEditor.cpp +++ b/mozilla/editor/libeditor/html/nsHTMLEditor.cpp @@ -3239,7 +3239,7 @@ nsHTMLEditor::GetEmbeddedObjects(nsISupportsArray** aNodeList) if (!doc) return NS_ERROR_UNEXPECTED; - rootContent = doc->GetRootContent(); + doc->GetRootContent(getter_AddRefs(rootContent)); iter->Init(rootContent); @@ -3932,7 +3932,8 @@ nsCOMPtr nsHTMLEditor::FindPreElement() if (!doc) return 0; - nsIContent* rootContent = doc->GetRootContent(); + nsCOMPtr rootContent; + doc->GetRootContent(getter_AddRefs(rootContent)); if (!rootContent) return 0; diff --git a/mozilla/embedding/browser/webBrowser/nsWebBrowserPersist.cpp b/mozilla/embedding/browser/webBrowser/nsWebBrowserPersist.cpp index 09566fe6673..c9eb26d72d7 100644 --- a/mozilla/embedding/browser/webBrowser/nsWebBrowserPersist.cpp +++ b/mozilla/embedding/browser/webBrowser/nsWebBrowserPersist.cpp @@ -223,7 +223,7 @@ NS_IMETHODIMP nsWebBrowserPersist::SaveDocument(nsIDOMDocument *aDocument, const // Persist the main document nsCOMPtr doc(do_QueryInterface(aDocument)); - mURI = do_QueryInterface(doc->GetDocumentURL()); + doc->GetDocumentURL(getter_AddRefs(mURI)); // Store the base URI doc->GetBaseURL(*getter_AddRefs(mBaseURI)); diff --git a/mozilla/embedding/components/windowwatcher/src/nsWindowWatcher.cpp b/mozilla/embedding/components/windowwatcher/src/nsWindowWatcher.cpp index 1a6d6cf6a43..55a54e59494 100644 --- a/mozilla/embedding/components/windowwatcher/src/nsWindowWatcher.cpp +++ b/mozilla/embedding/components/windowwatcher/src/nsWindowWatcher.cpp @@ -668,7 +668,8 @@ nsWindowWatcher::OpenWindowJS(nsIDOMWindow *aParent, nsCOMPtr doc(do_QueryInterface(document)); if (doc) { - nsCOMPtr uri(dont_AddRef(doc->GetDocumentURL())); + nsCOMPtr uri; + doc->GetDocumentURL(getter_AddRefs(uri)); // Set the referrer loadInfo->SetReferrer(uri); @@ -970,7 +971,8 @@ nsWindowWatcher::URIfromURL(const char *aURL, nsISupports *cxsup = (nsISupports *) JS_GetContextPrivate(cx); nsCOMPtr scriptcx(do_QueryInterface(cxsup)); if (scriptcx) { - nsCOMPtr gobj(dont_AddRef(scriptcx->GetGlobalObject())); + nsCOMPtr gobj; + scriptcx->GetGlobalObject(getter_AddRefs(gobj)); baseWindow = do_QueryInterface(gobj); } } @@ -991,7 +993,7 @@ nsWindowWatcher::URIfromURL(const char *aURL, nsCOMPtr doc; doc = do_QueryInterface(domDoc); if (doc) - baseURI = dont_AddRef(doc->GetDocumentURL()); + doc->GetDocumentURL(getter_AddRefs(baseURI)); } } diff --git a/mozilla/extensions/access-builtin/accessproxy/nsAccessProxy.cpp b/mozilla/extensions/access-builtin/accessproxy/nsAccessProxy.cpp index ad6fa9bfc3c..1a1cc44b4ae 100644 --- a/mozilla/extensions/access-builtin/accessproxy/nsAccessProxy.cpp +++ b/mozilla/extensions/access-builtin/accessproxy/nsAccessProxy.cpp @@ -128,7 +128,7 @@ nsresult nsAccessProxy::HandleEvent(nsIDOMEvent* aEvent) if (domDoc) { doc = do_QueryInterface(domDoc); if (doc && doc->GetNumberOfShells()>0) - presShell= dont_AddRef(doc->GetShellAt(0)); + doc->GetShellAt(0, getter_AddRefs(presShell)); } //return NS_OK; /* diff --git a/mozilla/extensions/inspector/base/src/inCSSValueSearch.cpp b/mozilla/extensions/inspector/base/src/inCSSValueSearch.cpp index 927db04187f..8c5eaf4f9f4 100644 --- a/mozilla/extensions/inspector/base/src/inCSSValueSearch.cpp +++ b/mozilla/extensions/inspector/base/src/inCSSValueSearch.cpp @@ -88,9 +88,11 @@ inCSSValueSearch::SearchSync() nsCOMPtr doc = do_QueryInterface(mDocument); if (doc) { - PRInt32 count = doc->GetNumberOfStyleSheets(); + PRInt32 count = 0; + doc->GetNumberOfStyleSheets(&count); for (PRInt32 i = 0; i < count; i++) { - nsIStyleSheet* sheet = doc->GetStyleSheetAt(i); + nsCOMPtr sheet; + doc->GetStyleSheetAt(i, getter_AddRefs(sheet)); SearchStyleSheet(sheet); } } diff --git a/mozilla/extensions/inspector/base/src/inSearchOrphanImages.cpp b/mozilla/extensions/inspector/base/src/inSearchOrphanImages.cpp index 2b24096925a..510219fef62 100644 --- a/mozilla/extensions/inspector/base/src/inSearchOrphanImages.cpp +++ b/mozilla/extensions/inspector/base/src/inSearchOrphanImages.cpp @@ -361,9 +361,11 @@ inSearchOrphanImages::BuildRemoteURLHash() nsCOMPtr doc = do_QueryInterface(mDocument); if (doc) { - PRInt32 count = doc->GetNumberOfStyleSheets(); + PRInt32 count = 0; + doc->GetNumberOfStyleSheets(&count); for (PRInt32 i = 0; i < count; i++) { - nsIStyleSheet* sheet = doc->GetStyleSheetAt(i); + nsCOMPtr sheet; + doc->GetStyleSheetAt(i, getter_AddRefs(sheet)); HashStyleSheet(sheet); } } diff --git a/mozilla/extensions/inspector/base/src/nsCSSRuleDataSource.cpp b/mozilla/extensions/inspector/base/src/nsCSSRuleDataSource.cpp index 04e029665b4..e9989f850b7 100644 --- a/mozilla/extensions/inspector/base/src/nsCSSRuleDataSource.cpp +++ b/mozilla/extensions/inspector/base/src/nsCSSRuleDataSource.cpp @@ -338,7 +338,7 @@ nsCSSRuleDataSource::GetTargetsForElement(nsIDOMElement* aElement, nsIRDFResourc nsCOMPtr styleContext; for (PRInt32 i = 0; i < num; i++) { // get the style context - shell = doc->GetShellAt(i); + doc->GetShellAt(i, getter_AddRefs(shell)); rv = shell->GetPrimaryFrameFor(content, &frame); if (NS_FAILED(rv) || !frame) return rv; shell->GetStyleContextFor(frame, getter_AddRefs(styleContext)); diff --git a/mozilla/extensions/p3p/src/nsP3PObserverHTML.cpp b/mozilla/extensions/p3p/src/nsP3PObserverHTML.cpp index 45f0931bf6f..938c7636015 100644 --- a/mozilla/extensions/p3p/src/nsP3PObserverHTML.cpp +++ b/mozilla/extensions/p3p/src/nsP3PObserverHTML.cpp @@ -237,7 +237,7 @@ nsP3PObserverHTML::Notify( PRUint32 aDocumentID, &rv ); if (NS_SUCCEEDED( rv )) { - pURI = pDocument->GetDocumentURL( ); + pDocument->GetDocumentURL( getter_AddRefs(pURI) ); if (pURI) { rv = nsP3PObserverUtils::ExamineLINKTag( pURI, @@ -303,7 +303,7 @@ nsP3PObserverHTML::Notify( PRUint32 aDocumentID, &rv ); if (NS_SUCCEEDED( rv )) { - pURI = pDocument->GetDocumentURL( ); + pDocument->GetDocumentURL( getter_AddRefs(pURI) ); if (pURI) { rv = nsP3PObserverUtils::ExamineLINKTag( pURI, diff --git a/mozilla/extensions/p3p/src/nsP3PObserverXML.cpp b/mozilla/extensions/p3p/src/nsP3PObserverXML.cpp index 207971cb3a8..412791c32d9 100644 --- a/mozilla/extensions/p3p/src/nsP3PObserverXML.cpp +++ b/mozilla/extensions/p3p/src/nsP3PObserverXML.cpp @@ -246,7 +246,7 @@ nsP3PObserverXML::Notify( PRUint32 aDocumentID, &rv ); if (NS_SUCCEEDED( rv )) { - pURI = pDocument->GetDocumentURL( ); + pDocument->GetDocumentURL( getter_AddRefs(pURI) ); if (pURI) { rv = nsP3PObserverUtils::ExamineLINKTag( pURI, @@ -311,7 +311,7 @@ nsP3PObserverXML::Notify( PRUint32 aDocumentID, &rv ); if (NS_SUCCEEDED( rv )) { - pURI = pDocument->GetDocumentURL( ); + pDocument->GetDocumentURL( getter_AddRefs(pURI) ); if (pURI) { rv = nsP3PObserverUtils::ExamineLINKTag( pURI, diff --git a/mozilla/extensions/transformiix/source/xml/parser/nsSyncLoader.cpp b/mozilla/extensions/transformiix/source/xml/parser/nsSyncLoader.cpp index 3f5bf58f63e..c9408065a2f 100644 --- a/mozilla/extensions/transformiix/source/xml/parser/nsSyncLoader.cpp +++ b/mozilla/extensions/transformiix/source/xml/parser/nsSyncLoader.cpp @@ -267,7 +267,7 @@ nsSyncLoader::LoadDocument(nsIURI* documentURI, nsIDOMDocument **_retval) // XXX Need to find a better way to do this rather than // chaining through a bunch of getters and QIs nsCOMPtr global; - global = dont_AddRef(scriptCX->GetGlobalObject()); + scriptCX->GetGlobalObject(getter_AddRefs(global)); if (!global) return NS_ERROR_FAILURE; nsCOMPtr docshell; diff --git a/mozilla/extensions/transformiix/source/xslt/XSLTProcessor.cpp b/mozilla/extensions/transformiix/source/xslt/XSLTProcessor.cpp index ab526c39dbe..47909a3ec88 100644 --- a/mozilla/extensions/transformiix/source/xslt/XSLTProcessor.cpp +++ b/mozilla/extensions/transformiix/source/xslt/XSLTProcessor.cpp @@ -72,7 +72,7 @@ /** * XSLTProcessor is a class for Processing XSL stylesheets * @author Keith Visco - * @version $Revision: 1.52 $ $Date: 2001-06-15 11:12:17 $ + * @version $Revision: 1.53 $ $Date: 2001-06-20 03:27:25 $ **/ /** @@ -1794,8 +1794,9 @@ XSLTProcessor::TransformDocument(nsIDOMNode* aSourceDOM, // Create a temporary channel to get nsIDocument->Reset to // do the right thing. We want the output document to get // much of the input document's characteristics. - serv->NewChannelFromURI(inputDocument->GetDocumentURL(), - getter_AddRefs(channel)); + nsCOMPtr docURL; + inputDocument->GetDocumentURL(getter_AddRefs(docURL)); + serv->NewChannelFromURI(docURL, getter_AddRefs(channel)); } } diff --git a/mozilla/extensions/wallet/cookieviewer/nsCookieViewer.cpp b/mozilla/extensions/wallet/cookieviewer/nsCookieViewer.cpp index 062a40dea9d..bce6ec14690 100644 --- a/mozilla/extensions/wallet/cookieviewer/nsCookieViewer.cpp +++ b/mozilla/extensions/wallet/cookieviewer/nsCookieViewer.cpp @@ -160,7 +160,7 @@ CookieViewerImpl::AddPermission(nsIDOMWindowInternal* aWin, PRBool permission, P } nsCOMPtr docURL; - docURL = doc->GetDocumentURL(); + doc->GetDocumentURL(getter_AddRefs(docURL)); if (!docURL) { return NS_ERROR_FAILURE; } diff --git a/mozilla/extensions/wallet/src/nsWalletService.cpp b/mozilla/extensions/wallet/src/nsWalletService.cpp index 9c5ac8d48ed..322ba41cf78 100644 --- a/mozilla/extensions/wallet/src/nsWalletService.cpp +++ b/mozilla/extensions/wallet/src/nsWalletService.cpp @@ -272,7 +272,8 @@ nsWalletlibService::OnStateChange(nsIWebProgress* aWebProgress, return NS_OK; } - nsCOMPtr uri(getter_AddRefs(doc->GetDocumentURL())); + nsCOMPtr uri; + doc->GetDocumentURL(getter_AddRefs(uri)); if (!uri) { NS_ASSERTION(0, "no URI available"); return NS_OK; diff --git a/mozilla/extensions/wallet/src/wallet.cpp b/mozilla/extensions/wallet/src/wallet.cpp index 93340e463aa..2d22efc6870 100644 --- a/mozilla/extensions/wallet/src/wallet.cpp +++ b/mozilla/extensions/wallet/src/wallet.cpp @@ -2598,10 +2598,9 @@ static void wallet_InitializeCurrentURL(nsIDocument * doc) { /* get url */ - nsIURI* url; - url = doc->GetDocumentURL(); + nsCOMPtr url; + doc->GetDocumentURL(getter_AddRefs(url)); if (wallet_lastUrl == url) { - NS_RELEASE(url); return; } else { if (wallet_lastUrl) { @@ -2610,7 +2609,6 @@ wallet_InitializeCurrentURL(nsIDocument * doc) { wallet_lastUrl = url; } - NS_RELEASE(url); } #define SEPARATOR "#*%$" @@ -3292,7 +3290,8 @@ wallet_TraversalForPrefill if (NS_SUCCEEDED(result)) { nsCOMPtr doc = do_QueryInterface(domdoc); if (doc) { - nsCOMPtr url = getter_AddRefs(doc->GetDocumentURL()); + nsCOMPtr url; + doc->GetDocumentURL(getter_AddRefs(url)); if (url) { wallet_GetHostFile(url, urlName); } @@ -3791,13 +3790,13 @@ WLLT_OnSubmit(nsIContent* currentForm, nsIDOMWindowInternal* window) { char *URLName = nsnull; char *strippedURLName = nsnull; nsAutoString strippedURLNameAutoString; - nsCOMPtr docURL; nsCOMPtr doc; currentForm->GetDocument(*getter_AddRefs(doc)); if (!doc) { return; } - docURL = dont_AddRef(doc->GetDocumentURL()); + nsCOMPtr docURL; + doc->GetDocumentURL(getter_AddRefs(docURL)); if (!docURL || wallet_IsFromCartman(docURL)) { return; } diff --git a/mozilla/extensions/xmlextras/base/src/nsXMLHttpRequest.cpp b/mozilla/extensions/xmlextras/base/src/nsXMLHttpRequest.cpp index d6cbcf716d5..eace6201d13 100644 --- a/mozilla/extensions/xmlextras/base/src/nsXMLHttpRequest.cpp +++ b/mozilla/extensions/xmlextras/base/src/nsXMLHttpRequest.cpp @@ -1049,7 +1049,7 @@ nsXMLHttpRequest::Send(nsISupports *body) // XXX Need to find a better way to do this rather than // chaining through a bunch of getters and QIs nsCOMPtr global; - global = dont_AddRef(scriptCX->GetGlobalObject()); + scriptCX->GetGlobalObject(getter_AddRefs(global)); if (!global) return NS_ERROR_FAILURE; nsCOMPtr docshell; diff --git a/mozilla/extensions/xmlextras/tests/TestXMLExtras.cpp b/mozilla/extensions/xmlextras/tests/TestXMLExtras.cpp index 3453520ae94..81e9b5ae3c9 100644 --- a/mozilla/extensions/xmlextras/tests/TestXMLExtras.cpp +++ b/mozilla/extensions/xmlextras/tests/TestXMLExtras.cpp @@ -270,7 +270,8 @@ int main (int argc, char* argv[]) nsCRT::free(s); nsCOMPtr doc = do_QueryInterface(pDOMDocument); if (doc) { - nsCOMPtr uri = dont_AddRef(doc->GetDocumentURL()); + nsCOMPtr uri; + doc->GetDocumentURL(getter_AddRefs(uri)); nsXPIDLCString spec; uri->GetSpec(getter_Copies(spec)); printf("Document URI=\"%s\"\n",spec.get()); diff --git a/mozilla/layout/base/nsCSSFrameConstructor.cpp b/mozilla/layout/base/nsCSSFrameConstructor.cpp index f0ba66451ea..9876cf5ff74 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/base/nsCSSFrameConstructor.cpp @@ -7291,7 +7291,8 @@ nsCSSFrameConstructor::ReconstructDocElementHierarchy(nsIPresContext* aPresConte aPresContext->GetShell(getter_AddRefs(shell)); if (nsnull != mDocument && shell) { - nsCOMPtr rootContent(dont_AddRef(mDocument->GetRootContent())); + nsCOMPtr rootContent; + mDocument->GetRootContent(getter_AddRefs(rootContent)); if (rootContent) { // Before removing the frames associated with the content object, ask them to save their @@ -8438,7 +8439,8 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext, // If we have a null parent, then this must be the document element // being inserted if (nsnull == aContainer) { - nsCOMPtr docElement( dont_AddRef( mDocument->GetRootContent() ) ); + nsCOMPtr docElement; + mDocument->GetRootContent(getter_AddRefs(docElement)); if (aChild == docElement.get()) { NS_PRECONDITION(nsnull == mInitialContainingBlock, "initial containing block already created"); @@ -10008,7 +10010,7 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext, // so the entire visible regions gets painted nsCOMPtr rootContent; nsCOMPtr parentContent; - rootContent = getter_AddRefs(mDocument->GetRootContent()); + mDocument->GetRootContent(getter_AddRefs(rootContent)); aContent->GetParent(*getter_AddRefs(parentContent)); if (aContent == rootContent.get() || // content is the root (HTML) parentContent == rootContent ) { // content's parent is root (BODY) diff --git a/mozilla/layout/base/nsCSSRendering.cpp b/mozilla/layout/base/nsCSSRendering.cpp index 2ae5a2c6325..88e0fde0b5b 100644 --- a/mozilla/layout/base/nsCSSRendering.cpp +++ b/mozilla/layout/base/nsCSSRendering.cpp @@ -1421,8 +1421,8 @@ PRBool GetBGColorForHTMLElement( nsIPresContext *aPresContext, if (shell) { nsIDocument *doc = nsnull; if (NS_SUCCEEDED(shell->GetDocument(&doc)) && doc) { - nsIContent *pContent = doc->GetRootContent(); - if (pContent) { + nsIContent *pContent; + if (NS_SUCCEEDED(doc->GetRootContent(&pContent)) && pContent) { // make sure that this is the HTML element nsIAtom *tag = nsnull; pContent->GetTag(tag); diff --git a/mozilla/layout/base/nsDocumentViewer.cpp b/mozilla/layout/base/nsDocumentViewer.cpp index 485367d1a58..7409fda5f57 100644 --- a/mozilla/layout/base/nsDocumentViewer.cpp +++ b/mozilla/layout/base/nsDocumentViewer.cpp @@ -2001,7 +2001,8 @@ DocumentViewerImpl::IsParentAFrameSet(nsIWebShell * aParent) nsCOMPtr doc; shell->GetDocument(getter_AddRefs(doc)); if (doc) { - nsCOMPtr rootContent = getter_AddRefs(doc->GetRootContent()); + nsCOMPtr rootContent; + doc->GetRootContent(getter_AddRefs(rootContent)); if (rootContent) { if (NS_SUCCEEDED(FindFrameSetWithIID(rootContent, NS_GET_IID(nsIDOMHTMLFrameSetElement)))) { isFrameSet = PR_TRUE; @@ -2059,7 +2060,8 @@ DocumentViewerImpl::GetWebShellTitleAndURL(nsIWebShell * aWebShell, } } - nsCOMPtr url(getter_AddRefs(doc->GetDocumentURL())); + nsCOMPtr url; + doc->GetDocumentURL(getter_AddRefs(url)); if (url) { char * urlCStr; url->GetSpec(&urlCStr); @@ -2576,7 +2578,7 @@ DocumentViewerImpl::GetPresShellAndRootContent(nsIWebShell * aWebShell, presShell->GetDocument(getter_AddRefs(doc)); if (!doc) return; - *aContent = doc->GetRootContent(); // this addrefs + doc->GetRootContent(aContent); // this addrefs *aPresShell = presShell.get(); NS_ADDREF(*aPresShell); } @@ -3702,10 +3704,12 @@ DocumentViewerImpl::CreateStyleSet(nsIDocument* aDocument, rv = nsComponentManager::CreateInstance(kStyleSetCID,nsnull,NS_GET_IID(nsIStyleSet),(void**)aStyleSet); if (NS_OK == rv) { - PRInt32 index = aDocument->GetNumberOfStyleSheets(); + PRInt32 index = 0; + aDocument->GetNumberOfStyleSheets(&index); while (0 < index--) { - nsCOMPtr sheet(getter_AddRefs(aDocument->GetStyleSheetAt(index))); + nsCOMPtr sheet; + aDocument->GetStyleSheetAt(index, getter_AddRefs(sheet)); /* * GetStyleSheetAt will return all style sheets in the document but @@ -3986,7 +3990,8 @@ NS_IMETHODIMP DocumentViewerImpl::SelectAll() } else if (mDocument) { - nsCOMPtr rootContent = getter_AddRefs(mDocument->GetRootContent()); + nsCOMPtr rootContent; + mDocument->GetRootContent(getter_AddRefs(rootContent)); bodyNode = do_QueryInterface(rootContent); } if (!bodyNode) return NS_ERROR_FAILURE; diff --git a/mozilla/layout/base/nsPresShell.cpp b/mozilla/layout/base/nsPresShell.cpp index 1cdcf5dbcb4..cb6a3b7db4a 100644 --- a/mozilla/layout/base/nsPresShell.cpp +++ b/mozilla/layout/base/nsPresShell.cpp @@ -1793,12 +1793,14 @@ NS_IMETHODIMP PresShell::SelectAlternateStyleSheet(const nsString& aSheetTitle) { if (mDocument && mStyleSet) { - PRInt32 count = mDocument->GetNumberOfStyleSheets(); + PRInt32 count = 0; + mDocument->GetNumberOfStyleSheets(&count); PRInt32 index; nsAutoString textHtml; textHtml.AssignWithConversion("text/html"); for (index = 0; index < count; index++) { - nsIStyleSheet* sheet = mDocument->GetStyleSheetAt(index); - if (nsnull != sheet) { + nsCOMPtr sheet; + mDocument->GetStyleSheetAt(index, getter_AddRefs(sheet)); + if (sheet) { nsAutoString type; sheet->GetType(type); if (PR_FALSE == type.Equals(textHtml)) { @@ -1813,7 +1815,6 @@ PresShell::SelectAlternateStyleSheet(const nsString& aSheetTitle) } } } - NS_RELEASE(sheet); } } ReconstructFrames(); @@ -1825,12 +1826,14 @@ NS_IMETHODIMP PresShell::ListAlternateStyleSheets(nsStringArray& aTitleList) { if (mDocument) { - PRInt32 count = mDocument->GetNumberOfStyleSheets(); + PRInt32 count = 0; + mDocument->GetNumberOfStyleSheets(&count); PRInt32 index; nsAutoString textHtml; textHtml.AssignWithConversion("text/html"); for (index = 0; index < count; index++) { - nsIStyleSheet* sheet = mDocument->GetStyleSheetAt(index); - if (nsnull != sheet) { + nsCOMPtr sheet; + mDocument->GetStyleSheetAt(index, getter_AddRefs(sheet)); + if (sheet) { nsAutoString type; sheet->GetType(type); if (PR_FALSE == type.Equals(textHtml)) { @@ -1842,7 +1845,6 @@ PresShell::ListAlternateStyleSheets(nsStringArray& aTitleList) } } } - NS_RELEASE(sheet); } } } @@ -2490,13 +2492,13 @@ GetRootScrollFrame(nsIPresContext* aPresContext, nsIFrame* aRootFrame, nsIFrame* NS_IMETHODIMP PresShell::InitialReflow(nscoord aWidth, nscoord aHeight) { - nsIContent* root = nsnull; + nsCOMPtr root; #ifdef NS_DEBUG if (VERIFY_REFLOW_NOISY_RC & gVerifyReflowFlags) { nsCOMPtr uri; if (mDocument) { - uri = dont_AddRef(mDocument->GetDocumentURL()); + mDocument->GetDocumentURL(getter_AddRefs(uri)); if (uri) { char* url = nsnull; uri->GetSpec(&url); @@ -2520,14 +2522,14 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight) } if (mDocument) { - root = mDocument->GetRootContent(); + mDocument->GetRootContent(getter_AddRefs(root)); } // Get the root frame from the frame manager nsIFrame* rootFrame; mFrameManager->GetRootFrame(&rootFrame); - if (nsnull != root) { + if (root) { MOZ_TIMER_DEBUGLOG(("Reset and start: Frame Creation: PresShell::InitialReflow(), this=%p\n", this)); MOZ_TIMER_RESET(mFrameCreationWatch); MOZ_TIMER_START(mFrameCreationWatch); @@ -2543,7 +2545,6 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight) // Have the style sheet processor construct frame for the root // content object down mStyleSet->ContentInserted(mPresContext, nsnull, root, 0); - NS_RELEASE(root); VERIFY_STYLE_TREE; MOZ_TIMER_DEBUGLOG(("Stop: Frame Creation: PresShell::InitialReflow(), this=%p\n", this)); MOZ_TIMER_STOP(mFrameCreationWatch); @@ -3448,7 +3449,7 @@ PresShell::AppendReflowCommandInternal(nsIReflowCommand* aReflowCommand, if (VERIFY_REFLOW_REALLY_NOISY_RC & gVerifyReflowFlags) { printf("Current content model:\n"); nsCOMPtr rootContent; - rootContent = getter_AddRefs(mDocument->GetRootContent()); + mDocument->GetRootContent(getter_AddRefs(rootContent)); if (rootContent) { rootContent->List(stdout, 0); } @@ -5396,7 +5397,7 @@ PresShell::HandleEvent(nsIView *aView, // On the Mac it is possible to be running with no windows open, only the native menu bar. // In this situation, we need to handle key board events but there are no frames, so // we set mCurrentEventContent and that works itself out in HandleEventInternal. - mCurrentEventContent = mDocument->GetRootContent(); + mDocument->GetRootContent(&mCurrentEventContent); mCurrentEventFrame = nsnull; /*#else if (aForceHandle) { @@ -6746,10 +6747,10 @@ PresShell::DumpReflows() if (mReflowCountMgr) { char * uriStr = nsnull; if (mDocument) { - nsIURI * uri = mDocument->GetDocumentURL(); + nsCOMPtr uri; + mDocument->GetDocumentURL(getter_AddRefs(uri)); if (uri) { uri->GetPath(&uriStr); - NS_RELEASE(uri); } } mReflowCountMgr->DisplayTotals(uriStr); diff --git a/mozilla/layout/base/src/nsCopySupport.cpp b/mozilla/layout/base/src/nsCopySupport.cpp index 1165c366d2f..4897cd48dc5 100644 --- a/mozilla/layout/base/src/nsCopySupport.cpp +++ b/mozilla/layout/base/src/nsCopySupport.cpp @@ -92,7 +92,8 @@ nsresult nsCopySupport::HTMLCopy(nsISelection *aSel, nsIDocument *aDoc, PRInt16 nsCOMPtr doc = do_QueryInterface(aDoc); if (doc) { - nsCOMPtr shell(dont_AddRef(doc->GetShellAt(0))); + nsCOMPtr shell; + doc->GetShellAt(0, getter_AddRefs(shell)); if (shell) { nsCOMPtr context; shell->GetPresContext(getter_AddRefs(context) ); diff --git a/mozilla/layout/generic/nsImageFrame.cpp b/mozilla/layout/generic/nsImageFrame.cpp index 292d0662eff..efe7befb836 100644 --- a/mozilla/layout/generic/nsImageFrame.cpp +++ b/mozilla/layout/generic/nsImageFrame.cpp @@ -983,7 +983,7 @@ nsImageFrame::TriggerLink(nsIPresContext* aPresContext, nsCOMPtr baseURI; if (NS_SUCCEEDED(rv) && doc) - baseURI = dont_AddRef(doc->GetDocumentURL()); + doc->GetDocumentURL(getter_AddRefs(baseURI)); nsCOMPtr absURI; if (NS_SUCCEEDED(rv)) rv = NS_NewURI(getter_AddRefs(absURI), aURLSpec, baseURI); diff --git a/mozilla/layout/generic/nsImageMap.cpp b/mozilla/layout/generic/nsImageMap.cpp index c0793dee052..8c26591d613 100644 --- a/mozilla/layout/generic/nsImageMap.cpp +++ b/mozilla/layout/generic/nsImageMap.cpp @@ -1254,7 +1254,8 @@ nsImageMap::ChangeFocus(nsIDOMEvent* aEvent, PRBool aFocus) { nsCOMPtr doc; //This check is necessary to see if we're still attached to the doc if (NS_SUCCEEDED(targetContent->GetDocument(*getter_AddRefs(doc))) && doc) { - nsCOMPtr presShell = getter_AddRefs(doc->GetShellAt(0)); + nsCOMPtr presShell; + doc->GetShellAt(0, getter_AddRefs(presShell)); if (presShell) { nsIFrame* imgFrame; if (NS_SUCCEEDED(presShell->GetPrimaryFrameFor(targetContent, &imgFrame)) && imgFrame) { diff --git a/mozilla/layout/generic/nsSelection.cpp b/mozilla/layout/generic/nsSelection.cpp index 80bb4a7a7d5..a3248222698 100644 --- a/mozilla/layout/generic/nsSelection.cpp +++ b/mozilla/layout/generic/nsSelection.cpp @@ -3016,7 +3016,7 @@ NS_IMETHODIMP nsSelection::SelectAll() rv = shell->GetDocument(getter_AddRefs(doc)); if (NS_FAILED(rv) || !doc) return rv?rv:NS_ERROR_FAILURE; - rootContent = getter_AddRefs(doc->GetRootContent()); + doc->GetRootContent(getter_AddRefs(rootContent)); if (!rootContent) return NS_ERROR_FAILURE; } diff --git a/mozilla/layout/html/base/src/nsImageFrame.cpp b/mozilla/layout/html/base/src/nsImageFrame.cpp index 292d0662eff..efe7befb836 100644 --- a/mozilla/layout/html/base/src/nsImageFrame.cpp +++ b/mozilla/layout/html/base/src/nsImageFrame.cpp @@ -983,7 +983,7 @@ nsImageFrame::TriggerLink(nsIPresContext* aPresContext, nsCOMPtr baseURI; if (NS_SUCCEEDED(rv) && doc) - baseURI = dont_AddRef(doc->GetDocumentURL()); + doc->GetDocumentURL(getter_AddRefs(baseURI)); nsCOMPtr absURI; if (NS_SUCCEEDED(rv)) rv = NS_NewURI(getter_AddRefs(absURI), aURLSpec, baseURI); diff --git a/mozilla/layout/html/base/src/nsImageMap.cpp b/mozilla/layout/html/base/src/nsImageMap.cpp index c0793dee052..8c26591d613 100644 --- a/mozilla/layout/html/base/src/nsImageMap.cpp +++ b/mozilla/layout/html/base/src/nsImageMap.cpp @@ -1254,7 +1254,8 @@ nsImageMap::ChangeFocus(nsIDOMEvent* aEvent, PRBool aFocus) { nsCOMPtr doc; //This check is necessary to see if we're still attached to the doc if (NS_SUCCEEDED(targetContent->GetDocument(*getter_AddRefs(doc))) && doc) { - nsCOMPtr presShell = getter_AddRefs(doc->GetShellAt(0)); + nsCOMPtr presShell; + doc->GetShellAt(0, getter_AddRefs(presShell)); if (presShell) { nsIFrame* imgFrame; if (NS_SUCCEEDED(presShell->GetPrimaryFrameFor(targetContent, &imgFrame)) && imgFrame) { diff --git a/mozilla/layout/html/base/src/nsPresShell.cpp b/mozilla/layout/html/base/src/nsPresShell.cpp index 1cdcf5dbcb4..cb6a3b7db4a 100644 --- a/mozilla/layout/html/base/src/nsPresShell.cpp +++ b/mozilla/layout/html/base/src/nsPresShell.cpp @@ -1793,12 +1793,14 @@ NS_IMETHODIMP PresShell::SelectAlternateStyleSheet(const nsString& aSheetTitle) { if (mDocument && mStyleSet) { - PRInt32 count = mDocument->GetNumberOfStyleSheets(); + PRInt32 count = 0; + mDocument->GetNumberOfStyleSheets(&count); PRInt32 index; nsAutoString textHtml; textHtml.AssignWithConversion("text/html"); for (index = 0; index < count; index++) { - nsIStyleSheet* sheet = mDocument->GetStyleSheetAt(index); - if (nsnull != sheet) { + nsCOMPtr sheet; + mDocument->GetStyleSheetAt(index, getter_AddRefs(sheet)); + if (sheet) { nsAutoString type; sheet->GetType(type); if (PR_FALSE == type.Equals(textHtml)) { @@ -1813,7 +1815,6 @@ PresShell::SelectAlternateStyleSheet(const nsString& aSheetTitle) } } } - NS_RELEASE(sheet); } } ReconstructFrames(); @@ -1825,12 +1826,14 @@ NS_IMETHODIMP PresShell::ListAlternateStyleSheets(nsStringArray& aTitleList) { if (mDocument) { - PRInt32 count = mDocument->GetNumberOfStyleSheets(); + PRInt32 count = 0; + mDocument->GetNumberOfStyleSheets(&count); PRInt32 index; nsAutoString textHtml; textHtml.AssignWithConversion("text/html"); for (index = 0; index < count; index++) { - nsIStyleSheet* sheet = mDocument->GetStyleSheetAt(index); - if (nsnull != sheet) { + nsCOMPtr sheet; + mDocument->GetStyleSheetAt(index, getter_AddRefs(sheet)); + if (sheet) { nsAutoString type; sheet->GetType(type); if (PR_FALSE == type.Equals(textHtml)) { @@ -1842,7 +1845,6 @@ PresShell::ListAlternateStyleSheets(nsStringArray& aTitleList) } } } - NS_RELEASE(sheet); } } } @@ -2490,13 +2492,13 @@ GetRootScrollFrame(nsIPresContext* aPresContext, nsIFrame* aRootFrame, nsIFrame* NS_IMETHODIMP PresShell::InitialReflow(nscoord aWidth, nscoord aHeight) { - nsIContent* root = nsnull; + nsCOMPtr root; #ifdef NS_DEBUG if (VERIFY_REFLOW_NOISY_RC & gVerifyReflowFlags) { nsCOMPtr uri; if (mDocument) { - uri = dont_AddRef(mDocument->GetDocumentURL()); + mDocument->GetDocumentURL(getter_AddRefs(uri)); if (uri) { char* url = nsnull; uri->GetSpec(&url); @@ -2520,14 +2522,14 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight) } if (mDocument) { - root = mDocument->GetRootContent(); + mDocument->GetRootContent(getter_AddRefs(root)); } // Get the root frame from the frame manager nsIFrame* rootFrame; mFrameManager->GetRootFrame(&rootFrame); - if (nsnull != root) { + if (root) { MOZ_TIMER_DEBUGLOG(("Reset and start: Frame Creation: PresShell::InitialReflow(), this=%p\n", this)); MOZ_TIMER_RESET(mFrameCreationWatch); MOZ_TIMER_START(mFrameCreationWatch); @@ -2543,7 +2545,6 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight) // Have the style sheet processor construct frame for the root // content object down mStyleSet->ContentInserted(mPresContext, nsnull, root, 0); - NS_RELEASE(root); VERIFY_STYLE_TREE; MOZ_TIMER_DEBUGLOG(("Stop: Frame Creation: PresShell::InitialReflow(), this=%p\n", this)); MOZ_TIMER_STOP(mFrameCreationWatch); @@ -3448,7 +3449,7 @@ PresShell::AppendReflowCommandInternal(nsIReflowCommand* aReflowCommand, if (VERIFY_REFLOW_REALLY_NOISY_RC & gVerifyReflowFlags) { printf("Current content model:\n"); nsCOMPtr rootContent; - rootContent = getter_AddRefs(mDocument->GetRootContent()); + mDocument->GetRootContent(getter_AddRefs(rootContent)); if (rootContent) { rootContent->List(stdout, 0); } @@ -5396,7 +5397,7 @@ PresShell::HandleEvent(nsIView *aView, // On the Mac it is possible to be running with no windows open, only the native menu bar. // In this situation, we need to handle key board events but there are no frames, so // we set mCurrentEventContent and that works itself out in HandleEventInternal. - mCurrentEventContent = mDocument->GetRootContent(); + mDocument->GetRootContent(&mCurrentEventContent); mCurrentEventFrame = nsnull; /*#else if (aForceHandle) { @@ -6746,10 +6747,10 @@ PresShell::DumpReflows() if (mReflowCountMgr) { char * uriStr = nsnull; if (mDocument) { - nsIURI * uri = mDocument->GetDocumentURL(); + nsCOMPtr uri; + mDocument->GetDocumentURL(getter_AddRefs(uri)); if (uri) { uri->GetPath(&uriStr); - NS_RELEASE(uri); } } mReflowCountMgr->DisplayTotals(uriStr); diff --git a/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp b/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp index e25e21aead7..2ac8772d123 100644 --- a/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp +++ b/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp @@ -351,7 +351,8 @@ nsTextInputListener::NotifySelectionChanged(nsIDOMDocument* aDoc, nsISelection* { if (doc) { - nsCOMPtr presShell = dont_AddRef(doc->GetShellAt(0)); + nsCOMPtr presShell; + doc->GetShellAt(0, getter_AddRefs(presShell)); if (presShell) { nsEventStatus status = nsEventStatus_eIgnore; diff --git a/mozilla/layout/html/forms/src/nsLabelFrame.cpp b/mozilla/layout/html/forms/src/nsLabelFrame.cpp index dcd6437ac75..b3c73685a9e 100644 --- a/mozilla/layout/html/forms/src/nsLabelFrame.cpp +++ b/mozilla/layout/html/forms/src/nsLabelFrame.cpp @@ -352,7 +352,8 @@ nsLabelFrame::FindForControl(nsIFormControlFrame*& aResultFrame) if (!domElement) return PR_FALSE; - nsCOMPtr shell = getter_AddRefs(iDoc->GetShellAt(0)); + nsCOMPtr shell; + iDoc->GetShellAt(0, getter_AddRefs(shell)); if (nsnull == shell) return PR_FALSE; diff --git a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp index f0ba66451ea..9876cf5ff74 100644 --- a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -7291,7 +7291,8 @@ nsCSSFrameConstructor::ReconstructDocElementHierarchy(nsIPresContext* aPresConte aPresContext->GetShell(getter_AddRefs(shell)); if (nsnull != mDocument && shell) { - nsCOMPtr rootContent(dont_AddRef(mDocument->GetRootContent())); + nsCOMPtr rootContent; + mDocument->GetRootContent(getter_AddRefs(rootContent)); if (rootContent) { // Before removing the frames associated with the content object, ask them to save their @@ -8438,7 +8439,8 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext, // If we have a null parent, then this must be the document element // being inserted if (nsnull == aContainer) { - nsCOMPtr docElement( dont_AddRef( mDocument->GetRootContent() ) ); + nsCOMPtr docElement; + mDocument->GetRootContent(getter_AddRefs(docElement)); if (aChild == docElement.get()) { NS_PRECONDITION(nsnull == mInitialContainingBlock, "initial containing block already created"); @@ -10008,7 +10010,7 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext, // so the entire visible regions gets painted nsCOMPtr rootContent; nsCOMPtr parentContent; - rootContent = getter_AddRefs(mDocument->GetRootContent()); + mDocument->GetRootContent(getter_AddRefs(rootContent)); aContent->GetParent(*getter_AddRefs(parentContent)); if (aContent == rootContent.get() || // content is the root (HTML) parentContent == rootContent ) { // content's parent is root (BODY) diff --git a/mozilla/layout/html/style/src/nsCSSRendering.cpp b/mozilla/layout/html/style/src/nsCSSRendering.cpp index 2ae5a2c6325..88e0fde0b5b 100644 --- a/mozilla/layout/html/style/src/nsCSSRendering.cpp +++ b/mozilla/layout/html/style/src/nsCSSRendering.cpp @@ -1421,8 +1421,8 @@ PRBool GetBGColorForHTMLElement( nsIPresContext *aPresContext, if (shell) { nsIDocument *doc = nsnull; if (NS_SUCCEEDED(shell->GetDocument(&doc)) && doc) { - nsIContent *pContent = doc->GetRootContent(); - if (pContent) { + nsIContent *pContent; + if (NS_SUCCEEDED(doc->GetRootContent(&pContent)) && pContent) { // make sure that this is the HTML element nsIAtom *tag = nsnull; pContent->GetTag(tag); diff --git a/mozilla/layout/html/tests/table/TableContentTest/TableContentTest.cpp b/mozilla/layout/html/tests/table/TableContentTest/TableContentTest.cpp index 24260c60cd4..1fdba188ed8 100644 --- a/mozilla/layout/html/tests/table/TableContentTest/TableContentTest.cpp +++ b/mozilla/layout/html/tests/table/TableContentTest/TableContentTest.cpp @@ -91,7 +91,7 @@ BasicTest::BasicTest() CreateCorrectContent(rows, cols); VerifyContent(rows, cols); nsIContent *root; - root = GetRootContent(); + GetRootContent(&root); if (nsnull!=root && 1==root->ChildCount()) root->RemoveChildAt(0); else @@ -103,7 +103,7 @@ BasicTest::BasicTest() // Build a content model the "right" way with every kind of table object CreateCorrectFullContent(rows, cols); VerifyContent(rows, cols); - root = GetRootContent(); + GetRootContent(&root); if (nsnull!=root && 1==root->ChildCount()) root->RemoveChildAt(0); else @@ -115,7 +115,7 @@ BasicTest::BasicTest() // Build a content model with things out of order CreateOutOfOrderContent(rows, cols); VerifyContent(rows, cols); - root = GetRootContent(); + GetRootContent(&root); if (nsnull!=root && 1==root->ChildCount()) root->RemoveChildAt(0); else @@ -128,7 +128,7 @@ BasicTest::BasicTest() /* not ready for prime time... CreateIllegalContent(rows, cols); VerifyContent(rows, cols); - root = GetRootContent(); + GetRootContent(&root); if (nsnull!=root && 1==root->ChildCount()) root->RemoveChildAt(0); else @@ -395,7 +395,8 @@ void BasicTest::CreateIllegalContent(int aRows, int aCols) void BasicTest::VerifyContent(PRInt32 aRows, PRInt32 aCols) { - nsIContent* root = GetRootContent(); + nsIContent* root; + GetRootContent(&root); if (nsnull==root) { fprintf(out, "GetRootContent failed\n"); @@ -531,7 +532,8 @@ GeometryTest::GeometryTest(BasicTest *aDoc) /** given a content model, create a geometry model */ void GeometryTest::CreateGeometry(BasicTest * aDoc, nsIPresContext *aPC) { - nsIContent *root = aDoc->GetRootContent(); + nsIContent *root; + aDoc->GetRootContent(&root); nsIContentDelegate* cd = root->GetDelegate(aPC); if (nsnull != cd) { mRootFrame = cd->CreateFrame(aPC, root, -1, nsnull); diff --git a/mozilla/layout/style/nsStyleSet.cpp b/mozilla/layout/style/nsStyleSet.cpp index e8504d1aa0f..2ed87c83f2a 100644 --- a/mozilla/layout/style/nsStyleSet.cpp +++ b/mozilla/layout/style/nsStyleSet.cpp @@ -521,14 +521,16 @@ void StyleSetImpl::AddDocStyleSheet(nsIStyleSheet* aSheet, nsIDocument* aDocumen if (EnsureArray(&mDocSheets)) { mDocSheets->RemoveElement(aSheet); // lowest index last - PRInt32 newDocIndex = aDocument->GetIndexOfStyleSheet(aSheet); + PRInt32 newDocIndex = 0; + aDocument->GetIndexOfStyleSheet(aSheet, &newDocIndex); PRUint32 count; nsresult rv = mDocSheets->Count(&count); if (NS_FAILED(rv)) return; // XXX error? PRUint32 index; for (index = 0; index < count; index++) { nsIStyleSheet* sheet = (nsIStyleSheet*)mDocSheets->ElementAt(index); - PRInt32 sheetDocIndex = aDocument->GetIndexOfStyleSheet(sheet); + PRInt32 sheetDocIndex = 0; + aDocument->GetIndexOfStyleSheet(sheet, &sheetDocIndex); if (sheetDocIndex < newDocIndex) { mDocSheets->InsertElementAt(aSheet, index); index = count; // break loop diff --git a/mozilla/layout/xul/base/src/nsBoxObject.cpp b/mozilla/layout/xul/base/src/nsBoxObject.cpp index d85778e8f6c..a02659e9043 100644 --- a/mozilla/layout/xul/base/src/nsBoxObject.cpp +++ b/mozilla/layout/xul/base/src/nsBoxObject.cpp @@ -124,7 +124,8 @@ nsBoxObject::SetDocument(nsIDocument* aDocument) { mPresState = nsnull; if (aDocument) { - nsCOMPtr shell = getter_AddRefs(aDocument->GetShellAt(0)); + nsCOMPtr shell; + aDocument->GetShellAt(0, getter_AddRefs(shell)); mPresShell = shell; } else { @@ -155,7 +156,8 @@ nsBoxObject::GetOffsetRect(nsRect& aRect) if (doc) { // Get Presentation shell 0 - nsCOMPtr presShell = getter_AddRefs(doc->GetShellAt(0)); + nsCOMPtr presShell; + doc->GetShellAt(0, getter_AddRefs(presShell)); if(presShell) { // Flush all pending notifications so that our frames are uptodate @@ -182,7 +184,8 @@ nsBoxObject::GetOffsetRect(nsRect& aRect) // Find the frame parent whose content's tagName either matches // the tagName passed in or is the document element. - nsCOMPtr docElement = getter_AddRefs(doc->GetRootContent()); + nsCOMPtr docElement; + doc->GetRootContent(getter_AddRefs(docElement)); nsIFrame* parent = frame; nsCOMPtr parentContent; frame->GetParent(&parent); @@ -264,7 +267,8 @@ nsBoxObject::GetScreenRect(nsRect& aRect) if (doc) { // Get Presentation shell 0 - nsCOMPtr presShell = getter_AddRefs(doc->GetShellAt(0)); + nsCOMPtr presShell; + doc->GetShellAt(0, getter_AddRefs(presShell)); if (presShell) { // Flush all pending notifications so that our frames are uptodate diff --git a/mozilla/layout/xul/base/src/nsMenuPopupFrame.cpp b/mozilla/layout/xul/base/src/nsMenuPopupFrame.cpp index 300466bab89..8521dddae29 100644 --- a/mozilla/layout/xul/base/src/nsMenuPopupFrame.cpp +++ b/mozilla/layout/xul/base/src/nsMenuPopupFrame.cpp @@ -394,7 +394,8 @@ nsMenuPopupFrame :: AdjustClientXYForNestedDocuments ( nsIDOMXULDocument* inPopu nsCOMPtr targetDocument; targetAsContent->GetDocument(*getter_AddRefs(targetDocument)); if (targetDocument) { - nsCOMPtr shell ( dont_AddRef(targetDocument->GetShellAt(0)) ); + nsCOMPtr shell; + targetDocument->GetShellAt(0, getter_AddRefs(shell)); nsCOMPtr viewManagerTarget; if ( shell ) { shell->GetViewManager(getter_AddRefs(viewManagerTarget)); diff --git a/mozilla/layout/xul/base/src/nsPopupSetBoxObject.cpp b/mozilla/layout/xul/base/src/nsPopupSetBoxObject.cpp index 0545148b2d1..bf30f097c1b 100644 --- a/mozilla/layout/xul/base/src/nsPopupSetBoxObject.cpp +++ b/mozilla/layout/xul/base/src/nsPopupSetBoxObject.cpp @@ -132,7 +132,8 @@ nsPopupSetBoxObject::CreatePopup(nsIDOMElement* aSrcContent, return NS_OK; nsCOMPtr document(do_QueryInterface(doc)); - nsCOMPtr shell = getter_AddRefs(document->GetShellAt(0)); + nsCOMPtr shell; + document->GetShellAt(0, getter_AddRefs(shell)); if (!shell) return NS_OK; diff --git a/mozilla/layout/xul/base/src/outliner/src/nsOutlinerSelection.cpp b/mozilla/layout/xul/base/src/outliner/src/nsOutlinerSelection.cpp index b88f5cf3279..0d6a59d6e74 100644 --- a/mozilla/layout/xul/base/src/outliner/src/nsOutlinerSelection.cpp +++ b/mozilla/layout/xul/base/src/outliner/src/nsOutlinerSelection.cpp @@ -693,15 +693,16 @@ nsOutlinerSelection::FireOnSelectHandler() content->GetDocument(*getter_AddRefs(document)); PRInt32 count = document->GetNumberOfShells(); - for (PRInt32 i = 0; i < count; i++) { - nsCOMPtr shell = getter_AddRefs(document->GetShellAt(i)); - if (nsnull == shell) - continue; + for (PRInt32 i = 0; i < count; i++) { + nsCOMPtr shell; + document->GetShellAt(i, getter_AddRefs(shell)); + if (!shell) + continue; + + // Retrieve the context in which our DOM event will fire. + nsCOMPtr aPresContext; + shell->GetPresContext(getter_AddRefs(aPresContext)); - // Retrieve the context in which our DOM event will fire. - nsCOMPtr aPresContext; - shell->GetPresContext(getter_AddRefs(aPresContext)); - nsEventStatus status = nsEventStatus_eIgnore; nsEvent event; event.eventStructType = NS_EVENT; diff --git a/mozilla/layout/xul/base/src/tree/src/nsTreeSelection.cpp b/mozilla/layout/xul/base/src/tree/src/nsTreeSelection.cpp index b88f5cf3279..0d6a59d6e74 100644 --- a/mozilla/layout/xul/base/src/tree/src/nsTreeSelection.cpp +++ b/mozilla/layout/xul/base/src/tree/src/nsTreeSelection.cpp @@ -693,15 +693,16 @@ nsOutlinerSelection::FireOnSelectHandler() content->GetDocument(*getter_AddRefs(document)); PRInt32 count = document->GetNumberOfShells(); - for (PRInt32 i = 0; i < count; i++) { - nsCOMPtr shell = getter_AddRefs(document->GetShellAt(i)); - if (nsnull == shell) - continue; + for (PRInt32 i = 0; i < count; i++) { + nsCOMPtr shell; + document->GetShellAt(i, getter_AddRefs(shell)); + if (!shell) + continue; + + // Retrieve the context in which our DOM event will fire. + nsCOMPtr aPresContext; + shell->GetPresContext(getter_AddRefs(aPresContext)); - // Retrieve the context in which our DOM event will fire. - nsCOMPtr aPresContext; - shell->GetPresContext(getter_AddRefs(aPresContext)); - nsEventStatus status = nsEventStatus_eIgnore; nsEvent event; event.eventStructType = NS_EVENT; diff --git a/mozilla/mailnews/compose/src/nsMsgSend.cpp b/mozilla/mailnews/compose/src/nsMsgSend.cpp index c709f4fba13..e25fc5928da 100644 --- a/mozilla/mailnews/compose/src/nsMsgSend.cpp +++ b/mozilla/mailnews/compose/src/nsMsgSend.cpp @@ -1597,7 +1597,8 @@ nsMsgComposeAndSend::ProcessMultipartRelated(PRInt32 *aMailboxCount, PRInt32 *aN } nsXPIDLCString spec; - nsCOMPtr uri = dont_AddRef(doc->GetDocumentURL()); + nsCOMPtr uri; + doc->GetDocumentURL(getter_AddRefs(uri)); if (!uri) return NS_ERROR_OUT_OF_MEMORY; diff --git a/mozilla/modules/oji/src/ProxyClassLoader.cpp b/mozilla/modules/oji/src/ProxyClassLoader.cpp index 1505d646d11..46299447c96 100644 --- a/mozilla/modules/oji/src/ProxyClassLoader.cpp +++ b/mozilla/modules/oji/src/ProxyClassLoader.cpp @@ -44,7 +44,8 @@ static nsresult getScriptCodebase(JSContext* cx, nsIURI* *result) { nsIScriptContext* scriptContext = NS_REINTERPRET_CAST(nsIScriptContext*, JS_GetContextPrivate(cx)); if (scriptContext) { - nsCOMPtr scriptGlobal = dont_AddRef(scriptContext->GetGlobalObject()); + nsCOMPtr scriptGlobal; + scriptContext->GetGlobalObject(getter_AddRefs(scriptGlobal)); nsCOMPtr scriptObjectPrincipal = do_QueryInterface(scriptGlobal); if (scriptObjectPrincipal) { nsCOMPtr principal; diff --git a/mozilla/modules/oji/src/lcglue.cpp b/mozilla/modules/oji/src/lcglue.cpp index 6ee8e0f11cf..84e8805330b 100644 --- a/mozilla/modules/oji/src/lcglue.cpp +++ b/mozilla/modules/oji/src/lcglue.cpp @@ -432,7 +432,8 @@ enter_js_from_java_impl(JNIEnv *jEnv, char **errp, if (pJSCX) { nsCOMPtr scriptContext = NS_REINTERPRET_CAST(nsIScriptContext*, JS_GetContextPrivate(pJSCX)); if (scriptContext) { - nsCOMPtr global(dont_AddRef(scriptContext->GetGlobalObject())); + nsCOMPtr global; + scriptContext->GetGlobalObject(getter_AddRefs(global)); NS_ASSERTION(global, "script context has no global object"); if (global) { diff --git a/mozilla/modules/oji/src/nsCSecurityContext.cpp b/mozilla/modules/oji/src/nsCSecurityContext.cpp index c76dde4fdad..82fc03d2ded 100644 --- a/mozilla/modules/oji/src/nsCSecurityContext.cpp +++ b/mozilla/modules/oji/src/nsCSecurityContext.cpp @@ -124,7 +124,8 @@ nsCSecurityContext::GetOrigin(char* buf, int buflen) if (!m_pPrincipal && m_pJSCX ) { nsCOMPtr scriptContext = (nsIScriptContext*)JS_GetContextPrivate(m_pJSCX); if (scriptContext) { - nsCOMPtr global(dont_AddRef(scriptContext->GetGlobalObject())); + nsCOMPtr global; + scriptContext->GetGlobalObject(getter_AddRefs(global)); NS_ASSERTION(global, "script context has no global object"); if (global) { diff --git a/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp b/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp index f3edd5e47e3..3b4efacaf52 100644 --- a/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp +++ b/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp @@ -4343,7 +4343,8 @@ NS_IMETHODIMP nsPluginHostImpl::NewPluginURLStream(const nsString& aURL, rv = owner->GetDocument(getter_AddRefs(doc)); if (NS_SUCCEEDED(rv) && doc) { - nsCOMPtr docURL( getter_AddRefs(doc->GetDocumentURL()) ); + nsCOMPtr docURL; + doc->GetDocumentURL(getter_AddRefs(docURL)); // Create an absolute URL rv = NS_MakeAbsoluteURI(absUrl, aURL, docURL); diff --git a/mozilla/modules/plugin/nglsrc/nsPluginHostImpl.cpp b/mozilla/modules/plugin/nglsrc/nsPluginHostImpl.cpp index f3edd5e47e3..3b4efacaf52 100644 --- a/mozilla/modules/plugin/nglsrc/nsPluginHostImpl.cpp +++ b/mozilla/modules/plugin/nglsrc/nsPluginHostImpl.cpp @@ -4343,7 +4343,8 @@ NS_IMETHODIMP nsPluginHostImpl::NewPluginURLStream(const nsString& aURL, rv = owner->GetDocument(getter_AddRefs(doc)); if (NS_SUCCEEDED(rv) && doc) { - nsCOMPtr docURL( getter_AddRefs(doc->GetDocumentURL()) ); + nsCOMPtr docURL; + doc->GetDocumentURL(getter_AddRefs(docURL)); // Create an absolute URL rv = NS_MakeAbsoluteURI(absUrl, aURL, docURL); diff --git a/mozilla/rdf/chrome/src/nsChromeRegistry.cpp b/mozilla/rdf/chrome/src/nsChromeRegistry.cpp index 0fb83fb7578..d27295d73d1 100644 --- a/mozilla/rdf/chrome/src/nsChromeRegistry.cpp +++ b/mozilla/rdf/chrome/src/nsChromeRegistry.cpp @@ -1186,7 +1186,8 @@ NS_IMETHODIMP nsChromeRegistry::RefreshWindow(nsIDOMWindowInternal* aWindow) // Deal with the backstop sheets first. PRInt32 shellCount = document->GetNumberOfShells(); for (PRInt32 k = 0; k < shellCount; k++) { - nsCOMPtr shell = getter_AddRefs(document->GetShellAt(k)); + nsCOMPtr shell; + document->GetShellAt(k, getter_AddRefs(shell)); if (shell) { nsCOMPtr styleSet; rv = shell->GetStyleSet(getter_AddRefs(styleSet)); @@ -1255,12 +1256,14 @@ NS_IMETHODIMP nsChromeRegistry::RefreshWindow(nsIDOMWindowInternal* aWindow) rv = container->GetInlineStyleSheet(getter_AddRefs(inlineSheet)); if (NS_FAILED(rv)) return rv; - PRInt32 count = document->GetNumberOfStyleSheets(); + PRInt32 count = 0; + document->GetNumberOfStyleSheets(&count); // Iterate over the style sheets. for (PRInt32 i = 0; i < count; i++) { // Get the style sheet - nsCOMPtr styleSheet = getter_AddRefs(document->GetStyleSheetAt(i)); + nsCOMPtr styleSheet; + document->GetStyleSheetAt(i, getter_AddRefs(styleSheet)); // Make sure we aren't the special style sheets that never change. We // want to skip those. @@ -2758,7 +2761,8 @@ nsChromeRegistry::GetBackstopSheets(nsIDocShell* aDocShell, nsISupportsArray **a nsCOMPtr content(do_QueryInterface(elt)); nsCOMPtr doc; content->GetDocument(*getter_AddRefs(doc)); - nsCOMPtr docURL = getter_AddRefs(doc->GetDocumentURL()); + nsCOMPtr docURL; + doc->GetDocumentURL(getter_AddRefs(docURL)); nsCOMPtr url; rv = NS_NewURI(getter_AddRefs(url), token, docURL); diff --git a/mozilla/rdf/tests/domds/nsRDFDOMDataSource.cpp b/mozilla/rdf/tests/domds/nsRDFDOMDataSource.cpp index d850f6f5927..ab7d3a8df76 100644 --- a/mozilla/rdf/tests/domds/nsRDFDOMDataSource.cpp +++ b/mozilla/rdf/tests/domds/nsRDFDOMDataSource.cpp @@ -859,7 +859,8 @@ nsRDFDOMDataSource::getTargetsForKnownObject(nsISupports *object, nsCOMPtr document = do_QueryInterface(object, &rv); if (NS_SUCCEEDED(rv)) { - // nsIContent *content = document->GetRootContent(); + // nsIContent *content; + // document->GetRootContent(&content); // if (content) { // rv = createContentArcs(content, arcs); // NS_RELEASE(content); diff --git a/mozilla/uriloader/base/nsDocLoader.cpp b/mozilla/uriloader/base/nsDocLoader.cpp index 56cc66351e1..3251ef2cbc2 100644 --- a/mozilla/uriloader/base/nsDocLoader.cpp +++ b/mozilla/uriloader/base/nsDocLoader.cpp @@ -368,8 +368,8 @@ nsDocLoaderImpl::GetContentViewerContainer(nsISupports* aDocumentID, rv = base->QueryInterface(kIDocumentIID, (void**)&doc); if (NS_SUCCEEDED(rv)) { - nsIPresShell* pres; - pres = doc->GetShellAt(0); + nsCOMPtr pres; + doc->GetShellAt(0, getter_AddRefs(pres)); if (nsnull != pres) { nsIPresContext* presContext; rv = pres->GetPresContext(&presContext); @@ -382,7 +382,6 @@ nsDocLoaderImpl::GetContentViewerContainer(nsISupports* aDocumentID, } NS_RELEASE(presContext); } - NS_RELEASE(pres); } NS_RELEASE(doc); } diff --git a/mozilla/webshell/tests/viewer/nsBrowserWindow.cpp b/mozilla/webshell/tests/viewer/nsBrowserWindow.cpp index f00d3849099..5b9b465bf80 100644 --- a/mozilla/webshell/tests/viewer/nsBrowserWindow.cpp +++ b/mozilla/webshell/tests/viewer/nsBrowserWindow.cpp @@ -2542,7 +2542,8 @@ DumpContentRecurse(nsIDocShell* aDocShell, FILE* out) nsCOMPtr doc; shell->GetDocument(getter_AddRefs(doc)); if (doc) { - nsIContent* root = doc->GetRootContent(); + nsIContent* root = nsnull; + doc->GetRootContent(&root); if (nsnull != root) { root->List(out); NS_RELEASE(root); @@ -3082,9 +3083,8 @@ GatherContentDataSizes(nsISizeOfHandler* aHandler, nsIDocShell* aDocShell) nsIDocument* doc; shell->GetDocument(&doc); if (doc) { - nsCOMPtr rootContent = getter_AddRefs( - doc->GetRootContent() - ); + nsCOMPtr rootContent; + doc->GetRootContent(getter_AddRefs(rootContent)); if (rootContent) { GatherContentDataSizes(aHandler, rootContent.get()); } diff --git a/mozilla/webshell/tests/viewer/nsViewerApp.cpp b/mozilla/webshell/tests/viewer/nsViewerApp.cpp index 49440760a9c..6673de5fced 100644 --- a/mozilla/webshell/tests/viewer/nsViewerApp.cpp +++ b/mozilla/webshell/tests/viewer/nsViewerApp.cpp @@ -1115,7 +1115,8 @@ nsViewerApp::CreateRobot(nsBrowserWindow* aWindow) shell->GetDocument(getter_AddRefs(doc)); if (doc) { char * str; - nsCOMPtr uri = dont_AddRef(doc->GetDocumentURL()); + nsCOMPtr uri; + doc->GetDocumentURL(getter_AddRefs(uri)); nsresult rv = uri->GetSpec(&str); if (NS_FAILED(rv)) { return rv; diff --git a/mozilla/webshell/tests/viewer/nsWebCrawler.cpp b/mozilla/webshell/tests/viewer/nsWebCrawler.cpp index 688807db26c..221fb350ba0 100644 --- a/mozilla/webshell/tests/viewer/nsWebCrawler.cpp +++ b/mozilla/webshell/tests/viewer/nsWebCrawler.cpp @@ -719,7 +719,8 @@ nsWebCrawler::FindURLsIn(nsIDocument* aDocument, nsIContent* aNode) else { aNode->GetAttribute(kNameSpaceID_HTML, mSrcAttr, src); } - nsIURI* docURL = aDocument->GetDocumentURL(); + nsCOMPtr docURL; + aDocument->GetDocumentURL(getter_AddRefs(docURL)); nsresult rv; rv = NS_MakeAbsoluteURI(absURLSpec, src, docURL); if (NS_OK == rv) { @@ -751,7 +752,6 @@ nsWebCrawler::FindURLsIn(nsIDocument* aDocument, nsIContent* aNode) } } } - NS_RELEASE(docURL); } PRBool canHaveKids; @@ -787,7 +787,7 @@ nsWebCrawler::FindMoreURLs() docv->GetDocument(*getter_AddRefs(doc)); if (doc) { nsCOMPtr root; - root = dont_AddRef(doc->GetRootContent()); + doc->GetRootContent(getter_AddRefs(root)); if (root) { FindURLsIn(doc, root); } diff --git a/mozilla/webshell/tests/viewer/nsXPBaseWindow.cpp b/mozilla/webshell/tests/viewer/nsXPBaseWindow.cpp index fcf3ea6c636..73bdff750a5 100644 --- a/mozilla/webshell/tests/viewer/nsXPBaseWindow.cpp +++ b/mozilla/webshell/tests/viewer/nsXPBaseWindow.cpp @@ -408,7 +408,7 @@ NS_IMETHODIMP nsXPBaseWindow::EndLoadURL(nsIWebShell* aShell, const PRUnichar* a nsCOMPtr doc; shell->GetDocument(getter_AddRefs(doc)); if (doc) { - mContentRoot = doc->GetRootContent(); + doc->GetRootContent(&mContentRoot); mDocIsLoaded = PR_TRUE; if (nsnull != mWindowListener) { mWindowListener->Initialize(this); diff --git a/mozilla/widget/src/xpwidgets/nsBaseDragService.cpp b/mozilla/widget/src/xpwidgets/nsBaseDragService.cpp index 4822d1e3aa8..3ad24222eda 100644 --- a/mozilla/widget/src/xpwidgets/nsBaseDragService.cpp +++ b/mozilla/widget/src/xpwidgets/nsBaseDragService.cpp @@ -248,7 +248,8 @@ nsBaseDragService :: GetFrameFromNode ( nsIDOMNode* inNode, nsIFrame** outFrame, if (contentNode) { contentNode->GetDocument(*getter_AddRefs(doc)); if (doc) { - nsCOMPtr presShell ( getter_AddRefs(doc->GetShellAt(0)) ); + nsCOMPtr presShell; + doc->GetShellAt(0, getter_AddRefs(presShell)); if (presShell) { presShell->GetPresContext(outContext); presShell->GetPrimaryFrameFor(contentNode, outFrame); diff --git a/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp b/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp index 2ea08e876d1..c5736a100ff 100644 --- a/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp +++ b/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp @@ -1406,7 +1406,8 @@ void nsWebShellWindow::LoadContentAreas() { if (docViewer) { nsCOMPtr doc; docViewer->GetDocument(*getter_AddRefs(doc)); - nsCOMPtr mainURL = getter_AddRefs(doc->GetDocumentURL()); + nsCOMPtr mainURL; + doc->GetDocumentURL(getter_AddRefs(mainURL)); if (mainURL) { char *search = nsnull; nsCOMPtr url = do_QueryInterface(mainURL); diff --git a/mozilla/xpinstall/src/nsInstallTrigger.cpp b/mozilla/xpinstall/src/nsInstallTrigger.cpp index 5ab6953f7bc..510983c10d7 100644 --- a/mozilla/xpinstall/src/nsInstallTrigger.cpp +++ b/mozilla/xpinstall/src/nsInstallTrigger.cpp @@ -80,7 +80,8 @@ nsInstallTrigger::GetScriptObject(nsIScriptContext *aContext, void** aScriptObje if (nsnull == mScriptObject) { - nsIScriptGlobalObject *global = aContext->GetGlobalObject(); + nsIScriptGlobalObject *global = nsnull; + aContext->GetGlobalObject(&global); res = NS_NewScriptInstallTriggerGlobal( aContext, (nsISupports *)(nsIDOMInstallTriggerGlobal*)this, diff --git a/mozilla/xpinstall/src/nsJSInstallTriggerGlobal.cpp b/mozilla/xpinstall/src/nsJSInstallTriggerGlobal.cpp index ccd9b574cea..302137fba75 100644 --- a/mozilla/xpinstall/src/nsJSInstallTriggerGlobal.cpp +++ b/mozilla/xpinstall/src/nsJSInstallTriggerGlobal.cpp @@ -236,7 +236,8 @@ InstallTriggerGlobalInstall(JSContext *cx, JSObject *obj, uintN argc, jsval *arg nsCOMPtr scriptContext = (nsIScriptContext*) JS_GetContextPrivate(cx); if (scriptContext) { - nsCOMPtr globalObject = scriptContext->GetGlobalObject(); + nsCOMPtr globalObject; + scriptContext->GetGlobalObject(getter_AddRefs(globalObject)); if (globalObject) { nativeThis->Install(globalObject, trigger,&result); @@ -316,7 +317,8 @@ InstallTriggerGlobalInstallChrome(JSContext *cx, JSObject *obj, uintN argc, jsva nsCOMPtr scriptContext = (nsIScriptContext*) JS_GetContextPrivate(cx); if (scriptContext) { - nsCOMPtr globalObject = scriptContext->GetGlobalObject(); + nsCOMPtr globalObject; + scriptContext->GetGlobalObject(getter_AddRefs(globalObject)); if (globalObject) { nsresult rv = nativeThis->InstallChrome(globalObject, chromeType, item, &nativeRet); @@ -365,7 +367,8 @@ InstallTriggerGlobalStartSoftwareUpdate(JSContext *cx, JSObject *obj, uintN argc nsCOMPtr scriptContext = (nsIScriptContext*) JS_GetContextPrivate(cx); if (scriptContext) { - nsCOMPtr globalObject = scriptContext->GetGlobalObject(); + nsCOMPtr globalObject; + scriptContext->GetGlobalObject(getter_AddRefs(globalObject)); if (globalObject) { if(NS_OK != nativeThis->StartSoftwareUpdate(globalObject, b0, b1, &nativeRet))