Index: third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinker.cpp |
diff --git a/third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinker.cpp b/third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinker.cpp |
index baceb7eedd23f10e52a9ea52e7ffd19e0cf300e0..fec4cbeb6764eb3d0477452a0b82dfb205d38850 100644 |
--- a/third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinker.cpp |
+++ b/third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinker.cpp |
@@ -376,6 +376,13 @@ void ModuleTreeLinker::Instantiate() { |
// https://html.spec.whatwg.org/multipage/webappapis.html#internal-module-script-graph-fetching-procedure |
+ // [nospec] Abort the steps if the browsing context is discarded. |
+ if (!modulator_->HasValidContext()) { |
+ descendants_module_script_ = nullptr; |
+ AdvanceState(State::kFinished); |
+ return; |
+ } |
+ |
// Step 5. Let instantiationStatus be null. |
// Note: The |error| variable corresponds to spec variable |
// "instantiationStatus". If |error| is empty, it indicates successful |