Chromium Code Reviews| Index: Source/bindings/core/v8/custom/V8WindowCustom.cpp | 
| diff --git a/Source/bindings/core/v8/custom/V8WindowCustom.cpp b/Source/bindings/core/v8/custom/V8WindowCustom.cpp | 
| index 4c613dd51c7b494bebfb027ab4aa1a05f3f91dc0..aa1aadfea2988af87033085a2376562a494ded32 100644 | 
| --- a/Source/bindings/core/v8/custom/V8WindowCustom.cpp | 
| +++ b/Source/bindings/core/v8/custom/V8WindowCustom.cpp | 
| @@ -69,84 +69,6 @@ | 
| namespace blink { | 
| -// FIXME: There is a lot of duplication with SetTimeoutOrInterval() in V8WorkerGlobalScopeCustom.cpp. | 
| -// We should refactor this. | 
| -static void windowSetTimeoutImpl(const v8::FunctionCallbackInfo<v8::Value>& info, bool singleShot, ExceptionState& exceptionState) | 
| -{ | 
| - int argumentCount = info.Length(); | 
| - | 
| - if (argumentCount < 1) | 
| - return; | 
| - | 
| - LocalDOMWindow* impl = toLocalDOMWindow(V8Window::toImpl(info.Holder())); | 
| - if (!impl->frame() || !impl->document()) { | 
| - exceptionState.throwDOMException(InvalidAccessError, "No script context is available in which to execute the script."); | 
| 
 
Jens Widell
2014/11/13 12:37:47
This exception is no longer thrown. The new genera
 
 | 
| - return; | 
| - } | 
| - ScriptState* scriptState = ScriptState::current(info.GetIsolate()); | 
| - v8::Handle<v8::Value> function = info[0]; | 
| - String functionString; | 
| - if (!function->IsFunction()) { | 
| - if (function->IsString()) { | 
| - functionString = toCoreString(function.As<v8::String>()); | 
| - } else { | 
| - v8::Handle<v8::String> v8String = function->ToString(); | 
| - | 
| - // Bail out if string conversion failed. | 
| - if (v8String.IsEmpty()) | 
| - return; | 
| - | 
| - functionString = toCoreString(v8String); | 
| - } | 
| - | 
| - // Don't allow setting timeouts to run empty functions! | 
| - // (Bug 1009597) | 
| - if (!functionString.length()) | 
| - return; | 
| - } | 
| - | 
| - if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->frame(), exceptionState)) | 
| - return; | 
| - | 
| - OwnPtr<ScheduledAction> action; | 
| - if (function->IsFunction()) { | 
| - int paramCount = argumentCount >= 2 ? argumentCount - 2 : 0; | 
| - OwnPtr<v8::Local<v8::Value>[]> params; | 
| - if (paramCount > 0) { | 
| - params = adoptArrayPtr(new v8::Local<v8::Value>[paramCount]); | 
| - for (int i = 0; i < paramCount; i++) { | 
| - // parameters must be globalized | 
| - params[i] = info[i+2]; | 
| - } | 
| - } | 
| - | 
| - // params is passed to action, and released in action's destructor | 
| - ASSERT(impl->frame()); | 
| - action = adoptPtr(new ScheduledAction(scriptState, v8::Handle<v8::Function>::Cast(function), paramCount, params.get(), info.GetIsolate())); | 
| - } else { | 
| - if (impl->document() && !impl->document()->contentSecurityPolicy()->allowEval()) { | 
| - v8SetReturnValue(info, 0); | 
| - return; | 
| - } | 
| - ASSERT(impl->frame()); | 
| - action = adoptPtr(new ScheduledAction(scriptState, functionString, KURL(), info.GetIsolate())); | 
| - } | 
| - | 
| - int32_t timeout = argumentCount >= 2 ? info[1]->Int32Value() : 0; | 
| - int timerId; | 
| - if (singleShot) | 
| - timerId = DOMWindowTimers::setTimeout(*impl, action.release(), timeout); | 
| - else | 
| - timerId = DOMWindowTimers::setInterval(*impl, action.release(), timeout); | 
| - | 
| - // FIXME: Crude hack that attempts to pass idle time to V8. This should be | 
| - // done using the scheduler instead. | 
| - if (timeout >= 0) | 
| - V8GCForContextDispose::instance().notifyIdle(); | 
| - | 
| - v8SetReturnValue(info, timerId); | 
| -} | 
| - | 
| void V8Window::eventAttributeGetterCustom(const v8::PropertyCallbackInfo<v8::Value>& info) | 
| { | 
| LocalFrame* frame = toLocalDOMWindow(V8Window::toImpl(info.Holder()))->frame(); | 
| @@ -438,22 +360,6 @@ void V8Window::namedPropertyGetterCustom(v8::Local<v8::String> name, const v8::P | 
| } | 
| } | 
| - | 
| -void V8Window::setTimeoutMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info) | 
| -{ | 
| - ExceptionState exceptionState(ExceptionState::ExecutionContext, "setTimeout", "Window", info.Holder(), info.GetIsolate()); | 
| - windowSetTimeoutImpl(info, true, exceptionState); | 
| - exceptionState.throwIfNeeded(); | 
| -} | 
| - | 
| - | 
| -void V8Window::setIntervalMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info) | 
| -{ | 
| - ExceptionState exceptionState(ExceptionState::ExecutionContext, "setInterval", "Window", info.Holder(), info.GetIsolate()); | 
| - windowSetTimeoutImpl(info, false, exceptionState); | 
| - exceptionState.throwIfNeeded(); | 
| -} | 
| - | 
| bool V8Window::namedSecurityCheckCustom(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8::AccessType type, v8::Local<v8::Value>) | 
| { | 
| v8::Isolate* isolate = v8::Isolate::GetCurrent(); |