Index: extensions/renderer/module_system.cc |
diff --git a/extensions/renderer/module_system.cc b/extensions/renderer/module_system.cc |
index 5a180b458583040c3ee433656abb7b1df74f3f89..eebc451a89ed21230063ddd87646cfbb29adcb39 100644 |
--- a/extensions/renderer/module_system.cc |
+++ b/extensions/renderer/module_system.cc |
@@ -657,17 +657,20 @@ v8::Handle<v8::Value> ModuleSystem::LoadModule(const std::string& module_name) { |
void ModuleSystem::OnDidAddPendingModule( |
const std::string& id, |
const std::vector<std::string>& dependencies) { |
- if (!source_map_->Contains(id)) |
- return; |
+ bool module_system_managed = source_map_->Contains(id); |
gin::ModuleRegistry* registry = |
gin::ModuleRegistry::From(context_->v8_context()); |
DCHECK(registry); |
- for (std::vector<std::string>::const_iterator it = dependencies.begin(); |
- it != dependencies.end(); |
- ++it) { |
- if (registry->available_modules().count(*it) == 0) |
- LoadModule(*it); |
+ for (const auto& dependency : dependencies) { |
+ // If a dependency is not available and either the module being loaded or |
+ // the particular dependency is one loaded by ModuleSystem, attempt to load |
not at google - send to devlin
2015/01/13 21:46:46
first part is a little hard to parse - I eventuall
Sam McNally
2015/01/13 23:48:43
Done.
|
+ // it. Ignore other dependencies; the module requesting them should be |
not at google - send to devlin
2015/01/13 21:46:46
could you mention what these other dependencies mi
Sam McNally
2015/01/13 23:48:43
Done.
|
+ // ensuring that its module's dependencies are available. |
+ if (registry->available_modules().count(dependency) == 0 && |
+ (module_system_managed || source_map_->Contains(dependency))) { |
+ LoadModule(dependency); |
+ } |
} |
registry->AttemptToLoadMoreModules(GetIsolate()); |
} |