mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-04 19:33:18 +00:00
Bug 1081453 - SessionHistory should not keep alive the DOM file objects, r=smaug
This commit is contained in:
parent
c980c9545a
commit
3cdd90a43f
@ -385,7 +385,6 @@ skip-if = buildapp == 'b2g' || toolkit == 'android' || (os == 'linux' && debug &
|
||||
[test_bug340571.html]
|
||||
[test_bug343596.html]
|
||||
[test_bug345339.html]
|
||||
skip-if = e10s # Bug 1081453 - shutdown leaks with e10s and WebIDL dom::File
|
||||
[test_bug346485.html]
|
||||
[test_bug352728.html]
|
||||
[test_bug352728.xhtml]
|
||||
|
@ -236,13 +236,15 @@ class HTMLInputElementState MOZ_FINAL : public nsISupports
|
||||
mValue = aValue;
|
||||
}
|
||||
|
||||
const nsTArray<nsRefPtr<File>>& GetFiles() {
|
||||
return mFiles;
|
||||
const nsTArray<nsRefPtr<FileImpl>>& GetFileImpls() {
|
||||
return mFileImpls;
|
||||
}
|
||||
|
||||
void SetFiles(const nsTArray<nsRefPtr<File>>& aFiles) {
|
||||
mFiles.Clear();
|
||||
mFiles.AppendElements(aFiles);
|
||||
void SetFileImpls(const nsTArray<nsRefPtr<File>>& aFile) {
|
||||
mFileImpls.Clear();
|
||||
for (uint32_t i = 0, len = aFile.Length(); i < len; ++i) {
|
||||
mFileImpls.AppendElement(aFile[i]->Impl());
|
||||
}
|
||||
}
|
||||
|
||||
HTMLInputElementState()
|
||||
@ -255,7 +257,7 @@ class HTMLInputElementState MOZ_FINAL : public nsISupports
|
||||
~HTMLInputElementState() {}
|
||||
|
||||
nsString mValue;
|
||||
nsTArray<nsRefPtr<File>> mFiles;
|
||||
nsTArray<nsRefPtr<FileImpl>> mFileImpls;
|
||||
bool mChecked;
|
||||
bool mCheckedSet;
|
||||
};
|
||||
@ -5697,7 +5699,7 @@ HTMLInputElement::SaveState()
|
||||
case VALUE_MODE_FILENAME:
|
||||
if (!mFiles.IsEmpty()) {
|
||||
inputState = new HTMLInputElementState();
|
||||
inputState->SetFiles(mFiles);
|
||||
inputState->SetFileImpls(mFiles);
|
||||
}
|
||||
break;
|
||||
case VALUE_MODE_VALUE:
|
||||
@ -5900,7 +5902,17 @@ HTMLInputElement::RestoreState(nsPresState* aState)
|
||||
break;
|
||||
case VALUE_MODE_FILENAME:
|
||||
{
|
||||
const nsTArray<nsRefPtr<File>>& files = inputState->GetFiles();
|
||||
const nsTArray<nsRefPtr<FileImpl>>& fileImpls = inputState->GetFileImpls();
|
||||
|
||||
nsCOMPtr<nsIGlobalObject> global = OwnerDoc()->GetScopeObject();
|
||||
MOZ_ASSERT(global);
|
||||
|
||||
nsTArray<nsRefPtr<File>> files;
|
||||
for (uint32_t i = 0, len = fileImpls.Length(); i < len; ++i) {
|
||||
nsRefPtr<File> file = new File(global, fileImpls[i]);
|
||||
files.AppendElement(file);
|
||||
}
|
||||
|
||||
SetFiles(files, true);
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user