void ScheduledAction::execute(Document* document) { JSDOMWindow* window = toJSDOMWindow(document->frame(), m_isolatedWorld.get()); if (!window) return; RefPtr<Frame> frame = window->impl()->frame(); if (!frame || !frame->script()->canExecuteScripts(AboutToExecuteScript)) return; if (m_function) executeFunctionInContext(window, window->shell(), document); else frame->script()->executeScriptInWorld(m_isolatedWorld.get(), m_code); }
void ScheduledAction::execute(WorkerContext* workerContext) { // In a Worker, the execution should always happen on a worker thread. ASSERT(workerContext->thread()->threadID() == currentThread()); WorkerScriptController* scriptController = workerContext->script(); if (m_function) { JSWorkerContext* contextWrapper = scriptController->workerContextWrapper(); executeFunctionInContext(contextWrapper, contextWrapper, workerContext); } else { ScriptSourceCode code(m_code, workerContext->url()); scriptController->evaluate(code); } }
void ScheduledAction::execute(Document* document) { JSDOMWindow* window = toJSDOMWindow(document->frame()); if (!window) return; RefPtr<Frame> frame = window->impl()->frame(); if (!frame || !frame->script()->isEnabled()) return; frame->script()->setProcessingTimerCallback(true); if (m_function) { executeFunctionInContext(window, window->shell()); Document::updateStyleForAllDocuments(); } else frame->loader()->executeScript(m_code); frame->script()->setProcessingTimerCallback(false); }