Closed Bug 1464992 Opened 3 years ago Closed 3 years ago

Immediate operations after tabs.discard() disposes tab's "discarded" attribute but the tab is actually still discarded

Categories

(WebExtensions :: General, defect, P3)

defect

Tracking

(firefox62 affected)

RESOLVED DUPLICATE of bug 1422588
Tracking Status
firefox62 --- affected

People

(Reporter: yuki, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

959 bytes, application/x-xpinstall
Details
Attached file testcase.xpi
browser.tabs.executeScript() or something other operations processed just after browser.tabs.discard() break synchronization of tab's "discarded" attribute with actual status of the tab.


Steps to reproduce:

 1. Install the attached testcase addon as a temporary addon via
    about:debugging.
 2. Start debugger for the addon and open the debugger for it.
 3. Open new tab, and search something like "Firefox" with Google.
 4. Open multiple tabs from the search result.
 5. Right-click on a background tab and choose
    "Mark tab as loaded when unloaded" => "Unload and execute script".
    It just does:
      ----
      browser.tabs.discard(tab.id);
      browser.tabs.executeScript(tab.id, {
        code: `browser.runtime.sendMessage({});`,
        runAt: 'document_start'
      });
      ----
 6. Click the tab you executed the "Unload and execute script" command.


Expected result(1):

 * At the step 5, the console says:
     tabs.onUpdated: XX, discarded=true
     discarded=true (0.5sec later)
 * At the step 6, the tab is discarded and start restoring.
 * At the step 6, the console says:
     tabs.onUpdated: XX, discarded=false


Expected result(2):

 * At the step 5, the console says:
     tabs.onUpdated: XX, discarded=true
     tabs.onUpdated: XX, discarded=false
     discarded=false (0.5sec later)
 * At the step 6, the tab is not discarded.


Actual result:

 * At the step 5, the console says:
     tabs.onUpdated: XX, discarded=true
     tabs.onUpdated: XX, discarded=false
     discarded=false (0.5sec later)
 * At the step 6, the tab is discarded and start restoring.

Note that the log says the tab is already undiscarded but actually discarded - the "discarded" status reported via WebExtensions API is mismatched to the actual tab.


This problem is originally reported at: https://github.com/piroor/treestyletab/issues/1903
Priority: -- → P3
Product: Toolkit → WebExtensions
I don't understand why there are two expected results for a single str, but I think it's just a copy/paste error since the second "expected" is the same as the "actual".

Having said that, the actual results are now:

tabs.onUpdated: 8, discarded=true background.js:38:5
discarded=true background.js:33:3
tabs.onUpdated: 8, discarded=false

As such, this was fixed by bug 1422588
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1422588
You need to log in before you can comment on or make changes to this bug.