mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-01 14:45:29 +00:00
merge backout
This commit is contained in:
commit
54c6a77ae5
@ -1097,28 +1097,6 @@ void nsDocLoader::ClearInternalProgress()
|
||||
mProgressStateFlags = nsIWebProgressListener::STATE_STOP;
|
||||
}
|
||||
|
||||
/**
|
||||
* |_code| is executed for every listener matching |_flag|
|
||||
* |listener| should be used inside |_code| as the nsIWebProgressListener var.
|
||||
*/
|
||||
#define NOTIFY_LISTENERS(_flag, _code) \
|
||||
PR_BEGIN_MACRO \
|
||||
nsCOMPtr<nsIWebProgressListener> listener; \
|
||||
ListenerArray::BackwardIterator iter(mListenerInfoList); \
|
||||
while (iter.HasMore()) { \
|
||||
nsListenerInfo &info = iter.GetNext(); \
|
||||
if (!(info.mNotifyMask & (_flag))) { \
|
||||
continue; \
|
||||
} \
|
||||
listener = do_QueryReferent(info.mWeakListener); \
|
||||
if (!listener) { \
|
||||
RemoveEmptyListeners(); \
|
||||
continue; \
|
||||
} \
|
||||
_code \
|
||||
} \
|
||||
mListenerInfoList.Compact(); \
|
||||
PR_END_MACRO
|
||||
|
||||
void nsDocLoader::FireOnProgressChange(nsDocLoader *aLoadInitiator,
|
||||
nsIRequest *request,
|
||||
@ -1145,12 +1123,29 @@ void nsDocLoader::FireOnProgressChange(nsDocLoader *aLoadInitiator,
|
||||
this, buffer.get(), aProgress, aProgressMax, aTotalProgress, aMaxTotalProgress));
|
||||
#endif /* DEBUG */
|
||||
|
||||
NOTIFY_LISTENERS(nsIWebProgress::NOTIFY_PROGRESS,
|
||||
// First notify any listeners of the new progress info...
|
||||
nsCOMPtr<nsIWebProgressListener> listener;
|
||||
ListenerArray::BackwardIterator iter(mListenerInfoList);
|
||||
|
||||
while (iter.HasMore()) {
|
||||
nsListenerInfo &info = iter.GetNext();
|
||||
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.
|
||||
RemoveEmptyListeners();
|
||||
continue;
|
||||
}
|
||||
|
||||
// XXX truncates 64-bit to 32-bit
|
||||
listener->OnProgressChange(aLoadInitiator,request,
|
||||
PRInt32(aProgress), PRInt32(aProgressMax),
|
||||
PRInt32(aTotalProgress), PRInt32(aMaxTotalProgress));
|
||||
);
|
||||
}
|
||||
mListenerInfoList.Compact();
|
||||
|
||||
// Pass the notification up to the parent...
|
||||
if (mParent) {
|
||||
@ -1195,9 +1190,26 @@ void nsDocLoader::FireOnStateChange(nsIWebProgress *aProgress,
|
||||
|
||||
NS_ASSERTION(aRequest, "Firing OnStateChange(...) notification with a NULL request!");
|
||||
|
||||
NOTIFY_LISTENERS((aStateFlags >> 16),
|
||||
// First notify any listeners of the new state info...
|
||||
nsCOMPtr<nsIWebProgressListener> listener;
|
||||
ListenerArray::BackwardIterator iter(mListenerInfoList);
|
||||
|
||||
while (iter.HasMore()) {
|
||||
nsListenerInfo &info = iter.GetNext();
|
||||
if (!(info.mNotifyMask & (aStateFlags >>16))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
listener = do_QueryReferent(info.mWeakListener);
|
||||
if (!listener) {
|
||||
// the listener went away. gracefully pull it out of the list.
|
||||
RemoveEmptyListeners();
|
||||
continue;
|
||||
}
|
||||
|
||||
listener->OnStateChange(aProgress, aRequest, aStateFlags, aStatus);
|
||||
);
|
||||
}
|
||||
mListenerInfoList.Compact();
|
||||
|
||||
// Pass the notification up to the parent...
|
||||
if (mParent) {
|
||||
@ -1212,9 +1224,26 @@ nsDocLoader::FireOnLocationChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
nsIURI *aUri)
|
||||
{
|
||||
NOTIFY_LISTENERS(nsIWebProgress::NOTIFY_LOCATION,
|
||||
// First notify any listeners of the new state info...
|
||||
nsCOMPtr<nsIWebProgressListener> listener;
|
||||
ListenerArray::BackwardIterator iter(mListenerInfoList);
|
||||
|
||||
while (iter.HasMore()) {
|
||||
nsListenerInfo &info = iter.GetNext();
|
||||
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.
|
||||
RemoveEmptyListeners();
|
||||
continue;
|
||||
}
|
||||
|
||||
listener->OnLocationChange(aWebProgress, aRequest, aUri);
|
||||
);
|
||||
}
|
||||
mListenerInfoList.Compact();
|
||||
|
||||
// Pass the notification up to the parent...
|
||||
if (mParent) {
|
||||
@ -1228,9 +1257,26 @@ nsDocLoader::FireOnStatusChange(nsIWebProgress* aWebProgress,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMessage)
|
||||
{
|
||||
NOTIFY_LISTENERS(nsIWebProgress::NOTIFY_STATUS,
|
||||
// First notify any listeners of the new state info...
|
||||
nsCOMPtr<nsIWebProgressListener> listener;
|
||||
ListenerArray::BackwardIterator iter(mListenerInfoList);
|
||||
|
||||
while (iter.HasMore()) {
|
||||
nsListenerInfo &info = iter.GetNext();
|
||||
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.
|
||||
RemoveEmptyListeners();
|
||||
continue;
|
||||
}
|
||||
|
||||
listener->OnStatusChange(aWebProgress, aRequest, aStatus, aMessage);
|
||||
);
|
||||
}
|
||||
mListenerInfoList.Compact();
|
||||
|
||||
// Pass the notification up to the parent...
|
||||
if (mParent) {
|
||||
@ -1251,8 +1297,22 @@ nsDocLoader::RefreshAttempted(nsIWebProgress* aWebProgress,
|
||||
* First notify any listeners of the refresh attempt...
|
||||
*/
|
||||
PRBool allowRefresh = PR_TRUE;
|
||||
ListenerArray::BackwardIterator iter(mListenerInfoList);
|
||||
|
||||
while (iter.HasMore()) {
|
||||
nsListenerInfo &info = iter.GetNext();
|
||||
if (!(info.mNotifyMask & nsIWebProgress::NOTIFY_REFRESH)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIWebProgressListener> listener =
|
||||
do_QueryReferent(info.mWeakListener);
|
||||
if (!listener) {
|
||||
// the listener went away. gracefully pull it out of the list.
|
||||
RemoveEmptyListeners();
|
||||
continue;
|
||||
}
|
||||
|
||||
NOTIFY_LISTENERS(nsIWebProgress::NOTIFY_REFRESH,
|
||||
nsCOMPtr<nsIWebProgressListener2> listener2 =
|
||||
do_QueryReferent(info.mWeakListener);
|
||||
if (!listener2)
|
||||
@ -1265,7 +1325,8 @@ nsDocLoader::RefreshAttempted(nsIWebProgress* aWebProgress,
|
||||
continue;
|
||||
|
||||
allowRefresh = allowRefresh && listenerAllowedRefresh;
|
||||
);
|
||||
}
|
||||
mListenerInfoList.Compact();
|
||||
|
||||
// Pass the notification up to the parent...
|
||||
if (mParent) {
|
||||
@ -1409,9 +1470,26 @@ NS_IMETHODIMP nsDocLoader::OnSecurityChange(nsISupports * aContext,
|
||||
nsCOMPtr<nsIRequest> request = do_QueryInterface(aContext);
|
||||
nsIWebProgress* webProgress = static_cast<nsIWebProgress*>(this);
|
||||
|
||||
NOTIFY_LISTENERS(nsIWebProgress::NOTIFY_SECURITY,
|
||||
// First notify any listeners of the new state info...
|
||||
nsCOMPtr<nsIWebProgressListener> listener;
|
||||
ListenerArray::BackwardIterator iter(mListenerInfoList);
|
||||
|
||||
while (iter.HasMore()) {
|
||||
nsListenerInfo &info = iter.GetNext();
|
||||
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.
|
||||
RemoveEmptyListeners();
|
||||
continue;
|
||||
}
|
||||
|
||||
listener->OnSecurityChange(webProgress, request, aState);
|
||||
);
|
||||
}
|
||||
mListenerInfoList.Compact();
|
||||
|
||||
// Pass the notification up to the parent...
|
||||
if (mParent) {
|
||||
|
@ -22,7 +22,6 @@
|
||||
*
|
||||
* Contributor(s):
|
||||
* Boris Zbarsky <bzbarsky@mit.edu> (original author)
|
||||
* Arpad Borsos <arpad.borsos@googlemail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
@ -165,7 +164,8 @@ int main(int argc, char **argv)
|
||||
arr.PrependElementUnlessExists(7);
|
||||
DO_TEST(ForwardIterator, test19Expected, );
|
||||
|
||||
DO_TEST(ForwardIterator, test19Expected,
|
||||
// Commented out because it fails; bug 474369 will fix
|
||||
/* DO_TEST(ForwardIterator, test19Expected,
|
||||
if (count == 1) {
|
||||
arr.PrependElementUnlessExists(9);
|
||||
}
|
||||
@ -173,37 +173,7 @@ int main(int argc, char **argv)
|
||||
|
||||
static int test22Expected[] = { 9, 3, 4, 7, 2, 8 };
|
||||
DO_TEST(ForwardIterator, test22Expected, );
|
||||
|
||||
// BackwardIterator
|
||||
static int test23Expected[] = { 8, 2, 7, 4, 3, 9 };
|
||||
DO_TEST(BackwardIterator, test23Expected, );
|
||||
|
||||
// Removals
|
||||
static int test24Expected[] = { 8, 2, 7, 4, 9 };
|
||||
DO_TEST(BackwardIterator, test24Expected,
|
||||
if (count == 1) arr.RemoveElementAt(1);
|
||||
);
|
||||
|
||||
// Appends
|
||||
DO_TEST(BackwardIterator, test24Expected,
|
||||
if (count == 1) arr.AppendElement(1);
|
||||
);
|
||||
|
||||
static int test26Expected[] = { 1, 8, 2, 7, 4, 9 };
|
||||
DO_TEST(BackwardIterator, test26Expected, );
|
||||
|
||||
// Prepends
|
||||
static int test27Expected[] = { 1, 8, 2, 7, 4, 9, 3 };
|
||||
DO_TEST(BackwardIterator, test27Expected,
|
||||
if (count == 1) arr.PrependElementUnlessExists(3);
|
||||
);
|
||||
|
||||
/**
|
||||
* Note: _code is executed before the call to GetNext(), it can therefore not
|
||||
* test the case of prepending when the BackwardIterator already returned the
|
||||
* first element.
|
||||
* In that case BackwardIterator does not traverse the newly prepended Element
|
||||
*/
|
||||
|
||||
*/
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user