Title: [240487] trunk/Source/WebInspectorUI
Revision
240487
Author
[email protected]
Date
2019-01-25 11:35:29 -0800 (Fri, 25 Jan 2019)

Log Message

Web Inspector: `WI.Setting.migrateValue` doesn't take into account the key prefix
https://bugs.webkit.org/show_bug.cgi?id=193814

Reviewed by Matt Baker.

* UserInterface/Base/Setting.js:
(WI.Setting):
(WI.Setting.migrateValue):
(WI.Setting._localStorageKey): Added.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (240486 => 240487)


--- trunk/Source/WebInspectorUI/ChangeLog	2019-01-25 19:21:36 UTC (rev 240486)
+++ trunk/Source/WebInspectorUI/ChangeLog	2019-01-25 19:35:29 UTC (rev 240487)
@@ -1,5 +1,17 @@
 2019-01-25  Devin Rousso  <[email protected]>
 
+        Web Inspector: `WI.Setting.migrateValue` doesn't take into account the key prefix
+        https://bugs.webkit.org/show_bug.cgi?id=193814
+
+        Reviewed by Matt Baker.
+
+        * UserInterface/Base/Setting.js:
+        (WI.Setting):
+        (WI.Setting.migrateValue):
+        (WI.Setting._localStorageKey): Added.
+
+2019-01-25  Devin Rousso  <[email protected]>
+
         Web Inspector: improve invalid Audit/Recording JSON error messages
         https://bugs.webkit.org/show_bug.cgi?id=193476
         <rdar://problem/47303659>

Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Setting.js (240486 => 240487)


--- trunk/Source/WebInspectorUI/UserInterface/Base/Setting.js	2019-01-25 19:21:36 UTC (rev 240486)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Setting.js	2019-01-25 19:35:29 UTC (rev 240487)
@@ -37,9 +37,7 @@
 
         this._name = name;
 
-        let inspectionLevel = InspectorFrontendHost ? InspectorFrontendHost.inspectionLevel() : 1;
-        let levelString = inspectionLevel > 1 ? "-" + inspectionLevel : "";
-        this._localStorageKey = `com.apple.WebInspector${levelString}.${name}`;
+        this._localStorageKey = WI.Setting._localStorageKey(this._name);
         this._defaultValue = defaultValue;
     }
 
@@ -47,17 +45,26 @@
 
     static migrateValue(key)
     {
+        let localStorageKey = WI.Setting._localStorageKey(key);
+
         let value = undefined;
-        if (!window.InspectorTest && window.localStorage && key in window.localStorage) {
+        if (!window.InspectorTest && window.localStorage && localStorageKey in window.localStorage) {
             try {
-                value = JSON.parse(window.localStorage[key]);
+                value = JSON.parse(window.localStorage[localStorageKey]);
             } catch { }
 
-            window.localStorage.removeItem(key);
+            window.localStorage.removeItem(localStorageKey);
         }
         return value;
     }
 
+    static _localStorageKey(name)
+    {
+        let inspectionLevel = InspectorFrontendHost ? InspectorFrontendHost.inspectionLevel() : 1;
+        let levelString = inspectionLevel > 1 ? "-" + inspectionLevel : "";
+        return `com.apple.WebInspector${levelString}.${name}`;
+    }
+
     // Public
 
     get name()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to