File tree Expand file tree Collapse file tree 3 files changed +23
-1
lines changed
Userland/Libraries/LibWeb Expand file tree Collapse file tree 3 files changed +23
-1
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright (c) 2018-2023 , Andreas Kling <kling@serenityos.org>
2
+ * Copyright (c) 2018-2024 , Andreas Kling <kling@serenityos.org>
3
3
* Copyright (c) 2021-2023, Linus Groh <linusg@serenityos.org>
4
4
* Copyright (c) 2021-2023, Luke Wilde <lukew@serenityos.org>
5
5
* Copyright (c) 2021-2023, Sam Atkins <atkinssj@serenityos.org>
52
52
#include < LibWeb/DOM/Text.h>
53
53
#include < LibWeb/DOM/TreeWalker.h>
54
54
#include < LibWeb/Dump.h>
55
+ #include < LibWeb/FileAPI/BlobURLStore.h>
55
56
#include < LibWeb/HTML/AttributeNames.h>
56
57
#include < LibWeb/HTML/BrowsingContext.h>
57
58
#include < LibWeb/HTML/CustomElements/CustomElementDefinition.h>
@@ -2988,6 +2989,8 @@ void Document::run_unloading_cleanup_steps()
2988
2989
// 2. Clear window's map of active timers.
2989
2990
window->clear_map_of_active_timers ();
2990
2991
}
2992
+
2993
+ FileAPI::run_unloading_cleanup_steps (*this );
2991
2994
}
2992
2995
2993
2996
// https://html.spec.whatwg.org/multipage/document-lifecycle.html#destroy-a-document
Original file line number Diff line number Diff line change 1
1
/*
2
2
* Copyright (c) 2023, Tim Flynn <trflynn89@serenityos.org>
3
+ * Copyright (c) 2024, Andreas Kling <kling@serenityos.org>
3
4
*
4
5
* SPDX-License-Identifier: BSD-2-Clause
5
6
*/
6
7
7
8
#include < AK/StringBuilder.h>
8
9
#include < LibURL/URL.h>
9
10
#include < LibWeb/Crypto/Crypto.h>
11
+ #include < LibWeb/DOM/Document.h>
10
12
#include < LibWeb/FileAPI/Blob.h>
11
13
#include < LibWeb/FileAPI/BlobURLStore.h>
12
14
#include < LibWeb/HTML/Origin.h>
@@ -89,4 +91,19 @@ ErrorOr<void> remove_entry_from_blob_url_store(StringView url)
89
91
return {};
90
92
}
91
93
94
+ // https://w3c.github.io/FileAPI/#lifeTime
95
+ void run_unloading_cleanup_steps (JS::NonnullGCPtr<DOM::Document> document)
96
+ {
97
+ // 1. Let environment be the Document's relevant settings object.
98
+ auto & environment = document->relevant_settings_object ();
99
+
100
+ // 2. Let store be the user agent’s blob URL store;
101
+ auto & store = FileAPI::blob_url_store ();
102
+
103
+ // 3. Remove from store any entries for which the value's environment is equal to environment.
104
+ store.remove_all_matching ([&](auto &, auto & value) {
105
+ return value.environment == &environment;
106
+ });
107
+ }
108
+
92
109
}
Original file line number Diff line number Diff line change @@ -28,4 +28,6 @@ ErrorOr<String> generate_new_blob_url();
28
28
ErrorOr<String> add_entry_to_blob_url_store (JS::NonnullGCPtr<Blob> object);
29
29
ErrorOr<void > remove_entry_from_blob_url_store (StringView url);
30
30
31
+ void run_unloading_cleanup_steps (JS::NonnullGCPtr<DOM::Document>);
32
+
31
33
}
You can’t perform that action at this time.
0 commit comments