Web Inspector: Debugger: move breakpoint storage to use `WI.ObjectStore`
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Mar 2019 19:50:21 +0000 (19:50 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Mar 2019 19:50:21 +0000 (19:50 +0000)
https://bugs.webkit.org/show_bug.cgi?id=192719
<rdar://problem/46746857>

Reviewed by Timothy Hatcher.

Source/WebInspectorUI:

* 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.

LayoutTests:

* 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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243226 268f45cc-cd09-0410-ab3c-d52691b4dbfc

19 files changed:
LayoutTests/ChangeLog
LayoutTests/inspector/unit-tests/objectStore/add-expected.txt [deleted file]
LayoutTests/inspector/unit-tests/objectStore/clear.html
LayoutTests/inspector/unit-tests/objectStore/delete-expected.txt
LayoutTests/inspector/unit-tests/objectStore/delete.html
LayoutTests/inspector/unit-tests/objectStore/deleteObject-expected.txt
LayoutTests/inspector/unit-tests/objectStore/deleteObject.html
LayoutTests/inspector/unit-tests/objectStore/put-expected.txt [new file with mode: 0644]
LayoutTests/inspector/unit-tests/objectStore/put.html [moved from LayoutTests/inspector/unit-tests/objectStore/add.html with 76% similarity]
LayoutTests/inspector/unit-tests/objectStore/putObject-expected.txt [moved from LayoutTests/inspector/unit-tests/objectStore/addObject-expected.txt with 54% similarity]
LayoutTests/inspector/unit-tests/objectStore/putObject.html [moved from LayoutTests/inspector/unit-tests/objectStore/addObject.html with 78% similarity]
LayoutTests/inspector/unit-tests/objectStore/resources/objectStore-utilities.js
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Base/ObjectStore.js
Source/WebInspectorUI/UserInterface/Controllers/AuditManager.js
Source/WebInspectorUI/UserInterface/Controllers/BreakpointPopoverController.js
Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js
Source/WebInspectorUI/UserInterface/Models/Breakpoint.js
Source/WebInspectorUI/UserInterface/Models/BreakpointAction.js

index 167694f..f0ab74e 100644 (file)
@@ -1,5 +1,25 @@
 2019-03-20  Devin Rousso  <drousso@apple.com>
 
+        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  <drousso@apple.com>
+
         Web Inspector: Database: lazily create the agent
         https://bugs.webkit.org/show_bug.cgi?id=195587
         <rdar://problem/48791735>
diff --git a/LayoutTests/inspector/unit-tests/objectStore/add-expected.txt b/LayoutTests/inspector/unit-tests/objectStore/add-expected.txt
deleted file mode 100644 (file)
index 1426e0c..0000000
+++ /dev/null
@@ -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}]
-
index d9e714e..4120281 100644 (file)
@@ -13,7 +13,7 @@ function test()
             let objectStore = InspectorTest.ObjectStore.createObjectStore({autoIncrement: true});
 
             for (let object of objects)
-                await objectStore.add(object);
+                await objectStore.put(object);
 
             await InspectorTest.ObjectStore.logValues();
 
index 4483e5c..94e8f06 100644 (file)
@@ -3,47 +3,47 @@ Tests WI.ObjectStore.prototype.delete.
 
 == 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 @@ DataError: Failed to store record in an IDBObjectStore: Evaluating the object st
 []
 
 -- 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: []
 []
index 5d59691..e62ac16 100644 (file)
@@ -14,7 +14,7 @@ function test()
 
             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 @@ function test()
 
         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 @@ function test()
         };
         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 @@ function test()
         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 @@ function test()
         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);
         });
     });
 
index d9d9ad9..586fd05 100644 (file)
@@ -3,13 +3,13 @@ Tests WI.ObjectStore.prototype.deleteObject.
 
 == 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 @@ DataError: Failed to store record in an IDBObjectStore: Evaluating the object st
 []
 
 -- 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: []
 []
index 8235bb2..d9707fe 100644 (file)
@@ -15,7 +15,7 @@ function test()
             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 @@ function test()
 
         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 @@ function test()
         };
         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 @@ function test()
         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 @@ function test()
         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);
         });
     });
 
diff --git a/LayoutTests/inspector/unit-tests/objectStore/put-expected.txt b/LayoutTests/inspector/unit-tests/objectStore/put-expected.txt
new file mode 100644 (file)
index 0000000..b348d90
--- /dev/null
@@ -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}]
+
@@ -6,27 +6,27 @@
 <script>
 function test()
 {
-    let suite = InspectorTest.ObjectStore.createSuite("WI.ObjectStore.prototype.add");
+    let suite = InspectorTest.ObjectStore.createSuite("WI.ObjectStore.prototype.put");
 
-    function testAdd(name, {options, tests}) {
+    function testPut(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);
+                await InspectorTest.ObjectStore.put(value, expected);
         });
     }
 
-    InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype.add.NoParameters", async function() {
+    InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype.put.NoParameters", async function() {
         let objectStore = InspectorTest.ObjectStore.createObjectStore();
 
         await InspectorTest.expectException(async function() {
-            await objectStore.add();
-            await objectStore.add(InspectorTest.ObjectStore.basicObject2);
+            await objectStore.put();
+            await objectStore.put(InspectorTest.ObjectStore.basicObject2);
         });
     });
 
-    testAdd("WI.ObjectStore.prototype.add.Boolean", {
+    testPut("WI.ObjectStore.prototype.put.Boolean", {
         options: {autoIncrement: true},
         tests: [
             {value: false, expected: 1},
@@ -34,7 +34,7 @@ function test()
         ],
     });
 
-    testAdd("WI.ObjectStore.prototype.add.Number", {
+    testPut("WI.ObjectStore.prototype.put.Number", {
         options: {autoIncrement: true},
         tests: [
             {value: 11, expected: 1},
@@ -42,7 +42,7 @@ function test()
         ],
     });
 
-    testAdd("WI.ObjectStore.prototype.add.String", {
+    testPut("WI.ObjectStore.prototype.put.String", {
         options: {autoIncrement: true},
         tests: [
             {value: "foo", expected: 1},
@@ -50,7 +50,7 @@ function test()
         ],
     });
 
-    testAdd("WI.ObjectStore.prototype.add.Array", {
+    testPut("WI.ObjectStore.prototype.put.Array", {
         options: {autoIncrement: true},
         tests: [
             {value: [11], expected: 1},
@@ -58,35 +58,35 @@ function test()
         ],
     });
 
-    testAdd("WI.ObjectStore.prototype.add.Null", {
+    testPut("WI.ObjectStore.prototype.put.Null", {
         options: {autoIncrement: true},
         tests: [
             {value: null, expected: 1},
         ],
     });
 
-    InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype.add.Object.WithoutKeyPathOrAutoIncrement", async function() {
+    InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype.put.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);
+            await objectStore.put(InspectorTest.ObjectStore.basicObject1);
+            await objectStore.put(InspectorTest.ObjectStore.basicObject2);
         });
     });
 
-    InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype.add.Object.KeyPathMissingOnObjectWithoutAutoIncrement", async function() {
+    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.add(InspectorTest.ObjectStore.basicObject1);
-            await objectStore.add(InspectorTest.ObjectStore.basicObject2);
+            await objectStore.put(InspectorTest.ObjectStore.basicObject1);
+            await objectStore.put(InspectorTest.ObjectStore.basicObject2);
         });
     });
 
-    testAdd("WI.ObjectStore.prototype.add.Object.KeyPathSetOnObjectWithoutAutoIncrement", {
+    testPut("WI.ObjectStore.prototype.put.Object.KeyPathSetOnObjectWithoutAutoIncrement", {
         options: {keyPath: "KeyPathSetOnObjectWithoutAutoIncrement"},
         tests: [
             {value: {KeyPathSetOnObjectWithoutAutoIncrement: 42, ...InspectorTest.ObjectStore.basicObject1}, expected: 42},
@@ -94,7 +94,7 @@ function test()
         ],
     });
 
-    testAdd("WI.ObjectStore.prototype.add.Object.KeyPathMissingOnObjectWithAutoIncrement", {
+    testPut("WI.ObjectStore.prototype.put.Object.KeyPathMissingOnObjectWithAutoIncrement", {
         options: {keyPath: "KeyPathMissingOnObjectWithAutoIncrement", autoIncrement: true},
         tests: [
             {value: InspectorTest.ObjectStore.basicObject1, expected: 1},
@@ -102,7 +102,7 @@ function test()
         ],
     });
 
-    testAdd("WI.ObjectStore.prototype.add.Object.KeyPathSetOnObjectWithAutoIncrement", {
+    testPut("WI.ObjectStore.prototype.put.Object.KeyPathSetOnObjectWithAutoIncrement", {
         options: {keyPath: "KeyPathSetOnObjectWithAutoIncrement", autoIncrement: true},
         tests: [
             {value: {KeyPathSetOnObjectWithAutoIncrement: 42, ...InspectorTest.ObjectStore.basicObject1}, expected: 42},
@@ -110,7 +110,7 @@ function test()
         ],
     });
 
-    testAdd("WI.ObjectStore.prototype.add.Object.AutoIncrementWithoutKeyPath", {
+    testPut("WI.ObjectStore.prototype.put.Object.AutoIncrementWithoutKeyPath", {
         options: {autoIncrement: true},
         tests: [
             {value: InspectorTest.ObjectStore.basicObject1, expected: 1},
@@ -118,7 +118,7 @@ function test()
         ],
     });
 
-    testAdd("WI.ObjectStore.prototype.add.Object.KeyPathSetOnObjectWithoutAutoIncrement.Sub", {
+    testPut("WI.ObjectStore.prototype.put.Object.KeyPathSetOnObjectWithoutAutoIncrement.Sub", {
         options: {keyPath: "KeyPathSetOnObjectWithoutAutoIncrement.Sub"},
         tests: [
             {value: {KeyPathSetOnObjectWithoutAutoIncrement: {Sub: 42}, ...InspectorTest.ObjectStore.basicObject1}, expected: 42},
@@ -126,7 +126,7 @@ function test()
         ],
     });
 
-    testAdd("WI.ObjectStore.prototype.add.Object.KeyPathMissingOnObjectWithAutoIncrement.Sub", {
+    testPut("WI.ObjectStore.prototype.put.Object.KeyPathMissingOnObjectWithAutoIncrement.Sub", {
         options: {keyPath: "KeyPathMissingOnObjectWithAutoIncrement.Sub", autoIncrement: true},
         tests: [
             {value: InspectorTest.ObjectStore.basicObject1, expected: 1},
@@ -134,7 +134,7 @@ function test()
         ],
     });
 
-    testAdd("WI.ObjectStore.prototype.add.Object.KeyPathSetOnObjectWithAutoIncrement.Sub", {
+    testPut("WI.ObjectStore.prototype.put.Object.KeyPathSetOnObjectWithAutoIncrement.Sub", {
         options: {keyPath: "KeyPathSetOnObjectWithAutoIncrement.Sub", autoIncrement: true},
         tests: [
             {value: {KeyPathSetOnObjectWithAutoIncrement: {Sub: 42}, ...InspectorTest.ObjectStore.basicObject1}, expected: 42},
@@ -147,6 +147,6 @@ function test()
 </script>
 </head>
 <body onload="runTest()">
-    <p>Tests WI.ObjectStore.prototype.add.</p>
+    <p>Tests WI.ObjectStore.prototype.put.</p>
 </body>
 </html>
@@ -1,54 +1,54 @@
-Tests WI.ObjectStore.prototype.addObject.
+Tests WI.ObjectStore.prototype.putObject.
 
 
-== Running test suite: WI.ObjectStore.prototype.addObject
--- Running test case: WI.ObjectStore.prototype.addObject.NoParameters
+== 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.addObject.WithoutKeyPathOrAutoIncrement
+-- 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.addObject.KeyPathMissingOnObjectWithoutAutoIncrement
+-- 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.addObject.KeyPathSetOnObjectWithoutAutoIncrement
-addObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1}]
-addObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":99,"b":2}]
+-- 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.addObject.KeyPathMissingOnObjectWithAutoIncrement
-addObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1}]
-addObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":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.addObject.KeyPathSetOnObjectWithAutoIncrement
-addObject: [{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1}]
-addObject: [{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithAutoIncrement":99,"b":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.addObject.AutoIncrementWithoutKeyPath
-addObject: [{"a":1}]
-addObject: [{"a":1},{"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.addObject.KeyPathSetOnObjectWithoutAutoIncrement.Sub
-addObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1}]
-addObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":99},"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.addObject.KeyPathMissingOnObjectWithAutoIncrement.Sub
-addObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}}]
-addObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":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.addObject.KeyPathSetOnObjectWithAutoIncrement.Sub
-addObject: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1}]
-addObject: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":99},"b":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}]
 
@@ -6,48 +6,48 @@
 <script>
 function test()
 {
-    let suite = InspectorTest.ObjectStore.createSuite("WI.ObjectStore.prototype.addObject");
+    let suite = InspectorTest.ObjectStore.createSuite("WI.ObjectStore.prototype.putObject");
 
-    function testAddObject(name, {options, tests}) {
+    function testPutObject(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);
+                await InspectorTest.ObjectStore.putObject(new InspectorTest.ObjectStore.TestObject(value), expected);
         });
     }
 
-    InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype.addObject.NoParameters", async function() {
+    InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype.putObject.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));
+            await objectStore.putObject();
+            await objectStore.putObject(new InspectorTest.ObjectStore.TestObject(InspectorTest.ObjectStore.basicObject2));
         });
     });
 
-    InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype.addObject.WithoutKeyPathOrAutoIncrement", async function() {
+    InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype.putObject.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));
+            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.addObject.KeyPathMissingOnObjectWithoutAutoIncrement", async function() {
+    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.addObject(new InspectorTest.ObjectStore.TestObject(InspectorTest.ObjectStore.basicObject1));
-            await objectStore.addObject(new InspectorTest.ObjectStore.TestObject(InspectorTest.ObjectStore.basicObject2));
+            await objectStore.putObject(new InspectorTest.ObjectStore.TestObject(InspectorTest.ObjectStore.basicObject1));
+            await objectStore.putObject(new InspectorTest.ObjectStore.TestObject(InspectorTest.ObjectStore.basicObject2));
         });
     });
 
-    testAddObject("WI.ObjectStore.prototype.addObject.KeyPathSetOnObjectWithoutAutoIncrement", {
+    testPutObject("WI.ObjectStore.prototype.putObject.KeyPathSetOnObjectWithoutAutoIncrement", {
         options: {keyPath: "KeyPathSetOnObjectWithoutAutoIncrement"},
         tests: [
             {value: {KeyPathSetOnObjectWithoutAutoIncrement: 42, ...InspectorTest.ObjectStore.basicObject1}, expected: 42},
@@ -55,7 +55,7 @@ function test()
         ],
     });
 
-    testAddObject("WI.ObjectStore.prototype.addObject.KeyPathMissingOnObjectWithAutoIncrement", {
+    testPutObject("WI.ObjectStore.prototype.putObject.KeyPathMissingOnObjectWithAutoIncrement", {
         options: {keyPath: "KeyPathMissingOnObjectWithAutoIncrement", autoIncrement: true},
         tests: [
             {value: InspectorTest.ObjectStore.basicObject1, expected: 1},
@@ -63,7 +63,7 @@ function test()
         ],
     });
 
-    testAddObject("WI.ObjectStore.prototype.addObject.KeyPathSetOnObjectWithAutoIncrement", {
+    testPutObject("WI.ObjectStore.prototype.putObject.KeyPathSetOnObjectWithAutoIncrement", {
         options: {keyPath: "KeyPathSetOnObjectWithAutoIncrement", autoIncrement: true},
         tests: [
             {value: {KeyPathSetOnObjectWithAutoIncrement: 42, ...InspectorTest.ObjectStore.basicObject1}, expected: 42},
@@ -71,7 +71,7 @@ function test()
         ],
     });
 
-    testAddObject("WI.ObjectStore.prototype.addObject.AutoIncrementWithoutKeyPath", {
+    testPutObject("WI.ObjectStore.prototype.putObject.AutoIncrementWithoutKeyPath", {
         options: {autoIncrement: true},
         tests: [
             {value: InspectorTest.ObjectStore.basicObject1, expected: 1},
@@ -79,7 +79,7 @@ function test()
         ],
     });
 
-    testAddObject("WI.ObjectStore.prototype.addObject.KeyPathSetOnObjectWithoutAutoIncrement.Sub", {
+    testPutObject("WI.ObjectStore.prototype.putObject.KeyPathSetOnObjectWithoutAutoIncrement.Sub", {
         options: {keyPath: "KeyPathSetOnObjectWithoutAutoIncrement.Sub"},
         tests: [
             {value: {KeyPathSetOnObjectWithoutAutoIncrement: {Sub: 42}, ...InspectorTest.ObjectStore.basicObject1}, expected: 42},
@@ -87,7 +87,7 @@ function test()
         ],
     });
 
-    testAddObject("WI.ObjectStore.prototype.addObject.KeyPathMissingOnObjectWithAutoIncrement.Sub", {
+    testPutObject("WI.ObjectStore.prototype.putObject.KeyPathMissingOnObjectWithAutoIncrement.Sub", {
         options: {keyPath: "KeyPathMissingOnObjectWithAutoIncrement.Sub", autoIncrement: true},
         tests: [
             {value: InspectorTest.ObjectStore.basicObject1, expected: 1},
@@ -95,7 +95,7 @@ function test()
         ],
     });
 
-    testAddObject("WI.ObjectStore.prototype.addObject.KeyPathSetOnObjectWithAutoIncrement.Sub", {
+    testPutObject("WI.ObjectStore.prototype.putObject.KeyPathSetOnObjectWithAutoIncrement.Sub", {
         options: {keyPath: "KeyPathSetOnObjectWithAutoIncrement.Sub", autoIncrement: true},
         tests: [
             {value: {KeyPathSetOnObjectWithAutoIncrement: {Sub: 42}, ...InspectorTest.ObjectStore.basicObject1}, expected: 42},
@@ -108,6 +108,6 @@ function test()
 </script>
 </head>
 <body onload="runTest()">
-    <p>Tests WI.ObjectStore.prototype.addObject.</p>
+    <p>Tests WI.ObjectStore.prototype.putObject.</p>
 </body>
 </html>
index adb4f6b..69c2163 100644 (file)
@@ -25,22 +25,22 @@ TestPage.registerInitializer(() => {
         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;
     };
 
index 52551b8..e4cfd1e 100644 (file)
@@ -1,5 +1,54 @@
 2019-03-20  Devin Rousso  <drousso@apple.com>
 
+        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  <drousso@apple.com>
+
         Web Inspector: Sources: disabled breakpoints banner should be sticky
         https://bugs.webkit.org/show_bug.cgi?id=195104
         <rdar://problem/48442259>
index c03ed8d..cee44bb 100644 (file)
@@ -38,6 +38,14 @@ WI.ObjectStore = class ObjectStore
         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 = class ObjectStore
 
         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 @@ WI.ObjectStore = class ObjectStore
 
     // Public
 
+    get keyPath()
+    {
+        return (this._options || {}).keyPath;
+    }
+
     associateObject(object, key, value)
     {
         if (typeof value === "object")
@@ -109,26 +122,26 @@ WI.ObjectStore = class ObjectStore
     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 @@ WI.ObjectStore.toJSONSymbol = Symbol("ObjectStore-toJSON");
 // 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"}),
 };
index b8e95b6..1f49053 100644 (file)
@@ -116,7 +116,7 @@ WI.AuditManager = class AuditManager extends WI.Object
                 if (test.__default)
                     saveDisabledDefaultTest(test);
                 else
-                    WI.objectStores.audits.addObject(test);
+                    WI.objectStores.audits.putObject(test);
             }
 
             this._disabledDefaultTestsSetting.value = disabledDefaultTests;
@@ -217,7 +217,7 @@ WI.AuditManager = class AuditManager extends WI.Object
 
         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);
 
index 5a42b26..0230507 100644 (file)
@@ -291,7 +291,7 @@ WI.BreakpointPopoverController = class BreakpointPopoverController extends WI.Ob
         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);
index 6c16ba9..805858f 100644 (file)
@@ -50,7 +50,6 @@ WI.DebuggerManager = class DebuggerManager extends WI.Object
 
         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 @@ WI.DebuggerManager = class DebuggerManager extends WI.Object
 
         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 @@ WI.DebuggerManager = class DebuggerManager extends WI.Object
             });
         }
 
-        this._saveBreakpoints();
+        if (!this._restoringBreakpoints)
+            WI.objectStores.breakpoints.putObject(breakpoint);
 
         this._addProbesForBreakpoint(breakpoint);
 
@@ -547,7 +559,8 @@ WI.DebuggerManager = class DebuggerManager extends WI.Object
         breakpoint.disabled = true;
         breakpoint.clearActions();
 
-        this._saveBreakpoints();
+        if (!this._restoringBreakpoints)
+            WI.objectStores.breakpoints.deleteObject(breakpoint);
 
         this._removeProbesForBreakpoint(breakpoint);
 
@@ -892,22 +905,18 @@ WI.DebuggerManager = class DebuggerManager extends WI.Object
     {
         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 @@ WI.DebuggerManager = class DebuggerManager extends WI.Object
 
             action.data = "console.log(`" + templateLiteral + "`)";
             action.type = WI.BreakpointAction.Type.Evaluate;
-        }
-
-        for (let invalidAction of invalidActions)
-            options.actions.remove(invalidAction);
-
+            return true;
+        });
         return options;
     }
 
@@ -969,10 +975,8 @@ WI.DebuggerManager = class DebuggerManager extends WI.Object
         // 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 @@ WI.DebuggerManager = class DebuggerManager extends WI.Object
 
     _breakpointDisabledStateDidChange(event)
     {
-        this._saveBreakpoints();
-
         let breakpoint = event.target;
+
         if (breakpoint === this._allExceptionsBreakpoint) {
             if (!breakpoint.disabled && !this.breakpointsDisabledTemporarily)
                 this.breakpointsEnabled = true;
@@ -1078,6 +1081,9 @@ WI.DebuggerManager = class DebuggerManager extends WI.Object
             return;
         }
 
+        if (!this._restoringBreakpoints)
+            WI.objectStores.breakpoints.putObject(breakpoint);
+
         if (breakpoint.disabled)
             this._removeBreakpoint(breakpoint);
         else
@@ -1086,9 +1092,11 @@ WI.DebuggerManager = class DebuggerManager extends WI.Object
 
     _breakpointEditablePropertyDidChange(event)
     {
-        this._saveBreakpoints();
-
         let breakpoint = event.target;
+
+        if (!this._restoringBreakpoints)
+            WI.objectStores.breakpoints.putObject(breakpoint);
+
         if (breakpoint.disabled)
             return;
 
@@ -1249,16 +1257,6 @@ WI.DebuggerManager = class DebuggerManager extends WI.Object
         }
     }
 
-    _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;
index 90b98cc..5c879b4 100644 (file)
@@ -190,31 +190,6 @@ WI.Breakpoint = class Breakpoint extends WI.Object
         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,9 +282,34 @@ WI.Breakpoint = class Breakpoint extends WI.Object
 
     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)
@@ -326,14 +326,6 @@ WI.Breakpoint = class Breakpoint extends WI.Object
 
     // 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 = class Breakpoint extends WI.Object
     }
 };
 
-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",
index b854741..2034615 100644 (file)
@@ -66,12 +66,15 @@ WI.BreakpointAction = class BreakpointAction
         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 = this._data;
-        return obj;
+            json.data = this._data;
+        return json;
     }
 };