Bug 1428264 - Do not show chrome urls in storage inspector r?pbro draft
authorMichael Ratcliffe <mratcliffe@mozilla.com>
Fri, 16 Mar 2018 14:33:24 +0000
changeset 769859 7e72e63b0c4b35e155a880241864e39c379ae09a
parent 769726 bfb7edfd0436db388bb9e103b8ad817fc50bfdcf
push id103237
push userbmo:mratcliffe@mozilla.com
push dateTue, 20 Mar 2018 09:10:13 +0000
reviewerspbro
bugs1428264
milestone61.0a1
Bug 1428264 - Do not show chrome urls in storage inspector r?pbro On investigation it turns out that no storage types are supported for chrome:// urls. MozReview-Commit-ID: JZcQg5FvfvN
devtools/server/actors/storage.js
--- a/devtools/server/actors/storage.js
+++ b/devtools/server/actors/storage.js
@@ -158,31 +158,32 @@ StorageActors.defaults = function(typeNa
     getHostName(location) {
       if (!location) {
         // Debugging a legacy Firefox extension... no hostname available and no
         // storage possible.
         return null;
       }
 
       switch (location.protocol) {
+        case "about:":
+          return `${location.protocol}${location.pathname}`;
+        case "chrome:":
+          // chrome: URLs do not support storage of any type.
+          return null;
         case "data:":
           // data: URLs do not support storage of any type.
           return null;
-        case "about:":
-          return location.protocol + location.pathname;
-        case "chrome:":
-          return location.protocol + location.pathname;
         case "file:":
           return `${location.protocol}//${location.pathname}`;
-        case "resource:":
-          return location.origin + location.pathname;
+        case "javascript:":
+          return location.href;
         case "moz-extension:":
           return location.origin;
-        case "javascript:":
-          return location.href;
+        case "resource:":
+          return `${location.origin}${location.pathname}`;
         default:
           // http: or unknown protocol.
           return `${location.protocol}//${location.host}`;
       }
     },
 
     initialize(storageActor) {
       protocol.Actor.prototype.initialize.call(this, null);