Bug 827346 - indexedDB.open() silently fails in an Open Web App (OWA/mozApp). r=myk

This commit is contained in:
Marco Castelluccio 2013-07-17 10:00:15 -04:00
parent 47be8d8d34
commit e27363e562
5 changed files with 50 additions and 14 deletions

View File

@ -84,7 +84,7 @@ WebappsRegistry.prototype = {
}
} catch(e) {
throw new Components.Exception(
"INVALID_URL: '" + aURL, Cr.NS_ERROR_FAILURE
"INVALID_URL: '" + aURL + "'", Cr.NS_ERROR_FAILURE
);
}

View File

@ -24,19 +24,7 @@ WebappsHandler.init();
// On firstrun, set permissions to their default values.
if (!Services.prefs.getBoolPref("webapprt.firstrun")) {
Cu.import("resource://webapprt/modules/WebappRT.jsm");
let uri = Services.io.newURI(WebappRT.config.app.origin, null, null);
// Set AppCache-related permissions.
Services.perms.add(uri, "pin-app",
Ci.nsIPermissionManager.ALLOW_ACTION);
Services.perms.add(uri, "offline-app",
Ci.nsIPermissionManager.ALLOW_ACTION);
Services.perms.add(uri, "indexedDB",
Ci.nsIPermissionManager.ALLOW_ACTION);
Services.perms.add(uri, "indexedDB-unlimited",
Ci.nsIPermissionManager.ALLOW_ACTION);
// Once we support packaged apps, set their permissions here on firstrun.
// Now that we've set the appropriate permissions, twiddle the firstrun
// flag so we don't try to do so again.

View File

@ -31,6 +31,15 @@ pref("extensions.blocklist.itemURL", "https://addons.mozilla.org/%LOCALE%/%APP%/
pref("full-screen-api.enabled", true);
// IndexedDB
pref("dom.indexedDB.enabled", true);
pref("indexedDB.feature.enabled", true);
pref("dom.indexedDB.warningQuota", 50);
// Offline cache prefs
pref("browser.offline-apps.notify", false);
pref("browser.cache.offline.enable", true);
pref("offline-apps.allow_by_default", true);
// Enable smooth scrolling
pref("general.smoothScroll", true);

View File

@ -13,6 +13,7 @@ include $(DEPTH)/config/autoconf.mk
MOCHITEST_FILES = \
test.webapp \
webapprt_sample.html \
webapprt_indexeddb.html \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -0,0 +1,38 @@
<!DOCTYPE HTML>
<!--
This is a IndexedDB WebappRT content mochitest. Since its name is prefixed with
webapprt_, this file is picked up by the Mochitest harness. It's just a plain
mochitest that runs in the app browser within an app window.
-->
<html>
<head>
<meta charset="utf-8">
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<p id="display">
This is the IndexedDB WebappRT content mochitest.
</p>
<div id="content" style="display: none"></div>
<pre id="test">
<script>
SimpleTest.waitForExplicitFinish();
var request = indexedDB.open('test');
request.onsuccess = function() {
ok(true, "onsuccess should be called");
SimpleTest.finish();
}
request.onerror = function() {
ok(false, "onerror shouldn't be called");
SimpleTest.finish();
}
</script>
</pre>
</body>
</html>