Changeset 243226 in webkit
- Timestamp:
- Mar 20, 2019, 12:50:21 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 1 deleted
- 14 edited
- 3 moved
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/inspector/unit-tests/objectStore/add-expected.txt (deleted)
-
LayoutTests/inspector/unit-tests/objectStore/clear.html (modified) (1 diff)
-
LayoutTests/inspector/unit-tests/objectStore/delete-expected.txt (modified) (14 diffs)
-
LayoutTests/inspector/unit-tests/objectStore/delete.html (modified) (5 diffs)
-
LayoutTests/inspector/unit-tests/objectStore/deleteObject-expected.txt (modified) (9 diffs)
-
LayoutTests/inspector/unit-tests/objectStore/deleteObject.html (modified) (5 diffs)
-
LayoutTests/inspector/unit-tests/objectStore/put-expected.txt (added)
-
LayoutTests/inspector/unit-tests/objectStore/put.html (moved) (moved from trunk/LayoutTests/inspector/unit-tests/objectStore/add.html ) (14 diffs)
-
LayoutTests/inspector/unit-tests/objectStore/putObject-expected.txt (moved) (moved from trunk/LayoutTests/inspector/unit-tests/objectStore/addObject-expected.txt ) (1 diff)
-
LayoutTests/inspector/unit-tests/objectStore/putObject.html (moved) (moved from trunk/LayoutTests/inspector/unit-tests/objectStore/addObject.html ) (9 diffs)
-
LayoutTests/inspector/unit-tests/objectStore/resources/objectStore-utilities.js (modified) (2 diffs)
-
Source/WebInspectorUI/ChangeLog (modified) (1 diff)
-
Source/WebInspectorUI/UserInterface/Base/ObjectStore.js (modified) (6 diffs)
-
Source/WebInspectorUI/UserInterface/Controllers/AuditManager.js (modified) (2 diffs)
-
Source/WebInspectorUI/UserInterface/Controllers/BreakpointPopoverController.js (modified) (1 diff)
-
Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js (modified) (11 diffs)
-
Source/WebInspectorUI/UserInterface/Models/Breakpoint.js (modified) (4 diffs)
-
Source/WebInspectorUI/UserInterface/Models/BreakpointAction.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r243219 r243226 1 2019-03-20 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: Debugger: move breakpoint storage to use `WI.ObjectStore` 4 https://bugs.webkit.org/show_bug.cgi?id=192719 5 <rdar://problem/46746857> 6 7 Reviewed by Timothy Hatcher. 8 9 * inspector/unit-tests/objectStore/resources/objectStore-utilities.js: 10 * inspector/unit-tests/objectStore/put.html: Renamed from LayoutTests/inspector/unit-tests/objectStore/add.html. 11 * inspector/unit-tests/objectStore/put-expected.txt: Renamed from LayoutTests/inspector/unit-tests/objectStore/add-expected.txt. 12 * inspector/unit-tests/objectStore/putObject.html: Renamed from LayoutTests/inspector/unit-tests/objectStore/addObject.html. 13 * inspector/unit-tests/objectStore/putObject-expected.txt: Renamed from LayoutTests/inspector/unit-tests/objectStore/addObject-expected.txt. 14 * inspector/unit-tests/objectStore/delete-expected.txt: 15 * inspector/unit-tests/objectStore/delete.html: 16 * inspector/unit-tests/objectStore/deleteObject-expected.txt: 17 * inspector/unit-tests/objectStore/deleteObject.html: 18 * inspector/unit-tests/objectStore/clear.html: 19 Replace `add` with `put` so that if a key already exists, it is overridden. 20 1 21 2019-03-20 Devin Rousso <drousso@apple.com> 2 22 -
trunk/LayoutTests/inspector/unit-tests/objectStore/clear.html
r239858 r243226 14 14 15 15 for (let object of objects) 16 await objectStore. add(object);16 await objectStore.put(object); 17 17 18 18 await InspectorTest.ObjectStore.logValues(); -
trunk/LayoutTests/inspector/unit-tests/objectStore/delete-expected.txt
r237665 r243226 4 4 == Running test suite: WI.ObjectStore.prototype.delete 5 5 -- Running test case: WI.ObjectStore.prototype.delete.NoParameters 6 add: [{"b":2}]6 put: [{"b":2}] 7 7 PASS: Should produce an exception. 8 8 TypeError: Not enough arguments … … 10 10 11 11 -- Running test case: WI.ObjectStore.prototype.delete.MissingObject 12 add: [{"b":2}]12 put: [{"b":2}] 13 13 PASS: Should produce an exception. 14 14 DataError: Failed to execute 'delete' on 'IDBObjectStore': The parameter is not a valid key. … … 16 16 17 17 -- Running test case: WI.ObjectStore.prototype.delete.Boolean 18 add: [false]19 add: [false,true]18 put: [false] 19 put: [false,true] 20 20 delete: [true] 21 21 delete: [] … … 23 23 24 24 -- Running test case: WI.ObjectStore.prototype.delete.Number 25 add: [11]26 add: [11,22]25 put: [11] 26 put: [11,22] 27 27 delete: [22] 28 28 delete: [] … … 30 30 31 31 -- Running test case: WI.ObjectStore.prototype.delete.String 32 add: ["foo"]33 add: ["foo","bar"]32 put: ["foo"] 33 put: ["foo","bar"] 34 34 delete: ["bar"] 35 35 delete: [] … … 37 37 38 38 -- Running test case: WI.ObjectStore.prototype.delete.Array 39 add: [[11]]40 add: [[11],[22]]39 put: [[11]] 40 put: [[11],[22]] 41 41 delete: [[22]] 42 42 delete: [] … … 44 44 45 45 -- Running test case: WI.ObjectStore.prototype.delete.Null 46 add: [null]46 put: [null] 47 47 delete: [] 48 48 [] … … 59 59 60 60 -- Running test case: WI.ObjectStore.prototype.delete.Object.KeyPathSetOnObjectWithoutAutoIncrement 61 add: [{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1}]62 add: [{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":99,"b":2}]61 put: [{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1}] 62 put: [{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":99,"b":2}] 63 63 delete: [{"KeyPathSetOnObjectWithoutAutoIncrement":99,"b":2}] 64 64 delete: [] … … 66 66 67 67 -- Running test case: WI.ObjectStore.prototype.delete.Object.KeyPathMissingOnObjectWithAutoIncrement 68 add: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1}]69 add: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":2}]68 put: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1}] 69 put: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":2}] 70 70 delete: [{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":2}] 71 71 delete: [] … … 73 73 74 74 -- Running test case: WI.ObjectStore.prototype.delete.Object.KeyPathSetOnObjectWithAutoIncrement 75 add: [{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1}]76 add: [{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithAutoIncrement":99,"b":2}]75 put: [{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1}] 76 put: [{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithAutoIncrement":99,"b":2}] 77 77 delete: [{"KeyPathSetOnObjectWithAutoIncrement":99,"b":2}] 78 78 delete: [] … … 80 80 81 81 -- Running test case: WI.ObjectStore.prototype.delete.Object.AutoIncrementWithoutKeyPath 82 add: [{"a":1}]83 add: [{"a":1},{"b":2}]82 put: [{"a":1}] 83 put: [{"a":1},{"b":2}] 84 84 delete: [{"b":2}] 85 85 delete: [] … … 87 87 88 88 -- Running test case: WI.ObjectStore.prototype.delete.Object.KeyPathSetOnObjectWithoutAutoIncrement.Sub 89 add: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1}]90 add: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":99},"b":2}]89 put: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1}] 90 put: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":99},"b":2}] 91 91 delete: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":99},"b":2}] 92 92 delete: [] … … 94 94 95 95 -- Running test case: WI.ObjectStore.prototype.delete.Object.KeyPathMissingOnObjectWithAutoIncrement.Sub 96 add: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}}]97 add: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":2}}]96 put: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}}] 97 put: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":2}}] 98 98 delete: [{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":2}}] 99 99 delete: [] … … 101 101 102 102 -- Running test case: WI.ObjectStore.prototype.delete.Object.KeyPathSetOnObjectWithAutoIncrement.Sub 103 add: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1}]104 add: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":99},"b":2}]103 put: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1}] 104 put: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":99},"b":2}] 105 105 delete: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":99},"b":2}] 106 106 delete: [] -
trunk/LayoutTests/inspector/unit-tests/objectStore/delete.html
r237694 r243226 15 15 let keys = []; 16 16 for (let {value, expected} of tests) 17 keys.push(await InspectorTest.ObjectStore. add(value, expected));17 keys.push(await InspectorTest.ObjectStore.put(value, expected)); 18 18 19 19 for (let key of keys) … … 30 30 try { 31 31 // This call may fail on WK1 32 await InspectorTest.ObjectStore. add(InspectorTest.ObjectStore.basicObject2, 1);32 await InspectorTest.ObjectStore.put(InspectorTest.ObjectStore.basicObject2, 1); 33 33 } catch { } 34 34 … … 45 45 let objectStore = InspectorTest.ObjectStore.createObjectStore(options); 46 46 47 await InspectorTest.ObjectStore. add(InspectorTest.ObjectStore.basicObject2, 1);47 await InspectorTest.ObjectStore.put(InspectorTest.ObjectStore.basicObject2, 1); 48 48 49 49 await InspectorTest.expectException(async () => { … … 96 96 97 97 await InspectorTest.expectException(async function() { 98 await objectStore. add(InspectorTest.ObjectStore.basicObject1);99 await objectStore. add(InspectorTest.ObjectStore.basicObject2);98 await objectStore.put(InspectorTest.ObjectStore.basicObject1); 99 await objectStore.put(InspectorTest.ObjectStore.basicObject2); 100 100 }); 101 101 }); … … 108 108 109 109 await InspectorTest.expectException(async function() { 110 await objectStore. add(InspectorTest.ObjectStore.basicObject1);111 await objectStore. add(InspectorTest.ObjectStore.basicObject2);110 await objectStore.put(InspectorTest.ObjectStore.basicObject1); 111 await objectStore.put(InspectorTest.ObjectStore.basicObject2); 112 112 }); 113 113 }); -
trunk/LayoutTests/inspector/unit-tests/objectStore/deleteObject-expected.txt
r237665 r243226 4 4 == Running test suite: WI.ObjectStore.prototype.deleteObject 5 5 -- Running test case: WI.ObjectStore.prototype.deleteObject.NoParameters 6 add: [{"_object":{"b":2}}]6 put: [{"_object":{"b":2}}] 7 7 PASS: Should produce an exception. 8 8 TypeError: undefined is not an object (evaluating 'object[key]') … … 10 10 11 11 -- Running test case: WI.ObjectStore.prototype.deleteObject.MissingObject 12 add: [{"_object":{"b":2}}]12 put: [{"_object":{"b":2}}] 13 13 PASS: Should produce an exception. 14 14 DataError: Failed to execute 'delete' on 'IDBObjectStore': The parameter is not a valid key range. … … 31 31 32 32 -- Running test case: WI.ObjectStore.prototype.deleteObject.KeyPathSetOnObjectWithoutAutoIncrement 33 addObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1}]34 addObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":99,"b":2}]33 putObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1}] 34 putObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":99,"b":2}] 35 35 deleteObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":99,"b":2}] 36 36 deleteObject: [] … … 38 38 39 39 -- Running test case: WI.ObjectStore.prototype.deleteObject.KeyPathMissingOnObjectWithAutoIncrement 40 addObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1}]41 addObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":2}]40 putObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1}] 41 putObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":2}] 42 42 deleteObject: [{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":2}] 43 43 deleteObject: [] … … 45 45 46 46 -- Running test case: WI.ObjectStore.prototype.deleteObject.KeyPathSetOnObjectWithAutoIncrement 47 addObject: [{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1}]48 addObject: [{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithAutoIncrement":99,"b":2}]47 putObject: [{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1}] 48 putObject: [{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithAutoIncrement":99,"b":2}] 49 49 deleteObject: [{"KeyPathSetOnObjectWithAutoIncrement":99,"b":2}] 50 50 deleteObject: [] … … 52 52 53 53 -- Running test case: WI.ObjectStore.prototype.deleteObject.AutoIncrementWithoutKeyPath 54 addObject: [{"a":1}]55 addObject: [{"a":1},{"b":2}]54 putObject: [{"a":1}] 55 putObject: [{"a":1},{"b":2}] 56 56 deleteObject: [{"b":2}] 57 57 deleteObject: [] … … 59 59 60 60 -- Running test case: WI.ObjectStore.prototype.deleteObject.KeyPathSetOnObjectWithoutAutoIncrement.Sub 61 addObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1}]62 addObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":99},"b":2}]61 putObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1}] 62 putObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":99},"b":2}] 63 63 deleteObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":99},"b":2}] 64 64 deleteObject: [] … … 66 66 67 67 -- Running test case: WI.ObjectStore.prototype.deleteObject.KeyPathMissingOnObjectWithAutoIncrement.Sub 68 addObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}}]69 addObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":2}}]68 putObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}}] 69 putObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":2}}] 70 70 deleteObject: [{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":2}}] 71 71 deleteObject: [] … … 73 73 74 74 -- Running test case: WI.ObjectStore.prototype.deleteObject.KeyPathSetOnObjectWithAutoIncrement.Sub 75 addObject: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1}]76 addObject: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":99},"b":2}]75 putObject: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1}] 76 putObject: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":99},"b":2}] 77 77 deleteObject: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":99},"b":2}] 78 78 deleteObject: [] -
trunk/LayoutTests/inspector/unit-tests/objectStore/deleteObject.html
r237694 r243226 16 16 for (let {value, expected} of tests) { 17 17 let object = new InspectorTest.ObjectStore.TestObject(value); 18 await InspectorTest.ObjectStore. addObject(object, expected);18 await InspectorTest.ObjectStore.putObject(object, expected); 19 19 objects.push(object); 20 20 } … … 35 35 try { 36 36 // This call may fail on WK1 37 await InspectorTest.ObjectStore. add(object, 1);37 await InspectorTest.ObjectStore.put(object, 1); 38 38 } catch { } 39 39 … … 50 50 let objectStore = InspectorTest.ObjectStore.createObjectStore(options); 51 51 52 await InspectorTest.ObjectStore. add(new InspectorTest.ObjectStore.TestObject(InspectorTest.ObjectStore.basicObject2), 1);52 await InspectorTest.ObjectStore.put(new InspectorTest.ObjectStore.TestObject(InspectorTest.ObjectStore.basicObject2), 1); 53 53 54 54 await InspectorTest.expectException(async () => { … … 74 74 75 75 await InspectorTest.expectException(async function() { 76 await objectStore. add(InspectorTest.ObjectStore.basicObject1);77 await objectStore. add(InspectorTest.ObjectStore.basicObject2);76 await objectStore.put(InspectorTest.ObjectStore.basicObject1); 77 await objectStore.put(InspectorTest.ObjectStore.basicObject2); 78 78 }); 79 79 }); … … 86 86 87 87 await InspectorTest.expectException(async function() { 88 await objectStore. add(InspectorTest.ObjectStore.basicObject1);89 await objectStore. add(InspectorTest.ObjectStore.basicObject2);88 await objectStore.put(InspectorTest.ObjectStore.basicObject1); 89 await objectStore.put(InspectorTest.ObjectStore.basicObject2); 90 90 }); 91 91 }); -
trunk/LayoutTests/inspector/unit-tests/objectStore/put.html
r243225 r243226 7 7 function test() 8 8 { 9 let suite = InspectorTest.ObjectStore.createSuite("WI.ObjectStore.prototype. add");9 let suite = InspectorTest.ObjectStore.createSuite("WI.ObjectStore.prototype.put"); 10 10 11 function test Add(name, {options, tests}) {11 function testPut(name, {options, tests}) { 12 12 InspectorTest.ObjectStore.wrapTest(name, async function() { 13 13 InspectorTest.ObjectStore.createObjectStore(options); 14 14 15 15 for (let {value, expected} of tests) 16 await InspectorTest.ObjectStore. add(value, expected);16 await InspectorTest.ObjectStore.put(value, expected); 17 17 }); 18 18 } 19 19 20 InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype. add.NoParameters", async function() {20 InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype.put.NoParameters", async function() { 21 21 let objectStore = InspectorTest.ObjectStore.createObjectStore(); 22 22 23 23 await InspectorTest.expectException(async function() { 24 await objectStore. add();25 await objectStore. add(InspectorTest.ObjectStore.basicObject2);24 await objectStore.put(); 25 await objectStore.put(InspectorTest.ObjectStore.basicObject2); 26 26 }); 27 27 }); 28 28 29 test Add("WI.ObjectStore.prototype.add.Boolean", {29 testPut("WI.ObjectStore.prototype.put.Boolean", { 30 30 options: {autoIncrement: true}, 31 31 tests: [ … … 35 35 }); 36 36 37 test Add("WI.ObjectStore.prototype.add.Number", {37 testPut("WI.ObjectStore.prototype.put.Number", { 38 38 options: {autoIncrement: true}, 39 39 tests: [ … … 43 43 }); 44 44 45 test Add("WI.ObjectStore.prototype.add.String", {45 testPut("WI.ObjectStore.prototype.put.String", { 46 46 options: {autoIncrement: true}, 47 47 tests: [ … … 51 51 }); 52 52 53 test Add("WI.ObjectStore.prototype.add.Array", {53 testPut("WI.ObjectStore.prototype.put.Array", { 54 54 options: {autoIncrement: true}, 55 55 tests: [ … … 59 59 }); 60 60 61 test Add("WI.ObjectStore.prototype.add.Null", {61 testPut("WI.ObjectStore.prototype.put.Null", { 62 62 options: {autoIncrement: true}, 63 63 tests: [ … … 66 66 }); 67 67 68 InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype. add.Object.WithoutKeyPathOrAutoIncrement", async function() {68 InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype.put.Object.WithoutKeyPathOrAutoIncrement", async function() { 69 69 let objectStore = InspectorTest.ObjectStore.createObjectStore(); 70 70 71 71 await InspectorTest.expectException(async function() { 72 await objectStore. add(InspectorTest.ObjectStore.basicObject1);73 await objectStore. add(InspectorTest.ObjectStore.basicObject2);72 await objectStore.put(InspectorTest.ObjectStore.basicObject1); 73 await objectStore.put(InspectorTest.ObjectStore.basicObject2); 74 74 }); 75 75 }); 76 76 77 InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype. add.Object.KeyPathMissingOnObjectWithoutAutoIncrement", async function() {77 InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype.put.Object.KeyPathMissingOnObjectWithoutAutoIncrement", async function() { 78 78 const options = { 79 79 keyPath: "KeyPathMissingOnObjectWithoutAutoIncrement", … … 82 82 83 83 await InspectorTest.expectException(async function() { 84 await objectStore. add(InspectorTest.ObjectStore.basicObject1);85 await objectStore. add(InspectorTest.ObjectStore.basicObject2);84 await objectStore.put(InspectorTest.ObjectStore.basicObject1); 85 await objectStore.put(InspectorTest.ObjectStore.basicObject2); 86 86 }); 87 87 }); 88 88 89 test Add("WI.ObjectStore.prototype.add.Object.KeyPathSetOnObjectWithoutAutoIncrement", {89 testPut("WI.ObjectStore.prototype.put.Object.KeyPathSetOnObjectWithoutAutoIncrement", { 90 90 options: {keyPath: "KeyPathSetOnObjectWithoutAutoIncrement"}, 91 91 tests: [ … … 95 95 }); 96 96 97 test Add("WI.ObjectStore.prototype.add.Object.KeyPathMissingOnObjectWithAutoIncrement", {97 testPut("WI.ObjectStore.prototype.put.Object.KeyPathMissingOnObjectWithAutoIncrement", { 98 98 options: {keyPath: "KeyPathMissingOnObjectWithAutoIncrement", autoIncrement: true}, 99 99 tests: [ … … 103 103 }); 104 104 105 test Add("WI.ObjectStore.prototype.add.Object.KeyPathSetOnObjectWithAutoIncrement", {105 testPut("WI.ObjectStore.prototype.put.Object.KeyPathSetOnObjectWithAutoIncrement", { 106 106 options: {keyPath: "KeyPathSetOnObjectWithAutoIncrement", autoIncrement: true}, 107 107 tests: [ … … 111 111 }); 112 112 113 test Add("WI.ObjectStore.prototype.add.Object.AutoIncrementWithoutKeyPath", {113 testPut("WI.ObjectStore.prototype.put.Object.AutoIncrementWithoutKeyPath", { 114 114 options: {autoIncrement: true}, 115 115 tests: [ … … 119 119 }); 120 120 121 test Add("WI.ObjectStore.prototype.add.Object.KeyPathSetOnObjectWithoutAutoIncrement.Sub", {121 testPut("WI.ObjectStore.prototype.put.Object.KeyPathSetOnObjectWithoutAutoIncrement.Sub", { 122 122 options: {keyPath: "KeyPathSetOnObjectWithoutAutoIncrement.Sub"}, 123 123 tests: [ … … 127 127 }); 128 128 129 test Add("WI.ObjectStore.prototype.add.Object.KeyPathMissingOnObjectWithAutoIncrement.Sub", {129 testPut("WI.ObjectStore.prototype.put.Object.KeyPathMissingOnObjectWithAutoIncrement.Sub", { 130 130 options: {keyPath: "KeyPathMissingOnObjectWithAutoIncrement.Sub", autoIncrement: true}, 131 131 tests: [ … … 135 135 }); 136 136 137 test Add("WI.ObjectStore.prototype.add.Object.KeyPathSetOnObjectWithAutoIncrement.Sub", {137 testPut("WI.ObjectStore.prototype.put.Object.KeyPathSetOnObjectWithAutoIncrement.Sub", { 138 138 options: {keyPath: "KeyPathSetOnObjectWithAutoIncrement.Sub", autoIncrement: true}, 139 139 tests: [ … … 148 148 </head> 149 149 <body onload="runTest()"> 150 <p>Tests WI.ObjectStore.prototype. add.</p>150 <p>Tests WI.ObjectStore.prototype.put.</p> 151 151 </body> 152 152 </html> -
trunk/LayoutTests/inspector/unit-tests/objectStore/putObject-expected.txt
r243225 r243226 1 Tests WI.ObjectStore.prototype. addObject.1 Tests WI.ObjectStore.prototype.putObject. 2 2 3 3 4 == Running test suite: WI.ObjectStore.prototype. addObject5 -- Running test case: WI.ObjectStore.prototype. addObject.NoParameters4 == Running test suite: WI.ObjectStore.prototype.putObject 5 -- Running test case: WI.ObjectStore.prototype.putObject.NoParameters 6 6 PASS: Should produce an exception. 7 7 TypeError: undefined is not an object (evaluating 'object.toJSON') 8 8 [] 9 9 10 -- Running test case: WI.ObjectStore.prototype. addObject.WithoutKeyPathOrAutoIncrement10 -- Running test case: WI.ObjectStore.prototype.putObject.WithoutKeyPathOrAutoIncrement 11 11 PASS: Should produce an exception. 12 12 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. 13 13 [] 14 14 15 -- Running test case: WI.ObjectStore.prototype. addObject.KeyPathMissingOnObjectWithoutAutoIncrement15 -- Running test case: WI.ObjectStore.prototype.putObject.KeyPathMissingOnObjectWithoutAutoIncrement 16 16 PASS: Should produce an exception. 17 17 DataError: Failed to store record in an IDBObjectStore: Evaluating the object store's key path did not yield a value. 18 18 [] 19 19 20 -- Running test case: WI.ObjectStore.prototype. addObject.KeyPathSetOnObjectWithoutAutoIncrement21 addObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1}]22 addObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":99,"b":2}]20 -- Running test case: WI.ObjectStore.prototype.putObject.KeyPathSetOnObjectWithoutAutoIncrement 21 putObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1}] 22 putObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":99,"b":2}] 23 23 [{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":99,"b":2}] 24 24 25 -- Running test case: WI.ObjectStore.prototype. addObject.KeyPathMissingOnObjectWithAutoIncrement26 addObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1}]27 addObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":2}]25 -- Running test case: WI.ObjectStore.prototype.putObject.KeyPathMissingOnObjectWithAutoIncrement 26 putObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1}] 27 putObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":2}] 28 28 [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":2}] 29 29 30 -- Running test case: WI.ObjectStore.prototype. addObject.KeyPathSetOnObjectWithAutoIncrement31 addObject: [{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1}]32 addObject: [{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithAutoIncrement":99,"b":2}]30 -- Running test case: WI.ObjectStore.prototype.putObject.KeyPathSetOnObjectWithAutoIncrement 31 putObject: [{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1}] 32 putObject: [{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithAutoIncrement":99,"b":2}] 33 33 [{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithAutoIncrement":99,"b":2}] 34 34 35 -- Running test case: WI.ObjectStore.prototype. addObject.AutoIncrementWithoutKeyPath36 addObject: [{"a":1}]37 addObject: [{"a":1},{"b":2}]35 -- Running test case: WI.ObjectStore.prototype.putObject.AutoIncrementWithoutKeyPath 36 putObject: [{"a":1}] 37 putObject: [{"a":1},{"b":2}] 38 38 [{"a":1},{"b":2}] 39 39 40 -- Running test case: WI.ObjectStore.prototype. addObject.KeyPathSetOnObjectWithoutAutoIncrement.Sub41 addObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1}]42 addObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":99},"b":2}]40 -- Running test case: WI.ObjectStore.prototype.putObject.KeyPathSetOnObjectWithoutAutoIncrement.Sub 41 putObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1}] 42 putObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":99},"b":2}] 43 43 [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":99},"b":2}] 44 44 45 -- Running test case: WI.ObjectStore.prototype. addObject.KeyPathMissingOnObjectWithAutoIncrement.Sub46 addObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}}]47 addObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":2}}]45 -- Running test case: WI.ObjectStore.prototype.putObject.KeyPathMissingOnObjectWithAutoIncrement.Sub 46 putObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}}] 47 putObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":2}}] 48 48 [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":2}}] 49 49 50 -- Running test case: WI.ObjectStore.prototype. addObject.KeyPathSetOnObjectWithAutoIncrement.Sub51 addObject: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1}]52 addObject: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":99},"b":2}]50 -- Running test case: WI.ObjectStore.prototype.putObject.KeyPathSetOnObjectWithAutoIncrement.Sub 51 putObject: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1}] 52 putObject: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":99},"b":2}] 53 53 [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":99},"b":2}] 54 54 -
trunk/LayoutTests/inspector/unit-tests/objectStore/putObject.html
r243225 r243226 7 7 function test() 8 8 { 9 let suite = InspectorTest.ObjectStore.createSuite("WI.ObjectStore.prototype. addObject");9 let suite = InspectorTest.ObjectStore.createSuite("WI.ObjectStore.prototype.putObject"); 10 10 11 function test AddObject(name, {options, tests}) {11 function testPutObject(name, {options, tests}) { 12 12 InspectorTest.ObjectStore.wrapTest(name, async function() { 13 13 InspectorTest.ObjectStore.createObjectStore(options); 14 14 15 15 for (let {value, expected} of tests) 16 await InspectorTest.ObjectStore. addObject(new InspectorTest.ObjectStore.TestObject(value), expected);16 await InspectorTest.ObjectStore.putObject(new InspectorTest.ObjectStore.TestObject(value), expected); 17 17 }); 18 18 } 19 19 20 InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype. addObject.NoParameters", async function() {20 InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype.putObject.NoParameters", async function() { 21 21 let objectStore = InspectorTest.ObjectStore.createObjectStore(); 22 22 23 23 await InspectorTest.expectException(async function() { 24 await objectStore. addObject();25 await objectStore. addObject(new InspectorTest.ObjectStore.TestObject(InspectorTest.ObjectStore.basicObject2));24 await objectStore.putObject(); 25 await objectStore.putObject(new InspectorTest.ObjectStore.TestObject(InspectorTest.ObjectStore.basicObject2)); 26 26 }); 27 27 }); 28 28 29 InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype. addObject.WithoutKeyPathOrAutoIncrement", async function() {29 InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype.putObject.WithoutKeyPathOrAutoIncrement", async function() { 30 30 let objectStore = InspectorTest.ObjectStore.createObjectStore(); 31 31 32 32 await InspectorTest.expectException(async function() { 33 await objectStore. addObject(new InspectorTest.ObjectStore.TestObject(InspectorTest.ObjectStore.basicObject1));34 await objectStore. addObject(new InspectorTest.ObjectStore.TestObject(InspectorTest.ObjectStore.basicObject2));33 await objectStore.putObject(new InspectorTest.ObjectStore.TestObject(InspectorTest.ObjectStore.basicObject1)); 34 await objectStore.putObject(new InspectorTest.ObjectStore.TestObject(InspectorTest.ObjectStore.basicObject2)); 35 35 }); 36 36 }); 37 37 38 InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype. addObject.KeyPathMissingOnObjectWithoutAutoIncrement", async function() {38 InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype.putObject.KeyPathMissingOnObjectWithoutAutoIncrement", async function() { 39 39 const options = { 40 40 keyPath: "KeyPathMissingOnObjectWithoutAutoIncrement", … … 43 43 44 44 await InspectorTest.expectException(async function() { 45 await objectStore. addObject(new InspectorTest.ObjectStore.TestObject(InspectorTest.ObjectStore.basicObject1));46 await objectStore. addObject(new InspectorTest.ObjectStore.TestObject(InspectorTest.ObjectStore.basicObject2));45 await objectStore.putObject(new InspectorTest.ObjectStore.TestObject(InspectorTest.ObjectStore.basicObject1)); 46 await objectStore.putObject(new InspectorTest.ObjectStore.TestObject(InspectorTest.ObjectStore.basicObject2)); 47 47 }); 48 48 }); 49 49 50 test AddObject("WI.ObjectStore.prototype.addObject.KeyPathSetOnObjectWithoutAutoIncrement", {50 testPutObject("WI.ObjectStore.prototype.putObject.KeyPathSetOnObjectWithoutAutoIncrement", { 51 51 options: {keyPath: "KeyPathSetOnObjectWithoutAutoIncrement"}, 52 52 tests: [ … … 56 56 }); 57 57 58 test AddObject("WI.ObjectStore.prototype.addObject.KeyPathMissingOnObjectWithAutoIncrement", {58 testPutObject("WI.ObjectStore.prototype.putObject.KeyPathMissingOnObjectWithAutoIncrement", { 59 59 options: {keyPath: "KeyPathMissingOnObjectWithAutoIncrement", autoIncrement: true}, 60 60 tests: [ … … 64 64 }); 65 65 66 test AddObject("WI.ObjectStore.prototype.addObject.KeyPathSetOnObjectWithAutoIncrement", {66 testPutObject("WI.ObjectStore.prototype.putObject.KeyPathSetOnObjectWithAutoIncrement", { 67 67 options: {keyPath: "KeyPathSetOnObjectWithAutoIncrement", autoIncrement: true}, 68 68 tests: [ … … 72 72 }); 73 73 74 test AddObject("WI.ObjectStore.prototype.addObject.AutoIncrementWithoutKeyPath", {74 testPutObject("WI.ObjectStore.prototype.putObject.AutoIncrementWithoutKeyPath", { 75 75 options: {autoIncrement: true}, 76 76 tests: [ … … 80 80 }); 81 81 82 test AddObject("WI.ObjectStore.prototype.addObject.KeyPathSetOnObjectWithoutAutoIncrement.Sub", {82 testPutObject("WI.ObjectStore.prototype.putObject.KeyPathSetOnObjectWithoutAutoIncrement.Sub", { 83 83 options: {keyPath: "KeyPathSetOnObjectWithoutAutoIncrement.Sub"}, 84 84 tests: [ … … 88 88 }); 89 89 90 test AddObject("WI.ObjectStore.prototype.addObject.KeyPathMissingOnObjectWithAutoIncrement.Sub", {90 testPutObject("WI.ObjectStore.prototype.putObject.KeyPathMissingOnObjectWithAutoIncrement.Sub", { 91 91 options: {keyPath: "KeyPathMissingOnObjectWithAutoIncrement.Sub", autoIncrement: true}, 92 92 tests: [ … … 96 96 }); 97 97 98 test AddObject("WI.ObjectStore.prototype.addObject.KeyPathSetOnObjectWithAutoIncrement.Sub", {98 testPutObject("WI.ObjectStore.prototype.putObject.KeyPathSetOnObjectWithAutoIncrement.Sub", { 99 99 options: {keyPath: "KeyPathSetOnObjectWithAutoIncrement.Sub", autoIncrement: true}, 100 100 tests: [ … … 109 109 </head> 110 110 <body onload="runTest()"> 111 <p>Tests WI.ObjectStore.prototype. addObject.</p>111 <p>Tests WI.ObjectStore.prototype.putObject.</p> 112 112 </body> 113 113 </html> -
trunk/LayoutTests/inspector/unit-tests/objectStore/resources/objectStore-utilities.js
r237694 r243226 26 26 }; 27 27 28 InspectorTest.ObjectStore. add= async function(value, expected) {29 let result = await WI.ObjectStore.__testObjectStore. add(value);28 InspectorTest.ObjectStore.put = async function(value, expected) { 29 let result = await WI.ObjectStore.__testObjectStore.put(value); 30 30 InspectorTest.assert(result === expected, `the key of the added item should be ${expected}, but is actually ${result}`); 31 31 32 await InspectorTest.ObjectStore.logValues(" add: ");32 await InspectorTest.ObjectStore.logValues("put: "); 33 33 return result; 34 34 }; 35 35 36 InspectorTest.ObjectStore. addObject = async function(object, expected) {37 let result = await WI.ObjectStore.__testObjectStore. addObject(object);36 InspectorTest.ObjectStore.putObject = async function(object, expected) { 37 let result = await WI.ObjectStore.__testObjectStore.putObject(object); 38 38 InspectorTest.assert(result === expected, `the key of the added item should be ${expected}, but is actually ${result}`); 39 39 … … 41 41 InspectorTest.assert(resolved.value === expected, `the resolved keyPath on the object should equal ${expected}, but is actually ${resolved.value}`); 42 42 43 await InspectorTest.ObjectStore.logValues(" addObject: ");43 await InspectorTest.ObjectStore.logValues("putObject: "); 44 44 return result; 45 45 }; -
trunk/Source/WebInspectorUI/ChangeLog
r243225 r243226 1 2019-03-20 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: Debugger: move breakpoint storage to use `WI.ObjectStore` 4 https://bugs.webkit.org/show_bug.cgi?id=192719 5 <rdar://problem/46746857> 6 7 Reviewed by Timothy Hatcher. 8 9 * UserInterface/Controllers/DebuggerManager.js: 10 (WI.DebuggerManager): 11 (WI.DebuggerManager.prototype.addBreakpoint): 12 (WI.DebuggerManager.prototype.removeBreakpoint): 13 (WI.DebuggerManager.prototype._debuggerBreakpointOptions): 14 (WI.DebuggerManager.prototype._setBreakpoint.didSetBreakpoint): 15 (WI.DebuggerManager.prototype._setBreakpoint): 16 (WI.DebuggerManager.prototype._breakpointDisabledStateDidChange): 17 (WI.DebuggerManager.prototype._breakpointEditablePropertyDidChange): 18 (WI.DebuggerManager.prototype._saveBreakpoints): Deleted. 19 20 * UserInterface/Models/Breakpoint.js: 21 (WI.Breakpoint.prototype.saveIdentityToCookie): 22 (WI.Breakpoint.prototype.serializeOptions): Added. 23 (WI.Breakpoint.prototype.toJSON): Added. 24 (WI.Breakpoint.prototype.get options): Deleted. 25 (WI.Breakpoint.prototype.get info): Deleted. 26 (WI.Breakpoint.prototype._serializableActions): Deleted. 27 * UserInterface/Models/BreakpointAction.js: 28 (WI.BreakpointAction.prototype.toJSON): Added. 29 (WI.BreakpointAction.prototype.get info): Deleted. 30 31 * UserInterface/Base/ObjectStore.js: 32 (WI.ObjectStore.async reset): Added. 33 (WI.ObjectStore._open): 34 (WI.ObjectStore.prototype.get keyPath): Added. 35 (WI.ObjectStore.prototype.async.getAll): 36 (WI.ObjectStore.prototype.async.put): Added. 37 (WI.ObjectStore.prototype.async.putObject): Added. 38 (WI.ObjectStore.prototype.async.add): Deleted. 39 (WI.ObjectStore.prototype.async.addObject): Deleted. 40 Replace `add` with `put` so that if a key already exists, it is overridden. 41 42 * UserInterface/Controllers/AuditManager.js: 43 (WI.AuditManager.prototype.set editing): 44 (WI.AuditManager.prototype.async processJSON): 45 46 * UserInterface/Controllers/BreakpointPopoverController.js: 47 (WI.BreakpointPopoverController.prototype._popoverActionsAddActionButtonClicked): 48 Inline some `WI.Breakpoint` static values. 49 1 50 2019-03-20 Devin Rousso <drousso@apple.com> 2 51 -
trunk/Source/WebInspectorUI/UserInterface/Base/ObjectStore.js
r239858 r243226 39 39 } 40 40 41 static async reset() 42 { 43 if (WI.ObjectStore._database) 44 WI.ObjectStore._database.close(); 45 46 await window.indexedDB.deleteDatabase(ObjectStore._databaseName); 47 } 48 41 49 static get _databaseName() 42 50 { … … 60 68 WI.ObjectStore._databaseCallbacks = [callback]; 61 69 62 const version = 1; // Increment this for every edit to `WI.objectStores`.63 64 let databaseRequest = indexedDB.open(WI.ObjectStore._databaseName, version);70 const version = 2; // Increment this for every edit to `WI.objectStores`. 71 72 let databaseRequest = window.indexedDB.open(WI.ObjectStore._databaseName, version); 65 73 databaseRequest.addEventListener("upgradeneeded", (event) => { 66 74 let database = databaseRequest.result; … … 98 106 // Public 99 107 108 get keyPath() 109 { 110 return (this._options || {}).keyPath; 111 } 112 100 113 associateObject(object, key, value) 101 114 { … … 110 123 { 111 124 if (!WI.ObjectStore.supported()) 112 return undefined;125 return []; 113 126 114 127 return this._operation("readonly", (objectStore) => objectStore.getAll(...args)); 115 128 } 116 129 117 async add(...args)118 { 119 if (!WI.ObjectStore.supported()) 120 return undefined; 121 122 return this._operation("readwrite", (objectStore) => objectStore. add(...args));123 } 124 125 async addObject(object, ...args)130 async put(...args) 131 { 132 if (!WI.ObjectStore.supported()) 133 return undefined; 134 135 return this._operation("readwrite", (objectStore) => objectStore.put(...args)); 136 } 137 138 async putObject(object, ...args) 126 139 { 127 140 if (!WI.ObjectStore.supported()) … … 129 142 130 143 console.assert(typeof object.toJSON === "function", "ObjectStore cannot store an object without JSON serialization", object.constructor.name); 131 let result = await this. add(object.toJSON(WI.ObjectStore.toJSONSymbol), ...args);144 let result = await this.put(object.toJSON(WI.ObjectStore.toJSONSymbol), ...args); 132 145 this.associateObject(object, args[0], result); 133 146 return result; … … 229 242 WI.objectStores = { 230 243 audits: new WI.ObjectStore("audit-manager-tests", {keyPath: "__id", autoIncrement: true}), 244 breakpoints: new WI.ObjectStore("debugger-breakpoints", {keyPath: "__id"}), 231 245 }; -
trunk/Source/WebInspectorUI/UserInterface/Controllers/AuditManager.js
r242808 r243226 117 117 saveDisabledDefaultTest(test); 118 118 else 119 WI.objectStores.audits. addObject(test);119 WI.objectStores.audits.putObject(test); 120 120 } 121 121 … … 218 218 if (object instanceof WI.AuditTestBase) { 219 219 this._addTest(object); 220 WI.objectStores.audits. addObject(object);220 WI.objectStores.audits.putObject(object); 221 221 } else if (object instanceof WI.AuditTestResultBase) 222 222 this._addResult(object); -
trunk/Source/WebInspectorUI/UserInterface/Controllers/BreakpointPopoverController.js
r238743 r243226 292 292 this._actionsContainer.removeChildren(); 293 293 294 let newAction = this._breakpoint.createAction(WI.Breakpoint .DefaultBreakpointActionType);294 let newAction = this._breakpoint.createAction(WI.BreakpointAction.Type.Log); 295 295 let newBreakpointActionView = new WI.BreakpointActionView(newAction, this); 296 296 this._popoverActionsInsertBreakpointActionView(newBreakpointActionView, -1); -
trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js
r242314 r243226 51 51 WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this); 52 52 53 this._breakpointsSetting = new WI.Setting("breakpoints", []);54 53 this._breakpointsEnabledSetting = new WI.Setting("breakpoints-enabled", true); 55 54 this._allExceptionsBreakpointEnabledSetting = new WI.Setting("break-on-all-exceptions", false); … … 101 100 this._ignoreBreakpointDisplayLocationDidChangeEvent = false; 102 101 103 // Ensure that all managers learn about restored breakpoints, 104 // regardless of their initialization order. 105 setTimeout(() => { 102 (async () => { 103 let existingSerializedBreakpoints = WI.Setting.migrateValue("breakpoints"); 104 if (existingSerializedBreakpoints) { 105 for (let existingSerializedBreakpoint of existingSerializedBreakpoints) 106 await WI.objectStores.breakpoints.putObject(new WI.Breakpoint(existingSerializedBreakpoint)); 107 } 108 109 let serializedBreakpoints = await WI.objectStores.breakpoints.getAll(); 110 106 111 this._restoringBreakpoints = true; 107 for (let cookie of this._breakpointsSetting.value) 108 this.addBreakpoint(new WI.Breakpoint(cookie)); 112 for (let serializedBreakpoint of serializedBreakpoints) { 113 let breakpoint = new WI.Breakpoint(serializedBreakpoint); 114 115 const key = null; 116 WI.objectStores.breakpoints.associateObject(breakpoint, key, serializedBreakpoint); 117 118 this.addBreakpoint(breakpoint); 119 } 109 120 this._restoringBreakpoints = false; 110 }) ;121 })(); 111 122 } 112 123 … … 498 509 } 499 510 500 this._saveBreakpoints(); 511 if (!this._restoringBreakpoints) 512 WI.objectStores.breakpoints.putObject(breakpoint); 501 513 502 514 this._addProbesForBreakpoint(breakpoint); … … 548 560 breakpoint.clearActions(); 549 561 550 this._saveBreakpoints(); 562 if (!this._restoringBreakpoints) 563 WI.objectStores.breakpoints.deleteObject(breakpoint); 551 564 552 565 this._removeProbesForBreakpoint(breakpoint); … … 893 906 const templatePlaceholderRegex = /\$\{.*?\}/; 894 907 895 let options = breakpoint.options; 896 let invalidActions = []; 897 898 for (let action of options.actions) { 908 let options = breakpoint.serializeOptions(); 909 options.actions = options.actions.filter((action) => { 899 910 if (action.type !== WI.BreakpointAction.Type.Log) 900 continue;911 return true; 901 912 902 913 if (!templatePlaceholderRegex.test(action.data)) 903 continue;914 return true; 904 915 905 916 let lexer = new WI.BreakpointLogMessageLexer; 906 917 let tokens = lexer.tokenize(action.data); 907 if (!tokens) { 908 invalidActions.push(action); 909 continue; 910 } 918 if (!tokens) 919 return false; 911 920 912 921 let templateLiteral = tokens.reduce((text, token) => { … … 920 929 action.data = "console.log(`" + templateLiteral + "`)"; 921 930 action.type = WI.BreakpointAction.Type.Evaluate; 922 } 923 924 for (let invalidAction of invalidActions) 925 options.actions.remove(invalidAction); 926 931 return true; 932 }); 927 933 return options; 928 934 } … … 970 976 // NOTE: Breakpoint.options returns new objects each time, so it is safe to modify. 971 977 let options = this._debuggerBreakpointOptions(breakpoint); 972 if (options.actions.length) { 973 for (let action of options.actions) 974 action.type = this._debuggerBreakpointActionType(action.type); 975 } 978 for (let action of options.actions) 979 action.type = this._debuggerBreakpointActionType(action.type); 976 980 977 981 if (breakpoint.contentIdentifier) { … … 1047 1051 _breakpointDisabledStateDidChange(event) 1048 1052 { 1049 this._saveBreakpoints();1050 1051 1053 let breakpoint = event.target; 1054 1052 1055 if (breakpoint === this._allExceptionsBreakpoint) { 1053 1056 if (!breakpoint.disabled && !this.breakpointsDisabledTemporarily) … … 1079 1082 } 1080 1083 1084 if (!this._restoringBreakpoints) 1085 WI.objectStores.breakpoints.putObject(breakpoint); 1086 1081 1087 if (breakpoint.disabled) 1082 1088 this._removeBreakpoint(breakpoint); … … 1087 1093 _breakpointEditablePropertyDidChange(event) 1088 1094 { 1089 this._saveBreakpoints();1090 1091 1095 let breakpoint = event.target; 1096 1097 if (!this._restoringBreakpoints) 1098 WI.objectStores.breakpoints.putObject(breakpoint); 1099 1092 1100 if (breakpoint.disabled) 1093 1101 return; … … 1248 1256 break; 1249 1257 } 1250 }1251 1252 _saveBreakpoints()1253 {1254 if (this._restoringBreakpoints)1255 return;1256 1257 let breakpointsToSave = this._breakpoints.filter((breakpoint) => !!breakpoint.contentIdentifier);1258 let serializedBreakpoints = breakpointsToSave.map((breakpoint) => breakpoint.info);1259 this._breakpointsSetting.value = serializedBreakpoints;1260 1258 } 1261 1259 -
trunk/Source/WebInspectorUI/UserInterface/Models/Breakpoint.js
r220119 r243226 191 191 } 192 192 193 get options()194 {195 return {196 condition: this._condition,197 ignoreCount: this._ignoreCount,198 actions: this._serializableActions(),199 autoContinue: this._autoContinue200 };201 }202 203 get info()204 {205 // The id, scriptIdentifier, target, and resolved state are tied to the current session, so don't include them for serialization.206 return {207 contentIdentifier: this._contentIdentifier,208 lineNumber: this._sourceCodeLocation.lineNumber,209 columnNumber: this._sourceCodeLocation.columnNumber,210 disabled: this._disabled,211 condition: this._condition,212 ignoreCount: this._ignoreCount,213 actions: this._serializableActions(),214 autoContinue: this._autoContinue215 };216 }217 218 193 get probeActions() 219 194 { … … 308 283 saveIdentityToCookie(cookie) 309 284 { 310 cookie[WI.Breakpoint.ContentIdentifierCookieKey] = this.contentIdentifier; 311 cookie[WI.Breakpoint.LineNumberCookieKey] = this.sourceCodeLocation.lineNumber; 312 cookie[WI.Breakpoint.ColumnNumberCookieKey] = this.sourceCodeLocation.columnNumber; 285 cookie["breakpoint-content-identifier"] = this.contentIdentifier; 286 cookie["breakpoint-line-number"] = this.sourceCodeLocation.lineNumber; 287 cookie["breakpoint-column-number"] = this.sourceCodeLocation.columnNumber; 288 } 289 290 serializeOptions() 291 { 292 return { 293 condition: this._condition, 294 ignoreCount: this._ignoreCount, 295 actions: this._actions.map((action) => action.toJSON()), 296 autoContinue: this._autoContinue, 297 }; 298 } 299 300 toJSON(key) 301 { 302 // The id, scriptIdentifier, target, and resolved state are tied to the current session, so don't include them for serialization. 303 let json = { 304 contentIdentifier: this._contentIdentifier, 305 lineNumber: this._sourceCodeLocation.lineNumber, 306 columnNumber: this._sourceCodeLocation.columnNumber, 307 disabled: this._disabled, 308 ...this.serializeOptions(), 309 }; 310 if (key === WI.ObjectStore.toJSONSymbol) 311 json[WI.objectStores.breakpoints.keyPath] = this._contentIdentifier + ":" + this._sourceCodeLocation.lineNumber + ":" + this._sourceCodeLocation.columnNumber; 312 return json; 313 313 } 314 314 … … 327 327 // Private 328 328 329 _serializableActions()330 {331 var actions = [];332 for (var i = 0; i < this._actions.length; ++i)333 actions.push(this._actions[i].info);334 return actions;335 }336 337 329 _sourceCodeLocationLocationChanged(event) 338 330 { … … 346 338 }; 347 339 348 WI.Breakpoint.DefaultBreakpointActionType = WI.BreakpointAction.Type.Log;349 350 340 WI.Breakpoint.TypeIdentifier = "breakpoint"; 351 WI.Breakpoint.ContentIdentifierCookieKey = "breakpoint-content-identifier";352 WI.Breakpoint.LineNumberCookieKey = "breakpoint-line-number";353 WI.Breakpoint.ColumnNumberCookieKey = "breakpoint-column-number";354 341 355 342 WI.Breakpoint.Event = { -
trunk/Source/WebInspectorUI/UserInterface/Models/BreakpointAction.js
r220119 r243226 67 67 } 68 68 69 get info()69 toJSON() 70 70 { 71 var obj = {type: this._type, id: this._id}; 71 let json = { 72 type: this._type, 73 id: this._id, 74 }; 72 75 if (this._data) 73 obj.data = this._data;74 return obj;76 json.data = this._data; 77 return json; 75 78 } 76 79 };
Note:
See TracChangeset
for help on using the changeset viewer.