This source file includes following definitions.
- injectInternalsObject
- resetInternalsObject
#include "config.h"
#include "WebCoreTestSupport.h"
#include "InternalSettings.h"
#include "Internals.h"
#include "V8Internals.h"
#include "core/dom/Document.h"
#include "core/dom/ExecutionContext.h"
#include "core/frame/LocalFrame.h"
#include <v8.h>
using namespace WebCore;
namespace WebCoreTestSupport {
void injectInternalsObject(v8::Local<v8::Context> context)
{
v8::Context::Scope contextScope(context);
v8::HandleScope scope(context->GetIsolate());
ExecutionContext* scriptContext = currentExecutionContext(context->GetIsolate());
if (scriptContext->isDocument())
context->Global()->Set(v8::String::NewFromUtf8(context->GetIsolate(), Internals::internalsId), toV8(Internals::create(toDocument(scriptContext)), v8::Handle<v8::Object>(), context->GetIsolate()));
}
void resetInternalsObject(v8::Local<v8::Context> context)
{
if (context.IsEmpty())
return;
v8::Context::Scope contextScope(context);
v8::HandleScope scope(context->GetIsolate());
ExecutionContext* scriptContext = currentExecutionContext(context->GetIsolate());
Page* page = toDocument(scriptContext)->frame()->page();
ASSERT(page);
Internals::resetToConsistentState(page);
InternalSettings::from(*page)->resetToConsistentState();
}
}