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());
}
Exemplo n.º 2
0
static v8::Handle<v8::Value> supplementalMethod1Method(const v8::Arguments& args)
{
    TestInterface* imp = V8TestInterface::toNative(args.Holder());
    TestPartialInterface::supplementalMethod1(imp);
    return v8Undefined();
}
Exemplo n.º 3
0
static v8::Handle<v8::Value> acceptTransferListCallback(const v8::Arguments& args)
{
    INC_STATS("DOM.TestSerializedScriptValueInterface.acceptTransferList");
    if (args.Length() < 1)
        return throwNotEnoughArgumentsError(args.GetIsolate());
    TestSerializedScriptValueInterface* imp = V8TestSerializedScriptValueInterface::toNative(args.Holder());
    MessagePortArray messagePortArrayTransferList;
    ArrayBufferArray arrayBufferArrayTransferList;
    if (args.Length() > 1) {
        if (!extractTransferables(args[1], messagePortArrayTransferList, arrayBufferArrayTransferList, args.GetIsolate()))
            return throwTypeError("Could not extract transferables");
    }
    bool dataDidThrow = false;
    RefPtr<SerializedScriptValue> data = SerializedScriptValue::create(args[0], &messagePortArrayTransferList, &arrayBufferArrayTransferList, dataDidThrow, args.GetIsolate());
    if (dataDidThrow)
        return v8Undefined();
    if (args.Length() <= 1) {
        imp->acceptTransferList(data);
        return v8Undefined();
    }
    imp->acceptTransferList(data, messagePortArrayTransferList);
    return v8Undefined();
}
Exemplo n.º 4
0
static v8::Handle<v8::Value> createSVGPathSegClosePathCallback(const v8::Arguments& args)
{
    INC_STATS("DOM.SVGPathElement.createSVGPathSegClosePath");
    SVGPathElement* imp = V8SVGPathElement::toNative(args.Holder());
    return toV8(imp->createSVGPathSegClosePath());
}
Exemplo n.º 5
0
static v8::Handle<v8::Value> getScreenCTMCallback(const v8::Arguments& args)
{
    INC_STATS("DOM.SVGPathElement.getScreenCTM");
    SVGPathElement* imp = V8SVGPathElement::toNative(args.Holder());
    return toV8(WTF::getPtr(SVGPropertyTearOff<SVGMatrix>::create(imp->getScreenCTM())));
}
Exemplo n.º 6
0
 static v8::Handle<v8::Value> localizedStringsURLCallback(const v8::Arguments& args) {
   INC_STATS("DOM.InspectorFrontendHost.localizedStringsURL");
   InspectorFrontendHost* imp = V8InspectorFrontendHost::toNative(args.Holder());
   return v8String(imp->localizedStringsURL());
 }
v8::Handle<v8::Value> V8HTMLAllCollection::itemCallback(const v8::Arguments& args)
{
    INC_STATS("DOM.HTMLAllCollection.item()");
    HTMLAllCollection* imp = V8HTMLAllCollection::toNative(args.Holder());
    return getItem(imp, args[0]);
}
v8::Handle<v8::Value> V8HTMLCollection::namedItemCallback(const v8::Arguments& args)
{
    INC_STATS("DOM.HTMLCollection.namedItem()");
    HTMLCollection* imp = V8DOMWrapper::convertToNativeObject<HTMLCollection>(V8ClassIndex::HTMLCOLLECTION, args.Holder());
    v8::Handle<v8::Value> result = getNamedItems(imp, toWebCoreString(args[0]));

    if (result.IsEmpty())
        return v8::Undefined();

    return result;
}
static v8::Handle<v8::Value> transformToDocumentCallback(const v8::Arguments& args)
{
    XSLTProcessor* imp = V8XSLTProcessor::toNative(args.Holder());
    V8TRYCATCH(Node*, source, V8Node::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))) : 0);
    return toV8(imp->transformToDocument(source), args.Holder(), args.GetIsolate());
}
v8::Handle<v8::Value> V8HTMLCollection::callAsFunctionCallback(const v8::Arguments& args)
{
    INC_STATS("DOM.HTMLCollection.callAsFunction()");
    if (args.Length() < 1)
        return v8::Undefined();

    HTMLCollection* imp = V8DOMWrapper::convertToNativeObject<HTMLCollection>(V8ClassIndex::HTMLCOLLECTION, args.Holder());

    if (args.Length() == 1)
        return getItem(imp, args[0]);

    // If there is a second argument it is the index of the item we want.
    String name = toWebCoreString(args[0]);
    v8::Local<v8::Uint32> index = args[1]->ToArrayIndex();
    if (index.IsEmpty())
        return v8::Undefined();

    unsigned current = index->Uint32Value();
    Node* node = imp->namedItem(name);
    while (node) {
        if (!current)
            return V8DOMWrapper::convertNodeToV8Object(node);

        node = imp->nextNamedItem(name);
        current--;
    }

    return v8::Undefined();
}
v8::Handle<v8::Value> V8HTMLCollection::itemCallback(const v8::Arguments& args)
{
    INC_STATS("DOM.HTMLCollection.item()");
    HTMLCollection* imp = V8DOMWrapper::convertToNativeObject<HTMLCollection>(V8ClassIndex::HTMLCOLLECTION, args.Holder());
    return getItem(imp, args[0]);
}
static v8::Handle<v8::Value> checkValidityCallback(const v8::Arguments& args)
{
    HTMLButtonElement* imp = V8HTMLButtonElement::toNative(args.Holder());
    return v8Boolean(imp->checkValidity(), args.GetIsolate());
}
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();
}
Exemplo n.º 14
0
v8::Handle<v8::Value> V8HTMLSelectElement::removeCallback(const v8::Arguments& args)
{
    HTMLSelectElement* imp = V8HTMLSelectElement::toNative(args.Holder());
    return removeElement(imp, args);
}
Exemplo n.º 15
0
 static v8::Handle<v8::Value> closeWindowCallback(const v8::Arguments& args) {
   INC_STATS("DOM.InspectorFrontendHost.closeWindow");
   InspectorFrontendHost* imp = V8InspectorFrontendHost::toNative(args.Holder());
   imp->closeWindow();
   return v8::Handle<v8::Value>();
 }
static v8::Handle<v8::Value> resetCallback(const v8::Arguments& args)
{
    XSLTProcessor* imp = V8XSLTProcessor::toNative(args.Holder());
    imp->reset();
    return v8Undefined();
}
Exemplo n.º 17
0
 static v8::Handle<v8::Value> windowUnloadingCallback(const v8::Arguments& args) {
   INC_STATS("DOM.InspectorFrontendHost.windowUnloading");
   InspectorFrontendHost* imp = V8InspectorFrontendHost::toNative(args.Holder());
   imp->windowUnloading();
   return v8::Handle<v8::Value>();
 }
Exemplo n.º 18
0
 static v8::Handle<v8::Value> checkValidityCallback(const v8::Arguments& args) {
   INC_STATS("DOM.HTMLFieldSetElement.checkValidity");
   HTMLFieldSetElement* imp = V8HTMLFieldSetElement::toNative(args.Holder());
   return v8Boolean(imp->checkValidity());
 }
Exemplo n.º 19
0
 static v8::Handle<v8::Value> hiddenPanelsCallback(const v8::Arguments& args) {
   INC_STATS("DOM.InspectorFrontendHost.hiddenPanels");
   InspectorFrontendHost* imp = V8InspectorFrontendHost::toNative(args.Holder());
   return v8String(imp->hiddenPanels());
 }
Exemplo n.º 20
0
v8::Handle<v8::Value> V8AudioContext::constructorCallback(const v8::Arguments& args)
{
    INC_STATS("DOM.AudioContext.Contructor");

    if (!args.IsConstructCall())
        return throwTypeError("AudioContext constructor cannot be called as a function.", args.GetIsolate());

    if (ConstructorMode::current() == ConstructorMode::WrapExistingObject)
        return args.Holder();

    Frame* frame = currentFrame(BindingState::instance());
    if (!frame)
        return throwError(ReferenceError, "AudioContext constructor associated frame is unavailable", args.GetIsolate());

    Document* document = frame->document();
    if (!document)
        return throwError(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 setDOMException(ec, args.GetIsolate());
        if (!audioContext.get())
            return throwError(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 throwNotEnoughArgumentsError(args.GetIsolate());

        bool ok = false;

        int32_t numberOfChannels = toInt32(args[0], ok);
        if (!ok || numberOfChannels <= 0 || numberOfChannels > 10)
            return throwError(SyntaxError, "Invalid number of channels", args.GetIsolate());

        int32_t numberOfFrames = toInt32(args[1], ok);
        if (!ok || numberOfFrames <= 0)
            return throwError(SyntaxError, "Invalid number of frames", args.GetIsolate());

        float sampleRate = toFloat(args[2]);
        if (sampleRate <= 0)
            return throwError(SyntaxError, "Invalid sample rate", args.GetIsolate());

        ExceptionCode ec = 0;
        audioContext = AudioContext::createOfflineContext(document, numberOfChannels, numberOfFrames, sampleRate, ec);
        if (ec)
            return setDOMException(ec, args.GetIsolate());
    }

    if (!audioContext.get())
        return throwError(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();
}
Exemplo n.º 21
0
static v8::Handle<v8::Value> getTotalLengthCallback(const v8::Arguments& args)
{
    INC_STATS("DOM.SVGPathElement.getTotalLength");
    SVGPathElement* imp = V8SVGPathElement::toNative(args.Holder());
    return v8::Number::New(imp->getTotalLength());
}
Exemplo n.º 22
0
 static v8::Handle<v8::Value> handleEventCallback(const v8::Arguments& args) {
   INC_STATS("DOM.VoidCallback.handleEvent");
   VoidCallback* imp = V8VoidCallback::toNative(args.Holder());
   imp->handleEvent();
   return v8::Handle<v8::Value>();
 }
Exemplo n.º 23
0
static v8::Handle<v8::Value> getBBoxCallback(const v8::Arguments& args)
{
    INC_STATS("DOM.SVGPathElement.getBBox");
    SVGPathElement* imp = V8SVGPathElement::toNative(args.Holder());
    return toV8(WTF::getPtr(SVGPropertyTearOff<FloatRect>::create(imp->getBBox())));
}
Exemplo n.º 24
0
v8::Handle<v8::Value> V8CInterface::constructorCustom(const v8::Arguments& args)
{
    RefPtr<CInterface> cInterface = CInterface::create();
    V8DOMWrapper::associateObjectWithWrapper(cInterface.release(), &info, args.Holder(), args.GetIsolate(), WrapperConfiguration::Dependent);
    return args.Holder();;
}
static v8::Handle<v8::Value> getPresentationAttributeCallback(const v8::Arguments& args)
{
    SVGFEImageElement* imp = V8SVGFEImageElement::toNative(args.Holder());
    V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, name, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
    return toV8Fast(imp->getPresentationAttribute(name), args, imp);
}
static v8::Handle<v8::Value> toStringCallback(const v8::Arguments& args)
{
    WorkerLocation* imp = V8WorkerLocation::toNative(args.Holder());
    return v8String(imp->toString(), args.GetIsolate());
}
static v8::Handle<v8::Value> lookupNamespaceURICallback(const v8::Arguments& args)
{
    XPathNSResolver* imp = V8XPathNSResolver::toNative(args.Holder());
    V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, prefix, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
    return v8StringOrNull(imp->lookupNamespaceURI(prefix), args.GetIsolate());
}
Exemplo n.º 28
0
 static v8::Handle<v8::Value> platformCallback(const v8::Arguments& args) {
   INC_STATS("DOM.InspectorFrontendHost.platform");
   InspectorFrontendHost* imp = V8InspectorFrontendHost::toNative(args.Holder());
   return v8String(imp->platform());
 }
Exemplo n.º 29
0
static v8::Handle<v8::Value> multiTransferListCallback(const v8::Arguments& args)
{
    INC_STATS("DOM.TestSerializedScriptValueInterface.multiTransferList");
    TestSerializedScriptValueInterface* imp = V8TestSerializedScriptValueInterface::toNative(args.Holder());
    if (args.Length() <= 0) {
        imp->multiTransferList();
        return v8Undefined();
    }
    MessagePortArray messagePortArrayTx;
    ArrayBufferArray arrayBufferArrayTx;
    if (args.Length() > 1) {
        if (!extractTransferables(args[1], messagePortArrayTx, arrayBufferArrayTx, args.GetIsolate()))
            return throwTypeError("Could not extract transferables");
    }
    bool firstDidThrow = false;
    RefPtr<SerializedScriptValue> first = SerializedScriptValue::create(args[0], &messagePortArrayTx, &arrayBufferArrayTx, firstDidThrow, args.GetIsolate());
    if (firstDidThrow)
        return v8Undefined();
    if (args.Length() <= 1) {
        imp->multiTransferList(first);
        return v8Undefined();
    }
    if (args.Length() <= 2) {
        imp->multiTransferList(first, messagePortArrayTx);
        return v8Undefined();
    }
    MessagePortArray messagePortArrayTxx;
    ArrayBufferArray arrayBufferArrayTxx;
    if (args.Length() > 3) {
        if (!extractTransferables(args[3], messagePortArrayTxx, arrayBufferArrayTxx, args.GetIsolate()))
            return throwTypeError("Could not extract transferables");
    }
    bool secondDidThrow = false;
    RefPtr<SerializedScriptValue> second = SerializedScriptValue::create(args[2], &messagePortArrayTxx, &arrayBufferArrayTxx, secondDidThrow, args.GetIsolate());
    if (secondDidThrow)
        return v8Undefined();
    if (args.Length() <= 3) {
        imp->multiTransferList(first, messagePortArrayTx, second);
        return v8Undefined();
    }
    imp->multiTransferList(first, messagePortArrayTx, second, messagePortArrayTxx);
    return v8Undefined();
}
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());
}