REGRESSION (r199819): CrashTracer: [GraphicsContext3D::getInternalFramebufferSize
https://bugs.webkit.org/show_bug.cgi?id=158895
<rdar://problem/26423617>
Reviewed by Zalan Bujtas.
Source/WebCore:
In r199819 we started resetting contexts if the page had too
many. Unfortunately there were entry points in the WebGL context
that didn't check for the validity of the object before trying
to access the lower level objects.
Test: webgl/many-contexts-access-after-loss.html
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::drawingBufferWidth): Return 0 if we're lost.
(WebCore::WebGLRenderingContextBase::drawingBufferHeight): Ditto.
LayoutTests:
New test to access the contexts after loss. Also cleaned
up the JavaScript code in the existing test (and made sure
it ran outside of the test system).
* webgl/many-contexts-access-after-loss-expected.txt: Added.
* webgl/many-contexts-access-after-loss.html: Added.
* webgl/many-contexts.html:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@202192 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index e78f38f..b43c4b5 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,19 @@
+2016-06-17 Dean Jackson <dino@apple.com>
+
+ REGRESSION (r199819): CrashTracer: [GraphicsContext3D::getInternalFramebufferSize
+ https://bugs.webkit.org/show_bug.cgi?id=158895
+ <rdar://problem/26423617>
+
+ Reviewed by Zalan Bujtas.
+
+ New test to access the contexts after loss. Also cleaned
+ up the JavaScript code in the existing test (and made sure
+ it ran outside of the test system).
+
+ * webgl/many-contexts-access-after-loss-expected.txt: Added.
+ * webgl/many-contexts-access-after-loss.html: Added.
+ * webgl/many-contexts.html:
+
2016-06-17 Antoine Quint <graouts@apple.com>
Web video playback controls should have RTL volume slider
diff --git a/LayoutTests/webgl/many-contexts-access-after-loss-expected.txt b/LayoutTests/webgl/many-contexts-access-after-loss-expected.txt
new file mode 100644
index 0000000..beed4c7
--- /dev/null
+++ b/LayoutTests/webgl/many-contexts-access-after-loss-expected.txt
@@ -0,0 +1,185 @@
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 13: There are too many active WebGL contexts on this page, the oldest context will be lost.
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 0
+CONSOLE MESSAGE: line 17: 1
+CONSOLE MESSAGE: line 17: 1
+CONSOLE MESSAGE: line 17: 1
+CONSOLE MESSAGE: line 17: 1
+CONSOLE MESSAGE: line 17: 1
+CONSOLE MESSAGE: line 17: 1
+CONSOLE MESSAGE: line 17: 1
+CONSOLE MESSAGE: line 17: 1
+CONSOLE MESSAGE: line 17: 1
+CONSOLE MESSAGE: line 17: 1
+CONSOLE MESSAGE: line 17: 1
+CONSOLE MESSAGE: line 17: 1
+CONSOLE MESSAGE: line 17: 1
+CONSOLE MESSAGE: line 17: 1
+CONSOLE MESSAGE: line 17: 1
+CONSOLE MESSAGE: line 17: 1
+PASS if this test did not crash.
diff --git a/LayoutTests/webgl/many-contexts-access-after-loss.html b/LayoutTests/webgl/many-contexts-access-after-loss.html
new file mode 100644
index 0000000..977ef22
--- /dev/null
+++ b/LayoutTests/webgl/many-contexts-access-after-loss.html
@@ -0,0 +1,21 @@
+<div id="result">PASS if this test did not crash.</div>
+<script>
+if (window.testRunner) {
+ testRunner.waitUntilDone();
+ testRunner.dumpAsText();
+}
+let size = 100;
+let canvii = new Array();
+for (let i = 0; i < size; i++) {
+ canvii[i] = document.createElement("canvas");
+ canvii[i].width = 1;
+ canvii[i].height = 1;
+ canvii[i].getContext("webgl");
+}
+for (let i = 0; i < size; i++) {
+ let context = canvii[i].getContext("webgl");
+ console.log(context.drawingBufferWidth);
+}
+if (window.testRunner)
+ testRunner.notifyDone();
+</script>
diff --git a/LayoutTests/webgl/many-contexts.html b/LayoutTests/webgl/many-contexts.html
index 8cbc97b..e6a9d19 100644
--- a/LayoutTests/webgl/many-contexts.html
+++ b/LayoutTests/webgl/many-contexts.html
@@ -3,14 +3,14 @@
if (window.testRunner) {
testRunner.waitUntilDone();
testRunner.dumpAsText();
- var size = 1000;
- var canvii = new Array();
- for (var i = 0; i < size; i++) {
- canvii[i] = document.createElement("canvas");
- canvii[i].width = 1;
- canvii[i].height = 1;
- var context = canvii[i].getContext("webgl", null);
- }
- testRunner.notifyDone();
}
+let canvii = new Array();
+for (let i = 0; i < 1000; i++) {
+ canvii[i] = document.createElement("canvas");
+ canvii[i].width = 1;
+ canvii[i].height = 1;
+ canvii[i].getContext("webgl");
+}
+if (window.testRunner)
+ testRunner.notifyDone();
</script>
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 1bb6c27..d393e43 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,22 @@
+2016-06-17 Dean Jackson <dino@apple.com>
+
+ REGRESSION (r199819): CrashTracer: [GraphicsContext3D::getInternalFramebufferSize
+ https://bugs.webkit.org/show_bug.cgi?id=158895
+ <rdar://problem/26423617>
+
+ Reviewed by Zalan Bujtas.
+
+ In r199819 we started resetting contexts if the page had too
+ many. Unfortunately there were entry points in the WebGL context
+ that didn't check for the validity of the object before trying
+ to access the lower level objects.
+
+ Test: webgl/many-contexts-access-after-loss.html
+
+ * html/canvas/WebGLRenderingContextBase.cpp:
+ (WebCore::WebGLRenderingContextBase::drawingBufferWidth): Return 0 if we're lost.
+ (WebCore::WebGLRenderingContextBase::drawingBufferHeight): Ditto.
+
2016-06-17 Daniel Bates <dabates@apple.com>
Unreviewed, rolling out r202186.
diff --git a/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp b/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
index e5ea6c2..65b2045 100644
--- a/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
+++ b/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
@@ -804,6 +804,9 @@
int WebGLRenderingContextBase::drawingBufferWidth() const
{
+ if (isContextLost())
+ return 0;
+
if (m_isPendingPolicyResolution && !m_hasRequestedPolicyResolution)
return 0;
@@ -812,6 +815,9 @@
int WebGLRenderingContextBase::drawingBufferHeight() const
{
+ if (isContextLost())
+ return 0;
+
if (m_isPendingPolicyResolution && !m_hasRequestedPolicyResolution)
return 0;