Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinker.cpp

Issue 2886593002: [ES6 modules] ModuleTreeLinker::Instantiate shouldn't proceed on invalid context (Closed)
Patch Set: hasvalidcontxt Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/loader/modulescript/ModuleTreeLinker.h" 5 #include "core/loader/modulescript/ModuleTreeLinker.h"
6 6
7 #include "bindings/core/v8/ScriptModule.h" 7 #include "bindings/core/v8/ScriptModule.h"
8 #include "core/dom/AncestorList.h" 8 #include "core/dom/AncestorList.h"
9 #include "core/dom/ModuleScript.h" 9 #include "core/dom/ModuleScript.h"
10 #include "core/loader/modulescript/ModuleScriptFetchRequest.h" 10 #include "core/loader/modulescript/ModuleScriptFetchRequest.h"
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 Instantiate(); 369 Instantiate();
370 } 370 }
371 } 371 }
372 372
373 void ModuleTreeLinker::Instantiate() { 373 void ModuleTreeLinker::Instantiate() {
374 CHECK(module_script_); 374 CHECK(module_script_);
375 AdvanceState(State::kInstantiating); 375 AdvanceState(State::kInstantiating);
376 376
377 // https://html.spec.whatwg.org/multipage/webappapis.html#internal-module-scri pt-graph-fetching-procedure 377 // https://html.spec.whatwg.org/multipage/webappapis.html#internal-module-scri pt-graph-fetching-procedure
378 378
379 // [nospec] Abort the steps if the browsing context is discarded.
380 if (!modulator_->HasValidContext()) {
381 descendants_module_script_ = nullptr;
382 AdvanceState(State::kFinished);
383 return;
384 }
385
379 // Step 5. Let instantiationStatus be null. 386 // Step 5. Let instantiationStatus be null.
380 // Note: The |error| variable corresponds to spec variable 387 // Note: The |error| variable corresponds to spec variable
381 // "instantiationStatus". If |error| is empty, it indicates successful 388 // "instantiationStatus". If |error| is empty, it indicates successful
382 // completion. 389 // completion.
383 ScriptValue error; 390 ScriptValue error;
384 391
385 // Step 6. If result's instantiation state is "errored",... 392 // Step 6. If result's instantiation state is "errored",...
386 if (module_script_->InstantiationState() == 393 if (module_script_->InstantiationState() ==
387 ModuleInstantiationState::kErrored) { 394 ModuleInstantiationState::kErrored) {
388 // ... Set instantiationStatus to record.ModuleDeclarationInstantiation(). 395 // ... Set instantiationStatus to record.ModuleDeclarationInstantiation().
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 HeapHashSet<Member<ModuleScript>> uninstantiated_set; 519 HeapHashSet<Member<ModuleScript>> uninstantiated_set;
513 for (const auto& script : inclusive_descendants) { 520 for (const auto& script : inclusive_descendants) {
514 if (script->InstantiationState() == 521 if (script->InstantiationState() ==
515 ModuleInstantiationState::kUninstantiated) 522 ModuleInstantiationState::kUninstantiated)
516 uninstantiated_set.insert(script); 523 uninstantiated_set.insert(script);
517 } 524 }
518 return uninstantiated_set; 525 return uninstantiated_set;
519 } 526 }
520 527
521 } // namespace blink 528 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/ModulatorImpl.cpp ('k') | third_party/WebKit/Source/core/testing/DummyModulator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698