Closed Bug 905357 Opened 11 years ago Closed 11 years ago

Unable to remove content policy registrations synchronously at runtime

Categories

(Core :: Security, defect)

defect
Not set
major

Tracking

()

RESOLVED DUPLICATE of bug 753687

People

(Reporter: felix.shnir, Unassigned)

Details

Attachments

(2 files, 1 obsolete file)

Attached file ghostery.xpi
User Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36 Steps to reproduce: Upgraded an existing addon-sdk built addon that uses content policy Actual results: previous content policy is never removed even tho there is relevant code that deletes xpcom category and unregisters the module Expected results: Should have been removed or replaced with new content policy.
If you open up the xpi, relevant code is in the background.js lines 130-164. Because previous policies are never removed, code that should not throw errors will throw dead object reference errors. In most cases, its harmless, but not so for redirects (net-channel-event-sinks) where a thrown error prevents all redirects.
Severity: normal → major
To reproduce, install the attached XPI once, and then install it again without a restart. Browse to any site and look at the error console for xpcom errors.
Dave, you were talking with the reporter on IRC about this the other day, right? Any information you can add to this?
Flags: needinfo?(dtownsend+bugmail)
Yes and as far as I can tell this is a core XPCOM bug as I've seen this outside the SDK.
Component: General → XPCOM
Flags: needinfo?(dtownsend+bugmail)
Product: Add-on SDK → Core
Summary: Addon-SDK built extension unable to remove its own xpcom modules during upgrade. → Unable to remove content policy registrations at runtime
What precisely is the XPCOM bug? Is the entry not being removed from the category manager? Or is that not firing a notification?
(In reply to Benjamin Smedberg [:bsmedberg] from comment #5) > What precisely is the XPCOM bug? Is the entry not being removed from the > category manager? Or is that not firing a notification? Correct, the entry was not removed.
Can you provide a minimal testcase (xpcshell would be awesome): the code for DeleteCategoryEntry exists and we even appear to have automated tests for it, so I suspect that is not actually the problem here.
Attached patch testcase (obsolete) — Splinter Review
To clarify the problem is that if you remove the category registration the content policy remains active for a time. The attached testcase verifies that behaviour. What would be better is if the test would pass without the do_execute_soons.
Summary: Unable to remove content policy registrations at runtime → Unable to remove content policy registrations synchronously at runtime
I expect that synchronous might be hard, or might require that we replace using the category manager with something more proactive. In any case, moving this to Core:Security since it isn't an XPCOM bug.
Status: UNCONFIRMED → NEW
Component: XPCOM → Security
Ever confirmed: true
Attached patch testcaseSplinter Review
I forgot the real problem that this causes. Whether content policies can be removed synchronously or not probably doesn't matter. The problem is that if you attempt to remove the category entry and unregister the component from the component manager then (as a restartless add-on would do to clean up when it is disabled) then something breaks and the content policy service continues to use its reference to the component. This attached testcase fails.
Attachment #796537 - Attachment is obsolete: true
This sounds similar to bug 753687, and I suspect both are implicated in bug 924340.
I think they're the same really
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: