haikuwebkit/LayoutTests/inspector/unit-tests/resource-collection.html

88 lines
3.2 KiB
HTML
Raw Permalink Normal View History

Web Inspector: Create general model object Collection class https://bugs.webkit.org/show_bug.cgi?id=163995 Patch by Devin Rousso <dcrousso+webkit@gmail.com> on 2016-10-27 Reviewed by Joseph Pecoraro. Source/WebInspectorUI: * UserInterface/Models/Collection.js: Added. (WebInspector.Collection): (WebInspector.Collection.prototype.get items): (WebInspector.Collection.prototype.get typeVerifier): (WebInspector.Collection.prototype.add): (WebInspector.Collection.prototype.remove): (WebInspector.Collection.prototype.clear): (WebInspector.Collection.prototype.toArray): (WebInspector.Collection.prototype.toJSON): (WebInspector.Collection.prototype.itemAdded): (WebInspector.Collection.prototype.itemRemoved): (WebInspector.Collection.prototype.itemsCleared): Class that holds multiple model objects. It can be limited to a specific type by supplying a "typeVerifier", which is a function that accepts a single argument (the model object) and returns true/false depending on if that argument matches the "type" of the collection. * UserInterface/Main.html: * UserInterface/Test.html: * UserInterface/Models/Frame.js: * UserInterface/Views/CookieStorageContentView.js: * UserInterface/Views/DebuggerSidebarPanel.js: * UserInterface/Views/FrameTreeElement.js: * UserInterface/Views/OpenResourceDialog.js: Add support for WebInspector.Collection. * UserInterface/Models/ResourceCollection.js: (WebInspector.ResourceCollection): (WebInspector.ResourceCollection.verifierForType): (WebInspector.ResourceCollection.prototype.resourceCollectionForType): (WebInspector.ResourceCollection.prototype.clear): (WebInspector.ResourceCollection.prototype.itemAdded): (WebInspector.ResourceCollection.prototype.itemRemoved): (WebInspector.ResourceCollection.prototype.itemsCleared): (WebInspector.ResourceCollection.prototype._associateWithResource): (WebInspector.ResourceCollection.prototype._disassociateWithResource): (WebInspector.ResourceCollection.prototype._resourceURLDidChange): (WebInspector.ResourceCollection.prototype._resourceTypeDidChange): (WebInspector.ResourceCollection.prototype.get resources): Deleted. (WebInspector.ResourceCollection.prototype.resourcesWithType): Deleted. (WebInspector.ResourceCollection.prototype.addResource): Deleted. (WebInspector.ResourceCollection.prototype.removeResource): Deleted. (WebInspector.ResourceCollection.prototype.removeAllResources): Deleted. Now a subclass of WebInspector.Collection. Retrieving WebInspector.Resource objects by type and URL is still supported, but requesting by type now returns another instance of WebInspector.ResourceCollection that is configured to only accept the requested type. LayoutTests: * inspector/debugger/resources/log-pause-location.js: (TestPage.registerInitializer.window.findScript): Change name of getter to support WebInspector.Collection. * inspector/unit-tests/collection-expected.txt: Added. * inspector/unit-tests/collection.html: Added. * inspector/unit-tests/resource-collection-expected.txt: Added. * inspector/unit-tests/resource-collection.html: Added. Created tests for WebInspector.Collection and WebInspector.ResourceCollection. Canonical link: https://commits.webkit.org/181800@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208012 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-27 22:25:24 +00:00
<!doctype html>
<html>
<head>
<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
<script>
function test()
{
let suite = InspectorTest.createAsyncSuite("ResourceCollection");
function createResource(url, type) {
return new WI.Resource(url, {type});
Web Inspector: Create general model object Collection class https://bugs.webkit.org/show_bug.cgi?id=163995 Patch by Devin Rousso <dcrousso+webkit@gmail.com> on 2016-10-27 Reviewed by Joseph Pecoraro. Source/WebInspectorUI: * UserInterface/Models/Collection.js: Added. (WebInspector.Collection): (WebInspector.Collection.prototype.get items): (WebInspector.Collection.prototype.get typeVerifier): (WebInspector.Collection.prototype.add): (WebInspector.Collection.prototype.remove): (WebInspector.Collection.prototype.clear): (WebInspector.Collection.prototype.toArray): (WebInspector.Collection.prototype.toJSON): (WebInspector.Collection.prototype.itemAdded): (WebInspector.Collection.prototype.itemRemoved): (WebInspector.Collection.prototype.itemsCleared): Class that holds multiple model objects. It can be limited to a specific type by supplying a "typeVerifier", which is a function that accepts a single argument (the model object) and returns true/false depending on if that argument matches the "type" of the collection. * UserInterface/Main.html: * UserInterface/Test.html: * UserInterface/Models/Frame.js: * UserInterface/Views/CookieStorageContentView.js: * UserInterface/Views/DebuggerSidebarPanel.js: * UserInterface/Views/FrameTreeElement.js: * UserInterface/Views/OpenResourceDialog.js: Add support for WebInspector.Collection. * UserInterface/Models/ResourceCollection.js: (WebInspector.ResourceCollection): (WebInspector.ResourceCollection.verifierForType): (WebInspector.ResourceCollection.prototype.resourceCollectionForType): (WebInspector.ResourceCollection.prototype.clear): (WebInspector.ResourceCollection.prototype.itemAdded): (WebInspector.ResourceCollection.prototype.itemRemoved): (WebInspector.ResourceCollection.prototype.itemsCleared): (WebInspector.ResourceCollection.prototype._associateWithResource): (WebInspector.ResourceCollection.prototype._disassociateWithResource): (WebInspector.ResourceCollection.prototype._resourceURLDidChange): (WebInspector.ResourceCollection.prototype._resourceTypeDidChange): (WebInspector.ResourceCollection.prototype.get resources): Deleted. (WebInspector.ResourceCollection.prototype.resourcesWithType): Deleted. (WebInspector.ResourceCollection.prototype.addResource): Deleted. (WebInspector.ResourceCollection.prototype.removeResource): Deleted. (WebInspector.ResourceCollection.prototype.removeAllResources): Deleted. Now a subclass of WebInspector.Collection. Retrieving WebInspector.Resource objects by type and URL is still supported, but requesting by type now returns another instance of WebInspector.ResourceCollection that is configured to only accept the requested type. LayoutTests: * inspector/debugger/resources/log-pause-location.js: (TestPage.registerInitializer.window.findScript): Change name of getter to support WebInspector.Collection. * inspector/unit-tests/collection-expected.txt: Added. * inspector/unit-tests/collection.html: Added. * inspector/unit-tests/resource-collection-expected.txt: Added. * inspector/unit-tests/resource-collection.html: Added. Created tests for WebInspector.Collection and WebInspector.ResourceCollection. Canonical link: https://commits.webkit.org/181800@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208012 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-27 22:25:24 +00:00
}
function logResourceNames(collection) {
Web Inspector: simplify the WI.Collection interface https://bugs.webkit.org/show_bug.cgi?id=185187 Reviewed by Brian Burg. Source/WebInspectorUI: * UserInterface/Models/Collection.js: (WI.Collection.prototype.get size): Added. (WI.Collection.prototype.has): Added. (WI.Collection.prototype.toJSON): (WI.Collection.prototype.[Symbol.iterator]): Added. (WI.Collection.prototype.get items): Deleted. (WI.Collection.prototype.toArray): Deleted. * UserInterface/Controllers/CanvasManager.js: (WI.CanvasManager.prototype._removeCanvas): * UserInterface/Controllers/DOMDebuggerManager.js: (WebInspector.DOMDebuggerManager.prototype.get domBreakpoints): * UserInterface/Models/Frame.js: (WI.Frame.prototype.removeAllChildFrames): (WI.Frame.prototype.resourceForURL): (WI.Frame.prototype.removeAllResources): * UserInterface/Models/Script.js: (WI.Script): * UserInterface/Views/CanvasContentView.js: (WI.CanvasContentView.prototype.initialLayout): * UserInterface/Views/CanvasOverviewContentView.js: (WI.CanvasOverviewContentView.prototype._updateNavigationItems): * UserInterface/Views/CanvasSidebarPanel.js: (WI.CanvasSidebarPanel.prototype._recordingRemoved): (WI.CanvasSidebarPanel.prototype._canvasChanged): (WI.CanvasSidebarPanel.prototype._updateRecordingScopeBar): * UserInterface/Views/CanvasTabContentView.js: (WI.CanvasTabContentView.prototype.attached): (WI.CanvasTabContentView.prototype._addCanvas): (WI.CanvasTabContentView.prototype._removeCanvas): * UserInterface/Views/CanvasTreeElement.js: (WI.CanvasTreeElement.prototype.onpopulate): * UserInterface/Views/CollectionContentView.js: (WI.CollectionContentView.prototype.initialLayout): (WI.CollectionContentView.prototype.attached): * UserInterface/Views/CookieStorageContentView.js: (WI.CookieStorageContentView.prototype._filterCookies): * UserInterface/Views/DebuggerSidebarPanel.js: (WI.DebuggerSidebarPanel.prototype._addResourcesRecursivelyForFrame): * UserInterface/Views/FolderizedTreeElement.js: (WI.FolderizedTreeElement.prototype.updateParentStatus): (WI.FolderizedTreeElement.prototype._shouldGroupIntoFolders): * UserInterface/Views/FrameTreeElement.js: (WI.FrameTreeElement.prototype.onpopulate): * UserInterface/Views/NavigationSidebarPanel.js: (WI.NavigationSidebarPanel.prototype.get contentTreeOutlines): * UserInterface/Views/NetworkTableContentView.js: (WI.NetworkTableContentView.prototype._populateWithInitialResourcesIfNeeded): * UserInterface/Views/OpenResourceDialog.js: (WI.OpenResourceDialog.prototype._addResourcesForFrame): (WI.OpenResourceDialog.prototype._addResourcesForTarget): * UserInterface/Views/TreeOutlineGroup.js: (WI.TreeOutlineGroup.prototype.get selectedTreeElement): (WI.TreeOutlineGroup.prototype._removeConflictingTreeSelections): * UserInterface/Views/WorkerTreeElement.js: (WI.WorkerTreeElement.prototype.onpopulate): LayoutTests: * http/tests/inspector/dom/cross-domain-inspected-node-access.html: * http/tests/inspector/dom/disconnect-dom-tree-after-main-frame-navigation.html: * http/tests/inspector/network/har/har-page.html: * http/tests/inspector/network/har/har-page-expected.txt: * http/tests/inspector/network/resource-response-source-memory-cache-revalidate-expired-only.html: * http/tests/inspector/network/resource-response-source-memory-cache.html: * http/tests/inspector/network/resource-sizes-memory-cache.html: * http/tests/inspector/network/set-resource-caching-disabled-memory-cache.html: * http/tests/inspector/worker/blob-script-with-cross-domain-imported-scripts.html: * http/tests/websocket/tests/hybi/inspector/before-load.html: * inspector/canvas/resources/recording-utilities.js: * inspector/css/manager-preferredInspectorStyleSheetForFrame.html: * inspector/debugger/resources/log-pause-location.js: (TestPage.registerInitializer.window.findScript): * inspector/dom/highlightFrame.html: * inspector/dom/highlightNode.html: * inspector/dom/highlightNodeList.html: * inspector/dom/highlightSelector.html: * inspector/model/frame-extra-scripts.html: * inspector/page/empty-or-missing-resources.html: * inspector/unit-tests/resource-collection.html: * inspector/worker/resources-in-worker.html: Canonical link: https://commits.webkit.org/200824@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231391 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-05-04 23:56:10 +00:00
InspectorTest.log(Array.from(collection).map((resource) => resource.displayName));
Web Inspector: Create general model object Collection class https://bugs.webkit.org/show_bug.cgi?id=163995 Patch by Devin Rousso <dcrousso+webkit@gmail.com> on 2016-10-27 Reviewed by Joseph Pecoraro. Source/WebInspectorUI: * UserInterface/Models/Collection.js: Added. (WebInspector.Collection): (WebInspector.Collection.prototype.get items): (WebInspector.Collection.prototype.get typeVerifier): (WebInspector.Collection.prototype.add): (WebInspector.Collection.prototype.remove): (WebInspector.Collection.prototype.clear): (WebInspector.Collection.prototype.toArray): (WebInspector.Collection.prototype.toJSON): (WebInspector.Collection.prototype.itemAdded): (WebInspector.Collection.prototype.itemRemoved): (WebInspector.Collection.prototype.itemsCleared): Class that holds multiple model objects. It can be limited to a specific type by supplying a "typeVerifier", which is a function that accepts a single argument (the model object) and returns true/false depending on if that argument matches the "type" of the collection. * UserInterface/Main.html: * UserInterface/Test.html: * UserInterface/Models/Frame.js: * UserInterface/Views/CookieStorageContentView.js: * UserInterface/Views/DebuggerSidebarPanel.js: * UserInterface/Views/FrameTreeElement.js: * UserInterface/Views/OpenResourceDialog.js: Add support for WebInspector.Collection. * UserInterface/Models/ResourceCollection.js: (WebInspector.ResourceCollection): (WebInspector.ResourceCollection.verifierForType): (WebInspector.ResourceCollection.prototype.resourceCollectionForType): (WebInspector.ResourceCollection.prototype.clear): (WebInspector.ResourceCollection.prototype.itemAdded): (WebInspector.ResourceCollection.prototype.itemRemoved): (WebInspector.ResourceCollection.prototype.itemsCleared): (WebInspector.ResourceCollection.prototype._associateWithResource): (WebInspector.ResourceCollection.prototype._disassociateWithResource): (WebInspector.ResourceCollection.prototype._resourceURLDidChange): (WebInspector.ResourceCollection.prototype._resourceTypeDidChange): (WebInspector.ResourceCollection.prototype.get resources): Deleted. (WebInspector.ResourceCollection.prototype.resourcesWithType): Deleted. (WebInspector.ResourceCollection.prototype.addResource): Deleted. (WebInspector.ResourceCollection.prototype.removeResource): Deleted. (WebInspector.ResourceCollection.prototype.removeAllResources): Deleted. Now a subclass of WebInspector.Collection. Retrieving WebInspector.Resource objects by type and URL is still supported, but requesting by type now returns another instance of WebInspector.ResourceCollection that is configured to only accept the requested type. LayoutTests: * inspector/debugger/resources/log-pause-location.js: (TestPage.registerInitializer.window.findScript): Change name of getter to support WebInspector.Collection. * inspector/unit-tests/collection-expected.txt: Added. * inspector/unit-tests/collection.html: Added. * inspector/unit-tests/resource-collection-expected.txt: Added. * inspector/unit-tests/resource-collection.html: Added. Created tests for WebInspector.Collection and WebInspector.ResourceCollection. Canonical link: https://commits.webkit.org/181800@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208012 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-27 22:25:24 +00:00
}
suite.addTestCase({
name: "WI.ResourceCollection.verifierForType",
Web Inspector: Create general model object Collection class https://bugs.webkit.org/show_bug.cgi?id=163995 Patch by Devin Rousso <dcrousso+webkit@gmail.com> on 2016-10-27 Reviewed by Joseph Pecoraro. Source/WebInspectorUI: * UserInterface/Models/Collection.js: Added. (WebInspector.Collection): (WebInspector.Collection.prototype.get items): (WebInspector.Collection.prototype.get typeVerifier): (WebInspector.Collection.prototype.add): (WebInspector.Collection.prototype.remove): (WebInspector.Collection.prototype.clear): (WebInspector.Collection.prototype.toArray): (WebInspector.Collection.prototype.toJSON): (WebInspector.Collection.prototype.itemAdded): (WebInspector.Collection.prototype.itemRemoved): (WebInspector.Collection.prototype.itemsCleared): Class that holds multiple model objects. It can be limited to a specific type by supplying a "typeVerifier", which is a function that accepts a single argument (the model object) and returns true/false depending on if that argument matches the "type" of the collection. * UserInterface/Main.html: * UserInterface/Test.html: * UserInterface/Models/Frame.js: * UserInterface/Views/CookieStorageContentView.js: * UserInterface/Views/DebuggerSidebarPanel.js: * UserInterface/Views/FrameTreeElement.js: * UserInterface/Views/OpenResourceDialog.js: Add support for WebInspector.Collection. * UserInterface/Models/ResourceCollection.js: (WebInspector.ResourceCollection): (WebInspector.ResourceCollection.verifierForType): (WebInspector.ResourceCollection.prototype.resourceCollectionForType): (WebInspector.ResourceCollection.prototype.clear): (WebInspector.ResourceCollection.prototype.itemAdded): (WebInspector.ResourceCollection.prototype.itemRemoved): (WebInspector.ResourceCollection.prototype.itemsCleared): (WebInspector.ResourceCollection.prototype._associateWithResource): (WebInspector.ResourceCollection.prototype._disassociateWithResource): (WebInspector.ResourceCollection.prototype._resourceURLDidChange): (WebInspector.ResourceCollection.prototype._resourceTypeDidChange): (WebInspector.ResourceCollection.prototype.get resources): Deleted. (WebInspector.ResourceCollection.prototype.resourcesWithType): Deleted. (WebInspector.ResourceCollection.prototype.addResource): Deleted. (WebInspector.ResourceCollection.prototype.removeResource): Deleted. (WebInspector.ResourceCollection.prototype.removeAllResources): Deleted. Now a subclass of WebInspector.Collection. Retrieving WebInspector.Resource objects by type and URL is still supported, but requesting by type now returns another instance of WebInspector.ResourceCollection that is configured to only accept the requested type. LayoutTests: * inspector/debugger/resources/log-pause-location.js: (TestPage.registerInitializer.window.findScript): Change name of getter to support WebInspector.Collection. * inspector/unit-tests/collection-expected.txt: Added. * inspector/unit-tests/collection.html: Added. * inspector/unit-tests/resource-collection-expected.txt: Added. * inspector/unit-tests/resource-collection.html: Added. Created tests for WebInspector.Collection and WebInspector.ResourceCollection. Canonical link: https://commits.webkit.org/181800@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208012 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-27 22:25:24 +00:00
test(resolve, reject) {
let collection = new WI.ResourceCollection(WI.Resource.Type.Image);
Web Inspector: Create general model object Collection class https://bugs.webkit.org/show_bug.cgi?id=163995 Patch by Devin Rousso <dcrousso+webkit@gmail.com> on 2016-10-27 Reviewed by Joseph Pecoraro. Source/WebInspectorUI: * UserInterface/Models/Collection.js: Added. (WebInspector.Collection): (WebInspector.Collection.prototype.get items): (WebInspector.Collection.prototype.get typeVerifier): (WebInspector.Collection.prototype.add): (WebInspector.Collection.prototype.remove): (WebInspector.Collection.prototype.clear): (WebInspector.Collection.prototype.toArray): (WebInspector.Collection.prototype.toJSON): (WebInspector.Collection.prototype.itemAdded): (WebInspector.Collection.prototype.itemRemoved): (WebInspector.Collection.prototype.itemsCleared): Class that holds multiple model objects. It can be limited to a specific type by supplying a "typeVerifier", which is a function that accepts a single argument (the model object) and returns true/false depending on if that argument matches the "type" of the collection. * UserInterface/Main.html: * UserInterface/Test.html: * UserInterface/Models/Frame.js: * UserInterface/Views/CookieStorageContentView.js: * UserInterface/Views/DebuggerSidebarPanel.js: * UserInterface/Views/FrameTreeElement.js: * UserInterface/Views/OpenResourceDialog.js: Add support for WebInspector.Collection. * UserInterface/Models/ResourceCollection.js: (WebInspector.ResourceCollection): (WebInspector.ResourceCollection.verifierForType): (WebInspector.ResourceCollection.prototype.resourceCollectionForType): (WebInspector.ResourceCollection.prototype.clear): (WebInspector.ResourceCollection.prototype.itemAdded): (WebInspector.ResourceCollection.prototype.itemRemoved): (WebInspector.ResourceCollection.prototype.itemsCleared): (WebInspector.ResourceCollection.prototype._associateWithResource): (WebInspector.ResourceCollection.prototype._disassociateWithResource): (WebInspector.ResourceCollection.prototype._resourceURLDidChange): (WebInspector.ResourceCollection.prototype._resourceTypeDidChange): (WebInspector.ResourceCollection.prototype.get resources): Deleted. (WebInspector.ResourceCollection.prototype.resourcesWithType): Deleted. (WebInspector.ResourceCollection.prototype.addResource): Deleted. (WebInspector.ResourceCollection.prototype.removeResource): Deleted. (WebInspector.ResourceCollection.prototype.removeAllResources): Deleted. Now a subclass of WebInspector.Collection. Retrieving WebInspector.Resource objects by type and URL is still supported, but requesting by type now returns another instance of WebInspector.ResourceCollection that is configured to only accept the requested type. LayoutTests: * inspector/debugger/resources/log-pause-location.js: (TestPage.registerInitializer.window.findScript): Change name of getter to support WebInspector.Collection. * inspector/unit-tests/collection-expected.txt: Added. * inspector/unit-tests/collection.html: Added. * inspector/unit-tests/resource-collection-expected.txt: Added. * inspector/unit-tests/resource-collection.html: Added. Created tests for WebInspector.Collection and WebInspector.ResourceCollection. Canonical link: https://commits.webkit.org/181800@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208012 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-27 22:25:24 +00:00
collection.add(createResource("one"));
collection.add(createResource("two", WI.Resource.Type.Image));
Web Inspector: Create general model object Collection class https://bugs.webkit.org/show_bug.cgi?id=163995 Patch by Devin Rousso <dcrousso+webkit@gmail.com> on 2016-10-27 Reviewed by Joseph Pecoraro. Source/WebInspectorUI: * UserInterface/Models/Collection.js: Added. (WebInspector.Collection): (WebInspector.Collection.prototype.get items): (WebInspector.Collection.prototype.get typeVerifier): (WebInspector.Collection.prototype.add): (WebInspector.Collection.prototype.remove): (WebInspector.Collection.prototype.clear): (WebInspector.Collection.prototype.toArray): (WebInspector.Collection.prototype.toJSON): (WebInspector.Collection.prototype.itemAdded): (WebInspector.Collection.prototype.itemRemoved): (WebInspector.Collection.prototype.itemsCleared): Class that holds multiple model objects. It can be limited to a specific type by supplying a "typeVerifier", which is a function that accepts a single argument (the model object) and returns true/false depending on if that argument matches the "type" of the collection. * UserInterface/Main.html: * UserInterface/Test.html: * UserInterface/Models/Frame.js: * UserInterface/Views/CookieStorageContentView.js: * UserInterface/Views/DebuggerSidebarPanel.js: * UserInterface/Views/FrameTreeElement.js: * UserInterface/Views/OpenResourceDialog.js: Add support for WebInspector.Collection. * UserInterface/Models/ResourceCollection.js: (WebInspector.ResourceCollection): (WebInspector.ResourceCollection.verifierForType): (WebInspector.ResourceCollection.prototype.resourceCollectionForType): (WebInspector.ResourceCollection.prototype.clear): (WebInspector.ResourceCollection.prototype.itemAdded): (WebInspector.ResourceCollection.prototype.itemRemoved): (WebInspector.ResourceCollection.prototype.itemsCleared): (WebInspector.ResourceCollection.prototype._associateWithResource): (WebInspector.ResourceCollection.prototype._disassociateWithResource): (WebInspector.ResourceCollection.prototype._resourceURLDidChange): (WebInspector.ResourceCollection.prototype._resourceTypeDidChange): (WebInspector.ResourceCollection.prototype.get resources): Deleted. (WebInspector.ResourceCollection.prototype.resourcesWithType): Deleted. (WebInspector.ResourceCollection.prototype.addResource): Deleted. (WebInspector.ResourceCollection.prototype.removeResource): Deleted. (WebInspector.ResourceCollection.prototype.removeAllResources): Deleted. Now a subclass of WebInspector.Collection. Retrieving WebInspector.Resource objects by type and URL is still supported, but requesting by type now returns another instance of WebInspector.ResourceCollection that is configured to only accept the requested type. LayoutTests: * inspector/debugger/resources/log-pause-location.js: (TestPage.registerInitializer.window.findScript): Change name of getter to support WebInspector.Collection. * inspector/unit-tests/collection-expected.txt: Added. * inspector/unit-tests/collection.html: Added. * inspector/unit-tests/resource-collection-expected.txt: Added. * inspector/unit-tests/resource-collection.html: Added. Created tests for WebInspector.Collection and WebInspector.ResourceCollection. Canonical link: https://commits.webkit.org/181800@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208012 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-27 22:25:24 +00:00
collection.add(3);
logResourceNames(collection);
resolve();
}
});
suite.addTestCase({
name: "WI.ResourceCollection.prototype.resourceCollectionForType",
Web Inspector: Create general model object Collection class https://bugs.webkit.org/show_bug.cgi?id=163995 Patch by Devin Rousso <dcrousso+webkit@gmail.com> on 2016-10-27 Reviewed by Joseph Pecoraro. Source/WebInspectorUI: * UserInterface/Models/Collection.js: Added. (WebInspector.Collection): (WebInspector.Collection.prototype.get items): (WebInspector.Collection.prototype.get typeVerifier): (WebInspector.Collection.prototype.add): (WebInspector.Collection.prototype.remove): (WebInspector.Collection.prototype.clear): (WebInspector.Collection.prototype.toArray): (WebInspector.Collection.prototype.toJSON): (WebInspector.Collection.prototype.itemAdded): (WebInspector.Collection.prototype.itemRemoved): (WebInspector.Collection.prototype.itemsCleared): Class that holds multiple model objects. It can be limited to a specific type by supplying a "typeVerifier", which is a function that accepts a single argument (the model object) and returns true/false depending on if that argument matches the "type" of the collection. * UserInterface/Main.html: * UserInterface/Test.html: * UserInterface/Models/Frame.js: * UserInterface/Views/CookieStorageContentView.js: * UserInterface/Views/DebuggerSidebarPanel.js: * UserInterface/Views/FrameTreeElement.js: * UserInterface/Views/OpenResourceDialog.js: Add support for WebInspector.Collection. * UserInterface/Models/ResourceCollection.js: (WebInspector.ResourceCollection): (WebInspector.ResourceCollection.verifierForType): (WebInspector.ResourceCollection.prototype.resourceCollectionForType): (WebInspector.ResourceCollection.prototype.clear): (WebInspector.ResourceCollection.prototype.itemAdded): (WebInspector.ResourceCollection.prototype.itemRemoved): (WebInspector.ResourceCollection.prototype.itemsCleared): (WebInspector.ResourceCollection.prototype._associateWithResource): (WebInspector.ResourceCollection.prototype._disassociateWithResource): (WebInspector.ResourceCollection.prototype._resourceURLDidChange): (WebInspector.ResourceCollection.prototype._resourceTypeDidChange): (WebInspector.ResourceCollection.prototype.get resources): Deleted. (WebInspector.ResourceCollection.prototype.resourcesWithType): Deleted. (WebInspector.ResourceCollection.prototype.addResource): Deleted. (WebInspector.ResourceCollection.prototype.removeResource): Deleted. (WebInspector.ResourceCollection.prototype.removeAllResources): Deleted. Now a subclass of WebInspector.Collection. Retrieving WebInspector.Resource objects by type and URL is still supported, but requesting by type now returns another instance of WebInspector.ResourceCollection that is configured to only accept the requested type. LayoutTests: * inspector/debugger/resources/log-pause-location.js: (TestPage.registerInitializer.window.findScript): Change name of getter to support WebInspector.Collection. * inspector/unit-tests/collection-expected.txt: Added. * inspector/unit-tests/collection.html: Added. * inspector/unit-tests/resource-collection-expected.txt: Added. * inspector/unit-tests/resource-collection.html: Added. Created tests for WebInspector.Collection and WebInspector.ResourceCollection. Canonical link: https://commits.webkit.org/181800@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208012 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-27 22:25:24 +00:00
test(resolve, reject) {
let collection = new WI.ResourceCollection;
collection.add(createResource("one", WI.Resource.Type.Image));
Web Inspector: rename "Stylesheet" to "Style Sheet" to match spec text https://bugs.webkit.org/show_bug.cgi?id=200422 Reviewed by Joseph Pecoraro. Source/JavaScriptCore: * inspector/protocol/Page.json: Source/WebCore: No observable change in functionality. * inspector/agents/InspectorPageAgent.h: * inspector/agents/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::resourceTypeJSON): (WebCore::InspectorPageAgent::inspectorResourceType): Source/WebInspectorUI: * Localizations/en.lproj/localizedStrings.js: * UserInterface/Controllers/CSSManager.js: (WI.CSSManager.prototype._resourceAdded): (WI.CSSManager.prototype._resourceTypeDidChange): (WI.CSSManager.prototype._clearStyleSheetsForResource): (WI.CSSManager.prototype._updateResourceContent.fetchedStyleSheetContent): * UserInterface/Models/CSSStyleSheet.js: (WI.CSSStyleSheet.prototype.get displayName): * UserInterface/Models/CollectionTypes.js: (WI.CSSStyleSheetCollection.prototype.get displayName): * UserInterface/Models/Resource.js: (WI.Resource.displayNameForType): (WI.Resource.prototype.get syntheticMIMEType): * UserInterface/Models/ResourceCollection.js: (WI.ResourceCollection.prototype.objectIsRequiredType): * UserInterface/Views/NetworkTableContentView.js: (WI.NetworkTableContentView): (WI.NetworkTableContentView.shortDisplayNameForResourceType): * UserInterface/Views/ResourceClusterContentView.js: (WI.ResourceClusterContentView.prototype._contentViewForResourceType): * UserInterface/Views/ResourceSidebarPanel.js: (WI.ResourceSidebarPanel.prototype.matchTreeElementAgainstCustomFilters.match): * UserInterface/Views/SourcesNavigationSidebarPanel.js: (WI.SourcesNavigationSidebarPanel.prototype.matchTreeElementAgainstCustomFilters.match): * UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js: (WI.SpreadsheetCSSStyleDeclarationSection.prototype._save): (WI.SpreadsheetCSSStyleDeclarationSection.prototype._populateIconElementContextMenu): * UserInterface/Views/StyleOriginView.js: (WI.StyleOriginView.prototype.update): * UserInterface/Views/TextResourceContentView.js: (WI.TextResourceContentView.prototype._shouldBeEditable): * UserInterface/Views/CSSStyleSheetTreeElement.js: (WI.CSSStyleSheetTreeElement): * UserInterface/Views/ResourceIcons.css: (:matches(.resource-icon.resource-type-style-sheet, .style-sheet-icon) .icon): Added. (.source-map-resource.resource-icon.resource-type-style-sheet .icon): Added. (.large :matches(.resource-icon.resource-type-style-sheet, .style-sheet-icon) .icon): Added. (.large .source-map-resource.resource-icon.resource-type-style-sheet .icon): Added. (:matches(.resource-icon.resource-type-stylesheet, .stylesheet-icon) .icon): Deleted. (.source-map-resource.resource-icon.resource-type-stylesheet .icon): Deleted. (.large :matches(.resource-icon.resource-type-stylesheet, .stylesheet-icon) .icon): Deleted. (.large .source-map-resource.resource-icon.resource-type-stylesheet .icon): Deleted. LayoutTests: * inspector/unit-tests/resource-collection.html: * http/tests/inspector/network/resource-mime-type.html: * http/tests/inspector/network/resource-mime-type-expected.txt: Canonical link: https://commits.webkit.org/214212@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248274 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-08-05 22:44:10 +00:00
collection.add(createResource("two", WI.Resource.Type.StyleSheet));
collection.add(createResource("three", WI.Resource.Type.Image));
collection.add(createResource("four", WI.Resource.Type.Document));
Web Inspector: rename "Stylesheet" to "Style Sheet" to match spec text https://bugs.webkit.org/show_bug.cgi?id=200422 Reviewed by Joseph Pecoraro. Source/JavaScriptCore: * inspector/protocol/Page.json: Source/WebCore: No observable change in functionality. * inspector/agents/InspectorPageAgent.h: * inspector/agents/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::resourceTypeJSON): (WebCore::InspectorPageAgent::inspectorResourceType): Source/WebInspectorUI: * Localizations/en.lproj/localizedStrings.js: * UserInterface/Controllers/CSSManager.js: (WI.CSSManager.prototype._resourceAdded): (WI.CSSManager.prototype._resourceTypeDidChange): (WI.CSSManager.prototype._clearStyleSheetsForResource): (WI.CSSManager.prototype._updateResourceContent.fetchedStyleSheetContent): * UserInterface/Models/CSSStyleSheet.js: (WI.CSSStyleSheet.prototype.get displayName): * UserInterface/Models/CollectionTypes.js: (WI.CSSStyleSheetCollection.prototype.get displayName): * UserInterface/Models/Resource.js: (WI.Resource.displayNameForType): (WI.Resource.prototype.get syntheticMIMEType): * UserInterface/Models/ResourceCollection.js: (WI.ResourceCollection.prototype.objectIsRequiredType): * UserInterface/Views/NetworkTableContentView.js: (WI.NetworkTableContentView): (WI.NetworkTableContentView.shortDisplayNameForResourceType): * UserInterface/Views/ResourceClusterContentView.js: (WI.ResourceClusterContentView.prototype._contentViewForResourceType): * UserInterface/Views/ResourceSidebarPanel.js: (WI.ResourceSidebarPanel.prototype.matchTreeElementAgainstCustomFilters.match): * UserInterface/Views/SourcesNavigationSidebarPanel.js: (WI.SourcesNavigationSidebarPanel.prototype.matchTreeElementAgainstCustomFilters.match): * UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js: (WI.SpreadsheetCSSStyleDeclarationSection.prototype._save): (WI.SpreadsheetCSSStyleDeclarationSection.prototype._populateIconElementContextMenu): * UserInterface/Views/StyleOriginView.js: (WI.StyleOriginView.prototype.update): * UserInterface/Views/TextResourceContentView.js: (WI.TextResourceContentView.prototype._shouldBeEditable): * UserInterface/Views/CSSStyleSheetTreeElement.js: (WI.CSSStyleSheetTreeElement): * UserInterface/Views/ResourceIcons.css: (:matches(.resource-icon.resource-type-style-sheet, .style-sheet-icon) .icon): Added. (.source-map-resource.resource-icon.resource-type-style-sheet .icon): Added. (.large :matches(.resource-icon.resource-type-style-sheet, .style-sheet-icon) .icon): Added. (.large .source-map-resource.resource-icon.resource-type-style-sheet .icon): Added. (:matches(.resource-icon.resource-type-stylesheet, .stylesheet-icon) .icon): Deleted. (.source-map-resource.resource-icon.resource-type-stylesheet .icon): Deleted. (.large :matches(.resource-icon.resource-type-stylesheet, .stylesheet-icon) .icon): Deleted. (.large .source-map-resource.resource-icon.resource-type-stylesheet .icon): Deleted. LayoutTests: * inspector/unit-tests/resource-collection.html: * http/tests/inspector/network/resource-mime-type.html: * http/tests/inspector/network/resource-mime-type-expected.txt: Canonical link: https://commits.webkit.org/214212@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248274 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-08-05 22:44:10 +00:00
collection.add(createResource("five", WI.Resource.Type.StyleSheet));
Web Inspector: Create general model object Collection class https://bugs.webkit.org/show_bug.cgi?id=163995 Patch by Devin Rousso <dcrousso+webkit@gmail.com> on 2016-10-27 Reviewed by Joseph Pecoraro. Source/WebInspectorUI: * UserInterface/Models/Collection.js: Added. (WebInspector.Collection): (WebInspector.Collection.prototype.get items): (WebInspector.Collection.prototype.get typeVerifier): (WebInspector.Collection.prototype.add): (WebInspector.Collection.prototype.remove): (WebInspector.Collection.prototype.clear): (WebInspector.Collection.prototype.toArray): (WebInspector.Collection.prototype.toJSON): (WebInspector.Collection.prototype.itemAdded): (WebInspector.Collection.prototype.itemRemoved): (WebInspector.Collection.prototype.itemsCleared): Class that holds multiple model objects. It can be limited to a specific type by supplying a "typeVerifier", which is a function that accepts a single argument (the model object) and returns true/false depending on if that argument matches the "type" of the collection. * UserInterface/Main.html: * UserInterface/Test.html: * UserInterface/Models/Frame.js: * UserInterface/Views/CookieStorageContentView.js: * UserInterface/Views/DebuggerSidebarPanel.js: * UserInterface/Views/FrameTreeElement.js: * UserInterface/Views/OpenResourceDialog.js: Add support for WebInspector.Collection. * UserInterface/Models/ResourceCollection.js: (WebInspector.ResourceCollection): (WebInspector.ResourceCollection.verifierForType): (WebInspector.ResourceCollection.prototype.resourceCollectionForType): (WebInspector.ResourceCollection.prototype.clear): (WebInspector.ResourceCollection.prototype.itemAdded): (WebInspector.ResourceCollection.prototype.itemRemoved): (WebInspector.ResourceCollection.prototype.itemsCleared): (WebInspector.ResourceCollection.prototype._associateWithResource): (WebInspector.ResourceCollection.prototype._disassociateWithResource): (WebInspector.ResourceCollection.prototype._resourceURLDidChange): (WebInspector.ResourceCollection.prototype._resourceTypeDidChange): (WebInspector.ResourceCollection.prototype.get resources): Deleted. (WebInspector.ResourceCollection.prototype.resourcesWithType): Deleted. (WebInspector.ResourceCollection.prototype.addResource): Deleted. (WebInspector.ResourceCollection.prototype.removeResource): Deleted. (WebInspector.ResourceCollection.prototype.removeAllResources): Deleted. Now a subclass of WebInspector.Collection. Retrieving WebInspector.Resource objects by type and URL is still supported, but requesting by type now returns another instance of WebInspector.ResourceCollection that is configured to only accept the requested type. LayoutTests: * inspector/debugger/resources/log-pause-location.js: (TestPage.registerInitializer.window.findScript): Change name of getter to support WebInspector.Collection. * inspector/unit-tests/collection-expected.txt: Added. * inspector/unit-tests/collection.html: Added. * inspector/unit-tests/resource-collection-expected.txt: Added. * inspector/unit-tests/resource-collection.html: Added. Created tests for WebInspector.Collection and WebInspector.ResourceCollection. Canonical link: https://commits.webkit.org/181800@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208012 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-27 22:25:24 +00:00
logResourceNames(collection.resourceCollectionForType(WI.Resource.Type.Image));
Web Inspector: Create general model object Collection class https://bugs.webkit.org/show_bug.cgi?id=163995 Patch by Devin Rousso <dcrousso+webkit@gmail.com> on 2016-10-27 Reviewed by Joseph Pecoraro. Source/WebInspectorUI: * UserInterface/Models/Collection.js: Added. (WebInspector.Collection): (WebInspector.Collection.prototype.get items): (WebInspector.Collection.prototype.get typeVerifier): (WebInspector.Collection.prototype.add): (WebInspector.Collection.prototype.remove): (WebInspector.Collection.prototype.clear): (WebInspector.Collection.prototype.toArray): (WebInspector.Collection.prototype.toJSON): (WebInspector.Collection.prototype.itemAdded): (WebInspector.Collection.prototype.itemRemoved): (WebInspector.Collection.prototype.itemsCleared): Class that holds multiple model objects. It can be limited to a specific type by supplying a "typeVerifier", which is a function that accepts a single argument (the model object) and returns true/false depending on if that argument matches the "type" of the collection. * UserInterface/Main.html: * UserInterface/Test.html: * UserInterface/Models/Frame.js: * UserInterface/Views/CookieStorageContentView.js: * UserInterface/Views/DebuggerSidebarPanel.js: * UserInterface/Views/FrameTreeElement.js: * UserInterface/Views/OpenResourceDialog.js: Add support for WebInspector.Collection. * UserInterface/Models/ResourceCollection.js: (WebInspector.ResourceCollection): (WebInspector.ResourceCollection.verifierForType): (WebInspector.ResourceCollection.prototype.resourceCollectionForType): (WebInspector.ResourceCollection.prototype.clear): (WebInspector.ResourceCollection.prototype.itemAdded): (WebInspector.ResourceCollection.prototype.itemRemoved): (WebInspector.ResourceCollection.prototype.itemsCleared): (WebInspector.ResourceCollection.prototype._associateWithResource): (WebInspector.ResourceCollection.prototype._disassociateWithResource): (WebInspector.ResourceCollection.prototype._resourceURLDidChange): (WebInspector.ResourceCollection.prototype._resourceTypeDidChange): (WebInspector.ResourceCollection.prototype.get resources): Deleted. (WebInspector.ResourceCollection.prototype.resourcesWithType): Deleted. (WebInspector.ResourceCollection.prototype.addResource): Deleted. (WebInspector.ResourceCollection.prototype.removeResource): Deleted. (WebInspector.ResourceCollection.prototype.removeAllResources): Deleted. Now a subclass of WebInspector.Collection. Retrieving WebInspector.Resource objects by type and URL is still supported, but requesting by type now returns another instance of WebInspector.ResourceCollection that is configured to only accept the requested type. LayoutTests: * inspector/debugger/resources/log-pause-location.js: (TestPage.registerInitializer.window.findScript): Change name of getter to support WebInspector.Collection. * inspector/unit-tests/collection-expected.txt: Added. * inspector/unit-tests/collection.html: Added. * inspector/unit-tests/resource-collection-expected.txt: Added. * inspector/unit-tests/resource-collection.html: Added. Created tests for WebInspector.Collection and WebInspector.ResourceCollection. Canonical link: https://commits.webkit.org/181800@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208012 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-27 22:25:24 +00:00
let typedCollection = new WI.ResourceCollection(WI.Resource.Type.Image);
typedCollection.add(createResource("one", WI.Resource.Type.Image));
Web Inspector: rename "Stylesheet" to "Style Sheet" to match spec text https://bugs.webkit.org/show_bug.cgi?id=200422 Reviewed by Joseph Pecoraro. Source/JavaScriptCore: * inspector/protocol/Page.json: Source/WebCore: No observable change in functionality. * inspector/agents/InspectorPageAgent.h: * inspector/agents/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::resourceTypeJSON): (WebCore::InspectorPageAgent::inspectorResourceType): Source/WebInspectorUI: * Localizations/en.lproj/localizedStrings.js: * UserInterface/Controllers/CSSManager.js: (WI.CSSManager.prototype._resourceAdded): (WI.CSSManager.prototype._resourceTypeDidChange): (WI.CSSManager.prototype._clearStyleSheetsForResource): (WI.CSSManager.prototype._updateResourceContent.fetchedStyleSheetContent): * UserInterface/Models/CSSStyleSheet.js: (WI.CSSStyleSheet.prototype.get displayName): * UserInterface/Models/CollectionTypes.js: (WI.CSSStyleSheetCollection.prototype.get displayName): * UserInterface/Models/Resource.js: (WI.Resource.displayNameForType): (WI.Resource.prototype.get syntheticMIMEType): * UserInterface/Models/ResourceCollection.js: (WI.ResourceCollection.prototype.objectIsRequiredType): * UserInterface/Views/NetworkTableContentView.js: (WI.NetworkTableContentView): (WI.NetworkTableContentView.shortDisplayNameForResourceType): * UserInterface/Views/ResourceClusterContentView.js: (WI.ResourceClusterContentView.prototype._contentViewForResourceType): * UserInterface/Views/ResourceSidebarPanel.js: (WI.ResourceSidebarPanel.prototype.matchTreeElementAgainstCustomFilters.match): * UserInterface/Views/SourcesNavigationSidebarPanel.js: (WI.SourcesNavigationSidebarPanel.prototype.matchTreeElementAgainstCustomFilters.match): * UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js: (WI.SpreadsheetCSSStyleDeclarationSection.prototype._save): (WI.SpreadsheetCSSStyleDeclarationSection.prototype._populateIconElementContextMenu): * UserInterface/Views/StyleOriginView.js: (WI.StyleOriginView.prototype.update): * UserInterface/Views/TextResourceContentView.js: (WI.TextResourceContentView.prototype._shouldBeEditable): * UserInterface/Views/CSSStyleSheetTreeElement.js: (WI.CSSStyleSheetTreeElement): * UserInterface/Views/ResourceIcons.css: (:matches(.resource-icon.resource-type-style-sheet, .style-sheet-icon) .icon): Added. (.source-map-resource.resource-icon.resource-type-style-sheet .icon): Added. (.large :matches(.resource-icon.resource-type-style-sheet, .style-sheet-icon) .icon): Added. (.large .source-map-resource.resource-icon.resource-type-style-sheet .icon): Added. (:matches(.resource-icon.resource-type-stylesheet, .stylesheet-icon) .icon): Deleted. (.source-map-resource.resource-icon.resource-type-stylesheet .icon): Deleted. (.large :matches(.resource-icon.resource-type-stylesheet, .stylesheet-icon) .icon): Deleted. (.large .source-map-resource.resource-icon.resource-type-stylesheet .icon): Deleted. LayoutTests: * inspector/unit-tests/resource-collection.html: * http/tests/inspector/network/resource-mime-type.html: * http/tests/inspector/network/resource-mime-type-expected.txt: Canonical link: https://commits.webkit.org/214212@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248274 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-08-05 22:44:10 +00:00
typedCollection.add(createResource("two", WI.Resource.Type.StyleSheet));
typedCollection.add(createResource("three", WI.Resource.Type.Image));
Web Inspector: Create general model object Collection class https://bugs.webkit.org/show_bug.cgi?id=163995 Patch by Devin Rousso <dcrousso+webkit@gmail.com> on 2016-10-27 Reviewed by Joseph Pecoraro. Source/WebInspectorUI: * UserInterface/Models/Collection.js: Added. (WebInspector.Collection): (WebInspector.Collection.prototype.get items): (WebInspector.Collection.prototype.get typeVerifier): (WebInspector.Collection.prototype.add): (WebInspector.Collection.prototype.remove): (WebInspector.Collection.prototype.clear): (WebInspector.Collection.prototype.toArray): (WebInspector.Collection.prototype.toJSON): (WebInspector.Collection.prototype.itemAdded): (WebInspector.Collection.prototype.itemRemoved): (WebInspector.Collection.prototype.itemsCleared): Class that holds multiple model objects. It can be limited to a specific type by supplying a "typeVerifier", which is a function that accepts a single argument (the model object) and returns true/false depending on if that argument matches the "type" of the collection. * UserInterface/Main.html: * UserInterface/Test.html: * UserInterface/Models/Frame.js: * UserInterface/Views/CookieStorageContentView.js: * UserInterface/Views/DebuggerSidebarPanel.js: * UserInterface/Views/FrameTreeElement.js: * UserInterface/Views/OpenResourceDialog.js: Add support for WebInspector.Collection. * UserInterface/Models/ResourceCollection.js: (WebInspector.ResourceCollection): (WebInspector.ResourceCollection.verifierForType): (WebInspector.ResourceCollection.prototype.resourceCollectionForType): (WebInspector.ResourceCollection.prototype.clear): (WebInspector.ResourceCollection.prototype.itemAdded): (WebInspector.ResourceCollection.prototype.itemRemoved): (WebInspector.ResourceCollection.prototype.itemsCleared): (WebInspector.ResourceCollection.prototype._associateWithResource): (WebInspector.ResourceCollection.prototype._disassociateWithResource): (WebInspector.ResourceCollection.prototype._resourceURLDidChange): (WebInspector.ResourceCollection.prototype._resourceTypeDidChange): (WebInspector.ResourceCollection.prototype.get resources): Deleted. (WebInspector.ResourceCollection.prototype.resourcesWithType): Deleted. (WebInspector.ResourceCollection.prototype.addResource): Deleted. (WebInspector.ResourceCollection.prototype.removeResource): Deleted. (WebInspector.ResourceCollection.prototype.removeAllResources): Deleted. Now a subclass of WebInspector.Collection. Retrieving WebInspector.Resource objects by type and URL is still supported, but requesting by type now returns another instance of WebInspector.ResourceCollection that is configured to only accept the requested type. LayoutTests: * inspector/debugger/resources/log-pause-location.js: (TestPage.registerInitializer.window.findScript): Change name of getter to support WebInspector.Collection. * inspector/unit-tests/collection-expected.txt: Added. * inspector/unit-tests/collection.html: Added. * inspector/unit-tests/resource-collection-expected.txt: Added. * inspector/unit-tests/resource-collection.html: Added. Created tests for WebInspector.Collection and WebInspector.ResourceCollection. Canonical link: https://commits.webkit.org/181800@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208012 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-27 22:25:24 +00:00
logResourceNames(typedCollection);
InspectorTest.expectEqual(typedCollection.resourceCollectionForType(WI.Resource.Type.Image), typedCollection, "resourceCollectionForType will return `this` if a type is specified.")
Web Inspector: Create general model object Collection class https://bugs.webkit.org/show_bug.cgi?id=163995 Patch by Devin Rousso <dcrousso+webkit@gmail.com> on 2016-10-27 Reviewed by Joseph Pecoraro. Source/WebInspectorUI: * UserInterface/Models/Collection.js: Added. (WebInspector.Collection): (WebInspector.Collection.prototype.get items): (WebInspector.Collection.prototype.get typeVerifier): (WebInspector.Collection.prototype.add): (WebInspector.Collection.prototype.remove): (WebInspector.Collection.prototype.clear): (WebInspector.Collection.prototype.toArray): (WebInspector.Collection.prototype.toJSON): (WebInspector.Collection.prototype.itemAdded): (WebInspector.Collection.prototype.itemRemoved): (WebInspector.Collection.prototype.itemsCleared): Class that holds multiple model objects. It can be limited to a specific type by supplying a "typeVerifier", which is a function that accepts a single argument (the model object) and returns true/false depending on if that argument matches the "type" of the collection. * UserInterface/Main.html: * UserInterface/Test.html: * UserInterface/Models/Frame.js: * UserInterface/Views/CookieStorageContentView.js: * UserInterface/Views/DebuggerSidebarPanel.js: * UserInterface/Views/FrameTreeElement.js: * UserInterface/Views/OpenResourceDialog.js: Add support for WebInspector.Collection. * UserInterface/Models/ResourceCollection.js: (WebInspector.ResourceCollection): (WebInspector.ResourceCollection.verifierForType): (WebInspector.ResourceCollection.prototype.resourceCollectionForType): (WebInspector.ResourceCollection.prototype.clear): (WebInspector.ResourceCollection.prototype.itemAdded): (WebInspector.ResourceCollection.prototype.itemRemoved): (WebInspector.ResourceCollection.prototype.itemsCleared): (WebInspector.ResourceCollection.prototype._associateWithResource): (WebInspector.ResourceCollection.prototype._disassociateWithResource): (WebInspector.ResourceCollection.prototype._resourceURLDidChange): (WebInspector.ResourceCollection.prototype._resourceTypeDidChange): (WebInspector.ResourceCollection.prototype.get resources): Deleted. (WebInspector.ResourceCollection.prototype.resourcesWithType): Deleted. (WebInspector.ResourceCollection.prototype.addResource): Deleted. (WebInspector.ResourceCollection.prototype.removeResource): Deleted. (WebInspector.ResourceCollection.prototype.removeAllResources): Deleted. Now a subclass of WebInspector.Collection. Retrieving WebInspector.Resource objects by type and URL is still supported, but requesting by type now returns another instance of WebInspector.ResourceCollection that is configured to only accept the requested type. LayoutTests: * inspector/debugger/resources/log-pause-location.js: (TestPage.registerInitializer.window.findScript): Change name of getter to support WebInspector.Collection. * inspector/unit-tests/collection-expected.txt: Added. * inspector/unit-tests/collection.html: Added. * inspector/unit-tests/resource-collection-expected.txt: Added. * inspector/unit-tests/resource-collection.html: Added. Created tests for WebInspector.Collection and WebInspector.ResourceCollection. Canonical link: https://commits.webkit.org/181800@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208012 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-27 22:25:24 +00:00
resolve();
}
});
suite.addTestCase({
name: "WI.ResourceCollection.prototype._resourceTypeDidChange",
Web Inspector: Create general model object Collection class https://bugs.webkit.org/show_bug.cgi?id=163995 Patch by Devin Rousso <dcrousso+webkit@gmail.com> on 2016-10-27 Reviewed by Joseph Pecoraro. Source/WebInspectorUI: * UserInterface/Models/Collection.js: Added. (WebInspector.Collection): (WebInspector.Collection.prototype.get items): (WebInspector.Collection.prototype.get typeVerifier): (WebInspector.Collection.prototype.add): (WebInspector.Collection.prototype.remove): (WebInspector.Collection.prototype.clear): (WebInspector.Collection.prototype.toArray): (WebInspector.Collection.prototype.toJSON): (WebInspector.Collection.prototype.itemAdded): (WebInspector.Collection.prototype.itemRemoved): (WebInspector.Collection.prototype.itemsCleared): Class that holds multiple model objects. It can be limited to a specific type by supplying a "typeVerifier", which is a function that accepts a single argument (the model object) and returns true/false depending on if that argument matches the "type" of the collection. * UserInterface/Main.html: * UserInterface/Test.html: * UserInterface/Models/Frame.js: * UserInterface/Views/CookieStorageContentView.js: * UserInterface/Views/DebuggerSidebarPanel.js: * UserInterface/Views/FrameTreeElement.js: * UserInterface/Views/OpenResourceDialog.js: Add support for WebInspector.Collection. * UserInterface/Models/ResourceCollection.js: (WebInspector.ResourceCollection): (WebInspector.ResourceCollection.verifierForType): (WebInspector.ResourceCollection.prototype.resourceCollectionForType): (WebInspector.ResourceCollection.prototype.clear): (WebInspector.ResourceCollection.prototype.itemAdded): (WebInspector.ResourceCollection.prototype.itemRemoved): (WebInspector.ResourceCollection.prototype.itemsCleared): (WebInspector.ResourceCollection.prototype._associateWithResource): (WebInspector.ResourceCollection.prototype._disassociateWithResource): (WebInspector.ResourceCollection.prototype._resourceURLDidChange): (WebInspector.ResourceCollection.prototype._resourceTypeDidChange): (WebInspector.ResourceCollection.prototype.get resources): Deleted. (WebInspector.ResourceCollection.prototype.resourcesWithType): Deleted. (WebInspector.ResourceCollection.prototype.addResource): Deleted. (WebInspector.ResourceCollection.prototype.removeResource): Deleted. (WebInspector.ResourceCollection.prototype.removeAllResources): Deleted. Now a subclass of WebInspector.Collection. Retrieving WebInspector.Resource objects by type and URL is still supported, but requesting by type now returns another instance of WebInspector.ResourceCollection that is configured to only accept the requested type. LayoutTests: * inspector/debugger/resources/log-pause-location.js: (TestPage.registerInitializer.window.findScript): Change name of getter to support WebInspector.Collection. * inspector/unit-tests/collection-expected.txt: Added. * inspector/unit-tests/collection.html: Added. * inspector/unit-tests/resource-collection-expected.txt: Added. * inspector/unit-tests/resource-collection.html: Added. Created tests for WebInspector.Collection and WebInspector.ResourceCollection. Canonical link: https://commits.webkit.org/181800@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208012 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-27 22:25:24 +00:00
test(resolve, reject) {
let imageResource = createResource("one");
let collection = new WI.ResourceCollection;
Web Inspector: Create general model object Collection class https://bugs.webkit.org/show_bug.cgi?id=163995 Patch by Devin Rousso <dcrousso+webkit@gmail.com> on 2016-10-27 Reviewed by Joseph Pecoraro. Source/WebInspectorUI: * UserInterface/Models/Collection.js: Added. (WebInspector.Collection): (WebInspector.Collection.prototype.get items): (WebInspector.Collection.prototype.get typeVerifier): (WebInspector.Collection.prototype.add): (WebInspector.Collection.prototype.remove): (WebInspector.Collection.prototype.clear): (WebInspector.Collection.prototype.toArray): (WebInspector.Collection.prototype.toJSON): (WebInspector.Collection.prototype.itemAdded): (WebInspector.Collection.prototype.itemRemoved): (WebInspector.Collection.prototype.itemsCleared): Class that holds multiple model objects. It can be limited to a specific type by supplying a "typeVerifier", which is a function that accepts a single argument (the model object) and returns true/false depending on if that argument matches the "type" of the collection. * UserInterface/Main.html: * UserInterface/Test.html: * UserInterface/Models/Frame.js: * UserInterface/Views/CookieStorageContentView.js: * UserInterface/Views/DebuggerSidebarPanel.js: * UserInterface/Views/FrameTreeElement.js: * UserInterface/Views/OpenResourceDialog.js: Add support for WebInspector.Collection. * UserInterface/Models/ResourceCollection.js: (WebInspector.ResourceCollection): (WebInspector.ResourceCollection.verifierForType): (WebInspector.ResourceCollection.prototype.resourceCollectionForType): (WebInspector.ResourceCollection.prototype.clear): (WebInspector.ResourceCollection.prototype.itemAdded): (WebInspector.ResourceCollection.prototype.itemRemoved): (WebInspector.ResourceCollection.prototype.itemsCleared): (WebInspector.ResourceCollection.prototype._associateWithResource): (WebInspector.ResourceCollection.prototype._disassociateWithResource): (WebInspector.ResourceCollection.prototype._resourceURLDidChange): (WebInspector.ResourceCollection.prototype._resourceTypeDidChange): (WebInspector.ResourceCollection.prototype.get resources): Deleted. (WebInspector.ResourceCollection.prototype.resourcesWithType): Deleted. (WebInspector.ResourceCollection.prototype.addResource): Deleted. (WebInspector.ResourceCollection.prototype.removeResource): Deleted. (WebInspector.ResourceCollection.prototype.removeAllResources): Deleted. Now a subclass of WebInspector.Collection. Retrieving WebInspector.Resource objects by type and URL is still supported, but requesting by type now returns another instance of WebInspector.ResourceCollection that is configured to only accept the requested type. LayoutTests: * inspector/debugger/resources/log-pause-location.js: (TestPage.registerInitializer.window.findScript): Change name of getter to support WebInspector.Collection. * inspector/unit-tests/collection-expected.txt: Added. * inspector/unit-tests/collection.html: Added. * inspector/unit-tests/resource-collection-expected.txt: Added. * inspector/unit-tests/resource-collection.html: Added. Created tests for WebInspector.Collection and WebInspector.ResourceCollection. Canonical link: https://commits.webkit.org/181800@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208012 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-27 22:25:24 +00:00
collection.add(imageResource);
logResourceNames(collection);
logResourceNames(collection.resourceCollectionForType(WI.Resource.Type.Image));
logResourceNames(collection.resourceCollectionForType(WI.Resource.Type.Other));
Web Inspector: Create general model object Collection class https://bugs.webkit.org/show_bug.cgi?id=163995 Patch by Devin Rousso <dcrousso+webkit@gmail.com> on 2016-10-27 Reviewed by Joseph Pecoraro. Source/WebInspectorUI: * UserInterface/Models/Collection.js: Added. (WebInspector.Collection): (WebInspector.Collection.prototype.get items): (WebInspector.Collection.prototype.get typeVerifier): (WebInspector.Collection.prototype.add): (WebInspector.Collection.prototype.remove): (WebInspector.Collection.prototype.clear): (WebInspector.Collection.prototype.toArray): (WebInspector.Collection.prototype.toJSON): (WebInspector.Collection.prototype.itemAdded): (WebInspector.Collection.prototype.itemRemoved): (WebInspector.Collection.prototype.itemsCleared): Class that holds multiple model objects. It can be limited to a specific type by supplying a "typeVerifier", which is a function that accepts a single argument (the model object) and returns true/false depending on if that argument matches the "type" of the collection. * UserInterface/Main.html: * UserInterface/Test.html: * UserInterface/Models/Frame.js: * UserInterface/Views/CookieStorageContentView.js: * UserInterface/Views/DebuggerSidebarPanel.js: * UserInterface/Views/FrameTreeElement.js: * UserInterface/Views/OpenResourceDialog.js: Add support for WebInspector.Collection. * UserInterface/Models/ResourceCollection.js: (WebInspector.ResourceCollection): (WebInspector.ResourceCollection.verifierForType): (WebInspector.ResourceCollection.prototype.resourceCollectionForType): (WebInspector.ResourceCollection.prototype.clear): (WebInspector.ResourceCollection.prototype.itemAdded): (WebInspector.ResourceCollection.prototype.itemRemoved): (WebInspector.ResourceCollection.prototype.itemsCleared): (WebInspector.ResourceCollection.prototype._associateWithResource): (WebInspector.ResourceCollection.prototype._disassociateWithResource): (WebInspector.ResourceCollection.prototype._resourceURLDidChange): (WebInspector.ResourceCollection.prototype._resourceTypeDidChange): (WebInspector.ResourceCollection.prototype.get resources): Deleted. (WebInspector.ResourceCollection.prototype.resourcesWithType): Deleted. (WebInspector.ResourceCollection.prototype.addResource): Deleted. (WebInspector.ResourceCollection.prototype.removeResource): Deleted. (WebInspector.ResourceCollection.prototype.removeAllResources): Deleted. Now a subclass of WebInspector.Collection. Retrieving WebInspector.Resource objects by type and URL is still supported, but requesting by type now returns another instance of WebInspector.ResourceCollection that is configured to only accept the requested type. LayoutTests: * inspector/debugger/resources/log-pause-location.js: (TestPage.registerInitializer.window.findScript): Change name of getter to support WebInspector.Collection. * inspector/unit-tests/collection-expected.txt: Added. * inspector/unit-tests/collection.html: Added. * inspector/unit-tests/resource-collection-expected.txt: Added. * inspector/unit-tests/resource-collection.html: Added. Created tests for WebInspector.Collection and WebInspector.ResourceCollection. Canonical link: https://commits.webkit.org/181800@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208012 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-27 22:25:24 +00:00
// Dispatch a type change.
imageResource._type = WI.Resource.Type.Image;
imageResource.dispatchEventToListeners(WI.Resource.Event.TypeDidChange, {oldType: WI.Resource.Type.Image});
Web Inspector: Create general model object Collection class https://bugs.webkit.org/show_bug.cgi?id=163995 Patch by Devin Rousso <dcrousso+webkit@gmail.com> on 2016-10-27 Reviewed by Joseph Pecoraro. Source/WebInspectorUI: * UserInterface/Models/Collection.js: Added. (WebInspector.Collection): (WebInspector.Collection.prototype.get items): (WebInspector.Collection.prototype.get typeVerifier): (WebInspector.Collection.prototype.add): (WebInspector.Collection.prototype.remove): (WebInspector.Collection.prototype.clear): (WebInspector.Collection.prototype.toArray): (WebInspector.Collection.prototype.toJSON): (WebInspector.Collection.prototype.itemAdded): (WebInspector.Collection.prototype.itemRemoved): (WebInspector.Collection.prototype.itemsCleared): Class that holds multiple model objects. It can be limited to a specific type by supplying a "typeVerifier", which is a function that accepts a single argument (the model object) and returns true/false depending on if that argument matches the "type" of the collection. * UserInterface/Main.html: * UserInterface/Test.html: * UserInterface/Models/Frame.js: * UserInterface/Views/CookieStorageContentView.js: * UserInterface/Views/DebuggerSidebarPanel.js: * UserInterface/Views/FrameTreeElement.js: * UserInterface/Views/OpenResourceDialog.js: Add support for WebInspector.Collection. * UserInterface/Models/ResourceCollection.js: (WebInspector.ResourceCollection): (WebInspector.ResourceCollection.verifierForType): (WebInspector.ResourceCollection.prototype.resourceCollectionForType): (WebInspector.ResourceCollection.prototype.clear): (WebInspector.ResourceCollection.prototype.itemAdded): (WebInspector.ResourceCollection.prototype.itemRemoved): (WebInspector.ResourceCollection.prototype.itemsCleared): (WebInspector.ResourceCollection.prototype._associateWithResource): (WebInspector.ResourceCollection.prototype._disassociateWithResource): (WebInspector.ResourceCollection.prototype._resourceURLDidChange): (WebInspector.ResourceCollection.prototype._resourceTypeDidChange): (WebInspector.ResourceCollection.prototype.get resources): Deleted. (WebInspector.ResourceCollection.prototype.resourcesWithType): Deleted. (WebInspector.ResourceCollection.prototype.addResource): Deleted. (WebInspector.ResourceCollection.prototype.removeResource): Deleted. (WebInspector.ResourceCollection.prototype.removeAllResources): Deleted. Now a subclass of WebInspector.Collection. Retrieving WebInspector.Resource objects by type and URL is still supported, but requesting by type now returns another instance of WebInspector.ResourceCollection that is configured to only accept the requested type. LayoutTests: * inspector/debugger/resources/log-pause-location.js: (TestPage.registerInitializer.window.findScript): Change name of getter to support WebInspector.Collection. * inspector/unit-tests/collection-expected.txt: Added. * inspector/unit-tests/collection.html: Added. * inspector/unit-tests/resource-collection-expected.txt: Added. * inspector/unit-tests/resource-collection.html: Added. Created tests for WebInspector.Collection and WebInspector.ResourceCollection. Canonical link: https://commits.webkit.org/181800@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208012 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-27 22:25:24 +00:00
logResourceNames(collection);
logResourceNames(collection.resourceCollectionForType(WI.Resource.Type.Image));
logResourceNames(collection.resourceCollectionForType(WI.Resource.Type.Other));
Web Inspector: Create general model object Collection class https://bugs.webkit.org/show_bug.cgi?id=163995 Patch by Devin Rousso <dcrousso+webkit@gmail.com> on 2016-10-27 Reviewed by Joseph Pecoraro. Source/WebInspectorUI: * UserInterface/Models/Collection.js: Added. (WebInspector.Collection): (WebInspector.Collection.prototype.get items): (WebInspector.Collection.prototype.get typeVerifier): (WebInspector.Collection.prototype.add): (WebInspector.Collection.prototype.remove): (WebInspector.Collection.prototype.clear): (WebInspector.Collection.prototype.toArray): (WebInspector.Collection.prototype.toJSON): (WebInspector.Collection.prototype.itemAdded): (WebInspector.Collection.prototype.itemRemoved): (WebInspector.Collection.prototype.itemsCleared): Class that holds multiple model objects. It can be limited to a specific type by supplying a "typeVerifier", which is a function that accepts a single argument (the model object) and returns true/false depending on if that argument matches the "type" of the collection. * UserInterface/Main.html: * UserInterface/Test.html: * UserInterface/Models/Frame.js: * UserInterface/Views/CookieStorageContentView.js: * UserInterface/Views/DebuggerSidebarPanel.js: * UserInterface/Views/FrameTreeElement.js: * UserInterface/Views/OpenResourceDialog.js: Add support for WebInspector.Collection. * UserInterface/Models/ResourceCollection.js: (WebInspector.ResourceCollection): (WebInspector.ResourceCollection.verifierForType): (WebInspector.ResourceCollection.prototype.resourceCollectionForType): (WebInspector.ResourceCollection.prototype.clear): (WebInspector.ResourceCollection.prototype.itemAdded): (WebInspector.ResourceCollection.prototype.itemRemoved): (WebInspector.ResourceCollection.prototype.itemsCleared): (WebInspector.ResourceCollection.prototype._associateWithResource): (WebInspector.ResourceCollection.prototype._disassociateWithResource): (WebInspector.ResourceCollection.prototype._resourceURLDidChange): (WebInspector.ResourceCollection.prototype._resourceTypeDidChange): (WebInspector.ResourceCollection.prototype.get resources): Deleted. (WebInspector.ResourceCollection.prototype.resourcesWithType): Deleted. (WebInspector.ResourceCollection.prototype.addResource): Deleted. (WebInspector.ResourceCollection.prototype.removeResource): Deleted. (WebInspector.ResourceCollection.prototype.removeAllResources): Deleted. Now a subclass of WebInspector.Collection. Retrieving WebInspector.Resource objects by type and URL is still supported, but requesting by type now returns another instance of WebInspector.ResourceCollection that is configured to only accept the requested type. LayoutTests: * inspector/debugger/resources/log-pause-location.js: (TestPage.registerInitializer.window.findScript): Change name of getter to support WebInspector.Collection. * inspector/unit-tests/collection-expected.txt: Added. * inspector/unit-tests/collection.html: Added. * inspector/unit-tests/resource-collection-expected.txt: Added. * inspector/unit-tests/resource-collection.html: Added. Created tests for WebInspector.Collection and WebInspector.ResourceCollection. Canonical link: https://commits.webkit.org/181800@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208012 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-27 22:25:24 +00:00
resolve();
}
});
suite.runTestCasesAndFinish();
}
</script>
</head>
<body onload="runTest()">
<p>Testing all methods of ResourceCollection.</p>
</body>
</html>