/*!@brief Static factory function to create the Patl class. Called from V8. * @oaram[in] args The supplied V8 arguments. * @return A handle to the wrapped C++ class. */ v8::Handle<v8::Value> Patl::New(const v8::Arguments& args) { v8::HandleScope scope; Patl *obj = new Patl(); obj->Wrap(args.This()); return args.This(); }
v8::Handle<v8::Value> V8HTMLSelectElement::removeCallback(const v8::Arguments& args) { HTMLSelectElement* imp = V8HTMLSelectElement::toNative(args.Holder()); return removeElement(imp, args); }
v8::Handle<v8::Value> WebDevToolsFrontendImpl::jsLoaded(const v8::Arguments& args) { WebDevToolsFrontendImpl* frontend = static_cast<WebDevToolsFrontendImpl*>(v8::External::Cast(*args.Data())->Value()); frontend->m_loaded = true; // Grant the devtools page the ability to have source view iframes. Page* page = V8Proxy::retrieveFrameForEnteredContext()->page(); SecurityOrigin* origin = page->mainFrame()->domWindow()->securityOrigin(); origin->grantUniversalAccess(); for (Vector<Vector<String> >::iterator it = frontend->m_pendingIncomingMessages.begin(); it != frontend->m_pendingIncomingMessages.end(); ++it) { frontend->executeScript(*it); } frontend->m_pendingIncomingMessages.clear(); return v8::Undefined(); }
static v8::Handle<v8::Value> V8LazyEventListenerToString(const v8::Arguments& args) { return args.Holder()->GetHiddenValue(V8HiddenPropertyName::toStringString()); }
static v8::Handle<v8::Value> containsCallback(const v8::Arguments& args) { DOMStringList* imp = V8DOMStringList::toNative(args.Holder()); V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, string, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)); return v8Boolean(imp->contains(string), args.GetIsolate()); }
static v8::Handle<v8::Value> getScreenCTMCallback(const v8::Arguments& args) { SVGDefsElement* imp = V8SVGDefsElement::toNative(args.Holder()); return toV8Fast(WTF::getPtr(SVGPropertyTearOff<SVGMatrix>::create(imp->getScreenCTM())), args, imp); }
v8::Handle<v8::Value> DateExtension::OnSleepDetected(const v8::Arguments& args) { return throwError(v8GeneralError, "Too much time spent in unload handler.", args.GetIsolate()); }
static v8::Handle<v8::Value> nextWorkerIdCallback(const v8::Arguments& args) { INC_STATS("DOM.InjectedScriptHost.nextWorkerId"); InjectedScriptHost* imp = V8InjectedScriptHost::toNative(args.Holder()); return v8::Integer::New(imp->nextWorkerId()); }
v8::Handle<v8::Value> V8AudioContext::constructorCallback(const v8::Arguments& args) { INC_STATS("DOM.AudioContext.Contructor"); if (!args.IsConstructCall()) return V8Proxy::throwTypeError("AudioContext constructor cannot be called as a function.", args.GetIsolate()); if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) return args.Holder(); Frame* frame = V8Proxy::retrieveFrameForCurrentContext(); if (!frame) return V8Proxy::throwError(V8Proxy::ReferenceError, "AudioContext constructor associated frame is unavailable", args.GetIsolate()); Document* document = frame->document(); if (!document) return V8Proxy::throwError(V8Proxy::ReferenceError, "AudioContext constructor associated document is unavailable", args.GetIsolate()); RefPtr<AudioContext> audioContext; if (!args.Length()) { // Constructor for default AudioContext which talks to audio hardware. ExceptionCode ec = 0; audioContext = AudioContext::create(document, ec); if (ec) return throwError(ec, args.GetIsolate()); if (!audioContext.get()) return V8Proxy::throwError(V8Proxy::SyntaxError, "audio resources unavailable for AudioContext construction", args.GetIsolate()); } else { // Constructor for offline (render-target) AudioContext which renders into an AudioBuffer. // new AudioContext(in unsigned long numberOfChannels, in unsigned long numberOfFrames, in float sampleRate); if (args.Length() < 3) return V8Proxy::throwNotEnoughArgumentsError(args.GetIsolate()); bool ok = false; int32_t numberOfChannels = toInt32(args[0], ok); if (!ok || numberOfChannels <= 0 || numberOfChannels > 10) return V8Proxy::throwError(V8Proxy::SyntaxError, "Invalid number of channels", args.GetIsolate()); int32_t numberOfFrames = toInt32(args[1], ok); if (!ok || numberOfFrames <= 0) return V8Proxy::throwError(V8Proxy::SyntaxError, "Invalid number of frames", args.GetIsolate()); float sampleRate = toFloat(args[2]); if (sampleRate <= 0) return V8Proxy::throwError(V8Proxy::SyntaxError, "Invalid sample rate", args.GetIsolate()); ExceptionCode ec = 0; audioContext = AudioContext::createOfflineContext(document, numberOfChannels, numberOfFrames, sampleRate, ec); if (ec) return throwError(ec, args.GetIsolate()); } if (!audioContext.get()) return V8Proxy::throwError(V8Proxy::SyntaxError, "Error creating AudioContext", args.GetIsolate()); // Transform the holder into a wrapper object for the audio context. V8DOMWrapper::setDOMWrapper(args.Holder(), &info, audioContext.get()); audioContext->ref(); return args.Holder(); }
static v8::Handle<v8::Value> skewYCallback(const v8::Arguments& args) { INC_STATS("DOM.SVGMatrix.skewY"); V8SVGPODTypeWrapper<AffineTransform>* impWrapper = V8SVGPODTypeWrapper<AffineTransform>::toNative(args.Holder()); AffineTransform impInstance = *impWrapper; AffineTransform* imp = &impInstance; EXCEPTION_BLOCK(float, angle, static_cast<float>(args[0]->NumberValue())); AffineTransform result = *imp; result.skewY(angle); RefPtr<V8SVGPODTypeWrapper<AffineTransform> > wrapper = V8SVGStaticPODTypeWrapper<AffineTransform>::create(result); SVGElement* context = V8Proxy::svgContext(impWrapper); V8Proxy::setSVGContext(wrapper.get(), context); impWrapper->commitChange(impInstance, context); return toV8(wrapper.release()); }
v8::Handle<v8::Value> Find(const v8::Arguments& args) { v8::HandleScope scope; int vid = 0; int pid = 0; v8::Local<v8::Value> callback; if (args.Length() == 0) { return scope.Close(v8::ThrowException(v8::Exception::TypeError(v8::String::New("First argument must be a function")))); } if (args.Length() == 3) { if (args[0]->IsNumber() && args[1]->IsNumber()) { vid = (int) args[0]->NumberValue(); pid = (int) args[1]->NumberValue(); } // callback if(!args[2]->IsFunction()) { return scope.Close(v8::ThrowException(v8::Exception::TypeError(v8::String::New("Third argument must be a function")))); } callback = args[2]; } if (args.Length() == 2) { if (args[0]->IsNumber()) { vid = (int) args[0]->NumberValue(); } // callback if(!args[1]->IsFunction()) { return scope.Close(v8::ThrowException(v8::Exception::TypeError(v8::String::New("Second argument must be a function")))); } callback = args[1]; } if (args.Length() == 1) { // callback if(!args[0]->IsFunction()) { return scope.Close(v8::ThrowException(v8::Exception::TypeError(v8::String::New("First argument must be a function")))); } callback = args[0]; } ListBaton* baton = new ListBaton(); strcpy(baton->errorString, ""); baton->callback = v8::Persistent<v8::Value>::New(callback); baton->vid = vid; baton->pid = pid; uv_work_t* req = new uv_work_t(); req->data = baton; uv_queue_work(uv_default_loop(), req, EIO_Find, (uv_after_work_cb)EIO_AfterFind); return scope.Close(v8::Undefined()); }
static v8::Handle<v8::Value> flipYCallback(const v8::Arguments& args) { INC_STATS("DOM.SVGMatrix.flipY"); V8SVGPODTypeWrapper<AffineTransform>* impWrapper = V8SVGPODTypeWrapper<AffineTransform>::toNative(args.Holder()); AffineTransform impInstance = *impWrapper; AffineTransform* imp = &impInstance; AffineTransform result = *imp; result.flipY(); RefPtr<V8SVGPODTypeWrapper<AffineTransform> > wrapper = V8SVGStaticPODTypeWrapper<AffineTransform>::create(result); SVGElement* context = V8Proxy::svgContext(impWrapper); V8Proxy::setSVGContext(wrapper.get(), context); impWrapper->commitChange(impInstance, context); return toV8(wrapper.release()); }
static v8::Handle<v8::Value> webkitExitFullScreenCallback(const v8::Arguments& args) { HTMLVideoElement* imp = V8HTMLVideoElement::toNative(args.Holder()); imp->webkitExitFullScreen(); return v8Undefined(); }
/*static*/ v8::Handle<v8::Value> wxNode_wxWebViewEvent::_init(const v8::Arguments& args) { v8::HandleScope scope; /* * id: _47418 */ if(args.Length() == 1 && (args[0]->IsNull() || (args[0]->IsObject() && wxNode_wxWebViewEvent::AssignableFrom(args[0]->ToObject()->GetConstructorName())))) { wxNode_wxWebViewEvent* arg0 = args[0]->IsNull() ? NULL : wxNodeObject::unwrap<wxNode_wxWebViewEvent>(args[0]->ToObject()); /* type: _66883 */ wxNode_wxWebViewEvent *self = new wxNode_wxWebViewEvent(*arg0); NodeExEvtHandlerImpl* evtHandler = dynamic_cast<NodeExEvtHandlerImpl*>(self); self->wrap(args.This(), self, evtHandler); return args.This(); } /* * id: _47419 */ if(args.Length() == 0) { wxNode_wxWebViewEvent *self = new wxNode_wxWebViewEvent(); NodeExEvtHandlerImpl* evtHandler = dynamic_cast<NodeExEvtHandlerImpl*>(self); self->wrap(args.This(), self, evtHandler); return args.This(); } /* * id: _47420 */ if(args.Length() == 4 && args[0]->IsNumber() && args[1]->IsNumber() && args[2]->IsString() && args[3]->IsString()) { int type = (int)args[0]->ToInt32()->Value(); /* type: _986 */ int id = (int)args[1]->ToInt32()->Value(); /* type: _165 */ v8::String::AsciiValue url(args[2]->ToString()); /* type: _1214c */ v8::String::AsciiValue target(args[3]->ToString()); /* type: _1214c */ wxNode_wxWebViewEvent *self = new wxNode_wxWebViewEvent(type, id, *url, *target); NodeExEvtHandlerImpl* evtHandler = dynamic_cast<NodeExEvtHandlerImpl*>(self); self->wrap(args.This(), self, evtHandler); return args.This(); } std::ostringstream errStr; errStr << "Could not find matching constructor for arguments (class name: wxWebViewEvent).\n"; errStr << " arg count: " << args.Length() << "\n"; for(int i = 0; i < args.Length(); i++) { v8::String::AsciiValue argStr(args[i]); errStr << " arg[" << i << "]: " << *argStr << "\n"; } return v8::ThrowException(v8::Exception::TypeError(v8::String::New(errStr.str().c_str()))); }
static v8::Handle<v8::Value> hasExtensionCallback(const v8::Arguments& args) { SVGDefsElement* imp = V8SVGDefsElement::toNative(args.Holder()); V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, extension, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)); return v8Boolean(imp->hasExtension(extension), args.GetIsolate()); }
/** Returns argv[I] if argv.Length() is <= I, else v8::Undefined() is returned. */ inline v8::Handle<v8::Value> operator()( v8::Arguments const & argv ) const { return (argv.Length() > I) ? argv[I] : v8::Undefined(); }
static v8::Handle<v8::Value> getPresentationAttributeCallback(const v8::Arguments& args) { SVGDefsElement* imp = V8SVGDefsElement::toNative(args.Holder()); V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, name, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)); return toV8Fast(imp->getPresentationAttribute(name), args, imp); }
/** Returns true if ValType()( av[Index] ) is true. */ inline bool operator()( v8::Arguments const & av ) const { return (Index >= av.Length()) ? false : ValIsType()( av[Index] ); }
static v8::Handle<v8::Value> getCallback(const v8::Arguments& args) { INC_STATS("DOM.WebGLUnsignedIntArray.get"); WebGLUnsignedIntArray* imp = V8WebGLUnsignedIntArray::toNative(args.Holder()); unsigned index = toInt32(args[0]); return v8::Integer::NewFromUnsigned(imp->get(index)); }
/** Returns true only if (Index < av.Length()) and av->Getter() returns true. */ inline bool operator()( v8::Arguments const & av ) const { return ( av.Length() <= Index ) ? false : ((*av[Index])->*Getter)(); }
v8::Handle<v8::Value> ButtonJS:: New( const v8::Arguments& args ) { EventEmitterJS:: prototypeTemplate-> GetFunction()-> Call( args.This(), 0, NULL ) ; return args.This() ; }
v8::Handle<v8::Value> V8Blob::constructorCallback(const v8::Arguments& args) { INC_STATS("DOM.Blob.Constructor"); if (!args.IsConstructCall()) return V8Proxy::throwTypeError("DOM object constructor cannot be called as a function.", args.GetIsolate()); if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) return args.Holder(); // Get the script execution context. ScriptExecutionContext* context = getScriptExecutionContext(); if (!context) return V8Proxy::throwError(V8Proxy::ReferenceError, "Blob constructor associated document is unavailable", args.GetIsolate()); if (!args.Length()) { RefPtr<Blob> blob = Blob::create(); return toV8(blob.get(), args.GetIsolate()); } v8::Local<v8::Value> firstArg = args[0]; if (!firstArg->IsArray()) return V8Proxy::throwTypeError("First argument of the constructor is not of type Array", args.GetIsolate()); String type; String endings = "transparent"; if (args.Length() > 1) { if (!args[1]->IsObject()) return V8Proxy::throwTypeError("Second argument of the constructor is not of type Object", args.GetIsolate()); EXCEPTION_BLOCK(Dictionary, dictionary, Dictionary(args[1], args.GetIsolate())); v8::TryCatch tryCatchEndings; bool containsEndings = dictionary.get("endings", endings); if (tryCatchEndings.HasCaught()) return throwError(tryCatchEndings.Exception(), args.GetIsolate()); if (containsEndings) { if (endings != "transparent" && endings != "native") return V8Proxy::throwTypeError("The endings property must be either \"transparent\" or \"native\"", args.GetIsolate()); } v8::TryCatch tryCatchType; dictionary.get("type", type); if (tryCatchType.HasCaught()) return throwError(tryCatchType.Exception(), args.GetIsolate()); if (!type.containsOnlyASCII()) return V8Proxy::throwError(V8Proxy::SyntaxError, "type must consist of ASCII characters", args.GetIsolate()); type.makeLower(); } ASSERT(endings == "transparent" || endings == "native"); RefPtr<WebKitBlobBuilder> blobBuilder = WebKitBlobBuilder::create(); EXCEPTION_BLOCK(v8::Local<v8::Array>, blobParts, v8::Local<v8::Array>::Cast(firstArg)); uint32_t length = blobParts->Length(); for (uint32_t i = 0; i < length; ++i) { v8::Local<v8::Value> item = blobParts->Get(v8::Uint32::New(i)); ASSERT(!item.IsEmpty()); #if ENABLE(BLOB) if (V8ArrayBuffer::HasInstance(item)) { ArrayBuffer* arrayBuffer = V8ArrayBuffer::toNative(v8::Handle<v8::Object>::Cast(item)); ASSERT(arrayBuffer); blobBuilder->append(context, arrayBuffer); } else if (V8ArrayBufferView::HasInstance(item)) { ArrayBufferView* arrayBufferView = V8ArrayBufferView::toNative(v8::Handle<v8::Object>::Cast(item)); ASSERT(arrayBufferView); blobBuilder->append(arrayBufferView); } else #endif if (V8Blob::HasInstance(item)) { Blob* blob = V8Blob::toNative(v8::Handle<v8::Object>::Cast(item)); ASSERT(blob); blobBuilder->append(blob); } else { EXCEPTION_BLOCK(String, stringValue, toWebCoreString(item)); blobBuilder->append(stringValue, endings, ASSERT_NO_EXCEPTION); } } RefPtr<Blob> blob = blobBuilder->getBlob(type); return toV8(blob.get(), args.GetIsolate()); }
static v8::Handle<v8::Value> itemCallback(const v8::Arguments& args) { DOMStringList* imp = V8DOMStringList::toNative(args.Holder()); V8TRYCATCH(unsigned, index, toUInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))); return v8StringOrNull(imp->item(index), args.GetIsolate()); }
/*static*/ v8::Handle<v8::Value> wxNode_wxInfoBar::_init(const v8::Arguments& args) { v8::HandleScope scope; /* * id: _54296 */ if(args.Length() == 0) { wxNode_wxInfoBar *self = new wxNode_wxInfoBar(); NodeExEvtHandlerImpl* evtHandler = dynamic_cast<NodeExEvtHandlerImpl*>(self); self->wrap(args.This(), self, evtHandler); return args.This(); } /* * id: _54297 */ if(args.Length() == 2 && (args[0]->IsNull() || (args[0]->IsObject() && wxNode_wxWindow::AssignableFrom(args[0]->ToObject()->GetConstructorName()))) && args[1]->IsNumber()) { wxNode_wxWindow* parent = args[0]->IsNull() ? NULL : wxNodeObject::unwrap<wxNode_wxWindow>(args[0]->ToObject()); /* type: _1000 * */ int winid = (int)args[1]->ToInt32()->Value(); /* type: _8725 */ wxNode_wxInfoBar *self = new wxNode_wxInfoBar(parent, winid); NodeExEvtHandlerImpl* evtHandler = dynamic_cast<NodeExEvtHandlerImpl*>(self); self->wrap(args.This(), self, evtHandler); return args.This(); } /* * id: _54297 */ if(args.Length() == 1 && (args[0]->IsNull() || (args[0]->IsObject() && wxNode_wxWindow::AssignableFrom(args[0]->ToObject()->GetConstructorName())))) { wxNode_wxWindow* parent = args[0]->IsNull() ? NULL : wxNodeObject::unwrap<wxNode_wxWindow>(args[0]->ToObject()); /* type: _1000 * */ wxNode_wxInfoBar *self = new wxNode_wxInfoBar(parent); NodeExEvtHandlerImpl* evtHandler = dynamic_cast<NodeExEvtHandlerImpl*>(self); self->wrap(args.This(), self, evtHandler); return args.This(); } std::ostringstream errStr; errStr << "Could not find matching constructor for arguments (class name: wxInfoBar).\n"; errStr << " arg count: " << args.Length() << "\n"; for(int i = 0; i < args.Length(); i++) { v8::String::AsciiValue argStr(args[i]); errStr << " arg[" << i << "]: " << *argStr << "\n"; } return v8::ThrowException(v8::Exception::TypeError(v8::String::New(errStr.str().c_str()))); }
/*static*/ v8::Handle<v8::Value> wxNode_wxTextValidator::_init(const v8::Arguments& args) { v8::HandleScope scope; /* * id: _41312 */ if(args.Length() == 2 && args[0]->IsNumber() && args[1]->IsString()) { long int style = (long int)args[0]->ToInt32()->Value(); /* type: _592 */ wxString* val; /* type: _24013 * */ wxNode_wxTextValidator *self = new wxNode_wxTextValidator(style, val); NodeExEvtHandlerImpl* evtHandler = dynamic_cast<NodeExEvtHandlerImpl*>(self); self->wrap(args.This(), self, evtHandler); return args.This(); } /* * id: _41312 */ if(args.Length() == 1 && args[0]->IsNumber()) { long int style = (long int)args[0]->ToInt32()->Value(); /* type: _592 */ wxNode_wxTextValidator *self = new wxNode_wxTextValidator(style); NodeExEvtHandlerImpl* evtHandler = dynamic_cast<NodeExEvtHandlerImpl*>(self); self->wrap(args.This(), self, evtHandler); return args.This(); } /* * id: _41312 */ if(args.Length() == 0) { wxNode_wxTextValidator *self = new wxNode_wxTextValidator(); NodeExEvtHandlerImpl* evtHandler = dynamic_cast<NodeExEvtHandlerImpl*>(self); self->wrap(args.This(), self, evtHandler); return args.This(); } /* * id: _41313 */ if(args.Length() == 1 && (args[0]->IsNull() || (args[0]->IsObject() && wxNode_wxTextValidator::AssignableFrom(args[0]->ToObject()->GetConstructorName())))) { wxNode_wxTextValidator* val = args[0]->IsNull() ? NULL : wxNodeObject::unwrap<wxNode_wxTextValidator>(args[0]->ToObject()); /* type: _64328 */ wxNode_wxTextValidator *self = new wxNode_wxTextValidator(*val); NodeExEvtHandlerImpl* evtHandler = dynamic_cast<NodeExEvtHandlerImpl*>(self); self->wrap(args.This(), self, evtHandler); return args.This(); } std::ostringstream errStr; errStr << "Could not find matching constructor for arguments (class name: wxTextValidator).\n"; errStr << " arg count: " << args.Length() << "\n"; for(int i = 0; i < args.Length(); i++) { v8::String::AsciiValue argStr(args[i]); errStr << " arg[" << i << "]: " << *argStr << "\n"; } return v8::ThrowException(v8::Exception::TypeError(v8::String::New(errStr.str().c_str()))); }
v8::Handle<v8::Value> _BeaScript::collectGarbage( const v8::Arguments& args ){ while (!V8::IdleNotification()) {} return args.This(); }
v8::Handle<v8::Value> V8HTMLDocument::writelnMethodCustom(const v8::Arguments& args) { HTMLDocument* htmlDocument = V8HTMLDocument::toNative(args.Holder()); htmlDocument->writeln(writeHelperGetString(args), activeDOMWindow()->document()); return v8::Undefined(); }
v8::Handle<v8::Value> AnimationStateJS:: New( const v8::Arguments& args ) { printf( "AnimationStateJS:: New \n" ) ; return args.This() ; }
v8::Handle<v8::Value> WebDevToolsFrontendImpl::jsUndockWindow(const v8::Arguments& args) { WebDevToolsFrontendImpl* frontend = static_cast<WebDevToolsFrontendImpl*>(v8::External::Cast(*args.Data())->Value()); frontend->m_client->undockWindow(); return v8::Undefined(); }
static v8::Handle<v8::Value> getScreenCTMCallback(const v8::Arguments& args) { INC_STATS("DOM.SVGAElement.getScreenCTM"); SVGAElement* imp = V8SVGAElement::toNative(args.Holder()); return toV8(WTF::getPtr(SVGPropertyTearOff<SVGMatrix>::create(imp->getScreenCTM()))); }