Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c76bfa5b authored by Steve Block's avatar Steve Block
Browse files

Fixes synchronous XHR requests which require authentication to complete synchronously

Bug: 2540515
Change-Id: I58eebdf2db9388f66c75d86dc26b8055f513b038
parent 722802e7
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -200,7 +200,7 @@ public class RequestHandle {
                if (mBodyProvider != null) mBodyProvider.reset();
            } catch (java.io.IOException ex) {
                if (HttpLog.LOGV) {
                    HttpLog.v("setupAuthResponse() failed to reset body provider");
                    HttpLog.v("setupRedirect() failed to reset body provider");
                }
                return false;
            }
@@ -443,6 +443,16 @@ public class RequestHandle {
     * Creates and queues new request.
     */
    private void createAndQueueNewRequest() {
        // mConnection is non-null if and only if the requests are synchronous.
        if (mConnection != null) {
            RequestHandle newHandle = mRequestQueue.queueSynchronousRequest(
                    mUrl, mUri, mMethod, mHeaders, mRequest.mEventHandler,
                    mBodyProvider, mBodyLength);
            mRequest = newHandle.mRequest;
            mConnection = newHandle.mConnection;
            newHandle.processRequest();
            return;
        }
        mRequest = mRequestQueue.queueRequest(
                mUrl, mUri, mMethod, mHeaders, mRequest.mEventHandler,
                mBodyProvider,
+1 −1
Original line number Diff line number Diff line
@@ -1599,7 +1599,7 @@ class LoadListener extends Handler implements EventHandler {
        // from http thread. Then it is called again from WebViewCore thread 
        // after the load is completed. So make sure the queue is cleared but
        // don't set it to null.
        for (int size = mMessageQueue.size(); size > 0; size--) {
        while (!mMessageQueue.isEmpty()) {
            handleMessage(mMessageQueue.remove(0));
        }
    }