phoboslab/Ejecta — pull request #400 by finscn (2014-06-08 06:04:41+00:00)
Title: Fix the bug about the circular reference between jsCanvas and jsContext

fix #398

test - case :
```
var w = window.innerWidth;
var h = window.innerHeight;
var canvas = document.getElementById('canvas');
canvas.width = w;
canvas.height = h;
var context = canvas.getContext('2d');

function createCanvas(width, height) {
var canvas = document.createElement("canvas");
canvas.width = width;
canvas.height = height;
canvas.retinaResolutionEnabled = false;
return canvas;
}

function createTempContexts(count) {
count = count || 10
for (var i = 0; i < count; i++) {
var temp = createCanvas(1000, 1000);
var ctx = temp.getContext("2d");
}
}

var globalContextList = [];

function createGlobalCanvases(count) {
count = count || 10
for (var i = 0; i < count; i++) {
var canvas = createCanvas(500, 500);
var ctx = canvas.getContext("2d");
globalContextList.push(ctx);
}
}

createGlobalCanvases(40);
createTempContexts(40);

var pool = [];
setInterval(function() {
// for eating memory
var longString = (new Array(1000)).join("X")
pool.push(longString);

// Expected Result:
// When recive memroy warning ,
// the canvas of ctx (in globalContextList) should NOT be release (size 500*500).
// but canvas of ctx be created in createTempContexts should be release (size 1000*1000).

}, 20);
```