Title: [205106] trunk/Source
Revision
205106
Author
akl...@apple.com
Date
2016-08-28 15:38:41 -0700 (Sun, 28 Aug 2016)

Log Message

document.title setter can't throw.
<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:]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (205105 => 205106)


--- trunk/Source/WebCore/ChangeLog	2016-08-28 17:36:05 UTC (rev 205105)
+++ trunk/Source/WebCore/ChangeLog	2016-08-28 22:38:41 UTC (rev 205106)
@@ -1,3 +1,23 @@
+2016-08-28  Andreas Kling  <akl...@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  <fw...@igalia.com>
 
         MathML renderers should use struct to pass long list of LayoutUnits

Modified: trunk/Source/WebCore/dom/Document.cpp (205105 => 205106)


--- trunk/Source/WebCore/dom/Document.cpp	2016-08-28 17:36:05 UTC (rev 205105)
+++ trunk/Source/WebCore/dom/Document.cpp	2016-08-28 22:38:41 UTC (rev 205106)
@@ -1631,7 +1631,7 @@
     }
 }
 
-void Document::setTitle(const String& title, ExceptionCode& ec)
+void Document::setTitle(const String& title)
 {
     if (!m_titleElement) {
         if (isHTMLDocument() || isXHTMLDocument()) {
@@ -1654,9 +1654,9 @@
     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)

Modified: trunk/Source/WebCore/dom/Document.h (205105 => 205106)


--- trunk/Source/WebCore/dom/Document.h	2016-08-28 17:36:05 UTC (rev 205105)
+++ trunk/Source/WebCore/dom/Document.h	2016-08-28 22:38:41 UTC (rev 205106)
@@ -857,7 +857,7 @@
 
     // 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&);

Modified: trunk/Source/WebCore/dom/Document.idl (205105 => 205106)


--- trunk/Source/WebCore/dom/Document.idl	2016-08-28 17:36:05 UTC (rev 205105)
+++ trunk/Source/WebCore/dom/Document.idl	2016-08-28 22:38:41 UTC (rev 205106)
@@ -115,7 +115,7 @@
     boolean queryCommandSupported(DOMString command);
     DOMString queryCommandValue(DOMString command);
 
-    [SetterRaisesException] attribute DOMString title;
+    attribute DOMString title;
     attribute DOMString dir;
     attribute DOMString designMode;
 

Modified: trunk/Source/WebCore/html/ImageDocument.cpp (205105 => 205106)


--- trunk/Source/WebCore/html/ImageDocument.cpp	2016-08-28 17:36:05 UTC (rev 205105)
+++ trunk/Source/WebCore/html/ImageDocument.cpp	2016-08-28 22:38:41 UTC (rev 205106)
@@ -164,7 +164,7 @@
             String name = decodeURLEscapeSequences(url().lastPathComponent());
             if (name.isEmpty())
                 name = url().host();
-            setTitle(imageTitle(name, size), IGNORE_EXCEPTION);
+            setTitle(imageTitle(name, size));
         }
 
         imageUpdated();

Modified: trunk/Source/WebKit/mac/ChangeLog (205105 => 205106)


--- trunk/Source/WebKit/mac/ChangeLog	2016-08-28 17:36:05 UTC (rev 205105)
+++ trunk/Source/WebKit/mac/ChangeLog	2016-08-28 22:38:41 UTC (rev 205106)
@@ -1,5 +1,15 @@
 2016-08-28  Andreas Kling  <akl...@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  <akl...@apple.com>
+
         Clean up some .text attribute setters that don't throw.
         <https://webkit.org/b/161292>
 

Modified: trunk/Source/WebKit/mac/DOM/DOMDocument.mm (205105 => 205106)


--- trunk/Source/WebKit/mac/DOM/DOMDocument.mm	2016-08-28 17:36:05 UTC (rev 205105)
+++ trunk/Source/WebKit/mac/DOM/DOMDocument.mm	2016-08-28 22:38:41 UTC (rev 205106)
@@ -191,9 +191,7 @@
 - (void)setTitle:(NSString *)newTitle
 {
     WebCore::JSMainThreadNullState state;
-    WebCore::ExceptionCode ec = 0;
-    IMPL->setTitle(newTitle, ec);
-    raiseOnDOMError(ec);
+    IMPL->setTitle(newTitle);
 }
 
 - (NSString *)dir
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to