Permalink
Browse files

Fixing recursion issue with tests-core.js.

  • Loading branch information...
1 parent 05cfa67 commit eff433781089c3f9690b6ffb657406db0d805488 David Humphrey committed Mar 9, 2011
Showing with 10 additions and 7 deletions.
  1. +10 −7 test/philip.html5.org/tests-core.js
@@ -162,13 +162,16 @@ function _addTest(test)
// Force getContext('2d') to use the 'webgl-2d' context,
// since some tests get their own context vs. ctx.
- canvas.getContext = function(t) {
- if (t === '2d') {
- return this.getContext('webgl-2d');
- } else {
- return this.getContext(t);
- }
- };
+ canvas.getContext = (function() {
+ var oldGetContext = canvas.getContext;
+ return function(t) {
+ if (t === '2d') {
+ return this.getContext('webgl-2d');
+ } else {
+ return oldGetContext.call(this, t);
+ }
+ };
+ })();
test(canvas, ctx);
}

0 comments on commit eff4337

Please sign in to comment.