haikuwebkit/LayoutTests/inspector/storage/setDOMStorageItem.html

53 lines
1.8 KiB
HTML
Raw Permalink Normal View History

Web Inspector: Storage: cannot clear out multiple or all local storage entries https://bugs.webkit.org/show_bug.cgi?id=209867 Reviewed by Timothy Hatcher. Source/JavaScriptCore: * inspector/protocol/DOMStorage.json: Add a `clearDOMStorageItems` command instead of calling `removeDOMStorageItem` for each key. Source/WebCore: Tests: inspector/storage/clearDOMStorageItems.html inspector/storage/getDOMStorageItems.html inspector/storage/removeDOMStorageItem.html inspector/storage/setDOMStorageItem.html * inspector/agents/InspectorDOMStorageAgent.h: * inspector/agents/InspectorDOMStorageAgent.cpp: (WebCore::InspectorDOMStorageAgent::clearDOMStorageItems): Added. Add a `clearDOMStorageItems` command instead of calling `removeDOMStorageItem` for each key. Source/WebInspectorUI: * UserInterface/Models/DOMStorageObject.js: (WI.DOMStorageObject.prototype.removeItem): (WI.DOMStorageObject.prototype.setItem): (WI.DOMStorageObject.prototype.clear): Added. (WI.DOMStorageObject.prototype.itemsCleared): (WI.DOMStorageObject.prototype.itemRemoved): (WI.DOMStorageObject.prototype.itemAdded): (WI.DOMStorageObject.prototype.itemUpdated): Add some assertions. * UserInterface/Views/DOMStorageContentView.js: (WI.DOMStorageContentView): (WI.DOMStorageContentView.prototype.get navigationItems): (WI.DOMStorageContentView.prototype._handleClearNavigationItemClicked): Added. Add a "Clear" navigation item that calls the new `DOMStorage.clearDOMStorageItems`. * UserInterface/Views/DataGrid.js: (WI.DataGrid.prototype.removeChild): If the removed item was selected, select the next (or previous if there is no next) item. * UserInterface/Views/CookieStorageContentView.js: (WI.CookieStorageContentView): (WI.CookieStorageContentView.prototype.get navigationItems): (WI.CookieStorageContentView.prototype._handleClearNavigationItemClicked): Added. Drive-by: also add a "Clear" navigation item that calls `Page.deleteCookie` for each row. * UserInterface/Protocol/DOMStorageObserver.js: (WI.DOMStorageObserver.prototype.domStorageItemUpdated): * UserInterface/Controllers/DOMStorageManager.js: (WI.DOMStorageManager.prototype.itemUpdated): Drive-by: rename `value` to `newValue` to match the protocol. * Localizations/en.lproj/localizedStrings.js: LayoutTests: * inspector/storage/clearDOMStorageItems.html: Added. * inspector/storage/clearDOMStorageItems-expected.txt: Added. * inspector/storage/domStorage-events.html: * inspector/storage/domStorage-events-expected.txt: * inspector/storage/getDOMStorageItems.html: Added. * inspector/storage/getDOMStorageItems-expected.txt: Added. * inspector/storage/removeDOMStorageItem.html: Added. * inspector/storage/removeDOMStorageItem-expected.txt: Added. * inspector/storage/setDOMStorageItem.html: Added. * inspector/storage/setDOMStorageItem-expected.txt: Added. * inspector/storage/resources/storage-utilities.js: Added. (clearStorages): (TestPage.registerInitializer.InspectorTest.Storage.async logEntries): Canonical link: https://commits.webkit.org/223107@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259744 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-04-08 19:16:34 +00:00
<!DOCTYPE html>
<html>
<head>
<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
<script src="resources/storage-utilities.js"></script>
<script>
function test()
{
let suite = InspectorTest.createAsyncSuite("DOMStorage.setDOMStorageItem");
suite.addTestCase({
name: "DOMStorage.setDOMStorageItem.Session",
description: "Test that DOMStorage.setDOMStorageItem works with Session storage.",
async test() {
let sessionStorage = WI.domStorageManager.domStorageObjects.find((x) => !x.isLocalStorage());
InspectorTest.expectThat(sessionStorage, "Should have a DOMStorageObject for sessionStorage.");
await InspectorTest.Storage.logEntries(sessionStorage);
InspectorTest.log("Setting key 'asd' with value 'new'...");
await sessionStorage.setItem("asd", "new");
await InspectorTest.Storage.logEntries(sessionStorage);
},
});
suite.addTestCase({
name: "DOMStorage.setDOMStorageItem.Local",
description: "Test that DOMStorage.setDOMStorageItem works with Local storage.",
async test() {
let localStorage = WI.domStorageManager.domStorageObjects.find((x) => x.isLocalStorage());
InspectorTest.expectThat(localStorage, "Should have a DOMStorageObject for localStorage.");
await InspectorTest.Storage.logEntries(localStorage);
InspectorTest.log("Setting key 'asd' with value 'new'...");
await localStorage.setItem("asd", "new");
await InspectorTest.Storage.logEntries(localStorage);
},
});
InspectorTest.evaluateInPage("clearStorages()", () => {
suite.runTestCasesAndFinish();
});
}
</script>
</head>
<body onload="runTest()">
<p>Tests for DOMStorage.setDOMStorageItem.</p>
</body>
</html>