⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 243226 in webkit


Ignore:
Timestamp:
Mar 20, 2019, 12:50:21 PM (7 years ago)
Author:
Devin Rousso
Message:

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.

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.

Location:
trunk
Files:
1 added
1 deleted
14 edited
3 moved

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r243219 r243226  
     12019-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
    1212019-03-20  Devin Rousso  <drousso@apple.com>
    222
  • trunk/LayoutTests/inspector/unit-tests/objectStore/clear.html

    r239858 r243226  
    1414
    1515            for (let object of objects)
    16                 await objectStore.add(object);
     16                await objectStore.put(object);
    1717
    1818            await InspectorTest.ObjectStore.logValues();
  • trunk/LayoutTests/inspector/unit-tests/objectStore/delete-expected.txt

    r237665 r243226  
    44== Running test suite: WI.ObjectStore.prototype.delete
    55-- Running test case: WI.ObjectStore.prototype.delete.NoParameters
    6 add: [{"b":2}]
     6put: [{"b":2}]
    77PASS: Should produce an exception.
    88TypeError: Not enough arguments
     
    1010
    1111-- Running test case: WI.ObjectStore.prototype.delete.MissingObject
    12 add: [{"b":2}]
     12put: [{"b":2}]
    1313PASS: Should produce an exception.
    1414DataError: Failed to execute 'delete' on 'IDBObjectStore': The parameter is not a valid key.
     
    1616
    1717-- Running test case: WI.ObjectStore.prototype.delete.Boolean
    18 add: [false]
    19 add: [false,true]
     18put: [false]
     19put: [false,true]
    2020delete: [true]
    2121delete: []
     
    2323
    2424-- Running test case: WI.ObjectStore.prototype.delete.Number
    25 add: [11]
    26 add: [11,22]
     25put: [11]
     26put: [11,22]
    2727delete: [22]
    2828delete: []
     
    3030
    3131-- Running test case: WI.ObjectStore.prototype.delete.String
    32 add: ["foo"]
    33 add: ["foo","bar"]
     32put: ["foo"]
     33put: ["foo","bar"]
    3434delete: ["bar"]
    3535delete: []
     
    3737
    3838-- Running test case: WI.ObjectStore.prototype.delete.Array
    39 add: [[11]]
    40 add: [[11],[22]]
     39put: [[11]]
     40put: [[11],[22]]
    4141delete: [[22]]
    4242delete: []
     
    4444
    4545-- Running test case: WI.ObjectStore.prototype.delete.Null
    46 add: [null]
     46put: [null]
    4747delete: []
    4848[]
     
    5959
    6060-- 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}]
     61put: [{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1}]
     62put: [{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":99,"b":2}]
    6363delete: [{"KeyPathSetOnObjectWithoutAutoIncrement":99,"b":2}]
    6464delete: []
     
    6666
    6767-- 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}]
     68put: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1}]
     69put: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":2}]
    7070delete: [{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":2}]
    7171delete: []
     
    7373
    7474-- 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}]
     75put: [{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1}]
     76put: [{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithAutoIncrement":99,"b":2}]
    7777delete: [{"KeyPathSetOnObjectWithAutoIncrement":99,"b":2}]
    7878delete: []
     
    8080
    8181-- Running test case: WI.ObjectStore.prototype.delete.Object.AutoIncrementWithoutKeyPath
    82 add: [{"a":1}]
    83 add: [{"a":1},{"b":2}]
     82put: [{"a":1}]
     83put: [{"a":1},{"b":2}]
    8484delete: [{"b":2}]
    8585delete: []
     
    8787
    8888-- 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}]
     89put: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1}]
     90put: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":99},"b":2}]
    9191delete: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":99},"b":2}]
    9292delete: []
     
    9494
    9595-- 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}}]
     96put: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}}]
     97put: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":2}}]
    9898delete: [{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":2}}]
    9999delete: []
     
    101101
    102102-- 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}]
     103put: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1}]
     104put: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":99},"b":2}]
    105105delete: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":99},"b":2}]
    106106delete: []
  • trunk/LayoutTests/inspector/unit-tests/objectStore/delete.html

    r237694 r243226  
    1515            let keys = [];
    1616            for (let {value, expected} of tests)
    17                 keys.push(await InspectorTest.ObjectStore.add(value, expected));
     17                keys.push(await InspectorTest.ObjectStore.put(value, expected));
    1818
    1919            for (let key of keys)
     
    3030        try {
    3131            // This call may fail on WK1
    32             await InspectorTest.ObjectStore.add(InspectorTest.ObjectStore.basicObject2, 1);
     32            await InspectorTest.ObjectStore.put(InspectorTest.ObjectStore.basicObject2, 1);
    3333        } catch { }
    3434
     
    4545        let objectStore = InspectorTest.ObjectStore.createObjectStore(options);
    4646
    47         await InspectorTest.ObjectStore.add(InspectorTest.ObjectStore.basicObject2, 1);
     47        await InspectorTest.ObjectStore.put(InspectorTest.ObjectStore.basicObject2, 1);
    4848
    4949        await InspectorTest.expectException(async () => {
     
    9696
    9797        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);
    100100        });
    101101    });
     
    108108
    109109        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);
    112112        });
    113113    });
  • trunk/LayoutTests/inspector/unit-tests/objectStore/deleteObject-expected.txt

    r237665 r243226  
    44== Running test suite: WI.ObjectStore.prototype.deleteObject
    55-- Running test case: WI.ObjectStore.prototype.deleteObject.NoParameters
    6 add: [{"_object":{"b":2}}]
     6put: [{"_object":{"b":2}}]
    77PASS: Should produce an exception.
    88TypeError: undefined is not an object (evaluating 'object[key]')
     
    1010
    1111-- Running test case: WI.ObjectStore.prototype.deleteObject.MissingObject
    12 add: [{"_object":{"b":2}}]
     12put: [{"_object":{"b":2}}]
    1313PASS: Should produce an exception.
    1414DataError: Failed to execute 'delete' on 'IDBObjectStore': The parameter is not a valid key range.
     
    3131
    3232-- Running test case: WI.ObjectStore.prototype.deleteObject.KeyPathSetOnObjectWithoutAutoIncrement
    33 addObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1}]
    34 addObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":99,"b":2}]
     33putObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1}]
     34putObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":99,"b":2}]
    3535deleteObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":99,"b":2}]
    3636deleteObject: []
     
    3838
    3939-- Running test case: WI.ObjectStore.prototype.deleteObject.KeyPathMissingOnObjectWithAutoIncrement
    40 addObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1}]
    41 addObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":2}]
     40putObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1}]
     41putObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":2}]
    4242deleteObject: [{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":2}]
    4343deleteObject: []
     
    4545
    4646-- Running test case: WI.ObjectStore.prototype.deleteObject.KeyPathSetOnObjectWithAutoIncrement
    47 addObject: [{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1}]
    48 addObject: [{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithAutoIncrement":99,"b":2}]
     47putObject: [{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1}]
     48putObject: [{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithAutoIncrement":99,"b":2}]
    4949deleteObject: [{"KeyPathSetOnObjectWithAutoIncrement":99,"b":2}]
    5050deleteObject: []
     
    5252
    5353-- Running test case: WI.ObjectStore.prototype.deleteObject.AutoIncrementWithoutKeyPath
    54 addObject: [{"a":1}]
    55 addObject: [{"a":1},{"b":2}]
     54putObject: [{"a":1}]
     55putObject: [{"a":1},{"b":2}]
    5656deleteObject: [{"b":2}]
    5757deleteObject: []
     
    5959
    6060-- 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}]
     61putObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1}]
     62putObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":99},"b":2}]
    6363deleteObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":99},"b":2}]
    6464deleteObject: []
     
    6666
    6767-- 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}}]
     68putObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}}]
     69putObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":2}}]
    7070deleteObject: [{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":2}}]
    7171deleteObject: []
     
    7373
    7474-- 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}]
     75putObject: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1}]
     76putObject: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":99},"b":2}]
    7777deleteObject: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":99},"b":2}]
    7878deleteObject: []
  • trunk/LayoutTests/inspector/unit-tests/objectStore/deleteObject.html

    r237694 r243226  
    1616            for (let {value, expected} of tests) {
    1717                let object = new InspectorTest.ObjectStore.TestObject(value);
    18                 await InspectorTest.ObjectStore.addObject(object, expected);
     18                await InspectorTest.ObjectStore.putObject(object, expected);
    1919                objects.push(object);
    2020            }
     
    3535        try {
    3636            // This call may fail on WK1
    37             await InspectorTest.ObjectStore.add(object, 1);
     37            await InspectorTest.ObjectStore.put(object, 1);
    3838        } catch { }
    3939
     
    5050        let objectStore = InspectorTest.ObjectStore.createObjectStore(options);
    5151
    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);
    5353
    5454        await InspectorTest.expectException(async () => {
     
    7474
    7575        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);
    7878        });
    7979    });
     
    8686
    8787        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);
    9090        });
    9191    });
  • trunk/LayoutTests/inspector/unit-tests/objectStore/put.html

    r243225 r243226  
    77function test()
    88{
    9     let suite = InspectorTest.ObjectStore.createSuite("WI.ObjectStore.prototype.add");
     9    let suite = InspectorTest.ObjectStore.createSuite("WI.ObjectStore.prototype.put");
    1010
    11     function testAdd(name, {options, tests}) {
     11    function testPut(name, {options, tests}) {
    1212        InspectorTest.ObjectStore.wrapTest(name, async function() {
    1313            InspectorTest.ObjectStore.createObjectStore(options);
    1414
    1515            for (let {value, expected} of tests)
    16                 await InspectorTest.ObjectStore.add(value, expected);
     16                await InspectorTest.ObjectStore.put(value, expected);
    1717        });
    1818    }
    1919
    20     InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype.add.NoParameters", async function() {
     20    InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype.put.NoParameters", async function() {
    2121        let objectStore = InspectorTest.ObjectStore.createObjectStore();
    2222
    2323        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);
    2626        });
    2727    });
    2828
    29     testAdd("WI.ObjectStore.prototype.add.Boolean", {
     29    testPut("WI.ObjectStore.prototype.put.Boolean", {
    3030        options: {autoIncrement: true},
    3131        tests: [
     
    3535    });
    3636
    37     testAdd("WI.ObjectStore.prototype.add.Number", {
     37    testPut("WI.ObjectStore.prototype.put.Number", {
    3838        options: {autoIncrement: true},
    3939        tests: [
     
    4343    });
    4444
    45     testAdd("WI.ObjectStore.prototype.add.String", {
     45    testPut("WI.ObjectStore.prototype.put.String", {
    4646        options: {autoIncrement: true},
    4747        tests: [
     
    5151    });
    5252
    53     testAdd("WI.ObjectStore.prototype.add.Array", {
     53    testPut("WI.ObjectStore.prototype.put.Array", {
    5454        options: {autoIncrement: true},
    5555        tests: [
     
    5959    });
    6060
    61     testAdd("WI.ObjectStore.prototype.add.Null", {
     61    testPut("WI.ObjectStore.prototype.put.Null", {
    6262        options: {autoIncrement: true},
    6363        tests: [
     
    6666    });
    6767
    68     InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype.add.Object.WithoutKeyPathOrAutoIncrement", async function() {
     68    InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype.put.Object.WithoutKeyPathOrAutoIncrement", async function() {
    6969        let objectStore = InspectorTest.ObjectStore.createObjectStore();
    7070
    7171        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);
    7474        });
    7575    });
    7676
    77     InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype.add.Object.KeyPathMissingOnObjectWithoutAutoIncrement", async function() {
     77    InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype.put.Object.KeyPathMissingOnObjectWithoutAutoIncrement", async function() {
    7878        const options = {
    7979            keyPath: "KeyPathMissingOnObjectWithoutAutoIncrement",
     
    8282
    8383        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);
    8686        });
    8787    });
    8888
    89     testAdd("WI.ObjectStore.prototype.add.Object.KeyPathSetOnObjectWithoutAutoIncrement", {
     89    testPut("WI.ObjectStore.prototype.put.Object.KeyPathSetOnObjectWithoutAutoIncrement", {
    9090        options: {keyPath: "KeyPathSetOnObjectWithoutAutoIncrement"},
    9191        tests: [
     
    9595    });
    9696
    97     testAdd("WI.ObjectStore.prototype.add.Object.KeyPathMissingOnObjectWithAutoIncrement", {
     97    testPut("WI.ObjectStore.prototype.put.Object.KeyPathMissingOnObjectWithAutoIncrement", {
    9898        options: {keyPath: "KeyPathMissingOnObjectWithAutoIncrement", autoIncrement: true},
    9999        tests: [
     
    103103    });
    104104
    105     testAdd("WI.ObjectStore.prototype.add.Object.KeyPathSetOnObjectWithAutoIncrement", {
     105    testPut("WI.ObjectStore.prototype.put.Object.KeyPathSetOnObjectWithAutoIncrement", {
    106106        options: {keyPath: "KeyPathSetOnObjectWithAutoIncrement", autoIncrement: true},
    107107        tests: [
     
    111111    });
    112112
    113     testAdd("WI.ObjectStore.prototype.add.Object.AutoIncrementWithoutKeyPath", {
     113    testPut("WI.ObjectStore.prototype.put.Object.AutoIncrementWithoutKeyPath", {
    114114        options: {autoIncrement: true},
    115115        tests: [
     
    119119    });
    120120
    121     testAdd("WI.ObjectStore.prototype.add.Object.KeyPathSetOnObjectWithoutAutoIncrement.Sub", {
     121    testPut("WI.ObjectStore.prototype.put.Object.KeyPathSetOnObjectWithoutAutoIncrement.Sub", {
    122122        options: {keyPath: "KeyPathSetOnObjectWithoutAutoIncrement.Sub"},
    123123        tests: [
     
    127127    });
    128128
    129     testAdd("WI.ObjectStore.prototype.add.Object.KeyPathMissingOnObjectWithAutoIncrement.Sub", {
     129    testPut("WI.ObjectStore.prototype.put.Object.KeyPathMissingOnObjectWithAutoIncrement.Sub", {
    130130        options: {keyPath: "KeyPathMissingOnObjectWithAutoIncrement.Sub", autoIncrement: true},
    131131        tests: [
     
    135135    });
    136136
    137     testAdd("WI.ObjectStore.prototype.add.Object.KeyPathSetOnObjectWithAutoIncrement.Sub", {
     137    testPut("WI.ObjectStore.prototype.put.Object.KeyPathSetOnObjectWithAutoIncrement.Sub", {
    138138        options: {keyPath: "KeyPathSetOnObjectWithAutoIncrement.Sub", autoIncrement: true},
    139139        tests: [
     
    148148</head>
    149149<body onload="runTest()">
    150     <p>Tests WI.ObjectStore.prototype.add.</p>
     150    <p>Tests WI.ObjectStore.prototype.put.</p>
    151151</body>
    152152</html>
  • trunk/LayoutTests/inspector/unit-tests/objectStore/putObject-expected.txt

    r243225 r243226  
    1 Tests WI.ObjectStore.prototype.addObject.
     1Tests WI.ObjectStore.prototype.putObject.
    22
    33
    4 == Running test suite: WI.ObjectStore.prototype.addObject
    5 -- Running test case: WI.ObjectStore.prototype.addObject.NoParameters
     4== Running test suite: WI.ObjectStore.prototype.putObject
     5-- Running test case: WI.ObjectStore.prototype.putObject.NoParameters
    66PASS: Should produce an exception.
    77TypeError: undefined is not an object (evaluating 'object.toJSON')
    88[]
    99
    10 -- Running test case: WI.ObjectStore.prototype.addObject.WithoutKeyPathOrAutoIncrement
     10-- Running test case: WI.ObjectStore.prototype.putObject.WithoutKeyPathOrAutoIncrement
    1111PASS: Should produce an exception.
    1212DataError: 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.
    1313[]
    1414
    15 -- Running test case: WI.ObjectStore.prototype.addObject.KeyPathMissingOnObjectWithoutAutoIncrement
     15-- Running test case: WI.ObjectStore.prototype.putObject.KeyPathMissingOnObjectWithoutAutoIncrement
    1616PASS: Should produce an exception.
    1717DataError: Failed to store record in an IDBObjectStore: Evaluating the object store's key path did not yield a value.
    1818[]
    1919
    20 -- Running test case: WI.ObjectStore.prototype.addObject.KeyPathSetOnObjectWithoutAutoIncrement
    21 addObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1}]
    22 addObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":99,"b":2}]
     20-- Running test case: WI.ObjectStore.prototype.putObject.KeyPathSetOnObjectWithoutAutoIncrement
     21putObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1}]
     22putObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":99,"b":2}]
    2323[{"KeyPathSetOnObjectWithoutAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":99,"b":2}]
    2424
    25 -- Running test case: WI.ObjectStore.prototype.addObject.KeyPathMissingOnObjectWithAutoIncrement
    26 addObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1}]
    27 addObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":2}]
     25-- Running test case: WI.ObjectStore.prototype.putObject.KeyPathMissingOnObjectWithAutoIncrement
     26putObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1}]
     27putObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":2}]
    2828[{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":1},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":2}]
    2929
    30 -- Running test case: WI.ObjectStore.prototype.addObject.KeyPathSetOnObjectWithAutoIncrement
    31 addObject: [{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1}]
    32 addObject: [{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithAutoIncrement":99,"b":2}]
     30-- Running test case: WI.ObjectStore.prototype.putObject.KeyPathSetOnObjectWithAutoIncrement
     31putObject: [{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1}]
     32putObject: [{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithAutoIncrement":99,"b":2}]
    3333[{"KeyPathSetOnObjectWithAutoIncrement":42,"a":1},{"KeyPathSetOnObjectWithAutoIncrement":99,"b":2}]
    3434
    35 -- Running test case: WI.ObjectStore.prototype.addObject.AutoIncrementWithoutKeyPath
    36 addObject: [{"a":1}]
    37 addObject: [{"a":1},{"b":2}]
     35-- Running test case: WI.ObjectStore.prototype.putObject.AutoIncrementWithoutKeyPath
     36putObject: [{"a":1}]
     37putObject: [{"a":1},{"b":2}]
    3838[{"a":1},{"b":2}]
    3939
    40 -- Running test case: WI.ObjectStore.prototype.addObject.KeyPathSetOnObjectWithoutAutoIncrement.Sub
    41 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
     41putObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1}]
     42putObject: [{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":99},"b":2}]
    4343[{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithoutAutoIncrement":{"Sub":99},"b":2}]
    4444
    45 -- Running test case: WI.ObjectStore.prototype.addObject.KeyPathMissingOnObjectWithAutoIncrement.Sub
    46 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
     46putObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}}]
     47putObject: [{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":2}}]
    4848[{"a":1,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":1}},{"b":2,"KeyPathMissingOnObjectWithAutoIncrement":{"Sub":2}}]
    4949
    50 -- Running test case: WI.ObjectStore.prototype.addObject.KeyPathSetOnObjectWithAutoIncrement.Sub
    51 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
     51putObject: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1}]
     52putObject: [{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":99},"b":2}]
    5353[{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":42},"a":1},{"KeyPathSetOnObjectWithAutoIncrement":{"Sub":99},"b":2}]
    5454
  • trunk/LayoutTests/inspector/unit-tests/objectStore/putObject.html

    r243225 r243226  
    77function test()
    88{
    9     let suite = InspectorTest.ObjectStore.createSuite("WI.ObjectStore.prototype.addObject");
     9    let suite = InspectorTest.ObjectStore.createSuite("WI.ObjectStore.prototype.putObject");
    1010
    11     function testAddObject(name, {options, tests}) {
     11    function testPutObject(name, {options, tests}) {
    1212        InspectorTest.ObjectStore.wrapTest(name, async function() {
    1313            InspectorTest.ObjectStore.createObjectStore(options);
    1414
    1515            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);
    1717        });
    1818    }
    1919
    20     InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype.addObject.NoParameters", async function() {
     20    InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype.putObject.NoParameters", async function() {
    2121        let objectStore = InspectorTest.ObjectStore.createObjectStore();
    2222
    2323        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));
    2626        });
    2727    });
    2828
    29     InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype.addObject.WithoutKeyPathOrAutoIncrement", async function() {
     29    InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype.putObject.WithoutKeyPathOrAutoIncrement", async function() {
    3030        let objectStore = InspectorTest.ObjectStore.createObjectStore();
    3131
    3232        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));
    3535        });
    3636    });
    3737
    38     InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype.addObject.KeyPathMissingOnObjectWithoutAutoIncrement", async function() {
     38    InspectorTest.ObjectStore.wrapTest("WI.ObjectStore.prototype.putObject.KeyPathMissingOnObjectWithoutAutoIncrement", async function() {
    3939        const options = {
    4040            keyPath: "KeyPathMissingOnObjectWithoutAutoIncrement",
     
    4343
    4444        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));
    4747        });
    4848    });
    4949
    50     testAddObject("WI.ObjectStore.prototype.addObject.KeyPathSetOnObjectWithoutAutoIncrement", {
     50    testPutObject("WI.ObjectStore.prototype.putObject.KeyPathSetOnObjectWithoutAutoIncrement", {
    5151        options: {keyPath: "KeyPathSetOnObjectWithoutAutoIncrement"},
    5252        tests: [
     
    5656    });
    5757
    58     testAddObject("WI.ObjectStore.prototype.addObject.KeyPathMissingOnObjectWithAutoIncrement", {
     58    testPutObject("WI.ObjectStore.prototype.putObject.KeyPathMissingOnObjectWithAutoIncrement", {
    5959        options: {keyPath: "KeyPathMissingOnObjectWithAutoIncrement", autoIncrement: true},
    6060        tests: [
     
    6464    });
    6565
    66     testAddObject("WI.ObjectStore.prototype.addObject.KeyPathSetOnObjectWithAutoIncrement", {
     66    testPutObject("WI.ObjectStore.prototype.putObject.KeyPathSetOnObjectWithAutoIncrement", {
    6767        options: {keyPath: "KeyPathSetOnObjectWithAutoIncrement", autoIncrement: true},
    6868        tests: [
     
    7272    });
    7373
    74     testAddObject("WI.ObjectStore.prototype.addObject.AutoIncrementWithoutKeyPath", {
     74    testPutObject("WI.ObjectStore.prototype.putObject.AutoIncrementWithoutKeyPath", {
    7575        options: {autoIncrement: true},
    7676        tests: [
     
    8080    });
    8181
    82     testAddObject("WI.ObjectStore.prototype.addObject.KeyPathSetOnObjectWithoutAutoIncrement.Sub", {
     82    testPutObject("WI.ObjectStore.prototype.putObject.KeyPathSetOnObjectWithoutAutoIncrement.Sub", {
    8383        options: {keyPath: "KeyPathSetOnObjectWithoutAutoIncrement.Sub"},
    8484        tests: [
     
    8888    });
    8989
    90     testAddObject("WI.ObjectStore.prototype.addObject.KeyPathMissingOnObjectWithAutoIncrement.Sub", {
     90    testPutObject("WI.ObjectStore.prototype.putObject.KeyPathMissingOnObjectWithAutoIncrement.Sub", {
    9191        options: {keyPath: "KeyPathMissingOnObjectWithAutoIncrement.Sub", autoIncrement: true},
    9292        tests: [
     
    9696    });
    9797
    98     testAddObject("WI.ObjectStore.prototype.addObject.KeyPathSetOnObjectWithAutoIncrement.Sub", {
     98    testPutObject("WI.ObjectStore.prototype.putObject.KeyPathSetOnObjectWithAutoIncrement.Sub", {
    9999        options: {keyPath: "KeyPathSetOnObjectWithAutoIncrement.Sub", autoIncrement: true},
    100100        tests: [
     
    109109</head>
    110110<body onload="runTest()">
    111     <p>Tests WI.ObjectStore.prototype.addObject.</p>
     111    <p>Tests WI.ObjectStore.prototype.putObject.</p>
    112112</body>
    113113</html>
  • trunk/LayoutTests/inspector/unit-tests/objectStore/resources/objectStore-utilities.js

    r237694 r243226  
    2626    };
    2727
    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);
    3030        InspectorTest.assert(result === expected, `the key of the added item should be ${expected}, but is actually ${result}`);
    3131
    32         await InspectorTest.ObjectStore.logValues("add: ");
     32        await InspectorTest.ObjectStore.logValues("put: ");
    3333        return result;
    3434    };
    3535
    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);
    3838        InspectorTest.assert(result === expected, `the key of the added item should be ${expected}, but is actually ${result}`);
    3939
     
    4141        InspectorTest.assert(resolved.value === expected, `the resolved keyPath on the object should equal ${expected}, but is actually ${resolved.value}`);
    4242
    43         await InspectorTest.ObjectStore.logValues("addObject: ");
     43        await InspectorTest.ObjectStore.logValues("putObject: ");
    4444        return result;
    4545    };
  • trunk/Source/WebInspectorUI/ChangeLog

    r243225 r243226  
     12019-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
    1502019-03-20  Devin Rousso  <drousso@apple.com>
    251
  • trunk/Source/WebInspectorUI/UserInterface/Base/ObjectStore.js

    r239858 r243226  
    3939    }
    4040
     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
    4149    static get _databaseName()
    4250    {
     
    6068        WI.ObjectStore._databaseCallbacks = [callback];
    6169
    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);
    6573        databaseRequest.addEventListener("upgradeneeded", (event) => {
    6674            let database = databaseRequest.result;
     
    98106    // Public
    99107
     108    get keyPath()
     109    {
     110        return (this._options || {}).keyPath;
     111    }
     112
    100113    associateObject(object, key, value)
    101114    {
     
    110123    {
    111124        if (!WI.ObjectStore.supported())
    112             return undefined;
     125            return [];
    113126
    114127        return this._operation("readonly", (objectStore) => objectStore.getAll(...args));
    115128    }
    116129
    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)
    126139    {
    127140        if (!WI.ObjectStore.supported())
     
    129142
    130143        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);
    132145        this.associateObject(object, args[0], result);
    133146        return result;
     
    229242WI.objectStores = {
    230243    audits: new WI.ObjectStore("audit-manager-tests", {keyPath: "__id", autoIncrement: true}),
     244    breakpoints: new WI.ObjectStore("debugger-breakpoints", {keyPath: "__id"}),
    231245};
  • trunk/Source/WebInspectorUI/UserInterface/Controllers/AuditManager.js

    r242808 r243226  
    117117                    saveDisabledDefaultTest(test);
    118118                else
    119                     WI.objectStores.audits.addObject(test);
     119                    WI.objectStores.audits.putObject(test);
    120120            }
    121121
     
    218218        if (object instanceof WI.AuditTestBase) {
    219219            this._addTest(object);
    220             WI.objectStores.audits.addObject(object);
     220            WI.objectStores.audits.putObject(object);
    221221        } else if (object instanceof WI.AuditTestResultBase)
    222222            this._addResult(object);
  • trunk/Source/WebInspectorUI/UserInterface/Controllers/BreakpointPopoverController.js

    r238743 r243226  
    292292        this._actionsContainer.removeChildren();
    293293
    294         let newAction = this._breakpoint.createAction(WI.Breakpoint.DefaultBreakpointActionType);
     294        let newAction = this._breakpoint.createAction(WI.BreakpointAction.Type.Log);
    295295        let newBreakpointActionView = new WI.BreakpointActionView(newAction, this);
    296296        this._popoverActionsInsertBreakpointActionView(newBreakpointActionView, -1);
  • trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js

    r242314 r243226  
    5151        WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
    5252
    53         this._breakpointsSetting = new WI.Setting("breakpoints", []);
    5453        this._breakpointsEnabledSetting = new WI.Setting("breakpoints-enabled", true);
    5554        this._allExceptionsBreakpointEnabledSetting = new WI.Setting("break-on-all-exceptions", false);
     
    101100        this._ignoreBreakpointDisplayLocationDidChangeEvent = false;
    102101
    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
    106111            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            }
    109120            this._restoringBreakpoints = false;
    110         });
     121        })();
    111122    }
    112123
     
    498509        }
    499510
    500         this._saveBreakpoints();
     511        if (!this._restoringBreakpoints)
     512            WI.objectStores.breakpoints.putObject(breakpoint);
    501513
    502514        this._addProbesForBreakpoint(breakpoint);
     
    548560        breakpoint.clearActions();
    549561
    550         this._saveBreakpoints();
     562        if (!this._restoringBreakpoints)
     563            WI.objectStores.breakpoints.deleteObject(breakpoint);
    551564
    552565        this._removeProbesForBreakpoint(breakpoint);
     
    893906        const templatePlaceholderRegex = /\$\{.*?\}/;
    894907
    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) => {
    899910            if (action.type !== WI.BreakpointAction.Type.Log)
    900                 continue;
     911                return true;
    901912
    902913            if (!templatePlaceholderRegex.test(action.data))
    903                 continue;
     914                return true;
    904915
    905916            let lexer = new WI.BreakpointLogMessageLexer;
    906917            let tokens = lexer.tokenize(action.data);
    907             if (!tokens) {
    908                 invalidActions.push(action);
    909                 continue;
    910             }
     918            if (!tokens)
     919                return false;
    911920
    912921            let templateLiteral = tokens.reduce((text, token) => {
     
    920929            action.data = "console.log(`" + templateLiteral + "`)";
    921930            action.type = WI.BreakpointAction.Type.Evaluate;
    922         }
    923 
    924         for (let invalidAction of invalidActions)
    925             options.actions.remove(invalidAction);
    926 
     931            return true;
     932        });
    927933        return options;
    928934    }
     
    970976        // NOTE: Breakpoint.options returns new objects each time, so it is safe to modify.
    971977        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);
    976980
    977981        if (breakpoint.contentIdentifier) {
     
    10471051    _breakpointDisabledStateDidChange(event)
    10481052    {
    1049         this._saveBreakpoints();
    1050 
    10511053        let breakpoint = event.target;
     1054
    10521055        if (breakpoint === this._allExceptionsBreakpoint) {
    10531056            if (!breakpoint.disabled && !this.breakpointsDisabledTemporarily)
     
    10791082        }
    10801083
     1084        if (!this._restoringBreakpoints)
     1085            WI.objectStores.breakpoints.putObject(breakpoint);
     1086
    10811087        if (breakpoint.disabled)
    10821088            this._removeBreakpoint(breakpoint);
     
    10871093    _breakpointEditablePropertyDidChange(event)
    10881094    {
    1089         this._saveBreakpoints();
    1090 
    10911095        let breakpoint = event.target;
     1096
     1097        if (!this._restoringBreakpoints)
     1098            WI.objectStores.breakpoints.putObject(breakpoint);
     1099
    10921100        if (breakpoint.disabled)
    10931101            return;
     
    12481256            break;
    12491257        }
    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;
    12601258    }
    12611259
  • trunk/Source/WebInspectorUI/UserInterface/Models/Breakpoint.js

    r220119 r243226  
    191191    }
    192192
    193     get options()
    194     {
    195         return {
    196             condition: this._condition,
    197             ignoreCount: this._ignoreCount,
    198             actions: this._serializableActions(),
    199             autoContinue: this._autoContinue
    200         };
    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._autoContinue
    215         };
    216     }
    217 
    218193    get probeActions()
    219194    {
     
    308283    saveIdentityToCookie(cookie)
    309284    {
    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;
    313313    }
    314314
     
    327327    // Private
    328328
    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 
    337329    _sourceCodeLocationLocationChanged(event)
    338330    {
     
    346338};
    347339
    348 WI.Breakpoint.DefaultBreakpointActionType = WI.BreakpointAction.Type.Log;
    349 
    350340WI.Breakpoint.TypeIdentifier = "breakpoint";
    351 WI.Breakpoint.ContentIdentifierCookieKey = "breakpoint-content-identifier";
    352 WI.Breakpoint.LineNumberCookieKey = "breakpoint-line-number";
    353 WI.Breakpoint.ColumnNumberCookieKey = "breakpoint-column-number";
    354341
    355342WI.Breakpoint.Event = {
  • trunk/Source/WebInspectorUI/UserInterface/Models/BreakpointAction.js

    r220119 r243226  
    6767    }
    6868
    69     get info()
     69    toJSON()
    7070    {
    71         var obj = {type: this._type, id: this._id};
     71        let json = {
     72            type: this._type,
     73            id: this._id,
     74        };
    7275        if (this._data)
    73             obj.data = this._data;
    74         return obj;
     76            json.data = this._data;
     77        return json;
    7578    }
    7679};
Note: See TracChangeset for help on using the changeset viewer.