gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-


From: Sandro Santilli
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-2276-g484ca4c
Date: Tue, 29 Mar 2016 18:06:01 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".

The branch, master has been updated
       via  484ca4cd2fecb73c3308fd451004f6cc2e976fbe (commit)
       via  a794319ac28c02365eddffd571a37c3ec4fb1eea (commit)
      from  29199b445b4a9315a1ae1006695f93a562592311 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=484ca4cd2fecb73c3308fd451004f6cc2e976fbe


commit 484ca4cd2fecb73c3308fd451004f6cc2e976fbe
Author: Nutchanon Wetchasit <address@hidden>
Date:   Tue Mar 29 19:19:50 2016 +0200

    Add automated tests on no-context function call via Function.call() and 
Function.apply().
    
    See bug #47354 <https://savannah.gnu.org/bugs/?47354>

diff --git a/testsuite/actionscript.all/Function.as 
b/testsuite/actionscript.all/Function.as
index b8b693f..e844403 100644
--- a/testsuite/actionscript.all/Function.as
+++ b/testsuite/actionscript.all/Function.as
@@ -1,5 +1,5 @@
 // 
-//   Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software
+//   Copyright (C) 2005, 2006, 2007, 2009, 2010, 2011, 2016 Free Software
 //   Foundation, Inc
 //
 // This program is free software; you can redistribute it and/or modify
@@ -35,6 +35,14 @@ check( ! Function.hasOwnProperty('__constructor__') );
 // Define a function returning 'this'.name and the given args
 function getThisName(a,b,c) { return this.name+a+b+c; }
 
+#if OUTPUT_VERSION >= 6
+// Define a function for checking 'this' against '_global' object
+function isThisGlobal() { return this===_global; }
+#endif
+
+// Define a function which set a property named 'instanceCheck' to 'this'
+function setThisMember(value) { this.instanceCheck=value; }
+
 // Every newly created function's super class is Object
 check_equals(getThisName.prototype.__proto__, Object.prototype);
 
@@ -121,6 +129,21 @@ var ret=getThisName.apply(undefined, "7");
   check_equals ( ret , 0 );
 #endif
 
+// Test Function.apply() with 'thisObject' being unspecified, 'undefined',
+// or 'null'
+
+function setThisMember_apply_noarg() { this.instanceCheck = "apply_no_this"; }
+check ( isThisGlobal.apply() );
+check ( isThisGlobal.apply(undefined) );
+check ( isThisGlobal.apply(null) );
+setThisMember_apply_noarg.apply();
+check_equals ( _global.instanceCheck, "apply_no_this" );
+setThisMember.apply(undefined, ["apply_undefined_this"]);
+check_equals ( _global.instanceCheck, "apply_undefined_this" );
+setThisMember.apply(null, ["apply_null_this"]);
+check_equals ( _global.instanceCheck, "apply_null_this" );
+check ( delete _global.instanceCheck );
+
 #else // OUTPUT_VERSION < 6
 
 // No Function.apply... for SWF up to 5
@@ -162,6 +185,33 @@ check_equals(typeof(ret), 'object');
 check_equals(ret, undefined); // an object type which returns 'undefined' as 
primitive value ?
 check( ! (ret === undefined) ); // an object type which returns 'undefined' as 
primitive value ?
 check( ! (ret === null) ); // an object type which returns 'undefined' as 
primitive value ?
+check( ret === _global ); // an object is actually the '_global' ?
+ret = getThis.call(undefined);
+check_equals(c, 3);
+check_equals(typeof(ret), 'object');
+check_equals(ret, undefined); // an object type which returns 'undefined' as 
primitive value ?
+check( ! (ret === undefined) ); // an object type which returns 'undefined' as 
primitive value ?
+check( ! (ret === null) ); // an object type which returns 'undefined' as 
primitive value ?
+check( ret === _global ); // an object is actually the '_global' ?
+ret = getThis.call();
+check_equals(c, 4);
+check_equals(typeof(ret), 'object');
+check_equals(ret, undefined); // an object type which returns 'undefined' as 
primitive value ?
+check( ! (ret === undefined) ); // an object type which returns 'undefined' as 
primitive value ?
+check( ! (ret === null) ); // an object type which returns 'undefined' as 
primitive value ?
+check( ret === _global ); // an object is actually the '_global' ?
+
+// Test Function.call() with 'thisObject' being unspecified, 'undefined',
+// or 'null'
+
+function setThisMember_call_noarg() { this.instanceCheck = "call_no_this"; }
+setThisMember_call_noarg.call();
+check_equals(_global.instanceCheck, "call_no_this");
+setThisMember.call(undefined, "call_undefined_this");
+check_equals(_global.instanceCheck, "call_undefined_this");
+setThisMember.call(null, "call_null_this");
+check_equals(_global.instanceCheck, "call_null_this");
+check(delete _global.instanceCheck);
 
 retCaller = 'custom'; 
 myCaller = function()
@@ -1077,8 +1127,8 @@ check_equals(called, 0);
  check_totals(150); // SWF5
 #endif
 #if OUTPUT_VERSION == 6
- check_totals(239); // SWF6
+ check_totals(263); // SWF6
 #endif
 #if OUTPUT_VERSION >= 7
- check_totals(240); // SWF7,SWF8
+ check_totals(264); // SWF7,SWF8
 #endif

http://git.savannah.gnu.org/cgit//commit/?id=a794319ac28c02365eddffd571a37c3ec4fb1eea


commit a794319ac28c02365eddffd571a37c3ec4fb1eea
Author: Nutchanon Wetchasit <address@hidden>
Date:   Tue Mar 29 19:19:24 2016 +0200

    Use _global as a fallback "this" object in Function.call() and 
Function.apply().
    
    See bug #47354 <https://savannah.gnu.org/bugs/?47354>

diff --git a/libcore/asobj/Function_as.cpp b/libcore/asobj/Function_as.cpp
index f276109..879c927 100644
--- a/libcore/asobj/Function_as.cpp
+++ b/libcore/asobj/Function_as.cpp
@@ -104,13 +104,13 @@ function_apply(const fn_call& fn)
         IF_VERBOSE_ASCODING_ERRORS(
             log_aserror(_("Function.apply() called with no args"));
         );
-        new_fn_call.this_ptr = new as_object(getGlobal(fn));
+        new_fn_call.this_ptr = &getGlobal(fn);
        }
        else {
                // Get the object to use as 'this' reference
                as_object* obj = toObject(fn.arg(0), getVM(fn));
 
-        if (!obj) obj = new as_object(getGlobal(fn)); 
+        if (!obj) obj = &getGlobal(fn);
 
         new_fn_call.this_ptr = obj;
 
@@ -156,7 +156,7 @@ function_call(const fn_call& fn)
     as_object* tp;
 
     if (!fn.nargs || fn.arg(0).is_undefined() || fn.arg(0).is_null()) {
-        tp = new as_object(getGlobal(fn));
+        tp = &getGlobal(fn);
     }
     else tp = toObject(fn.arg(0), getVM(fn));
 

-----------------------------------------------------------------------

Summary of changes:
 libcore/asobj/Function_as.cpp          |    6 ++--
 testsuite/actionscript.all/Function.as |   56 ++++++++++++++++++++++++++++++--
 2 files changed, 56 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

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