Closed Bug 1242752 Opened 9 years ago Closed 9 years ago

Fix exception raised when a WebExtension iframe is destroyed

Categories

(WebExtensions :: Untriaged, defect, P2)

46 Branch
defect

Tracking

(firefox45 unaffected, firefox46+ fixed, firefox47+ fixed)

RESOLVED FIXED
mozilla47
Tracking Status
firefox45 --- unaffected
firefox46 + fixed
firefox47 + fixed

People

(Reporter: rpl, Assigned: rpl)

References

Details

(Keywords: regression, Whiteboard: [triaged])

Attachments

(1 file, 2 obsolete files)

An addon iframes' extension context is closed correctly when an extension is unloaded, but it fails if the iframe is removed with the exception: TypeError: this.extensionWindows is undefined because of a typo in the DocumentManager.observe method. I'm going to attach to this issue a patch with an additional test case which raise the exception, and the related fix.
Attached patch 001-fix-exception-on-iframe-destroy.patch (obsolete) (deleted) — Splinter Review
Attachment #8711883 - Flags: review?(kmaglione+bmo)
Comment on attachment 8711883 [details] [diff] [review] 001-fix-exception-on-iframe-destroy.patch Review of attachment 8711883 [details] [diff] [review]: ----------------------------------------------------------------- We should request uplift to aurora for this. ::: toolkit/components/extensions/test/mochitest/test_ext_contentscript_create_iframe.html @@ +210,5 @@ > + // Not necessary in browser-chrome tests, but monitorConsole gripes > + // if we don't call it. > + SimpleTest.waitForExplicitFinish(); > + > + SimpleTest.monitorConsole(resolve, [{ message: /extensionWindows is undefined/, forbid: true }]); I'd rather just assert that there are no console messages. `SimpleTest.monitorConsole(resolve, [], true);`
Attachment #8711883 - Flags: review?(kmaglione+bmo) → review+
Unfortunately there are two unrelated errors which make the test to fail if I do so: - JavaScript Error: "TelemetryStopwatch: requesting elapsed time for nonexisting stopwatch. ...", related to resource://gre/modules/TelemetryStopwatch.jsm - JavaScript Error: "[Exception... "Component returned failure code: ...", related to chrome://browser/content/browser.js (TabsProgressListener.onStateChange) How about forbid errors based on the "sourceName" as a compromise? let forbiddenMessages = [{ forbid: true, isScriptError: true, sourceName: /ExtensionContent\.jsm/, }]; ... SimpleTest.monitorConsole(resolve, forbiddenMessages);
Updates on the previous patch version: - fixed eslint warnings and errors - applied the described tweak (forbid console errors based on the sourceName instead of the error message) Re-applied the previous r+ flag.
Attachment #8711883 - Attachment is obsolete: true
Attachment #8712131 - Flags: review+
Assignee: nobody → lgreco
Status: NEW → ASSIGNED
Minor tweak on the previous version of the attached patch: - removed the test case used to demonstrate the issue (a new test case to properly test that "the extension context is completely cleaned up when the iframe is removed" will be added in a follow up of this issue)
Attachment #8712131 - Attachment is obsolete: true
Attachment #8713106 - Flags: review+
Flags: blocking-webextensions+
Priority: -- → P2
Whiteboard: [triaged]
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla47
Comment on attachment 8713106 [details] [diff] [review] 0001-fix-exception-webextension-iframe-destroy.patch Approval Request Comment [Feature/regressing bug #]: 1214658 [User impact if declined]: minor memory leak and errors appearing in the error console. [Describe test coverage new/current, TreeHerder]: the tear-down code isn't adequately tested, more comprehensive tests will be added as a follow-up. [Risks and why]: The patch is composed by a low-risk single-line typo fix. [String/UUID change made/needed]: None.
Attachment #8713106 - Flags: approval-mozilla-aurora?
Comment on attachment 8713106 [details] [diff] [review] 0001-fix-exception-webextension-iframe-destroy.patch Fix for recent regression, ok to uplift to aurora.
Attachment #8713106 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Blocks: 1214658
Version: unspecified → 46 Branch
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: