mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 18:08:58 +00:00
Bug 582840 - Remove nsIWebProgressListener(2) support from TabChild and TabParent. r=Olli.Pettay a=blocking2.0
--HG-- extra : rebase_source : 764765bb56a218ec4b9be106eda1227156bf5181
This commit is contained in:
parent
59e844f810
commit
c75f353b6b
@ -41,12 +41,11 @@
|
||||
|
||||
interface nsIDocShell;
|
||||
interface nsIURI;
|
||||
interface nsIWebProgress;
|
||||
interface nsIFrame;
|
||||
interface nsIChromeFrameMessageManager;
|
||||
interface nsIVariant;
|
||||
|
||||
[scriptable, uuid(65d2c9e2-852c-48cf-a95d-9b82f1273c15)]
|
||||
[scriptable, uuid(50a67436-bb44-11df-8d9a-001e37d2764a)]
|
||||
interface nsIFrameLoader : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -54,11 +53,6 @@ interface nsIFrameLoader : nsISupports
|
||||
*/
|
||||
readonly attribute nsIDocShell docShell;
|
||||
|
||||
/**
|
||||
* Get the nsIWebProgress from the frame loader, allowing listener registration.
|
||||
*/
|
||||
readonly attribute nsIWebProgress webProgress;
|
||||
|
||||
/**
|
||||
* Start loading the frame. This method figures out what to load
|
||||
* from the owner content in the frame loader.
|
||||
|
@ -425,34 +425,6 @@ nsFrameLoader::GetDocShell(nsIDocShell **aDocShell)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::GetWebProgress(nsIWebProgress **aWebProgress)
|
||||
{
|
||||
nsresult rv;
|
||||
*aWebProgress = nsnull;
|
||||
#ifdef MOZ_IPC
|
||||
if (mRemoteFrame) {
|
||||
if (!mRemoteBrowser) {
|
||||
TryNewProcess();
|
||||
}
|
||||
if (!mRemoteBrowser) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
*aWebProgress = mRemoteBrowser;
|
||||
NS_ADDREF(*aWebProgress);
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIDocShell> shell;
|
||||
rv = GetDocShell(getter_AddRefs(shell));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsIWebProgress> progress(do_QueryInterface(shell));
|
||||
progress.swap(*aWebProgress);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
void
|
||||
nsFrameLoader::Finalize()
|
||||
{
|
||||
|
@ -45,7 +45,6 @@ include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_TEST_FILES = \
|
||||
bug421622-referer.sjs \
|
||||
bug514705.html \
|
||||
$(NULL)
|
||||
|
||||
_CHROME_FILES = \
|
||||
@ -54,8 +53,6 @@ _CHROME_FILES = \
|
||||
test_bug429785.xul \
|
||||
test_bug430050.xul \
|
||||
test_bug467123.xul \
|
||||
test_bug514705.xul \
|
||||
bug514705_helper.xul \
|
||||
test_title.xul \
|
||||
title_window.xul \
|
||||
test_bug549682.xul \
|
||||
|
@ -1,10 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>bug514705.html</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
bug514705.html
|
||||
</body>
|
||||
</html>
|
@ -1,90 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<window title="Bug514705 helper"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="RunTest();">
|
||||
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
var Ci = Components.interfaces;
|
||||
var imports = [ "SimpleTest", "is", "isnot", "ok" ];
|
||||
for each (var import in imports) {
|
||||
window[import] = window.opener.wrappedJSObject[import];
|
||||
}
|
||||
var locationChanged = false;
|
||||
var progressChanged = false;
|
||||
var refreshAttempted = false;
|
||||
|
||||
var listener = {
|
||||
onLocationChange: function(webProgress, request, location) {
|
||||
locationChanged = true;
|
||||
},
|
||||
onProgressChange: function(webProgress, request, curSelfProgress,
|
||||
maxSelfProgress, curTotalProgress,
|
||||
maxTotalProgress) {
|
||||
},
|
||||
onSecurityChange: function(webProgress, request, state) {
|
||||
},
|
||||
onStateChange: function(webProgress, request, stateFlags, status) {
|
||||
|
||||
if ((stateFlags & Ci.nsIWebProgressListener.STATE_STOP) &&
|
||||
(stateFlags & Ci.nsIWebProgressListener.STATE_IS_WINDOW)) {
|
||||
var test = SimpleTest;
|
||||
ok (locationChanged, "onLocationChanged was called.");
|
||||
ok (progressChanged, "onProgressChanged64 was called.");
|
||||
ok (refreshAttempted, "onRefreshAttempted was called.");
|
||||
ok (true, "onStateChange was called.");
|
||||
window.close();
|
||||
test.finish();
|
||||
}
|
||||
},
|
||||
onStatusChange: function(webProgress, request, status, message) {
|
||||
},
|
||||
onProgressChange64 : function(webProgress, request, curSelfProgress,
|
||||
maxSelfProgress, curTotalProgress,
|
||||
maxTotalProgress) {
|
||||
|
||||
progressChanged = true;
|
||||
},
|
||||
onRefreshAttempted : function(webProgress, uri, millis, sameURI)
|
||||
{
|
||||
refreshAttempted = true;
|
||||
return true;
|
||||
},
|
||||
QueryInterface: function(iid) {
|
||||
if (iid.equals(Components.interfaces.nsIWebProgressListener) ||
|
||||
iid.equals(Components.interfaces.nsIWebProgressListener2) ||
|
||||
iid.equals(Components.interfaces.nsISupportsWeakReference)) {
|
||||
return this;
|
||||
}
|
||||
throw Components.results.NS_NOINTERFACE;
|
||||
}
|
||||
}
|
||||
function EndTest() {
|
||||
var test = SimpleTest;
|
||||
window.close();
|
||||
test.finish();
|
||||
}
|
||||
function RunTest()
|
||||
{
|
||||
var browser = document.getElementById('page');
|
||||
var flags = Ci.nsIWebProgress.NOTIFY_ALL;
|
||||
|
||||
browser.webProgress.addProgressListener(listener, flags);
|
||||
|
||||
var script = "refreshURI = docShell.QueryInterface(Components.interfaces.nsIRefreshURI);"
|
||||
+ "var ioServ = Components.classes['@mozilla.org/network/io-service;1'].getService(Components.interfaces.nsIIOService);"
|
||||
+ "var uri = ioServ.newURI('http://localhost:8888/tests/content/base/test/chrome/bug514705.html', null, null);"
|
||||
+ "refreshURI.refreshURI(uri, 100, false, false);";
|
||||
messageManager.loadFrameScript("data:," + script, true);
|
||||
}
|
||||
|
||||
]]>
|
||||
</script>
|
||||
|
||||
|
||||
<browser type="content" flex="1" id="page" remote="true"/>
|
||||
|
||||
</window>
|
@ -1,30 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<window title="Bug 514705"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="RunTest();">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"/>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
|
||||
<!-- test results are displayed in the html:body -->
|
||||
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=421622"
|
||||
target="_blank">Mozilla Bug 421622</a>
|
||||
</body>
|
||||
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
//SimpleTest.waitForExplicitFinish();
|
||||
todo(false, "Enable this test");
|
||||
|
||||
function RunTest()
|
||||
{
|
||||
//window.open("bug514705_helper.xul", "bug514705",
|
||||
// "chrome,width=100,height=100");
|
||||
}
|
||||
]]>
|
||||
</script>
|
||||
</window>
|
@ -86,27 +86,6 @@ parent:
|
||||
|
||||
Event(RemoteDOMEvent aEvent);
|
||||
|
||||
NotifyStateChange(PRUint32 stateFlags, nsresult status);
|
||||
|
||||
NotifyProgressChange(PRInt64 curSelfProgress,
|
||||
PRInt64 maxSelfProgress,
|
||||
PRInt64 curTotalProgress,
|
||||
PRInt64 maxTotalProgress);
|
||||
|
||||
NotifyLocationChange(nsCString uri);
|
||||
|
||||
NotifyStatusChange(nsresult status,
|
||||
nsString message);
|
||||
|
||||
NotifySecurityChange(PRUint32 aState,
|
||||
PRBool aUseSSLStatusObject,
|
||||
nsString aTooltip,
|
||||
nsCString aSecInfoAsString);
|
||||
|
||||
sync RefreshAttempted(nsCString uri, PRInt32 millis,
|
||||
bool sameURI) returns (bool retval);
|
||||
|
||||
|
||||
rpc CreateWindow() returns (PBrowser window);
|
||||
|
||||
sync SyncMessage(nsString aMessage, nsString aJSON)
|
||||
|
@ -142,10 +142,6 @@ TabChild::Init()
|
||||
}
|
||||
|
||||
webBrowser->SetContainerWindow(this);
|
||||
nsCOMPtr<nsIWeakReference> weak =
|
||||
do_GetWeakReference(static_cast<nsSupportsWeakReference*>(this));
|
||||
webBrowser->AddWebBrowserListener(weak, NS_GET_IID(nsIWebProgressListener));
|
||||
|
||||
mWebNav = do_QueryInterface(webBrowser);
|
||||
NS_ASSERTION(mWebNav, "nsWebBrowser doesn't implement nsIWebNavigation?");
|
||||
|
||||
@ -155,7 +151,6 @@ TabChild::Init()
|
||||
}
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(TabChild)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWebProgressListener2)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChrome)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChrome2)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIEmbeddingSiteWindow)
|
||||
@ -163,11 +158,9 @@ NS_INTERFACE_MAP_BEGIN(TabChild)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChromeFocus)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWindowProvider)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener2)
|
||||
NS_INTERFACE_MAP_ENTRY(nsSupportsWeakReference)
|
||||
NS_INTERFACE_MAP_ENTRY(nsITabChild)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDialogCreator)
|
||||
NS_INTERFACE_MAP_ENTRY(nsSupportsWeakReference)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMPL_ADDREF(TabChild)
|
||||
@ -492,10 +485,6 @@ TabChild::ActorDestroy(ActorDestroyReason why)
|
||||
TabChild::~TabChild()
|
||||
{
|
||||
nsCOMPtr<nsIWebBrowser> webBrowser = do_QueryInterface(mWebNav);
|
||||
nsCOMPtr<nsIWeakReference> weak =
|
||||
do_GetWeakReference(static_cast<nsSupportsWeakReference*>(this));
|
||||
webBrowser->RemoveWebBrowserListener(weak, NS_GET_IID(nsIWebProgressListener));
|
||||
|
||||
if (webBrowser) {
|
||||
webBrowser->SetContainerWindow(nsnull);
|
||||
}
|
||||
@ -510,141 +499,6 @@ TabChild::~TabChild()
|
||||
mTabChildGlobal->mTabChild = nsnull;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabChild::OnStateChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest,
|
||||
PRUint32 aStateFlags,
|
||||
nsresult aStatus)
|
||||
{
|
||||
SendNotifyStateChange(aStateFlags, aStatus);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Only one of OnProgressChange / OnProgressChange64 will be called.
|
||||
// According to interface, it should be OnProgressChange64, but looks
|
||||
// like docLoader only sends the former.
|
||||
NS_IMETHODIMP
|
||||
TabChild::OnProgressChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest,
|
||||
PRInt32 aCurSelfProgress,
|
||||
PRInt32 aMaxSelfProgress,
|
||||
PRInt32 aCurTotalProgress,
|
||||
PRInt32 aMaxTotalProgress)
|
||||
{
|
||||
SendNotifyProgressChange(aCurSelfProgress, aMaxSelfProgress,
|
||||
aCurTotalProgress, aMaxTotalProgress);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabChild::OnStatusChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMessage)
|
||||
{
|
||||
nsDependentString message(aMessage);
|
||||
SendNotifyStatusChange(aStatus, message);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabChild::OnSecurityChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest,
|
||||
PRUint32 aState)
|
||||
{
|
||||
nsCString secInfoAsString;
|
||||
if (aState & nsIWebProgressListener::STATE_IS_SECURE) {
|
||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest);
|
||||
if (channel) {
|
||||
nsCOMPtr<nsISupports> secInfoSupports;
|
||||
channel->GetSecurityInfo(getter_AddRefs(secInfoSupports));
|
||||
|
||||
nsCOMPtr<nsISerializable> secInfoSerializable =
|
||||
do_QueryInterface(secInfoSupports);
|
||||
NS_SerializeToString(secInfoSerializable, secInfoAsString);
|
||||
}
|
||||
}
|
||||
|
||||
PRBool useSSLStatusObject = PR_FALSE;
|
||||
nsAutoString securityTooltip;
|
||||
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(aWebProgress);
|
||||
if (docShell) {
|
||||
nsCOMPtr<nsISecureBrowserUI> secureUI;
|
||||
docShell->GetSecurityUI(getter_AddRefs(secureUI));
|
||||
if (secureUI) {
|
||||
secureUI->GetTooltipText(securityTooltip);
|
||||
nsCOMPtr<nsISupports> supports;
|
||||
nsCOMPtr<nsISSLStatusProvider> provider = do_QueryInterface(secureUI);
|
||||
nsresult rv = provider->GetSSLStatus(getter_AddRefs(supports));
|
||||
if (NS_SUCCEEDED(rv) && supports) {
|
||||
/*
|
||||
* useSSLStatusObject: Security UI internally holds 4 states: secure, mixed,
|
||||
* broken, no security. In cases of secure, mixed and broken it holds reference
|
||||
* to a valid SSL status object. But, in case of the 'broken' state it doesn't
|
||||
* return the SSL status object (returns null), in contrary to the 'mixed' state
|
||||
* for which it returns.
|
||||
*
|
||||
* However, mixed and broken states are both reported to the upper level
|
||||
* as nsIWebProgressListener::STATE_IS_BROKEN, i.e. states are merged,
|
||||
* so we cannot determine, if to return the status object or not.
|
||||
*
|
||||
* TabParent is extracting the SSL status object from the security info
|
||||
* serialization (string). SSL status object is always present there
|
||||
* even security UI implementation doesn't present it. This argument
|
||||
* tells the parent if the SSL status object is being presented by
|
||||
* the security UI here, on the child process, and so if it has to be
|
||||
* presented also on the parent process.
|
||||
*/
|
||||
useSSLStatusObject = PR_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SendNotifySecurityChange(aState, useSSLStatusObject, securityTooltip,
|
||||
secInfoAsString);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabChild::OnLocationChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest,
|
||||
nsIURI *aLocation)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aLocation);
|
||||
nsCString uri;
|
||||
aLocation->GetSpec(uri);
|
||||
SendNotifyLocationChange(uri);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabChild::OnProgressChange64(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest,
|
||||
PRInt64 aCurSelfProgress,
|
||||
PRInt64 aMaxSelfProgress,
|
||||
PRInt64 aCurTotalProgress,
|
||||
PRInt64 aMaxTotalProgress)
|
||||
{
|
||||
SendNotifyProgressChange(aCurSelfProgress, aMaxSelfProgress,
|
||||
aCurTotalProgress, aMaxTotalProgress);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabChild::OnRefreshAttempted(nsIWebProgress *aWebProgress,
|
||||
nsIURI *aURI, PRInt32 aMillis,
|
||||
PRBool aSameURL, PRBool *aRefreshAllowed)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aURI);
|
||||
nsCString uri;
|
||||
aURI->GetSpec(uri);
|
||||
bool sameURL = aSameURL;
|
||||
bool refreshAllowed;
|
||||
SendRefreshAttempted(uri, aMillis, sameURL, &refreshAllowed);
|
||||
*aRefreshAllowed = refreshAllowed;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
TabChild::RecvLoadURL(const nsCString& uri)
|
||||
{
|
||||
|
@ -48,8 +48,6 @@
|
||||
#include "nsIWebBrowserChrome2.h"
|
||||
#include "nsIEmbeddingSiteWindow2.h"
|
||||
#include "nsIWebBrowserChromeFocus.h"
|
||||
#include "nsIWebProgressListener.h"
|
||||
#include "nsIWebProgressListener2.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
@ -145,7 +143,6 @@ protected:
|
||||
|
||||
class TabChild : public PBrowserChild,
|
||||
public nsFrameScriptExecutor,
|
||||
public nsIWebProgressListener2,
|
||||
public nsIWebBrowserChrome2,
|
||||
public nsIEmbeddingSiteWindow2,
|
||||
public nsIWebBrowserChromeFocus,
|
||||
@ -162,8 +159,6 @@ public:
|
||||
nsresult Init();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIWEBPROGRESSLISTENER
|
||||
NS_DECL_NSIWEBPROGRESSLISTENER2
|
||||
NS_DECL_NSIWEBBROWSERCHROME
|
||||
NS_DECL_NSIWEBBROWSERCHROME2
|
||||
NS_DECL_NSIEMBEDDINGSITEWINDOW
|
||||
|
@ -58,7 +58,6 @@
|
||||
#include "TabChild.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIPrivateDOMEvent.h"
|
||||
#include "nsIWebProgressListener2.h"
|
||||
#include "nsFrameLoader.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "jsarray.h"
|
||||
@ -89,10 +88,10 @@ using mozilla::dom::ContentParent;
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
NS_IMPL_ISUPPORTS5(TabParent, nsITabParent, nsIWebProgress, nsIAuthPromptProvider, nsISSLStatusProvider, nsISecureBrowserUI)
|
||||
NS_IMPL_ISUPPORTS4(TabParent, nsITabParent, nsIAuthPromptProvider, nsISSLStatusProvider, nsISecureBrowserUI)
|
||||
|
||||
TabParent::TabParent()
|
||||
: mSecurityState(nsIWebProgressListener::STATE_IS_INSECURE)
|
||||
: mSecurityState(0)
|
||||
{
|
||||
}
|
||||
|
||||
@ -137,269 +136,6 @@ TabParent::RecvEvent(const RemoteDOMEvent& aEvent)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TabParent::RecvNotifyProgressChange(const PRInt64& aProgress,
|
||||
const PRInt64& aProgressMax,
|
||||
const PRInt64& aTotalProgress,
|
||||
const PRInt64& aMaxTotalProgress)
|
||||
{
|
||||
/*
|
||||
* First notify any listeners of the new progress info...
|
||||
*
|
||||
* Operate the elements from back to front so that if items get
|
||||
* get removed from the list it won't affect our iteration
|
||||
*/
|
||||
nsCOMPtr<nsIWebProgressListener> listener;
|
||||
PRUint32 count = mListenerInfoList.Length();
|
||||
|
||||
while (count-- > 0) {
|
||||
TabParentListenerInfo *info = &mListenerInfoList[count];
|
||||
if (!(info->mNotifyMask & nsIWebProgress::NOTIFY_PROGRESS)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
listener = do_QueryReferent(info->mWeakListener);
|
||||
if (!listener) {
|
||||
// the listener went away. gracefully pull it out of the list.
|
||||
mListenerInfoList.RemoveElementAt(count);
|
||||
continue;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIWebProgressListener2> listener2 =
|
||||
do_QueryReferent(info->mWeakListener);
|
||||
if (listener2) {
|
||||
listener2->OnProgressChange64(this, nsnull, aProgress, aProgressMax,
|
||||
aTotalProgress, aMaxTotalProgress);
|
||||
} else {
|
||||
listener->OnProgressChange(this, nsnull, PRInt32(aProgress),
|
||||
PRInt32(aProgressMax),
|
||||
PRInt32(aTotalProgress),
|
||||
PRInt32(aMaxTotalProgress));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TabParent::RecvNotifyStateChange(const PRUint32& aStateFlags,
|
||||
const nsresult& aStatus)
|
||||
{
|
||||
/*
|
||||
* First notify any listeners of the new state info...
|
||||
*
|
||||
* Operate the elements from back to front so that if items get
|
||||
* get removed from the list it won't affect our iteration
|
||||
*/
|
||||
nsCOMPtr<nsIWebProgressListener> listener;
|
||||
PRUint32 count = mListenerInfoList.Length();
|
||||
|
||||
while (count-- > 0) {
|
||||
TabParentListenerInfo *info = &mListenerInfoList[count];
|
||||
|
||||
// The flags used in listener registration are shifted over
|
||||
// 16 bits from the ones sent in the notification, so we shift
|
||||
// to see if the listener is interested in this change.
|
||||
// Note that the flags are not changed in the notification we
|
||||
// send along. Flags are defined in nsIWebProgressListener and
|
||||
// nsIWebProgress.
|
||||
// See nsDocLoader for another example of this.
|
||||
if (!(info->mNotifyMask & (aStateFlags >> NOTIFY_FLAG_SHIFT))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
listener = do_QueryReferent(info->mWeakListener);
|
||||
if (!listener) {
|
||||
// the listener went away. gracefully pull it out of the list.
|
||||
mListenerInfoList.RemoveElementAt(count);
|
||||
continue;
|
||||
}
|
||||
|
||||
listener->OnStateChange(this, nsnull, aStateFlags, aStatus);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TabParent::RecvNotifyLocationChange(const nsCString& aUri)
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(uri), aUri);
|
||||
if (NS_FAILED(rv)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* First notify any listeners of the new state info...
|
||||
*
|
||||
* Operate the elements from back to front so that if items get
|
||||
* get removed from the list it won't affect our iteration
|
||||
*/
|
||||
nsCOMPtr<nsIWebProgressListener> listener;
|
||||
PRUint32 count = mListenerInfoList.Length();
|
||||
|
||||
while (count-- > 0) {
|
||||
TabParentListenerInfo *info = &mListenerInfoList[count];
|
||||
if (!(info->mNotifyMask & nsIWebProgress::NOTIFY_LOCATION)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
listener = do_QueryReferent(info->mWeakListener);
|
||||
if (!listener) {
|
||||
// the listener went away. gracefully pull it out of the list.
|
||||
mListenerInfoList.RemoveElementAt(count);
|
||||
continue;
|
||||
}
|
||||
|
||||
listener->OnLocationChange(this, nsnull, uri);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TabParent::RecvNotifyStatusChange(const nsresult& status,
|
||||
const nsString& message)
|
||||
{
|
||||
/*
|
||||
* First notify any listeners of the new state info...
|
||||
*
|
||||
* Operate the elements from back to front so that if items get
|
||||
* get removed from the list it won't affect our iteration
|
||||
*/
|
||||
nsCOMPtr<nsIWebProgressListener> listener;
|
||||
PRUint32 count = mListenerInfoList.Length();
|
||||
|
||||
while (count-- > 0) {
|
||||
TabParentListenerInfo *info = &mListenerInfoList[count];
|
||||
if (!(info->mNotifyMask & nsIWebProgress::NOTIFY_STATUS)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
listener = do_QueryReferent(info->mWeakListener);
|
||||
if (!listener) {
|
||||
// the listener went away. gracefully pull it out of the list.
|
||||
mListenerInfoList.RemoveElementAt(count);
|
||||
continue;
|
||||
}
|
||||
|
||||
listener->OnStatusChange(this, nsnull, status, message.BeginReading());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TabParent::RecvNotifySecurityChange(const PRUint32& aState,
|
||||
const PRBool& aUseSSLStatusObject,
|
||||
const nsString& aTooltip,
|
||||
const nsCString& aSecInfoAsString)
|
||||
{
|
||||
/*
|
||||
* First notify any listeners of the new state info...
|
||||
*
|
||||
* Operate the elements from back to front so that if items get
|
||||
* get removed from the list it won't affect our iteration
|
||||
*/
|
||||
|
||||
mSecurityState = aState;
|
||||
mSecurityTooltipText = aTooltip;
|
||||
|
||||
if (!aSecInfoAsString.IsEmpty()) {
|
||||
nsCOMPtr<nsISupports> secInfoSupports;
|
||||
nsresult rv = NS_DeserializeObject(aSecInfoAsString, getter_AddRefs(secInfoSupports));
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsIIdentityInfo> idInfo = do_QueryInterface(secInfoSupports);
|
||||
if (idInfo) {
|
||||
PRBool isEV;
|
||||
if (NS_SUCCEEDED(idInfo->GetIsExtendedValidation(&isEV)) && isEV)
|
||||
mSecurityState |= nsIWebProgressListener::STATE_IDENTITY_EV_TOPLEVEL;
|
||||
}
|
||||
}
|
||||
|
||||
mSecurityStatusObject = nsnull;
|
||||
if (aUseSSLStatusObject)
|
||||
{
|
||||
nsCOMPtr<nsISSLStatusProvider> sslStatusProvider =
|
||||
do_QueryInterface(secInfoSupports);
|
||||
if (sslStatusProvider)
|
||||
sslStatusProvider->GetSSLStatus(getter_AddRefs(mSecurityStatusObject));
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIWebProgressListener> listener;
|
||||
PRUint32 count = mListenerInfoList.Length();
|
||||
|
||||
while (count-- > 0) {
|
||||
TabParentListenerInfo *info = &mListenerInfoList[count];
|
||||
if (!(info->mNotifyMask & nsIWebProgress::NOTIFY_SECURITY)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
listener = do_QueryReferent(info->mWeakListener);
|
||||
if (!listener) {
|
||||
// the listener went away. gracefully pull it out of the list.
|
||||
mListenerInfoList.RemoveElementAt(count);
|
||||
continue;
|
||||
}
|
||||
|
||||
listener->OnSecurityChange(this, nsnull, mSecurityState);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TabParent::RecvRefreshAttempted(const nsCString& aURI, const PRInt32& aMillis,
|
||||
const bool& aSameURI, bool* refreshAllowed)
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(uri), aURI);
|
||||
if (NS_FAILED(rv)) {
|
||||
return false;
|
||||
}
|
||||
/*
|
||||
* First notify any listeners of the new state info...
|
||||
*
|
||||
* Operate the elements from back to front so that if items get
|
||||
* get removed from the list it won't affect our iteration
|
||||
*/
|
||||
|
||||
nsCOMPtr<nsIWebProgressListener> listener;
|
||||
PRUint32 count = mListenerInfoList.Length();
|
||||
|
||||
*refreshAllowed = true;
|
||||
while (count-- > 0) {
|
||||
TabParentListenerInfo *info = &mListenerInfoList[count];
|
||||
if (!(info->mNotifyMask & nsIWebProgress::NOTIFY_REFRESH)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
listener = do_QueryReferent(info->mWeakListener);
|
||||
if (!listener) {
|
||||
// the listener went away. gracefully pull it out of the list.
|
||||
mListenerInfoList.RemoveElementAt(count);
|
||||
continue;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIWebProgressListener2> listener2 =
|
||||
do_QueryReferent(info->mWeakListener);
|
||||
if (!listener2) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// some listeners don't seem to set this at all...
|
||||
PRBool allowed = true;
|
||||
listener2->OnRefreshAttempted(this, uri,
|
||||
aMillis, aSameURI, &allowed);
|
||||
*refreshAllowed = allowed && *refreshAllowed;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TabParent::AnswerCreateWindow(PBrowserParent** retval)
|
||||
{
|
||||
@ -458,6 +194,7 @@ NS_IMETHODIMP
|
||||
TabParent::GetState(PRUint32 *aState)
|
||||
{
|
||||
NS_ENSURE_ARG(aState);
|
||||
NS_WARNING("SecurityState not valid here");
|
||||
*aState = mSecurityState;
|
||||
return NS_OK;
|
||||
}
|
||||
@ -628,71 +365,6 @@ TabParent::ReceiveMessage(const nsString& aMessage,
|
||||
return true;
|
||||
}
|
||||
|
||||
// nsIWebProgress
|
||||
nsresult
|
||||
TabParent::AddProgressListener(nsIWebProgressListener* aListener,
|
||||
PRUint32 aNotifyMask)
|
||||
{
|
||||
if (GetListenerInfo(aListener)) {
|
||||
// The listener is already registered!
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsWeakPtr listener = do_GetWeakReference(aListener);
|
||||
if (!listener) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
TabParentListenerInfo info(listener, aNotifyMask);
|
||||
|
||||
if (!mListenerInfoList.AppendElement(info))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabParent::RemoveProgressListener(nsIWebProgressListener *aListener)
|
||||
{
|
||||
nsAutoPtr<TabParentListenerInfo> info(GetListenerInfo(aListener));
|
||||
|
||||
return info && mListenerInfoList.RemoveElement(*info) ?
|
||||
NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
TabParentListenerInfo *
|
||||
TabParent::GetListenerInfo(nsIWebProgressListener *aListener)
|
||||
{
|
||||
PRUint32 i, count;
|
||||
TabParentListenerInfo *info;
|
||||
|
||||
nsCOMPtr<nsISupports> listener1 = do_QueryInterface(aListener);
|
||||
count = mListenerInfoList.Length();
|
||||
for (i = 0; i < count; ++i) {
|
||||
info = &mListenerInfoList[i];
|
||||
|
||||
if (info) {
|
||||
nsCOMPtr<nsISupports> listener2 = do_QueryReferent(info->mWeakListener);
|
||||
if (listener1 == listener2) {
|
||||
return info;
|
||||
}
|
||||
}
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabParent::GetDOMWindow(nsIDOMWindow **aResult)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabParent::GetIsLoadingDocument(PRBool *aIsLoadingDocument)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
// nsIAuthPromptProvider
|
||||
|
||||
// This method is largely copied from nsDocShell::GetAuthPrompt
|
||||
|
@ -48,8 +48,6 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsITabParent.h"
|
||||
#include "nsIBrowserDOMWindow.h"
|
||||
#include "nsIWebProgress.h"
|
||||
#include "nsIWebProgressListener.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsIDialogParamBlock.h"
|
||||
#include "nsIAuthPromptProvider.h"
|
||||
@ -66,34 +64,11 @@ struct JSObject;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
struct TabParentListenerInfo
|
||||
{
|
||||
TabParentListenerInfo(nsIWeakReference *aListener, unsigned long aNotifyMask)
|
||||
: mWeakListener(aListener), mNotifyMask(aNotifyMask)
|
||||
{
|
||||
}
|
||||
|
||||
TabParentListenerInfo(const TabParentListenerInfo& obj)
|
||||
: mWeakListener(obj.mWeakListener), mNotifyMask(obj.mNotifyMask)
|
||||
{
|
||||
}
|
||||
|
||||
nsWeakPtr mWeakListener;
|
||||
|
||||
PRUint32 mNotifyMask;
|
||||
};
|
||||
|
||||
inline
|
||||
bool operator==(const TabParentListenerInfo& lhs, const TabParentListenerInfo& rhs)
|
||||
{
|
||||
return &lhs == &rhs;
|
||||
}
|
||||
|
||||
class ContentDialogParent : public PContentDialogParent {};
|
||||
|
||||
class TabParent : public PBrowserParent
|
||||
, public nsITabParent
|
||||
, public nsIWebProgress
|
||||
, public nsIAuthPromptProvider
|
||||
, public nsISecureBrowserUI
|
||||
, public nsISSLStatusProvider
|
||||
@ -110,24 +85,6 @@ public:
|
||||
|
||||
virtual bool RecvMoveFocus(const bool& aForward);
|
||||
virtual bool RecvEvent(const RemoteDOMEvent& aEvent);
|
||||
virtual bool RecvNotifyProgressChange(const PRInt64& aProgress,
|
||||
const PRInt64& aProgressMax,
|
||||
const PRInt64& aTotalProgress,
|
||||
const PRInt64& aMaxTotalProgress);
|
||||
virtual bool RecvNotifyStateChange(const PRUint32& aStateFlags,
|
||||
const nsresult& aStatus);
|
||||
virtual bool RecvNotifyLocationChange(const nsCString& aUri);
|
||||
virtual bool RecvNotifyStatusChange(const nsresult& status,
|
||||
const nsString& message);
|
||||
virtual bool RecvNotifySecurityChange(const PRUint32& aState,
|
||||
const PRBool& aUseSSLStatusObject,
|
||||
const nsString& aTooltip,
|
||||
const nsCString& aSecInfoAsString);
|
||||
|
||||
virtual bool RecvRefreshAttempted(const nsCString& aURI,
|
||||
const PRInt32& aMillis,
|
||||
const bool& aSameURI,
|
||||
bool* aAllowRefresh);
|
||||
|
||||
virtual bool AnswerCreateWindow(PBrowserParent** retval);
|
||||
virtual bool RecvSyncMessage(const nsString& aMessage,
|
||||
@ -206,7 +163,6 @@ public:
|
||||
JSBool GetGlobalJSObject(JSContext* cx, JSObject** globalp);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIWEBPROGRESS
|
||||
NS_DECL_NSIAUTHPROMPTPROVIDER
|
||||
NS_DECL_NSISECUREBROWSERUI
|
||||
NS_DECL_NSISSLSTATUSPROVIDER
|
||||
@ -218,15 +174,11 @@ protected:
|
||||
const nsString& aJSON,
|
||||
nsTArray<nsString>* aJSONRetVal = nsnull);
|
||||
|
||||
TabParentListenerInfo* GetListenerInfo(nsIWebProgressListener *aListener);
|
||||
|
||||
void ActorDestroy(ActorDestroyReason why);
|
||||
|
||||
nsIDOMElement* mFrameElement;
|
||||
nsCOMPtr<nsIBrowserDOMWindow> mBrowserDOMWindow;
|
||||
|
||||
nsTArray<TabParentListenerInfo> mListenerInfoList;
|
||||
|
||||
struct DelayedDialogData
|
||||
{
|
||||
DelayedDialogData(PContentDialogParent* aDialog, PRUint32 aType,
|
||||
|
@ -318,7 +318,7 @@
|
||||
|
||||
<property name="webProgress"
|
||||
readonly="true"
|
||||
onget="return this.QueryInterface(Components.interfaces.nsIFrameLoaderOwner).frameLoader.webProgress;"/>
|
||||
onget="return this.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIWebProgress);"/>
|
||||
|
||||
<field name="_contentWindow">null</field>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user