gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] /srv/bzr/gnash/trunk r12068: Throw an exception rather th


From: Sandro Santilli
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r12068: Throw an exception rather than aborting on invalid url
Date: Tue, 16 Mar 2010 19:30:59 +0100
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 12068
committer: Sandro Santilli <address@hidden>
branch nick: trunk
timestamp: Tue 2010-03-16 19:30:59 +0100
message:
  Throw an exception rather than aborting on invalid url
modified:
  libbase/URL.cpp
  testsuite/libbase.all/URLTest.cpp
=== modified file 'libbase/URL.cpp'
--- a/libbase/URL.cpp   2010-01-25 18:52:20 +0000
+++ b/libbase/URL.cpp   2010-03-16 18:30:59 +0000
@@ -55,7 +55,10 @@
        return;
 #endif
 
-       assert(path[0] == '/');
+       if (path.empty() || path[0] != '/')
+       {
+               throw gnash::GnashException("invalid url");
+       }
 
     std::vector<std::string> components;
 

=== modified file 'testsuite/libbase.all/URLTest.cpp'
--- a/testsuite/libbase.all/URLTest.cpp 2010-03-14 19:55:58 +0000
+++ b/testsuite/libbase.all/URLTest.cpp 2010-03-16 18:30:59 +0000
@@ -22,6 +22,7 @@
 
 #include "check.h"
 #include "URL.h"
+#include "log.h"
 #include <iostream>
 #include <sstream>
 #include <cassert>
@@ -32,6 +33,8 @@
 int
 main(int /*argc*/, char** /*argv*/)
 {
+       //gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
+       //dbglogfile.setVerbosity(2);
 
        std::string label;
 
@@ -278,9 +281,17 @@
        check_equals (u2.querystring(), "");
        check_equals (u2.anchor(), "anchor");
     }
+
+    bool threw = false;
+    try
     { // pseudo-url from Mozilla
         URL u("about:blank");
     }
+    catch (const std::exception& e)
+    {
+       threw = true;
+    }
+    check(threw);
 
 
        // TODO: Samba paths


reply via email to

[Prev in Thread] Current Thread [Next in Thread]