Index: Source/core/testing/v8/WebCoreTestSupport.cpp |
diff --git a/Source/core/testing/v8/WebCoreTestSupport.cpp b/Source/core/testing/v8/WebCoreTestSupport.cpp |
index 17cac5e093da930486c9883945d80937dcc76a10..b6f41a30319d95fbe33f99549ec950057a22c12e 100644 |
--- a/Source/core/testing/v8/WebCoreTestSupport.cpp |
+++ b/Source/core/testing/v8/WebCoreTestSupport.cpp |
@@ -66,7 +66,13 @@ void resetInternalsObject(v8::Local<v8::Context> context) |
ScriptState* scriptState = ScriptState::from(context); |
ScriptState::Scope scope(scriptState); |
- Page* page = toDocument(scriptState->executionContext())->frame()->page(); |
+ Document* document = toDocument(scriptState->executionContext()); |
+ ASSERT(document); |
+ LocalFrame* frame = document->frame(); |
+ // Should the document have been detached, the page is assumed being destroyed (=> no reset required.) |
+ if (!frame) |
+ return; |
+ Page* page = frame->page(); |
ASSERT(page); |
Internals::resetToConsistentState(page); |
InternalSettings::from(*page)->resetToConsistentState(); |