This source file includes following definitions.
- ensureInjected
#include "config.h"
#include "core/inspector/InjectedScriptModule.h"
#include "bindings/v8/ScriptFunctionCall.h"
#include "bindings/v8/ScriptObject.h"
#include "bindings/v8/ScriptScope.h"
#include "core/inspector/InjectedScript.h"
#include "core/inspector/InjectedScriptManager.h"
namespace WebCore {
InjectedScriptModule::InjectedScriptModule(const String& name)
: InjectedScriptBase(name)
{
}
void InjectedScriptModule::ensureInjected(InjectedScriptManager* injectedScriptManager, ScriptState* scriptState)
{
InjectedScript injectedScript = injectedScriptManager->injectedScriptFor(scriptState);
ASSERT(!injectedScript.hasNoValue());
if (injectedScript.hasNoValue())
return;
ScriptFunctionCall function(injectedScript.injectedScriptObject(), "module");
function.appendArgument(name());
bool hadException = false;
ScriptValue resultValue = injectedScript.callFunctionWithEvalEnabled(function, hadException);
ASSERT(!hadException);
ScriptScope scope(scriptState);
if (hadException || resultValue.hasNoValue() || !resultValue.isObject()) {
ScriptFunctionCall function(injectedScript.injectedScriptObject(), "injectModule");
function.appendArgument(name());
function.appendArgument(source());
resultValue = injectedScript.callFunctionWithEvalEnabled(function, hadException);
if (hadException || resultValue.hasNoValue() || !resultValue.isObject()) {
ASSERT_NOT_REACHED();
return;
}
}
ScriptObject moduleObject(scriptState, resultValue);
initialize(moduleObject, injectedScriptManager->inspectedStateAccessCheck());
}
}