metamask-filecoin-developer-beta icon indicating copy to clipboard operation
metamask-filecoin-developer-beta copied to clipboard

Fix manifest creation

Open MakMuftic opened this issue 3 years ago • 1 comments

Fixes: #11

Explanation:
I tracked a bug inside Metamasks code that creates browser-specific manifests. The idea here is to have _base.json manifest that holds manifest properties that are needed on all browsers and then also have browser-specific manifests such as chrome.json. Then, when manifest for specific browser distribution is created, these two manifests are merged into one. The problem occurs when you have array property such as permissions in both _base.json and chrome.json (browser-specific manifest). Below you can find examples of how this merge worked before, and how it works now.

OLD BEHAVIOUR

  /* _base.json */
  "permissions": [
    "storage",
    "unlimitedStorage",
    "clipboardWrite",
    "http://localhost:8545/",
    "https://*.infura.io/",
    "activeTab",
    "webRequest",
    "*://*.eth/",
    "notifications"
  ]
  
  /* chrome.json */
  "permissions": [
    "chrome-extension://*/*"
  ]
  
  /* results in merged permissions as shown below */
  /* problem is that new permissions from browser specific manifest ovveride base permission /*
  "permissions": [
    "chrome-extension://*/*",  /* notice that storage permission is missing */
    "unlimitedStorage",
    "clipboardWrite",
    "http://localhost:8545/",
    "https://*.infura.io/",
    "activeTab",
    "webRequest",
    "*://*.eth/",
    "notifications"
  ]
  

NEW BEHAVIOUR

  /* _base.json */
  "permissions": [
    "storage",
    "unlimitedStorage",
    "clipboardWrite",
    "http://localhost:8545/",
    "https://*.infura.io/",
    "activeTab",
    "webRequest",
    "*://*.eth/",
    "notifications"
  ]
  
  /* chrome.json */
  "permissions": [
    "chrome-extension://*/*"
  ]
  
  /* results in merged permissions as shown below */
  "permissions": [ 
    "storage"
    "unlimitedStorage",
    "clipboardWrite",
    "http://localhost:8545/",
    "https://*.infura.io/",
    "activeTab",
    "webRequest",
    "*://*.eth/",
    "notifications",
    "chrome-extension://*/*"
  ]
  

I have read the CLA Document and I hereby sign the CLA

MakMuftic avatar Oct 04 '21 14:10 MakMuftic

I have read the CLA Document and I hereby sign the CLA

MakMuftic avatar Oct 05 '21 11:10 MakMuftic