[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r12272: Fix for bug #30238: don't tr
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r12272: Fix for bug #30238: don't try to load "undefined" or any other non-string |
Date: |
Thu, 24 Jun 2010 08:21:15 +0200 |
User-agent: |
Bazaar (2.0.3) |
------------------------------------------------------------
revno: 12272 [merge]
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Thu 2010-06-24 08:21:15 +0200
message:
Fix for bug #30238: don't try to load "undefined" or any other non-string
value in MovieClipLoader.loadClip.
Add tests for this behaviour.
modified:
libcore/asobj/MovieClipLoader.cpp
testsuite/actionscript.all/MovieClipLoader.as
=== modified file 'libcore/asobj/MovieClipLoader.cpp'
--- a/libcore/asobj/MovieClipLoader.cpp 2010-03-22 23:46:33 +0000
+++ b/libcore/asobj/MovieClipLoader.cpp 2010-06-24 06:08:01 +0000
@@ -105,7 +105,7 @@
as_object* ptr = ensure<ValidThis>(fn);
- if ( fn.nargs < 2 ) {
+ if (fn.nargs < 2) {
IF_VERBOSE_ASCODING_ERRORS(
std::stringstream ss; fn.dump_args(ss);
log_aserror(_("MovieClipLoader.loadClip(%s): missing arguments"),
@@ -114,6 +114,15 @@
return as_value(false);
}
+ if (!fn.arg(0).is_string()) {
+ IF_VERBOSE_ASCODING_ERRORS(
+ std::stringstream ss; fn.dump_args(ss);
+ log_aserror(_("MovieClipLoader.loadClip(%s): first argument must"
+ "be a string"), ss.str());
+ );
+ return as_value(false);
+ }
+
const std::string& str_url = fn.arg(0).to_string();
as_value tgt_arg = fn.arg(1);
=== modified file 'testsuite/actionscript.all/MovieClipLoader.as'
--- a/testsuite/actionscript.all/MovieClipLoader.as 2010-01-11 06:41:38
+0000
+++ b/testsuite/actionscript.all/MovieClipLoader.as 2010-06-24 05:51:08
+0000
@@ -76,6 +76,63 @@
this.bm.apply(this, arguments);
};
+// Test simple loadClip calls
+
+lmc = _root.createEmptyMovieClip("lmc", 2000);
+mldr = new MovieClipLoader();
+
+// String
+ret = mldr.loadClip("h", lmc);
+check_equals(ret, true);
+
+// Number
+ret = mldr.loadClip(9, lmc);
+check_equals(ret, false);
+
+// String again.
+ret = mldr.loadClip("h", lmc);
+check_equals(ret, true);
+
+// Boolean
+ret = mldr.loadClip(true, lmc);
+check_equals(ret, false);
+
+ret = mldr.loadClip(false, lmc);
+check_equals(ret, false);
+
+// Null
+ret = mldr.loadClip(null, lmc);
+check_equals(ret, false);
+
+// String again (just to check it doesn't depend on previous calls).
+ret = mldr.loadClip("h", lmc);
+check_equals(ret, true);
+
+// Undefined
+ret = mldr.loadClip(undefined, lmc);
+check_equals(ret, false);
+
+// Array
+ret = mldr.loadClip([], lmc);
+check_equals(ret, false);
+
+// Object
+
+o= {};
+ret = mldr.loadClip(o, lmc);
+check_equals(ret, false);
+
+// Object with toString
+o.toString = function() { return "url"; };
+ret = mldr.loadClip(o, lmc);
+check_equals(ret, false);
+
+// Object with valueOf
+o.valueOf = function() { return "url"; };
+ret = mldr.loadClip(o, lmc);
+check_equals(ret, false);
+
+
//---------------------------------------------------------
// Test loadClip and events
//---------------------------------------------------------
@@ -316,7 +373,7 @@
// subtract the number of progress callback runs reported when playing
from the totals to get the correct number
// BUT MAKE SURE nextTestOrEnd CONTAINS THE CORRECT
testsPerProgressCallback INFO !!
//
- expected.totals = 72;
+ expected.totals = 84;
// gnash doesn't call onLoadInit if the data at the url is not an SWF
or JPG
// (or whatever else can become a movie_instance), while the PP does.
// So in this testcase, the attempt to load vars.txt is invalid for
Gnash
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r12272: Fix for bug #30238: don't try to load "undefined" or any other non-string,
Benjamin Wolsey <=