зеркало из https://github.com/mozilla/gecko-dev.git
Bug 62589. Remove ad hoc timers from layout regression page cycler, collection regression data 200msec after page load has completed. Fix some bustage on framesets that happened when landing the new embed APIs. Fix Win32 harness to set XPCOM_DEBUG_BREAK=warn. r=karnaze,rpotts; sr=attinasi
This commit is contained in:
Родитель
b4c75043a6
Коммит
37b090af98
|
@ -538,7 +538,7 @@ PRBool
|
|||
nsFrameUtil::CompareTrees(Node* tree1, Node* tree2)
|
||||
{
|
||||
PRBool result = PR_TRUE;
|
||||
for (;;) {
|
||||
for (;; tree1 = tree1->next, tree2 = tree2->next) {
|
||||
// Make sure both nodes are non-null, or at least agree with each other
|
||||
if (nsnull == tree1) {
|
||||
if (nsnull == tree2) {
|
||||
|
@ -561,14 +561,31 @@ nsFrameUtil::CompareTrees(Node* tree1, Node* tree2)
|
|||
DumpNode(tree2, stdout, 1);
|
||||
return PR_FALSE;
|
||||
}
|
||||
if (tree1->state != tree2->state) {
|
||||
|
||||
// Ignore the XUL scrollbar frames
|
||||
static const char kScrollbarFrame[] = "ScrollbarFrame";
|
||||
if (0 == PL_strncmp(tree1->type, kScrollbarFrame, sizeof(kScrollbarFrame) - 1))
|
||||
continue;
|
||||
|
||||
// We'll ignore these flags for the purposes of comparing frame state:
|
||||
//
|
||||
// NS_FRAME_EXTERNAL_REFERENCE
|
||||
// because this is set by the event state manager or the
|
||||
// caret code when a frame is focused. Depending on whether
|
||||
// or not the regression tests are run as the focused window
|
||||
// will make this value vary randomly.
|
||||
#define IRRELEVANT_FRAME_STATE_FLAGS NS_FRAME_EXTERNAL_REFERENCE
|
||||
|
||||
#define FRAME_STATE_MASK (~(IRRELEVANT_FRAME_STATE_FLAGS))
|
||||
|
||||
if ((tree1->state & FRAME_STATE_MASK) != (tree2->state & FRAME_STATE_MASK)) {
|
||||
printf("frame state mismatch: 0x%x vs. 0x%x\n",
|
||||
tree1->state, tree2->state);
|
||||
printf("Node 1:\n");
|
||||
DumpNode(tree1, stdout, 1);
|
||||
printf("Node 2:\n");
|
||||
DumpNode(tree2, stdout, 1);
|
||||
//result = PR_FALSE; // we have a non-critical failure, so remember that but continue
|
||||
result = PR_FALSE; // we have a non-critical failure, so remember that but continue
|
||||
}
|
||||
if (tree1->bbox != tree2->bbox) {
|
||||
printf("frame bbox mismatch: %d,%d,%d,%d vs. %d,%d,%d,%d\n",
|
||||
|
@ -628,10 +645,6 @@ nsFrameUtil::CompareTrees(Node* tree1, Node* tree2)
|
|||
list1 = list1->next;
|
||||
list2 = list2->next;
|
||||
}
|
||||
|
||||
// Check siblings next
|
||||
tree1 = tree1->next;
|
||||
tree2 = tree2->next;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -538,7 +538,7 @@ PRBool
|
|||
nsFrameUtil::CompareTrees(Node* tree1, Node* tree2)
|
||||
{
|
||||
PRBool result = PR_TRUE;
|
||||
for (;;) {
|
||||
for (;; tree1 = tree1->next, tree2 = tree2->next) {
|
||||
// Make sure both nodes are non-null, or at least agree with each other
|
||||
if (nsnull == tree1) {
|
||||
if (nsnull == tree2) {
|
||||
|
@ -561,14 +561,31 @@ nsFrameUtil::CompareTrees(Node* tree1, Node* tree2)
|
|||
DumpNode(tree2, stdout, 1);
|
||||
return PR_FALSE;
|
||||
}
|
||||
if (tree1->state != tree2->state) {
|
||||
|
||||
// Ignore the XUL scrollbar frames
|
||||
static const char kScrollbarFrame[] = "ScrollbarFrame";
|
||||
if (0 == PL_strncmp(tree1->type, kScrollbarFrame, sizeof(kScrollbarFrame) - 1))
|
||||
continue;
|
||||
|
||||
// We'll ignore these flags for the purposes of comparing frame state:
|
||||
//
|
||||
// NS_FRAME_EXTERNAL_REFERENCE
|
||||
// because this is set by the event state manager or the
|
||||
// caret code when a frame is focused. Depending on whether
|
||||
// or not the regression tests are run as the focused window
|
||||
// will make this value vary randomly.
|
||||
#define IRRELEVANT_FRAME_STATE_FLAGS NS_FRAME_EXTERNAL_REFERENCE
|
||||
|
||||
#define FRAME_STATE_MASK (~(IRRELEVANT_FRAME_STATE_FLAGS))
|
||||
|
||||
if ((tree1->state & FRAME_STATE_MASK) != (tree2->state & FRAME_STATE_MASK)) {
|
||||
printf("frame state mismatch: 0x%x vs. 0x%x\n",
|
||||
tree1->state, tree2->state);
|
||||
printf("Node 1:\n");
|
||||
DumpNode(tree1, stdout, 1);
|
||||
printf("Node 2:\n");
|
||||
DumpNode(tree2, stdout, 1);
|
||||
//result = PR_FALSE; // we have a non-critical failure, so remember that but continue
|
||||
result = PR_FALSE; // we have a non-critical failure, so remember that but continue
|
||||
}
|
||||
if (tree1->bbox != tree2->bbox) {
|
||||
printf("frame bbox mismatch: %d,%d,%d,%d vs. %d,%d,%d,%d\n",
|
||||
|
@ -628,10 +645,6 @@ nsFrameUtil::CompareTrees(Node* tree1, Node* tree2)
|
|||
list1 = list1->next;
|
||||
list2 = list2->next;
|
||||
}
|
||||
|
||||
// Check siblings next
|
||||
tree1 = tree1->next;
|
||||
tree2 = tree2->next;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -5,13 +5,13 @@ if "%1"=="baseline" goto baseline
|
|||
if not exist verify mkdir verify
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -o s:\mozilla\layout\html\tests\block\bugs\verify\ -rd s:\mozilla\layout\html\tests\block\bugs -f s:\mozilla\layout\html\tests\block\bugs\file_list.txt
|
||||
REM some files require asynch loading, so they need a short delay to give good results
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -d 5 -o s:\mozilla\layout\html\tests\block\bugs\verify\ -rd s:\mozilla\layout\html\tests\block\bugs -f s:\mozilla\layout\html\tests\block\bugs\file_list_slow.txt
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -o s:\mozilla\layout\html\tests\block\bugs\verify\ -rd s:\mozilla\layout\html\tests\block\bugs -f s:\mozilla\layout\html\tests\block\bugs\file_list_slow.txt
|
||||
goto done
|
||||
|
||||
:baseline
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -o s:\mozilla\layout\html\tests\block\bugs\ -f s:\mozilla\layout\html\tests\block\bugs\file_list.txt
|
||||
REM some files require asynch loading, so they need a short delay to give good results
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -d 5 -o s:\mozilla\layout\html\tests\block\bugs\ -f s:\mozilla\layout\html\tests\block\bugs\file_list_slow.txt
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -o s:\mozilla\layout\html\tests\block\bugs\ -f s:\mozilla\layout\html\tests\block\bugs\file_list_slow.txt
|
||||
goto done
|
||||
|
||||
:error
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
@echo off
|
||||
|
||||
rem Treat assertions as warnings so the tests don't choke waiting on a
|
||||
rem dialog box
|
||||
|
||||
set XPCOM_DEBUG_BREAK_SAVE=%XPCOM_DEBUG_BREAK%
|
||||
set XPCOM_DEBUG_BREAK=warn
|
||||
|
||||
cd base
|
||||
call rtest.bat %1
|
||||
|
||||
|
@ -8,3 +14,5 @@ call rtest.bat %1
|
|||
|
||||
cd ..
|
||||
|
||||
set XPCOM_DEBUG_BREAK=%XPCOM_DEBUG_BREAK_SAVE%
|
||||
|
||||
|
|
|
@ -16,6 +16,10 @@ nodots() {
|
|||
|
||||
dirs="base bugs ../table/core ../table/viewer_tests ../table/bugs ../table/marvin ../table/other ../table/dom"
|
||||
|
||||
# This doesn't appear to work on Linux right now; needs support for a
|
||||
# null driver, perhaps?
|
||||
#extra_dirs="../table/printing"
|
||||
|
||||
#extra_dirs="net/HTML_Chars net/W3C net/baron net/boxAcidTest net/glazman net/mozilla"
|
||||
|
||||
DEPTH="../../../../.."
|
||||
|
|
|
@ -3,37 +3,88 @@
|
|||
# create test file to use first; since we don't know where the tree
|
||||
# is, and we need full pathnames in the file, we create it on the fly.
|
||||
|
||||
testsfile=/tmp/$$-tests.txt
|
||||
case $1 in
|
||||
baseline|verify)
|
||||
MODE=$1
|
||||
;;
|
||||
|
||||
cp /dev/null $testsfile
|
||||
clean)
|
||||
rm -r -f verify baseline
|
||||
exit 0
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: $0 baseline|verify|clean"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
run_tests() {
|
||||
print_flags=
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
-m) shift
|
||||
mode=$1
|
||||
;;
|
||||
|
||||
-p) print_flags="-Prt 1"
|
||||
;;
|
||||
|
||||
-f) shift
|
||||
tests_file=$1
|
||||
;;
|
||||
|
||||
*) echo "unknown option $1 to run_tests()"
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if [ -z "$tests_file" ]; then
|
||||
echo "no tests file specified to run_tests()"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$mode" = "baseline" ]; then
|
||||
rm -r -f baseline
|
||||
nmkdir baseline
|
||||
echo
|
||||
echo $MOZ_TEST_VIEWER $print_flags -o baseline/ -f $tests_file
|
||||
$MOZ_TEST_VIEWER $print_flags -o baseline/ -f $tests_file
|
||||
elif [ "$mode" = "verify" ]; then
|
||||
rm -r -f verify
|
||||
mkdir verify
|
||||
echo
|
||||
echo $MOZ_TEST_VIEWER $print_flags -o baseline/ -f $tests_file
|
||||
$MOZ_TEST_VIEWER $print_flags -o verify/ -rd baseline/ -f $tests_file
|
||||
else
|
||||
echo "no mode specified to run_tests()"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
TESTS_FILE=/tmp/$$-tests.txt
|
||||
|
||||
cp /dev/null $TESTS_FILE
|
||||
|
||||
for FILE in `ls file_list.txt file_list[0-9].txt 2> /dev/null`; do
|
||||
egrep -v "^#" < $FILE \
|
||||
| sed -e "s@file:///s\(:\||\)@file://$MOZ_TEST_BASE@" \
|
||||
>> $testsfile
|
||||
>> $TESTS_FILE
|
||||
done
|
||||
|
||||
if [ \! -s $testfile ]; then
|
||||
echo "WARNING: No file lists found in `pwd`"
|
||||
rm -f $testsfile
|
||||
return 0
|
||||
if [ -s $TESTS_FILE ]; then
|
||||
run_tests -m $MODE -f $TESTS_FILE
|
||||
fi
|
||||
|
||||
if test "$1"x = "baselinex"; then
|
||||
rm -r -f baseline
|
||||
mkdir baseline
|
||||
echo
|
||||
echo $MOZ_TEST_VIEWER -o baseline/ -f $testsfile
|
||||
$MOZ_TEST_VIEWER -o baseline/ -f $testsfile
|
||||
elif test "$1"x = "verifyx"; then
|
||||
rm -r -f verify
|
||||
mkdir verify
|
||||
echo
|
||||
echo $MOZ_TEST_VIEWER -o baseline/ -f $testsfile
|
||||
$MOZ_TEST_VIEWER -o verify/ -rd baseline/ -f $testsfile
|
||||
elif test "$1"x = "cleanx"; then
|
||||
rm -r -f verify baseline
|
||||
else
|
||||
echo "Usage: $0 baseline|verify|clean"
|
||||
if [ -f file_list_printing.txt ]; then
|
||||
egrep -v "^#" < file_list_printing.txt \
|
||||
| sed -e "s@file:///s\(:\||\)@file://$MOZ_TEST_BASE@" \
|
||||
> $TESTS_FILE
|
||||
|
||||
if [ -s $TESTS_FILE ]; then
|
||||
run_tests -p -m $MODE -f $TESTS_FILE
|
||||
fi
|
||||
fi
|
||||
rm -f $testsfile
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ The bug showed horizontal scroll bars when resized
|
|||
<BR>
|
||||
<TABLE BORDER="0" WIDTH="100%" CELLSPACING="0" CELLPADDING="0">
|
||||
<TR>
|
||||
<TD HEIGHT="90" BGCOLOR="#FFFFFF"><IMG BORDER="0" SRC="../images/aboutHeader.gif" WIDTH="194" HEIGHT="90" ALIGN="LEFT"><IMG BORDER="0" SRC="../images/blimp.gif" WIDTH="133" HEIGHT="90" ALIGN="RIGHT"></TD>
|
||||
<TD HEIGHT="90" BGCOLOR="#FFFFFF"><IMG BORDER="0" SRC="../images/aboutHeader.gif" WIDTH="194" HEIGHT="90" ALIGN="LEFT"><IMG BORDER="0" SRC="../images/ant.jpg" WIDTH="133" HEIGHT="90" ALIGN="RIGHT"></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
|
|
|
@ -11,23 +11,23 @@ if %1==baseline goto baseline
|
|||
|
||||
:verify
|
||||
if not exist verify mkdir verify
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -d 1 -o s:\mozilla\layout\html\tests\table\bugs\verify\ -rd s:\mozilla\layout\html\tests\table\bugs -f s:\mozilla\layout\html\tests\table\bugs\file_list1.txt
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -d 1 -o s:\mozilla\layout\html\tests\table\bugs\verify\ -rd s:\mozilla\layout\html\tests\table\bugs -f s:\mozilla\layout\html\tests\table\bugs\file_list2.txt
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -d 1 -o s:\mozilla\layout\html\tests\table\bugs\verify\ -rd s:\mozilla\layout\html\tests\table\bugs -f s:\mozilla\layout\html\tests\table\bugs\file_list3.txt
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -d 1 -o s:\mozilla\layout\html\tests\table\bugs\verify\ -rd s:\mozilla\layout\html\tests\table\bugs -f s:\mozilla\layout\html\tests\table\bugs\file_list4.txt
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -d 1 -o s:\mozilla\layout\html\tests\table\bugs\verify\ -rd s:\mozilla\layout\html\tests\table\bugs -f s:\mozilla\layout\html\tests\table\bugs\file_list5.txt
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -d 1 -o s:\mozilla\layout\html\tests\table\bugs\verify\ -rd s:\mozilla\layout\html\tests\table\bugs -f s:\mozilla\layout\html\tests\table\bugs\file_list6.txt
|
||||
REM s:\mozilla\dist\win32_d.obj\bin\viewer -Prt 1 -d 5 -o s:\mozilla\layout\html\tests\table\bugs\verify\ -rd s:\mozilla\layout\html\tests\table\bugs -f s:\mozilla\layout\html\tests\table\bugs\file_list_printing.txt
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -o s:\mozilla\layout\html\tests\table\bugs\verify\ -rd s:\mozilla\layout\html\tests\table\bugs -f s:\mozilla\layout\html\tests\table\bugs\file_list1.txt
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -o s:\mozilla\layout\html\tests\table\bugs\verify\ -rd s:\mozilla\layout\html\tests\table\bugs -f s:\mozilla\layout\html\tests\table\bugs\file_list2.txt
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -o s:\mozilla\layout\html\tests\table\bugs\verify\ -rd s:\mozilla\layout\html\tests\table\bugs -f s:\mozilla\layout\html\tests\table\bugs\file_list3.txt
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -o s:\mozilla\layout\html\tests\table\bugs\verify\ -rd s:\mozilla\layout\html\tests\table\bugs -f s:\mozilla\layout\html\tests\table\bugs\file_list4.txt
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -o s:\mozilla\layout\html\tests\table\bugs\verify\ -rd s:\mozilla\layout\html\tests\table\bugs -f s:\mozilla\layout\html\tests\table\bugs\file_list5.txt
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -o s:\mozilla\layout\html\tests\table\bugs\verify\ -rd s:\mozilla\layout\html\tests\table\bugs -f s:\mozilla\layout\html\tests\table\bugs\file_list6.txt
|
||||
REM s:\mozilla\dist\win32_d.obj\bin\viewer -Prt 1 -o s:\mozilla\layout\html\tests\table\bugs\verify\ -rd s:\mozilla\layout\html\tests\table\bugs -f s:\mozilla\layout\html\tests\table\bugs\file_list_printing.txt
|
||||
goto done
|
||||
|
||||
:baseline
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -d 1 -o s:\mozilla\layout\html\tests\table\bugs\ -f s:\mozilla\layout\html\tests\table\bugs\file_list1.txt
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -d 1 -o s:\mozilla\layout\html\tests\table\bugs\ -f s:\mozilla\layout\html\tests\table\bugs\file_list2.txt
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -d 1 -o s:\mozilla\layout\html\tests\table\bugs\ -f s:\mozilla\layout\html\tests\table\bugs\file_list3.txt
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -d 1 -o s:\mozilla\layout\html\tests\table\bugs\ -f s:\mozilla\layout\html\tests\table\bugs\file_list4.txt
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -d 1 -o s:\mozilla\layout\html\tests\table\bugs\ -f s:\mozilla\layout\html\tests\table\bugs\file_list5.txt
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -d 1 -o s:\mozilla\layout\html\tests\table\bugs\ -f s:\mozilla\layout\html\tests\table\bugs\file_list6.txt
|
||||
REM s:\mozilla\dist\win32_d.obj\bin\viewer -Prt 1 -d 5 -o s:\mozilla\layout\html\tests\table\bugs\verify\ -rd s:\mozilla\layout\html\tests\table\bugs -f s:\mozilla\layout\html\tests\table\bugs\file_list_printing.txt
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -o s:\mozilla\layout\html\tests\table\bugs\ -f s:\mozilla\layout\html\tests\table\bugs\file_list1.txt
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -o s:\mozilla\layout\html\tests\table\bugs\ -f s:\mozilla\layout\html\tests\table\bugs\file_list2.txt
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -o s:\mozilla\layout\html\tests\table\bugs\ -f s:\mozilla\layout\html\tests\table\bugs\file_list3.txt
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -o s:\mozilla\layout\html\tests\table\bugs\ -f s:\mozilla\layout\html\tests\table\bugs\file_list4.txt
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -o s:\mozilla\layout\html\tests\table\bugs\ -f s:\mozilla\layout\html\tests\table\bugs\file_list5.txt
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -o s:\mozilla\layout\html\tests\table\bugs\ -f s:\mozilla\layout\html\tests\table\bugs\file_list6.txt
|
||||
REM s:\mozilla\dist\win32_d.obj\bin\viewer -Prt 1 -o s:\mozilla\layout\html\tests\table\bugs\verify\ -rd s:\mozilla\layout\html\tests\table\bugs -f s:\mozilla\layout\html\tests\table\bugs\file_list_printing.txt
|
||||
goto done
|
||||
|
||||
:error
|
||||
|
|
|
@ -3,12 +3,12 @@ if %1==baseline goto baseline
|
|||
|
||||
:verify
|
||||
if not exist verify mkdir verify
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -d 1 -o s:\mozilla\layout\html\tests\table\core\verify\ -rd s:\mozilla\layout\html\tests\table\core -f s:\mozilla\layout\html\tests\table\core\file_list.txt
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -o s:\mozilla\layout\html\tests\table\core\verify\ -rd s:\mozilla\layout\html\tests\table\core -f s:\mozilla\layout\html\tests\table\core\file_list.txt
|
||||
goto done
|
||||
|
||||
:baseline
|
||||
delay=1
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -d 1 -o s:\mozilla\layout\html\tests\table\core\ -f s:\mozilla\layout\html\tests\table\core\file_list.txt
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -o s:\mozilla\layout\html\tests\table\core\ -f s:\mozilla\layout\html\tests\table\core\file_list.txt
|
||||
goto done
|
||||
|
||||
:error
|
||||
|
|
|
@ -3,11 +3,11 @@ if %1==baseline goto baseline
|
|||
|
||||
:verify
|
||||
if not exist verify mkdir verify
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -d 1 -o s:\mozilla\layout\html\tests\table\dom\verify\ -rd s:\mozilla\layout\html\tests\table\dom -f s:\mozilla\layout\html\tests\table\dom\file_list.txt
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -o s:\mozilla\layout\html\tests\table\dom\verify\ -rd s:\mozilla\layout\html\tests\table\dom -f s:\mozilla\layout\html\tests\table\dom\file_list.txt
|
||||
goto done
|
||||
|
||||
:baseline
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -d 1 -o s:\mozilla\layout\html\tests\table\dom\ -f s:\mozilla\layout\html\tests\table\dom\file_list.txt
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -o s:\mozilla\layout\html\tests\table\dom\ -f s:\mozilla\layout\html\tests\table\dom\file_list.txt
|
||||
goto done
|
||||
|
||||
:error
|
||||
|
|
|
@ -3,11 +3,11 @@ if %1==baseline goto baseline
|
|||
|
||||
:verify
|
||||
if not exist verify mkdir verify
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -d 1 -o s:\mozilla\layout\html\tests\table\marvin\verify\ -rd s:\mozilla\layout\html\tests\table\marvin -f s:\mozilla\layout\html\tests\table\marvin\file_list.txt
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -o s:\mozilla\layout\html\tests\table\marvin\verify\ -rd s:\mozilla\layout\html\tests\table\marvin -f s:\mozilla\layout\html\tests\table\marvin\file_list.txt
|
||||
goto done
|
||||
|
||||
:baseline
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -d 1 -o s:\mozilla\layout\html\tests\table\marvin\ -f s:\mozilla\layout\html\tests\table\marvin\file_list.txt
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -o s:\mozilla\layout\html\tests\table\marvin\ -f s:\mozilla\layout\html\tests\table\marvin\file_list.txt
|
||||
goto done
|
||||
|
||||
:error
|
||||
|
|
|
@ -3,11 +3,11 @@ if %1==baseline goto baseline
|
|||
|
||||
:verify
|
||||
if not exist verify mkdir verify
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -d 1 -o s:\mozilla\layout\html\tests\table\other\verify\ -rd s:\mozilla\layout\html\tests\table\other -f s:\mozilla\layout\html\tests\table\other\file_list.txt
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -o s:\mozilla\layout\html\tests\table\other\verify\ -rd s:\mozilla\layout\html\tests\table\other -f s:\mozilla\layout\html\tests\table\other\file_list.txt
|
||||
goto done
|
||||
|
||||
:baseline
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -d 1 -o s:\mozilla\layout\html\tests\table\other\ -f s:\mozilla\layout\html\tests\table\other\file_list.txt
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -o s:\mozilla\layout\html\tests\table\other\ -f s:\mozilla\layout\html\tests\table\other\file_list.txt
|
||||
goto done
|
||||
|
||||
:error
|
||||
|
|
|
@ -11,11 +11,11 @@ if %1==baseline goto baseline
|
|||
|
||||
:verify
|
||||
if not exist verify mkdir verify
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -Prt 1 -d 5 -o s:\mozilla\layout\html\tests\table\printing\verify\ -rd s:\mozilla\layout\html\tests\table\printing -f s:\mozilla\layout\html\tests\table\printing\file_list.txt
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -Prt 1 -o s:\mozilla\layout\html\tests\table\printing\verify\ -rd s:\mozilla\layout\html\tests\table\printing -f s:\mozilla\layout\html\tests\table\printing\file_list_printing.txt
|
||||
goto done
|
||||
|
||||
:baseline
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -Prt 1 -d 5 -o s:\mozilla\layout\html\tests\table\printing\ -rd s:\mozilla\layout\html\tests\table\printing -f s:\mozilla\layout\html\tests\table\printing\file_list.txt
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -Prt 1 -o s:\mozilla\layout\html\tests\table\printing\ -rd s:\mozilla\layout\html\tests\table\printing -f s:\mozilla\layout\html\tests\table\printing\file_list_printing.txt
|
||||
goto done
|
||||
|
||||
:error
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
@echo off
|
||||
|
||||
rem Treat assertions as warnings so the tests don't choke waiting on a
|
||||
rem dialog box
|
||||
|
||||
set XPCOM_DEBUG_BREAK_SAVE=%XPCOM_DEBUG_BREAK%
|
||||
set XPCOM_DEBUG_BREAK=warn
|
||||
|
||||
cd core
|
||||
call rtest.bat %1
|
||||
|
||||
|
@ -23,3 +29,4 @@ call rtest.bat %1
|
|||
|
||||
cd ..
|
||||
|
||||
set XPCOM_DEBUG_BREAK=%XPCOM_DEBUG_BREAK_SAVE%
|
||||
|
|
|
@ -3,11 +3,11 @@ if %1==baseline goto baseline
|
|||
|
||||
:verify
|
||||
if not exist verify mkdir verify
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -d 1 -o s:\mozilla\layout\html\tests\table\viewer_tests\verify\ -rd s:\mozilla\layout\html\tests\table\viewer_tests -f s:\mozilla\layout\html\tests\table\viewer_tests\file_list.txt
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -o s:\mozilla\layout\html\tests\table\viewer_tests\verify\ -rd s:\mozilla\layout\html\tests\table\viewer_tests -f s:\mozilla\layout\html\tests\table\viewer_tests\file_list.txt
|
||||
goto done
|
||||
|
||||
:baseline
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -d 1 -o s:\mozilla\layout\html\tests\table\viewer_tests\ -f s:\mozilla\layout\html\tests\table\viewer_tests\file_list.txt
|
||||
s:\mozilla\dist\win32_d.obj\bin\viewer -o s:\mozilla\layout\html\tests\table\viewer_tests\ -f s:\mozilla\layout\html\tests\table\viewer_tests\file_list.txt
|
||||
goto done
|
||||
|
||||
:error
|
||||
|
|
|
@ -378,14 +378,6 @@ nsViewerApp::Exit()
|
|||
mAppShell->Exit();
|
||||
NS_RELEASE(mAppShell);
|
||||
}
|
||||
if (mEventQService) {
|
||||
printf("Going to destroy the event queue\n");
|
||||
rv = mEventQService->DestroyThreadEventQueue();
|
||||
if (nsnull != mEventQService) {
|
||||
nsServiceManager::ReleaseService(kEventQueueServiceCID, mEventQService);
|
||||
mEventQService = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
// Unregister the test form processor registered in nsViewerApp::SetupRegistry
|
||||
rv = nsServiceManager::UnregisterService(kFormProcessorCID);
|
||||
|
@ -541,16 +533,6 @@ nsViewerApp::ProcessArguments(int argc, char** argv)
|
|||
}
|
||||
mCrawler->SetOutputDir(NS_ConvertASCIItoUCS2(argv[i]));
|
||||
}
|
||||
else if (PL_strcmp(argv[i], "-d") == 0) {
|
||||
int delay;
|
||||
i++;
|
||||
if (i>=argc || 1!=sscanf(argv[i], "%d", &delay))
|
||||
{
|
||||
PrintHelpInfo(argv);
|
||||
exit(-1);
|
||||
}
|
||||
mCrawler->SetDelay(delay);
|
||||
}
|
||||
else if (PL_strcmp(argv[i], "-w") == 0) {
|
||||
int width;
|
||||
i++;
|
||||
|
|
|
@ -165,18 +165,6 @@ AtomHashTable::Remove(nsIAtom* aKey)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
PRInt32
|
||||
GetDelay(nsString& aURL)
|
||||
{
|
||||
PRInt32 delay = -1;
|
||||
if (aURL.Find("delay:=") >= 0) {
|
||||
char buf[128];
|
||||
PRInt32 offset = aURL.Find("=") + 1;
|
||||
aURL.ToCString(&buf[0], 128, offset);
|
||||
sscanf(&buf[0], "%d", &delay);
|
||||
}
|
||||
return delay;
|
||||
}
|
||||
|
||||
nsWebCrawler::nsWebCrawler(nsViewerApp* aViewer)
|
||||
: mHaveURLList(PR_FALSE),
|
||||
|
@ -189,8 +177,7 @@ nsWebCrawler::nsWebCrawler(nsViewerApp* aViewer)
|
|||
mCrawl = PR_FALSE;
|
||||
mJiggleLayout = PR_FALSE;
|
||||
mPostExit = PR_FALSE;
|
||||
mDelay = 0;
|
||||
mLastDelay = 0;
|
||||
mDelay = 200 /*msec*/; // XXXwaterson straigt outta my arse
|
||||
mMaxPages = -1;
|
||||
mRecord = nsnull;
|
||||
mLinkTag = getter_AddRefs(NS_NewAtom("a"));
|
||||
|
@ -206,7 +193,6 @@ nsWebCrawler::nsWebCrawler(nsViewerApp* aViewer)
|
|||
mPrinterTestType = 0;
|
||||
mRegressionOutputLevel = 0; // full output
|
||||
mIncludeStyleInfo = PR_TRUE;
|
||||
mLastWebShell = nsnull;
|
||||
}
|
||||
|
||||
static void FreeStrings(nsVoidArray& aArray)
|
||||
|
@ -223,7 +209,6 @@ nsWebCrawler::~nsWebCrawler()
|
|||
{
|
||||
FreeStrings(mSafeDomains);
|
||||
FreeStrings(mAvoidDomains);
|
||||
NS_IF_RELEASE(mLastWebShell);
|
||||
NS_IF_RELEASE(mBrowser);
|
||||
delete mVisited;
|
||||
}
|
||||
|
@ -233,23 +218,27 @@ NS_IMPL_ISUPPORTS2(nsWebCrawler,
|
|||
nsISupportsWeakReference)
|
||||
|
||||
void
|
||||
nsWebCrawler::DumpRegressionData(nsIWebShell* aWebShell,
|
||||
nsIURI* aURL)
|
||||
nsWebCrawler::DumpRegressionData()
|
||||
{
|
||||
#ifdef NS_DEBUG
|
||||
nsCOMPtr<nsIWebShell> webshell;
|
||||
mBrowser->GetWebShell(*getter_AddRefs(webshell));
|
||||
if (! webshell)
|
||||
return;
|
||||
|
||||
if (mOutputDir.Length() > 0) {
|
||||
nsIPresShell* shell = GetPresShell(aWebShell);
|
||||
nsIPresShell* shell = GetPresShell(webshell);
|
||||
if (!shell) return;
|
||||
if ( mPrinterTestType > 0 ) {
|
||||
nsCOMPtr <nsIContentViewer> viewer;
|
||||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(aWebShell));
|
||||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(webshell));
|
||||
docShell->GetContentViewer(getter_AddRefs(viewer));
|
||||
|
||||
if (viewer){
|
||||
nsCOMPtr<nsIContentViewerFile> viewerFile = do_QueryInterface(viewer);
|
||||
if (viewerFile) {
|
||||
nsAutoString regressionFileName;
|
||||
FILE *fp = GetOutputFile(aURL, regressionFileName);
|
||||
FILE *fp = GetOutputFile(mLastURL, regressionFileName);
|
||||
|
||||
switch (mPrinterTestType) {
|
||||
case 1:
|
||||
|
@ -280,7 +269,7 @@ nsWebCrawler::DumpRegressionData(nsIWebShell* aWebShell,
|
|||
|
||||
if (mOutputDir.Length() > 0) {
|
||||
nsAutoString regressionFileName;
|
||||
FILE *fp = GetOutputFile(aURL, regressionFileName);
|
||||
FILE *fp = GetOutputFile(mLastURL, regressionFileName);
|
||||
if (fp) {
|
||||
nsIFrameDebug* fdbg;
|
||||
if (NS_SUCCEEDED(root->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**) &fdbg))) {
|
||||
|
@ -297,7 +286,7 @@ nsWebCrawler::DumpRegressionData(nsIWebShell* aWebShell,
|
|||
}
|
||||
else {
|
||||
char* file;
|
||||
(void)aURL->GetPath(&file);
|
||||
(void)mLastURL->GetPath(&file);
|
||||
printf("could not open output file for %s\n", file);
|
||||
nsCRT::free(file);
|
||||
}
|
||||
|
@ -315,169 +304,166 @@ nsWebCrawler::DumpRegressionData(nsIWebShell* aWebShell,
|
|||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
nsWebCrawler::LoadNextURLCallback(nsITimer *aTimer, void *aClosure)
|
||||
{
|
||||
nsWebCrawler* self = (nsWebCrawler*) aClosure;
|
||||
self->DumpRegressionData();
|
||||
self->LoadNextURL(PR_FALSE);
|
||||
}
|
||||
|
||||
void
|
||||
nsWebCrawler::QueueExitCallback(nsITimer *aTimer, void *aClosure)
|
||||
{
|
||||
nsWebCrawler* self = (nsWebCrawler*) aClosure;
|
||||
self->DumpRegressionData();
|
||||
self->QueueExit();
|
||||
}
|
||||
|
||||
// nsIWebProgressListener implementation
|
||||
NS_IMETHODIMP
|
||||
nsWebCrawler::OnStateChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest *aRequest,
|
||||
PRInt32 progressStateFlags,
|
||||
nsresult aStatus) {
|
||||
if (progressStateFlags & nsIWebProgressListener::STATE_IS_DOCUMENT) {
|
||||
if (progressStateFlags & nsIWebProgressListener::STATE_START) {
|
||||
if (mDelay > 0) {
|
||||
if (mLastWebShell && mLastURL) {
|
||||
DumpRegressionData(mLastWebShell, mLastURL);
|
||||
}
|
||||
}
|
||||
NS_IF_RELEASE(mLastWebShell);
|
||||
mBrowser->GetWebShell(mLastWebShell);
|
||||
nsIRequest* aRequest,
|
||||
PRInt32 progressStateFlags,
|
||||
nsresult aStatus)
|
||||
{
|
||||
// Make sure that we're being notified for _our_ shell, and not some
|
||||
// subshell that's been created e.g. for an IFRAME.
|
||||
nsCOMPtr<nsIWebShell> shell;
|
||||
mBrowser->GetWebShell(*getter_AddRefs(shell));
|
||||
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(shell);
|
||||
if (docShell) {
|
||||
nsCOMPtr<nsIWebProgress> progress = do_GetInterface(docShell);
|
||||
if (aWebProgress != progress)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIChannel> channel(do_QueryInterface(aRequest));
|
||||
if (!channel) {
|
||||
NS_ASSERTION(channel, "no channel avail");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
(void) channel->GetURI(getter_AddRefs(uri));
|
||||
mLastURL = uri;
|
||||
}
|
||||
|
||||
if (progressStateFlags & nsIWebProgressListener::STATE_STOP) {
|
||||
nsresult rv;
|
||||
PRTime endLoadTime = PR_Now();
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest);
|
||||
rv = channel->GetURI(getter_AddRefs(uri));
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Ignore this notification unless its for the current url. That way
|
||||
// we skip over embedded webshell notifications (e.g. frame cells,
|
||||
// iframes, etc.)
|
||||
char* spec;
|
||||
uri->GetSpec(&spec);
|
||||
if (!spec) {
|
||||
nsCRT::free(spec);
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
nsCOMPtr<nsIURI> currentURL;
|
||||
rv = NS_NewURI(getter_AddRefs(currentURL), mCurrentURL);
|
||||
if (NS_FAILED(rv)) {
|
||||
nsCRT::free(spec);
|
||||
return rv;
|
||||
}
|
||||
char* spec2;
|
||||
currentURL->GetSpec(&spec2);
|
||||
if (!spec2) {
|
||||
nsCRT::free(spec);
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
if (PL_strcmp(spec, spec2)) {
|
||||
nsCRT::free(spec);
|
||||
nsCRT::free(spec2);
|
||||
return NS_OK;
|
||||
}
|
||||
nsCRT::free(spec2);
|
||||
|
||||
char buf[400];
|
||||
PRTime delta, cvt, rounder;
|
||||
LL_I2L(cvt, 1000);
|
||||
LL_I2L(rounder, 499);
|
||||
LL_SUB(delta, endLoadTime, mStartLoad);
|
||||
LL_ADD(delta, delta, rounder);
|
||||
LL_DIV(delta, delta, cvt);
|
||||
PR_snprintf(buf, sizeof(buf), "%s: done loading (%lld msec)",
|
||||
spec, delta);
|
||||
printf("%s\n", buf);
|
||||
nsCRT::free(spec);
|
||||
|
||||
// Make sure the document bits make it to the screen at least once
|
||||
nsIPresShell* shell = GetPresShell();
|
||||
if (nsnull != shell) {
|
||||
nsCOMPtr<nsIViewManager> vm;
|
||||
shell->GetViewManager(getter_AddRefs(vm));
|
||||
if (vm) {
|
||||
nsIView* rootView;
|
||||
vm->GetRootView(rootView);
|
||||
vm->UpdateView(rootView, NS_VMREFRESH_IMMEDIATE);
|
||||
}
|
||||
if (0 == mDelay) {
|
||||
nsIWebShell* webShell;
|
||||
mBrowser->GetWebShell(webShell);
|
||||
if (webShell) {
|
||||
DumpRegressionData(webShell, uri);
|
||||
NS_RELEASE(webShell);
|
||||
}
|
||||
}
|
||||
if (mJiggleLayout) {
|
||||
nsRect r;
|
||||
mBrowser->GetContentBounds(r);
|
||||
nscoord oldWidth = r.width;
|
||||
while (r.width > 100) {
|
||||
r.width -= 10;
|
||||
mBrowser->SizeWindowTo(r.width, r.height, PR_FALSE, PR_FALSE);
|
||||
}
|
||||
while (r.width < oldWidth) {
|
||||
r.width += 10;
|
||||
mBrowser->SizeWindowTo(r.width, r.height, PR_FALSE, PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
if (mCrawl) {
|
||||
FindMoreURLs();
|
||||
}
|
||||
|
||||
if (0 == mDelay) {
|
||||
LoadNextURL(PR_TRUE);
|
||||
}
|
||||
NS_RELEASE(shell);
|
||||
}
|
||||
else {
|
||||
fputs("null pres shell\n", stdout);
|
||||
}
|
||||
|
||||
if (mPostExit && (0 == mQueuedLoadURLs) && (0==mPendingURLs.Count())) {
|
||||
QueueExit();
|
||||
}
|
||||
}
|
||||
}
|
||||
// Make sure that we're being notified for the whole document, not a
|
||||
// sub-load.
|
||||
if (! (progressStateFlags & nsIWebProgressListener::STATE_IS_DOCUMENT))
|
||||
return NS_OK;
|
||||
|
||||
if (progressStateFlags & nsIWebProgressListener::STATE_START) {
|
||||
// If the document load is starting, remember its URL as the last
|
||||
// URL we've loaded.
|
||||
nsCOMPtr<nsIChannel> channel(do_QueryInterface(aRequest));
|
||||
if (! channel) {
|
||||
NS_ERROR("no channel avail");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
channel->GetURI(getter_AddRefs(uri));
|
||||
|
||||
mLastURL = uri;
|
||||
}
|
||||
//XXXwaterson are these really _not_ mutually exclusive?
|
||||
// else
|
||||
if ((progressStateFlags & nsIWebProgressListener::STATE_STOP) && (aStatus == NS_OK)) {
|
||||
// If the document load is finishing, then wrap up and maybe load
|
||||
// some more URLs.
|
||||
nsresult rv;
|
||||
PRTime endLoadTime = PR_Now();
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest);
|
||||
rv = channel->GetURI(getter_AddRefs(uri));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Ignore this notification unless its for the current url. That way
|
||||
// we skip over embedded webshell notifications (e.g. frame cells,
|
||||
// iframes, etc.)
|
||||
nsXPIDLCString spec;
|
||||
uri->GetSpec(getter_Copies(spec));
|
||||
|
||||
PRTime delta, cvt, rounder;
|
||||
LL_I2L(cvt, 1000);
|
||||
LL_I2L(rounder, 499);
|
||||
LL_SUB(delta, endLoadTime, mStartLoad);
|
||||
LL_ADD(delta, delta, rounder);
|
||||
LL_DIV(delta, delta, cvt);
|
||||
printf("+++ %s: done loading (%lld msec)\n", spec.get(), delta);
|
||||
|
||||
// Make sure the document bits make it to the screen at least once
|
||||
nsCOMPtr<nsIPresShell> shell = dont_AddRef(GetPresShell());
|
||||
if (shell) {
|
||||
// Force the presentation shell to flush any pending reflows
|
||||
shell->FlushPendingNotifications();
|
||||
|
||||
// Force the view manager to update itself
|
||||
nsCOMPtr<nsIViewManager> vm;
|
||||
shell->GetViewManager(getter_AddRefs(vm));
|
||||
if (vm) {
|
||||
nsIView* rootView;
|
||||
vm->GetRootView(rootView);
|
||||
vm->UpdateView(rootView, NS_VMREFRESH_IMMEDIATE);
|
||||
}
|
||||
|
||||
if (mJiggleLayout) {
|
||||
nsRect r;
|
||||
mBrowser->GetContentBounds(r);
|
||||
nscoord oldWidth = r.width;
|
||||
while (r.width > 100) {
|
||||
r.width -= 10;
|
||||
mBrowser->SizeWindowTo(r.width, r.height, PR_FALSE, PR_FALSE);
|
||||
}
|
||||
while (r.width < oldWidth) {
|
||||
r.width += 10;
|
||||
mBrowser->SizeWindowTo(r.width, r.height, PR_FALSE, PR_FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mCrawl) {
|
||||
FindMoreURLs();
|
||||
}
|
||||
|
||||
mTimer = do_CreateInstance("@mozilla.org/timer;1");
|
||||
if ((0 < mQueuedLoadURLs) || (0 < mPendingURLs.Count())) {
|
||||
mTimer->Init(LoadNextURLCallback, this, mDelay);
|
||||
}
|
||||
else if (mPostExit) {
|
||||
mTimer->Init(QueueExitCallback, this, mDelay);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebCrawler::OnProgressChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest,
|
||||
PRInt32 aCurSelfProgress,
|
||||
PRInt32 aMaxSelfProgress,
|
||||
PRInt32 aCurTotalProgress,
|
||||
PRInt32 aMaxTotalProgress) {
|
||||
nsIRequest *aRequest,
|
||||
PRInt32 aCurSelfProgress,
|
||||
PRInt32 aMaxSelfProgress,
|
||||
PRInt32 aCurTotalProgress,
|
||||
PRInt32 aMaxTotalProgress) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebCrawler::OnLocationChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
nsIURI *location) {
|
||||
nsIRequest* aRequest,
|
||||
nsIURI *location)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebCrawler::OnStatusChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMessage) {
|
||||
nsIRequest* aRequest,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMessage)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebCrawler::OnSecurityChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest,
|
||||
PRInt32 state) {
|
||||
nsIRequest *aRequest,
|
||||
PRInt32 state)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
@ -540,14 +526,6 @@ nsWebCrawler::AddURL(const nsString& aURL)
|
|||
{
|
||||
nsString* url = new nsString(aURL);
|
||||
mPendingURLs.AppendElement(url);
|
||||
if (1 == mPendingURLs.Count()) {
|
||||
mLastDelay = mDelay;
|
||||
}
|
||||
PRInt32 delay = GetDelay(*url);
|
||||
if (delay >= 0) {
|
||||
SetDelay(delay);
|
||||
mLastDelay = delay;
|
||||
}
|
||||
if (mVerbose) {
|
||||
printf("WebCrawler: adding '");
|
||||
fputs(aURL, stdout);
|
||||
|
@ -585,28 +563,16 @@ void
|
|||
nsWebCrawler::Start()
|
||||
{
|
||||
// Enable observing each URL load...
|
||||
nsIWebShell *shell = nsnull;
|
||||
mBrowser->GetWebShell(shell);
|
||||
nsCOMPtr<nsIWebShell> shell;
|
||||
mBrowser->GetWebShell(*getter_AddRefs(shell));
|
||||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(shell));
|
||||
NS_RELEASE(shell);
|
||||
nsCOMPtr<nsIWebProgress> progress(do_GetInterface(docShell));
|
||||
if (!progress) return;
|
||||
|
||||
(void) progress->AddProgressListener((nsIWebProgressListener*)this);
|
||||
|
||||
if (mPendingURLs.Count() >= 1) {
|
||||
mHaveURLList = PR_TRUE;
|
||||
// duplicate the last url if there is a delay since the regression data for the
|
||||
// url gets written when the next url is encountered. Not perfect, but simple.
|
||||
if (mLastDelay != 0) {
|
||||
nsString* last = (nsString *) mPendingURLs.ElementAt(mPendingURLs.Count() - 1);
|
||||
if (last) {
|
||||
nsString* dupLast = new nsString(*last);
|
||||
mPendingURLs.AppendElement(dupLast);
|
||||
}
|
||||
if (docShell) {
|
||||
nsCOMPtr<nsIWebProgress> progress(do_GetInterface(docShell));
|
||||
if (progress) {
|
||||
progress->AddProgressListener(this);
|
||||
LoadNextURL(PR_FALSE);
|
||||
}
|
||||
}
|
||||
LoadNextURL(PR_FALSE);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -807,32 +773,27 @@ nsWebCrawler::FindURLsIn(nsIDocument* aDocument, nsIContent* aNode)
|
|||
void
|
||||
nsWebCrawler::FindMoreURLs()
|
||||
{
|
||||
nsIWebShell* shell = nsnull;
|
||||
mBrowser->GetWebShell(shell);
|
||||
nsCOMPtr<nsIWebShell> shell;
|
||||
mBrowser->GetWebShell(*getter_AddRefs(shell));
|
||||
|
||||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(shell));
|
||||
if (docShell) {
|
||||
nsIContentViewer* cv = nsnull;
|
||||
docShell->GetContentViewer(&cv);
|
||||
if (nsnull != cv) {
|
||||
nsIDocumentViewer* docv = nsnull;
|
||||
cv->QueryInterface(NS_GET_IID(nsIDocumentViewer), (void**) &docv);
|
||||
if (nsnull != docv) {
|
||||
nsIDocument* doc = nsnull;
|
||||
docv->GetDocument(doc);
|
||||
if (nsnull != doc) {
|
||||
nsIContent* root;
|
||||
root = doc->GetRootContent();
|
||||
if (nsnull != root) {
|
||||
nsCOMPtr<nsIContentViewer> cv;
|
||||
docShell->GetContentViewer(getter_AddRefs(cv));
|
||||
if (cv) {
|
||||
nsCOMPtr<nsIDocumentViewer> docv = do_QueryInterface(cv);
|
||||
if (docv) {
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
docv->GetDocument(*getter_AddRefs(doc));
|
||||
if (doc) {
|
||||
nsCOMPtr<nsIContent> root;
|
||||
root = dont_AddRef(doc->GetRootContent());
|
||||
if (root) {
|
||||
FindURLsIn(doc, root);
|
||||
NS_RELEASE(root);
|
||||
}
|
||||
NS_RELEASE(doc);
|
||||
}
|
||||
NS_RELEASE(docv);
|
||||
}
|
||||
NS_RELEASE(cv);
|
||||
}
|
||||
NS_RELEASE(shell);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -851,36 +812,12 @@ nsWebCrawler::GetBrowserWindow(nsBrowserWindow** aWindow)
|
|||
*aWindow = mBrowser;
|
||||
}
|
||||
|
||||
static void
|
||||
TimerCallBack(nsITimer *aTimer, void *aClosure)
|
||||
{
|
||||
nsWebCrawler* wc = (nsWebCrawler*) aClosure;
|
||||
wc->LoadNextURL(PR_TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
nsWebCrawler::LoadNextURL(PRBool aQueueLoad)
|
||||
{
|
||||
nsString* url = (nsString*) mPendingURLs.ElementAt(0);
|
||||
if (nsnull != url) {
|
||||
PRInt32 delay = GetDelay(*url);
|
||||
if (delay >= 0) {
|
||||
SetDelay(delay);
|
||||
mPendingURLs.RemoveElementAt(0);
|
||||
char buf[128];
|
||||
url->ToCString(&buf[0], 128);
|
||||
printf("%s\n", buf);
|
||||
}
|
||||
}
|
||||
|
||||
if ((0 != mDelay) && (mPendingURLs.Count() > 0)) {
|
||||
mTimer = do_CreateInstance("@mozilla.org/timer;1");
|
||||
mTimer->Init(TimerCallBack, (void *)this, mDelay * 1000);
|
||||
}
|
||||
|
||||
if ((mMaxPages < 0) || (mMaxPages > 0)) {
|
||||
while (0 != mPendingURLs.Count()) {
|
||||
url = NS_REINTERPRET_CAST(nsString*, mPendingURLs.ElementAt(0));
|
||||
nsString* url = NS_REINTERPRET_CAST(nsString*, mPendingURLs.ElementAt(0));
|
||||
mPendingURLs.RemoveElementAt(0);
|
||||
if (nsnull != url) {
|
||||
if (OkToLoad(*url)) {
|
||||
|
|
|
@ -64,11 +64,6 @@ public:
|
|||
void SetBrowserWindow(nsBrowserWindow* aWindow);
|
||||
void GetBrowserWindow(nsBrowserWindow** aWindow);
|
||||
|
||||
// Set the delay (by default, the timer is set to one second)
|
||||
void SetDelay(PRInt32 aSeconds) {
|
||||
mDelay = aSeconds;
|
||||
}
|
||||
|
||||
void SetPrintTest(PRInt32 aTestType) { mPrinterTestType = aTestType; }
|
||||
|
||||
void RegressionOutput(PRInt32 aRegressionOutputLevel) { mRegressionOutputLevel = aRegressionOutputLevel; }
|
||||
|
@ -100,20 +95,25 @@ public:
|
|||
|
||||
void SetOutputDir(const nsString& aOutputDir);
|
||||
|
||||
void DumpRegressionData(nsIWebShell* aWebShell,
|
||||
nsIURI* aURL);
|
||||
void DumpRegressionData();
|
||||
void SetRegressionDir(const nsString& aOutputDir);
|
||||
|
||||
void SetEnableRegression(PRBool aSetting) {
|
||||
mRegressing = aSetting;
|
||||
}
|
||||
|
||||
static void
|
||||
LoadNextURLCallback(nsITimer* aTimer, void* aClosure);
|
||||
|
||||
void LoadNextURL(PRBool aQueueLoad);
|
||||
|
||||
nsresult QueueLoadURL(const nsString& aURL);
|
||||
|
||||
void GoToQueuedURL(const nsString& aURL);
|
||||
|
||||
static void
|
||||
QueueExitCallback(nsITimer* atimer, void* aClosure);
|
||||
|
||||
void QueueExit();
|
||||
|
||||
void Exit();
|
||||
|
@ -169,13 +169,11 @@ protected:
|
|||
PRBool mHaveURLList;
|
||||
PRBool mJiggleLayout;
|
||||
PRBool mPostExit;
|
||||
PRInt32 mDelay; // first delay encountered from command line or delay:= in file
|
||||
PRInt32 mLastDelay; // last delay encountered from command line or delay:= in file
|
||||
PRInt32 mDelay;
|
||||
PRInt32 mMaxPages;
|
||||
|
||||
nsString mCurrentURL;
|
||||
nsCOMPtr<nsIURI> mLastURL;
|
||||
nsIWebShell* mLastWebShell;
|
||||
|
||||
PRTime mStartLoad;
|
||||
PRBool mVerbose;
|
||||
|
|
Загрузка…
Ссылка в новой задаче