Title: [277212] trunk/Source/WebInspectorUI
Revision
277212
Author
[email protected]
Date
2021-05-07 16:59:38 -0700 (Fri, 07 May 2021)

Log Message

Web Inspector: Default source for new test cases is minified
https://bugs.webkit.org/show_bug.cgi?id=225546

Reviewed by Devin Rousso.

Move the placeholder test code to `WI.DefaultAudits` as part of the non-minified sources so that new audit test
cases do not have their default placeholder script minified. This also allows us to remove
`WI.AuditTestCase.stringifyFunction` as it is no longer needed.

* UserInterface/Models/AuditTestCase.js:
(WI.AuditTestCase.stringifyFunction): Deleted.
* UserInterface/NonMinified/DefaultAudits.js:
(WI.DefaultAudits.newAuditPlaceholder):
* UserInterface/Views/CreateAuditPopover.js:
(WI.CreateAuditPopover.prototype.dismiss):
(WI.CreateAuditPopover.prototype.dismiss.const.placeholderTestFunction): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (277211 => 277212)


--- trunk/Source/WebInspectorUI/ChangeLog	2021-05-07 23:49:48 UTC (rev 277211)
+++ trunk/Source/WebInspectorUI/ChangeLog	2021-05-07 23:59:38 UTC (rev 277212)
@@ -1,3 +1,22 @@
+2021-05-07  Patrick Angle  <[email protected]>
+
+        Web Inspector: Default source for new test cases is minified
+        https://bugs.webkit.org/show_bug.cgi?id=225546
+
+        Reviewed by Devin Rousso.
+
+        Move the placeholder test code to `WI.DefaultAudits` as part of the non-minified sources so that new audit test
+        cases do not have their default placeholder script minified. This also allows us to remove
+        `WI.AuditTestCase.stringifyFunction` as it is no longer needed.
+
+        * UserInterface/Models/AuditTestCase.js:
+        (WI.AuditTestCase.stringifyFunction): Deleted.
+        * UserInterface/NonMinified/DefaultAudits.js:
+        (WI.DefaultAudits.newAuditPlaceholder):
+        * UserInterface/Views/CreateAuditPopover.js:
+        (WI.CreateAuditPopover.prototype.dismiss):
+        (WI.CreateAuditPopover.prototype.dismiss.const.placeholderTestFunction): Deleted.
+
 2021-05-04  Devin Rousso  <[email protected]>
 
         Web Inspector: add assertion for `WI.View` re-entrancy

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/AuditTestCase.js (277211 => 277212)


--- trunk/Source/WebInspectorUI/UserInterface/Models/AuditTestCase.js	2021-05-07 23:49:48 UTC (rev 277211)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/AuditTestCase.js	2021-05-07 23:59:38 UTC (rev 277212)
@@ -77,19 +77,6 @@
         return new WI.AuditTestCase(payload.name, payload.test, options);
     }
 
-    static stringifyFunction(func, indentLevel)
-    {
-        let string = func.toString();
-
-        // Remove spaces to make the function look unindented.
-        string = string.replaceAll(new RegExp(`^ {${indentLevel}}`, "gm"), "");
-
-        // Replace remaining indentations with the user set indent string.
-        string = string.replaceAll(/^    /gm, WI.indentString());
-
-        return string;
-    }
-
     // Public
 
     get test()

Modified: trunk/Source/WebInspectorUI/UserInterface/NonMinified/DefaultAudits.js (277211 => 277212)


--- trunk/Source/WebInspectorUI/UserInterface/NonMinified/DefaultAudits.js	2021-05-07 23:49:48 UTC (rev 277211)
+++ trunk/Source/WebInspectorUI/UserInterface/NonMinified/DefaultAudits.js	2021-05-07 23:59:38 UTC (rev 277212)
@@ -679,3 +679,10 @@
     let domNodes = Array.from(document.querySelectorAll(`[aria-hidden]:not([aria-hidden="true"], [aria-hidden="false"])`));
     return {level: domNodes.length ? "fail" : "pass", domNodes, domAttributes: ["aria-hidden"]};
 };
+
+WI.DefaultAudits.newAuditPlaceholder = function() {
+    let result = {
+        level: "pass",
+    };
+    return result;
+};

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CreateAuditPopover.js (277211 => 277212)


--- trunk/Source/WebInspectorUI/UserInterface/Views/CreateAuditPopover.js	2021-05-07 23:49:48 UTC (rev 277211)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CreateAuditPopover.js	2021-05-07 23:59:38 UTC (rev 277212)
@@ -86,13 +86,7 @@
 
     dismiss()
     {
-        const placeholderTestFunction = function() {
-            let result = {
-                level: "pass",
-            };
-            return result;
-        };
-        const placeholderTestFunctionString = WI.AuditTestCase.stringifyFunction(placeholderTestFunction, 8);
+        const placeholderTestFunctionString = WI.DefaultAudits.newAuditPlaceholder.toString();
 
         let type = this._typeSelectElement.value;
         let name = this._nameInputElement.value;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to