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

Commit 76619af6 authored by Steve Block's avatar Steve Block
Browse files

For synchronous loads, load file URLs in the WebCore thread, rather than in...

For synchronous loads, load file URLs in the WebCore thread, rather than in the new WebViewWorker thread

This fixes the layout test failure in fast/xmlhttprequest/xmlhttprequest-html-response-encoding.html

Bug: 2218794
Change-Id: If86c5dbb72b21400bd0fb6981de1a6fdf9b40fe7
parent 780a1cb7
Loading
Loading
Loading
Loading
+42 −24
Original line number Diff line number Diff line
@@ -111,11 +111,10 @@ class FrameLoader {
            }
            mNetwork = Network.getInstance(mListener.getContext());
            if (mListener.isSynchronous()) {
                handleHTTPLoad();
            } else {
                return handleHTTPLoad();
            }
            WebViewWorker.getHandler().obtainMessage(
                    WebViewWorker.MSG_ADD_HTTPLOADER, this).sendToTarget();
            }
            return true;
        } else if (handleLocalFile(url, mListener, mSettings)) {
            return true;
@@ -147,34 +146,53 @@ class FrameLoader {
            return true;
        }
        if (URLUtil.isAssetUrl(url)) {
            if (loadListener.isSynchronous()) {
                new FileLoader(url, loadListener, FileLoader.TYPE_ASSET,
                        true).load();
            } else {
                // load asset in a separate thread as it involves IO
                WebViewWorker.getHandler().obtainMessage(
                        WebViewWorker.MSG_ADD_STREAMLOADER,
                        new FileLoader(url, loadListener, FileLoader.TYPE_ASSET,
                                true)).sendToTarget();
            }
            return true;
        } else if (URLUtil.isResourceUrl(url)) {
            if (loadListener.isSynchronous()) {
                new FileLoader(url, loadListener, FileLoader.TYPE_RES,
                        true).load();
            } else {
                // load resource in a separate thread as it involves IO
                WebViewWorker.getHandler().obtainMessage(
                        WebViewWorker.MSG_ADD_STREAMLOADER,
                        new FileLoader(url, loadListener, FileLoader.TYPE_RES,
                                true)).sendToTarget();
            }
            return true;
        } else if (URLUtil.isFileUrl(url)) {
            if (loadListener.isSynchronous()) {
                new FileLoader(url, loadListener, FileLoader.TYPE_FILE,
                        settings.getAllowFileAccess()).load();
            } else {
                // load file in a separate thread as it involves IO
                WebViewWorker.getHandler().obtainMessage(
                        WebViewWorker.MSG_ADD_STREAMLOADER,
                        new FileLoader(url, loadListener, FileLoader.TYPE_FILE,
                                settings.getAllowFileAccess())).sendToTarget();
            }
            return true;
        } else if (URLUtil.isContentUrl(url)) {
            // Send the raw url to the ContentLoader because it will do a
            // permission check and the url has to match.
            if (loadListener.isSynchronous()) {
                new ContentLoader(loadListener.url(), loadListener).load();
            } else {
                // load content in a separate thread as it involves IO
                WebViewWorker.getHandler().obtainMessage(
                        WebViewWorker.MSG_ADD_STREAMLOADER,
                        new ContentLoader(loadListener.url(), loadListener))
                        .sendToTarget();
            }
            return true;
        } else if (URLUtil.isDataUrl(url)) {
            // load data in the current thread to reduce the latency