Closed Bug 1505670 Opened 7 years ago Closed 7 years ago

Target tab may already be destroyed while waiting for the next microtask checkpoint in ext-browser.js

Categories

(WebExtensions :: General, enhancement, P2)

enhancement

Tracking

(firefox65 fixed)

RESOLVED FIXED
mozilla65
Tracking Status
firefox65 --- fixed

People

(Reporter: arai, Assigned: arai)

References

Details

Attachments

(1 file, 1 obsolete file)

https://searchfox.org/mozilla-central/rev/6e0e603f4852b8e571e5b8ae133e772b18b6016e/browser/components/extensions/parent/ext-browser.js#482-484 > class TabTracker extends TabTrackerBase { > ... > handleEvent(event) { > let nativeTab = event.target; > > switch (event.type) { > ... > case "TabSelect": > // Because we are delaying calling emitCreated above, we also need to > // delay sending this event because it shouldn't fire before onCreated. > Promise.resolve().then(() => { > this.emitActivated(nativeTab); > }); > break; It may fail if the tab is destroyed before the resolution handler is called. which results in hitting the following: https://searchfox.org/mozilla-central/rev/6e0e603f4852b8e571e5b8ae133e772b18b6016e/browser/components/extensions/parent/ext-browser.js#337 > class TabTracker extends TabTrackerBase { > ... > setId(nativeTab, id) { > if (!nativeTab.parentNode) { > throw new Error("Cannot attach ID to a destroyed tab.");
A lot of test fails because of this after fixing bug 1498775. (thus this patch has no testcase)
Attachment #9023519 - Flags: review?(mixedpuppy)
Comment on attachment 9023519 [details] [diff] [review] Check if the tab is still alive after waiting for the next microtask checkpoint, in TabTracker#handleEvent. oops, wrong patch
Attachment #9023519 - Attachment is obsolete: true
Attachment #9023519 - Flags: review?(mixedpuppy)
here's the correct one that checks the tab's existence, which is passed to the methods.
Attachment #9023524 - Flags: review?(mixedpuppy)
The patch looks reasonable. I'd like to see the test failures so I can see what tests are failing and how they are failing. Can you run a try for bug 1498775?
Flags: needinfo?(arai.unmht)
Flags: needinfo?(arai.unmht)
Priority: -- → P2
Comment on attachment 9023524 [details] [diff] [review] Check if the tab is still alive after waiting for the next microtask checkpoint, in TabTracker#handleEvent. Thanks!
Attachment #9023524 - Flags: review?(mixedpuppy) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/73042df54a94e6b961e5f7128d15a5e4ff01c56b Bug 1505670 - Check if the tab is still alive after waiting for the next microtask checkpoint, in TabTracker#handleEvent. r=mixedpuppy
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla65
Is manual testing required on this bug? If yes, please provide some STR and the proper extension(if required) or set the “qe-verify -“ flag. Thanks
Flags: needinfo?(arai.unmht)
This is tested once bug 1498775 gets fixed (I hope shortly), and also is already covered in existing testcases. I think manual test is not necessary.
Flags: needinfo?(arai.unmht) → qe-verify-
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: