Improve unit tests of WebView

This guards that https://bugzilla.mozilla.org/show_bug.cgi?id=1001853
like error does not reappear.