I'm not sure if these are correct, but it seems like we could be missing UnmarkGray calls in a few places.
Created attachment 586560 [details] [diff] [review]
The concern here is that someone could cause get a reference to a scope's mPrototypeNoHelper. Then it could stash the reference in a DOM object or something and relinquish all other references, cause the mPrototypeNoHelper object to be marked gray. Later, they could cause an object to be created with mPrototypeNoHelper as its proto. This would lead to a black -> gray pointer (via the proto edge), which violates our invariants.
Created attachment 586568 [details] [diff] [review]
This patch is questionable. In theory, if a tear-off JS object could become gray while the XPC wrapped native's JS object was black, then the tear-off's JS object could be exposed to JS code via DefinePropertyIfFound's to->GetJSObject() call.
However, as far as I can tell from the code, once a tear-off's JS object has been created, it always has a strong reference from the wrapped native's flattened object (via property that it set during the resolve hook). However, if that's true, then I don't understand the purpose of all this tear-off sweeping code. Why don't we just keep the tear-offs alive as long as the WrappedNative is alive?
Created attachment 586570 [details] [diff] [review]
fix waiver wrappers
Same story. It seems like we could add a waiver wrapper to the map, then it could end up gray if it's stored in a DOM object, and then we could look it up in the map again and return it to JS code.
However, I have no idea what a waiver wrapper is, so I may be wrong.
guessing at a moderate security severity due to the uncertainty indicated by "possibly" in the summary.
Comment on attachment 586568 [details] [diff] [review]
This looks good!
Created attachment 595499 [details] [diff] [review]
fix the DOM prototype cache
Another weak pointer that I just saw.
Backed out in https://hg.mozilla.org/integration/mozilla-inbound/rev/71f5bf4df2f6 - one of the six in that push was crashing in js::gc::Mark<JSString>
Is this something we ought to take on Firefox 12 or ESR?
(In reply to Daniel Veditz [:dveditz] from comment #11)
> Is this something we ought to take on Firefox 12 or ESR?
We now know that there are a lot more bugs like this. As far as we know, they'll only lead to a NULL pointer crash. However, we've never connected one of these bugs to an actual crash, so it's all pretty theoretical. I don't think there's much reason to take this on branches.
lowering the severity based on comment 12.