Title: [156243] trunk
Revision
156243
Author
[email protected]
Date
2013-09-22 00:11:10 -0700 (Sun, 22 Sep 2013)

Log Message

Fix too-strict type error exceptions introduced in WebGL bindings
https://bugs.webkit.org/show_bug.cgi?id=121759

Reviewed by Alexey Proskuryakov.

* bindings/js/JSWebGLRenderingContextCustom.cpp:
(WebCore::JSWebGLRenderingContext::getAttachedShaders): Allow undefined
or null without throwing type error.
(WebCore::JSWebGLRenderingContext::getProgramParameter): Ditto.
(WebCore::JSWebGLRenderingContext::getUniform): Ditto.
(WebCore::dataFunctionf): Ditto.
(WebCore::dataFunctioni): Ditto.
(WebCore::dataFunctionMatrix): Ditto.

Modified Paths

Diff

Modified: trunk/LayoutTests/accessibility/accessibility-node-memory-management.html (156242 => 156243)


--- trunk/LayoutTests/accessibility/accessibility-node-memory-management.html	2013-09-22 05:00:45 UTC (rev 156242)
+++ trunk/LayoutTests/accessibility/accessibility-node-memory-management.html	2013-09-22 07:11:10 UTC (rev 156243)
@@ -2,26 +2,27 @@
 <html>
 <body>
 <script src=""
-
 <canvas id="canvas" tabindex="-1"></canvas>
-
 <div id="console"></div>
 <script>
+
+var jsTestIsAsync = true;
+
 description("This test makes sure that AccessibilityNodeObjects are properly detached when the node they point to is deleted.");
 
 if (window.testRunner && window.accessibilityController) {
-    window.testRunner.dumpAsText();
+    testRunner.dumpAsText();
 
     // Create an ordinary button on the page, focus it and get its accessibility role.
     var button = document.createElement('button');
     document.body.appendChild(button);
     button.focus();
-    window.axElement = accessibilityController.focusedElement;
-    window.expectedButtonRole = axElement.role;
+    axElement = accessibilityController.focusedElement;
+    expectedButtonRole = axElement.role;
 
-    // Now remove the node from the tree and get the role of the detached accessibility object.
+    // Now remove the button from the tree and get the role of the detached accessibility object.
     document.body.removeChild(button);
-    window.expectedDetachedRole = axElement.role;
+    expectedDetachedRole = axElement.role;
     shouldBeTrue("expectedButtonRole != expectedDetachedRole");
 
     // This time create a button that's a child of a canvas element. It will be focusable but not rendered.
@@ -31,26 +32,33 @@
         var button = document.createElement('button');
         canvas.appendChild(button);
 
-        // Note: focusing the button and using that to get its accessibility object creates an extra
+        // Note: Focusing the button and using that to get its accessibility object creates an extra
         // reference to the button and it won't get deleted when we want it to. So instead we focus the
         // canvas and get its first child.
         canvas.focus();
-        window.axElement = accessibilityController.focusedElement.childAtIndex(0);
+        axElement = accessibilityController.focusedElement.childAtIndex(0);
 
-        window.canvasButtonRole = axElement.role;
+        canvasButtonRole = axElement.role;
         shouldBe("canvasButtonRole", "expectedButtonRole");
 
-        // Now delete the node.
+        // Now delete the last reference to the button.
         canvas.removeChild(button);
     })();
 
-    // Explicitly run garbage collection now; since there are no more references to the button,
-    // the node will be destroyed.
+    setTimeout("finishTest()", 0);
+}
+
+function finishTest()
+{
+    // Explicitly run garbage collection now. Since there are no more references to the button,
+    // it will be destroyed.
     gc();
 
     // Ensure that the accessibility object is detached by checking its role.
-    window.detachedCanvasButtonRole = axElement.role;
+    detachedCanvasButtonRole = axElement.role;
     shouldBe("detachedCanvasButtonRole", "expectedDetachedRole");
+
+    finishJSTest();
 }
 
 </script>

Modified: trunk/Source/WebCore/ChangeLog (156242 => 156243)


--- trunk/Source/WebCore/ChangeLog	2013-09-22 05:00:45 UTC (rev 156242)
+++ trunk/Source/WebCore/ChangeLog	2013-09-22 07:11:10 UTC (rev 156243)
@@ -1,3 +1,19 @@
+2013-09-21  Darin Adler  <[email protected]>
+
+        Fix too-strict type error exceptions introduced in WebGL bindings
+        https://bugs.webkit.org/show_bug.cgi?id=121759
+
+        Reviewed by Alexey Proskuryakov.
+
+        * bindings/js/JSWebGLRenderingContextCustom.cpp:
+        (WebCore::JSWebGLRenderingContext::getAttachedShaders): Allow undefined
+        or null without throwing type error.
+        (WebCore::JSWebGLRenderingContext::getProgramParameter): Ditto.
+        (WebCore::JSWebGLRenderingContext::getUniform): Ditto.
+        (WebCore::dataFunctionf): Ditto.
+        (WebCore::dataFunctioni): Ditto.
+        (WebCore::dataFunctionMatrix): Ditto.
+
 2013-09-21  Sam Weinig  <[email protected]>
 
         Event and EventTarget interfaces don't need to be store as AtomicStrings

Modified: trunk/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp (156242 => 156243)


--- trunk/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp	2013-09-22 05:00:45 UTC (rev 156242)
+++ trunk/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp	2013-09-22 07:11:10 UTC (rev 156243)
@@ -247,7 +247,7 @@
     ExceptionCode ec = 0;
     WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());
     WebGLProgram* program = toWebGLProgram(exec->uncheckedArgument(0));
-    if (!program)
+    if (!program && !exec->uncheckedArgument(0).isUndefinedOrNull())
         return throwTypeError(exec);
     Vector<RefPtr<WebGLShader> > shaders;
     bool succeed = context->getAttachedShaders(program, shaders, ec);
@@ -331,7 +331,7 @@
     ExceptionCode ec = 0;
     WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());
     WebGLProgram* program = toWebGLProgram(exec->uncheckedArgument(0));
-    if (!program)
+    if (!program && !exec->uncheckedArgument(0).isUndefinedOrNull())
         return throwTypeError(exec);
     unsigned pname = exec->uncheckedArgument(1).toInt32(exec);
     if (exec->hadException())
@@ -395,10 +395,10 @@
     ExceptionCode ec = 0;
     WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());
     WebGLProgram* program = toWebGLProgram(exec->uncheckedArgument(0));
-    if (!program)
+    if (!program && !exec->uncheckedArgument(0).isUndefinedOrNull())
         return throwTypeError(exec);
     WebGLUniformLocation* location = toWebGLUniformLocation(exec->uncheckedArgument(1));
-    if (!location)
+    if (!location && !exec->uncheckedArgument(1).isUndefinedOrNull())
         return throwTypeError(exec);
     WebGLGetInfo info = context->getUniform(program, location, ec);
     if (ec) {
@@ -469,7 +469,7 @@
     
     if (functionForUniform(f)) {
         location = toWebGLUniformLocation(exec->uncheckedArgument(0));
-        if (!location)
+        if (!location && !exec->uncheckedArgument(0).isUndefinedOrNull())
             return throwTypeError(exec);
     } else
         index = exec->uncheckedArgument(0).toInt32(exec);
@@ -555,7 +555,7 @@
         return exec->vm().throwException(exec, createNotEnoughArgumentsError(exec));
 
     WebGLUniformLocation* location = toWebGLUniformLocation(exec->uncheckedArgument(0));
-    if (!location)
+    if (!location && !exec->uncheckedArgument(0).isUndefinedOrNull())
         return throwTypeError(exec);
   
     RefPtr<Int32Array> webGLArray = toInt32Array(exec->uncheckedArgument(1));
@@ -615,7 +615,7 @@
         return exec->vm().throwException(exec, createNotEnoughArgumentsError(exec));
 
     WebGLUniformLocation* location = toWebGLUniformLocation(exec->uncheckedArgument(0));
-    if (!location)
+    if (!location && !exec->uncheckedArgument(0).isUndefinedOrNull())
         return throwTypeError(exec);
 
     bool transpose = exec->uncheckedArgument(1).toBoolean(exec);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to