Fix the crash issue for debug version when restoring texture binding at Unit 0 in DrawingBuffer::prepareMailbox()

BUG=254345

Review URL: https://chromiumcodereview.appspot.com/17835002

git-svn-id: svn://svn.chromium.org/blink/trunk@153065 bbb929c8-8fbe-4397-9dbb-9b2b20218538
diff --git a/Source/core/html/canvas/WebGLRenderingContext.cpp b/Source/core/html/canvas/WebGLRenderingContext.cpp
index 6fc446f..1faa49d 100644
--- a/Source/core/html/canvas/WebGLRenderingContext.cpp
+++ b/Source/core/html/canvas/WebGLRenderingContext.cpp
@@ -1660,8 +1660,11 @@
     if (!deleteObject(texture))
         return;
     for (size_t i = 0; i < m_textureUnits.size(); ++i) {
-        if (texture == m_textureUnits[i].m_texture2DBinding)
+        if (texture == m_textureUnits[i].m_texture2DBinding) {
             m_textureUnits[i].m_texture2DBinding = 0;
+            if (!i)
+                m_drawingBuffer->setTexture2DBinding(0);
+        }
         if (texture == m_textureUnits[i].m_textureCubeMapBinding)
             m_textureUnits[i].m_textureCubeMapBinding = 0;
     }