Changeset 97280 in webkit
- Timestamp:
- Oct 12, 2011 11:45:47 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r97278 r97280 1 2011-10-12 Nate Chapin <japhet@chromium.org> 2 3 Remove logging to determine how null v8::Contexts are happening, 4 and check the return value of V8DOMWindowShell::initContextIfNeeded() 5 before using the context it initialized. 6 https://bugs.webkit.org/show_bug.cgi?id=68099 7 8 Reviewed by Adam Barth. 9 10 No new tests, the only symptom is a crash without a known repro. 11 12 * bindings/v8/ScriptController.cpp: 13 * bindings/v8/V8DOMWindowShell.cpp: 14 (WebCore::V8DOMWindowShell::initContextIfNeeded): Return true 15 if a context already existed. 16 (WebCore::V8DOMWindowShell::namedItemAdded): Remove logging. 17 * bindings/v8/V8Proxy.cpp: 18 1 19 2011-10-06 Robert Hogan <robert@webkit.org> 2 20 -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
r97109 r97280 2727 2727 proxy = V8Proxy::retrieve(impl->document()->frame()); 2728 2728 if (proxy && static_cast<Node*>(impl->document()) == static_cast<Node*>(impl)) { 2729 if (proxy->windowShell()-> initContextIfNeeded()) {2729 if (proxy->windowShell()->context().IsEmpty() && proxy->windowShell()->initContextIfNeeded()) { 2730 2730 // initContextIfNeeded may have created a wrapper for the object, retry from the start. 2731 2731 return ${className}::wrap(impl); -
trunk/Source/WebCore/bindings/v8/ScriptController.cpp
r96991 r97280 270 270 void ScriptController::disableEval() 271 271 { 272 m_proxy->windowShell()->initContextIfNeeded(); 272 if (!m_proxy->windowShell()->initContextIfNeeded()) 273 return; 273 274 274 275 v8::HandleScope handleScope; -
trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp
r96357 r97280 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;84 80 85 81 static void handleFatalErrorInV8() … … 282 278 // Bail out if the context has already been initialized. 283 279 if (!m_context.IsEmpty()) 284 return false;280 return true; 285 281 286 282 // Create a handle scope for all local handles. … … 323 319 if (m_global.IsEmpty()) { 324 320 disposeContextHandles(); 325 s_contextFailureReason = 3;326 321 return false; 327 322 } … … 359 354 360 355 // The activeDocumentLoader pointer could be 0 during frame shutdown. 361 if (!m_frame->loader()->activeDocumentLoader()) { 362 s_contextFailureReason = 0; 356 if (!m_frame->loader()->activeDocumentLoader()) 363 357 return result; 364 }365 358 366 359 // Create a new environment using an empty template for the shadow 367 360 // object. Reuse the global object if one has been created earlier. 368 361 v8::Persistent<v8::ObjectTemplate> globalTemplate = V8DOMWindow::GetShadowObjectTemplate(); 369 if (globalTemplate.IsEmpty()) { 370 s_contextFailureReason = 1; 362 if (globalTemplate.IsEmpty()) 371 363 return result; 372 }373 364 374 365 // Used to avoid sleep calls in unload handlers. … … 397 388 result = v8::Context::New(&extensionConfiguration, globalTemplate, global); 398 389 399 if (result.IsEmpty())400 s_contextFailureReason = 2;401 390 return result; 402 391 } … … 418 407 v8::Local<v8::Object> jsWindow = SafeAllocation::newInstance(windowConstructor); 419 408 // Bail out if allocation failed. 420 if (jsWindow.IsEmpty()) { 421 s_contextFailureReason = 7; 409 if (jsWindow.IsEmpty()) 422 410 return false; 423 }424 411 425 412 // Wrap the window. … … 552 539 // context for the new document to make property access on the 553 540 // global object wrapper succeed. 554 initContextIfNeeded(); 555 556 // Bail out if context initialization failed. 557 if (m_context.IsEmpty()) 541 if (!initContextIfNeeded()) 558 542 return; 559 543 … … 581 565 void V8DOMWindowShell::namedItemAdded(HTMLDocument* doc, const AtomicString& name) 582 566 { 583 initContextIfNeeded(); 584 585 if (!isContextInitialized()) { 586 #if PLATFORM(CHROMIUM) 587 // FIXME: Temporary diagnostics as to why V8 sometimes crashes with a null context below. 588 // See https://bugs.webkit.org/show_bug.cgi?id=68099. 589 PlatformSupport::histogramEnumeration("V8Bindings.nullContextState", 0, 3); 590 if (m_frame->settings() && !m_frame->settings()->isJavaScriptEnabled()) 591 PlatformSupport::histogramEnumeration("V8Bindings.nullContextState", 1, 3); 592 593 if (!m_frame->script()->canExecuteScripts(NotAboutToExecuteScript)) 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; 599 #endif 600 return; 601 } 567 if (!initContextIfNeeded()) 568 return; 602 569 603 570 v8::HandleScope handleScope; … … 630 597 v8::Handle<v8::String> hiddenObjectPrototypeString = V8HiddenPropertyName::objectPrototype(); 631 598 // Bail out if allocation failed. 632 if (objectString.IsEmpty() || prototypeString.IsEmpty() || hiddenObjectPrototypeString.IsEmpty()) { 633 s_contextFailureReason = 4; 599 if (objectString.IsEmpty() || prototypeString.IsEmpty() || hiddenObjectPrototypeString.IsEmpty()) 634 600 return false; 635 }636 601 637 602 v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(context->Global()->Get(objectString)); 638 603 // Bail out if fetching failed. 639 if (object.IsEmpty()) { 640 s_contextFailureReason = 5; 604 if (object.IsEmpty()) 641 605 return false; 642 }643 606 v8::Handle<v8::Value> objectPrototype = object->Get(prototypeString); 644 607 // Bail out if fetching failed. 645 if (objectPrototype.IsEmpty()) { 646 s_contextFailureReason = 6; 608 if (objectPrototype.IsEmpty()) 647 609 return false; 648 }649 610 650 611 context->Global()->SetHiddenValue(hiddenObjectPrototypeString, objectPrototype); … … 656 617 { 657 618 // Not in cache. 658 initContextIfNeeded(); 619 if (!initContextIfNeeded()) 620 return notHandledByInterceptor(); 621 659 622 v8::Context::Scope scope(m_context); 660 623 v8::Local<v8::Function> function = V8DOMWrapper::getConstructor(type, getHiddenObjectPrototype(m_context)); -
trunk/Source/WebCore/bindings/v8/V8Proxy.cpp
r95901 r97280 246 246 { 247 247 // FIXME: This will need to get reorganized once we have a windowShell for the isolated world. 248 windowShell()->initContextIfNeeded(); 248 if (!windowShell()->initContextIfNeeded()) 249 return; 249 250 250 251 v8::HandleScope handleScope;
Note: See TracChangeset
for help on using the changeset viewer.