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

Unified Diff: third_party/WebKit/Source/core/html/parser/HTMLViewSourceParserTest.cpp

Issue 2537043002: After detach, there's no document to notify parsing is finished. (Closed)
Patch Set: Feedback. Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/html/parser/HTMLViewSourceParser.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/parser/HTMLViewSourceParserTest.cpp
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLViewSourceParserTest.cpp b/third_party/WebKit/Source/core/html/parser/HTMLViewSourceParserTest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..bc1c8ae3d1ff2ae2eb6c4169f4580c49131e5834
--- /dev/null
+++ b/third_party/WebKit/Source/core/html/parser/HTMLViewSourceParserTest.cpp
@@ -0,0 +1,29 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "core/html/parser/HTMLViewSourceParser.h"
+
+#include "core/dom/DocumentInit.h"
+#include "core/dom/DocumentParser.h"
+#include "core/html/HTMLViewSourceDocument.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "wtf/text/WTFString.h"
+
+namespace blink {
+
+// This is a regression test for https://crbug.com/664915
+TEST(HTMLViewSourceParserTest, DetachThenFinish_ShouldNotCrash) {
+ String mimeType("text/html");
+ HTMLViewSourceDocument* document =
+ HTMLViewSourceDocument::create(DocumentInit(), mimeType);
+ HTMLViewSourceParser* parser =
+ HTMLViewSourceParser::create(*document, mimeType);
+ // A client may detach the parser from the document.
+ parser->detach();
+ // A DocumentWriter may call finish() after detach().
+ static_cast<DocumentParser*>(parser)->finish();
+ // The test passed if finish did not crash.
+}
+
+} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/html/parser/HTMLViewSourceParser.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698