Diff
Modified: trunk/LayoutTests/ChangeLog (243225 => 243226)
--- trunk/LayoutTests/ChangeLog 2019-03-20 19:37:16 UTC (rev 243225)
+++ trunk/LayoutTests/ChangeLog 2019-03-20 19:50:21 UTC (rev 243226)
@@ -1,5 +1,25 @@
2019-03-20 Devin Rousso <[email protected]>
+ Web Inspector: Debugger: move breakpoint storage to use `WI.ObjectStore`
+ https://bugs.webkit.org/show_bug.cgi?id=192719
+ <rdar://problem/46746857>
+
+ Reviewed by Timothy Hatcher.
+
+ * inspector/unit-tests/objectStore/resources/objectStore-utilities.js:
+ * inspector/unit-tests/objectStore/put.html: Renamed from LayoutTests/inspector/unit-tests/objectStore/add.html.
+ * inspector/unit-tests/objectStore/put-expected.txt: Renamed from LayoutTests/inspector/unit-tests/objectStore/add-expected.txt.
+ * inspector/unit-tests/objectStore/putObject.html: Renamed from LayoutTests/inspector/unit-tests/objectStore/addObject.html.
+ * inspector/unit-tests/objectStore/putObject-expected.txt: Renamed from LayoutTests/inspector/unit-tests/objectStore/addObject-expected.txt.
+ * inspector/unit-tests/objectStore/delete-expected.txt:
+ * inspector/unit-tests/objectStore/delete.html:
+ * inspector/unit-tests/objectStore/deleteObject-expected.txt:
+ * inspector/unit-tests/objectStore/deleteObject.html:
+ * inspector/unit-tests/objectStore/clear.html:
+ Replace `add` with `put` so that if a key already exists, it is overridden.
+
+2019-03-20 Devin Rousso <[email protected]>
+
Web Inspector: Database: lazily create the agent
https://bugs.webkit.org/show_bug.cgi?id=195587
<rdar://problem/48791735>
Deleted: trunk/LayoutTests/inspector/unit-tests/objectStore/add-expected.txt (243225 => 243226)
--- trunk/LayoutTests/inspector/unit-tests/objectStore/add-expected.txt 2019-03-20 19:37:16 UTC (rev 243225)
+++ trunk/LayoutTests/inspector/unit-tests/objectStore/add-expected.txt 2019-03-20 19:50:21 UTC (rev 243226)
@@ -1,78 +0,0 @@
-Tests WI.ObjectStore.prototype.add.
-
-
-== Running test suite: WI.ObjectStore.prototype.add
--- Running test case: WI.ObjectStore.prototype.add.NoParameters
-PASS: Should produce an exception.
-TypeError: Not enough arguments
-[]
-
--- Running test case: WI.ObjectStore.prototype.add.Boolean
-add: [false]
-add: [false,true]
-[false,true]
-
--- Running test case: WI.ObjectStore.prototype.add.Number
-add: [11]
-add: [11,22]
-[11,22]
-
--- Running test case: WI.ObjectStore.prototype.add.String
-add: ["foo"]
-add: ["foo","bar"]
-["foo","bar"]
-
--- Running test case: WI.ObjectStore.prototype.add.Array
-add: [[11]]
-add: [[11],[22]]
-[[11],[22]]
-
--- Running test case: WI.ObjectStore.prototype.add.Null
-add: [null]
-[null]
-
--- Running test case: WI.ObjectStore.prototype.add.Object.WithoutKeyPathOrAutoIncrement
-PASS: Should produce an exception.
-DataError: Failed to store record in an IDBObjectStore: The object store uses out-of-line keys and has no key generator and the key parameter was not provided.
-[]
-
--- Running test case: WI.ObjectStore.prototype.add.Object.KeyPathMissingOnObjectWithoutAutoIncrement
-PASS: Should produce an exception.
-DataError: Failed to store record in an IDBObjectStore: Evaluating the object store's key path did not yield a value.
-[]
-
--- Running test case: WI.ObjectStore.prototype.add.Object.KeyPathSetOnObjectWithoutAutoIncrement
-add: [{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1}]
-add: [{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":99,"b":2}]
-[{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":99,"b":2}]
-
--- Running test case: WI.ObjectStore.prototype.add.Object.KeyPathMissingOnObjectWithAutoIncrement
-add: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1}]
-add: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":2}]
-[{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":2}]
-
--- Running test case: WI.ObjectStore.prototype.add.Object.KeyPathSetOnObjectWithAutoIncrement
-add: [{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1}]
-add: [{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithAutoIncrement":99,"b":2}]
-[{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithAutoIncrement":99,"b":2}]
-
--- Running test case: WI.ObjectStore.prototype.add.Object.AutoIncrementWithoutKeyPath
-add: [{"a":1}]
-add: [{"a":1},{"b":2}]
-[{"a":1},{"b":2}]
-
--- Running test case: WI.ObjectStore.prototype.add.Object.KeyPathSetOnObjectWithoutAutoIncrement.Sub
-add: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1}]
-add: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":99},"b":2}]
-[{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":99},"b":2}]
-
--- Running test case: WI.ObjectStore.prototype.add.Object.KeyPathMissingOnObjectWithAutoIncrement.Sub
-add: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}}]
-add: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":2}}]
-[{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":2}}]
-
--- Running test case: WI.ObjectStore.prototype.add.Object.KeyPathSetOnObjectWithAutoIncrement.Sub
-add: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1}]
-add: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":99},"b":2}]
-[{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":99},"b":2}]
-
Deleted: trunk/LayoutTests/inspector/unit-tests/objectStore/add.html (243225 => 243226)
--- trunk/LayoutTests/inspector/unit-tests/objectStore/add.html 2019-03-20 19:37:16 UTC (rev 243225)
+++ trunk/LayoutTests/inspector/unit-tests/objectStore/add.html 2019-03-20 19:50:21 UTC (rev 243226)
@@ -1,152 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<script src=""
-<script src=""
-<script>
-function test()
-{
- let suite = InspectorTest.ObjectStore.createSuite("WI.ObjectStore.prototype.add");
-
- function testAdd(name, {options, tests}) {
- InspectorTest.ObjectStore.wrapTest(name, async function() {
- InspectorTest.ObjectStore.createObjectStore(options);
-
- for (let {value, expected} of tests)
- await InspectorTest.ObjectStore.add(value, expected);
- });
- }
-
- InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype.add.NoParameters", async function() {
- let objectStore = InspectorTest.ObjectStore.createObjectStore();
-
- await InspectorTest.expectException(async function() {
- await objectStore.add();
- await objectStore.add(InspectorTest.ObjectStore.basicObject2);
- });
- });
-
- testAdd("WI.ObjectStore.prototype.add.Boolean", {
- options: {autoIncrement: true},
- tests: [
- {value: false, expected: 1},
- {value: true, expected: 2},
- ],
- });
-
- testAdd("WI.ObjectStore.prototype.add.Number", {
- options: {autoIncrement: true},
- tests: [
- {value: 11, expected: 1},
- {value: 22, expected: 2},
- ],
- });
-
- testAdd("WI.ObjectStore.prototype.add.String", {
- options: {autoIncrement: true},
- tests: [
- {value: "foo", expected: 1},
- {value: "bar", expected: 2},
- ],
- });
-
- testAdd("WI.ObjectStore.prototype.add.Array", {
- options: {autoIncrement: true},
- tests: [
- {value: [11], expected: 1},
- {value: [22], expected: 2},
- ],
- });
-
- testAdd("WI.ObjectStore.prototype.add.Null", {
- options: {autoIncrement: true},
- tests: [
- {value: null, expected: 1},
- ],
- });
-
- InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype.add.Object.WithoutKeyPathOrAutoIncrement", async function() {
- let objectStore = InspectorTest.ObjectStore.createObjectStore();
-
- await InspectorTest.expectException(async function() {
- await objectStore.add(InspectorTest.ObjectStore.basicObject1);
- await objectStore.add(InspectorTest.ObjectStore.basicObject2);
- });
- });
-
- InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype.add.Object.KeyPathMissingOnObjectWithoutAutoIncrement", async function() {
- const options = {
- keyPath: "KeyPathMissingOnObjectWithoutAutoIncrement",
- };
- let objectStore = InspectorTest.ObjectStore.createObjectStore(options);
-
- await InspectorTest.expectException(async function() {
- await objectStore.add(InspectorTest.ObjectStore.basicObject1);
- await objectStore.add(InspectorTest.ObjectStore.basicObject2);
- });
- });
-
- testAdd("WI.ObjectStore.prototype.add.Object.KeyPathSetOnObjectWithoutAutoIncrement", {
- options: {keyPath: "KeyPathSetOnObjectWithoutAutoIncrement"},
- tests: [
- {value: {KeyPathSetOnObjectWithoutAutoIncrement: 42, ...InspectorTest.ObjectStore.basicObject1}, expected: 42},
- {value: {KeyPathSetOnObjectWithoutAutoIncrement: 99, ...InspectorTest.ObjectStore.basicObject2}, expected: 99},
- ],
- });
-
- testAdd("WI.ObjectStore.prototype.add.Object.KeyPathMissingOnObjectWithAutoIncrement", {
- options: {keyPath: "KeyPathMissingOnObjectWithAutoIncrement", autoIncrement: true},
- tests: [
- {value: InspectorTest.ObjectStore.basicObject1, expected: 1},
- {value: InspectorTest.ObjectStore.basicObject2, expected: 2},
- ],
- });
-
- testAdd("WI.ObjectStore.prototype.add.Object.KeyPathSetOnObjectWithAutoIncrement", {
- options: {keyPath: "KeyPathSetOnObjectWithAutoIncrement", autoIncrement: true},
- tests: [
- {value: {KeyPathSetOnObjectWithAutoIncrement: 42, ...InspectorTest.ObjectStore.basicObject1}, expected: 42},
- {value: {KeyPathSetOnObjectWithAutoIncrement: 99, ...InspectorTest.ObjectStore.basicObject2}, expected: 99},
- ],
- });
-
- testAdd("WI.ObjectStore.prototype.add.Object.AutoIncrementWithoutKeyPath", {
- options: {autoIncrement: true},
- tests: [
- {value: InspectorTest.ObjectStore.basicObject1, expected: 1},
- {value: InspectorTest.ObjectStore.basicObject2, expected: 2},
- ],
- });
-
- testAdd("WI.ObjectStore.prototype.add.Object.KeyPathSetOnObjectWithoutAutoIncrement.Sub", {
- options: {keyPath: "KeyPathSetOnObjectWithoutAutoIncrement.Sub"},
- tests: [
- {value: {KeyPathSetOnObjectWithoutAutoIncrement: {Sub: 42}, ...InspectorTest.ObjectStore.basicObject1}, expected: 42},
- {value: {KeyPathSetOnObjectWithoutAutoIncrement: {Sub: 99}, ...InspectorTest.ObjectStore.basicObject2}, expected: 99},
- ],
- });
-
- testAdd("WI.ObjectStore.prototype.add.Object.KeyPathMissingOnObjectWithAutoIncrement.Sub", {
- options: {keyPath: "KeyPathMissingOnObjectWithAutoIncrement.Sub", autoIncrement: true},
- tests: [
- {value: InspectorTest.ObjectStore.basicObject1, expected: 1},
- {value: InspectorTest.ObjectStore.basicObject2, expected: 2},
- ],
- });
-
- testAdd("WI.ObjectStore.prototype.add.Object.KeyPathSetOnObjectWithAutoIncrement.Sub", {
- options: {keyPath: "KeyPathSetOnObjectWithAutoIncrement.Sub", autoIncrement: true},
- tests: [
- {value: {KeyPathSetOnObjectWithAutoIncrement: {Sub: 42}, ...InspectorTest.ObjectStore.basicObject1}, expected: 42},
- {value: {KeyPathSetOnObjectWithAutoIncrement: {Sub: 99}, ...InspectorTest.ObjectStore.basicObject2}, expected: 99},
- ],
- });
-
- suite.runTestCasesAndFinish();
-}
-</script>
-</head>
-<body _onload_="runTest()">
- <p>Tests WI.ObjectStore.prototype.add.</p>
-</body>
-</html>
Deleted: trunk/LayoutTests/inspector/unit-tests/objectStore/addObject-expected.txt (243225 => 243226)
--- trunk/LayoutTests/inspector/unit-tests/objectStore/addObject-expected.txt 2019-03-20 19:37:16 UTC (rev 243225)
+++ trunk/LayoutTests/inspector/unit-tests/objectStore/addObject-expected.txt 2019-03-20 19:50:21 UTC (rev 243226)
@@ -1,54 +0,0 @@
-Tests WI.ObjectStore.prototype.addObject.
-
-
-== Running test suite: WI.ObjectStore.prototype.addObject
--- Running test case: WI.ObjectStore.prototype.addObject.NoParameters
-PASS: Should produce an exception.
-TypeError: undefined is not an object (evaluating 'object.toJSON')
-[]
-
--- Running test case: WI.ObjectStore.prototype.addObject.WithoutKeyPathOrAutoIncrement
-PASS: Should produce an exception.
-DataError: Failed to store record in an IDBObjectStore: The object store uses out-of-line keys and has no key generator and the key parameter was not provided.
-[]
-
--- Running test case: WI.ObjectStore.prototype.addObject.KeyPathMissingOnObjectWithoutAutoIncrement
-PASS: Should produce an exception.
-DataError: Failed to store record in an IDBObjectStore: Evaluating the object store's key path did not yield a value.
-[]
-
--- Running test case: WI.ObjectStore.prototype.addObject.KeyPathSetOnObjectWithoutAutoIncrement
-addObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1}]
-addObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":99,"b":2}]
-[{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":99,"b":2}]
-
--- Running test case: WI.ObjectStore.prototype.addObject.KeyPathMissingOnObjectWithAutoIncrement
-addObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1}]
-addObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":2}]
-[{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":2}]
-
--- Running test case: WI.ObjectStore.prototype.addObject.KeyPathSetOnObjectWithAutoIncrement
-addObject: [{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1}]
-addObject: [{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithAutoIncrement":99,"b":2}]
-[{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithAutoIncrement":99,"b":2}]
-
--- Running test case: WI.ObjectStore.prototype.addObject.AutoIncrementWithoutKeyPath
-addObject: [{"a":1}]
-addObject: [{"a":1},{"b":2}]
-[{"a":1},{"b":2}]
-
--- Running test case: WI.ObjectStore.prototype.addObject.KeyPathSetOnObjectWithoutAutoIncrement.Sub
-addObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1}]
-addObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":99},"b":2}]
-[{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":99},"b":2}]
-
--- Running test case: WI.ObjectStore.prototype.addObject.KeyPathMissingOnObjectWithAutoIncrement.Sub
-addObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}}]
-addObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":2}}]
-[{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":2}}]
-
--- Running test case: WI.ObjectStore.prototype.addObject.KeyPathSetOnObjectWithAutoIncrement.Sub
-addObject: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1}]
-addObject: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":99},"b":2}]
-[{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":99},"b":2}]
-
Deleted: trunk/LayoutTests/inspector/unit-tests/objectStore/addObject.html (243225 => 243226)
--- trunk/LayoutTests/inspector/unit-tests/objectStore/addObject.html 2019-03-20 19:37:16 UTC (rev 243225)
+++ trunk/LayoutTests/inspector/unit-tests/objectStore/addObject.html 2019-03-20 19:50:21 UTC (rev 243226)
@@ -1,113 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<script src=""
-<script src=""
-<script>
-function test()
-{
- let suite = InspectorTest.ObjectStore.createSuite("WI.ObjectStore.prototype.addObject");
-
- function testAddObject(name, {options, tests}) {
- InspectorTest.ObjectStore.wrapTest(name, async function() {
- InspectorTest.ObjectStore.createObjectStore(options);
-
- for (let {value, expected} of tests)
- await InspectorTest.ObjectStore.addObject(new InspectorTest.ObjectStore.TestObject(value), expected);
- });
- }
-
- InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype.addObject.NoParameters", async function() {
- let objectStore = InspectorTest.ObjectStore.createObjectStore();
-
- await InspectorTest.expectException(async function() {
- await objectStore.addObject();
- await objectStore.addObject(new InspectorTest.ObjectStore.TestObject(InspectorTest.ObjectStore.basicObject2));
- });
- });
-
- InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype.addObject.WithoutKeyPathOrAutoIncrement", async function() {
- let objectStore = InspectorTest.ObjectStore.createObjectStore();
-
- await InspectorTest.expectException(async function() {
- await objectStore.addObject(new InspectorTest.ObjectStore.TestObject(InspectorTest.ObjectStore.basicObject1));
- await objectStore.addObject(new InspectorTest.ObjectStore.TestObject(InspectorTest.ObjectStore.basicObject2));
- });
- });
-
- InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype.addObject.KeyPathMissingOnObjectWithoutAutoIncrement", async function() {
- const options = {
- keyPath: "KeyPathMissingOnObjectWithoutAutoIncrement",
- };
- let objectStore = InspectorTest.ObjectStore.createObjectStore(options);
-
- await InspectorTest.expectException(async function() {
- await objectStore.addObject(new InspectorTest.ObjectStore.TestObject(InspectorTest.ObjectStore.basicObject1));
- await objectStore.addObject(new InspectorTest.ObjectStore.TestObject(InspectorTest.ObjectStore.basicObject2));
- });
- });
-
- testAddObject("WI.ObjectStore.prototype.addObject.KeyPathSetOnObjectWithoutAutoIncrement", {
- options: {keyPath: "KeyPathSetOnObjectWithoutAutoIncrement"},
- tests: [
- {value: {KeyPathSetOnObjectWithoutAutoIncrement: 42, ...InspectorTest.ObjectStore.basicObject1}, expected: 42},
- {value: {KeyPathSetOnObjectWithoutAutoIncrement: 99, ...InspectorTest.ObjectStore.basicObject2}, expected: 99},
- ],
- });
-
- testAddObject("WI.ObjectStore.prototype.addObject.KeyPathMissingOnObjectWithAutoIncrement", {
- options: {keyPath: "KeyPathMissingOnObjectWithAutoIncrement", autoIncrement: true},
- tests: [
- {value: InspectorTest.ObjectStore.basicObject1, expected: 1},
- {value: InspectorTest.ObjectStore.basicObject2, expected: 2},
- ],
- });
-
- testAddObject("WI.ObjectStore.prototype.addObject.KeyPathSetOnObjectWithAutoIncrement", {
- options: {keyPath: "KeyPathSetOnObjectWithAutoIncrement", autoIncrement: true},
- tests: [
- {value: {KeyPathSetOnObjectWithAutoIncrement: 42, ...InspectorTest.ObjectStore.basicObject1}, expected: 42},
- {value: {KeyPathSetOnObjectWithAutoIncrement: 99, ...InspectorTest.ObjectStore.basicObject2}, expected: 99},
- ],
- });
-
- testAddObject("WI.ObjectStore.prototype.addObject.AutoIncrementWithoutKeyPath", {
- options: {autoIncrement: true},
- tests: [
- {value: InspectorTest.ObjectStore.basicObject1, expected: 1},
- {value: InspectorTest.ObjectStore.basicObject2, expected: 2},
- ],
- });
-
- testAddObject("WI.ObjectStore.prototype.addObject.KeyPathSetOnObjectWithoutAutoIncrement.Sub", {
- options: {keyPath: "KeyPathSetOnObjectWithoutAutoIncrement.Sub"},
- tests: [
- {value: {KeyPathSetOnObjectWithoutAutoIncrement: {Sub: 42}, ...InspectorTest.ObjectStore.basicObject1}, expected: 42},
- {value: {KeyPathSetOnObjectWithoutAutoIncrement: {Sub: 99}, ...InspectorTest.ObjectStore.basicObject2}, expected: 99},
- ],
- });
-
- testAddObject("WI.ObjectStore.prototype.addObject.KeyPathMissingOnObjectWithAutoIncrement.Sub", {
- options: {keyPath: "KeyPathMissingOnObjectWithAutoIncrement.Sub", autoIncrement: true},
- tests: [
- {value: InspectorTest.ObjectStore.basicObject1, expected: 1},
- {value: InspectorTest.ObjectStore.basicObject2, expected: 2},
- ],
- });
-
- testAddObject("WI.ObjectStore.prototype.addObject.KeyPathSetOnObjectWithAutoIncrement.Sub", {
- options: {keyPath: "KeyPathSetOnObjectWithAutoIncrement.Sub", autoIncrement: true},
- tests: [
- {value: {KeyPathSetOnObjectWithAutoIncrement: {Sub: 42}, ...InspectorTest.ObjectStore.basicObject1}, expected: 42},
- {value: {KeyPathSetOnObjectWithAutoIncrement: {Sub: 99}, ...InspectorTest.ObjectStore.basicObject2}, expected: 99},
- ],
- });
-
- suite.runTestCasesAndFinish();
-}
-</script>
-</head>
-<body _onload_="runTest()">
- <p>Tests WI.ObjectStore.prototype.addObject.</p>
-</body>
-</html>
Modified: trunk/LayoutTests/inspector/unit-tests/objectStore/clear.html (243225 => 243226)
--- trunk/LayoutTests/inspector/unit-tests/objectStore/clear.html 2019-03-20 19:37:16 UTC (rev 243225)
+++ trunk/LayoutTests/inspector/unit-tests/objectStore/clear.html 2019-03-20 19:50:21 UTC (rev 243226)
@@ -13,7 +13,7 @@
let objectStore = InspectorTest.ObjectStore.createObjectStore({autoIncrement: true});
for (let object of objects)
- await objectStore.add(object);
+ await objectStore.put(object);
await InspectorTest.ObjectStore.logValues();
Modified: trunk/LayoutTests/inspector/unit-tests/objectStore/delete-expected.txt (243225 => 243226)
--- trunk/LayoutTests/inspector/unit-tests/objectStore/delete-expected.txt 2019-03-20 19:37:16 UTC (rev 243225)
+++ trunk/LayoutTests/inspector/unit-tests/objectStore/delete-expected.txt 2019-03-20 19:50:21 UTC (rev 243226)
@@ -3,47 +3,47 @@
== Running test suite: WI.ObjectStore.prototype.delete
-- Running test case: WI.ObjectStore.prototype.delete.NoParameters
-add: [{"b":2}]
+put: [{"b":2}]
PASS: Should produce an exception.
TypeError: Not enough arguments
[{"b":2}]
-- Running test case: WI.ObjectStore.prototype.delete.MissingObject
-add: [{"b":2}]
+put: [{"b":2}]
PASS: Should produce an exception.
DataError: Failed to execute 'delete' on 'IDBObjectStore': The parameter is not a valid key.
[{"b":2}]
-- Running test case: WI.ObjectStore.prototype.delete.Boolean
-add: [false]
-add: [false,true]
+put: [false]
+put: [false,true]
delete: [true]
delete: []
[]
-- Running test case: WI.ObjectStore.prototype.delete.Number
-add: [11]
-add: [11,22]
+put: [11]
+put: [11,22]
delete: [22]
delete: []
[]
-- Running test case: WI.ObjectStore.prototype.delete.String
-add: ["foo"]
-add: ["foo","bar"]
+put: ["foo"]
+put: ["foo","bar"]
delete: ["bar"]
delete: []
[]
-- Running test case: WI.ObjectStore.prototype.delete.Array
-add: [[11]]
-add: [[11],[22]]
+put: [[11]]
+put: [[11],[22]]
delete: [[22]]
delete: []
[]
-- Running test case: WI.ObjectStore.prototype.delete.Null
-add: [null]
+put: [null]
delete: []
[]
@@ -58,50 +58,50 @@
[]
-- Running test case: WI.ObjectStore.prototype.delete.Object.KeyPathSetOnObjectWithoutAutoIncrement
-add: [{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1}]
-add: [{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":99,"b":2}]
+put: [{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1}]
+put: [{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":99,"b":2}]
delete: [{"KeyPathSetOnObjectWithoutAutoIncrement":99,"b":2}]
delete: []
[]
-- Running test case: WI.ObjectStore.prototype.delete.Object.KeyPathMissingOnObjectWithAutoIncrement
-add: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1}]
-add: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":2}]
+put: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1}]
+put: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":2}]
delete: [{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":2}]
delete: []
[]
-- Running test case: WI.ObjectStore.prototype.delete.Object.KeyPathSetOnObjectWithAutoIncrement
-add: [{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1}]
-add: [{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithAutoIncrement":99,"b":2}]
+put: [{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1}]
+put: [{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithAutoIncrement":99,"b":2}]
delete: [{"KeyPathSetOnObjectWithAutoIncrement":99,"b":2}]
delete: []
[]
-- Running test case: WI.ObjectStore.prototype.delete.Object.AutoIncrementWithoutKeyPath
-add: [{"a":1}]
-add: [{"a":1},{"b":2}]
+put: [{"a":1}]
+put: [{"a":1},{"b":2}]
delete: [{"b":2}]
delete: []
[]
-- Running test case: WI.ObjectStore.prototype.delete.Object.KeyPathSetOnObjectWithoutAutoIncrement.Sub
-add: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1}]
-add: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":99},"b":2}]
+put: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1}]
+put: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":99},"b":2}]
delete: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":99},"b":2}]
delete: []
[]
-- Running test case: WI.ObjectStore.prototype.delete.Object.KeyPathMissingOnObjectWithAutoIncrement.Sub
-add: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}}]
-add: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":2}}]
+put: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}}]
+put: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":2}}]
delete: [{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":2}}]
delete: []
[]
-- Running test case: WI.ObjectStore.prototype.delete.Object.KeyPathSetOnObjectWithAutoIncrement.Sub
-add: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1}]
-add: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":99},"b":2}]
+put: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1}]
+put: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":99},"b":2}]
delete: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":99},"b":2}]
delete: []
[]
Modified: trunk/LayoutTests/inspector/unit-tests/objectStore/delete.html (243225 => 243226)
--- trunk/LayoutTests/inspector/unit-tests/objectStore/delete.html 2019-03-20 19:37:16 UTC (rev 243225)
+++ trunk/LayoutTests/inspector/unit-tests/objectStore/delete.html 2019-03-20 19:50:21 UTC (rev 243226)
@@ -14,7 +14,7 @@
let keys = [];
for (let {value, expected} of tests)
- keys.push(await InspectorTest.ObjectStore.add(value, expected));
+ keys.push(await InspectorTest.ObjectStore.put(value, expected));
for (let key of keys)
await InspectorTest.ObjectStore.delete(key);
@@ -29,7 +29,7 @@
try {
// This call may fail on WK1
- await InspectorTest.ObjectStore.add(InspectorTest.ObjectStore.basicObject2, 1);
+ await InspectorTest.ObjectStore.put(InspectorTest.ObjectStore.basicObject2, 1);
} catch { }
await InspectorTest.expectException(async () => {
@@ -44,7 +44,7 @@
};
let objectStore = InspectorTest.ObjectStore.createObjectStore(options);
- await InspectorTest.ObjectStore.add(InspectorTest.ObjectStore.basicObject2, 1);
+ await InspectorTest.ObjectStore.put(InspectorTest.ObjectStore.basicObject2, 1);
await InspectorTest.expectException(async () => {
await objectStore.delete(InspectorTest.ObjectStore.basicObject1);
@@ -95,8 +95,8 @@
let objectStore = InspectorTest.ObjectStore.createObjectStore();
await InspectorTest.expectException(async function() {
- await objectStore.add(InspectorTest.ObjectStore.basicObject1);
- await objectStore.add(InspectorTest.ObjectStore.basicObject2);
+ await objectStore.put(InspectorTest.ObjectStore.basicObject1);
+ await objectStore.put(InspectorTest.ObjectStore.basicObject2);
});
});
@@ -107,8 +107,8 @@
let objectStore = InspectorTest.ObjectStore.createObjectStore(options);
await InspectorTest.expectException(async function() {
- await objectStore.add(InspectorTest.ObjectStore.basicObject1);
- await objectStore.add(InspectorTest.ObjectStore.basicObject2);
+ await objectStore.put(InspectorTest.ObjectStore.basicObject1);
+ await objectStore.put(InspectorTest.ObjectStore.basicObject2);
});
});
Modified: trunk/LayoutTests/inspector/unit-tests/objectStore/deleteObject-expected.txt (243225 => 243226)
--- trunk/LayoutTests/inspector/unit-tests/objectStore/deleteObject-expected.txt 2019-03-20 19:37:16 UTC (rev 243225)
+++ trunk/LayoutTests/inspector/unit-tests/objectStore/deleteObject-expected.txt 2019-03-20 19:50:21 UTC (rev 243226)
@@ -3,13 +3,13 @@
== Running test suite: WI.ObjectStore.prototype.deleteObject
-- Running test case: WI.ObjectStore.prototype.deleteObject.NoParameters
-add: [{"_object":{"b":2}}]
+put: [{"_object":{"b":2}}]
PASS: Should produce an exception.
TypeError: undefined is not an object (evaluating 'object[key]')
[{"_object":{"b":2}}]
-- Running test case: WI.ObjectStore.prototype.deleteObject.MissingObject
-add: [{"_object":{"b":2}}]
+put: [{"_object":{"b":2}}]
PASS: Should produce an exception.
DataError: Failed to execute 'delete' on 'IDBObjectStore': The parameter is not a valid key range.
[{"_object":{"b":2}}]
@@ -30,50 +30,50 @@
[]
-- Running test case: WI.ObjectStore.prototype.deleteObject.KeyPathSetOnObjectWithoutAutoIncrement
-addObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1}]
-addObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":99,"b":2}]
+putObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1}]
+putObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":99,"b":2}]
deleteObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":99,"b":2}]
deleteObject: []
[]
-- Running test case: WI.ObjectStore.prototype.deleteObject.KeyPathMissingOnObjectWithAutoIncrement
-addObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1}]
-addObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":2}]
+putObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1}]
+putObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":2}]
deleteObject: [{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":2}]
deleteObject: []
[]
-- Running test case: WI.ObjectStore.prototype.deleteObject.KeyPathSetOnObjectWithAutoIncrement
-addObject: [{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1}]
-addObject: [{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithAutoIncrement":99,"b":2}]
+putObject: [{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1}]
+putObject: [{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithAutoIncrement":99,"b":2}]
deleteObject: [{"KeyPathSetOnObjectWithAutoIncrement":99,"b":2}]
deleteObject: []
[]
-- Running test case: WI.ObjectStore.prototype.deleteObject.AutoIncrementWithoutKeyPath
-addObject: [{"a":1}]
-addObject: [{"a":1},{"b":2}]
+putObject: [{"a":1}]
+putObject: [{"a":1},{"b":2}]
deleteObject: [{"b":2}]
deleteObject: []
[]
-- Running test case: WI.ObjectStore.prototype.deleteObject.KeyPathSetOnObjectWithoutAutoIncrement.Sub
-addObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1}]
-addObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":99},"b":2}]
+putObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1}]
+putObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":99},"b":2}]
deleteObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":99},"b":2}]
deleteObject: []
[]
-- Running test case: WI.ObjectStore.prototype.deleteObject.KeyPathMissingOnObjectWithAutoIncrement.Sub
-addObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}}]
-addObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":2}}]
+putObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}}]
+putObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":2}}]
deleteObject: [{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":2}}]
deleteObject: []
[]
-- Running test case: WI.ObjectStore.prototype.deleteObject.KeyPathSetOnObjectWithAutoIncrement.Sub
-addObject: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1}]
-addObject: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":99},"b":2}]
+putObject: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1}]
+putObject: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":99},"b":2}]
deleteObject: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":99},"b":2}]
deleteObject: []
[]
Modified: trunk/LayoutTests/inspector/unit-tests/objectStore/deleteObject.html (243225 => 243226)
--- trunk/LayoutTests/inspector/unit-tests/objectStore/deleteObject.html 2019-03-20 19:37:16 UTC (rev 243225)
+++ trunk/LayoutTests/inspector/unit-tests/objectStore/deleteObject.html 2019-03-20 19:50:21 UTC (rev 243226)
@@ -15,7 +15,7 @@
let objects = []
for (let {value, expected} of tests) {
let object = new InspectorTest.ObjectStore.TestObject(value);
- await InspectorTest.ObjectStore.addObject(object, expected);
+ await InspectorTest.ObjectStore.putObject(object, expected);
objects.push(object);
}
@@ -34,7 +34,7 @@
try {
// This call may fail on WK1
- await InspectorTest.ObjectStore.add(object, 1);
+ await InspectorTest.ObjectStore.put(object, 1);
} catch { }
await InspectorTest.expectException(async () => {
@@ -49,7 +49,7 @@
};
let objectStore = InspectorTest.ObjectStore.createObjectStore(options);
- await InspectorTest.ObjectStore.add(new InspectorTest.ObjectStore.TestObject(InspectorTest.ObjectStore.basicObject2), 1);
+ await InspectorTest.ObjectStore.put(new InspectorTest.ObjectStore.TestObject(InspectorTest.ObjectStore.basicObject2), 1);
await InspectorTest.expectException(async () => {
await objectStore.deleteObject(new InspectorTest.ObjectStore.TestObject(InspectorTest.ObjectStore.basicObject1));
@@ -73,8 +73,8 @@
let objectStore = InspectorTest.ObjectStore.createObjectStore();
await InspectorTest.expectException(async function() {
- await objectStore.add(InspectorTest.ObjectStore.basicObject1);
- await objectStore.add(InspectorTest.ObjectStore.basicObject2);
+ await objectStore.put(InspectorTest.ObjectStore.basicObject1);
+ await objectStore.put(InspectorTest.ObjectStore.basicObject2);
});
});
@@ -85,8 +85,8 @@
let objectStore = InspectorTest.ObjectStore.createObjectStore(options);
await InspectorTest.expectException(async function() {
- await objectStore.add(InspectorTest.ObjectStore.basicObject1);
- await objectStore.add(InspectorTest.ObjectStore.basicObject2);
+ await objectStore.put(InspectorTest.ObjectStore.basicObject1);
+ await objectStore.put(InspectorTest.ObjectStore.basicObject2);
});
});
Added: trunk/LayoutTests/inspector/unit-tests/objectStore/put-expected.txt (0 => 243226)
--- trunk/LayoutTests/inspector/unit-tests/objectStore/put-expected.txt (rev 0)
+++ trunk/LayoutTests/inspector/unit-tests/objectStore/put-expected.txt 2019-03-20 19:50:21 UTC (rev 243226)
@@ -0,0 +1,78 @@
+Tests WI.ObjectStore.prototype.put.
+
+
+== Running test suite: WI.ObjectStore.prototype.put
+-- Running test case: WI.ObjectStore.prototype.put.NoParameters
+PASS: Should produce an exception.
+TypeError: Not enough arguments
+[]
+
+-- Running test case: WI.ObjectStore.prototype.put.Boolean
+put: [false]
+put: [false,true]
+[false,true]
+
+-- Running test case: WI.ObjectStore.prototype.put.Number
+put: [11]
+put: [11,22]
+[11,22]
+
+-- Running test case: WI.ObjectStore.prototype.put.String
+put: ["foo"]
+put: ["foo","bar"]
+["foo","bar"]
+
+-- Running test case: WI.ObjectStore.prototype.put.Array
+put: [[11]]
+put: [[11],[22]]
+[[11],[22]]
+
+-- Running test case: WI.ObjectStore.prototype.put.Null
+put: [null]
+[null]
+
+-- Running test case: WI.ObjectStore.prototype.put.Object.WithoutKeyPathOrAutoIncrement
+PASS: Should produce an exception.
+DataError: Failed to store record in an IDBObjectStore: The object store uses out-of-line keys and has no key generator and the key parameter was not provided.
+[]
+
+-- Running test case: WI.ObjectStore.prototype.put.Object.KeyPathMissingOnObjectWithoutAutoIncrement
+PASS: Should produce an exception.
+DataError: Failed to store record in an IDBObjectStore: Evaluating the object store's key path did not yield a value.
+[]
+
+-- Running test case: WI.ObjectStore.prototype.put.Object.KeyPathSetOnObjectWithoutAutoIncrement
+put: [{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1}]
+put: [{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":99,"b":2}]
+[{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":99,"b":2}]
+
+-- Running test case: WI.ObjectStore.prototype.put.Object.KeyPathMissingOnObjectWithAutoIncrement
+put: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1}]
+put: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":2}]
+[{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":2}]
+
+-- Running test case: WI.ObjectStore.prototype.put.Object.KeyPathSetOnObjectWithAutoIncrement
+put: [{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1}]
+put: [{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithAutoIncrement":99,"b":2}]
+[{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithAutoIncrement":99,"b":2}]
+
+-- Running test case: WI.ObjectStore.prototype.put.Object.AutoIncrementWithoutKeyPath
+put: [{"a":1}]
+put: [{"a":1},{"b":2}]
+[{"a":1},{"b":2}]
+
+-- Running test case: WI.ObjectStore.prototype.put.Object.KeyPathSetOnObjectWithoutAutoIncrement.Sub
+put: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1}]
+put: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":99},"b":2}]
+[{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":99},"b":2}]
+
+-- Running test case: WI.ObjectStore.prototype.put.Object.KeyPathMissingOnObjectWithAutoIncrement.Sub
+put: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}}]
+put: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":2}}]
+[{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":2}}]
+
+-- Running test case: WI.ObjectStore.prototype.put.Object.KeyPathSetOnObjectWithAutoIncrement.Sub
+put: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1}]
+put: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":99},"b":2}]
+[{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":99},"b":2}]
+
Copied: trunk/LayoutTests/inspector/unit-tests/objectStore/put.html (from rev 243225, trunk/LayoutTests/inspector/unit-tests/objectStore/add.html) (0 => 243226)
--- trunk/LayoutTests/inspector/unit-tests/objectStore/put.html (rev 0)
+++ trunk/LayoutTests/inspector/unit-tests/objectStore/put.html 2019-03-20 19:50:21 UTC (rev 243226)
@@ -0,0 +1,152 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script src=""
+<script>
+function test()
+{
+ let suite = InspectorTest.ObjectStore.createSuite("WI.ObjectStore.prototype.put");
+
+ function testPut(name, {options, tests}) {
+ InspectorTest.ObjectStore.wrapTest(name, async function() {
+ InspectorTest.ObjectStore.createObjectStore(options);
+
+ for (let {value, expected} of tests)
+ await InspectorTest.ObjectStore.put(value, expected);
+ });
+ }
+
+ InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype.put.NoParameters", async function() {
+ let objectStore = InspectorTest.ObjectStore.createObjectStore();
+
+ await InspectorTest.expectException(async function() {
+ await objectStore.put();
+ await objectStore.put(InspectorTest.ObjectStore.basicObject2);
+ });
+ });
+
+ testPut("WI.ObjectStore.prototype.put.Boolean", {
+ options: {autoIncrement: true},
+ tests: [
+ {value: false, expected: 1},
+ {value: true, expected: 2},
+ ],
+ });
+
+ testPut("WI.ObjectStore.prototype.put.Number", {
+ options: {autoIncrement: true},
+ tests: [
+ {value: 11, expected: 1},
+ {value: 22, expected: 2},
+ ],
+ });
+
+ testPut("WI.ObjectStore.prototype.put.String", {
+ options: {autoIncrement: true},
+ tests: [
+ {value: "foo", expected: 1},
+ {value: "bar", expected: 2},
+ ],
+ });
+
+ testPut("WI.ObjectStore.prototype.put.Array", {
+ options: {autoIncrement: true},
+ tests: [
+ {value: [11], expected: 1},
+ {value: [22], expected: 2},
+ ],
+ });
+
+ testPut("WI.ObjectStore.prototype.put.Null", {
+ options: {autoIncrement: true},
+ tests: [
+ {value: null, expected: 1},
+ ],
+ });
+
+ InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype.put.Object.WithoutKeyPathOrAutoIncrement", async function() {
+ let objectStore = InspectorTest.ObjectStore.createObjectStore();
+
+ await InspectorTest.expectException(async function() {
+ await objectStore.put(InspectorTest.ObjectStore.basicObject1);
+ await objectStore.put(InspectorTest.ObjectStore.basicObject2);
+ });
+ });
+
+ InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype.put.Object.KeyPathMissingOnObjectWithoutAutoIncrement", async function() {
+ const options = {
+ keyPath: "KeyPathMissingOnObjectWithoutAutoIncrement",
+ };
+ let objectStore = InspectorTest.ObjectStore.createObjectStore(options);
+
+ await InspectorTest.expectException(async function() {
+ await objectStore.put(InspectorTest.ObjectStore.basicObject1);
+ await objectStore.put(InspectorTest.ObjectStore.basicObject2);
+ });
+ });
+
+ testPut("WI.ObjectStore.prototype.put.Object.KeyPathSetOnObjectWithoutAutoIncrement", {
+ options: {keyPath: "KeyPathSetOnObjectWithoutAutoIncrement"},
+ tests: [
+ {value: {KeyPathSetOnObjectWithoutAutoIncrement: 42, ...InspectorTest.ObjectStore.basicObject1}, expected: 42},
+ {value: {KeyPathSetOnObjectWithoutAutoIncrement: 99, ...InspectorTest.ObjectStore.basicObject2}, expected: 99},
+ ],
+ });
+
+ testPut("WI.ObjectStore.prototype.put.Object.KeyPathMissingOnObjectWithAutoIncrement", {
+ options: {keyPath: "KeyPathMissingOnObjectWithAutoIncrement", autoIncrement: true},
+ tests: [
+ {value: InspectorTest.ObjectStore.basicObject1, expected: 1},
+ {value: InspectorTest.ObjectStore.basicObject2, expected: 2},
+ ],
+ });
+
+ testPut("WI.ObjectStore.prototype.put.Object.KeyPathSetOnObjectWithAutoIncrement", {
+ options: {keyPath: "KeyPathSetOnObjectWithAutoIncrement", autoIncrement: true},
+ tests: [
+ {value: {KeyPathSetOnObjectWithAutoIncrement: 42, ...InspectorTest.ObjectStore.basicObject1}, expected: 42},
+ {value: {KeyPathSetOnObjectWithAutoIncrement: 99, ...InspectorTest.ObjectStore.basicObject2}, expected: 99},
+ ],
+ });
+
+ testPut("WI.ObjectStore.prototype.put.Object.AutoIncrementWithoutKeyPath", {
+ options: {autoIncrement: true},
+ tests: [
+ {value: InspectorTest.ObjectStore.basicObject1, expected: 1},
+ {value: InspectorTest.ObjectStore.basicObject2, expected: 2},
+ ],
+ });
+
+ testPut("WI.ObjectStore.prototype.put.Object.KeyPathSetOnObjectWithoutAutoIncrement.Sub", {
+ options: {keyPath: "KeyPathSetOnObjectWithoutAutoIncrement.Sub"},
+ tests: [
+ {value: {KeyPathSetOnObjectWithoutAutoIncrement: {Sub: 42}, ...InspectorTest.ObjectStore.basicObject1}, expected: 42},
+ {value: {KeyPathSetOnObjectWithoutAutoIncrement: {Sub: 99}, ...InspectorTest.ObjectStore.basicObject2}, expected: 99},
+ ],
+ });
+
+ testPut("WI.ObjectStore.prototype.put.Object.KeyPathMissingOnObjectWithAutoIncrement.Sub", {
+ options: {keyPath: "KeyPathMissingOnObjectWithAutoIncrement.Sub", autoIncrement: true},
+ tests: [
+ {value: InspectorTest.ObjectStore.basicObject1, expected: 1},
+ {value: InspectorTest.ObjectStore.basicObject2, expected: 2},
+ ],
+ });
+
+ testPut("WI.ObjectStore.prototype.put.Object.KeyPathSetOnObjectWithAutoIncrement.Sub", {
+ options: {keyPath: "KeyPathSetOnObjectWithAutoIncrement.Sub", autoIncrement: true},
+ tests: [
+ {value: {KeyPathSetOnObjectWithAutoIncrement: {Sub: 42}, ...InspectorTest.ObjectStore.basicObject1}, expected: 42},
+ {value: {KeyPathSetOnObjectWithAutoIncrement: {Sub: 99}, ...InspectorTest.ObjectStore.basicObject2}, expected: 99},
+ ],
+ });
+
+ suite.runTestCasesAndFinish();
+}
+</script>
+</head>
+<body _onload_="runTest()">
+ <p>Tests WI.ObjectStore.prototype.put.</p>
+</body>
+</html>
Copied: trunk/LayoutTests/inspector/unit-tests/objectStore/putObject-expected.txt (from rev 243225, trunk/LayoutTests/inspector/unit-tests/objectStore/addObject-expected.txt) (0 => 243226)
--- trunk/LayoutTests/inspector/unit-tests/objectStore/putObject-expected.txt (rev 0)
+++ trunk/LayoutTests/inspector/unit-tests/objectStore/putObject-expected.txt 2019-03-20 19:50:21 UTC (rev 243226)
@@ -0,0 +1,54 @@
+Tests WI.ObjectStore.prototype.putObject.
+
+
+== Running test suite: WI.ObjectStore.prototype.putObject
+-- Running test case: WI.ObjectStore.prototype.putObject.NoParameters
+PASS: Should produce an exception.
+TypeError: undefined is not an object (evaluating 'object.toJSON')
+[]
+
+-- Running test case: WI.ObjectStore.prototype.putObject.WithoutKeyPathOrAutoIncrement
+PASS: Should produce an exception.
+DataError: Failed to store record in an IDBObjectStore: The object store uses out-of-line keys and has no key generator and the key parameter was not provided.
+[]
+
+-- Running test case: WI.ObjectStore.prototype.putObject.KeyPathMissingOnObjectWithoutAutoIncrement
+PASS: Should produce an exception.
+DataError: Failed to store record in an IDBObjectStore: Evaluating the object store's key path did not yield a value.
+[]
+
+-- Running test case: WI.ObjectStore.prototype.putObject.KeyPathSetOnObjectWithoutAutoIncrement
+putObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1}]
+putObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":99,"b":2}]
+[{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":99,"b":2}]
+
+-- Running test case: WI.ObjectStore.prototype.putObject.KeyPathMissingOnObjectWithAutoIncrement
+putObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1}]
+putObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":2}]
+[{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":2}]
+
+-- Running test case: WI.ObjectStore.prototype.putObject.KeyPathSetOnObjectWithAutoIncrement
+putObject: [{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1}]
+putObject: [{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithAutoIncrement":99,"b":2}]
+[{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithAutoIncrement":99,"b":2}]
+
+-- Running test case: WI.ObjectStore.prototype.putObject.AutoIncrementWithoutKeyPath
+putObject: [{"a":1}]
+putObject: [{"a":1},{"b":2}]
+[{"a":1},{"b":2}]
+
+-- Running test case: WI.ObjectStore.prototype.putObject.KeyPathSetOnObjectWithoutAutoIncrement.Sub
+putObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1}]
+putObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":99},"b":2}]
+[{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":99},"b":2}]
+
+-- Running test case: WI.ObjectStore.prototype.putObject.KeyPathMissingOnObjectWithAutoIncrement.Sub
+putObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}}]
+putObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":2}}]
+[{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":2}}]
+
+-- Running test case: WI.ObjectStore.prototype.putObject.KeyPathSetOnObjectWithAutoIncrement.Sub
+putObject: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1}]
+putObject: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":99},"b":2}]
+[{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":99},"b":2}]
+
Copied: trunk/LayoutTests/inspector/unit-tests/objectStore/putObject.html (from rev 243225, trunk/LayoutTests/inspector/unit-tests/objectStore/addObject.html) (0 => 243226)
--- trunk/LayoutTests/inspector/unit-tests/objectStore/putObject.html (rev 0)
+++ trunk/LayoutTests/inspector/unit-tests/objectStore/putObject.html 2019-03-20 19:50:21 UTC (rev 243226)
@@ -0,0 +1,113 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script src=""
+<script>
+function test()
+{
+ let suite = InspectorTest.ObjectStore.createSuite("WI.ObjectStore.prototype.putObject");
+
+ function testPutObject(name, {options, tests}) {
+ InspectorTest.ObjectStore.wrapTest(name, async function() {
+ InspectorTest.ObjectStore.createObjectStore(options);
+
+ for (let {value, expected} of tests)
+ await InspectorTest.ObjectStore.putObject(new InspectorTest.ObjectStore.TestObject(value), expected);
+ });
+ }
+
+ InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype.putObject.NoParameters", async function() {
+ let objectStore = InspectorTest.ObjectStore.createObjectStore();
+
+ await InspectorTest.expectException(async function() {
+ await objectStore.putObject();
+ await objectStore.putObject(new InspectorTest.ObjectStore.TestObject(InspectorTest.ObjectStore.basicObject2));
+ });
+ });
+
+ InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype.putObject.WithoutKeyPathOrAutoIncrement", async function() {
+ let objectStore = InspectorTest.ObjectStore.createObjectStore();
+
+ await InspectorTest.expectException(async function() {
+ await objectStore.putObject(new InspectorTest.ObjectStore.TestObject(InspectorTest.ObjectStore.basicObject1));
+ await objectStore.putObject(new InspectorTest.ObjectStore.TestObject(InspectorTest.ObjectStore.basicObject2));
+ });
+ });
+
+ InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype.putObject.KeyPathMissingOnObjectWithoutAutoIncrement", async function() {
+ const options = {
+ keyPath: "KeyPathMissingOnObjectWithoutAutoIncrement",
+ };
+ let objectStore = InspectorTest.ObjectStore.createObjectStore(options);
+
+ await InspectorTest.expectException(async function() {
+ await objectStore.putObject(new InspectorTest.ObjectStore.TestObject(InspectorTest.ObjectStore.basicObject1));
+ await objectStore.putObject(new InspectorTest.ObjectStore.TestObject(InspectorTest.ObjectStore.basicObject2));
+ });
+ });
+
+ testPutObject("WI.ObjectStore.prototype.putObject.KeyPathSetOnObjectWithoutAutoIncrement", {
+ options: {keyPath: "KeyPathSetOnObjectWithoutAutoIncrement"},
+ tests: [
+ {value: {KeyPathSetOnObjectWithoutAutoIncrement: 42, ...InspectorTest.ObjectStore.basicObject1}, expected: 42},
+ {value: {KeyPathSetOnObjectWithoutAutoIncrement: 99, ...InspectorTest.ObjectStore.basicObject2}, expected: 99},
+ ],
+ });
+
+ testPutObject("WI.ObjectStore.prototype.putObject.KeyPathMissingOnObjectWithAutoIncrement", {
+ options: {keyPath: "KeyPathMissingOnObjectWithAutoIncrement", autoIncrement: true},
+ tests: [
+ {value: InspectorTest.ObjectStore.basicObject1, expected: 1},
+ {value: InspectorTest.ObjectStore.basicObject2, expected: 2},
+ ],
+ });
+
+ testPutObject("WI.ObjectStore.prototype.putObject.KeyPathSetOnObjectWithAutoIncrement", {
+ options: {keyPath: "KeyPathSetOnObjectWithAutoIncrement", autoIncrement: true},
+ tests: [
+ {value: {KeyPathSetOnObjectWithAutoIncrement: 42, ...InspectorTest.ObjectStore.basicObject1}, expected: 42},
+ {value: {KeyPathSetOnObjectWithAutoIncrement: 99, ...InspectorTest.ObjectStore.basicObject2}, expected: 99},
+ ],
+ });
+
+ testPutObject("WI.ObjectStore.prototype.putObject.AutoIncrementWithoutKeyPath", {
+ options: {autoIncrement: true},
+ tests: [
+ {value: InspectorTest.ObjectStore.basicObject1, expected: 1},
+ {value: InspectorTest.ObjectStore.basicObject2, expected: 2},
+ ],
+ });
+
+ testPutObject("WI.ObjectStore.prototype.putObject.KeyPathSetOnObjectWithoutAutoIncrement.Sub", {
+ options: {keyPath: "KeyPathSetOnObjectWithoutAutoIncrement.Sub"},
+ tests: [
+ {value: {KeyPathSetOnObjectWithoutAutoIncrement: {Sub: 42}, ...InspectorTest.ObjectStore.basicObject1}, expected: 42},
+ {value: {KeyPathSetOnObjectWithoutAutoIncrement: {Sub: 99}, ...InspectorTest.ObjectStore.basicObject2}, expected: 99},
+ ],
+ });
+
+ testPutObject("WI.ObjectStore.prototype.putObject.KeyPathMissingOnObjectWithAutoIncrement.Sub", {
+ options: {keyPath: "KeyPathMissingOnObjectWithAutoIncrement.Sub", autoIncrement: true},
+ tests: [
+ {value: InspectorTest.ObjectStore.basicObject1, expected: 1},
+ {value: InspectorTest.ObjectStore.basicObject2, expected: 2},
+ ],
+ });
+
+ testPutObject("WI.ObjectStore.prototype.putObject.KeyPathSetOnObjectWithAutoIncrement.Sub", {
+ options: {keyPath: "KeyPathSetOnObjectWithAutoIncrement.Sub", autoIncrement: true},
+ tests: [
+ {value: {KeyPathSetOnObjectWithAutoIncrement: {Sub: 42}, ...InspectorTest.ObjectStore.basicObject1}, expected: 42},
+ {value: {KeyPathSetOnObjectWithAutoIncrement: {Sub: 99}, ...InspectorTest.ObjectStore.basicObject2}, expected: 99},
+ ],
+ });
+
+ suite.runTestCasesAndFinish();
+}
+</script>
+</head>
+<body _onload_="runTest()">
+ <p>Tests WI.ObjectStore.prototype.putObject.</p>
+</body>
+</html>
Modified: trunk/LayoutTests/inspector/unit-tests/objectStore/resources/objectStore-utilities.js (243225 => 243226)
--- trunk/LayoutTests/inspector/unit-tests/objectStore/resources/objectStore-utilities.js 2019-03-20 19:37:16 UTC (rev 243225)
+++ trunk/LayoutTests/inspector/unit-tests/objectStore/resources/objectStore-utilities.js 2019-03-20 19:50:21 UTC (rev 243226)
@@ -25,22 +25,22 @@
return WI.ObjectStore.__testObjectStore;
};
- InspectorTest.ObjectStore.add = async function(value, expected) {
- let result = await WI.ObjectStore.__testObjectStore.add(value);
+ InspectorTest.ObjectStore.put = async function(value, expected) {
+ let result = await WI.ObjectStore.__testObjectStore.put(value);
InspectorTest.assert(result === expected, `the key of the added item should be ${expected}, but is actually ${result}`);
- await InspectorTest.ObjectStore.logValues("add: ");
+ await InspectorTest.ObjectStore.logValues("put: ");
return result;
};
- InspectorTest.ObjectStore.addObject = async function(object, expected) {
- let result = await WI.ObjectStore.__testObjectStore.addObject(object);
+ InspectorTest.ObjectStore.putObject = async function(object, expected) {
+ let result = await WI.ObjectStore.__testObjectStore.putObject(object);
InspectorTest.assert(result === expected, `the key of the added item should be ${expected}, but is actually ${result}`);
let resolved = WI.ObjectStore.__testObjectStore._resolveKeyPath(object);
InspectorTest.assert(resolved.value === expected, `the resolved keyPath on the object should equal ${expected}, but is actually ${resolved.value}`);
- await InspectorTest.ObjectStore.logValues("addObject: ");
+ await InspectorTest.ObjectStore.logValues("putObject: ");
return result;
};
Modified: trunk/Source/WebInspectorUI/ChangeLog (243225 => 243226)
--- trunk/Source/WebInspectorUI/ChangeLog 2019-03-20 19:37:16 UTC (rev 243225)
+++ trunk/Source/WebInspectorUI/ChangeLog 2019-03-20 19:50:21 UTC (rev 243226)
@@ -1,5 +1,54 @@
2019-03-20 Devin Rousso <[email protected]>
+ Web Inspector: Debugger: move breakpoint storage to use `WI.ObjectStore`
+ https://bugs.webkit.org/show_bug.cgi?id=192719
+ <rdar://problem/46746857>
+
+ Reviewed by Timothy Hatcher.
+
+ * UserInterface/Controllers/DebuggerManager.js:
+ (WI.DebuggerManager):
+ (WI.DebuggerManager.prototype.addBreakpoint):
+ (WI.DebuggerManager.prototype.removeBreakpoint):
+ (WI.DebuggerManager.prototype._debuggerBreakpointOptions):
+ (WI.DebuggerManager.prototype._setBreakpoint.didSetBreakpoint):
+ (WI.DebuggerManager.prototype._setBreakpoint):
+ (WI.DebuggerManager.prototype._breakpointDisabledStateDidChange):
+ (WI.DebuggerManager.prototype._breakpointEditablePropertyDidChange):
+ (WI.DebuggerManager.prototype._saveBreakpoints): Deleted.
+
+ * UserInterface/Models/Breakpoint.js:
+ (WI.Breakpoint.prototype.saveIdentityToCookie):
+ (WI.Breakpoint.prototype.serializeOptions): Added.
+ (WI.Breakpoint.prototype.toJSON): Added.
+ (WI.Breakpoint.prototype.get options): Deleted.
+ (WI.Breakpoint.prototype.get info): Deleted.
+ (WI.Breakpoint.prototype._serializableActions): Deleted.
+ * UserInterface/Models/BreakpointAction.js:
+ (WI.BreakpointAction.prototype.toJSON): Added.
+ (WI.BreakpointAction.prototype.get info): Deleted.
+
+ * UserInterface/Base/ObjectStore.js:
+ (WI.ObjectStore.async reset): Added.
+ (WI.ObjectStore._open):
+ (WI.ObjectStore.prototype.get keyPath): Added.
+ (WI.ObjectStore.prototype.async.getAll):
+ (WI.ObjectStore.prototype.async.put): Added.
+ (WI.ObjectStore.prototype.async.putObject): Added.
+ (WI.ObjectStore.prototype.async.add): Deleted.
+ (WI.ObjectStore.prototype.async.addObject): Deleted.
+ Replace `add` with `put` so that if a key already exists, it is overridden.
+
+ * UserInterface/Controllers/AuditManager.js:
+ (WI.AuditManager.prototype.set editing):
+ (WI.AuditManager.prototype.async processJSON):
+
+ * UserInterface/Controllers/BreakpointPopoverController.js:
+ (WI.BreakpointPopoverController.prototype._popoverActionsAddActionButtonClicked):
+ Inline some `WI.Breakpoint` static values.
+
+2019-03-20 Devin Rousso <[email protected]>
+
Web Inspector: Sources: disabled breakpoints banner should be sticky
https://bugs.webkit.org/show_bug.cgi?id=195104
<rdar://problem/48442259>
Modified: trunk/Source/WebInspectorUI/UserInterface/Base/ObjectStore.js (243225 => 243226)
--- trunk/Source/WebInspectorUI/UserInterface/Base/ObjectStore.js 2019-03-20 19:37:16 UTC (rev 243225)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/ObjectStore.js 2019-03-20 19:50:21 UTC (rev 243226)
@@ -38,6 +38,14 @@
return (!window.InspectorTest || WI.ObjectStore.__testObjectStore) && window.indexedDB;
}
+ static async reset()
+ {
+ if (WI.ObjectStore._database)
+ WI.ObjectStore._database.close();
+
+ await window.indexedDB.deleteDatabase(ObjectStore._databaseName);
+ }
+
static get _databaseName()
{
let inspectionLevel = InspectorFrontendHost ? InspectorFrontendHost.inspectionLevel() : 1;
@@ -59,9 +67,9 @@
WI.ObjectStore._databaseCallbacks = [callback];
- const version = 1; // Increment this for every edit to `WI.objectStores`.
+ const version = 2; // Increment this for every edit to `WI.objectStores`.
- let databaseRequest = indexedDB.open(WI.ObjectStore._databaseName, version);
+ let databaseRequest = window.indexedDB.open(WI.ObjectStore._databaseName, version);
databaseRequest.addEventListener("upgradeneeded", (event) => {
let database = databaseRequest.result;
@@ -97,6 +105,11 @@
// Public
+ get keyPath()
+ {
+ return (this._options || {}).keyPath;
+ }
+
associateObject(object, key, value)
{
if (typeof value === "object")
@@ -109,26 +122,26 @@
async getAll(...args)
{
if (!WI.ObjectStore.supported())
- return undefined;
+ return [];
return this._operation("readonly", (objectStore) => objectStore.getAll(...args));
}
- async add(...args)
+ async put(...args)
{
if (!WI.ObjectStore.supported())
return undefined;
- return this._operation("readwrite", (objectStore) => objectStore.add(...args));
+ return this._operation("readwrite", (objectStore) => objectStore.put(...args));
}
- async addObject(object, ...args)
+ async putObject(object, ...args)
{
if (!WI.ObjectStore.supported())
return undefined;
console.assert(typeof object.toJSON === "function", "ObjectStore cannot store an object without JSON serialization", object.constructor.name);
- let result = await this.add(object.toJSON(WI.ObjectStore.toJSONSymbol), ...args);
+ let result = await this.put(object.toJSON(WI.ObjectStore.toJSONSymbol), ...args);
this.associateObject(object, args[0], result);
return result;
}
@@ -228,4 +241,5 @@
// Be sure to update the `version` above when making changes.
WI.objectStores = {
audits: new WI.ObjectStore("audit-manager-tests", {keyPath: "__id", autoIncrement: true}),
+ breakpoints: new WI.ObjectStore("debugger-breakpoints", {keyPath: "__id"}),
};
Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/AuditManager.js (243225 => 243226)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/AuditManager.js 2019-03-20 19:37:16 UTC (rev 243225)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/AuditManager.js 2019-03-20 19:50:21 UTC (rev 243226)
@@ -116,7 +116,7 @@
if (test.__default)
saveDisabledDefaultTest(test);
else
- WI.objectStores.audits.addObject(test);
+ WI.objectStores.audits.putObject(test);
}
this._disabledDefaultTestsSetting.value = disabledDefaultTests;
@@ -217,7 +217,7 @@
if (object instanceof WI.AuditTestBase) {
this._addTest(object);
- WI.objectStores.audits.addObject(object);
+ WI.objectStores.audits.putObject(object);
} else if (object instanceof WI.AuditTestResultBase)
this._addResult(object);
Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/BreakpointPopoverController.js (243225 => 243226)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/BreakpointPopoverController.js 2019-03-20 19:37:16 UTC (rev 243225)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/BreakpointPopoverController.js 2019-03-20 19:50:21 UTC (rev 243226)
@@ -291,7 +291,7 @@
this._popoverContentElement.classList.add(WI.BreakpointPopoverController.WidePopoverClassName);
this._actionsContainer.removeChildren();
- let newAction = this._breakpoint.createAction(WI.Breakpoint.DefaultBreakpointActionType);
+ let newAction = this._breakpoint.createAction(WI.BreakpointAction.Type.Log);
let newBreakpointActionView = new WI.BreakpointActionView(newAction, this);
this._popoverActionsInsertBreakpointActionView(newBreakpointActionView, -1);
this._popoverOptionsRowElement.classList.remove(WI.BreakpointPopoverController.HiddenStyleClassName);
Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js (243225 => 243226)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js 2019-03-20 19:37:16 UTC (rev 243225)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js 2019-03-20 19:50:21 UTC (rev 243226)
@@ -50,7 +50,6 @@
WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
- this._breakpointsSetting = new WI.Setting("breakpoints", []);
this._breakpointsEnabledSetting = new WI.Setting("breakpoints-enabled", true);
this._allExceptionsBreakpointEnabledSetting = new WI.Setting("break-on-all-exceptions", false);
this._uncaughtExceptionsBreakpointEnabledSetting = new WI.Setting("break-on-uncaught-exceptions", false);
@@ -100,14 +99,26 @@
this._ignoreBreakpointDisplayLocationDidChangeEvent = false;
- // Ensure that all managers learn about restored breakpoints,
- // regardless of their initialization order.
- setTimeout(() => {
+ (async () => {
+ let existingSerializedBreakpoints = WI.Setting.migrateValue("breakpoints");
+ if (existingSerializedBreakpoints) {
+ for (let existingSerializedBreakpoint of existingSerializedBreakpoints)
+ await WI.objectStores.breakpoints.putObject(new WI.Breakpoint(existingSerializedBreakpoint));
+ }
+
+ let serializedBreakpoints = await WI.objectStores.breakpoints.getAll();
+
this._restoringBreakpoints = true;
- for (let cookie of this._breakpointsSetting.value)
- this.addBreakpoint(new WI.Breakpoint(cookie));
+ for (let serializedBreakpoint of serializedBreakpoints) {
+ let breakpoint = new WI.Breakpoint(serializedBreakpoint);
+
+ const key = null;
+ WI.objectStores.breakpoints.associateObject(breakpoint, key, serializedBreakpoint);
+
+ this.addBreakpoint(breakpoint);
+ }
this._restoringBreakpoints = false;
- });
+ })();
}
// Target
@@ -497,7 +508,8 @@
});
}
- this._saveBreakpoints();
+ if (!this._restoringBreakpoints)
+ WI.objectStores.breakpoints.putObject(breakpoint);
this._addProbesForBreakpoint(breakpoint);
@@ -547,7 +559,8 @@
breakpoint.disabled = true;
breakpoint.clearActions();
- this._saveBreakpoints();
+ if (!this._restoringBreakpoints)
+ WI.objectStores.breakpoints.deleteObject(breakpoint);
this._removeProbesForBreakpoint(breakpoint);
@@ -892,22 +905,18 @@
{
const templatePlaceholderRegex = /\$\{.*?\}/;
- let options = breakpoint.options;
- let invalidActions = [];
-
- for (let action of options.actions) {
+ let options = breakpoint.serializeOptions();
+ options.actions = options.actions.filter((action) => {
if (action.type !== WI.BreakpointAction.Type.Log)
- continue;
+ return true;
if (!templatePlaceholderRegex.test(action.data))
- continue;
+ return true;
let lexer = new WI.BreakpointLogMessageLexer;
let tokens = lexer.tokenize(action.data);
- if (!tokens) {
- invalidActions.push(action);
- continue;
- }
+ if (!tokens)
+ return false;
let templateLiteral = tokens.reduce((text, token) => {
if (token.type === WI.BreakpointLogMessageLexer.TokenType.PlainText)
@@ -919,11 +928,8 @@
action.data = "" + templateLiteral + "`)";
action.type = WI.BreakpointAction.Type.Evaluate;
- }
-
- for (let invalidAction of invalidActions)
- options.actions.remove(invalidAction);
-
+ return true;
+ });
return options;
}
@@ -969,10 +975,8 @@
// Convert BreakpointAction types to DebuggerAgent protocol types.
// NOTE: Breakpoint.options returns new objects each time, so it is safe to modify.
let options = this._debuggerBreakpointOptions(breakpoint);
- if (options.actions.length) {
- for (let action of options.actions)
- action.type = this._debuggerBreakpointActionType(action.type);
- }
+ for (let action of options.actions)
+ action.type = this._debuggerBreakpointActionType(action.type);
if (breakpoint.contentIdentifier) {
let targets = specificTarget ? [specificTarget] : WI.targets;
@@ -1046,9 +1050,8 @@
_breakpointDisabledStateDidChange(event)
{
- this._saveBreakpoints();
+ let breakpoint = event.target;
- let breakpoint = event.target;
if (breakpoint === this._allExceptionsBreakpoint) {
if (!breakpoint.disabled && !this.breakpointsDisabledTemporarily)
this.breakpointsEnabled = true;
@@ -1078,6 +1081,9 @@
return;
}
+ if (!this._restoringBreakpoints)
+ WI.objectStores.breakpoints.putObject(breakpoint);
+
if (breakpoint.disabled)
this._removeBreakpoint(breakpoint);
else
@@ -1086,9 +1092,11 @@
_breakpointEditablePropertyDidChange(event)
{
- this._saveBreakpoints();
+ let breakpoint = event.target;
- let breakpoint = event.target;
+ if (!this._restoringBreakpoints)
+ WI.objectStores.breakpoints.putObject(breakpoint);
+
if (breakpoint.disabled)
return;
@@ -1249,16 +1257,6 @@
}
}
- _saveBreakpoints()
- {
- if (this._restoringBreakpoints)
- return;
-
- let breakpointsToSave = this._breakpoints.filter((breakpoint) => !!breakpoint.contentIdentifier);
- let serializedBreakpoints = breakpointsToSave.map((breakpoint) => breakpoint.info);
- this._breakpointsSetting.value = serializedBreakpoints;
- }
-
_associateBreakpointsWithSourceCode(breakpoints, sourceCode)
{
this._ignoreBreakpointDisplayLocationDidChangeEvent = true;
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/Breakpoint.js (243225 => 243226)
--- trunk/Source/WebInspectorUI/UserInterface/Models/Breakpoint.js 2019-03-20 19:37:16 UTC (rev 243225)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/Breakpoint.js 2019-03-20 19:50:21 UTC (rev 243226)
@@ -190,31 +190,6 @@
return this._actions;
}
- get options()
- {
- return {
- condition: this._condition,
- ignoreCount: this._ignoreCount,
- actions: this._serializableActions(),
- autoContinue: this._autoContinue
- };
- }
-
- get info()
- {
- // The id, scriptIdentifier, target, and resolved state are tied to the current session, so don't include them for serialization.
- return {
- contentIdentifier: this._contentIdentifier,
- lineNumber: this._sourceCodeLocation.lineNumber,
- columnNumber: this._sourceCodeLocation.columnNumber,
- disabled: this._disabled,
- condition: this._condition,
- ignoreCount: this._ignoreCount,
- actions: this._serializableActions(),
- autoContinue: this._autoContinue
- };
- }
-
get probeActions()
{
return this._actions.filter(function(action) {
@@ -307,11 +282,36 @@
saveIdentityToCookie(cookie)
{
- cookie[WI.Breakpoint.ContentIdentifierCookieKey] = this.contentIdentifier;
- cookie[WI.Breakpoint.LineNumberCookieKey] = this.sourceCodeLocation.lineNumber;
- cookie[WI.Breakpoint.ColumnNumberCookieKey] = this.sourceCodeLocation.columnNumber;
+ cookie["breakpoint-content-identifier"] = this.contentIdentifier;
+ cookie["breakpoint-line-number"] = this.sourceCodeLocation.lineNumber;
+ cookie["breakpoint-column-number"] = this.sourceCodeLocation.columnNumber;
}
+ serializeOptions()
+ {
+ return {
+ condition: this._condition,
+ ignoreCount: this._ignoreCount,
+ actions: this._actions.map((action) => action.toJSON()),
+ autoContinue: this._autoContinue,
+ };
+ }
+
+ toJSON(key)
+ {
+ // The id, scriptIdentifier, target, and resolved state are tied to the current session, so don't include them for serialization.
+ let json = {
+ contentIdentifier: this._contentIdentifier,
+ lineNumber: this._sourceCodeLocation.lineNumber,
+ columnNumber: this._sourceCodeLocation.columnNumber,
+ disabled: this._disabled,
+ ...this.serializeOptions(),
+ };
+ if (key === WI.ObjectStore.toJSONSymbol)
+ json[WI.objectStores.breakpoints.keyPath] = this._contentIdentifier + ":" + this._sourceCodeLocation.lineNumber + ":" + this._sourceCodeLocation.columnNumber;
+ return json;
+ }
+
// Protected (Called by BreakpointAction)
breakpointActionDidChange(action)
@@ -326,14 +326,6 @@
// Private
- _serializableActions()
- {
- var actions = [];
- for (var i = 0; i < this._actions.length; ++i)
- actions.push(this._actions[i].info);
- return actions;
- }
-
_sourceCodeLocationLocationChanged(event)
{
this.dispatchEventToListeners(WI.Breakpoint.Event.LocationDidChange, event.data);
@@ -345,12 +337,7 @@
}
};
-WI.Breakpoint.DefaultBreakpointActionType = WI.BreakpointAction.Type.Log;
-
WI.Breakpoint.TypeIdentifier = "breakpoint";
-WI.Breakpoint.ContentIdentifierCookieKey = "breakpoint-content-identifier";
-WI.Breakpoint.LineNumberCookieKey = "breakpoint-line-number";
-WI.Breakpoint.ColumnNumberCookieKey = "breakpoint-column-number";
WI.Breakpoint.Event = {
DisabledStateDidChange: "breakpoint-disabled-state-did-change",
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/BreakpointAction.js (243225 => 243226)
--- trunk/Source/WebInspectorUI/UserInterface/Models/BreakpointAction.js 2019-03-20 19:37:16 UTC (rev 243225)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/BreakpointAction.js 2019-03-20 19:50:21 UTC (rev 243226)
@@ -66,12 +66,15 @@
this._breakpoint.breakpointActionDidChange(this);
}
- get info()
+ toJSON()
{
- var obj = {type: this._type, id: this._id};
+ let json = {
+ type: this._type,
+ id: this._id,
+ };
if (this._data)
- obj.data = ""
- return obj;
+ json.data = ""
+ return json;
}
};