Title: [236844] trunk
Revision
236844
Author
drou...@apple.com
Date
2018-10-04 13:08:54 -0700 (Thu, 04 Oct 2018)

Log Message

Web Inspector: some files not listed in OpenResourceDialog
https://bugs.webkit.org/show_bug.cgi?id=190272

Reviewed by Joseph Pecoraro.

Source/WebInspectorUI:

* UserInterface/Controllers/ResourceQueryController.js:
(WI.ResourceQueryController.prototype._findQueryMatches):
Allow the `searchIndex` to go past the end of the `searchString` to allow for backtracking
if the last character of `searchString` is not found in `query`.

LayoutTests:

* inspector/unit-tests/resource-query-controller-expected.txt:
* inspector/unit-tests/resource-query-controller.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (236843 => 236844)


--- trunk/LayoutTests/ChangeLog	2018-10-04 20:03:50 UTC (rev 236843)
+++ trunk/LayoutTests/ChangeLog	2018-10-04 20:08:54 UTC (rev 236844)
@@ -1,3 +1,13 @@
+2018-10-04  Devin Rousso  <drou...@apple.com>
+
+        Web Inspector: some files not listed in OpenResourceDialog
+        https://bugs.webkit.org/show_bug.cgi?id=190272
+
+        Reviewed by Joseph Pecoraro.
+
+        * inspector/unit-tests/resource-query-controller-expected.txt:
+        * inspector/unit-tests/resource-query-controller.html:
+
 2018-10-04  Jiewen Tan  <jiewen_...@apple.com>
 
         [WebAuthN] Move time out control from WebProcess to UIProcess

Modified: trunk/LayoutTests/inspector/unit-tests/resource-query-controller-expected.txt (236843 => 236844)


--- trunk/LayoutTests/inspector/unit-tests/resource-query-controller-expected.txt	2018-10-04 20:03:50 UTC (rev 236843)
+++ trunk/LayoutTests/inspector/unit-tests/resource-query-controller-expected.txt	2018-10-04 20:08:54 UTC (rev 236844)
@@ -216,3 +216,6 @@
 PASS: Result TextRanges should match the expected ranges.
 PASS: Result TextRanges should match the expected ranges.
 
+-- Running test case: QueryMatchesExtension
+PASS: All resources should be matched.
+

Modified: trunk/LayoutTests/inspector/unit-tests/resource-query-controller.html (236843 => 236844)


--- trunk/LayoutTests/inspector/unit-tests/resource-query-controller.html	2018-10-04 20:03:50 UTC (rev 236843)
+++ trunk/LayoutTests/inspector/unit-tests/resource-query-controller.html	2018-10-04 20:08:54 UTC (rev 236844)
@@ -61,7 +61,7 @@
 
             for (let {filename, expected} of tests) {
                 let actual = createSpecialMask(filename, matcher._findSpecialCharacterIndices(filename));
-                InspectorTest.expectThat(actual === expected, "Result should match expected special indices.");
+                InspectorTest.expectEqual(actual, expected, "Result should match expected special indices.");
             }
         }
     });
@@ -103,7 +103,7 @@
 
             for (let query of [" abcde", "abcde ", " abcde ", "a b c d e", "a  b  c  d  e"]) {
                 let results = matcher.executeQuery(query);
-                InspectorTest.expectThat(results.length === 1, "Should match one result.");
+                InspectorTest.expectEqual(results.length, 1, "Should match one result.");
             }
         }
     });
@@ -193,7 +193,7 @@
                 let results = matcher.executeQuery(query);
                 InspectorTest.assert(results.length === 1, "Should return exactly one match.");
                 let actual = results.length ? results[0].__test_createMatchesMask() : null;
-                InspectorTest.expectThat(actual === expected, `Query "${query}" should match "${expected}" in "${filename}".`);
+                InspectorTest.expectEqual(actual, expected, `Query "${query}" should match "${expected}" in "${filename}".`);
             }
         }
     });
@@ -261,7 +261,7 @@
                 for (let queryPermutation of casePermutations(query)) {
                     let results = matcher.executeQuery(queryPermutation);
                     let actual = results.length === 1 ? results[0].__test_createMatchesMask() : "";
-                    InspectorTest.expectThat(expected === actual, `Permutation "${queryPermutation}".`);
+                    InspectorTest.expectEqual(expected, actual, `Permutation "${queryPermutation}".`);
                 }
             }
         }
@@ -278,7 +278,7 @@
             let query = "abcde";
             let results = matcher.executeQuery(query);
             let resultFilenames = results.map((filename) => filename.resource.displayName);
-            InspectorTest.expectThat(Object.shallowEqual(resultFilenames, filenames), "Results should be ranked by descending relevancy.");
+            InspectorTest.expectShallowEqual(resultFilenames, filenames, "Results should be ranked by descending relevancy.");
         }
     });
 
@@ -293,7 +293,7 @@
             let query = "bcd";
             let results = matcher.executeQuery(query);
             let resultFilenames = results.map((result) => result.resource.displayName);
-            InspectorTest.expectThat(Object.shallowEqual(resultFilenames, filenames), "Results should be ranked by descending relevancy.");
+            InspectorTest.expectShallowEqual(resultFilenames, filenames, "Results should be ranked by descending relevancy.");
         }
     });
 
@@ -353,11 +353,28 @@
 
                 let results = matcher.executeQuery("abcde");
                 let resultTextRanges = results.length ? results[0].matchingTextRanges : [];
-                InspectorTest.expectThat(JSON.stringify(resultTextRanges) === JSON.stringify(ranges), "Result TextRanges should match the expected ranges.");
+                InspectorTest.expectEqual(JSON.stringify(resultTextRanges), JSON.stringify(ranges), "Result TextRanges should match the expected ranges.");
             }
         }
     });
 
+    suite.addTestCase({
+        name: "QueryMatchesExtension",
+        description: "Test case for when a character from the query is found in the extension of the resource.",
+        test() {
+            const query = "TestCase";
+            const filenames = ["TestCase.123", "TestCase.a", "TestCase.b"];
+
+            let matcher = new WI.ResourceQueryController;
+            for (let filename of filenames)
+                matcher.addResource(new WI.Resource(filename));
+
+            let results = matcher.executeQuery(query);
+            let resultFilenames = results.map((result) => result.resource.displayName);
+            InspectorTest.expectShallowEqual(resultFilenames, filenames, "All resources should be matched.");
+        }
+    });
+
     suite.runTestCasesAndFinish();
 }
 </script>

Modified: trunk/Source/WebInspectorUI/ChangeLog (236843 => 236844)


--- trunk/Source/WebInspectorUI/ChangeLog	2018-10-04 20:03:50 UTC (rev 236843)
+++ trunk/Source/WebInspectorUI/ChangeLog	2018-10-04 20:08:54 UTC (rev 236844)
@@ -1,5 +1,17 @@
 2018-10-04  Devin Rousso  <drou...@apple.com>
 
+        Web Inspector: some files not listed in OpenResourceDialog
+        https://bugs.webkit.org/show_bug.cgi?id=190272
+
+        Reviewed by Joseph Pecoraro.
+
+        * UserInterface/Controllers/ResourceQueryController.js:
+        (WI.ResourceQueryController.prototype._findQueryMatches):
+        Allow the `searchIndex` to go past the end of the `searchString` to allow for backtracking
+        if the last character of `searchString` is not found in `query`.
+
+2018-10-04  Devin Rousso  <drou...@apple.com>
+
         Web Inspector: REGRESSION(r236783): Uncaught Exception: Can't find variable: sourceMapURL
         https://bugs.webkit.org/show_bug.cgi?id=190276
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/ResourceQueryController.js (236843 => 236844)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/ResourceQueryController.js	2018-10-04 20:03:50 UTC (rev 236843)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/ResourceQueryController.js	2018-10-04 20:08:54 UTC (rev 236844)
@@ -146,7 +146,7 @@
             return false;
         }
 
-        while (queryIndex < query.length && searchIndex < searchString.length) {
+        while (queryIndex < query.length && searchIndex <= searchString.length) {
             if (type === WI.ResourceQueryMatch.Type.Special && !matchNextSpecialCharacter())
                 type = WI.ResourceQueryMatch.Type.Normal;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to