HTML5 local SQL database cannot be created from an extension's global page
| Originator: | jacobc | ||
| Number: | rdar://8111265 | Date Originated: | 20-Jun-2010 12:52 AM |
| Status: | Duplicate/8040866 | Resolved: | 22-Jun-2010 08:10 PM |
| Product: | Safari | Product Version: | 5.0 |
| Classification: | Other Bug | Reproducible: | Always |
Summary:
An HTML5 local SQL database cannot be created from an extension's global page; attempting to do so causes a "DOM Exception 18".
Steps to Reproduce:
1) Open Extension Builder and create a new extension.
2) Set Access Level = All.
3) Create global.html with the following content:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" charset="utf-8">
var db = openDatabase("MyLocalDb", "1.0", "My Local Database", 65536);
</script>
</head>
</html>
4) Set Global Page File = global.html.
5) Install the extension.
6) Click on "Inspect Global Page". The following error will be listed for global.html:
SECURITY_ERR: DOM Exception 18: An attempt was made to break through the security policy of the user agent.
Expected Results:
A local SQL database should be created, called "MyLocalDb".
This should be visible in the Web Inspector, under Storage, and in Preferences -> Security -> Show Databases.
Note that the above two UIs assume that a local SQL database is associated with the domain of a web site; if this issue were to be fixed, then the UI might need to show that the local SQL database is tied to an extension, not a site.
Actual Results:
No database is created.
The error message "SECURITY_ERR: DOM Exception 18: An attempt was made to break through the security policy of the user agent" occurs.
Regression:
This problem does not occur if the local SQL database is created from an extension's injected script.
This problem does not occur outside the context of an extension.
Notes:
See http://discussions.apple.com/thread.jspa?threadID=2457408
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!
Possible fix
In the Extension Builder, under "Extension Storage", change Database Quota to a value bigger than "None". That made the error go away for me.
More info: http://developer.apple.com/library/safari/#documentation/Tools/Conceptual/SafariExtensionGuide/ExtensionSettings/ExtensionSettings.html#//apple_ref/doc/uid/TP40009977-CH11-SW15