Changeset 185172 in webkit


Ignore:
Timestamp:
Jun 3, 2015, 3:32:40 PM (10 years ago)
Author:
dino@apple.com
Message:

Crash in GraphicsContext3D::getInternalFramebufferSize
https://bugs.webkit.org/show_bug.cgi?id=145479
<rdar://problem/16461048>

Reviewed by Eric Carlson.

Source/WebCore:

If we are in an unitialized or lost state, don't try to access the context.

In order to test this, I added an Internal setting that always
forces WebGL into a pending state.

Test: fast/canvas/webgl/useWhilePending.html

  • html/canvas/WebGLRenderingContextBase.cpp:

(WebCore::WebGLRenderingContextBase::create): Check internal settings for
a forced pending state.
(WebCore::WebGLRenderingContextBase::drawingBufferWidth): Guard against a pending state.
(WebCore::WebGLRenderingContextBase::drawingBufferHeight): Ditto.

  • page/Settings.cpp: New Internal setting for forcing a pending policy.

(WebCore::Settings::Settings):
(WebCore::Settings::setForcePendingWebGLPolicy):

  • page/Settings.h:

(WebCore::Settings::isForcePendingWebGLPolicy):

  • testing/InternalSettings.cpp:

(WebCore::InternalSettings::Backup::Backup):
(WebCore::InternalSettings::Backup::restoreTo):
(WebCore::InternalSettings::setForcePendingWebGLPolicy):

  • testing/InternalSettings.h:
  • testing/InternalSettings.idl:

LayoutTests:

Attemps to use a WebGL context while it is in the pending state.

  • fast/canvas/webgl/useWhilePending-expected.txt: Added.
  • fast/canvas/webgl/useWhilePending.html: Added.
Location:
trunk
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r185171 r185172  
     12015-06-03  Dean Jackson  <dino@apple.com>
     2
     3        Crash in GraphicsContext3D::getInternalFramebufferSize
     4        https://bugs.webkit.org/show_bug.cgi?id=145479
     5        <rdar://problem/16461048>
     6
     7        Reviewed by Eric Carlson.
     8
     9        Attemps to use a WebGL context while it is in the pending state.
     10
     11        * fast/canvas/webgl/useWhilePending-expected.txt: Added.
     12        * fast/canvas/webgl/useWhilePending.html: Added.
     13
    1142015-06-03  Daniel Bates  <dabates@apple.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r185167 r185172  
     12015-06-03  Dean Jackson  <dino@apple.com>
     2
     3        Crash in GraphicsContext3D::getInternalFramebufferSize
     4        https://bugs.webkit.org/show_bug.cgi?id=145479
     5        <rdar://problem/16461048>
     6
     7        Reviewed by Eric Carlson.
     8
     9        If we are in an unitialized or lost state, don't try to access the context.
     10
     11        In order to test this, I added an Internal setting that always
     12        forces WebGL into a pending state.
     13
     14        Test: fast/canvas/webgl/useWhilePending.html
     15
     16        * html/canvas/WebGLRenderingContextBase.cpp:
     17        (WebCore::WebGLRenderingContextBase::create): Check internal settings for
     18        a forced pending state.
     19        (WebCore::WebGLRenderingContextBase::drawingBufferWidth): Guard against a pending state.
     20        (WebCore::WebGLRenderingContextBase::drawingBufferHeight): Ditto.
     21        * page/Settings.cpp: New Internal setting for forcing a pending policy.
     22        (WebCore::Settings::Settings):
     23        (WebCore::Settings::setForcePendingWebGLPolicy):
     24        * page/Settings.h:
     25        (WebCore::Settings::isForcePendingWebGLPolicy):
     26        * testing/InternalSettings.cpp:
     27        (WebCore::InternalSettings::Backup::Backup):
     28        (WebCore::InternalSettings::Backup::restoreTo):
     29        (WebCore::InternalSettings::setForcePendingWebGLPolicy):
     30        * testing/InternalSettings.h:
     31        * testing/InternalSettings.idl:
     32
    1332015-06-03  Hunseop Jeong  <hs85.jeong@samsung.com>
    234
  • trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp

    r185145 r185172  
    363363    Document& topDocument = document.topDocument();
    364364    Page* page = topDocument.page();
    365     if (page && !topDocument.url().isLocalFile()) {
    366         WebGLLoadPolicy policy = page->mainFrame().loader().client().webGLPolicyForURL(topDocument.url());
     365    bool forcingPendingPolicy = frame->settings().isForcePendingWebGLPolicy();
     366
     367    if (forcingPendingPolicy || (page && !topDocument.url().isLocalFile())) {
     368        WebGLLoadPolicy policy = forcingPendingPolicy ? WebGLPendingCreation : page->mainFrame().loader().client().webGLPolicyForURL(topDocument.url());
    367369
    368370        if (policy == WebGLBlockCreation) {
     
    401403        else
    402404            renderingContext = std::unique_ptr<WebGLRenderingContext>(new WebGLRenderingContext(canvas, attributes));
     405        renderingContext->suspendIfNeeded();
    403406        return renderingContext;
    404407    }
     
    780783int WebGLRenderingContextBase::drawingBufferWidth() const
    781784{
     785    if (m_isPendingPolicyResolution && !m_hasRequestedPolicyResolution)
     786        return 0;
     787
    782788    return m_context->getInternalFramebufferSize().width();
    783789}
     
    785791int WebGLRenderingContextBase::drawingBufferHeight() const
    786792{
     793    if (m_isPendingPolicyResolution && !m_hasRequestedPolicyResolution)
     794        return 0;
     795
    787796    return m_context->getInternalFramebufferSize().height();
    788797}
  • trunk/Source/WebCore/page/Settings.cpp

    r185145 r185172  
    202202    , m_hiddenPageCSSAnimationSuspensionEnabled(false)
    203203    , m_fontFallbackPrefersPictographs(false)
     204    , m_forcePendingWebGLPolicy(false)
    204205{
    205206    // A Frame may not have been created yet, so we initialize the AtomicString
     
    425426}
    426427
     428void Settings::setForcePendingWebGLPolicy(bool forced)
     429{
     430    m_forcePendingWebGLPolicy = forced;
     431}
     432
    427433void Settings::setPluginsEnabled(bool arePluginsEnabled)
    428434{
  • trunk/Source/WebCore/page/Settings.h

    r185145 r185172  
    271271#endif
    272272
     273    WEBCORE_EXPORT void setForcePendingWebGLPolicy(bool);
     274    bool isForcePendingWebGLPolicy() const { return m_forcePendingWebGLPolicy; }
     275
    273276private:
    274277    explicit Settings(Page*);
     
    324327    bool m_fontFallbackPrefersPictographs : 1;
    325328
     329    bool m_forcePendingWebGLPolicy : 1;
     330
    326331#if USE(AVFOUNDATION)
    327332    WEBCORE_EXPORT static bool gAVFoundationEnabled;
  • trunk/Source/WebCore/testing/InternalSettings.cpp

    r185145 r185172  
    8686#endif
    8787    , m_defaultVideoPosterURL(settings.defaultVideoPosterURL())
     88    , m_forcePendingWebGLPolicy(settings.isForcePendingWebGLPolicy())
    8889    , m_originalTimeWithoutMouseMovementBeforeHidingControls(settings.timeWithoutMouseMovementBeforeHidingControls())
    8990    , m_useLegacyBackgroundSizeShorthandBehavior(settings.useLegacyBackgroundSizeShorthandBehavior())
     
    153154#endif
    154155    settings.setDefaultVideoPosterURL(m_defaultVideoPosterURL);
     156    settings.setForcePendingWebGLPolicy(m_forcePendingWebGLPolicy);
    155157    settings.setTimeWithoutMouseMovementBeforeHidingControls(m_originalTimeWithoutMouseMovementBeforeHidingControls);
    156158    settings.setUseLegacyBackgroundSizeShorthandBehavior(m_useLegacyBackgroundSizeShorthandBehavior);
     
    211213    page()->setPageScaleFactor(1, IntPoint(0, 0));
    212214    page()->setCanStartMedia(true);
     215    page()->settings().setForcePendingWebGLPolicy(false);
    213216#if ENABLE(WIRELESS_PLAYBACK_TARGET)
    214217    m_page->settings().setAllowsAirPlayForMediaPlayback(false);
     
    469472}
    470473
     474void InternalSettings::setForcePendingWebGLPolicy(bool forced, ExceptionCode& ec)
     475{
     476    InternalSettingsGuardForSettings();
     477    settings()->setForcePendingWebGLPolicy(forced);
     478}
     479
    471480void InternalSettings::setTimeWithoutMouseMovementBeforeHidingControls(double time, ExceptionCode& ec)
    472481{
  • trunk/Source/WebCore/testing/InternalSettings.h

    r185145 r185172  
    8484#endif
    8585        String m_defaultVideoPosterURL;
     86        bool m_forcePendingWebGLPolicy;
    8687        bool m_originalTimeWithoutMouseMovementBeforeHidingControls;
    8788        bool m_useLegacyBackgroundSizeShorthandBehavior;
     
    135136    void setMinimumTimerInterval(double intervalInSeconds, ExceptionCode&);
    136137    void setDefaultVideoPosterURL(const String& url, ExceptionCode&);
     138    void setForcePendingWebGLPolicy(bool, ExceptionCode&);
    137139    void setTimeWithoutMouseMovementBeforeHidingControls(double time, ExceptionCode&);
    138140    void setUseLegacyBackgroundSizeShorthandBehavior(bool, ExceptionCode&);
  • trunk/Source/WebCore/testing/InternalSettings.idl

    r185145 r185172  
    11/*
    22 * Copyright (C) 2012 Google Inc. All rights reserved.
     3 * Copyright (C) 2015 Apple Inc. All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    5657    void setWirelessPlaybackDisabled(boolean available);
    5758
     59    [RaisesException] void setForcePendingWebGLPolicy(boolean forced);
     60
    5861    void setPluginReplacementEnabled(boolean enabled);
    5962
Note: See TracChangeset for help on using the changeset viewer.