Changeset 96349 in webkit


Ignore:
Timestamp:
Sep 29, 2011 12:46:01 PM (13 years ago)
Author:
Nate Chapin
Message:

[V8, chromium] More logging to determine cause of a null
v8::Context in V8DOMWindowShell::namedItemAdded().

https://bugs.webkit.org/show_bug.cgi?id=68099

Reviewed by Adam Barth.

  • bindings/v8/V8DOMWindowShell.cpp:

(WebCore::V8DOMWindowShell::namedItemAdded):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r96348 r96349  
     12011-09-29  Nate Chapin  <japhet@chromium.org>
     2
     3        [V8, chromium] More logging to determine cause of a null
     4        v8::Context in V8DOMWindowShell::namedItemAdded().
     5
     6        https://bugs.webkit.org/show_bug.cgi?id=68099
     7
     8        Reviewed by Adam Barth.
     9
     10        * bindings/v8/V8DOMWindowShell.cpp:
     11        (WebCore::V8DOMWindowShell::namedItemAdded):
     12
    1132011-09-29  Alexey Proskuryakov  <ap@apple.com>
    214
  • trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp

    r95901 r96349  
    7878
    7979namespace WebCore {
     80
     81// FIXME: Temporary diagnostics as to why V8 sometimes crashes with a null context in namedItemAdded().
     82// See https://bugs.webkit.org/show_bug.cgi?id=68099.
     83static int s_contextFailureReason = -1;
    8084
    8185static void handleFatalErrorInV8()
     
    319323        if (m_global.IsEmpty()) {
    320324            disposeContextHandles();
     325            s_contextFailureReason = 3;
    321326            return false;
    322327        }
     
    354359
    355360    // The activeDocumentLoader pointer could be 0 during frame shutdown.
    356     if (!m_frame->loader()->activeDocumentLoader())
     361    if (!m_frame->loader()->activeDocumentLoader()) {
     362        s_contextFailureReason = 0;
    357363        return result;
     364    }
    358365
    359366    // Create a new environment using an empty template for the shadow
    360367    // object. Reuse the global object if one has been created earlier.
    361368    v8::Persistent<v8::ObjectTemplate> globalTemplate = V8DOMWindow::GetShadowObjectTemplate();
    362     if (globalTemplate.IsEmpty())
     369    if (globalTemplate.IsEmpty()) {
     370        s_contextFailureReason = 1;
    363371        return result;
     372    }
    364373
    365374    // Used to avoid sleep calls in unload handlers.
     
    388397    result = v8::Context::New(&extensionConfiguration, globalTemplate, global);
    389398
     399    if (result.IsEmpty())
     400        s_contextFailureReason = 2;
    390401    return result;
    391402}
     
    407418    v8::Local<v8::Object> jsWindow = SafeAllocation::newInstance(windowConstructor);
    408419    // Bail out if allocation failed.
    409     if (jsWindow.IsEmpty())
    410         return false;
     420    if (jsWindow.IsEmpty()) {
     421        s_contextFailureReason = 7;
     422        return false;
     423    }
    411424
    412425    // Wrap the window.
     
    574587        // FIXME: Temporary diagnostics as to why V8 sometimes crashes with a null context below.
    575588        // See https://bugs.webkit.org/show_bug.cgi?id=68099.
    576         PlatformSupport::incrementStatsCounter("V8Bindings.namedItemAdded.initContextFailed");
     589        PlatformSupport::histogramEnumeration("V8Bindings.nullContextState", 0, 3);
    577590        if (m_frame->settings() && !m_frame->settings()->isJavaScriptEnabled())
    578             PlatformSupport::incrementStatsCounter("V8Bindings.namedItemAdded.scriptBlockedByWebCoreSettings");
     591            PlatformSupport::histogramEnumeration("V8Bindings.nullContextState", 1, 3);
    579592
    580593        if (!m_frame->script()->canExecuteScripts(NotAboutToExecuteScript))
    581             PlatformSupport::incrementStatsCounter("V8Bindings.namedItemAdded.scriptBlockedByScriptController");
    582 
    583         if (V8Proxy::handleOutOfMemory())
    584             PlatformSupport::incrementStatsCounter("V8Bindings.namedItemAdded.outOfMemory");
     594            PlatformSupport::histogramEnumeration("V8Bindings.nullContextState", 2, 3);
     595
     596         if (s_contextFailureReason >= 0 && s_contextFailureReason <= 7);
     597            PlatformSupport::histogramEnumeration("V8Bindings.nullContextReason", s_contextFailureReason, 8);
     598         s_contextFailureReason = -1;
    585599#endif
    586600        return;
     
    616630    v8::Handle<v8::String> hiddenObjectPrototypeString = V8HiddenPropertyName::objectPrototype();
    617631    // Bail out if allocation failed.
    618     if (objectString.IsEmpty() || prototypeString.IsEmpty() || hiddenObjectPrototypeString.IsEmpty())
    619         return false;
     632    if (objectString.IsEmpty() || prototypeString.IsEmpty() || hiddenObjectPrototypeString.IsEmpty()) {
     633        s_contextFailureReason = 4;
     634        return false;
     635    }
    620636
    621637    v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(context->Global()->Get(objectString));
    622638    // Bail out if fetching failed.
    623     if (object.IsEmpty())
    624         return false;
     639    if (object.IsEmpty()) {
     640        s_contextFailureReason = 5;
     641        return false;
     642    }
    625643    v8::Handle<v8::Value> objectPrototype = object->Get(prototypeString);
    626644    // Bail out if fetching failed.
    627     if (objectPrototype.IsEmpty())
    628         return false;
     645    if (objectPrototype.IsEmpty()) {
     646        s_contextFailureReason = 6;
     647        return false;
     648    }
    629649
    630650    context->Global()->SetHiddenValue(hiddenObjectPrototypeString, objectPrototype);
Note: See TracChangeset for help on using the changeset viewer.