Closed Bug 1561711 Opened 6 years ago Closed 5 years ago

back history will be cleared on reloading an extension page

Categories

(WebExtensions :: Request Handling, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1573456

People

(Reporter: kernp25, Unassigned)

References

Details

Attachments

(2 files)

904 bytes, application/x-zip-compressed
Details
575.22 KB, application/x-zip-compressed
Details

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:69.0) Gecko/20100101 Firefox/69.0

Steps to reproduce:

Load the attached add-on.
Open example.com and wait for the extension page to load.
Reload the page .

Actual results:

The back history of the tab will be lost.

Expected results:

The back history of the tab should not be cleared on reloading the page.

Attached file background.zip
Flags: needinfo?(rob)

Use this link for testing:
https://example.com/

Using redirectUrl in webRequest is like a HTTP 302 redirect, i.e. it's a temporary redirect that replaces the requested URL. Therefore it won't end up being used in the history entry.

If I load example.org before navigating to https://example.com using your extension, then I do see that the history is preserved.
I tested this with Firefox 67.0.4 and Firefox 69.0a1 buildID 20190624213657.

In the future, if you report bugs in Firefox, could you also mention the exact version that you're using in your test? You can find this information at about:support .

Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Flags: needinfo?(rob)
Resolution: --- → INVALID
Attached file test7.7z
Flags: needinfo?(rob)

Please download the compressed test7.avi video.

Version 69.0a1
Build-ID 20190627093636

Ah, I missed the reload step. This is a valid bug.

If I directly navigate to the web-accessible moz-extension:-URL, then the history is preserved even upon reload.

Status: RESOLVED → REOPENED
Component: General → Request Handling
Ever confirmed: true
Flags: needinfo?(rob)
Resolution: INVALID → ---
Priority: -- → P2

After investigating the issue, I found that there are two things:

  • In the broken case, after the webRequest redirect the extension is in the wrong process. This is bug 1573456.
  • When the user reloads the tab, a process switch is forced, resulting in loss of history.

This reported issue appears to have been fixed in 72, then broken again in 73 and then fixed in 73/74. I didn't check the details of the breakages in between, but the least we can do is to add a unit test in bug 1573456 to prevent the regression from occurring again.

(You can stop reading now, unless you're interested in how I reached the above conclusion)

When I ran mozregression in an attempt to find the cause of the fix, I got confused.
I consistently get the same regression ranges:

Because of the inconclusive regression range, I looked into it a bit further.

While trying to reproduce, I tried to automate the test, and found that using browser.tabs.reload does not reproduce the issue, whereas using a keyboard shortcut or pressing the browser's reload button does reproduce the issue. In the first case, browser.reloadWithFlags is used directly. In the latter case, the final handler is BrowserReloadWithFlags (via BrowserReloadOrDuplicate), which is sensitive to the value of browser.processType.

Another observation is that the issue also reproduces if the current URL is a moz-extension:-URL. In that case the tab browser's remoteType is web, which reminds me of bug 1573456 .

With the ability to reproduce the bug (Firefox 73 Beta) and not (Firefox 74 Nightly), I patched omni.ja by adding logging to getRemoteTypeForPrincipal, and found that in the good case, onMayChangeProcess is called, but not in the bad case. This specific behavior changed in bug 1584031 (https://hg.mozilla.org/mozilla-central/rev/7a1d40167829) and looks like a plausible cause of the fixed behavior in Nightly 72.

I'm not interested in completely figuring out why it broke and got fixed in 73, but since we have a plausible fix and the latest beta&nightly versions work, we can consider writing a unit test to avoid future regressions (todo for bug 1573456).

Status: REOPENED → RESOLVED
Closed: 6 years ago5 years ago
Depends on: 1573456
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: