Index: third_party/WebKit/Source/core/html/parser/TextDocumentParser.cpp |
diff --git a/third_party/WebKit/Source/core/html/parser/TextDocumentParser.cpp b/third_party/WebKit/Source/core/html/parser/TextDocumentParser.cpp |
index d6b8d15d6675e0872b1f271291ad815c8f75dd62..bc1c0c3e143d2cc21802300edb04317cce9f2532 100644 |
--- a/third_party/WebKit/Source/core/html/parser/TextDocumentParser.cpp |
+++ b/third_party/WebKit/Source/core/html/parser/TextDocumentParser.cpp |
@@ -60,6 +60,8 @@ void TextDocumentParser::insertFakePreElement() |
attributes.append(Attribute(styleAttr, "word-wrap: break-word; white-space: pre-wrap;")); |
AtomicHTMLToken fakePre(HTMLToken::StartTag, preTag.localName(), attributes); |
treeBuilder()->constructTree(&fakePre); |
+ if (isStopped()) |
+ return; // The document could have been detached by an extension while the tree was being constructed. |
// Normally we would skip the first \n after a <pre> element, but we don't |
// want to skip the first \n for text documents! |