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

Unified Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2369853002: HTML parser: implementing throw-on-dynamic-markup-insertion counter (Closed)
Patch Set: copyright comment update Created 4 years, 3 months 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
Index: third_party/WebKit/Source/core/dom/Document.cpp
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index 9c107592c0d797f84dfe57c01071d5e9ee4248ec..c2c805ff2c05fad79f1ebf5f4377a9c562944a81 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -432,6 +432,7 @@ Document::Document(const DocumentInit& initializer, DocumentClassFlags documentC
, m_containsPlugins(false)
, m_updateFocusAppearanceSelectionBahavior(SelectionBehaviorOnFocus::Reset)
, m_ignoreDestructiveWriteCount(0)
+ , m_throwOnDynamicMarkupInsertionCount(0)
, m_markers(new DocumentMarkerController(*this))
, m_updateFocusAppearanceTimer(this, &Document::updateFocusAppearanceTimerFired)
, m_cssTarget(nullptr)
@@ -2393,6 +2394,11 @@ void Document::open(Document* enteredDocument, ExceptionState& exceptionState)
return;
}
+ if (m_throwOnDynamicMarkupInsertionCount) {
+ exceptionState.throwDOMException(InvalidStateError, "Custom Element constructor should not use open().");
+ return;
+ }
+
if (enteredDocument) {
if (!getSecurityOrigin()->canAccess(enteredDocument->getSecurityOrigin())) {
exceptionState.throwSecurityError("Can only call open() on same-origin documents.");
@@ -2590,6 +2596,11 @@ void Document::close(ExceptionState& exceptionState)
return;
}
+ if (m_throwOnDynamicMarkupInsertionCount) {
+ exceptionState.throwDOMException(InvalidStateError, "Custom Element constructor should not use close().");
+ return;
+ }
+
close();
}
@@ -2853,6 +2864,11 @@ void Document::write(const SegmentedString& text, Document* enteredDocument, Exc
return;
}
+ if (m_throwOnDynamicMarkupInsertionCount) {
+ exceptionState.throwDOMException(InvalidStateError, "Custom Element constructor should not use write().");
+ return;
+ }
+
if (enteredDocument && !getSecurityOrigin()->canAccess(enteredDocument->getSecurityOrigin())) {
exceptionState.throwSecurityError("Can only call write() on same-origin documents.");
return;

Powered by Google App Engine
This is Rietveld 408576698