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

Commit 47faa92c authored by Steve Block's avatar Steve Block Committed by Android (Google) Code Review
Browse files

Merge "Avoid unintended side-effects of loading javascript: URLS in Java Bridge tests"

parents fc11edb0 830698b1
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -106,7 +106,12 @@ public class JavaBridgeTestBase extends ActivityInstrumentationTestCase2<WebView
        runTestOnUiThread(new Runnable() {
            @Override
            public void run() {
                getWebView().loadUrl("javascript:" + script);
                // When a JavaScript URL is executed, if the value of the last
                // expression evaluated is not 'undefined', this value is
                // converted to a string and used as the new document for the
                // frame. We don't want this behaviour, so wrap the script in
                // an anonymous function.
                getWebView().loadUrl("javascript:(function() { " + script + " })()");
            }
        });
    }