Changeset 96349 in webkit
- Timestamp:
- Sep 29, 2011 12:46:01 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r96348 r96349 1 2011-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 1 13 2011-09-29 Alexey Proskuryakov <ap@apple.com> 2 14 -
trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp
r95901 r96349 78 78 79 79 namespace 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. 83 static int s_contextFailureReason = -1; 80 84 81 85 static void handleFatalErrorInV8() … … 319 323 if (m_global.IsEmpty()) { 320 324 disposeContextHandles(); 325 s_contextFailureReason = 3; 321 326 return false; 322 327 } … … 354 359 355 360 // 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; 357 363 return result; 364 } 358 365 359 366 // Create a new environment using an empty template for the shadow 360 367 // object. Reuse the global object if one has been created earlier. 361 368 v8::Persistent<v8::ObjectTemplate> globalTemplate = V8DOMWindow::GetShadowObjectTemplate(); 362 if (globalTemplate.IsEmpty()) 369 if (globalTemplate.IsEmpty()) { 370 s_contextFailureReason = 1; 363 371 return result; 372 } 364 373 365 374 // Used to avoid sleep calls in unload handlers. … … 388 397 result = v8::Context::New(&extensionConfiguration, globalTemplate, global); 389 398 399 if (result.IsEmpty()) 400 s_contextFailureReason = 2; 390 401 return result; 391 402 } … … 407 418 v8::Local<v8::Object> jsWindow = SafeAllocation::newInstance(windowConstructor); 408 419 // Bail out if allocation failed. 409 if (jsWindow.IsEmpty()) 410 return false; 420 if (jsWindow.IsEmpty()) { 421 s_contextFailureReason = 7; 422 return false; 423 } 411 424 412 425 // Wrap the window. … … 574 587 // FIXME: Temporary diagnostics as to why V8 sometimes crashes with a null context below. 575 588 // See https://bugs.webkit.org/show_bug.cgi?id=68099. 576 PlatformSupport:: incrementStatsCounter("V8Bindings.namedItemAdded.initContextFailed");589 PlatformSupport::histogramEnumeration("V8Bindings.nullContextState", 0, 3); 577 590 if (m_frame->settings() && !m_frame->settings()->isJavaScriptEnabled()) 578 PlatformSupport:: incrementStatsCounter("V8Bindings.namedItemAdded.scriptBlockedByWebCoreSettings");591 PlatformSupport::histogramEnumeration("V8Bindings.nullContextState", 1, 3); 579 592 580 593 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; 585 599 #endif 586 600 return; … … 616 630 v8::Handle<v8::String> hiddenObjectPrototypeString = V8HiddenPropertyName::objectPrototype(); 617 631 // 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 } 620 636 621 637 v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(context->Global()->Get(objectString)); 622 638 // Bail out if fetching failed. 623 if (object.IsEmpty()) 624 return false; 639 if (object.IsEmpty()) { 640 s_contextFailureReason = 5; 641 return false; 642 } 625 643 v8::Handle<v8::Value> objectPrototype = object->Get(prototypeString); 626 644 // Bail out if fetching failed. 627 if (objectPrototype.IsEmpty()) 628 return false; 645 if (objectPrototype.IsEmpty()) { 646 s_contextFailureReason = 6; 647 return false; 648 } 629 649 630 650 context->Global()->SetHiddenValue(hiddenObjectPrototypeString, objectPrototype);
Note: See TracChangeset
for help on using the changeset viewer.