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

Commit 5647bb3c authored by Ben Murdoch's avatar Ben Murdoch Committed by Ben Murdoch
Browse files

Update WebStorage methods used by DumpRenderTree to complete synchronously if...

Update WebStorage methods used by DumpRenderTree to complete synchronously if they are called on the webcore thread.
parent 9f655a4a
Loading
Loading
Loading
Loading
+25 −6
Original line number Original line Diff line number Diff line
@@ -200,10 +200,15 @@ public final class WebStorage {
     */
     */
    public void setQuotaForOrigin(String origin, long quota) {
    public void setQuotaForOrigin(String origin, long quota) {
        if (origin != null) {
        if (origin != null) {
            if (WebViewCore.THREAD_NAME.equals(Thread.currentThread().getName())) {
                nativeSetQuotaForOrigin(origin, quota);
                syncValues();
            } else {
                postMessage(Message.obtain(null, SET_QUOTA_ORIGIN,
                postMessage(Message.obtain(null, SET_QUOTA_ORIGIN,
                    new Origin(origin, quota)));
                    new Origin(origin, quota)));
            }
            }
        }
        }
    }


    /**
    /**
     * @hide
     * @hide
@@ -211,18 +216,28 @@ public final class WebStorage {
     */
     */
    public void deleteOrigin(String origin) {
    public void deleteOrigin(String origin) {
        if (origin != null) {
        if (origin != null) {
            if (WebViewCore.THREAD_NAME.equals(Thread.currentThread().getName())) {
                nativeDeleteOrigin(origin);
                syncValues();
            } else {
                postMessage(Message.obtain(null, DELETE_ORIGIN,
                postMessage(Message.obtain(null, DELETE_ORIGIN,
                    new Origin(origin)));
                    new Origin(origin)));
            }
            }
        }
        }
    }


    /**
    /**
     * @hide
     * @hide
     * Delete all databases
     * Delete all databases
     */
     */
    public void deleteAllDatabases() {
    public void deleteAllDatabases() {
        if (WebViewCore.THREAD_NAME.equals(Thread.currentThread().getName())) {
            nativeDeleteAllDatabases();
            syncValues();
        } else {
            postMessage(Message.obtain(null, DELETE_ALL));
            postMessage(Message.obtain(null, DELETE_ALL));
        }
        }
    }


    /**
    /**
     * Utility function to send a message to our handler
     * Utility function to send a message to our handler
@@ -250,8 +265,12 @@ public final class WebStorage {
     * Post a Sync request
     * Post a Sync request
     */
     */
    public void update() {
    public void update() {
        if (WebViewCore.THREAD_NAME.equals(Thread.currentThread().getName())) {
            syncValues();
        } else {
            postMessage(Message.obtain(null, UPDATE));
            postMessage(Message.obtain(null, UPDATE));
        }
        }
    }


    /**
    /**
     * Run on the webcore thread
     * Run on the webcore thread