Skip to content

Instantly share code, notes, and snippets.

@rwaldron
Created November 1, 2010 20:42
Show Gist options
  • Save rwaldron/658832 to your computer and use it in GitHub Desktop.
Save rwaldron/658832 to your computer and use it in GitHub Desktop.
overwrites function.prototype.call with enforced scope. (the closure seems unnec. but is, when running in FF)
var originalCall = (function () {
return Function.prototype.call;
})();
Function.prototype.call = function () {
console.log('Logging:', arguments);
return originalCall;
}
function foo(arg) {
return arg;
}
foo('this should log to the console');
// Tested in FF4b6, FF3.6.13pre, 9.0.567.0 (64354) Ubuntu 10.04
@rwaldron
Copy link
Author

rwaldron commented Nov 1, 2010

Yes. It does. I just tested it - in the browsers I listed above. on Ubuntu 10.04

@rwaldron
Copy link
Author

rwaldron commented Nov 2, 2010

I take that back, FF isn't logging. Firebug's implicit logging is what I was seeing. Duh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment