Bug 20760 - WebView DOM Exception 18 on API 16
Summary: WebView DOM Exception 18 on API 16
Status: CONFIRMED
Alias: None
Product: Android
Classification: Xamarin
Component: BCL Class Libraries ()
Version: 4.14.0
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2014-06-20 12:13 UTC by John Miller [MSFT]
Modified: 2014-06-23 14:30 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 20760 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
CONFIRMED

Description John Miller [MSFT] 2014-06-20 12:13:36 UTC
## Overview: 

    The attached (private) sample project will load correctly on Android 4.4, but on Android 4.1.2 an exception is thrown:
"I/mono-stdout( 1758): Unhandled error: Uncaught Error: SECURITY_ERR: DOM Exception 18"

## Steps to Reproduce: 

    1. Run the sample project on an Android 4.1.2 (API 16) emulator.
    2. Run logcat to see the exception once the app finishes launching.

## Actual Results: 

    The apps WebView is blank and the exception is thrown.

## Expected Results: 

    WebView should display the same content as when running on Android 4.4

## Build Date & Platform: 

    Tested on XA 4.14 and XA 4.12.4

## Additional Information: 

    This looks similar to the bug reported here: https://code.google.com/p/android/issues/detail?id=16175
    This workaround did not work: http://stackoverflow.com/questions/8390985/android-4-0-1-breaks-webview-html-5-local-storage
    It is theorized that the WebView might be ignoring the AllowFileAccessFromFileURLs and/or AllowUniversalAccessFromFileURLs settings (which are set to 'true' in the sample project) on API 16. The WebView may be treating the files it's loading as a cross-site resource.
Comment 4 Ram Chandra 2014-06-23 14:30:25 UTC
I have checked this issue and with the help of bug description and "Comment 1" I am able to reproduce this issue.

Steps to reproduce: 

1. Open the attached sample from "Commnet 1" on XS
2. Deploy the sample application on API 16 emulator.

When I deploy the attached sample on API 16 emulator I observed that emulator shows a blank screen and the adb logs contains the unhandled "DOM Exception 18" exception i.e. 

"Unhandled error: Uncaught Error: SECURITY_ERR: DOM Exception 18: url : file:///data/data/RavenHybridAndroid.RavenHybridAndroid/files/lib/Lawnchair-dom-adapter.js : at : 13".

I also observed that when I deploy the same application on device (4.4.2) application is working fine.

Screencast: http://www.screencast.com/t/NMk84pCKr20h

Adb logcat: https://gist.github.com/saurabh360/dd69f5ec1121fa5ab4e5

Environment Info:

Mac OS X 10.9.3
Xamarin Studio: 5.0.1 (build 3)
Xamarin.Android : 4.12.5 

Build Information 
Release ID: 500010003
Git revision: f94ee866936d25105704eb63728ad5a981eda0a4
Build date: 2014-06-04 12:19:12-04
Xamarin addins: 1a6044e8321ea07e03a56b5381951686c82fed8b