Title: [96536] trunk/Tools
Revision
96536
Author
[email protected]
Date
2011-10-03 13:51:21 -0700 (Mon, 03 Oct 2011)

Log Message

garden-o-matic should work in Safari 5.1
https://bugs.webkit.org/show_bug.cgi?id=69290

Reviewed by Sam Weinig.

My old implementation of bind was too clever by half.  This one seems
to work better, at least according to this test.

* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/base.js:
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/base_unittests.js:

Modified Paths

Diff

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/base.js (96535 => 96536)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/base.js	2011-10-03 20:43:37 UTC (rev 96535)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/base.js	2011-10-03 20:51:21 UTC (rev 96536)
@@ -31,9 +31,19 @@
 if (!('bind' in Function.prototype)) {
     Function.prototype.bind = function(thisObject) {
         var method = this;
-        var boundArguments = [].concat(arguments).slice(1);
+        var boundArguments = [];
+        for (var i = 1; i < arguments.length; ++i) {
+            boundArguments.push(arguments[i]);
+        }
         return function() {
-            return method.apply(thisObject, boundArguments.concat(arguments));
+            var actualParameters = [];
+            for (var i = 0; i < boundArguments.length; ++i) {
+                actualParameters.push(boundArguments[i]);
+            }
+            for (var i = 0; i < arguments.length; ++i) {
+                actualParameters.push(arguments[i]);
+            }
+            return method.apply(thisObject, actualParameters);
         }
     }
 }

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/base_unittests.js (96535 => 96536)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/base_unittests.js	2011-10-03 20:43:37 UTC (rev 96535)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/base_unittests.js	2011-10-03 20:51:21 UTC (rev 96536)
@@ -27,6 +27,22 @@
 
 module("base");
 
+test("bind", 3, function() {
+    function func(a, b) {
+        equals(this.prop, 5);
+        equals(a, "banana");
+        deepEqual(b, [2, 3, 4]);
+    }
+
+    var thisObject = {
+        "prop": 5
+    };
+
+    var bound = func.bind(thisObject, "banana");
+    bound([2, 3, 4]);
+});
+
+
 test("joinPath", 1, function() {
     var value = base.joinPath("path/to", "test.html");
     equals(value, "path/to/test.html");

Modified: trunk/Tools/ChangeLog (96535 => 96536)


--- trunk/Tools/ChangeLog	2011-10-03 20:43:37 UTC (rev 96535)
+++ trunk/Tools/ChangeLog	2011-10-03 20:51:21 UTC (rev 96536)
@@ -1,3 +1,16 @@
+2011-10-03  Adam Barth  <[email protected]>
+
+        garden-o-matic should work in Safari 5.1
+        https://bugs.webkit.org/show_bug.cgi?id=69290
+
+        Reviewed by Sam Weinig.
+
+        My old implementation of bind was too clever by half.  This one seems
+        to work better, at least according to this test.
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/base.js:
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/base_unittests.js:
+
 2011-09-29  Ademar de Souza Reis Jr.  <[email protected]>
 
         Unreviewed: change my e-mail in commiters.py
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to