void FrameLoaderClientEfl::updateGlobalHistory()
{
    WebCore::Frame* frame = EWKPrivate::coreFrame(m_frame);
    if (!frame)
        return;

    WebCore::DocumentLoader* loader = frame->loader()->documentLoader();
    if (!loader)
        return;

    const FrameLoader* frameLoader = loader->frameLoader();
    const bool isMainFrameRequest = frameLoader && (loader == frameLoader->provisionalDocumentLoader()) && frameLoader->isLoadingMainFrame();
    const CString& urlForHistory = loader->urlForHistory().string().utf8();
    const CString& title = loader->title().string().utf8();
    const CString& firstParty = loader->request().firstPartyForCookies().string().utf8();
    const CString& clientRedirectSource = loader->clientRedirectSourceForHistory().utf8();
    const CString& originalURL = loader->originalURL().string().utf8();
    const CString& httpMethod = loader->request().httpMethod().utf8();
    const CString& responseURL = loader->responseURL().string().utf8();
    const CString& mimeType = loader->response().mimeType().utf8();

    Ewk_Frame_Resource_Request request = { originalURL.data(), firstParty.data(), httpMethod.data(), 0, m_frame, isMainFrameRequest };
    Ewk_Frame_Resource_Response response = { responseURL.data(), loader->response().httpStatusCode(), 0, mimeType.data() };
    bool hasSubstituteData = loader->substituteData().isValid();

    Ewk_View_Navigation_Data data = { urlForHistory.data(), title.data(), &request, &response, hasSubstituteData, clientRedirectSource.data() };

    evas_object_smart_callback_call(m_view, "navigate,with,data", &data);
}
Пример #2
0
bool DumpRenderTreeSupportEfl::callShouldCloseOnWebView(Evas_Object* ewkFrame)
{
    WebCore::Frame* frame = EWKPrivate::coreFrame(ewkFrame);

    if (!frame)
        return false;

    return frame->loader()->shouldClose();
}
Пример #3
0
// API Candidate?
void DumpRenderTreeSupportQt::setAlternateHtml(QWebFrameAdapter* adapter, const QString& html, const QUrl& baseUrl, const QUrl& failingUrl)
{
    KURL kurl(baseUrl);
    WebCore::Frame* coreFrame = adapter->frame;
    WebCore::ResourceRequest request(kurl);
    const QByteArray utf8 = html.toUtf8();
    WTF::RefPtr<WebCore::SharedBuffer> data = WebCore::SharedBuffer::create(utf8.constData(), utf8.length());
    WebCore::SubstituteData substituteData(data, WTF::String("text/html"), WTF::String("utf-8"), failingUrl);
    coreFrame->loader()->load(WebCore::FrameLoadRequest(coreFrame, request, substituteData));
}
Пример #4
0
String DumpRenderTreeSupportEfl::responseMimeType(const Evas_Object* ewkFrame)
{
    WebCore::Frame* frame = EWKPrivate::coreFrame(ewkFrame);

    if (!frame)
        return String();

    WebCore::DocumentLoader *documentLoader = frame->loader()->documentLoader();

    if (!documentLoader)
        return String();

    return documentLoader->responseMIMEType();
}
Пример #5
0
bool LoadItem::invoke() const
{
    size_t targetArrSize = JSStringGetMaximumUTF8CStringSize(m_target.get());
    size_t urlArrSize = JSStringGetMaximumUTF8CStringSize(m_url.get());
    OwnArrayPtr<char> target(new char[targetArrSize]);
    OwnArrayPtr<char> url(new char[urlArrSize]);
    size_t targetLen = JSStringGetUTF8CString(m_target.get(), target.get(), targetArrSize) - 1;
    JSStringGetUTF8CString(m_url.get(), url.get(), urlArrSize);

    WebCore::Frame* frame;
    if (target && targetLen)
        frame = mainFrame->tree()->find(target.get());
    else
        frame = mainFrame;

    if (!frame)
        return false;

    WebCore::KURL kurl = WebCore::KURL(WebCore::KURL(), url.get());
    frame->loader()->load(kurl, false);
    return true;
}
void FrameLoaderClientEfl::updateGlobalHistoryRedirectLinks()
{
        WebCore::Frame* frame = EWKPrivate::coreFrame(m_frame);
        if (!frame)
            return;

        WebCore::DocumentLoader* loader = frame->loader()->documentLoader();
        if (!loader)
            return;

        if (!loader->clientRedirectSourceForHistory().isNull()) {
            const CString& sourceURL = loader->clientRedirectSourceForHistory().utf8();
            const CString& destinationURL = loader->clientRedirectDestinationForHistory().utf8();
            Ewk_View_Redirection_Data data = { sourceURL.data(), destinationURL.data() };
            evas_object_smart_callback_call(m_view, "perform,client,redirect", &data);
        }

        if (!loader->serverRedirectSourceForHistory().isNull()) {
            const CString& sourceURL = loader->serverRedirectSourceForHistory().utf8();
            const CString& destinationURL = loader->serverRedirectDestinationForHistory().utf8();
            Ewk_View_Redirection_Data data = { sourceURL.data(), destinationURL.data() };
            evas_object_smart_callback_call(m_view, "perform,server,redirect", &data);
        }
}
Пример #7
0
void DumpRenderTreeSupportQt::clearOpener(QWebFrameAdapter* adapter)
{
    WebCore::Frame* coreFrame = adapter->frame;
    coreFrame->loader()->setOpener(0);
}
Пример #8
0
// API Candidate?
QString DumpRenderTreeSupportQt::responseMimeType(QWebFrameAdapter* adapter)
{
    WebCore::Frame* coreFrame = adapter->frame;
    WebCore::DocumentLoader* docLoader = coreFrame->loader()->documentLoader();
    return docLoader->responseMIMEType();
}
Пример #9
0
bool DumpRenderTreeSupportQt::shouldClose(QWebFrameAdapter *adapter)
{
    WebCore::Frame* coreFrame = adapter->frame;
    return coreFrame->loader()->shouldClose();
}
Пример #10
0
static void WebHistoryClose(JNIEnv* env, jobject obj, jint frame)
{
    LOG_ASSERT(frame, "Close needs a valid Frame pointer!");
    WebCore::Frame* pFrame = (WebCore::Frame*)frame;

    WebCore::BackForwardList* list = pFrame->page()->backForwardList();
    RefPtr<WebCore::HistoryItem> current = list->currentItem();
    // Remove each item instead of using close(). close() is intended to be used
    // right before the list is deleted.
    WebCore::HistoryItemVector& entries = list->entries();
    int size = entries.size();
    for (int i = size - 1; i >= 0; --i)
        list->removeItem(entries[i].get());
    // Add the current item back to the list.
    if (current) {
        current->setBridge(0);
        // addItem will update the children to match the newly created bridge
        list->addItem(current);

        /*
         * The Grand Prix site uses anchor navigations to change the display.
         * WebKit tries to be smart and not load child frames that have the
         * same history urls during an anchor navigation. This means that the
         * current history item stored in the child frame's loader does not
         * match the item found in the history tree. If we remove all the
         * entries in the back/foward list, we have to restore the entire tree
         * or else a HistoryItem might have a deleted parent.
         *
         * In order to restore the history tree correctly, we have to look up
         * all the frames first and then look up the history item. We do this
         * because the history item in the tree may be null at this point.
         * Unfortunately, a HistoryItem can only search its immediately
         * children so we do a breadth-first rebuild of the tree.
         */

        // Keep a small list of child frames to traverse.
        WTF::Vector<WebCore::Frame*> frameQueue;
        // Fix the top-level item.
        pFrame->loader()->history()->setCurrentItem(current.get());
        WebCore::Frame* child = pFrame->tree()->firstChild();
        // Remember the parent history item so we can search for a child item.
        RefPtr<WebCore::HistoryItem> parent = current;
        while (child) {
            // Use the old history item since the current one may have a
            // deleted parent.
            WebCore::HistoryItem* item = parent->childItemWithTarget(child->tree()->name());
            child->loader()->history()->setCurrentItem(item);
            // Append the first child to the queue if it exists. If there is no
            // item, then we do not need to traverse the children since there
            // will be no parent history item.
            WebCore::Frame* firstChild;
            if (item && (firstChild = child->tree()->firstChild()))
                frameQueue.append(firstChild);
            child = child->tree()->nextSibling();
            // If we don't have a sibling for this frame and the queue isn't
            // empty, use the next entry in the queue.
            if (!child && !frameQueue.isEmpty()) {
                child = frameQueue.at(0);
                frameQueue.remove(0);
                // Figure out the parent history item used when searching for
                // the history item to use.
                parent = child->tree()->parent()->loader()->history()->currentItem();
            }
        }
    }
}
Пример #11
0
bool DumpRenderTreeSupportQt::shouldClose(QWebFrame* frame)
{
    WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
    return coreFrame->loader()->shouldClose();
}
Пример #12
0
Eina_List* DumpRenderTreeSupportEfl::frameChildren(const Evas_Object* ewkFrame)
{
    DRT_SUPPORT_FRAME_GET_OR_RETURN(ewkFrame, frame, 0);

    Eina_List* childFrames = 0;

    for (unsigned index = 0; index < frame->tree()->childCount(); index++) {
        WebCore::Frame *childFrame = frame->tree()->child(index);
        WebCore::FrameLoaderClientEfl *client = static_cast<WebCore::FrameLoaderClientEfl*>(childFrame->loader()->client());

        if (!client)
            continue;

        childFrames = eina_list_append(childFrames, client->webFrame());
    }

    return childFrames;
}
Пример #13
0
void DumpRenderTreeSupportQt::clearOpener(QWebFrame* frame)
{
    WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
    coreFrame->loader()->setOpener(0);
}
Пример #14
0
// API Candidate?
QString DumpRenderTreeSupportQt::responseMimeType(QWebFrame* frame)
{
    WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
    WebCore::DocumentLoader* docLoader = coreFrame->loader()->documentLoader();
    return docLoader->responseMIMEType();
}
Пример #15
0
Eina_List* DumpRenderTreeSupportEfl::frameChildren(const Evas_Object* ewkFrame)
{
    WebCore::Frame* frame = EWKPrivate::coreFrame(ewkFrame);

    if (!frame)
        return 0;

    Eina_List* childFrames = 0;

    for (unsigned index = 0; index < frame->tree()->childCount(); index++) {
        WebCore::Frame *childFrame = frame->tree()->child(index);
        WebCore::FrameLoaderClientEfl *client = static_cast<WebCore::FrameLoaderClientEfl*>(childFrame->loader()->client());

        if (!client)
            continue;

        childFrames = eina_list_append(childFrames, client->webFrame());
    }

    return childFrames;
}
WebFrame* InjectedBundleDOMWindowExtension::frame() const
{
    WebCore::Frame* frame = m_coreExtension->frame();
    return frame ? static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame() : 0;
}