зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1524106 - Disconnect l10n root when destroying the document. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D18774 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
9719483cc6
Коммит
aee876626a
|
@ -7498,6 +7498,10 @@ void Document::Destroy() {
|
|||
|
||||
mIsGoingAway = true;
|
||||
|
||||
if (mDocumentL10n) {
|
||||
mDocumentL10n->Destroy();
|
||||
}
|
||||
|
||||
ScriptLoader()->Destroy();
|
||||
SetScriptGlobalObject(nullptr);
|
||||
RemovedFromDocShell();
|
||||
|
|
|
@ -112,6 +112,15 @@ bool DocumentL10n::Init(nsTArray<nsString>& aResourceIds) {
|
|||
return true;
|
||||
}
|
||||
|
||||
void DocumentL10n::Destroy() {
|
||||
if (mDOMLocalization) {
|
||||
Element* elem = mDocument->GetDocumentElement();
|
||||
if (elem) {
|
||||
mDOMLocalization->DisconnectRoot(elem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JSObject* DocumentL10n::WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aGivenProto) {
|
||||
return DocumentL10n_Binding::Wrap(aCx, this, aGivenProto);
|
||||
|
|
|
@ -65,6 +65,7 @@ class DocumentL10n final : public nsWrapperCache {
|
|||
public:
|
||||
explicit DocumentL10n(Document* aDocument);
|
||||
bool Init(nsTArray<nsString>& aResourceIds);
|
||||
void Destroy();
|
||||
|
||||
protected:
|
||||
virtual ~DocumentL10n();
|
||||
|
|
|
@ -24,6 +24,7 @@ interface mozIDOMLocalization : nsISupports
|
|||
Promise translateElements(in Array<Element> aElements);
|
||||
|
||||
void connectRoot(in Element aElement);
|
||||
void disconnectRoot(in Element aElement);
|
||||
Promise translateRoots();
|
||||
readonly attribute Promise ready;
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче