Changeset 156243 in webkit


Ignore:
Timestamp:
Sep 22, 2013 12:11:10 AM (11 years ago)
Author:
Darin Adler
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.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/accessibility/accessibility-node-memory-management.html

    r155274 r156243  
    33<body>
    44<script src="../resources/js-test-pre.js"></script>
    5 
    65<canvas id="canvas" tabindex="-1"></canvas>
    7 
    86<div id="console"></div>
    97<script>
     8
     9var jsTestIsAsync = true;
     10
    1011description("This test makes sure that AccessibilityNodeObjects are properly detached when the node they point to is deleted.");
    1112
    1213if (window.testRunner && window.accessibilityController) {
    13     window.testRunner.dumpAsText();
     14    testRunner.dumpAsText();
    1415
    1516    // Create an ordinary button on the page, focus it and get its accessibility role.
     
    1718    document.body.appendChild(button);
    1819    button.focus();
    19     window.axElement = accessibilityController.focusedElement;
    20     window.expectedButtonRole = axElement.role;
     20    axElement = accessibilityController.focusedElement;
     21    expectedButtonRole = axElement.role;
    2122
    22     // Now remove the node from the tree and get the role of the detached accessibility object.
     23    // Now remove the button from the tree and get the role of the detached accessibility object.
    2324    document.body.removeChild(button);
    24     window.expectedDetachedRole = axElement.role;
     25    expectedDetachedRole = axElement.role;
    2526    shouldBeTrue("expectedButtonRole != expectedDetachedRole");
    2627
     
    3233        canvas.appendChild(button);
    3334
    34         // Note: focusing the button and using that to get its accessibility object creates an extra
     35        // Note: Focusing the button and using that to get its accessibility object creates an extra
    3536        // reference to the button and it won't get deleted when we want it to. So instead we focus the
    3637        // canvas and get its first child.
    3738        canvas.focus();
    38         window.axElement = accessibilityController.focusedElement.childAtIndex(0);
     39        axElement = accessibilityController.focusedElement.childAtIndex(0);
    3940
    40         window.canvasButtonRole = axElement.role;
     41        canvasButtonRole = axElement.role;
    4142        shouldBe("canvasButtonRole", "expectedButtonRole");
    4243
    43         // Now delete the node.
     44        // Now delete the last reference to the button.
    4445        canvas.removeChild(button);
    4546    })();
    4647
    47     // Explicitly run garbage collection now; since there are no more references to the button,
    48     // the node will be destroyed.
     48    setTimeout("finishTest()", 0);
     49}
     50
     51function finishTest()
     52{
     53    // Explicitly run garbage collection now. Since there are no more references to the button,
     54    // it will be destroyed.
    4955    gc();
    5056
    5157    // Ensure that the accessibility object is detached by checking its role.
    52     window.detachedCanvasButtonRole = axElement.role;
     58    detachedCanvasButtonRole = axElement.role;
    5359    shouldBe("detachedCanvasButtonRole", "expectedDetachedRole");
     60
     61    finishJSTest();
    5462}
    5563
  • trunk/Source/WebCore/ChangeLog

    r156241 r156243  
     12013-09-21  Darin Adler  <darin@apple.com>
     2
     3        Fix too-strict type error exceptions introduced in WebGL bindings
     4        https://bugs.webkit.org/show_bug.cgi?id=121759
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        * bindings/js/JSWebGLRenderingContextCustom.cpp:
     9        (WebCore::JSWebGLRenderingContext::getAttachedShaders): Allow undefined
     10        or null without throwing type error.
     11        (WebCore::JSWebGLRenderingContext::getProgramParameter): Ditto.
     12        (WebCore::JSWebGLRenderingContext::getUniform): Ditto.
     13        (WebCore::dataFunctionf): Ditto.
     14        (WebCore::dataFunctioni): Ditto.
     15        (WebCore::dataFunctionMatrix): Ditto.
     16
    1172013-09-21  Sam Weinig  <sam@webkit.org>
    218
  • trunk/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp

    r156240 r156243  
    248248    WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());
    249249    WebGLProgram* program = toWebGLProgram(exec->uncheckedArgument(0));
    250     if (!program)
     250    if (!program && !exec->uncheckedArgument(0).isUndefinedOrNull())
    251251        return throwTypeError(exec);
    252252    Vector<RefPtr<WebGLShader> > shaders;
     
    332332    WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());
    333333    WebGLProgram* program = toWebGLProgram(exec->uncheckedArgument(0));
    334     if (!program)
     334    if (!program && !exec->uncheckedArgument(0).isUndefinedOrNull())
    335335        return throwTypeError(exec);
    336336    unsigned pname = exec->uncheckedArgument(1).toInt32(exec);
     
    396396    WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());
    397397    WebGLProgram* program = toWebGLProgram(exec->uncheckedArgument(0));
    398     if (!program)
     398    if (!program && !exec->uncheckedArgument(0).isUndefinedOrNull())
    399399        return throwTypeError(exec);
    400400    WebGLUniformLocation* location = toWebGLUniformLocation(exec->uncheckedArgument(1));
    401     if (!location)
     401    if (!location && !exec->uncheckedArgument(1).isUndefinedOrNull())
    402402        return throwTypeError(exec);
    403403    WebGLGetInfo info = context->getUniform(program, location, ec);
     
    470470    if (functionForUniform(f)) {
    471471        location = toWebGLUniformLocation(exec->uncheckedArgument(0));
    472         if (!location)
     472        if (!location && !exec->uncheckedArgument(0).isUndefinedOrNull())
    473473            return throwTypeError(exec);
    474474    } else
     
    556556
    557557    WebGLUniformLocation* location = toWebGLUniformLocation(exec->uncheckedArgument(0));
    558     if (!location)
     558    if (!location && !exec->uncheckedArgument(0).isUndefinedOrNull())
    559559        return throwTypeError(exec);
    560560 
     
    616616
    617617    WebGLUniformLocation* location = toWebGLUniformLocation(exec->uncheckedArgument(0));
    618     if (!location)
     618    if (!location && !exec->uncheckedArgument(0).isUndefinedOrNull())
    619619        return throwTypeError(exec);
    620620
Note: See TracChangeset for help on using the changeset viewer.