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

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

Issue 100433004: Sync Document.createProcessingInstruction() with spec (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: test createProcessingInstruction for HTML doc Created 7 years 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 | « LayoutTests/fast/dom/Node/script-tests/initial-values.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index 20ee2edf2273cb5b7fb53b7b724313f73a2807f8..3180abb3363abfc7cf8e52bfec79fc66010760de 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -787,7 +787,7 @@ PassRefPtr<CDATASection> Document::createCDATASection(const String& data, Except
exceptionState.throwUninformativeAndGenericDOMException(NotSupportedError);
return 0;
}
- if (data.find("]]>") != WTF::kNotFound) {
+ if (data.contains("]]>")) {
exceptionState.throwDOMException(InvalidCharacterError, "String cannot contain ']]>' since that is the end delimiter of a CData section.");
return 0;
}
@@ -797,11 +797,11 @@ PassRefPtr<CDATASection> Document::createCDATASection(const String& data, Except
PassRefPtr<ProcessingInstruction> Document::createProcessingInstruction(const String& target, const String& data, ExceptionState& exceptionState)
{
if (!isValidName(target)) {
- exceptionState.throwUninformativeAndGenericDOMException(InvalidCharacterError);
+ exceptionState.throwDOMException(InvalidCharacterError, "The target provided ('" + target + "') is not a valid name.");
return 0;
}
- if (isHTMLDocument()) {
- exceptionState.throwUninformativeAndGenericDOMException(NotSupportedError);
+ if (data.contains("?>")) {
+ exceptionState.throwDOMException(InvalidCharacterError, "The data provided ('" + data + "') contains '?>'.");
return 0;
}
return ProcessingInstruction::create(*this, target, data);
« no previous file with comments | « LayoutTests/fast/dom/Node/script-tests/initial-values.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698