gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r11307: Fix undefined behaviour and


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r11307: Fix undefined behaviour and compiler warning. Add proper tests, correct
Date: Thu, 23 Jul 2009 11:12:59 -0600
User-agent: Bazaar (1.13.1)

------------------------------------------------------------
revno: 11307
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Thu 2009-07-23 11:12:59 -0600
message:
  Fix undefined behaviour and compiler warning. Add proper tests, correct
  behaviour.
modified:
  libcore/asobj/flash/system/System_as.cpp
  testsuite/actionscript.all/System.as
    ------------------------------------------------------------
    revno: 11305.1.1
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Thu 2009-07-23 14:23:55 +0100
    message:
      Test allowDomain properly.
    modified:
      testsuite/actionscript.all/System.as
    ------------------------------------------------------------
    revno: 11305.1.2
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Thu 2009-07-23 14:28:29 +0100
    message:
      Don't use an uninitialized variable in System.security.allowDomain (the
      compiler warns about this too). Implement according to tests rather than
      guessing.
    modified:
      libcore/asobj/flash/system/System_as.cpp
    ------------------------------------------------------------
    revno: 11305.1.3
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Thu 2009-07-23 17:43:41 +0100
    message:
      Merge LC build fix.
    modified:
      libamf/lcshm.cpp
=== modified file 'libcore/asobj/flash/system/System_as.cpp'
--- a/libcore/asobj/flash/system/System_as.cpp  2009-07-16 09:12:10 +0000
+++ b/libcore/asobj/flash/system/System_as.cpp  2009-07-23 13:28:29 +0000
@@ -362,22 +362,28 @@
 
 }
 
-
+// This function returns false if no arguments were passed, true if any
+// arguments were passed at all, even if they are not strings. There is
+// currently no known way of accessing the list of allowed domains.
 as_value
 system_security_allowdomain(const fn_call& fn)
 {
        // NOTE: This is the AS2 version of allowDomain, the AS3 version is 
located
        // in Security_as.cpp
-       bool result;
+    if (!fn.nargs) {
+        IF_VERBOSE_ASCODING_ERRORS(
+            log_aserror("System.security.allowDomain requires at least one "
+                "argument.");
+        );
+        return as_value(false);
+    }
 
-       // NOTE: Once the security portion (in the VM?) of this is implemented,
-       // this should probably return true only if access to the added domain 
was
-       // successfully granted
-    LOG_ONCE(log_unimpl ("System.security.allowDomain currently stores domains 
but does nothing else. It returns true if the string was successfuly stored.") 
);
-       for(unsigned int i = 0; i < fn.nargs; ++i) {
-               result = addAllowDataAccess( fn.arg(i).to_string());
+    LOG_ONCE(log_unimpl ("System.security.allowDomain currently stores "
+                "domains but does nothing else.")); 
+       for (unsigned int i = 0; i < fn.nargs; ++i) {
+               addAllowDataAccess(fn.arg(i).to_string());
        }
-    return as_value(result); 
+    return as_value(true);
 }
 
 

=== modified file 'testsuite/actionscript.all/System.as'
--- a/testsuite/actionscript.all/System.as      2009-07-15 16:35:45 +0000
+++ b/testsuite/actionscript.all/System.as      2009-07-23 13:23:55 +0000
@@ -179,14 +179,28 @@
 // Tries to exec whatisthis from a particular location?
 xcheck_equals(typeof(p.launch), 'function');
 
-trace(System.security.allowDomain("um"));
+ret = System.security.allowDomain(1);
+check_equals(typeof(ret), "boolean");
+check_equals(ret, true);
+ret = System.security.allowDomain(false);
+check_equals(ret, true);
+ret = System.security.allowDomain("string");
+check_equals(ret, true);
+ret = System.security.allowDomain("http://www.gnashdev.org";);
+check_equals(ret, true);
+ret = System.security.allowDomain();
+check_equals(ret, false);
+ret = System.security.allowDomain("string again");
+check_equals(ret, true);
+ret = System.security.allowDomain(undefined);
+check_equals(ret, true);
 
 #if OUTPUT_VERSION > 6
- check_totals(85);
+ check_totals(93);
 #else
 # if OUTPUT_VERSION == 6
-   check_totals(84);
+   check_totals(92);
 # else
-   check_totals(51);
+   check_totals(59);
 # endif
 #endif


reply via email to

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