Bug 1542035 Comment 8 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

((Below is the QA Test Plan. I will upload the test extensions before merge day.))

## Bug 1542035 QA Test Plan

### Setup
1. Open Firefox Beta 70 in a new profile
2. Download the following test extensions attached to this bug:
  * Test Extension 1: 1542035-test-extension-1-1.0.zip
    * Extension with Background script and browserAction toolbar button. Clicking the browserAction toolbar button opens a popup with a menu.
  * Test Extension 2: 1542035-test-extension-2-1.0.zip
    * Extension with no Background script and a browserAction toolbar button. Clicking the browserAction toolbar button opens a popup with a menu.

Notes about the test extensions:
* For any non-add operations (i.e. edit, remove, remove all), storage items must first be added.
* Any non-add bulk operations will affect all storage items if there are less than 10 in total.

### Verify Extension Storage is not listed in the Storage panel sidebar when ...

#### The Storage panel is in the addon toolbox and the feature is disabled
1. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `false`.
2. Load Test Extension 1 in `about:debugging`.
3. Open the addon toolbox for Test Extension 1 in `about:debugging`, and select the Storage panel.
4. Verify "Extension Storage" is not listed in the left sidebar.

#### The Storage panel is in a non-addon toolbox and the feature is enabled
1. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `true`.
2. Load Test Extension 1 in `about:debugging`.
3. Open a page in a new tab (e.g. https://www.mozilla.org/).
4. Open the in-page toolbox and select the Storage panel.
5. Verify "Extension Storage" is not listed in the left sidebar.

### Verify Storage panel data matches expected data when...

#### Storage data is modified by various different scripts in the same session
Important: Complete these checks for both Test Extension 1 and Test Extension 2 (referred to as Test Extension below):
1. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `true`.
2. Load Test Extension in `about:debugging`.
3. If Test Extension 1, open any http(s) page in a new tab (e.g. https://www.mozilla.org/).
4. Click the browserAction toolbar icon.
5. For each option in the browserAction popup:
  * Click an option, e.g. "Background script adds a new storage item" or "browserAction script adds a new storage item".
  * Open the addon toolbox for Test Extension in `about:debugging`.
  * Select the Console panel and note the storage item(s) that is/are modified.
  * Open the Storage panel and select the extension under "Extension Storage" in the sidebar.
  * Verify the storage data displayed in the panel reflects the modification(s).
    * The Storage panel should display the correct data whether the addon toolbox is left open or closed and re-opened each time.
    
#### Storage data is modified by various different scripts, and then the extension is restarted
Important: Complete these checks for both Test Extension 1 and Test Extension 2 (referred to as Test Extension below):
1. Remove any previous installation of Test Extension 1 and/or Test Extension 2.
2. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `true`.
3. If Test Extension 1, open any http(s) page in a new tab (e.g. https://www.mozilla.org/).
4. Load Test Extension in `about:debugging`.
5. Click the browserAction toolbar icon.
6. In the popup, click 'Background script bulk adds several storage items' or 'browserAction script bulk adds several storage items'.
7. Open the addon toolbox for Test Extension in `about:debugging`.
8. Select the Storage panel, and select the extension under "Extension Storage" in the sidebar and note the storage items added.
9. Leaving the Storage panel open, disable the extension in `about:addons`.
10. Enable the extension in `about:addons`.
11. Verify the storage data in the panel matches the data added prior to disabling the addon.

#### Verify JSONifiable values display as-is while non-JSONifiable values display as "Object"
1. Remove any previous installation of Test Extension 1 and/or Test Extension 2.
2. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `true`.
3. Load Test Extension 1 in `about:debugging`.
4. Open the addon toolbox for Test Extension 1 in `about:debugging`.
5. Select the Console panel, and for each of the following stringifiable items, verify they are set as a string equivalent in the Storage panel (Note: the Console panel does not always provide helpful error messages for incorrect syntax, so it is recommended to copy these lines over exactly and limit modifications):
```js
await browser.storage.local.set({a: 123});
await browser.storage.local.set({b: true});
await browser.storage.local.set({c: "test"});
await browser.storage.local.set({d: [1, 2]});
await browser.storage.local.set({e: {f: false}});
await browser.storage.local.set({g: null});
```
Select the Console panel, and for each of the following non-stringifiable items, verify they are set as “Object” in the Storage panel:
```js
await browser.storage.local.set({map: new Map()});
await browser.storage.local.set({set: new Set()});
await browser.storage.local.set({arrayBuffer: new ArrayBuffer(8)});
await browser.storage.local.set({regexp: /regexp/});
await browser.storage.local.set({bigint: 1n})
await browser.storage.local.set({date: new Date()})
```

### Try out a real world extension and modify some of its settings kept in storage local
1. In the same profile as before, download Tree Style Tab from https://addons.mozilla.org/en-US/firefox/addon/tree-style-tab/.
2. Leaving any new tabs that are created from the install open, open the addon toolbox for Tree Style Tab in `about:debugging`.
3. Select the Storage panel, and select the extension under "Extension Storage" in the sidebar and note the storage items present.
  * For version 3.1.7, you should see something like:
    * closeParentBehaviorMode: 1
    * configsVersion: 7
    * notifiedFeaturesVersion: 3
4. In the extension page that opens up, check both checkbox options. Click through the prompts to accept the increased permissions.
  * For version 3.1.7, the Storage panel should now have data such as:
    * closeParentBehaviorMode: 1
    * configsVersion: 7
    * notifiedFeaturesVersion: 3
    * requestingPermissionsNatively: null
    * skipCollapsedTabsForTabSwitchingShortcuts: true

### Helpful tips
* How to clear the test extension’s storage:
  * Since the test extensions are just temporarily installed, simply restart Firefox.
  * Note that you will need to re-install the test extension via `about:debugging`.
* What the error, `TypeError: CONTENT_SCRIPT_PORT is null` means:
  * Make sure you have an http(s):// page loaded in a tab (e.g. https://www.mozilla.org/).
  * If the extension has restarted (e.g. disabled/re-enabled, reloaded…) since the page was loaded, you may need to reload the page.
((Below is the QA Test Plan. I will upload the test extensions before merge day.))

## Bug 1542035 QA Test Plan

### Setup
1. Open Firefox Beta 70 in a new profile
2. Download the following test extensions attached to this bug:
  * Test Extension 1: 1542035-test-extension-1-1.0.zip
    * Extension with Background script, a content script that loads into any `http(s)://` webpage, and a browserAction toolbar button. Clicking the browserAction toolbar button opens a popup with a menu.
  * Test Extension 2: 1542035-test-extension-2-1.0.zip
    * Extension with no Background script and a browserAction toolbar button. Clicking the browserAction toolbar button opens a popup with a menu.

Notes about the test extensions:
* For any non-add operations (i.e. edit, remove, remove all), storage items must first be added.
* Any non-add bulk operations will affect all storage items if there are less than 10 in total.

### Verify Extension Storage is not listed in the Storage panel sidebar when ...

#### The Storage panel is in the addon toolbox and the feature is disabled
1. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `false`.
2. Load Test Extension 1 in `about:debugging`.
3. Open the addon toolbox for Test Extension 1 in `about:debugging`, and select the Storage panel.
4. Verify "Extension Storage" is not listed in the left sidebar.

#### The Storage panel is in a non-addon toolbox and the feature is enabled
1. Restart Firefox using the same profile.
2. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `true`.
3. Load Test Extension 1 in `about:debugging`.
4. Open a page in a new tab (e.g. https://www.mozilla.org/).
5. Open the in-page toolbox and select the Storage panel.
6. Verify "Extension Storage" is not listed in the left sidebar.

### Verify Storage panel data matches expected data when...

#### Storage data is modified by various different scripts in the same session
Important: Complete these checks for both Test Extension 1 and Test Extension 2 (referred to as Test Extension below):
1. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `true`.
2. Load Test Extension in `about:debugging`.
3. If Test Extension 1, open any http(s) page in a new tab (e.g. https://www.mozilla.org/). If such a page was already open, reloading it is sufficient.
4. Click the browserAction toolbar icon.
5. For each option in the browserAction popup:
  * Click an option, e.g. "Background script adds a new storage item" or "browserAction script adds a new storage item".
  * Open the addon toolbox for Test Extension in `about:debugging`.
  * Select the Console panel and note the storage item(s) that is/are modified.
  * Open the Storage panel and select the extension under "Extension Storage" in the sidebar.
  * Verify the storage data displayed in the panel reflects the modification(s).
    * The Storage panel should display the correct data whether the addon toolbox is left open or closed and re-opened each time.
    * Note that if the Storage panel is left open, some modifications require clicking the 'Refresh Items' button in the top right corner of the panel.
    
#### Storage data is modified by various different scripts, and then the extension is restarted
Important: Complete these checks for both Test Extension 1 and Test Extension 2 (referred to as Test Extension below):
1. Remove any previous installation of Test Extension 1 and/or Test Extension 2.
2. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `true`.
3. Load Test Extension in `about:debugging`.
4. Click the browserAction toolbar icon.
5. In the popup, click 'Background script bulk adds several storage items' or 'browserAction script bulk adds several storage items'.
6. Open the addon toolbox for Test Extension in `about:debugging`.
7. Select the Storage panel, and select the extension under "Extension Storage" in the sidebar and note the storage items added.
8. Leaving the Storage panel open, disable the extension in `about:addons`.
9. Switch back to the Storage panel, and observe that the extension is no longer listed under "Extension Storage" in the left sidebar, and there is no data shown in the main area of the panel.
10. Enable the extension in `about:addons`.
11. Switch back to the Storage panel, and select the extension under "Extension Storage" in the sidebar.
12. Verify the storage data in the panel matches the data added prior to disabling the addon.

#### Verify JSONifiable values display as-is while non-JSONifiable values display as "Object"
1. Remove any previous installation of Test Extension 1 and/or Test Extension 2.
2. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `true`.
3. Load Test Extension 1 in `about:debugging`.
4. Open the addon toolbox for Test Extension 1 in `about:debugging`.
5. Select the Console panel, and for each of the following stringifiable items, verify they are set as a string equivalent in the Storage panel:
Note: Quotes around object keys such as `f` below are expected.
Note: the Console panel does not always provide helpful error messages for incorrect syntax, so it is recommended to copy these lines over exactly and limit modifications.
```js
await browser.storage.local.set({a: 123});
await browser.storage.local.set({b: true});
await browser.storage.local.set({c: "test"});
await browser.storage.local.set({d: [1, 2]});
await browser.storage.local.set({e: {f: false}});
await browser.storage.local.set({g: null});
```

Select the Console panel, and for each of the following non-stringifiable items, verify they are set as “Object” in the Storage panel:
```js
await browser.storage.local.set({map: new Map()});
await browser.storage.local.set({set: new Set()});
await browser.storage.local.set({arrayBuffer: new ArrayBuffer(8)});
await browser.storage.local.set({regexp: /regexp/});
await browser.storage.local.set({bigint: 1n})
await browser.storage.local.set({date: new Date()})
```

### Try out a real world extension and modify some of its settings kept in storage local
1. In the same profile as before, download Tree Style Tab from https://addons.mozilla.org/en-US/firefox/addon/tree-style-tab/.
2. Leaving any new tabs that are created from the install open, open the addon toolbox for Tree Style Tab in `about:debugging`.
3. Select the Storage panel, and select the extension under "Extension Storage" in the sidebar and note the storage items present.
  * For version 3.1.7, you should see something like:
    * closeParentBehaviorMode: 1
    * configsVersion: 7
    * notifiedFeaturesVersion: 3
4. In the extension page that opens up, check both checkbox options. Click through the prompts to accept the increased permissions.
  * For version 3.1.7, the Storage panel should now have data such as:
    * closeParentBehaviorMode: 1
    * configsVersion: 7
    * notifiedFeaturesVersion: 3
    * requestingPermissionsNatively: null
    * skipCollapsedTabsForTabSwitchingShortcuts: true

### Helpful tips
* How to clear the test extension’s storage:
  * Since the test extensions are just temporarily installed, simply restart Firefox.
  * Note that you will need to re-install the test extension via `about:debugging`.
* What the error, `TypeError: CONTENT_SCRIPT_PORT is null` means:
  * Make sure you have an http(s):// page loaded in a tab (e.g. https://www.mozilla.org/).
  * If the extension has restarted (e.g. disabled/re-enabled, reloaded…) since the page was loaded, you may need to reload the page.
## Bug 1542035 QA Test Plan

### Setup
1. Open Firefox Beta 70 in a new profile
2. Download the following test extensions attached to this bug:
  * Test Extension 1: 1542035-test-extension-1-1.0.zip
    * Extension with Background script, a content script that loads into any `http(s)://` webpage, and a browserAction toolbar button. Clicking the browserAction toolbar button opens a popup with a menu.
  * Test Extension 2: 1542035-test-extension-2-1.0.zip
    * Extension with no Background script and a browserAction toolbar button. Clicking the browserAction toolbar button opens a popup with a menu.

#### Notes about the test extensions:
* For any non-add operations (i.e. edit, remove, remove all), storage items must first be added.
* Any non-add bulk operations will affect all storage items if there are less than 10 in total.
* Both test extensions use a counter for adding new storage items via the browserAction popup menu. This counter starts at `1` (so the first storage item to be added is `{"1": 1}` and so on). It is stored in `storage.sync`; therefore it can only be reset back to `1` by clearing the profile's sync data (or using a new profile). There shouldn't be a need to reset the counter.

### Verify Extension Storage is not listed in the Storage panel sidebar when ...

#### The Storage panel is in the addon toolbox and the feature is disabled
1. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `false`.
2. Load Test Extension 1 in `about:debugging`.
3. Open the addon toolbox for Test Extension 1 in `about:debugging`, and select the Storage panel.
4. Verify "Extension Storage" is not listed in the left sidebar.

#### The Storage panel is in a non-addon toolbox and the feature is enabled
1. Restart Firefox using the same profile.
2. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `true`.
3. Load Test Extension 1 in `about:debugging`.
4. Open a page in a new tab (e.g. https://www.mozilla.org/).
5. Open the in-page toolbox and select the Storage panel.
6. Verify "Extension Storage" is not listed in the left sidebar.

### Verify Storage panel data matches expected data when...

#### Storage data is modified by various different scripts in the same session
Important: Complete these checks for both Test Extension 1 and Test Extension 2 (referred to as Test Extension below):
1. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `true`.
2. Load Test Extension in `about:debugging`.
3. If Test Extension 1, open any http(s) page in a new tab (e.g. https://www.mozilla.org/). If such a page was already open, reloading it is sufficient.
4. If Test Extension 2, open the addon toolbox for the extension in `about:debugging` and click "Disable Popup Auto-Hide" in the toolbox's overflow menu. Move the toolbox to a second, separate window.
5. Click the browserAction toolbar icon in the (first) window.
6. For each option in the browserAction popup:
  * Click an option, e.g. "Background script adds a new storage item" or "browserAction script adds a new storage item".
  * Open (or switch back to) the addon toolbox for Test Extension in `about:debugging`.
  * Select the Console panel and note the storage item(s) that is/are modified.
  * Open the Storage panel and select the extension under "Extension Storage" in the left sidebar.
  * Verify the storage data displayed in the panel reflects the modification(s).
    * The Storage panel should display the correct data whether the addon toolbox is left open or closed and re-opened each time.
    * Note that if the Storage panel is left open, some modifications require clicking the 'Refresh Items' button in the top right corner of the panel.
    
#### Storage data is modified by various different scripts, and then the extension is restarted
Important: Complete these checks for both Test Extension 1 and Test Extension 2 (referred to as Test Extension below):
1. Remove any previous installation of Test Extension 1 and/or Test Extension 2 and close any open toolboxes.
2. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `true`.
3. Load Test Extension in `about:debugging`.
4. If Test Extension 2, open the addon toolbox for the extension in `about:debugging` and click "Disable Popup Auto-Hide" in the toolbox's overflow menu. Move the toolbox to a second, separate window.
5. Click the browserAction toolbar icon in the (first) window.
6. In the popup, click 'Background script bulk adds several storage items' or 'browserAction script bulk adds several storage items'.
7. Open (or switch back to) the addon toolbox for Test Extension in `about:debugging`.
8. Select the Storage panel, and select the extension under "Extension Storage" in the left sidebar and note the storage items added.
9. Leaving the Storage panel open, disable the extension in `about:addons`.
10. Enable the extension in `about:addons`.
11. Switch back to the Storage panel, and select the extension under "Extension Storage" in the left sidebar.
12. Verify the storage data in the panel matches the data added prior to disabling the addon.

#### Verify JSONifiable values display as-is while non-JSONifiable values display as "Object"
1. Remove any previous installation of Test Extension 1 and/or Test Extension 2 and close any open toolboxes.
2. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `true`.
3. Load Test Extension 1 in `about:debugging`.
4. Open the addon toolbox for Test Extension 1 in `about:debugging`.
5. Select the Console panel, and for each of the following stringifiable items, verify they are set as a string equivalent in the Storage panel:
  * Note: Quotes around object literal keys such as `f` below are expected.
  * Note: the Console panel does not always provide helpful error messages for incorrect syntax, so it is recommended to copy these lines over exactly and limit modifications.
```js
await browser.storage.local.set({a: 123});
await browser.storage.local.set({b: true});
await browser.storage.local.set({c: "test"});
await browser.storage.local.set({d: [1, 2]});
await browser.storage.local.set({e: {f: false}});
await browser.storage.local.set({g: null});```

Select the Console panel, and for each of the following non-stringifiable items, verify they are set as “Object” in the Storage panel:
```js
await browser.storage.local.set({map: new Map()});
await browser.storage.local.set({set: new Set()});
await browser.storage.local.set({arrayBuffer: new ArrayBuffer(8)});
await browser.storage.local.set({regexp: /regexp/});
await browser.storage.local.set({bigint: 1n})
await browser.storage.local.set({date: new Date()})
```

### Try out a real world extension and modify some of its settings kept in storage local
1. In the same profile as before, download Tree Style Tab from https://addons.mozilla.org/en-US/firefox/addon/tree-style-tab/.
2. Leaving any new tabs that are created from the install open, open the addon toolbox for Tree Style Tab in `about:debugging`.
3. Select the Storage panel, and select the extension under "Extension Storage" in the sidebar and note the storage items present.
  * For version 3.1.7, you should see something like:
    * closeParentBehaviorMode: 1
    * configsVersion: 7
    * notifiedFeaturesVersion: 3
4. In the extension page that opens up, check both checkbox options. Click through the prompts to accept the increased permissions.
  * For version 3.1.7, the Storage panel should now have data such as:
    * closeParentBehaviorMode: 1
    * configsVersion: 7
    * notifiedFeaturesVersion: 3
    * requestingPermissionsNatively: null
    * skipCollapsedTabsForTabSwitchingShortcuts: true

### Appendix

#### Helpful tips
* How to clear the test extension’s storage local:
  * Since the test extensions are just temporarily installed, simply restart Firefox.
  * Note that you will need to re-install the test extension via `about:debugging`.
* What the error, `TypeError: CONTENT_SCRIPT_PORT is null` means:
  * Make sure you have an http(s):// page loaded in a tab (e.g. https://www.mozilla.org/).
  * If the extension has restarted (e.g. disabled/re-enabled, reloaded…) since the page was loaded, you may need to reload the page.
* For Test Extension 2, the addon toolbox's Console panel clears every time the popup is opened, closed, or the browserAction button is hovered over. This makes it hard to reference the Console for how the storage data was modified without doing the following:
  * Each time the toolbox is opened, before opening the browserAction popup, click "Disable Popup Auto-Hide" in the overflow menu settings in the toolbox. This keeps the popup open and therefore keeps the Console from clearing.

#### Known or possible bugs I found while creating this test plan

_Should be fixed as part of this patch_
* Non-JSONifiable storage item values that are `typeof` `"bigint"` or `Date` objects are converted to a string version rather than listed as `"Object"` as stipulated in the Test Plan.
* Adding storage items while the addon toolbox's Storage panel is open live updates, but all other modifications requires a manual refresh by clicking the 'Refresh Items' button. It'd be nice if all modifications automatically refreshed. This may require changes to the larger storage actor framework and/or the Storage panel's client side code, which we've tried hard not to touch.

_May be a follow-up bug or unrelated_
* The behavior of the addon toolbox's Storage panel is different if left open between disabling and re-enabling it for Test Extension 1 (has background page) versus Test Extension 2 (does not have a background page). For the former, the panel updates to reflect that the extension is disabled. For the later, there is no change. This is outside of the scope of this patch, but it may be worth filing a follow-up bug.
* If I don’t add "1. Restart Firefox using the same profile" where it is in the Test Plan, the "Extension Storage" actor is not listed in the addon toolbox even when the pref is set to `true` before opening the toolbox. I think this may have to do with the larger debugger framework that is loading the storage actor script.
## Bug 1542035 QA Test Plan

### Setup
1. Open Firefox Beta 70 in a new profile
2. Download the following test extensions attached to this bug:
  * Test Extension 1: 1542035-test-extension-1-1.0.zip
    * Extension with Background script, a content script that loads into any `http(s)://` webpage, and a browserAction toolbar button. Clicking the browserAction toolbar button opens a popup with a menu.
  * Test Extension 2: 1542035-test-extension-2-1.0.zip
    * Extension with no Background script and a browserAction toolbar button. Clicking the browserAction toolbar button opens a popup with a menu.

#### Notes about the test extensions:
* For any non-add operations (i.e. edit, remove, remove all), storage items must first be added.
* Any non-add bulk operations will affect all storage items if there are less than 10 in total.
* Both test extensions use a counter for adding new storage items via the browserAction popup menu. This counter starts at `1` (so the first storage item to be added is `{"1": 1}` and so on). It is stored in `storage.sync`; therefore it can only be reset back to `1` by clearing the profile's sync data (or using a new profile). There shouldn't be a need to reset the counter.

### Verify Extension Storage is not listed in the Storage panel sidebar when ...

#### The Storage panel is in the addon toolbox and the feature is disabled
1. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `false`.
2. Load Test Extension 1 in `about:debugging`.
3. Open the addon toolbox for Test Extension 1 in `about:debugging`, and select the Storage panel.
4. Verify "Extension Storage" is not listed in the left sidebar.

#### The Storage panel is in a non-addon toolbox and the feature is enabled
1. Restart Firefox using the same profile.
2. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `true`.
3. Load Test Extension 1 in `about:debugging`.
4. Open a page in a new tab (e.g. https://www.mozilla.org/).
5. Open the in-page toolbox and select the Storage panel.
6. Verify "Extension Storage" is not listed in the left sidebar.

### Verify Storage panel data matches expected data when...

#### Storage data is modified by various different scripts in the same session
Important: Complete these checks for both Test Extension 1 and Test Extension 2 (referred to as Test Extension below):
1. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `true`.
2. Load Test Extension in `about:debugging`.
3. If Test Extension 1, open any http(s) page in a new tab (e.g. https://www.mozilla.org/). If such a page was already open, reloading it is sufficient.
4. If Test Extension 2, open the addon toolbox for the extension in `about:debugging` and click "Disable Popup Auto-Hide" in the toolbox's overflow menu. Move the toolbox to a second, separate window.
5. Click the browserAction toolbar icon in the (first) window.
6. For each option in the browserAction popup:
  * Click an option, e.g. "Background script adds a new storage item" or "browserAction script adds a new storage item".
  * Open (or switch back to) the addon toolbox for Test Extension in `about:debugging`.
  * Select the Console panel and note the storage item(s) that is/are modified.
  * Open the Storage panel and select the extension under "Extension Storage" in the left sidebar.
  * Verify the storage data displayed in the panel reflects the modification(s).
    * The Storage panel should display the correct data whether the addon toolbox is left open or closed and re-opened each time.
    * Note that if the Storage panel is left open, some modifications require clicking the 'Refresh Items' button in the top right corner of the panel.
    
#### Storage data is modified by various different scripts, and then the extension is restarted
Important: Complete these checks for both Test Extension 1 and Test Extension 2 (referred to as Test Extension below):
1. Remove any previous installation of Test Extension 1 and/or Test Extension 2 and close any open toolboxes.
2. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `true`.
3. Load Test Extension in `about:debugging`.
4. If Test Extension 2, open the addon toolbox for the extension in `about:debugging` and click "Disable Popup Auto-Hide" in the toolbox's overflow menu. Move the toolbox to a second, separate window.
5. Click the browserAction toolbar icon in the (first) window.
6. In the popup, click 'Background script bulk adds several storage items' or 'browserAction script bulk adds several storage items'.
7. Open (or switch back to) the addon toolbox for Test Extension in `about:debugging`.
8. Select the Storage panel, and select the extension under "Extension Storage" in the left sidebar and note the storage items added.
9. Leaving the Storage panel open, disable the extension in `about:addons`.
10. Enable the extension in `about:addons`.
11. Switch back to the Storage panel, and select the extension under "Extension Storage" in the left sidebar.
12. Verify the storage data in the panel matches the data added prior to disabling the addon.

#### Verify JSONifiable values display as-is while non-JSONifiable values display as "Object"
1. Remove any previous installation of Test Extension 1 and/or Test Extension 2 and close any open toolboxes.
2. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `true`.
3. Load Test Extension 1 in `about:debugging`.
4. Open the addon toolbox for Test Extension 1 in `about:debugging`.
5. Select the Console panel, and for each of the following stringifiable items, verify they are set as a string equivalent in the Storage panel:
  * Note: Quotes around object literal keys such as `f` below are expected.
  * Note: the Console panel does not always provide helpful error messages for incorrect syntax, so it is recommended to copy these lines over exactly and limit modifications.
```js
await browser.storage.local.set({a: 123});
await browser.storage.local.set({b: true});
await browser.storage.local.set({c: "test"});
await browser.storage.local.set({d: [1, 2]});
await browser.storage.local.set({e: {f: false}});
await browser.storage.local.set({g: null});```

Select the Console panel, and for each of the following non-stringifiable items, verify they are set as “Object” in the Storage panel:
```js
await browser.storage.local.set({map: new Map()});
await browser.storage.local.set({set: new Set()});
await browser.storage.local.set({arrayBuffer: new ArrayBuffer(8)});
await browser.storage.local.set({regexp: /regexp/});
```

### Try out a real world extension and modify some of its settings kept in storage local
1. In the same profile as before, download Tree Style Tab from https://addons.mozilla.org/en-US/firefox/addon/tree-style-tab/.
2. Leaving any new tabs that are created from the install open, open the addon toolbox for Tree Style Tab in `about:debugging`.
3. Select the Storage panel, and select the extension under "Extension Storage" in the sidebar and note the storage items present.
  * For version 3.1.7, you should see something like:
    * closeParentBehaviorMode: 1
    * configsVersion: 7
    * notifiedFeaturesVersion: 3
4. In the extension page that opens up, check both checkbox options. Click through the prompts to accept the increased permissions.
  * For version 3.1.7, the Storage panel should now have data such as:
    * closeParentBehaviorMode: 1
    * configsVersion: 7
    * notifiedFeaturesVersion: 3
    * requestingPermissionsNatively: null
    * skipCollapsedTabsForTabSwitchingShortcuts: true

### Appendix

#### Helpful tips
* How to clear the test extension’s storage local:
  * Since the test extensions are just temporarily installed, simply restart Firefox.
  * Note that you will need to re-install the test extension via `about:debugging`.
* What the error, `TypeError: CONTENT_SCRIPT_PORT is null` means:
  * Make sure you have an http(s):// page loaded in a tab (e.g. https://www.mozilla.org/).
  * If the extension has restarted (e.g. disabled/re-enabled, reloaded…) since the page was loaded, you may need to reload the page.
* For Test Extension 2, the addon toolbox's Console panel clears every time the popup is opened, closed, or the browserAction button is hovered over. This makes it hard to reference the Console for how the storage data was modified without doing the following:
  * Each time the toolbox is opened, before opening the browserAction popup, click "Disable Popup Auto-Hide" in the overflow menu settings in the toolbox. This keeps the popup open and therefore keeps the Console from clearing.

#### Known or possible bugs I found while creating this test plan

_Should be fixed as part of this patch_
* Adding storage items while the addon toolbox's Storage panel is open live updates, but all other modifications requires a manual refresh by clicking the 'Refresh Items' button. It'd be nice if all modifications automatically refreshed. This may require changes to the larger storage actor framework and/or the Storage panel's client side code, which we've tried hard not to touch.

_May be a follow-up bug or unrelated_
* The behavior of the addon toolbox's Storage panel is different if left open between disabling and re-enabling it for Test Extension 1 (has background page) versus Test Extension 2 (does not have a background page). For the former, the panel updates to reflect that the extension is disabled. For the later, there is no change. This is outside of the scope of this patch, but it may be worth filing a follow-up bug.
* If I don’t add "1. Restart Firefox using the same profile" where it is in the Test Plan, the "Extension Storage" actor is not listed in the addon toolbox even when the pref is set to `true` before opening the toolbox. I think this may have to do with the larger debugger framework that is loading the storage actor script.
## Bug 1542035 QA Test Plan

### Setup
1. Open Firefox Beta 70 in a new profile
2. Download the following test extensions attached to this bug:
  * Test Extension 1: 1542035-test-extension-1-1.0.zip
    * Extension with Background script, a content script that loads into any `http(s)://` webpage, and a browserAction toolbar button. Clicking the browserAction toolbar button opens a popup with a menu.
  * Test Extension 2: 1542035-test-extension-2-1.0.zip
    * Extension with no Background script and a browserAction toolbar button. Clicking the browserAction toolbar button opens a popup with a menu.

#### Notes about the test extensions:
* For any non-add operations (i.e. edit, remove, remove all), storage items must first be added.
* Any non-add bulk operations will affect all storage items if there are less than 10 in total.
* Both test extensions use a counter for adding new storage items via the browserAction popup menu. This counter starts at `1` (so the first storage item to be added is `{"1": 1}` and so on). It is stored in `storage.sync`; therefore it can only be reset back to `1` by clearing the profile's sync data (or using a new profile). There shouldn't be a need to reset the counter.

### Verify Extension Storage is not listed in the Storage panel sidebar when ...

#### The Storage panel is in the addon toolbox and the feature is disabled
1. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `false`.
2. Load Test Extension 1 in `about:debugging`.
3. Open the addon toolbox for Test Extension 1 in `about:debugging`, and select the Storage panel.
4. Verify "Extension Storage" is not listed in the left sidebar.

#### The Storage panel is in a non-addon toolbox and the feature is enabled
1. Restart Firefox using the same profile.
2. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `true`.
3. Load Test Extension 1 in `about:debugging`.
4. Open a page in a new tab (e.g. https://www.mozilla.org/).
5. Open the in-page toolbox and select the Storage panel.
6. Verify "Extension Storage" is not listed in the left sidebar.

### Verify Storage panel data matches expected data when...

#### Storage data is modified by various different scripts in the same session
Important: Complete these checks for both Test Extension 1 and Test Extension 2 (referred to as Test Extension below):
1. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `true`.
2. Load Test Extension in `about:debugging`.
3. If Test Extension 1, open any http(s) page in a new tab (e.g. https://www.mozilla.org/). If such a page was already open, reloading it is sufficient.
4. If Test Extension 2, open the addon toolbox for the extension in `about:debugging` and click "Disable Popup Auto-Hide" in the toolbox's overflow menu. Move the toolbox to a second, separate window.
5. Click the browserAction toolbar icon in the (first) window.
6. For each option in the browserAction popup:
  * Click an option, e.g. "Background script adds a new storage item" or "browserAction script adds a new storage item".
  * Open (or switch back to) the addon toolbox for Test Extension in `about:debugging`.
  * Select the Console panel and note the storage item(s) that is/are modified.
  * Open the Storage panel and select the extension under "Extension Storage" in the left sidebar.
  * Verify the storage data displayed in the panel reflects the modification(s).
    * The Storage panel should display the correct data whether the addon toolbox is left open or closed and re-opened each time.
    * Note that if the Storage panel is left open, some modifications require clicking the 'Refresh Items' button in the top right corner of the panel.
    
#### Storage data is modified by various different scripts, and then the extension is restarted
Important: Complete these checks for both Test Extension 1 and Test Extension 2 (referred to as Test Extension below):
1. Remove any previous installation of Test Extension 1 and/or Test Extension 2 and close any open toolboxes.
2. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `true`.
3. Load Test Extension in `about:debugging`.
4. If Test Extension 2, open the addon toolbox for the extension in `about:debugging` and click "Disable Popup Auto-Hide" in the toolbox's overflow menu. Move the toolbox to a second, separate window.
5. Click the browserAction toolbar icon in the (first) window.
6. In the popup, click 'Background script bulk adds several storage items' or 'browserAction script bulk adds several storage items'.
7. Open (or switch back to) the addon toolbox for Test Extension in `about:debugging`.
8. Select the Storage panel, and select the extension under "Extension Storage" in the left sidebar and note the storage items added.
9. Close the addon toolbox.
10. Disable the extension in `about:addons`.
11. Enable the extension in `about:addons`.
12. Open the addon toolbox for Test Extension in `about:debugging`.
13. Select the Storage panel, and select the extension under "Extension Storage" in the left sidebar.
14. Verify the storage data in the panel matches the data added prior to disabling the addon.

#### Verify JSONifiable values display as-is while non-JSONifiable values display as "Object"
1. Remove any previous installation of Test Extension 1 and/or Test Extension 2 and close any open toolboxes.
2. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `true`.
3. Load Test Extension 1 in `about:debugging`.
4. Open the addon toolbox for Test Extension 1 in `about:debugging`.
5. Select the Console panel, and for each of the following stringifiable items, verify they are set as a string equivalent in the Storage panel:
  * Note: Quotes around object literal keys such as `f` below are expected.
  * Note: the Console panel does not always provide helpful error messages for incorrect syntax, so it is recommended to copy these lines over exactly and limit modifications.
```js
await browser.storage.local.set({a: 123});
await browser.storage.local.set({b: true});
await browser.storage.local.set({c: "test"});
await browser.storage.local.set({d: [1, 2]});
await browser.storage.local.set({e: {f: false}});
await browser.storage.local.set({g: null});```

Select the Console panel, and for each of the following non-stringifiable items, verify they are set as “Object” in the Storage panel:
```js
await browser.storage.local.set({map: new Map()});
await browser.storage.local.set({set: new Set()});
await browser.storage.local.set({arrayBuffer: new ArrayBuffer(8)});
await browser.storage.local.set({regexp: /regexp/});
```

### Try out a real world extension and modify some of its settings kept in storage local
1. In the same profile as before, download Tree Style Tab from https://addons.mozilla.org/en-US/firefox/addon/tree-style-tab/.
2. Leaving any new tabs that are created from the install open, open the addon toolbox for Tree Style Tab in `about:debugging`.
3. Select the Storage panel, and select the extension under "Extension Storage" in the sidebar and note the storage items present.
  * For version 3.1.7, you should see something like:
    * closeParentBehaviorMode: 1
    * configsVersion: 7
    * notifiedFeaturesVersion: 3
4. In the extension page that opens up, check both checkbox options. Click through the prompts to accept the increased permissions.
  * For version 3.1.7, the Storage panel should now have data such as:
    * closeParentBehaviorMode: 1
    * configsVersion: 7
    * notifiedFeaturesVersion: 3
    * requestingPermissionsNatively: null
    * skipCollapsedTabsForTabSwitchingShortcuts: true

### Appendix

#### Helpful tips
* How to clear the test extension’s storage local:
  * Since the test extensions are just temporarily installed, simply restart Firefox.
  * Note that you will need to re-install the test extension via `about:debugging`.
* What the error, `TypeError: CONTENT_SCRIPT_PORT is null` means:
  * Make sure you have an http(s):// page loaded in a tab (e.g. https://www.mozilla.org/).
  * If the extension has restarted (e.g. disabled/re-enabled, reloaded…) since the page was loaded, you may need to reload the page.
* For Test Extension 2, the addon toolbox's Console panel clears every time the popup is opened, closed, or the browserAction button is hovered over. This makes it hard to reference the Console for how the storage data was modified without doing the following:
  * Each time the toolbox is opened, before opening the browserAction popup, click "Disable Popup Auto-Hide" in the overflow menu settings in the toolbox. This keeps the popup open and therefore keeps the Console from clearing.

#### Known or possible bugs I found while creating this test plan

_Should be fixed as part of this patch_
* Adding storage items while the addon toolbox's Storage panel is open live updates, but all other modifications requires a manual refresh by clicking the 'Refresh Items' button. It'd be nice if all modifications automatically refreshed. This may require changes to the larger storage actor framework and/or the Storage panel's client side code, which we've tried hard not to touch.

_May be a follow-up bug or unrelated_
* The behavior of the addon toolbox's Storage panel is different if left open between disabling and re-enabling it for Test Extension 1 (has background page) versus Test Extension 2 (does not have a background page). For the former, the panel updates to reflect that the extension is disabled. For the later, there is no change. This is outside of the scope of this patch, but it may be worth filing a follow-up bug.
## Bug 1542035 QA Test Plan

### Setup
1. Open Firefox Beta 70 in a new profile
2. Download the following test extensions attached to this bug:
  * Test Extension 1: 1542035-test-extension-1-1.0.zip
    * Extension with Background script, a content script that loads into any `http(s)://` webpage, and a browserAction toolbar button. Clicking the browserAction toolbar button opens a popup with a menu.
  * Test Extension 2: 1542035-test-extension-2-1.0.zip
    * Extension with no Background script and a browserAction toolbar button. Clicking the browserAction toolbar button opens a popup with a menu.

#### Notes about the test extensions:
* For any non-add operations (i.e. edit, remove, remove all), storage items must first be added.
* Any non-add bulk operations will affect all storage items if there are less than 10 in total.
* Both test extensions use a counter for adding new storage items via the browserAction popup menu. This counter starts at `1` (so the first storage item to be added is `{"1": 1}` and so on). It is stored in `storage.sync`; therefore it can only be reset back to `1` by clearing the profile's sync data (or using a new profile). There shouldn't be a need to reset the counter.

### Verify Extension Storage is not listed in the Storage panel sidebar when ...

#### The Storage panel is in the addon toolbox and the feature is disabled
1. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `false`.
2. Load Test Extension 1 in `about:debugging`.
3. Open the addon toolbox for Test Extension 1 in `about:debugging`, and select the Storage panel.
4. Verify "Extension Storage" is not listed in the left sidebar.

#### The Storage panel is in a non-addon toolbox and the feature is enabled
1. Restart Firefox using the same profile.
2. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `true`.
3. Load Test Extension 1 in `about:debugging`.
4. Open a page in a new tab (e.g. https://www.mozilla.org/).
5. Open the in-page toolbox and select the Storage panel.
6. Verify "Extension Storage" is not listed in the left sidebar.

### Verify Storage panel data matches expected data when...

#### Storage data is modified by various different scripts in the same session
Important: Complete these checks for both Test Extension 1 and Test Extension 2 (referred to as Test Extension below):
1. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `true`.
2. Load Test Extension in `about:debugging`.
3. If Test Extension 1, open any http(s) page in a new tab (e.g. https://www.mozilla.org/). If such a page was already open, reloading it is sufficient.
4. If Test Extension 2, open the addon toolbox for the extension in `about:debugging` and click "Disable Popup Auto-Hide" in the toolbox's overflow menu. Move the toolbox to a second, separate window.
5. Click the browserAction toolbar icon in the (first) window.
6. For each option in the browserAction popup:
  * Click an option, e.g. "Background script adds a new storage item" or "browserAction script adds a new storage item".
  * Open (or switch back to) the addon toolbox for Test Extension in `about:debugging`.
  * Select the Console panel and note the storage item(s) that is/are modified.
  * Open the Storage panel and select the extension under "Extension Storage" in the left sidebar.
  * Verify the storage data displayed in the panel reflects the modification(s).
    * The Storage panel should display the correct data whether the addon toolbox is left open or closed and re-opened each time.
    * Note that if the Storage panel is left open, some modifications require clicking the 'Refresh Items' button in the top right corner of the panel.
    
#### Storage data is modified by various different scripts, and then the extension is restarted
Important: Complete these checks for both Test Extension 1 and Test Extension 2 (referred to as Test Extension below):
1. Remove any previous installation of Test Extension 1 and/or Test Extension 2 and close any open toolboxes.
2. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `true`.
3. Load Test Extension in `about:debugging`.
4. If Test Extension 2, open the addon toolbox for the extension in `about:debugging` and click "Disable Popup Auto-Hide" in the toolbox's overflow menu. Move the toolbox to a second, separate window.
5. Click the browserAction toolbar icon in the (first) window.
6. In the popup, click 'Background script bulk adds several storage items' or 'browserAction script bulk adds several storage items'.
7. Open (or switch back to) the addon toolbox for Test Extension in `about:debugging`.
8. Select the Storage panel, and select the extension under "Extension Storage" in the left sidebar and note the storage items added.
9. Close the addon toolbox.
10. Disable the extension in `about:addons`.
11. Enable the extension in `about:addons`.
12. Open the addon toolbox for Test Extension in `about:debugging`.
13. Select the Storage panel, and select the extension under "Extension Storage" in the left sidebar.
14. Verify the storage data in the panel matches the data added prior to disabling the addon.

#### Verify JSONifiable values display as-is while non-JSONifiable values display as "Object"
1. Remove any previous installation of Test Extension 1 and/or Test Extension 2 and close any open toolboxes.
2. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `true`.
3. Load Test Extension 1 in `about:debugging`.
4. Open the addon toolbox for Test Extension 1 in `about:debugging`.
5. Select the Console panel, and for each of the following stringifiable items, verify they are set as a string equivalent in the Storage panel:
  * Note: Quotes around object literal keys such as `f` below are expected.
  * Note: the Console panel does not always provide helpful error messages for incorrect syntax, so it is recommended to copy these lines over exactly and limit modifications.
```js
await browser.storage.local.set({a: 123});
await browser.storage.local.set({b: true});
await browser.storage.local.set({c: "test"});
await browser.storage.local.set({d: [1, 2]});
await browser.storage.local.set({e: {f: false}});
await browser.storage.local.set({g: null});```
```
Select the Console panel, and for each of the following non-stringifiable items, verify they are set as “Object” in the Storage panel:
```js
await browser.storage.local.set({map: new Map()});
await browser.storage.local.set({set: new Set()});
await browser.storage.local.set({arrayBuffer: new ArrayBuffer(8)});
await browser.storage.local.set({regexp: /regexp/});
```

### Try out a real world extension and modify some of its settings kept in storage local
1. In the same profile as before, download Tree Style Tab from https://addons.mozilla.org/en-US/firefox/addon/tree-style-tab/.
2. Leaving any new tabs that are created from the install open, open the addon toolbox for Tree Style Tab in `about:debugging`.
3. Select the Storage panel, and select the extension under "Extension Storage" in the sidebar and note the storage items present.
  * For version 3.1.7, you should see something like:
    * closeParentBehaviorMode: 1
    * configsVersion: 7
    * notifiedFeaturesVersion: 3
4. In the extension page that opens up, check both checkbox options. Click through the prompts to accept the increased permissions.
  * For version 3.1.7, the Storage panel should now have data such as:
    * closeParentBehaviorMode: 1
    * configsVersion: 7
    * notifiedFeaturesVersion: 3
    * requestingPermissionsNatively: null
    * skipCollapsedTabsForTabSwitchingShortcuts: true

### Appendix

#### Helpful tips
* How to clear the test extension’s storage local:
  * Since the test extensions are just temporarily installed, simply restart Firefox.
  * Note that you will need to re-install the test extension via `about:debugging`.
* What the error, `TypeError: CONTENT_SCRIPT_PORT is null` means:
  * Make sure you have an http(s):// page loaded in a tab (e.g. https://www.mozilla.org/).
  * If the extension has restarted (e.g. disabled/re-enabled, reloaded…) since the page was loaded, you may need to reload the page.
* For Test Extension 2, the addon toolbox's Console panel clears every time the popup is opened, closed, or the browserAction button is hovered over. This makes it hard to reference the Console for how the storage data was modified without doing the following:
  * Each time the toolbox is opened, before opening the browserAction popup, click "Disable Popup Auto-Hide" in the overflow menu settings in the toolbox. This keeps the popup open and therefore keeps the Console from clearing.

#### Known or possible bugs I found while creating this test plan

_Should be fixed as part of this patch_
* Adding storage items while the addon toolbox's Storage panel is open live updates, but all other modifications requires a manual refresh by clicking the 'Refresh Items' button. It'd be nice if all modifications automatically refreshed. This may require changes to the larger storage actor framework and/or the Storage panel's client side code, which we've tried hard not to touch.

_May be a follow-up bug or unrelated_
* The behavior of the addon toolbox's Storage panel is different if left open between disabling and re-enabling it for Test Extension 1 (has background page) versus Test Extension 2 (does not have a background page). For the former, the panel updates to reflect that the extension is disabled. For the later, there is no change. This is outside of the scope of this patch, but it may be worth filing a follow-up bug.
## Bug 1542035 QA Test Plan

### Setup
1. Open Firefox Beta 70 in a new profile
2. Download the following test extensions attached to this bug:
  * Test Extension 1: 1542035-test-extension-1-1.0.zip
    * Extension with Background script, a content script that loads into any `http(s)://` webpage, and a browserAction toolbar button. Clicking the browserAction toolbar button opens a popup with a menu.
  * Test Extension 2: 1542035-test-extension-2-1.0.zip
    * Extension with no Background script and a browserAction toolbar button. Clicking the browserAction toolbar button opens a popup with a menu.

#### Notes about the test extensions:
* For any non-add operations (i.e. edit, remove, remove all), storage items must first be added.
* Any non-add bulk operations will affect all storage items if there are less than 10 in total.
* Both test extensions use a counter for adding new storage items via the browserAction popup menu. This counter starts at `1` (so the first storage item to be added is `{"1": 1}` and so on). It is stored in `storage.sync`; therefore it can only be reset back to `1` by clearing the profile's sync data (or using a new profile). There shouldn't be a need to reset the counter.

### Verify Extension Storage is not listed in the Storage panel sidebar when ...

#### The Storage panel is in the addon toolbox and the feature is disabled
1. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `false`.
2. Load Test Extension 1 in `about:debugging`.
3. Open the addon toolbox for Test Extension 1 in `about:debugging`, and select the Storage panel.
4. Verify "Extension Storage" is not listed in the left sidebar.

#### The Storage panel is in a non-addon toolbox and the feature is enabled
1. Restart Firefox using the same profile.
2. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `true`.
3. Load Test Extension 1 in `about:debugging`.
4. Open a page in a new tab (e.g. https://www.mozilla.org/).
5. Open the in-page toolbox and select the Storage panel.
6. Verify "Extension Storage" is not listed in the left sidebar.

### Verify Storage panel data matches expected data when...

#### Storage data is modified by various different scripts in the same session
Important: Complete these checks for both Test Extension 1 and Test Extension 2 (referred to as Test Extension below):
1. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `true`.
2. Load Test Extension in `about:debugging`.
3. If Test Extension 1, open any http(s) page in a new tab (e.g. https://www.mozilla.org/). If such a page was already open, reloading it is sufficient.
4. If Test Extension 2, open the addon toolbox for the extension in `about:debugging` and click "Disable Popup Auto-Hide" in the toolbox's overflow menu. Move the toolbox to a second, separate window.
5. Click the browserAction toolbar icon in the (first) window.
6. For each option in the browserAction popup:
  * Click an option, e.g. "Background script adds a new storage item" or "browserAction script adds a new storage item".
  * Open (or switch back to) the addon toolbox for Test Extension in `about:debugging`.
  * Select the Console panel and note the storage item(s) that is/are modified.
  * Open the Storage panel and select the extension under "Extension Storage" in the left sidebar.
  * Verify the storage data displayed in the panel reflects the modification(s).
    * The Storage panel should display the correct data whether the addon toolbox is left open or closed and re-opened each time.
    * Note that if the Storage panel is left open, some modifications require clicking the 'Refresh Items' button in the top right corner of the panel.
    
#### Storage data is modified by various different scripts, and then the extension is restarted
Important: Complete these checks for both Test Extension 1 and Test Extension 2 (referred to as Test Extension below):
1. Remove any previous installation of Test Extension 1 and/or Test Extension 2 and close any open toolboxes.
2. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `true`.
3. Load Test Extension in `about:debugging`.
4. If Test Extension 2, open the addon toolbox for the extension in `about:debugging` and click "Disable Popup Auto-Hide" in the toolbox's overflow menu. Move the toolbox to a second, separate window.
5. Click the browserAction toolbar icon in the (first) window.
6. In the popup, click 'Background script bulk adds several storage items' or 'browserAction script bulk adds several storage items'.
7. Open (or switch back to) the addon toolbox for Test Extension in `about:debugging`.
8. Select the Storage panel, and select the extension under "Extension Storage" in the left sidebar and note the storage items added.
9. Close the addon toolbox.
10. Disable the extension in `about:addons`.
11. Enable the extension in `about:addons`.
12. Open the addon toolbox for Test Extension in `about:debugging`.
13. Select the Storage panel, and select the extension under "Extension Storage" in the left sidebar.
14. Verify the storage data in the panel matches the data added prior to disabling the addon.

#### Verify JSONifiable values display as-is while non-JSONifiable values display as "Object"
1. Remove any previous installation of Test Extension 1 and/or Test Extension 2 and close any open toolboxes.
2. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `true`.
3. Load Test Extension 1 in `about:debugging`.
4. Open the addon toolbox for Test Extension 1 in `about:debugging`.
5. Select the Console panel, and for each of the following stringifiable items, verify they are set as a string equivalent in the Storage panel:
  * Note: Quotes around object literal keys such as `f` below are expected.
  * Note: the Console panel does not always provide helpful error messages for incorrect syntax, so it is recommended to copy these lines over exactly and limit modifications.
```js
await browser.storage.local.set({a: 123});
await browser.storage.local.set({b: true});
await browser.storage.local.set({c: "test"});
await browser.storage.local.set({d: [1, 2]});
await browser.storage.local.set({e: {f: false}});
await browser.storage.local.set({g: null});```
```
Select the Console panel, and for each of the following non-stringifiable items, verify they are set as “Object” in the Storage panel:
```js
await browser.storage.local.set({map: new Map()});
await browser.storage.local.set({set: new Set()});
await browser.storage.local.set({arrayBuffer: new ArrayBuffer(8)});
await browser.storage.local.set({regexp: /regexp/});
```

### Try out a real world extension and modify some of its settings kept in storage local
1. In the same profile as before, download Tree Style Tab from https://addons.mozilla.org/en-US/firefox/addon/tree-style-tab/.
2. Leaving any new tabs that are created from the install open, open the addon toolbox for Tree Style Tab in `about:debugging`.
3. Select the Storage panel, and select the extension under "Extension Storage" in the sidebar and note the storage items present.
  * For version 3.1.7, you should see something like:
    * closeParentBehaviorMode: 1
    * configsVersion: 7
    * notifiedFeaturesVersion: 3
4. In the extension page that opens up, check both checkbox options. Click through the prompts to accept the increased permissions.
  * For version 3.1.7, the Storage panel should now have data such as:
    * closeParentBehaviorMode: 1
    * configsVersion: 7
    * notifiedFeaturesVersion: 3
    * requestingPermissionsNatively: null
    * skipCollapsedTabsForTabSwitchingShortcuts: true

### Appendix

#### Helpful tips
* How to clear the test extension’s storage local:
  * Since the test extensions are just temporarily installed, simply restart Firefox.
  * Note that you will need to re-install the test extension via `about:debugging`.
* What the error, `TypeError: CONTENT_SCRIPT_PORT is null` means:
  * Make sure you have an http(s):// page loaded in a tab (e.g. https://www.mozilla.org/).
  * If the extension has restarted (e.g. disabled/re-enabled, reloaded…) since the page was loaded, you may need to reload the page.
* For Test Extension 2, the addon toolbox's Console panel clears every time the popup is opened, closed, or the browserAction button is hovered over. This makes it hard to reference the Console for how the storage data was modified without doing the following:
  * Each time the toolbox is opened, before opening the browserAction popup, click "Disable Popup Auto-Hide" in the overflow menu settings in the toolbox. This keeps the popup open and therefore keeps the Console from clearing.

#### Known or possible bugs I found while creating this test plan

_Should be fixed as part of this patch_
* Bug 1578447: Adding storage items while the addon toolbox's Storage panel is open live updates, but all other modifications requires a manual refresh by clicking the 'Refresh Items' button. It'd be nice if all modifications automatically refreshed. This may require changes to the larger storage actor framework and/or the Storage panel's client side code, which we've tried hard not to touch.

_May be a follow-up bug or unrelated_
* The behavior of the addon toolbox's Storage panel is different if left open between disabling and re-enabling it for Test Extension 1 (has background page) versus Test Extension 2 (does not have a background page). For the former, the panel updates to reflect that the extension is disabled. For the later, there is no change. This is outside of the scope of this patch, but it may be worth filing a follow-up bug.
## Bug 1542035 QA Test Plan

### Setup
1. Open Firefox Beta 70 in a new profile
2. Download the following test extensions attached to this bug:
  * Test Extension 1: 1542035-test-extension-1-1.0.zip
    * Extension with Background script, a content script that loads into any `http(s)://` webpage, and a browserAction toolbar button. Clicking the browserAction toolbar button opens a popup with a menu.
  * Test Extension 2: 1542035-test-extension-2-1.0.zip
    * Extension with no Background script and a browserAction toolbar button. Clicking the browserAction toolbar button opens a popup with a menu.

#### Notes about the test extensions:
* For any non-add operations (i.e. edit, remove, remove all), storage items must first be added.
* Any non-add bulk operations will affect all storage items if there are less than 10 in total.
* Both test extensions use a counter for adding new storage items via the browserAction popup menu. This counter starts at `1` (so the first storage item to be added is `{"1": 1}` and so on). It is stored in `storage.sync`; therefore it can only be reset back to `1` by clearing the profile's sync data (or using a new profile). There shouldn't be a need to reset the counter.

### Verify Extension Storage is not listed in the Storage panel sidebar when ...

#### The Storage panel is in the addon toolbox and the feature is disabled
1. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `false`.
2. Load Test Extension 1 in `about:debugging`.
3. Open the addon toolbox for Test Extension 1 in `about:debugging`, and select the Storage panel.
4. Verify "Extension Storage" is not listed in the left sidebar.

#### The Storage panel is in a non-addon toolbox and the feature is enabled
1. Restart Firefox using the same profile.
2. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `true`.
3. Load Test Extension 1 in `about:debugging`.
4. Open a page in a new tab (e.g. https://www.mozilla.org/).
5. Open the in-page toolbox and select the Storage panel.
6. Verify "Extension Storage" is not listed in the left sidebar.

### Verify Storage panel data matches expected data when...

#### Storage data is modified by various different scripts in the same session
Important: Complete these checks for both Test Extension 1 and Test Extension 2 (referred to as Test Extension below):
1. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `true`.
2. Load Test Extension in `about:debugging`.
3. If Test Extension 1, open any http(s) page in a new tab (e.g. https://www.mozilla.org/). If such a page was already open, reloading it is sufficient.
4. If Test Extension 2, open the addon toolbox for the extension in `about:debugging` and click "Disable Popup Auto-Hide" in the toolbox's overflow menu. Move the toolbox to a second, separate window.
5. Click the browserAction toolbar icon in the (first) window.
6. For each option in the browserAction popup:
  * Click an option, e.g. "Background script adds a new storage item" or "browserAction script adds a new storage item".
  * Open (or switch back to) the addon toolbox for Test Extension in `about:debugging`.
  * Select the Console panel and note the storage item(s) that is/are modified.
  * Open the Storage panel and select the extension under "Extension Storage" in the left sidebar.
  * Verify the storage data displayed in the panel reflects the modification(s).
    * The Storage panel should display the correct data whether the addon toolbox is left open or closed and re-opened each time.
    * Note that if the Storage panel is left open, some modifications require clicking the 'Refresh Items' button in the top right corner of the panel.
    
#### Storage data is modified by various different scripts, and then the extension is restarted
Important: Complete these checks for both Test Extension 1 and Test Extension 2 (referred to as Test Extension below):
1. Remove any previous installation of Test Extension 1 and/or Test Extension 2 and close any open toolboxes.
2. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `true`.
3. Load Test Extension in `about:debugging`.
4. If Test Extension 2, open the addon toolbox for the extension in `about:debugging` and click "Disable Popup Auto-Hide" in the toolbox's overflow menu. Move the toolbox to a second, separate window.
5. Click the browserAction toolbar icon in the (first) window.
6. In the popup, click 'Background script bulk adds several storage items' or 'browserAction script bulk adds several storage items'.
7. Open (or switch back to) the addon toolbox for Test Extension in `about:debugging`.
8. Select the Storage panel, and select the extension under "Extension Storage" in the left sidebar and note the storage items added.
9. Close the addon toolbox.
10. Disable the extension in `about:addons`.
11. Enable the extension in `about:addons`.
12. Open the addon toolbox for Test Extension in `about:debugging`.
13. Select the Storage panel, and select the extension under "Extension Storage" in the left sidebar.
14. Verify the storage data in the panel matches the data added prior to disabling the addon.

#### Verify JSONifiable values display as-is while non-JSONifiable values display as "Object"
1. Remove any previous installation of Test Extension 1 and/or Test Extension 2 and close any open toolboxes.
2. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `true`.
3. Load Test Extension 1 in `about:debugging`.
4. Open the addon toolbox for Test Extension 1 in `about:debugging`.
5. Select the Console panel, and for each of the following stringifiable items, verify they are set as a string equivalent in the Storage panel:
  * Note: Quotes around object literal keys such as `f` below are expected.
  * Note: the Console panel does not always provide helpful error messages for incorrect syntax, so it is recommended to copy these lines over exactly and limit modifications.
```js
await browser.storage.local.set({a: 123});
await browser.storage.local.set({b: true});
await browser.storage.local.set({c: "test"});
await browser.storage.local.set({d: [1, 2]});
await browser.storage.local.set({e: {f: false}});
await browser.storage.local.set({g: null});```
```
Select the Console panel, and for each of the following non-stringifiable items, verify they are set as “Object” in the Storage panel:
```js
await browser.storage.local.set({map: new Map()});
await browser.storage.local.set({set: new Set()});
await browser.storage.local.set({arrayBuffer: new ArrayBuffer(8)});
await browser.storage.local.set({regexp: /regexp/});
```

### Try out a real world extension and modify some of its settings kept in storage local
1. In the same profile as before, download Tree Style Tab from https://addons.mozilla.org/en-US/firefox/addon/tree-style-tab/.
2. Leaving any new tabs that are created from the install open, open the addon toolbox for Tree Style Tab in `about:debugging`.
3. Select the Storage panel, and select the extension under "Extension Storage" in the sidebar and note the storage items present.
  * For version 3.1.7, you should see something like:
    * closeParentBehaviorMode: 1
    * configsVersion: 7
    * notifiedFeaturesVersion: 3
4. In the extension page that opens up, check both checkbox options. Click through the prompts to accept the increased permissions.
  * For version 3.1.7, the Storage panel should now have data such as:
    * closeParentBehaviorMode: 1
    * configsVersion: 7
    * notifiedFeaturesVersion: 3
    * requestingPermissionsNatively: null
    * skipCollapsedTabsForTabSwitchingShortcuts: true

### Appendix

#### Helpful tips
* How to clear the test extension’s storage local:
  * Since the test extensions are just temporarily installed, simply restart Firefox.
  * Note that you will need to re-install the test extension via `about:debugging`.
* What the error, `TypeError: CONTENT_SCRIPT_PORT is null` means:
  * Make sure you have an http(s):// page loaded in a tab (e.g. https://www.mozilla.org/).
  * If the extension has restarted (e.g. disabled/re-enabled, reloaded…) since the page was loaded, you may need to reload the page.
* For Test Extension 2, the addon toolbox's Console panel clears every time the popup is opened, closed, or the browserAction button is hovered over. This makes it hard to reference the Console for how the storage data was modified without doing the following:
  * Each time the toolbox is opened, before opening the browserAction popup, click "Disable Popup Auto-Hide" in the overflow menu settings in the toolbox. This keeps the popup open and therefore keeps the Console from clearing.

#### Known or possible bugs I found while creating this test plan

_Should be fixed as part of this patch_
* Bug 1578447: Adding storage items while the addon toolbox's Storage panel is open live updates, but all other modifications requires a manual refresh by clicking the 'Refresh Items' button. It'd be nice if all modifications automatically refreshed. This may require changes to the larger storage actor framework and/or the Storage panel's client side code, which we've tried hard not to touch.

_May be a follow-up bug or unrelated_
* Bug 1578452: The behavior of the addon toolbox's Storage panel is different if left open between disabling and re-enabling it for Test Extension 1 (has background page) versus Test Extension 2 (does not have a background page). For the former, the panel updates to reflect that the extension is disabled. For the later, there is no change. This is outside of the scope of this patch, but it may be worth filing a follow-up bug.
## Bug 1542035 QA Test Plan

### Setup
1. Open Firefox Beta 70 in a new profile
2. Download the following test extensions attached to this bug:
  * Test Extension 1: 1542035-test-extension-1-1.1.zip
    * Extension with Background script, a content script that loads into any `http(s)://` webpage, and a browserAction toolbar button. Clicking the browserAction toolbar button opens a popup with a menu.
  * Test Extension 2: 1542035-test-extension-2-1.1.zip
    * Extension with no Background script and a browserAction toolbar button. Clicking the browserAction toolbar button opens a popup with a menu.

#### Notes about the test extensions:
* For any non-add operations (i.e. edit, remove, remove all), storage items must first be added.
* Any non-add bulk operations will affect all storage items if there are less than 10 in total.
* Both test extensions use a counter for adding new storage items via the browserAction popup menu. This counter starts at `1` (so the first storage item to be added is `{"1": 1}` and so on). It is stored in `storage.sync`; therefore it can only be reset back to `1` by clearing the profile's sync data (or using a new profile). There shouldn't be a need to reset the counter.

### Verify Extension Storage is not listed in the Storage panel sidebar when ...

#### The Storage panel is in the addon toolbox and the feature is disabled
1. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `false`.
2. Load Test Extension 1 in `about:debugging`.
3. Open the addon toolbox for Test Extension 1 in `about:debugging`, and select the Storage panel.
4. Verify "Extension Storage" is not listed in the left sidebar.

#### The Storage panel is in a non-addon toolbox and the feature is enabled
1. Restart Firefox using the same profile.
2. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `true`.
3. Load Test Extension 1 in `about:debugging`.
4. Open a page in a new tab (e.g. https://www.mozilla.org/).
5. Open the in-page toolbox and select the Storage panel.
6. Verify "Extension Storage" is not listed in the left sidebar.

### Verify Storage panel data matches expected data when...

#### Storage data is modified by various different scripts in the same session
Important: Complete these checks for both Test Extension 1 and Test Extension 2 (referred to as Test Extension below):
1. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `true`.
2. Load Test Extension in `about:debugging`.
3. If Test Extension 1, open any http(s) page in a new tab (e.g. https://www.mozilla.org/). If such a page was already open, reloading it is sufficient.
4. If Test Extension 2, open the addon toolbox for the extension in `about:debugging` and click "Disable Popup Auto-Hide" in the toolbox's overflow menu. Move the toolbox to a second, separate window.
5. Click the browserAction toolbar icon in the (first) window.
6. For each option in the browserAction popup:
  * Click an option, e.g. "Background script adds a new storage item" or "browserAction script adds a new storage item".
  * Open (or switch back to) the addon toolbox for Test Extension in `about:debugging`.
  * Select the Console panel and note the storage item(s) that is/are modified.
  * Open the Storage panel and select the extension under "Extension Storage" in the left sidebar.
  * Verify the storage data displayed in the panel reflects the modification(s).
    * The Storage panel should display the correct data whether the addon toolbox is left open or closed and re-opened each time.
    * Note that if the Storage panel is left open, some modifications require clicking the 'Refresh Items' button in the top right corner of the panel.
    
#### Storage data is modified by various different scripts, and then the extension is restarted
Important: Complete these checks for both Test Extension 1 and Test Extension 2 (referred to as Test Extension below):
1. Remove any previous installation of Test Extension 1 and/or Test Extension 2 and close any open toolboxes.
2. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `true`.
3. Load Test Extension in `about:debugging`.
4. If Test Extension 2, open the addon toolbox for the extension in `about:debugging` and click "Disable Popup Auto-Hide" in the toolbox's overflow menu. Move the toolbox to a second, separate window.
5. Click the browserAction toolbar icon in the (first) window.
6. In the popup, click 'Background script bulk adds several storage items' or 'browserAction script bulk adds several storage items'.
7. Open (or switch back to) the addon toolbox for Test Extension in `about:debugging`.
8. Select the Storage panel, and select the extension under "Extension Storage" in the left sidebar and note the storage items added.
9. Close the addon toolbox.
10. Disable the extension in `about:addons`.
11. Enable the extension in `about:addons`.
12. Open the addon toolbox for Test Extension in `about:debugging`.
13. Select the Storage panel, and select the extension under "Extension Storage" in the left sidebar.
14. Verify the storage data in the panel matches the data added prior to disabling the addon.

#### Verify JSONifiable values display as-is while non-JSONifiable values display as "Object"
1. Remove any previous installation of Test Extension 1 and/or Test Extension 2 and close any open toolboxes.
2. In `about:config`, set `devtools.storage.extensionStorage.enabled` to `true`.
3. Load Test Extension 1 in `about:debugging`.
4. Open the addon toolbox for Test Extension 1 in `about:debugging`.
5. Select the Console panel, and for each of the following stringifiable items, verify they are set as a string equivalent in the Storage panel:
  * Note: Quotes around object literal keys such as `f` below are expected.
  * Note: the Console panel does not always provide helpful error messages for incorrect syntax, so it is recommended to copy these lines over exactly and limit modifications.
```js
await browser.storage.local.set({a: 123});
await browser.storage.local.set({b: true});
await browser.storage.local.set({c: "test"});
await browser.storage.local.set({d: [1, 2]});
await browser.storage.local.set({e: {f: false}});
await browser.storage.local.set({g: null});```
```
Select the Console panel, and for each of the following non-stringifiable items, verify they are set as “Object” in the Storage panel:
```js
await browser.storage.local.set({map: new Map()});
await browser.storage.local.set({set: new Set()});
await browser.storage.local.set({arrayBuffer: new ArrayBuffer(8)});
await browser.storage.local.set({regexp: /regexp/});
```

### Try out a real world extension and modify some of its settings kept in storage local
1. In the same profile as before, download Tree Style Tab from https://addons.mozilla.org/en-US/firefox/addon/tree-style-tab/.
2. Leaving any new tabs that are created from the install open, open the addon toolbox for Tree Style Tab in `about:debugging`.
3. Select the Storage panel, and select the extension under "Extension Storage" in the sidebar and note the storage items present.
  * For version 3.1.7, you should see something like:
    * closeParentBehaviorMode: 1
    * configsVersion: 7
    * notifiedFeaturesVersion: 3
4. In the extension page that opens up, check both checkbox options. Click through the prompts to accept the increased permissions.
  * For version 3.1.7, the Storage panel should now have data such as:
    * closeParentBehaviorMode: 1
    * configsVersion: 7
    * notifiedFeaturesVersion: 3
    * requestingPermissionsNatively: null
    * skipCollapsedTabsForTabSwitchingShortcuts: true

### Appendix

#### Helpful tips
* How to clear the test extension’s storage local:
  * Since the test extensions are just temporarily installed, simply restart Firefox.
  * Note that you will need to re-install the test extension via `about:debugging`.
* What the error, `TypeError: CONTENT_SCRIPT_PORT is null` means:
  * Make sure you have an http(s):// page loaded in a tab (e.g. https://www.mozilla.org/).
  * If the extension has restarted (e.g. disabled/re-enabled, reloaded…) since the page was loaded, you may need to reload the page.
* For Test Extension 2, the addon toolbox's Console panel clears every time the popup is opened, closed, or the browserAction button is hovered over. This makes it hard to reference the Console for how the storage data was modified without doing the following:
  * Each time the toolbox is opened, before opening the browserAction popup, click "Disable Popup Auto-Hide" in the overflow menu settings in the toolbox. This keeps the popup open and therefore keeps the Console from clearing.

#### Known or possible bugs I found while creating this test plan

_Should be fixed as part of this patch_
* Bug 1578447: Adding storage items while the addon toolbox's Storage panel is open live updates, but all other modifications requires a manual refresh by clicking the 'Refresh Items' button. It'd be nice if all modifications automatically refreshed. This may require changes to the larger storage actor framework and/or the Storage panel's client side code, which we've tried hard not to touch.

_May be a follow-up bug or unrelated_
* Bug 1578452: The behavior of the addon toolbox's Storage panel is different if left open between disabling and re-enabling it for Test Extension 1 (has background page) versus Test Extension 2 (does not have a background page). For the former, the panel updates to reflect that the extension is disabled. For the later, there is no change. This is outside of the scope of this patch, but it may be worth filing a follow-up bug.

Back to Bug 1542035 Comment 8