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:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@96536
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
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);
}
}
}
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");
+2011-10-03 Adam Barth <abarth@webkit.org>
+
+ 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. <ademar.reis@openbossa.org>
Unreviewed: change my e-mail in commiters.py