Title: [208234] trunk
Revision
208234
Author
commit-qu...@webkit.org
Date
2016-11-01 12:04:48 -0700 (Tue, 01 Nov 2016)

Log Message

Web Inspector: Fix double remove of ResourceCollection if type changes
https://bugs.webkit.org/show_bug.cgi?id=164268

Patch by Devin Rousso <dcrousso+web...@gmail.com> on 2016-11-01
Reviewed by Joseph Pecoraro.

Source/WebInspectorUI:

* UserInterface/Models/ResourceCollection.js:
(WebInspector.ResourceCollection.prototype._resourceTypeDidChange):
Change logic so that a non-typed collection will not try to remove a resource that has
changed types from the sub-collection of its old type, since the sub-collection itself will
handle the removal inside its own event listener for the type change.

LayoutTests:

* inspector/unit-tests/resource-collection-expected.txt:
Fixed test to not expect a double remove.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (208233 => 208234)


--- trunk/LayoutTests/ChangeLog	2016-11-01 18:57:22 UTC (rev 208233)
+++ trunk/LayoutTests/ChangeLog	2016-11-01 19:04:48 UTC (rev 208234)
@@ -1,3 +1,13 @@
+2016-11-01  Devin Rousso  <dcrousso+web...@gmail.com>
+
+        Web Inspector: Fix double remove of ResourceCollection if type changes
+        https://bugs.webkit.org/show_bug.cgi?id=164268
+
+        Reviewed by Joseph Pecoraro.
+
+        * inspector/unit-tests/resource-collection-expected.txt:
+        Fixed test to not expect a double remove.
+
 2016-11-01  Ryan Haddad  <ryanhad...@apple.com>
 
         Marking inspector/storage/domStorage-events.html as flaky.

Modified: trunk/LayoutTests/inspector/unit-tests/resource-collection-expected.txt (208233 => 208234)


--- trunk/LayoutTests/inspector/unit-tests/resource-collection-expected.txt	2016-11-01 18:57:22 UTC (rev 208233)
+++ trunk/LayoutTests/inspector/unit-tests/resource-collection-expected.txt	2016-11-01 19:04:48 UTC (rev 208234)
@@ -15,6 +15,6 @@
 []
 ["one"]
 ["one"]
+["one"]
 []
-[]
 

Modified: trunk/Source/WebInspectorUI/ChangeLog (208233 => 208234)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-11-01 18:57:22 UTC (rev 208233)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-11-01 19:04:48 UTC (rev 208234)
@@ -1,3 +1,16 @@
+2016-11-01  Devin Rousso  <dcrousso+web...@gmail.com>
+
+        Web Inspector: Fix double remove of ResourceCollection if type changes
+        https://bugs.webkit.org/show_bug.cgi?id=164268
+
+        Reviewed by Joseph Pecoraro.
+
+        * UserInterface/Models/ResourceCollection.js:
+        (WebInspector.ResourceCollection.prototype._resourceTypeDidChange):
+        Change logic so that a non-typed collection will not try to remove a resource that has
+        changed types from the sub-collection of its old type, since the sub-collection itself will
+        handle the removal inside its own event listener for the type change.
+
 2016-11-01  Ryosuke Niwa  <rn...@webkit.org>
 
         Web Inspector: Add the support for custom elements

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/ResourceCollection.js (208233 => 208234)


--- trunk/Source/WebInspectorUI/UserInterface/Models/ResourceCollection.js	2016-11-01 18:57:22 UTC (rev 208233)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/ResourceCollection.js	2016-11-01 19:04:48 UTC (rev 208234)
@@ -173,16 +173,14 @@
             return;
         }
 
-        let oldType = event.data.oldType;
-        console.assert(oldType);
-        if (!oldType)
-            return;
+        console.assert(event.data.oldType);
 
         let resourcesWithNewType = this.resourceCollectionForType(resource.type);
         resourcesWithNewType.add(resource);
 
-        let resourcesWithOldType = this.resourceCollectionForType(oldType);
-        resourcesWithOldType.remove(resource);
+        // It is not necessary to remove the resource from the sub-collection for the old type since
+        // this is handled by that sub-collection's own _resourceTypeDidChange handler (via the
+        // above if statement).
     }
 };
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to