[Swfdec] 8 commits - libswfdec-gtk/swfdec_gtk_player.c libswfdec/swfdec_as_context.c libswfdec/swfdec_as_date.c libswfdec/swfdec_as_frame.c libswfdec/swfdec_player.c test/trace
Benjamin Otte
company at kemper.freedesktop.org
Thu Nov 8 13:30:37 PST 2007
libswfdec-gtk/swfdec_gtk_player.c | 3
libswfdec/swfdec_as_context.c | 10 -
libswfdec/swfdec_as_date.c | 4
libswfdec/swfdec_as_frame.c | 4
libswfdec/swfdec_player.c | 18 +
test/trace/Makefile.am | 18 +
test/trace/moviecliploader-constructor-5.swf |binary
test/trace/moviecliploader-constructor-5.swf.trace | 3
test/trace/moviecliploader-constructor-6.swf |binary
test/trace/moviecliploader-constructor-6.swf.trace | 3
test/trace/moviecliploader-constructor-7.swf |binary
test/trace/moviecliploader-constructor-7.swf.trace | 3
test/trace/moviecliploader-constructor-8.swf |binary
test/trace/moviecliploader-constructor-8.swf.trace | 3
test/trace/moviecliploader-constructor.as | 9
test/trace/unreproducable-random-5.swf |binary
test/trace/unreproducable-random-5.swf.trace | 203 +++++++++++++++++++++
test/trace/unreproducable-random-6.swf |binary
test/trace/unreproducable-random-6.swf.trace | 203 +++++++++++++++++++++
test/trace/unreproducable-random-7.swf |binary
test/trace/unreproducable-random-7.swf.trace | 203 +++++++++++++++++++++
test/trace/unreproducable-random-8.swf |binary
test/trace/unreproducable-random-8.swf.trace | 203 +++++++++++++++++++++
test/trace/unreproducable-random.as | 17 +
24 files changed, 895 insertions(+), 12 deletions(-)
New commits:
commit 4305ef53af80ae0d864d3d2eca5a851dd405df25
Author: Benjamin Otte <otte at gnome.org>
Date: Thu Nov 8 22:30:25 2007 +0100
add internal consistency test for random() and new Date()
diff --git a/test/trace/Makefile.am b/test/trace/Makefile.am
index aaaca1a..57c8e79 100644
--- a/test/trace/Makefile.am
+++ b/test/trace/Makefile.am
@@ -2187,6 +2187,15 @@ EXTRA_DIST = \
unescape2-6.swf.trace \
unescape2-7.swf \
unescape2-7.swf.trace \
+ unreproducable-random.as \
+ unreproducable-random-5.swf \
+ unreproducable-random-5.swf.trace \
+ unreproducable-random-6.swf \
+ unreproducable-random-6.swf.trace \
+ unreproducable-random-7.swf \
+ unreproducable-random-7.swf.trace \
+ unreproducable-random-8.swf \
+ unreproducable-random-8.swf.trace \
values.as \
video.flv \
video-properties.as \
diff --git a/test/trace/unreproducable-random-5.swf b/test/trace/unreproducable-random-5.swf
new file mode 100644
index 0000000..579a1f0
Binary files /dev/null and b/test/trace/unreproducable-random-5.swf differ
diff --git a/test/trace/unreproducable-random-5.swf.trace b/test/trace/unreproducable-random-5.swf.trace
new file mode 100644
index 0000000..078f399
--- /dev/null
+++ b/test/trace/unreproducable-random-5.swf.trace
@@ -0,0 +1,203 @@
+This is an internal Swfdec test to ensure tests are internally predictable.
+You cannot reproduce this test with any other Flash player.
+44
+0.715189365109625
+60
+0.85794561998983
+27
+0.423654796985735
+83
+0.384381708373757
+56
+0.891773001825794
+76
+0.272656294741589
+94
+0.791725033539735
+19
+0.479977171525568
+24
+0.925596633318994
+69
+0.337396161647289
+81
+0.020218399271409
+60
+0.957155154513339
+22
+0.870012145289302
+88
+0.47360804024586
+96
+0.461479362985331
+57
+0.67887953384326
+82
+0.639921017158924
+69
+0.537373228264822
+11
+0.521848328355377
+6
+0.473600422827215
+99
+0.774233686548269
+74
+0.216550356814673
+18
+0.0187897980527995
+12
+0.149674863931172
+10
+0.616933998703566
+21
+0.902598471600504
+81
+0.359507902164466
+19
+0.902348578310812
+69
+0.0602254665222206
+33
+0.653140032353524
+35
+0.210382561704821
+58
+0.75068613889835
+46
+0.363710773551797
+12
+0.0384254256659646
+56
+0.988373831993498
+50
+0.652790318965457
+47
+0.16130951131579
+84
+0.581850332360041
+44
+0.466310772908472
+60
+0.623510106057959
+75
+0.110375139242506
+57
+0.317201744917857
+49
+0.196582356881896
+11
+0.662526868136769
+77
+0.0971012711556562
+1
+0.673659631246222
+90
+0.976459465448732
+27
+0.509624371879886
+41
+0.604845518026434
+69
+0.0199876725066601
+72
+0.282806959571715
+71
+0.359444469008641
+71
+0.118727714400947
+73
+0.880475893225051
+87
+0.0641475012335543
+71
+0.565188865804223
+91
+0.265389491306875
+42
+0.916722956701007
+1
+0.575946495384247
+12
+0.277718564246152
+43
+0.66741037625106
+82
+0.647174138606479
+88
+0.289406091170708
+98
+0.397820751691049
+66
+0.0201075506752407
+84
+0.369808095933157
+42
+0.677816539338427
+18
+0.703737280860079
+74
+0.962188544983155
+64
+0.756106691492897
+15
+0.592041926550702
+78
+0.638921080290399
+8
+0.952749009451725
+45
+0.449197732016241
+40
+0.699479277706372
+3
+0.767023702686987
+21
+0.396505738937254
+47
+0.249796275254596
+92
+0.881735359624312
+86
+0.588465083551717
+20
+0.501324383229871
+13
+0.230533023354617
+33
+0.423855044039634
+32
+0.474867521693556
+69
+0.301574816338283
+3
+0.287991003985557
+48
+0.618015426998833
+45
+0.878452191229157
+94
+0.298282327852879
+22
+0.354046664566259
+93
+0.574325255945282
+78
+0.968961766141746
+37
+0.431418434558668
+86
+0.141263903094583
+18
+0.43586491935357
+19
+0.260340928773378
+29
+0.703888585683196
+67
+0.0995690848446048
+52
+0.714241298463268
+46
+0.841140130068838
+Mon Oct 28 21:24:04 GMT+0000 2002
diff --git a/test/trace/unreproducable-random-6.swf b/test/trace/unreproducable-random-6.swf
new file mode 100644
index 0000000..0a686e4
Binary files /dev/null and b/test/trace/unreproducable-random-6.swf differ
diff --git a/test/trace/unreproducable-random-6.swf.trace b/test/trace/unreproducable-random-6.swf.trace
new file mode 100644
index 0000000..078f399
--- /dev/null
+++ b/test/trace/unreproducable-random-6.swf.trace
@@ -0,0 +1,203 @@
+This is an internal Swfdec test to ensure tests are internally predictable.
+You cannot reproduce this test with any other Flash player.
+44
+0.715189365109625
+60
+0.85794561998983
+27
+0.423654796985735
+83
+0.384381708373757
+56
+0.891773001825794
+76
+0.272656294741589
+94
+0.791725033539735
+19
+0.479977171525568
+24
+0.925596633318994
+69
+0.337396161647289
+81
+0.020218399271409
+60
+0.957155154513339
+22
+0.870012145289302
+88
+0.47360804024586
+96
+0.461479362985331
+57
+0.67887953384326
+82
+0.639921017158924
+69
+0.537373228264822
+11
+0.521848328355377
+6
+0.473600422827215
+99
+0.774233686548269
+74
+0.216550356814673
+18
+0.0187897980527995
+12
+0.149674863931172
+10
+0.616933998703566
+21
+0.902598471600504
+81
+0.359507902164466
+19
+0.902348578310812
+69
+0.0602254665222206
+33
+0.653140032353524
+35
+0.210382561704821
+58
+0.75068613889835
+46
+0.363710773551797
+12
+0.0384254256659646
+56
+0.988373831993498
+50
+0.652790318965457
+47
+0.16130951131579
+84
+0.581850332360041
+44
+0.466310772908472
+60
+0.623510106057959
+75
+0.110375139242506
+57
+0.317201744917857
+49
+0.196582356881896
+11
+0.662526868136769
+77
+0.0971012711556562
+1
+0.673659631246222
+90
+0.976459465448732
+27
+0.509624371879886
+41
+0.604845518026434
+69
+0.0199876725066601
+72
+0.282806959571715
+71
+0.359444469008641
+71
+0.118727714400947
+73
+0.880475893225051
+87
+0.0641475012335543
+71
+0.565188865804223
+91
+0.265389491306875
+42
+0.916722956701007
+1
+0.575946495384247
+12
+0.277718564246152
+43
+0.66741037625106
+82
+0.647174138606479
+88
+0.289406091170708
+98
+0.397820751691049
+66
+0.0201075506752407
+84
+0.369808095933157
+42
+0.677816539338427
+18
+0.703737280860079
+74
+0.962188544983155
+64
+0.756106691492897
+15
+0.592041926550702
+78
+0.638921080290399
+8
+0.952749009451725
+45
+0.449197732016241
+40
+0.699479277706372
+3
+0.767023702686987
+21
+0.396505738937254
+47
+0.249796275254596
+92
+0.881735359624312
+86
+0.588465083551717
+20
+0.501324383229871
+13
+0.230533023354617
+33
+0.423855044039634
+32
+0.474867521693556
+69
+0.301574816338283
+3
+0.287991003985557
+48
+0.618015426998833
+45
+0.878452191229157
+94
+0.298282327852879
+22
+0.354046664566259
+93
+0.574325255945282
+78
+0.968961766141746
+37
+0.431418434558668
+86
+0.141263903094583
+18
+0.43586491935357
+19
+0.260340928773378
+29
+0.703888585683196
+67
+0.0995690848446048
+52
+0.714241298463268
+46
+0.841140130068838
+Mon Oct 28 21:24:04 GMT+0000 2002
diff --git a/test/trace/unreproducable-random-7.swf b/test/trace/unreproducable-random-7.swf
new file mode 100644
index 0000000..f62ceef
Binary files /dev/null and b/test/trace/unreproducable-random-7.swf differ
diff --git a/test/trace/unreproducable-random-7.swf.trace b/test/trace/unreproducable-random-7.swf.trace
new file mode 100644
index 0000000..078f399
--- /dev/null
+++ b/test/trace/unreproducable-random-7.swf.trace
@@ -0,0 +1,203 @@
+This is an internal Swfdec test to ensure tests are internally predictable.
+You cannot reproduce this test with any other Flash player.
+44
+0.715189365109625
+60
+0.85794561998983
+27
+0.423654796985735
+83
+0.384381708373757
+56
+0.891773001825794
+76
+0.272656294741589
+94
+0.791725033539735
+19
+0.479977171525568
+24
+0.925596633318994
+69
+0.337396161647289
+81
+0.020218399271409
+60
+0.957155154513339
+22
+0.870012145289302
+88
+0.47360804024586
+96
+0.461479362985331
+57
+0.67887953384326
+82
+0.639921017158924
+69
+0.537373228264822
+11
+0.521848328355377
+6
+0.473600422827215
+99
+0.774233686548269
+74
+0.216550356814673
+18
+0.0187897980527995
+12
+0.149674863931172
+10
+0.616933998703566
+21
+0.902598471600504
+81
+0.359507902164466
+19
+0.902348578310812
+69
+0.0602254665222206
+33
+0.653140032353524
+35
+0.210382561704821
+58
+0.75068613889835
+46
+0.363710773551797
+12
+0.0384254256659646
+56
+0.988373831993498
+50
+0.652790318965457
+47
+0.16130951131579
+84
+0.581850332360041
+44
+0.466310772908472
+60
+0.623510106057959
+75
+0.110375139242506
+57
+0.317201744917857
+49
+0.196582356881896
+11
+0.662526868136769
+77
+0.0971012711556562
+1
+0.673659631246222
+90
+0.976459465448732
+27
+0.509624371879886
+41
+0.604845518026434
+69
+0.0199876725066601
+72
+0.282806959571715
+71
+0.359444469008641
+71
+0.118727714400947
+73
+0.880475893225051
+87
+0.0641475012335543
+71
+0.565188865804223
+91
+0.265389491306875
+42
+0.916722956701007
+1
+0.575946495384247
+12
+0.277718564246152
+43
+0.66741037625106
+82
+0.647174138606479
+88
+0.289406091170708
+98
+0.397820751691049
+66
+0.0201075506752407
+84
+0.369808095933157
+42
+0.677816539338427
+18
+0.703737280860079
+74
+0.962188544983155
+64
+0.756106691492897
+15
+0.592041926550702
+78
+0.638921080290399
+8
+0.952749009451725
+45
+0.449197732016241
+40
+0.699479277706372
+3
+0.767023702686987
+21
+0.396505738937254
+47
+0.249796275254596
+92
+0.881735359624312
+86
+0.588465083551717
+20
+0.501324383229871
+13
+0.230533023354617
+33
+0.423855044039634
+32
+0.474867521693556
+69
+0.301574816338283
+3
+0.287991003985557
+48
+0.618015426998833
+45
+0.878452191229157
+94
+0.298282327852879
+22
+0.354046664566259
+93
+0.574325255945282
+78
+0.968961766141746
+37
+0.431418434558668
+86
+0.141263903094583
+18
+0.43586491935357
+19
+0.260340928773378
+29
+0.703888585683196
+67
+0.0995690848446048
+52
+0.714241298463268
+46
+0.841140130068838
+Mon Oct 28 21:24:04 GMT+0000 2002
diff --git a/test/trace/unreproducable-random-8.swf b/test/trace/unreproducable-random-8.swf
new file mode 100644
index 0000000..0657b36
Binary files /dev/null and b/test/trace/unreproducable-random-8.swf differ
diff --git a/test/trace/unreproducable-random-8.swf.trace b/test/trace/unreproducable-random-8.swf.trace
new file mode 100644
index 0000000..078f399
--- /dev/null
+++ b/test/trace/unreproducable-random-8.swf.trace
@@ -0,0 +1,203 @@
+This is an internal Swfdec test to ensure tests are internally predictable.
+You cannot reproduce this test with any other Flash player.
+44
+0.715189365109625
+60
+0.85794561998983
+27
+0.423654796985735
+83
+0.384381708373757
+56
+0.891773001825794
+76
+0.272656294741589
+94
+0.791725033539735
+19
+0.479977171525568
+24
+0.925596633318994
+69
+0.337396161647289
+81
+0.020218399271409
+60
+0.957155154513339
+22
+0.870012145289302
+88
+0.47360804024586
+96
+0.461479362985331
+57
+0.67887953384326
+82
+0.639921017158924
+69
+0.537373228264822
+11
+0.521848328355377
+6
+0.473600422827215
+99
+0.774233686548269
+74
+0.216550356814673
+18
+0.0187897980527995
+12
+0.149674863931172
+10
+0.616933998703566
+21
+0.902598471600504
+81
+0.359507902164466
+19
+0.902348578310812
+69
+0.0602254665222206
+33
+0.653140032353524
+35
+0.210382561704821
+58
+0.75068613889835
+46
+0.363710773551797
+12
+0.0384254256659646
+56
+0.988373831993498
+50
+0.652790318965457
+47
+0.16130951131579
+84
+0.581850332360041
+44
+0.466310772908472
+60
+0.623510106057959
+75
+0.110375139242506
+57
+0.317201744917857
+49
+0.196582356881896
+11
+0.662526868136769
+77
+0.0971012711556562
+1
+0.673659631246222
+90
+0.976459465448732
+27
+0.509624371879886
+41
+0.604845518026434
+69
+0.0199876725066601
+72
+0.282806959571715
+71
+0.359444469008641
+71
+0.118727714400947
+73
+0.880475893225051
+87
+0.0641475012335543
+71
+0.565188865804223
+91
+0.265389491306875
+42
+0.916722956701007
+1
+0.575946495384247
+12
+0.277718564246152
+43
+0.66741037625106
+82
+0.647174138606479
+88
+0.289406091170708
+98
+0.397820751691049
+66
+0.0201075506752407
+84
+0.369808095933157
+42
+0.677816539338427
+18
+0.703737280860079
+74
+0.962188544983155
+64
+0.756106691492897
+15
+0.592041926550702
+78
+0.638921080290399
+8
+0.952749009451725
+45
+0.449197732016241
+40
+0.699479277706372
+3
+0.767023702686987
+21
+0.396505738937254
+47
+0.249796275254596
+92
+0.881735359624312
+86
+0.588465083551717
+20
+0.501324383229871
+13
+0.230533023354617
+33
+0.423855044039634
+32
+0.474867521693556
+69
+0.301574816338283
+3
+0.287991003985557
+48
+0.618015426998833
+45
+0.878452191229157
+94
+0.298282327852879
+22
+0.354046664566259
+93
+0.574325255945282
+78
+0.968961766141746
+37
+0.431418434558668
+86
+0.141263903094583
+18
+0.43586491935357
+19
+0.260340928773378
+29
+0.703888585683196
+67
+0.0995690848446048
+52
+0.714241298463268
+46
+0.841140130068838
+Mon Oct 28 21:24:04 GMT+0000 2002
diff --git a/test/trace/unreproducable-random.as b/test/trace/unreproducable-random.as
new file mode 100644
index 0000000..5d81379
--- /dev/null
+++ b/test/trace/unreproducable-random.as
@@ -0,0 +1,17 @@
+// makeswf -v 7 -s 200x150 -r 1 -o unreproducable-random.swf unreproducable-random.as
+
+trace ("This is an internal Swfdec test to ensure tests are internally predictable.");
+trace ("You cannot reproduce this test with any other Flash player.");
+
+for (i = 0; i < 100; i++) {
+ asm {
+ push 100
+ random
+ trace
+ };
+ trace (Math.random ());
+}
+
+trace (new Date ());
+
+loadMovie ("fscommand:QUIT", "");
commit 21da8d8897eae9d5c3468bab01bec1a569d48d4d
Author: Benjamin Otte <otte at gnome.org>
Date: Thu Nov 8 22:29:00 2007 +0100
make new Date () predictable
diff --git a/libswfdec/swfdec_player.c b/libswfdec/swfdec_player.c
index 019b962..7d68208 100644
--- a/libswfdec/swfdec_player.c
+++ b/libswfdec/swfdec_player.c
@@ -1995,6 +1995,7 @@ swfdec_player_unroot_object (SwfdecPlayer *player, GObject *object)
SwfdecPlayer *
swfdec_player_new (SwfdecAsDebugger *debugger)
{
+ static const GTimeVal the_beginning = { 1035840244, 0 };
SwfdecPlayer *player;
g_return_val_if_fail (debugger == NULL || SWFDEC_IS_AS_DEBUGGER (debugger), NULL);
@@ -2003,6 +2004,8 @@ swfdec_player_new (SwfdecAsDebugger *debugger)
player = g_object_new (SWFDEC_TYPE_PLAYER, "random-seed", 0,
"max-runtime", 0,
"debugger", debugger, NULL);
+ /* FIXME: make this a property or something and don't set it here */
+ SWFDEC_AS_CONTEXT (player)->start_time = the_beginning;
return player;
}
commit 7a5ddc67a5e8da3780b72df086f8c27bf5e6db56
Author: Benjamin Otte <otte at gnome.org>
Date: Thu Nov 8 22:28:43 2007 +0100
fix new Date () to work correctly
diff --git a/libswfdec/swfdec_as_date.c b/libswfdec/swfdec_as_date.c
index cb10e26..50b4ad9 100644
--- a/libswfdec/swfdec_as_date.c
+++ b/libswfdec/swfdec_as_date.c
@@ -1052,8 +1052,8 @@ swfdec_as_date_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
GTimeVal tv;
swfdec_as_context_get_time (cx, &tv);
- swfdec_as_date_set_milliseconds_local (date,
- tv.tv_sec * 1000 + tv.tv_usec / 1000);
+ swfdec_as_date_set_milliseconds_utc (date,
+ tv.tv_sec * 1000.0 + tv.tv_usec / 1000.0);
}
else if (argc == 1) // milliseconds from epoch, local
{
commit b023c1c39919dc09e8125723788217a36c6d1dda
Author: Benjamin Otte <otte at gnome.org>
Date: Thu Nov 8 20:09:26 2007 +0100
add a test for the MovieClipLoader() function
diff --git a/test/trace/Makefile.am b/test/trace/Makefile.am
index ab9d1c4..aaaca1a 100644
--- a/test/trace/Makefile.am
+++ b/test/trace/Makefile.am
@@ -982,6 +982,15 @@ EXTRA_DIST = \
movieclip-target-6.swf.trace \
movieclip-target-7.swf \
movieclip-target-7.swf.trace \
+ moviecliploader-constructor.as \
+ moviecliploader-constructor-5.swf \
+ moviecliploader-constructor-5.swf.trace \
+ moviecliploader-constructor-6.swf \
+ moviecliploader-constructor-6.swf.trace \
+ moviecliploader-constructor-7.swf \
+ moviecliploader-constructor-7.swf.trace \
+ moviecliploader-constructor-8.swf \
+ moviecliploader-constructor-8.swf.trace \
moviecliploader-error-illegalrequest.as \
moviecliploader-error-illegalrequest-6.swf \
moviecliploader-error-illegalrequest-6.swf.trace \
diff --git a/test/trace/moviecliploader-constructor-5.swf b/test/trace/moviecliploader-constructor-5.swf
new file mode 100644
index 0000000..e830ce3
Binary files /dev/null and b/test/trace/moviecliploader-constructor-5.swf differ
diff --git a/test/trace/moviecliploader-constructor-5.swf.trace b/test/trace/moviecliploader-constructor-5.swf.trace
new file mode 100644
index 0000000..b122b04
--- /dev/null
+++ b/test/trace/moviecliploader-constructor-5.swf.trace
@@ -0,0 +1,3 @@
+Call MovieClipLoader on a normal object
+undefined
+undefined
diff --git a/test/trace/moviecliploader-constructor-6.swf b/test/trace/moviecliploader-constructor-6.swf
new file mode 100644
index 0000000..28340e8
Binary files /dev/null and b/test/trace/moviecliploader-constructor-6.swf differ
diff --git a/test/trace/moviecliploader-constructor-6.swf.trace b/test/trace/moviecliploader-constructor-6.swf.trace
new file mode 100644
index 0000000..b122b04
--- /dev/null
+++ b/test/trace/moviecliploader-constructor-6.swf.trace
@@ -0,0 +1,3 @@
+Call MovieClipLoader on a normal object
+undefined
+undefined
diff --git a/test/trace/moviecliploader-constructor-7.swf b/test/trace/moviecliploader-constructor-7.swf
new file mode 100644
index 0000000..0e1b03d
Binary files /dev/null and b/test/trace/moviecliploader-constructor-7.swf differ
diff --git a/test/trace/moviecliploader-constructor-7.swf.trace b/test/trace/moviecliploader-constructor-7.swf.trace
new file mode 100644
index 0000000..b122b04
--- /dev/null
+++ b/test/trace/moviecliploader-constructor-7.swf.trace
@@ -0,0 +1,3 @@
+Call MovieClipLoader on a normal object
+undefined
+undefined
diff --git a/test/trace/moviecliploader-constructor-8.swf b/test/trace/moviecliploader-constructor-8.swf
new file mode 100644
index 0000000..ec19678
Binary files /dev/null and b/test/trace/moviecliploader-constructor-8.swf differ
diff --git a/test/trace/moviecliploader-constructor-8.swf.trace b/test/trace/moviecliploader-constructor-8.swf.trace
new file mode 100644
index 0000000..b122b04
--- /dev/null
+++ b/test/trace/moviecliploader-constructor-8.swf.trace
@@ -0,0 +1,3 @@
+Call MovieClipLoader on a normal object
+undefined
+undefined
diff --git a/test/trace/moviecliploader-constructor.as b/test/trace/moviecliploader-constructor.as
new file mode 100644
index 0000000..57df74e
--- /dev/null
+++ b/test/trace/moviecliploader-constructor.as
@@ -0,0 +1,9 @@
+// makeswf -v 7 -s 200x150 -r 1 -o moviecliploader-constructor.swf moviecliploader-constructor.as
+
+trace ("Call MovieClipLoader on a normal object");
+
+o = {};
+trace (MovieClipLoader (o));
+trace (o._listeners);
+
+loadMovie ("fscommand:QUIT", "");
commit 62df0b4c39aa14e0182350814f0f85f3fbf0307f
Author: Benjamin Otte <otte at gnome.org>
Date: Thu Nov 8 19:40:34 2007 +0100
Make max-runtime default to 10 seconds, but override it in swfdec_player_new()
diff --git a/libswfdec-gtk/swfdec_gtk_player.c b/libswfdec-gtk/swfdec_gtk_player.c
index 60e7ded..485f708 100644
--- a/libswfdec-gtk/swfdec_gtk_player.c
+++ b/libswfdec-gtk/swfdec_gtk_player.c
@@ -173,8 +173,7 @@ swfdec_gtk_player_new (SwfdecAsDebugger *debugger)
SwfdecPlayer *player;
swfdec_init ();
- player = g_object_new (SWFDEC_TYPE_GTK_PLAYER, "debugger", debugger,
- "max-runtime", (gulong) 10 * 1000, NULL);
+ player = g_object_new (SWFDEC_TYPE_GTK_PLAYER, "debugger", debugger, NULL);
return player;
}
diff --git a/libswfdec/swfdec_player.c b/libswfdec/swfdec_player.c
index 7d665b5..019b962 100644
--- a/libswfdec/swfdec_player.c
+++ b/libswfdec/swfdec_player.c
@@ -1485,7 +1485,7 @@ swfdec_player_class_init (SwfdecPlayerClass *klass)
SWFDEC_TYPE_SYSTEM, G_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_MAX_RUNTIME,
g_param_spec_ulong ("max-runtime", "maximum runtime", "maximum time in msecs scripts may run in the player before aborting",
- 0, G_MAXULONG, 0, G_PARAM_READWRITE));
+ 0, G_MAXULONG, 10 * 1000, G_PARAM_READWRITE));
/**
* SwfdecPlayer::invalidate:
@@ -1652,6 +1652,7 @@ swfdec_player_init (SwfdecPlayer *player)
player->runtime = g_timer_new ();
g_timer_stop (player->runtime);
+ player->max_runtime = 10 * 1000;
player->invalidations = g_array_new (FALSE, FALSE, sizeof (SwfdecRectangle));
player->mouse_visible = TRUE;
player->mouse_cursor = SWFDEC_MOUSE_CURSOR_NORMAL;
@@ -2000,6 +2001,7 @@ swfdec_player_new (SwfdecAsDebugger *debugger)
swfdec_init ();
player = g_object_new (SWFDEC_TYPE_PLAYER, "random-seed", 0,
+ "max-runtime", 0,
"debugger", debugger, NULL);
return player;
commit ff66817638e142937eb49269c326d6347870a3b5
Author: Benjamin Otte <otte at gnome.org>
Date: Thu Nov 8 19:40:15 2007 +0100
make description not cause a gtk-doc warning.
The detection code should be better...
diff --git a/libswfdec/swfdec_as_frame.c b/libswfdec/swfdec_as_frame.c
index f4d13f0..e850d96 100644
--- a/libswfdec/swfdec_as_frame.c
+++ b/libswfdec/swfdec_as_frame.c
@@ -217,8 +217,8 @@ typedef struct {
*
* Registers a function that guards a block of memory. When the function
* exits this block of memory, it will call this function. This can happen
- * either when the program counter leaves the guarded region, when the function
- * returns or when the context aborted due to an unrecoverable error.
+ * either when the program counter leaves the guarded region, when the
+ * function returns or when the context aborted due to an unrecoverable error.
**/
void
swfdec_as_frame_push_block (SwfdecAsFrame *frame, const guint8 *start,
commit 91adc003c115b3128ac86af06e0ac4b356bcbd6e
Author: Benjamin Otte <otte at gnome.org>
Date: Thu Nov 8 19:33:46 2007 +0100
clarify swfdec_player_new() documentation.
diff --git a/libswfdec/swfdec_player.c b/libswfdec/swfdec_player.c
index 40d205c..7d665b5 100644
--- a/libswfdec/swfdec_player.c
+++ b/libswfdec/swfdec_player.c
@@ -1984,8 +1984,10 @@ swfdec_player_unroot_object (SwfdecPlayer *player, GObject *object)
* swfdec_player_new:
* @debugger: %NULL or a #SwfdecAsDebugger to use for debugging this player.
*
- * Creates a new player.
- * This function calls swfdec_init () for you if it wasn't called before.
+ * Creates a new player. This function is supposed to be used for testing.
+ * Because of this, the created player will behave as predictable as possible.
+ * For example, it will generate the same random number sequence every time.
+ * The function calls swfdec_init () for you if it wasn't called before.
*
* Returns: The new player
**/
commit 4a87d4afbaf205fd24d5f3cdf43ec6866b5a36c1
Author: Benjamin Otte <otte at gnome.org>
Date: Thu Nov 8 19:31:39 2007 +0100
add a "random-seed" proeprty to SwfdecAsContext
This allows making random number generation predictable, which is useful for
testing.
swfdec_player_new() uses this already.
diff --git a/libswfdec/swfdec_as_context.c b/libswfdec/swfdec_as_context.c
index 18afbe2..a429112 100644
--- a/libswfdec/swfdec_as_context.c
+++ b/libswfdec/swfdec_as_context.c
@@ -435,6 +435,7 @@ enum {
enum {
PROP_0,
PROP_DEBUGGER,
+ PROP_RANDOM_SEED,
PROP_ABORTED,
PROP_UNTIL_GC
};
@@ -448,7 +449,6 @@ swfdec_as_context_get_property (GObject *object, guint param_id, GValue *value,
{
SwfdecAsContext *context = SWFDEC_AS_CONTEXT (object);
-
switch (param_id) {
case PROP_DEBUGGER:
g_value_set_object (value, context->debugger);
@@ -471,11 +471,13 @@ swfdec_as_context_set_property (GObject *object, guint param_id, const GValue *v
{
SwfdecAsContext *context = SWFDEC_AS_CONTEXT (object);
-
switch (param_id) {
case PROP_DEBUGGER:
context->debugger = SWFDEC_AS_DEBUGGER (g_value_dup_object (value));
break;
+ case PROP_RANDOM_SEED:
+ g_rand_set_seed (context->rand, g_value_get_uint (value));
+ break;
case PROP_UNTIL_GC:
context->memory_until_gc = g_value_get_ulong (value);
break;
@@ -520,6 +522,10 @@ swfdec_as_context_class_init (SwfdecAsContextClass *klass)
g_object_class_install_property (object_class, PROP_DEBUGGER,
g_param_spec_object ("debugger", "debugger", "debugger used in this player",
SWFDEC_TYPE_AS_DEBUGGER, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property (object_class, PROP_RANDOM_SEED,
+ g_param_spec_uint ("random-seed", "random seed",
+ "seed used for calculating random numbers",
+ 0, G_MAXUINT32, 0, G_PARAM_WRITABLE)); /* FIXME: make this readwrite for replaying? */
g_object_class_install_property (object_class, PROP_ABORTED,
g_param_spec_boolean ("aborted", "aborted", "set when the script engine aborts due to an error",
FALSE, G_PARAM_READABLE));
diff --git a/libswfdec/swfdec_player.c b/libswfdec/swfdec_player.c
index d08215d..40d205c 100644
--- a/libswfdec/swfdec_player.c
+++ b/libswfdec/swfdec_player.c
@@ -1994,8 +1994,11 @@ swfdec_player_new (SwfdecAsDebugger *debugger)
{
SwfdecPlayer *player;
+ g_return_val_if_fail (debugger == NULL || SWFDEC_IS_AS_DEBUGGER (debugger), NULL);
+
swfdec_init ();
- player = g_object_new (SWFDEC_TYPE_PLAYER, "debugger", debugger, NULL);
+ player = g_object_new (SWFDEC_TYPE_PLAYER, "random-seed", 0,
+ "debugger", debugger, NULL);
return player;
}
More information about the Swfdec
mailing list