Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<meta charset="utf-8">
<title>IDBObjectStore.add() - If the transaction this IDBObjectStore belongs to has its mode set to readonly, throw ReadOnlyError </title>
<link rel="author" title="Intel" href="">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/support.js"></script>
<div id="log"></div>
var db,
t = async_test();
var open_rq = createdb(t);
open_rq.onupgradeneeded = function (event) {
db =;
db.createObjectStore("store", {keyPath:"pKey"});
open_rq.onsuccess = function (event) {
var txn = db.transaction("store", "readonly", {durability: 'relaxed'});
var ostore = txn.objectStore("store");
assert_throws_dom("ReadOnlyError", function(){
ostore.add({ pKey: "primaryKey_0"});