2003-03-22 04:24:51 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2001-09-26 03:31:24 +04:00
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
2001-03-29 06:11:48 +04:00
|
|
|
*
|
2001-09-26 03:31:24 +04:00
|
|
|
* The contents of this file are subject to the Netscape Public License
|
|
|
|
* Version 1.1 (the "License"); you may not use this file except in
|
|
|
|
* compliance with the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/NPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
2001-03-29 06:11:48 +04:00
|
|
|
*
|
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2001-09-26 03:31:24 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the NPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the NPL, the GPL or the LGPL.
|
2001-03-29 06:11:48 +04:00
|
|
|
*
|
2001-09-26 03:31:24 +04:00
|
|
|
* ***** END LICENSE BLOCK ***** */
|
2001-03-29 06:11:48 +04:00
|
|
|
|
|
|
|
#include "nsImgManager.h"
|
2001-06-06 01:37:48 +04:00
|
|
|
#include "nsIDocument.h"
|
|
|
|
#include "nsIContent.h"
|
2003-04-26 00:03:40 +04:00
|
|
|
#include "nsINodeInfo.h"
|
2001-06-06 01:37:48 +04:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsXPIDLString.h"
|
|
|
|
#include "nsIURI.h"
|
2001-10-19 06:28:06 +04:00
|
|
|
#include "nsIServiceManager.h"
|
2002-05-31 22:40:39 +04:00
|
|
|
#include "nsIScriptGlobalObject.h"
|
|
|
|
#include "nsIDOMWindow.h"
|
|
|
|
#include "nsIDocShellTreeItem.h"
|
2003-03-22 04:24:51 +03:00
|
|
|
#include "nsCRT.h"
|
|
|
|
#include "nsIPrefBranchInternal.h"
|
|
|
|
#include "nsIObserverService.h"
|
2003-03-26 10:41:30 +03:00
|
|
|
#include "nsString.h"
|
2001-10-19 06:28:06 +04:00
|
|
|
|
2003-03-22 04:24:51 +03:00
|
|
|
// Possible behavior pref values
|
|
|
|
#define IMAGE_ACCEPT 0
|
|
|
|
#define IMAGE_NOFOREIGN 1
|
|
|
|
#define IMAGE_DENY 2
|
2002-05-31 22:40:39 +04:00
|
|
|
|
2003-03-22 04:24:51 +03:00
|
|
|
static const char kImageBehaviorPrefName[] = "network.image.imageBehavior";
|
|
|
|
static const char kImageWarningPrefName[] = "network.image.warnAboutImages";
|
|
|
|
static const char kImageBlockerPrefName[] = "imageblocker.enabled";
|
|
|
|
static const char kImageBlockImageInMailNewsPrefName[] = "mailnews.message_display.disable_remote_image";
|
2001-03-29 06:11:48 +04:00
|
|
|
|
2003-03-22 04:24:51 +03:00
|
|
|
static const PRInt32 kImageBehaviorPrefDefault = IMAGE_ACCEPT;
|
|
|
|
static const PRBool kImageWarningPrefDefault = PR_FALSE;
|
|
|
|
static const PRBool kImageBlockerPrefDefault = PR_FALSE;
|
|
|
|
static const PRBool kImageBlockImageInMailNewsPrefDefault = PR_FALSE;
|
2001-03-29 06:11:48 +04:00
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// nsImgManager Implementation
|
2003-03-22 04:24:51 +03:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2001-03-29 06:11:48 +04:00
|
|
|
|
2003-03-22 04:24:51 +03:00
|
|
|
NS_IMPL_ISUPPORTS4(nsImgManager,
|
2001-06-06 01:37:48 +04:00
|
|
|
nsIImgManager,
|
2003-03-22 04:24:51 +03:00
|
|
|
nsIContentPolicy,
|
|
|
|
nsIObserver,
|
2003-09-08 02:05:34 +04:00
|
|
|
nsSupportsWeakReference)
|
2001-03-29 06:11:48 +04:00
|
|
|
|
|
|
|
nsImgManager::nsImgManager()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2003-03-22 04:24:51 +03:00
|
|
|
nsImgManager::~nsImgManager()
|
2001-03-29 06:11:48 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult nsImgManager::Init()
|
|
|
|
{
|
2003-03-22 04:24:51 +03:00
|
|
|
nsresult rv;
|
2001-03-29 06:11:48 +04:00
|
|
|
|
2003-03-22 04:24:51 +03:00
|
|
|
// On error, just don't use the host based lookup anymore. We can do the
|
|
|
|
// other things, like mailnews blocking
|
|
|
|
mPermissionManager = do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
2001-03-29 06:11:48 +04:00
|
|
|
|
2003-03-22 04:24:51 +03:00
|
|
|
mPrefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
|
|
|
|
|
|
|
|
if (NS_SUCCEEDED(rv)) {
|
|
|
|
nsCOMPtr<nsIPrefBranchInternal> prefInternal = do_QueryInterface(mPrefBranch, &rv);
|
|
|
|
if (NS_SUCCEEDED(rv)) {
|
|
|
|
prefInternal->AddObserver(kImageBehaviorPrefName, this, PR_TRUE);
|
|
|
|
|
|
|
|
// We don't do anything with it yet, but let it be. (bug 110112, 146513)
|
|
|
|
prefInternal->AddObserver(kImageWarningPrefName, this, PR_TRUE);
|
|
|
|
|
|
|
|
// What is this pref, and how do you set it?
|
|
|
|
prefInternal->AddObserver(kImageBlockerPrefName, this, PR_TRUE);
|
|
|
|
prefInternal->AddObserver(kImageBlockImageInMailNewsPrefName, this, PR_TRUE);
|
|
|
|
}
|
|
|
|
}
|
2001-06-06 01:37:48 +04:00
|
|
|
|
2003-03-22 04:24:51 +03:00
|
|
|
rv = ReadPrefs();
|
|
|
|
NS_ASSERTION(NS_SUCCEEDED(rv), "Error occured reading image preferences");
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2002-05-31 22:40:39 +04:00
|
|
|
|
2001-06-06 01:37:48 +04:00
|
|
|
// nsIContentPolicy Implementation
|
|
|
|
NS_IMETHODIMP nsImgManager::ShouldLoad(PRInt32 aContentType,
|
|
|
|
nsIURI *aContentLoc,
|
|
|
|
nsISupports *aContext,
|
|
|
|
nsIDOMWindow *aWindow,
|
2003-03-22 04:24:51 +03:00
|
|
|
PRBool *aShouldLoad)
|
2001-06-06 01:37:48 +04:00
|
|
|
{
|
2003-03-22 04:24:51 +03:00
|
|
|
*aShouldLoad = PR_TRUE;
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
|
|
|
|
// we can't do anything w/ out these.
|
2003-09-27 08:18:26 +04:00
|
|
|
if (!aContentLoc || !aContext)
|
|
|
|
return rv;
|
2003-03-22 04:24:51 +03:00
|
|
|
|
|
|
|
if (aContentType == nsIContentPolicy::IMAGE) {
|
2003-04-30 10:28:16 +04:00
|
|
|
// we only want to check http, https, ftp
|
|
|
|
PRBool isFtp;
|
|
|
|
rv = aContentLoc->SchemeIs("ftp", &isFtp);
|
2003-04-26 03:29:17 +04:00
|
|
|
NS_ENSURE_SUCCESS(rv,rv);
|
|
|
|
|
2003-04-30 10:28:16 +04:00
|
|
|
PRBool needToCheck = isFtp;
|
|
|
|
if (!needToCheck) {
|
|
|
|
rv = aContentLoc->SchemeIs("http", &needToCheck);
|
|
|
|
NS_ENSURE_SUCCESS(rv,rv);
|
2003-04-26 03:29:17 +04:00
|
|
|
|
2003-04-30 10:28:16 +04:00
|
|
|
if (!needToCheck) {
|
|
|
|
rv = aContentLoc->SchemeIs("https", &needToCheck);
|
|
|
|
NS_ENSURE_SUCCESS(rv,rv);
|
|
|
|
}
|
|
|
|
}
|
2003-04-26 03:29:17 +04:00
|
|
|
|
2003-04-30 10:28:16 +04:00
|
|
|
// for chrome:// and resources and others, no need to check.
|
|
|
|
if (!needToCheck)
|
2003-04-26 03:29:17 +04:00
|
|
|
return NS_OK;
|
2003-03-22 04:24:51 +03:00
|
|
|
|
|
|
|
nsCOMPtr<nsIURI> baseURI;
|
|
|
|
nsCOMPtr<nsIDocument> doc;
|
|
|
|
nsCOMPtr<nsIContent> content = do_QueryInterface(aContext);
|
|
|
|
NS_ASSERTION(content, "no content available");
|
|
|
|
if (content) {
|
2003-07-24 21:30:52 +04:00
|
|
|
// XXXbz GetOwnerDocument
|
2003-07-29 01:35:53 +04:00
|
|
|
doc = content->GetDocument();
|
|
|
|
if (!doc) {
|
2003-09-27 08:18:26 +04:00
|
|
|
nsINodeInfo *nodeinfo = content->GetNodeInfo();
|
|
|
|
if (!nodeinfo)
|
|
|
|
return NS_OK;
|
2003-04-26 00:03:40 +04:00
|
|
|
|
2003-07-24 21:30:52 +04:00
|
|
|
doc = nodeinfo->GetDocument();
|
|
|
|
// XXX what should this code do if there is really no document?
|
2003-09-27 08:18:26 +04:00
|
|
|
if (!doc)
|
|
|
|
return NS_OK;
|
2003-04-26 00:03:40 +04:00
|
|
|
}
|
2003-03-22 04:24:51 +03:00
|
|
|
|
2003-06-14 00:10:01 +04:00
|
|
|
rv = doc->GetBaseURL(getter_AddRefs(baseURI));
|
2003-09-27 08:18:26 +04:00
|
|
|
if (NS_FAILED(rv) || !baseURI)
|
|
|
|
return rv;
|
2003-03-22 04:24:51 +03:00
|
|
|
|
2003-04-26 03:29:17 +04:00
|
|
|
nsCOMPtr<nsIDocShell> docshell;
|
|
|
|
rv = GetRootDocShell(aWindow, getter_AddRefs(docshell));
|
|
|
|
if (docshell) {
|
|
|
|
PRUint32 appType;
|
|
|
|
rv = docshell->GetAppType(&appType);
|
|
|
|
if (NS_SUCCEEDED(rv) && appType == nsIDocShell::APP_TYPE_MAIL) {
|
|
|
|
// never allow ftp for mail messages,
|
|
|
|
// because we don't want to send the users email address
|
|
|
|
// as the anonymous password
|
|
|
|
if (mBlockInMailNewsPref || isFtp) {
|
2003-03-22 04:24:51 +03:00
|
|
|
*aShouldLoad = PR_FALSE;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2001-06-06 01:37:48 +04:00
|
|
|
}
|
2003-03-22 04:24:51 +03:00
|
|
|
}
|
2003-04-26 03:29:17 +04:00
|
|
|
|
2003-03-22 04:24:51 +03:00
|
|
|
rv = TestPermission(aContentLoc, baseURI, aShouldLoad);
|
2003-09-27 08:18:26 +04:00
|
|
|
if (NS_FAILED(rv))
|
|
|
|
return rv;
|
2001-06-06 01:37:48 +04:00
|
|
|
}
|
2003-03-22 04:24:51 +03:00
|
|
|
}
|
|
|
|
return NS_OK;
|
2001-03-29 06:11:48 +04:00
|
|
|
}
|
|
|
|
|
2001-06-06 01:37:48 +04:00
|
|
|
NS_IMETHODIMP nsImgManager::ShouldProcess(PRInt32 aContentType,
|
|
|
|
nsIURI *aDocumentLoc,
|
|
|
|
nsISupports *aContext,
|
|
|
|
nsIDOMWindow *aWindow,
|
2003-03-22 04:24:51 +03:00
|
|
|
PRBool *_retval)
|
|
|
|
{
|
2001-06-06 01:37:48 +04:00
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
2001-03-29 06:11:48 +04:00
|
|
|
}
|
2002-05-31 22:40:39 +04:00
|
|
|
|
2003-03-22 04:24:51 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsImgManager::TestPermission(nsIURI *aCurrentURI,
|
|
|
|
nsIURI *aFirstURI,
|
|
|
|
PRBool *aPermission)
|
|
|
|
{
|
|
|
|
nsresult rv;
|
|
|
|
*aPermission = PR_TRUE;
|
|
|
|
|
|
|
|
// return if imageblocker is not enabled
|
|
|
|
// TODO: Why? Where is the pref set?
|
|
|
|
if (!mBlockerPref) {
|
|
|
|
*aPermission = (mBehaviorPref != IMAGE_DENY);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2003-08-02 21:20:52 +04:00
|
|
|
// check the permission list first; if we find an entry, it overrides
|
|
|
|
// default prefs. this is new behavior, see bug 184059.
|
|
|
|
if (mPermissionManager) {
|
|
|
|
PRUint32 temp;
|
|
|
|
mPermissionManager->TestPermission(aCurrentURI, "image", &temp);
|
|
|
|
|
|
|
|
// if we found an entry, use it
|
|
|
|
if (temp != nsIPermissionManager::UNKNOWN_ACTION) {
|
|
|
|
*aPermission = (temp != nsIPermissionManager::DENY_ACTION);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-03-22 04:24:51 +03:00
|
|
|
if (mBehaviorPref == IMAGE_DENY) {
|
|
|
|
*aPermission = PR_FALSE;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Third party checking
|
|
|
|
if (mBehaviorPref == IMAGE_NOFOREIGN) {
|
|
|
|
// compare tails of names checking to see if they have a common domain
|
|
|
|
// we do this by comparing the tails of both names where each tail
|
|
|
|
// includes at least one dot
|
|
|
|
|
|
|
|
// A more generic method somewhere would be nice
|
|
|
|
|
|
|
|
nsCAutoString currentHost;
|
|
|
|
rv = aCurrentURI->GetAsciiHost(currentHost);
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
|
|
|
// Search for two dots, starting at the end.
|
|
|
|
// If there are no two dots found, ++dot will turn to zero,
|
|
|
|
// that will return the entire string.
|
|
|
|
PRInt32 dot = currentHost.RFindChar('.');
|
|
|
|
dot = currentHost.RFindChar('.', dot-1);
|
|
|
|
++dot;
|
|
|
|
|
|
|
|
// Get the domain, ie the last part of the host (www.domain.com -> domain.com)
|
|
|
|
// This will break on co.uk
|
|
|
|
const nsACString &tail = Substring(currentHost, dot, currentHost.Length() - dot);
|
|
|
|
|
|
|
|
nsCAutoString firstHost;
|
|
|
|
rv = aFirstURI->GetAsciiHost(firstHost);
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
2003-06-20 02:35:08 +04:00
|
|
|
|
|
|
|
// If the tail is longer then the whole firstHost, it will never match
|
|
|
|
if (firstHost.Length() < tail.Length()) {
|
|
|
|
*aPermission = PR_FALSE;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2003-03-22 04:24:51 +03:00
|
|
|
|
|
|
|
// Get the last part of the firstUri with the same length as |tail|
|
2003-06-20 02:35:08 +04:00
|
|
|
const nsACString &firstTail = Substring(firstHost, firstHost.Length() - tail.Length(), tail.Length());
|
2003-03-22 04:24:51 +03:00
|
|
|
|
|
|
|
// Check that both tails are the same, and that just before the tail in
|
|
|
|
// |firstUri| there is a dot. That means both url are in the same domain
|
2003-06-20 02:35:08 +04:00
|
|
|
if ((firstHost.Length() > tail.Length() &&
|
|
|
|
firstHost.CharAt(firstHost.Length() - tail.Length() - 1) != '.') ||
|
|
|
|
!tail.Equals(firstTail)) {
|
2003-03-22 04:24:51 +03:00
|
|
|
*aPermission = PR_FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsImgManager::Observe(nsISupports *aSubject,
|
|
|
|
const char *aTopic,
|
|
|
|
const PRUnichar *aData)
|
|
|
|
{
|
|
|
|
nsresult rv;
|
|
|
|
|
|
|
|
// check the topic, and the cached prefservice
|
|
|
|
if (!mPrefBranch) {
|
|
|
|
NS_ERROR("No prefbranch");
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!nsCRT::strcmp(NS_PREFBRANCH_PREFCHANGE_TOPIC_ID, aTopic)) {
|
|
|
|
// which pref changed?
|
2003-06-15 00:10:55 +04:00
|
|
|
NS_LossyConvertUCS2toASCII pref(aData);
|
2003-03-22 04:24:51 +03:00
|
|
|
|
|
|
|
if (pref.Equals(kImageBehaviorPrefName)) {
|
|
|
|
rv = mPrefBranch->GetIntPref(kImageBehaviorPrefName, &mBehaviorPref);
|
|
|
|
if (NS_FAILED(rv) || mBehaviorPref < 0 || mBehaviorPref > 2) {
|
|
|
|
mBehaviorPref = kImageBehaviorPrefDefault;
|
|
|
|
}
|
|
|
|
} else if (pref.Equals(kImageWarningPrefName)) {
|
|
|
|
rv = mPrefBranch->GetIntPref(kImageWarningPrefName, &mWarningPref);
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
mWarningPref = kImageWarningPrefDefault;
|
|
|
|
}
|
|
|
|
} else if (pref.Equals(kImageBlockerPrefName)) {
|
|
|
|
rv = mPrefBranch->GetIntPref(kImageBlockerPrefName, &mBlockerPref);
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
mBlockerPref = kImageBlockerPrefDefault;
|
|
|
|
}
|
|
|
|
} else if (pref.Equals(kImageBlockImageInMailNewsPrefName)) {
|
2003-04-07 14:15:21 +04:00
|
|
|
rv = mPrefBranch->GetBoolPref(kImageBlockImageInMailNewsPrefName, &mBlockInMailNewsPref);
|
2003-03-22 04:24:51 +03:00
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
mBlockInMailNewsPref = kImageBlockImageInMailNewsPrefDefault;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsImgManager::ReadPrefs()
|
|
|
|
{
|
|
|
|
nsresult rv, rv2 = NS_OK;
|
|
|
|
|
|
|
|
// check the prefservice is cached
|
|
|
|
if (!mPrefBranch) {
|
|
|
|
NS_ERROR("No prefbranch");
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
rv = mPrefBranch->GetIntPref(kImageBehaviorPrefName, &mBehaviorPref);
|
|
|
|
if (NS_FAILED(rv) || mBehaviorPref < 0 || mBehaviorPref > 2) {
|
|
|
|
rv2 = rv;
|
|
|
|
mBehaviorPref = kImageBehaviorPrefDefault;
|
|
|
|
}
|
|
|
|
|
|
|
|
rv = mPrefBranch->GetBoolPref(kImageBlockerPrefName, &mBlockerPref);
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
rv2 = rv;
|
|
|
|
mBlockerPref = kImageWarningPrefDefault;
|
|
|
|
}
|
|
|
|
|
|
|
|
rv = mPrefBranch->GetBoolPref(kImageWarningPrefName, &mWarningPref);
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
rv2 = rv;
|
|
|
|
mWarningPref = kImageBlockerPrefDefault;
|
|
|
|
}
|
|
|
|
|
|
|
|
rv = mPrefBranch->GetBoolPref(kImageBlockImageInMailNewsPrefName, &mBlockInMailNewsPref);
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
rv2 = rv;
|
|
|
|
mBlockInMailNewsPref = kImageBlockImageInMailNewsPrefDefault;
|
|
|
|
}
|
|
|
|
|
|
|
|
return rv2;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsImgManager::GetRootDocShell(nsIDOMWindow *aWindow, nsIDocShell **result)
|
2002-05-31 22:40:39 +04:00
|
|
|
{
|
|
|
|
nsresult rv;
|
|
|
|
|
2003-05-08 05:55:37 +04:00
|
|
|
nsCOMPtr<nsIScriptGlobalObject> globalObj(do_QueryInterface(aWindow));
|
2002-05-31 22:40:39 +04:00
|
|
|
if (!globalObj)
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIDocShell> docshell;
|
|
|
|
rv = globalObj->GetDocShell(getter_AddRefs(docshell));
|
|
|
|
if (NS_FAILED(rv))
|
|
|
|
return rv;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIDocShellTreeItem> docshellTreeItem(do_QueryInterface(docshell, &rv));
|
|
|
|
if (NS_FAILED(rv))
|
|
|
|
return rv;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIDocShellTreeItem> rootItem;
|
|
|
|
rv = docshellTreeItem->GetRootTreeItem(getter_AddRefs(rootItem));
|
|
|
|
if (NS_FAILED(rv))
|
|
|
|
return rv;
|
|
|
|
|
2003-05-08 05:55:37 +04:00
|
|
|
return CallQueryInterface(rootItem, result);
|
2002-05-31 22:40:39 +04:00
|
|
|
}
|