Upstream version 7.35.139.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / dom / Document.cpp
index adb5aa2..22aff80 100644 (file)
@@ -2615,11 +2615,6 @@ bool Document::shouldScheduleLayout() const
         || (documentElement() && !isHTMLHtmlElement(*documentElement()));
 }
 
-bool Document::shouldParserYieldAgressivelyBeforeScriptExecution()
-{
-    return view() && view()->layoutPending();
-}
-
 int Document::elapsedTime() const
 {
     return static_cast<int>((currentTime() - m_startTime) * 1000);
@@ -4333,11 +4328,21 @@ WeakPtr<Document> Document::contextDocument()
 
 PassRefPtr<Attr> Document::createAttribute(const AtomicString& name, ExceptionState& exceptionState)
 {
+    return createAttributeNS(nullAtom, name, exceptionState, true);
+}
+
+PassRefPtr<Attr> Document::createAttributeNS(const AtomicString& namespaceURI, const AtomicString& qualifiedName, ExceptionState& exceptionState, bool shouldIgnoreNamespaceChecks)
+{
     AtomicString prefix, localName;
-    if (!parseQualifiedName(name, prefix, localName, exceptionState))
+    if (!parseQualifiedName(qualifiedName, prefix, localName, exceptionState))
         return nullptr;
 
-    QualifiedName qName(prefix, localName, nullAtom);
+    QualifiedName qName(prefix, localName, namespaceURI);
+
+    if (!shouldIgnoreNamespaceChecks && !hasValidNamespaceForAttributes(qName)) {
+        exceptionState.throwDOMException(NamespaceError, "The namespace URI provided ('" + namespaceURI + "') is not valid for the qualified name provided ('" + qualifiedName + "').");
+        return nullptr;
+    }
 
     return Attr::create(*this, qName, emptyAtom);
 }