document.title setter can't throw.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 28 Aug 2016 22:38:41 +0000 (22:38 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 28 Aug 2016 22:38:41 +0000 (22:38 +0000)
<https://webkit.org/b/161302>

Reviewed by Antti Koivisto.

Source/WebCore:

Remove [SetterRaisesException] from document.title and replace
ExceptionCode propagation with ASSERT_NO_EXCEPTION.

Setting the .textContent of a SVGTitleElement or HTMLTitleElement
will never fail, so there's no exception to propagate.

* dom/Document.cpp:
(WebCore::Document::setTitle):
* dom/Document.h:
* dom/Document.idl:
* html/ImageDocument.cpp:
(WebCore::ImageDocument::finishedParsing):

Source/WebKit/mac:

* DOM/DOMDocument.mm:
(-[DOMDocument setTitle:]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205106 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/dom/Document.idl
Source/WebCore/html/ImageDocument.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/DOM/DOMDocument.mm

index fecad64..bbaf5fb 100644 (file)
@@ -1,3 +1,23 @@
+2016-08-28  Andreas Kling  <akling@apple.com>
+
+        document.title setter can't throw.
+        <https://webkit.org/b/161302>
+
+        Reviewed by Antti Koivisto.
+
+        Remove [SetterRaisesException] from document.title and replace
+        ExceptionCode propagation with ASSERT_NO_EXCEPTION.
+
+        Setting the .textContent of a SVGTitleElement or HTMLTitleElement
+        will never fail, so there's no exception to propagate.
+
+        * dom/Document.cpp:
+        (WebCore::Document::setTitle):
+        * dom/Document.h:
+        * dom/Document.idl:
+        * html/ImageDocument.cpp:
+        (WebCore::ImageDocument::finishedParsing):
+
 2016-08-23  Frederic Wang  <fwang@igalia.com>
 
         MathML renderers should use struct to pass long list of LayoutUnits
index 4d0308d..a16305c 100644 (file)
@@ -1631,7 +1631,7 @@ void Document::updateTitleFromTitleElement()
     }
 }
 
-void Document::setTitle(const String& title, ExceptionCode& ec)
+void Document::setTitle(const String& title)
 {
     if (!m_titleElement) {
         if (isHTMLDocument() || isXHTMLDocument()) {
@@ -1654,9 +1654,9 @@ void Document::setTitle(const String& title, ExceptionCode& ec)
     updateTitle(StringWithDirection(title, LTR));
 
     if (is<HTMLTitleElement>(m_titleElement.get()))
-        downcast<HTMLTitleElement>(*m_titleElement).setTextContent(title, ec);
+        downcast<HTMLTitleElement>(*m_titleElement).setTextContent(title, ASSERT_NO_EXCEPTION);
     else if (is<SVGTitleElement>(m_titleElement.get()))
-        downcast<SVGTitleElement>(*m_titleElement).setTextContent(title, ec);
+        downcast<SVGTitleElement>(*m_titleElement).setTextContent(title, ASSERT_NO_EXCEPTION);
 }
 
 void Document::updateTitleElement(Element* newTitleElement)
index 7e38d8f..8c155f1 100644 (file)
@@ -857,7 +857,7 @@ public:
 
     // Used by DOM bindings; no direction known.
     String title() const { return m_title.string(); }
-    WEBCORE_EXPORT void setTitle(const String&, ExceptionCode&);
+    WEBCORE_EXPORT void setTitle(const String&);
 
     WEBCORE_EXPORT const AtomicString& dir() const;
     WEBCORE_EXPORT void setDir(const AtomicString&);
index e018f59..9555621 100644 (file)
     boolean queryCommandSupported(DOMString command);
     DOMString queryCommandValue(DOMString command);
 
-    [SetterRaisesException] attribute DOMString title;
+    attribute DOMString title;
     attribute DOMString dir;
     attribute DOMString designMode;
 
index 5802ee8..7fd2c7c 100644 (file)
@@ -164,7 +164,7 @@ void ImageDocument::finishedParsing()
             String name = decodeURLEscapeSequences(url().lastPathComponent());
             if (name.isEmpty())
                 name = url().host();
-            setTitle(imageTitle(name, size), IGNORE_EXCEPTION);
+            setTitle(imageTitle(name, size));
         }
 
         imageUpdated();
index 875c27b..4cc17bc 100644 (file)
@@ -1,5 +1,15 @@
 2016-08-28  Andreas Kling  <akling@apple.com>
 
+        document.title setter can't throw.
+        <https://webkit.org/b/161302>
+
+        Reviewed by Antti Koivisto.
+
+        * DOM/DOMDocument.mm:
+        (-[DOMDocument setTitle:]):
+
+2016-08-28  Andreas Kling  <akling@apple.com>
+
         Clean up some .text attribute setters that don't throw.
         <https://webkit.org/b/161292>
 
index a9c3cd8..4cd9bfb 100644 (file)
 - (void)setTitle:(NSString *)newTitle
 {
     WebCore::JSMainThreadNullState state;
-    WebCore::ExceptionCode ec = 0;
-    IMPL->setTitle(newTitle, ec);
-    raiseOnDOMError(ec);
+    IMPL->setTitle(newTitle);
 }
 
 - (NSString *)dir