mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Don't crash when importing a 404
Now we have a test for this case. R=esprehn@chromium.org Review URL: https://codereview.chromium.org/682913002
This commit is contained in:
parent
de93d90cda
commit
c198c32164
@ -353,7 +353,10 @@ void ScriptController::executeModuleScript(Document& document, const String& sou
|
||||
String name = link->as();
|
||||
if (!name.isEmpty()) {
|
||||
module.formalDependenciesAndSource.append(v8String(m_isolate, name));
|
||||
module.resolvedDependencies.append(child->document() ? child->document()->exports().v8Value() : v8Undefined());
|
||||
v8::Handle<v8::Value> actual = v8::Undefined(m_isolate);
|
||||
if (child->document())
|
||||
actual = child->document()->exports().v8Value();
|
||||
module.resolvedDependencies.append(actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -121,8 +121,10 @@ void HTMLImportLoader::setState(State state)
|
||||
|
||||
m_state = state;
|
||||
|
||||
if (m_state == StateParsed || m_state == StateError || m_state == StateWritten)
|
||||
m_document->cancelParsing();
|
||||
if (m_state == StateParsed || m_state == StateError || m_state == StateWritten) {
|
||||
if (m_document)
|
||||
m_document->cancelParsing();
|
||||
}
|
||||
|
||||
// Since DocumentWriter::end() can let setState() reenter, we shouldn't refer to m_state here.
|
||||
if (state == StateLoaded || state == StateError)
|
||||
|
||||
1
tests/modules/imports-can-load-404s-expected.txt
Normal file
1
tests/modules/imports-can-load-404s-expected.txt
Normal file
@ -0,0 +1 @@
|
||||
PASS
|
||||
9
tests/modules/imports-can-load-404s.html
Normal file
9
tests/modules/imports-can-load-404s.html
Normal file
@ -0,0 +1,9 @@
|
||||
<html>
|
||||
<link rel="import" href="resources/does-not-exist.html" as="hello" />
|
||||
<link rel="import" href="../resources/dump-as-text.html" />
|
||||
<div id="result">FAIL - Script did not execute</div>
|
||||
<script>
|
||||
document.getElementById("result").textContent =
|
||||
hello === undefined ? "PASS" : "FAIL";
|
||||
</script>
|
||||
</html>
|
||||
Loading…
x
Reference in New Issue
Block a user