Example #1
0
bool InspectorInstrumentation::hasFrontendForScriptContext(ScriptExecutionContext* scriptExecutionContext)
{
    if (!scriptExecutionContext)
        return false;

#if ENABLE(WORKERS)
    if (scriptExecutionContext->isWorkerContext()) {
        WorkerContext* workerContext = static_cast<WorkerContext*>(scriptExecutionContext);
        WorkerInspectorController* workerInspectorController = workerContext->workerInspectorController();
        return workerInspectorController && workerInspectorController->hasFrontend();
    }
#endif

    ASSERT(scriptExecutionContext->isDocument());
    Document* document = static_cast<Document*>(scriptExecutionContext);
    Page* page = document->page();
    return page && page->inspectorController()->hasFrontend();
}