forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 2
/
gc.patch
155 lines (145 loc) · 5.04 KB
/
gc.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# HG changeset patch
# Parent f9585cefcf568dbc2a6ce81f16a2048365af7ed2
diff --git a/content/canvas/test/webgl/conformance/extensions/oes-standard-derivatives.html b/content/canvas/test/webgl/conformance/extensions/oes-standard-derivatives.html
--- a/content/canvas/test/webgl/conformance/extensions/oes-standard-derivatives.html
+++ b/content/canvas/test/webgl/conformance/extensions/oes-standard-derivatives.html
@@ -337,42 +337,21 @@ function runOutputTests() {
setupBuffers(1.0, 0.5, 0.5, 0.0);
wtu.drawQuad(gl);
expectResult([3, 3, 5, 255],
"Draw 4 (variation in x & y) returned the correct data",
"Draw 4 (variation in x & y) returned incorrect data");
}
-function attemptToForceGC()
-{
- var holderArray = [];
- var tempArray;
- window.tempArray = holderArray;
- for (var i = 0; i < 12; ++i) {
- tempArray = [];
- for (var j = 0; j < 1024 * 1024; ++j) {
- tempArray.push(0);
- }
- holderArray.push(tempArray);
- }
- window.tempArray = null;
-}
-
function runUniqueObjectTest()
{
debug("Testing that getExtension() returns the same object each time");
gl.getExtension("OES_standard_derivatives").myProperty = 2;
- if (window.GCController) {
- window.GCController.collect();
- } else if (window.opera && window.opera.collect) {
- window.opera.collect();
- } else {
- attemptToForceGC();
- }
+ gc();
shouldBe('gl.getExtension("OES_standard_derivatives").myProperty', '2');
}
function runReferenceCycleTest()
{
// create some reference cycles. The goal is to see if they cause leaks. The point is that
// some browser test runners have instrumentation to detect leaked refcounted objects.
diff --git a/content/canvas/test/webgl/conformance/extensions/oes-texture-float.html b/content/canvas/test/webgl/conformance/extensions/oes-texture-float.html
--- a/content/canvas/test/webgl/conformance/extensions/oes-texture-float.html
+++ b/content/canvas/test/webgl/conformance/extensions/oes-texture-float.html
@@ -178,42 +178,21 @@ function runRenderTargetTest(testProgram
gl.bindTexture(gl.TEXTURE_2D, texture);
gl.useProgram(testProgram);
gl.uniform1i(gl.getUniformLocation(testProgram, "tex"), 0);
wtu.drawQuad(gl);
glErrorShouldBe(gl, gl.NO_ERROR, "rendering from floating-point texture should succeed");
checkRenderingResults();
}
-function attemptToForceGC()
-{
- var holderArray = [];
- var tempArray;
- window.tempArray = holderArray;
- for (var i = 0; i < 12; ++i) {
- tempArray = [];
- for (var j = 0; j < 1024 * 1024; ++j) {
- tempArray.push(0);
- }
- holderArray.push(tempArray);
- }
- window.tempArray = null;
-}
-
function runUniqueObjectTest()
{
debug("Testing that getExtension() returns the same object each time");
gl.getExtension("OES_texture_float").myProperty = 2;
- if (window.GCController) {
- window.GCController.collect();
- } else if (window.opera && window.opera.collect) {
- window.opera.collect();
- } else {
- attemptToForceGC();
- }
+ gc();
shouldBe('gl.getExtension("OES_texture_float").myProperty', '2');
}
function runReferenceCycleTest()
{
// create some reference cycles. The goal is to see if they cause leaks. The point is that
// some browser test runners have instrumentation to detect leaked refcounted objects.
diff --git a/content/canvas/test/webgl/resources/js-test-pre.js b/content/canvas/test/webgl/resources/js-test-pre.js
--- a/content/canvas/test/webgl/resources/js-test-pre.js
+++ b/content/canvas/test/webgl/resources/js-test-pre.js
@@ -435,29 +435,42 @@ function assertMsg(assertion, msg) {
if (assertion) {
testPassed(msg);
} else {
testFailed(msg);
}
}
function gc() {
- if (typeof GCController !== "undefined")
- GCController.collect();
- else {
- function gcRec(n) {
- if (n < 1)
- return {};
- var temp = {i: "ab" + i + (i / 100000)};
- temp += "foo";
- gcRec(n-1);
- }
- for (var i = 0; i < 1000; i++)
- gcRec(10)
+ if (window.GCController) {
+ window.GCController.collect();
+ return;
}
+
+ if (window.opera && window.opera.collect) {
+ window.opera.collect();
+ return;
+ }
+
+ try {
+ window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
+ .getInterface(Components.interfaces.nsIDOMWindowUtils)
+ .garbageCollect();
+ return;
+ } catch(e) {}
+
+ function gcRec(n) {
+ if (n < 1)
+ return {};
+ var temp = {i: "ab" + i + (i / 100000)};
+ temp += "foo";
+ gcRec(n-1);
+ }
+ for (var i = 0; i < 1000; i++)
+ gcRec(10);
}
function finishTest() {
successfullyParsed = true;
var epilogue = document.createElement("script");
epilogue.onload = function() {
if (window.nonKhronosFrameworkNotifyDone) {
window.nonKhronosFrameworkNotifyDone();