提交 f3e367c3 编写于 作者: A Adam Barth

Don't crash when importing a module that doesn't export

Instead of crashing, we should use the value "undefined". There's some question
as to whether we should default to the document, but we can resolve that later.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/690483002
上级 f11504f4
......@@ -353,9 +353,11 @@ void ScriptController::executeModuleScript(Document& document, const String& sou
String name = link->as();
if (!name.isEmpty()) {
module.formalDependenciesAndSource.append(v8String(m_isolate, name));
v8::Handle<v8::Value> actual = v8::Undefined(m_isolate);
v8::Handle<v8::Value> actual;
if (child->document())
actual = child->document()->exports().v8Value();
if (actual.IsEmpty())
actual = v8::Undefined(m_isolate);
module.resolvedDependencies.append(actual);
}
}
......
<html>
<link rel="import" href="resources/does-not-export.sky" as="hello" />
<link rel="import" href="../resources/dump-as-text.sky" />
<div id="result">FAIL - Script did not execute</div>
<script>
document.getElementById("result").textContent =
hello === undefined ? "PASS" : "FAIL";
</script>
</html>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册