зеркало из https://github.com/mozilla/gecko-dev.git
359f06fb50
This is kind of a long story, stay with me on this. In bug 990290, a WeakMap was added to any JS scope that loaded an XBL binding. That WeakMap stored the JS prototypes that are injected into a bound node's prototype chain. When a binding is removed, we search the prototype chain for the JS prototype that we'd added, and remove it. The XUL prototype cache caches numerous things, including nsXBLDocumentInfo, which we use to get at the nsXBLPrototypeBinding for a particular binding, which is then used to generate the class object that's put into the WeakMap. When the XUL prototype cache is flushed, that means that when a binding is bound, its definition needs to be reloaded off of the disk. If, however, there was a pre-existing instance of the binding already being used in a document, now we were in a funny case. We were in a funny case, because when attempting to remove a binding, we would look up the nsXBLPrototypeBinding via the nsXBLDocumentInfo that's being held within the nsXULPrototypeCache, find (or load off the disk) a _new_ nsXBLDocumentInfo and generate a _new_ nsXBLPrototypeBinding that did not match to the one that we'd already stored in the WeakMap. This would mean that removal would go wrong, and things would break horribly. This patch makes it so that we prioritize checking the nsBindingManager for a document for the nsXBLDocumentInfo before checking the global nsXULPrototypeCache. That way, even if the cache gets cleared, if the binding was ever used in this document, it'll be in the nsBindingManager, and we'll get the same nsXULProtoypeBinding that we'd been using before, and sanity will prevail. MozReview-Commit-ID: G8iLDbCPRAC --HG-- extra : rebase_source : 4322965c0b7150b22454651ad7a9461ee76d766b |
||
---|---|---|
.. | ||
builtin | ||
crashtests | ||
test | ||
XBLChildrenElement.cpp | ||
XBLChildrenElement.h | ||
moz.build | ||
nsBindingManager.cpp | ||
nsBindingManager.h | ||
nsXBLBinding.cpp | ||
nsXBLBinding.h | ||
nsXBLContentSink.cpp | ||
nsXBLContentSink.h | ||
nsXBLDocumentInfo.cpp | ||
nsXBLDocumentInfo.h | ||
nsXBLEventHandler.cpp | ||
nsXBLEventHandler.h | ||
nsXBLMaybeCompiled.h | ||
nsXBLProtoImpl.cpp | ||
nsXBLProtoImpl.h | ||
nsXBLProtoImplField.cpp | ||
nsXBLProtoImplField.h | ||
nsXBLProtoImplMember.h | ||
nsXBLProtoImplMethod.cpp | ||
nsXBLProtoImplMethod.h | ||
nsXBLProtoImplProperty.cpp | ||
nsXBLProtoImplProperty.h | ||
nsXBLPrototypeBinding.cpp | ||
nsXBLPrototypeBinding.h | ||
nsXBLPrototypeHandler.cpp | ||
nsXBLPrototypeHandler.h | ||
nsXBLPrototypeResources.cpp | ||
nsXBLPrototypeResources.h | ||
nsXBLResourceLoader.cpp | ||
nsXBLResourceLoader.h | ||
nsXBLSerialize.cpp | ||
nsXBLSerialize.h | ||
nsXBLService.cpp | ||
nsXBLService.h | ||
nsXBLWindowKeyHandler.cpp | ||
nsXBLWindowKeyHandler.h |