NS_IMETHODIMP
GetToStringStreamListener::OnStopRequest(nsIRequest *aRequest,
                                         nsISupports *aContext,
                                         nsresult aStatusCode)
{
    PRUint32 status, rv;
    nsCOMPtr<nsIHttpChannel> channel = do_QueryInterface(aContext);

    LOG(("OperationStreamListener::OnStopRequest() entered"));

    rv = channel ? channel->GetResponseStatus(&status) : NS_ERROR_UNEXPECTED;

    if (NS_FAILED(rv))
        return SignalCompletion(rv);

    if (status != 200)
        return SignalCompletion(status);

    nsCOMPtr<nsISupportsCString>
        suppString(do_CreateInstance("@mozilla.org/supports-cstring;1",
                                     &rv));
    NS_ENSURE_SUCCESS(rv, rv);
    suppString->SetData(mBody);

    SignalDetail(status, nsCAutoString(""), suppString);
    SignalCompletion(status);
    return NS_OK;
}
NS_IMETHODIMP
OperationStreamListener::OnStopRequest(nsIRequest *aRequest,
                                       nsISupports *aContext,
                                       nsresult aStatusCode)
{
    PRUint32 status, rv;
    nsCOMPtr<nsIHttpChannel> channel = do_QueryInterface(aContext);

    LOG(("OperationStreamListener::OnStopRequest() entered"));

    rv = channel ? channel->GetResponseStatus(&status) : NS_ERROR_UNEXPECTED;

    if (NS_FAILED(rv))
        return SignalCompletion(rv);

    if (status != 207)
        return SignalCompletion(status);

    // ZZZ Check content-length against mBody.Length()

    // Now we parse!
    nsCOMPtr<nsIDOMNodeList> responseList;
    PRUint32 length;
    rv = NS_WD_GetDocAndResponseListFromBuffer(mBody, getter_AddRefs(mXMLDoc),
                                               getter_AddRefs(responseList),
                                               &length);
    NS_ENSURE_SUCCESS(rv, SignalCompletion(rv));

    LOG(("found %d responses", length));
    
    for (PRUint32 i = 0; i < length; i++) {
        nsCOMPtr<nsIDOMNode> responseNode;
        rv = responseList->Item(i, getter_AddRefs(responseNode));
        NS_ENSURE_SUCCESS(rv, SignalCompletion(rv));

        nsCOMPtr<nsIDOMElement> responseElt =
            do_QueryInterface(responseNode, &rv);
        NS_ENSURE_SUCCESS(rv, SignalCompletion(rv));
    
        rv = ProcessResponse(responseElt);
        NS_ENSURE_SUCCESS(rv, SignalCompletion(rv));
    }

    SignalCompletion(status);
    return NS_OK;
}
Пример #3
0
void Driver::Event_Fallthrough(const EV::Event& event) {
    int accepted = 0;
    event.SetReturnPointer(&accepted);
	if(!(_activeOp && DispatchSingleEvent(_activeOp, event))) {
        if(_activeOp != _defaultOp) {
            GEN::Pointer<EV::Event> ftevent(event.Clone());
            ftevent->SetFallthrough(true);
            if(DispatchSingleEvent(_defaultOp, *ftevent)) {
                // default operator becomes active, implicit rebuild
                SetOperator(_defaultOp, false, NULL);
                // next, we have to resend the event without fallthrough flag
                accepted = 0;
                DispatchSingleEvent(_activeOp, event);
            }
        }
    }
    if(!accepted) {
        // forward event
        W::world.Send(event);
    }
    RebuildMeshes();
    SignalCompletion();
}
Пример #4
0
void Driver::Event_SetOperator(const SetOperatorEvent& event) {
    SetOperator(event.m_op, event.m_force, event.m_args);
    SignalCompletion();
}
Пример #5
0
void Driver::Event_RebuildAll(const EV::Event& event) {
    W::world.SendAndWait(ev_w_rebuildAll.Tag());
    SignalCompletion();
}