Strip out more characters when creating permalinks
authorjonlee@apple.com <jonlee@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Jun 2018 17:40:42 +0000 (17:40 +0000)
committerjonlee@apple.com <jonlee@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Jun 2018 17:40:42 +0000 (17:40 +0000)
https://bugs.webkit.org/show_bug.cgi?id=186259

Reviewed by Said Abou-Hallawa.

Tests and suites may have names that make permalinks to the tests less readable when
shared. Expand the set of characters that are stripped out of the names.

* MotionMark/resources/debug-runner/motionmark.js: Refactor to call
stripUnwantedCharactersForURL. For existing links, decode the suite and test names.
* MotionMark/resources/extensions.js:
(Utilities.stripUnwantedCharactersForURL): Rename from stripNonASCIICharacters.
Remove any non-alphanumeric character.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232547 268f45cc-cd09-0410-ab3c-d52691b4dbfc

PerformanceTests/ChangeLog
PerformanceTests/MotionMark/resources/debug-runner/motionmark.js
PerformanceTests/MotionMark/resources/extensions.js

index e397ecb..ed7ba54 100644 (file)
@@ -1,3 +1,19 @@
+2018-06-06  Jon Lee  <jonlee@apple.com>
+
+        Strip out more characters when creating permalinks
+        https://bugs.webkit.org/show_bug.cgi?id=186259
+
+        Reviewed by Said Abou-Hallawa.
+
+        Tests and suites may have names that make permalinks to the tests less readable when
+        shared. Expand the set of characters that are stripped out of the names.
+
+        * MotionMark/resources/debug-runner/motionmark.js: Refactor to call
+        stripUnwantedCharactersForURL. For existing links, decode the suite and test names.
+        * MotionMark/resources/extensions.js:
+        (Utilities.stripUnwantedCharactersForURL): Rename from stripNonASCIICharacters.
+        Remove any non-alphanumeric character.
+
 2018-06-04  Jon Lee  <jonlee@apple.com>
 
         Remove unnecessary MotionMark controllers
index 88b1c3d..ffc7a7d 100644 (file)
@@ -360,7 +360,7 @@ window.suitesManager =
         var link = Utilities.createElement("span", {}, testElement);
         link.classList.add("link");
         link.textContent = "link";
-        link.suiteName = Utilities.stripNonASCIICharacters(suiteCheckbox.suite.name);
+        link.suiteName = Utilities.stripUnwantedCharactersForURL(suiteCheckbox.suite.name);
         link.testName = test.name;
         link.onclick = function(event) {
             var element = event.target;
@@ -369,7 +369,7 @@ window.suitesManager =
             var options = optionsManager.updateLocalStorageFromUI();
             Utilities.extendObject(options, {
                 "suite-name": element.suiteName,
-                "test-name": Utilities.stripNonASCIICharacters(element.testName)
+                "test-name": Utilities.stripUnwantedCharactersForURL(element.testName)
             });
             var complexity = suitesManager._editElement(element.parentNode).value;
             if (complexity)
@@ -481,19 +481,22 @@ window.suitesManager =
 
     suitesFromQueryString: function(suiteName, testName)
     {
+        suiteName = decodeURIComponent(suiteName);
+        testName = decodeURIComponent(testName);
+
         var suites = [];
         var suiteRegExp = new RegExp(suiteName, "i");
         var testRegExp = new RegExp(testName, "i");
 
         for (var i = 0; i < Suites.length; ++i) {
             var suite = Suites[i];
-            if (!Utilities.stripNonASCIICharacters(suite.name).match(suiteRegExp))
+            if (!Utilities.stripUnwantedCharactersForURL(suite.name).match(suiteRegExp))
                 continue;
 
             var test;
             for (var j = 0; j < suite.tests.length; ++j) {
                 suiteTest = suite.tests[j];
-                if (Utilities.stripNonASCIICharacters(suiteTest.name).match(testRegExp)) {
+                if (Utilities.stripUnwantedCharactersForURL(suiteTest.name).match(testRegExp)) {
                     test = suiteTest;
                     break;
                 }
index 38c72d6..e4a7efd 100644 (file)
@@ -147,9 +147,9 @@ Utilities =
         element.style[property] = element.style[this.browserPrefix().js + property[0].toUpperCase() + property.substr(1)] = value;
     },
 
-    stripNonASCIICharacters: function(inputString)
+    stripUnwantedCharactersForURL: function(inputString)
     {
-        return inputString.replace(/[ .,]/g, '');
+        return inputString.replace(/\W/g, '');
     },
 
     convertObjectToQueryString: function(object)